1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XIROOT_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XIROOT_HXX
26 // Forward declarations of objects in public use ==============================
31 typedef std::shared_ptr
< XclImpString
> XclImpStringRef
;
33 // Global data ================================================================
35 class XclImpAddressConverter
;
36 class XclImpFormulaCompiler
;
39 class XclImpFontBuffer
;
40 class XclImpNumFmtBuffer
;
42 class XclImpXFRangeBuffer
;
44 class XclImpNameManager
;
45 class XclImpLinkManager
;
46 class XclImpObjectManager
;
47 class XclImpSheetDrawing
;
48 class XclImpCondFormatManager
;
49 class XclImpValidationManager
;
50 class XclImpAutoFilterBuffer
;
51 class XclImpWebQueryBuffer
;
52 class XclImpPivotTableManager
;
53 class XclImpPageSettings
;
54 class XclImpDocViewSettings
;
55 class XclImpTabViewSettings
;
56 class XclImpSheetProtectBuffer
;
57 class XclImpDocProtectBuffer
;
59 class ScRangeListTabs
;
61 class ScDocumentImport
;
63 /** Stores global buffers and data needed for Excel import filter. */
64 struct XclImpRootData
: public XclRootData
66 typedef std::shared_ptr
< XclImpAddressConverter
> XclImpAddrConvRef
;
67 typedef std::shared_ptr
< XclImpFormulaCompiler
> XclImpFmlaCompRef
;
69 typedef std::shared_ptr
< XclImpSst
> XclImpSstRef
;
70 typedef std::shared_ptr
< XclImpPalette
> XclImpPaletteRef
;
71 typedef std::shared_ptr
< XclImpFontBuffer
> XclImpFontBfrRef
;
72 typedef std::shared_ptr
< XclImpNumFmtBuffer
> XclImpNumFmtBfrRef
;
73 typedef std::shared_ptr
< XclImpXFBuffer
> XclImpXFBfrRef
;
74 typedef std::shared_ptr
< XclImpXFRangeBuffer
> XclImpXFRangeBfrRef
;
75 typedef std::shared_ptr
< XclImpTabInfo
> XclImpTabInfoRef
;
76 typedef std::shared_ptr
< XclImpNameManager
> XclImpNameMgrRef
;
77 typedef std::shared_ptr
< XclImpLinkManager
> XclImpLinkMgrRef
;
78 typedef std::shared_ptr
< XclImpObjectManager
> XclImpObjectMgrRef
;
79 typedef std::shared_ptr
< XclImpCondFormatManager
> XclImpCondFmtMgrRef
;
80 typedef std::shared_ptr
< XclImpValidationManager
> XclImpValidationMgrRef
;
81 typedef std::shared_ptr
< XclImpWebQueryBuffer
> XclImpWebQueryBfrRef
;
82 typedef std::shared_ptr
< XclImpPivotTableManager
> XclImpPTableMgrRef
;
83 typedef std::shared_ptr
< XclImpPageSettings
> XclImpPageSettRef
;
84 typedef std::shared_ptr
< XclImpDocViewSettings
> XclImpDocViewSettRef
;
85 typedef std::shared_ptr
< XclImpTabViewSettings
> XclImpTabViewSettRef
;
86 typedef std::shared_ptr
< XclImpSheetProtectBuffer
> XclImpTabProtectRef
;
87 typedef std::shared_ptr
< XclImpDocProtectBuffer
> XclImpDocProtectRef
;
89 XclImpAddrConvRef mxAddrConv
; /// The address converter.
90 XclImpFmlaCompRef mxFmlaComp
; /// The formula compiler.
92 XclImpSstRef mxSst
; /// The shared string table.
93 XclImpPaletteRef mxPalette
; /// The color buffer.
94 XclImpFontBfrRef mxFontBfr
; /// All fonts in the file.
95 XclImpNumFmtBfrRef mxNumFmtBfr
; /// All number formats in the file.
96 XclImpXFBfrRef mpXFBfr
; /// All XF record data in the file.
97 XclImpXFRangeBfrRef mxXFRangeBfr
; /// Buffer of XF index ranges in a sheet.
99 XclImpTabInfoRef mxTabInfo
; /// Sheet creation order list.
100 XclImpNameMgrRef mxNameMgr
; /// Internal defined names.
101 XclImpLinkMgrRef mxLinkMgr
; /// Manager for internal/external links.
103 XclImpObjectMgrRef mxObjMgr
; /// All drawing objects.
104 XclImpCondFmtMgrRef mxCondFmtMgr
; /// Conditional formatting.
105 XclImpValidationMgrRef mxValidMgr
; /// Data validation
106 XclImpWebQueryBfrRef mxWebQueryBfr
; /// All web queries.
107 XclImpPTableMgrRef mxPTableMgr
; /// All pivot tables and pivot caches.
109 XclImpPageSettRef mxPageSett
; /// Page settings for current sheet.
110 XclImpDocViewSettRef mxDocViewSett
; /// View settings for entire document.
111 XclImpTabViewSettRef mxTabViewSett
; /// View settings for current sheet.
112 XclImpTabProtectRef mxTabProtect
; /// Sheet protection options for current sheet.
113 XclImpDocProtectRef mxDocProtect
; /// Document protection options.
115 std::shared_ptr
<ScDocumentImport
> mxDocImport
;
117 bool mbHasCodePage
; /// true = CODEPAGE record exists.
118 bool mbHasBasic
; /// true = document contains VB project.
120 explicit XclImpRootData( XclBiff eBiff
, SfxMedium
& rMedium
,
121 const tools::SvRef
<SotStorage
>& xRootStrg
, ScDocument
& rDoc
, rtl_TextEncoding eTextEnc
);
122 virtual ~XclImpRootData() override
;
125 /** Access to global data from other classes. */
126 class XclImpRoot
: public XclRoot
129 explicit XclImpRoot( XclImpRootData
& rImpRootData
);
131 /** Returns this root instance - for code readability in derived classes. */
132 const XclImpRoot
& GetRoot() const { return *this; }
133 XclImpRoot
& GetRoot() { return *this; }
135 /** Sets a code page read from a CODEPAGE record for byte string import. */
136 void SetCodePage( sal_uInt16 nCodePage
);
137 /** Sets text encoding from the default application font (in case of missing CODEPAGE record). */
138 void SetAppFontEncoding( rtl_TextEncoding eAppFontEnc
);
140 /** Is called when import filter starts importing a single sheet (all BIFF versions). */
141 void InitializeTable( SCTAB nScTab
);
142 /** Is called when import filter stops importing a single sheet (all BIFF versions). */
143 void FinalizeTable();
145 /** Returns the address converter. */
146 XclImpAddressConverter
& GetAddressConverter() const;
147 /** Returns the formula converter. */
148 XclImpFormulaCompiler
& GetFormulaCompiler() const;
149 /** Returns the old formula converter. */
150 ExcelToSc
& GetOldFmlaConverter() const;
152 /** Returns the shared string table. */
153 XclImpSst
& GetSst() const;
154 /** Returns the color buffer. */
155 XclImpPalette
& GetPalette() const;
156 /** Returns the font buffer. */
157 XclImpFontBuffer
& GetFontBuffer() const;
158 /** Returns the number format buffer. */
159 XclImpNumFmtBuffer
& GetNumFmtBuffer() const;
160 /** Returns the cell formatting attributes buffer. */
161 XclImpXFBuffer
& GetXFBuffer() const;
162 /** Returns the buffer of XF index ranges for a sheet. */
163 XclImpXFRangeBuffer
& GetXFRangeBuffer() const;
165 /** Returns the buffer that contains all print areas in the document. */
166 ScRangeListTabs
& GetPrintAreaBuffer() const;
167 /** Returns the buffer that contains all print titles in the document. */
168 ScRangeListTabs
& GetTitleAreaBuffer() const;
170 /** Returns the buffer that contains the sheet creation order. */
171 XclImpTabInfo
& GetTabInfo() const;
172 /** Returns the buffer that contains internal defined names. */
173 XclImpNameManager
& GetNameManager() const;
174 /** Returns the link manager. */
175 XclImpLinkManager
& GetLinkManager() const;
177 /** Returns the drawing object manager. */
178 XclImpObjectManager
& GetObjectManager() const;
179 /** Returns the drawing container of the current sheet. */
180 XclImpSheetDrawing
& GetCurrSheetDrawing() const;
181 /** Returns the conditional formatting manager. */
182 XclImpCondFormatManager
& GetCondFormatManager() const;
184 XclImpValidationManager
& GetValidationManager() const;
185 /** Returns the filter manager. */
186 XclImpAutoFilterBuffer
& GetFilterManager() const;
187 /** Returns the web query buffer. */
188 XclImpWebQueryBuffer
& GetWebQueryBuffer() const;
189 /** Returns the pivot table manager. */
190 XclImpPivotTableManager
& GetPivotTableManager() const;
191 /** Returns the sheet protection options of the current sheet. */
192 XclImpSheetProtectBuffer
& GetSheetProtectBuffer() const;
193 /** Returns the document protection options. */
194 XclImpDocProtectBuffer
& GetDocProtectBuffer() const;
196 /** Returns the page settings of the current sheet. */
197 XclImpPageSettings
& GetPageSettings() const;
198 /** Returns the view settings of the entire document. */
199 XclImpDocViewSettings
& GetDocViewSettings() const;
200 /** Returns the view settings of the current sheet. */
201 XclImpTabViewSettings
& GetTabViewSettings() const;
203 /** Returns the Calc add-in function name for an Excel function name. */
204 static OUString
GetScAddInName( const OUString
& rXclName
);
206 /** Returns true, if the document contains a VB project. */
207 bool HasBasic() const { return mrImpData
.mbHasBasic
; }
208 /** Called to indicate that the document contains a VB project. */
209 void SetHasBasic() { mrImpData
.mbHasBasic
= true; }
210 /** Reads the CODENAME record and inserts the codename into the document. */
211 void ReadCodeName( XclImpStream
& rStrm
, bool bGlobals
);
213 ScDocumentImport
& GetDocImport();
216 XclImpRootData
& mrImpData
; /// Reference to the global import data struct.
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */