Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SC_XEROOT_HXX
21 : #define SC_XEROOT_HXX
22 :
23 : #include <com/sun/star/beans/NamedValue.hpp>
24 :
25 : #include "xlroot.hxx"
26 : #include "compiler.hxx"
27 : #include <boost/shared_ptr.hpp>
28 :
29 : // Forward declarations of objects in public use ==============================
30 :
31 : class XclExpRecordBase;
32 : class XclExpString;
33 :
34 : typedef boost::shared_ptr< XclExpRecordBase > XclExpRecordRef;
35 : typedef boost::shared_ptr< XclExpString > XclExpStringRef;
36 :
37 : // Global data ================================================================
38 :
39 : class XclExpTabInfo;
40 : class XclExpAddressConverter;
41 : class XclExpFormulaCompiler;
42 : class XclExpProgressBar;
43 : class XclExpSst;
44 : class XclExpPalette;
45 : class XclExpFontBuffer;
46 : class XclExpNumFmtBuffer;
47 : class XclExpXFBuffer;
48 : class XclExpLinkManager;
49 : class XclExpNameManager;
50 : class XclExpObjectManager;
51 : class XclExpFilterManager;
52 : class XclExpPivotTableManager;
53 : class XclExpDxfs;
54 :
55 : /** Stores global buffers and data needed for Excel export filter. */
56 : struct XclExpRootData : public XclRootData
57 : {
58 : typedef boost::shared_ptr< XclExpTabInfo > XclExpTabInfoRef;
59 : typedef boost::shared_ptr< XclExpAddressConverter > XclExpAddrConvRef;
60 : typedef boost::shared_ptr< XclExpFormulaCompiler > XclExpFmlaCompRef;
61 : typedef boost::shared_ptr< XclExpProgressBar > XclExpProgressRef;
62 :
63 : typedef boost::shared_ptr< XclExpSst > XclExpSstRef;
64 : typedef boost::shared_ptr< XclExpPalette > XclExpPaletteRef;
65 : typedef boost::shared_ptr< XclExpFontBuffer > XclExpFontBfrRef;
66 : typedef boost::shared_ptr< XclExpNumFmtBuffer > XclExpNumFmtBfrRef;
67 : typedef boost::shared_ptr< XclExpXFBuffer > XclExpXFBfrRef;
68 : typedef boost::shared_ptr< XclExpNameManager > XclExpNameMgrRef;
69 : typedef boost::shared_ptr< XclExpLinkManager > XclExpLinkMgrRef;
70 : typedef boost::shared_ptr< XclExpObjectManager > XclExpObjectMgrRef;
71 : typedef boost::shared_ptr< XclExpFilterManager > XclExpFilterMgrRef;
72 : typedef boost::shared_ptr< XclExpPivotTableManager > XclExpPTableMgrRef;
73 : typedef boost::shared_ptr< XclExpDxfs > XclExpDxfsRef;
74 :
75 : XclExpTabInfoRef mxTabInfo; /// Calc->Excel sheet index conversion.
76 : XclExpAddrConvRef mxAddrConv; /// The address converter.
77 : XclExpFmlaCompRef mxFmlaComp; /// The formula compiler.
78 : XclExpProgressRef mxProgress; /// The export progress bar.
79 :
80 : XclExpSstRef mxSst; /// The shared string table.
81 : XclExpPaletteRef mxPalette; /// The color buffer.
82 : XclExpFontBfrRef mxFontBfr; /// All fonts in the file.
83 : XclExpNumFmtBfrRef mxNumFmtBfr; /// All number formats in the file.
84 : XclExpXFBfrRef mxXFBfr; /// All XF records in the file.
85 : XclExpNameMgrRef mxNameMgr; /// Internal defined names.
86 : XclExpLinkMgrRef mxGlobLinkMgr; /// Global link manager for defined names.
87 : XclExpLinkMgrRef mxLocLinkMgr; /// Local link manager for a sheet.
88 : XclExpObjectMgrRef mxObjMgr; /// All drawing objects.
89 : XclExpFilterMgrRef mxFilterMgr; /// Manager for filtered areas in all sheets.
90 : XclExpPTableMgrRef mxPTableMgr; /// All pivot tables and pivot caches.
91 : XclExpDxfsRef mxDxfs; /// All delta formatting entries
92 :
93 : ScCompiler::OpCodeMapPtr mxOpCodeMap; /// mapping between op-codes and names
94 :
95 : bool mbRelUrl; /// true = Store URLs relative.
96 :
97 : explicit XclExpRootData( XclBiff eBiff, SfxMedium& rMedium,
98 : SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc );
99 : virtual ~XclExpRootData();
100 : };
101 :
102 : /** Access to global data from other classes. */
103 0 : class XclExpRoot : public XclRoot
104 : {
105 : public:
106 : explicit XclExpRoot( XclExpRootData& rExpRootData );
107 :
108 : /** Returns this root instance - for code readability in derived classes. */
109 0 : inline const XclExpRoot& GetRoot() const { return *this; }
110 : /** Returns true, if URLs should be stored relative to the document location. */
111 0 : inline bool IsRelUrl() const { return mrExpData.mbRelUrl; }
112 :
113 : /** Returns the buffer for Calc->Excel sheet index conversion. */
114 : XclExpTabInfo& GetTabInfo() const;
115 : /** Returns the address converter. */
116 : XclExpAddressConverter& GetAddressConverter() const;
117 : /** Returns the formula compiler to produce formula token arrays. */
118 : XclExpFormulaCompiler& GetFormulaCompiler() const;
119 : /** Returns the export progress bar. */
120 : XclExpProgressBar& GetProgressBar() const;
121 :
122 : /** Returns the shared string table. */
123 : XclExpSst& GetSst() const;
124 : /** Returns the color buffer. */
125 : XclExpPalette& GetPalette() const;
126 : /** Returns the font buffer. */
127 : XclExpFontBuffer& GetFontBuffer() const;
128 : /** Returns the number format buffer. */
129 : XclExpNumFmtBuffer& GetNumFmtBuffer() const;
130 : /** Returns the cell formatting attributes buffer. */
131 : XclExpXFBuffer& GetXFBuffer() const;
132 : /** Returns the global link manager for defined names. */
133 : XclExpLinkManager& GetGlobalLinkManager() const;
134 : /** Returns the local link manager for the current sheet. */
135 : XclExpLinkManager& GetLocalLinkManager() const;
136 : /** Returns the buffer that contains internal defined names. */
137 : XclExpNameManager& GetNameManager() const;
138 : /** Returns the drawing object manager. */
139 : XclExpObjectManager& GetObjectManager() const;
140 : /** Returns the filter manager. */
141 : XclExpFilterManager& GetFilterManager() const;
142 : /** Returns the pivot table manager. */
143 : XclExpPivotTableManager& GetPivotTableManager() const;
144 : /** Returns the differential formatting list */
145 : XclExpDxfs& GetDxfs() const;
146 :
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;
158 :
159 : bool IsDocumentEncrypted() const;
160 :
161 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateEncryptionData( const OUString& aPass ) const;
162 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData() const;
163 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateDefaultEncryptionData() const;
164 :
165 : private:
166 :
167 : /** Returns the local or global link manager, depending on current context. */
168 : XclExpRootData::XclExpLinkMgrRef GetLocalLinkMgrRef() const;
169 :
170 : private:
171 : XclExpRootData& mrExpData; /// Reference to the global export data struct.
172 : };
173 :
174 : #endif
175 :
176 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|