xref: /aoo42x/main/svx/source/svdraw/svdundo.cxx (revision 88b53a7c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 
27 #include <svx/svdundo.hxx>
28 #include "svx/svditext.hxx"
29 #include <svx/svdotext.hxx>
30 #include <svx/svdobj.hxx>
31 #include <svx/svdpage.hxx>
32 #include <svx/svdlayer.hxx>
33 #include <svx/svdmodel.hxx>
34 #include <svx/svdview.hxx>
35 #include "svx/svdstr.hrc"   // Namen aus der Resource
36 #include "svx/svdglob.hxx"  // StringCache
37 #include <svx/scene3d.hxx>
38 #include <editeng/outlobj.hxx>
39 #include <svx/svdogrp.hxx>
40 #include <svx/sdr/properties/itemsettools.hxx>
41 #include <svx/sdr/properties/properties.hxx>
42 #include <svx/svdocapt.hxx>
43 #include <svl/whiter.hxx>
44 #include <svx/e3dsceneupdater.hxx>
45 #include <svx/svdviter.hxx>
46 #include <svx/svdograf.hxx>
47 #include <svx/sdr/contact/viewcontactofgraphic.hxx>
48 
49 ////////////////////////////////////////////////////////////////////////////////////////////////////
50 
51 // iterates over all views and unmarks this SdrObject if it is marked
52 static void ImplUnmarkObject( SdrObject* pObj )
53 {
54     SdrViewIter aIter( pObj );
55     for ( SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView() )
56 	{
57 		pView->MarkObj( pObj, pView->GetSdrPageView(), sal_True );
58 	}
59 }
60 
61 ////////////////////////////////////////////////////////////////////////////////////////////////////
62 
63 TYPEINIT1(SdrUndoAction,SfxUndoAction);
64 
65 sal_Bool SdrUndoAction::CanRepeat(SfxRepeatTarget& rView) const
66 {
67 	SdrView* pV=PTR_CAST(SdrView,&rView);
68 	if (pV!=NULL) return CanSdrRepeat(*pV);
69 	return sal_False;
70 }
71 
72 void SdrUndoAction::Repeat(SfxRepeatTarget& rView)
73 {
74 	SdrView* pV=PTR_CAST(SdrView,&rView);
75 	if (pV!=NULL) SdrRepeat(*pV);
76 	DBG_ASSERT(pV!=NULL,"Repeat: Uebergebenes SfxRepeatTarget ist keine SdrView");
77 }
78 
79 XubString SdrUndoAction::GetRepeatComment(SfxRepeatTarget& rView) const
80 {
81 	SdrView* pV=PTR_CAST(SdrView,&rView);
82 	if (pV!=NULL) return GetSdrRepeatComment(*pV);
83 	return String();
84 }
85 
86 bool SdrUndoAction::CanSdrRepeat(SdrView& /*rView*/) const
87 {
88 	return sal_False;
89 }
90 
91 void SdrUndoAction::SdrRepeat(SdrView& /*rView*/)
92 {
93 }
94 
95 XubString SdrUndoAction::GetSdrRepeatComment(SdrView& /*rView*/) const
96 {
97 	return String();
98 }
99 
100 ////////////////////////////////////////////////////////////////////////////////////////////////////
101 
102 SdrUndoGroup::SdrUndoGroup(SdrModel& rNewMod)
103 :	SdrUndoAction(rNewMod),
104 	aBuf(1024,32,32),
105 	eFunction(SDRREPFUNC_OBJ_NONE)		/*#72642#*/
106 {}
107 
108 SdrUndoGroup::SdrUndoGroup(SdrModel& rNewMod,const String& rStr)
109 :	SdrUndoAction(rNewMod),
110 	aBuf(1024,32,32),
111 	aComment(rStr),
112 	eFunction(SDRREPFUNC_OBJ_NONE)
113 {}
114 
115 SdrUndoGroup::~SdrUndoGroup()
116 {
117 	Clear();
118 }
119 
120 void SdrUndoGroup::Clear()
121 {
122 	for (sal_uIntPtr nu=0; nu<GetActionCount(); nu++) {
123 		SdrUndoAction* pAct=GetAction(nu);
124 		delete pAct;
125 	}
126 	aBuf.Clear();
127 }
128 
129 void SdrUndoGroup::AddAction(SdrUndoAction* pAct)
130 {
131 	aBuf.Insert(pAct,CONTAINER_APPEND);
132 }
133 
134 void SdrUndoGroup::push_front( SdrUndoAction* pAct )
135 {
136 	aBuf.Insert(pAct, (sal_uIntPtr)0 );
137 }
138 
139 void SdrUndoGroup::Undo()
140 {
141 	for (sal_uIntPtr nu=GetActionCount(); nu>0;) {
142 		nu--;
143 		SdrUndoAction* pAct=GetAction(nu);
144 		pAct->Undo();
145 	}
146 }
147 
148 void SdrUndoGroup::Redo()
149 {
150 	for (sal_uIntPtr nu=0; nu<GetActionCount(); nu++) {
151 		SdrUndoAction* pAct=GetAction(nu);
152 		pAct->Redo();
153 	}
154 }
155 
156 XubString SdrUndoGroup::GetComment() const
157 {
158 	XubString aRet(aComment);
159 	sal_Char aSearchText[] = "%1";
160 	String aSearchString(aSearchText, sizeof(aSearchText)-1);
161 
162 	aRet.SearchAndReplace(aSearchString, aObjDescription);
163 
164 	return aRet;
165 }
166 
167 bool SdrUndoGroup::CanSdrRepeat(SdrView& rView) const
168 {
169 	switch (eFunction) {
170 		case SDRREPFUNC_OBJ_NONE			:  return sal_False;
171 		case SDRREPFUNC_OBJ_DELETE          :  return rView.AreObjectsMarked();
172 		case SDRREPFUNC_OBJ_COMBINE_POLYPOLY:  return rView.IsCombinePossible(sal_False);
173 		case SDRREPFUNC_OBJ_COMBINE_ONEPOLY :  return rView.IsCombinePossible(sal_True);
174 		case SDRREPFUNC_OBJ_DISMANTLE_POLYS :  return rView.IsDismantlePossible(sal_False);
175 		case SDRREPFUNC_OBJ_DISMANTLE_LINES :  return rView.IsDismantlePossible(sal_True);
176 		case SDRREPFUNC_OBJ_CONVERTTOPOLY   :  return rView.IsConvertToPolyObjPossible(sal_False);
177 		case SDRREPFUNC_OBJ_CONVERTTOPATH   :  return rView.IsConvertToPathObjPossible(sal_False);
178 		case SDRREPFUNC_OBJ_GROUP           :  return rView.IsGroupPossible();
179 		case SDRREPFUNC_OBJ_UNGROUP         :  return rView.IsUnGroupPossible();
180 		case SDRREPFUNC_OBJ_PUTTOTOP        :  return rView.IsToTopPossible();
181 		case SDRREPFUNC_OBJ_PUTTOBTM        :  return rView.IsToBtmPossible();
182 		case SDRREPFUNC_OBJ_MOVTOTOP        :  return rView.IsToTopPossible();
183 		case SDRREPFUNC_OBJ_MOVTOBTM        :  return rView.IsToBtmPossible();
184 		case SDRREPFUNC_OBJ_REVORDER        :  return rView.IsReverseOrderPossible();
185 		case SDRREPFUNC_OBJ_IMPORTMTF       :  return rView.IsImportMtfPossible();
186 		default: break;
187 	} // switch
188 	return sal_False;
189 }
190 
191 void SdrUndoGroup::SdrRepeat(SdrView& rView)
192 {
193 	switch (eFunction) {
194 		case SDRREPFUNC_OBJ_NONE			:  break;
195 		case SDRREPFUNC_OBJ_DELETE          :  rView.DeleteMarked();                break;
196 		case SDRREPFUNC_OBJ_COMBINE_POLYPOLY:  rView.CombineMarkedObjects(sal_False);   break;
197 		case SDRREPFUNC_OBJ_COMBINE_ONEPOLY :  rView.CombineMarkedObjects(sal_True);    break;
198 		case SDRREPFUNC_OBJ_DISMANTLE_POLYS :  rView.DismantleMarkedObjects(sal_False); break;
199 		case SDRREPFUNC_OBJ_DISMANTLE_LINES :  rView.DismantleMarkedObjects(sal_True);  break;
200 		case SDRREPFUNC_OBJ_CONVERTTOPOLY   :  rView.ConvertMarkedToPolyObj(sal_False); break;
201 		case SDRREPFUNC_OBJ_CONVERTTOPATH   :  rView.ConvertMarkedToPathObj(sal_False); break;
202 		case SDRREPFUNC_OBJ_GROUP           :  rView.GroupMarked();                 break;
203 		case SDRREPFUNC_OBJ_UNGROUP         :  rView.UnGroupMarked();               break;
204 		case SDRREPFUNC_OBJ_PUTTOTOP        :  rView.PutMarkedToTop();              break;
205 		case SDRREPFUNC_OBJ_PUTTOBTM        :  rView.PutMarkedToBtm();              break;
206 		case SDRREPFUNC_OBJ_MOVTOTOP        :  rView.MovMarkedToTop();              break;
207 		case SDRREPFUNC_OBJ_MOVTOBTM        :  rView.MovMarkedToBtm();              break;
208 		case SDRREPFUNC_OBJ_REVORDER        :  rView.ReverseOrderOfMarked();        break;
209 		case SDRREPFUNC_OBJ_IMPORTMTF       :  rView.DoImportMarkedMtf();           break;
210 		default: break;
211 	} // switch
212 }
213 
214 XubString SdrUndoGroup::GetSdrRepeatComment(SdrView& /*rView*/) const
215 {
216 	XubString aRet(aComment);
217 	sal_Char aSearchText[] = "%1";
218 	String aSearchString(aSearchText, sizeof(aSearchText)-1);
219 
220 	aRet.SearchAndReplace(aSearchString, ImpGetResStr(STR_ObjNameSingulPlural));
221 
222 	return aRet;
223 }
224 
225 ////////////////////////////////////////////////////////////////////////////////////////////////////
226 ////////////////////////////////////////////////////////////////////////////////////////////////////
227 //
228 //   @@@@   @@@@@   @@@@@@  @@@@@   @@@@   @@@@@@   @@@@
229 //  @@  @@  @@  @@      @@  @@     @@  @@    @@    @@  @@
230 //  @@  @@  @@  @@      @@  @@     @@        @@    @@
231 //  @@  @@  @@@@@       @@  @@@@   @@        @@     @@@@
232 //  @@  @@  @@  @@      @@  @@     @@        @@        @@
233 //  @@  @@  @@  @@  @@  @@  @@     @@  @@    @@    @@  @@
234 //   @@@@   @@@@@    @@@@   @@@@@   @@@@     @@     @@@@
235 //
236 ////////////////////////////////////////////////////////////////////////////////////////////////////
237 ////////////////////////////////////////////////////////////////////////////////////////////////////
238 
239 SdrUndoObj::SdrUndoObj(SdrObject& rNewObj):
240 	SdrUndoAction(*rNewObj.GetModel()),
241 	pObj(&rNewObj)
242 {
243 }
244 
245 void SdrUndoObj::GetDescriptionStringForObject( const SdrObject& _rForObject, sal_uInt16 nStrCacheID, String& rStr, FASTBOOL bRepeat )
246 {
247 	rStr = ImpGetResStr(nStrCacheID);
248 	sal_Char aSearchText[] = "%1";
249 	String aSearchString(aSearchText, sizeof(aSearchText)-1);
250 
251 	xub_StrLen nPos = rStr.Search(aSearchString);
252 
253 	if(nPos != STRING_NOTFOUND)
254 	{
255 		rStr.Erase(nPos, 2);
256 
257 		if(bRepeat)
258 		{
259 			rStr.Insert(ImpGetResStr(STR_ObjNameSingulPlural), nPos);
260 		}
261 		else
262 		{
263 			XubString aStr;
264 
265 			_rForObject.TakeObjNameSingul(aStr);
266 			rStr.Insert(aStr, nPos);
267 		}
268 	}
269 }
270 
271 void SdrUndoObj::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, FASTBOOL bRepeat) const
272 {
273     if ( pObj )
274         GetDescriptionStringForObject( *pObj, nStrCacheID, rStr, bRepeat );
275 }
276 
277 // #94278# common call method for evtl. page change when UNDO/REDO
278 // is triggered
279 void SdrUndoObj::ImpShowPageOfThisObject()
280 {
281 	if(pObj && pObj->IsInserted() && pObj->GetPage() && pObj->GetModel())
282 	{
283 		SdrHint aHint(HINT_SWITCHTOPAGE);
284 
285 		aHint.SetObject(pObj);
286 		aHint.SetPage(pObj->GetPage());
287 
288 		pObj->GetModel()->Broadcast(aHint);
289 	}
290 }
291 
292 ////////////////////////////////////////////////////////////////////////////////////////////////////
293 
294 void SdrUndoAttrObj::ensureStyleSheetInStyleSheetPool(SfxStyleSheetBasePool& rStyleSheetPool, SfxStyleSheet& rSheet)
295 {
296     SfxStyleSheetBase* pThere = rStyleSheetPool.Find(rSheet.GetName(), rSheet.GetFamily());
297 
298     if(!pThere)
299     {
300         // re-insert remembered style which was removed in the meantime. To do this
301         // without assertion, do it without parent and set parent after insertion
302         const UniString aParent(rSheet.GetParent());
303 
304         rSheet.SetParent(UniString());
305         rStyleSheetPool.Insert(&rSheet);
306         rSheet.SetParent(aParent);
307     }
308 }
309 
310 SdrUndoAttrObj::SdrUndoAttrObj(SdrObject& rNewObj, FASTBOOL bStyleSheet1, FASTBOOL bSaveText)
311 :	SdrUndoObj(rNewObj),
312 	pUndoSet(NULL),
313 	pRedoSet(NULL),
314 	pRepeatSet(NULL),
315     mxUndoStyleSheet(),
316     mxRedoStyleSheet(),
317 	bHaveToTakeRedoSet(sal_True),
318 	pTextUndo(NULL),
319 
320 	// #i8508#
321 	pTextRedo(NULL),
322 
323 	pUndoGroup(NULL)
324 {
325 	bStyleSheet = bStyleSheet1;
326 
327 	SdrObjList* pOL = rNewObj.GetSubList();
328 	sal_Bool bIsGroup(pOL!=NULL && pOL->GetObjCount());
329 	sal_Bool bIs3DScene(bIsGroup && pObj->ISA(E3dScene));
330 
331 	if(bIsGroup)
332 	{
333 		// Aha, Gruppenobjekt
334 		pUndoGroup = new SdrUndoGroup(*pObj->GetModel());
335 		sal_uInt32 nObjAnz(pOL->GetObjCount());
336 
337 		for(sal_uInt32 nObjNum(0); nObjNum < nObjAnz; nObjNum++)
338 		{
339 			pUndoGroup->AddAction(
340 				new SdrUndoAttrObj(*pOL->GetObj(nObjNum), bStyleSheet1));
341 		}
342 	}
343 
344 	if(!bIsGroup || bIs3DScene)
345 	{
346 		if(pUndoSet)
347 		{
348 			delete pUndoSet;
349 		}
350 
351 		pUndoSet = new SfxItemSet(pObj->GetMergedItemSet());
352 
353 		if(bStyleSheet)
354             mxUndoStyleSheet = pObj->GetStyleSheet();
355 
356 		if(bSaveText)
357 		{
358 			pTextUndo = pObj->GetOutlinerParaObject();
359 			if(pTextUndo)
360 				pTextUndo = new OutlinerParaObject(*pTextUndo);
361 		}
362 	}
363 }
364 
365 SdrUndoAttrObj::~SdrUndoAttrObj()
366 {
367 	if(pUndoSet)
368 		delete pUndoSet;
369 	if(pRedoSet)
370 		delete pRedoSet;
371 	if(pRepeatSet)
372 		delete pRepeatSet;
373 	if(pUndoGroup)
374 		delete pUndoGroup;
375 	if(pTextUndo)
376 		delete pTextUndo;
377 
378 	// #i8508#
379 	if(pTextRedo)
380 		delete pTextRedo;
381 }
382 
383 void SdrUndoAttrObj::SetRepeatAttr(const SfxItemSet& rSet)
384 {
385 	if(pRepeatSet)
386 		delete pRepeatSet;
387 
388 	pRepeatSet = new SfxItemSet(rSet);
389 }
390 
391 void SdrUndoAttrObj::Undo()
392 {
393     E3DModifySceneSnapRectUpdater aUpdater(pObj);
394 	sal_Bool bIs3DScene(pObj && pObj->ISA(E3dScene));
395 
396 	// #94278# Trigger PageChangeCall
397 	ImpShowPageOfThisObject();
398 
399 	if(!pUndoGroup || bIs3DScene)
400 	{
401 		if(bHaveToTakeRedoSet)
402 		{
403 			bHaveToTakeRedoSet = sal_False;
404 
405 			if(pRedoSet)
406 			{
407 				delete pRedoSet;
408 			}
409 
410 			pRedoSet = new SfxItemSet(pObj->GetMergedItemSet());
411 
412 			if(bStyleSheet)
413 				mxRedoStyleSheet = pObj->GetStyleSheet();
414 
415 			if(pTextUndo)
416 			{
417 				// #i8508#
418 				pTextRedo = pObj->GetOutlinerParaObject();
419 
420 				if(pTextRedo)
421 					pTextRedo = new OutlinerParaObject(*pTextRedo);
422 			}
423 		}
424 
425 		if(bStyleSheet)
426 		{
427 			mxRedoStyleSheet = pObj->GetStyleSheet();
428             SfxStyleSheet* pSheet = dynamic_cast< SfxStyleSheet* >(mxUndoStyleSheet.get());
429 
430             if(pSheet && pObj->GetModel() && pObj->GetModel()->GetStyleSheetPool())
431             {
432                 ensureStyleSheetInStyleSheetPool(*pObj->GetModel()->GetStyleSheetPool(), *pSheet);
433     			pObj->SetStyleSheet(pSheet, sal_True);
434             }
435             else
436             {
437                 OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
438             }
439 		}
440 
441 		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
442 
443 		// #105122# Since ClearItem sets back everything to normal
444 		// it also sets fit-to-size text to non-fit-to-size text and
445 		// switches on autogrowheight (the default). That may lead to
446 		// loosing the geometry size info for the object when it is
447 		// re-layouted from AdjustTextFrameWidthAndHeight(). This makes
448 		// rescuing the size of the object necessary.
449 		const Rectangle aSnapRect = pObj->GetSnapRect();
450 
451 		if(pUndoSet)
452 		{
453 			// #109587#
454 			if(pObj->ISA(SdrCaptionObj))
455 			{
456 				// do a more smooth item deletion here, else the text
457 				// rect will be reformatted, especially when information regarding
458 				// vertical text is changed. When clearing only set items it's
459 				// slower, but safer regarding such information (it's not changed
460 				// usually)
461 				SfxWhichIter aIter(*pUndoSet);
462 				sal_uInt16 nWhich(aIter.FirstWhich());
463 
464 				while(nWhich)
465 				{
466 					if(SFX_ITEM_SET != pUndoSet->GetItemState(nWhich, sal_False))
467 					{
468 						pObj->ClearMergedItem(nWhich);
469 					}
470 
471 					nWhich = aIter.NextWhich();
472 				}
473 			}
474 			else
475 			{
476 				pObj->ClearMergedItem();
477 			}
478 
479 			pObj->SetMergedItemSet(*pUndoSet);
480 		}
481 
482 		// #105122# Restore prev size here when it was changed.
483 		if(aSnapRect != pObj->GetSnapRect())
484 		{
485 			pObj->NbcSetSnapRect(aSnapRect);
486 		}
487 
488 		pObj->GetProperties().BroadcastItemChange(aItemChange);
489 
490 		if(pTextUndo)
491 		{
492 			pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextUndo));
493 		}
494 	}
495 
496 	if(pUndoGroup)
497 	{
498 		pUndoGroup->Undo();
499 	}
500 }
501 
502 void SdrUndoAttrObj::Redo()
503 {
504     E3DModifySceneSnapRectUpdater aUpdater(pObj);
505 	sal_Bool bIs3DScene(pObj && pObj->ISA(E3dScene));
506 
507 	if(!pUndoGroup || bIs3DScene)
508 	{
509 		if(bStyleSheet)
510 		{
511             mxUndoStyleSheet = pObj->GetStyleSheet();
512             SfxStyleSheet* pSheet = dynamic_cast< SfxStyleSheet* >(mxRedoStyleSheet.get());
513 
514             if(pSheet && pObj->GetModel() && pObj->GetModel()->GetStyleSheetPool())
515             {
516                 ensureStyleSheetInStyleSheetPool(*pObj->GetModel()->GetStyleSheetPool(), *pSheet);
517 			    pObj->SetStyleSheet(pSheet, sal_True);
518             }
519             else
520             {
521                 OSL_ENSURE(false, "OOps, something went wrong in SdrUndoAttrObj (!)");
522             }
523 		}
524 
525 		sdr::properties::ItemChangeBroadcaster aItemChange(*pObj);
526 
527 		// #105122#
528 		const Rectangle aSnapRect = pObj->GetSnapRect();
529 
530 		if(pRedoSet)
531 		{
532 			// #109587#
533 			if(pObj->ISA(SdrCaptionObj))
534 			{
535 				// do a more smooth item deletion here, else the text
536 				// rect will be reformatted, especially when information regarding
537 				// vertical text is changed. When clearing only set items it's
538 				// slower, but safer regarding such information (it's not changed
539 				// usually)
540 				SfxWhichIter aIter(*pRedoSet);
541 				sal_uInt16 nWhich(aIter.FirstWhich());
542 
543 				while(nWhich)
544 				{
545 					if(SFX_ITEM_SET != pRedoSet->GetItemState(nWhich, sal_False))
546 					{
547 						pObj->ClearMergedItem(nWhich);
548 					}
549 
550 					nWhich = aIter.NextWhich();
551 				}
552 			}
553 			else
554 			{
555 				pObj->ClearMergedItem();
556 			}
557 
558 			pObj->SetMergedItemSet(*pRedoSet);
559 		}
560 
561 		// #105122# Restore prev size here when it was changed.
562 		if(aSnapRect != pObj->GetSnapRect())
563 		{
564 			pObj->NbcSetSnapRect(aSnapRect);
565 		}
566 
567 		pObj->GetProperties().BroadcastItemChange(aItemChange);
568 
569 		// #i8508#
570 		if(pTextRedo)
571 		{
572 			pObj->SetOutlinerParaObject(new OutlinerParaObject(*pTextRedo));
573 		}
574 	}
575 
576 	if(pUndoGroup)
577 	{
578 		pUndoGroup->Redo();
579 	}
580 
581 	// #94278# Trigger PageChangeCall
582 	ImpShowPageOfThisObject();
583 }
584 
585 XubString SdrUndoAttrObj::GetComment() const
586 {
587 	XubString aStr;
588 
589 	if(bStyleSheet)
590 	{
591 		ImpTakeDescriptionStr(STR_EditSetStylesheet, aStr);
592 	}
593 	else
594 	{
595 		ImpTakeDescriptionStr(STR_EditSetAttributes, aStr);
596 	}
597 
598 	return aStr;
599 }
600 
601 void SdrUndoAttrObj::SdrRepeat(SdrView& rView)
602 {
603 	if(pRepeatSet)
604 	{
605 		rView.SetAttrToMarked(*pRepeatSet, sal_False);
606 	}
607 }
608 
609 bool SdrUndoAttrObj::CanSdrRepeat(SdrView& rView) const
610 {
611 	return (pRepeatSet!=0L && rView.AreObjectsMarked());
612 }
613 
614 XubString SdrUndoAttrObj::GetSdrRepeatComment(SdrView& /*rView*/) const
615 {
616 	XubString aStr;
617 
618 	if(bStyleSheet)
619 	{
620 		ImpTakeDescriptionStr(STR_EditSetStylesheet, aStr, sal_True);
621 	}
622 	else
623 	{
624 		ImpTakeDescriptionStr(STR_EditSetAttributes, aStr, sal_True);
625 	}
626 
627 	return aStr;
628 }
629 
630 ////////////////////////////////////////////////////////////////////////////////////////////////////
631 
632 void SdrUndoMoveObj::Undo()
633 {
634 	// #94278# Trigger PageChangeCall
635 	ImpShowPageOfThisObject();
636 
637 	pObj->Move(Size(-aDistance.Width(),-aDistance.Height()));
638 }
639 
640 void SdrUndoMoveObj::Redo()
641 {
642 	pObj->Move(Size(aDistance.Width(),aDistance.Height()));
643 
644 	// #94278# Trigger PageChangeCall
645 	ImpShowPageOfThisObject();
646 }
647 
648 XubString SdrUndoMoveObj::GetComment() const
649 {
650 	XubString aStr;
651 	ImpTakeDescriptionStr(STR_EditMove,aStr);
652 	return aStr;
653 }
654 
655 void SdrUndoMoveObj::SdrRepeat(SdrView& rView)
656 {
657 	rView.MoveMarkedObj(aDistance);
658 }
659 
660 bool SdrUndoMoveObj::CanSdrRepeat(SdrView& rView) const
661 {
662 	return rView.AreObjectsMarked();
663 }
664 
665 XubString SdrUndoMoveObj::GetSdrRepeatComment(SdrView& /*rView*/) const
666 {
667 	XubString aStr;
668 	ImpTakeDescriptionStr(STR_EditMove,aStr,sal_True);
669 	return aStr;
670 }
671 
672 ////////////////////////////////////////////////////////////////////////////////////////////////////
673 
674 SdrUndoGeoObj::SdrUndoGeoObj(SdrObject& rNewObj):
675 	SdrUndoObj(rNewObj),
676 	pUndoGeo(NULL),
677 	pRedoGeo(NULL),
678 	pUndoGroup(NULL)
679 {
680 	SdrObjList* pOL=rNewObj.GetSubList();
681 	if (pOL!=NULL && pOL->GetObjCount() && !rNewObj.ISA(E3dScene))
682 	{
683 		// Aha, Gruppenobjekt
684 		// AW: Aber keine 3D-Szene, dann nur fuer die Szene selbst den Undo anlegen
685 		pUndoGroup=new SdrUndoGroup(*pObj->GetModel());
686 		sal_uIntPtr nObjAnz=pOL->GetObjCount();
687 		for (sal_uIntPtr nObjNum=0; nObjNum<nObjAnz; nObjNum++) {
688 			pUndoGroup->AddAction(new SdrUndoGeoObj(*pOL->GetObj(nObjNum)));
689 		}
690 	} else {
691 		pUndoGeo=pObj->GetGeoData();
692 	}
693 }
694 
695 SdrUndoGeoObj::~SdrUndoGeoObj()
696 {
697 	if (pUndoGeo!=NULL) delete pUndoGeo;
698 	if (pRedoGeo!=NULL) delete pRedoGeo;
699 	if (pUndoGroup!=NULL) delete pUndoGroup;
700 }
701 
702 void SdrUndoGeoObj::Undo()
703 {
704 	// #94278# Trigger PageChangeCall
705 	ImpShowPageOfThisObject();
706 
707 	if(pUndoGroup)
708 	{
709 		pUndoGroup->Undo();
710 
711 		// #97172#
712 		// only repaint, no objectchange
713 		pObj->ActionChanged();
714 	}
715 	else
716 	{
717 		if (pRedoGeo!=NULL) delete pRedoGeo;
718 		pRedoGeo=pObj->GetGeoData();
719 		pObj->SetGeoData(*pUndoGeo);
720 	}
721 }
722 
723 void SdrUndoGeoObj::Redo()
724 {
725 	if(pUndoGroup)
726 	{
727 		pUndoGroup->Redo();
728 
729 		// #97172#
730 		// only repaint, no objectchange
731 		pObj->ActionChanged();
732 	}
733 	else
734 	{
735 		if (pUndoGeo!=NULL) delete pUndoGeo;
736 		pUndoGeo=pObj->GetGeoData();
737 		pObj->SetGeoData(*pRedoGeo);
738 	}
739 
740 	// #94278# Trigger PageChangeCall
741 	ImpShowPageOfThisObject();
742 }
743 
744 XubString SdrUndoGeoObj::GetComment() const
745 {
746 	XubString aStr;
747 	ImpTakeDescriptionStr(STR_DragMethObjOwn,aStr);
748 	return aStr;
749 }
750 
751 ////////////////////////////////////////////////////////////////////////////////////////////////////
752 
753 SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect)
754 :	SdrUndoObj(rNewObj),
755 	bOwner(sal_False),
756 	pView(NULL),
757 	pPageView(NULL)
758 {
759 	pObjList=pObj->GetObjList();
760 	if (bOrdNumDirect) {
761 		nOrdNum=pObj->GetOrdNumDirect();
762 	} else {
763 		nOrdNum=pObj->GetOrdNum();
764 	}
765 }
766 
767 SdrUndoObjList::~SdrUndoObjList()
768 {
769 	if (pObj!=NULL && IsOwner())
770 	{
771 		// Attribute muessen wieder in den regulaeren Pool
772 		SetOwner(sal_False);
773 
774 		// nun loeschen
775 		SdrObject::Free( pObj );
776 	}
777 }
778 
779 void SdrUndoObjList::SetOwner(bool bNew)
780 {
781 	bOwner = bNew;
782 }
783 
784 ////////////////////////////////////////////////////////////////////////////////////////////////////
785 
786 void SdrUndoRemoveObj::Undo()
787 {
788 	// #94278# Trigger PageChangeCall
789 	ImpShowPageOfThisObject();
790 
791 	DBG_ASSERT(!pObj->IsInserted(),"UndoRemoveObj: pObj ist bereits Inserted");
792 	if (!pObj->IsInserted())
793 	{
794 		// #i11426#
795 		// For UNDOs in Calc/Writer it is necessary to adapt the anchor
796 		// pos of the target object.
797 		Point aOwnerAnchorPos(0, 0);
798 
799 		if(pObjList
800 			&& pObjList->GetOwnerObj()
801 			&& pObjList->GetOwnerObj()->ISA(SdrObjGroup))
802 		{
803 			aOwnerAnchorPos = pObjList->GetOwnerObj()->GetAnchorPos();
804 		}
805 
806         E3DModifySceneSnapRectUpdater aUpdater(pObjList->GetOwnerObj());
807 		SdrInsertReason aReason(SDRREASON_UNDO);
808 		pObjList->InsertObject(pObj,nOrdNum,&aReason);
809 
810 		// #i11426#
811 		if(aOwnerAnchorPos.X() || aOwnerAnchorPos.Y())
812 		{
813 			pObj->NbcSetAnchorPos(aOwnerAnchorPos);
814 		}
815 	}
816 }
817 
818 void SdrUndoRemoveObj::Redo()
819 {
820 	DBG_ASSERT(pObj->IsInserted(),"RedoRemoveObj: pObj ist nicht Inserted");
821 	if (pObj->IsInserted())
822 	{
823 		ImplUnmarkObject( pObj );
824         E3DModifySceneSnapRectUpdater aUpdater(pObj);
825 		pObjList->RemoveObject(nOrdNum);
826 	}
827 
828 	// #94278# Trigger PageChangeCall
829 	ImpShowPageOfThisObject();
830 }
831 
832 ////////////////////////////////////////////////////////////////////////////////////////////////////
833 
834 void SdrUndoInsertObj::Undo()
835 {
836 	// #94278# Trigger PageChangeCall
837 	ImpShowPageOfThisObject();
838 
839 	DBG_ASSERT(pObj->IsInserted(),"UndoInsertObj: pObj ist nicht Inserted");
840 	if (pObj->IsInserted())
841 	{
842 		ImplUnmarkObject( pObj );
843 
844 #ifdef DBG_UTIL
845 		SdrObject* pChkObj=
846 #endif
847 		pObjList->RemoveObject(nOrdNum);
848 		DBG_ASSERT(pChkObj==pObj,"UndoInsertObj: RemoveObjNum!=pObj");
849 	}
850 }
851 
852 void SdrUndoInsertObj::Redo()
853 {
854 	DBG_ASSERT(!pObj->IsInserted(),"RedoInsertObj: pObj ist bereits Inserted");
855     if (!pObj->IsInserted())
856     {
857         // --> OD 2005-05-10 #i45952# - restore anchor position of an object,
858         // which becomes a member of a group, because its cleared in method
859         // <InsertObject(..)>. Needed for correct ReDo in Writer.
860         Point aAnchorPos( 0, 0 );
861         if ( pObjList &&
862              pObjList->GetOwnerObj() &&
863              pObjList->GetOwnerObj()->ISA(SdrObjGroup) )
864         {
865             aAnchorPos = pObj->GetAnchorPos();
866         }
867         // <--
868 
869 		SdrInsertReason aReason(SDRREASON_UNDO);
870 		pObjList->InsertObject(pObj,nOrdNum,&aReason);
871 
872         // --> OD 2005-05-10 #i45952#
873         if ( aAnchorPos.X() || aAnchorPos.Y() )
874         {
875             pObj->NbcSetAnchorPos( aAnchorPos );
876         }
877         // <--
878 	}
879 
880 	// #94278# Trigger PageChangeCall
881 	ImpShowPageOfThisObject();
882 }
883 
884 ////////////////////////////////////////////////////////////////////////////////////////////////////
885 
886 void SdrUndoDelObj::TryToFlushGraphicContent()
887 {
888     SdrGrafObj* pSdrGrafObj = dynamic_cast< SdrGrafObj* >(pObj);
889 
890     if(pSdrGrafObj)
891     {
892         sdr::contact::ViewContactOfGraphic* pVC = dynamic_cast< sdr::contact::ViewContactOfGraphic* >(&pSdrGrafObj->GetViewContact());
893 
894         if(pVC)
895         {
896             pVC->flushViewObjectContacts();
897             pVC->flushGraphicObjects();
898         }
899 
900         pSdrGrafObj->ForceSwapOut();
901     }
902 }
903 
904 SdrUndoDelObj::SdrUndoDelObj(SdrObject& rNewObj, FASTBOOL bOrdNumDirect)
905 :   SdrUndoRemoveObj(rNewObj,bOrdNumDirect)
906 {
907     SetOwner(sal_True);
908 
909     // #122985# if graphic object is deleted (but goes to undo) flush it's graphic content
910     // since it is potentially no longer needed
911     TryToFlushGraphicContent();
912 }
913 
914 SdrUndoDelObj::~SdrUndoDelObj()
915 {
916 }
917 
918 void SdrUndoDelObj::Undo()
919 {
920 	SdrUndoRemoveObj::Undo();
921 	DBG_ASSERT(IsOwner(),"UndoDeleteObj: pObj gehoert nicht der UndoAction");
922 	SetOwner(sal_False);
923 }
924 
925 void SdrUndoDelObj::Redo()
926 {
927 	SdrUndoRemoveObj::Redo();
928 	DBG_ASSERT(!IsOwner(),"RedoDeleteObj: pObj gehoert bereits der UndoAction");
929 	SetOwner(sal_True);
930 
931     // #122985# if graphic object is deleted (but goes to undo) flush it's graphic content
932     // since it is potentially no longer needed
933     TryToFlushGraphicContent();
934 }
935 
936 XubString SdrUndoDelObj::GetComment() const
937 {
938 	XubString aStr;
939 	ImpTakeDescriptionStr(STR_EditDelete,aStr);
940 	return aStr;
941 }
942 
943 void SdrUndoDelObj::SdrRepeat(SdrView& rView)
944 {
945 	rView.DeleteMarked();
946 }
947 
948 bool SdrUndoDelObj::CanSdrRepeat(SdrView& rView) const
949 {
950 	return rView.AreObjectsMarked();
951 }
952 
953 XubString SdrUndoDelObj::GetSdrRepeatComment(SdrView& /*rView*/) const
954 {
955 	XubString aStr;
956 	ImpTakeDescriptionStr(STR_EditDelete,aStr,sal_True);
957 	return aStr;
958 }
959 
960 ////////////////////////////////////////////////////////////////////////////////////////////////////
961 
962 void SdrUndoNewObj::Undo()
963 {
964 	SdrUndoInsertObj::Undo();
965 	DBG_ASSERT(!IsOwner(),"RedoNewObj: pObj gehoert bereits der UndoAction");
966 	SetOwner(sal_True);
967 }
968 
969 void SdrUndoNewObj::Redo()
970 {
971 	SdrUndoInsertObj::Redo();
972 	DBG_ASSERT(IsOwner(),"RedoNewObj: pObj gehoert nicht der UndoAction");
973 	SetOwner(sal_False);
974 }
975 
976 String SdrUndoNewObj::GetComment( const SdrObject& _rForObject )
977 {
978     String sComment;
979     GetDescriptionStringForObject( _rForObject, STR_UndoInsertObj, sComment );
980     return sComment;
981 }
982 
983 XubString SdrUndoNewObj::GetComment() const
984 {
985 	XubString aStr;
986 	ImpTakeDescriptionStr(STR_UndoInsertObj,aStr);
987 	return aStr;
988 }
989 
990 SdrUndoReplaceObj::SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1, bool bOrdNumDirect)
991 :	SdrUndoObj(rOldObj1),
992 	bOldOwner(sal_False),
993 	bNewOwner(sal_False),
994 	pNewObj(&rNewObj1)
995 {
996 	SetOldOwner(sal_True);
997 
998 	pObjList=pObj->GetObjList();
999 	if (bOrdNumDirect) {
1000 		nOrdNum=pObj->GetOrdNumDirect();
1001 	} else {
1002 		nOrdNum=pObj->GetOrdNum();
1003 	}
1004 }
1005 
1006 SdrUndoReplaceObj::~SdrUndoReplaceObj()
1007 {
1008 	if (pObj!=NULL && IsOldOwner())
1009 	{
1010 		// Attribute muessen wieder in den regulaeren Pool
1011 		SetOldOwner(sal_False);
1012 
1013 		// nun loeschen
1014 		SdrObject::Free( pObj );
1015 	}
1016 	if (pNewObj!=NULL && IsNewOwner())
1017 	{
1018 		// Attribute muessen wieder in den regulaeren Pool
1019 		SetNewOwner(sal_False);
1020 
1021 		// nun loeschen
1022 		SdrObject::Free( pNewObj );
1023 	}
1024 }
1025 
1026 void SdrUndoReplaceObj::Undo()
1027 {
1028 	// #94278# Trigger PageChangeCall
1029 	ImpShowPageOfThisObject();
1030 
1031 	if (IsOldOwner() && !IsNewOwner())
1032 	{
1033 		DBG_ASSERT(!pObj->IsInserted(),"SdrUndoReplaceObj::Undo(): Altes Objekt ist bereits inserted!");
1034 		DBG_ASSERT(pNewObj->IsInserted(),"SdrUndoReplaceObj::Undo(): Neues Objekt ist nicht inserted!");
1035 		SetOldOwner(sal_False);
1036 		SetNewOwner(sal_True);
1037 
1038 		ImplUnmarkObject( pNewObj );
1039 		pObjList->ReplaceObject(pObj,nOrdNum);
1040 	}
1041 	else
1042 	{
1043 		DBG_ERROR("SdrUndoReplaceObj::Undo(): IsMine-Flags stehen verkehrt. Doppelter Undo-Aufruf?");
1044 	}
1045 }
1046 
1047 void SdrUndoReplaceObj::Redo()
1048 {
1049 	if (!IsOldOwner() && IsNewOwner())
1050 	{
1051 		DBG_ASSERT(!pNewObj->IsInserted(),"SdrUndoReplaceObj::Redo(): Neues Objekt ist bereits inserted!");
1052 		DBG_ASSERT(pObj->IsInserted(),"SdrUndoReplaceObj::Redo(): Altes Objekt ist nicht inserted!");
1053 		SetOldOwner(sal_True);
1054 		SetNewOwner(sal_False);
1055 
1056 		ImplUnmarkObject( pObj );
1057 		pObjList->ReplaceObject(pNewObj,nOrdNum);
1058 
1059 	}
1060 	else
1061 	{
1062 		DBG_ERROR("SdrUndoReplaceObj::Redo(): IsMine-Flags stehen verkehrt. Doppelter Redo-Aufruf?");
1063 	}
1064 
1065 	// #94278# Trigger PageChangeCall
1066 	ImpShowPageOfThisObject();
1067 }
1068 
1069 void SdrUndoReplaceObj::SetNewOwner(bool bNew)
1070 {
1071 	bNewOwner = bNew;
1072 }
1073 
1074 void SdrUndoReplaceObj::SetOldOwner(bool bNew)
1075 {
1076 	bOldOwner = bNew;
1077 }
1078 
1079 ////////////////////////////////////////////////////////////////////////////////////////////////////
1080 
1081 XubString SdrUndoCopyObj::GetComment() const
1082 {
1083 	XubString aStr;
1084 	ImpTakeDescriptionStr(STR_UndoCopyObj,aStr);
1085 	return aStr;
1086 }
1087 
1088 ////////////////////////////////////////////////////////////////////////////////////////////////////
1089 // #i11702#
1090 
1091 SdrUndoObjectLayerChange::SdrUndoObjectLayerChange(SdrObject& rObj, SdrLayerID aOldLayer, SdrLayerID aNewLayer)
1092 :	SdrUndoObj(rObj),
1093 	maOldLayer(aOldLayer),
1094 	maNewLayer(aNewLayer)
1095 {
1096 }
1097 
1098 void SdrUndoObjectLayerChange::Undo()
1099 {
1100 	ImpShowPageOfThisObject();
1101 	pObj->SetLayer(maOldLayer);
1102 }
1103 
1104 void SdrUndoObjectLayerChange::Redo()
1105 {
1106 	pObj->SetLayer(maNewLayer);
1107 	ImpShowPageOfThisObject();
1108 }
1109 
1110 ////////////////////////////////////////////////////////////////////////////////////////////////////
1111 
1112 SdrUndoObjOrdNum::SdrUndoObjOrdNum(SdrObject& rNewObj, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1):
1113 	SdrUndoObj(rNewObj),
1114 	nOldOrdNum(nOldOrdNum1),
1115 	nNewOrdNum(nNewOrdNum1)
1116 {
1117 }
1118 
1119 void SdrUndoObjOrdNum::Undo()
1120 {
1121 	// #94278# Trigger PageChangeCall
1122 	ImpShowPageOfThisObject();
1123 
1124 	SdrObjList* pOL=pObj->GetObjList();
1125 	if (pOL==NULL) {
1126 		DBG_ERROR("UndoObjOrdNum: pObj hat keine ObjList");
1127 		return;
1128 	}
1129 	pOL->SetObjectOrdNum(nNewOrdNum,nOldOrdNum);
1130 }
1131 
1132 void SdrUndoObjOrdNum::Redo()
1133 {
1134 	SdrObjList* pOL=pObj->GetObjList();
1135 	if (pOL==NULL) {
1136 		DBG_ERROR("RedoObjOrdNum: pObj hat keine ObjList");
1137 		return;
1138 	}
1139 	pOL->SetObjectOrdNum(nOldOrdNum,nNewOrdNum);
1140 
1141 	// #94278# Trigger PageChangeCall
1142 	ImpShowPageOfThisObject();
1143 }
1144 
1145 XubString SdrUndoObjOrdNum::GetComment() const
1146 {
1147 	XubString aStr;
1148 	ImpTakeDescriptionStr(STR_UndoObjOrdNum,aStr);
1149 	return aStr;
1150 }
1151 
1152 ////////////////////////////////////////////////////////////////////////////////////////////////////
1153 
1154 SdrUndoObjSetText::SdrUndoObjSetText(SdrObject& rNewObj, sal_Int32 nText)
1155 : SdrUndoObj(rNewObj)
1156 , pOldText(NULL)
1157 , pNewText(NULL)
1158 , bNewTextAvailable(sal_False)
1159 , bEmptyPresObj(sal_False)
1160 , mnText(nText)
1161 {
1162 	SdrText* pText = static_cast< SdrTextObj*>( &rNewObj )->getText(mnText);
1163 	if( pText && pText->GetOutlinerParaObject() )
1164 		pOldText = new OutlinerParaObject(*pText->GetOutlinerParaObject());
1165 
1166 	bEmptyPresObj = rNewObj.IsEmptyPresObj();
1167 }
1168 
1169 SdrUndoObjSetText::~SdrUndoObjSetText()
1170 {
1171 	if ( pOldText )
1172 		delete pOldText;
1173 	if ( pNewText )
1174 		delete pNewText;
1175 }
1176 
1177 void SdrUndoObjSetText::AfterSetText()
1178 {
1179 	if (!bNewTextAvailable)
1180 	{
1181 		SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
1182 		if( pText && pText->GetOutlinerParaObject() )
1183 			pNewText = new OutlinerParaObject(*pText->GetOutlinerParaObject());
1184 		bNewTextAvailable=sal_True;
1185 	}
1186 }
1187 
1188 void SdrUndoObjSetText::Undo()
1189 {
1190 	// #94278# Trigger PageChangeCall
1191 	ImpShowPageOfThisObject();
1192 
1193 	// alten Text sichern fuer Redo
1194 	if (!bNewTextAvailable)
1195 		AfterSetText();
1196 
1197 	// Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung
1198 	OutlinerParaObject* pText1 = pOldText;
1199 	if(pText1)
1200 		pText1 = new OutlinerParaObject(*pText1);
1201 
1202 	SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
1203 	if( pText )
1204 		static_cast< SdrTextObj* >( pObj )->NbcSetOutlinerParaObjectForText( pText1, pText );
1205 
1206 	pObj->SetEmptyPresObj( bEmptyPresObj );
1207 	pObj->ActionChanged();
1208 
1209     // #122410# SetOutlinerParaObject at SdrText does not trigger a
1210     // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
1211     // update their preview.
1212 	pObj->BroadcastObjectChange();
1213 }
1214 
1215 void SdrUndoObjSetText::Redo()
1216 {
1217 	// Text fuer Undo kopieren, denn SetOutlinerParaObject() ist Eigentumsuebereignung
1218 	OutlinerParaObject* pText1 = pNewText;
1219 
1220 	if(pText1)
1221 		pText1 = new OutlinerParaObject(*pText1);
1222 
1223 	SdrText* pText = static_cast< SdrTextObj*>( pObj )->getText(mnText);
1224 	if( pText )
1225 		static_cast< SdrTextObj* >( pObj )->NbcSetOutlinerParaObjectForText( pText1, pText );
1226 
1227 	pObj->ActionChanged();
1228 
1229     // #122410# NbcSetOutlinerParaObjectForText at SdrTextObj does not trigger a
1230     // BroadcastObjectChange, but it is needed to make evtl. SlideSorters
1231     // update their preview.
1232 	pObj->BroadcastObjectChange();
1233 
1234 	// #94278# Trigger PageChangeCall
1235 	ImpShowPageOfThisObject();
1236 }
1237 
1238 XubString SdrUndoObjSetText::GetComment() const
1239 {
1240 	XubString aStr;
1241 	ImpTakeDescriptionStr(STR_UndoObjSetText,aStr);
1242 	return aStr;
1243 }
1244 
1245 XubString SdrUndoObjSetText::GetSdrRepeatComment(SdrView& /*rView*/) const
1246 {
1247 	XubString aStr;
1248 	ImpTakeDescriptionStr(STR_UndoObjSetText,aStr);
1249 	return aStr;
1250 }
1251 
1252 void SdrUndoObjSetText::SdrRepeat(SdrView& rView)
1253 {
1254 	if (bNewTextAvailable && rView.AreObjectsMarked())
1255 	{
1256 		const SdrMarkList& rML=rView.GetMarkedObjectList();
1257 
1258 		const bool bUndo = rView.IsUndoEnabled();
1259 		if( bUndo )
1260 		{
1261 			XubString aStr;
1262 			ImpTakeDescriptionStr(STR_UndoObjSetText,aStr);
1263 			rView.BegUndo(aStr);
1264 		}
1265 
1266 		sal_uIntPtr nAnz=rML.GetMarkCount();
1267 		for (sal_uIntPtr nm=0; nm<nAnz; nm++)
1268 		{
1269 			SdrObject* pObj2=rML.GetMark(nm)->GetMarkedSdrObj();
1270 			SdrTextObj* pTextObj=PTR_CAST(SdrTextObj,pObj2);
1271 			if (pTextObj!=NULL)
1272 			{
1273 				if( bUndo )
1274 					rView.AddUndo(new SdrUndoObjSetText(*pTextObj,0));
1275 
1276 				OutlinerParaObject* pText1=pNewText;
1277 				if (pText1!=NULL)
1278 					pText1 = new OutlinerParaObject(*pText1);
1279 				pTextObj->SetOutlinerParaObject(pText1);
1280 			}
1281 		}
1282 
1283 		if( bUndo )
1284 			rView.EndUndo();
1285 	}
1286 }
1287 
1288 bool SdrUndoObjSetText::CanSdrRepeat(SdrView& rView) const
1289 {
1290 	bool bOk=sal_False;
1291 	if (bNewTextAvailable && rView.AreObjectsMarked()) {
1292 		bOk=sal_True;
1293 	}
1294 	return bOk;
1295 }
1296 
1297 // --> OD 2009-07-09 #i73249#
1298 SdrUndoObjStrAttr::SdrUndoObjStrAttr( SdrObject& rNewObj,
1299                                       const ObjStrAttrType eObjStrAttr,
1300                                       const String& sOldStr,
1301                                       const String& sNewStr)
1302     : SdrUndoObj( rNewObj ),
1303       meObjStrAttr( eObjStrAttr ),
1304       msOldStr( sOldStr ),
1305       msNewStr( sNewStr )
1306 {
1307 }
1308 
1309 void SdrUndoObjStrAttr::Undo()
1310 {
1311     ImpShowPageOfThisObject();
1312 
1313     switch ( meObjStrAttr )
1314     {
1315         case OBJ_NAME:
1316         {
1317             pObj->SetName( msOldStr );
1318         }
1319         break;
1320         case OBJ_TITLE:
1321         {
1322             pObj->SetTitle( msOldStr );
1323         }
1324         break;
1325         case OBJ_DESCRIPTION:
1326         {
1327             pObj->SetDescription( msOldStr );
1328         }
1329         break;
1330     }
1331 }
1332 
1333 void SdrUndoObjStrAttr::Redo()
1334 {
1335     switch ( meObjStrAttr )
1336     {
1337         case OBJ_NAME:
1338         {
1339             pObj->SetName( msNewStr );
1340         }
1341         break;
1342         case OBJ_TITLE:
1343         {
1344             pObj->SetTitle( msNewStr );
1345         }
1346         break;
1347         case OBJ_DESCRIPTION:
1348         {
1349             pObj->SetDescription( msNewStr );
1350         }
1351         break;
1352     }
1353 
1354     ImpShowPageOfThisObject();
1355 }
1356 
1357 String SdrUndoObjStrAttr::GetComment() const
1358 {
1359     String aStr;
1360     switch ( meObjStrAttr )
1361     {
1362         case OBJ_NAME:
1363         {
1364             ImpTakeDescriptionStr( STR_UndoObjName, aStr );
1365             aStr += sal_Unicode(' ');
1366             aStr += sal_Unicode('\'');
1367             aStr += msNewStr;
1368             aStr += sal_Unicode('\'');
1369         }
1370         break;
1371         case OBJ_TITLE:
1372         {
1373             ImpTakeDescriptionStr( STR_UndoObjTitle, aStr );
1374         }
1375         break;
1376         case OBJ_DESCRIPTION:
1377         {
1378             ImpTakeDescriptionStr( STR_UndoObjDescription, aStr );
1379         }
1380         break;
1381     }
1382 
1383     return aStr;
1384 }
1385 
1386 ////////////////////////////////////////////////////////////////////////////////////////////////////
1387 ////////////////////////////////////////////////////////////////////////////////////////////////////
1388 //
1389 //  @@      @@@@   @@  @@  @@@@@  @@@@@
1390 //  @@     @@  @@  @@  @@  @@     @@  @@
1391 //  @@     @@  @@  @@  @@  @@     @@  @@
1392 //  @@     @@@@@@   @@@@   @@@@   @@@@@
1393 //  @@     @@  @@    @@    @@     @@  @@
1394 //  @@     @@  @@    @@    @@     @@  @@
1395 //  @@@@@  @@  @@    @@    @@@@@  @@  @@
1396 //
1397 ////////////////////////////////////////////////////////////////////////////////////////////////////
1398 ////////////////////////////////////////////////////////////////////////////////////////////////////
1399 
1400 SdrUndoLayer::SdrUndoLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel):
1401 	SdrUndoAction(rNewModel),
1402 	pLayer(rNewLayerAdmin.GetLayer(nLayerNum)),
1403 	pLayerAdmin(&rNewLayerAdmin),
1404 	nNum(nLayerNum),
1405 	bItsMine(sal_False)
1406 {
1407 }
1408 
1409 SdrUndoLayer::~SdrUndoLayer()
1410 {
1411 	if (bItsMine) {
1412 		delete pLayer;
1413 	}
1414 }
1415 
1416 ////////////////////////////////////////////////////////////////////////////////////////////////////
1417 
1418 void SdrUndoNewLayer::Undo()
1419 {
1420 	DBG_ASSERT(!bItsMine,"SdrUndoNewLayer::Undo(): Layer gehoert bereits der UndoAction");
1421 	bItsMine=sal_True;
1422 #ifdef DBG_UTIL
1423 	SdrLayer* pCmpLayer=
1424 #endif
1425 	pLayerAdmin->RemoveLayer(nNum);
1426 	DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoNewLayer::Undo(): Removter Layer ist != pLayer");
1427 }
1428 
1429 void SdrUndoNewLayer::Redo()
1430 {
1431 	DBG_ASSERT(bItsMine,"SdrUndoNewLayer::Undo(): Layer gehoert nicht der UndoAction");
1432 	bItsMine=sal_False;
1433 	pLayerAdmin->InsertLayer(pLayer,nNum);
1434 }
1435 
1436 XubString SdrUndoNewLayer::GetComment() const
1437 {
1438 	return ImpGetResStr(STR_UndoNewLayer);
1439 }
1440 
1441 ////////////////////////////////////////////////////////////////////////////////////////////////////
1442 
1443 void SdrUndoDelLayer::Undo()
1444 {
1445 	DBG_ASSERT(bItsMine,"SdrUndoDelLayer::Undo(): Layer gehoert nicht der UndoAction");
1446 	bItsMine=sal_False;
1447 	pLayerAdmin->InsertLayer(pLayer,nNum);
1448 }
1449 
1450 void SdrUndoDelLayer::Redo()
1451 {
1452 	DBG_ASSERT(!bItsMine,"SdrUndoDelLayer::Undo(): Layer gehoert bereits der UndoAction");
1453 	bItsMine=sal_True;
1454 #ifdef DBG_UTIL
1455 	SdrLayer* pCmpLayer=
1456 #endif
1457 	pLayerAdmin->RemoveLayer(nNum);
1458 	DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoDelLayer::Redo(): Removter Layer ist != pLayer");
1459 }
1460 
1461 XubString SdrUndoDelLayer::GetComment() const
1462 {
1463 	return ImpGetResStr(STR_UndoDelLayer);
1464 }
1465 
1466 ////////////////////////////////////////////////////////////////////////////////////////////////////
1467 
1468 void SdrUndoMoveLayer::Undo()
1469 {
1470 #ifdef DBG_UTIL
1471 	SdrLayer* pCmpLayer=
1472 #endif
1473 	pLayerAdmin->RemoveLayer(nNeuPos);
1474 	DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoMoveLayer::Undo(): Removter Layer ist != pLayer");
1475 	pLayerAdmin->InsertLayer(pLayer,nNum);
1476 }
1477 
1478 void SdrUndoMoveLayer::Redo()
1479 {
1480 #ifdef DBG_UTIL
1481 	SdrLayer* pCmpLayer=
1482 #endif
1483 	pLayerAdmin->RemoveLayer(nNum);
1484 	DBG_ASSERT(pCmpLayer==pLayer,"SdrUndoMoveLayer::Redo(): Removter Layer ist != pLayer");
1485 	pLayerAdmin->InsertLayer(pLayer,nNeuPos);
1486 }
1487 
1488 XubString SdrUndoMoveLayer::GetComment() const
1489 {
1490 	return ImpGetResStr(STR_UndoMovLayer);
1491 }
1492 
1493 ////////////////////////////////////////////////////////////////////////////////////////////////////
1494 ////////////////////////////////////////////////////////////////////////////////////////////////////
1495 //
1496 //  @@@@@    @@@@    @@@@   @@@@@   @@@@
1497 //  @@  @@  @@  @@  @@  @@  @@     @@  @@
1498 //  @@  @@  @@  @@  @@      @@     @@
1499 //  @@@@@   @@@@@@  @@ @@@  @@@@    @@@@
1500 //  @@      @@  @@  @@  @@  @@         @@
1501 //  @@      @@  @@  @@  @@  @@     @@  @@
1502 //  @@      @@  @@   @@@@@  @@@@@   @@@@
1503 //
1504 ////////////////////////////////////////////////////////////////////////////////////////////////////
1505 ////////////////////////////////////////////////////////////////////////////////////////////////////
1506 
1507 SdrUndoPage::SdrUndoPage(SdrPage& rNewPg)
1508 :	SdrUndoAction(*rNewPg.GetModel()),
1509 	mrPage(rNewPg)
1510 {
1511 }
1512 
1513 void SdrUndoPage::ImpInsertPage(sal_uInt16 nNum)
1514 {
1515 	DBG_ASSERT(!mrPage.IsInserted(),"SdrUndoPage::ImpInsertPage(): mrPage ist bereits Inserted");
1516 	if (!mrPage.IsInserted()) {
1517 		if (mrPage.IsMasterPage()) {
1518 			rMod.InsertMasterPage(&mrPage,nNum);
1519 		} else {
1520 			rMod.InsertPage(&mrPage,nNum);
1521 		}
1522 	}
1523 }
1524 
1525 void SdrUndoPage::ImpRemovePage(sal_uInt16 nNum)
1526 {
1527 	DBG_ASSERT(mrPage.IsInserted(),"SdrUndoPage::ImpRemovePage(): mrPage ist nicht Inserted");
1528 	if (mrPage.IsInserted()) {
1529 		SdrPage* pChkPg=NULL;
1530 		if (mrPage.IsMasterPage()) {
1531 			pChkPg=rMod.RemoveMasterPage(nNum);
1532 		} else {
1533 			pChkPg=rMod.RemovePage(nNum);
1534 		}
1535 		DBG_ASSERT(pChkPg==&mrPage,"SdrUndoPage::ImpRemovePage(): RemovePage!=&mrPage");
1536 	}
1537 }
1538 
1539 void SdrUndoPage::ImpMovePage(sal_uInt16 nOldNum, sal_uInt16 nNewNum)
1540 {
1541 	DBG_ASSERT(mrPage.IsInserted(),"SdrUndoPage::ImpMovePage(): mrPage ist nicht Inserted");
1542 	if (mrPage.IsInserted()) {
1543 		if (mrPage.IsMasterPage()) {
1544 			rMod.MoveMasterPage(nOldNum,nNewNum);
1545 		} else {
1546 			rMod.MovePage(nOldNum,nNewNum);
1547 		}
1548 	}
1549 }
1550 
1551 void SdrUndoPage::ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, XubString& rStr, sal_uInt16 /*n*/, FASTBOOL /*bRepeat*/) const
1552 {
1553 	rStr=ImpGetResStr(nStrCacheID);
1554 }
1555 
1556 ////////////////////////////////////////////////////////////////////////////////////////////////////
1557 
1558 SdrUndoPageList::SdrUndoPageList(SdrPage& rNewPg):
1559 	SdrUndoPage(rNewPg),
1560 	bItsMine(sal_False)
1561 {
1562 	nPageNum=rNewPg.GetPageNum();
1563 }
1564 
1565 SdrUndoPageList::~SdrUndoPageList()
1566 {
1567 	if(bItsMine)
1568 	{
1569 		delete (&mrPage);
1570 	}
1571 }
1572 
1573 ////////////////////////////////////////////////////////////////////////////////////////////////////
1574 
1575 SdrUndoDelPage::SdrUndoDelPage(SdrPage& rNewPg):
1576 	SdrUndoPageList(rNewPg),
1577 	pUndoGroup(NULL)
1578 {
1579 	bItsMine = sal_True;
1580 
1581 	// Und nun ggf. die MasterPage-Beziehungen merken
1582 	if(mrPage.IsMasterPage())
1583 	{
1584 		sal_uInt16 nPageAnz(rMod.GetPageCount());
1585 
1586 		for(sal_uInt16 nPageNum2(0); nPageNum2 < nPageAnz; nPageNum2++)
1587 		{
1588 			SdrPage* pDrawPage = rMod.GetPage(nPageNum2);
1589 
1590 			if(pDrawPage->TRG_HasMasterPage())
1591 			{
1592 				SdrPage& rMasterPage = pDrawPage->TRG_GetMasterPage();
1593 
1594 				if(&mrPage == &rMasterPage)
1595 				{
1596 					if(!pUndoGroup)
1597 					{
1598 						pUndoGroup = new SdrUndoGroup(rMod);
1599 					}
1600 
1601 					pUndoGroup->AddAction(rMod.GetSdrUndoFactory().CreateUndoPageRemoveMasterPage(*pDrawPage));
1602 				}
1603 			}
1604 		}
1605 	}
1606 }
1607 
1608 SdrUndoDelPage::~SdrUndoDelPage()
1609 {
1610 	if (pUndoGroup!=NULL) {
1611 		delete pUndoGroup;
1612 	}
1613 }
1614 
1615 void SdrUndoDelPage::Undo()
1616 {
1617 	ImpInsertPage(nPageNum);
1618 	if (pUndoGroup!=NULL) { // MasterPage-Beziehungen wiederherstellen
1619 		pUndoGroup->Undo();
1620 	}
1621 	DBG_ASSERT(bItsMine,"UndoDeletePage: mrPage gehoert nicht der UndoAction");
1622 	bItsMine=sal_False;
1623 }
1624 
1625 void SdrUndoDelPage::Redo()
1626 {
1627 	ImpRemovePage(nPageNum);
1628 	// Die MasterPage-Beziehungen werden ggf. von selbst geloesst
1629 	DBG_ASSERT(!bItsMine,"RedoDeletePage: mrPage gehoert bereits der UndoAction");
1630 	bItsMine=sal_True;
1631 }
1632 
1633 XubString SdrUndoDelPage::GetComment() const
1634 {
1635 	XubString aStr;
1636 	ImpTakeDescriptionStr(STR_UndoDelPage,aStr,0,sal_False);
1637 	return aStr;
1638 }
1639 
1640 XubString SdrUndoDelPage::GetSdrRepeatComment(SdrView& /*rView*/) const
1641 {
1642 	XubString aStr;
1643 	ImpTakeDescriptionStr(STR_UndoDelPage,aStr,0,sal_False);
1644 	return aStr;
1645 }
1646 
1647 void SdrUndoDelPage::SdrRepeat(SdrView& /*rView*/)
1648 {
1649 }
1650 
1651 bool SdrUndoDelPage::CanSdrRepeat(SdrView& /*rView*/) const
1652 {
1653 	return sal_False;
1654 }
1655 
1656 ////////////////////////////////////////////////////////////////////////////////////////////////////
1657 
1658 void SdrUndoNewPage::Undo()
1659 {
1660 	ImpRemovePage(nPageNum);
1661 	DBG_ASSERT(!bItsMine,"UndoNewPage: mrPage gehoert bereits der UndoAction");
1662 	bItsMine=sal_True;
1663 }
1664 
1665 void SdrUndoNewPage::Redo()
1666 {
1667 	ImpInsertPage(nPageNum);
1668 	DBG_ASSERT(bItsMine,"RedoNewPage: mrPage gehoert nicht der UndoAction");
1669 	bItsMine=sal_False;
1670 }
1671 
1672 XubString SdrUndoNewPage::GetComment() const
1673 {
1674 	XubString aStr;
1675 	ImpTakeDescriptionStr(STR_UndoNewPage,aStr,0,sal_False);
1676 	return aStr;
1677 }
1678 
1679 ////////////////////////////////////////////////////////////////////////////////////////////////////
1680 
1681 XubString SdrUndoCopyPage::GetComment() const
1682 {
1683 	XubString aStr;
1684 	ImpTakeDescriptionStr(STR_UndoCopPage,aStr,0,sal_False);
1685 	return aStr;
1686 }
1687 
1688 XubString SdrUndoCopyPage::GetSdrRepeatComment(SdrView& /*rView*/) const
1689 {
1690 	XubString aStr;
1691 	ImpTakeDescriptionStr(STR_UndoCopPage,aStr,0,sal_False);
1692 	return aStr;
1693 }
1694 
1695 void SdrUndoCopyPage::SdrRepeat(SdrView& /*rView*/)
1696 {
1697 
1698 }
1699 
1700 bool SdrUndoCopyPage::CanSdrRepeat(SdrView& /*rView*/) const
1701 {
1702 	return sal_False;
1703 }
1704 
1705 ////////////////////////////////////////////////////////////////////////////////////////////////////
1706 
1707 void SdrUndoSetPageNum::Undo()
1708 {
1709 	ImpMovePage(nNewPageNum,nOldPageNum);
1710 }
1711 
1712 void SdrUndoSetPageNum::Redo()
1713 {
1714 	ImpMovePage(nOldPageNum,nNewPageNum);
1715 }
1716 
1717 XubString SdrUndoSetPageNum::GetComment() const
1718 {
1719 	XubString aStr;
1720 	ImpTakeDescriptionStr(STR_UndoMovPage,aStr,0,sal_False);
1721 	return aStr;
1722 }
1723 
1724 ////////////////////////////////////////////////////////////////////////////////////////////////////
1725 //
1726 //  @@   @@  @@@@   @@@@  @@@@@@ @@@@@ @@@@@   @@@@@   @@@@   @@@@  @@@@@  @@@@
1727 //  @@@ @@@ @@  @@ @@  @@   @@   @@    @@  @@  @@  @@ @@  @@ @@  @@ @@    @@  @@
1728 //  @@@@@@@ @@  @@ @@       @@   @@    @@  @@  @@  @@ @@  @@ @@     @@    @@
1729 //  @@@@@@@ @@@@@@  @@@@    @@   @@@@  @@@@@   @@@@@  @@@@@@ @@ @@@ @@@@   @@@@
1730 //  @@ @ @@ @@  @@     @@   @@   @@    @@  @@  @@     @@  @@ @@  @@ @@        @@
1731 //  @@   @@ @@  @@ @@  @@   @@   @@    @@  @@  @@     @@  @@ @@  @@ @@    @@  @@
1732 //  @@   @@ @@  @@  @@@@    @@   @@@@@ @@  @@  @@     @@  @@  @@@@@ @@@@@  @@@@
1733 //
1734 ////////////////////////////////////////////////////////////////////////////////////////////////////
1735 
1736 SdrUndoPageMasterPage::SdrUndoPageMasterPage(SdrPage& rChangedPage)
1737 :	SdrUndoPage(rChangedPage),
1738 	mbOldHadMasterPage(mrPage.TRG_HasMasterPage())
1739 {
1740 	// get current state from page
1741 	if(mbOldHadMasterPage)
1742 	{
1743 		maOldSet = mrPage.TRG_GetMasterPageVisibleLayers();
1744 		maOldMasterPageNumber = mrPage.TRG_GetMasterPage().GetPageNum();
1745 	}
1746 }
1747 
1748 SdrUndoPageMasterPage::~SdrUndoPageMasterPage()
1749 {
1750 }
1751 
1752 ////////////////////////////////////////////////////////////////////////////////////////////////////
1753 
1754 SdrUndoPageRemoveMasterPage::SdrUndoPageRemoveMasterPage(SdrPage& rChangedPage)
1755 :	SdrUndoPageMasterPage(rChangedPage)
1756 {
1757 }
1758 
1759 void SdrUndoPageRemoveMasterPage::Undo()
1760 {
1761 	if(mbOldHadMasterPage)
1762 	{
1763 		mrPage.TRG_SetMasterPage(*mrPage.GetModel()->GetMasterPage(maOldMasterPageNumber));
1764 		mrPage.TRG_SetMasterPageVisibleLayers(maOldSet);
1765 	}
1766 }
1767 
1768 void SdrUndoPageRemoveMasterPage::Redo()
1769 {
1770 	mrPage.TRG_ClearMasterPage();
1771 }
1772 
1773 XubString SdrUndoPageRemoveMasterPage::GetComment() const
1774 {
1775 	XubString aStr;
1776 	ImpTakeDescriptionStr(STR_UndoDelPageMasterDscr,aStr,0,sal_False);
1777 	return aStr;
1778 }
1779 
1780 ////////////////////////////////////////////////////////////////////////////////////////////////////
1781 
1782 SdrUndoPageChangeMasterPage::SdrUndoPageChangeMasterPage(SdrPage& rChangedPage)
1783 :	SdrUndoPageMasterPage(rChangedPage),
1784 	mbNewHadMasterPage(sal_False)
1785 {
1786 }
1787 
1788 void SdrUndoPageChangeMasterPage::Undo()
1789 {
1790 	// remember values from new page
1791 	if(mrPage.TRG_HasMasterPage())
1792 	{
1793 		mbNewHadMasterPage = sal_True;
1794 		maNewSet = mrPage.TRG_GetMasterPageVisibleLayers();
1795 		maNewMasterPageNumber = mrPage.TRG_GetMasterPage().GetPageNum();
1796 	}
1797 
1798 	// restore old values
1799 	if(mbOldHadMasterPage)
1800 	{
1801 		mrPage.TRG_ClearMasterPage();
1802 		mrPage.TRG_SetMasterPage(*mrPage.GetModel()->GetMasterPage(maOldMasterPageNumber));
1803 		mrPage.TRG_SetMasterPageVisibleLayers(maOldSet);
1804 	}
1805 }
1806 
1807 void SdrUndoPageChangeMasterPage::Redo()
1808 {
1809 	// restore new values
1810 	if(mbNewHadMasterPage)
1811 	{
1812 		mrPage.TRG_ClearMasterPage();
1813 		mrPage.TRG_SetMasterPage(*mrPage.GetModel()->GetMasterPage(maNewMasterPageNumber));
1814 		mrPage.TRG_SetMasterPageVisibleLayers(maNewSet);
1815 	}
1816 }
1817 
1818 XubString SdrUndoPageChangeMasterPage::GetComment() const
1819 {
1820 	XubString aStr;
1821 	ImpTakeDescriptionStr(STR_UndoChgPageMasterDscr,aStr,0,sal_False);
1822 	return aStr;
1823 }
1824 
1825 ///////////////////////////////////////////////////////////////////////
1826 SdrUndoFactory::~SdrUndoFactory(){}
1827 // shapes
1828 SdrUndoAction* SdrUndoFactory::CreateUndoMoveObject( SdrObject& rObject )
1829 {
1830 	return new SdrUndoMoveObj( rObject );
1831 }
1832 
1833 SdrUndoAction* SdrUndoFactory::CreateUndoMoveObject( SdrObject& rObject, const Size& rDist )
1834 {
1835 	return new SdrUndoMoveObj( rObject, rDist );
1836 }
1837 
1838 SdrUndoAction* SdrUndoFactory::CreateUndoGeoObject( SdrObject& rObject )
1839 {
1840 	return new SdrUndoGeoObj( rObject );
1841 }
1842 
1843 SdrUndoAction* SdrUndoFactory::CreateUndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
1844 {
1845 	return new SdrUndoAttrObj( rObject, bStyleSheet1 ? sal_True : sal_False, bSaveText ? sal_True : sal_False );
1846 }
1847 
1848 SdrUndoAction* SdrUndoFactory::CreateUndoRemoveObject( SdrObject& rObject, bool bOrdNumDirect )
1849 {
1850 	return new SdrUndoRemoveObj( rObject, bOrdNumDirect ? sal_True : sal_False );
1851 }
1852 
1853 SdrUndoAction* SdrUndoFactory::CreateUndoInsertObject( SdrObject& rObject, bool bOrdNumDirect )
1854 {
1855 	return new SdrUndoInsertObj( rObject, bOrdNumDirect ? sal_True : sal_False );
1856 }
1857 
1858 SdrUndoAction* SdrUndoFactory::CreateUndoDeleteObject( SdrObject& rObject, bool bOrdNumDirect )
1859 {
1860 	return new SdrUndoDelObj( rObject, bOrdNumDirect ? sal_True : sal_False );
1861 }
1862 
1863 SdrUndoAction* SdrUndoFactory::CreateUndoNewObject( SdrObject& rObject, bool bOrdNumDirect )
1864 {
1865 	return new SdrUndoNewObj( rObject, bOrdNumDirect ? sal_True : sal_False );
1866 }
1867 
1868 SdrUndoAction* SdrUndoFactory::CreateUndoCopyObject( SdrObject& rObject, bool bOrdNumDirect )
1869 {
1870 	return new SdrUndoCopyObj( rObject, bOrdNumDirect ? sal_True : sal_False );
1871 }
1872 
1873 SdrUndoAction* SdrUndoFactory::CreateUndoObjectOrdNum( SdrObject& rObject, sal_uInt32 nOldOrdNum1, sal_uInt32 nNewOrdNum1)
1874 {
1875 	return new SdrUndoObjOrdNum( rObject, nOldOrdNum1, nNewOrdNum1 );
1876 }
1877 
1878 SdrUndoAction* SdrUndoFactory::CreateUndoReplaceObject( SdrObject& rOldObject, SdrObject& rNewObject, bool bOrdNumDirect )
1879 {
1880 	return new SdrUndoReplaceObj( rOldObject, rNewObject, bOrdNumDirect ? sal_True : sal_False );
1881 }
1882 
1883 SdrUndoAction* SdrUndoFactory::CreateUndoObjectLayerChange( SdrObject& rObject, SdrLayerID aOldLayer, SdrLayerID aNewLayer )
1884 {
1885 	return new SdrUndoObjectLayerChange( rObject, aOldLayer, aNewLayer );
1886 }
1887 
1888 SdrUndoAction* SdrUndoFactory::CreateUndoObjectSetText( SdrObject& rNewObj, sal_Int32 nText )
1889 {
1890 	return new SdrUndoObjSetText( rNewObj, nText );
1891 }
1892 
1893 SdrUndoAction* SdrUndoFactory::CreateUndoObjectStrAttr( SdrObject& rObject,
1894                                                         SdrUndoObjStrAttr::ObjStrAttrType eObjStrAttrType,
1895                                                         String sOldStr,
1896                                                         String sNewStr )
1897 {
1898     return new SdrUndoObjStrAttr( rObject, eObjStrAttrType, sOldStr, sNewStr );
1899 }
1900 
1901 
1902 // layer
1903 SdrUndoAction* SdrUndoFactory::CreateUndoNewLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
1904 {
1905 	return new SdrUndoNewLayer( nLayerNum, rNewLayerAdmin, rNewModel );
1906 }
1907 
1908 SdrUndoAction* SdrUndoFactory::CreateUndoDeleteLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel)
1909 {
1910 	return new SdrUndoDelLayer( nLayerNum, rNewLayerAdmin, rNewModel );
1911 }
1912 
1913 SdrUndoAction* SdrUndoFactory::CreateUndoMoveLayer(sal_uInt16 nLayerNum, SdrLayerAdmin& rNewLayerAdmin, SdrModel& rNewModel, sal_uInt16 nNeuPos1)
1914 {
1915 	return new SdrUndoMoveLayer( nLayerNum, rNewLayerAdmin, rNewModel, nNeuPos1 );
1916 }
1917 
1918 // page
1919 SdrUndoAction*	SdrUndoFactory::CreateUndoDeletePage(SdrPage& rPage)
1920 {
1921 	return new SdrUndoDelPage( rPage );
1922 }
1923 
1924 SdrUndoAction* SdrUndoFactory::CreateUndoNewPage(SdrPage& rPage)
1925 {
1926 	return new SdrUndoNewPage( rPage );
1927 }
1928 
1929 SdrUndoAction* SdrUndoFactory::CreateUndoCopyPage(SdrPage& rPage)
1930 {
1931 	return new SdrUndoCopyPage( rPage );
1932 }
1933 
1934 SdrUndoAction* SdrUndoFactory::CreateUndoSetPageNum(SdrPage& rNewPg, sal_uInt16 nOldPageNum1, sal_uInt16 nNewPageNum1)
1935 {
1936 	return new SdrUndoSetPageNum( rNewPg, nOldPageNum1, nNewPageNum1 );
1937 }
1938 	// master page
1939 SdrUndoAction* SdrUndoFactory::CreateUndoPageRemoveMasterPage(SdrPage& rChangedPage)
1940 {
1941 	return new SdrUndoPageRemoveMasterPage( rChangedPage );
1942 }
1943 
1944 SdrUndoAction* SdrUndoFactory::CreateUndoPageChangeMasterPage(SdrPage& rChangedPage)
1945 {
1946 	return new SdrUndoPageChangeMasterPage(rChangedPage);
1947 }
1948 
1949 // eof
1950