1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xeroot.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
36 // Forward declarations of objects in public use ==============================
39 class XclExpRecordBase
;
42 typedef ScfRef
< XclExpRecordBase
> XclExpRecordRef
;
43 typedef ScfRef
< XclExpString
> XclExpStringRef
;
45 // Global data ================================================================
48 class XclExpAddressConverter
;
49 class XclExpFormulaCompiler
;
50 class XclExpProgressBar
;
53 class XclExpFontBuffer
;
54 class XclExpNumFmtBuffer
;
56 class XclExpLinkManager
;
57 class XclExpNameManager
;
58 class XclExpFilterManager
;
59 class XclExpPivotTableManager
;
61 /** Stores global buffers and data needed for Excel export filter. */
62 struct XclExpRootData
: public XclRootData
64 typedef ScfRef
< XclExpTabInfo
> XclExpTabInfoRef
;
65 typedef ScfRef
< XclExpAddressConverter
> XclExpAddrConvRef
;
66 typedef ScfRef
< XclExpFormulaCompiler
> XclExpFmlaCompRef
;
67 typedef ScfRef
< XclExpProgressBar
> XclExpProgressRef
;
69 typedef ScfRef
< XclExpSst
> XclExpSstRef
;
70 typedef ScfRef
< XclExpPalette
> XclExpPaletteRef
;
71 typedef ScfRef
< XclExpFontBuffer
> XclExpFontBfrRef
;
72 typedef ScfRef
< XclExpNumFmtBuffer
> XclExpNumFmtBfrRef
;
73 typedef ScfRef
< XclExpXFBuffer
> XclExpXFBfrRef
;
74 typedef ScfRef
< XclExpNameManager
> XclExpNameMgrRef
;
75 typedef ScfRef
< XclExpLinkManager
> XclExpLinkMgrRef
;
76 typedef ScfRef
< XclExpFilterManager
> XclExpFilterMgrRef
;
77 typedef ScfRef
< XclExpPivotTableManager
> XclExpPTableMgrRef
;
79 XclExpTabInfoRef mxTabInfo
; /// Calc->Excel sheet index conversion.
80 XclExpAddrConvRef mxAddrConv
; /// The address converter.
81 XclExpFmlaCompRef mxFmlaComp
; /// The formula compiler.
82 XclExpProgressRef mxProgress
; /// The export progress bar.
84 XclExpSstRef mxSst
; /// The shared string table.
85 XclExpPaletteRef mxPalette
; /// The color buffer.
86 XclExpFontBfrRef mxFontBfr
; /// All fonts in the file.
87 XclExpNumFmtBfrRef mxNumFmtBfr
; /// All number formats in the file.
88 XclExpXFBfrRef mxXFBfr
; /// All XF records in the file.
89 XclExpNameMgrRef mxNameMgr
; /// Internal defined names.
90 XclExpLinkMgrRef mxGlobLinkMgr
; /// Global link manager for defined names.
91 XclExpLinkMgrRef mxLocLinkMgr
; /// Local link manager for a sheet.
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
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 filter manager. */
141 XclExpFilterManager
& GetFilterManager() const;
142 /** Returns the pivot table manager. */
143 XclExpPivotTableManager
& GetPivotTableManager() const;
145 /** Is called when export filter starts to create the Excel document (all BIFF versions). */
146 void InitializeConvert();
147 /** Is called when export filter starts to create the workbook global data (>=BIFF5). */
148 void InitializeGlobals();
149 /** Is called when export filter starts to create data for a single sheet (all BIFF versions). */
150 void InitializeTable( SCTAB nScTab
);
151 /** Is called before export filter starts to write the records to the stream. */
152 void InitializeSave();
153 /** Returns the reference to a record (or record list) representing a root object.
154 @param nRecId Identifier that specifies which record is returned. */
155 XclExpRecordRef
CreateRecord( sal_uInt16 nRecId
) const;
157 bool IsDocumentEncrypted() const;
159 const String
GetPassword() const;
163 /** Returns the local or global link manager, depending on current context. */
164 XclExpRootData::XclExpLinkMgrRef
GetLocalLinkMgrRef() const;
167 mutable XclExpRootData
& mrExpData
; /// Reference to the global export data struct.
170 // ============================================================================