merged tag ooo/OOO330_m14
[LibreOffice.git] / sc / source / filter / inc / xeroot.hxx
blob980590f9d4ff487258d848fffa9420e7ebcc438b
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_XEROOT_HXX
29 #define SC_XEROOT_HXX
31 #include "xlroot.hxx"
33 // Forward declarations of objects in public use ==============================
35 class XclExpStream;
36 class XclExpRecordBase;
37 class XclExpString;
39 typedef ScfRef< XclExpRecordBase > XclExpRecordRef;
40 typedef ScfRef< XclExpString > XclExpStringRef;
42 // Global data ================================================================
44 class XclExpTabInfo;
45 class XclExpAddressConverter;
46 class XclExpFormulaCompiler;
47 class XclExpProgressBar;
48 class XclExpSst;
49 class XclExpPalette;
50 class XclExpFontBuffer;
51 class XclExpNumFmtBuffer;
52 class XclExpXFBuffer;
53 class XclExpLinkManager;
54 class XclExpNameManager;
55 class XclExpObjectManager;
56 class XclExpFilterManager;
57 class XclExpPivotTableManager;
59 /** Stores global buffers and data needed for Excel export filter. */
60 struct XclExpRootData : public XclRootData
62 typedef ScfRef< XclExpTabInfo > XclExpTabInfoRef;
63 typedef ScfRef< XclExpAddressConverter > XclExpAddrConvRef;
64 typedef ScfRef< XclExpFormulaCompiler > XclExpFmlaCompRef;
65 typedef ScfRef< XclExpProgressBar > XclExpProgressRef;
67 typedef ScfRef< XclExpSst > XclExpSstRef;
68 typedef ScfRef< XclExpPalette > XclExpPaletteRef;
69 typedef ScfRef< XclExpFontBuffer > XclExpFontBfrRef;
70 typedef ScfRef< XclExpNumFmtBuffer > XclExpNumFmtBfrRef;
71 typedef ScfRef< XclExpXFBuffer > XclExpXFBfrRef;
72 typedef ScfRef< XclExpNameManager > XclExpNameMgrRef;
73 typedef ScfRef< XclExpLinkManager > XclExpLinkMgrRef;
74 typedef ScfRef< XclExpObjectManager > XclExpObjectMgrRef;
75 typedef ScfRef< XclExpFilterManager > XclExpFilterMgrRef;
76 typedef ScfRef< XclExpPivotTableManager > XclExpPTableMgrRef;
78 XclExpTabInfoRef mxTabInfo; /// Calc->Excel sheet index conversion.
79 XclExpAddrConvRef mxAddrConv; /// The address converter.
80 XclExpFmlaCompRef mxFmlaComp; /// The formula compiler.
81 XclExpProgressRef mxProgress; /// The export progress bar.
83 XclExpSstRef mxSst; /// The shared string table.
84 XclExpPaletteRef mxPalette; /// The color buffer.
85 XclExpFontBfrRef mxFontBfr; /// All fonts in the file.
86 XclExpNumFmtBfrRef mxNumFmtBfr; /// All number formats in the file.
87 XclExpXFBfrRef mxXFBfr; /// All XF records in the file.
88 XclExpNameMgrRef mxNameMgr; /// Internal defined names.
89 XclExpLinkMgrRef mxGlobLinkMgr; /// Global link manager for defined names.
90 XclExpLinkMgrRef mxLocLinkMgr; /// Local link manager for a sheet.
91 XclExpObjectMgrRef mxObjMgr; /// All drawing objects.
92 XclExpFilterMgrRef mxFilterMgr; /// Manager for filtered areas in all sheets.
93 XclExpPTableMgrRef mxPTableMgr; /// All pivot tables and pivot caches.
95 bool mbRelUrl; /// true = Store URLs relative.
97 explicit XclExpRootData( XclBiff eBiff, SfxMedium& rMedium,
98 SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc );
99 virtual ~XclExpRootData();
102 // ----------------------------------------------------------------------------
104 /** Access to global data from other classes. */
105 class XclExpRoot : public XclRoot
107 public:
108 explicit XclExpRoot( XclExpRootData& rExpRootData );
110 /** Returns this root instance - for code readability in derived classes. */
111 inline const XclExpRoot& GetRoot() const { return *this; }
112 /** Returns true, if URLs should be stored relative to the document location. */
113 inline bool IsRelUrl() const { return mrExpData.mbRelUrl; }
115 /** Returns the buffer for Calc->Excel sheet index conversion. */
116 XclExpTabInfo& GetTabInfo() const;
117 /** Returns the address converter. */
118 XclExpAddressConverter& GetAddressConverter() const;
119 /** Returns the formula compiler to produce formula token arrays. */
120 XclExpFormulaCompiler& GetFormulaCompiler() const;
121 /** Returns the export progress bar. */
122 XclExpProgressBar& GetProgressBar() const;
124 /** Returns the shared string table. */
125 XclExpSst& GetSst() const;
126 /** Returns the color buffer. */
127 XclExpPalette& GetPalette() const;
128 /** Returns the font buffer. */
129 XclExpFontBuffer& GetFontBuffer() const;
130 /** Returns the number format buffer. */
131 XclExpNumFmtBuffer& GetNumFmtBuffer() const;
132 /** Returns the cell formatting attributes buffer. */
133 XclExpXFBuffer& GetXFBuffer() const;
134 /** Returns the global link manager for defined names. */
135 XclExpLinkManager& GetGlobalLinkManager() const;
136 /** Returns the local link manager for the current sheet. */
137 XclExpLinkManager& GetLocalLinkManager() const;
138 /** Returns the buffer that contains internal defined names. */
139 XclExpNameManager& GetNameManager() const;
140 /** Returns the drawing object manager. */
141 XclExpObjectManager& GetObjectManager() const;
142 /** Returns the filter manager. */
143 XclExpFilterManager& GetFilterManager() const;
144 /** Returns the pivot table manager. */
145 XclExpPivotTableManager& GetPivotTableManager() const;
147 /** Is called when export filter starts to create the Excel document (all BIFF versions). */
148 void InitializeConvert();
149 /** Is called when export filter starts to create the workbook global data (>=BIFF5). */
150 void InitializeGlobals();
151 /** Is called when export filter starts to create data for a single sheet (all BIFF versions). */
152 void InitializeTable( SCTAB nScTab );
153 /** Is called before export filter starts to write the records to the stream. */
154 void InitializeSave();
155 /** Returns the reference to a record (or record list) representing a root object.
156 @param nRecId Identifier that specifies which record is returned. */
157 XclExpRecordRef CreateRecord( sal_uInt16 nRecId ) const;
159 bool IsDocumentEncrypted() const;
161 String GetPassword() const;
163 private:
165 /** Returns the local or global link manager, depending on current context. */
166 XclExpRootData::XclExpLinkMgrRef GetLocalLinkMgrRef() const;
168 private:
169 mutable XclExpRootData& mrExpData; /// Reference to the global export data struct.
172 // ============================================================================
174 #endif