1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 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_XIROOT_HXX 25cdf0e10cSrcweir #define SC_XIROOT_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "xlroot.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir // Forward declarations of objects in public use ============================== 30cdf0e10cSrcweir 31cdf0e10cSrcweir class XclImpStream; 32cdf0e10cSrcweir class XclImpString; 33cdf0e10cSrcweir 34cdf0e10cSrcweir typedef ScfRef< XclImpString > XclImpStringRef; 35cdf0e10cSrcweir 36cdf0e10cSrcweir // Global data ================================================================ 37cdf0e10cSrcweir 38cdf0e10cSrcweir class XclImpAddressConverter; 39cdf0e10cSrcweir class XclImpFormulaCompiler; 40cdf0e10cSrcweir class XclImpSst; 41cdf0e10cSrcweir class XclImpPalette; 42cdf0e10cSrcweir class XclImpFontBuffer; 43cdf0e10cSrcweir class XclImpNumFmtBuffer; 44cdf0e10cSrcweir class XclImpXFBuffer; 45cdf0e10cSrcweir class XclImpXFRangeBuffer; 46cdf0e10cSrcweir class XclImpTabInfo; 47cdf0e10cSrcweir class XclImpNameManager; 48cdf0e10cSrcweir class XclImpLinkManager; 49cdf0e10cSrcweir class XclImpObjectManager; 50cdf0e10cSrcweir class XclImpSheetDrawing; 51cdf0e10cSrcweir class XclImpCondFormatManager; 52cdf0e10cSrcweir class XclImpAutoFilterBuffer; 53cdf0e10cSrcweir class XclImpWebQueryBuffer; 54cdf0e10cSrcweir class XclImpPivotTableManager; 55cdf0e10cSrcweir class XclImpPageSettings; 56cdf0e10cSrcweir class XclImpDocViewSettings; 57cdf0e10cSrcweir class XclImpTabViewSettings; 58cdf0e10cSrcweir class XclImpSheetProtectBuffer; 59cdf0e10cSrcweir class XclImpDocProtectBuffer; 60cdf0e10cSrcweir 61cdf0e10cSrcweir class _ScRangeListTabs; 62cdf0e10cSrcweir class ExcelToSc; 63cdf0e10cSrcweir 64cdf0e10cSrcweir /** Stores global buffers and data needed for Excel import filter. */ 65cdf0e10cSrcweir struct XclImpRootData : public XclRootData 66cdf0e10cSrcweir { 67cdf0e10cSrcweir typedef ScfRef< XclImpAddressConverter > XclImpAddrConvRef; 68cdf0e10cSrcweir typedef ScfRef< XclImpFormulaCompiler > XclImpFmlaCompRef; 69cdf0e10cSrcweir 70cdf0e10cSrcweir typedef ScfRef< XclImpSst > XclImpSstRef; 71cdf0e10cSrcweir typedef ScfRef< XclImpPalette > XclImpPaletteRef; 72cdf0e10cSrcweir typedef ScfRef< XclImpFontBuffer > XclImpFontBfrRef; 73cdf0e10cSrcweir typedef ScfRef< XclImpNumFmtBuffer > XclImpNumFmtBfrRef; 74cdf0e10cSrcweir typedef ScfRef< XclImpXFBuffer > XclImpXFBfrRef; 75cdf0e10cSrcweir typedef ScfRef< XclImpXFRangeBuffer > XclImpXFRangeBfrRef; 76cdf0e10cSrcweir typedef ScfRef< XclImpTabInfo > XclImpTabInfoRef; 77cdf0e10cSrcweir typedef ScfRef< XclImpNameManager > XclImpNameMgrRef; 78cdf0e10cSrcweir typedef ScfRef< XclImpLinkManager > XclImpLinkMgrRef; 79cdf0e10cSrcweir typedef ScfRef< XclImpObjectManager > XclImpObjectMgrRef; 80cdf0e10cSrcweir typedef ScfRef< XclImpCondFormatManager > XclImpCondFmtMgrRef; 81cdf0e10cSrcweir typedef ScfRef< XclImpWebQueryBuffer > XclImpWebQueryBfrRef; 82cdf0e10cSrcweir typedef ScfRef< XclImpPivotTableManager > XclImpPTableMgrRef; 83cdf0e10cSrcweir typedef ScfRef< XclImpPageSettings > XclImpPageSettRef; 84cdf0e10cSrcweir typedef ScfRef< XclImpDocViewSettings > XclImpDocViewSettRef; 85cdf0e10cSrcweir typedef ScfRef< XclImpTabViewSettings > XclImpTabViewSettRef; 86cdf0e10cSrcweir typedef ScfRef< XclImpSheetProtectBuffer > XclImpTabProtectRef; 87cdf0e10cSrcweir typedef ScfRef< XclImpDocProtectBuffer > XclImpDocProtectRef; 88cdf0e10cSrcweir 89cdf0e10cSrcweir XclImpAddrConvRef mxAddrConv; /// The address converter. 90cdf0e10cSrcweir XclImpFmlaCompRef mxFmlaComp; /// The formula compiler. 91cdf0e10cSrcweir 92cdf0e10cSrcweir XclImpSstRef mxSst; /// The shared string table. 93cdf0e10cSrcweir XclImpPaletteRef mxPalette; /// The color buffer. 94cdf0e10cSrcweir XclImpFontBfrRef mxFontBfr; /// All fonts in the file. 95cdf0e10cSrcweir XclImpNumFmtBfrRef mxNumFmtBfr; /// All number formats in the file. 96cdf0e10cSrcweir XclImpXFBfrRef mpXFBfr; /// All XF record data in the file. 97cdf0e10cSrcweir XclImpXFRangeBfrRef mxXFRangeBfr; /// Buffer of XF index ranges in a sheet. 98cdf0e10cSrcweir 99cdf0e10cSrcweir XclImpTabInfoRef mxTabInfo; /// Sheet creation order list. 100cdf0e10cSrcweir XclImpNameMgrRef mxNameMgr; /// Internal defined names. 101cdf0e10cSrcweir XclImpLinkMgrRef mxLinkMgr; /// Manager for internal/external links. 102cdf0e10cSrcweir 103cdf0e10cSrcweir XclImpObjectMgrRef mxObjMgr; /// All drawing objects. 104cdf0e10cSrcweir XclImpCondFmtMgrRef mxCondFmtMgr; /// Conditional formattings. 105cdf0e10cSrcweir XclImpWebQueryBfrRef mxWebQueryBfr; /// All web queries. 106cdf0e10cSrcweir XclImpPTableMgrRef mxPTableMgr; /// All pivot tables and pivot caches. 107cdf0e10cSrcweir 108cdf0e10cSrcweir XclImpPageSettRef mxPageSett; /// Page settings for current sheet. 109cdf0e10cSrcweir XclImpDocViewSettRef mxDocViewSett; /// View settings for entire document. 110cdf0e10cSrcweir XclImpTabViewSettRef mxTabViewSett; /// View settings for current sheet. 111cdf0e10cSrcweir XclImpTabProtectRef mxTabProtect; /// Sheet protection options for current sheet. 112cdf0e10cSrcweir XclImpDocProtectRef mxDocProtect; /// Document protection options. 113cdf0e10cSrcweir 114cdf0e10cSrcweir bool mbHasCodePage; /// true = CODEPAGE record exists. 115cdf0e10cSrcweir bool mbHasBasic; /// true = document contains VB project. 116cdf0e10cSrcweir 117cdf0e10cSrcweir explicit XclImpRootData( XclBiff eBiff, SfxMedium& rMedium, 118cdf0e10cSrcweir SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ); 119cdf0e10cSrcweir virtual ~XclImpRootData(); 120cdf0e10cSrcweir }; 121cdf0e10cSrcweir 122cdf0e10cSrcweir // ---------------------------------------------------------------------------- 123cdf0e10cSrcweir 124cdf0e10cSrcweir /** Access to global data from other classes. */ 125cdf0e10cSrcweir class XclImpRoot : public XclRoot 126cdf0e10cSrcweir { 127cdf0e10cSrcweir public: 128cdf0e10cSrcweir explicit XclImpRoot( XclImpRootData& rImpRootData ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir /** Returns this root instance - for code readability in derived classes. */ GetRoot() const131cdf0e10cSrcweir inline const XclImpRoot& GetRoot() const { return *this; } 132cdf0e10cSrcweir 133cdf0e10cSrcweir /** Sets a code page read from a CODEPAGE record for byte string import. */ 134cdf0e10cSrcweir void SetCodePage( sal_uInt16 nCodePage ); 135cdf0e10cSrcweir /** Sets text encoding from the default application font (in case of missing CODEPAGE record). */ 136cdf0e10cSrcweir void SetAppFontEncoding( rtl_TextEncoding eAppFontEnc ); 137cdf0e10cSrcweir 138cdf0e10cSrcweir /** Is called when import filter starts importing a single sheet (all BIFF versions). */ 139cdf0e10cSrcweir void InitializeTable( SCTAB nScTab ); 140cdf0e10cSrcweir /** Is called when import filter stops importing a single sheet (all BIFF versions). */ 141cdf0e10cSrcweir void FinalizeTable(); 142cdf0e10cSrcweir 143cdf0e10cSrcweir /** Returns the address converter. */ 144cdf0e10cSrcweir XclImpAddressConverter& GetAddressConverter() const; 145cdf0e10cSrcweir /** Returns the formula converter. */ 146cdf0e10cSrcweir XclImpFormulaCompiler& GetFormulaCompiler() const; 147cdf0e10cSrcweir /** Returns the old formula converter. */ 148cdf0e10cSrcweir ExcelToSc& GetOldFmlaConverter() const; 149cdf0e10cSrcweir 150cdf0e10cSrcweir /** Returns the shared string table. */ 151cdf0e10cSrcweir XclImpSst& GetSst() const; 152cdf0e10cSrcweir /** Returns the color buffer. */ 153cdf0e10cSrcweir XclImpPalette& GetPalette() const; 154cdf0e10cSrcweir /** Returns the font buffer. */ 155cdf0e10cSrcweir XclImpFontBuffer& GetFontBuffer() const; 156cdf0e10cSrcweir /** Returns the number format buffer. */ 157cdf0e10cSrcweir XclImpNumFmtBuffer& GetNumFmtBuffer() const; 158cdf0e10cSrcweir /** Returns the cell formatting attributes buffer. */ 159cdf0e10cSrcweir XclImpXFBuffer& GetXFBuffer() const; 160cdf0e10cSrcweir /** Returns the buffer of XF index ranges for a sheet. */ 161cdf0e10cSrcweir XclImpXFRangeBuffer& GetXFRangeBuffer() const; 162cdf0e10cSrcweir 163cdf0e10cSrcweir /** Returns the buffer that contains all print areas in the document. */ 164cdf0e10cSrcweir _ScRangeListTabs& GetPrintAreaBuffer() const; 165cdf0e10cSrcweir /** Returns the buffer that contains all print titles in the document. */ 166cdf0e10cSrcweir _ScRangeListTabs& GetTitleAreaBuffer() const; 167cdf0e10cSrcweir 168cdf0e10cSrcweir /** Returns the buffer that contains the sheet creation order. */ 169cdf0e10cSrcweir XclImpTabInfo& GetTabInfo() const; 170cdf0e10cSrcweir /** Returns the buffer that contains internal defined names. */ 171cdf0e10cSrcweir XclImpNameManager& GetNameManager() const; 172cdf0e10cSrcweir /** Returns the link manager. */ 173cdf0e10cSrcweir XclImpLinkManager& GetLinkManager() const; 174cdf0e10cSrcweir 175cdf0e10cSrcweir /** Returns the drawing object manager. */ 176cdf0e10cSrcweir XclImpObjectManager& GetObjectManager() const; 177cdf0e10cSrcweir /** Returns the drawing container of the current sheet. */ 178cdf0e10cSrcweir XclImpSheetDrawing& GetCurrSheetDrawing() const; 179cdf0e10cSrcweir /** Returns the conditional formattings manager. */ 180cdf0e10cSrcweir XclImpCondFormatManager& GetCondFormatManager() const; 181cdf0e10cSrcweir /** Returns the filter manager. */ 182cdf0e10cSrcweir XclImpAutoFilterBuffer& GetFilterManager() const; 183cdf0e10cSrcweir /** Returns the web query buffer. */ 184cdf0e10cSrcweir XclImpWebQueryBuffer& GetWebQueryBuffer() const; 185cdf0e10cSrcweir /** Returns the pivot table manager. */ 186cdf0e10cSrcweir XclImpPivotTableManager& GetPivotTableManager() const; 187cdf0e10cSrcweir /** Returns the sheet protection options of the current sheet. */ 188cdf0e10cSrcweir XclImpSheetProtectBuffer& GetSheetProtectBuffer() const; 189cdf0e10cSrcweir /** Returns the document protection options. */ 190cdf0e10cSrcweir XclImpDocProtectBuffer& GetDocProtectBuffer() const; 191cdf0e10cSrcweir 192cdf0e10cSrcweir /** Returns the page settings of the current sheet. */ 193cdf0e10cSrcweir XclImpPageSettings& GetPageSettings() const; 194cdf0e10cSrcweir /** Returns the view settings of the entire document. */ 195cdf0e10cSrcweir XclImpDocViewSettings& GetDocViewSettings() const; 196cdf0e10cSrcweir /** Returns the view settings of the current sheet. */ 197cdf0e10cSrcweir XclImpTabViewSettings& GetTabViewSettings() const; 198cdf0e10cSrcweir 199cdf0e10cSrcweir /** Returns the Calc add-in function name for an Excel function name. */ 200cdf0e10cSrcweir String GetScAddInName( const String& rXclName ) const; 201cdf0e10cSrcweir 202cdf0e10cSrcweir /** Returns true, if the document contains a VB project. */ HasBasic() const203cdf0e10cSrcweir inline bool HasBasic() const { return mrImpData.mbHasBasic; } 204cdf0e10cSrcweir /** Called to indicate that the document contains a VB project. */ SetHasBasic()205cdf0e10cSrcweir inline void SetHasBasic() { mrImpData.mbHasBasic = true; } 206cdf0e10cSrcweir /** Reads the CODENAME record and inserts the codename into the document. */ 207cdf0e10cSrcweir void ReadCodeName( XclImpStream& rStrm, bool bGlobals ); 208cdf0e10cSrcweir 209cdf0e10cSrcweir private: 2107925e912SMichael Stahl XclImpRootData& mrImpData; /// Reference to the global import data struct. 211cdf0e10cSrcweir }; 212cdf0e10cSrcweir 213cdf0e10cSrcweir // ============================================================================ 214cdf0e10cSrcweir 215cdf0e10cSrcweir #endif 216