LCOV - code coverage report
Current view: top level - libreoffice/sc/source/filter/inc - excform.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 7 71.4 %
Date: 2012-12-27 Functions: 3 4 75.0 %
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_EXCFORM_HXX
      21             : #define SC_EXCFORM_HXX
      22             : 
      23             : #include "xlformula.hxx"
      24             : #include "xiroot.hxx"
      25             : #include "formel.hxx"
      26             : 
      27             : #include <vector>
      28             : 
      29             : class ScFormulaCell;
      30             : class ScRangeList;
      31             : 
      32             : 
      33             : class ExcelToSc : public ExcelConverterBase, protected XclImpRoot
      34             : {
      35             : protected:
      36             :     enum ExtensionType { EXTENSION_ARRAY, EXTENSION_NLR, EXTENSION_MEMAREA };
      37             :     typedef ::std::vector< ExtensionType >          ExtensionTypeVec;
      38             : 
      39             :     sal_Bool                bExternName;    // wenn External Name gefunden wurde
      40             :     static const sal_uInt16 nRowMask;
      41             :     static const sal_uInt16 nLastInd;       // letzter Index fuer Excel->SC-
      42             :                                         // Token Umsetzung
      43             :     XclFunctionProvider maFuncProv;
      44             :     const XclBiff       meBiff;
      45             : 
      46             :     // ---------------------------------------------------------------
      47             :     void                DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs );
      48             : 
      49             :     void                ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData&, const sal_Bool bName );
      50             : 
      51             : public:
      52             :                         ExcelToSc( const XclImpRoot& rRoot );
      53             :     virtual             ~ExcelToSc();
      54             :     virtual ConvErr     Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
      55             :                                  bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
      56             : 
      57             :     virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
      58             : 
      59             :     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
      60             :                                            const String& rUrl, const ::std::vector<String>& rTabNames );
      61             : 
      62             :     virtual sal_Bool        GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen );
      63             : 
      64             :     void                GetDummy( const ScTokenArray*& );
      65             :     const ScTokenArray* GetBoolErr( XclBoolError );
      66             :     sal_Bool                GetShrFmla( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen );
      67             : 
      68             :     static void         SetError( ScFormulaCell& rCell, const ConvErr eErr );
      69             : 
      70             :     static inline sal_Bool  IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 );
      71             :     static inline sal_Bool  IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 );
      72             : 
      73             :     void                SetComplCol( ScComplexRefData& );
      74             :     void                SetComplRow( ScComplexRefData& );
      75             : 
      76             :     void                ReadExtensions( const ExtensionTypeVec& rExtensions,
      77             :                                         XclImpStream& aIn );
      78             :     void                ReadExtensionArray( unsigned int n,
      79             :                                             XclImpStream& aIn );
      80             :     void                ReadExtensionNlr( XclImpStream& aIn );
      81             :     void                ReadExtensionMemArea( XclImpStream& aIn );
      82             : };
      83             : 
      84             : 
      85        2136 : inline sal_Bool ExcelToSc::IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 )
      86             : {
      87        2136 :     return ( nCol1 == 0x00 ) && ( nCol2 == 0xFF );
      88             : }
      89             : 
      90             : 
      91           0 : inline sal_Bool ExcelToSc::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
      92             : {
      93           0 :     return ( ( nRow1 & 0x3FFF ) == 0x0000 ) && ( ( nRow2 & 0x3FFF ) == 0x3FFF );
      94             : }
      95             : 
      96             : // ============================================================================
      97             : 
      98             : class XclImpLinkManager;
      99             : class XclImpExtName;
     100             : 
     101             : class ExcelToSc8 : public ExcelToSc
     102             : {
     103             : public:
     104             : 
     105        1018 :     struct ExternalTabInfo
     106             :     {
     107             :         ScRange         maRange;
     108             :         ::rtl::OUString maTabName;
     109             :         sal_uInt16      mnFileId;
     110             :         bool            mbExternal;
     111             : 
     112             :         ExternalTabInfo();
     113             :     };
     114             : 
     115             : private:
     116             :     const XclImpLinkManager&    rLinkMan;
     117             : 
     118             :     void                ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nCol, ScSingleRefData&,
     119             :                             const sal_Bool bName );
     120             : 
     121             :     bool                GetExternalFileIdFromXti( sal_uInt16 nIxti, sal_uInt16& rFileId ) const;
     122             : 
     123             :     virtual bool        Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
     124             : 
     125             :     bool                HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo);
     126             : public:
     127             :                         ExcelToSc8( const XclImpRoot& rRoot );
     128             :     virtual             ~ExcelToSc8();
     129             : 
     130             :     virtual ConvErr     Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula );
     131             : 
     132             :     virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula );
     133             : 
     134             :     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
     135             :                                            const String& rUrl, const ::std::vector<String>& rTabNames );
     136             : 
     137             :     static inline sal_Bool  IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 );
     138             : 
     139             :     virtual sal_Bool        GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen );
     140             : };
     141             : 
     142             : 
     143        2136 : inline sal_Bool ExcelToSc8::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
     144             : {
     145        2136 :     return ( nRow1 == 0x0000 ) && ( nRow2 == 0xFFFF );
     146             : }
     147             : 
     148             : 
     149             : 
     150             : 
     151             : 
     152             : #endif
     153             : 
     154             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10