LCOV - code coverage report
Current view: top level - sc/source/filter/xcl97 - XclExpChangeTrack.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 845 0.1 %
Date: 2012-08-25 Functions: 2 164 1.2 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 1000 0.2 %

           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                 :            : 
      30                 :            : 
      31                 :            : //___________________________________________________________________
      32                 :            : 
      33                 :            : #include <stdio.h>
      34                 :            : #include <sot/storage.hxx>
      35                 :            : #include "XclExpChangeTrack.hxx"
      36                 :            : #include "xeformula.hxx"
      37                 :            : #include "cell.hxx"
      38                 :            : #include "xcl97rec.hxx"
      39                 :            : 
      40                 :            : #include <oox/token/tokens.hxx>
      41                 :            : #include <rtl/strbuf.hxx>
      42                 :            : 
      43                 :            : using ::rtl::OUString;
      44                 :            : using ::rtl::OString;
      45                 :            : using ::rtl::OStringBuffer;
      46                 :            : using namespace oox;
      47                 :            : 
      48                 :          0 : static OString lcl_GuidToOString( sal_uInt8 aGuid[ 16 ] )
      49                 :            : {
      50                 :            :     char sBuf[ 40 ];
      51                 :            :     snprintf( sBuf, sizeof( sBuf ),
      52                 :            :             "{%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
      53                 :          0 :             aGuid[ 0 ], aGuid[ 1 ], aGuid[ 2 ], aGuid[ 3 ], aGuid[ 4 ], aGuid[ 5 ], aGuid[ 6 ], aGuid[ 7 ],
      54                 :          0 :             aGuid[ 8 ], aGuid[ 9 ], aGuid[ 10 ], aGuid[ 11 ], aGuid[ 12 ], aGuid[ 13 ], aGuid[ 14 ], aGuid[ 15 ] );
      55                 :          0 :     return OString( sBuf );
      56                 :            : }
      57                 :            : 
      58                 :          0 : static OString lcl_DateTimeToOString( const DateTime& rDateTime )
      59                 :            : {
      60                 :            :     char sBuf[ 200 ];
      61                 :            :     snprintf( sBuf, sizeof( sBuf ),
      62                 :            :             "%d-%02d-%02dT%02d:%02d:%02d.%02dZ",
      63                 :          0 :             rDateTime.GetYear(), rDateTime.GetMonth(), rDateTime.GetDay(),
      64                 :          0 :             rDateTime.GetHour(), rDateTime.GetMin(), rDateTime.GetSec(),
      65                 :          0 :             rDateTime.Get100Sec() );
      66                 :          0 :     return OString( sBuf );
      67                 :            : }
      68                 :            : 
      69                 :            : //___________________________________________________________________
      70                 :            : // local functions
      71                 :            : 
      72                 :          0 : void lcl_WriteDateTime( XclExpStream& rStrm, const DateTime& rDateTime )
      73                 :            : {
      74                 :          0 :     rStrm.SetSliceSize( 7 );
      75                 :          0 :     rStrm   << (sal_uInt16) rDateTime.GetYear()
      76                 :          0 :             << (sal_uInt8)  rDateTime.GetMonth()
      77                 :          0 :             << (sal_uInt8)  rDateTime.GetDay()
      78                 :          0 :             << (sal_uInt8)  rDateTime.GetHour()
      79                 :          0 :             << (sal_uInt8)  rDateTime.GetMin()
      80                 :          0 :             << (sal_uInt8)  rDateTime.GetSec();
      81                 :          0 :     rStrm.SetSliceSize( 0 );
      82                 :          0 : }
      83                 :            : 
      84                 :            : // write string and fill rest of <nLength> with zero bytes
      85                 :            : // <nLength> is without string header
      86                 :          0 : void lcl_WriteFixedString( XclExpStream& rStrm, const XclExpString& rString, sal_Size nLength )
      87                 :            : {
      88                 :          0 :     sal_Size nStrBytes = rString.GetBufferSize();
      89                 :            :     OSL_ENSURE( nLength >= nStrBytes, "lcl_WriteFixedString - String too long" );
      90         [ #  # ]:          0 :     if( rString.Len() > 0 )
      91                 :          0 :         rStrm << rString;
      92         [ #  # ]:          0 :     if( nLength > nStrBytes )
      93                 :          0 :         rStrm.WriteZeroBytes( nLength - nStrBytes );
      94                 :          0 : }
      95                 :            : 
      96                 :          0 : inline void lcl_GenerateGUID( sal_uInt8* pGUID, sal_Bool& rValidGUID )
      97                 :            : {
      98         [ #  # ]:          0 :     rtl_createUuid( pGUID, rValidGUID ? pGUID : NULL, false );
      99                 :          0 :     rValidGUID = sal_True;
     100                 :          0 : }
     101                 :            : 
     102                 :          0 : inline void lcl_WriteGUID( XclExpStream& rStrm, const sal_uInt8* pGUID )
     103                 :            : {
     104                 :          0 :     rStrm.SetSliceSize( 16 );
     105         [ #  # ]:          0 :     for( sal_Size nIndex = 0; nIndex < 16; nIndex++ )
     106                 :          0 :         rStrm << pGUID[ nIndex ];
     107                 :          0 :     rStrm.SetSliceSize( 0 );
     108                 :          0 : }
     109                 :            : 
     110                 :            : //___________________________________________________________________
     111                 :            : 
     112                 :          0 : XclExpUserBView::XclExpUserBView( const String& rUsername, const sal_uInt8* pGUID ) :
     113         [ #  # ]:          0 :     sUsername( rUsername )
     114                 :            : {
     115                 :          0 :     memcpy( aGUID, pGUID, 16 );
     116                 :          0 : }
     117                 :            : 
     118                 :          0 : void XclExpUserBView::SaveCont( XclExpStream& rStrm )
     119                 :            : {
     120                 :          0 :     rStrm   << (sal_uInt32) 0xFF078014
     121                 :          0 :             << (sal_uInt32) 0x00000001;
     122                 :          0 :     lcl_WriteGUID( rStrm, aGUID );
     123                 :          0 :     rStrm.WriteZeroBytes( 8 );
     124                 :          0 :     rStrm   << (sal_uInt32) 1200
     125                 :          0 :             << (sal_uInt32) 1000
     126                 :          0 :             << (sal_uInt16) 1000
     127                 :          0 :             << (sal_uInt16) 0x0CF7
     128                 :          0 :             << (sal_uInt16) 0x0000
     129                 :          0 :             << (sal_uInt16) 0x0001
     130                 :          0 :             << (sal_uInt16) 0x0000;
     131         [ #  # ]:          0 :     if( sUsername.Len() > 0 )
     132                 :          0 :         rStrm << sUsername;
     133                 :          0 : }
     134                 :            : 
     135                 :          0 : sal_uInt16 XclExpUserBView::GetNum() const
     136                 :            : {
     137                 :          0 :     return 0x01A9;
     138                 :            : }
     139                 :            : 
     140                 :          0 : sal_Size XclExpUserBView::GetLen() const
     141                 :            : {
     142         [ #  # ]:          0 :     return 50 + ((sUsername.Len() > 0) ? sUsername.GetSize() : 0);
     143                 :            : }
     144                 :            : 
     145                 :            : //___________________________________________________________________
     146                 :            : 
     147         [ #  # ]:          0 : XclExpUserBViewList::XclExpUserBViewList( const ScChangeTrack& rChangeTrack )
     148                 :            : {
     149                 :            :     sal_uInt8 aGUID[ 16 ];
     150                 :          0 :     sal_Bool bValidGUID = false;
     151         [ #  # ]:          0 :     const std::set<rtl::OUString>& rStrColl = rChangeTrack.GetUserCollection();
     152         [ #  # ]:          0 :     aViews.reserve(rStrColl.size());
     153                 :          0 :     std::set<rtl::OUString>::const_iterator it = rStrColl.begin(), itEnd = rStrColl.end();
     154         [ #  # ]:          0 :     for (; it != itEnd; ++it)
     155                 :            :     {
     156         [ #  # ]:          0 :         lcl_GenerateGUID( aGUID, bValidGUID );
     157 [ #  # ][ #  # ]:          0 :         aViews.push_back( new XclExpUserBView(*it, aGUID) );
         [ #  # ][ #  # ]
                 [ #  # ]
     158                 :            :     }
     159                 :          0 : }
     160                 :            : 
     161                 :          0 : XclExpUserBViewList::~XclExpUserBViewList()
     162                 :            : {
     163 [ #  # ][ #  # ]:          0 :     for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
     164 [ #  # ][ #  # ]:          0 :         delete *iter;
     165         [ #  # ]:          0 : }
     166                 :            : 
     167                 :          0 : void XclExpUserBViewList::Save( XclExpStream& rStrm )
     168                 :            : {
     169 [ #  # ][ #  # ]:          0 :    for( iterator iter = aViews.begin(); iter != aViews.end(); ++iter )
     170         [ #  # ]:          0 :         (*iter)->Save( rStrm );
     171                 :          0 : }
     172                 :            : 
     173                 :            : //___________________________________________________________________
     174                 :            : 
     175                 :          0 : XclExpUsersViewBegin::XclExpUsersViewBegin( const sal_uInt8* pGUID, sal_uInt32 nTab ) :
     176                 :          0 :     nCurrTab( nTab )
     177                 :            : {
     178                 :          0 :     memcpy( aGUID, pGUID, 16 );
     179                 :          0 : }
     180                 :            : 
     181                 :          0 : void XclExpUsersViewBegin::SaveCont( XclExpStream& rStrm )
     182                 :            : {
     183                 :          0 :     lcl_WriteGUID( rStrm, aGUID );
     184                 :          0 :     rStrm   << nCurrTab
     185                 :          0 :             << (sal_uInt32) 100
     186                 :          0 :             << (sal_uInt32) 64
     187                 :          0 :             << (sal_uInt32) 3
     188                 :          0 :             << (sal_uInt32) 0x0000003C
     189                 :          0 :             << (sal_uInt16) 0
     190                 :          0 :             << (sal_uInt16) 3
     191                 :          0 :             << (sal_uInt16) 0
     192                 :          0 :             << (sal_uInt16) 3
     193                 :          0 :             << (double)     0
     194                 :          0 :             << (double)     0
     195                 :          0 :             << (sal_Int16)  -1
     196                 :          0 :             << (sal_Int16)  -1;
     197                 :          0 : }
     198                 :            : 
     199                 :          0 : sal_uInt16 XclExpUsersViewBegin::GetNum() const
     200                 :            : {
     201                 :          0 :     return 0x01AA;
     202                 :            : }
     203                 :            : 
     204                 :          0 : sal_Size XclExpUsersViewBegin::GetLen() const
     205                 :            : {
     206                 :          0 :     return 64;
     207                 :            : }
     208                 :            : 
     209                 :            : //___________________________________________________________________
     210                 :            : 
     211                 :          0 : void XclExpUsersViewEnd::SaveCont( XclExpStream& rStrm )
     212                 :            : {
     213                 :          0 :     rStrm << (sal_uInt16) 0x0001;
     214                 :          0 : }
     215                 :            : 
     216                 :          0 : sal_uInt16 XclExpUsersViewEnd::GetNum() const
     217                 :            : {
     218                 :          0 :     return 0x01AB;
     219                 :            : }
     220                 :            : 
     221                 :          0 : sal_Size XclExpUsersViewEnd::GetLen() const
     222                 :            : {
     223                 :          0 :     return 2;
     224                 :            : }
     225                 :            : 
     226                 :            : //___________________________________________________________________
     227                 :            : 
     228                 :          0 : void XclExpChTr0x0191::SaveCont( XclExpStream& rStrm )
     229                 :            : {
     230                 :          0 :     rStrm << (sal_uInt16) 0x0000;
     231                 :          0 : }
     232                 :            : 
     233                 :          0 : sal_uInt16 XclExpChTr0x0191::GetNum() const
     234                 :            : {
     235                 :          0 :     return 0x0191;
     236                 :            : }
     237                 :            : 
     238                 :          0 : sal_Size XclExpChTr0x0191::GetLen() const
     239                 :            : {
     240                 :          0 :     return 2;
     241                 :            : }
     242                 :            : 
     243                 :            : //___________________________________________________________________
     244                 :            : 
     245                 :          0 : void XclExpChTr0x0198::SaveCont( XclExpStream& rStrm )
     246                 :            : {
     247                 :          0 :     rStrm   << (sal_uInt16) 0x0006
     248                 :          0 :             << (sal_uInt16) 0x0000;
     249                 :          0 : }
     250                 :            : 
     251                 :          0 : sal_uInt16 XclExpChTr0x0198::GetNum() const
     252                 :            : {
     253                 :          0 :     return 0x0198;
     254                 :            : }
     255                 :            : 
     256                 :          0 : sal_Size XclExpChTr0x0198::GetLen() const
     257                 :            : {
     258                 :          0 :     return 4;
     259                 :            : }
     260                 :            : 
     261                 :            : //___________________________________________________________________
     262                 :            : 
     263                 :          0 : void XclExpChTr0x0192::SaveCont( XclExpStream& rStrm )
     264                 :            : {
     265                 :          0 :     rStrm << sal_uInt16( 0x0022 );
     266                 :          0 :     rStrm.WriteZeroBytes( 510 );
     267                 :          0 : }
     268                 :            : 
     269                 :          0 : sal_uInt16 XclExpChTr0x0192::GetNum() const
     270                 :            : {
     271                 :          0 :     return 0x0192;
     272                 :            : }
     273                 :            : 
     274                 :          0 : sal_Size XclExpChTr0x0192::GetLen() const
     275                 :            : {
     276                 :          0 :     return 512;
     277                 :            : }
     278                 :            : 
     279                 :            : //___________________________________________________________________
     280                 :            : 
     281                 :          0 : void XclExpChTr0x0197::SaveCont( XclExpStream& rStrm )
     282                 :            : {
     283                 :          0 :     rStrm << (sal_uInt16) 0x0000;
     284                 :          0 : }
     285                 :            : 
     286                 :          0 : sal_uInt16 XclExpChTr0x0197::GetNum() const
     287                 :            : {
     288                 :          0 :     return 0x0197;
     289                 :            : }
     290                 :            : 
     291                 :          0 : sal_Size XclExpChTr0x0197::GetLen() const
     292                 :            : {
     293                 :          0 :     return 2;
     294                 :            : }
     295                 :            : 
     296                 :            : //___________________________________________________________________
     297                 :            : 
     298                 :          0 : XclExpChTrEmpty::~XclExpChTrEmpty()
     299                 :            : {
     300         [ #  # ]:          0 : }
     301                 :            : 
     302                 :          0 : sal_uInt16 XclExpChTrEmpty::GetNum() const
     303                 :            : {
     304                 :          0 :     return nRecNum;
     305                 :            : }
     306                 :            : 
     307                 :          0 : sal_Size XclExpChTrEmpty::GetLen() const
     308                 :            : {
     309                 :          0 :     return 0;
     310                 :            : }
     311                 :            : 
     312                 :            : //___________________________________________________________________
     313                 :            : 
     314                 :          0 : XclExpChTr0x0195::~XclExpChTr0x0195()
     315                 :            : {
     316         [ #  # ]:          0 : }
     317                 :            : 
     318                 :          0 : void XclExpChTr0x0195::SaveCont( XclExpStream& rStrm )
     319                 :            : {
     320                 :          0 :     rStrm.WriteZeroBytes( 162 );
     321                 :          0 : }
     322                 :            : 
     323                 :          0 : sal_uInt16 XclExpChTr0x0195::GetNum() const
     324                 :            : {
     325                 :          0 :     return 0x0195;
     326                 :            : }
     327                 :            : 
     328                 :          0 : sal_Size XclExpChTr0x0195::GetLen() const
     329                 :            : {
     330                 :          0 :     return 162;
     331                 :            : }
     332                 :            : 
     333                 :            : //___________________________________________________________________
     334                 :            : 
     335                 :          0 : XclExpChTr0x0194::~XclExpChTr0x0194()
     336                 :            : {
     337         [ #  # ]:          0 : }
     338                 :            : 
     339                 :          0 : void XclExpChTr0x0194::SaveCont( XclExpStream& rStrm )
     340                 :            : {
     341                 :          0 :     rStrm << (sal_uInt32) 0;
     342                 :          0 :     lcl_WriteDateTime( rStrm, aDateTime );
     343                 :          0 :     rStrm << (sal_uInt8) 0;
     344                 :          0 :     lcl_WriteFixedString( rStrm, sUsername, 147 );
     345                 :          0 : }
     346                 :            : 
     347                 :          0 : sal_uInt16 XclExpChTr0x0194::GetNum() const
     348                 :            : {
     349                 :          0 :     return 0x0194;
     350                 :            : }
     351                 :            : 
     352                 :          0 : sal_Size XclExpChTr0x0194::GetLen() const
     353                 :            : {
     354                 :          0 :     return 162;
     355                 :            : }
     356                 :            : 
     357                 :            : //___________________________________________________________________
     358                 :            : 
     359                 :          0 : XclExpChTrHeader::~XclExpChTrHeader()
     360                 :            : {
     361         [ #  # ]:          0 : }
     362                 :            : 
     363                 :          0 : void XclExpChTrHeader::SaveCont( XclExpStream& rStrm )
     364                 :            : {
     365                 :          0 :     rStrm   << (sal_uInt16) 0x0006
     366                 :          0 :             << (sal_uInt16) 0x0000
     367                 :          0 :             << (sal_uInt16) 0x000D;
     368                 :          0 :     lcl_WriteGUID( rStrm, aGUID );
     369                 :          0 :     lcl_WriteGUID( rStrm, aGUID );
     370                 :          0 :     rStrm   << nCount
     371                 :          0 :             << (sal_uInt16) 0x0001
     372                 :          0 :             << (sal_uInt32) 0x00000000
     373                 :          0 :             << (sal_uInt16) 0x001E;
     374                 :          0 : }
     375                 :            : 
     376                 :          0 : sal_uInt16 XclExpChTrHeader::GetNum() const
     377                 :            : {
     378                 :          0 :     return 0x0196;
     379                 :            : }
     380                 :            : 
     381                 :          0 : sal_Size XclExpChTrHeader::GetLen() const
     382                 :            : {
     383                 :          0 :     return 50;
     384                 :            : }
     385                 :            : 
     386                 :          0 : void XclExpChTrHeader::SaveXml( XclExpXmlStream& rRevisionHeadersStrm )
     387                 :            : {
     388 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pHeaders = rRevisionHeadersStrm.GetCurrentStream();
     389                 :            :     rRevisionHeadersStrm.WriteAttributes(
     390                 :            :             XML_guid,               lcl_GuidToOString( aGUID ).getStr(),
     391                 :            :             XML_lastGuid,           NULL,   // OOXTODO
     392                 :            :             XML_shared,             NULL,   // OOXTODO
     393                 :            :             XML_diskRevisions,      NULL,   // OOXTODO
     394                 :            :             XML_history,            NULL,   // OOXTODO
     395                 :            :             XML_trackRevisions,     NULL,   // OOXTODO
     396                 :            :             XML_exclusive,          NULL,   // OOXTODO
     397                 :            :             XML_revisionId,         NULL,   // OOXTODO
     398                 :            :             XML_version,            NULL,   // OOXTODO
     399                 :            :             XML_keepChangeHistory,  NULL,   // OOXTODO
     400                 :            :             XML_protected,          NULL,   // OOXTODO
     401                 :            :             XML_preserveHistory,    NULL,   // OOXTODO
     402 [ #  # ][ #  # ]:          0 :             FSEND );
     403 [ #  # ][ #  # ]:          0 :     pHeaders->write( ">" );
     404                 :          0 : }
     405                 :            : 
     406                 :            : //___________________________________________________________________
     407                 :            : 
     408                 :          0 : XclExpChTrInfo::~XclExpChTrInfo()
     409                 :            : {
     410         [ #  # ]:          0 : }
     411                 :            : 
     412                 :          0 : void XclExpChTrInfo::SaveCont( XclExpStream& rStrm )
     413                 :            : {
     414                 :          0 :     rStrm   << (sal_uInt32) 0xFFFFFFFF
     415                 :          0 :             << (sal_uInt32) 0x00000000
     416                 :          0 :             << (sal_uInt32) 0x00000020
     417                 :          0 :             << (sal_uInt16) 0xFFFF;
     418                 :          0 :     lcl_WriteGUID( rStrm, aGUID );
     419                 :          0 :     rStrm   << (sal_uInt16) 0x04B0;
     420                 :          0 :     lcl_WriteFixedString( rStrm, sUsername, 113 );
     421                 :          0 :     lcl_WriteDateTime( rStrm, aDateTime );
     422                 :          0 :     rStrm   << (sal_uInt8)  0x0000
     423                 :          0 :             << (sal_uInt16) 0x0002;
     424                 :          0 : }
     425                 :            : 
     426                 :          0 : sal_uInt16 XclExpChTrInfo::GetNum() const
     427                 :            : {
     428                 :          0 :     return 0x0138;
     429                 :            : }
     430                 :            : 
     431                 :          0 : sal_Size XclExpChTrInfo::GetLen() const
     432                 :            : {
     433                 :          0 :     return 158;
     434                 :            : }
     435                 :            : 
     436                 :          0 : void XclExpChTrInfo::SaveXml( XclExpXmlStream& rRevisionHeadersStrm )
     437                 :            : {
     438 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pHeader = rRevisionHeadersStrm.GetCurrentStream();
     439                 :            : 
     440                 :          0 :     OUString sRelationshipId;
     441                 :            :     sax_fastparser::FSHelperPtr pRevisionLog = rRevisionHeadersStrm.CreateOutputStream(
     442                 :            :             XclXmlUtils::GetStreamName( "xl/revisions/", "revisionLog", mnLogNumber ),
     443                 :            :             XclXmlUtils::GetStreamName( NULL, "revisionLog", mnLogNumber ),
     444         [ #  # ]:          0 :             rRevisionHeadersStrm.GetCurrentStream()->getOutputStream(),
     445                 :            :             "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml",
     446                 :            :             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionLog",
     447 [ #  # ][ #  # ]:          0 :             &sRelationshipId );
         [ #  # ][ #  # ]
     448                 :            : 
     449                 :            :     rRevisionHeadersStrm.WriteAttributes(
     450                 :            :             XML_guid,               lcl_GuidToOString( aGUID ).getStr(),
     451                 :            :             XML_dateTime,           lcl_DateTimeToOString( aDateTime ).getStr(),
     452                 :            :             XML_maxSheetId,         NULL,   // OOXTODO
     453                 :            :             XML_userName,           XclXmlUtils::ToOString( sUsername ).getStr(),
     454                 :            :             FSNS( XML_r, XML_id ),  XclXmlUtils::ToOString( sRelationshipId ).getStr(),
     455                 :            :             XML_minRId,             NULL,   // OOXTODO
     456                 :            :             XML_maxRId,             NULL,   // OOXTODO
     457 [ #  # ][ #  # ]:          0 :             FSEND );
         [ #  # ][ #  # ]
                 [ #  # ]
     458         [ #  # ]:          0 :     pHeader->write( ">" );
     459                 :            : 
     460 [ #  # ][ #  # ]:          0 :     rRevisionHeadersStrm.PushStream( pRevisionLog );
         [ #  # ][ #  # ]
                 [ #  # ]
     461                 :          0 : }
     462                 :            : 
     463                 :            : //___________________________________________________________________
     464                 :            : 
     465                 :          0 : XclExpChTrTabIdBuffer::XclExpChTrTabIdBuffer( sal_uInt16 nCount ) :
     466                 :            :     nBufSize( nCount ),
     467                 :          0 :     nLastId( nCount )
     468                 :            : {
     469                 :          0 :     pBuffer = new sal_uInt16[ nBufSize ];
     470                 :          0 :     memset( pBuffer, 0, sizeof(sal_uInt16) * nBufSize );
     471                 :          0 :     pLast = pBuffer + nBufSize - 1;
     472                 :          0 : }
     473                 :            : 
     474                 :          0 : XclExpChTrTabIdBuffer::XclExpChTrTabIdBuffer( const XclExpChTrTabIdBuffer& rCopy ) :
     475                 :            :     nBufSize( rCopy.nBufSize ),
     476                 :          0 :     nLastId( rCopy.nLastId )
     477                 :            : {
     478                 :          0 :     pBuffer = new sal_uInt16[ nBufSize ];
     479                 :          0 :     memcpy( pBuffer, rCopy.pBuffer, sizeof(sal_uInt16) * nBufSize );
     480                 :          0 :     pLast = pBuffer + nBufSize - 1;
     481                 :          0 : }
     482                 :            : 
     483                 :          0 : XclExpChTrTabIdBuffer::~XclExpChTrTabIdBuffer()
     484                 :            : {
     485         [ #  # ]:          0 :     delete[] pBuffer;
     486                 :          0 : }
     487                 :            : 
     488                 :          0 : void XclExpChTrTabIdBuffer::InitFill( sal_uInt16 nIndex )
     489                 :            : {
     490                 :            :     OSL_ENSURE( nIndex < nLastId, "XclExpChTrTabIdBuffer::Insert - out of range" );
     491                 :            : 
     492                 :          0 :     sal_uInt16 nFreeCount = 0;
     493         [ #  # ]:          0 :     for( sal_uInt16* pElem = pBuffer; pElem <= pLast; pElem++ )
     494                 :            :     {
     495         [ #  # ]:          0 :         if( !*pElem )
     496                 :          0 :             nFreeCount++;
     497         [ #  # ]:          0 :         if( nFreeCount > nIndex )
     498                 :            :         {
     499                 :          0 :             *pElem = nLastId--;
     500                 :          0 :             return;
     501                 :            :         }
     502                 :            :     }
     503                 :            : }
     504                 :            : 
     505                 :          0 : void XclExpChTrTabIdBuffer::InitFillup()
     506                 :            : {
     507                 :          0 :     sal_uInt16 nFreeCount = 1;
     508         [ #  # ]:          0 :     for( sal_uInt16* pElem = pBuffer; pElem <= pLast; pElem++ )
     509         [ #  # ]:          0 :         if( !*pElem )
     510                 :          0 :             *pElem = nFreeCount++;
     511                 :          0 :     nLastId = nBufSize;
     512                 :          0 : }
     513                 :            : 
     514                 :          0 : sal_uInt16 XclExpChTrTabIdBuffer::GetId( sal_uInt16 nIndex ) const
     515                 :            : {
     516                 :            :     OSL_ENSURE( nIndex < nBufSize, "XclExpChTrTabIdBuffer::GetId - out of range" );
     517                 :          0 :     return pBuffer[ nIndex ];
     518                 :            : }
     519                 :            : 
     520                 :          0 : void XclExpChTrTabIdBuffer::Remove()
     521                 :            : {
     522                 :            :     OSL_ENSURE( pBuffer <= pLast, "XclExpChTrTabIdBuffer::Remove - buffer empty" );
     523                 :          0 :     sal_uInt16* pElem = pBuffer;
     524 [ #  # ][ #  # ]:          0 :     while( (pElem <= pLast) && (*pElem != nLastId) )
                 [ #  # ]
     525                 :          0 :         pElem++;
     526         [ #  # ]:          0 :     while( pElem < pLast )
     527                 :            :     {
     528                 :          0 :         *pElem = *(pElem + 1);
     529                 :          0 :         pElem++;
     530                 :            :     }
     531                 :          0 :     pLast--;
     532                 :          0 :     nLastId--;
     533                 :          0 : }
     534                 :            : 
     535                 :            : //___________________________________________________________________
     536                 :            : 
     537                 :          0 : XclExpChTrTabId::XclExpChTrTabId( const XclExpChTrTabIdBuffer& rBuffer, bool bInRevisionHeaders )
     538                 :          0 :     : nTabCount( rBuffer.GetBufferCount() )
     539                 :          0 :     , mbInRevisionHeaders( bInRevisionHeaders )
     540                 :            : {
     541         [ #  # ]:          0 :     pBuffer = new sal_uInt16[ nTabCount ];
     542                 :          0 :     rBuffer.GetBufferCopy( pBuffer );
     543                 :          0 : }
     544                 :            : 
     545                 :          0 : XclExpChTrTabId::~XclExpChTrTabId()
     546                 :            : {
     547                 :          0 :     Clear();
     548         [ #  # ]:          0 : }
     549                 :            : 
     550                 :          0 : void XclExpChTrTabId::Copy( const XclExpChTrTabIdBuffer& rBuffer )
     551                 :            : {
     552                 :          0 :     Clear();
     553                 :          0 :     nTabCount = rBuffer.GetBufferCount();
     554                 :          0 :     pBuffer = new sal_uInt16[ nTabCount ];
     555                 :          0 :     rBuffer.GetBufferCopy( pBuffer );
     556                 :          0 : }
     557                 :            : 
     558                 :          0 : void XclExpChTrTabId::SaveCont( XclExpStream& rStrm )
     559                 :            : {
     560                 :          0 :     rStrm.EnableEncryption();
     561         [ #  # ]:          0 :     if( pBuffer )
     562         [ #  # ]:          0 :         for( sal_uInt16* pElem = pBuffer; pElem < (pBuffer + nTabCount); pElem++ )
     563                 :          0 :             rStrm << *pElem;
     564                 :            :     else
     565         [ #  # ]:          0 :         for( sal_uInt16 nIndex = 1; nIndex <= nTabCount; nIndex++ )
     566                 :          0 :             rStrm << nIndex;
     567                 :          0 : }
     568                 :            : 
     569                 :          0 : sal_uInt16 XclExpChTrTabId::GetNum() const
     570                 :            : {
     571                 :          0 :     return 0x013D;
     572                 :            : }
     573                 :            : 
     574                 :          0 : sal_Size XclExpChTrTabId::GetLen() const
     575                 :            : {
     576                 :          0 :     return nTabCount << 1;
     577                 :            : }
     578                 :            : 
     579                 :          0 : void XclExpChTrTabId::SaveXml( XclExpXmlStream& rRevisionLogStrm )
     580                 :            : {
     581         [ #  # ]:          0 :     if( !mbInRevisionHeaders )
     582                 :          0 :         return;
     583                 :            : 
     584 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pRevisionLog = rRevisionLogStrm.GetCurrentStream();
     585         [ #  # ]:          0 :     rRevisionLogStrm.PopStream();
     586                 :            : 
     587 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pHeader = rRevisionLogStrm.GetCurrentStream();
     588                 :            :     pHeader->startElement( XML_sheetIdMap,
     589                 :            :             XML_count,  OString::valueOf( sal_Int32( nTabCount ) ).getStr(),
     590         [ #  # ]:          0 :             FSEND );
     591         [ #  # ]:          0 :     for( int i = 0; i < nTabCount; ++i )
     592                 :            :     {
     593                 :            :         pHeader->singleElement( XML_sheetId,
     594                 :          0 :                 XML_val,    OString::valueOf( sal_Int32( pBuffer[ i ] ) ).getStr(),
     595         [ #  # ]:          0 :                 FSEND );
     596                 :            :     }
     597         [ #  # ]:          0 :     pHeader->endElement( XML_sheetIdMap );
     598                 :            : 
     599 [ #  # ][ #  # ]:          0 :     rRevisionLogStrm.PushStream( pRevisionLog );
         [ #  # ][ #  # ]
                 [ #  # ]
     600                 :            : }
     601                 :            : 
     602                 :            : //___________________________________________________________________
     603                 :            : 
     604                 :            : // ! does not copy additional actions
     605                 :          0 : XclExpChTrAction::XclExpChTrAction( const XclExpChTrAction& rCopy ) :
     606                 :            :     ExcRecord( rCopy ),
     607                 :            :     sUsername( rCopy.sUsername ),
     608                 :            :     aDateTime( rCopy.aDateTime ),
     609                 :            :     nIndex( 0 ),
     610                 :            :     pAddAction( 0 ),
     611                 :            :     bAccepted( rCopy.bAccepted ),
     612                 :            :     rTabInfo( rCopy.rTabInfo ),
     613                 :            :     rIdBuffer( rCopy.rIdBuffer ),
     614                 :            :     nLength( rCopy.nLength ),
     615                 :            :     nOpCode( rCopy.nOpCode ),
     616 [ #  # ][ #  # ]:          0 :     bForceInfo( rCopy.bForceInfo )
     617                 :            : {
     618                 :          0 : }
     619                 :            : 
     620                 :          0 : XclExpChTrAction::XclExpChTrAction(
     621                 :            :         const ScChangeAction& rAction,
     622                 :            :         const XclExpRoot& rRoot,
     623                 :            :         const XclExpChTrTabIdBuffer& rTabIdBuffer,
     624                 :            :         sal_uInt16 nNewOpCode ) :
     625         [ #  # ]:          0 :     sUsername( rAction.GetUser() ),
     626                 :            :     aDateTime( rAction.GetDateTime() ),
     627                 :            :     nIndex( 0 ),
     628                 :            :     pAddAction( NULL ),
     629         [ #  # ]:          0 :     bAccepted( rAction.IsAccepted() ),
     630         [ #  # ]:          0 :     rTabInfo( rRoot.GetTabInfo() ),
     631                 :            :     rIdBuffer( rTabIdBuffer ),
     632                 :            :     nLength( 0 ),
     633                 :            :     nOpCode( nNewOpCode ),
     634 [ #  # ][ #  # ]:          0 :     bForceInfo( false )
     635                 :            : {
     636         [ #  # ]:          0 :     aDateTime.SetSec( 0 );
     637         [ #  # ]:          0 :     aDateTime.Set100Sec( 0 );
     638                 :          0 : }
     639                 :            : 
     640         [ #  # ]:          0 : XclExpChTrAction::~XclExpChTrAction()
     641                 :            : {
     642         [ #  # ]:          0 :     if( pAddAction )
     643 [ #  # ][ #  # ]:          0 :         delete pAddAction;
     644         [ #  # ]:          0 : }
     645                 :            : 
     646                 :          0 : void XclExpChTrAction::SetAddAction( XclExpChTrAction* pAction )
     647                 :            : {
     648         [ #  # ]:          0 :     if( pAddAction )
     649                 :          0 :         pAddAction->SetAddAction( pAction );
     650                 :            :     else
     651                 :          0 :         pAddAction = pAction;
     652                 :          0 : }
     653                 :            : 
     654                 :          0 : void XclExpChTrAction::AddDependentContents(
     655                 :            :         const ScChangeAction& rAction,
     656                 :            :         const XclExpRoot& rRoot,
     657                 :            :         ScChangeTrack& rChangeTrack )
     658                 :            : {
     659         [ #  # ]:          0 :     ScChangeActionMap aActionMap;
     660                 :          0 :     ScChangeActionMap::iterator itChangeAction;
     661                 :            : 
     662         [ #  # ]:          0 :     rChangeTrack.GetDependents( (ScChangeAction*)(&rAction), aActionMap );
     663         [ #  # ]:          0 :     for( itChangeAction = aActionMap.begin(); itChangeAction != aActionMap.end(); ++itChangeAction )
     664         [ #  # ]:          0 :         if( itChangeAction->second->GetType() == SC_CAT_CONTENT )
     665                 :            :             SetAddAction( new XclExpChTrCellContent(
     666 [ #  # ][ #  # ]:          0 :                 *((const ScChangeActionContent*) itChangeAction->second), rRoot, rIdBuffer ) );
                 [ #  # ]
     667                 :          0 : }
     668                 :            : 
     669                 :          0 : void XclExpChTrAction::SetIndex( sal_uInt32& rIndex )
     670                 :            : {
     671                 :          0 :     nIndex = rIndex++;
     672                 :          0 : }
     673                 :            : 
     674                 :          0 : void XclExpChTrAction::SaveCont( XclExpStream& rStrm )
     675                 :            : {
     676                 :            :     OSL_ENSURE( nOpCode != EXC_CHTR_OP_UNKNOWN, "XclExpChTrAction::SaveCont - unknown action" );
     677                 :          0 :     rStrm   << nLength
     678                 :          0 :             << nIndex
     679                 :          0 :             << nOpCode
     680         [ #  # ]:          0 :             << (sal_uInt16)(bAccepted ? EXC_CHTR_ACCEPT : EXC_CHTR_NOTHING);
     681                 :          0 :     SaveActionData( rStrm );
     682                 :          0 : }
     683                 :            : 
     684                 :          0 : void XclExpChTrAction::PrepareSaveAction( XclExpStream& /*rStrm*/ ) const
     685                 :            : {
     686                 :          0 : }
     687                 :            : 
     688                 :          0 : void XclExpChTrAction::CompleteSaveAction( XclExpStream& /*rStrm*/ ) const
     689                 :            : {
     690                 :          0 : }
     691                 :            : 
     692                 :          0 : void XclExpChTrAction::Save( XclExpStream& rStrm )
     693                 :            : {
     694                 :          0 :     PrepareSaveAction( rStrm );
     695                 :          0 :     ExcRecord::Save( rStrm );
     696         [ #  # ]:          0 :     if( pAddAction )
     697                 :          0 :         pAddAction->Save( rStrm );
     698                 :          0 :     CompleteSaveAction( rStrm );
     699                 :          0 : }
     700                 :            : 
     701                 :          0 : sal_Size XclExpChTrAction::GetLen() const
     702                 :            : {
     703                 :          0 :     return GetHeaderByteCount() + GetActionByteCount();
     704                 :            : }
     705                 :            : 
     706                 :            : //___________________________________________________________________
     707                 :            : 
     708                 :          0 : XclExpChTrData::XclExpChTrData() :
     709                 :            :     pString( NULL ),
     710                 :            :     mpFormulaCell( NULL ),
     711                 :            :     fValue( 0.0 ),
     712                 :            :     nRKValue( 0 ),
     713                 :            :     nType( EXC_CHTR_TYPE_EMPTY ),
     714 [ #  # ][ #  # ]:          0 :     nSize( 0 )
     715                 :            : {
     716                 :          0 : }
     717                 :            : 
     718         [ #  # ]:          0 : XclExpChTrData::~XclExpChTrData()
     719                 :            : {
     720         [ #  # ]:          0 :     Clear();
     721                 :          0 : }
     722                 :            : 
     723                 :          0 : void XclExpChTrData::Clear()
     724                 :            : {
     725         [ #  # ]:          0 :     DELETEZ( pString );
     726                 :          0 :     mpFormulaCell = NULL;
     727                 :          0 :     mxTokArr.reset();
     728                 :          0 :     maRefLog.clear();
     729                 :          0 :     fValue = 0.0;
     730                 :          0 :     nRKValue = 0;
     731                 :          0 :     nType = EXC_CHTR_TYPE_EMPTY;
     732                 :          0 :     nSize = 0;
     733                 :          0 : }
     734                 :            : 
     735                 :          0 : void XclExpChTrData::WriteFormula( XclExpStream& rStrm, const XclExpChTrTabIdBuffer& rTabIdBuffer )
     736                 :            : {
     737                 :            :     OSL_ENSURE( mxTokArr && !mxTokArr->Empty(), "XclExpChTrData::Write - no formula" );
     738                 :          0 :     rStrm << *mxTokArr;
     739                 :            : 
     740 [ #  # ][ #  # ]:          0 :     for( XclExpRefLog::const_iterator aIt = maRefLog.begin(), aEnd = maRefLog.end(); aIt != aEnd; ++aIt )
         [ #  # ][ #  # ]
     741                 :            :     {
     742 [ #  # ][ #  # ]:          0 :         if( aIt->mpUrl && aIt->mpFirstTab )
                 [ #  # ]
     743                 :            :         {
     744 [ #  # ][ #  # ]:          0 :             rStrm << *aIt->mpUrl << (sal_uInt8) 0x01 << *aIt->mpFirstTab << (sal_uInt8) 0x02;
         [ #  # ][ #  # ]
     745                 :            :         }
     746                 :            :         else
     747                 :            :         {
     748                 :          0 :             bool bSingleTab = aIt->mnFirstXclTab == aIt->mnLastXclTab;
     749 [ #  # ][ #  # ]:          0 :             rStrm.SetSliceSize( bSingleTab ? 6 : 8 );
     750 [ #  # ][ #  # ]:          0 :             rStrm << (sal_uInt8) 0x01 << (sal_uInt8) 0x02 << (sal_uInt8) 0x00;
                 [ #  # ]
     751         [ #  # ]:          0 :             rStrm << rTabIdBuffer.GetId( aIt->mnFirstXclTab );
     752         [ #  # ]:          0 :             if( bSingleTab )
     753         [ #  # ]:          0 :                 rStrm << (sal_uInt8) 0x02;
     754                 :            :             else
     755 [ #  # ][ #  # ]:          0 :                 rStrm << (sal_uInt8) 0x00 << rTabIdBuffer.GetId( aIt->mnLastXclTab );
     756                 :            :         }
     757                 :            :     }
     758                 :          0 :     rStrm.SetSliceSize( 0 );
     759                 :          0 :     rStrm << (sal_uInt8) 0x00;
     760                 :          0 : }
     761                 :            : 
     762                 :          0 : void XclExpChTrData::Write( XclExpStream& rStrm, const XclExpChTrTabIdBuffer& rTabIdBuffer )
     763                 :            : {
     764   [ #  #  #  #  :          0 :     switch( nType )
                      # ]
     765                 :            :     {
     766                 :            :         case EXC_CHTR_TYPE_RK:
     767                 :          0 :             rStrm << nRKValue;
     768                 :          0 :         break;
     769                 :            :         case EXC_CHTR_TYPE_DOUBLE:
     770                 :          0 :             rStrm << fValue;
     771                 :          0 :         break;
     772                 :            :         case EXC_CHTR_TYPE_STRING:
     773                 :            :             OSL_ENSURE( pString, "XclExpChTrData::Write - no string" );
     774                 :          0 :             rStrm << *pString;
     775                 :          0 :         break;
     776                 :            :         case EXC_CHTR_TYPE_FORMULA:
     777                 :          0 :             WriteFormula( rStrm, rTabIdBuffer );
     778                 :          0 :         break;
     779                 :            :     }
     780                 :          0 : }
     781                 :            : 
     782                 :            : //___________________________________________________________________
     783                 :            : 
     784                 :          0 : XclExpChTrCellContent::XclExpChTrCellContent(
     785                 :            :         const ScChangeActionContent& rAction,
     786                 :            :         const XclExpRoot& rRoot,
     787                 :            :         const XclExpChTrTabIdBuffer& rTabIdBuffer ) :
     788                 :            :     XclExpChTrAction( rAction, rRoot, rTabIdBuffer, EXC_CHTR_OP_CELL ),
     789                 :            :     XclExpRoot( rRoot ),
     790                 :            :     pOldData( 0 ),
     791                 :            :     pNewData( 0 ),
     792         [ #  # ]:          0 :     aPosition( rAction.GetBigRange().MakeRange().aStart )
     793                 :            : {
     794                 :            :     sal_uInt32 nDummy32;
     795                 :            :     sal_uInt16 nDummy16;
     796         [ #  # ]:          0 :     GetCellData( rRoot, rAction.GetOldCell(), pOldData, nDummy32, nOldLength );
     797         [ #  # ]:          0 :     GetCellData( rRoot, rAction.GetNewCell(), pNewData, nLength, nDummy16 );
     798                 :          0 : }
     799                 :            : 
     800         [ #  # ]:          0 : XclExpChTrCellContent::~XclExpChTrCellContent()
     801                 :            : {
     802         [ #  # ]:          0 :     if( pOldData )
     803 [ #  # ][ #  # ]:          0 :         delete pOldData;
     804         [ #  # ]:          0 :     if( pNewData )
     805 [ #  # ][ #  # ]:          0 :         delete pNewData;
     806         [ #  # ]:          0 : }
     807                 :            : 
     808                 :          0 : void XclExpChTrCellContent::MakeEmptyChTrData( XclExpChTrData*& rpData )
     809                 :            : {
     810         [ #  # ]:          0 :     if( rpData )
     811                 :          0 :         rpData->Clear();
     812                 :            :     else
     813         [ #  # ]:          0 :         rpData = new XclExpChTrData;
     814                 :          0 : }
     815                 :            : 
     816                 :          0 : void XclExpChTrCellContent::GetCellData(
     817                 :            :         const XclExpRoot& rRoot,
     818                 :            :         const ScBaseCell* pScCell,
     819                 :            :         XclExpChTrData*& rpData,
     820                 :            :         sal_uInt32& rXclLength1,
     821                 :            :         sal_uInt16& rXclLength2 )
     822                 :            : {
     823                 :          0 :     MakeEmptyChTrData( rpData );
     824                 :          0 :     rXclLength1 = 0x0000003A;
     825                 :          0 :     rXclLength2 = 0x0000;
     826                 :            : 
     827         [ #  # ]:          0 :     if( !pScCell )
     828                 :            :     {
     829         [ #  # ]:          0 :         delete rpData;
     830                 :          0 :         rpData = NULL;
     831                 :          0 :         return;
     832                 :            :     }
     833                 :            : 
     834   [ #  #  #  # ]:          0 :     switch( pScCell->GetCellType() )
     835                 :            :     {
     836                 :            :         case CELLTYPE_VALUE:
     837                 :            :         {
     838                 :          0 :             rpData->fValue = ((const ScValueCell*) pScCell)->GetValue();
     839         [ #  # ]:          0 :             if( XclTools::GetRKFromDouble( rpData->nRKValue, rpData->fValue ) )
     840                 :            :             {
     841                 :          0 :                 rpData->nType = EXC_CHTR_TYPE_RK;
     842                 :          0 :                 rpData->nSize = 4;
     843                 :          0 :                 rXclLength1 = 0x0000003E;
     844                 :          0 :                 rXclLength2 = 0x0004;
     845                 :            :             }
     846                 :            :             else
     847                 :            :             {
     848                 :          0 :                 rpData->nType = EXC_CHTR_TYPE_DOUBLE;
     849                 :          0 :                 rpData->nSize = 8;
     850                 :          0 :                 rXclLength1 = 0x00000042;
     851                 :          0 :                 rXclLength2 = 0x0008;
     852                 :            :             }
     853                 :            :         }
     854                 :          0 :         break;
     855                 :            :         case CELLTYPE_STRING:
     856                 :            :         case CELLTYPE_EDIT:
     857                 :            :         {
     858         [ #  # ]:          0 :             String sCellStr;
     859         [ #  # ]:          0 :             if( pScCell->GetCellType() == CELLTYPE_STRING )
     860                 :            :             {
     861                 :          0 :                 const ScStringCell* pStrCell = static_cast< const ScStringCell* >( pScCell );
     862         [ #  # ]:          0 :                 sCellStr = pStrCell->GetString();
     863                 :            :                 rpData->mpFormattedString = XclExpStringHelper::CreateCellString( rRoot,
     864 [ #  # ][ #  # ]:          0 :                         *pStrCell, NULL );
                 [ #  # ]
     865                 :            :             }
     866                 :            :             else
     867                 :            :             {
     868                 :          0 :                 const ScEditCell* pEditCell = static_cast< const ScEditCell* >( pScCell );
     869 [ #  # ][ #  # ]:          0 :                 sCellStr = pEditCell->GetString();
     870         [ #  # ]:          0 :                 XclExpHyperlinkHelper aLinkHelper( rRoot, aPosition );
     871                 :            :                 rpData->mpFormattedString = XclExpStringHelper::CreateCellString( rRoot,
     872 [ #  # ][ #  # ]:          0 :                         *pEditCell, NULL, aLinkHelper );
         [ #  # ][ #  # ]
     873                 :            :             }
     874 [ #  # ][ #  # ]:          0 :             rpData->pString = new XclExpString( sCellStr, EXC_STR_DEFAULT, 32766 );
     875                 :          0 :             rpData->nType = EXC_CHTR_TYPE_STRING;
     876         [ #  # ]:          0 :             rpData->nSize = 3 + rpData->pString->GetSize();
     877                 :          0 :             rXclLength1 = 64 + (sCellStr.Len() << 1);
     878         [ #  # ]:          0 :             rXclLength2 = 6 + (sal_uInt16)(sCellStr.Len() << 1);
     879                 :            :         }
     880                 :          0 :         break;
     881                 :            :         case CELLTYPE_FORMULA:
     882                 :            :         {
     883         [ #  # ]:          0 :             const ScFormulaCell* pFmlCell = (const ScFormulaCell*) pScCell;
     884                 :          0 :             rpData->mpFormulaCell = pFmlCell;
     885                 :            : 
     886                 :          0 :             const ScTokenArray* pTokenArray = pFmlCell->GetCode();
     887         [ #  # ]:          0 :             if( pTokenArray )
     888                 :            :             {
     889                 :          0 :                 XclExpRefLog& rRefLog = rpData->maRefLog;
     890         [ #  # ]:          0 :                 rpData->mxTokArr = GetFormulaCompiler().CreateFormula(
     891 [ #  # ][ #  # ]:          0 :                     EXC_FMLATYPE_CELL, *pTokenArray, &pFmlCell->aPos, &rRefLog );
                 [ #  # ]
     892                 :          0 :                 rpData->nType = EXC_CHTR_TYPE_FORMULA;
     893         [ #  # ]:          0 :                 sal_Size nSize = rpData->mxTokArr->GetSize() + 3;
     894                 :            : 
     895 [ #  # ][ #  # ]:          0 :                 for( XclExpRefLog::const_iterator aIt = rRefLog.begin(), aEnd = rRefLog.end(); aIt != aEnd; ++aIt )
         [ #  # ][ #  # ]
     896                 :            :                 {
     897 [ #  # ][ #  # ]:          0 :                     if( aIt->mpUrl && aIt->mpFirstTab )
                 [ #  # ]
     898 [ #  # ][ #  # ]:          0 :                         nSize += aIt->mpUrl->GetSize() + aIt->mpFirstTab->GetSize() + 2;
     899                 :            :                     else
     900         [ #  # ]:          0 :                         nSize += (aIt->mnFirstXclTab == aIt->mnLastXclTab) ? 6 : 8;
     901                 :            :                 }
     902         [ #  # ]:          0 :                 rpData->nSize = ::std::min< sal_Size >( nSize, 0xFFFF );
     903                 :          0 :                 rXclLength1 = 0x00000052;
     904                 :          0 :                 rXclLength2 = 0x0018;
     905                 :            :             }
     906                 :            :         }
     907                 :          0 :         break;
     908                 :            :         default:;
     909                 :            :     }
     910                 :            : }
     911                 :            : 
     912                 :          0 : void XclExpChTrCellContent::SaveActionData( XclExpStream& rStrm ) const
     913                 :            : {
     914                 :          0 :     WriteTabId( rStrm, aPosition.Tab() );
     915 [ #  # ][ #  # ]:          0 :     rStrm   << (sal_uInt16)((pOldData ? (pOldData->nType << 3) : 0x0000) | (pNewData ? pNewData->nType : 0x0000))
     916                 :          0 :             << (sal_uInt16) 0x0000;
     917                 :          0 :     Write2DAddress( rStrm, aPosition );
     918                 :          0 :     rStrm   << nOldLength
     919                 :          0 :             << (sal_uInt32) 0x00000000;
     920         [ #  # ]:          0 :     if( pOldData )
     921                 :          0 :         pOldData->Write( rStrm, rIdBuffer );
     922         [ #  # ]:          0 :     if( pNewData )
     923                 :          0 :         pNewData->Write( rStrm, rIdBuffer );
     924                 :          0 : }
     925                 :            : 
     926                 :          0 : sal_uInt16 XclExpChTrCellContent::GetNum() const
     927                 :            : {
     928                 :          0 :     return 0x013B;
     929                 :            : }
     930                 :            : 
     931                 :          0 : sal_Size XclExpChTrCellContent::GetActionByteCount() const
     932                 :            : {
     933                 :          0 :     sal_Size nLen = 16;
     934         [ #  # ]:          0 :     if( pOldData )
     935                 :          0 :         nLen += pOldData->nSize;
     936         [ #  # ]:          0 :     if( pNewData )
     937                 :          0 :         nLen += pNewData->nSize;
     938                 :          0 :     return nLen;
     939                 :            : }
     940                 :            : 
     941                 :          0 : static const char* lcl_GetType( XclExpChTrData* pData )
     942                 :            : {
     943   [ #  #  #  # ]:          0 :     switch( pData->nType )
     944                 :            :     {
     945                 :            :     case EXC_CHTR_TYPE_RK:
     946                 :            :     case EXC_CHTR_TYPE_DOUBLE:
     947                 :          0 :         return "n";
     948                 :            :         break;
     949                 :            :     case EXC_CHTR_TYPE_FORMULA:
     950                 :            :         {
     951                 :          0 :             ScFormulaCell* pFormulaCell = const_cast< ScFormulaCell* >( pData->mpFormulaCell );
     952                 :            :             const char* sType;
     953                 :          0 :             OUString sValue;
     954         [ #  # ]:          0 :             XclXmlUtils::GetFormulaTypeAndValue( *pFormulaCell, sType, sValue );
     955                 :          0 :             return sType;
     956                 :            :         }
     957                 :            :         break;
     958                 :            :     case EXC_CHTR_TYPE_STRING:
     959                 :          0 :         return "inlineStr";
     960                 :            :         break;
     961                 :            :     default:
     962                 :          0 :         break;
     963                 :            :     }
     964                 :          0 :     return "*unknown*";
     965                 :            : }
     966                 :            : 
     967                 :          0 : static void lcl_WriteCell( XclExpXmlStream& rStrm, sal_Int32 nElement, const ScAddress& rPosition, XclExpChTrData* pData )
     968                 :            : {
     969 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
     970                 :            : 
     971                 :            :     pStream->startElement( nElement,
     972                 :            :             XML_r,  XclXmlUtils::ToOString( rPosition ).getStr(),
     973                 :            :             XML_s,  NULL,   // OOXTODO: not supported
     974                 :            :             XML_t,  lcl_GetType( pData ),
     975                 :            :             XML_cm, NULL,   // OOXTODO: not supported
     976                 :            :             XML_vm, NULL,   // OOXTODO: not supported
     977                 :            :             XML_ph, NULL,   // OOXTODO: not supported
     978 [ #  # ][ #  # ]:          0 :             FSEND );
                 [ #  # ]
     979   [ #  #  #  # ]:          0 :     switch( pData->nType )
     980                 :            :     {
     981                 :            :         case EXC_CHTR_TYPE_RK:
     982                 :            :         case EXC_CHTR_TYPE_DOUBLE:
     983         [ #  # ]:          0 :             pStream->startElement( XML_v, FSEND );
     984         [ #  # ]:          0 :             pStream->write( pData->fValue );
     985         [ #  # ]:          0 :             pStream->endElement( XML_v );
     986                 :          0 :             break;
     987                 :            :         case EXC_CHTR_TYPE_FORMULA:
     988                 :            :             pStream->startElement( XML_f,
     989                 :            :                     // OOXTODO: other attributes?  see XclExpFormulaCell::SaveXml()
     990         [ #  # ]:          0 :                     FSEND );
     991                 :            :             pStream->writeEscaped( XclXmlUtils::ToOUString(
     992                 :          0 :                         *pData->mpFormulaCell->GetDocument(),
     993 [ #  # ][ #  # ]:          0 :                         pData->mpFormulaCell->aPos, pData->mpFormulaCell->GetCode() ) );
     994         [ #  # ]:          0 :             pStream->endElement( XML_f );
     995                 :          0 :             break;
     996                 :            :         case EXC_CHTR_TYPE_STRING:
     997         [ #  # ]:          0 :             pStream->startElement( XML_is, FSEND );
     998         [ #  # ]:          0 :             if( pData->mpFormattedString )
     999         [ #  # ]:          0 :                 pData->mpFormattedString->WriteXml( rStrm );
    1000                 :            :             else
    1001         [ #  # ]:          0 :                 pData->pString->WriteXml( rStrm );
    1002         [ #  # ]:          0 :             pStream->endElement( XML_is );
    1003                 :          0 :             break;
    1004                 :            :         default:
    1005                 :            :             // ignore
    1006                 :          0 :             break;
    1007                 :            :     }
    1008 [ #  # ][ #  # ]:          0 :     pStream->endElement( nElement );
    1009                 :          0 : }
    1010                 :            : 
    1011                 :          0 : void XclExpChTrCellContent::SaveXml( XclExpXmlStream& rRevisionLogStrm )
    1012                 :            : {
    1013 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
    1014                 :            :     pStream->startElement( XML_rcc,
    1015                 :          0 :             XML_rId,                    OString::valueOf( (sal_Int32) GetActionNumber() ).getStr(),
    1016                 :          0 :             XML_ua,                     XclXmlUtils::ToPsz( GetAccepted () ),   // OOXTODO? bAccepted == ua or ra; not sure.
    1017                 :            :             XML_ra,                     NULL,       // OOXTODO: RRD.fUndoAction?  Or RRD.fAccepted?
    1018         [ #  # ]:          0 :             XML_sId,                    OString::valueOf( (sal_Int32) GetTabId( aPosition.Tab() ) ).getStr(),
    1019                 :            :             XML_odxf,                   NULL,       // OOXTODO: not supported
    1020                 :            :             XML_xfDxf,                  NULL,       // OOXTODO: not supported
    1021                 :            :             XML_s,                      NULL,       // OOXTODO: not supported
    1022                 :            :             XML_dxf,                    NULL,       // OOXTODO: not supported
    1023                 :            :             XML_numFmtId,               NULL,       // OOXTODO: not supported
    1024                 :            :             XML_quotePrefix,            NULL,       // OOXTODO: not supported
    1025                 :            :             XML_oldQuotePrefix,         NULL,       // OOXTODO: not supported
    1026                 :            :             XML_ph,                     NULL,       // OOXTODO: not supported
    1027                 :            :             XML_oldPh,                  NULL,       // OOXTODO: not supported
    1028                 :            :             XML_endOfListFormulaUpdate, NULL,       // OOXTODO: not supported
    1029   [ #  #  #  # ]:          0 :             FSEND );
    1030         [ #  # ]:          0 :     if( pOldData )
    1031                 :            :     {
    1032         [ #  # ]:          0 :         lcl_WriteCell( rRevisionLogStrm, XML_oc, aPosition, pOldData );
    1033                 :            :     }
    1034         [ #  # ]:          0 :     if( pNewData )
    1035                 :            :     {
    1036         [ #  # ]:          0 :         lcl_WriteCell( rRevisionLogStrm, XML_nc, aPosition, pNewData );
    1037                 :            :     }
    1038                 :            :     // OOXTODO: XML_odxf, XML_ndxf, XML_extLst elements
    1039 [ #  # ][ #  # ]:          0 :     pStream->endElement( XML_rcc );
    1040                 :          0 : }
    1041                 :            : 
    1042                 :            : //___________________________________________________________________
    1043                 :            : 
    1044                 :          0 : XclExpChTrInsert::XclExpChTrInsert(
    1045                 :            :         const ScChangeAction& rAction,
    1046                 :            :         const XclExpRoot& rRoot,
    1047                 :            :         const XclExpChTrTabIdBuffer& rTabIdBuffer,
    1048                 :            :         ScChangeTrack& rChangeTrack ) :
    1049                 :            :     XclExpChTrAction( rAction, rRoot, rTabIdBuffer ),
    1050                 :          0 :     aRange( rAction.GetBigRange().MakeRange() )
    1051                 :            : {
    1052                 :          0 :     nLength = 0x00000030;
    1053   [ #  #  #  #  :          0 :     switch( rAction.GetType() )
                      # ]
    1054                 :            :     {
    1055                 :          0 :         case SC_CAT_INSERT_COLS:    nOpCode = EXC_CHTR_OP_INSCOL;   break;
    1056                 :          0 :         case SC_CAT_INSERT_ROWS:    nOpCode = EXC_CHTR_OP_INSROW;   break;
    1057                 :          0 :         case SC_CAT_DELETE_COLS:    nOpCode = EXC_CHTR_OP_DELCOL;   break;
    1058                 :          0 :         case SC_CAT_DELETE_ROWS:    nOpCode = EXC_CHTR_OP_DELROW;   break;
    1059                 :            :         default:
    1060                 :            :             OSL_FAIL( "XclExpChTrInsert::XclExpChTrInsert - unknown action" );
    1061                 :            :     }
    1062                 :            : 
    1063         [ #  # ]:          0 :     if( nOpCode & EXC_CHTR_OP_COLFLAG )
    1064                 :            :     {
    1065                 :          0 :         aRange.aStart.SetRow( 0 );
    1066                 :          0 :         aRange.aEnd.SetRow( rRoot.GetXclMaxPos().Row() );
    1067                 :            :     }
    1068                 :            :     else
    1069                 :            :     {
    1070                 :          0 :         aRange.aStart.SetCol( 0 );
    1071                 :          0 :         aRange.aEnd.SetCol( rRoot.GetXclMaxPos().Col() );
    1072                 :            :     }
    1073                 :            : 
    1074         [ #  # ]:          0 :     if( nOpCode & EXC_CHTR_OP_DELFLAG )
    1075                 :            :     {
    1076 [ #  # ][ #  # ]:          0 :         SetAddAction( new XclExpChTr0x014A( *this ) );
                 [ #  # ]
    1077         [ #  # ]:          0 :         AddDependentContents( rAction, rRoot, rChangeTrack );
    1078                 :            :     }
    1079                 :          0 : }
    1080                 :            : 
    1081                 :          0 : XclExpChTrInsert::~XclExpChTrInsert()
    1082                 :            : {
    1083         [ #  # ]:          0 : }
    1084                 :            : 
    1085                 :          0 : void XclExpChTrInsert::SaveActionData( XclExpStream& rStrm ) const
    1086                 :            : {
    1087                 :          0 :     WriteTabId( rStrm, aRange.aStart.Tab() );
    1088                 :          0 :     rStrm   << (sal_uInt16) 0x0000;
    1089                 :          0 :     Write2DRange( rStrm, aRange );
    1090                 :          0 :     rStrm   << (sal_uInt32) 0x00000000;
    1091                 :          0 : }
    1092                 :            : 
    1093                 :          0 : void XclExpChTrInsert::PrepareSaveAction( XclExpStream& rStrm ) const
    1094                 :            : {
    1095 [ #  # ][ #  # ]:          0 :     if( (nOpCode == EXC_CHTR_OP_DELROW) || (nOpCode == EXC_CHTR_OP_DELCOL) )
    1096         [ #  # ]:          0 :         XclExpChTrEmpty( 0x0150 ).Save( rStrm );
    1097                 :          0 : }
    1098                 :            : 
    1099                 :          0 : void XclExpChTrInsert::CompleteSaveAction( XclExpStream& rStrm ) const
    1100                 :            : {
    1101 [ #  # ][ #  # ]:          0 :     if( (nOpCode == EXC_CHTR_OP_DELROW) || (nOpCode == EXC_CHTR_OP_DELCOL) )
    1102         [ #  # ]:          0 :         XclExpChTrEmpty( 0x0151 ).Save( rStrm );
    1103                 :          0 : }
    1104                 :            : 
    1105                 :          0 : sal_uInt16 XclExpChTrInsert::GetNum() const
    1106                 :            : {
    1107                 :          0 :     return 0x0137;
    1108                 :            : }
    1109                 :            : 
    1110                 :          0 : sal_Size XclExpChTrInsert::GetActionByteCount() const
    1111                 :            : {
    1112                 :          0 :     return 16;
    1113                 :            : }
    1114                 :            : 
    1115                 :          0 : static const char* lcl_GetAction( sal_uInt16 nOpCode )
    1116                 :            : {
    1117   [ #  #  #  #  :          0 :     switch( nOpCode )
                      # ]
    1118                 :            :     {
    1119                 :          0 :         case EXC_CHTR_OP_INSCOL:    return "insertCol";
    1120                 :          0 :         case EXC_CHTR_OP_INSROW:    return "insertRow";
    1121                 :          0 :         case EXC_CHTR_OP_DELCOL:    return "deleteCol";
    1122                 :          0 :         case EXC_CHTR_OP_DELROW:    return "deleteRow";
    1123                 :          0 :         default:                    return "*unknown*";
    1124                 :            :     }
    1125                 :            : }
    1126                 :            : 
    1127                 :          0 : void XclExpChTrInsert::SaveXml( XclExpXmlStream& rRevisionLogStrm )
    1128                 :            : {
    1129 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
    1130                 :            :     pStream->startElement( XML_rrc,
    1131                 :          0 :             XML_rId,    OString::valueOf( (sal_Int32) GetActionNumber() ).getStr(),
    1132                 :          0 :             XML_ua,     XclXmlUtils::ToPsz( GetAccepted () ),   // OOXTODO? bAccepted == ua or ra; not sure.
    1133                 :            :             XML_ra,     NULL,       // OOXTODO: RRD.fUndoAction?  Or RRD.fAccepted?
    1134         [ #  # ]:          0 :             XML_sId,    OString::valueOf( (sal_Int32) GetTabId( aRange.aStart.Tab() ) ).getStr(),
    1135                 :            :             XML_eol,    NULL,       // OOXTODO: not supported?
    1136                 :            :             XML_ref,    XclXmlUtils::ToOString( aRange ).getStr(),
    1137                 :            :             XML_action, lcl_GetAction( nOpCode ),
    1138                 :            :             XML_edge,   NULL,       // OOXTODO: ???
    1139         [ #  # ]:          0 :             FSEND );
           [ #  #  #  # ]
    1140                 :            :     // OOXTODO: does this handle XML_rfmt, XML_undo?
    1141                 :          0 :     XclExpChTrAction* pAction = GetAddAction();
    1142         [ #  # ]:          0 :     while( pAction != NULL )
    1143                 :            :     {
    1144         [ #  # ]:          0 :         pAction->SaveXml( rRevisionLogStrm );
    1145                 :          0 :         pAction = pAction->GetAddAction();
    1146                 :            :     }
    1147 [ #  # ][ #  # ]:          0 :     pStream->endElement( XML_rrc );
    1148                 :          0 : }
    1149                 :            : 
    1150                 :            : //___________________________________________________________________
    1151                 :            : 
    1152                 :          0 : XclExpChTrInsertTab::XclExpChTrInsertTab(
    1153                 :            :         const ScChangeAction& rAction,
    1154                 :            :         const XclExpRoot& rRoot,
    1155                 :            :         const XclExpChTrTabIdBuffer& rTabIdBuffer ) :
    1156                 :            :     XclExpChTrAction( rAction, rRoot, rTabIdBuffer, EXC_CHTR_OP_INSTAB ),
    1157                 :            :     XclExpRoot( rRoot ),
    1158         [ #  # ]:          0 :     nTab( (SCTAB) rAction.GetBigRange().aStart.Tab() )
    1159                 :            : {
    1160                 :          0 :     nLength = 0x0000021C;
    1161                 :          0 :     bForceInfo = sal_True;
    1162                 :          0 : }
    1163                 :            : 
    1164         [ #  # ]:          0 : XclExpChTrInsertTab::~XclExpChTrInsertTab()
    1165                 :            : {
    1166         [ #  # ]:          0 : }
    1167                 :            : 
    1168                 :          0 : void XclExpChTrInsertTab::SaveActionData( XclExpStream& rStrm ) const
    1169                 :            : {
    1170                 :          0 :     WriteTabId( rStrm, nTab );
    1171                 :          0 :     rStrm << sal_uInt32( 0 );
    1172 [ #  # ][ #  # ]:          0 :     lcl_WriteFixedString( rStrm, XclExpString( GetTabInfo().GetScTabName( nTab ) ), 127 );
    1173                 :          0 :     lcl_WriteDateTime( rStrm, GetDateTime() );
    1174                 :          0 :     rStrm.WriteZeroBytes( 133 );
    1175                 :          0 : }
    1176                 :            : 
    1177                 :          0 : sal_uInt16 XclExpChTrInsertTab::GetNum() const
    1178                 :            : {
    1179                 :          0 :     return 0x014D;
    1180                 :            : }
    1181                 :            : 
    1182                 :          0 : sal_Size XclExpChTrInsertTab::GetActionByteCount() const
    1183                 :            : {
    1184                 :          0 :     return 276;
    1185                 :            : }
    1186                 :            : 
    1187                 :          0 : void XclExpChTrInsertTab::SaveXml( XclExpXmlStream& rStrm )
    1188                 :            : {
    1189 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
    1190                 :            :     pStream->singleElement( XML_ris,
    1191                 :          0 :             XML_rId,            OString::valueOf( (sal_Int32) GetActionNumber() ).getStr(),
    1192                 :          0 :             XML_ua,             XclXmlUtils::ToPsz( GetAccepted () ),   // OOXTODO? bAccepted == ua or ra; not sure.
    1193                 :            :             XML_ra,             NULL,       // OOXTODO: RRD.fUndoAction?  Or RRD.fAccepted?
    1194         [ #  # ]:          0 :             XML_sheetId,        OString::valueOf( (sal_Int32) GetTabId( nTab ) ).getStr(),
    1195         [ #  # ]:          0 :             XML_name,           XclXmlUtils::ToOString( GetTabInfo().GetScTabName( nTab ) ).getStr(),
    1196                 :            :             XML_sheetPosition,  OString::valueOf( (sal_Int32) nTab ).getStr(),
    1197 [ #  # ][ #  # ]:          0 :             FSEND );
           [ #  #  #  # ]
                 [ #  # ]
    1198                 :          0 : }
    1199                 :            : 
    1200                 :            : //___________________________________________________________________
    1201                 :            : 
    1202                 :          0 : XclExpChTrMoveRange::XclExpChTrMoveRange(
    1203                 :            :         const ScChangeActionMove& rAction,
    1204                 :            :         const XclExpRoot& rRoot,
    1205                 :            :         const XclExpChTrTabIdBuffer& rTabIdBuffer,
    1206                 :            :         ScChangeTrack& rChangeTrack ) :
    1207                 :            :     XclExpChTrAction( rAction, rRoot, rTabIdBuffer, EXC_CHTR_OP_MOVE ),
    1208                 :          0 :     aDestRange( rAction.GetBigRange().MakeRange() )
    1209                 :            : {
    1210                 :          0 :     nLength = 0x00000042;
    1211                 :          0 :     aSourceRange = aDestRange;
    1212                 :            :     sal_Int32 nDCols, nDRows, nDTabs;
    1213         [ #  # ]:          0 :     rAction.GetDelta( nDCols, nDRows, nDTabs );
    1214         [ #  # ]:          0 :     aSourceRange.aStart.IncRow( (SCROW) -nDRows );
    1215         [ #  # ]:          0 :     aSourceRange.aStart.IncCol( (SCCOL) -nDCols );
    1216         [ #  # ]:          0 :     aSourceRange.aStart.IncTab( (SCTAB) -nDTabs );
    1217         [ #  # ]:          0 :     aSourceRange.aEnd.IncRow( (SCROW) -nDRows );
    1218         [ #  # ]:          0 :     aSourceRange.aEnd.IncCol( (SCCOL) -nDCols );
    1219         [ #  # ]:          0 :     aSourceRange.aEnd.IncTab( (SCTAB) -nDTabs );
    1220         [ #  # ]:          0 :     AddDependentContents( rAction, rRoot, rChangeTrack );
    1221                 :          0 : }
    1222                 :            : 
    1223                 :          0 : XclExpChTrMoveRange::~XclExpChTrMoveRange()
    1224                 :            : {
    1225         [ #  # ]:          0 : }
    1226                 :            : 
    1227                 :          0 : void XclExpChTrMoveRange::SaveActionData( XclExpStream& rStrm ) const
    1228                 :            : {
    1229                 :          0 :     WriteTabId( rStrm, aDestRange.aStart.Tab() );
    1230                 :          0 :     Write2DRange( rStrm, aSourceRange );
    1231                 :          0 :     Write2DRange( rStrm, aDestRange );
    1232                 :          0 :     WriteTabId( rStrm, aSourceRange.aStart.Tab() );
    1233                 :          0 :     rStrm << (sal_uInt32) 0x00000000;
    1234                 :          0 : }
    1235                 :            : 
    1236                 :          0 : void XclExpChTrMoveRange::PrepareSaveAction( XclExpStream& rStrm ) const
    1237                 :            : {
    1238         [ #  # ]:          0 :     XclExpChTrEmpty( 0x014E ).Save( rStrm );
    1239                 :          0 : }
    1240                 :            : 
    1241                 :          0 : void XclExpChTrMoveRange::CompleteSaveAction( XclExpStream& rStrm ) const
    1242                 :            : {
    1243         [ #  # ]:          0 :     XclExpChTrEmpty( 0x014F ).Save( rStrm );
    1244                 :          0 : }
    1245                 :            : 
    1246                 :          0 : sal_uInt16 XclExpChTrMoveRange::GetNum() const
    1247                 :            : {
    1248                 :          0 :     return 0x0140;
    1249                 :            : }
    1250                 :            : 
    1251                 :          0 : sal_Size XclExpChTrMoveRange::GetActionByteCount() const
    1252                 :            : {
    1253                 :          0 :     return 24;
    1254                 :            : }
    1255                 :            : 
    1256                 :          0 : void XclExpChTrMoveRange::SaveXml( XclExpXmlStream& rRevisionLogStrm )
    1257                 :            : {
    1258 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
    1259                 :            : 
    1260                 :            :     pStream->startElement( XML_rm,
    1261                 :          0 :             XML_rId,            OString::valueOf( (sal_Int32) GetActionNumber() ).getStr(),
    1262                 :          0 :             XML_ua,             XclXmlUtils::ToPsz( GetAccepted () ),   // OOXTODO? bAccepted == ua or ra; not sure.
    1263                 :            :             XML_ra,             NULL,       // OOXTODO: RRD.fUndoAction?  Or RRD.fAccepted?
    1264         [ #  # ]:          0 :             XML_sheetId,        OString::valueOf( (sal_Int32) GetTabId( aDestRange.aStart.Tab() ) ).getStr(),
    1265                 :            :             XML_source,         XclXmlUtils::ToOString( aSourceRange ).getStr(),
    1266                 :            :             XML_destination,    XclXmlUtils::ToOString( aDestRange ).getStr(),
    1267         [ #  # ]:          0 :             XML_sourceSheetId,  OString::valueOf( (sal_Int32) GetTabId( aSourceRange.aStart.Tab() ) ).getStr(),
    1268 [ #  # ][ #  # ]:          0 :             FSEND );
           [ #  #  #  # ]
    1269                 :            :     // OOXTODO: does this handle XML_rfmt, XML_undo?
    1270                 :          0 :     XclExpChTrAction* pAction = GetAddAction();
    1271         [ #  # ]:          0 :     while( pAction != NULL )
    1272                 :            :     {
    1273         [ #  # ]:          0 :         pAction->SaveXml( rRevisionLogStrm );
    1274                 :          0 :         pAction = pAction->GetAddAction();
    1275                 :            :     }
    1276 [ #  # ][ #  # ]:          0 :     pStream->endElement( XML_rm );
    1277                 :          0 : }
    1278                 :            : 
    1279                 :            : //___________________________________________________________________
    1280                 :            : 
    1281                 :          0 : XclExpChTr0x014A::XclExpChTr0x014A( const XclExpChTrInsert& rAction ) :
    1282                 :          0 :     XclExpChTrInsert( rAction )
    1283                 :            : {
    1284                 :          0 :     nLength = 0x00000026;
    1285                 :          0 :     nOpCode = EXC_CHTR_OP_FORMAT;
    1286                 :          0 : }
    1287                 :            : 
    1288                 :          0 : XclExpChTr0x014A::~XclExpChTr0x014A()
    1289                 :            : {
    1290         [ #  # ]:          0 : }
    1291                 :            : 
    1292                 :          0 : void XclExpChTr0x014A::SaveActionData( XclExpStream& rStrm ) const
    1293                 :            : {
    1294                 :          0 :     WriteTabId( rStrm, aRange.aStart.Tab() );
    1295                 :          0 :     rStrm   << (sal_uInt16) 0x0003
    1296                 :          0 :             << (sal_uInt16) 0x0001;
    1297                 :          0 :     Write2DRange( rStrm, aRange );
    1298                 :          0 : }
    1299                 :            : 
    1300                 :          0 : sal_uInt16 XclExpChTr0x014A::GetNum() const
    1301                 :            : {
    1302                 :          0 :     return 0x014A;
    1303                 :            : }
    1304                 :            : 
    1305                 :          0 : sal_Size XclExpChTr0x014A::GetActionByteCount() const
    1306                 :            : {
    1307                 :          0 :     return 14;
    1308                 :            : }
    1309                 :            : 
    1310                 :          0 : void XclExpChTr0x014A::SaveXml( XclExpXmlStream& rStrm )
    1311                 :            : {
    1312 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
    1313                 :            : 
    1314                 :            :     pStream->startElement( XML_rfmt,
    1315         [ #  # ]:          0 :             XML_sheetId,    OString::valueOf( (sal_Int32) GetTabId( aRange.aStart.Tab() ) ).getStr(),
    1316                 :            :             XML_xfDxf,      NULL,   // OOXTODO: not supported
    1317                 :            :             XML_s,          NULL,   // OOXTODO: style
    1318                 :            :             XML_sqref,      XclXmlUtils::ToOString( aRange ).getStr(),
    1319                 :            :             XML_start,      NULL,   // OOXTODO: for string changes
    1320                 :            :             XML_length,     NULL,   // OOXTODO: for string changes
    1321 [ #  # ][ #  # ]:          0 :             FSEND );
    1322                 :            :     // OOXTODO: XML_dxf, XML_extLst
    1323                 :            : 
    1324 [ #  # ][ #  # ]:          0 :     pStream->endElement( XML_rfmt );
    1325                 :          0 : }
    1326                 :            : 
    1327                 :            : //___________________________________________________________________
    1328                 :            : 
    1329         [ #  # ]:          0 : class ExcXmlRecord : public ExcRecord
    1330                 :            : {
    1331                 :            : public:
    1332                 :            :     virtual sal_Size    GetLen() const;
    1333                 :            :     virtual sal_uInt16  GetNum() const;
    1334                 :            :     virtual void        Save( XclExpStream& rStrm );
    1335                 :            :     virtual void        SaveXml( XclExpXmlStream& rStrm ) = 0;
    1336                 :            : };
    1337                 :            : 
    1338                 :          0 : sal_Size ExcXmlRecord::GetLen() const
    1339                 :            : {
    1340                 :          0 :     return 0;
    1341                 :            : }
    1342                 :            : 
    1343                 :          0 : sal_uInt16 ExcXmlRecord::GetNum() const
    1344                 :            : {
    1345                 :          0 :     return 0;
    1346                 :            : }
    1347                 :            : 
    1348                 :          0 : void ExcXmlRecord::Save( XclExpStream& )
    1349                 :            : {
    1350                 :            :     // Do nothing; ignored for BIFF output.
    1351                 :          0 : }
    1352                 :            : 
    1353         [ #  # ]:          0 : class StartXmlElement : public ExcXmlRecord
    1354                 :            : {
    1355                 :            : public:
    1356                 :            :     enum Behavior {
    1357                 :            :         CLOSE_ELEMENT       = 0x1,
    1358                 :            :         WRITE_NAMESPACES    = 0x2,
    1359                 :            :     };
    1360                 :          0 :                         StartXmlElement( sal_Int32 nElement, sal_Int32 eBehavior )
    1361                 :          0 :                             : mnElement( nElement ), meBehavior( (Behavior) eBehavior ) {}
    1362                 :            :     virtual void        SaveXml( XclExpXmlStream& rStrm );
    1363                 :            : private:
    1364                 :            :     sal_Int32           mnElement;
    1365                 :            :     Behavior            meBehavior;
    1366                 :            : };
    1367                 :            : 
    1368                 :          0 : void StartXmlElement::SaveXml( XclExpXmlStream& rStrm )
    1369                 :            : {
    1370 [ #  # ][ #  # ]:          0 :     sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
    1371                 :            :     pStream->write( "<" )
    1372 [ #  # ][ #  # ]:          0 :         ->writeId( mnElement );
    1373         [ #  # ]:          0 :     if( meBehavior & WRITE_NAMESPACES )
    1374                 :            :     {
    1375                 :            :         rStrm.WriteAttributes(
    1376                 :            :                 XML_xmlns,                  "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
    1377                 :            :                 FSNS( XML_xmlns, XML_r ),   "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
    1378         [ #  # ]:          0 :                 FSEND );
    1379                 :            :     }
    1380         [ #  # ]:          0 :     if( meBehavior & CLOSE_ELEMENT )
    1381                 :            :     {
    1382         [ #  # ]:          0 :         pStream->write( ">" );
    1383         [ #  # ]:          0 :     }
    1384                 :          0 : }
    1385                 :            : 
    1386         [ #  # ]:          0 : class EndXmlElement : public ExcXmlRecord
    1387                 :            : {
    1388                 :            :     sal_Int32           mnElement;
    1389                 :            : public:
    1390                 :          0 :                         EndXmlElement( sal_Int32 nElement ) : mnElement( nElement) {}
    1391                 :            :     virtual void        SaveXml( XclExpXmlStream& rStrm );
    1392                 :            : };
    1393                 :            : 
    1394                 :          0 : void EndXmlElement::SaveXml( XclExpXmlStream& rStrm )
    1395                 :            : {
    1396                 :          0 :     rStrm.GetCurrentStream()->endElement( mnElement );
    1397                 :          0 : }
    1398                 :            : 
    1399         [ #  # ]:          0 : class EndHeaderElement : public EndXmlElement
    1400                 :            : {
    1401                 :            : public:
    1402                 :          0 :                         EndHeaderElement() : EndXmlElement( XML_header ) {}
    1403                 :            :     virtual void        SaveXml( XclExpXmlStream& rStrm );
    1404                 :            : };
    1405                 :            : 
    1406                 :          0 : void EndHeaderElement::SaveXml( XclExpXmlStream& rStrm )
    1407                 :            : {
    1408                 :            :     // Remove the `xl/revisions/revisionLogX.xml' file from the stack
    1409                 :          0 :     rStrm.PopStream();
    1410                 :            : 
    1411                 :          0 :     EndXmlElement::SaveXml( rStrm );
    1412                 :          0 : }
    1413                 :            : 
    1414                 :          0 : XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) :
    1415                 :            :     XclExpRoot( rRoot ),
    1416                 :            :     aActionStack(),
    1417                 :            :     pTabIdBuffer( NULL ),
    1418                 :            :     pTempDoc( NULL ),
    1419                 :            :     nNewAction( 1 ),
    1420                 :            :     pHeader( NULL ),
    1421 [ #  # ][ #  # ]:          0 :     bValidGUID( false )
         [ #  # ][ #  # ]
    1422                 :            : {
    1423                 :            :     OSL_ENSURE( GetOldRoot().pTabId, "XclExpChangeTrack::XclExpChangeTrack - root data incomplete" );
    1424 [ #  # ][ #  # ]:          0 :     if( !GetOldRoot().pTabId )
    1425                 :            :         return;
    1426                 :            : 
    1427         [ #  # ]:          0 :     ScChangeTrack* pTempChangeTrack = CreateTempChangeTrack();
    1428         [ #  # ]:          0 :     if (!pTempChangeTrack)
    1429                 :            :         return;
    1430                 :            : 
    1431 [ #  # ][ #  # ]:          0 :     pTabIdBuffer = new XclExpChTrTabIdBuffer( GetTabInfo().GetXclTabCount() );
                 [ #  # ]
    1432         [ #  # ]:          0 :     maBuffers.push_back( pTabIdBuffer );
    1433                 :            : 
    1434                 :            :     // calculate final table order (tab id list)
    1435                 :            :     const ScChangeAction* pScAction;
    1436         [ #  # ]:          0 :     for( pScAction = pTempChangeTrack->GetLast(); pScAction; pScAction = pScAction->GetPrev() )
    1437                 :            :     {
    1438         [ #  # ]:          0 :         if( pScAction->GetType() == SC_CAT_INSERT_TABS )
    1439                 :            :         {
    1440                 :          0 :             SCTAB nScTab = static_cast< SCTAB >( pScAction->GetBigRange().aStart.Tab() );
    1441 [ #  # ][ #  # ]:          0 :             pTabIdBuffer->InitFill( GetTabInfo().GetXclTab( nScTab ) );
    1442                 :            :         }
    1443                 :            :     }
    1444                 :          0 :     pTabIdBuffer->InitFillup();
    1445 [ #  # ][ #  # ]:          0 :     GetOldRoot().pTabId->Copy( *pTabIdBuffer );
    1446                 :            : 
    1447                 :            :     // get actions in reverse order
    1448                 :          0 :     pScAction = pTempChangeTrack->GetLast();
    1449         [ #  # ]:          0 :     while( pScAction )
    1450                 :            :     {
    1451         [ #  # ]:          0 :         PushActionRecord( *pScAction );
    1452                 :          0 :         const ScChangeAction* pPrevAction = pScAction->GetPrev();
    1453         [ #  # ]:          0 :         pTempChangeTrack->Undo( pScAction->GetActionNumber(), pScAction->GetActionNumber() );
    1454                 :          0 :         pScAction = pPrevAction;
    1455                 :            :     }
    1456                 :            : 
    1457                 :            :     // build record list
    1458 [ #  # ][ #  # ]:          0 :     pHeader = new XclExpChTrHeader;
    1459 [ #  # ][ #  # ]:          0 :     aRecList.push_back( new StartXmlElement( XML_headers, StartXmlElement::WRITE_NAMESPACES ) );
                 [ #  # ]
    1460         [ #  # ]:          0 :     aRecList.push_back( pHeader );
    1461 [ #  # ][ #  # ]:          0 :     aRecList.push_back( new XclExpChTr0x0195 );
                 [ #  # ]
    1462 [ #  # ][ #  # ]:          0 :     aRecList.push_back( new XclExpChTr0x0194( *pTempChangeTrack ) );
                 [ #  # ]
    1463                 :            : 
    1464         [ #  # ]:          0 :     String sLastUsername;
    1465                 :          0 :     DateTime aLastDateTime( DateTime::EMPTY );
    1466                 :          0 :     sal_uInt32 nIndex = 1;
    1467                 :          0 :     sal_Int32 nLogNumber = 1;
    1468         [ #  # ]:          0 :     while( !aActionStack.empty() )
    1469                 :            :     {
    1470         [ #  # ]:          0 :         XclExpChTrAction* pAction = aActionStack.top();
    1471         [ #  # ]:          0 :         aActionStack.pop();
    1472                 :            : 
    1473 [ #  # ][ #  # ]:          0 :         if( (nIndex == 1) || pAction->ForceInfoRecord() ||
           [ #  #  #  # ]
                 [ #  # ]
    1474         [ #  # ]:          0 :             (pAction->GetUsername() != sLastUsername) ||
    1475                 :          0 :             (pAction->GetDateTime() != aLastDateTime) )
    1476                 :            :         {
    1477         [ #  # ]:          0 :             if( nIndex != 1 )
    1478                 :            :             {
    1479 [ #  # ][ #  # ]:          0 :                 aRecList.push_back( new EndXmlElement( XML_revisions ) );
                 [ #  # ]
    1480 [ #  # ][ #  # ]:          0 :                 aRecList.push_back( new EndHeaderElement() );
                 [ #  # ]
    1481                 :            :             }
    1482                 :            : 
    1483         [ #  # ]:          0 :             lcl_GenerateGUID( aGUID, bValidGUID );
    1484         [ #  # ]:          0 :             sLastUsername = pAction->GetUsername();
    1485         [ #  # ]:          0 :             aLastDateTime = pAction->GetDateTime();
    1486                 :            : 
    1487 [ #  # ][ #  # ]:          0 :             aRecList.push_back( new StartXmlElement( XML_header, 0 ) );
                 [ #  # ]
    1488 [ #  # ][ #  # ]:          0 :             aRecList.push_back( new XclExpChTrInfo( sLastUsername, aLastDateTime, aGUID, nLogNumber++ ) );
                 [ #  # ]
    1489 [ #  # ][ #  # ]:          0 :             aRecList.push_back( new XclExpChTrTabId( pAction->GetTabIdBuffer(), true ) );
                 [ #  # ]
    1490 [ #  # ][ #  # ]:          0 :             aRecList.push_back( new StartXmlElement( XML_revisions, StartXmlElement::WRITE_NAMESPACES | StartXmlElement::CLOSE_ELEMENT ) );
                 [ #  # ]
    1491                 :          0 :             pHeader->SetGUID( aGUID );
    1492                 :            :         }
    1493         [ #  # ]:          0 :         pAction->SetIndex( nIndex );
    1494         [ #  # ]:          0 :         aRecList.push_back( pAction );
    1495                 :            :     }
    1496                 :            : 
    1497                 :          0 :     pHeader->SetGUID( aGUID );
    1498                 :          0 :     pHeader->SetCount( nIndex - 1 );
    1499         [ #  # ]:          0 :     if( nLogNumber > 1 )
    1500                 :            :     {
    1501 [ #  # ][ #  # ]:          0 :         aRecList.push_back( new EndXmlElement( XML_revisions ) );
                 [ #  # ]
    1502 [ #  # ][ #  # ]:          0 :         aRecList.push_back( new EndHeaderElement() );
                 [ #  # ]
    1503                 :            :     }
    1504 [ #  # ][ #  # ]:          0 :     aRecList.push_back( new EndXmlElement( XML_headers ) );
                 [ #  # ]
    1505 [ #  # ][ #  # ]:          0 :     aRecList.push_back( new ExcEof );
         [ #  # ][ #  # ]
    1506                 :            : }
    1507                 :            : 
    1508                 :          0 : XclExpChangeTrack::~XclExpChangeTrack()
    1509                 :            : {
    1510                 :          0 :     std::vector<ExcRecord*>::iterator prIter;
    1511 [ #  # ][ #  # ]:          0 :     for ( prIter = aRecList.begin(); prIter != aRecList.end(); ++prIter )
    1512 [ #  # ][ #  # ]:          0 :         delete *prIter;
    1513                 :            : 
    1514                 :          0 :     std::vector<XclExpChTrTabIdBuffer*>::iterator pIter;
    1515 [ #  # ][ #  # ]:          0 :     for ( pIter = maBuffers.begin(); pIter != maBuffers.end(); ++pIter )
    1516         [ #  # ]:          0 :         delete *pIter;
    1517                 :            : 
    1518         [ #  # ]:          0 :     while( !aActionStack.empty() )
    1519                 :            :     {
    1520 [ #  # ][ #  # ]:          0 :         delete aActionStack.top();
                 [ #  # ]
    1521         [ #  # ]:          0 :         aActionStack.pop();
    1522                 :            :     }
    1523                 :            : 
    1524         [ #  # ]:          0 :     if( pTempDoc )
    1525 [ #  # ][ #  # ]:          0 :         delete pTempDoc;
    1526         [ #  # ]:          0 : }
    1527                 :            : 
    1528                 :          0 : ScChangeTrack* XclExpChangeTrack::CreateTempChangeTrack()
    1529                 :            : {
    1530                 :            :     // get original change track
    1531                 :          0 :     ScChangeTrack* pOrigChangeTrack = GetDoc().GetChangeTrack();
    1532                 :            :     OSL_ENSURE( pOrigChangeTrack, "XclExpChangeTrack::CreateTempChangeTrack - no change track data" );
    1533         [ #  # ]:          0 :     if( !pOrigChangeTrack )
    1534                 :          0 :         return NULL;
    1535                 :            : 
    1536                 :            :     // create empty document
    1537 [ #  # ][ #  # ]:          0 :     pTempDoc = new ScDocument;
    1538                 :            :     OSL_ENSURE( pTempDoc, "XclExpChangeTrack::CreateTempChangeTrack - no temp document" );
    1539         [ #  # ]:          0 :     if( !pTempDoc )
    1540                 :          0 :         return NULL;
    1541                 :            : 
    1542                 :            :     // adjust table count
    1543         [ #  # ]:          0 :     SCTAB nOrigCount = GetDoc().GetTableCount();
    1544                 :          0 :     rtl::OUString sTabName;
    1545         [ #  # ]:          0 :     for( sal_Int32 nIndex = 0; nIndex < nOrigCount; nIndex++ )
    1546                 :            :     {
    1547         [ #  # ]:          0 :         pTempDoc->CreateValidTabName( sTabName );
    1548         [ #  # ]:          0 :         pTempDoc->InsertTab( SC_TAB_APPEND, sTabName );
    1549                 :            :     }
    1550                 :            :     OSL_ENSURE( nOrigCount == pTempDoc->GetTableCount(),
    1551                 :            :         "XclExpChangeTrack::CreateTempChangeTrack - table count mismatch" );
    1552 [ #  # ][ #  # ]:          0 :     if( nOrigCount != pTempDoc->GetTableCount() )
    1553                 :          0 :         return NULL;
    1554                 :            : 
    1555         [ #  # ]:          0 :     return pOrigChangeTrack->Clone(pTempDoc);
    1556                 :            : }
    1557                 :            : 
    1558                 :          0 : void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction )
    1559                 :            : {
    1560                 :          0 :     XclExpChTrAction* pXclAction = NULL;
    1561                 :          0 :     ScChangeTrack* pTempChangeTrack = pTempDoc->GetChangeTrack();
    1562   [ #  #  #  #  :          0 :     switch( rAction.GetType() )
                      # ]
    1563                 :            :     {
    1564                 :            :         case SC_CAT_CONTENT:
    1565 [ #  # ][ #  # ]:          0 :             pXclAction = new XclExpChTrCellContent( (const ScChangeActionContent&) rAction, GetRoot(), *pTabIdBuffer );
    1566                 :          0 :         break;
    1567                 :            :         case SC_CAT_INSERT_ROWS:
    1568                 :            :         case SC_CAT_INSERT_COLS:
    1569                 :            :         case SC_CAT_DELETE_ROWS:
    1570                 :            :         case SC_CAT_DELETE_COLS:
    1571         [ #  # ]:          0 :             if (pTempChangeTrack)
    1572 [ #  # ][ #  # ]:          0 :                 pXclAction = new XclExpChTrInsert( rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
    1573                 :          0 :         break;
    1574                 :            :         case SC_CAT_INSERT_TABS:
    1575                 :            :         {
    1576 [ #  # ][ #  # ]:          0 :             pXclAction = new XclExpChTrInsertTab( rAction, GetRoot(), *pTabIdBuffer );
    1577 [ #  # ][ #  # ]:          0 :             XclExpChTrTabIdBuffer* pNewBuffer = new XclExpChTrTabIdBuffer( *pTabIdBuffer );
    1578                 :          0 :             pNewBuffer->Remove();
    1579         [ #  # ]:          0 :             maBuffers.push_back( pNewBuffer );
    1580                 :          0 :             pTabIdBuffer = pNewBuffer;
    1581                 :            :         }
    1582                 :          0 :         break;
    1583                 :            :         case SC_CAT_MOVE:
    1584         [ #  # ]:          0 :             if (pTempChangeTrack)
    1585 [ #  # ][ #  # ]:          0 :                 pXclAction = new XclExpChTrMoveRange( (const ScChangeActionMove&) rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
    1586                 :          0 :         break;
    1587                 :            :         default:;
    1588                 :            :     }
    1589         [ #  # ]:          0 :     if( pXclAction )
    1590         [ #  # ]:          0 :         aActionStack.push( pXclAction );
    1591                 :          0 : }
    1592                 :            : 
    1593                 :          0 : sal_Bool XclExpChangeTrack::WriteUserNamesStream()
    1594                 :            : {
    1595                 :          0 :     sal_Bool bRet = false;
    1596 [ #  # ][ #  # ]:          0 :     SotStorageStreamRef xSvStrm = OpenStream( EXC_STREAM_USERNAMES );
                 [ #  # ]
    1597                 :            :     OSL_ENSURE( xSvStrm.Is(), "XclExpChangeTrack::WriteUserNamesStream - no stream" );
    1598         [ #  # ]:          0 :     if( xSvStrm.Is() )
    1599                 :            :     {
    1600         [ #  # ]:          0 :         XclExpStream aXclStrm( *xSvStrm, GetRoot() );
    1601 [ #  # ][ #  # ]:          0 :         XclExpChTr0x0191().Save( aXclStrm );
                 [ #  # ]
    1602 [ #  # ][ #  # ]:          0 :         XclExpChTr0x0198().Save( aXclStrm );
                 [ #  # ]
    1603 [ #  # ][ #  # ]:          0 :         XclExpChTr0x0192().Save( aXclStrm );
                 [ #  # ]
    1604 [ #  # ][ #  # ]:          0 :         XclExpChTr0x0197().Save( aXclStrm );
                 [ #  # ]
    1605         [ #  # ]:          0 :         xSvStrm->Commit();
    1606         [ #  # ]:          0 :         bRet = sal_True;
    1607                 :            :     }
    1608         [ #  # ]:          0 :     return bRet;
    1609                 :            : }
    1610                 :            : 
    1611                 :          0 : void XclExpChangeTrack::Write()
    1612                 :            : {
    1613         [ #  # ]:          0 :     if( aRecList.empty() )
    1614                 :          0 :         return;
    1615                 :            : 
    1616         [ #  # ]:          0 :     if( WriteUserNamesStream() )
    1617                 :            :     {
    1618 [ #  # ][ #  # ]:          0 :         SotStorageStreamRef xSvStrm = OpenStream( EXC_STREAM_REVLOG );
                 [ #  # ]
    1619                 :            :         OSL_ENSURE( xSvStrm.Is(), "XclExpChangeTrack::Write - no stream" );
    1620         [ #  # ]:          0 :         if( xSvStrm.Is() )
    1621                 :            :         {
    1622         [ #  # ]:          0 :             XclExpStream aXclStrm( *xSvStrm, GetRoot(), EXC_MAXRECSIZE_BIFF8 + 8 );
    1623                 :            : 
    1624                 :          0 :             std::vector<ExcRecord*>::iterator pIter;
    1625 [ #  # ][ #  # ]:          0 :             for ( pIter = aRecList.begin(); pIter != aRecList.end(); ++pIter )
    1626         [ #  # ]:          0 :                 (*pIter)->Save(aXclStrm);
    1627                 :            : 
    1628 [ #  # ][ #  # ]:          0 :             xSvStrm->Commit();
    1629         [ #  # ]:          0 :         }
    1630                 :            :     }
    1631                 :            : }
    1632                 :            : 
    1633                 :          0 : static void lcl_WriteUserNamesXml( XclExpXmlStream& rWorkbookStrm )
    1634                 :            : {
    1635                 :            :     sax_fastparser::FSHelperPtr pUserNames = rWorkbookStrm.CreateOutputStream(
    1636                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM( "xl/revisions/userNames.xml" )),
    1637                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM( "revisions/userNames.xml" )),
    1638         [ #  # ]:          0 :             rWorkbookStrm.GetCurrentStream()->getOutputStream(),
    1639                 :            :             "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml",
    1640 [ #  # ][ #  # ]:          0 :             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/usernames" );
         [ #  # ][ #  # ]
    1641                 :            :     pUserNames->startElement( XML_users,
    1642                 :            :             XML_xmlns,                  "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
    1643                 :            :             FSNS( XML_xmlns, XML_r ),   "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
    1644                 :            :             XML_count,                  "0",
    1645         [ #  # ]:          0 :             FSEND );
    1646                 :            :     // OOXTODO: XML_userinfo elements for each user editing the file
    1647                 :            :     //          Doesn't seem to be supported by .xls output either (based on
    1648                 :            :     //          contents of XclExpChangeTrack::WriteUserNamesStream()).
    1649 [ #  # ][ #  # ]:          0 :     pUserNames->endElement( XML_users );
    1650                 :          0 : }
    1651                 :            : 
    1652                 :          0 : void XclExpChangeTrack::WriteXml( XclExpXmlStream& rWorkbookStrm )
    1653                 :            : {
    1654         [ #  # ]:          0 :     if( aRecList.empty() )
    1655                 :          0 :         return;
    1656                 :            : 
    1657         [ #  # ]:          0 :     lcl_WriteUserNamesXml( rWorkbookStrm );
    1658                 :            : 
    1659                 :            :     sax_fastparser::FSHelperPtr pRevisionHeaders = rWorkbookStrm.CreateOutputStream(
    1660                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM( "xl/revisions/revisionHeaders.xml" )),
    1661                 :            :             OUString(RTL_CONSTASCII_USTRINGPARAM( "revisions/revisionHeaders.xml" )),
    1662         [ #  # ]:          0 :             rWorkbookStrm.GetCurrentStream()->getOutputStream(),
    1663                 :            :             "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml",
    1664 [ #  # ][ #  # ]:          0 :             "http://schemas.openxmlformats.org/officeDocument/2006/relationships/revisionHeaders" );
         [ #  # ][ #  # ]
    1665                 :            :     // OOXTODO: XML_userinfo elements for each user editing the file
    1666                 :            :     //          Doesn't seem to be supported by .xls output either (based on
    1667                 :            :     //          contents of XclExpChangeTrack::WriteUserNamesStream()).
    1668 [ #  # ][ #  # ]:          0 :     rWorkbookStrm.PushStream( pRevisionHeaders );
                 [ #  # ]
    1669                 :            : 
    1670                 :          0 :     std::vector<ExcRecord*>::iterator pIter;
    1671 [ #  # ][ #  # ]:          0 :     for ( pIter = aRecList.begin(); pIter != aRecList.end(); ++pIter )
    1672         [ #  # ]:          0 :         (*pIter)->SaveXml(rWorkbookStrm);
    1673                 :            : 
    1674 [ #  # ][ #  # ]:          0 :     rWorkbookStrm.PopStream();
    1675 [ +  - ][ +  - ]:         24 : }
    1676                 :            : 
    1677                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10