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
|
/* -*- 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 INCLUDED_SC_SOURCE_UI_INC_UNDOBLK_HXX
#define INCLUDED_SC_SOURCE_UI_INC_UNDOBLK_HXX
#include "undobase.hxx"
#include <markdata.hxx>
#include "spellparam.hxx"
#include "cellmergeoption.hxx"
#include <paramisc.hxx>
#include <editeng/boxitem.hxx>
#include <memory>
class ScDocShell;
class ScOutlineTable;
class ScPatternAttr;
class SvxSearchItem;
class SdrUndoAction;
class ScEditDataArray;
class ScUndoInsertCells: public ScMoveUndo
{
public:
ScUndoInsertCells( ScDocShell* pNewDocShell,
const ScRange& rRange,
SCTAB nNewCount, std::unique_ptr<SCTAB[]> pNewTabs, std::unique_ptr<SCTAB[]> pNewScenarios,
InsCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData,
bool bNewPartOfPaste );
virtual ~ScUndoInsertCells() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat( SfxRepeatTarget& rTarget ) override;
virtual bool CanRepeat( SfxRepeatTarget& rTarget ) const override;
virtual OUString GetComment() const override;
virtual bool Merge( SfxUndoAction *pNextAction ) override;
private:
ScRange aEffRange;
SCTAB nCount;
std::unique_ptr<SCTAB[]>
pTabs;
std::unique_ptr<SCTAB[]>
pScenarios;
sal_uLong nEndChangeAction;
InsCellCmd eCmd;
bool bPartOfPaste;
std::unique_ptr<SfxUndoAction>
pPasteUndo;
void DoChange ( const bool bUndo );
void SetChangeTrack();
};
class ScUndoDeleteCells: public ScMoveUndo
{
public:
ScUndoDeleteCells( ScDocShell* pNewDocShell,
const ScRange& rRange,
SCTAB nNewCount, std::unique_ptr<SCTAB[]> pNewTabs, std::unique_ptr<SCTAB[]> pNewScenarios,
DelCellCmd eNewCmd, ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData );
virtual ~ScUndoDeleteCells() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScRange aEffRange;
SCTAB nCount;
std::unique_ptr<SCTAB[]>
pTabs;
std::unique_ptr<SCTAB[]>
pScenarios;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
DelCellCmd eCmd;
void DoChange ( const bool bUndo );
void SetChangeTrack();
};
class ScUndoDeleteMulti: public ScMoveUndo
{
public:
ScUndoDeleteMulti( ScDocShell* pNewDocShell,
bool bNewRows, bool bNeedsRefresh, SCTAB nNewTab,
const std::vector<sc::ColRowSpan>& rSpans,
ScDocumentUniquePtr pUndoDocument, std::unique_ptr<ScRefUndoData> pRefData );
virtual ~ScUndoDeleteMulti() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
bool mbRows:1;
bool mbRefresh:1;
SCTAB nTab;
std::vector<sc::ColRowSpan> maSpans;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
void DoChange() const;
void SetChangeTrack();
};
class ScUndoCut: public ScBlockUndo
{
public:
ScUndoCut(ScDocShell* pNewDocShell,
const ScRange& aRange, // adjusted for merged cells
const ScAddress& aOldEnd, // end position without adjustment
const ScMarkData& rMark, // selected sheets
ScDocumentUniquePtr pNewUndoDoc);
virtual ~ScUndoCut() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScDocumentUniquePtr
pUndoDoc;
ScRange aExtendedRange;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
void DoChange( const bool bUndo );
void SetChangeTrack();
};
struct ScUndoPasteOptions
{
ScPasteFunc nFunction;
bool bSkipEmpty;
bool bTranspose;
bool bAsLink;
InsCellCmd eMoveMode;
ScUndoPasteOptions() :
nFunction( ScPasteFunc::NONE ),
bSkipEmpty( false ),
bTranspose( false ),
bAsLink( false ),
eMoveMode( INS_NONE )
{}
};
class ScUndoPaste: public ScMultiBlockUndo
{
public:
ScUndoPaste(ScDocShell* pNewDocShell, const ScRangeList& rRanges,
const ScMarkData& rMark,
ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc,
InsertDeleteFlags nNewFlags,
std::unique_ptr<ScRefUndoData> pRefData,
bool bRedoIsFilled = true,
const ScUndoPasteOptions* pOptions = nullptr);
virtual ~ScUndoPaste() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScDocumentUniquePtr pUndoDoc;
ScDocumentUniquePtr pRedoDoc;
InsertDeleteFlags nFlags;
std::unique_ptr<ScRefUndoData> pRefUndoData;
std::unique_ptr<ScRefUndoData> pRefRedoData;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
bool bRedoFilled;
ScUndoPasteOptions aPasteOptions;
void DoChange(bool bUndo);
void SetChangeTrack();
};
class ScUndoDragDrop: public ScMoveUndo
{
public:
ScUndoDragDrop( ScDocShell* pNewDocShell,
const ScRange& rRange, const ScAddress& aNewDestPos, bool bNewCut,
ScDocumentUniquePtr pUndoDocument,
bool bScenario );
virtual ~ScUndoDragDrop() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
sal_uInt16 mnPaintExtFlags;
ScRangeList maPaintRanges;
ScRange aSrcRange;
ScRange aDestRange;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
bool bCut;
bool bKeepScenarioFlags;
void PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const;
void DoUndo( ScRange aRange );
void SetChangeTrack();
};
class ScUndoDeleteContents: public ScSimpleUndo
{
public:
ScUndoDeleteContents( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
const ScRange& rRange,
ScDocumentUniquePtr&& pNewUndoDoc, bool bNewMulti,
InsertDeleteFlags nNewFlags, bool bObjects );
virtual ~ScUndoDeleteContents() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
void SetDataSpans( const std::shared_ptr<DataSpansType>& pSpans );
private:
std::shared_ptr<DataSpansType> mpDataSpans; // Spans of non-empty cells.
ScRange aRange;
ScMarkData aMarkData;
ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data
std::unique_ptr<SdrUndoAction> pDrawUndo; // Deleted objects
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
InsertDeleteFlags nFlags;
bool bMulti; // Multi selection
void DoChange( const bool bUndo );
void SetChangeTrack();
};
class ScUndoFillTable: public ScSimpleUndo
{
public:
ScUndoFillTable( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti, SCTAB nSrc,
InsertDeleteFlags nFlg, ScPasteFunc nFunc, bool bSkip, bool bLink );
virtual ~ScUndoFillTable() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScRange aRange;
ScMarkData aMarkData;
ScDocumentUniquePtr
pUndoDoc; // Block mark and deleted data
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
InsertDeleteFlags nFlags;
ScPasteFunc nFunction;
SCTAB nSrcTab;
bool bMulti; // Multi selection
bool bSkipEmpty;
bool bAsLink;
void DoChange( const bool bUndo );
void SetChangeTrack();
};
class ScUndoSelectionAttr: public ScSimpleUndo
{
public:
ScUndoSelectionAttr( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
ScDocumentUniquePtr pNewUndoDoc, bool bNewMulti,
const ScPatternAttr* pNewApply,
const SvxBoxItem* pNewOuter = nullptr,
const SvxBoxInfoItem* pNewInner = nullptr,
const ScRange* pRangeCover = nullptr );
virtual ~ScUndoSelectionAttr() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
ScEditDataArray* GetDataArray();
private:
ScMarkData aMarkData;
ScRange aRange;
ScRange aRangeCover;
std::unique_ptr<ScEditDataArray> mpDataArray;
ScDocumentUniquePtr pUndoDoc;
bool bMulti;
ScPatternAttr* pApplyPattern;
SvxBoxItem* pLineOuter;
SvxBoxInfoItem* pLineInner;
void DoChange( const bool bUndo );
void ChangeEditData( const bool bUndo );
};
class ScUndoWidthOrHeight: public ScSimpleUndo
{
public:
ScUndoWidthOrHeight( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
SCCOLROW nNewStart, SCTAB nNewStartTab,
SCCOLROW nNewEnd, SCTAB nNewEndTab,
ScDocumentUniquePtr pNewUndoDoc,
const std::vector<sc::ColRowSpan>& rRanges,
std::unique_ptr<ScOutlineTable> pNewUndoTab,
ScSizeMode eNewMode, sal_uInt16 nNewSizeTwips,
bool bNewWidth );
virtual ~ScUndoWidthOrHeight() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
SCCOLROW nStart;
SCCOLROW nEnd;
SCTAB nStartTab;
SCTAB nEndTab;
ScDocumentUniquePtr pUndoDoc;
std::unique_ptr<ScOutlineTable> pUndoTab;
std::vector<sc::ColRowSpan> maRanges;
sal_uInt16 nNewSize;
bool bWidth;
ScSizeMode eMode;
std::unique_ptr<SdrUndoAction> pDrawUndo;
};
class ScUndoAutoFill: public ScBlockUndo
{
public:
ScUndoAutoFill( ScDocShell* pNewDocShell,
const ScRange& rRange, const ScRange& rSourceArea,
ScDocumentUniquePtr pNewUndoDoc, const ScMarkData& rMark,
FillDir eNewFillDir,
FillCmd eNewFillCmd, FillDateCmd eNewFillDateCmd,
double fNewStartValue, double fNewStepValue, double fNewMaxValue );
virtual ~ScUndoAutoFill() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScRange aSource;
ScMarkData aMarkData;
ScDocumentUniquePtr
pUndoDoc;
FillDir eFillDir;
FillCmd eFillCmd;
FillDateCmd eFillDateCmd;
double fStartValue;
double fStepValue;
double fMaxValue;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
void SetChangeTrack();
};
class ScUndoMerge: public ScSimpleUndo
{
public:
ScUndoMerge( ScDocShell* pNewDocShell, const ScCellMergeOption& rOption,
bool bMergeContents, ScDocumentUniquePtr pUndoDoc,
std::unique_ptr<SdrUndoAction> pDrawUndo);
virtual ~ScUndoMerge() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScCellMergeOption maOption;
bool mbMergeContents; // Merge contents in Redo().
ScDocumentUniquePtr mxUndoDoc; // when data is merged
std::unique_ptr<SdrUndoAction> mpDrawUndo;
void DoChange( bool bUndo ) const;
};
class ScUndoAutoFormat: public ScBlockUndo
{
public:
ScUndoAutoFormat( ScDocShell* pNewDocShell,
const ScRange& rRange, ScDocumentUniquePtr pNewUndoDoc,
const ScMarkData& rMark,
bool bNewSize, sal_uInt16 nNewFormatNo );
virtual ~ScUndoAutoFormat() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScDocumentUniquePtr
pUndoDoc; // deleted data
ScMarkData aMarkData;
bool bSize;
sal_uInt16 nFormatNo;
};
class ScUndoReplace: public ScSimpleUndo
{
public:
ScUndoReplace( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
const OUString& rNewUndoStr, ScDocumentUniquePtr pNewUndoDoc,
const SvxSearchItem* pItem );
virtual ~ScUndoReplace() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScAddress aCursorPos;
ScMarkData aMarkData;
OUString aUndoStr; // Data at single selection
ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data
std::unique_ptr<SvxSearchItem> pSearchItem;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
void SetChangeTrack();
};
class ScUndoTabOp: public ScSimpleUndo
{
public:
ScUndoTabOp( ScDocShell* pNewDocShell,
SCCOL nStartX, SCROW nStartY, SCTAB nStartZ,
SCCOL nEndX, SCROW nEndY, SCTAB nEndZ,
ScDocumentUniquePtr pNewUndoDoc,
const ScRefAddress& rFormulaCell,
const ScRefAddress& rFormulaEnd,
const ScRefAddress& rRowCell,
const ScRefAddress& rColCell,
ScTabOpParam::Mode eMode );
virtual ~ScUndoTabOp() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScRange aRange;
ScDocumentUniquePtr
pUndoDoc; // Deleted data
ScRefAddress theFormulaCell;
ScRefAddress theFormulaEnd;
ScRefAddress theRowCell;
ScRefAddress theColCell;
ScTabOpParam::Mode meMode;
};
class ScUndoConversion : public ScSimpleUndo
{
public:
ScUndoConversion( ScDocShell* pNewDocShell, const ScMarkData& rMark,
SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, ScDocumentUniquePtr pNewUndoDoc,
SCCOL nNewX, SCROW nNewY, SCTAB nNewZ, ScDocumentUniquePtr pNewRedoDoc,
const ScConversionParam& rConvParam );
virtual ~ScUndoConversion() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScAddress aCursorPos;
ScDocumentUniquePtr pUndoDoc; // Block mark and deleted data
ScAddress aNewCursorPos;
ScDocumentUniquePtr pRedoDoc; // Block mark and new data
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
ScConversionParam maConvParam; /// Conversion type and parameters.
void DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPos );
void SetChangeTrack();
};
class ScUndoRefConversion: public ScSimpleUndo
{
public:
ScUndoRefConversion( ScDocShell* pNewDocShell,
const ScRange& aMarkRange, const ScMarkData& rMark,
ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc, bool bNewMulti);
virtual ~ScUndoRefConversion() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScDocumentUniquePtr pUndoDoc;
ScDocumentUniquePtr pRedoDoc;
ScRange aRange;
bool bMulti;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
void DoChange( ScDocument* pRefDoc);
void SetChangeTrack();
};
class ScUndoListNames: public ScBlockUndo
{
public:
ScUndoListNames(ScDocShell* pNewDocShell,
const ScRange& rRange,
ScDocumentUniquePtr pNewUndoDoc, ScDocumentUniquePtr pNewRedoDoc);
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScDocumentUniquePtr xUndoDoc;
ScDocumentUniquePtr xRedoDoc;
void DoChange( ScDocument* pSrcDoc ) const;
};
class ScUndoConditionalFormat : public ScSimpleUndo
{
public:
ScUndoConditionalFormat( ScDocShell* pNewDocShell,
ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, const ScRange& rRange);
virtual ~ScUndoConditionalFormat() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
void DoChange(ScDocument* pDoc);
ScDocumentUniquePtr mpUndoDoc;
ScDocumentUniquePtr mpRedoDoc;
ScRange maRange;
};
class ScUndoConditionalFormatList : public ScSimpleUndo
{
public:
ScUndoConditionalFormatList( ScDocShell* pNewDocShell,
ScDocumentUniquePtr pUndoDoc, ScDocumentUniquePtr pRedoDoc, SCTAB nTab);
virtual ~ScUndoConditionalFormatList() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
void DoChange(const ScDocument* pDoc);
ScDocumentUniquePtr mpUndoDoc;
ScDocumentUniquePtr mpRedoDoc;
SCTAB mnTab;
};
class ScUndoUseScenario: public ScSimpleUndo
{
public:
ScUndoUseScenario( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
const ScArea& rDestArea, ScDocumentUniquePtr pNewUndoDoc,
const OUString& rNewName );
virtual ~ScUndoUseScenario() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScDocumentUniquePtr
pUndoDoc;
ScRange aRange;
ScMarkData aMarkData;
OUString aName;
};
class ScUndoSelectionStyle: public ScSimpleUndo
{
public:
ScUndoSelectionStyle( ScDocShell* pNewDocShell,
const ScMarkData& rMark,
const ScRange& rRange,
const OUString& rName,
ScDocumentUniquePtr pNewUndoDoc );
virtual ~ScUndoSelectionStyle() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScDocumentUniquePtr
pUndoDoc;
OUString aStyleName;
ScRange aRange;
void DoChange( const bool bUndo );
};
class ScUndoRefreshLink: public ScSimpleUndo
{
public:
ScUndoRefreshLink(ScDocShell* pNewDocShell,
ScDocumentUniquePtr pNewUndoDoc);
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScDocumentUniquePtr xUndoDoc;
ScDocumentUniquePtr xRedoDoc;
};
class ScUndoEnterMatrix: public ScBlockUndo
{
public:
ScUndoEnterMatrix( ScDocShell* pNewDocShell,
const ScRange& rArea,
ScDocumentUniquePtr pNewUndoDoc,
const OUString& rForm );
virtual ~ScUndoEnterMatrix() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScDocumentUniquePtr
pUndoDoc;
OUString aFormula;
sal_uLong nStartChangeAction;
sal_uLong nEndChangeAction;
void SetChangeTrack();
};
class ScUndoInsertAreaLink : public ScSimpleUndo
{
public:
ScUndoInsertAreaLink( ScDocShell* pShell,
const OUString& rDocName,
const OUString& rFltName, const OUString& rOptions,
const OUString& rAreaName, const ScRange& rDestRange,
sal_uLong nRefreshDelay );
virtual ~ScUndoInsertAreaLink() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
OUString aDocName;
OUString aFltName;
OUString aOptions;
OUString aAreaName;
ScRange aRange;
sal_uLong nRefreshDelay;
};
class ScUndoRemoveAreaLink : public ScSimpleUndo
{
public:
ScUndoRemoveAreaLink( ScDocShell* pShell,
const OUString& rDocName,
const OUString& rFltName, const OUString& rOptions,
const OUString& rAreaName, const ScRange& rDestRange,
sal_uLong nRefreshDelay );
virtual ~ScUndoRemoveAreaLink() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
OUString aDocName;
OUString aFltName;
OUString aOptions;
OUString aAreaName;
ScRange aRange;
sal_uLong nRefreshDelay;
};
class ScUndoUpdateAreaLink : public ScSimpleUndo //! also change BlockUndo?
{
public:
ScUndoUpdateAreaLink(ScDocShell* pShell,
const OUString& rOldD,
const OUString& rOldF, const OUString& rOldO,
const OUString& rOldA, const ScRange& rOldR,
sal_uLong nOldRD,
const OUString& rNewD,
const OUString& rNewF, const OUString& rNewO,
const OUString& rNewA, const ScRange& rNewR,
sal_uLong nNewRD,
ScDocumentUniquePtr pUndo, ScDocumentUniquePtr pRedo,
bool bDoInsert);
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
OUString aOldDoc;
OUString aOldFlt;
OUString aOldOpt;
OUString aOldArea;
ScRange aOldRange;
OUString aNewDoc;
OUString aNewFlt;
OUString aNewOpt;
OUString aNewArea;
ScRange aNewRange;
ScDocumentUniquePtr xUndoDoc;
ScDocumentUniquePtr xRedoDoc;
sal_uLong nOldRefresh;
sal_uLong nNewRefresh;
bool bWithInsert;
void DoChange( const bool bUndo ) const;
};
class ScUndoIndent: public ScBlockUndo
{
public:
ScUndoIndent( ScDocShell* pNewDocShell, const ScMarkData& rMark,
ScDocumentUniquePtr pNewUndoDoc, bool bIncrement );
virtual ~ScUndoIndent() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScDocumentUniquePtr
pUndoDoc;
bool bIsIncrement;
};
class ScUndoTransliterate: public ScBlockUndo
{
public:
ScUndoTransliterate( ScDocShell* pNewDocShell, const ScMarkData& rMark,
ScDocumentUniquePtr pNewUndoDoc, TransliterationFlags nType );
virtual ~ScUndoTransliterate() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScDocumentUniquePtr
pUndoDoc;
TransliterationFlags
nTransliterationType;
};
class ScUndoClearItems: public ScBlockUndo
{
public:
ScUndoClearItems( ScDocShell* pNewDocShell, const ScMarkData& rMark,
ScDocumentUniquePtr pNewUndoDoc, const sal_uInt16* pW );
virtual ~ScUndoClearItems() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScMarkData aMarkData;
ScDocumentUniquePtr
pUndoDoc;
std::unique_ptr<sal_uInt16[]>
pWhich;
};
class ScUndoRemoveBreaks: public ScSimpleUndo
{
public:
ScUndoRemoveBreaks( ScDocShell* pNewDocShell,
SCTAB nNewTab, ScDocumentUniquePtr pNewUndoDoc );
virtual ~ScUndoRemoveBreaks() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
SCTAB nTab;
ScDocumentUniquePtr
pUndoDoc;
};
class ScUndoRemoveMerge: public ScBlockUndo
{
public:
ScUndoRemoveMerge( ScDocShell* pNewDocShell,
const ScCellMergeOption& rOption,
ScDocumentUniquePtr pNewUndoDoc );
ScUndoRemoveMerge( ScDocShell* pNewDocShell,
const ScRange& rRange,
ScDocumentUniquePtr pNewUndoDoc );
virtual ~ScUndoRemoveMerge() override;
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
ScDocument* GetUndoDoc();
void AddCellMergeOption( const ScCellMergeOption& rOption );
private:
void SetCurTab();
std::vector<ScCellMergeOption> maOptions;
ScDocumentUniquePtr pUndoDoc;
};
class ScUndoBorder: public ScBlockUndo
{
public:
ScUndoBorder(ScDocShell* pNewDocShell,
const ScRangeList& rRangeList,
ScDocumentUniquePtr pNewUndoDoc,
const SvxBoxItem& rNewOuter,
const SvxBoxInfoItem& rNewInner);
virtual void Undo() override;
virtual void Redo() override;
virtual void Repeat(SfxRepeatTarget& rTarget) override;
virtual bool CanRepeat(SfxRepeatTarget& rTarget) const override;
virtual OUString GetComment() const override;
private:
ScDocumentUniquePtr xUndoDoc;
std::unique_ptr<ScRangeList> xRanges;
std::unique_ptr<SvxBoxItem> xOuter;
std::unique_ptr<SvxBoxInfoItem> xInner;
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|