tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / inc / undoblk.hxx
blob8c8805b3dce8015e73bafaa2a50a5800c5b8a43f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
19 #pragma once
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>
28 #include <memory>
30 class ScDocShell;
31 class ScOutlineTable;
32 class ScPatternAttr;
33 class SvxSearchItem;
34 class SdrUndoAction;
35 class ScEditDataArray;
37 class ScUndoInsertCells: public ScMoveUndo
39 public:
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;
56 private:
57 ScRange aEffRange;
58 SCTAB nCount;
59 std::unique_ptr<SCTAB[]>
60 pTabs;
61 std::unique_ptr<SCTAB[]>
62 pScenarios;
63 sal_uLong nEndChangeAction;
64 InsCellCmd eCmd;
65 bool bPartOfPaste;
66 std::unique_ptr<SfxUndoAction>
67 pPasteUndo;
69 void DoChange ( const bool bUndo );
70 void SetChangeTrack();
73 class ScUndoDeleteCells: public ScMoveUndo
75 public:
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;
89 private:
90 ScRange aEffRange;
91 SCTAB nCount;
92 std::unique_ptr<SCTAB[]>
93 pTabs;
94 std::unique_ptr<SCTAB[]>
95 pScenarios;
96 sal_uLong nStartChangeAction;
97 sal_uLong nEndChangeAction;
98 DelCellCmd eCmd;
100 void DoChange ( const bool bUndo );
101 void SetChangeTrack();
104 class ScUndoDeleteMulti: public ScMoveUndo
106 public:
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;
122 private:
123 bool mbRows:1;
124 bool mbRefresh:1;
125 SCTAB nTab;
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
136 public:
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;
151 private:
152 ScMarkData aMarkData;
153 ScDocumentUniquePtr
154 pUndoDoc;
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;
167 bool bTranspose;
168 bool bAsLink;
169 InsCellCmd eMoveMode;
171 ScUndoPasteOptions() :
172 nFunction( ScPasteFunc::NONE ),
173 bSkipEmptyCells( false ),
174 bTranspose( false ),
175 bAsLink( false ),
176 eMoveMode( INS_NONE )
180 class SAL_DLLPUBLIC_RTTI ScUndoPaste: public ScMultiBlockUndo
182 public:
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;
199 private:
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;
208 bool bRedoFilled;
209 ScUndoPasteOptions aPasteOptions;
211 void DoChange(bool bUndo);
212 void SetChangeTrack();
215 class ScUndoDragDrop: public ScMoveUndo
217 public:
218 ScUndoDragDrop( ScDocShell* pNewDocShell,
219 const ScRange& rRange, const ScAddress& aNewDestPos, bool bNewCut,
220 ScDocumentUniquePtr pUndoDocument,
221 bool bScenario );
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;
231 private:
232 sal_uInt16 mnPaintExtFlags;
233 ScRangeList maPaintRanges;
235 ScRange aSrcRange;
236 ScRange aDestRange;
237 sal_uLong nStartChangeAction;
238 sal_uLong nEndChangeAction;
239 bool bCut;
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
250 public:
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 );
267 private:
268 std::shared_ptr<DataSpansType> mpDataSpans; // Spans of non-empty cells.
270 ScRange aRange;
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
285 public:
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;
301 private:
302 ScRange aRange;
303 ScMarkData aMarkData;
304 ScDocumentUniquePtr
305 pUndoDoc; // Block mark and deleted data
306 sal_uLong nStartChangeAction;
307 sal_uLong nEndChangeAction;
308 InsertDeleteFlags nFlags;
309 ScPasteFunc nFunction;
310 SCTAB nSrcTab;
311 bool bMulti; // Multi selection
312 bool bSkipEmpty;
313 bool bAsLink;
315 void DoChange( const bool bUndo );
316 void SetChangeTrack();
319 class ScUndoSelectionAttr: public ScSimpleUndo
321 public:
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();
341 private:
342 ScMarkData aMarkData;
343 ScRange aRange;
344 ScRange aRangeCover;
345 std::unique_ptr<ScEditDataArray> mpDataArray;
346 ScDocumentUniquePtr pUndoDoc;
347 bool bMulti;
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
359 public:
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,
368 bool bNewWidth );
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;
378 private:
379 ScMarkData aMarkData;
380 SCCOLROW nStart;
381 SCCOLROW nEnd;
382 SCTAB nStartTab;
383 SCTAB nEndTab;
384 ScDocumentUniquePtr pUndoDoc;
385 std::unique_ptr<ScOutlineTable> pUndoTab;
386 std::vector<sc::ColRowSpan> maRanges;
387 sal_uInt16 nNewSize;
388 bool bWidth;
389 ScSizeMode eMode;
390 std::unique_ptr<SdrUndoAction> pDrawUndo;
393 class ScUndoAutoFill: public ScBlockUndo
395 public:
396 ScUndoAutoFill( ScDocShell* pNewDocShell,
397 const ScRange& rRange, const ScRange& rSourceArea,
398 ScDocumentUniquePtr pNewUndoDoc, const ScMarkData& rMark,
399 FillDir eNewFillDir,
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;
411 private:
412 ScRange aSource;
413 ScMarkData aMarkData;
414 ScDocumentUniquePtr
415 pUndoDoc;
416 FillDir eFillDir;
417 FillCmd eFillCmd;
418 FillDateCmd eFillDateCmd;
419 double fStartValue;
420 double fStepValue;
421 double fMaxValue;
422 sal_uLong nStartChangeAction;
423 sal_uLong nEndChangeAction;
425 void SetChangeTrack();
428 class ScUndoMerge: public ScSimpleUndo
430 public:
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;
443 private:
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
454 public:
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;
468 private:
469 ScDocumentUniquePtr
470 pUndoDoc; // deleted data
471 ScMarkData aMarkData;
472 bool bSize;
473 sal_uInt16 nFormatNo;
476 class ScUndoReplace: public ScSimpleUndo
478 public:
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;
493 private:
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
507 public:
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;
526 private:
527 ScRange aRange;
528 ScDocumentUniquePtr
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
539 public:
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;
554 private:
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
570 public:
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;
583 private:
584 ScMarkData aMarkData;
585 ScDocumentUniquePtr pUndoDoc;
586 ScDocumentUniquePtr pRedoDoc;
587 ScRange aRange;
588 bool bMulti;
589 sal_uLong nStartChangeAction;
590 sal_uLong nEndChangeAction;
592 void DoChange( ScDocument* pRefDoc);
593 void SetChangeTrack();
596 class ScUndoListNames: public ScBlockUndo
598 public:
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;
610 private:
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
621 public:
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;
634 private:
635 ScDocumentUniquePtr createUndoRedoData();
636 void DoChange(ScDocument* pDoc);
637 SCTAB mnTab;
638 ScDocumentUniquePtr mpUndoDoc;
639 ScDocumentUniquePtr mpRedoDoc;
642 class ScUndoConditionalFormatList : public ScSimpleUndo
644 public:
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;
656 private:
657 void DoChange(const ScDocument* pDoc);
658 ScDocumentUniquePtr mpUndoDoc;
659 ScDocumentUniquePtr mpRedoDoc;
660 SCTAB mnTab;
663 class ScUndoUseScenario: public ScSimpleUndo
665 public:
666 ScUndoUseScenario( ScDocShell* pNewDocShell,
667 const ScMarkData& rMark,
668 const ScArea& rDestArea, ScDocumentUniquePtr pNewUndoDoc,
669 OUString aNewName );
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;
679 private:
680 ScDocumentUniquePtr
681 pUndoDoc;
682 ScRange aRange;
683 ScMarkData aMarkData;
684 OUString aName;
687 class ScUndoSelectionStyle: public ScSimpleUndo
689 public:
690 ScUndoSelectionStyle( ScDocShell* pNewDocShell,
691 const ScMarkData& rMark,
692 const ScRange& rRange,
693 OUString aName,
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;
704 private:
705 ScMarkData aMarkData;
706 ScDocumentUniquePtr
707 pUndoDoc;
708 OUString aStyleName;
709 ScRange aRange;
711 void DoChange( const bool bUndo );
714 class ScUndoRefreshLink: public ScSimpleUndo
716 public:
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;
727 private:
728 ScDocumentUniquePtr xUndoDoc;
729 ScDocumentUniquePtr xRedoDoc;
732 class ScUndoEnterMatrix: public ScBlockUndo
734 public:
735 ScUndoEnterMatrix( ScDocShell* pNewDocShell,
736 const ScRange& rArea,
737 ScDocumentUniquePtr pNewUndoDoc,
738 OUString aForm );
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;
748 private:
749 ScDocumentUniquePtr
750 pUndoDoc;
751 OUString aFormula;
752 sal_uLong nStartChangeAction;
753 sal_uLong nEndChangeAction;
755 void SetChangeTrack();
758 class ScUndoInsertAreaLink : public ScSimpleUndo
760 public:
761 ScUndoInsertAreaLink( ScDocShell* pShell,
762 OUString aDocName,
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;
775 private:
776 OUString aDocName;
777 OUString aFltName;
778 OUString aOptions;
779 OUString aAreaName;
780 ScRange aRange;
781 sal_uLong nRefreshDelay;
784 class ScUndoRemoveAreaLink : public ScSimpleUndo
786 public:
787 ScUndoRemoveAreaLink( ScDocShell* pShell,
788 OUString aDocName,
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;
801 private:
802 OUString aDocName;
803 OUString aFltName;
804 OUString aOptions;
805 OUString aAreaName;
806 ScRange aRange;
807 sal_uLong nRefreshDelay;
810 class ScUndoUpdateAreaLink : public ScSimpleUndo //! also change BlockUndo?
812 public:
813 ScUndoUpdateAreaLink(ScDocShell* pShell,
814 OUString aOldD,
815 OUString aOldF, OUString aOldO,
816 OUString aOldA, const ScRange& rOldR,
817 sal_uLong nOldRD,
818 OUString aNewD,
819 OUString aNewF, OUString aNewO,
820 OUString aNewA, const ScRange& rNewR,
821 sal_uLong nNewRD,
822 ScDocumentUniquePtr pUndo, ScDocumentUniquePtr pRedo,
823 bool bDoInsert);
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;
832 private:
833 OUString aOldDoc;
834 OUString aOldFlt;
835 OUString aOldOpt;
836 OUString aOldArea;
837 ScRange aOldRange;
838 OUString aNewDoc;
839 OUString aNewFlt;
840 OUString aNewOpt;
841 OUString aNewArea;
842 ScRange aNewRange;
843 ScDocumentUniquePtr xUndoDoc;
844 ScDocumentUniquePtr xRedoDoc;
845 sal_uLong nOldRefresh;
846 sal_uLong nNewRefresh;
847 bool bWithInsert;
849 void DoChange( const bool bUndo ) const;
852 class ScUndoIndent: public ScBlockUndo
854 public:
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;
866 private:
867 ScMarkData aMarkData;
868 ScDocumentUniquePtr
869 pUndoDoc;
870 bool bIsIncrement;
873 class ScUndoTransliterate: public ScBlockUndo
875 public:
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;
887 private:
888 ScMarkData aMarkData;
889 ScDocumentUniquePtr
890 pUndoDoc;
891 TransliterationFlags
892 nTransliterationType;
895 class ScUndoClearItems: public ScBlockUndo
897 public:
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;
909 private:
910 ScMarkData aMarkData;
911 ScDocumentUniquePtr
912 pUndoDoc;
913 std::unique_ptr<sal_uInt16[]>
914 pWhich;
917 class ScUndoRemoveBreaks: public ScSimpleUndo
919 public:
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;
931 private:
932 SCTAB nTab;
933 ScDocumentUniquePtr
934 pUndoDoc;
937 class ScUndoRemoveMerge: public ScBlockUndo
939 public:
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 );
958 private:
959 void SetCurTab();
961 std::vector<ScCellMergeOption> maOptions;
962 ScDocumentUniquePtr pUndoDoc;
965 class ScUndoBorder: public ScBlockUndo
967 public:
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;
981 private:
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: */