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