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