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 <svl/lstner.hxx>
23 #include <svx/svdundo.hxx>
24 #include <svx/svdotext.hxx>
25 #include <svx/svdobj.hxx>
26 #include <svx/svdpage.hxx>
27 #include <svx/svdlayer.hxx>
28 #include <svx/svdmodel.hxx>
29 #include <svx/svdview.hxx>
30 #include "svx/svdstr.hrc"
31 #include "svdglob.hxx"
32 #include <svx/scene3d.hxx>
33 #include <editeng/editdata.hxx>
34 #include <editeng/outlobj.hxx>
35 #include <svx/svdogrp.hxx>
36 #include <sdr/properties/itemsettools.hxx>
37 #include <svx/sdr/properties/properties.hxx>
38 #include <svx/svdocapt.hxx>
39 #include <svl/whiter.hxx>
40 #include <svx/e3dsceneupdater.hxx>
41 #include <svx/svdviter.hxx>
42 #include <svx/svdograf.hxx>
43 #include <sdr/contact/viewcontactofgraphic.hxx>
44 #include <svx/svdotable.hxx> // #i124389#
45 #include <vcl/svapp.hxx>
48 // iterates over all views and unmarks this SdrObject if it is marked
49 static void ImplUnmarkObject( SdrObject
* pObj
)
51 SdrViewIter
aIter( pObj
);
52 for ( SdrView
* pView
= aIter
.FirstView(); pView
; pView
= aIter
.NextView() )
54 pView
->MarkObj( pObj
, pView
->GetSdrPageView(), true );
60 TYPEINIT1(SdrUndoAction
,SfxUndoAction
);
62 SdrUndoAction::~SdrUndoAction() {}
64 bool SdrUndoAction::CanRepeat(SfxRepeatTarget
& rView
) const
66 SdrView
* pV
=PTR_CAST(SdrView
,&rView
);
67 if (pV
!=NULL
) return CanSdrRepeat(*pV
);
71 void SdrUndoAction::Repeat(SfxRepeatTarget
& rView
)
73 SdrView
* pV
=PTR_CAST(SdrView
,&rView
);
74 if (pV
!=NULL
) SdrRepeat(*pV
);
75 DBG_ASSERT(pV
!=NULL
,"Repeat: SfxRepeatTarget that was handed over is not a SdrView");
78 OUString
SdrUndoAction::GetRepeatComment(SfxRepeatTarget
& rView
) const
80 SdrView
* pV
=PTR_CAST(SdrView
,&rView
);
81 if (pV
!=NULL
) return GetSdrRepeatComment(*pV
);
85 bool SdrUndoAction::CanSdrRepeat(SdrView
& /*rView*/) const
90 void SdrUndoAction::SdrRepeat(SdrView
& /*rView*/)
94 OUString
SdrUndoAction::GetSdrRepeatComment(SdrView
& /*rView*/) const
101 SdrUndoGroup::SdrUndoGroup(SdrModel
& rNewMod
)
102 : SdrUndoAction(rNewMod
),
104 eFunction(SDRREPFUNC_OBJ_NONE
)
107 SdrUndoGroup::~SdrUndoGroup()
112 void SdrUndoGroup::Clear()
114 for (sal_uIntPtr nu
=0; nu
<GetActionCount(); nu
++) {
115 SdrUndoAction
* pAct
=GetAction(nu
);
121 void SdrUndoGroup::AddAction(SdrUndoAction
* pAct
)
123 aBuf
.push_back(pAct
);
126 void SdrUndoGroup::Undo()
128 for (sal_uIntPtr nu
=GetActionCount(); nu
>0;) {
130 SdrUndoAction
* pAct
=GetAction(nu
);
135 void SdrUndoGroup::Redo()
137 for (sal_uIntPtr nu
=0; nu
<GetActionCount(); nu
++) {
138 SdrUndoAction
* pAct
=GetAction(nu
);
143 OUString
SdrUndoGroup::GetComment() const
145 return aComment
.replaceAll("%1", aObjDescription
);
148 bool SdrUndoGroup::CanSdrRepeat(SdrView
& rView
) const
152 case SDRREPFUNC_OBJ_NONE
: return false;
153 case SDRREPFUNC_OBJ_DELETE
: return rView
.AreObjectsMarked();
154 case SDRREPFUNC_OBJ_COMBINE_POLYPOLY
: return rView
.IsCombinePossible(false);
155 case SDRREPFUNC_OBJ_COMBINE_ONEPOLY
: return rView
.IsCombinePossible(true);
156 case SDRREPFUNC_OBJ_DISMANTLE_POLYS
: return rView
.IsDismantlePossible(false);
157 case SDRREPFUNC_OBJ_DISMANTLE_LINES
: return rView
.IsDismantlePossible(true);
158 case SDRREPFUNC_OBJ_CONVERTTOPOLY
: return rView
.IsConvertToPolyObjPossible(false);
159 case SDRREPFUNC_OBJ_CONVERTTOPATH
: return rView
.IsConvertToPathObjPossible(false);
160 case SDRREPFUNC_OBJ_GROUP
: return rView
.IsGroupPossible();
161 case SDRREPFUNC_OBJ_UNGROUP
: return rView
.IsUnGroupPossible();
162 case SDRREPFUNC_OBJ_PUTTOTOP
: return rView
.IsToTopPossible();
163 case SDRREPFUNC_OBJ_PUTTOBTM
: return rView
.IsToBtmPossible();
164 case SDRREPFUNC_OBJ_MOVTOTOP
: return rView
.IsToTopPossible();
165 case SDRREPFUNC_OBJ_MOVTOBTM
: return rView
.IsToBtmPossible();
166 case SDRREPFUNC_OBJ_REVORDER
: return rView
.IsReverseOrderPossible();
167 case SDRREPFUNC_OBJ_IMPORTMTF
: return rView
.IsImportMtfPossible();
173 void SdrUndoGroup::SdrRepeat(SdrView
& rView
)
177 case SDRREPFUNC_OBJ_NONE
: break;
178 case SDRREPFUNC_OBJ_DELETE
: rView
.DeleteMarked(); break;
179 case SDRREPFUNC_OBJ_COMBINE_POLYPOLY
: rView
.CombineMarkedObjects(false); break;
180 case SDRREPFUNC_OBJ_COMBINE_ONEPOLY
: rView
.CombineMarkedObjects(true); break;
181 case SDRREPFUNC_OBJ_DISMANTLE_POLYS
: rView
.DismantleMarkedObjects(false); break;
182 case SDRREPFUNC_OBJ_DISMANTLE_LINES
: rView
.DismantleMarkedObjects(true); break;
183 case SDRREPFUNC_OBJ_CONVERTTOPOLY
: rView
.ConvertMarkedToPolyObj(false); break;
184 case SDRREPFUNC_OBJ_CONVERTTOPATH
: rView
.ConvertMarkedToPathObj(false); break;
185 case SDRREPFUNC_OBJ_GROUP
: rView
.GroupMarked(); break;
186 case SDRREPFUNC_OBJ_UNGROUP
: rView
.UnGroupMarked(); break;
187 case SDRREPFUNC_OBJ_PUTTOTOP
: rView
.PutMarkedToTop(); break;
188 case SDRREPFUNC_OBJ_PUTTOBTM
: rView
.PutMarkedToBtm(); break;
189 case SDRREPFUNC_OBJ_MOVTOTOP
: rView
.MovMarkedToTop(); break;
190 case SDRREPFUNC_OBJ_MOVTOBTM
: rView
.MovMarkedToBtm(); break;
191 case SDRREPFUNC_OBJ_REVORDER
: rView
.ReverseOrderOfMarked(); break;
192 case SDRREPFUNC_OBJ_IMPORTMTF
: rView
.DoImportMarkedMtf(); break;
197 OUString
SdrUndoGroup::GetSdrRepeatComment(SdrView
& /*rView*/) const
199 return aComment
.replaceAll("%1", ImpGetResStr(STR_ObjNameSingulPlural
));
202 SdrUndoObj::SdrUndoObj(SdrObject
& rNewObj
)
203 : SdrUndoAction(*rNewObj
.GetModel())
208 OUString
SdrUndoObj::GetDescriptionStringForObject( const SdrObject
& _rForObject
, sal_uInt16 nStrCacheID
, bool bRepeat
)
210 OUString rStr
= ImpGetResStr(nStrCacheID
);
212 sal_Int32 nPos
= rStr
.indexOf("%1");
218 rStr
= rStr
.replaceAt(nPos
, 2, ImpGetResStr(STR_ObjNameSingulPlural
));
222 OUString
aStr(_rForObject
.TakeObjNameSingul());
223 rStr
= rStr
.replaceAt(nPos
, 2, aStr
);
230 void SdrUndoObj::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID
, OUString
& rStr
, bool bRepeat
) const
233 rStr
= GetDescriptionStringForObject( *pObj
, nStrCacheID
, bRepeat
);
236 // common call method for possible change of the page when UNDO/REDO is triggered
237 void SdrUndoObj::ImpShowPageOfThisObject()
239 if(pObj
&& pObj
->IsInserted() && pObj
->GetPage() && pObj
->GetModel())
241 SdrHint
aHint(HINT_SWITCHTOPAGE
);
243 aHint
.SetObject(pObj
);
244 aHint
.SetPage(pObj
->GetPage());
246 pObj
->GetModel()->Broadcast(aHint
);
250 void SdrUndoAttrObj::ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool
& rStyleSheetPool
, SfxStyleSheet
& rSheet
)
252 SfxStyleSheetBase
* pThere
= rStyleSheetPool
.Find(rSheet
.GetName(), rSheet
.GetFamily());
256 // re-insert remembered style which was removed in the meantime. To do this
257 // without assertion, do it without parent and set parent after insertion
258 const OUString
aParent(rSheet
.GetParent());
260 rSheet
.SetParent(OUString());
261 rStyleSheetPool
.Insert(&rSheet
);
262 rSheet
.SetParent(aParent
);
266 SdrUndoAttrObj::SdrUndoAttrObj(SdrObject
& rNewObj
, bool bStyleSheet1
, bool bSaveText
)
267 : SdrUndoObj(rNewObj
)
273 , bHaveToTakeRedoSet(true)
278 bStyleSheet
= bStyleSheet1
;
280 SdrObjList
* pOL
= rNewObj
.GetSubList();
281 bool bIsGroup(pOL
!=NULL
&& pOL
->GetObjCount());
282 bool bIs3DScene(bIsGroup
&& pObj
->ISA(E3dScene
));
286 // it's a group object!
287 pUndoGroup
= new SdrUndoGroup(*pObj
->GetModel());
288 const size_t nObjAnz(pOL
->GetObjCount());
290 for(size_t nObjNum
= 0; nObjNum
< nObjAnz
; ++nObjNum
)
292 pUndoGroup
->AddAction(
293 new SdrUndoAttrObj(*pOL
->GetObj(nObjNum
), bStyleSheet1
));
297 if(!bIsGroup
|| bIs3DScene
)
299 pUndoSet
= new SfxItemSet(pObj
->GetMergedItemSet());
302 mxUndoStyleSheet
= pObj
->GetStyleSheet();
306 pTextUndo
= pObj
->GetOutlinerParaObject();
308 pTextUndo
= new OutlinerParaObject(*pTextUndo
);
313 SdrUndoAttrObj::~SdrUndoAttrObj()
323 void SdrUndoAttrObj::Undo()
325 E3DModifySceneSnapRectUpdater
aUpdater(pObj
);
326 bool bIs3DScene(pObj
&& pObj
->ISA(E3dScene
));
328 // Trigger PageChangeCall
329 ImpShowPageOfThisObject();
331 if(!pUndoGroup
|| bIs3DScene
)
333 if(bHaveToTakeRedoSet
)
335 bHaveToTakeRedoSet
= false;
339 pRedoSet
= new SfxItemSet(pObj
->GetMergedItemSet());
342 mxRedoStyleSheet
= pObj
->GetStyleSheet();
347 pTextRedo
= pObj
->GetOutlinerParaObject();
350 pTextRedo
= new OutlinerParaObject(*pTextRedo
);
356 mxRedoStyleSheet
= pObj
->GetStyleSheet();
357 SfxStyleSheet
* pSheet
= dynamic_cast< SfxStyleSheet
* >(mxUndoStyleSheet
.get());
359 if(pSheet
&& pObj
->GetModel() && pObj
->GetModel()->GetStyleSheetPool())
361 ensureStyleSheetInStyleSheetPool(*pObj
->GetModel()->GetStyleSheetPool(), *pSheet
);
362 pObj
->SetStyleSheet(pSheet
, true);
366 OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
370 sdr::properties::ItemChangeBroadcaster
aItemChange(*pObj
);
372 // Since ClearItem sets back everything to normal
373 // it also sets fit-to-size text to non-fit-to-size text and
374 // switches on autogrowheight (the default). That may lead to
375 // losing the geometry size info for the object when it is
376 // laid out again from AdjustTextFrameWidthAndHeight(). This makes
377 // rescuing the size of the object necessary.
378 const Rectangle aSnapRect
= pObj
->GetSnapRect();
382 if(pObj
->ISA(SdrCaptionObj
))
384 // do a more smooth item deletion here, else the text
385 // rect will be reformatted, especially when information regarding
386 // vertical text is changed. When clearing only set items it's
387 // slower, but safer regarding such information (it's not changed
389 SfxWhichIter
aIter(*pUndoSet
);
390 sal_uInt16
nWhich(aIter
.FirstWhich());
394 if(SfxItemState::SET
!= pUndoSet
->GetItemState(nWhich
, false))
396 pObj
->ClearMergedItem(nWhich
);
399 nWhich
= aIter
.NextWhich();
404 pObj
->ClearMergedItem();
407 pObj
->SetMergedItemSet(*pUndoSet
);
410 // Restore previous size here when it was changed.
411 if(aSnapRect
!= pObj
->GetSnapRect())
413 pObj
->NbcSetSnapRect(aSnapRect
);
416 pObj
->GetProperties().BroadcastItemChange(aItemChange
);
420 pObj
->SetOutlinerParaObject(new OutlinerParaObject(*pTextUndo
));
430 void SdrUndoAttrObj::Redo()
432 E3DModifySceneSnapRectUpdater
aUpdater(pObj
);
433 bool bIs3DScene(pObj
&& pObj
->ISA(E3dScene
));
435 if(!pUndoGroup
|| bIs3DScene
)
439 mxUndoStyleSheet
= pObj
->GetStyleSheet();
440 SfxStyleSheet
* pSheet
= dynamic_cast< SfxStyleSheet
* >(mxRedoStyleSheet
.get());
442 if(pSheet
&& pObj
->GetModel() && pObj
->GetModel()->GetStyleSheetPool())
444 ensureStyleSheetInStyleSheetPool(*pObj
->GetModel()->GetStyleSheetPool(), *pSheet
);
445 pObj
->SetStyleSheet(pSheet
, true);
449 OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
453 sdr::properties::ItemChangeBroadcaster
aItemChange(*pObj
);
455 const Rectangle aSnapRect
= pObj
->GetSnapRect();
459 if(pObj
->ISA(SdrCaptionObj
))
461 // do a more smooth item deletion here, else the text
462 // rect will be reformatted, especially when information regarding
463 // vertical text is changed. When clearing only set items it's
464 // slower, but safer regarding such information (it's not changed
466 SfxWhichIter
aIter(*pRedoSet
);
467 sal_uInt16
nWhich(aIter
.FirstWhich());
471 if(SfxItemState::SET
!= pRedoSet
->GetItemState(nWhich
, false))
473 pObj
->ClearMergedItem(nWhich
);
476 nWhich
= aIter
.NextWhich();
481 pObj
->ClearMergedItem();
484 pObj
->SetMergedItemSet(*pRedoSet
);
487 // Restore previous size here when it was changed.
488 if(aSnapRect
!= pObj
->GetSnapRect())
490 pObj
->NbcSetSnapRect(aSnapRect
);
493 pObj
->GetProperties().BroadcastItemChange(aItemChange
);
498 pObj
->SetOutlinerParaObject(new OutlinerParaObject(*pTextRedo
));
507 // Trigger PageChangeCall
508 ImpShowPageOfThisObject();
511 OUString
SdrUndoAttrObj::GetComment() const
517 ImpTakeDescriptionStr(STR_EditSetStylesheet
, aStr
);
521 ImpTakeDescriptionStr(STR_EditSetAttributes
, aStr
);
527 void SdrUndoAttrObj::SdrRepeat(SdrView
& rView
)
531 rView
.SetAttrToMarked(*pRepeatSet
, false);
535 bool SdrUndoAttrObj::CanSdrRepeat(SdrView
& rView
) const
537 return (pRepeatSet
!=0L && rView
.AreObjectsMarked());
540 OUString
SdrUndoAttrObj::GetSdrRepeatComment(SdrView
& /*rView*/) const
546 ImpTakeDescriptionStr(STR_EditSetStylesheet
, aStr
, true);
550 ImpTakeDescriptionStr(STR_EditSetAttributes
, aStr
, true);
558 SdrUndoMoveObj::~SdrUndoMoveObj() {}
560 void SdrUndoMoveObj::Undo()
562 // Trigger PageChangeCall
563 ImpShowPageOfThisObject();
565 pObj
->Move(Size(-aDistance
.Width(),-aDistance
.Height()));
568 void SdrUndoMoveObj::Redo()
570 pObj
->Move(Size(aDistance
.Width(),aDistance
.Height()));
572 // Trigger PageChangeCall
573 ImpShowPageOfThisObject();
576 OUString
SdrUndoMoveObj::GetComment() const
579 ImpTakeDescriptionStr(STR_EditMove
,aStr
);
583 void SdrUndoMoveObj::SdrRepeat(SdrView
& rView
)
585 rView
.MoveMarkedObj(aDistance
);
588 bool SdrUndoMoveObj::CanSdrRepeat(SdrView
& rView
) const
590 return rView
.AreObjectsMarked();
593 OUString
SdrUndoMoveObj::GetSdrRepeatComment(SdrView
& /*rView*/) const
596 ImpTakeDescriptionStr(STR_EditMove
,aStr
,true);
602 SdrUndoGeoObj::SdrUndoGeoObj(SdrObject
& rNewObj
)
603 : SdrUndoObj(rNewObj
)
608 SdrObjList
* pOL
=rNewObj
.GetSubList();
609 if (pOL
!=NULL
&& pOL
->GetObjCount() && !rNewObj
.ISA(E3dScene
))
611 // this is a group object!
612 // If this were 3D scene, we'd only add an Undo for the scene itself
613 // (which we do elsewhere).
614 pUndoGroup
=new SdrUndoGroup(*pObj
->GetModel());
615 const size_t nObjAnz
= pOL
->GetObjCount();
616 for (size_t nObjNum
= 0; nObjNum
<nObjAnz
; ++nObjNum
) {
617 pUndoGroup
->AddAction(new SdrUndoGeoObj(*pOL
->GetObj(nObjNum
)));
622 pUndoGeo
=pObj
->GetGeoData();
626 SdrUndoGeoObj::~SdrUndoGeoObj()
633 void SdrUndoGeoObj::Undo()
635 // Trigger PageChangeCall
636 ImpShowPageOfThisObject();
642 // only repaint, no objectchange
643 pObj
->ActionChanged();
648 pRedoGeo
=pObj
->GetGeoData();
649 pObj
->SetGeoData(*pUndoGeo
);
653 void SdrUndoGeoObj::Redo()
659 // only repaint, no objectchange
660 pObj
->ActionChanged();
665 pUndoGeo
=pObj
->GetGeoData();
666 pObj
->SetGeoData(*pRedoGeo
);
669 // Trigger PageChangeCall
670 ImpShowPageOfThisObject();
673 OUString
SdrUndoGeoObj::GetComment() const
676 ImpTakeDescriptionStr(STR_DragMethObjOwn
,aStr
);
682 SdrUndoObjList::SdrUndoObjList(SdrObject
& rNewObj
, bool bOrdNumDirect
)
683 : SdrUndoObj(rNewObj
)
688 pObjList
=pObj
->GetObjList();
691 nOrdNum
=pObj
->GetOrdNumDirect();
695 nOrdNum
=pObj
->GetOrdNum();
699 SdrUndoObjList::~SdrUndoObjList()
701 SolarMutexGuard aGuard
;
703 if (pObj
!=NULL
&& IsOwner())
705 // Attribute have to go back to the regular Pool
709 SdrObject::Free( pObj
);
713 void SdrUndoObjList::SetOwner(bool bNew
)
719 void SdrUndoObjList::SetOrdNum(sal_uInt32 nOrdNum_
)
726 void SdrUndoRemoveObj::Undo()
728 // Trigger PageChangeCall
729 ImpShowPageOfThisObject();
731 DBG_ASSERT(!pObj
->IsInserted(),"UndoRemoveObj: pObj has already been inserted.");
732 if (!pObj
->IsInserted())
735 // For UNDOs in Calc/Writer it is necessary to adapt the anchor
736 // position of the target object.
737 Point
aOwnerAnchorPos(0, 0);
740 pObjList
->GetOwnerObj() &&
741 pObjList
->GetOwnerObj()->ISA(SdrObjGroup
))
743 aOwnerAnchorPos
= pObjList
->GetOwnerObj()->GetAnchorPos();
746 E3DModifySceneSnapRectUpdater
aUpdater(pObjList
->GetOwnerObj());
747 SdrInsertReason
aReason(SDRREASON_UNDO
);
748 pObjList
->InsertObject(pObj
,nOrdNum
,&aReason
);
751 if(aOwnerAnchorPos
.X() || aOwnerAnchorPos
.Y())
753 pObj
->NbcSetAnchorPos(aOwnerAnchorPos
);
758 void SdrUndoRemoveObj::Redo()
760 DBG_ASSERT(pObj
->IsInserted(),"RedoRemoveObj: pObj is not inserted.");
761 if (pObj
->IsInserted())
763 ImplUnmarkObject( pObj
);
764 E3DModifySceneSnapRectUpdater
aUpdater(pObj
);
765 pObjList
->RemoveObject(nOrdNum
);
768 // Trigger PageChangeCall
769 ImpShowPageOfThisObject();
772 SdrUndoRemoveObj::~SdrUndoRemoveObj()
778 void SdrUndoInsertObj::Undo()
780 // Trigger PageChangeCall
781 ImpShowPageOfThisObject();
783 DBG_ASSERT(pObj
->IsInserted(),"UndoInsertObj: pObj is not inserted.");
784 if (pObj
->IsInserted())
786 ImplUnmarkObject( pObj
);
791 pObjList
->RemoveObject(nOrdNum
);
792 DBG_ASSERT(pChkObj
==pObj
,"UndoInsertObj: RemoveObjNum!=pObj");
796 void SdrUndoInsertObj::Redo()
798 DBG_ASSERT(!pObj
->IsInserted(),"RedoInsertObj: pObj is already inserted");
799 if (!pObj
->IsInserted())
801 // Restore anchor position of an object,
802 // which becomes a member of a group, because its cleared in method
803 // <InsertObject(..)>. Needed for correct Redo in Writer. (#i45952#)
804 Point
aAnchorPos( 0, 0 );
806 pObjList
->GetOwnerObj() &&
807 pObjList
->GetOwnerObj()->ISA(SdrObjGroup
) )
809 aAnchorPos
= pObj
->GetAnchorPos();
812 SdrInsertReason
aReason(SDRREASON_UNDO
);
813 pObjList
->InsertObject(pObj
,nOrdNum
,&aReason
);
815 // Arcs lose position when grouped (#i45952#)
816 if ( aAnchorPos
.X() || aAnchorPos
.Y() )
818 pObj
->NbcSetAnchorPos( aAnchorPos
);
822 // Trigger PageChangeCall
823 ImpShowPageOfThisObject();
826 SdrUndoDelObj::SdrUndoDelObj(SdrObject
& rNewObj
, bool bOrdNumDirect
)
827 : SdrUndoRemoveObj(rNewObj
,bOrdNumDirect
)
832 void SdrUndoDelObj::Undo()
834 SdrUndoRemoveObj::Undo();
835 DBG_ASSERT(IsOwner(),"UndoDeleteObj: pObj does not belong to UndoAction");
839 void SdrUndoDelObj::Redo()
841 SdrUndoRemoveObj::Redo();
842 DBG_ASSERT(!IsOwner(),"RedoDeleteObj: pObj already belongs to UndoAction");
846 OUString
SdrUndoDelObj::GetComment() const
849 ImpTakeDescriptionStr(STR_EditDelete
,aStr
);
853 void SdrUndoDelObj::SdrRepeat(SdrView
& rView
)
855 rView
.DeleteMarked();
858 bool SdrUndoDelObj::CanSdrRepeat(SdrView
& rView
) const
860 return rView
.AreObjectsMarked();
863 OUString
SdrUndoDelObj::GetSdrRepeatComment(SdrView
& /*rView*/) const
866 ImpTakeDescriptionStr(STR_EditDelete
,aStr
,true);
872 void SdrUndoNewObj::Undo()
874 SdrUndoInsertObj::Undo();
875 DBG_ASSERT(!IsOwner(),"RedoNewObj: pObj already belongs to UndoAction");
879 void SdrUndoNewObj::Redo()
881 SdrUndoInsertObj::Redo();
882 DBG_ASSERT(IsOwner(),"RedoNewObj: pObj does not belong to UndoAction");
886 OUString
SdrUndoNewObj::GetComment( const SdrObject
& _rForObject
)
888 return GetDescriptionStringForObject( _rForObject
, STR_UndoInsertObj
);
891 OUString
SdrUndoNewObj::GetComment() const
894 ImpTakeDescriptionStr(STR_UndoInsertObj
,aStr
);
898 SdrUndoReplaceObj::SdrUndoReplaceObj(SdrObject
& rOldObj1
, SdrObject
& rNewObj1
, bool bOrdNumDirect
)
899 : SdrUndoObj(rOldObj1
)
906 pObjList
=pObj
->GetObjList();
909 nOrdNum
=pObj
->GetOrdNumDirect();
913 nOrdNum
=pObj
->GetOrdNum();
917 SdrUndoReplaceObj::~SdrUndoReplaceObj()
919 if (pObj
!=NULL
&& IsOldOwner())
921 // Attribute have to go back into the Pool
925 SdrObject::Free( pObj
);
927 if (pNewObj
!=NULL
&& IsNewOwner())
929 // Attribute have to go back into the Pool
933 SdrObject::Free( pNewObj
);
937 void SdrUndoReplaceObj::Undo()
939 // Trigger PageChangeCall
940 ImpShowPageOfThisObject();
942 if (IsOldOwner() && !IsNewOwner())
944 DBG_ASSERT(!pObj
->IsInserted(),"SdrUndoReplaceObj::Undo(): Old object is already inserted!");
945 DBG_ASSERT(pNewObj
->IsInserted(),"SdrUndoReplaceObj::Undo(): New object is not inserted!");
949 ImplUnmarkObject( pNewObj
);
950 pObjList
->ReplaceObject(pObj
,nOrdNum
);
954 OSL_FAIL("SdrUndoReplaceObj::Undo(): Wrong IsMine flags. Did you call Undo twice?");
958 void SdrUndoReplaceObj::Redo()
960 if (!IsOldOwner() && IsNewOwner())
962 DBG_ASSERT(!pNewObj
->IsInserted(),"SdrUndoReplaceObj::Redo(): New object is already inserted!!");
963 DBG_ASSERT(pObj
->IsInserted(),"SdrUndoReplaceObj::Redo(): Old object is not inserted!!");
967 ImplUnmarkObject( pObj
);
968 pObjList
->ReplaceObject(pNewObj
,nOrdNum
);
973 OSL_FAIL("SdrUndoReplaceObj::Redo(): Wrong IsMine flags. Did you call Redo twice?");
976 // Trigger PageChangeCall
977 ImpShowPageOfThisObject();
980 void SdrUndoReplaceObj::SetNewOwner(bool bNew
)
985 void SdrUndoReplaceObj::SetOldOwner(bool bNew
)
992 OUString
SdrUndoCopyObj::GetComment() const
995 ImpTakeDescriptionStr(STR_UndoCopyObj
,aStr
);
1002 SdrUndoObjectLayerChange::SdrUndoObjectLayerChange(SdrObject
& rObj
, SdrLayerID aOldLayer
, SdrLayerID aNewLayer
)
1004 , maOldLayer(aOldLayer
)
1005 , maNewLayer(aNewLayer
)
1009 void SdrUndoObjectLayerChange::Undo()
1011 ImpShowPageOfThisObject();
1012 pObj
->SetLayer(maOldLayer
);
1015 void SdrUndoObjectLayerChange::Redo()
1017 pObj
->SetLayer(maNewLayer
);
1018 ImpShowPageOfThisObject();
1023 SdrUndoObjOrdNum::SdrUndoObjOrdNum(SdrObject
& rNewObj
, sal_uInt32 nOldOrdNum1
, sal_uInt32 nNewOrdNum1
)
1024 : SdrUndoObj(rNewObj
)
1025 , nOldOrdNum(nOldOrdNum1
)
1026 , nNewOrdNum(nNewOrdNum1
)
1030 void SdrUndoObjOrdNum::Undo()
1032 // Trigger PageChangeCall
1033 ImpShowPageOfThisObject();
1035 SdrObjList
* pOL
=pObj
->GetObjList();
1038 OSL_FAIL("UndoObjOrdNum: pObj does not have an ObjList.");
1041 pOL
->SetObjectOrdNum(nNewOrdNum
,nOldOrdNum
);
1044 void SdrUndoObjOrdNum::Redo()
1046 SdrObjList
* pOL
=pObj
->GetObjList();
1049 OSL_FAIL("RedoObjOrdNum: pObj does not have an ObjList.");
1052 pOL
->SetObjectOrdNum(nOldOrdNum
,nNewOrdNum
);
1054 // Trigger PageChangeCall
1055 ImpShowPageOfThisObject();
1058 OUString
SdrUndoObjOrdNum::GetComment() const
1061 ImpTakeDescriptionStr(STR_UndoObjOrdNum
,aStr
);
1067 SdrUndoObjSetText::SdrUndoObjSetText(SdrObject
& rNewObj
, sal_Int32 nText
)
1068 : SdrUndoObj(rNewObj
)
1071 , bNewTextAvailable(false)
1072 , bEmptyPresObj(false)
1075 SdrText
* pText
= static_cast< SdrTextObj
*>( &rNewObj
)->getText(mnText
);
1076 if( pText
&& pText
->GetOutlinerParaObject() )
1077 pOldText
= new OutlinerParaObject(*pText
->GetOutlinerParaObject());
1079 bEmptyPresObj
= rNewObj
.IsEmptyPresObj();
1082 SdrUndoObjSetText::~SdrUndoObjSetText()
1088 void SdrUndoObjSetText::AfterSetText()
1090 if (!bNewTextAvailable
)
1092 SdrText
* pText
= static_cast< SdrTextObj
*>( pObj
)->getText(mnText
);
1093 if( pText
&& pText
->GetOutlinerParaObject() )
1094 pNewText
= new OutlinerParaObject(*pText
->GetOutlinerParaObject());
1095 bNewTextAvailable
=true;
1099 void SdrUndoObjSetText::Undo()
1101 // only works with SdrTextObj
1102 SdrTextObj
* pTarget
= dynamic_cast< SdrTextObj
* >(pObj
);
1106 OSL_ENSURE(false, "SdrUndoObjSetText::Undo with SdrObject not based on SdrTextObj (!)");
1110 // Trigger PageChangeCall
1111 ImpShowPageOfThisObject();
1113 // save old text for Redo
1114 if(!bNewTextAvailable
)
1119 SdrText
* pText
= pTarget
->getText(mnText
);
1122 // copy text for Undo, because the original now belongs to SetOutlinerParaObject()
1123 OutlinerParaObject
* pText1
= pOldText
? new OutlinerParaObject(*pOldText
) : NULL
;
1124 pText
->SetOutlinerParaObject(pText1
);
1125 pTarget
->NbcSetOutlinerParaObjectForText(pText1
, pText
);
1128 pTarget
->SetEmptyPresObj(bEmptyPresObj
);
1129 pTarget
->ActionChanged();
1131 // #i124389# if it's a table, also need to relayout TextFrame
1132 if(0 != dynamic_cast< sdr::table::SdrTableObj
* >(pTarget
))
1134 pTarget
->NbcAdjustTextFrameWidthAndHeight();
1137 // #i122410# SetOutlinerParaObject at SdrText does not trigger a
1138 // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
1139 // update their preview.
1140 pTarget
->BroadcastObjectChange();
1143 void SdrUndoObjSetText::Redo()
1145 // only works with SdrTextObj
1146 SdrTextObj
* pTarget
= dynamic_cast< SdrTextObj
* >(pObj
);
1150 OSL_ENSURE(false, "SdrUndoObjSetText::Redo with SdrObject not based on SdrTextObj (!)");
1154 SdrText
* pText
= pTarget
->getText(mnText
);
1157 // copy text for Undo, because the original now belongs to SetOutlinerParaObject()
1158 OutlinerParaObject
* pText1
= pNewText
? new OutlinerParaObject(*pNewText
) : NULL
;
1159 pTarget
->NbcSetOutlinerParaObjectForText( pText1
, pText
);
1162 pTarget
->ActionChanged();
1164 // #i124389# if it's a table, als oneed to relayout TextFrame
1165 if(0 != dynamic_cast< sdr::table::SdrTableObj
* >(pTarget
))
1167 pTarget
->NbcAdjustTextFrameWidthAndHeight();
1170 // #i122410# NbcSetOutlinerParaObjectForText at SdrTextObj does not trigger a
1171 // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
1172 // update their preview.
1173 pTarget
->BroadcastObjectChange();
1175 // Trigger PageChangeCall
1176 ImpShowPageOfThisObject();
1179 OUString
SdrUndoObjSetText::GetComment() const
1182 ImpTakeDescriptionStr(STR_UndoObjSetText
,aStr
);
1186 OUString
SdrUndoObjSetText::GetSdrRepeatComment(SdrView
& /*rView*/) const
1189 ImpTakeDescriptionStr(STR_UndoObjSetText
,aStr
);
1193 void SdrUndoObjSetText::SdrRepeat(SdrView
& rView
)
1195 if (bNewTextAvailable
&& rView
.AreObjectsMarked())
1197 const SdrMarkList
& rML
=rView
.GetMarkedObjectList();
1199 const bool bUndo
= rView
.IsUndoEnabled();
1203 ImpTakeDescriptionStr(STR_UndoObjSetText
,aStr
);
1204 rView
.BegUndo(aStr
);
1207 const size_t nCount
=rML
.GetMarkCount();
1208 for (size_t nm
=0; nm
<nCount
; ++nm
)
1210 SdrObject
* pObj2
=rML
.GetMark(nm
)->GetMarkedSdrObj();
1211 SdrTextObj
* pTextObj
=PTR_CAST(SdrTextObj
,pObj2
);
1215 rView
.AddUndo(new SdrUndoObjSetText(*pTextObj
,0));
1217 OutlinerParaObject
* pText1
=pNewText
;
1219 pText1
= new OutlinerParaObject(*pText1
);
1220 pTextObj
->SetOutlinerParaObject(pText1
);
1229 bool SdrUndoObjSetText::CanSdrRepeat(SdrView
& rView
) const
1232 if (bNewTextAvailable
&& rView
.AreObjectsMarked()) {
1238 // Undo/Redo for setting object's name (#i73249#)
1239 SdrUndoObjStrAttr::SdrUndoObjStrAttr( SdrObject
& rNewObj
,
1240 const ObjStrAttrType eObjStrAttr
,
1241 const OUString
& sOldStr
,
1242 const OUString
& sNewStr
)
1243 : SdrUndoObj( rNewObj
)
1244 , meObjStrAttr( eObjStrAttr
)
1245 , msOldStr( sOldStr
)
1246 , msNewStr( sNewStr
)
1250 void SdrUndoObjStrAttr::Undo()
1252 ImpShowPageOfThisObject();
1254 switch ( meObjStrAttr
)
1257 pObj
->SetName( msOldStr
);
1260 pObj
->SetTitle( msOldStr
);
1262 case OBJ_DESCRIPTION
:
1263 pObj
->SetDescription( msOldStr
);
1268 void SdrUndoObjStrAttr::Redo()
1270 switch ( meObjStrAttr
)
1273 pObj
->SetName( msNewStr
);
1276 pObj
->SetTitle( msNewStr
);
1278 case OBJ_DESCRIPTION
:
1279 pObj
->SetDescription( msNewStr
);
1283 ImpShowPageOfThisObject();
1286 OUString
SdrUndoObjStrAttr::GetComment() const
1289 switch ( meObjStrAttr
)
1292 ImpTakeDescriptionStr( STR_UndoObjName
, aStr
);
1293 aStr
+= " '" + msNewStr
+ "'";
1296 ImpTakeDescriptionStr( STR_UndoObjTitle
, aStr
);
1298 case OBJ_DESCRIPTION
:
1299 ImpTakeDescriptionStr( STR_UndoObjDescription
, aStr
);
1307 SdrUndoLayer::SdrUndoLayer(sal_uInt16 nLayerNum
, SdrLayerAdmin
& rNewLayerAdmin
, SdrModel
& rNewModel
)
1308 : SdrUndoAction(rNewModel
)
1309 , pLayer(rNewLayerAdmin
.GetLayer(nLayerNum
))
1310 , pLayerAdmin(&rNewLayerAdmin
)
1316 SdrUndoLayer::~SdrUndoLayer()
1326 void SdrUndoNewLayer::Undo()
1328 DBG_ASSERT(!bItsMine
,"SdrUndoNewLayer::Undo(): Layer already belongs to UndoAction.");
1331 SdrLayer
* pCmpLayer
=
1333 pLayerAdmin
->RemoveLayer(nNum
);
1334 DBG_ASSERT(pCmpLayer
==pLayer
,"SdrUndoNewLayer::Undo(): Removed layer is != pLayer.");
1337 void SdrUndoNewLayer::Redo()
1339 DBG_ASSERT(bItsMine
,"SdrUndoNewLayer::Undo(): Layer does not belong to UndoAction.");
1341 pLayerAdmin
->InsertLayer(pLayer
,nNum
);
1344 OUString
SdrUndoNewLayer::GetComment() const
1346 return ImpGetResStr(STR_UndoNewLayer
);
1351 void SdrUndoDelLayer::Undo()
1353 DBG_ASSERT(bItsMine
,"SdrUndoDelLayer::Undo(): Layer does not belong to UndoAction.");
1355 pLayerAdmin
->InsertLayer(pLayer
,nNum
);
1358 void SdrUndoDelLayer::Redo()
1360 DBG_ASSERT(!bItsMine
,"SdrUndoDelLayer::Undo(): Layer already belongs to UndoAction.");
1363 SdrLayer
* pCmpLayer
=
1365 pLayerAdmin
->RemoveLayer(nNum
);
1366 DBG_ASSERT(pCmpLayer
==pLayer
,"SdrUndoDelLayer::Redo(): Removed layer is != pLayer.");
1369 OUString
SdrUndoDelLayer::GetComment() const
1371 return ImpGetResStr(STR_UndoDelLayer
);
1376 void SdrUndoMoveLayer::Undo()
1379 SdrLayer
* pCmpLayer
=
1381 pLayerAdmin
->RemoveLayer(nNeuPos
);
1382 DBG_ASSERT(pCmpLayer
==pLayer
,"SdrUndoMoveLayer::Undo(): Removed layer is != pLayer.");
1383 pLayerAdmin
->InsertLayer(pLayer
,nNum
);
1386 void SdrUndoMoveLayer::Redo()
1389 SdrLayer
* pCmpLayer
=
1391 pLayerAdmin
->RemoveLayer(nNum
);
1392 DBG_ASSERT(pCmpLayer
==pLayer
,"SdrUndoMoveLayer::Redo(): Removed layer is != pLayer.");
1393 pLayerAdmin
->InsertLayer(pLayer
,nNeuPos
);
1396 OUString
SdrUndoMoveLayer::GetComment() const
1398 return ImpGetResStr(STR_UndoMovLayer
);
1402 SdrUndoPage::SdrUndoPage(SdrPage
& rNewPg
)
1403 : SdrUndoAction(*rNewPg
.GetModel())
1408 void SdrUndoPage::ImpInsertPage(sal_uInt16 nNum
)
1410 DBG_ASSERT(!mrPage
.IsInserted(),"SdrUndoPage::ImpInsertPage(): mrPage is already inserted.");
1411 if (!mrPage
.IsInserted())
1413 if (mrPage
.IsMasterPage())
1415 rMod
.InsertMasterPage(&mrPage
,nNum
);
1419 rMod
.InsertPage(&mrPage
,nNum
);
1424 void SdrUndoPage::ImpRemovePage(sal_uInt16 nNum
)
1426 DBG_ASSERT(mrPage
.IsInserted(),"SdrUndoPage::ImpRemovePage(): mrPage is not inserted.");
1427 if (mrPage
.IsInserted())
1429 SdrPage
* pChkPg
=NULL
;
1430 if (mrPage
.IsMasterPage())
1432 pChkPg
=rMod
.RemoveMasterPage(nNum
);
1436 pChkPg
=rMod
.RemovePage(nNum
);
1438 DBG_ASSERT(pChkPg
==&mrPage
,"SdrUndoPage::ImpRemovePage(): RemovePage!=&mrPage");
1443 void SdrUndoPage::ImpMovePage(sal_uInt16 nOldNum
, sal_uInt16 nNewNum
)
1445 DBG_ASSERT(mrPage
.IsInserted(),"SdrUndoPage::ImpMovePage(): mrPage is not inserted.");
1446 if (mrPage
.IsInserted())
1448 if (mrPage
.IsMasterPage())
1450 rMod
.MoveMasterPage(nOldNum
,nNewNum
);
1454 rMod
.MovePage(nOldNum
,nNewNum
);
1459 void SdrUndoPage::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID
, OUString
& rStr
, sal_uInt16
/*n*/, bool /*bRepeat*/)
1461 rStr
= ImpGetResStr(nStrCacheID
);
1466 SdrUndoPageList::SdrUndoPageList(SdrPage
& rNewPg
)
1467 : SdrUndoPage(rNewPg
)
1470 nPageNum
=rNewPg
.GetPageNum();
1473 SdrUndoPageList::~SdrUndoPageList()
1483 SdrUndoDelPage::SdrUndoDelPage(SdrPage
& rNewPg
)
1484 : SdrUndoPageList(rNewPg
)
1489 // now remember the master page relationships
1490 if(mrPage
.IsMasterPage())
1492 sal_uInt16
nPageAnz(rMod
.GetPageCount());
1494 for(sal_uInt16
nPageNum2(0); nPageNum2
< nPageAnz
; nPageNum2
++)
1496 SdrPage
* pDrawPage
= rMod
.GetPage(nPageNum2
);
1498 if(pDrawPage
->TRG_HasMasterPage())
1500 SdrPage
& rMasterPage
= pDrawPage
->TRG_GetMasterPage();
1502 if(&mrPage
== &rMasterPage
)
1506 pUndoGroup
= new SdrUndoGroup(rMod
);
1509 pUndoGroup
->AddAction(rMod
.GetSdrUndoFactory().CreateUndoPageRemoveMasterPage(*pDrawPage
));
1516 SdrUndoDelPage::~SdrUndoDelPage()
1521 void SdrUndoDelPage::Undo()
1523 ImpInsertPage(nPageNum
);
1524 if (pUndoGroup
!=NULL
)
1526 // recover master page relationships
1529 DBG_ASSERT(bItsMine
,"UndoDeletePage: mrPage does not belong to UndoAction.");
1533 void SdrUndoDelPage::Redo()
1535 ImpRemovePage(nPageNum
);
1536 // master page relations are dissolved automatically
1537 DBG_ASSERT(!bItsMine
,"RedoDeletePage: mrPage already belongs to UndoAction.");
1541 OUString
SdrUndoDelPage::GetComment() const
1544 ImpTakeDescriptionStr(STR_UndoDelPage
,aStr
,0,false);
1548 OUString
SdrUndoDelPage::GetSdrRepeatComment(SdrView
& /*rView*/) const
1551 ImpTakeDescriptionStr(STR_UndoDelPage
,aStr
,0,false);
1555 void SdrUndoDelPage::SdrRepeat(SdrView
& /*rView*/)
1559 bool SdrUndoDelPage::CanSdrRepeat(SdrView
& /*rView*/) const
1566 void SdrUndoNewPage::Undo()
1568 ImpRemovePage(nPageNum
);
1569 DBG_ASSERT(!bItsMine
,"UndoNewPage: mrPage already belongs to UndoAction.");
1573 void SdrUndoNewPage::Redo()
1575 ImpInsertPage(nPageNum
);
1576 DBG_ASSERT(bItsMine
,"RedoNewPage: mrPage does not belong to UndoAction.");
1580 OUString
SdrUndoNewPage::GetComment() const
1583 ImpTakeDescriptionStr(STR_UndoNewPage
,aStr
,0,false);
1589 OUString
SdrUndoCopyPage::GetComment() const
1592 ImpTakeDescriptionStr(STR_UndoCopPage
,aStr
,0,false);
1596 OUString
SdrUndoCopyPage::GetSdrRepeatComment(SdrView
& /*rView*/) const
1599 ImpTakeDescriptionStr(STR_UndoCopPage
,aStr
,0,false);
1603 void SdrUndoCopyPage::SdrRepeat(SdrView
& /*rView*/)
1608 bool SdrUndoCopyPage::CanSdrRepeat(SdrView
& /*rView*/) const
1615 void SdrUndoSetPageNum::Undo()
1617 ImpMovePage(nNewPageNum
,nOldPageNum
);
1620 void SdrUndoSetPageNum::Redo()
1622 ImpMovePage(nOldPageNum
,nNewPageNum
);
1625 OUString
SdrUndoSetPageNum::GetComment() const
1628 ImpTakeDescriptionStr(STR_UndoMovPage
,aStr
,0,false);
1632 SdrUndoPageMasterPage::SdrUndoPageMasterPage(SdrPage
& rChangedPage
)
1633 : SdrUndoPage(rChangedPage
)
1634 , mbOldHadMasterPage(mrPage
.TRG_HasMasterPage())
1635 , maOldMasterPageNumber(0)
1637 // get current state from page
1638 if(mbOldHadMasterPage
)
1640 maOldSet
= mrPage
.TRG_GetMasterPageVisibleLayers();
1641 maOldMasterPageNumber
= mrPage
.TRG_GetMasterPage().GetPageNum();
1645 SdrUndoPageMasterPage::~SdrUndoPageMasterPage()
1649 SdrUndoPageRemoveMasterPage::SdrUndoPageRemoveMasterPage(SdrPage
& rChangedPage
)
1650 : SdrUndoPageMasterPage(rChangedPage
)
1654 void SdrUndoPageRemoveMasterPage::Undo()
1656 if(mbOldHadMasterPage
)
1658 mrPage
.TRG_SetMasterPage(*mrPage
.GetModel()->GetMasterPage(maOldMasterPageNumber
));
1659 mrPage
.TRG_SetMasterPageVisibleLayers(maOldSet
);
1663 void SdrUndoPageRemoveMasterPage::Redo()
1665 mrPage
.TRG_ClearMasterPage();
1668 OUString
SdrUndoPageRemoveMasterPage::GetComment() const
1671 ImpTakeDescriptionStr(STR_UndoDelPageMasterDscr
,aStr
,0,false);
1675 SdrUndoPageChangeMasterPage::SdrUndoPageChangeMasterPage(SdrPage
& rChangedPage
)
1676 : SdrUndoPageMasterPage(rChangedPage
)
1677 , mbNewHadMasterPage(false)
1678 , maNewMasterPageNumber(0)
1682 void SdrUndoPageChangeMasterPage::Undo()
1684 // remember values from new page
1685 if(mrPage
.TRG_HasMasterPage())
1687 mbNewHadMasterPage
= true;
1688 maNewSet
= mrPage
.TRG_GetMasterPageVisibleLayers();
1689 maNewMasterPageNumber
= mrPage
.TRG_GetMasterPage().GetPageNum();
1692 // restore old values
1693 if(mbOldHadMasterPage
)
1695 mrPage
.TRG_ClearMasterPage();
1696 mrPage
.TRG_SetMasterPage(*mrPage
.GetModel()->GetMasterPage(maOldMasterPageNumber
));
1697 mrPage
.TRG_SetMasterPageVisibleLayers(maOldSet
);
1701 void SdrUndoPageChangeMasterPage::Redo()
1703 // restore new values
1704 if(mbNewHadMasterPage
)
1706 mrPage
.TRG_ClearMasterPage();
1707 mrPage
.TRG_SetMasterPage(*mrPage
.GetModel()->GetMasterPage(maNewMasterPageNumber
));
1708 mrPage
.TRG_SetMasterPageVisibleLayers(maNewSet
);
1712 OUString
SdrUndoPageChangeMasterPage::GetComment() const
1715 ImpTakeDescriptionStr(STR_UndoChgPageMasterDscr
,aStr
,0,false);
1720 SdrUndoFactory::~SdrUndoFactory(){}
1722 SdrUndoAction
* SdrUndoFactory::CreateUndoMoveObject( SdrObject
& rObject
)
1724 return new SdrUndoMoveObj( rObject
);
1727 SdrUndoAction
* SdrUndoFactory::CreateUndoMoveObject( SdrObject
& rObject
, const Size
& rDist
)
1729 return new SdrUndoMoveObj( rObject
, rDist
);
1732 SdrUndoAction
* SdrUndoFactory::CreateUndoGeoObject( SdrObject
& rObject
)
1734 return new SdrUndoGeoObj( rObject
);
1737 SdrUndoAction
* SdrUndoFactory::CreateUndoAttrObject( SdrObject
& rObject
, bool bStyleSheet1
, bool bSaveText
)
1739 return new SdrUndoAttrObj( rObject
, bStyleSheet1
, bSaveText
);
1742 SdrUndoAction
* SdrUndoFactory::CreateUndoRemoveObject( SdrObject
& rObject
, bool bOrdNumDirect
)
1744 return new SdrUndoRemoveObj( rObject
, bOrdNumDirect
);
1747 SdrUndoAction
* SdrUndoFactory::CreateUndoInsertObject( SdrObject
& rObject
, bool bOrdNumDirect
)
1749 return new SdrUndoInsertObj( rObject
, bOrdNumDirect
);
1752 SdrUndoAction
* SdrUndoFactory::CreateUndoDeleteObject( SdrObject
& rObject
, bool bOrdNumDirect
)
1754 return new SdrUndoDelObj( rObject
, bOrdNumDirect
);
1757 SdrUndoAction
* SdrUndoFactory::CreateUndoNewObject( SdrObject
& rObject
, bool bOrdNumDirect
)
1759 return new SdrUndoNewObj( rObject
, bOrdNumDirect
);
1762 SdrUndoAction
* SdrUndoFactory::CreateUndoCopyObject( SdrObject
& rObject
, bool bOrdNumDirect
)
1764 return new SdrUndoCopyObj( rObject
, bOrdNumDirect
);
1767 SdrUndoAction
* SdrUndoFactory::CreateUndoObjectOrdNum( SdrObject
& rObject
, sal_uInt32 nOldOrdNum1
, sal_uInt32 nNewOrdNum1
)
1769 return new SdrUndoObjOrdNum( rObject
, nOldOrdNum1
, nNewOrdNum1
);
1772 SdrUndoAction
* SdrUndoFactory::CreateUndoReplaceObject( SdrObject
& rOldObject
, SdrObject
& rNewObject
, bool bOrdNumDirect
)
1774 return new SdrUndoReplaceObj( rOldObject
, rNewObject
, bOrdNumDirect
);
1777 SdrUndoAction
* SdrUndoFactory::CreateUndoObjectLayerChange( SdrObject
& rObject
, SdrLayerID aOldLayer
, SdrLayerID aNewLayer
)
1779 return new SdrUndoObjectLayerChange( rObject
, aOldLayer
, aNewLayer
);
1782 SdrUndoAction
* SdrUndoFactory::CreateUndoObjectSetText( SdrObject
& rNewObj
, sal_Int32 nText
)
1784 return new SdrUndoObjSetText( rNewObj
, nText
);
1787 SdrUndoAction
* SdrUndoFactory::CreateUndoObjectStrAttr( SdrObject
& rObject
,
1788 SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType
,
1789 const OUString
& sOldStr
,
1790 const OUString
& sNewStr
)
1792 return new SdrUndoObjStrAttr( rObject
, eObjStrAttrType
, sOldStr
, sNewStr
);
1797 SdrUndoAction
* SdrUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum
, SdrLayerAdmin
& rNewLayerAdmin
, SdrModel
& rNewModel
)
1799 return new SdrUndoNewLayer( nLayerNum
, rNewLayerAdmin
, rNewModel
);
1802 SdrUndoAction
* SdrUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum
, SdrLayerAdmin
& rNewLayerAdmin
, SdrModel
& rNewModel
)
1804 return new SdrUndoDelLayer( nLayerNum
, rNewLayerAdmin
, rNewModel
);
1807 SdrUndoAction
* SdrUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum
, SdrLayerAdmin
& rNewLayerAdmin
, SdrModel
& rNewModel
, sal_uInt16 nNeuPos1
)
1809 return new SdrUndoMoveLayer( nLayerNum
, rNewLayerAdmin
, rNewModel
, nNeuPos1
);
1813 SdrUndoAction
* SdrUndoFactory::CreateUndoDeletePage(SdrPage
& rPage
)
1815 return new SdrUndoDelPage( rPage
);
1818 SdrUndoAction
* SdrUndoFactory::CreateUndoNewPage(SdrPage
& rPage
)
1820 return new SdrUndoNewPage( rPage
);
1823 SdrUndoAction
* SdrUndoFactory::CreateUndoCopyPage(SdrPage
& rPage
)
1825 return new SdrUndoCopyPage( rPage
);
1828 SdrUndoAction
* SdrUndoFactory::CreateUndoSetPageNum(SdrPage
& rNewPg
, sal_uInt16 nOldPageNum1
, sal_uInt16 nNewPageNum1
)
1830 return new SdrUndoSetPageNum( rNewPg
, nOldPageNum1
, nNewPageNum1
);
1833 SdrUndoAction
* SdrUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage
& rChangedPage
)
1835 return new SdrUndoPageRemoveMasterPage( rChangedPage
);
1838 SdrUndoAction
* SdrUndoFactory::CreateUndoPageChangeMasterPage(SdrPage
& rChangedPage
)
1840 return new SdrUndoPageChangeMasterPage(rChangedPage
);
1844 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */