LCOV - code coverage report
Current view: top level - sc/source/filter/inc - excform.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 7 100.0 %
Date: 2015-06-13 12:38:46 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             : 
      41             :     XclFunctionProvider maFuncProv;
      42             :     const XclBiff       meBiff;
      43             : 
      44             :     void                DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs );
      45             : 
      46             :     void                ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData&, const bool bName );
      47             : 
      48             : public:
      49             :     ExcelToSc( XclImpRoot& rRoot );
      50             :     virtual             ~ExcelToSc();
      51             :     virtual ConvErr     Convert( const ScTokenArray*&, XclImpStream& rStrm, sal_Size nFormulaLen,
      52             :                                  bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
      53             : 
      54             :     virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
      55             : 
      56             :     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
      57             :                                            const OUString& rUrl, const ::std::vector<OUString>& rTabNames );
      58             : 
      59             :     virtual bool        GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen );
      60             : 
      61             :     void                GetDummy( const ScTokenArray*& );
      62             :     const ScTokenArray* GetBoolErr( XclBoolError );
      63             : 
      64             :     static bool ReadSharedFormulaPosition( XclImpStream& rStrm, SCCOL& rCol, SCROW& rRow );
      65             :     const ScTokenArray* GetSharedFormula( const ScAddress& rRefPos ) const;
      66             : 
      67             :     static void         SetError( ScFormulaCell& rCell, const ConvErr eErr );
      68             : 
      69             :     static inline bool  IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 );
      70             :     static inline bool  IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 );
      71             : 
      72             :     void                SetComplCol( ScComplexRefData& );
      73             :     void                SetComplRow( ScComplexRefData& );
      74             : 
      75             :     void                ReadExtensions( const ExtensionTypeVec& rExtensions,
      76             :                                         XclImpStream& aIn );
      77             :     void                ReadExtensionArray( unsigned int n,
      78             :                                             XclImpStream& aIn );
      79             :     static void         ReadExtensionNlr( XclImpStream& aIn );
      80             :     void                ReadExtensionMemArea( XclImpStream& aIn );
      81             : };
      82             : 
      83        2360 : inline bool ExcelToSc::IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 )
      84             : {
      85        2360 :     return ( nCol1 == 0x00 ) && ( nCol2 == 0xFF );
      86             : }
      87             : 
      88           7 : inline bool ExcelToSc::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
      89             : {
      90           7 :     return ( ( nRow1 & 0x3FFF ) == 0x0000 ) && ( ( nRow2 & 0x3FFF ) == 0x3FFF );
      91             : }
      92             : 
      93             : class XclImpLinkManager;
      94             : class XclImpExtName;
      95             : 
      96             : class ExcelToSc8 : public ExcelToSc
      97             : {
      98             : public:
      99             : 
     100        1165 :     struct ExternalTabInfo
     101             :     {
     102             :         ScRange         maRange;
     103             :         OUString maTabName;
     104             :         sal_uInt16      mnFileId;
     105             :         bool            mbExternal;
     106             : 
     107             :         ExternalTabInfo();
     108             :     };
     109             : 
     110             : private:
     111             :     const XclImpLinkManager&    rLinkMan;
     112             : 
     113             :     void                ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nCol, ScSingleRefData&,
     114             :                             const bool bName );
     115             : 
     116             :     bool                GetExternalFileIdFromXti( sal_uInt16 nIxti, sal_uInt16& rFileId ) const;
     117             : 
     118             :     virtual bool        Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
     119             : 
     120             :     bool                HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo);
     121             : public:
     122             :     ExcelToSc8( XclImpRoot& rRoot );
     123             :     virtual             ~ExcelToSc8();
     124             : 
     125             :     virtual ConvErr     Convert( const ScTokenArray*& rpTokArray, XclImpStream& rStrm, sal_Size nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
     126             : 
     127             :     virtual ConvErr     Convert( _ScRangeListTabs&, XclImpStream& rStrm, sal_Size nFormulaLen, SCsTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula ) SAL_OVERRIDE;
     128             : 
     129             :     virtual ConvErr     ConvertExternName( const ScTokenArray*& rpArray, XclImpStream& rStrm, sal_Size nFormulaLen,
     130             :                                            const OUString& rUrl, const ::std::vector<OUString>& rTabNames ) SAL_OVERRIDE;
     131             : 
     132             :     static inline bool  IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 );
     133             : 
     134             :     virtual bool        GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, sal_Size nLen ) SAL_OVERRIDE;
     135             : };
     136             : 
     137        2353 : inline bool ExcelToSc8::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
     138             : {
     139        2353 :     return ( nRow1 == 0x0000 ) && ( nRow2 == 0xFFFF );
     140             : }
     141             : 
     142             : #endif
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11