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