more fixes for new presentation layout shapes

This commit is contained in:
Christian Lippka 2010-02-25 18:04:05 +01:00
parent 3c69551e77
commit 55525d4462
9 changed files with 29 additions and 29 deletions

View file

@ -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<SdDrawDocument*>(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;

View file

@ -59,7 +59,7 @@ using rtl::OUString;
using ::sd::framework::FrameworkHelper;
#undef VERBOSE
#define VERBOSE 3
//#define VERBOSE 3
namespace sd { namespace framework {

View file

@ -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);

View file

@ -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
{

View file

@ -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;

View file

@ -45,7 +45,7 @@
#include <hash_map>
#undef VERBOSE
#define VERBOSE 2
//#define VERBOSE 2
namespace sd {

View file

@ -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

View file

@ -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;

View file

@ -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;
}
// --------------------------------------------------------------------