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#pragma once
21
22#include <utility>
23#include <oox/helper/refmap.hxx>
25#include "workbookhelper.hxx"
26
27namespace oox { class SequenceInputStream; }
28namespace oox { class AttributeList; }
29
30namespace oox::xls {
31
34{
35 OUString maRelId;
36 OUString maName;
37 sal_Int32 mnSheetId;
38 sal_Int32 mnState;
39
40 explicit SheetInfoModel();
41};
42
50{
51public:
52 explicit WorksheetBuffer( const WorkbookHelper& rHelper );
53
55 void importSheet( const AttributeList& rAttribs );
60 sal_Int16 insertEmptySheet( const OUString& rPreferredName );
61
63 sal_Int32 getWorksheetCount() const;
65 sal_Int32 getAllSheetCount() const;
67 OUString getWorksheetRelId( sal_Int32 nWorksheet ) const;
68
70 sal_Int16 getCalcSheetIndex( sal_Int32 nWorksheet ) const;
72 OUString getCalcSheetName( sal_Int32 nWorksheet ) const;
73
75 sal_Int16 getCalcSheetIndex( const OUString& rWorksheetName ) const;
77 OUString getCalcSheetName( const OUString& rWorksheetName ) const;
81 void convertSheetNameRef( OUString& sSheetNameRef ) const;
82 void finalizeImport( sal_Int16 nActiveSheet );
83
84private:
85 struct SheetInfo : public SheetInfoModel
86 {
87 OUString maCalcName;
89 sal_Int16 mnCalcSheet;
90
91 explicit SheetInfo( const SheetInfoModel& rModel, sal_Int16 nCalcSheet, const OUString& rCalcName );
92 };
93
94 typedef ::std::pair< sal_Int16, OUString > IndexNamePair;
95
97 IndexNamePair createSheet( const OUString& rPreferredName, sal_Int32 nSheetPos );
99 void insertSheet( const SheetInfoModel& rModel );
100
101private:
104};
105
106} // namespace oox::xls
107
108/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Helper class to provide access to global workbook data.
Stores information about all sheets in a spreadsheet document.
void convertSheetNameRef(OUString &sSheetNameRef) const
Converts sSheetNameRef (e.g.
RefVector< SheetInfo > maSheetInfos
OUString getWorksheetRelId(sal_Int32 nWorksheet) const
Returns the OOXML relation identifier of the specified worksheet.
OUString getCalcSheetName(sal_Int32 nWorksheet) const
Returns the finalized name of the specified worksheet.
IndexNamePair createSheet(const OUString &rPreferredName, sal_Int32 nSheetPos)
Creates a new sheet in the Calc document.
sal_Int32 getWorksheetCount() const
Returns the number of original sheets contained in the workbook.
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.
RefMap< OUString, SheetInfo, IgnoreCaseCompare > maSheetInfosByName
sal_Int16 insertEmptySheet(const OUString &rPreferredName)
Inserts a new empty sheet into the document.
sal_Int32 getAllSheetCount() const
Returns the number of all sheets, workbook + dummy ones (pivot table cache records )
WorksheetBuffer(const WorkbookHelper &rHelper)
void finalizeImport(sal_Int16 nActiveSheet)
void insertSheet(const SheetInfoModel &rModel)
Creates a new sheet in the Calc document and inserts the related SheetInfo.
void SvStream & rStrm
Contains data from the 'sheet' element describing a sheet in the workbook.
SheetInfoModel()
Visibility state.
OUString maName
Relation identifier for the sheet substream.
sal_Int32 mnState
Sheet identifier.
sal_Int32 mnSheetId
Original name of the sheet.
SheetInfo(const SheetInfoModel &rModel, sal_Int16 nCalcSheet, const OUString &rCalcName)