From f0a1b95f99bed6d184e3020b5c7e30bc6c1597f6 Mon Sep 17 00:00:00 2001 From: Christian Lippka ORACLE Date: Tue, 6 Dec 2011 02:48:42 +0100 Subject: impress210: #i41995# fixed import of path animation from sxi files # HG changeset patch # User Christian Lippka ORACLE # Date 1299691949 -3600 # Node ID 8edc33ef50a3b6ebbc4e88d574b6b1ba57b1dbaa # Parent 0b9b11216b0d3401f8824542dd5f2794eb141035 impress210: #i41995# fixed import of path animation from sxi files --- sd/inc/EffectMigration.hxx | 3 +++ sd/source/core/CustomAnimationEffect.cxx | 1 + sd/source/core/EffectMigration.cxx | 25 +++++++++++++++++++++++++ sd/source/ui/unoidl/unoobj.cxx | 12 +++++++++++- svx/inc/svx/svdobj.hxx | 3 ++- svx/inc/svx/svdogrp.hxx | 3 +++ svx/inc/svx/svdovirt.hxx | 2 +- svx/source/svdraw/svdobj.cxx | 6 +++--- svx/source/svdraw/svdogrp.cxx | 11 +++++++++++ svx/source/svdraw/svdovirt.cxx | 2 +- sw/inc/dcontact.hxx | 2 +- sw/source/core/draw/dcontact.cxx | 2 +- sw/source/core/draw/dflyobj.cxx | 2 +- sw/source/core/inc/dflyobj.hxx | 2 +- 14 files changed, 65 insertions(+), 11 deletions(-) diff --git a/sd/inc/EffectMigration.hxx b/sd/inc/EffectMigration.hxx index 03fd55303422..59e19dacdb70 100644 --- a/sd/inc/EffectMigration.hxx +++ b/sd/inc/EffectMigration.hxx @@ -37,6 +37,7 @@ class SdPage; class SvxShape; class SdAnimationInfo; class SdrObject; +class SdrPathObj; namespace sd { @@ -77,6 +78,8 @@ public: static void UpdateSoundEffect( SvxShape* pShape, SdAnimationInfo* pInfo ); static ::rtl::OUString GetSoundFile( SvxShape* pShape ); static sal_Bool GetSoundOn( SvxShape* pShape ); + + static void SetAnimationPath( SvxShape* pShape, SdrPathObj* pPathObj ); }; } // end of namespace sd diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 054fcd0c4748..7deb7cfa0ed9 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -1735,6 +1735,7 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() ); if( pObj ) { + pObj->RecalcBoundRect(true); const Rectangle aBoundRect( pObj->GetCurrentBoundRect() ); const Point aCenter( aBoundRect.Center() ); diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index 9d03a10fafed..f90808d9368a 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include "drawdoc.hxx" #include "sdpage.hxx" #include @@ -1319,4 +1320,28 @@ sal_Bool EffectMigration::GetSoundOn( SvxShape* pShape ) return GetSoundFile( pShape ).getLength() != 0; } +// -------------------------------------------------------------------- + +void EffectMigration::SetAnimationPath( SvxShape* pShape, SdrPathObj* pPathObj ) +{ + if( pShape && pPathObj ) + { + SdrObject* pObj = pShape->GetSdrObject(); + + if( pObj ) + { + sd::MainSequencePtr pMainSequence = static_cast(pObj->GetPage())->getMainSequence(); + + const Reference< XShape > xShape( pShape ); + SdPage* pPage = dynamic_cast< SdPage* >( pPathObj ? pPathObj->GetPage() : 0 ); + if( pPage ) + { + boost::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() ); + if( pMainSequence.get() ) + CustomAnimationEffectPtr pCreated( pMainSequence->append( *pPathObj, makeAny( xShape ), -1.0 ) ); + } + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 8f1ab65abcee..8341121af06a 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -644,7 +644,17 @@ void SAL_CALL SdXShape::setPropertyValue( const ::rtl::OUString& aPropertyName, } } break; -// TODO: WID_ANIMPATH + case WID_ANIMPATH: + { + uno::Reference< drawing::XShape > xShape( aValue, uno::UNO_QUERY ); + SdrPathObj* pObj = xShape.is() ? dynamic_cast< SdrPathObj* >( GetSdrObjectFromXShape( xShape ) ) : NULL; + + if( pObj == NULL ) + throw lang::IllegalArgumentException(); + + EffectMigration::SetAnimationPath( mpShape, pObj ); + break; + } case WID_IMAGEMAP: { SdDrawDocument* pDoc = mpModel?mpModel->GetDoc():NULL; diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index 1bac35e49232..2b69930c28bf 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -660,7 +660,8 @@ public: // a new method for accessing the last BoundRect. virtual const Rectangle& GetLastBoundRect() const; - virtual void RecalcBoundRect(); + // If bForced is true, the boundrect is also calculated when the model is locked + virtual void RecalcBoundRect(bool bForced = false); void BroadcastObjectChange() const; diff --git a/svx/inc/svx/svdogrp.hxx b/svx/inc/svx/svdogrp.hxx index 7e48ec372ae7..5b96c38ddacb 100644 --- a/svx/inc/svx/svdogrp.hxx +++ b/svx/inc/svx/svdogrp.hxx @@ -80,6 +80,9 @@ public: virtual const Rectangle& GetCurrentBoundRect() const; virtual const Rectangle& GetSnapRect() const; + // If bForced is true, the boundrect is also calculated when the model is locked + virtual void RecalcBoundRect(bool bForced = false); + virtual SdrObjGroup* Clone() const; SdrObjGroup& operator=(const SdrObjGroup& rObj); diff --git a/svx/inc/svx/svdovirt.hxx b/svx/inc/svx/svdovirt.hxx index 95536ef3bc40..5d05a68b43cf 100644 --- a/svx/inc/svx/svdovirt.hxx +++ b/svx/inc/svx/svdovirt.hxx @@ -76,7 +76,7 @@ public: virtual const Rectangle& GetCurrentBoundRect() const; virtual const Rectangle& GetLastBoundRect() const; - virtual void RecalcBoundRect(); + virtual void RecalcBoundRect(bool bForced = false); virtual void SetChanged(); virtual SdrVirtObj* Clone() const; SdrVirtObj& operator=(const SdrVirtObj& rObj); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 5a11ca6fc1cd..d5a2fe3fab0b 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -828,14 +828,14 @@ const Rectangle& SdrObject::GetLastBoundRect() const return aOutRect; } -void SdrObject::RecalcBoundRect() +void SdrObject::RecalcBoundRect(bool bForced) { // #i101680# suppress BoundRect calculations on import(s) - if(pModel && pModel->isLocked() ) + if(pModel && pModel->isLocked() && !bForced ) return; // central new method which will calculate the BoundRect using primitive geometry - if(aOutRect.IsEmpty()) + if(aOutRect.IsEmpty() || bForced) { const drawinglayer::primitive2d::Primitive2DSequence xPrimitives(GetViewContact().getViewIndependentPrimitive2DSequence()); diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 1e5206298c16..ff5fec569796 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -267,6 +267,17 @@ const Rectangle& SdrObjGroup::GetCurrentBoundRect() const return aOutRect; } +void SdrObjGroup::RecalcBoundRect(bool bForced) +{ + if( bForced ) + { + sal_uIntPtr nAnz=pSub->GetObjCount(); + for( sal_uIntPtr i=0; iGetObj(i)->RecalcBoundRect(true); + } + + SdrObject::RecalcBoundRect(bForced); +} const Rectangle& SdrObjGroup::GetSnapRect() const { diff --git a/svx/source/svdraw/svdovirt.cxx b/svx/source/svdraw/svdovirt.cxx index 2aa7d0e0351e..b8155eac4787 100644 --- a/svx/source/svdraw/svdovirt.cxx +++ b/svx/source/svdraw/svdovirt.cxx @@ -137,7 +137,7 @@ const Rectangle& SdrVirtObj::GetLastBoundRect() const return aOutRect; } -void SdrVirtObj::RecalcBoundRect() +void SdrVirtObj::RecalcBoundRect(bool bForced) { aOutRect=rRefObj.GetCurrentBoundRect(); aOutRect+=aAnchor; diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index ff317e5e40d4..4c2bb433108e 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -293,7 +293,7 @@ class SwDrawVirtObj : public SdrVirtObj virtual void NbcSetAnchorPos(const Point& rPnt); // All overloaded methods which need to use the offset - virtual void RecalcBoundRect(); + virtual void RecalcBoundRect(bool bForce = false); virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const; virtual ::basegfx::B2DPolyPolygon TakeContour() const; virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const; diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 998b1672ba83..38ec0a01f508 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -2384,7 +2384,7 @@ void SwDrawVirtObj::SetBoundRectDirty() // do nothing to not lose model information in aOutRect } -void SwDrawVirtObj::RecalcBoundRect() +void SwDrawVirtObj::RecalcBoundRect(bool) { // OD 2004-04-05 #i26791# - switch order of calling and // , because calculates diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index 6eac60586127..82629d804f3d 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -582,7 +582,7 @@ const Rectangle& SwVirtFlyDrawObj::GetLastBoundRect() const } -void SwVirtFlyDrawObj::RecalcBoundRect() +void SwVirtFlyDrawObj::RecalcBoundRect(bool) { SetRect(); } diff --git a/sw/source/core/inc/dflyobj.hxx b/sw/source/core/inc/dflyobj.hxx index 9e3cf0dff55e..1ac349decc0d 100644 --- a/sw/source/core/inc/dflyobj.hxx +++ b/sw/source/core/inc/dflyobj.hxx @@ -102,7 +102,7 @@ public: //Wir nehemen die Groessenbehandlung vollstaendig selbst in die Hand. virtual const Rectangle& GetCurrentBoundRect() const; virtual const Rectangle& GetLastBoundRect() const; - virtual void RecalcBoundRect(); + virtual void RecalcBoundRect(bool bForce = false); virtual void RecalcSnapRect(); virtual const Rectangle& GetSnapRect() const; virtual void SetSnapRect(const Rectangle& rRect); -- cgit v1.2.3