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