From 55525d4462565f4e47e92854158c5fe7a7e457ab Mon Sep 17 00:00:00 2001 From: Christian Lippka Date: Thu, 25 Feb 2010 18:04:05 +0100 Subject: [PATCH] more fixes for new presentation layout shapes --- sd/source/core/sdpage.cxx | 8 ++++--- .../configuration/ConfigurationController.cxx | 2 +- .../configuration/ConfigurationUpdater.cxx | 2 +- sd/source/ui/func/fuinsert.cxx | 6 ------ sd/source/ui/table/tablefunction.cxx | 6 ------ sd/source/ui/view/ViewShellManager.cxx | 2 +- sd/source/ui/view/drawview.cxx | 6 ++++++ sd/source/ui/view/sdview4.cxx | 21 +++++++++++-------- sd/source/ui/view/viewoverlaymanager.cxx | 5 +++-- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 97e936a092b8..9d333329e7c5 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -1380,7 +1380,7 @@ static void CalcAutoLayoutRectangles( SdPage& rPage, int nLayout, Rectangle* rRe } -void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescriptor, std::vector< SdrObject* >& rShapes, bool bInit ) +void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescriptor, std::vector< SdrObject* >& rShapes, bool bInit, bool bSwitchLayout ) { int i; @@ -1400,7 +1400,7 @@ void findAutoLayoutShapesImpl( SdPage& rPage, const LayoutDescriptor& rDescripto { PresObjIndex[eKind]++; // on next search for eKind, find next shape with same eKind - if( !pObj->IsEmptyPresObj() ) + if( !bSwitchLayout || !pObj->IsEmptyPresObj() ) { rShapes[i] = pObj; break; @@ -1545,6 +1545,8 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, BOOL bInit, BOOL bCreate ) { sd::ScopeLockGuard aGuard( maLockAutoLayoutArrangement ); + const bool bSwitchLayout = eLayout != GetAutoLayout(); + sd::UndoManager* pUndoManager = pModel ? static_cast(pModel)->GetUndoManager() : 0; const bool bUndo = pUndoManager && pUndoManager->isInListAction() && IsInserted(); @@ -1567,7 +1569,7 @@ void SdPage::SetAutoLayout(AutoLayout eLayout, BOOL bInit, BOOL bCreate ) std::vector< SdrObject* > aLayoutShapes(PRESOBJ_MAX, 0); - findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit ); + findAutoLayoutShapesImpl( *this, aDescriptor, aLayoutShapes, bInit, bSwitchLayout ); int i; diff --git a/sd/source/ui/framework/configuration/ConfigurationController.cxx b/sd/source/ui/framework/configuration/ConfigurationController.cxx index ef7fd4cdbf00..731b9d6963c0 100644 --- a/sd/source/ui/framework/configuration/ConfigurationController.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationController.cxx @@ -59,7 +59,7 @@ using rtl::OUString; using ::sd::framework::FrameworkHelper; #undef VERBOSE -#define VERBOSE 3 +//#define VERBOSE 3 namespace sd { namespace framework { diff --git a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx index e2aab7316937..5721f483595f 100644 --- a/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationUpdater.cxx @@ -49,7 +49,7 @@ using ::rtl::OUString; using ::std::vector; #undef VERBOSE -#define VERBOSE 2 +//#define VERBOSE 2 namespace { static const sal_Int32 snShortTimeout (100); diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx index df537fa8bb03..11af473cfd0b 100644 --- a/sd/source/ui/func/fuinsert.cxx +++ b/sd/source/ui/func/fuinsert.cxx @@ -410,12 +410,6 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq ) mpViewShell->AdaptDefaultsForChart( xObj ); } } - - if( !mpView->IsUndoEnabled() && pPickObj ) - { - // replaced object must be freed if there is no undo action owning it - SdrObject::Free( pPickObj ); - } } else { diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx index 4c12445a513f..4ef479af977e 100644 --- a/sd/source/ui/table/tablefunction.cxx +++ b/sd/source/ui/table/tablefunction.cxx @@ -193,12 +193,6 @@ void DrawViewShell::FuTable(SfxRequest& rReq) else mpView->InsertObjectAtView(pObj, *pPV, SDRINSERT_SETDEFLAYER); - if( !mpView->IsUndoEnabled() && pPickObj ) - { - // replaced object must be freed if there is no undo action owning it - SdrObject::Free( pPickObj ); - } - Invalidate(SID_DRAWTBX_INSERT); rReq.Ignore(); break; diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx index e8337c97dfb3..528969bcbf4d 100755 --- a/sd/source/ui/view/ViewShellManager.cxx +++ b/sd/source/ui/view/ViewShellManager.cxx @@ -45,7 +45,7 @@ #include #undef VERBOSE -#define VERBOSE 2 +//#define VERBOSE 2 namespace sd { diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx index 9c6273085b51..db7c981f80e2 100644 --- a/sd/source/ui/view/drawview.cxx +++ b/sd/source/ui/view/drawview.cxx @@ -593,6 +593,8 @@ SdrObject* DrawView::GetMaxToBtmObj(SdrObject* pObj) const void DrawView::DeleteMarked() { + OSL_TRACE( "DrawView::DeleteMarked() - enter" ); + sd::UndoManager* pUndoManager = mpDoc->GetUndoManager(); DBG_ASSERT( pUndoManager, "sd::DrawView::DeleteMarked(), ui action without undo manager!?" ); @@ -643,6 +645,8 @@ void DrawView::DeleteMarked() pPage->SetObjectOrdNum( pNewObj->GetOrdNum(), pObj->GetOrdNum() ); bResetLayout = true; + + OSL_TRACE( "DrawView::InsertAutoLayoutShape() - InsertAutoLayoutShape" ); } } } @@ -655,6 +659,8 @@ void DrawView::DeleteMarked() if( pUndoManager ) pUndoManager->LeaveListAction(); + + OSL_TRACE( "DrawView::InsertAutoLayoutShape() - leave" ); } } // end of namespace sd diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx index 49496086e084..aeebb7d63f69 100644 --- a/sd/source/ui/view/sdview4.cxx +++ b/sd/source/ui/view/sdview4.cxx @@ -123,6 +123,9 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, const bool bIsGraphic = pPickObj->ISA( SdrGrafObj ); if( bIsGraphic || pObj->IsEmptyPresObj() ) { + if( IsUndoEnabled() ) + BegUndo(String(SdResId(STR_INSERTGRAPHIC))); + SdPage* pPage = (SdPage*) pPickObj->GetPage(); if( bIsGraphic ) @@ -157,10 +160,8 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction, ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView - if( !IsUndoEnabled() && pPickObj ) - { - SdrObject::Free( pPickObj ); - } + if( IsUndoEnabled() ) + EndUndo(); } else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj)) { @@ -329,13 +330,14 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc pNewMediaObj = new SdrMediaObj( aRect ); + bool bIsPres = false; if( pPickObj ) { SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage()); - if(pPage && pPage->IsPresObj(pPickObj)) + bIsPres = pPage && pPage->IsPresObj(pPickObj); + if( bIsPres ) { pPage->InsertPresObj( pNewMediaObj, PRESOBJ_MEDIA ); - pNewMediaObj->SetUserCall(pPickObj->GetUserCall()); } } @@ -347,10 +349,11 @@ SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAc pNewMediaObj->setURL( rMediaURL ); if( pPickObj ) + { pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() ); - - if( !IsUndoEnabled() ) - SdrObject::Free( pPickObj ); + if( bIsPres ) + pNewMediaObj->SetUserCall(pPickObj->GetUserCall()); + } } rAction = mnAction; diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 172594adc2e8..d42c3a986f7f 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -312,14 +312,15 @@ bool ChangePlaceholderTag::KeyInput( const KeyEvent& rKEvt ) /** returns true if the SmartTag consumes this event. */ bool ChangePlaceholderTag::RequestHelp( const HelpEvent& rHEvt ) { +/* Rectangle aItemRect( rHEvt.GetMousePosPixel(), Size(1,1) ); String aHelpText(RTL_CONSTASCII_USTRINGPARAM("I'm a help text")); if( rHEvt.GetMode() == HELPMODE_BALLOON ) Help::ShowBalloon( static_cast< ::Window* >(mrView.GetFirstOutputDevice()), aItemRect.Center(), aItemRect, aHelpText); else Help::ShowQuickHelp( static_cast< ::Window* >(mrView.GetFirstOutputDevice()), aItemRect, aHelpText ); - - return true; +*/ + return false; } // --------------------------------------------------------------------