LCOV - code coverage report
Current view: top level - sc/source/filter/inc - worksheetbuffer.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 3 0.0 %
Date: 2014-04-14 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef OOX_XLS_WORKSHEETBUFFER_HXX
      21             : #define OOX_XLS_WORKSHEETBUFFER_HXX
      22             : 
      23             : #include <utility>
      24             : #include "oox/helper/refmap.hxx"
      25             : #include "oox/helper/refvector.hxx"
      26             : #include "workbookhelper.hxx"
      27             : 
      28             : namespace com { namespace sun { namespace star {
      29             :     namespace i18n { class XCharacterClassification; }
      30             : } } }
      31             : 
      32             : namespace oox {
      33             : namespace xls {
      34             : 
      35             : /** Contains data from the 'sheet' element describing a sheet in the workbook. */
      36           0 : struct SheetInfoModel
      37             : {
      38             :     OUString     maRelId;        /// Relation identifier for the sheet substream.
      39             :     OUString     maName;         /// Original name of the sheet.
      40             :     sal_Int64           mnBiffHandle;   /// BIFF record handle of the sheet substream.
      41             :     sal_Int32           mnSheetId;      /// Sheet identifier.
      42             :     sal_Int32           mnState;        /// Visibility state.
      43             : 
      44             :     explicit            SheetInfoModel();
      45             : };
      46             : 
      47             : /** Stores information about all sheets in a spreadsheet document.
      48             : 
      49             :     Information about sheets includes the sheet name, the visibility state, and
      50             :     for the OOXML filter, the relation identifier of the sheet used to obtain
      51             :     the related worksheet fragment.
      52             :  */
      53           0 : class WorksheetBuffer : public WorkbookHelper
      54             : {
      55             : public:
      56             :     explicit            WorksheetBuffer( const WorkbookHelper& rHelper );
      57             : 
      58             :     /** Imports the attributes of a sheet element. */
      59             :     void                importSheet( const AttributeList& rAttribs );
      60             :     /** Imports the SHEET record from the passed BIFF12 stream. */
      61             :     void                importSheet( SequenceInputStream& rStrm );
      62             :     /** Inserts a new empty sheet into the document. Looks for an unused name.
      63             :          @return  Index of the new sheet in the Calc document. */
      64             :     sal_Int16           insertEmptySheet( const OUString& rPreferredName, bool bVisible );
      65             : 
      66             :     /** Returns the number of original sheets contained in the workbook. */
      67             :     sal_Int32           getWorksheetCount() const;
      68             :     /** Returns the OOXML relation identifier of the specified worksheet. */
      69             :     OUString     getWorksheetRelId( sal_Int32 nWorksheet ) const;
      70             : 
      71             :     /** Returns the Calc index of the specified worksheet. */
      72             :     sal_Int16           getCalcSheetIndex( sal_Int32 nWorksheet ) const;
      73             :     /** Returns the finalized name of the specified worksheet. */
      74             :     OUString     getCalcSheetName( sal_Int32 nWorksheet ) const;
      75             : 
      76             :     /** Returns the Calc index of the sheet with the passed original worksheet name. */
      77             :     sal_Int16           getCalcSheetIndex( const OUString& rWorksheetName ) const;
      78             :     /** Returns the finalized name of the sheet with the passed worksheet name. */
      79             :     OUString     getCalcSheetName( const OUString& rWorksheetName ) const;
      80             :     /** Converts sSheetNameRef (e.g. '#SheetName!A1' to '#SheetName.A1' )
      81             :         if sSheetNameRef doesn't start with '#' it is ignored and not modified
      82             :     */
      83             :     void                convertSheetNameRef( OUString& sSheetNameRef ) const;
      84             : 
      85             : private:
      86           0 :     struct SheetInfo : public SheetInfoModel
      87             :     {
      88             :         OUString     maCalcName;
      89             :         OUString     maCalcQuotedName;
      90             :         sal_Int16           mnCalcSheet;
      91             : 
      92             :         explicit            SheetInfo( const SheetInfoModel& rModel, sal_Int16 nCalcSheet, const OUString& rCalcName );
      93             :     };
      94             : 
      95             :     typedef ::std::pair< sal_Int16, OUString > IndexNamePair;
      96             : 
      97             :     /** Creates a new sheet in the Calc document. Does not insert anything in the own lists. */
      98             :     IndexNamePair       createSheet( const OUString& rPreferredName, sal_Int32 nSheetPos, bool bVisible );
      99             :     /** Creates a new sheet in the Calc document and inserts the related SheetInfo. */
     100             :     void                insertSheet( const SheetInfoModel& rModel );
     101             : 
     102             : private:
     103             :     typedef RefVector< SheetInfo > SheetInfoVector;
     104             :     SheetInfoVector     maSheetInfos;
     105             : 
     106             :     typedef RefMap< OUString, SheetInfo, IgnoreCaseCompare > SheetInfoMap;
     107             :     SheetInfoMap        maSheetInfosByName;
     108             : };
     109             : 
     110             : } // namespace xls
     111             : } // namespace oox
     112             : 
     113             : #endif
     114             : 
     115             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10