LibreOffice Module sc (master)  1
worksheetbuffer.hxx
Go to the documentation of this file.
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 INCLUDED_SC_SOURCE_FILTER_INC_WORKSHEETBUFFER_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_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 oox { class SequenceInputStream; }
29 namespace oox { class AttributeList; }
30 
31 namespace oox::xls {
32 
35 {
36  OUString maRelId;
37  OUString maName;
38  sal_Int32 mnSheetId;
39  sal_Int32 mnState;
40 
41  explicit SheetInfoModel();
42 };
43 
51 {
52 public:
53  explicit WorksheetBuffer( const WorkbookHelper& rHelper );
54 
56  void importSheet( const AttributeList& rAttribs );
61  sal_Int16 insertEmptySheet( const OUString& rPreferredName );
62 
64  sal_Int32 getWorksheetCount() const;
66  sal_Int32 getAllSheetCount() const;
68  OUString getWorksheetRelId( sal_Int32 nWorksheet ) const;
69 
71  sal_Int16 getCalcSheetIndex( sal_Int32 nWorksheet ) const;
73  OUString getCalcSheetName( sal_Int32 nWorksheet ) const;
74 
76  sal_Int16 getCalcSheetIndex( const OUString& rWorksheetName ) const;
78  OUString getCalcSheetName( const OUString& rWorksheetName ) const;
82  void convertSheetNameRef( OUString& sSheetNameRef ) const;
83  void finalizeImport( sal_Int16 nActiveSheet );
84 
85 private:
86  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 
98  IndexNamePair createSheet( const OUString& rPreferredName, sal_Int32 nSheetPos );
100  void insertSheet( const SheetInfoModel& rModel );
101 
102 private:
105 };
106 
107 } // namespace oox::xls
108 
109 #endif
110 
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
sal_Int32 getAllSheetCount() const
Returns the number of all sheets, workbook + dummy ones (pivot table cache records ) ...
WorksheetBuffer(const WorkbookHelper &rHelper)
Stores information about all sheets in a spreadsheet document.
RefVector< SheetInfo > maSheetInfos
OUString getCalcSheetName(sal_Int32 nWorksheet) const
Returns the finalized name of the specified worksheet.
SheetInfoModel()
Visibility state.
OUString getWorksheetRelId(sal_Int32 nWorksheet) const
Returns the OOXML relation identifier of the specified worksheet.
SheetInfo(const SheetInfoModel &rModel, sal_Int16 nCalcSheet, const OUString &rCalcName)
OUString maName
Relation identifier for the sheet substream.
void convertSheetNameRef(OUString &sSheetNameRef) const
Converts sSheetNameRef (e.g.
Contains data from the 'sheet' element describing a sheet in the workbook.
sal_Int32 mnState
Sheet identifier.
void insertSheet(const SheetInfoModel &rModel)
Creates a new sheet in the Calc document and inserts the related SheetInfo.
sal_Int32 getWorksheetCount() const
Returns the number of original sheets contained in the workbook.
RefMap< OUString, SheetInfo, IgnoreCaseCompare > maSheetInfosByName
sal_Int16 getCalcSheetIndex(sal_Int32 nWorksheet) const
Returns the Calc index of the specified worksheet.
::std::pair< sal_Int16, OUString > IndexNamePair
void importSheet(const AttributeList &rAttribs)
Imports the attributes of a sheet element.
sal_Int32 mnSheetId
Original name of the sheet.
sal_Int16 insertEmptySheet(const OUString &rPreferredName)
Inserts a new empty sheet into the document.
void finalizeImport(sal_Int16 nActiveSheet)
void SvStream & rStrm
IndexNamePair createSheet(const OUString &rPreferredName, sal_Int32 nSheetPos)
Creates a new sheet in the Calc document.