1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "undobase.hxx"
22 #include <markdata.hxx>
23 #include "spellparam.hxx"
24 #include "cellmergeoption.hxx"
25 #include <paramisc.hxx>
26 #include <editeng/boxitem.hxx>
35 class ScEditDataArray
;
37 class ScUndoInsertCells
: public ScMoveUndo
40 ScUndoInsertCells( ScDocShell
* pNewDocShell
,
41 const ScRange
& rRange
,
42 SCTAB nNewCount
, std::unique_ptr
<SCTAB
[]> pNewTabs
, std::unique_ptr
<SCTAB
[]> pNewScenarios
,
43 InsCellCmd eNewCmd
, ScDocumentUniquePtr pUndoDocument
, std::unique_ptr
<ScRefUndoData
> pRefData
,
44 bool bNewPartOfPaste
);
45 virtual ~ScUndoInsertCells() override
;
47 virtual void Undo() override
;
48 virtual void Redo() override
;
49 virtual void Repeat( SfxRepeatTarget
& rTarget
) override
;
50 virtual bool CanRepeat( SfxRepeatTarget
& rTarget
) const override
;
52 virtual OUString
GetComment() const override
;
54 virtual bool Merge( SfxUndoAction
*pNextAction
) override
;
59 std::unique_ptr
<SCTAB
[]>
61 std::unique_ptr
<SCTAB
[]>
63 sal_uLong nEndChangeAction
;
66 std::unique_ptr
<SfxUndoAction
>
69 void DoChange ( const bool bUndo
);
70 void SetChangeTrack();
73 class ScUndoDeleteCells
: public ScMoveUndo
76 ScUndoDeleteCells( ScDocShell
* pNewDocShell
,
77 const ScRange
& rRange
,
78 SCTAB nNewCount
, std::unique_ptr
<SCTAB
[]> pNewTabs
, std::unique_ptr
<SCTAB
[]> pNewScenarios
,
79 DelCellCmd eNewCmd
, ScDocumentUniquePtr pUndoDocument
, std::unique_ptr
<ScRefUndoData
> pRefData
);
80 virtual ~ScUndoDeleteCells() override
;
82 virtual void Undo() override
;
83 virtual void Redo() override
;
84 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
85 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
87 virtual OUString
GetComment() const override
;
92 std::unique_ptr
<SCTAB
[]>
94 std::unique_ptr
<SCTAB
[]>
96 sal_uLong nStartChangeAction
;
97 sal_uLong nEndChangeAction
;
100 void DoChange ( const bool bUndo
);
101 void SetChangeTrack();
104 class ScUndoDeleteMulti
: public ScMoveUndo
108 ScUndoDeleteMulti( ScDocShell
* pNewDocShell
,
109 bool bNewRows
, bool bNeedsRefresh
, SCTAB nNewTab
,
110 std::vector
<sc::ColRowSpan
>&& rSpans
,
111 ScDocumentUniquePtr pUndoDocument
, std::unique_ptr
<ScRefUndoData
> pRefData
);
113 virtual ~ScUndoDeleteMulti() override
;
115 virtual void Undo() override
;
116 virtual void Redo() override
;
117 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
118 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
120 virtual OUString
GetComment() const override
;
126 std::vector
<sc::ColRowSpan
> maSpans
;
127 sal_uLong nStartChangeAction
;
128 sal_uLong nEndChangeAction
;
130 void DoChange() const;
131 void SetChangeTrack();
134 class SAL_DLLPUBLIC_RTTI ScUndoCut
: public ScBlockUndo
137 SC_DLLPUBLIC
ScUndoCut(ScDocShell
* pNewDocShell
,
138 const ScRange
& aRange
, // adjusted for merged cells
139 const ScAddress
& aOldEnd
, // end position without adjustment
140 const ScMarkData
& rMark
, // selected sheets
141 ScDocumentUniquePtr pNewUndoDoc
);
142 virtual ~ScUndoCut() override
;
144 virtual void Undo() override
;
145 virtual void Redo() override
;
146 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
147 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
149 virtual OUString
GetComment() const override
;
152 ScMarkData aMarkData
;
155 ScRange aExtendedRange
;
156 sal_uLong nStartChangeAction
;
157 sal_uLong nEndChangeAction
;
159 void DoChange( const bool bUndo
);
160 void SetChangeTrack();
163 struct ScUndoPasteOptions
165 ScPasteFunc nFunction
;
166 bool bSkipEmptyCells
;
169 InsCellCmd eMoveMode
;
171 ScUndoPasteOptions() :
172 nFunction( ScPasteFunc::NONE
),
173 bSkipEmptyCells( false ),
176 eMoveMode( INS_NONE
)
180 class SAL_DLLPUBLIC_RTTI ScUndoPaste
: public ScMultiBlockUndo
183 SC_DLLPUBLIC
ScUndoPaste(ScDocShell
* pNewDocShell
, const ScRangeList
& rRanges
,
184 const ScMarkData
& rMark
,
185 ScDocumentUniquePtr pNewUndoDoc
, ScDocumentUniquePtr pNewRedoDoc
,
186 InsertDeleteFlags nNewFlags
,
187 std::unique_ptr
<ScRefUndoData
> pRefData
,
188 bool bRedoIsFilled
= true,
189 const ScUndoPasteOptions
* pOptions
= nullptr);
190 virtual ~ScUndoPaste() override
;
192 virtual void Undo() override
;
193 virtual void Redo() override
;
194 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
195 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
197 virtual OUString
GetComment() const override
;
200 ScMarkData aMarkData
;
201 ScDocumentUniquePtr pUndoDoc
;
202 ScDocumentUniquePtr pRedoDoc
;
203 InsertDeleteFlags nFlags
;
204 std::unique_ptr
<ScRefUndoData
> pRefUndoData
;
205 std::unique_ptr
<ScRefUndoData
> pRefRedoData
;
206 sal_uLong nStartChangeAction
;
207 sal_uLong nEndChangeAction
;
209 ScUndoPasteOptions aPasteOptions
;
211 void DoChange(bool bUndo
);
212 void SetChangeTrack();
215 class ScUndoDragDrop
: public ScMoveUndo
218 ScUndoDragDrop( ScDocShell
* pNewDocShell
,
219 const ScRange
& rRange
, const ScAddress
& aNewDestPos
, bool bNewCut
,
220 ScDocumentUniquePtr pUndoDocument
,
222 virtual ~ScUndoDragDrop() override
;
224 virtual void Undo() override
;
225 virtual void Redo() override
;
226 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
227 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
229 virtual OUString
GetComment() const override
;
232 sal_uInt16 mnPaintExtFlags
;
233 ScRangeList maPaintRanges
;
237 sal_uLong nStartChangeAction
;
238 sal_uLong nEndChangeAction
;
240 bool bKeepScenarioFlags
;
242 void PaintArea( ScRange aRange
, sal_uInt16 nExtFlags
) const;
243 void DoUndo( ScRange aRange
);
245 void SetChangeTrack();
248 class ScUndoDeleteContents
: public ScSimpleUndo
251 ScUndoDeleteContents( ScDocShell
* pNewDocShell
,
252 const ScMarkData
& rMark
,
253 const ScRange
& rRange
,
254 ScDocumentUniquePtr
&& pNewUndoDoc
, bool bNewMulti
,
255 InsertDeleteFlags nNewFlags
, bool bObjects
);
256 virtual ~ScUndoDeleteContents() override
;
258 virtual void Undo() override
;
259 virtual void Redo() override
;
260 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
261 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
263 virtual OUString
GetComment() const override
;
265 void SetDataSpans( const std::shared_ptr
<DataSpansType
>& pSpans
);
268 std::shared_ptr
<DataSpansType
> mpDataSpans
; // Spans of non-empty cells.
271 ScMarkData aMarkData
;
272 ScDocumentUniquePtr pUndoDoc
; // Block mark and deleted data
273 std::unique_ptr
<SdrUndoAction
> pDrawUndo
; // Deleted objects
274 sal_uLong nStartChangeAction
;
275 sal_uLong nEndChangeAction
;
276 InsertDeleteFlags nFlags
;
277 bool bMulti
; // Multi selection
279 void DoChange( const bool bUndo
);
280 void SetChangeTrack();
283 class ScUndoFillTable
: public ScSimpleUndo
286 ScUndoFillTable( ScDocShell
* pNewDocShell
,
287 const ScMarkData
& rMark
,
288 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
289 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
290 ScDocumentUniquePtr pNewUndoDoc
, bool bNewMulti
, SCTAB nSrc
,
291 InsertDeleteFlags nFlg
, ScPasteFunc nFunc
, bool bSkip
, bool bLink
);
292 virtual ~ScUndoFillTable() override
;
294 virtual void Undo() override
;
295 virtual void Redo() override
;
296 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
297 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
299 virtual OUString
GetComment() const override
;
303 ScMarkData aMarkData
;
305 pUndoDoc
; // Block mark and deleted data
306 sal_uLong nStartChangeAction
;
307 sal_uLong nEndChangeAction
;
308 InsertDeleteFlags nFlags
;
309 ScPasteFunc nFunction
;
311 bool bMulti
; // Multi selection
315 void DoChange( const bool bUndo
);
316 void SetChangeTrack();
319 class ScUndoSelectionAttr
: public ScSimpleUndo
322 ScUndoSelectionAttr( ScDocShell
* pNewDocShell
,
323 const ScMarkData
& rMark
,
324 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
325 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
326 ScDocumentUniquePtr pNewUndoDoc
, bool bNewMulti
,
327 const ScPatternAttr
* pNewApply
,
328 const SvxBoxItem
* pNewOuter
= nullptr,
329 const SvxBoxInfoItem
* pNewInner
= nullptr,
330 const ScRange
* pRangeCover
= nullptr );
331 virtual ~ScUndoSelectionAttr() override
;
333 virtual void Undo() override
;
334 virtual void Redo() override
;
335 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
336 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
338 virtual OUString
GetComment() const override
;
340 ScEditDataArray
* GetDataArray();
342 ScMarkData aMarkData
;
345 std::unique_ptr
<ScEditDataArray
> mpDataArray
;
346 ScDocumentUniquePtr pUndoDoc
;
348 const CellAttributeHolder aApplyPattern
;
350 SfxPoolItemHolder maLineOuter
;
351 SfxPoolItemHolder maLineInner
;
353 void DoChange( const bool bUndo
);
354 void ChangeEditData( const bool bUndo
);
357 class ScUndoWidthOrHeight
: public ScSimpleUndo
360 ScUndoWidthOrHeight( ScDocShell
* pNewDocShell
,
361 const ScMarkData
& rMark
,
362 SCCOLROW nNewStart
, SCTAB nNewStartTab
,
363 SCCOLROW nNewEnd
, SCTAB nNewEndTab
,
364 ScDocumentUniquePtr pNewUndoDoc
,
365 std::vector
<sc::ColRowSpan
>&& rRanges
,
366 std::unique_ptr
<ScOutlineTable
> pNewUndoTab
,
367 ScSizeMode eNewMode
, sal_uInt16 nNewSizeTwips
,
369 virtual ~ScUndoWidthOrHeight() override
;
371 virtual void Undo() override
;
372 virtual void Redo() override
;
373 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
374 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
376 virtual OUString
GetComment() const override
;
379 ScMarkData aMarkData
;
384 ScDocumentUniquePtr pUndoDoc
;
385 std::unique_ptr
<ScOutlineTable
> pUndoTab
;
386 std::vector
<sc::ColRowSpan
> maRanges
;
390 std::unique_ptr
<SdrUndoAction
> pDrawUndo
;
393 class ScUndoAutoFill
: public ScBlockUndo
396 ScUndoAutoFill( ScDocShell
* pNewDocShell
,
397 const ScRange
& rRange
, const ScRange
& rSourceArea
,
398 ScDocumentUniquePtr pNewUndoDoc
, const ScMarkData
& rMark
,
400 FillCmd eNewFillCmd
, FillDateCmd eNewFillDateCmd
,
401 double fNewStartValue
, double fNewStepValue
, double fNewMaxValue
);
402 virtual ~ScUndoAutoFill() override
;
404 virtual void Undo() override
;
405 virtual void Redo() override
;
406 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
407 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
409 virtual OUString
GetComment() const override
;
413 ScMarkData aMarkData
;
418 FillDateCmd eFillDateCmd
;
422 sal_uLong nStartChangeAction
;
423 sal_uLong nEndChangeAction
;
425 void SetChangeTrack();
428 class ScUndoMerge
: public ScSimpleUndo
431 ScUndoMerge( ScDocShell
* pNewDocShell
, ScCellMergeOption aOption
,
432 bool bMergeContents
, ScDocumentUniquePtr pUndoDoc
,
433 std::unique_ptr
<SdrUndoAction
> pDrawUndo
);
434 virtual ~ScUndoMerge() override
;
436 virtual void Undo() override
;
437 virtual void Redo() override
;
438 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
439 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
441 virtual OUString
GetComment() const override
;
444 ScCellMergeOption maOption
;
445 bool mbMergeContents
; // Merge contents in Redo().
446 ScDocumentUniquePtr mxUndoDoc
; // when data is merged
447 std::unique_ptr
<SdrUndoAction
> mpDrawUndo
;
449 void DoChange( bool bUndo
) const;
452 class ScUndoAutoFormat
: public ScBlockUndo
455 ScUndoAutoFormat( ScDocShell
* pNewDocShell
,
456 const ScRange
& rRange
, ScDocumentUniquePtr pNewUndoDoc
,
457 const ScMarkData
& rMark
,
458 bool bNewSize
, sal_uInt16 nNewFormatNo
);
459 virtual ~ScUndoAutoFormat() override
;
461 virtual void Undo() override
;
462 virtual void Redo() override
;
463 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
464 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
466 virtual OUString
GetComment() const override
;
470 pUndoDoc
; // deleted data
471 ScMarkData aMarkData
;
473 sal_uInt16 nFormatNo
;
476 class ScUndoReplace
: public ScSimpleUndo
479 ScUndoReplace( ScDocShell
* pNewDocShell
,
480 const ScMarkData
& rMark
,
481 SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
,
482 OUString aNewUndoStr
, ScDocumentUniquePtr pNewUndoDoc
,
483 const SvxSearchItem
* pItem
);
484 virtual ~ScUndoReplace() override
;
486 virtual void Undo() override
;
487 virtual void Redo() override
;
488 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
489 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
491 virtual OUString
GetComment() const override
;
494 ScAddress aCursorPos
;
495 ScMarkData aMarkData
;
496 OUString aUndoStr
; // Data at single selection
497 ScDocumentUniquePtr pUndoDoc
; // Block mark and deleted data
498 std::unique_ptr
<SvxSearchItem
> pSearchItem
;
499 sal_uLong nStartChangeAction
;
500 sal_uLong nEndChangeAction
;
502 void SetChangeTrack();
505 class ScUndoTabOp
: public ScSimpleUndo
508 ScUndoTabOp( ScDocShell
* pNewDocShell
,
509 SCCOL nStartX
, SCROW nStartY
, SCTAB nStartZ
,
510 SCCOL nEndX
, SCROW nEndY
, SCTAB nEndZ
,
511 ScDocumentUniquePtr pNewUndoDoc
,
512 const ScRefAddress
& rFormulaCell
,
513 const ScRefAddress
& rFormulaEnd
,
514 const ScRefAddress
& rRowCell
,
515 const ScRefAddress
& rColCell
,
516 ScTabOpParam::Mode eMode
);
517 virtual ~ScUndoTabOp() override
;
519 virtual void Undo() override
;
520 virtual void Redo() override
;
521 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
522 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
524 virtual OUString
GetComment() const override
;
529 pUndoDoc
; // Deleted data
530 ScRefAddress theFormulaCell
;
531 ScRefAddress theFormulaEnd
;
532 ScRefAddress theRowCell
;
533 ScRefAddress theColCell
;
534 ScTabOpParam::Mode meMode
;
537 class ScUndoConversion
: public ScSimpleUndo
541 ScUndoConversion( ScDocShell
* pNewDocShell
, const ScMarkData
& rMark
,
542 SCCOL nCurX
, SCROW nCurY
, SCTAB nCurZ
, ScDocumentUniquePtr pNewUndoDoc
,
543 SCCOL nNewX
, SCROW nNewY
, SCTAB nNewZ
, ScDocumentUniquePtr pNewRedoDoc
,
544 ScConversionParam aConvParam
);
545 virtual ~ScUndoConversion() override
;
547 virtual void Undo() override
;
548 virtual void Redo() override
;
549 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
550 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
552 virtual OUString
GetComment() const override
;
555 ScMarkData aMarkData
;
556 ScAddress aCursorPos
;
557 ScDocumentUniquePtr pUndoDoc
; // Block mark and deleted data
558 ScAddress aNewCursorPos
;
559 ScDocumentUniquePtr pRedoDoc
; // Block mark and new data
560 sal_uLong nStartChangeAction
;
561 sal_uLong nEndChangeAction
;
562 ScConversionParam maConvParam
; /// Conversion type and parameters.
564 void DoChange( ScDocument
* pRefDoc
, const ScAddress
& rCursorPos
);
565 void SetChangeTrack();
568 class ScUndoRefConversion
: public ScSimpleUndo
571 ScUndoRefConversion( ScDocShell
* pNewDocShell
,
572 const ScRange
& aMarkRange
, const ScMarkData
& rMark
,
573 ScDocumentUniquePtr pNewUndoDoc
, ScDocumentUniquePtr pNewRedoDoc
, bool bNewMulti
);
574 virtual ~ScUndoRefConversion() override
;
576 virtual void Undo() override
;
577 virtual void Redo() override
;
578 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
579 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
581 virtual OUString
GetComment() const override
;
584 ScMarkData aMarkData
;
585 ScDocumentUniquePtr pUndoDoc
;
586 ScDocumentUniquePtr pRedoDoc
;
589 sal_uLong nStartChangeAction
;
590 sal_uLong nEndChangeAction
;
592 void DoChange( ScDocument
* pRefDoc
);
593 void SetChangeTrack();
596 class ScUndoListNames
: public ScBlockUndo
599 ScUndoListNames(ScDocShell
* pNewDocShell
,
600 const ScRange
& rRange
,
601 ScDocumentUniquePtr pNewUndoDoc
, ScDocumentUniquePtr pNewRedoDoc
);
603 virtual void Undo() override
;
604 virtual void Redo() override
;
605 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
606 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
608 virtual OUString
GetComment() const override
;
611 ScDocumentUniquePtr xUndoDoc
;
612 ScDocumentUniquePtr xRedoDoc
;
614 void DoChange( ScDocument
* pSrcDoc
) const;
617 // This class only uses conditional format lists in the undo/redo documents;
618 // no other tab data is needed in the documents
619 class ScUndoConditionalFormat
: public ScSimpleUndo
622 ScUndoConditionalFormat( ScDocShell
* pNewDocShell
, SCTAB nTab
);
623 virtual ~ScUndoConditionalFormat() override
;
625 void setRedoData() { mpRedoDoc
= createUndoRedoData(); }
627 virtual void Undo() override
;
628 virtual void Redo() override
;
629 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
630 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
632 virtual OUString
GetComment() const override
;
635 ScDocumentUniquePtr
createUndoRedoData();
636 void DoChange(ScDocument
* pDoc
);
638 ScDocumentUniquePtr mpUndoDoc
;
639 ScDocumentUniquePtr mpRedoDoc
;
642 class ScUndoConditionalFormatList
: public ScSimpleUndo
645 ScUndoConditionalFormatList( ScDocShell
* pNewDocShell
,
646 ScDocumentUniquePtr pUndoDoc
, ScDocumentUniquePtr pRedoDoc
, SCTAB nTab
);
647 virtual ~ScUndoConditionalFormatList() override
;
649 virtual void Undo() override
;
650 virtual void Redo() override
;
651 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
652 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
654 virtual OUString
GetComment() const override
;
657 void DoChange(const ScDocument
* pDoc
);
658 ScDocumentUniquePtr mpUndoDoc
;
659 ScDocumentUniquePtr mpRedoDoc
;
663 class ScUndoUseScenario
: public ScSimpleUndo
666 ScUndoUseScenario( ScDocShell
* pNewDocShell
,
667 const ScMarkData
& rMark
,
668 const ScArea
& rDestArea
, ScDocumentUniquePtr pNewUndoDoc
,
670 virtual ~ScUndoUseScenario() override
;
672 virtual void Undo() override
;
673 virtual void Redo() override
;
674 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
675 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
677 virtual OUString
GetComment() const override
;
683 ScMarkData aMarkData
;
687 class ScUndoSelectionStyle
: public ScSimpleUndo
690 ScUndoSelectionStyle( ScDocShell
* pNewDocShell
,
691 const ScMarkData
& rMark
,
692 const ScRange
& rRange
,
694 ScDocumentUniquePtr pNewUndoDoc
);
695 virtual ~ScUndoSelectionStyle() override
;
697 virtual void Undo() override
;
698 virtual void Redo() override
;
699 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
700 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
702 virtual OUString
GetComment() const override
;
705 ScMarkData aMarkData
;
711 void DoChange( const bool bUndo
);
714 class ScUndoRefreshLink
: public ScSimpleUndo
717 ScUndoRefreshLink(ScDocShell
* pNewDocShell
,
718 ScDocumentUniquePtr pNewUndoDoc
);
720 virtual void Undo() override
;
721 virtual void Redo() override
;
722 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
723 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
725 virtual OUString
GetComment() const override
;
728 ScDocumentUniquePtr xUndoDoc
;
729 ScDocumentUniquePtr xRedoDoc
;
732 class ScUndoEnterMatrix
: public ScBlockUndo
735 ScUndoEnterMatrix( ScDocShell
* pNewDocShell
,
736 const ScRange
& rArea
,
737 ScDocumentUniquePtr pNewUndoDoc
,
739 virtual ~ScUndoEnterMatrix() override
;
741 virtual void Undo() override
;
742 virtual void Redo() override
;
743 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
744 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
746 virtual OUString
GetComment() const override
;
752 sal_uLong nStartChangeAction
;
753 sal_uLong nEndChangeAction
;
755 void SetChangeTrack();
758 class ScUndoInsertAreaLink
: public ScSimpleUndo
761 ScUndoInsertAreaLink( ScDocShell
* pShell
,
763 OUString aFltName
, OUString aOptions
,
764 OUString aAreaName
, const ScRange
& rDestRange
,
765 sal_uLong nRefreshDelay
);
766 virtual ~ScUndoInsertAreaLink() override
;
768 virtual void Undo() override
;
769 virtual void Redo() override
;
770 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
771 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
773 virtual OUString
GetComment() const override
;
781 sal_uLong nRefreshDelay
;
784 class ScUndoRemoveAreaLink
: public ScSimpleUndo
787 ScUndoRemoveAreaLink( ScDocShell
* pShell
,
789 OUString aFltName
, OUString aOptions
,
790 OUString aAreaName
, const ScRange
& rDestRange
,
791 sal_uLong nRefreshDelay
);
792 virtual ~ScUndoRemoveAreaLink() override
;
794 virtual void Undo() override
;
795 virtual void Redo() override
;
796 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
797 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
799 virtual OUString
GetComment() const override
;
807 sal_uLong nRefreshDelay
;
810 class ScUndoUpdateAreaLink
: public ScSimpleUndo
//! also change BlockUndo?
813 ScUndoUpdateAreaLink(ScDocShell
* pShell
,
815 OUString aOldF
, OUString aOldO
,
816 OUString aOldA
, const ScRange
& rOldR
,
819 OUString aNewF
, OUString aNewO
,
820 OUString aNewA
, const ScRange
& rNewR
,
822 ScDocumentUniquePtr pUndo
, ScDocumentUniquePtr pRedo
,
825 virtual void Undo() override
;
826 virtual void Redo() override
;
827 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
828 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
830 virtual OUString
GetComment() const override
;
843 ScDocumentUniquePtr xUndoDoc
;
844 ScDocumentUniquePtr xRedoDoc
;
845 sal_uLong nOldRefresh
;
846 sal_uLong nNewRefresh
;
849 void DoChange( const bool bUndo
) const;
852 class ScUndoIndent
: public ScBlockUndo
855 ScUndoIndent( ScDocShell
* pNewDocShell
, const ScMarkData
& rMark
,
856 ScDocumentUniquePtr pNewUndoDoc
, bool bIncrement
);
857 virtual ~ScUndoIndent() override
;
859 virtual void Undo() override
;
860 virtual void Redo() override
;
861 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
862 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
864 virtual OUString
GetComment() const override
;
867 ScMarkData aMarkData
;
873 class ScUndoTransliterate
: public ScBlockUndo
876 ScUndoTransliterate( ScDocShell
* pNewDocShell
, const ScMarkData
& rMark
,
877 ScDocumentUniquePtr pNewUndoDoc
, TransliterationFlags nType
);
878 virtual ~ScUndoTransliterate() override
;
880 virtual void Undo() override
;
881 virtual void Redo() override
;
882 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
883 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
885 virtual OUString
GetComment() const override
;
888 ScMarkData aMarkData
;
892 nTransliterationType
;
895 class ScUndoClearItems
: public ScBlockUndo
898 ScUndoClearItems( ScDocShell
* pNewDocShell
, const ScMarkData
& rMark
,
899 ScDocumentUniquePtr pNewUndoDoc
, const sal_uInt16
* pW
);
900 virtual ~ScUndoClearItems() override
;
902 virtual void Undo() override
;
903 virtual void Redo() override
;
904 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
905 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
907 virtual OUString
GetComment() const override
;
910 ScMarkData aMarkData
;
913 std::unique_ptr
<sal_uInt16
[]>
917 class ScUndoRemoveBreaks
: public ScSimpleUndo
920 ScUndoRemoveBreaks( ScDocShell
* pNewDocShell
,
921 SCTAB nNewTab
, ScDocumentUniquePtr pNewUndoDoc
);
922 virtual ~ScUndoRemoveBreaks() override
;
924 virtual void Undo() override
;
925 virtual void Redo() override
;
926 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
927 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
929 virtual OUString
GetComment() const override
;
937 class ScUndoRemoveMerge
: public ScBlockUndo
940 ScUndoRemoveMerge( ScDocShell
* pNewDocShell
,
941 const ScCellMergeOption
& rOption
,
942 ScDocumentUniquePtr pNewUndoDoc
);
943 ScUndoRemoveMerge( ScDocShell
* pNewDocShell
,
944 const ScRange
& rRange
,
945 ScDocumentUniquePtr pNewUndoDoc
);
946 virtual ~ScUndoRemoveMerge() override
;
948 virtual void Undo() override
;
949 virtual void Redo() override
;
950 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
951 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
953 virtual OUString
GetComment() const override
;
955 ScDocument
* GetUndoDoc();
956 void AddCellMergeOption( const ScCellMergeOption
& rOption
);
961 std::vector
<ScCellMergeOption
> maOptions
;
962 ScDocumentUniquePtr pUndoDoc
;
965 class ScUndoBorder
: public ScBlockUndo
968 ScUndoBorder(ScDocShell
* pNewDocShell
,
969 const ScRangeList
& rRangeList
,
970 ScDocumentUniquePtr pNewUndoDoc
,
971 const SvxBoxItem
& rNewOuter
,
972 const SvxBoxInfoItem
& rNewInner
);
974 virtual void Undo() override
;
975 virtual void Redo() override
;
976 virtual void Repeat(SfxRepeatTarget
& rTarget
) override
;
977 virtual bool CanRepeat(SfxRepeatTarget
& rTarget
) const override
;
979 virtual OUString
GetComment() const override
;
982 ScDocumentUniquePtr xUndoDoc
;
983 std::unique_ptr
<ScRangeList
> xRanges
;
984 std::unique_ptr
<SvxBoxItem
> xOuter
;
985 std::unique_ptr
<SvxBoxInfoItem
> xInner
;
988 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */