From ef7c5c7534ecf24b2af1bc0de6e221327b4a4c49 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Thu, 4 Jun 2009 16:21:29 +0000 Subject: CWS-TOOLING: integrate CWS clnoundo 2009-05-18 09:40:22 +0200 wg r271998 : i102011 2009-04-28 12:20:24 +0200 cl r271318 : CWS-TOOLING: rebase CWS clnoundo to trunk@270723 (milestone: DEV300:m46) 2009-04-02 11:37:14 +0200 cl r270388 : #i100371# check valid positions all the time to avoid crashes during model lock 2009-03-30 13:02:27 +0200 cl r270219 : #i100371# do not create undo actions in drawing layer during load 2009-03-30 12:59:41 +0200 cl r270218 : #i100371# do not create undo actions in drawing layer during load 2009-03-30 12:55:06 +0200 cl r270217 : #i100371# do not create undo actions in drawing layer during load 2009-03-30 12:53:27 +0200 cl r270216 : #i100371# do not create undo actions in drawing layer during load 2009-03-30 12:49:28 +0200 cl r270215 : #i100371# added EnableUndo() and IsUndoEnabled() --- sd/source/ui/view/sdview4.cxx | 51 +++++++++++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 11 deletions(-) (limited to 'sd/source/ui/view/sdview4.cxx') diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 12dcaba2899f..1e6842408e67 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -134,7 +134,9 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, pNewGrafObj->SetEmptyPresObj(FALSE); } - BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); + const bool bUndo = IsUndoEnabled(); + if( bUndo ) + BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); SdPage* pPage = (SdPage*) pPickObj->GetPage(); @@ -142,26 +144,39 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, { // Neues PresObj in die Liste eintragen pNewGrafObj->SetUserCall(pPickObj->GetUserCall()); - AddUndo( new sd::UndoObjectPresentationKind( *pPickObj ) ); - AddUndo( new sd::UndoObjectPresentationKind( *pNewGrafObj ) ); + if( bUndo ) + { + AddUndo( new sd::UndoObjectPresentationKind( *pPickObj ) ); + AddUndo( new sd::UndoObjectPresentationKind( *pNewGrafObj ) ); + } pPage->RemovePresObj(pPickObj); pPage->InsertPresObj(pNewGrafObj, PRESOBJ_GRAPHIC); + + if( !bUndo ) + { + SdrObject::Free( pPickObj ); + } } if (pImageMap) pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap)); ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView - EndUndo(); + + if( bUndo ) + EndUndo(); } else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj)) { /****************************************************************** * Das Objekt wird mit der Graphik gefuellt ******************************************************************/ - BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj)); - EndUndo(); + if( IsUndoEnabled() ) + { + BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); + AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj)); + EndUndo(); + } XOBitmap aXOBitmap( rGraphic.GetBitmap() ); SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP); @@ -238,14 +253,28 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft(); pNewGrafObj->NbcMove(Size(aVec.X(), aVec.Y())); - BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); + const bool bUndo = IsUndoEnabled(); + + if( bUndo ) + BegUndo(String(SdResId(STR_UNDO_DRAGDROP))); pNewGrafObj->NbcSetLayer(pPickObj->GetLayer()); SdrPage* pP = pPV->GetPage(); pP->InsertObject(pNewGrafObj); - AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewObject(*pNewGrafObj)); - AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pPickObj)); + if( bUndo ) + { + AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewObject(*pNewGrafObj)); + AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pPickObj)); + } pP->RemoveObject(pPickObj->GetOrdNum()); - EndUndo(); + + if( bUndo ) + { + EndUndo(); + } + else + { + SdrObject::Free(pPickObj); + } mnAction = DND_ACTION_COPY; } else -- cgit