LCOV - code coverage report
Current view: top level - sc/source/filter/inc - excform.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 7 7 100.0 %
Date: 2014-11-03 Functions: 4 4 100.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 INCLUDED_SC_SOURCE_FILTER_INC_EXCFORM_HXX
      21             : #define INCLUDED_SC_SOURCE_FILTER_INC_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             : class ExcelToSc : public ExcelConverterBase, protected XclImpRoot
      33             : {
      34             : protected:
      35             :     enum ExtensionType { EXTENSION_ARRAY, EXTENSION_NLR, EXTENSION_MEMAREA };
      36             :     typedef ::std::vector< ExtensionType >          ExtensionTypeVec;
      37             : 
      38             :     bool                    bExternName;    // external name was found
      39             :     static const sal_uInt16 nRowMask;
      40             :     static const sal_uInt16 nLastInd;       // last Index for Excel->SC- token
      41             : 
      42             :     XclFunctionProvider maFuncProv;
      43             :     const XclBiff       meBiff;
      44             : 
      45             :     void                DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs );
      46             : 
      47             :     void                ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData&, const bool bName );
      48             : 
      49             : public:
      50             :     ExcelToSc( XclImpRoot& rRoot );
      51             :     virtual             ~ExcelToSc();
      52             :     virtual ConvErr     Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
      53             :                                  bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
      54             : 
      55             :     virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
      56             : 
      57             :     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
      58             :                                            const OUString& rUrl, const ::std::vector<OUString>& rTabNames );
      59             : 
      60             :     virtual bool        GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen );
      61             : 
      62             :     void                GetDummy( const ScTokenArray*& );
      63             :     const ScTokenArray* GetBoolErr( XclBoolError );
      64             : 
      65             :     bool ReadSharedFormulaPosition( XclImpStream& rStrm, SCCOL& rCol, SCROW& rRow );
      66             :     const ScTokenArray* GetSharedFormula( const ScAddress& rRefPos ) const;
      67             : 
      68             :     static void         SetError( ScFormulaCell& rCell, const ConvErr eErr );
      69             : 
      70             :     static inline bool  IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 );
      71             :     static inline 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        4716 : inline bool ExcelToSc::IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 )
      85             : {
      86        4716 :     return ( nCol1 == 0x00 ) && ( nCol2 == 0xFF );
      87             : }
      88             : 
      89           6 : inline bool ExcelToSc::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
      90             : {
      91           6 :     return ( ( nRow1 & 0x3FFF ) == 0x0000 ) && ( ( nRow2 & 0x3FFF ) == 0x3FFF );
      92             : }
      93             : 
      94             : class XclImpLinkManager;
      95             : class XclImpExtName;
      96             : 
      97             : class ExcelToSc8 : public ExcelToSc
      98             : {
      99             : public:
     100             : 
     101        2318 :     struct ExternalTabInfo
     102             :     {
     103             :         ScRange         maRange;
     104             :         OUString maTabName;
     105             :         sal_uInt16      mnFileId;
     106             :         bool            mbExternal;
     107             : 
     108             :         ExternalTabInfo();
     109             :     };
     110             : 
     111             : private:
     112             :     const XclImpLinkManager&    rLinkMan;
     113             : 
     114             :     void                ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nCol, ScSingleRefData&,
     115             :                             const bool bName );
     116             : 
     117             :     bool                GetExternalFileIdFromXti( sal_uInt16 nIxti, sal_uInt16& rFileId ) const;
     118             : 
     119             :     virtual bool        Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
     120             : 
     121             :     bool                HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo);
     122             : public:
     123             :     ExcelToSc8( XclImpRoot& rRoot );
     124             :     virtual             ~ExcelToSc8();
     125             : 
     126             :     virtual ConvErr     Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
     127             : 
     128             :     virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
     129             : 
     130             :     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
     131             :                                            const OUString& rUrl, const ::std::vector<OUString>& rTabNames ) SAL_OVERRIDE;
     132             : 
     133             :     static inline bool  IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 );
     134             : 
     135             :     virtual bool        GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen ) SAL_OVERRIDE;
     136             : };
     137             : 
     138        4710 : inline bool ExcelToSc8::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
     139             : {
     140        4710 :     return ( nRow1 == 0x0000 ) && ( nRow2 == 0xFFFF );
     141             : }
     142             : 
     143             : #endif
     144             : 
     145             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10