Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef SC_XEROOT_HXX
30 : : #define SC_XEROOT_HXX
31 : :
32 : : #include <com/sun/star/beans/NamedValue.hpp>
33 : :
34 : : #include "xlroot.hxx"
35 : : #include <boost/shared_ptr.hpp>
36 : :
37 : : // Forward declarations of objects in public use ==============================
38 : :
39 : : class XclExpRecordBase;
40 : : class XclExpString;
41 : :
42 : : typedef boost::shared_ptr< XclExpRecordBase > XclExpRecordRef;
43 : : typedef boost::shared_ptr< XclExpString > XclExpStringRef;
44 : :
45 : : // Global data ================================================================
46 : :
47 : : class XclExpTabInfo;
48 : : class XclExpAddressConverter;
49 : : class XclExpFormulaCompiler;
50 : : class XclExpProgressBar;
51 : : class XclExpSst;
52 : : class XclExpPalette;
53 : : class XclExpFontBuffer;
54 : : class XclExpNumFmtBuffer;
55 : : class XclExpXFBuffer;
56 : : class XclExpLinkManager;
57 : : class XclExpNameManager;
58 : : class XclExpObjectManager;
59 : : class XclExpFilterManager;
60 : : class XclExpPivotTableManager;
61 : : class XclExpDxfs;
62 : :
63 : : /** Stores global buffers and data needed for Excel export filter. */
64 : : struct XclExpRootData : public XclRootData
65 : : {
66 : : typedef boost::shared_ptr< XclExpTabInfo > XclExpTabInfoRef;
67 : : typedef boost::shared_ptr< XclExpAddressConverter > XclExpAddrConvRef;
68 : : typedef boost::shared_ptr< XclExpFormulaCompiler > XclExpFmlaCompRef;
69 : : typedef boost::shared_ptr< XclExpProgressBar > XclExpProgressRef;
70 : :
71 : : typedef boost::shared_ptr< XclExpSst > XclExpSstRef;
72 : : typedef boost::shared_ptr< XclExpPalette > XclExpPaletteRef;
73 : : typedef boost::shared_ptr< XclExpFontBuffer > XclExpFontBfrRef;
74 : : typedef boost::shared_ptr< XclExpNumFmtBuffer > XclExpNumFmtBfrRef;
75 : : typedef boost::shared_ptr< XclExpXFBuffer > XclExpXFBfrRef;
76 : : typedef boost::shared_ptr< XclExpNameManager > XclExpNameMgrRef;
77 : : typedef boost::shared_ptr< XclExpLinkManager > XclExpLinkMgrRef;
78 : : typedef boost::shared_ptr< XclExpObjectManager > XclExpObjectMgrRef;
79 : : typedef boost::shared_ptr< XclExpFilterManager > XclExpFilterMgrRef;
80 : : typedef boost::shared_ptr< XclExpPivotTableManager > XclExpPTableMgrRef;
81 : : typedef boost::shared_ptr< XclExpDxfs > XclExpDxfsRef;
82 : :
83 : : XclExpTabInfoRef mxTabInfo; /// Calc->Excel sheet index conversion.
84 : : XclExpAddrConvRef mxAddrConv; /// The address converter.
85 : : XclExpFmlaCompRef mxFmlaComp; /// The formula compiler.
86 : : XclExpProgressRef mxProgress; /// The export progress bar.
87 : :
88 : : XclExpSstRef mxSst; /// The shared string table.
89 : : XclExpPaletteRef mxPalette; /// The color buffer.
90 : : XclExpFontBfrRef mxFontBfr; /// All fonts in the file.
91 : : XclExpNumFmtBfrRef mxNumFmtBfr; /// All number formats in the file.
92 : : XclExpXFBfrRef mxXFBfr; /// All XF records in the file.
93 : : XclExpNameMgrRef mxNameMgr; /// Internal defined names.
94 : : XclExpLinkMgrRef mxGlobLinkMgr; /// Global link manager for defined names.
95 : : XclExpLinkMgrRef mxLocLinkMgr; /// Local link manager for a sheet.
96 : : XclExpObjectMgrRef mxObjMgr; /// All drawing objects.
97 : : XclExpFilterMgrRef mxFilterMgr; /// Manager for filtered areas in all sheets.
98 : : XclExpPTableMgrRef mxPTableMgr; /// All pivot tables and pivot caches.
99 : : XclExpDxfsRef mxDxfs; /// All delta formatting entries
100 : :
101 : : bool mbRelUrl; /// true = Store URLs relative.
102 : :
103 : : explicit XclExpRootData( XclBiff eBiff, SfxMedium& rMedium,
104 : : SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc );
105 : : virtual ~XclExpRootData();
106 : : };
107 : :
108 : : // ----------------------------------------------------------------------------
109 : :
110 : : /** Access to global data from other classes. */
111 [ # # ][ # # ]: 0 : class XclExpRoot : public XclRoot
112 : : {
113 : : public:
114 : : explicit XclExpRoot( XclExpRootData& rExpRootData );
115 : :
116 : : /** Returns this root instance - for code readability in derived classes. */
117 : 0 : inline const XclExpRoot& GetRoot() const { return *this; }
118 : : /** Returns true, if URLs should be stored relative to the document location. */
119 : 0 : inline bool IsRelUrl() const { return mrExpData.mbRelUrl; }
120 : :
121 : : /** Returns the buffer for Calc->Excel sheet index conversion. */
122 : : XclExpTabInfo& GetTabInfo() const;
123 : : /** Returns the address converter. */
124 : : XclExpAddressConverter& GetAddressConverter() const;
125 : : /** Returns the formula compiler to produce formula token arrays. */
126 : : XclExpFormulaCompiler& GetFormulaCompiler() const;
127 : : /** Returns the export progress bar. */
128 : : XclExpProgressBar& GetProgressBar() const;
129 : :
130 : : /** Returns the shared string table. */
131 : : XclExpSst& GetSst() const;
132 : : /** Returns the color buffer. */
133 : : XclExpPalette& GetPalette() const;
134 : : /** Returns the font buffer. */
135 : : XclExpFontBuffer& GetFontBuffer() const;
136 : : /** Returns the number format buffer. */
137 : : XclExpNumFmtBuffer& GetNumFmtBuffer() const;
138 : : /** Returns the cell formatting attributes buffer. */
139 : : XclExpXFBuffer& GetXFBuffer() const;
140 : : /** Returns the global link manager for defined names. */
141 : : XclExpLinkManager& GetGlobalLinkManager() const;
142 : : /** Returns the local link manager for the current sheet. */
143 : : XclExpLinkManager& GetLocalLinkManager() const;
144 : : /** Returns the buffer that contains internal defined names. */
145 : : XclExpNameManager& GetNameManager() const;
146 : : /** Returns the drawing object manager. */
147 : : XclExpObjectManager& GetObjectManager() const;
148 : : /** Returns the filter manager. */
149 : : XclExpFilterManager& GetFilterManager() const;
150 : : /** Returns the pivot table manager. */
151 : : XclExpPivotTableManager& GetPivotTableManager() const;
152 : : /** Returns the differential formatting list */
153 : : XclExpDxfs& GetDxfs() const;
154 : :
155 : : /** Is called when export filter starts to create the Excel document (all BIFF versions). */
156 : : void InitializeConvert();
157 : : /** Is called when export filter starts to create the workbook global data (>=BIFF5). */
158 : : void InitializeGlobals();
159 : : /** Is called when export filter starts to create data for a single sheet (all BIFF versions). */
160 : : void InitializeTable( SCTAB nScTab );
161 : : /** Is called before export filter starts to write the records to the stream. */
162 : : void InitializeSave();
163 : : /** Returns the reference to a record (or record list) representing a root object.
164 : : @param nRecId Identifier that specifies which record is returned. */
165 : : XclExpRecordRef CreateRecord( sal_uInt16 nRecId ) const;
166 : :
167 : : bool IsDocumentEncrypted() const;
168 : :
169 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateEncryptionData( const ::rtl::OUString& aPass ) const;
170 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData() const;
171 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateDefaultEncryptionData() const;
172 : :
173 : : private:
174 : :
175 : : /** Returns the local or global link manager, depending on current context. */
176 : : XclExpRootData::XclExpLinkMgrRef GetLocalLinkMgrRef() const;
177 : :
178 : : private:
179 : : XclExpRootData& mrExpData; /// Reference to the global export data struct.
180 : : };
181 : :
182 : : // ============================================================================
183 : :
184 : : #endif
185 : :
186 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|