LibreOffice Module sc (master)  1
xeroot.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 "xlroot.hxx"
23 #include <compiler.hxx>
24 #include <memory>
25 #include <rtl/ref.hxx>
26 
27 // Forward declarations of objects in public use ==============================
28 
29 namespace com::sun::star::beans { struct NamedValue; }
30 
31 class XclExpRecordBase;
33 
35 typedef std::shared_ptr< XclExpString > XclExpStringRef;
36 
37 // Global data ================================================================
38 
39 class XclExpTabInfo;
42 class XclExpProgressBar;
43 class XclExpSst;
44 class XclExpPalette;
45 class XclExpFontBuffer;
46 class XclExpNumFmtBuffer;
47 class XclExpXFBuffer;
48 class XclExpLinkManager;
49 class XclExpNameManager;
53 class XclExpDxfs;
56 namespace sc { class CompileFormulaContext; }
57 
59 struct XclExpRootData : public XclRootData
60 {
61  typedef std::shared_ptr< XclExpTabInfo > XclExpTabInfoRef;
62  typedef std::shared_ptr< XclExpAddressConverter > XclExpAddrConvRef;
63  typedef std::shared_ptr< XclExpFormulaCompiler > XclExpFmlaCompRef;
64  typedef std::shared_ptr< XclExpProgressBar > XclExpProgressRef;
65 
73  typedef std::shared_ptr< XclExpObjectManager > XclExpObjectMgrRef;
74  typedef std::shared_ptr< XclExpFilterManager > XclExpFilterMgrRef;
75  typedef std::shared_ptr< XclExpPivotTableManager > XclExpPTableMgrRef;
77 
78  XclExpTabInfoRef mxTabInfo;
79  XclExpAddrConvRef mxAddrConv;
80  XclExpFmlaCompRef mxFmlaComp;
81  XclExpProgressRef mxProgress;
82 
83  XclExpSstRef mxSst;
84  XclExpPaletteRef mxPalette;
85  XclExpFontBfrRef mxFontBfr;
86  XclExpNumFmtBfrRef mxNumFmtBfr;
87  XclExpXFBfrRef mxXFBfr;
88  XclExpNameMgrRef mxNameMgr;
89  XclExpLinkMgrRef mxGlobLinkMgr;
90  XclExpLinkMgrRef mxLocLinkMgr;
91  XclExpObjectMgrRef mxObjMgr;
92  XclExpFilterMgrRef mxFilterMgr;
93  XclExpPTableMgrRef mxPTableMgr;
94  XclExpDxfsRef mxDxfs;
95 
96  std::shared_ptr<XclExpXmlPivotTableManager> mxXmlPTableMgr;
97  std::shared_ptr<XclExpTablesManager> mxTablesMgr;
98  std::shared_ptr<sc::CompileFormulaContext> mpCompileFormulaCxt;
99 
101 
102  bool mbRelUrl;
103 
104  OStringBuffer maStringBuf;
105 
106  explicit XclExpRootData( XclBiff eBiff, SfxMedium& rMedium,
107  const tools::SvRef<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc );
108  virtual ~XclExpRootData() override;
109 };
110 
112 class XclExpRoot : public XclRoot
113 {
114 public:
115  explicit XclExpRoot( XclExpRootData& rExpRootData );
116 
118  const XclExpRoot& GetRoot() const { return *this; }
120  bool IsRelUrl() const { return mrExpData.mbRelUrl; }
122 
124  XclExpTabInfo& GetTabInfo() const;
131 
133  XclExpSst& GetSst() const;
135  XclExpPalette& GetPalette() const;
141  XclExpXFBuffer& GetXFBuffer() const;
155  XclExpDxfs& GetDxfs() const;
156 
158  OStringBuffer& GetStringBuf() const { mrExpData.maStringBuf.setLength(0); return mrExpData.maStringBuf; }
159 
161 
163 
165  void InitializeConvert();
167  void InitializeGlobals();
169  void InitializeTable( SCTAB nScTab );
171  void InitializeSave();
174  XclExpRecordRef CreateRecord( sal_uInt16 nRecId ) const;
175 
176  bool IsDocumentEncrypted() const;
177 
178  static css::uno::Sequence< css::beans::NamedValue > GenerateEncryptionData( const OUString& aPass );
179  css::uno::Sequence< css::beans::NamedValue > GetEncryptionData() const;
180  static css::uno::Sequence< css::beans::NamedValue > GenerateDefaultEncryptionData();
181 
182 private:
183 
186 
187 private:
189 };
190 
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:47
XclExpFilterManager & GetFilterManager() const
Returns the filter manager.
Definition: xeroot.cxx:155
Stores all XF records (cell formats and cell styles) in the document.
Definition: xestyle.hxx:574
XclExpObjectMgrRef mxObjMgr
Local link manager for a sheet.
Definition: xeroot.hxx:91
XclBiff
An enumeration for all Excel file format types (BIFF types).
Definition: xlconst.hxx:29
Stores global buffers and data needed for Excel export filter.
Definition: xeroot.hxx:59
void InitializeGlobals()
Is called when export filter starts to create the workbook global data (>=BIFF5). ...
Definition: xeroot.cxx:195
The main progress bar for the export filter.
Definition: xehelper.hxx:43
std::shared_ptr< XclExpPivotTableManager > XclExpPTableMgrRef
Definition: xeroot.hxx:75
rtl::Reference< XclExpSst > XclExpSstRef
Definition: xeroot.hxx:66
std::shared_ptr< XclExpXmlPivotTableManager > mxXmlPTableMgr
All delta formatting entries.
Definition: xeroot.hxx:96
OStringBuffer & GetStringBuf() const
Clean and return the OStringBuffer.
Definition: xeroot.hxx:158
void InitializeConvert()
Is called when export filter starts to create the Excel document (all BIFF versions).
Definition: xeroot.cxx:185
XclExpRoot(XclExpRootData &rExpRootData)
Definition: xeroot.cxx:71
XclExpAddrConvRef mxAddrConv
Calc->Excel sheet index conversion.
Definition: xeroot.hxx:79
rtl::Reference< XclExpNumFmtBuffer > XclExpNumFmtBfrRef
Definition: xeroot.hxx:69
XclExpLinkManager & GetLocalLinkManager() const
Returns the local link manager for the current sheet.
Definition: xeroot.cxx:137
OStringBuffer maStringBuf
true = Store URLs relative.
Definition: xeroot.hxx:104
XclExpPivotTableManager & GetPivotTableManager() const
Returns the pivot table manager.
Definition: xeroot.cxx:167
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
Definition: xeroot.cxx:89
static css::uno::Sequence< css::beans::NamedValue > GenerateEncryptionData(const OUString &aPass)
Definition: xeroot.cxx:311
Stores global buffers and data needed elsewhere in the Excel filters.
Definition: xlroot.hxx:61
XclExpNameMgrRef mxNameMgr
All XF records in the file.
Definition: xeroot.hxx:88
XclExpProgressBar & GetProgressBar() const
Returns the export progress bar.
Definition: xeroot.cxx:95
rtl::Reference< XclExpXFBuffer > XclExpXFBfrRef
Definition: xeroot.hxx:70
rtl::Reference< XclExpLinkManager > XclExpLinkMgrRef
Definition: xeroot.hxx:72
The formula compiler to create Excel token arrays from Calc token arrays.
Definition: xeformula.hxx:51
Access to global data from other classes.
Definition: xeroot.hxx:112
static css::uno::Sequence< css::beans::NamedValue > GenerateDefaultEncryptionData()
Definition: xeroot.cxx:352
XclExpXFBfrRef mxXFBfr
All number formats in the file.
Definition: xeroot.hxx:87
std::shared_ptr< XclExpAddressConverter > XclExpAddrConvRef
Definition: xeroot.hxx:62
std::shared_ptr< XclExpFormulaCompiler > XclExpFmlaCompRef
Definition: xeroot.hxx:63
std::shared_ptr< XclExpTabInfo > XclExpTabInfoRef
Definition: xeroot.hxx:61
XclExpRootData(XclBiff eBiff, SfxMedium &rMedium, const tools::SvRef< SotStorage > &xRootStrg, ScDocument &rDoc, rtl_TextEncoding eTextEnc)
buffer to avoid massive OUString allocations
Definition: xeroot.cxx:57
rtl::Reference< XclExpDxfs > XclExpDxfsRef
Definition: xeroot.hxx:76
Base class for all Excel records.
Definition: xerecord.hxx:37
Stores all number formats used in the document.
Definition: xestyle.hxx:268
XclExpFontBfrRef mxFontBfr
The color buffer.
Definition: xeroot.hxx:85
XclExpDxfs & GetDxfs() const
Returns the differential formatting list.
Definition: xeroot.cxx:161
XclExpLinkManager & GetGlobalLinkManager() const
Returns the global link manager for defined names.
Definition: xeroot.cxx:131
XclExpRootData & mrExpData
Definition: xeroot.hxx:188
XclExpRootData::XclExpLinkMgrRef const & GetLocalLinkMgrRef() const
Returns the local or global link manager, depending on current context.
Definition: xeroot.cxx:357
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
Definition: xeroot.cxx:83
rtl::Reference< XclExpPalette > XclExpPaletteRef
Definition: xeroot.hxx:67
Manager that stores all internal defined names (NAME records) of the document.
Definition: xename.hxx:31
XclExpFilterMgrRef mxFilterMgr
All drawing objects.
Definition: xeroot.hxx:92
XclExpXmlPivotTableManager & GetXmlPivotTableManager()
Definition: xeroot.cxx:173
XclExpPalette & GetPalette() const
Returns the color buffer.
Definition: xeroot.cxx:107
The main class for pivot table export.
Definition: xepivot.hxx:405
XclExpNumFmtBuffer & GetNumFmtBuffer() const
Returns the number format buffer.
Definition: xeroot.cxx:119
Stores all used colors in the document.
Definition: xestyle.hxx:74
Stores the correct Excel sheet index for each Calc sheet.
Definition: xelink.hxx:61
XclExpTablesManager & GetTablesManager()
Definition: xeroot.cxx:179
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
Definition: xeroot.cxx:143
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
Definition: xeroot.cxx:77
rtl::Reference< XclExpFontBuffer > XclExpFontBfrRef
Definition: xeroot.hxx:68
bool mbRelUrl
mapping between op-codes and names
Definition: xeroot.hxx:102
XclExpRecordRef CreateRecord(sal_uInt16 nRecId) const
Returns the reference to a record (or record list) representing a root object.
Definition: xeroot.cxx:282
void InitializeSave()
Is called before export filter starts to write the records to the stream.
Definition: xeroot.cxx:276
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
XclExpSst & GetSst() const
Returns the shared string table.
Definition: xeroot.cxx:101
Stores all data for database ranges (tables in Excel speak).
Definition: xedbdata.hxx:52
Provides functions to convert Calc cell addresses to Excel cell addresses.
Definition: xehelper.hxx:81
XclExpNumFmtBfrRef mxNumFmtBfr
All fonts in the file.
Definition: xeroot.hxx:86
XclExpDxfsRef mxDxfs
All pivot tables and pivot caches.
Definition: xeroot.hxx:94
std::shared_ptr< XclExpTablesManager > mxTablesMgr
Definition: xeroot.hxx:97
Stores all data for internal/external references (the link table).
Definition: xelink.hxx:145
XclExpSstRef mxSst
The export progress bar.
Definition: xeroot.hxx:83
XclExpPTableMgrRef mxPTableMgr
Manager for filtered areas in all sheets.
Definition: xeroot.hxx:93
Sheet filter manager.
Definition: excrecds.hxx:432
Stores the data of all fonts used in the document.
Definition: xestyle.hxx:206
std::shared_ptr< XclExpFilterManager > XclExpFilterMgrRef
Definition: xeroot.hxx:74
css::uno::Sequence< css::beans::NamedValue > GetEncryptionData() const
Definition: xeroot.cxx:335
void InitializeTable(SCTAB nScTab)
Is called when export filter starts to create data for a single sheet (all BIFF versions).
Definition: xeroot.cxx:266
XclExpObjectManager & GetObjectManager() const
Returns the drawing object manager.
Definition: xeroot.cxx:149
rtl::Reference< XclExpNameManager > XclExpNameMgrRef
Definition: xeroot.hxx:71
bool IsDocumentEncrypted() const
Definition: xeroot.cxx:300
XclExpPaletteRef mxPalette
The shared string table.
Definition: xeroot.hxx:84
XclExpTabInfoRef mxTabInfo
Definition: xeroot.hxx:78
XclExpLinkMgrRef mxGlobLinkMgr
Internal defined names.
Definition: xeroot.hxx:89
std::shared_ptr< XclExpString > XclExpStringRef
Definition: xeroot.hxx:35
virtual ~XclExpRootData() override
Definition: xeroot.cxx:67
XclExpProgressRef mxProgress
The formula compiler.
Definition: xeroot.hxx:81
std::shared_ptr< const OpCodeMap > OpCodeMapPtr
XclExpFmlaCompRef mxFmlaComp
The address converter.
Definition: xeroot.hxx:80
XclExpXFBuffer & GetXFBuffer() const
Returns the cell formatting attributes buffer.
Definition: xeroot.cxx:125
std::shared_ptr< sc::CompileFormulaContext > mpCompileFormulaCxt
Definition: xeroot.hxx:98
XclExpFontBuffer & GetFontBuffer() const
Returns the font buffer.
Definition: xeroot.cxx:113
Provides export of the SST (shared string table) record.
Definition: xecontent.hxx:51
Access to global data for a filter object (imported or exported document) from other classes...
Definition: xlroot.hxx:127
bool IsRelUrl() const
Returns true, if URLs should be stored relative to the document location.
Definition: xeroot.hxx:120
sc::CompileFormulaContext & GetCompileFormulaContext() const
Definition: xeroot.hxx:121
std::shared_ptr< XclExpObjectManager > XclExpObjectMgrRef
Definition: xeroot.hxx:73
std::shared_ptr< XclExpProgressBar > XclExpProgressRef
Definition: xeroot.hxx:64
ScCompiler::OpCodeMapPtr mxOpCodeMap
Definition: xeroot.hxx:100
sal_Int16 SCTAB
Definition: types.hxx:22
rtl::Reference< XclExpRecordBase > XclExpRecordRef
Definition: xeroot.hxx:32
XclExpLinkMgrRef mxLocLinkMgr
Global link manager for defined names.
Definition: xeroot.hxx:90