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

           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_WORKSHEETBUFFER_HXX
      30                 :            : #define OOX_XLS_WORKSHEETBUFFER_HXX
      31                 :            : 
      32                 :            : #include <utility>
      33                 :            : #include "oox/helper/refmap.hxx"
      34                 :            : #include "oox/helper/refvector.hxx"
      35                 :            : #include "workbookhelper.hxx"
      36                 :            : 
      37                 :            : namespace com { namespace sun { namespace star {
      38                 :            :     namespace i18n { class XCharacterClassification; }
      39                 :            : } } }
      40                 :            : 
      41                 :            : namespace oox {
      42                 :            : namespace xls {
      43                 :            : 
      44                 :            : // ============================================================================
      45                 :            : 
      46                 :            : /** Contains data from the 'sheet' element describing a sheet in the workbook. */
      47                 :        180 : struct SheetInfoModel
      48                 :            : {
      49                 :            :     ::rtl::OUString     maRelId;        /// Relation identifier for the sheet substream.
      50                 :            :     ::rtl::OUString     maName;         /// Original name of the sheet.
      51                 :            :     sal_Int64           mnBiffHandle;   /// BIFF record handle of the sheet substream.
      52                 :            :     sal_Int32           mnSheetId;      /// Sheet identifier.
      53                 :            :     sal_Int32           mnState;        /// Visibility state.
      54                 :            : 
      55                 :            :     explicit            SheetInfoModel();
      56                 :            : };
      57                 :            : 
      58                 :            : // ============================================================================
      59                 :            : 
      60                 :            : /** Stores information about all sheets in a spreadsheet document.
      61                 :            : 
      62                 :            :     Information about sheets includes the sheet name, the visibility state, and
      63                 :            :     for the OOXML filter, the relation identifier of the sheet used to obtain
      64                 :            :     the related worksheet fragment.
      65                 :            :  */
      66         [ -  + ]:         48 : class WorksheetBuffer : public WorkbookHelper
      67                 :            : {
      68                 :            : public:
      69                 :            :     explicit            WorksheetBuffer( const WorkbookHelper& rHelper );
      70                 :            : 
      71                 :            :     /** Imports the attributes of a sheet element. */
      72                 :            :     void                importSheet( const AttributeList& rAttribs );
      73                 :            :     /** Imports the SHEET record from the passed BIFF12 stream. */
      74                 :            :     void                importSheet( SequenceInputStream& rStrm );
      75                 :            :     /** Inserts a new empty sheet into the document. Looks for an unused name.
      76                 :            :          @return  Index of the new sheet in the Calc document. */
      77                 :            :     sal_Int16           insertEmptySheet( const ::rtl::OUString& rPreferredName, bool bVisible );
      78                 :            : 
      79                 :            :     /** Returns the number of original sheets contained in the workbook. */
      80                 :            :     sal_Int32           getWorksheetCount() const;
      81                 :            :     /** Returns the OOXML relation identifier of the specified worksheet. */
      82                 :            :     ::rtl::OUString     getWorksheetRelId( sal_Int32 nWorksheet ) const;
      83                 :            : 
      84                 :            :     /** Returns the Calc index of the specified worksheet. */
      85                 :            :     sal_Int16           getCalcSheetIndex( sal_Int32 nWorksheet ) const;
      86                 :            :     /** Returns the finalized name of the specified worksheet. */
      87                 :            :     ::rtl::OUString     getCalcSheetName( sal_Int32 nWorksheet ) const;
      88                 :            : 
      89                 :            :     /** Returns the Calc index of the sheet with the passed original worksheet name. */
      90                 :            :     sal_Int16           getCalcSheetIndex( const ::rtl::OUString& rWorksheetName ) const;
      91                 :            :     /** Returns the finalized name of the sheet with the passed worksheet name. */
      92                 :            :     ::rtl::OUString     getCalcSheetName( const ::rtl::OUString& rWorksheetName ) const;
      93                 :            : 
      94                 :            : private:
      95                 :         60 :     struct SheetInfo : public SheetInfoModel
      96                 :            :     {
      97                 :            :         ::rtl::OUString     maCalcName;
      98                 :            :         ::rtl::OUString     maCalcQuotedName;
      99                 :            :         sal_Int16           mnCalcSheet;
     100                 :            : 
     101                 :            :         explicit            SheetInfo( const SheetInfoModel& rModel, sal_Int16 nCalcSheet, const ::rtl::OUString& rCalcName );
     102                 :            :     };
     103                 :            : 
     104                 :            :     typedef ::std::pair< sal_Int16, ::rtl::OUString > IndexNamePair;
     105                 :            : 
     106                 :            :     /** Creates a new sheet in the Calc document. Does not insert anything in the own lists. */
     107                 :            :     IndexNamePair       createSheet( const ::rtl::OUString& rPreferredName, sal_Int32 nSheetPos, bool bVisible );
     108                 :            :     /** Creates a new sheet in the Calc document and inserts the related SheetInfo. */
     109                 :            :     void                insertSheet( const SheetInfoModel& rModel );
     110                 :            : 
     111                 :            : private:
     112                 :            :     typedef RefVector< SheetInfo > SheetInfoVector;
     113                 :            :     SheetInfoVector     maSheetInfos;
     114                 :            : 
     115                 :            :     typedef RefMap< ::rtl::OUString, SheetInfo, IgnoreCaseCompare > SheetInfoMap;
     116                 :            :     SheetInfoMap        maSheetInfosByName;
     117                 :            : };
     118                 :            : 
     119                 :            : // ============================================================================
     120                 :            : 
     121                 :            : } // namespace xls
     122                 :            : } // namespace oox
     123                 :            : 
     124                 :            : #endif
     125                 :            : 
     126                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10