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: xiroot.hxx,v $
10 * $Revision: 1.22.88.1 $
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 ==============================
41 typedef ScfRef
< XclImpString
> XclImpStringRef
;
43 // Global data ================================================================
45 class XclImpAddressConverter
;
46 class XclImpFormulaCompiler
;
49 class XclImpFontBuffer
;
50 class XclImpNumFmtBuffer
;
52 class XclImpXFRangeBuffer
;
54 class XclImpNameManager
;
55 class XclImpLinkManager
;
56 class XclImpObjectManager
;
57 class XclImpCondFormatManager
;
58 class XclImpAutoFilterBuffer
;
59 class XclImpWebQueryBuffer
;
60 class XclImpPivotTableManager
;
61 class XclImpPageSettings
;
62 class XclImpDocViewSettings
;
63 class XclImpTabViewSettings
;
64 class XclImpSheetProtectBuffer
;
65 class XclImpDocProtectBuffer
;
67 class _ScRangeListTabs
;
70 /** Stores global buffers and data needed for Excel import filter. */
71 struct XclImpRootData
: public XclRootData
73 typedef ScfRef
< XclImpAddressConverter
> XclImpAddrConvRef
;
74 typedef ScfRef
< XclImpFormulaCompiler
> XclImpFmlaCompRef
;
76 typedef ScfRef
< XclImpSst
> XclImpSstRef
;
77 typedef ScfRef
< XclImpPalette
> XclImpPaletteRef
;
78 typedef ScfRef
< XclImpFontBuffer
> XclImpFontBfrRef
;
79 typedef ScfRef
< XclImpNumFmtBuffer
> XclImpNumFmtBfrRef
;
80 typedef ScfRef
< XclImpXFBuffer
> XclImpXFBfrRef
;
81 typedef ScfRef
< XclImpXFRangeBuffer
> XclImpXFRangeBfrRef
;
82 typedef ScfRef
< XclImpTabInfo
> XclImpTabInfoRef
;
83 typedef ScfRef
< XclImpNameManager
> XclImpNameMgrRef
;
84 typedef ScfRef
< XclImpLinkManager
> XclImpLinkMgrRef
;
85 typedef ScfRef
< XclImpObjectManager
> XclImpObjectMgrRef
;
86 typedef ScfRef
< XclImpCondFormatManager
> XclImpCondFmtMgrRef
;
87 typedef ScfRef
< XclImpWebQueryBuffer
> XclImpWebQueryBfrRef
;
88 typedef ScfRef
< XclImpPivotTableManager
> XclImpPTableMgrRef
;
89 typedef ScfRef
< XclImpPageSettings
> XclImpPageSettRef
;
90 typedef ScfRef
< XclImpDocViewSettings
> XclImpDocViewSettRef
;
91 typedef ScfRef
< XclImpTabViewSettings
> XclImpTabViewSettRef
;
92 typedef ScfRef
< XclImpSheetProtectBuffer
> XclImpTabProtectRef
;
93 typedef ScfRef
< XclImpDocProtectBuffer
> XclImpDocProtectRef
;
95 XclImpAddrConvRef mxAddrConv
; /// The address converter.
96 XclImpFmlaCompRef mxFmlaComp
; /// The formula compiler.
98 XclImpSstRef mxSst
; /// The shared string table.
99 XclImpPaletteRef mxPalette
; /// The color buffer.
100 XclImpFontBfrRef mxFontBfr
; /// All fonts in the file.
101 XclImpNumFmtBfrRef mxNumFmtBfr
; /// All number formats in the file.
102 XclImpXFBfrRef mpXFBfr
; /// All XF record data in the file.
103 XclImpXFRangeBfrRef mxXFRangeBfr
; /// Buffer of XF index ranges in a sheet.
105 XclImpTabInfoRef mxTabInfo
; /// Sheet creation order list.
106 XclImpNameMgrRef mxNameMgr
; /// Internal defined names.
107 XclImpLinkMgrRef mxLinkMgr
; /// Manager for internal/external links.
109 XclImpObjectMgrRef mxObjMgr
; /// All drawing objects.
110 XclImpCondFmtMgrRef mxCondFmtMgr
; /// Conditional formattings.
111 XclImpWebQueryBfrRef mxWebQueryBfr
; /// All web queries.
112 XclImpPTableMgrRef mxPTableMgr
; /// All pivot tables and pivot caches.
114 XclImpPageSettRef mxPageSett
; /// Page settings for current sheet.
115 XclImpDocViewSettRef mxDocViewSett
; /// View settings for entire document.
116 XclImpTabViewSettRef mxTabViewSett
; /// View settings for current sheet.
117 XclImpTabProtectRef mxTabProtect
; /// Sheet protection options for current sheet.
118 XclImpDocProtectRef mxDocProtect
; /// Document protection options.
120 bool mbHasCodePage
; /// true = CODEPAGE record exists.
122 explicit XclImpRootData( XclBiff eBiff
, SfxMedium
& rMedium
,
123 SotStorageRef xRootStrg
, ScDocument
& rDoc
, rtl_TextEncoding eTextEnc
);
124 virtual ~XclImpRootData();
127 // ----------------------------------------------------------------------------
129 /** Access to global data from other classes. */
130 class XclImpRoot
: public XclRoot
133 explicit XclImpRoot( XclImpRootData
& rImpRootData
);
135 /** Returns this root instance - for code readability in derived classes. */
136 inline const XclImpRoot
& GetRoot() const { return *this; }
138 /** Sets a code page read from a CODEPAGE record for byte string import. */
139 void SetCodePage( sal_uInt16 nCodePage
);
140 /** Sets text encoding from the default application font (in case of missing CODEPAGE record). */
141 void SetAppFontEncoding( rtl_TextEncoding eAppFontEnc
);
143 /** Is called when import filter starts importing a single sheet (all BIFF versions). */
144 void InitializeTable( SCTAB nScTab
);
145 /** Is called when import filter stops importing a single sheet (all BIFF versions). */
146 void FinalizeTable();
148 /** Returns the address converter. */
149 XclImpAddressConverter
& GetAddressConverter() const;
150 /** Returns the formula converter. */
151 XclImpFormulaCompiler
& GetFormulaCompiler() const;
152 /** Returns the old formula converter. */
153 ExcelToSc
& GetOldFmlaConverter() const;
155 /** Returns the shared string table. */
156 XclImpSst
& GetSst() const;
157 /** Returns the color buffer. */
158 XclImpPalette
& GetPalette() const;
159 /** Returns the font buffer. */
160 XclImpFontBuffer
& GetFontBuffer() const;
161 /** Returns the number format buffer. */
162 XclImpNumFmtBuffer
& GetNumFmtBuffer() const;
163 /** Returns the cell formatting attributes buffer. */
164 XclImpXFBuffer
& GetXFBuffer() const;
165 /** Returns the buffer of XF index ranges for a sheet. */
166 XclImpXFRangeBuffer
& GetXFRangeBuffer() const;
168 /** Returns the buffer that contains all print areas in the document. */
169 _ScRangeListTabs
& GetPrintAreaBuffer() const;
170 /** Returns the buffer that contains all print titles in the document. */
171 _ScRangeListTabs
& GetTitleAreaBuffer() const;
173 /** Returns the buffer that contains the sheet creation order. */
174 XclImpTabInfo
& GetTabInfo() const;
175 /** Returns the buffer that contains internal defined names. */
176 XclImpNameManager
& GetNameManager() const;
177 /** Returns the link manager. */
178 XclImpLinkManager
& GetLinkManager() const;
180 /** Returns the drawing object manager. */
181 XclImpObjectManager
& GetObjectManager() const;
182 /** Returns the conditional formattings manager. */
183 XclImpCondFormatManager
& GetCondFormatManager() const;
184 /** Returns the filter manager. */
185 XclImpAutoFilterBuffer
& GetFilterManager() const;
186 /** Returns the web query buffer. */
187 XclImpWebQueryBuffer
& GetWebQueryBuffer() const;
188 /** Returns the pivot table manager. */
189 XclImpPivotTableManager
& GetPivotTableManager() const;
190 /** Returns the sheet protection options of the current sheet. */
191 XclImpSheetProtectBuffer
& GetSheetProtectBuffer() const;
192 /** Returns the document protection options. */
193 XclImpDocProtectBuffer
& GetDocProtectBuffer() const;
195 /** Returns the page settings of the current sheet. */
196 XclImpPageSettings
& GetPageSettings() const;
197 /** Returns the view settings of the entire document. */
198 XclImpDocViewSettings
& GetDocViewSettings() const;
199 /** Returns the view settings of the current sheet. */
200 XclImpTabViewSettings
& GetTabViewSettings() const;
202 /** Returns the Calc add-in function name for an Excel function name. */
203 String
GetScAddInName( const String
& rXclName
) const;
206 mutable XclImpRootData
& mrImpData
; /// Reference to the global import data struct.
209 // ============================================================================