1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_SVX_SVDUNDO_HXX
21 #define INCLUDED_SVX_SVDUNDO_HXX
22 
23 #include <sal/config.h>
24 
25 #include <memory>
26 #include <vector>
27 
28 #include <svl/undo.hxx>
29 #include <svl/style.hxx>
30 #include <tools/gen.hxx>
31 #include <svx/svdtypes.hxx>
32 #include <svx/svdsob.hxx>
33 #include <svx/svxdllapi.h>
34 
35 class SfxItemSet;
36 class SfxPoolItem;
37 class SfxStyleSheet;
38 class SdrView;
39 class SdrPageView;
40 class SdrModel;
41 class SdrObject;
42 class SdrPage;
43 class SdrObjList;
44 class SdrLayer;
45 class SdrLayerAdmin;
46 class SdrObjGeoData;
47 class OutlinerParaObject;
48 
49 /**
50  * Abstract base class (ABC) for all UndoActions of DrawingEngine
51  */
52 
53 class SVX_DLLPUBLIC SdrUndoAction : public SfxUndoAction
54 {
55 protected:
56     SdrModel&     rMod;
57     ViewShellId   m_nViewShellId;
58 
59 protected:
60     SdrUndoAction(SdrModel& rNewMod);
61 
62 public:
63     virtual ~SdrUndoAction() override;
64 
65     virtual bool CanRepeat(SfxRepeatTarget& rView) const override;
66     virtual void Repeat(SfxRepeatTarget& rView) override;
67 
68     virtual OUString GetRepeatComment(SfxRepeatTarget& rView) const override;
69     virtual OUString GetSdrRepeatComment() const;
70 
71     virtual bool CanSdrRepeat(SdrView& rView) const;
72     virtual void SdrRepeat(SdrView& rView);
73 
74     /// See SfxUndoAction::GetViewShellId().
75     ViewShellId GetViewShellId() const override;
76 };
77 
78 /**
79  * Aggregation of arbitrarily many UndoActions to a single UndoAction.
80  * Undo() executes the single UndoActions backwards (LIFO, first the last
81  * ones attached), Redo() executes the UndoActions in the order they were
82  * added (FIFO).
83  */
84 
85 class SVX_DLLPUBLIC SdrUndoGroup final : public SdrUndoAction
86 {
87     std::vector<std::unique_ptr<SdrUndoAction>> maActions;
88 
89     // No expanded description of the Action (contains %O)
90     OUString                    aComment;
91     OUString                    aObjDescription;
92 
93     SdrRepeatFunc               eFunction;
94 
95 public:
96     SdrUndoGroup(SdrModel& rNewMod);
97     virtual ~SdrUndoGroup() override;
98 
GetActionCount() const99     sal_Int32 GetActionCount() const { return maActions.size(); }
GetAction(sal_Int32 nNum) const100     SdrUndoAction* GetAction(sal_Int32 nNum) const { return maActions[nNum].get(); }
101     void AddAction(std::unique_ptr<SdrUndoAction> pAct);
102 
SetComment(const OUString & rStr)103     void SetComment(const OUString& rStr) { aComment=rStr; }
SetObjDescription(const OUString & rStr)104     void SetObjDescription(const OUString& rStr) { aObjDescription=rStr; }
105     virtual OUString GetComment() const override;
106     virtual OUString GetSdrRepeatComment() const override;
107 
108     virtual void Undo() override;
109     virtual void Redo() override;
110 
111     virtual bool CanSdrRepeat(SdrView& rView) const override;
112     virtual void SdrRepeat(SdrView& rView) override;
SetRepeatFunction(SdrRepeatFunc eFunc)113     void SetRepeatFunction(SdrRepeatFunc eFunc) { eFunction=eFunc; }
114 };
115 
116 /**
117  * Abstract base class for all UndoActions that handle objects.
118  */
119 
120 class SVX_DLLPUBLIC SdrUndoObj : public SdrUndoAction
121 {
122 protected:
123     SdrObject*                  pObj;
124 
125 protected:
126     SdrUndoObj(SdrObject& rNewObj);
127 
128     OUString ImpGetDescriptionStr(const char* pStrCacheID, bool bRepeat = false) const;
129 
130     [[nodiscard]] static OUString GetDescriptionStringForObject( const SdrObject& _rForObject, const char* pStrCacheID, bool bRepeat = false );
131 
132     // #94278# new method for evtl. PageChange at UNDO/REDO
133     void ImpShowPageOfThisObject();
134 };
135 
136 /**
137  * Changing the object attributes.
138  * Create Action right before setting the new attributes.
139  * Also for StyleSheets.
140  */
141 
142 class SVX_DLLPUBLIC SdrUndoAttrObj : public SdrUndoObj
143 {
144 protected:
145     std::unique_ptr<SfxItemSet> pUndoSet;
146     std::unique_ptr<SfxItemSet> pRedoSet;
147 
148     // FIXME: Or should we better remember the StyleSheetNames?
149     rtl::Reference< SfxStyleSheetBase > mxUndoStyleSheet;
150     rtl::Reference< SfxStyleSheetBase > mxRedoStyleSheet;
151     bool                        bStyleSheet;
152     bool                        bHaveToTakeRedoSet;
153 
154     // When assigning TextItems to a drawing object with text:
155     std::unique_ptr<OutlinerParaObject>
156                                 pTextUndo;
157     // #i8508#
158     // The text rescue mechanism needs also to be implemented for redo actions.
159     std::unique_ptr<OutlinerParaObject>
160                                 pTextRedo;
161 
162     // If we have a group object:
163     std::unique_ptr<SdrUndoGroup> pUndoGroup;
164 
165     // Helper to ensure StyleSheet is in pool (provided by SdrModel from SdrObject)
166     static void ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool& rStyleSheetPool, SfxStyleSheet& rSheet);
167 
168 public:
169     SdrUndoAttrObj(SdrObject& rNewObj, bool bStyleSheet1 = false, bool bSaveText = false);
170     virtual ~SdrUndoAttrObj() override;
171     virtual void Undo() override;
172     virtual void Redo() override;
173 
174     virtual OUString GetComment() const override;
175     virtual OUString GetSdrRepeatComment() const override;
176 };
177 
178 /**
179  * Only moving of an object.
180  * Create Action right before moving.
181  */
182 
183 class SVX_DLLPUBLIC SdrUndoMoveObj final : public SdrUndoObj
184 {
185     Size const                        aDistance;     // Distance by which we move
186 
187 public:
SdrUndoMoveObj(SdrObject & rNewObj,const Size & rDist)188     SdrUndoMoveObj(SdrObject& rNewObj, const Size& rDist): SdrUndoObj(rNewObj),aDistance(rDist) {}
189     virtual ~SdrUndoMoveObj() override;
190 
191     virtual void Undo() override;
192     virtual void Redo() override;
193 
194     virtual OUString GetComment() const override;
195     virtual OUString GetSdrRepeatComment() const override;
196 
197     virtual void SdrRepeat(SdrView& rView) override;
198     virtual bool CanSdrRepeat(SdrView& rView) const override;
199 };
200 
201 /**
202  * Changing the geometry of an object.
203  * Create Action right before the geometric transformation.
204  */
205 
206 class SVX_DLLPUBLIC SdrUndoGeoObj : public SdrUndoObj
207 {
208     std::unique_ptr<SdrObjGeoData>  pUndoGeo;
209     std::unique_ptr<SdrObjGeoData>  pRedoGeo;
210     // If we have a group object:
211     std::unique_ptr<SdrUndoGroup>   pUndoGroup;
212     /// If we have a table object, should its layout change?
213     bool mbSkipChangeLayout;
214 
215 public:
216     SdrUndoGeoObj(SdrObject& rNewObj);
217     virtual ~SdrUndoGeoObj() override;
218 
219     virtual void Undo() override;
220     virtual void Redo() override;
221 
222     virtual OUString GetComment() const override;
SetSkipChangeLayout(bool bOn)223     void SetSkipChangeLayout(bool bOn) { mbSkipChangeLayout=bOn; }
224 };
225 
226 /**
227  * Manipulation of an ObjList: New Object, DeleteObj, SetObjZLevel, Grouping, ...
228  * Abstract base class.
229  */
230 
231 class SVX_DLLPUBLIC SdrUndoObjList : public SdrUndoObj {
232     class ObjListListener;
233     friend class ObjListListener;
234 
235 private:
236     bool                        bOwner;
237 
238 protected:
239     SdrObjList*                 pObjList;
240     sal_uInt32                      nOrdNum;
241 
242 protected:
243     SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect);
244     virtual ~SdrUndoObjList() override;
245 
IsOwner() const246     bool IsOwner() const { return bOwner; }
247     void SetOwner(bool bNew);
248 };
249 
250 /**
251  * Removing an Object from an ObjectList.
252  * To be used with corresponding Inserts within a UndoGroup.
253  *
254  * Create Action before removing from the ObjList.
255  */
256 
257 class SVX_DLLPUBLIC SdrUndoRemoveObj : public SdrUndoObjList
258 {
259 public:
SdrUndoRemoveObj(SdrObject & rNewObj,bool bOrdNumDirect=false)260     SdrUndoRemoveObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
261     : SdrUndoObjList(rNewObj,bOrdNumDirect) {}
262 
263     virtual void Undo() override;
264     virtual void Redo() override;
265 
266     virtual ~SdrUndoRemoveObj() override;
267 };
268 
269 /**
270  * Inserting Objects into an ObjectList.
271  * Use with corresponding Removes within an UndoGroup.
272  * Create Action before removal from ObjList.
273  */
274 
275 class SVX_DLLPUBLIC SdrUndoInsertObj : public SdrUndoObjList
276 {
277 public:
SdrUndoInsertObj(SdrObject & rNewObj,bool bOrdNumDirect=false)278     SdrUndoInsertObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
279     :   SdrUndoObjList(rNewObj,bOrdNumDirect) {}
280 
281     virtual void Undo() override;
282     virtual void Redo() override;
283 };
284 
285 /**
286  * Deleting an Object.
287  * Create Action before removing from ObjList.
288  */
289 
290 class SVX_DLLPUBLIC SdrUndoDelObj : public SdrUndoRemoveObj
291 {
292 public:
293     SdrUndoDelObj(SdrObject& rNewObj, bool bOrdNumDirect = false);
294 
295     virtual void Undo() override;
296     virtual void Redo() override;
297 
298     virtual OUString GetComment() const override;
299     virtual OUString GetSdrRepeatComment() const override;
300 
301     virtual void SdrRepeat(SdrView& rView) override;
302     virtual bool CanSdrRepeat(SdrView& rView) const override;
303 };
304 
305 /**
306  * Inserting a NEW Object.
307  * Create Action after insertion into the ObjList.
308  */
309 
310 class SVX_DLLPUBLIC SdrUndoNewObj : public SdrUndoInsertObj
311 {
312 public:
SdrUndoNewObj(SdrObject & rNewObj,bool bOrdNumDirect=false)313     SdrUndoNewObj(SdrObject& rNewObj, bool bOrdNumDirect = false)
314     :   SdrUndoInsertObj(rNewObj,bOrdNumDirect) {}
315 
316     virtual void Undo() override;
317     virtual void Redo() override;
318 
319     virtual OUString GetComment() const override;
320 
321     static  OUString GetComment(const SdrObject& _rForObject);
322 };
323 
324 /**
325  * Replacing an Object.
326  * Create Action before Replace in ObjList.
327  */
328 
329 class SVX_DLLPUBLIC SdrUndoReplaceObj : public SdrUndoObj
330 {
331     bool                        bOldOwner;
332     bool                        bNewOwner;
333 
334     SdrObjList*                 pObjList;
335     SdrObject*                  pNewObj;
336 
337 public:
338     SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1);
339     virtual ~SdrUndoReplaceObj() override;
340 
341     virtual void Undo() override;
342     virtual void Redo() override;
343 
IsNewOwner() const344     bool IsNewOwner() const { return bNewOwner; }
345     void SetNewOwner(bool bNew);
346 
IsOldOwner() const347     bool IsOldOwner() const { return bOldOwner; }
348     void SetOldOwner(bool bNew);
349 };
350 
351 /**
352  * Copying an Object.
353  * Create Action before inserting into the ObjList.
354  */
355 
356 class SdrUndoCopyObj final : public SdrUndoNewObj
357 {
358 public:
SdrUndoCopyObj(SdrObject & rNewObj,bool bOrdNumDirect)359     SdrUndoCopyObj(SdrObject& rNewObj, bool bOrdNumDirect)
360     :   SdrUndoNewObj(rNewObj,bOrdNumDirect) {}
361 
362     virtual OUString GetComment() const override;
363 };
364 
365 class SdrUndoObjOrdNum final : public SdrUndoObj
366 {
367     sal_uInt32 const                      nOldOrdNum;
368     sal_uInt32 const                      nNewOrdNum;
369 
370 public:
371     SdrUndoObjOrdNum(SdrObject& rNewObj, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
372 
373     virtual void Undo() override;
374     virtual void Redo() override;
375 
376     virtual OUString GetComment() const override;
377 };
378 
379 
380 // #i11702#
381 
382 class SVX_DLLPUBLIC SdrUndoObjectLayerChange final : public SdrUndoObj
383 {
384     SdrLayerID const                  maOldLayer;
385     SdrLayerID const                  maNewLayer;
386 
387 public:
388     SdrUndoObjectLayerChange(SdrObject& rObj, SdrLayerID aOldLayer, SdrLayerID aNewLayer);
389 
390     virtual void Undo() override;
391     virtual void Redo() override;
392 };
393 
394 class SVX_DLLPUBLIC SdrUndoObjSetText : public SdrUndoObj
395 {
396 protected:
397     std::unique_ptr<OutlinerParaObject>
398                                 pOldText;
399     std::unique_ptr<OutlinerParaObject>
400                                 pNewText;
401     bool                        bNewTextAvailable;
402     bool                        bEmptyPresObj;
403     sal_Int32 const             mnText;
404 
405 public:
406     SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText );
407     virtual ~SdrUndoObjSetText() override;
408 
IsDifferent() const409     bool IsDifferent() const { return pOldText!=pNewText; }
410     void AfterSetText();
411 
412     virtual void Undo() override;
413     virtual void Redo() override;
414 
415     virtual OUString GetComment() const override;
416     virtual OUString GetSdrRepeatComment() const override;
417 
418     virtual void SdrRepeat(SdrView& rView) override;
419     virtual bool CanSdrRepeat(SdrView& rView) const override;
420 };
421 
422 /**
423  * Implement Title/Description Elements UI for Writer
424  * text frames, graphics and embedded objects (#i73249#)
425  */
426 class SdrUndoObjStrAttr final : public SdrUndoObj
427 {
428 public:
429     enum class ObjStrAttrType
430     {
431         Name,
432         Title,
433         Description
434     };
435 
436     SdrUndoObjStrAttr( SdrObject& rNewObj,
437                        const ObjStrAttrType eObjStrAttr,
438                        const OUString& sOldStr,
439                        const OUString& sNewStr);
440 
441     virtual void Undo() override;
442     virtual void Redo() override;
443 
444     virtual OUString GetComment() const override;
445 
446 private:
447     const ObjStrAttrType meObjStrAttr;
448     const OUString msOldStr;
449     const OUString msNewStr;
450 
451 };
452 
453 
454 /*
455  * Layer
456  */
457 
458 /**
459  * Abstract base class for all UndoActions that have something to do with SdrLayer.
460  */
461 
462 class SdrUndoLayer : public SdrUndoAction
463 {
464 protected:
465     SdrLayer* const             pLayer;
466     SdrLayerAdmin*              pLayerAdmin;
467     sal_uInt16 const            nNum;
468     bool                        bItsMine;
469 
470 protected:
471     SdrUndoLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
472     virtual ~SdrUndoLayer() override;
473 };
474 
475 /**
476  * Inserting a new Layer.
477  * Create Action after Insertion.
478  */
479 
480 class SdrUndoNewLayer final : public SdrUndoLayer
481 {
482 public:
SdrUndoNewLayer(sal_uInt16 nLayerNum,SdrLayerAdmin & rNewLayerAdmin,SdrModel & rNewModel)483     SdrUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
484     : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) {}
485 
486     virtual void Undo() override;
487     virtual void Redo() override;
488 
489     virtual OUString GetComment() const override;
490 };
491 
492 /**
493  * Deleting a Layer.
494  * Create Action before the Remove.
495  */
496 
497 class SdrUndoDelLayer final : public SdrUndoLayer
498 {
499 public:
SdrUndoDelLayer(sal_uInt16 nLayerNum,SdrLayerAdmin & rNewLayerAdmin,SdrModel & rNewModel)500     SdrUndoDelLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
501     : SdrUndoLayer(nLayerNum,rNewLayerAdmin,rNewModel) { bItsMine=true; }
502 
503     virtual void Undo() override;
504     virtual void Redo() override;
505 
506     virtual OUString GetComment() const override;
507 };
508 
509 /*
510  * Pages
511  */
512 
513 /**
514  * ABC for all UndoActions that have something to do with SdrPages.
515  */
516 
517 class SVX_DLLPUBLIC SdrUndoPage : public SdrUndoAction
518 {
519 protected:
520     SdrPage&                    mrPage;
521 
522 protected:
523     void ImpInsertPage(sal_uInt16 nNum);
524     void ImpRemovePage(sal_uInt16 nNum);
525     void ImpMovePage(sal_uInt16 nOldNum, sal_uInt16 nNewNum);
526 
527 protected:
528     SdrUndoPage(SdrPage& rNewPg);
529 
530     static OUString ImpGetDescriptionStr(const char* pStrCacheID);
531 };
532 
533 /**
534  * ABC for manipulation of a PageList: New Page, DeletePage, MovePage (ChangePageNum).
535  */
536 
537 class SVX_DLLPUBLIC SdrUndoPageList : public SdrUndoPage
538 {
539 protected:
540     sal_uInt16                      nPageNum;
541 
542     // It's possible that the object is re-assigned during a Undo/Redo.
543     // The Page is deleted in the dtor, if bItsMine==TRUE
544     bool                        bItsMine;
545 
546 protected:
547     SdrUndoPageList(SdrPage& rNewPg);
548     virtual ~SdrUndoPageList() override;
549 };
550 
551 /**
552  * Deleting a Page.
553  * Create Action before removing from the List.
554  */
555 
556 class SVX_DLLPUBLIC SdrUndoDelPage final : public SdrUndoPageList
557 {
558     // When deleting a MasterPage, we remember all relations of the
559     // Character Page with the MasterPage in this UndoGroup.
560     std::unique_ptr<SdrUndoGroup>  pUndoGroup;
561     std::unique_ptr<SfxPoolItem>   mpFillBitmapItem;
562     bool                           mbHasFillBitmap;
563 
564 public:
565     SdrUndoDelPage(SdrPage& rNewPg);
566     virtual ~SdrUndoDelPage() override;
567 
568     virtual void Undo() override;
569     virtual void Redo() override;
570 
571     virtual OUString GetComment() const override;
572     virtual OUString GetSdrRepeatComment() const override;
573 
574     virtual void SdrRepeat(SdrView& rView) override;
575     virtual bool CanSdrRepeat(SdrView& rView) const override;
576 
577 private:
578     void queryFillBitmap(const SfxItemSet &rItemSet);
579     void clearFillBitmap();
580     void restoreFillBitmap();
581 };
582 
583 /**
584  * Inserting a new Page.
585  * Create Action after inserting into the List.
586  */
587 
588 class SVX_DLLPUBLIC SdrUndoNewPage : public SdrUndoPageList
589 {
590 public:
SdrUndoNewPage(SdrPage & rNewPg)591     SdrUndoNewPage(SdrPage& rNewPg): SdrUndoPageList(rNewPg) {}
592 
593     virtual void Undo() override;
594     virtual void Redo() override;
595 
596     virtual OUString GetComment() const override;
597 };
598 
599 /**
600  * Copying a Page.
601  * Create Action after inserting into the List.
602  */
603 
604 class SdrUndoCopyPage final : public SdrUndoNewPage
605 {
606 public:
SdrUndoCopyPage(SdrPage & rNewPg)607     SdrUndoCopyPage(SdrPage& rNewPg): SdrUndoNewPage(rNewPg) {}
608 
609     virtual OUString GetComment() const override;
610     virtual OUString GetSdrRepeatComment() const override;
611 
612     virtual void SdrRepeat(SdrView& rView) override;
613     virtual bool CanSdrRepeat(SdrView& rView) const override;
614 };
615 
616 /**
617  * Moving a Page within the List.
618  * Create Action before moving the Page.
619  */
620 
621 class SVX_DLLPUBLIC SdrUndoSetPageNum final : public SdrUndoPage
622 {
623     sal_uInt16 const                      nOldPageNum;
624     sal_uInt16 const                      nNewPageNum;
625 
626 public:
SdrUndoSetPageNum(SdrPage & rNewPg,sal_uInt16 nOldPageNum1,sal_uInt16 nNewPageNum1)627     SdrUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
628     :   SdrUndoPage(rNewPg),nOldPageNum(nOldPageNum1),nNewPageNum(nNewPageNum1) {}
629 
630     virtual void Undo() override;
631     virtual void Redo() override;
632 
633     virtual OUString GetComment() const override;
634 };
635 
636 
637 /*
638  * Masterpages
639  */
640 
641 /**
642  * ABC for all UndoActions that have something to do with
643  * MasterPage relationships.
644  */
645 
646 class SdrUndoPageMasterPage : public SdrUndoPage
647 {
648 protected:
649     bool const                  mbOldHadMasterPage;
650     SdrLayerIDSet               maOldSet;
651     sal_uInt16                  maOldMasterPageNumber;
652 
653 protected:
654     SdrUndoPageMasterPage(SdrPage& rChangedPage);
655 
656 public:
657     SVX_DLLPUBLIC virtual ~SdrUndoPageMasterPage() override;
658 };
659 
660 /**
661  * Removal of a MasterPage from a Character Page.
662  * Create Action before removing the MasterPageDescriptor.
663  */
664 
665 class SdrUndoPageRemoveMasterPage final : public SdrUndoPageMasterPage
666 {
667 public:
668     SdrUndoPageRemoveMasterPage(SdrPage& rChangedPage);
669 
670     virtual void Undo() override;
671     virtual void Redo() override;
672 
673     virtual OUString GetComment() const override;
674 };
675 
676 /**
677  * Changing the MasterPageDescriptor (e.g. change of the VisibleLayer).
678  * Create Action before changing the MasterPageDescriptors.
679  */
680 
681 class SVX_DLLPUBLIC SdrUndoPageChangeMasterPage final : public SdrUndoPageMasterPage
682 {
683     bool                        mbNewHadMasterPage;
684     SdrLayerIDSet                   maNewSet;
685     sal_uInt16                  maNewMasterPageNumber;
686 
687 public:
688     SdrUndoPageChangeMasterPage(SdrPage& rChangedPage);
689 
690     virtual void Undo() override;
691     virtual void Redo() override;
692 
693     virtual OUString GetComment() const override;
694 };
695 
696 
697 /**
698  * The SdrUndoFactory can be set and retrieved from the SdrModel.
699  * It is used by the drawing layer implementations to create undo actions.
700  * It can be used by applications to create application specific undo actions.
701  */
702 class SVX_DLLPUBLIC SdrUndoFactory
703 {
704 public:
705     // Shapes
706     virtual ~SdrUndoFactory();
707     virtual std::unique_ptr<SdrUndoAction> CreateUndoMoveObject( SdrObject& rObject, const Size& rDist );
708     virtual std::unique_ptr<SdrUndoAction> CreateUndoGeoObject( SdrObject& rObject );
709     virtual std::unique_ptr<SdrUndoAction> CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1 = false, bool bSaveText = false );
710     virtual std::unique_ptr<SdrUndoAction> CreateUndoRemoveObject(SdrObject& rObject);
711     virtual std::unique_ptr<SdrUndoAction> CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect = false);
712     virtual std::unique_ptr<SdrUndoAction> CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect = false);
713     virtual std::unique_ptr<SdrUndoAction> CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect = false);
714     virtual std::unique_ptr<SdrUndoAction> CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect = false);
715 
716     virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1);
717 
718     virtual std::unique_ptr<SdrUndoAction> CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject );
719     virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer );
720     virtual std::unique_ptr<SdrUndoAction> CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText );
721 
722     // Implement Title/Description Elements UI for Writer text frames, graphics and embedded objects (#i73249#)
723     static std::unique_ptr<SdrUndoAction> CreateUndoObjectStrAttr( SdrObject& rObject,
724                                                     SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
725                                                     const OUString& sOldStr,
726                                                     const OUString& sNewStr );
727 
728     // Layer
729     virtual std::unique_ptr<SdrUndoAction> CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
730     virtual std::unique_ptr<SdrUndoAction> CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel);
731 
732     // Page
733     virtual std::unique_ptr<SdrUndoAction> CreateUndoDeletePage(SdrPage& rPage);
734     virtual std::unique_ptr<SdrUndoAction> CreateUndoNewPage(SdrPage& rPage);
735     virtual std::unique_ptr<SdrUndoAction> CreateUndoCopyPage(SdrPage& rPage);
736     virtual std::unique_ptr<SdrUndoAction> CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1);
737 
738     // Master page
739     virtual std::unique_ptr<SdrUndoAction> CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage);
740     virtual std::unique_ptr<SdrUndoAction> CreateUndoPageChangeMasterPage(SdrPage& rChangedPage);
741 };
742 
743 #endif // INCLUDED_SVX_SVDUNDO_HXX
744 
745 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
746