1*38d50f7bSAndrew Rist /************************************************************** 2*38d50f7bSAndrew Rist * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_XEROOT_HXX 25cdf0e10cSrcweir #define SC_XEROOT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp> 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "xlroot.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir // Forward declarations of objects in public use ============================== 32cdf0e10cSrcweir 33cdf0e10cSrcweir class XclExpStream; 34cdf0e10cSrcweir class XclExpRecordBase; 35cdf0e10cSrcweir class XclExpString; 36cdf0e10cSrcweir 37cdf0e10cSrcweir typedef ScfRef< XclExpRecordBase > XclExpRecordRef; 38cdf0e10cSrcweir typedef ScfRef< XclExpString > XclExpStringRef; 39cdf0e10cSrcweir 40cdf0e10cSrcweir // Global data ================================================================ 41cdf0e10cSrcweir 42cdf0e10cSrcweir class XclExpTabInfo; 43cdf0e10cSrcweir class XclExpAddressConverter; 44cdf0e10cSrcweir class XclExpFormulaCompiler; 45cdf0e10cSrcweir class XclExpProgressBar; 46cdf0e10cSrcweir class XclExpSst; 47cdf0e10cSrcweir class XclExpPalette; 48cdf0e10cSrcweir class XclExpFontBuffer; 49cdf0e10cSrcweir class XclExpNumFmtBuffer; 50cdf0e10cSrcweir class XclExpXFBuffer; 51cdf0e10cSrcweir class XclExpLinkManager; 52cdf0e10cSrcweir class XclExpNameManager; 53cdf0e10cSrcweir class XclExpObjectManager; 54cdf0e10cSrcweir class XclExpFilterManager; 55cdf0e10cSrcweir class XclExpPivotTableManager; 56cdf0e10cSrcweir 57cdf0e10cSrcweir /** Stores global buffers and data needed for Excel export filter. */ 58cdf0e10cSrcweir struct XclExpRootData : public XclRootData 59cdf0e10cSrcweir { 60cdf0e10cSrcweir typedef ScfRef< XclExpTabInfo > XclExpTabInfoRef; 61cdf0e10cSrcweir typedef ScfRef< XclExpAddressConverter > XclExpAddrConvRef; 62cdf0e10cSrcweir typedef ScfRef< XclExpFormulaCompiler > XclExpFmlaCompRef; 63cdf0e10cSrcweir typedef ScfRef< XclExpProgressBar > XclExpProgressRef; 64cdf0e10cSrcweir 65cdf0e10cSrcweir typedef ScfRef< XclExpSst > XclExpSstRef; 66cdf0e10cSrcweir typedef ScfRef< XclExpPalette > XclExpPaletteRef; 67cdf0e10cSrcweir typedef ScfRef< XclExpFontBuffer > XclExpFontBfrRef; 68cdf0e10cSrcweir typedef ScfRef< XclExpNumFmtBuffer > XclExpNumFmtBfrRef; 69cdf0e10cSrcweir typedef ScfRef< XclExpXFBuffer > XclExpXFBfrRef; 70cdf0e10cSrcweir typedef ScfRef< XclExpNameManager > XclExpNameMgrRef; 71cdf0e10cSrcweir typedef ScfRef< XclExpLinkManager > XclExpLinkMgrRef; 72cdf0e10cSrcweir typedef ScfRef< XclExpObjectManager > XclExpObjectMgrRef; 73cdf0e10cSrcweir typedef ScfRef< XclExpFilterManager > XclExpFilterMgrRef; 74cdf0e10cSrcweir typedef ScfRef< XclExpPivotTableManager > XclExpPTableMgrRef; 75cdf0e10cSrcweir 76cdf0e10cSrcweir XclExpTabInfoRef mxTabInfo; /// Calc->Excel sheet index conversion. 77cdf0e10cSrcweir XclExpAddrConvRef mxAddrConv; /// The address converter. 78cdf0e10cSrcweir XclExpFmlaCompRef mxFmlaComp; /// The formula compiler. 79cdf0e10cSrcweir XclExpProgressRef mxProgress; /// The export progress bar. 80cdf0e10cSrcweir 81cdf0e10cSrcweir XclExpSstRef mxSst; /// The shared string table. 82cdf0e10cSrcweir XclExpPaletteRef mxPalette; /// The color buffer. 83cdf0e10cSrcweir XclExpFontBfrRef mxFontBfr; /// All fonts in the file. 84cdf0e10cSrcweir XclExpNumFmtBfrRef mxNumFmtBfr; /// All number formats in the file. 85cdf0e10cSrcweir XclExpXFBfrRef mxXFBfr; /// All XF records in the file. 86cdf0e10cSrcweir XclExpNameMgrRef mxNameMgr; /// Internal defined names. 87cdf0e10cSrcweir XclExpLinkMgrRef mxGlobLinkMgr; /// Global link manager for defined names. 88cdf0e10cSrcweir XclExpLinkMgrRef mxLocLinkMgr; /// Local link manager for a sheet. 89cdf0e10cSrcweir XclExpObjectMgrRef mxObjMgr; /// All drawing objects. 90cdf0e10cSrcweir XclExpFilterMgrRef mxFilterMgr; /// Manager for filtered areas in all sheets. 91cdf0e10cSrcweir XclExpPTableMgrRef mxPTableMgr; /// All pivot tables and pivot caches. 92cdf0e10cSrcweir 93cdf0e10cSrcweir bool mbRelUrl; /// true = Store URLs relative. 94cdf0e10cSrcweir 95cdf0e10cSrcweir explicit XclExpRootData( XclBiff eBiff, SfxMedium& rMedium, 96cdf0e10cSrcweir SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ); 97cdf0e10cSrcweir virtual ~XclExpRootData(); 98cdf0e10cSrcweir }; 99cdf0e10cSrcweir 100cdf0e10cSrcweir // ---------------------------------------------------------------------------- 101cdf0e10cSrcweir 102cdf0e10cSrcweir /** Access to global data from other classes. */ 103cdf0e10cSrcweir class XclExpRoot : public XclRoot 104cdf0e10cSrcweir { 105cdf0e10cSrcweir public: 106cdf0e10cSrcweir explicit XclExpRoot( XclExpRootData& rExpRootData ); 107cdf0e10cSrcweir 108cdf0e10cSrcweir /** Returns this root instance - for code readability in derived classes. */ GetRoot() const109cdf0e10cSrcweir inline const XclExpRoot& GetRoot() const { return *this; } 110cdf0e10cSrcweir /** Returns true, if URLs should be stored relative to the document location. */ IsRelUrl() const111cdf0e10cSrcweir inline bool IsRelUrl() const { return mrExpData.mbRelUrl; } 112cdf0e10cSrcweir 113cdf0e10cSrcweir /** Returns the buffer for Calc->Excel sheet index conversion. */ 114cdf0e10cSrcweir XclExpTabInfo& GetTabInfo() const; 115cdf0e10cSrcweir /** Returns the address converter. */ 116cdf0e10cSrcweir XclExpAddressConverter& GetAddressConverter() const; 117cdf0e10cSrcweir /** Returns the formula compiler to produce formula token arrays. */ 118cdf0e10cSrcweir XclExpFormulaCompiler& GetFormulaCompiler() const; 119cdf0e10cSrcweir /** Returns the export progress bar. */ 120cdf0e10cSrcweir XclExpProgressBar& GetProgressBar() const; 121cdf0e10cSrcweir 122cdf0e10cSrcweir /** Returns the shared string table. */ 123cdf0e10cSrcweir XclExpSst& GetSst() const; 124cdf0e10cSrcweir /** Returns the color buffer. */ 125cdf0e10cSrcweir XclExpPalette& GetPalette() const; 126cdf0e10cSrcweir /** Returns the font buffer. */ 127cdf0e10cSrcweir XclExpFontBuffer& GetFontBuffer() const; 128cdf0e10cSrcweir /** Returns the number format buffer. */ 129cdf0e10cSrcweir XclExpNumFmtBuffer& GetNumFmtBuffer() const; 130cdf0e10cSrcweir /** Returns the cell formatting attributes buffer. */ 131cdf0e10cSrcweir XclExpXFBuffer& GetXFBuffer() const; 132cdf0e10cSrcweir /** Returns the global link manager for defined names. */ 133cdf0e10cSrcweir XclExpLinkManager& GetGlobalLinkManager() const; 134cdf0e10cSrcweir /** Returns the local link manager for the current sheet. */ 135cdf0e10cSrcweir XclExpLinkManager& GetLocalLinkManager() const; 136cdf0e10cSrcweir /** Returns the buffer that contains internal defined names. */ 137cdf0e10cSrcweir XclExpNameManager& GetNameManager() const; 138cdf0e10cSrcweir /** Returns the drawing object manager. */ 139cdf0e10cSrcweir XclExpObjectManager& GetObjectManager() const; 140cdf0e10cSrcweir /** Returns the filter manager. */ 141cdf0e10cSrcweir XclExpFilterManager& GetFilterManager() const; 142cdf0e10cSrcweir /** Returns the pivot table manager. */ 143cdf0e10cSrcweir XclExpPivotTableManager& GetPivotTableManager() const; 144cdf0e10cSrcweir 145cdf0e10cSrcweir /** Is called when export filter starts to create the Excel document (all BIFF versions). */ 146cdf0e10cSrcweir void InitializeConvert(); 147cdf0e10cSrcweir /** Is called when export filter starts to create the workbook global data (>=BIFF5). */ 148cdf0e10cSrcweir void InitializeGlobals(); 149cdf0e10cSrcweir /** Is called when export filter starts to create data for a single sheet (all BIFF versions). */ 150cdf0e10cSrcweir void InitializeTable( SCTAB nScTab ); 151cdf0e10cSrcweir /** Is called before export filter starts to write the records to the stream. */ 152cdf0e10cSrcweir void InitializeSave(); 153cdf0e10cSrcweir /** Returns the reference to a record (or record list) representing a root object. 154cdf0e10cSrcweir @param nRecId Identifier that specifies which record is returned. */ 155cdf0e10cSrcweir XclExpRecordRef CreateRecord( sal_uInt16 nRecId ) const; 156cdf0e10cSrcweir 157cdf0e10cSrcweir bool IsDocumentEncrypted() const; 158cdf0e10cSrcweir 159cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateEncryptionData( const ::rtl::OUString& aPass ) const; 160cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GetEncryptionData() const; 161cdf0e10cSrcweir ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > GenerateDefaultEncryptionData() const; 162cdf0e10cSrcweir 163cdf0e10cSrcweir private: 164cdf0e10cSrcweir 165cdf0e10cSrcweir /** Returns the local or global link manager, depending on current context. */ 166cdf0e10cSrcweir XclExpRootData::XclExpLinkMgrRef GetLocalLinkMgrRef() const; 167cdf0e10cSrcweir 168cdf0e10cSrcweir private: 1697925e912SMichael Stahl XclExpRootData& mrExpData; /// Reference to the global export data struct. 170cdf0e10cSrcweir }; 171cdf0e10cSrcweir 172cdf0e10cSrcweir // ============================================================================ 173cdf0e10cSrcweir 174cdf0e10cSrcweir #endif 175cdf0e10cSrcweir 176