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

Generated by: LCOV version 1.10