LCOV - code coverage report
Current view: top level - sc/source/filter/inc - XclExpChangeTrack.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 55 0.0 %
Date: 2012-08-25 Functions: 0 46 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 28 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef SC_XCLEXPCHANGETRACK_HXX
      30                 :            : #define SC_XCLEXPCHANGETRACK_HXX
      31                 :            : 
      32                 :            : #include <stack>
      33                 :            : #include <tools/datetime.hxx>
      34                 :            : #include <rtl/uuid.h>
      35                 :            : #include "bigrange.hxx"
      36                 :            : #include "chgtrack.hxx"
      37                 :            : #include "xelink.hxx"
      38                 :            : #include "ftools.hxx"
      39                 :            : #include "excrecds.hxx"
      40                 :            : 
      41                 :            : //___________________________________________________________________
      42                 :            : 
      43                 :            : class ScBaseCell;
      44                 :            : 
      45                 :            : //___________________________________________________________________
      46                 :            : // XclExpUserBView - one UserBView record for each user
      47                 :            : 
      48         [ #  # ]:          0 : class XclExpUserBView : public ExcRecord
      49                 :            : {
      50                 :            : private:
      51                 :            :     XclExpString                sUsername;
      52                 :            :     sal_uInt8                   aGUID[ 16 ];
      53                 :            : 
      54                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
      55                 :            : 
      56                 :            : public:
      57                 :            :                                 XclExpUserBView( const String& rUsername, const sal_uInt8* pGUID );
      58                 :            : 
      59                 :          0 :     inline const sal_uInt8*     GetGUID() const { return aGUID; }
      60                 :            : 
      61                 :            :     virtual sal_uInt16              GetNum() const;
      62                 :            :     virtual sal_Size            GetLen() const;
      63                 :            : };
      64                 :            : 
      65                 :            : //___________________________________________________________________
      66                 :            : // XclExpUserBViewList - list of UserBView records
      67                 :            : 
      68                 :            : class XclExpUserBViewList : public ExcEmptyRec
      69                 :            : {
      70                 :            : private:
      71                 :            :     std::vector<XclExpUserBView*> aViews;
      72                 :            : 
      73                 :            : public:
      74                 :            : 
      75                 :            :     typedef std::vector<XclExpUserBView*>::iterator iterator;
      76                 :            :     typedef std::vector<XclExpUserBView*>::const_iterator const_iterator;
      77                 :            : 
      78                 :            :                                 XclExpUserBViewList( const ScChangeTrack& rChangeTrack );
      79                 :            :     virtual                     ~XclExpUserBViewList();
      80                 :            : 
      81                 :          0 :     inline iterator begin () { return aViews.begin(); }
      82                 :            : 
      83                 :          0 :     inline iterator end () { return aViews.end(); }
      84                 :            : 
      85                 :            :     inline const_iterator begin () const { return aViews.begin(); }
      86                 :            : 
      87                 :            :     inline const_iterator end () const { return aViews.end(); }
      88                 :            : 
      89                 :            :     virtual void                Save( XclExpStream& rStrm );
      90                 :            : };
      91                 :            : 
      92                 :            : //___________________________________________________________________
      93                 :            : // XclExpUsersViewBegin - begin of view block (one per sheet)
      94                 :            : 
      95         [ #  # ]:          0 : class XclExpUsersViewBegin : public ExcRecord
      96                 :            : {
      97                 :            : private:
      98                 :            :     sal_uInt8                   aGUID[ 16 ];
      99                 :            :     sal_uInt32                  nCurrTab;
     100                 :            : 
     101                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     102                 :            : 
     103                 :            : public:
     104                 :            :                                 XclExpUsersViewBegin( const sal_uInt8* pGUID, sal_uInt32 nTab );
     105                 :            :     virtual sal_uInt16              GetNum() const;
     106                 :            :     virtual sal_Size            GetLen() const;
     107                 :            : };
     108                 :            : 
     109                 :            : //___________________________________________________________________
     110                 :            : // XclExpUsersViewEnd - end of view block (one per sheet)
     111                 :            : 
     112         [ #  # ]:          0 : class XclExpUsersViewEnd : public ExcRecord
     113                 :            : {
     114                 :            : private:
     115                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     116                 :            : 
     117                 :            : public:
     118                 :            :     virtual sal_uInt16              GetNum() const;
     119                 :            :     virtual sal_Size            GetLen() const;
     120                 :            : };
     121                 :            : 
     122                 :            : //___________________________________________________________________
     123                 :            : // dummy record for "User Names" stream
     124                 :            : 
     125         [ #  # ]:          0 : class XclExpChTr0x0191 : public ExcRecord
     126                 :            : {
     127                 :            : private:
     128                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     129                 :            : 
     130                 :            : public:
     131                 :            :     virtual sal_uInt16              GetNum() const;
     132                 :            :     virtual sal_Size            GetLen() const;
     133                 :            : };
     134                 :            : 
     135                 :            : //___________________________________________________________________
     136                 :            : // dummy record for "User Names" stream
     137                 :            : 
     138         [ #  # ]:          0 : class XclExpChTr0x0198 : public ExcRecord
     139                 :            : {
     140                 :            : private:
     141                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     142                 :            : 
     143                 :            : public:
     144                 :            :     virtual sal_uInt16              GetNum() const;
     145                 :            :     virtual sal_Size            GetLen() const;
     146                 :            : };
     147                 :            : 
     148                 :            : //___________________________________________________________________
     149                 :            : // dummy record for "User Names" stream
     150                 :            : 
     151         [ #  # ]:          0 : class XclExpChTr0x0192 : public ExcRecord
     152                 :            : {
     153                 :            : private:
     154                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     155                 :            : 
     156                 :            : public:
     157                 :            :     virtual sal_uInt16              GetNum() const;
     158                 :            :     virtual sal_Size            GetLen() const;
     159                 :            : };
     160                 :            : 
     161                 :            : //___________________________________________________________________
     162                 :            : // dummy record for "User Names" stream
     163                 :            : 
     164         [ #  # ]:          0 : class XclExpChTr0x0197 : public ExcRecord
     165                 :            : {
     166                 :            : private:
     167                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     168                 :            : 
     169                 :            : public:
     170                 :            :     virtual sal_uInt16              GetNum() const;
     171                 :            :     virtual sal_Size            GetLen() const;
     172                 :            : };
     173                 :            : 
     174                 :            : //___________________________________________________________________
     175                 :            : // dummy record without content
     176                 :            : 
     177                 :            : class XclExpChTrEmpty : public ExcRecord
     178                 :            : {
     179                 :            : private:
     180                 :            :     sal_uInt16                      nRecNum;
     181                 :            : 
     182                 :            : public:
     183                 :          0 :     inline                      XclExpChTrEmpty( sal_uInt16 nNum ) : nRecNum( nNum ) {}
     184                 :            :     virtual                     ~XclExpChTrEmpty();
     185                 :            : 
     186                 :            :     virtual sal_uInt16              GetNum() const;
     187                 :            :     virtual sal_Size            GetLen() const;
     188                 :            : };
     189                 :            : 
     190                 :            : //___________________________________________________________________
     191                 :            : // dummy record for "Revision Log" stream
     192                 :            : 
     193                 :          0 : class XclExpChTr0x0195 : public ExcRecord
     194                 :            : {
     195                 :            : private:
     196                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     197                 :            : 
     198                 :            : public:
     199                 :            :     virtual                     ~XclExpChTr0x0195();
     200                 :            : 
     201                 :            :     virtual sal_uInt16              GetNum() const;
     202                 :            :     virtual sal_Size            GetLen() const;
     203                 :            : };
     204                 :            : 
     205                 :            : //___________________________________________________________________
     206                 :            : // dummy record for "Revision Log" stream
     207                 :            : 
     208                 :            : class XclExpChTr0x0194 : public ExcRecord
     209                 :            : {
     210                 :            : private:
     211                 :            :     XclExpString                sUsername;
     212                 :            :     DateTime                    aDateTime;
     213                 :            : 
     214                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     215                 :            : 
     216                 :            : public:
     217                 :            :     inline                      XclExpChTr0x0194( const ScChangeTrack& rChangeTrack );
     218                 :            :     virtual                     ~XclExpChTr0x0194();
     219                 :            : 
     220                 :            :     virtual sal_uInt16              GetNum() const;
     221                 :            :     virtual sal_Size            GetLen() const;
     222                 :            : };
     223                 :            : 
     224                 :          0 : inline XclExpChTr0x0194::XclExpChTr0x0194( const ScChangeTrack& rChangeTrack ) :
     225         [ #  # ]:          0 :     sUsername( rChangeTrack.GetUser() ),
     226 [ #  # ][ #  # ]:          0 :     aDateTime( rChangeTrack.GetFixDateTime() )
     227                 :            : {
     228                 :          0 : }
     229                 :            : 
     230                 :            : //___________________________________________________________________
     231                 :            : // XclExpChTrHeader - header record, includes action count
     232                 :            : 
     233                 :            : class XclExpChTrHeader : public ExcRecord
     234                 :            : {
     235                 :            : private:
     236                 :            :     sal_uInt8                   aGUID[ 16 ];
     237                 :            :     sal_uInt32                  nCount;
     238                 :            : 
     239                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     240                 :            : 
     241                 :            : public:
     242                 :          0 :     inline                      XclExpChTrHeader() : nCount( 0 ) {}
     243                 :            :     virtual                     ~XclExpChTrHeader();
     244                 :            : 
     245                 :          0 :     inline void                 SetGUID( const sal_uInt8* pGUID )   { memcpy( aGUID, pGUID, 16 ); }
     246                 :          0 :     inline void                 SetCount( sal_uInt32 nNew )         { nCount = nNew; }
     247                 :            : 
     248                 :            :     virtual sal_uInt16              GetNum() const;
     249                 :            :     virtual sal_Size            GetLen() const;
     250                 :            : 
     251                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     252                 :            : };
     253                 :            : 
     254                 :            : //___________________________________________________________________
     255                 :            : // XclExpChTrInfo - header of action group of a user
     256                 :            : 
     257                 :            : class XclExpChTrInfo : public ExcRecord
     258                 :            : {
     259                 :            : private:
     260                 :            :     XclExpString                sUsername;
     261                 :            :     sal_Int32                   mnLogNumber;
     262                 :            :     DateTime                    aDateTime;
     263                 :            :     sal_uInt8                   aGUID[ 16 ];
     264                 :            : 
     265                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     266                 :            : 
     267                 :            : public:
     268                 :            :     inline                      XclExpChTrInfo(
     269                 :            :                                     const String& rUsername,
     270                 :            :                                     const DateTime& rDateTime,
     271                 :            :                                     const sal_uInt8* pGUID,
     272                 :            :                                     sal_Int32 nLogNumber );
     273                 :            :     virtual                     ~XclExpChTrInfo();
     274                 :            : 
     275                 :            :     virtual sal_uInt16              GetNum() const;
     276                 :            :     virtual sal_Size            GetLen() const;
     277                 :            : 
     278                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     279                 :            : };
     280                 :            : 
     281                 :          0 : inline XclExpChTrInfo::XclExpChTrInfo( const String& rUsername, const DateTime& rDateTime, const sal_uInt8* pGUID, sal_Int32 nLogNumber ) :
     282                 :            :     sUsername( rUsername ),
     283                 :            :     mnLogNumber( nLogNumber ),
     284 [ #  # ][ #  # ]:          0 :     aDateTime( rDateTime )
     285                 :            : {
     286                 :          0 :     memcpy( aGUID, pGUID, 16 );
     287                 :          0 : }
     288                 :            : 
     289                 :            : //___________________________________________________________________
     290                 :            : // XclExpChTrTabIdBuffer - buffer for tab id's
     291                 :            : 
     292                 :            : class XclExpChTrTabIdBuffer
     293                 :            : {
     294                 :            : private:
     295                 :            :     sal_uInt16*                 pBuffer;
     296                 :            :     sal_uInt16*                 pLast;
     297                 :            :     sal_uInt16                  nBufSize;
     298                 :            :     sal_uInt16                  nLastId;
     299                 :            : 
     300                 :            : public:
     301                 :            :                                 XclExpChTrTabIdBuffer( sal_uInt16 nCount );
     302                 :            :                                 XclExpChTrTabIdBuffer( const XclExpChTrTabIdBuffer& rCopy );
     303                 :            :                                 ~XclExpChTrTabIdBuffer();
     304                 :            : 
     305                 :            :     void                        InitFill( sal_uInt16 nIndex );
     306                 :            :     void                        InitFillup();
     307                 :            : 
     308                 :            :     sal_uInt16                  GetId( sal_uInt16 nIndex ) const;
     309                 :            :     void                        Remove();
     310                 :            : 
     311                 :          0 :     inline sal_uInt16           GetBufferCount() const
     312                 :          0 :                                     { return static_cast< sal_uInt16 >( (pLast - pBuffer) + 1 ); }
     313                 :          0 :     inline void                 GetBufferCopy( sal_uInt16* pDest ) const
     314                 :          0 :                                     { memcpy( pDest, pBuffer, sizeof(sal_uInt16) * GetBufferCount() ); }
     315                 :            : };
     316                 :            : 
     317                 :            : //___________________________________________________________________
     318                 :            : // XclExpChTrTabId - tab id record
     319                 :            : 
     320                 :            : class XclExpChTrTabId : public ExcRecord
     321                 :            : {
     322                 :            : private:
     323                 :            :     sal_uInt16*                 pBuffer;
     324                 :            :     sal_uInt16                  nTabCount;
     325                 :            :     bool                        mbInRevisionHeaders;
     326                 :            : 
     327 [ #  # ][ #  # ]:          0 :     inline void                 Clear() { if( pBuffer ) delete[] pBuffer; pBuffer = NULL; }
     328                 :            : 
     329                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     330                 :            : 
     331                 :            : public:
     332                 :          0 :     inline                      XclExpChTrTabId( sal_uInt16 nCount ) :
     333                 :          0 :                                     pBuffer( NULL ), nTabCount( nCount ), mbInRevisionHeaders( false ) {}
     334                 :            :                                 XclExpChTrTabId( const XclExpChTrTabIdBuffer& rBuffer, bool bInRevisionHeaders = false );
     335                 :            :     virtual                     ~XclExpChTrTabId();
     336                 :            : 
     337                 :            :     void                        Copy( const XclExpChTrTabIdBuffer& rBuffer );
     338                 :            : 
     339                 :            :     virtual sal_uInt16              GetNum() const;
     340                 :            :     virtual sal_Size            GetLen() const;
     341                 :            : 
     342                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     343                 :            : };
     344                 :            : 
     345                 :            : //___________________________________________________________________
     346                 :            : // XclExpChTrAction - base class for action records
     347                 :            : 
     348                 :            : class XclExpChTrAction : public ExcRecord
     349                 :            : {
     350                 :            : private:
     351                 :            :     String                      sUsername;
     352                 :            :     DateTime                    aDateTime;
     353                 :            :     sal_uInt32                  nIndex;         // action number
     354                 :            :     XclExpChTrAction*           pAddAction;     // additional record for this action
     355                 :            :     sal_Bool                    bAccepted;
     356                 :            : 
     357                 :            : protected:
     358                 :            :     const XclExpTabInfo&        rTabInfo;       // for table num export (sc num -> xcl num)
     359                 :            :     const XclExpChTrTabIdBuffer& rIdBuffer;     // for table num export (xcl num -> tab id)
     360                 :            :     sal_uInt32                  nLength;        // this is not the record size
     361                 :            :     sal_uInt16                  nOpCode;        // EXC_CHTR_OP_***
     362                 :            :     sal_Bool                    bForceInfo;
     363                 :            : 
     364                 :            :                                 XclExpChTrAction( const XclExpChTrAction& rCopy );
     365                 :            : 
     366                 :            :     void                        SetAddAction( XclExpChTrAction* pAction );
     367                 :            :     void                        AddDependentContents(
     368                 :            :                                     const ScChangeAction& rAction,
     369                 :            :                                     const XclExpRoot& rRoot,
     370                 :            :                                     ScChangeTrack& rChangeTrack );
     371                 :            : 
     372                 :            :     inline void                 Write2DAddress( XclExpStream& rStrm, const ScAddress& rAddress ) const;
     373                 :            :     inline void                 Write2DRange( XclExpStream& rStrm, const ScRange& rRange ) const;
     374                 :            :     inline sal_uInt16           GetTabId( SCTAB nTabId ) const;
     375                 :            :     inline void                 WriteTabId( XclExpStream& rStrm, SCTAB nTabId ) const;
     376                 :            : 
     377                 :            :                                 // save header data, call SaveActionData()
     378                 :            :     virtual void                SaveCont( XclExpStream& rStrm );
     379                 :          0 :     inline sal_Size             GetHeaderByteCount() const  { return 12; }
     380                 :            : 
     381                 :            :                                 // overload to save action data without header, called by SaveCont()
     382                 :            :     virtual void                SaveActionData( XclExpStream& rStrm ) const = 0;
     383                 :            :                                 // overload to get action size without header, called by GetLen()
     384                 :            :     virtual sal_Size            GetActionByteCount() const = 0;
     385                 :            : 
     386                 :            :                                 // do something before writing the record
     387                 :            :     virtual void                PrepareSaveAction( XclExpStream& rStrm ) const;
     388                 :            :                                 // do something after writing the record
     389                 :            :     virtual void                CompleteSaveAction( XclExpStream& rStrm ) const;
     390                 :            : 
     391                 :          0 :     inline sal_uInt32           GetActionNumber() const { return nIndex; }
     392                 :          0 :     inline sal_Bool             GetAccepted() const { return bAccepted; }
     393                 :            : 
     394                 :            : public:
     395                 :            :                                 XclExpChTrAction(
     396                 :            :                                     const ScChangeAction& rAction,
     397                 :            :                                     const XclExpRoot& rRoot,
     398                 :            :                                     const XclExpChTrTabIdBuffer& rTabIdBuffer,
     399                 :            :                                     sal_uInt16 nNewOpCode = EXC_CHTR_OP_UNKNOWN );
     400                 :            :     virtual                     ~XclExpChTrAction();
     401                 :            : 
     402                 :          0 :     inline const String&        GetUsername() const             { return sUsername; }
     403                 :          0 :     inline const DateTime&      GetDateTime() const             { return aDateTime; }
     404                 :          0 :     inline const XclExpChTrTabIdBuffer& GetTabIdBuffer() const  { return rIdBuffer; }
     405                 :          0 :     inline sal_Bool             ForceInfoRecord() const         { return bForceInfo; }
     406                 :            : 
     407                 :            :                                 // set own index & return new index
     408                 :            :                                 // could be overloaded to use more indexes per action
     409                 :            :     virtual void                SetIndex( sal_uInt32& rIndex );
     410                 :            : 
     411                 :            :     virtual void                Save( XclExpStream& rStrm );
     412                 :            :     virtual sal_Size            GetLen() const;
     413                 :            : 
     414                 :          0 :     inline XclExpChTrAction*    GetAddAction() { return pAddAction; }
     415                 :            : };
     416                 :            : 
     417                 :          0 : inline void XclExpChTrAction::Write2DAddress( XclExpStream& rStrm, const ScAddress& rAddress ) const
     418                 :            : {
     419                 :          0 :     rStrm   << (sal_uInt16) rAddress.Row()
     420                 :          0 :             << (sal_uInt16) rAddress.Col();
     421                 :          0 : }
     422                 :            : 
     423                 :          0 : inline void XclExpChTrAction::Write2DRange( XclExpStream& rStrm, const ScRange& rRange ) const
     424                 :            : {
     425                 :          0 :     rStrm   << (sal_uInt16) rRange.aStart.Row()
     426                 :          0 :             << (sal_uInt16) rRange.aEnd.Row()
     427                 :          0 :             << (sal_uInt16) rRange.aStart.Col()
     428                 :          0 :             << (sal_uInt16) rRange.aEnd.Col();
     429                 :          0 : }
     430                 :            : 
     431                 :          0 : inline sal_uInt16 XclExpChTrAction::GetTabId( SCTAB nTab ) const
     432                 :            : {
     433                 :          0 :     return rIdBuffer.GetId( rTabInfo.GetXclTab( nTab ) );
     434                 :            : }
     435                 :            : 
     436                 :          0 : inline void XclExpChTrAction::WriteTabId( XclExpStream& rStrm, SCTAB nTab ) const
     437                 :            : {
     438                 :          0 :     rStrm << GetTabId( nTab );
     439                 :          0 : }
     440                 :            : 
     441                 :            : //___________________________________________________________________
     442                 :            : // XclExpChTrData - cell content itself
     443                 :            : 
     444                 :            : struct XclExpChTrData
     445                 :            : {
     446                 :            :     XclExpString*               pString;
     447                 :            :     XclExpStringRef             mpFormattedString;
     448                 :            :     const ScFormulaCell*        mpFormulaCell;
     449                 :            :     XclTokenArrayRef            mxTokArr;
     450                 :            :     XclExpRefLog                maRefLog;
     451                 :            :     double                      fValue;
     452                 :            :     sal_Int32                   nRKValue;
     453                 :            :     sal_uInt16                  nType;
     454                 :            :     sal_Size                    nSize;
     455                 :            : 
     456                 :            :                                 XclExpChTrData();
     457                 :            :                                 ~XclExpChTrData();
     458                 :            :     void                        Clear();
     459                 :            : 
     460                 :            :     void                        WriteFormula(
     461                 :            :                                     XclExpStream& rStrm,
     462                 :            :                                     const XclExpChTrTabIdBuffer& rTabIdBuffer );
     463                 :            :     void                        Write(
     464                 :            :                                     XclExpStream& rStrm,
     465                 :            :                                     const XclExpChTrTabIdBuffer& rTabIdBuffer );
     466                 :            : };
     467                 :            : 
     468                 :            : //___________________________________________________________________
     469                 :            : // XclExpChTrCellContent - changed cell content
     470                 :            : 
     471                 :            : class XclExpChTrCellContent : public XclExpChTrAction, protected XclExpRoot
     472                 :            : {
     473                 :            : private:
     474                 :            :     XclExpChTrData*             pOldData;
     475                 :            :     XclExpChTrData*             pNewData;
     476                 :            :     sal_uInt16                  nOldLength;     // this is not the record size
     477                 :            : 
     478                 :            :     void                        MakeEmptyChTrData( XclExpChTrData*& rpData );
     479                 :            : 
     480                 :            : protected:
     481                 :            :     ScAddress                   aPosition;
     482                 :            : 
     483                 :            :     void                        GetCellData(
     484                 :            :                                     const XclExpRoot& rRoot,
     485                 :            :                                     const ScBaseCell* pScCell,
     486                 :            :                                     XclExpChTrData*& rpData,
     487                 :            :                                     sal_uInt32& rXclLength1,
     488                 :            :                                     sal_uInt16& rXclLength2 );
     489                 :            : 
     490                 :            :     virtual void                SaveActionData( XclExpStream& rStrm ) const;
     491                 :            : 
     492                 :            : public:
     493                 :            :                                 XclExpChTrCellContent(
     494                 :            :                                     const ScChangeActionContent& rAction,
     495                 :            :                                     const XclExpRoot& rRoot,
     496                 :            :                                     const XclExpChTrTabIdBuffer& rTabIdBuffer );
     497                 :            :     virtual                     ~XclExpChTrCellContent();
     498                 :            : 
     499                 :            :     virtual sal_uInt16              GetNum() const;
     500                 :            :     virtual sal_Size            GetActionByteCount() const;
     501                 :            : 
     502                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     503                 :            : };
     504                 :            : 
     505                 :            : //___________________________________________________________________
     506                 :            : // XclExpChTrInsert - insert/delete columns/rows
     507                 :            : 
     508                 :            : class XclExpChTrInsert : public XclExpChTrAction
     509                 :            : {
     510                 :            : protected:
     511                 :            :     ScRange                     aRange;
     512                 :            : 
     513                 :          0 :                                 XclExpChTrInsert( const XclExpChTrInsert& rCopy ) :
     514                 :          0 :                                     XclExpChTrAction( rCopy ), aRange( rCopy.aRange ) {}
     515                 :            : 
     516                 :            :     virtual void                SaveActionData( XclExpStream& rStrm ) const;
     517                 :            :     virtual void                PrepareSaveAction( XclExpStream& rStrm ) const;
     518                 :            :     virtual void                CompleteSaveAction( XclExpStream& rStrm ) const;
     519                 :            : 
     520                 :            : public:
     521                 :            :                                 XclExpChTrInsert(
     522                 :            :                                     const ScChangeAction& rAction,
     523                 :            :                                     const XclExpRoot& rRoot,
     524                 :            :                                     const XclExpChTrTabIdBuffer& rTabIdBuffer,
     525                 :            :                                     ScChangeTrack& rChangeTrack );
     526                 :            :     virtual                     ~XclExpChTrInsert();
     527                 :            : 
     528                 :            :     virtual sal_uInt16              GetNum() const;
     529                 :            :     virtual sal_Size            GetActionByteCount() const;
     530                 :            : 
     531                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     532                 :            : };
     533                 :            : 
     534                 :            : //___________________________________________________________________
     535                 :            : // XclExpChTrInsertTab - insert table
     536                 :            : 
     537                 :            : class XclExpChTrInsertTab : public XclExpChTrAction, protected XclExpRoot
     538                 :            : {
     539                 :            : private:
     540                 :            :     SCTAB                   nTab;
     541                 :            : 
     542                 :            : protected:
     543                 :            :     virtual void                SaveActionData( XclExpStream& rStrm ) const;
     544                 :            : 
     545                 :            : public:
     546                 :            :                                 XclExpChTrInsertTab(
     547                 :            :                                     const ScChangeAction& rAction,
     548                 :            :                                     const XclExpRoot& rRoot,
     549                 :            :                                     const XclExpChTrTabIdBuffer& rTabIdBuffer );
     550                 :            :     virtual                     ~XclExpChTrInsertTab();
     551                 :            : 
     552                 :            :     virtual sal_uInt16              GetNum() const;
     553                 :            :     virtual sal_Size            GetActionByteCount() const;
     554                 :            : 
     555                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     556                 :            : };
     557                 :            : 
     558                 :            : //___________________________________________________________________
     559                 :            : // XclExpChTrMoveRange - move cell range
     560                 :            : 
     561                 :            : class XclExpChTrMoveRange : public XclExpChTrAction
     562                 :            : {
     563                 :            : protected:
     564                 :            :     ScRange                     aSourceRange;
     565                 :            :     ScRange                     aDestRange;
     566                 :            : 
     567                 :            :     virtual void                SaveActionData( XclExpStream& rStrm ) const;
     568                 :            :     virtual void                PrepareSaveAction( XclExpStream& rStrm ) const;
     569                 :            :     virtual void                CompleteSaveAction( XclExpStream& rStrm ) const;
     570                 :            : 
     571                 :            : public:
     572                 :            :                                 XclExpChTrMoveRange(
     573                 :            :                                     const ScChangeActionMove& rAction,
     574                 :            :                                     const XclExpRoot& rRoot,
     575                 :            :                                     const XclExpChTrTabIdBuffer& rTabIdBuffer,
     576                 :            :                                     ScChangeTrack& rChangeTrack );
     577                 :            :     virtual                     ~XclExpChTrMoveRange();
     578                 :            : 
     579                 :            :     virtual sal_uInt16              GetNum() const;
     580                 :            :     virtual sal_Size            GetActionByteCount() const;
     581                 :            : 
     582                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     583                 :            : };
     584                 :            : 
     585                 :            : //___________________________________________________________________
     586                 :            : // XclExpChTr0x019A - additional data for delete action
     587                 :            : 
     588                 :            : class XclExpChTr0x014A : public XclExpChTrInsert
     589                 :            : {
     590                 :            : protected:
     591                 :            :     virtual void                SaveActionData( XclExpStream& rStrm ) const;
     592                 :            : 
     593                 :            : public:
     594                 :            :                                 XclExpChTr0x014A( const XclExpChTrInsert& rAction );
     595                 :            :     virtual                     ~XclExpChTr0x014A();
     596                 :            : 
     597                 :            :     virtual sal_uInt16              GetNum() const;
     598                 :            :     virtual sal_Size            GetActionByteCount() const;
     599                 :            : 
     600                 :            :     virtual void                SaveXml( XclExpXmlStream& rStrm );
     601                 :            : };
     602                 :            : 
     603                 :            : //___________________________________________________________________
     604                 :            : // XclExpChangeTrack - exports the "Revision Log" stream
     605                 :            : 
     606                 :            : class XclExpChangeTrack : protected XclExpRoot
     607                 :            : {
     608                 :            : private:
     609                 :            :     std::vector<ExcRecord*>       aRecList;           // list of "Revision Log" stream records
     610                 :            :     std::stack<XclExpChTrAction*> aActionStack;
     611                 :            :     XclExpChTrTabIdBuffer*        pTabIdBuffer;
     612                 :            :     std::vector<XclExpChTrTabIdBuffer*> maBuffers;
     613                 :            : 
     614                 :            :     ScDocument*                 pTempDoc;           // empty document
     615                 :            : 
     616                 :            :     sal_uInt32                  nNewAction;         // action number, 1-based
     617                 :            :     XclExpChTrHeader*           pHeader;            // header record for last GUID
     618                 :            :     sal_uInt8                   aGUID[ 16 ];        // GUID for action info records
     619                 :            :     sal_Bool                    bValidGUID;
     620                 :            : 
     621                 :            :     ScChangeTrack*              CreateTempChangeTrack();
     622                 :            :     void                        PushActionRecord( const ScChangeAction& rAction );
     623                 :            : 
     624                 :            :     sal_Bool                    WriteUserNamesStream();
     625                 :            : 
     626                 :            : public:
     627                 :            :                                 XclExpChangeTrack( const XclExpRoot& rRoot );
     628                 :            :                                 ~XclExpChangeTrack();
     629                 :            : 
     630                 :            :     void                        Write();
     631                 :            :     void                        WriteXml( XclExpXmlStream& rStrm );
     632                 :            : };
     633                 :            : 
     634                 :            : //___________________________________________________________________
     635                 :            : 
     636                 :            : #endif
     637                 :            : 
     638                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10