merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / source / filter / inc / xiroot.hxx
blobc5cf284d2d2e264366cfc2318574176672894354
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #ifndef SC_XIROOT_HXX
29 #define SC_XIROOT_HXX
31 #include "xlroot.hxx"
33 // Forward declarations of objects in public use ==============================
35 class XclImpStream;
36 class XclImpString;
38 typedef ScfRef< XclImpString > XclImpStringRef;
40 // Global data ================================================================
42 class XclImpAddressConverter;
43 class XclImpFormulaCompiler;
44 class XclImpSst;
45 class XclImpPalette;
46 class XclImpFontBuffer;
47 class XclImpNumFmtBuffer;
48 class XclImpXFBuffer;
49 class XclImpXFRangeBuffer;
50 class XclImpTabInfo;
51 class XclImpNameManager;
52 class XclImpLinkManager;
53 class XclImpObjectManager;
54 class XclImpSheetDrawing;
55 class XclImpCondFormatManager;
56 class XclImpAutoFilterBuffer;
57 class XclImpWebQueryBuffer;
58 class XclImpPivotTableManager;
59 class XclImpPageSettings;
60 class XclImpDocViewSettings;
61 class XclImpTabViewSettings;
62 class XclImpSheetProtectBuffer;
63 class XclImpDocProtectBuffer;
65 class _ScRangeListTabs;
66 class ExcelToSc;
68 /** Stores global buffers and data needed for Excel import filter. */
69 struct XclImpRootData : public XclRootData
71 typedef ScfRef< XclImpAddressConverter > XclImpAddrConvRef;
72 typedef ScfRef< XclImpFormulaCompiler > XclImpFmlaCompRef;
74 typedef ScfRef< XclImpSst > XclImpSstRef;
75 typedef ScfRef< XclImpPalette > XclImpPaletteRef;
76 typedef ScfRef< XclImpFontBuffer > XclImpFontBfrRef;
77 typedef ScfRef< XclImpNumFmtBuffer > XclImpNumFmtBfrRef;
78 typedef ScfRef< XclImpXFBuffer > XclImpXFBfrRef;
79 typedef ScfRef< XclImpXFRangeBuffer > XclImpXFRangeBfrRef;
80 typedef ScfRef< XclImpTabInfo > XclImpTabInfoRef;
81 typedef ScfRef< XclImpNameManager > XclImpNameMgrRef;
82 typedef ScfRef< XclImpLinkManager > XclImpLinkMgrRef;
83 typedef ScfRef< XclImpObjectManager > XclImpObjectMgrRef;
84 typedef ScfRef< XclImpCondFormatManager > XclImpCondFmtMgrRef;
85 typedef ScfRef< XclImpWebQueryBuffer > XclImpWebQueryBfrRef;
86 typedef ScfRef< XclImpPivotTableManager > XclImpPTableMgrRef;
87 typedef ScfRef< XclImpPageSettings > XclImpPageSettRef;
88 typedef ScfRef< XclImpDocViewSettings > XclImpDocViewSettRef;
89 typedef ScfRef< XclImpTabViewSettings > XclImpTabViewSettRef;
90 typedef ScfRef< XclImpSheetProtectBuffer > XclImpTabProtectRef;
91 typedef ScfRef< XclImpDocProtectBuffer > XclImpDocProtectRef;
93 XclImpAddrConvRef mxAddrConv; /// The address converter.
94 XclImpFmlaCompRef mxFmlaComp; /// The formula compiler.
96 XclImpSstRef mxSst; /// The shared string table.
97 XclImpPaletteRef mxPalette; /// The color buffer.
98 XclImpFontBfrRef mxFontBfr; /// All fonts in the file.
99 XclImpNumFmtBfrRef mxNumFmtBfr; /// All number formats in the file.
100 XclImpXFBfrRef mpXFBfr; /// All XF record data in the file.
101 XclImpXFRangeBfrRef mxXFRangeBfr; /// Buffer of XF index ranges in a sheet.
103 XclImpTabInfoRef mxTabInfo; /// Sheet creation order list.
104 XclImpNameMgrRef mxNameMgr; /// Internal defined names.
105 XclImpLinkMgrRef mxLinkMgr; /// Manager for internal/external links.
107 XclImpObjectMgrRef mxObjMgr; /// All drawing objects.
108 XclImpCondFmtMgrRef mxCondFmtMgr; /// Conditional formattings.
109 XclImpWebQueryBfrRef mxWebQueryBfr; /// All web queries.
110 XclImpPTableMgrRef mxPTableMgr; /// All pivot tables and pivot caches.
112 XclImpPageSettRef mxPageSett; /// Page settings for current sheet.
113 XclImpDocViewSettRef mxDocViewSett; /// View settings for entire document.
114 XclImpTabViewSettRef mxTabViewSett; /// View settings for current sheet.
115 XclImpTabProtectRef mxTabProtect; /// Sheet protection options for current sheet.
116 XclImpDocProtectRef mxDocProtect; /// Document protection options.
118 bool mbHasCodePage; /// true = CODEPAGE record exists.
119 bool mbHasBasic; /// true = document contains VB project.
121 explicit XclImpRootData( XclBiff eBiff, SfxMedium& rMedium,
122 SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc );
123 virtual ~XclImpRootData();
126 // ----------------------------------------------------------------------------
128 /** Access to global data from other classes. */
129 class XclImpRoot : public XclRoot
131 public:
132 explicit XclImpRoot( XclImpRootData& rImpRootData );
134 /** Returns this root instance - for code readability in derived classes. */
135 inline const XclImpRoot& GetRoot() const { return *this; }
137 /** Sets a code page read from a CODEPAGE record for byte string import. */
138 void SetCodePage( sal_uInt16 nCodePage );
139 /** Sets text encoding from the default application font (in case of missing CODEPAGE record). */
140 void SetAppFontEncoding( rtl_TextEncoding eAppFontEnc );
142 /** Is called when import filter starts importing a single sheet (all BIFF versions). */
143 void InitializeTable( SCTAB nScTab );
144 /** Is called when import filter stops importing a single sheet (all BIFF versions). */
145 void FinalizeTable();
147 /** Returns the address converter. */
148 XclImpAddressConverter& GetAddressConverter() const;
149 /** Returns the formula converter. */
150 XclImpFormulaCompiler& GetFormulaCompiler() const;
151 /** Returns the old formula converter. */
152 ExcelToSc& GetOldFmlaConverter() const;
154 /** Returns the shared string table. */
155 XclImpSst& GetSst() const;
156 /** Returns the color buffer. */
157 XclImpPalette& GetPalette() const;
158 /** Returns the font buffer. */
159 XclImpFontBuffer& GetFontBuffer() const;
160 /** Returns the number format buffer. */
161 XclImpNumFmtBuffer& GetNumFmtBuffer() const;
162 /** Returns the cell formatting attributes buffer. */
163 XclImpXFBuffer& GetXFBuffer() const;
164 /** Returns the buffer of XF index ranges for a sheet. */
165 XclImpXFRangeBuffer& GetXFRangeBuffer() const;
167 /** Returns the buffer that contains all print areas in the document. */
168 _ScRangeListTabs& GetPrintAreaBuffer() const;
169 /** Returns the buffer that contains all print titles in the document. */
170 _ScRangeListTabs& GetTitleAreaBuffer() const;
172 /** Returns the buffer that contains the sheet creation order. */
173 XclImpTabInfo& GetTabInfo() const;
174 /** Returns the buffer that contains internal defined names. */
175 XclImpNameManager& GetNameManager() const;
176 /** Returns the link manager. */
177 XclImpLinkManager& GetLinkManager() const;
179 /** Returns the drawing object manager. */
180 XclImpObjectManager& GetObjectManager() const;
181 /** Returns the drawing container of the current sheet. */
182 XclImpSheetDrawing& GetCurrSheetDrawing() const;
183 /** Returns the conditional formattings manager. */
184 XclImpCondFormatManager& GetCondFormatManager() 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 String GetScAddInName( const String& rXclName ) const;
206 /** Returns true, if the document contains a VB project. */
207 inline bool HasBasic() const { return mrImpData.mbHasBasic; }
208 /** Called to indicate that the document contains a VB project. */
209 inline 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 private:
214 mutable XclImpRootData& mrImpData; /// Reference to the global import data struct.
217 // ============================================================================
219 #endif