LibreOffice Module sc (master) 1
XclExpChangeTrack.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <memory>
21#include <numeric>
22#include <stdio.h>
23#include <sot/storage.hxx>
24#include <XclExpChangeTrack.hxx>
25#include <utility>
26#include <xeformula.hxx>
27#include <xehelper.hxx>
28#include <xltools.hxx>
29#include <formulacell.hxx>
30#include <document.hxx>
31#include <editutil.hxx>
32#include <root.hxx>
33#include <tools/Guid.hxx>
34
35#include <oox/export/utils.hxx>
36#include <oox/token/namespaces.hxx>
37#include <oox/token/tokens.hxx>
38#include <rtl/uuid.h>
39#include <svl/sharedstring.hxx>
40
41using namespace oox;
42
43static OString lcl_DateTimeToOString( const DateTime& rDateTime )
44{
45 char sBuf[ 200 ];
46 snprintf( sBuf, sizeof( sBuf ),
47 "%d-%02d-%02dT%02d:%02d:%02d.%09" SAL_PRIuUINT32 "Z",
48 rDateTime.GetYear(), rDateTime.GetMonth(), rDateTime.GetDay(),
49 rDateTime.GetHour(), rDateTime.GetMin(), rDateTime.GetSec(),
50 rDateTime.GetNanoSec() );
51 return OString(sBuf);
52}
53
54// local functions
55
56static void lcl_WriteDateTime( XclExpStream& rStrm, const DateTime& rDateTime )
57{
58 rStrm.SetSliceSize( 7 );
59 rStrm << static_cast<sal_uInt16>(rDateTime.GetYear())
60 << static_cast<sal_uInt8>(rDateTime.GetMonth())
61 << static_cast<sal_uInt8>(rDateTime.GetDay())
62 << static_cast<sal_uInt8>(rDateTime.GetHour())
63 << static_cast<sal_uInt8>(rDateTime.GetMin())
64 << static_cast<sal_uInt8>(rDateTime.GetSec());
65 rStrm.SetSliceSize( 0 );
66}
67
68// write string and fill rest of <nLength> with zero bytes
69// <nLength> is without string header
70static void lcl_WriteFixedString( XclExpStream& rStrm, const XclExpString& rString, std::size_t nLength )
71{
72 std::size_t nStrBytes = rString.GetBufferSize();
73 OSL_ENSURE( nLength >= nStrBytes, "lcl_WriteFixedString - String too long" );
74 if( rString.Len() > 0 )
75 rStrm << rString;
76 if( nLength > nStrBytes )
77 rStrm.WriteZeroBytes( nLength - nStrBytes );
78}
79
80static void lcl_GenerateGUID( sal_uInt8* pGUID, bool& rValidGUID )
81{
82 rtl_createUuid( pGUID, rValidGUID ? pGUID : nullptr, false );
83 rValidGUID = true;
84}
85
86static void lcl_WriteGUID( XclExpStream& rStrm, const sal_uInt8* pGUID )
87{
88 rStrm.SetSliceSize( 16 );
89 for( std::size_t nIndex = 0; nIndex < 16; nIndex++ )
90 rStrm << pGUID[ nIndex ];
91 rStrm.SetSliceSize( 0 );
92}
93
94XclExpUserBView::XclExpUserBView( const OUString& rUsername, const sal_uInt8* pGUID ) :
95 sUsername( rUsername )
96{
97 memcpy( aGUID, pGUID, 16 );
98}
99
101{
102 rStrm << sal_uInt32(0xFF078014)
103 << sal_uInt32(0x00000001);
105 rStrm.WriteZeroBytes( 8 );
106 rStrm << sal_uInt32(1200)
107 << sal_uInt32(1000)
108 << sal_uInt16(1000)
109 << sal_uInt16(0x0CF7)
110 << sal_uInt16(0x0000)
111 << sal_uInt16(0x0001)
112 << sal_uInt16(0x0000);
113 if( sUsername.Len() > 0 )
114 rStrm << sUsername;
115}
116
117sal_uInt16 XclExpUserBView::GetNum() const
118{
119 return 0x01A9;
120}
121
122std::size_t XclExpUserBView::GetLen() const
123{
124 return 50 + ((sUsername.Len() > 0) ? sUsername.GetSize() : 0);
125}
126
128{
129 sal_uInt8 aGUID[ 16 ];
130 bool bValidGUID = false;
131 const std::set<OUString>& rStrColl = rChangeTrack.GetUserCollection();
132 aViews.reserve(rStrColl.size());
133 for (const auto& rStr : rStrColl)
134 {
135 lcl_GenerateGUID( aGUID, bValidGUID );
136 aViews.emplace_back( rStr, aGUID );
137 }
138}
139
141{
142}
143
145{
146 for( XclExpUserBView& rView : aViews )
147 rView.Save( rStrm );
148}
149
151 nCurrTab( nTab )
152{
153 memcpy( aGUID, pGUID, 16 );
154}
155
157{
159 rStrm << nCurrTab
160 << sal_uInt32(100)
161 << sal_uInt32(64)
162 << sal_uInt32(3)
163 << sal_uInt32(0x0000003C)
164 << sal_uInt16(0)
165 << sal_uInt16(3)
166 << sal_uInt16(0)
167 << sal_uInt16(3)
168 << double(0)
169 << double(0)
170 << sal_Int16(-1)
171 << sal_Int16(-1);
172}
173
175{
176 return 0x01AA;
177}
178
180{
181 return 64;
182}
183
185{
186 rStrm << sal_uInt16(0x0001);
187}
188
190{
191 return 0x01AB;
192}
193
194std::size_t XclExpUsersViewEnd::GetLen() const
195{
196 return 2;
197}
198
200{
201 rStrm << sal_uInt16(0x0000);
202}
203
204sal_uInt16 XclExpChTr0x0191::GetNum() const
205{
206 return 0x0191;
207}
208
209std::size_t XclExpChTr0x0191::GetLen() const
210{
211 return 2;
212}
213
215{
216 rStrm << sal_uInt16(0x0006)
217 << sal_uInt16(0x0000);
218}
219
220sal_uInt16 XclExpChTr0x0198::GetNum() const
221{
222 return 0x0198;
223}
224
225std::size_t XclExpChTr0x0198::GetLen() const
226{
227 return 4;
228}
229
231{
232 rStrm << sal_uInt16( 0x0022 );
233 rStrm.WriteZeroBytes( 510 );
234}
235
236sal_uInt16 XclExpChTr0x0192::GetNum() const
237{
238 return 0x0192;
239}
240
241std::size_t XclExpChTr0x0192::GetLen() const
242{
243 return 512;
244}
245
247{
248 rStrm << sal_uInt16(0x0000);
249}
250
251sal_uInt16 XclExpChTr0x0197::GetNum() const
252{
253 return 0x0197;
254}
255
256std::size_t XclExpChTr0x0197::GetLen() const
257{
258 return 2;
259}
260
262{
263}
264
265sal_uInt16 XclExpChTrEmpty::GetNum() const
266{
267 return nRecNum;
268}
269
270std::size_t XclExpChTrEmpty::GetLen() const
271{
272 return 0;
273}
274
276{
277}
278
280{
281 rStrm.WriteZeroBytes( 162 );
282}
283
284sal_uInt16 XclExpChTr0x0195::GetNum() const
285{
286 return 0x0195;
287}
288
289std::size_t XclExpChTr0x0195::GetLen() const
290{
291 return 162;
292}
293
295{
296}
297
299{
300 rStrm << sal_uInt32(0);
302 rStrm << sal_uInt8(0);
304}
305
306sal_uInt16 XclExpChTr0x0194::GetNum() const
307{
308 return 0x0194;
309}
310
311std::size_t XclExpChTr0x0194::GetLen() const
312{
313 return 162;
314}
315
317{
318}
319
321{
322 rStrm << sal_uInt16(0x0006)
323 << sal_uInt16(0x0000)
324 << sal_uInt16(0x000D);
327 rStrm << nCount
328 << sal_uInt16(0x0001)
329 << sal_uInt32(0x00000000)
330 << sal_uInt16(0x001E);
331}
332
333sal_uInt16 XclExpChTrHeader::GetNum() const
334{
335 return 0x0196;
336}
337
338std::size_t XclExpChTrHeader::GetLen() const
339{
340 return 50;
341}
342
343void XclExpChTrHeader::SaveXml( XclExpXmlStream& rRevisionHeadersStrm )
344{
345 sax_fastparser::FSHelperPtr pHeaders = rRevisionHeadersStrm.GetCurrentStream();
346 tools::Guid aGuid(aGUID);
347 rRevisionHeadersStrm.WriteAttributes(
348 XML_guid, aGuid.getString(),
349 XML_lastGuid, nullptr, // OOXTODO
350 XML_shared, nullptr, // OOXTODO
351 XML_diskRevisions, nullptr, // OOXTODO
352 XML_history, nullptr, // OOXTODO
353 XML_trackRevisions, nullptr, // OOXTODO
354 XML_exclusive, nullptr, // OOXTODO
355 XML_revisionId, nullptr, // OOXTODO
356 XML_version, nullptr, // OOXTODO
357 XML_keepChangeHistory, nullptr, // OOXTODO
358 XML_protected, nullptr, // OOXTODO
359 XML_preserveHistory, nullptr); // OOXTODO
360 pHeaders->write( ">" );
361}
362
364{
365 memcpy(maGUID, pGUID, 16);
366}
367
369{
370 sax_fastparser::FSHelperPtr pHeaders = rStrm.GetCurrentStream();
371
372 pHeaders->write("<")->writeId(XML_headers);
373
374 tools::Guid aGuid(maGUID);
375 rStrm.WriteAttributes(
376 XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)),
377 FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)),
378 XML_guid, aGuid.getString(),
379 XML_lastGuid, nullptr, // OOXTODO
380 XML_shared, nullptr, // OOXTODO
381 XML_diskRevisions, nullptr, // OOXTODO
382 XML_history, nullptr, // OOXTODO
383 XML_trackRevisions, nullptr, // OOXTODO
384 XML_exclusive, nullptr, // OOXTODO
385 XML_revisionId, nullptr, // OOXTODO
386 XML_version, nullptr, // OOXTODO
387 XML_keepChangeHistory, nullptr, // OOXTODO
388 XML_protected, nullptr, // OOXTODO
389 XML_preserveHistory, nullptr); // OOXTODO
390
391 pHeaders->write(">");
392}
393
395 OUString aUserName, const DateTime& rDateTime, const sal_uInt8* pGUID,
396 sal_Int32 nLogNumber, const XclExpChTrTabIdBuffer& rBuf ) :
397 maUserName(std::move(aUserName)), maDateTime(rDateTime), mnLogNumber(nLogNumber),
398 mnMinAction(0), mnMaxAction(0)
399{
400 memcpy(maGUID, pGUID, 16);
401 if (rBuf.GetBufferCount())
402 {
403 maTabBuffer.resize(rBuf.GetBufferCount());
404 rBuf.GetBufferCopy(maTabBuffer.data());
405 }
406}
407
409{
410 sax_fastparser::FSHelperPtr pHeader = rStrm.GetCurrentStream();
411
412 pHeader->write("<")->writeId(XML_header);
413
414 OUString aRelId;
415 sax_fastparser::FSHelperPtr pRevLogStrm = rStrm.CreateOutputStream(
416 XclXmlUtils::GetStreamName("xl/revisions/", "revisionLog", mnLogNumber),
417 XclXmlUtils::GetStreamName(nullptr, "revisionLog", mnLogNumber),
418 rStrm.GetCurrentStream()->getOutputStream(),
419 "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionLog+xml",
420 CREATE_OFFICEDOC_RELATION_TYPE("revisionLog"),
421 &aRelId);
422
423 tools::Guid aGuid(maGUID);
424 rStrm.WriteAttributes(
425 XML_guid, aGuid.getString(),
426 XML_dateTime, lcl_DateTimeToOString(maDateTime),
427 XML_userName, maUserName,
428 FSNS(XML_r, XML_id), aRelId);
429
430 if (mnMinAction)
431 rStrm.WriteAttributes(XML_minRId, OUString::number(mnMinAction));
432
433 if (mnMaxAction)
434 rStrm.WriteAttributes(XML_maxRId, OUString::number(mnMaxAction));
435
436 if (!maTabBuffer.empty())
437 // next available sheet index.
438 rStrm.WriteAttributes(XML_maxSheetId, OUString::number(maTabBuffer.back()+1));
439
440 pHeader->write(">");
441
442 if (!maTabBuffer.empty())
443 {
444 // Write sheet index map.
445 size_t n = maTabBuffer.size();
446 pHeader->startElement(XML_sheetIdMap, XML_count, OString::number(n));
447
448 for (size_t i = 0; i < n; ++i)
449 {
450 pHeader->singleElement(XML_sheetId, XML_val, OString::number(maTabBuffer[i]));
451 }
452 pHeader->endElement(XML_sheetIdMap);
453 }
454
455 // Write all revision logs in a separate stream.
456
457 rStrm.PushStream(pRevLogStrm);
458
459 pRevLogStrm->write("<")->writeId(XML_revisions);
460
461 rStrm.WriteAttributes(
462 XML_xmlns, rStrm.getNamespaceURL(OOX_NS(xls)),
463 FSNS(XML_xmlns, XML_r), rStrm.getNamespaceURL(OOX_NS(officeRel)));
464
465 pRevLogStrm->write(">");
466
467 for (const auto& rxAction : maActions)
468 {
469 rxAction->SaveXml(rStrm);
470 }
471
472 pRevLogStrm->write("</")->writeId(XML_revisions)->write(">");
473
474 rStrm.PopStream();
475
476 pHeader->write("</")->writeId(XML_header)->write(">");
477}
478
479void XclExpXmlChTrHeader::AppendAction( std::unique_ptr<XclExpChTrAction> pAction )
480{
481 sal_uInt32 nActionNum = pAction->GetActionNumber();
482 if (!mnMinAction || mnMinAction > nActionNum)
483 mnMinAction = nActionNum;
484
485 if (!mnMaxAction || mnMaxAction < nActionNum)
486 mnMaxAction = nActionNum;
487
488 maActions.push_back(std::move(pAction));
489}
490
491XclExpChTrInfo::XclExpChTrInfo( const OUString& rUsername, const DateTime& rDateTime, const sal_uInt8* pGUID ) :
492 sUsername( rUsername ),
493 aDateTime( rDateTime )
494{
495 memcpy( aGUID, pGUID, 16 );
496}
497
499{
500}
501
503{
504 rStrm << sal_uInt32(0xFFFFFFFF)
505 << sal_uInt32(0x00000000)
506 << sal_uInt32(0x00000020)
507 << sal_uInt16(0xFFFF);
509 rStrm << sal_uInt16(0x04B0);
512 rStrm << sal_uInt8(0x0000)
513 << sal_uInt16(0x0002);
514}
515
516sal_uInt16 XclExpChTrInfo::GetNum() const
517{
518 return 0x0138;
519}
520
521std::size_t XclExpChTrInfo::GetLen() const
522{
523 return 158;
524}
525
527 nBufSize( nCount ),
528 nLastId( nCount )
529{
530 pBuffer.reset( new sal_uInt16[ nBufSize ] );
531 memset( pBuffer.get(), 0, sizeof(sal_uInt16) * nBufSize );
532 pLast = pBuffer.get() + nBufSize - 1;
533}
534
536 nBufSize( rCopy.nBufSize ),
537 nLastId( rCopy.nLastId )
538{
539 pBuffer.reset( new sal_uInt16[ nBufSize ] );
540 memcpy( pBuffer.get(), rCopy.pBuffer.get(), sizeof(sal_uInt16) * nBufSize );
541 pLast = pBuffer.get() + nBufSize - 1;
542}
543
545{
546}
547
548void XclExpChTrTabIdBuffer::InitFill( sal_uInt16 nIndex )
549{
550 OSL_ENSURE( nIndex < nLastId, "XclExpChTrTabIdBuffer::Insert - out of range" );
551
552 sal_uInt16 nFreeCount = 0;
553 for( sal_uInt16* pElem = pBuffer.get(); pElem <= pLast; pElem++ )
554 {
555 if( !*pElem )
556 nFreeCount++;
557 if( nFreeCount > nIndex )
558 {
559 *pElem = nLastId--;
560 return;
561 }
562 }
563}
564
566{
567 sal_uInt16 nFreeCount = 1;
568 for( sal_uInt16* pElem = pBuffer.get(); pElem <= pLast; pElem++ )
569 if( !*pElem )
570 *pElem = nFreeCount++;
572}
573
574sal_uInt16 XclExpChTrTabIdBuffer::GetId( sal_uInt16 nIndex ) const
575{
576 OSL_ENSURE( nIndex < nBufSize, "XclExpChTrTabIdBuffer::GetId - out of range" );
577 return pBuffer[ nIndex ];
578}
579
581{
582 OSL_ENSURE( pBuffer.get() <= pLast, "XclExpChTrTabIdBuffer::Remove - buffer empty" );
583 sal_uInt16* pElem = pBuffer.get();
584 while( (pElem <= pLast) && (*pElem != nLastId) )
585 pElem++;
586 while( pElem < pLast )
587 {
588 *pElem = *(pElem + 1);
589 pElem++;
590 }
591 pLast--;
592 nLastId--;
593}
594
596 : nTabCount( rBuffer.GetBufferCount() )
597{
598 pBuffer.reset( new sal_uInt16[ nTabCount ] );
599 rBuffer.GetBufferCopy( pBuffer.get() );
600}
601
603{
604 Clear();
605}
606
608{
609 Clear();
610 nTabCount = rBuffer.GetBufferCount();
611 pBuffer.reset( new sal_uInt16[ nTabCount ] );
612 rBuffer.GetBufferCopy( pBuffer.get() );
613}
614
616{
617 rStrm.EnableEncryption();
618 if( pBuffer )
619 rStrm.Write(pBuffer.get(), nTabCount);
620 else
621 for( sal_uInt16 nIndex = 1; nIndex <= nTabCount; nIndex++ )
622 rStrm << nIndex;
623}
624
625sal_uInt16 XclExpChTrTabId::GetNum() const
626{
627 return 0x013D;
628}
629
630std::size_t XclExpChTrTabId::GetLen() const
631{
632 return nTabCount << 1;
633}
634
635// ! does not copy additional actions
637 ExcRecord( rCopy ),
638 sUsername( rCopy.sUsername ),
639 aDateTime( rCopy.aDateTime ),
640 nIndex( 0 ),
641 bAccepted( rCopy.bAccepted ),
642 rTabInfo( rCopy.rTabInfo ),
643 rIdBuffer( rCopy.rIdBuffer ),
644 nLength( rCopy.nLength ),
645 nOpCode( rCopy.nOpCode ),
646 bForceInfo( rCopy.bForceInfo )
647{
648}
649
651 const ScChangeAction& rAction,
652 const XclExpRoot& rRoot,
653 const XclExpChTrTabIdBuffer& rTabIdBuffer,
654 sal_uInt16 nNewOpCode ) :
655 sUsername( rAction.GetUser() ),
656 aDateTime( rAction.GetDateTime() ),
657 nIndex( 0 ),
658 bAccepted( rAction.IsAccepted() ),
659 rTabInfo( rRoot.GetTabInfo() ),
660 rIdBuffer( rTabIdBuffer ),
661 nLength( 0 ),
662 nOpCode( nNewOpCode ),
663 bForceInfo( false )
664{
665 aDateTime.SetSec( 0 );
667}
668
670{
671}
672
674{
675 if( pAddAction )
676 pAddAction->SetAddAction( pAction );
677 else
678 pAddAction.reset( pAction );
679}
680
682 const ScChangeAction& rAction,
683 const XclExpRoot& rRoot,
684 const ScChangeTrack& rChangeTrack )
685{
686 ScChangeActionMap aActionMap;
687
688 rChangeTrack.GetDependents( const_cast<ScChangeAction*>(&rAction), aActionMap );
689 for( const auto& rEntry : aActionMap )
690 if( rEntry.second->GetType() == SC_CAT_CONTENT )
692 *static_cast<const ScChangeActionContent*>(rEntry.second), rRoot, rIdBuffer ) );
693}
694
695void XclExpChTrAction::SetIndex( sal_uInt32& rIndex )
696{
697 nIndex = rIndex++;
698}
699
701{
702 OSL_ENSURE( nOpCode != EXC_CHTR_OP_UNKNOWN, "XclExpChTrAction::SaveCont - unknown action" );
703 rStrm << nLength
704 << nIndex
705 << nOpCode
706 << static_cast<sal_uInt16>(bAccepted ? EXC_CHTR_ACCEPT : EXC_CHTR_NOTHING);
708}
709
711{
712}
713
715{
716}
717
719{
722 if( pAddAction )
723 pAddAction->Save( rStrm );
725}
726
727std::size_t XclExpChTrAction::GetLen() const
728{
730}
731
733 mpFormulaCell( nullptr ),
734 fValue( 0.0 ),
735 nRKValue( 0 ),
737 nSize( 0 )
738{
739}
740
742{
743 Clear();
744}
745
747{
748 pString.reset();
749 mpFormulaCell = nullptr;
750 mxTokArr.reset();
751 maRefLog.clear();
752 fValue = 0.0;
753 nRKValue = 0;
755 nSize = 0;
756}
757
759{
760 OSL_ENSURE( mxTokArr && !mxTokArr->Empty(), "XclExpChTrData::Write - no formula" );
761 rStrm << *mxTokArr;
762
763 for( const auto& rLogEntry : maRefLog )
764 {
765 if( rLogEntry.mpUrl && rLogEntry.mpFirstTab )
766 {
767 rStrm << *rLogEntry.mpUrl << sal_uInt8(0x01) << *rLogEntry.mpFirstTab << sal_uInt8(0x02);
768 }
769 else
770 {
771 bool bSingleTab = rLogEntry.mnFirstXclTab == rLogEntry.mnLastXclTab;
772 rStrm.SetSliceSize( bSingleTab ? 6 : 8 );
773 rStrm << sal_uInt8(0x01) << sal_uInt8(0x02) << sal_uInt8(0x00);
774 rStrm << rTabIdBuffer.GetId( rLogEntry.mnFirstXclTab );
775 if( bSingleTab )
776 rStrm << sal_uInt8(0x02);
777 else
778 rStrm << sal_uInt8(0x00) << rTabIdBuffer.GetId( rLogEntry.mnLastXclTab );
779 }
780 }
781 rStrm.SetSliceSize( 0 );
782 rStrm << sal_uInt8(0x00);
783}
784
786{
787 switch( nType )
788 {
789 case EXC_CHTR_TYPE_RK:
790 rStrm << nRKValue;
791 break;
793 rStrm << fValue;
794 break;
796 OSL_ENSURE( pString, "XclExpChTrData::Write - no string" );
797 rStrm << *pString;
798 break;
800 WriteFormula( rStrm, rTabIdBuffer );
801 break;
802 }
803}
804
806 const ScChangeActionContent& rAction,
807 const XclExpRoot& rRoot,
808 const XclExpChTrTabIdBuffer& rTabIdBuffer ) :
809 XclExpChTrAction( rAction, rRoot, rTabIdBuffer, EXC_CHTR_OP_CELL ),
810 XclExpRoot( rRoot ),
811 aPosition( rAction.GetBigRange().MakeRange( rRoot.GetDoc()).aStart )
812{
813 sal_uInt32 nDummy32;
814 sal_uInt16 nDummy16;
815 GetCellData( rRoot, rAction.GetOldCell(), pOldData, nDummy32, nOldLength );
816 GetCellData( rRoot, rAction.GetNewCell(), pNewData, nLength, nDummy16 );
817}
818
820{
821 pOldData.reset();
822 pNewData.reset();
823}
824
825void XclExpChTrCellContent::MakeEmptyChTrData( std::unique_ptr<XclExpChTrData>& rpData )
826{
827 if( rpData )
828 rpData->Clear();
829 else
830 rpData.reset( new XclExpChTrData );
831}
832
834 const XclExpRoot& rRoot, const ScCellValue& rScCell,
835 std::unique_ptr<XclExpChTrData>& rpData, sal_uInt32& rXclLength1, sal_uInt16& rXclLength2 )
836{
837 MakeEmptyChTrData( rpData );
838 rXclLength1 = 0x0000003A;
839 rXclLength2 = 0x0000;
840
841 if (rScCell.isEmpty())
842 {
843 rpData.reset();
844 return;
845 }
846
847 switch (rScCell.getType())
848 {
849 case CELLTYPE_VALUE:
850 {
851 rpData->fValue = rScCell.getDouble();
852 if( XclTools::GetRKFromDouble( rpData->nRKValue, rpData->fValue ) )
853 {
854 rpData->nType = EXC_CHTR_TYPE_RK;
855 rpData->nSize = 4;
856 rXclLength1 = 0x0000003E;
857 rXclLength2 = 0x0004;
858 }
859 else
860 {
861 rpData->nType = EXC_CHTR_TYPE_DOUBLE;
862 rpData->nSize = 8;
863 rXclLength1 = 0x00000042;
864 rXclLength2 = 0x0008;
865 }
866 }
867 break;
868 case CELLTYPE_STRING:
869 case CELLTYPE_EDIT:
870 {
871 OUString sCellStr;
872 if (rScCell.getType() == CELLTYPE_STRING)
873 {
874 sCellStr = rScCell.getSharedString()->getString();
875 rpData->mpFormattedString = XclExpStringHelper::CreateCellString(
876 rRoot, sCellStr, nullptr);
877 }
878 else
879 {
880 XclExpHyperlinkHelper aLinkHelper( rRoot, aPosition );
881 if (rScCell.getEditText())
882 {
883 sCellStr = ScEditUtil::GetString(*rScCell.getEditText(), &GetDoc());
884 rpData->mpFormattedString = XclExpStringHelper::CreateCellString(
885 rRoot, *rScCell.getEditText(), nullptr, aLinkHelper);
886 }
887 else
888 {
889 rpData->mpFormattedString = XclExpStringHelper::CreateCellString(
890 rRoot, OUString(), nullptr);
891 }
892 }
893 rpData->pString.reset( new XclExpString( sCellStr, XclStrFlags::NONE, 32766 ) );
894 rpData->nType = EXC_CHTR_TYPE_STRING;
895 rpData->nSize = 3 + rpData->pString->GetSize();
896 rXclLength1 = 64 + (sCellStr.getLength() << 1);
897 rXclLength2 = 6 + static_cast<sal_uInt16>(sCellStr.getLength() << 1);
898 }
899 break;
900 case CELLTYPE_FORMULA:
901 {
902 const ScFormulaCell* pFmlCell = rScCell.getFormula();
903 rpData->mpFormulaCell = pFmlCell;
904
905 const ScTokenArray* pTokenArray = pFmlCell->GetCode();
906 if( pTokenArray )
907 {
908 XclExpRefLog& rRefLog = rpData->maRefLog;
909 rpData->mxTokArr = GetFormulaCompiler().CreateFormula(
910 EXC_FMLATYPE_CELL, *pTokenArray, &pFmlCell->aPos, &rRefLog );
911 rpData->nType = EXC_CHTR_TYPE_FORMULA;
912 std::size_t nSize = std::accumulate(rRefLog.begin(), rRefLog.end(),
913 static_cast<std::size_t>(rpData->mxTokArr->GetSize() + 3),
914 [](const std::size_t& rSum, const XclExpRefLogEntry& rLogEntry) {
915 if( rLogEntry.mpUrl && rLogEntry.mpFirstTab )
916 return rSum + rLogEntry.mpUrl->GetSize() + rLogEntry.mpFirstTab->GetSize() + 2;
917 else
918 return rSum + ((rLogEntry.mnFirstXclTab == rLogEntry.mnLastXclTab) ? 6 : 8);
919 });
920 rpData->nSize = ::std::min< std::size_t >( nSize, 0xFFFF );
921 rXclLength1 = 0x00000052;
922 rXclLength2 = 0x0018;
923 }
924 }
925 break;
926 default:;
927 }
928}
929
931{
933 rStrm << static_cast<sal_uInt16>((pOldData ? (pOldData->nType << 3) : 0x0000) | (pNewData ? pNewData->nType : 0x0000))
934 << sal_uInt16(0x0000);
937 << sal_uInt32(0x00000000);
938 if( pOldData )
939 pOldData->Write( rStrm, rIdBuffer );
940 if( pNewData )
941 pNewData->Write( rStrm, rIdBuffer );
942}
943
945{
946 return 0x013B;
947}
948
950{
951 std::size_t nLen = 16;
952 if( pOldData )
953 nLen += pOldData->nSize;
954 if( pNewData )
955 nLen += pNewData->nSize;
956 return nLen;
957}
958
959static const char* lcl_GetType( XclExpChTrData* pData )
960{
961 switch( pData->nType )
962 {
963 case EXC_CHTR_TYPE_RK:
965 return "n";
967 {
968 ScFormulaCell* pFormulaCell = const_cast< ScFormulaCell* >( pData->mpFormulaCell );
969 const char* sType;
970 OUString sValue;
971 XclXmlUtils::GetFormulaTypeAndValue( *pFormulaCell, sType, sValue );
972 return sType;
973 }
974 break;
976 return "inlineStr";
977 default:
978 break;
979 }
980 return "*unknown*";
981}
982
983static void lcl_WriteCell( XclExpXmlStream& rStrm, sal_Int32 nElement, const ScAddress& rPosition, XclExpChTrData* pData )
984{
985 sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
986
987 pStream->startElement(nElement,
988 XML_r, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), rPosition),
989 XML_s, nullptr, // OOXTODO: not supported
990 XML_t, lcl_GetType(pData),
991 XML_cm, nullptr, // OOXTODO: not supported
992 XML_vm, nullptr, // OOXTODO: not supported
993 XML_ph, nullptr); // OOXTODO: not supported
994 switch( pData->nType )
995 {
996 case EXC_CHTR_TYPE_RK:
998 pStream->startElement(XML_v);
999 pStream->write( pData->fValue );
1000 pStream->endElement( XML_v );
1001 break;
1003 pStream->startElement( XML_f
1004 // OOXTODO: other attributes? see XclExpFormulaCell::SaveXml()
1005 );
1006 pStream->writeEscaped( XclXmlUtils::ToOUString(
1007 rStrm.GetRoot().GetCompileFormulaContext(),
1008 pData->mpFormulaCell->aPos, pData->mpFormulaCell->GetCode()));
1009 pStream->endElement( XML_f );
1010 break;
1012 pStream->startElement(XML_is);
1013 if( pData->mpFormattedString )
1014 pData->mpFormattedString->WriteXml( rStrm );
1015 else
1016 pData->pString->WriteXml( rStrm );
1017 pStream->endElement( XML_is );
1018 break;
1019 default:
1020 // ignore
1021 break;
1022 }
1023 pStream->endElement( nElement );
1024}
1025
1027{
1028 sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
1029 pStream->startElement( XML_rcc,
1030 XML_rId, OString::number(GetActionNumber()),
1031 XML_ua, ToPsz( GetAccepted () ), // OOXTODO? bAccepted == ua or ra; not sure.
1032 XML_ra, nullptr, // OOXTODO: RRD.fUndoAction? Or RRD.fAccepted?
1033 XML_sId, OString::number(GetTabId(aPosition.Tab())),
1034 XML_odxf, nullptr, // OOXTODO: not supported
1035 XML_xfDxf, nullptr, // OOXTODO: not supported
1036 XML_s, nullptr, // OOXTODO: not supported
1037 XML_dxf, nullptr, // OOXTODO: not supported
1038 XML_numFmtId, nullptr, // OOXTODO: not supported
1039 XML_quotePrefix, nullptr, // OOXTODO: not supported
1040 XML_oldQuotePrefix, nullptr, // OOXTODO: not supported
1041 XML_ph, nullptr, // OOXTODO: not supported
1042 XML_oldPh, nullptr, // OOXTODO: not supported
1043 XML_endOfListFormulaUpdate, nullptr); // OOXTODO: not supported
1044 if( pOldData )
1045 {
1046 lcl_WriteCell( rRevisionLogStrm, XML_oc, aPosition, pOldData.get() );
1047 if (!pNewData)
1048 {
1049 pStream->singleElement(XML_nc, XML_r, XclXmlUtils::ToOString(rRevisionLogStrm.GetRoot().GetDoc(), aPosition));
1050 }
1051 }
1052 if( pNewData )
1053 {
1054 lcl_WriteCell( rRevisionLogStrm, XML_nc, aPosition, pNewData.get() );
1055 }
1056 // OOXTODO: XML_odxf, XML_ndxf, XML_extLst elements
1057 pStream->endElement( XML_rcc );
1058}
1059
1061 XclExpChTrAction(rCopy),
1062 mbEndOfList(rCopy.mbEndOfList),
1063 aRange(rCopy.aRange) {}
1064
1066 const ScChangeAction& rAction,
1067 const XclExpRoot& rRoot,
1068 const XclExpChTrTabIdBuffer& rTabIdBuffer,
1069 const ScChangeTrack& rChangeTrack ) :
1070 XclExpChTrAction( rAction, rRoot, rTabIdBuffer ),
1071 mbEndOfList(false),
1072 aRange( rAction.GetBigRange().MakeRange( rRoot.GetDoc()) )
1073{
1074 nLength = 0x00000030;
1075 switch( rAction.GetType() )
1076 {
1078 case SC_CAT_INSERT_ROWS:
1079 {
1080 const ScChangeActionIns& rIns = static_cast<const ScChangeActionIns&>(rAction);
1081 mbEndOfList = rIns.IsEndOfList();
1083 }
1084 break;
1087 default:
1088 OSL_FAIL( "XclExpChTrInsert::XclExpChTrInsert - unknown action" );
1089 }
1090
1092 {
1093 aRange.aStart.SetRow( 0 );
1094 aRange.aEnd.SetRow( rRoot.GetXclMaxPos().Row() );
1095 }
1096 else
1097 {
1098 aRange.aStart.SetCol( 0 );
1099 aRange.aEnd.SetCol( rRoot.GetXclMaxPos().Col() );
1100 }
1101
1103 {
1104 SetAddAction( new XclExpChTr0x014A( *this ) );
1105 AddDependentContents( rAction, rRoot, rChangeTrack );
1106 }
1107}
1108
1110{
1111}
1112
1114{
1116 sal_uInt16 nFlagVal = mbEndOfList ? 0x0001 : 0x0000;
1117 rStrm << nFlagVal;
1119 rStrm << sal_uInt32(0x00000000);
1120}
1121
1123{
1125 XclExpChTrEmpty( 0x0150 ).Save( rStrm );
1126}
1127
1129{
1131 XclExpChTrEmpty( 0x0151 ).Save( rStrm );
1132}
1133
1135{
1136 return 0x0137;
1137}
1138
1140{
1141 return 16;
1142}
1143
1144static const char* lcl_GetAction( sal_uInt16 nOpCode )
1145{
1146 switch( nOpCode )
1147 {
1148 case EXC_CHTR_OP_INSCOL: return "insertCol";
1149 case EXC_CHTR_OP_INSROW: return "insertRow";
1150 case EXC_CHTR_OP_DELCOL: return "deleteCol";
1151 case EXC_CHTR_OP_DELROW: return "deleteRow";
1152 default: return "*unknown*";
1153 }
1154}
1155
1157{
1158 sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
1159 pStream->startElement( XML_rrc,
1160 XML_rId, OString::number(GetActionNumber()),
1161 XML_ua, ToPsz( GetAccepted () ), // OOXTODO? bAccepted == ua or ra; not sure.
1162 XML_ra, nullptr, // OOXTODO: RRD.fUndoAction? Or RRD.fAccepted?
1163 XML_sId, OString::number(GetTabId(aRange.aStart.Tab())),
1164 XML_eol, ToPsz10(mbEndOfList),
1165 XML_ref, XclXmlUtils::ToOString(rRevisionLogStrm.GetRoot().GetDoc(), aRange),
1166 XML_action, lcl_GetAction( nOpCode ),
1167 XML_edge, nullptr); // OOXTODO: ???
1168
1169 // OOXTODO: does this handle XML_rfmt, XML_undo?
1170 XclExpChTrAction* pAction = GetAddAction();
1171 while( pAction != nullptr )
1172 {
1173 pAction->SaveXml( rRevisionLogStrm );
1174 pAction = pAction->GetAddAction();
1175 }
1176 pStream->endElement( XML_rrc );
1177}
1178
1180 const ScChangeAction& rAction,
1181 const XclExpRoot& rRoot,
1182 const XclExpChTrTabIdBuffer& rTabIdBuffer ) :
1183 XclExpChTrAction( rAction, rRoot, rTabIdBuffer, EXC_CHTR_OP_INSTAB ),
1184 XclExpRoot( rRoot ),
1185 nTab( static_cast<SCTAB>(rAction.GetBigRange().aStart.Tab()) )
1186{
1187 nLength = 0x0000021C;
1188 bForceInfo = true;
1189}
1190
1192{
1193}
1194
1196{
1197 WriteTabId( rStrm, nTab );
1198 rStrm << sal_uInt32( 0 );
1199 lcl_WriteFixedString( rStrm, XclExpString( GetTabInfo().GetScTabName( nTab ) ), 127 );
1201 rStrm.WriteZeroBytes( 133 );
1202}
1203
1205{
1206 return 0x014D;
1207}
1208
1210{
1211 return 276;
1212}
1213
1215{
1216 sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
1217 pStream->singleElement( XML_ris,
1218 XML_rId, OString::number(GetActionNumber()),
1219 XML_ua, ToPsz( GetAccepted () ), // OOXTODO? bAccepted == ua or ra; not sure.
1220 XML_ra, nullptr, // OOXTODO: RRD.fUndoAction? Or RRD.fAccepted?
1221 XML_sheetId, OString::number(GetTabId(nTab)),
1222 XML_name, GetTabInfo().GetScTabName(nTab).toUtf8(),
1223 XML_sheetPosition, OString::number(nTab) );
1224}
1225
1227 const ScChangeActionMove& rAction,
1228 const XclExpRoot& rRoot,
1229 const XclExpChTrTabIdBuffer& rTabIdBuffer,
1230 const ScChangeTrack& rChangeTrack ) :
1231 XclExpChTrAction( rAction, rRoot, rTabIdBuffer, EXC_CHTR_OP_MOVE ),
1232 aDestRange( rAction.GetBigRange().MakeRange( rRoot.GetDoc() ) )
1233{
1234 nLength = 0x00000042;
1236 sal_Int32 nDCols, nDRows, nDTabs;
1237 rAction.GetDelta( nDCols, nDRows, nDTabs );
1238 aSourceRange.aStart.IncRow( static_cast<SCROW>(-nDRows) );
1239 aSourceRange.aStart.IncCol( static_cast<SCCOL>(-nDCols) );
1240 aSourceRange.aStart.IncTab( static_cast<SCTAB>(-nDTabs) );
1241 aSourceRange.aEnd.IncRow( static_cast<SCROW>(-nDRows) );
1242 aSourceRange.aEnd.IncCol( static_cast<SCCOL>(-nDCols) );
1243 aSourceRange.aEnd.IncTab( static_cast<SCTAB>(-nDTabs) );
1244 AddDependentContents( rAction, rRoot, rChangeTrack );
1245}
1246
1248{
1249}
1250
1252{
1257 rStrm << sal_uInt32(0x00000000);
1258}
1259
1261{
1262 XclExpChTrEmpty( 0x014E ).Save( rStrm );
1263}
1264
1266{
1267 XclExpChTrEmpty( 0x014F ).Save( rStrm );
1268}
1269
1271{
1272 return 0x0140;
1273}
1274
1276{
1277 return 24;
1278}
1279
1281{
1282 sax_fastparser::FSHelperPtr pStream = rRevisionLogStrm.GetCurrentStream();
1283
1284 pStream->startElement( XML_rm,
1285 XML_rId, OString::number(GetActionNumber()),
1286 XML_ua, ToPsz( GetAccepted () ), // OOXTODO? bAccepted == ua or ra; not sure.
1287 XML_ra, nullptr, // OOXTODO: RRD.fUndoAction? Or RRD.fAccepted?
1288 XML_sheetId, OString::number(GetTabId(aDestRange.aStart.Tab())),
1289 XML_source, XclXmlUtils::ToOString(rRevisionLogStrm.GetRoot().GetDoc(), aSourceRange),
1290 XML_destination, XclXmlUtils::ToOString(rRevisionLogStrm.GetRoot().GetDoc(), aDestRange),
1291 XML_sourceSheetId, OString::number(GetTabId(aSourceRange.aStart.Tab())) );
1292 // OOXTODO: does this handle XML_rfmt, XML_undo?
1293 XclExpChTrAction* pAction = GetAddAction();
1294 while( pAction != nullptr )
1295 {
1296 pAction->SaveXml( rRevisionLogStrm );
1297 pAction = pAction->GetAddAction();
1298 }
1299 pStream->endElement( XML_rm );
1300}
1301
1303 XclExpChTrInsert( rAction )
1304{
1305 nLength = 0x00000026;
1307}
1308
1310{
1311}
1312
1314{
1316 rStrm << sal_uInt16(0x0003)
1317 << sal_uInt16(0x0001);
1319}
1320
1322{
1323 return 0x014A;
1324}
1325
1327{
1328 return 14;
1329}
1330
1332{
1333 sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
1334
1335 pStream->startElement( XML_rfmt,
1336 XML_sheetId, OString::number(GetTabId(aRange.aStart.Tab())),
1337 XML_xfDxf, nullptr, // OOXTODO: not supported
1338 XML_s, nullptr, // OOXTODO: style
1339 XML_sqref, XclXmlUtils::ToOString(rStrm.GetRoot().GetDoc(), aRange),
1340 XML_start, nullptr, // OOXTODO: for string changes
1341 XML_length, nullptr); // OOXTODO: for string changes
1342 // OOXTODO: XML_dxf, XML_extLst
1343
1344 pStream->endElement( XML_rfmt );
1345}
1346
1347std::size_t ExcXmlRecord::GetLen() const
1348{
1349 return 0;
1350}
1351
1352sal_uInt16 ExcXmlRecord::GetNum() const
1353{
1354 return 0;
1355}
1356
1358{
1359 // Do nothing; ignored for BIFF output.
1360}
1361
1362namespace {
1363
1364class EndXmlElement : public ExcXmlRecord
1365{
1366 sal_Int32 mnElement;
1367public:
1368 explicit EndXmlElement( sal_Int32 nElement ) : mnElement( nElement) {}
1369 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
1370};
1371
1372}
1373
1374void EndXmlElement::SaveXml( XclExpXmlStream& rStrm )
1375{
1376 sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream();
1377 pStream->write("</")->writeId(mnElement)->write(">");
1378}
1379
1381 XclExpRoot( rRoot ),
1382 pTabIdBuffer( nullptr )
1383{
1384 OSL_ENSURE( GetOldRoot().pTabId, "XclExpChangeTrack::XclExpChangeTrack - root data incomplete" );
1385 if( !GetOldRoot().pTabId )
1386 return;
1387
1388 ScChangeTrack* pTempChangeTrack = CreateTempChangeTrack();
1389 if (!pTempChangeTrack)
1390 return;
1391
1392 pTabIdBuffer = new XclExpChTrTabIdBuffer( GetTabInfo().GetXclTabCount() );
1393 maBuffers.push_back( std::unique_ptr<XclExpChTrTabIdBuffer>(pTabIdBuffer) );
1394
1395 // calculate final table order (tab id list)
1396 const ScChangeAction* pScAction;
1397 for( pScAction = pTempChangeTrack->GetLast(); pScAction; pScAction = pScAction->GetPrev() )
1398 {
1399 if( pScAction->GetType() == SC_CAT_INSERT_TABS )
1400 {
1401 SCTAB nScTab = static_cast< SCTAB >( pScAction->GetBigRange().aStart.Tab() );
1402 pTabIdBuffer->InitFill( GetTabInfo().GetXclTab( nScTab ) );
1403 }
1404 }
1407
1408 // get actions in reverse order
1409 pScAction = pTempChangeTrack->GetLast();
1410 while( pScAction )
1411 {
1412 PushActionRecord( *pScAction );
1413 const ScChangeAction* pPrevAction = pScAction->GetPrev();
1414 pScAction = pPrevAction;
1415 }
1416
1417 // build record list
1419 {
1420 XclExpChTrHeader* pHeader = new XclExpChTrHeader; // header record for last GUID
1421 maRecList.push_back( std::unique_ptr<ExcRecord>(pHeader) );
1422 maRecList.push_back( std::unique_ptr<ExcRecord>( new XclExpChTr0x0195 ) );
1423 maRecList.push_back( std::unique_ptr<ExcRecord>( new XclExpChTr0x0194( *pTempChangeTrack ) ) );
1424
1425 OUString sLastUsername;
1426 DateTime aLastDateTime( DateTime::EMPTY );
1427 sal_uInt32 nIndex = 1;
1428 sal_uInt8 aGUID[ 16 ]; // GUID for action info records
1429 bool bValidGUID = false;
1430 while( !aActionStack.empty() )
1431 {
1432 XclExpChTrAction* pAction = aActionStack.top();
1433 aActionStack.pop();
1434
1435 if( (nIndex == 1) || pAction->ForceInfoRecord() ||
1436 (pAction->GetUsername() != sLastUsername) ||
1437 (pAction->GetDateTime() != aLastDateTime) )
1438 {
1439 lcl_GenerateGUID( aGUID, bValidGUID );
1440 sLastUsername = pAction->GetUsername();
1441 aLastDateTime = pAction->GetDateTime();
1442
1443 maRecList.push_back( std::unique_ptr<ExcRecord>(new XclExpChTrInfo(sLastUsername, aLastDateTime, aGUID)) );
1444 maRecList.push_back( std::unique_ptr<ExcRecord>(new XclExpChTrTabId(pAction->GetTabIdBuffer())) );
1445 pHeader->SetGUID( aGUID );
1446 }
1447 pAction->SetIndex( nIndex );
1448 maRecList.push_back( std::unique_ptr<ExcRecord>(pAction) );
1449 }
1450
1451 pHeader->SetGUID( aGUID );
1452 pHeader->SetCount( nIndex - 1 );
1453 maRecList.push_back( std::unique_ptr<ExcRecord>(new ExcEof) );
1454 }
1455 else
1456 {
1458 maRecList.push_back( std::unique_ptr<ExcRecord>(pHeaders));
1459
1460 OUString sLastUsername;
1461 DateTime aLastDateTime(DateTime::EMPTY);
1462 sal_uInt32 nIndex = 1;
1463 sal_Int32 nLogNumber = 1;
1464 XclExpXmlChTrHeader* pCurHeader = nullptr;
1465 sal_uInt8 aGUID[ 16 ]; // GUID for action info records
1466 bool bValidGUID = false;
1467
1468 while (!aActionStack.empty())
1469 {
1470 XclExpChTrAction* pAction = aActionStack.top();
1471 aActionStack.pop();
1472
1473 if( (nIndex == 1) || pAction->ForceInfoRecord() ||
1474 (pAction->GetUsername() != sLastUsername) ||
1475 (pAction->GetDateTime() != aLastDateTime) )
1476 {
1477 lcl_GenerateGUID( aGUID, bValidGUID );
1478 sLastUsername = pAction->GetUsername();
1479 aLastDateTime = pAction->GetDateTime();
1480
1481 pCurHeader = new XclExpXmlChTrHeader(sLastUsername, aLastDateTime, aGUID, nLogNumber, pAction->GetTabIdBuffer());
1482 maRecList.push_back( std::unique_ptr<ExcRecord>(pCurHeader));
1483 nLogNumber++;
1484 pHeaders->SetGUID(aGUID);
1485 }
1486 pAction->SetIndex(nIndex);
1487 pCurHeader->AppendAction(std::unique_ptr<XclExpChTrAction>(pAction));
1488 }
1489
1490 pHeaders->SetGUID(aGUID);
1491 maRecList.push_back( std::unique_ptr<ExcRecord>(new EndXmlElement(XML_headers)));
1492 }
1493}
1494
1496{
1497 while( !aActionStack.empty() )
1498 {
1499 delete aActionStack.top();
1500 aActionStack.pop();
1501 }
1502}
1503
1505{
1506 // get original change track
1507 ScChangeTrack* pOrigChangeTrack = GetDoc().GetChangeTrack();
1508 OSL_ENSURE( pOrigChangeTrack, "XclExpChangeTrack::CreateTempChangeTrack - no change track data" );
1509 if( !pOrigChangeTrack )
1510 return nullptr;
1511
1512 assert(!xTempDoc);
1513 // create empty document
1514 xTempDoc.reset(new ScDocument);
1515
1516 // adjust table count
1517 SCTAB nOrigCount = GetDoc().GetTableCount();
1518 OUString sTabName;
1519 for( sal_Int32 nIndex = 0; nIndex < nOrigCount; nIndex++ )
1520 {
1521 xTempDoc->CreateValidTabName(sTabName);
1522 xTempDoc->InsertTab(SC_TAB_APPEND, sTabName);
1523 }
1524 OSL_ENSURE(nOrigCount == xTempDoc->GetTableCount(),
1525 "XclExpChangeTrack::CreateTempChangeTrack - table count mismatch");
1526 if(nOrigCount != xTempDoc->GetTableCount())
1527 return nullptr;
1528
1529 return pOrigChangeTrack->Clone(xTempDoc.get());
1530}
1531
1533{
1534 XclExpChTrAction* pXclAction = nullptr;
1535 ScChangeTrack* pTempChangeTrack = xTempDoc->GetChangeTrack();
1536 switch( rAction.GetType() )
1537 {
1538 case SC_CAT_CONTENT:
1539 pXclAction = new XclExpChTrCellContent( static_cast<const ScChangeActionContent&>(rAction), GetRoot(), *pTabIdBuffer );
1540 break;
1541 case SC_CAT_INSERT_ROWS:
1542 case SC_CAT_INSERT_COLS:
1543 case SC_CAT_DELETE_ROWS:
1544 case SC_CAT_DELETE_COLS:
1545 if (pTempChangeTrack)
1546 pXclAction = new XclExpChTrInsert( rAction, GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
1547 break;
1548 case SC_CAT_INSERT_TABS:
1549 {
1550 pXclAction = new XclExpChTrInsertTab( rAction, GetRoot(), *pTabIdBuffer );
1552 pNewBuffer->Remove();
1553 maBuffers.push_back( std::unique_ptr<XclExpChTrTabIdBuffer>(pNewBuffer) );
1554 pTabIdBuffer = pNewBuffer;
1555 }
1556 break;
1557 case SC_CAT_MOVE:
1558 if (pTempChangeTrack)
1559 pXclAction = new XclExpChTrMoveRange( static_cast<const ScChangeActionMove&>(rAction), GetRoot(), *pTabIdBuffer, *pTempChangeTrack );
1560 break;
1561 default:;
1562 }
1563 if( pXclAction )
1564 aActionStack.push( pXclAction );
1565}
1566
1568{
1569 bool bRet = false;
1571 OSL_ENSURE( xSvStrm.is(), "XclExpChangeTrack::WriteUserNamesStream - no stream" );
1572 if( xSvStrm.is() )
1573 {
1574 XclExpStream aXclStrm( *xSvStrm, GetRoot() );
1575 XclExpChTr0x0191().Save( aXclStrm );
1576 XclExpChTr0x0198().Save( aXclStrm );
1577 XclExpChTr0x0192().Save( aXclStrm );
1578 XclExpChTr0x0197().Save( aXclStrm );
1579 xSvStrm->Commit();
1580 bRet = true;
1581 }
1582 return bRet;
1583}
1584
1586{
1587 if (maRecList.empty())
1588 return;
1589
1590 if( !WriteUserNamesStream() )
1591 return;
1592
1594 OSL_ENSURE( xSvStrm.is(), "XclExpChangeTrack::Write - no stream" );
1595 if( xSvStrm.is() )
1596 {
1597 XclExpStream aXclStrm( *xSvStrm, GetRoot(), EXC_MAXRECSIZE_BIFF8 + 8 );
1598
1599 for(const auto& rxRec : maRecList)
1600 rxRec->Save(aXclStrm);
1601
1602 xSvStrm->Commit();
1603 }
1604}
1605
1606static void lcl_WriteUserNamesXml( XclExpXmlStream& rWorkbookStrm )
1607{
1608 sax_fastparser::FSHelperPtr pUserNames = rWorkbookStrm.CreateOutputStream(
1609 "xl/revisions/userNames.xml",
1610 u"revisions/userNames.xml",
1611 rWorkbookStrm.GetCurrentStream()->getOutputStream(),
1612 "application/vnd.openxmlformats-officedocument.spreadsheetml.userNames+xml",
1613 CREATE_OFFICEDOC_RELATION_TYPE("usernames"));
1614 pUserNames->startElement( XML_users,
1615 XML_xmlns, rWorkbookStrm.getNamespaceURL(OOX_NS(xls)).toUtf8(),
1616 FSNS( XML_xmlns, XML_r ), rWorkbookStrm.getNamespaceURL(OOX_NS(officeRel)).toUtf8(),
1617 XML_count, "0" );
1618 // OOXTODO: XML_userinfo elements for each user editing the file
1619 // Doesn't seem to be supported by .xls output either (based on
1620 // contents of XclExpChangeTrack::WriteUserNamesStream()).
1621 pUserNames->endElement( XML_users );
1622}
1623
1625{
1626 if (maRecList.empty())
1627 return;
1628
1629 lcl_WriteUserNamesXml( rWorkbookStrm );
1630
1631 sax_fastparser::FSHelperPtr pRevisionHeaders = rWorkbookStrm.CreateOutputStream(
1632 "xl/revisions/revisionHeaders.xml",
1633 u"revisions/revisionHeaders.xml",
1634 rWorkbookStrm.GetCurrentStream()->getOutputStream(),
1635 "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionHeaders+xml",
1636 CREATE_OFFICEDOC_RELATION_TYPE("revisionHeaders"));
1637 // OOXTODO: XML_userinfo elements for each user editing the file
1638 // Doesn't seem to be supported by .xls output either (based on
1639 // contents of XclExpChangeTrack::WriteUserNamesStream()).
1640 rWorkbookStrm.PushStream( pRevisionHeaders );
1641
1642 for (const auto& rxRec : maRecList)
1643 rxRec->SaveXml(rWorkbookStrm);
1644
1645 rWorkbookStrm.PopStream();
1646}
1647
1648/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
static void lcl_WriteCell(XclExpXmlStream &rStrm, sal_Int32 nElement, const ScAddress &rPosition, XclExpChTrData *pData)
static void lcl_WriteFixedString(XclExpStream &rStrm, const XclExpString &rString, std::size_t nLength)
static void lcl_WriteUserNamesXml(XclExpXmlStream &rWorkbookStrm)
static void lcl_WriteDateTime(XclExpStream &rStrm, const DateTime &rDateTime)
static OString lcl_DateTimeToOString(const DateTime &rDateTime)
static const char * lcl_GetAction(sal_uInt16 nOpCode)
static void lcl_WriteGUID(XclExpStream &rStrm, const sal_uInt8 *pGUID)
static const char * lcl_GetType(XclExpChTrData *pData)
static void lcl_GenerateGUID(sal_uInt8 *pGUID, bool &rValidGUID)
const SCTAB SC_TAB_APPEND
Definition: address.hxx:90
std::map< sal_uLong, ScChangeAction * > ScChangeActionMap
Definition: chgtrack.hxx:800
@ SC_CAT_MOVE
Definition: chgtrack.hxx:71
@ SC_CAT_INSERT_TABS
Definition: chgtrack.hxx:67
@ SC_CAT_DELETE_ROWS
Definition: chgtrack.hxx:69
@ SC_CAT_CONTENT
Definition: chgtrack.hxx:72
@ SC_CAT_DELETE_COLS
Definition: chgtrack.hxx:68
@ SC_CAT_INSERT_ROWS
Definition: chgtrack.hxx:66
@ SC_CAT_INSERT_COLS
Definition: chgtrack.hxx:65
sal_Int16 GetYear() const
sal_uInt16 GetDay() const
sal_uInt16 GetMonth() const
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:106
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:91
virtual sal_uInt16 GetNum() const override
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
virtual std::size_t GetLen() const override
void IncTab(SCTAB nDelta=1)
Definition: address.hxx:320
SCTAB Tab() const
Definition: address.hxx:283
void SetCol(SCCOL nColP)
Definition: address.hxx:291
void IncCol(SCCOL nDelta=1)
Definition: address.hxx:316
SCROW Row() const
Definition: address.hxx:274
void SetRow(SCROW nRowP)
Definition: address.hxx:287
void IncRow(SCROW nDelta=1)
Definition: address.hxx:312
SCCOL Col() const
Definition: address.hxx:279
sal_Int64 Tab() const
Definition: bigrange.hxx:46
ScBigAddress aStart
Definition: bigrange.hxx:108
const ScCellValue & GetNewCell() const
Definition: chgtrack.hxx:742
const ScCellValue & GetOldCell() const
Definition: chgtrack.hxx:741
SC_DLLPUBLIC bool IsEndOfList() const
Definition: chgtrack.cxx:697
SC_DLLPUBLIC void GetDelta(sal_Int32 &nDx, sal_Int32 &nDy, sal_Int32 &nDz) const
Definition: chgtrack.cxx:1130
ScBigRange & GetBigRange()
Definition: chgtrack.hxx:231
ScChangeActionType GetType() const
Definition: chgtrack.hxx:317
ScChangeAction * GetPrev() const
Definition: chgtrack.hxx:323
const std::set< OUString > & GetUserCollection() const
Definition: chgtrack.hxx:973
ScChangeAction * GetLast() const
Definition: chgtrack.hxx:954
SC_DLLPUBLIC ScChangeTrack * Clone(ScDocument *pDocument) const
Definition: chgtrack.cxx:4351
SC_DLLPUBLIC void GetDependents(ScChangeAction *, ScChangeActionMap &, bool bListMasterDelete=false, bool bAllFlat=false) const
Definition: chgtrack.cxx:3792
ScChangeTrack * GetChangeTrack() const
Definition: document.hxx:2487
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:316
static SC_DLLPUBLIC OUString GetString(const EditTextObject &rEditText, const ScDocument *pDoc)
Retrieves string with paragraphs delimited by new lines (' ').
Definition: editutil.cxx:119
ScTokenArray * GetCode()
ScAddress aPos
ScAddress aEnd
Definition: address.hxx:498
ScAddress aStart
Definition: address.hxx:497
virtual ~XclExpChTr0x014A() override
virtual void SaveActionData(XclExpStream &rStrm) const override
virtual std::size_t GetActionByteCount() const override
XclExpChTr0x014A(const XclExpChTrInsert &rAction)
virtual void SaveXml(XclExpXmlStream &rStrm) override
virtual sal_uInt16 GetNum() const override
virtual sal_uInt16 GetNum() const override
virtual void SaveCont(XclExpStream &rStrm) override
virtual std::size_t GetLen() const override
virtual sal_uInt16 GetNum() const override
virtual void SaveCont(XclExpStream &rStrm) override
virtual std::size_t GetLen() const override
virtual std::size_t GetLen() const override
virtual ~XclExpChTr0x0194() override
virtual sal_uInt16 GetNum() const override
virtual void SaveCont(XclExpStream &rStrm) override
virtual std::size_t GetLen() const override
virtual void SaveCont(XclExpStream &rStrm) override
virtual ~XclExpChTr0x0195() override
virtual sal_uInt16 GetNum() const override
virtual void SaveCont(XclExpStream &rStrm) override
virtual sal_uInt16 GetNum() const override
virtual std::size_t GetLen() const override
virtual void SaveCont(XclExpStream &rStrm) override
virtual std::size_t GetLen() const override
virtual sal_uInt16 GetNum() const override
virtual void PrepareSaveAction(XclExpStream &rStrm) const
bool GetAccepted() const
bool ForceInfoRecord() const
virtual ~XclExpChTrAction() override
const OUString & GetUsername() const
void SetIndex(sal_uInt32 &rIndex)
const XclExpChTrTabIdBuffer & GetTabIdBuffer() const
std::unique_ptr< XclExpChTrAction > pAddAction
void WriteTabId(XclExpStream &rStrm, SCTAB nTabId) const
sal_uInt16 GetTabId(SCTAB nTabId) const
virtual void SaveActionData(XclExpStream &rStrm) const =0
virtual std::size_t GetActionByteCount() const =0
void AddDependentContents(const ScChangeAction &rAction, const XclExpRoot &rRoot, const ScChangeTrack &rChangeTrack)
virtual std::size_t GetLen() const override
static std::size_t GetHeaderByteCount()
void SetAddAction(XclExpChTrAction *pAction)
XclExpChTrAction(const XclExpChTrAction &rCopy)
virtual void CompleteSaveAction(XclExpStream &rStrm) const
const XclExpChTrTabIdBuffer & rIdBuffer
virtual void SaveCont(XclExpStream &rStrm) override
static void Write2DRange(XclExpStream &rStrm, const ScRange &rRange)
sal_uInt32 GetActionNumber() const
const DateTime & GetDateTime() const
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
static void Write2DAddress(XclExpStream &rStrm, const ScAddress &rAddress)
XclExpChTrAction * GetAddAction()
void GetCellData(const XclExpRoot &rRoot, const ScCellValue &rScCell, std::unique_ptr< XclExpChTrData > &rpData, sal_uInt32 &rXclLength1, sal_uInt16 &rXclLength2)
std::unique_ptr< XclExpChTrData > pOldData
virtual ~XclExpChTrCellContent() override
virtual std::size_t GetActionByteCount() const override
virtual sal_uInt16 GetNum() const override
virtual void SaveActionData(XclExpStream &rStrm) const override
static void MakeEmptyChTrData(std::unique_ptr< XclExpChTrData > &rpData)
std::unique_ptr< XclExpChTrData > pNewData
XclExpChTrCellContent(const ScChangeActionContent &rAction, const XclExpRoot &rRoot, const XclExpChTrTabIdBuffer &rTabIdBuffer)
virtual void SaveXml(XclExpXmlStream &rStrm) override
virtual sal_uInt16 GetNum() const override
virtual std::size_t GetLen() const override
virtual ~XclExpChTrEmpty() override
virtual sal_uInt16 GetNum() const override
void SetCount(sal_uInt32 nNew)
virtual std::size_t GetLen() const override
virtual void SaveXml(XclExpXmlStream &rStrm) override
virtual void SaveCont(XclExpStream &rStrm) override
virtual ~XclExpChTrHeader() override
void SetGUID(const sal_uInt8 *pGUID)
virtual std::size_t GetLen() const override
virtual sal_uInt16 GetNum() const override
XclExpChTrInfo(const OUString &rUsername, const DateTime &rDateTime, const sal_uInt8 *pGUID)
virtual ~XclExpChTrInfo() override
virtual void SaveCont(XclExpStream &rStrm) override
sal_uInt8 aGUID[16]
XclExpString sUsername
virtual void SaveActionData(XclExpStream &rStrm) const override
virtual ~XclExpChTrInsertTab() override
virtual sal_uInt16 GetNum() const override
virtual std::size_t GetActionByteCount() const override
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpChTrInsertTab(const ScChangeAction &rAction, const XclExpRoot &rRoot, const XclExpChTrTabIdBuffer &rTabIdBuffer)
virtual void SaveActionData(XclExpStream &rStrm) const override
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpChTrInsert(const XclExpChTrInsert &rCopy)
virtual ~XclExpChTrInsert() override
virtual sal_uInt16 GetNum() const override
virtual void CompleteSaveAction(XclExpStream &rStrm) const override
virtual void PrepareSaveAction(XclExpStream &rStrm) const override
virtual std::size_t GetActionByteCount() const override
virtual std::size_t GetActionByteCount() const override
virtual sal_uInt16 GetNum() const override
virtual void PrepareSaveAction(XclExpStream &rStrm) const override
XclExpChTrMoveRange(const ScChangeActionMove &rAction, const XclExpRoot &rRoot, const XclExpChTrTabIdBuffer &rTabIdBuffer, const ScChangeTrack &rChangeTrack)
virtual void CompleteSaveAction(XclExpStream &rStrm) const override
virtual void SaveActionData(XclExpStream &rStrm) const override
virtual void SaveXml(XclExpXmlStream &rStrm) override
virtual ~XclExpChTrMoveRange() override
XclExpChTrTabIdBuffer(sal_uInt16 nCount)
sal_uInt16 GetBufferCount() const
void InitFill(sal_uInt16 nIndex)
void GetBufferCopy(sal_uInt16 *pDest) const
sal_uInt16 GetId(sal_uInt16 nIndex) const
std::unique_ptr< sal_uInt16[]> pBuffer
virtual void SaveCont(XclExpStream &rStrm) override
virtual ~XclExpChTrTabId() override
virtual sal_uInt16 GetNum() const override
virtual std::size_t GetLen() const override
void Copy(const XclExpChTrTabIdBuffer &rBuffer)
std::unique_ptr< sal_uInt16[]> pBuffer
XclExpChTrTabId(sal_uInt16 nCount)
void PushActionRecord(const ScChangeAction &rAction)
XclExpChTrTabIdBuffer * pTabIdBuffer
virtual ~XclExpChangeTrack() override
std::stack< XclExpChTrAction * > aActionStack
void WriteXml(XclExpXmlStream &rStrm)
XclExpChangeTrack(const XclExpRoot &rRoot)
ScDocumentUniquePtr xTempDoc
std::vector< std::unique_ptr< XclExpChTrTabIdBuffer > > maBuffers
ScChangeTrack * CreateTempChangeTrack()
XclTokenArrayRef CreateFormula(XclFormulaType eType, const ScTokenArray &rScTokArr, const ScAddress *pScBasePos=nullptr, XclExpRefLog *pRefLog=nullptr)
Creates and returns the token array of a formula.
Definition: xeformula.cxx:2644
Helper to create HLINK records during creation of formatted cell strings.
Definition: xehelper.hxx:178
Access to global data from other classes.
Definition: xeroot.hxx:113
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
Definition: xeroot.cxx:88
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
Definition: xeroot.cxx:76
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:118
This class is used to export Excel record streams.
Definition: xestream.hxx:73
static XclExpStringRef CreateCellString(const XclExpRoot &rRoot, const OUString &rString, const ScPatternAttr *pCellAttr, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Creates a new formatted string from a Calc string cell.
Definition: xehelper.cxx:566
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:48
std::size_t GetSize() const
Returns the byte count the whole string will take on export.
Definition: xestring.cxx:248
std::size_t GetBufferSize() const
Returns the byte count the character buffer will take on export.
Definition: xestring.cxx:243
sal_uInt16 Len() const
Returns the character count of the string.
Definition: xestring.hxx:118
sal_uInt16 GetXclTab(SCTAB nScTab) const
Returns the Excel sheet index for a given Calc sheet.
Definition: xelink.cxx:814
virtual ~XclExpUserBViewList() override
XclExpUserBViewList(const ScChangeTrack &rChangeTrack)
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
std::vector< XclExpUserBView > aViews
XclExpString sUsername
sal_uInt8 aGUID[16]
XclExpUserBView(const OUString &rUsername, const sal_uInt8 *pGUID)
virtual std::size_t GetLen() const override
virtual sal_uInt16 GetNum() const override
virtual void SaveCont(XclExpStream &rStrm) override
XclExpUsersViewBegin(const sal_uInt8 *pGUID, sal_uInt32 nTab)
virtual void SaveCont(XclExpStream &rStrm) override
virtual sal_uInt16 GetNum() const override
virtual std::size_t GetLen() const override
virtual void SaveCont(XclExpStream &rStrm) override
virtual sal_uInt16 GetNum() const override
virtual std::size_t GetLen() const override
std::vector< std::unique_ptr< XclExpChTrAction > > maActions
void AppendAction(std::unique_ptr< XclExpChTrAction > pAction)
std::vector< sal_uInt16 > maTabBuffer
virtual void SaveXml(XclExpXmlStream &rStrm) override
XclExpXmlChTrHeader(OUString aUserName, const DateTime &rDateTime, const sal_uInt8 *pGUID, sal_Int32 nLogNumber, const XclExpChTrTabIdBuffer &rBuf)
void SetGUID(const sal_uInt8 *pGUID)
virtual void SaveXml(XclExpXmlStream &rStrm) override
void WriteAttributes(sal_Int32 nAttribute, Str &&value, Args &&... rest)
Definition: xestream.hxx:300
sax_fastparser::FSHelperPtr & GetCurrentStream()
Definition: xestream.cxx:912
sax_fastparser::FSHelperPtr CreateOutputStream(const OUString &sFullStream, std::u16string_view sRelativeStream, const css::uno::Reference< css::io::XOutputStream > &xParentRelation, const char *sContentType, std::u16string_view sRelationshipType, OUString *pRelationshipId=nullptr)
Definition: xestream.cxx:941
void PopStream()
Definition: xestream.cxx:923
void PushStream(sax_fastparser::FSHelperPtr const &aStream)
Definition: xestream.cxx:918
const XclExpRoot & GetRoot() const
Returns the filter root data.
Definition: xestream.hxx:291
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
Definition: xlroot.hxx:143
tools::SvRef< SotStorageStream > OpenStream(tools::SvRef< SotStorage > const &xStrg, const OUString &rStrmName) const
Tries to open a new stream in the specified storage for reading or writing.
Definition: xlroot.cxx:274
RootData & GetOldRoot() const
Returns old RootData struct.
Definition: xlroot.hxx:138
const ScAddress & GetXclMaxPos() const
Returns the highest possible cell address in an Excel document (using current BIFF version).
Definition: xlroot.hxx:246
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:286
static bool GetRKFromDouble(sal_Int32 &rnRKValue, double fValue)
Calculates an RK value (encoded integer or double) from a double value.
Definition: xltools.cxx:124
static OString ToOString(const Color &rColor)
Definition: xestream.cxx:709
static void GetFormulaTypeAndValue(ScFormulaCell &rCell, const char *&sType, OUString &rValue)
Definition: xestream.cxx:665
static OUString ToOUString(const char *s)
Definition: xestream.cxx:785
static OUString GetStreamName(const char *sStreamDir, const char *sStream, sal_Int32 nId)
Definition: xestream.cxx:694
OUString getNamespaceURL(sal_Int32 nNSID) const
const OUString & getString() const
OString getString() const
bool is() const
sal_uInt16 GetSec() const
sal_uInt16 GetMin() const
void SetNanoSec(sal_uInt32 nNewNanoSec)
sal_uInt16 GetHour() const
sal_uInt32 GetNanoSec() const
void SetSec(sal_uInt16 nNewSec)
int nCount
float u
#define EXC_CHTR_TYPE_STRING
Definition: excdefs.hxx:84
constexpr OUStringLiteral EXC_STREAM_REVLOG
Definition: excdefs.hxx:63
constexpr OUStringLiteral EXC_STREAM_USERNAMES
Definition: excdefs.hxx:62
#define EXC_CHTR_TYPE_DOUBLE
Definition: excdefs.hxx:83
#define EXC_CHTR_OP_DELCOL
Definition: excdefs.hxx:71
#define EXC_CHTR_ACCEPT
Definition: excdefs.hxx:90
#define EXC_CHTR_TYPE_RK
Definition: excdefs.hxx:82
#define EXC_CHTR_OP_FORMAT
Definition: excdefs.hxx:75
#define EXC_CHTR_OP_DELFLAG
Definition: excdefs.hxx:67
#define EXC_CHTR_OP_DELROW
Definition: excdefs.hxx:70
#define EXC_CHTR_OP_INSCOL
Definition: excdefs.hxx:69
#define EXC_CHTR_TYPE_FORMULA
Definition: excdefs.hxx:86
#define EXC_CHTR_OP_CELL
Definition: excdefs.hxx:74
#define EXC_CHTR_OP_COLFLAG
Definition: excdefs.hxx:66
#define EXC_CHTR_OP_INSROW
Definition: excdefs.hxx:68
#define EXC_CHTR_TYPE_EMPTY
Definition: excdefs.hxx:81
#define EXC_CHTR_OP_INSTAB
Definition: excdefs.hxx:73
#define EXC_CHTR_NOTHING
Definition: excdefs.hxx:89
#define EXC_CHTR_OP_UNKNOWN
Definition: excdefs.hxx:76
#define EXC_CHTR_OP_MOVE
Definition: excdefs.hxx:72
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
@ CELLTYPE_EDIT
Definition: global.hxx:276
@ CELLTYPE_STRING
Definition: global.hxx:274
@ CELLTYPE_FORMULA
Definition: global.hxx:275
@ CELLTYPE_VALUE
Definition: global.hxx:273
sal_Int32 nIndex
sal_Int64 n
std::unique_ptr< sal_Int32[]> pData
int i
void SvStream & rStrm
std::shared_ptr< FastSerializerHelper > FSHelperPtr
DateTime GetDateTime(const css::util::DateTime &_rDT)
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
#define CREATE_OFFICEDOC_RELATION_TYPE(ascii)
OUString maUserName
DateTime maDateTime
XclExpChTrTabId * pTabId
Definition: root.hxx:56
Store arbitrary cell value of any kind.
Definition: cellvalue.hxx:32
bool isEmpty() const
Definition: cellvalue.cxx:519
const svl::SharedString * getSharedString() const
Definition: cellvalue.hxx:60
CellType getType() const
Definition: cellvalue.cxx:296
ScFormulaCell * getFormula() const
Definition: cellvalue.hxx:59
EditTextObject * getEditText() const
Definition: cellvalue.hxx:61
double getDouble() const
Definition: cellvalue.hxx:58
XclTokenArrayRef mxTokArr
void Write(XclExpStream &rStrm, const XclExpChTrTabIdBuffer &rTabIdBuffer)
std::unique_ptr< XclExpString > pString
void WriteFormula(XclExpStream &rStrm, const XclExpChTrTabIdBuffer &rTabIdBuffer)
XclExpRefLog maRefLog
const ScFormulaCell * mpFormulaCell
Log entry for external references in a formula, used i.e.
Definition: xeformula.hxx:32
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
::std::vector< XclExpRefLogEntry > XclExpRefLog
Vector containing a log for all external references in a formula, used i.e.
Definition: xeformula.hxx:43
@ EXC_OUTPUT_BINARY
Definition: xlconst.hxx:42
@ EXC_FMLATYPE_CELL
Definition: xlformula.hxx:161
const sal_uInt16 EXC_MAXRECSIZE_BIFF8
Definition: xlstream.hxx:30
sal_Int32 nLength