LCOV - code coverage report
Current view: top level - sc/source/filter/inc - scenariobuffer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 5 20.0 %
Date: 2012-08-25 Functions: 2 9 22.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 6 16.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef OOX_XLS_SCENARIOBUFFER_HXX
      30                 :            : #define OOX_XLS_SCENARIOBUFFER_HXX
      31                 :            : 
      32                 :            : #include <com/sun/star/table/CellAddress.hpp>
      33                 :            : #include "oox/helper/refmap.hxx"
      34                 :            : #include "oox/helper/refvector.hxx"
      35                 :            : #include "workbookhelper.hxx"
      36                 :            : 
      37                 :            : namespace oox {
      38                 :            : namespace xls {
      39                 :            : 
      40                 :            : // ============================================================================
      41                 :            : 
      42                 :          0 : struct ScenarioCellModel
      43                 :            : {
      44                 :            :     ::com::sun::star::table::CellAddress maPos;
      45                 :            :     ::rtl::OUString     maValue;
      46                 :            :     sal_Int32           mnNumFmtId;
      47                 :            :     bool                mbDeleted;
      48                 :            : 
      49                 :            :     explicit            ScenarioCellModel();
      50                 :            : };
      51                 :            : 
      52                 :            : // ----------------------------------------------------------------------------
      53                 :            : 
      54                 :          0 : struct ScenarioModel
      55                 :            : {
      56                 :            :     ::rtl::OUString     maName;             /// Name of the scenario.
      57                 :            :     ::rtl::OUString     maComment;          /// Comment.
      58                 :            :     ::rtl::OUString     maUser;             /// Name of user created the scenario.
      59                 :            :     bool                mbLocked;           /// True = input cell values locked.
      60                 :            :     bool                mbHidden;           /// True = scenario is hidden.
      61                 :            : 
      62                 :            :     explicit            ScenarioModel();
      63                 :            : };
      64                 :            : 
      65                 :            : // ----------------------------------------------------------------------------
      66                 :            : 
      67         [ #  # ]:          0 : class Scenario : public WorkbookHelper
      68                 :            : {
      69                 :            : public:
      70                 :            :     explicit            Scenario( const WorkbookHelper& rHelper, sal_Int16 nSheet );
      71                 :            : 
      72                 :            :     /** Imports a scenario definition from a scenario element. */
      73                 :            :     void                importScenario( const AttributeList& rAttribs );
      74                 :            :     /** Imports a new cell for this scenario from a inputCells element. */
      75                 :            :     void                importInputCells( const AttributeList& rAttribs );
      76                 :            : 
      77                 :            :     /** Imports a scenario definition from a SCENARIO record. */
      78                 :            :     void                importScenario( SequenceInputStream& rStrm );
      79                 :            :     /** Imports a new cell for this scenario from a INPUTCELLS record. */
      80                 :            :     void                importInputCells( SequenceInputStream& rStrm );
      81                 :            : 
      82                 :            :     /** Creates the scenario in the Calc document. */
      83                 :            :     void                finalizeImport();
      84                 :            : 
      85                 :            : private:
      86                 :            :     typedef ::std::vector< ScenarioCellModel > ScenarioCellVector;
      87                 :            : 
      88                 :            :     ScenarioCellVector  maCells;            /// Scenario cells.
      89                 :            :     ScenarioModel       maModel;            /// Scenario model data.
      90                 :            :     sal_Int16           mnSheet;            /// Index of the sheet this scenario is based on.
      91                 :            : };
      92                 :            : 
      93                 :            : // ============================================================================
      94                 :            : 
      95                 :            : struct SheetScenariosModel
      96                 :            : {
      97                 :            :     sal_Int32           mnCurrent;          /// Selected scenario.
      98                 :            :     sal_Int32           mnShown;            /// Visible scenario.
      99                 :            : 
     100                 :            :     explicit            SheetScenariosModel();
     101                 :            : };
     102                 :            : 
     103                 :            : // ----------------------------------------------------------------------------
     104                 :            : 
     105         [ #  # ]:          0 : class SheetScenarios : public WorkbookHelper
     106                 :            : {
     107                 :            : public:
     108                 :            :     explicit            SheetScenarios( const WorkbookHelper& rHelper, sal_Int16 nSheet );
     109                 :            : 
     110                 :            :     /** Imports sheet scenario settings from a scenarios element. */
     111                 :            :     void                importScenarios( const AttributeList& rAttribs );
     112                 :            :     /** Imports sheet scenario settings from a SCENARIOS record. */
     113                 :            :     void                importScenarios( SequenceInputStream& rStrm );
     114                 :            : 
     115                 :            :     /** Creates and returns a new scenario in this collection. */
     116                 :            :     Scenario&           createScenario();
     117                 :            : 
     118                 :            :     /** Creates all scenarios in the Calc sheet. */
     119                 :            :     void                finalizeImport();
     120                 :            : 
     121                 :            : private:
     122                 :            :     typedef RefVector< Scenario > ScenarioVector;
     123                 :            :     ScenarioVector      maScenarios;
     124                 :            :     SheetScenariosModel maModel;
     125                 :            :     sal_Int16           mnSheet;
     126                 :            : };
     127                 :            : 
     128                 :            : // ============================================================================
     129                 :            : 
     130         [ -  + ]:         48 : class ScenarioBuffer : public WorkbookHelper
     131                 :            : {
     132                 :            : public:
     133                 :            :     explicit            ScenarioBuffer( const WorkbookHelper& rHelper );
     134                 :            : 
     135                 :            :     /** Creates and returns a scenario collection for the passed sheet. */
     136                 :            :     SheetScenarios&     createSheetScenarios( sal_Int16 nSheet );
     137                 :            : 
     138                 :            :     /** Creates all scenarios in the Calc document. */
     139                 :            :     void                finalizeImport();
     140                 :            : 
     141                 :            : private:
     142                 :            :     typedef RefMap< sal_Int16, SheetScenarios, ::std::greater< sal_Int16 > > SheetScenariosMap;
     143                 :            :     SheetScenariosMap   maSheetScenarios;
     144                 :            : };
     145                 :            : 
     146                 :            : // ============================================================================
     147                 :            : 
     148                 :            : } // namespace xls
     149                 :            : } // namespace oox
     150                 :            : 
     151                 :            : #endif
     152                 :            : 
     153                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10