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

Generated by: LCOV version 1.11