LCOV - code coverage report
Current view: top level - sc/source/filter/inc - XclImpChangeTrack.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 21 26 80.8 %
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_XCLIMPCHANGETRACK_HXX
      21             : #define INCLUDED_SC_SOURCE_FILTER_INC_XCLIMPCHANGETRACK_HXX
      22             : 
      23             : #include <tools/datetime.hxx>
      24             : #include "xiroot.hxx"
      25             : #include "xistream.hxx"
      26             : #include "excform.hxx"
      27             : #include "imp_op.hxx"
      28             : 
      29             : struct ScCellValue;
      30             : class ScChangeAction;
      31             : class ScChangeTrack;
      32             : class XclImpChTrFmlConverter;
      33             : 
      34             : struct XclImpChTrRecHeader
      35             : {
      36             :     sal_uInt32                  nSize;
      37             :     sal_uInt32                  nIndex;
      38             :     sal_uInt16                  nOpCode;
      39             :     sal_uInt16                  nAccept;
      40             : };
      41             : 
      42          26 : inline XclImpStream& operator>>( XclImpStream& rStrm, XclImpChTrRecHeader& rRecHeader )
      43             : {
      44          26 :     rRecHeader.nSize = rStrm.ReaduInt32();
      45          26 :     rRecHeader.nIndex = rStrm.ReaduInt32();
      46          26 :     rRecHeader.nOpCode = rStrm.ReaduInt16();
      47          26 :     rRecHeader.nAccept = rStrm.ReaduInt16();
      48          26 :     return rStrm;
      49             : }
      50             : 
      51             : class XclImpChangeTrack : protected XclImpRoot
      52             : {
      53             : private:
      54             :     XclImpChTrRecHeader         aRecHeader;
      55             :     OUString                    sOldUsername;
      56             : 
      57             :     ScChangeTrack*              pChangeTrack;
      58             :     tools::SvRef<SotStorageStream>          xInStrm;        // input stream
      59             :     XclImpStream*               pStrm;          // stream import class
      60             :     sal_uInt16                  nTabIdCount;
      61             :     bool                        bGlobExit;      // global exit loop
      62             : 
      63             :     enum { nmBase, nmFound, nmNested }
      64             :                                 eNestedMode;    // action with nested content actions
      65             : 
      66          12 :     inline bool                 FoundNestedMode() { return eNestedMode == nmFound; }
      67             : 
      68             :     void                        DoAcceptRejectAction( ScChangeAction* pAction );
      69             :     void                        DoAcceptRejectAction( sal_uInt32 nFirst, sal_uInt32 nLast );
      70             : 
      71             :     void DoInsertRange( const ScRange& rRange, bool bEndOfList );
      72             :     void                        DoDeleteRange( const ScRange& rRange );
      73             : 
      74             :     inline sal_uInt8            LookAtuInt8();
      75             :     inline double               ReadRK();
      76             :     inline bool                 ReadBool();
      77             :     inline void                 Read2DAddress( ScAddress& rAddress );
      78             :     inline void                 Read2DRange( ScRange& rRange );
      79             :     SCTAB                       ReadTabNum();
      80             :     void                        ReadDateTime( DateTime& rDateTime );
      81             : 
      82             :     inline void                 ReadString( OUString& rString );
      83             : 
      84             :     bool                        CheckRecord( sal_uInt16 nOpCode );
      85             : 
      86             :     void                        ReadFormula(
      87             :                                     ScTokenArray*& rpTokenArray,
      88             :                                     const ScAddress& rPosition );
      89             :     void ReadCell( ScCellValue& rCell, sal_uInt32& rFormat, sal_uInt16 nFlags, const ScAddress& rPosition );
      90             : 
      91             :     void                        ReadChTrInsert();           // 0x0137
      92             :     void                        ReadChTrInfo();             // 0x0138
      93             :     void                        ReadChTrCellContent();      // 0x013B
      94             :     void                        ReadChTrTabId();            // 0x013D
      95             :     void                        ReadChTrMoveRange();        // 0x0140
      96             :     void                        ReadChTrInsertTab();        // 0x014D
      97             :     void                        InitNestedMode();           // 0x014E, 0x0150
      98             :     void                        ReadNestedRecords();
      99             :     bool                        EndNestedMode();            // 0x014F, 0x0151
     100             : 
     101             :     void                        ReadRecords();
     102             : 
     103             : public:
     104             :                                 XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStream& rBookStrm );
     105             :                                 virtual ~XclImpChangeTrack();
     106             : 
     107             :                                 // reads extended 3D ref info following the formulas, returns sc tab nums
     108             :                                 // ( called by XclImpChTrFmlConverter::Read3DTabReference() )
     109             :     bool                        Read3DTabRefInfo( SCTAB& rFirstTab, SCTAB& rLastTab, ExcelToSc8::ExternalTabInfo& rExtInfo );
     110             : 
     111             :     void                        Apply();
     112             : };
     113             : 
     114           0 : inline sal_uInt8 XclImpChangeTrack::LookAtuInt8()
     115             : {
     116           0 :     pStrm->PushPosition();
     117             :     sal_uInt8 nValue;
     118           0 :     nValue = pStrm->ReaduInt8();
     119           0 :     pStrm->PopPosition();
     120           0 :     return nValue;
     121             : }
     122             : 
     123           7 : inline double XclImpChangeTrack::ReadRK()
     124             : {
     125           7 :     return XclTools::GetDoubleFromRK( pStrm->ReadInt32() );
     126             : }
     127             : 
     128           1 : inline bool XclImpChangeTrack::ReadBool()
     129             : {
     130           1 :     return (pStrm->ReaduInt16() != 0);
     131             : }
     132             : 
     133          14 : inline void XclImpChangeTrack::Read2DAddress( ScAddress& rAddress )
     134             : {
     135          14 :     rAddress.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
     136          14 :     rAddress.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
     137          14 : }
     138             : 
     139          12 : inline void XclImpChangeTrack::Read2DRange( ScRange& rRange )
     140             : {
     141          12 :     rRange.aStart.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
     142          12 :     rRange.aEnd.SetRow( static_cast<SCROW>(pStrm->ReaduInt16()) );
     143          12 :     rRange.aStart.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
     144          12 :     rRange.aEnd.SetCol( static_cast<SCCOL>(pStrm->ReaduInt16()) );
     145          12 : }
     146             : 
     147             : inline void XclImpChangeTrack::ReadString( OUString& rString )
     148             : {
     149             :     rString = pStrm->ReadUniString();
     150             : }
     151             : 
     152             : // derived class for special 3D ref handling
     153             : 
     154             : class XclImpChTrFmlConverter : public ExcelToSc8
     155             : {
     156             : private:
     157             :     XclImpChangeTrack&          rChangeTrack;
     158             : 
     159             :     virtual bool                Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo ) SAL_OVERRIDE;
     160             : 
     161             : public:
     162             :     XclImpChTrFmlConverter( XclImpRoot& rRoot, XclImpChangeTrack& rXclChTr );
     163             :     virtual                     ~XclImpChTrFmlConverter();
     164             : };
     165             : 
     166             : #endif
     167             : 
     168             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11