summaryrefslogtreecommitdiff
path: root/inc/bf_sc/chgtrack.hxx
blob: 4b413871791622abfffded0b657f47d5dd30519f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 *
 * This file incorporates work covered by the following license notice:
 *
 *   Licensed to the Apache Software Foundation (ASF) under one or more
 *   contributor license agreements. See the NOTICE file distributed
 *   with this work for additional information regarding copyright
 *   ownership. The ASF licenses this file to you under the Apache
 *   License, Version 2.0 (the "License"); you may not use this file
 *   except in compliance with the License. You may obtain a copy of
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */

#ifndef SC_CHGTRACK_HXX
#define SC_CHGTRACK_HXX

#include <deque>

#include <bf_svtools/bf_solar.h>


#include <tools/datetime.hxx>
#include <bf_tools/table.hxx>
#include <tools/mempool.hxx>
#include <bf_tools/stack.hxx>
#include <bf_svtools/lstner.hxx>

#include "bigrange.hxx"
#include "collect.hxx"

#ifdef SC_CHGTRACK_CXX
// core/inc
#endif
/*N*/#include <tools/debug.hxx>
/*N*/
class SvStream;
/*N*/class Stack;
/*N*/
namespace binfilter {

class ScBaseCell;
class ScDocument;


enum ScChangeActionType
{
    SC_CAT_NONE,
    SC_CAT_INSERT_COLS,
    SC_CAT_INSERT_ROWS,
    SC_CAT_INSERT_TABS,
    SC_CAT_DELETE_COLS,
    SC_CAT_DELETE_ROWS,
    SC_CAT_DELETE_TABS,
    SC_CAT_MOVE,
    SC_CAT_CONTENT,
    SC_CAT_REJECT
};


enum ScChangeActionState
{
    SC_CAS_VIRGIN,
    SC_CAS_ACCEPTED,
    SC_CAS_REJECTED
};


enum ScChangeActionClipMode
{
    SC_CACM_NONE,
    SC_CACM_CUT,
    SC_CACM_COPY,
    SC_CACM_PASTE
};

class ScMultipleReadHeader;

// --- ScChangeActionLinkEntry ---------------------------------------------

// Fuegt sich selbst am Beginn einer Kette ein, bzw. vor einem anderen
// LinkEntry, on delete selbstaendiges ausklinken auch des gelinkten.
// ppPrev == &previous->pNext oder Adresse des Pointers auf Beginn der Kette,
// *ppPrev == this

class ScChangeAction;

class ScChangeActionLinkEntry
{
                                // not implemented, prevent usage
                                ScChangeActionLinkEntry(
                                    const ScChangeActionLinkEntry& );
/*N*/   ScChangeActionLinkEntry&    operator=( const ScChangeActionLinkEntry& );

protected:

    ScChangeActionLinkEntry*    pNext;
    ScChangeActionLinkEntry**   ppPrev;
    ScChangeAction*             pAction;
    ScChangeActionLinkEntry*    pLink;

public:

    DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionLinkEntry )

                                ScChangeActionLinkEntry(
                                        ScChangeActionLinkEntry** ppPrevP,
                                        ScChangeAction* pActionP )
                                    : pNext( *ppPrevP )
                                    , ppPrev( ppPrevP )
                                    , pAction( pActionP )
                                    , pLink( NULL )
                                    {
                                        if ( pNext )
                                            pNext->ppPrev = &pNext;
                                        *ppPrevP = this;
                                    }

    virtual                     ~ScChangeActionLinkEntry()
                                    {
                                        ScChangeActionLinkEntry* p = pLink;
                                        UnLink();
                                        Remove();
                                        if ( p )
                                            delete p;
                                    }

            void                SetLink( ScChangeActionLinkEntry* pLinkP )
                                    {
                                        UnLink();
                                        if ( pLinkP )
                                        {
                                            pLink = pLinkP;
                                            pLinkP->pLink = this;
                                        }
                                    }

            void                UnLink()
                                    {
                                        if ( pLink )
                                        {
                                            pLink->pLink = NULL;
                                            pLink = NULL;
                                        }
                                    }

            void                Remove()
                                    {
                                        if ( ppPrev )
                                        {
                                            if (( *ppPrev = pNext ))
                                                pNext->ppPrev = ppPrev;
                                            ppPrev = NULL;  // not inserted
                                        }
                                    }

            void                Insert( ScChangeActionLinkEntry** ppPrevP )
                                    {
                                        if ( !ppPrev )
                                        {
                                            ppPrev = ppPrevP;
                                            if (( pNext = *ppPrevP ))
                                                pNext->ppPrev = &pNext;
                                            *ppPrevP = this;
                                        }
                                    }

    const ScChangeActionLinkEntry*  GetLink() const     { return pLink; }
    ScChangeActionLinkEntry*        GetLink()           { return pLink; }
    const ScChangeActionLinkEntry*  GetNext() const     { return pNext; }
    ScChangeActionLinkEntry*        GetNext()           { return pNext; }
    const ScChangeAction*           GetAction() const   { return pAction; }
    ScChangeAction*                 GetAction()         { return pAction; }
};

// --- ScChangeActionCellListEntry -----------------------------------------
// this is only for the XML Export in the hxx
class ScChangeActionContent;

class ScChangeActionCellListEntry
{
    friend class ScChangeAction;
    friend class ScChangeActionDel;
    friend class ScChangeActionMove;
    friend class ScChangeTrack;

            ScChangeActionCellListEntry*    pNext;
            ScChangeActionContent*          pContent;

                                ScChangeActionCellListEntry(
                                    ScChangeActionContent* pContentP,
                                    ScChangeActionCellListEntry* pNextP )
                                    : pNext( pNextP )
                                    , pContent( pContentP )
                                    {}

public:
    const ScChangeActionCellListEntry* GetNext() const { return pNext; } // this is only for the XML Export public
    const ScChangeActionContent* GetContent() const { return pContent; } // this is only for the XML Export public

    DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionCellListEntry )
};

// --- ScChangeAction -------------------------------------------------------

class ScChangeTrack;
class ScChangeActionIns;
class ScChangeActionDel;
class ScChangeActionContent;

class ScChangeAction
{
    friend class ScChangeTrack;
    friend class ScChangeActionIns;
    friend class ScChangeActionDel;
    friend class ScChangeActionMove;
    friend class ScChangeActionContent;
/*N*/
/*N*/                               // not implemented, prevent usage
/*N*/                               ScChangeAction( const ScChangeAction& );
            ScChangeAction&     operator=( const ScChangeAction& );
/*N*/
protected:

             ScBigRange         aBigRange;          // Ins/Del/MoveTo/ContentPos
             DateTime           aDateTime;          //! UTC
             String             aUser;              // wer war's
             String             aComment;           // Benutzerkommentar
             ScChangeAction*        pNext;              // naechster in Kette
             ScChangeAction*        pPrev;              // vorheriger in Kette
             ScChangeActionLinkEntry*   pLinkAny;   // irgendwelche Links
             ScChangeActionLinkEntry*   pLinkDeletedIn; // Zuordnung zu
                                                     // geloeschten oder
                                                     // druebergemoveten oder
                                                     // rejecteten Insert
                                                     // Bereichen
             ScChangeActionLinkEntry*   pLinkDeleted;   // Links zu geloeschten
             ScChangeActionLinkEntry*   pLinkDependent; // Links zu abhaengigen
             ULONG              nAction;
             ULONG              nRejectAction;
             ScChangeActionType eType;
             ScChangeActionState    eState;


                            ScChangeAction( ScChangeActionType,
                                                const ScRange& );

                                 // only to be used in the XML import
                                ScChangeAction( ScChangeActionType,
                                                const ScBigRange&,
                                                const ULONG nAction,
                                                const ULONG nRejectAction,
                                                const ScChangeActionState eState,
                                                const DateTime& aDateTime,
                                                const String& aUser,
                                                const String& aComment );
/*N*/                               // only to be used in the XML import
                                ScChangeAction( ScChangeActionType,
                                                const ScBigRange&,
                                                const ULONG nAction);

                                ScChangeAction( SvStream&,
                                    ScMultipleReadHeader&, ScChangeTrack* );
    virtual                     ~ScChangeAction();
/*N*/
/*N*/   static ScBaseCell*          LoadCell( SvStream&, ScMultipleReadHeader&,
/*N*/                                   ScDocument*, USHORT nVer );
/*N*/
/*N*/   static  BOOL                StoreLinkChain( ScChangeActionLinkEntry*,
/*N*/                                   SvStream& );
/*N*/   static  BOOL                LoadLinkChain( ScChangeAction*,
/*N*/                                   ScChangeActionLinkEntry**,
/*N*/                                   SvStream&, ScChangeTrack*,
/*N*/                                   BOOL bLinkDeleted );
/*N*/
/*N*/   static  BOOL                StoreCellList( ScChangeActionCellListEntry*,
/*N*/                                   SvStream& );
/*N*/   static  BOOL                LoadCellList( ScChangeAction* pOfAction,
/*N*/                                   ScChangeActionCellListEntry*&, SvStream&,
/*N*/                                   ScChangeTrack* );
/*N*/
/*N*/           String              GetRefString( const ScBigRange&,
/*N*/                                   ScDocument*, BOOL bFlag3D = FALSE ) const;
/*N*/
/*N*/           void                SetActionNumber( ULONG n ) { nAction = n; }
/*N*/           void                SetRejectAction( ULONG n ) { nRejectAction = n; }
/*N*/           void                SetUser( const String& r ) { aUser = r; }
/*N*/           void                SetType( ScChangeActionType e ) { eType = e; }
/*N*/           void                SetState( ScChangeActionState e ) { eState = e; }
/*N*/           void                SetRejected();
/*N*/
            ScBigRange&         GetBigRange() { return aBigRange; }
/*N*/
/*N*/           ScChangeActionLinkEntry*    AddLink( ScChangeAction* p,
/*N*/                                           ScChangeActionLinkEntry* pL )
/*N*/                                   {
/*N*/                                       ScChangeActionLinkEntry* pLnk =
/*N*/                                           new ScChangeActionLinkEntry(
/*N*/                                           &pLinkAny, p );
/*N*/                                       pLnk->SetLink( pL );
/*N*/                                       return pLnk;
/*N*/                                   }
/*N*/           void                RemoveAllAnyLinks();
/*N*/
     virtual    ScChangeActionLinkEntry*    GetDeletedIn() const
                                             { return pLinkDeletedIn; }
/*N*/   virtual ScChangeActionLinkEntry**   GetDeletedInAddress()
/*N*/                                           { return &pLinkDeletedIn; }
/*N*/           ScChangeActionLinkEntry*    AddDeletedIn( ScChangeAction* p )
/*N*/                                   {
/*N*/                                       return new ScChangeActionLinkEntry(
/*N*/                                           GetDeletedInAddress(), p );
/*N*/                                   }
/*N*/           BOOL                RemoveDeletedIn( const ScChangeAction* );
/*N*/           void                RemoveAllDeletedIn();
/*N*/           void                SetDeletedIn( ScChangeAction* );
/*N*/
/*N*/           ScChangeActionLinkEntry*    AddDeleted( ScChangeAction* p )
/*N*/                                   {
/*N*/                                       return new ScChangeActionLinkEntry(
/*N*/                                           &pLinkDeleted, p );
/*N*/                                   }
/*N*/           void                RemoveAllDeleted();
/*N*/
            ScChangeActionLinkEntry*    AddDependent( ScChangeAction* p )
                                    {
                                        return new ScChangeActionLinkEntry(
                                            &pLinkDependent, p );
                                    }
/*N*/           void                RemoveAllDependent();
/*N*/
            void                RemoveAllLinks();
/*N*/
/*N*/   virtual void                AddContent( ScChangeActionContent* ) = 0;
/*N*/   virtual void                DeleteCellEntries() = 0;
/*N*/
/*N*/   virtual void                UpdateReference( const ScChangeTrack*,
/*N*/                                   UpdateRefMode, const ScBigRange&,
/*N*/                                   INT32 nDx, INT32 nDy, INT32 nDz );
/*N*/
/*N*/           void                Accept();
/*N*/   virtual BOOL                Reject( ScDocument* ) = 0;
/*N*/           void                RejectRestoreContents( ScChangeTrack*,
/*N*/                                   short nDx, short nDy );
/*N*/
/*N*/                               // used in Reject() instead of IsRejectable()
/*N*/           BOOL                IsInternalRejectable() const;
/*N*/
/*N*/   virtual BOOL                StoreLinks( SvStream& ) const;
/*N*/   virtual BOOL                LoadLinks( SvStream&, ScChangeTrack* );
/*N*/
public:
/*N*/
             BOOL               IsInsertType() const
                                     {
                                         return eType == SC_CAT_INSERT_COLS ||
                                             eType == SC_CAT_INSERT_ROWS ||
                                             eType == SC_CAT_INSERT_TABS;
                                     }
             BOOL               IsDeleteType() const
                                     {
                                         return eType == SC_CAT_DELETE_COLS ||
                                             eType == SC_CAT_DELETE_ROWS ||
                                             eType == SC_CAT_DELETE_TABS;
                                     }
/*N*/           BOOL                IsVirgin() const
/*N*/                                   { return eState == SC_CAS_VIRGIN; }
             BOOL               IsAccepted() const
                                     { return eState == SC_CAS_ACCEPTED; }
             BOOL               IsRejected() const
                                     { return eState == SC_CAS_REJECTED; }
/*N*/
/*N*/                               // Action rejects another Action
             BOOL               IsRejecting() const
                                     { return nRejectAction != 0; }
/*N*/
/*N*/                               // ob Action anfassbar ist
/*N*/           BOOL                IsTouchable() const;
/*N*/

            const ScBigRange&   GetBigRange() const { return aBigRange; }
             const DateTime&        GetDateTimeUTC() const      // UTC time
                                     { return aDateTime; }
            const String&       GetUser() const { return aUser; }
            const String&       GetComment() const { return aComment; }
            ScChangeActionType  GetType() const { return eType; }
/*N*/           ScChangeActionState GetState() const { return eState; }
            ULONG               GetActionNumber() const { return nAction; }
            ULONG               GetRejectAction() const { return nRejectAction; }
/*N*/
            ScChangeAction*     GetNext() const { return pNext; }
/*N*/           ScChangeAction*     GetPrev() const { return pPrev; }
/*N*/
             BOOL               IsDeletedIn() const
                                     { return GetDeletedIn() != NULL; }
/*N*/           BOOL                IsDeleted() const
/*N*/                                   { return IsDeleteType() || IsDeletedIn(); }
/*N*/           BOOL                IsDeletedIn( const ScChangeAction* ) const;
/*N*/           BOOL                IsDeletedInDelType( ScChangeActionType ) const;
/*N*/
             const ScChangeActionLinkEntry* GetFirstDeletedEntry() const
                                     { return pLinkDeleted; }
             const ScChangeActionLinkEntry* GetFirstDependentEntry() const
                                     { return pLinkDependent; }
             BOOL               HasDependent() const
                                     { return pLinkDependent != NULL; }
             BOOL               HasDeleted() const
                                     { return pLinkDeleted != NULL; }
/*N*/
/*N*/                               // Description wird an String angehaengt.
/*N*/                               // Mit bSplitRange wird bei Delete nur
/*N*/                               // eine Spalte/Zeile beruecksichtigt (fuer
/*N*/                               // Auflistung der einzelnen Eintraege).
/*N*/   virtual void                GetDescription( String&, ScDocument*,
/*N*/                                   BOOL /*bSplitRange*/ = FALSE ) const {}
/*N*/
/*N*/   virtual void                GetRefString( String&, ScDocument*,
/*N*/                                   BOOL bFlag3D = FALSE ) const;
/*N*/
/*N*/                               // fuer DocumentMerge altes Datum einer anderen
/*N*/                               // Action setzen, mit GetDateTimeUTC geholt
/*N*/           void                SetDateTimeUTC( const DateTime& rDT )
/*N*/                                   { aDateTime = rDT; }
/*N*/
/*N*/                               // Benutzerkommentar setzen
/*N*/           void                SetComment( const String& rStr )
/*N*/                                   { aComment = rStr; }
/*N*/
/*N*/                               // only to be used in the XML import
            void                SetDeletedInThis( ULONG nActionNumber,
                                        const ScChangeTrack* pTrack );
/*N*/                               // only to be used in the XML import
            void                AddDependent( ULONG nActionNumber,
                                        const ScChangeTrack* pTrack );
};


// --- ScChangeActionIns ----------------------------------------------------

class ScChangeActionIns : public ScChangeAction
{
    friend class ScChangeTrack;

                                ScChangeActionIns( const ScRange& rRange );
                                ScChangeActionIns( SvStream&,
                                    ScMultipleReadHeader&, ScChangeTrack* );
    virtual                     ~ScChangeActionIns();
/*N*/
/*N*/   virtual void                AddContent( ScChangeActionContent* ) {}
/*N*/   virtual void                DeleteCellEntries() {}
/*N*/
/*N*/   virtual BOOL                Reject( ScDocument* );
/*N*/
public:
                                ScChangeActionIns(const ULONG nActionNumber,
                                        const ScChangeActionState eState,
                                        const ULONG nRejectingNumber,
                                        const ScBigRange& aBigRange,
                                        const String& aUser,
                                        const DateTime& aDateTime,
                                        const String &sComment,
                                        const ScChangeActionType eType); // only to use in the XML import

/*N*/   virtual void                GetDescription( String&, ScDocument*,
/*N*/                                   BOOL bSplitRange = FALSE ) const;
};


// --- ScChangeActionDel ----------------------------------------------------

class ScChangeActionMove;

class ScChangeActionDelMoveEntry : public ScChangeActionLinkEntry
{
    friend class ScChangeActionDel;
    friend class ScChangeTrack;

            short               nCutOffFrom;
            short               nCutOffTo;


                                ScChangeActionDelMoveEntry(
                                    ScChangeActionDelMoveEntry** ppInPrev,
                                    ScChangeActionMove* pMove,
                                    short nFrom, short nTo )
                                    :   ScChangeActionLinkEntry(
                                            (ScChangeActionLinkEntry**)
                                                ppInPrev,
                                            (ScChangeAction*) pMove ),
                                        nCutOffFrom( nFrom ),
                                        nCutOffTo( nTo )
/*N*/                                   {};

/*N*/           ScChangeActionDelMoveEntry* GetNext()
/*N*/                                   {
/*N*/                                       return (ScChangeActionDelMoveEntry*)
/*N*/                                       ScChangeActionLinkEntry::GetNext();
/*N*/                                   }
/*N*/           ScChangeActionMove* GetMove()
/*N*/                                   {
/*N*/                                       return (ScChangeActionMove*)
/*N*/                                       ScChangeActionLinkEntry::GetAction();
/*N*/                                   }
/*N*/
public:
             const ScChangeActionDelMoveEntry*  GetNext() const
                                     {
                                         return (const ScChangeActionDelMoveEntry*)
                                         ScChangeActionLinkEntry::GetNext();
                                     }
/*N*/           const ScChangeActionMove*   GetMove() const
/*N*/                                   {
/*N*/                                       return (const ScChangeActionMove*)
/*N*/                                       ScChangeActionLinkEntry::GetAction();
/*N*/                                   }
            short               GetCutOffFrom() const { return nCutOffFrom; }
            short               GetCutOffTo() const { return nCutOffTo; }
};


class ScChangeActionDel : public ScChangeAction
{
    friend class ScChangeTrack;
/*N*/   friend class ScChangeAction;

            ScChangeTrack*      pTrack;
            ScChangeActionCellListEntry* pFirstCell;
            ScChangeActionIns*  pCutOff;        // abgeschnittener Insert
            short               nCutOff;        // +: Start  -: End
            ScChangeActionDelMoveEntry* pLinkMove;
            short               nDx;
            short               nDy;

                                ScChangeActionDel( const ScRange& rRange,
                                    short nDx, short nDy, ScChangeTrack* );
                                ScChangeActionDel( SvStream&,
                                    ScMultipleReadHeader&, ScDocument*,
                                    USHORT nVer, ScChangeTrack* );
/*N*/   virtual                     ~ScChangeActionDel();
/*N*/
            ScChangeActionIns*  GetCutOffInsert() { return pCutOff; }
/*N*/
/*N*/   virtual void                AddContent( ScChangeActionContent* );
/*N*/   virtual void                DeleteCellEntries();
/*N*/
/*N*/           void                UndoCutOffMoves();
/*N*/           void                UndoCutOffInsert();
/*N*/
/*N*/   virtual void                UpdateReference( const ScChangeTrack*,
/*N*/                                   UpdateRefMode, const ScBigRange&,
/*N*/                                   INT32 nDx, INT32 nDy, INT32 nDz );
/*N*/
/*N*/   virtual BOOL                Reject( ScDocument* );
/*N*/
/*N*/   virtual BOOL                StoreLinks( SvStream& ) const;
/*N*/   virtual BOOL                LoadLinks( SvStream&, ScChangeTrack* );
/*N*/
public:
                                ScChangeActionDel(const ULONG nActionNumber,
                                                const ScChangeActionState eState,
                                                const ULONG nRejectingNumber,
                                                const ScBigRange& aBigRange,
                                                const String& aUser,
                                                const DateTime& aDateTime,
                                                const String &sComment,
                                                const ScChangeActionType eType,
                                                const short nD,
                                                ScChangeTrack* pTrack); // only to use in the XML import
                                                                        // wich of nDx and nDy is set is depend on the type

                                // ob dieses das unterste einer Reihe (oder
                                // auch einzeln) ist
/*N*/           BOOL                IsBaseDelete() const;

                                // ob dieses das oberste einer Reihe (oder
                                // auch einzeln) ist
/*N*/           BOOL                IsTopDelete() const;

                                // ob dieses ein Teil einer Reihe ist
/*N*/           BOOL                IsMultiDelete() const;


            short               GetDx() const { return nDx; }
            short               GetDy() const { return nDy; }
/*N*/           ScBigRange          GetOverAllRange() const;    // BigRange + (nDx, nDy)

/*N*/           const ScChangeActionCellListEntry* GetFirstCellEntry() const
/*N*/                                   { return pFirstCell; }
             const ScChangeActionDelMoveEntry* GetFirstMoveEntry() const
                                     { return pLinkMove; }
            const ScChangeActionIns*    GetCutOffInsert() const { return pCutOff; }
        short               GetCutOffCount() const { return nCutOff; }
/*N*/
/*N*/   virtual void                GetDescription( String&, ScDocument*,
/*N*/                                   BOOL bSplitRange = FALSE ) const;
            void                SetCutOffInsert( ScChangeActionIns* p, short n )
                                    { pCutOff = p; nCutOff = n; }   // only to use in the XML import
/*N*/                                                                   // this should be protected, but for the XML import it is public
/*N*/           // only to use in the XML import
/*N*/           // this should be protected, but for the XML import it is public
            ScChangeActionDelMoveEntry* AddCutOffMove( ScChangeActionMove* pMove,
                                        short nFrom, short nTo )
                                    {
                                        return new ScChangeActionDelMoveEntry(
                                        &pLinkMove, pMove, nFrom, nTo );
                                    }
};


// --- ScChangeActionMove ---------------------------------------------------

class ScChangeActionMove : public ScChangeAction
{
    friend class ScChangeTrack;
/*N*/   friend class ScChangeActionDel;

            ScBigRange          aFromRange;
            ScChangeTrack*      pTrack;
            ScChangeActionCellListEntry* pFirstCell;
            ULONG               nStartLastCut;  // fuer PasteCut Undo
            ULONG               nEndLastCut;

                                ScChangeActionMove( const ScRange& rFromRange,
                                    const ScRange& rToRange,
                                    ScChangeTrack* pTrackP )
                                    : ScChangeAction( SC_CAT_MOVE, rToRange ),
                                        aFromRange( rFromRange ),
                                        pTrack( pTrackP ),
                                        pFirstCell( NULL ),
                                        nStartLastCut(0),
                                        nEndLastCut(0)
/*N*/                                   {};
                                ScChangeActionMove( SvStream&,
                                    ScMultipleReadHeader&, ScChangeTrack* );
/*N*/   virtual                     ~ScChangeActionMove();

/*N*/   virtual void                AddContent( ScChangeActionContent* );
/*N*/   virtual void                DeleteCellEntries();
/*N*/
            ScBigRange&         GetFromRange() { return aFromRange; }
/*N*/
/*N*/           void                SetStartLastCut( ULONG nVal ) { nStartLastCut = nVal; }
/*N*/           ULONG               GetStartLastCut() const { return nStartLastCut; }
/*N*/           void                SetEndLastCut( ULONG nVal ) { nEndLastCut = nVal; }
/*N*/           ULONG               GetEndLastCut() const { return nEndLastCut; }
/*N*/
/*N*/   virtual void                UpdateReference( const ScChangeTrack*,
/*N*/                                   UpdateRefMode, const ScBigRange&,
/*N*/                                   INT32 nDx, INT32 nDy, INT32 nDz );
/*N*/
/*N*/   virtual BOOL                Reject( ScDocument* );
/*N*/
/*N*/   virtual BOOL                StoreLinks( SvStream& ) const;
/*N*/   virtual BOOL                LoadLinks( SvStream&, ScChangeTrack* );
/*N*/
public:
                                ScChangeActionMove(const ULONG nActionNumber,
                                                const ScChangeActionState eState,
                                                const ULONG nRejectingNumber,
                                                const ScBigRange& aToBigRange,
                                                const String& aUser,
                                                const DateTime& aDateTime,
                                                const String &sComment,
                                                const ScBigRange& aFromBigRange,
                                                ScChangeTrack* pTrack); // only to use in the XML import
/*N*/           const ScChangeActionCellListEntry* GetFirstCellEntry() const
/*N*/                                   { return pFirstCell; } // only to use in the XML export
/*N*/
            const ScBigRange&   GetFromRange() const { return aFromRange; }
/*N*/           void                GetDelta( INT32& nDx, INT32& nDy, INT32& nDz ) const;
/*N*/
/*N*/   virtual void                GetDescription( String&, ScDocument*,
/*N*/                                   BOOL bSplitRange = FALSE ) const;
/*N*/
/*N*/   virtual void                GetRefString( String&, ScDocument*,
/*N*/                                   BOOL bFlag3D = FALSE ) const;
};


// --- ScChangeActionContent ------------------------------------------------

enum ScChangeActionContentCellType
{
    SC_CACCT_NONE = 0,
    SC_CACCT_NORMAL,
    SC_CACCT_MATORG,
    SC_CACCT_MATREF
};

class ScChangeActionContent : public ScChangeAction
{
    friend class ScChangeTrack;

            String              aOldValue;
            String              aNewValue;
            ScBaseCell*         pOldCell;
            ScBaseCell*         pNewCell;
        ScChangeActionContent*  pNextContent;   // an gleicher Position
        ScChangeActionContent*  pPrevContent;
        ScChangeActionContent*  pNextInSlot;    // in gleichem Slot
        ScChangeActionContent** ppPrevInSlot;

                                ScChangeActionContent( SvStream&,
                                    ScMultipleReadHeader&, ScDocument*,
                                    USHORT nVer, ScChangeTrack* );

/*N*/           void                InsertInSlot( ScChangeActionContent** pp )
/*N*/                                   {
/*N*/                                       if ( !ppPrevInSlot )
/*N*/                                       {
/*N*/                                           ppPrevInSlot = pp;
/*N*/                                           if (( pNextInSlot = *pp ))
/*N*/                                               pNextInSlot->ppPrevInSlot = &pNextInSlot;
/*N*/                                           *pp = this;
/*N*/                                       }
/*N*/                                   }
/*N*/           void                RemoveFromSlot()
/*N*/                                   {
/*N*/                                       if ( ppPrevInSlot )
/*N*/                                       {
/*N*/                                           if (( *ppPrevInSlot = pNextInSlot ))
/*N*/                                               pNextInSlot->ppPrevInSlot = ppPrevInSlot;
/*N*/                                           ppPrevInSlot = NULL;    // not inserted
/*N*/                                       }
/*N*/                                   }
/*N*/       ScChangeActionContent*  GetNextInSlot() { return pNextInSlot; }
/*N*/
/*N*/           void                ClearTrack();
/*N*/
/*N*/   static  void                SetValue( String& rStr, ScBaseCell*& pCell,
/*N*/                                   const ScAddress& rPos,
/*N*/                                   const ScBaseCell* pOrgCell,
/*N*/                                   const ScDocument* pFromDoc,
/*N*/                                   ScDocument* pToDoc );
/*N*/
/*N*/   static  void                SetValue( String& rStr, ScBaseCell*& pCell,
/*N*/                                   ULONG nFormat,
/*N*/                                   const ScBaseCell* pOrgCell,
/*N*/                                   const ScDocument* pFromDoc,
/*N*/                                   ScDocument* pToDoc );
/*N*/
/*N*/   static  void                SetCell( String& rStr, ScBaseCell* pCell,
/*N*/                                   ULONG nFormat, const ScDocument* pDoc );
/*N*/
/*N*/   static  BOOL                NeedsNumberFormat( const ScBaseCell* );
/*N*/
/*N*/           void                GetValueString( String& rStr,
/*N*/                                   const String& rValue,
/*N*/                                   const ScBaseCell* pCell ) const;
/*N*/
/*N*/           void                GetFormulaString( String& rStr,
/*N*/                                   const ScFormulaCell* pCell ) const;
/*N*/
/*N*/   virtual void                AddContent( ScChangeActionContent* ) {}
/*N*/   virtual void                DeleteCellEntries() {}
/*N*/
/*N*/   virtual void                UpdateReference( const ScChangeTrack*,
/*N*/                                   UpdateRefMode, const ScBigRange&,
/*N*/                                   INT32 nDx, INT32 nDy, INT32 nDz );
/*N*/
/*N*/   virtual BOOL                Reject( ScDocument* );
/*N*/
/*N*/           void                PutValueToDoc( ScBaseCell*, const String&,
/*N*/                                   ScDocument*, short nDx, short nDy ) const;
/*N*/
/*N*/   virtual BOOL                StoreLinks( SvStream& ) const;
/*N*/   virtual BOOL                LoadLinks( SvStream&, ScChangeTrack* );
/*N*/
public:

    DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionContent )

                                ScChangeActionContent( const ScRange& rRange )
                                    : ScChangeAction( SC_CAT_CONTENT, rRange ),
                                        pOldCell( NULL ),
                                        pNewCell( NULL ),
                                        pNextContent( NULL ),
                                        pPrevContent( NULL ),
                                        pNextInSlot( NULL ),
                                        ppPrevInSlot( NULL )
/*N*/                                   {};
                                ScChangeActionContent(const ULONG nActionNumber,
                                                const ScChangeActionState eState,
                                                const ULONG nRejectingNumber,
                                                const ScBigRange& aBigRange,
                                                const String& aUser,
                                                const DateTime& aDateTime,
                                                const String &sComment,
                                                ScBaseCell* pOldCell,
                                                ScDocument* pDoc,
                                                const String& sResult); // to use for XML Import
                                ScChangeActionContent(const ULONG nActionNumber,
                                                ScBaseCell* pNewCell,
                                                const ScBigRange& aBigRange,
                                                ScDocument* pDoc); // to use for XML Import of Generated Actions
/*N*/   virtual                     ~ScChangeActionContent();
/*N*/
/*N*/       ScChangeActionContent*  GetNextContent() const { return pNextContent; }
        ScChangeActionContent*  GetPrevContent() const { return pPrevContent; }
/*N*/       ScChangeActionContent*  GetTopContent() const;
             BOOL               IsTopContent() const
                                     { return pNextContent == NULL; }
/*N*/
/*N*/   virtual ScChangeActionLinkEntry*    GetDeletedIn() const;
/*N*/   virtual ScChangeActionLinkEntry**   GetDeletedInAddress();
/*N*/
/*N*/           void                PutOldValueToDoc( ScDocument*,
/*N*/                                   short nDx, short nDy ) const;
/*N*/           void                PutNewValueToDoc( ScDocument*,
/*N*/                                   short nDx, short nDy ) const;
/*N*/
/*N*/           void                SetOldValue( const ScBaseCell*,
/*N*/                                   const ScDocument* pFromDoc,
/*N*/                                   ScDocument* pToDoc );
/*N*/           void                SetNewValue( const ScBaseCell*, ScDocument* );
/*N*/
/*N*/                               // Use this only in the XML import,
/*N*/                               // takes ownership of cell.
            void                SetNewCell( ScBaseCell* pNewCell, ScDocument* pDoc );
/*N*/
/*N*/                               // These functions should be protected but for
/*N*/                               // the XML import they are public.
            void                SetNextContent( ScChangeActionContent* p )
                                    { pNextContent = p; }
            void                SetPrevContent( ScChangeActionContent* p )
                                    { pPrevContent = p; }
/*N*/
/*N*/           void                GetOldString( String& ) const;
/*N*/           void                GetNewString( String& ) const;
            const ScBaseCell*   GetOldCell() const { return pOldCell; }
            const ScBaseCell*   GetNewCell() const { return pNewCell; }
/*N*/   virtual void                GetDescription( String&, ScDocument*,
/*N*/                                   BOOL bSplitRange = FALSE ) const;
/*N*/   virtual void                GetRefString( String&, ScDocument*,
/*N*/                                   BOOL bFlag3D = FALSE ) const;
/*N*/
/*N*/   static  ScChangeActionContentCellType   GetContentCellType( const ScBaseCell* );
/*N*/
/*N*/                               // NewCell
/*N*/           BOOL                IsMatrixOrigin() const
/*N*/                                   {
/*N*/                                       return GetContentCellType( GetNewCell() )
/*N*/                                           == SC_CACCT_MATORG;
/*N*/                                   }
/*N*/           BOOL                IsMatrixReference() const
/*N*/                                   {
/*N*/                                       return GetContentCellType( GetNewCell() )
/*N*/                                           == SC_CACCT_MATREF;
/*N*/                                   }
/*N*/                               // OldCell
/*N*/           BOOL                IsOldMatrixOrigin() const
/*N*/                                   {
/*N*/                                       return GetContentCellType( GetOldCell() )
/*N*/                                           == SC_CACCT_MATORG;
/*N*/                                   }
/*N*/           BOOL                IsOldMatrixReference() const
/*N*/                                   {
/*N*/                                       return GetContentCellType( GetOldCell() )
/*N*/                                           == SC_CACCT_MATREF;
/*N*/                                   }
/*N*/
};


// --- ScChangeActionReject -------------------------------------------------

class ScChangeActionReject : public ScChangeAction
{
    friend class ScChangeTrack;
/*N*/   friend class ScChangeActionContent;

                                ScChangeActionReject( ULONG nReject )
                                    : ScChangeAction( SC_CAT_REJECT, ScRange() )
                                    {
/*N*/                                       SetRejectAction( nReject );
/*N*/                                       SetState( SC_CAS_ACCEPTED );
                                    }
                                ScChangeActionReject( SvStream&,
                                    ScMultipleReadHeader&, ScChangeTrack* );

/*N*/   virtual void                AddContent( ScChangeActionContent* ) {}
/*N*/   virtual void                DeleteCellEntries() {}
/*N*/
/*N*/   virtual BOOL                Reject( ScDocument* /*p*/ ) { return FALSE; }
/*N*/
public:
                                ScChangeActionReject(const ULONG nActionNumber,
                                                const ScChangeActionState eState,
                                                const ULONG nRejectingNumber,
                                                const ScBigRange& aBigRange,
                                                const String& aUser,
                                                const DateTime& aDateTime,
                                                const String &sComment); // only to use in the XML import
};


// --- ScChangeTrack --------------------------------------------------------

enum ScChangeTrackMsgType
{
    SC_CTM_NONE,
    SC_CTM_APPEND,      // Actions angehaengt
    SC_CTM_REMOVE,      // Actions weggenommen
    SC_CTM_CHANGE,      // Actions geaendert
    SC_CTM_PARENT       // war kein Parent und ist jetzt einer
};

struct ScChangeTrackMsgInfo
{
    DECL_FIXEDMEMPOOL_NEWDEL( ScChangeTrackMsgInfo )

    ScChangeTrackMsgType    eMsgType;
    ULONG                   nStartAction;
    ULONG                   nEndAction;
};

// MsgQueue fuer Benachrichtigung via ModifiedLink
/*N*/ typedef std::deque<ScChangeTrackMsgInfo*> ScChangeTrackMsgQueue;
/*N*/ DECLARE_STACK( ScChangeTrackMsgStack, ScChangeTrackMsgInfo* )

enum ScChangeTrackMergeState
{
    SC_CTMS_NONE,
    SC_CTMS_PREPARE,
    SC_CTMS_OWN,
    SC_CTMS_OTHER
};

// zusaetzlich zu pFirst/pNext/pLast/pPrev eine Table, um schnell sowohl
// per ActionNumber als auch ueber Liste zugreifen zu koennen
/*N*/DECLARE_TABLE( ScChangeActionTable, ScChangeAction* )

// Intern generierte Actions beginnen bei diesem Wert (fast alle Bits gesetzt)
// und werden runtergezaehlt, um sich in einer Table wertemaessig nicht mit den
// "normalen" Actions in die Quere zu kommen.
#define SC_CHGTRACK_GENERATED_START ((UINT32) 0xfffffff0)

// SfxListener an der Applikation, um Aenderungen des Usernamens mitzubekommen

class ScChangeTrack : public SfxListener
{
/*N*/   friend void ScChangeAction::RejectRestoreContents( ScChangeTrack*, short, short );
/*N*/   friend BOOL ScChangeActionDel::Reject( ScDocument* pDoc );
/*N*/   friend void ScChangeActionDel::DeleteCellEntries();
/*N*/   friend void ScChangeActionMove::DeleteCellEntries();
/*N*/   friend BOOL ScChangeActionMove::Reject( ScDocument* pDoc );

    static  const USHORT        nContentRowsPerSlot;
    static  const USHORT        nContentSlots;

     ::com::sun::star::uno::Sequence< sal_Int8 >    aProtectPass;
             ScChangeActionTable    aTable;
             ScChangeActionTable    aGeneratedTable;
             ScChangeActionTable    aPasteCutTable;
/*N*/       ScChangeTrackMsgQueue   aMsgQueue;
/*N*/       ScChangeTrackMsgStack   aMsgStackTmp;
/*N*/       ScChangeTrackMsgStack   aMsgStackFinal;
             StrCollection      aUserCollection;
             String             aUser;
             Link               aModifiedLink;
             ScRange                aInDeleteRange;
             DateTime           aFixDateTime;
             ScChangeAction*        pFirst;
             ScChangeAction*        pLast;
         ScChangeActionContent* pFirstGeneratedDelContent;
         ScChangeActionContent**    ppContentSlots;
         ScChangeActionMove*        pLastCutMove;
     ScChangeActionLinkEntry*   pLinkInsertCol;
     ScChangeActionLinkEntry*   pLinkInsertRow;
     ScChangeActionLinkEntry*   pLinkInsertTab;
     ScChangeActionLinkEntry*   pLinkMove;
         ScChangeTrackMsgInfo*  pBlockModifyMsg;
             ScDocument*            pDoc;
             ULONG              nActionMax;
             ULONG              nGeneratedMin;
             ULONG              nMarkLastSaved;
             ULONG              nStartLastCut;
             ULONG              nEndLastCut;
             ULONG              nLastMerge;
         ScChangeTrackMergeState    eMergeState;
             USHORT             nLoadedFileFormatVersion;
             BOOL               bLoadSave;
             BOOL               bInDelete;
             BOOL               bInDeleteUndo;
             BOOL               bInDeleteTop;
             BOOL               bInPasteCut;
             BOOL               bUseFixDateTime;
             BOOL                bTime100thSeconds;

                                // not implemented, prevent usage
/*N*/                               ScChangeTrack( const ScChangeTrack& );
            ScChangeTrack&      operator=( const ScChangeTrack& );

#ifdef SC_CHGTRACK_CXX
    static  USHORT              InitContentRowsPerSlot();
/*N*/
/*N*/   virtual void                Notify( SfxBroadcaster&, const SfxHint& );
/*N*/           void                Init();
/*N*/           void                DtorClear();
/*N*/           void                SetLoadSave( BOOL bVal ) { bLoadSave = bVal; }
/*N*/           void                SetInDeleteRange( const ScRange& rRange )
/*N*/                                   { aInDeleteRange = rRange; }
/*N*/           void                SetInDelete( BOOL bVal )
/*N*/                                   { bInDelete = bVal; }
/*N*/           void                SetInDeleteTop( BOOL bVal )
/*N*/                                   { bInDeleteTop = bVal; }
/*N*/           void                SetInDeleteUndo( BOOL bVal )
/*N*/                                   { bInDeleteUndo = bVal; }
/*N*/           void                SetInPasteCut( BOOL bVal )
/*N*/                                   { bInPasteCut = bVal; }
/*N*/           void                SetMergeState( ScChangeTrackMergeState eState )
/*N*/                                   { eMergeState = eState; }
/*N*/       ScChangeTrackMergeState GetMergeState() const { return eMergeState; }
/*N*/           void                SetLastMerge( ULONG nVal ) { nLastMerge = nVal; }
/*N*/           ULONG               GetLastMerge() const { return nLastMerge; }
/*N*/
/*N*/                               // ModifyMsg blockweise und nicht einzeln erzeugen
/*N*/           void                StartBlockModify( ScChangeTrackMsgType,
/*N*/                                   ULONG nStartAction );
/*N*/           void                EndBlockModify( ULONG nEndAction );
/*N*/
/*N*/           void                AddDependentWithNotify( ScChangeAction* pParent,
/*N*/                                   ScChangeAction* pDependent );
/*N*/
/*N*/           void                Dependencies( ScChangeAction* );
/*N*/           void                UpdateReference( ScChangeAction*, BOOL bUndo );
/*N*/           void                UpdateReference( ScChangeAction** ppFirstAction,
/*N*/                                   ScChangeAction* pAct, BOOL bUndo );
/*N*/           void                Append( ScChangeAction* pAppend, ULONG nAction );
/*N*/           void                AppendDeleteRange( const ScRange&,
/*N*/                                   ScDocument* pRefDoc, short nDz,
/*N*/                                   ULONG nRejectingInsert );
/*N*/           void                AppendOneDeleteRange( const ScRange& rOrgRange,
/*N*/                                   ScDocument* pRefDoc,
/*N*/                                   short nDx, short nDy, short nDz,
/*N*/                                   ULONG nRejectingInsert );
/*N*/           void                LookUpContents( const ScRange& rOrgRange,
/*N*/                                   ScDocument* pRefDoc,
/*N*/                                   short nDx, short nDy, short nDz );
/*N*/           void                MasterLinks( ScChangeAction* );
/*N*/                                                          // Content on top an Position
/*N*/          ScChangeActionContent*  SearchContentAt( const ScBigAddress&,
/*N*/                                                                  ScChangeAction* pButNotThis ) const;
/*N*/
/*N*/                               // das gleiche fuer generierte Del-Eintraege,
/*N*/                               // wobei der Content nicht in der angegebenen
/*N*/                               // Richtung geloescht sein darf
/*N*/           void                DeleteGeneratedDelContent(
/*N*/                                   ScChangeActionContent* );
/*N*/       ScChangeActionContent*  GenerateDelContent( const ScAddress&,
/*N*/                                   const ScBaseCell*,
/*N*/                                   const ScDocument* pFromDoc );
/*N*/           void                DeleteCellEntries(
/*N*/                                   ScChangeActionCellListEntry*&,
/*N*/                                   ScChangeAction* pDeletor );
/*N*/
/*N*/                               // Action und alle abhaengigen rejecten,
/*N*/                               // Table stammt aus vorherigem GetDependents,
/*N*/                               // ist nur bei Insert und Move (MasterType)
/*N*/                               // noetig, kann ansonsten NULL sein.
/*N*/                               // bRecursion == Aufruf aus Reject mit Table
/*N*/           BOOL                Reject( ScChangeAction*,
/*N*/                                   ScChangeActionTable*, BOOL bRecursion );
/*N*/
#endif  // SC_CHGTRACK_CXX
/*N*/
/*N*/           void                ClearMsgQueue();
/*N*/
public:

/*N*/   static  USHORT              ComputeContentSlot( INT32 nRow )
/*N*/                                   {
/*N*/                                       if ( nRow < 0 || nRow > MAXROW )
/*N*/                                           return nContentSlots - 1;
/*N*/                                       return nRow / nContentRowsPerSlot;
/*N*/                                   }

/*N*/                               ScChangeTrack( ScDocument* );
                                ScChangeTrack( ScDocument*,
/*N*/                                           const StrCollection& ); // only to use in the XML import
/*N*/   virtual                     ~ScChangeTrack();
/*N*/           void                Clear();
/*N*/
            ScChangeActionContent*  GetFirstGenerated() const { return pFirstGeneratedDelContent; }
            ScChangeAction*     GetFirst() const { return pFirst; }
            ScChangeAction*     GetLast() const { return pLast; }
            ULONG               GetActionMax() const { return nActionMax; }
             BOOL               IsGenerated( ULONG nAction ) const
/*N*/                                   { return nAction >= nGeneratedMin;}
            ScChangeAction*     GetAction( ULONG nAction ) const
                                    { return aTable.Get( nAction ); }
/*N*/           ScChangeAction*     GetGenerated( ULONG nGenerated ) const
/*N*/                                   { return aGeneratedTable.Get( nGenerated ); }
/*N*/           ScChangeAction*     GetActionOrGenerated( ULONG nAction ) const
/*N*/                                   {
/*N*/                                       return IsGenerated( nAction ) ?
/*N*/                                           GetGenerated( nAction ) :
/*N*/                                           GetAction( nAction );
/*N*/                                   }
/*N*/           ULONG               GetLastSavedActionNumber() const
/*N*/                                   { return nMarkLastSaved; }
            void                SetLastSavedActionNumber(ULONG nNew)
                                    { nMarkLastSaved = nNew; }
/*N*/           ScChangeAction*     GetLastSaved() const
/*N*/                                   { return aTable.Get( nMarkLastSaved ); }
/*N*/       ScChangeActionContent** GetContentSlots() const { return ppContentSlots; }
/*N*/
/*N*/           BOOL                IsLoadSave() const { return bLoadSave; }
/*N*/           const ScRange&      GetInDeleteRange() const
/*N*/                                   { return aInDeleteRange; }
/*N*/           BOOL                IsInDelete() const { return bInDelete; }
/*N*/           BOOL                IsInDeleteTop() const { return bInDeleteTop; }
            BOOL                IsInDeleteUndo() const { return bInDeleteUndo; }
/*N*/           BOOL                IsInPasteCut() const { return bInPasteCut; }
/*N*/           void                SetUser( const String& );
/*N*/           const String&       GetUser() const { return aUser; }
            const StrCollection&    GetUserCollection() const
                                    { return aUserCollection; }
/*N*/           ScDocument*         GetDocument() const { return pDoc; }
/*N*/                               // for import filter
/*N*/           const DateTime&     GetFixDateTime() const { return aFixDateTime; }
/*N*/
/*N*/                               // set this if the date/time set with
/*N*/                               // SetFixDateTime...() shall be applied to
/*N*/                               // appended actions
/*N*/           void                SetUseFixDateTime( BOOL bVal )
/*N*/                                   { bUseFixDateTime = bVal; }
/*N*/                               // for MergeDocument, apply original date/time as UTC
/*N*/           void                SetFixDateTimeUTC( const DateTime& rDT )
/*N*/                                   { aFixDateTime = rDT; }
/*N*/                               // for import filter, apply original date/time as local time
/*N*/           void                SetFixDateTimeLocal( const DateTime& rDT )
/*N*/                                   { aFixDateTime = rDT; aFixDateTime.ConvertToUTC(); }
/*N*/
/*N*/           void                Append( ScChangeAction* );
/*N*/
/*N*/                               // Cut to Clipboard
/*N*/           void                ResetLastCut()
/*N*/                                   {
/*N*/                                       nStartLastCut = nEndLastCut = 0;
/*N*/                                       if ( pLastCutMove )
/*N*/                                       {
/*N*/                                           delete pLastCutMove;
/*N*/                                           pLastCutMove = NULL;
/*N*/                                       }
/*N*/                                   }
/*N*/           BOOL                HasLastCut() const
/*N*/                                   {
/*N*/                                       return nEndLastCut > 0 &&
/*N*/                                           nStartLastCut <= nEndLastCut &&
/*N*/                                           pLastCutMove;
/*N*/                                   }
/*N*/
/*N*/
/*N*/                               // wenn ModifiedLink gesetzt, landen
/*N*/                               // Aenderungen in ScChangeTrackMsgQueue
/*N*/           void                SetModifiedLink( const Link& r )
/*N*/                                   { aModifiedLink = r; ClearMsgQueue(); }
/*N*/           const Link&         GetModifiedLink() const { return aModifiedLink; }
/*N*/           ScChangeTrackMsgQueue& GetMsgQueue() { return aMsgQueue; }
/*N*/
/*N*/           void                NotifyModified( ScChangeTrackMsgType eMsgType,
/*N*/                                   ULONG nStartAction, ULONG nEndAction );
/*N*/
/*N*/           BOOL                Load( SvStream& rStrm, USHORT nVer );
/*N*/    BOOL    Store( SvStream& ) {return FALSE;}
/*N*/           USHORT              GetLoadedFileFormatVersion() const
/*N*/                                   { return nLoadedFileFormatVersion; }
/*N*/
            ULONG               AddLoadedGenerated(ScBaseCell* pOldCell,
                                                const ScBigRange& aBigRange ); // only to use in the XML import
             void               AppendLoaded( ScChangeAction* pAppend ); // this is only for the XML import public, it should be protected
             void               SetActionMax(ULONG nTempActionMax)
                                    { nActionMax = nTempActionMax; } // only to use in the XML import
/*N*/
            void                SetProtection( const ::com::sun::star::uno::Sequence< sal_Int8 >& rPass )
                                    { aProtectPass = rPass; }
     ::com::sun::star::uno::Sequence< sal_Int8 >   GetProtection() const
                                     { return aProtectPass; }
             BOOL                IsProtected() const
                                     { return aProtectPass.getLength() != 0; }
/*N*/
/*N*/                                 // If time stamps of actions of this
/*N*/                                 // ChangeTrack and a second one are to be
/*N*/                                 // compared including 100th seconds.
            void                SetTime100thSeconds( BOOL bVal )
                                    { bTime100thSeconds = bVal; }
/*N*/             BOOL                IsTime100thSeconds() const
/*N*/                                     { return bTime100thSeconds; }
};


} //namespace binfilter
#endif


/* vim:set shiftwidth=4 softtabstop=4 expandtab: */