You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2014/02/15 02:16:09 UTC
svn commit: r1568575 - in /openoffice/trunk/main: sd/inc/EffectMigration.hxx
sd/source/core/EffectMigration.cxx sd/source/ui/dlg/animobjs.cxx
sd/source/ui/unoidl/unoobj.cxx xmloff/source/draw/animimp.cxx
Author: alg
Date: Sat Feb 15 01:16:09 2014
New Revision: 1568575
URL: http://svn.apache.org/r1568575
Log:
i42894 added support for <presentation:animations> at import and creation
Modified:
openoffice/trunk/main/sd/inc/EffectMigration.hxx
openoffice/trunk/main/sd/source/core/EffectMigration.cxx
openoffice/trunk/main/sd/source/ui/dlg/animobjs.cxx
openoffice/trunk/main/sd/source/ui/unoidl/unoobj.cxx
openoffice/trunk/main/xmloff/source/draw/animimp.cxx
Modified: openoffice/trunk/main/sd/inc/EffectMigration.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/inc/EffectMigration.hxx?rev=1568575&r1=1568574&r2=1568575&view=diff
==============================================================================
--- openoffice/trunk/main/sd/inc/EffectMigration.hxx (original)
+++ openoffice/trunk/main/sd/inc/EffectMigration.hxx Sat Feb 15 01:16:09 2014
@@ -33,6 +33,7 @@ class SvxShape;
class SdAnimationInfo;
class SdrObject;
class SdrPathObj;
+class SdrObjGroup;
namespace sd {
@@ -75,6 +76,7 @@ public:
static sal_Bool GetSoundOn( SvxShape* pShape );
static void SetAnimationPath( SvxShape* pShape, SdrPathObj* pPathObj );
+ static void CreateAnimatedGroup(SdrObjGroup& rGroupObj, SdPage& rPage);
};
} // end of namespace sd
Modified: openoffice/trunk/main/sd/source/core/EffectMigration.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/core/EffectMigration.cxx?rev=1568575&r1=1568574&r2=1568575&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/core/EffectMigration.cxx (original)
+++ openoffice/trunk/main/sd/source/core/EffectMigration.cxx Sat Feb 15 01:16:09 2014
@@ -19,17 +19,24 @@
*
*************************************************************/
-
-
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sd.hxx"
#include <com/sun/star/presentation/EffectNodeType.hpp>
#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
#include <com/sun/star/presentation/TextAnimationType.hpp>
#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/animations/Event.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
#include <svx/unoshape.hxx>
#include <svx/svdotext.hxx>
#include <svx/svdopath.hxx>
+#include <svx/svdogrp.hxx>
+#include <svx/svditer.hxx>
#include "drawdoc.hxx"
#include "sdpage.hxx"
#include <CustomAnimationPreset.hxx>
@@ -42,15 +49,18 @@ using namespace ::sd;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::animations;
using namespace ::com::sun::star::presentation;
-
using ::com::sun::star::drawing::XShape;
using ::rtl::OUString;
+using ::com::sun::star::lang::XMultiServiceFactory;
+using ::com::sun::star::drawing::XShape;
+using ::com::sun::star::beans::NamedValue;
struct deprecated_FadeEffect_conversion_table_entry
{
FadeEffect meFadeEffect;
const sal_Char* mpPresetId;
}
+
deprecated_FadeEffect_conversion_table[] =
{
// OOo 1.x transitions
@@ -1363,4 +1373,145 @@ void EffectMigration::SetAnimationPath(
}
}
+// --------------------------------------------------------------------
+
+static const OUString aServiceNameParallelTimeContainer(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.ParallelTimeContainer"));
+static const OUString aServiceNameAnimateSet(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.animations.AnimateSet"));
+
+// #42894# helper which creates the needed XAnimate for changing visibility and all the (currently) needed embeddings
+void createVisibilityOnOffNode(Reference< XTimeContainer >& rxParentContainer, SdrObject& rCandidate, bool bVisible, bool bOnClick, double fDuration)
+{
+ Reference< XMultiServiceFactory > xMsf(::comphelper::getProcessServiceFactory());
+ Any aAny;
+
+ // create par container node
+ Reference< XAnimationNode > xOuterSeqTimeContainer(xMsf->createInstance(aServiceNameParallelTimeContainer), UNO_QUERY_THROW);
+
+ // set begin
+ aAny <<= (double)(0.0);
+ xOuterSeqTimeContainer->setBegin(aAny);
+
+ // set fill
+ xOuterSeqTimeContainer->setFill(AnimationFill::HOLD);
+
+ // set named values
+ Sequence< NamedValue > aUserDataSequence;
+ aUserDataSequence.realloc(1);
+
+ aUserDataSequence[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM("node-type"));
+ aUserDataSequence[0].Value <<= bOnClick ? EffectNodeType::ON_CLICK : EffectNodeType::AFTER_PREVIOUS;
+
+ xOuterSeqTimeContainer->setUserData(aUserDataSequence);
+
+ // create animate set to change visibility for rCandidate
+ Reference< XAnimationNode > xAnimateSetForLast(xMsf->createInstance(aServiceNameAnimateSet), UNO_QUERY_THROW);
+
+ // set begin
+ aAny <<= (double)(0.0);
+ xAnimateSetForLast->setBegin(aAny);
+
+ // set duration
+ aAny <<= fDuration;
+ xAnimateSetForLast->setDuration(aAny);
+
+ // set fill
+ xAnimateSetForLast->setFill(AnimationFill::HOLD);
+
+ // set target
+ Reference< XAnimate > xAnimate(xAnimateSetForLast, UNO_QUERY);
+ Reference< XShape > xTargetShape(rCandidate.getUnoShape(), UNO_QUERY);
+ aAny <<= xTargetShape;
+ xAnimate->setTarget(aAny);
+
+ // set AttributeName
+ xAnimate->setAttributeName(OUString(RTL_CONSTASCII_USTRINGPARAM("Visibility")));
+
+ // set attribute value
+ aAny <<= bVisible ? sal_True : sal_False;
+ xAnimate->setTo(aAny);
+
+ // ad set node to par node
+ Reference< XTimeContainer > xParentContainer(xOuterSeqTimeContainer, UNO_QUERY_THROW);
+ xParentContainer->appendChild(xAnimateSetForLast);
+
+ // add node
+ rxParentContainer->appendChild(xOuterSeqTimeContainer);
+}
+
+// #42894# older AOO formats supported animated group objects, that means all members of the group
+// were shown animated by showing one after the other. This is no longer supported, but the following
+// fallback will create the needed SMIL animation stuff. Unfortunately the members of the group
+// have to be moved directly to the page, else the (explained to be generic, thus I expected this to
+// work) animations will not work in slideshow
+void EffectMigration::CreateAnimatedGroup(SdrObjGroup& rGroupObj, SdPage& rPage)
+{
+ // aw080 will give a vector immeditately
+ SdrObjListIter aIter(rGroupObj);
+
+ if(aIter.Count())
+ {
+ boost::shared_ptr< sd::MainSequence > pMainSequence(rPage.getMainSequence());
+
+ if(pMainSequence.get())
+ {
+ std::vector< SdrObject* > aObjects;
+ aObjects.reserve(aIter.Count());
+
+ while(aIter.IsMore())
+ {
+ // do move to page rough with old/current stuff, will be different in aw080 anyways
+ SdrObject* pCandidate = aIter.Next();
+ rGroupObj.GetSubList()->NbcRemoveObject(pCandidate->GetOrdNum());
+ rPage.NbcInsertObject(pCandidate);
+ aObjects.push_back(pCandidate);
+ }
+
+ // create main node
+ Reference< XMultiServiceFactory > xMsf(::comphelper::getProcessServiceFactory());
+ Reference< XAnimationNode > xOuterSeqTimeContainer(xMsf->createInstance(aServiceNameParallelTimeContainer), UNO_QUERY_THROW);
+ Any aAny;
+
+ // set begin
+ aAny <<= (double)(0.0);
+ xOuterSeqTimeContainer->setBegin(aAny);
+
+ // prepare parent container
+ Reference< XTimeContainer > xParentContainer(xOuterSeqTimeContainer, UNO_QUERY_THROW);
+
+ // prepare loop over objects
+ SdrObject* pLast = 0;
+ SdrObject* pNext = 0;
+ const double fDurationShow(0.2);
+ const double fDurationHide(0.001);
+
+ for(sal_uInt32 a(0); a < aObjects.size(); a++)
+ {
+ pLast = pNext;
+ pNext = aObjects[a];
+
+ // create node
+ if(pLast)
+ {
+ createVisibilityOnOffNode(xParentContainer, *pLast, false, false, fDurationHide);
+ }
+
+ if(pNext)
+ {
+ createVisibilityOnOffNode(xParentContainer, *pNext, true, !a, fDurationShow);
+ }
+ }
+
+ // create end node
+ if(pNext)
+ {
+ createVisibilityOnOffNode(xParentContainer, *pNext, false, false, fDurationHide);
+ }
+
+ // add to main sequence and rebuild
+ pMainSequence->createEffects(xOuterSeqTimeContainer);
+ pMainSequence->rebuild();
+ }
+ }
+}
+// eof
Modified: openoffice/trunk/main/sd/source/ui/dlg/animobjs.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/dlg/animobjs.cxx?rev=1568575&r1=1568574&r2=1568575&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/dlg/animobjs.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/dlg/animobjs.cxx Sat Feb 15 01:16:09 2014
@@ -55,6 +55,9 @@
#include <vcl/svapp.hxx>
#endif
+// #42894#
+#include <EffectMigration.hxx>
+
#include <string>
#include <algorithm>
@@ -1232,39 +1235,46 @@ void AnimationWindow::CreateAnimObj (::s
pClone->NbcMove( aMoveSize );
}
- // Animationsgruppe erzeugen
- SdrObjGroup* pGroup = new SdrObjGroup;
- SdrObjList* pObjList = pGroup->GetSubList();
+ // #42894# Caution(!) variable pPage looks right, but it is a page from the local
+ // document the dialog is using (!), so get the target page from the target view
+ SdPage* pTargetSdPage = dynamic_cast< SdPage* >(rView.GetSdrPageView() ? rView.GetSdrPageView()->GetPage() : 0);
+
+ if(pTargetSdPage)
+ {
+ // Animationsgruppe erzeugen
+ SdrObjGroup* pGroup = new SdrObjGroup;
+ SdrObjList* pObjList = pGroup->GetSubList();
- for (i = 0; i < nCount; i++)
- {
- // der Clone verbleibt im Animator; in die Gruppe kommt ein Clone
- // des Clones
- pClone = pPage->GetObj(i);
- SdrObject* pCloneOfClone = pClone->Clone();
- //SdrObject* pCloneOfClone = pPage->GetObj(i)->Clone();
- pObjList->InsertObject(pCloneOfClone, LIST_APPEND);
- }
+ for (i = 0; i < nCount; i++)
+ {
+ // der Clone verbleibt im Animator; in die Gruppe kommt ein Clone
+ // des Clones
+ pClone = pPage->GetObj(i);
+ SdrObject* pCloneOfClone = pClone->Clone();
+ //SdrObject* pCloneOfClone = pPage->GetObj(i)->Clone();
+ pObjList->InsertObject(pCloneOfClone, LIST_APPEND);
+ }
- // bis jetzt liegt die linke obere Ecke der Gruppe in der Fenstermitte;
- // jetzt noch um die Haelfte der Groesse nach oben und links korrigieren
- aTemp = aMaxSizeLog;
- aTemp.Height() = - aTemp.Height() / 2;
- aTemp.Width() = - aTemp.Width() / 2;
- pGroup->NbcMove(aTemp);
-
- // Animationsinformation erzeugen
- SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pGroup,true);
- pInfo->meEffect = presentation::AnimationEffect_NONE;
- pInfo->meSpeed = presentation::AnimationSpeed_MEDIUM;
- pInfo->mbActive = sal_True;
- pInfo->mbIsMovie = sal_True;
- pInfo->maBlueScreen = COL_WHITE;
+ // bis jetzt liegt die linke obere Ecke der Gruppe in der Fenstermitte;
+ // jetzt noch um die Haelfte der Groesse nach oben und links korrigieren
+ aTemp = aMaxSizeLog;
+ aTemp.Height() = - aTemp.Height() / 2;
+ aTemp.Width() = - aTemp.Width() / 2;
+ pGroup->NbcMove(aTemp);
+
+ // #42894# create needed SMIL stuff and move child objects to page directly (see
+ // comments at EffectMigration::CreateAnimatedGroup why this has to be done).
+ EffectMigration::CreateAnimatedGroup(*pGroup, *pTargetSdPage);
- rView.InsertObjectAtView( pGroup, *pPV, SDRINSERT_SETDEFLAYER);
- }
+ // #42894# if that worked, delete the group again
+ if(!pGroup->GetSubList()->GetObjCount())
+ {
+ delete pGroup;
+ }
+ }
+ }
- ClickFirstHdl( this );
+ ClickFirstHdl( this );
}
void AnimationWindow::DataChanged( const DataChangedEvent& rDCEvt )
Modified: openoffice/trunk/main/sd/source/ui/unoidl/unoobj.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sd/source/ui/unoidl/unoobj.cxx?rev=1568575&r1=1568574&r2=1568575&view=diff
==============================================================================
--- openoffice/trunk/main/sd/source/ui/unoidl/unoobj.cxx (original)
+++ openoffice/trunk/main/sd/source/ui/unoidl/unoobj.cxx Sat Feb 15 01:16:09 2014
@@ -56,6 +56,7 @@
#include "Outliner.hxx"
#include "sdresid.hxx"
#include <comphelper/serviceinfohelper.hxx>
+#include <svx/svdogrp.hxx>
#include "anminfo.hxx"
#include "unohelp.hxx"
@@ -542,17 +543,39 @@ void SAL_CALL SdXShape::setPropertyValue
EffectMigration::SetAnimationSpeed( mpShape, eSpeed );
break;
}
-/* TODO?? case WID_ISANIMATION:
- {
-
- sal_Bool bIsAnimation;
- if(!(aValue >>= bIsAnimation))
- throw lang::IllegalArgumentException();
-
- pInfo->mbIsMovie = bIsAnimation;
- break;
- }
-*/
+ case WID_ISANIMATION:
+ {
+ sal_Bool bIsAnimation(sal_False);
+
+ if(!(aValue >>= bIsAnimation))
+ {
+ throw lang::IllegalArgumentException();
+ }
+
+ if(bIsAnimation)
+ {
+ SdrObjGroup* pGroup = dynamic_cast< SdrObjGroup* >(pObj);
+ SdPage* pPage = dynamic_cast< SdPage* >(pGroup->GetPage());
+
+ if(pGroup && pPage)
+ {
+ // #42894# Animated Group object, migrate that effect
+ EffectMigration::CreateAnimatedGroup(*pGroup, *pPage);
+
+ // #42894# unfortunately when doing this all group members have to
+ // be moved to the page as direct members, else the currently
+ // available forms of animation do not work. If it succeeds,
+ // the group is empty and can be removed and deleted
+ if(!pGroup->GetSubList()->GetObjCount())
+ {
+ pPage->NbcRemoveObject(pGroup->GetOrdNum());
+ delete pGroup;
+ }
+ }
+ }
+ //pInfo->mbIsMovie = bIsAnimation;
+ break;
+ }
case WID_BOOKMARK:
{
OUString aString;
Modified: openoffice/trunk/main/xmloff/source/draw/animimp.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/animimp.cxx?rev=1568575&r1=1568574&r2=1568575&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/draw/animimp.cxx (original)
+++ openoffice/trunk/main/xmloff/source/draw/animimp.cxx Sat Feb 15 01:16:09 2014
@@ -615,8 +615,9 @@ void XMLAnimationsEffectContext::EndElem
aAny <<= (sal_Bool)sal_True;
xSet->setPropertyValue( mpImpl->msIsAnimation, aAny );
- aAny <<= meSpeed;
- xSet->setPropertyValue( mpImpl->msSpeed, aAny );
+ // #42894# speed is not supported for the old group animation fallback, so no need to set it
+ // aAny <<= meSpeed;
+ // xSet->setPropertyValue( mpImpl->msSpeed, aAny );
}
else
{