LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - xiroot.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 4 100.0 %
Date: 2012-12-27 Functions: 5 6 83.3 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10