summaryrefslogtreecommitdiff
path: root/slideshow/source/engine/animationnodes
diff options
context:
space:
mode:
Diffstat (limited to 'slideshow/source/engine/animationnodes')
-rw-r--r--slideshow/source/engine/animationnodes/animationaudionode.cxx181
-rw-r--r--slideshow/source/engine/animationnodes/animationaudionode.hxx77
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.cxx490
-rw-r--r--slideshow/source/engine/animationnodes/animationbasenode.hxx111
-rw-r--r--slideshow/source/engine/animationnodes/animationcolornode.cxx137
-rw-r--r--slideshow/source/engine/animationnodes/animationcolornode.hxx62
-rw-r--r--slideshow/source/engine/animationnodes/animationcommandnode.cxx134
-rw-r--r--slideshow/source/engine/animationnodes/animationcommandnode.hxx69
-rw-r--r--slideshow/source/engine/animationnodes/animationnodefactory.cxx620
-rw-r--r--slideshow/source/engine/animationnodes/animationpathmotionnode.cxx67
-rw-r--r--slideshow/source/engine/animationnodes/animationpathmotionnode.hxx65
-rw-r--r--slideshow/source/engine/animationnodes/animationsetnode.cxx213
-rw-r--r--slideshow/source/engine/animationnodes/animationsetnode.hxx58
-rw-r--r--slideshow/source/engine/animationnodes/animationtransformnode.cxx114
-rw-r--r--slideshow/source/engine/animationnodes/animationtransformnode.hxx66
-rw-r--r--slideshow/source/engine/animationnodes/animationtransitionfilternode.cxx59
-rw-r--r--slideshow/source/engine/animationnodes/animationtransitionfilternode.hxx67
-rw-r--r--slideshow/source/engine/animationnodes/basecontainernode.cxx175
-rw-r--r--slideshow/source/engine/animationnodes/basecontainernode.hxx105
-rw-r--r--slideshow/source/engine/animationnodes/basenode.cxx769
-rw-r--r--slideshow/source/engine/animationnodes/basenode.hxx229
-rw-r--r--slideshow/source/engine/animationnodes/generateevent.cxx246
-rw-r--r--slideshow/source/engine/animationnodes/generateevent.hxx62
-rw-r--r--slideshow/source/engine/animationnodes/makefile.mk61
-rw-r--r--slideshow/source/engine/animationnodes/nodetools.cxx128
-rw-r--r--slideshow/source/engine/animationnodes/nodetools.hxx88
-rw-r--r--slideshow/source/engine/animationnodes/paralleltimecontainer.cxx69
-rw-r--r--slideshow/source/engine/animationnodes/paralleltimecontainer.hxx63
-rw-r--r--slideshow/source/engine/animationnodes/propertyanimationnode.cxx115
-rw-r--r--slideshow/source/engine/animationnodes/propertyanimationnode.hxx58
-rw-r--r--slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx162
-rw-r--r--slideshow/source/engine/animationnodes/sequentialtimecontainer.hxx75
-rw-r--r--slideshow/source/engine/animationnodes/setactivity.hxx155
33 files changed, 5150 insertions, 0 deletions
diff --git a/slideshow/source/engine/animationnodes/animationaudionode.cxx b/slideshow/source/engine/animationnodes/animationaudionode.cxx
new file mode 100644
index 000000000000..c4efc7c4df34
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationaudionode.cxx
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include "eventqueue.hxx"
+#include "animationaudionode.hxx"
+#include "delayevent.hxx"
+#include "tools.hxx"
+#include "nodetools.hxx"
+#include "boost/bind.hpp"
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+AnimationAudioNode::AnimationAudioNode(
+ const uno::Reference< animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+ : BaseNode( xNode, rParent, rContext ),
+ mxAudioNode( xNode, uno::UNO_QUERY_THROW ),
+ maSoundURL(),
+ mpPlayer()
+{
+ mxAudioNode->getSource() >>= maSoundURL;
+
+ OSL_ENSURE( maSoundURL.getLength(),
+ "could not extract sound source URL/empty URL string" );
+
+ ENSURE_OR_THROW( getContext().mxComponentContext.is(),
+ "Invalid component context" );
+}
+
+void AnimationAudioNode::dispose()
+{
+ resetPlayer();
+ mxAudioNode.clear();
+ BaseNode::dispose();
+}
+
+void AnimationAudioNode::activate_st()
+{
+ createPlayer();
+
+ AnimationEventHandlerSharedPtr aHandler(
+ boost::dynamic_pointer_cast<AnimationEventHandler>( getSelf() ) );
+ OSL_ENSURE( aHandler,
+ "could not cast self to AnimationEventHandler?" );
+ getContext().mrEventMultiplexer.addCommandStopAudioHandler( aHandler );
+
+ if (mpPlayer && mpPlayer->startPlayback())
+ {
+ // TODO(F2): Handle end time attribute, too
+ if( getXAnimationNode()->getDuration().hasValue() )
+ {
+ scheduleDeactivationEvent();
+ }
+ else
+ {
+ // no node duration. Take inherent media time, then
+ scheduleDeactivationEvent(
+ makeDelay( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ mpPlayer->getDuration(),
+ "AnimationAudioNode::deactivate with delay") );
+ }
+ }
+ else
+ {
+ // deactivate ASAP:
+ scheduleDeactivationEvent(
+ makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ "AnimationAudioNode::deactivate without delay") );
+ }
+}
+
+// TODO(F2): generate deactivation event, when sound
+// is over
+
+void AnimationAudioNode::deactivate_st( NodeState /*eDestState*/ )
+{
+ AnimationEventHandlerSharedPtr aHandler(
+ boost::dynamic_pointer_cast<AnimationEventHandler>( getSelf() ) );
+ OSL_ENSURE( aHandler,
+ "could not cas self to AnimationEventHandler?" );
+ getContext().mrEventMultiplexer.removeCommandStopAudioHandler( aHandler );
+
+ // force-end sound
+ if (mpPlayer)
+ {
+ mpPlayer->stopPlayback();
+ resetPlayer();
+ }
+
+ // notify _after_ state change:
+ getContext().mrEventQueue.addEvent(
+ makeEvent( boost::bind( &EventMultiplexer::notifyAudioStopped,
+ boost::ref(getContext().mrEventMultiplexer),
+ getSelf() ),
+ "AnimationAudioNode::notifyAudioStopped") );
+}
+
+bool AnimationAudioNode::hasPendingAnimation() const
+{
+ // force slide to use the animation framework
+ // (otherwise, a single sound on the slide would
+ // not be played).
+ return true;
+}
+
+void AnimationAudioNode::createPlayer() const
+{
+ if (mpPlayer)
+ return;
+
+ try
+ {
+ mpPlayer = SoundPlayer::create( getContext().mrEventMultiplexer,
+ maSoundURL,
+ getContext().mxComponentContext );
+ }
+ catch( lang::NoSupportException& )
+ {
+ // catch possible exceptions from SoundPlayer,
+ // since being not able to playback the sound
+ // is not a hard error here (remainder of the
+ // animations should still work).
+ }
+}
+
+void AnimationAudioNode::resetPlayer() const
+{
+ if (mpPlayer)
+ {
+ mpPlayer->stopPlayback();
+ mpPlayer->dispose();
+ mpPlayer.reset();
+ }
+}
+
+bool AnimationAudioNode::handleAnimationEvent(
+ const AnimationNodeSharedPtr& /*rNode*/ )
+{
+ // TODO(F2): for now we support only STOPAUDIO events.
+ deactivate();
+ return true;
+}
+
+} // namespace internal
+} // namespace presentation
+
diff --git a/slideshow/source/engine/animationnodes/animationaudionode.hxx b/slideshow/source/engine/animationnodes/animationaudionode.hxx
new file mode 100644
index 000000000000..60f0da8d863f
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationaudionode.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX
+
+#include "basecontainernode.hxx"
+#include "soundplayer.hxx"
+#include "com/sun/star/animations/XAnimationNode.hpp"
+#include "com/sun/star/animations/XAudio.hpp"
+
+namespace slideshow {
+namespace internal {
+
+/** Audio node.
+
+ This animation node contains an audio effect. Duration and
+ start/stop behaviour is affected by the referenced audio
+ file.
+*/
+class AnimationAudioNode : public BaseNode, public AnimationEventHandler
+{
+public:
+ AnimationAudioNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext );
+
+protected:
+ virtual void dispose();
+
+private:
+ virtual void activate_st();
+ virtual void deactivate_st( NodeState eDestState );
+ virtual bool hasPendingAnimation() const;
+
+ /// overriden, because we need to deal with STOPAUDIO commands
+ virtual bool handleAnimationEvent( const AnimationNodeSharedPtr& rNode );
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAudio > mxAudioNode;
+ ::rtl::OUString maSoundURL;
+ mutable SoundPlayerSharedPtr mpPlayer;
+
+ void createPlayer() const;
+ void resetPlayer() const;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX */
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.cxx b/slideshow/source/engine/animationnodes/animationbasenode.cxx
new file mode 100644
index 000000000000..370d646a4f43
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationbasenode.cxx
@@ -0,0 +1,490 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <comphelper/anytostring.hxx>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+
+#include "nodetools.hxx"
+#include "doctreenode.hxx"
+#include "animationbasenode.hxx"
+#include "delayevent.hxx"
+#include "framerate.hxx"
+
+#include <boost/bind.hpp>
+#include <boost/optional.hpp>
+#include <algorithm>
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+AnimationBaseNode::AnimationBaseNode(
+ const uno::Reference< animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+ : BaseNode( xNode, rParent, rContext ),
+ mxAnimateNode( xNode, uno::UNO_QUERY_THROW ),
+ maAttributeLayerHolder(),
+ maSlideSize( rContext.maSlideSize ),
+ mpActivity(),
+ mpShape(),
+ mpShapeSubset(),
+ mpSubsetManager(rContext.maContext.mpSubsettableShapeManager),
+ mbIsIndependentSubset( rContext.mbIsIndependentSubset )
+{
+ // extract native node targets
+ // ===========================
+
+ // plain shape target
+ uno::Reference< drawing::XShape > xShape( mxAnimateNode->getTarget(),
+ uno::UNO_QUERY );
+
+ // distinguish 5 cases:
+ //
+ // - plain shape target
+ // (NodeContext.mpMasterShapeSubset full set)
+ //
+ // - parent-generated subset (generate an
+ // independent subset)
+ //
+ // - parent-generated subset from iteration
+ // (generate a dependent subset)
+ //
+ // - XShape target at the XAnimatioNode (generate
+ // a plain shape target)
+ //
+ // - ParagraphTarget target at the XAnimationNode
+ // (generate an independent shape subset)
+ if( rContext.mpMasterShapeSubset )
+ {
+ if( rContext.mpMasterShapeSubset->isFullSet() )
+ {
+ // case 1: plain shape target from parent
+ mpShape = rContext.mpMasterShapeSubset->getSubsetShape();
+ }
+ else
+ {
+ // cases 2 & 3: subset shape
+ mpShapeSubset = rContext.mpMasterShapeSubset;
+ }
+ }
+ else
+ {
+ // no parent-provided shape, try to extract
+ // from XAnimationNode - cases 4 and 5
+
+ if( xShape.is() )
+ {
+ mpShape = lookupAttributableShape( getContext().mpSubsettableShapeManager,
+ xShape );
+ }
+ else
+ {
+ // no shape provided. Maybe a ParagraphTarget?
+ presentation::ParagraphTarget aTarget;
+
+ if( !(mxAnimateNode->getTarget() >>= aTarget) )
+ ENSURE_OR_THROW(
+ false, "could not extract any target information" );
+
+ xShape = aTarget.Shape;
+
+ ENSURE_OR_THROW( xShape.is(), "invalid shape in ParagraphTarget" );
+
+ mpShape = lookupAttributableShape( getContext().mpSubsettableShapeManager,
+ xShape );
+
+ // NOTE: For shapes with ParagraphTarget, we ignore
+ // the SubItem property. We implicitely assume that it
+ // is set to ONLY_TEXT.
+ OSL_ENSURE(
+ mxAnimateNode->getSubItem() ==
+ presentation::ShapeAnimationSubType::ONLY_TEXT ||
+ mxAnimateNode->getSubItem() ==
+ presentation::ShapeAnimationSubType::AS_WHOLE,
+ "ParagraphTarget given, but subitem not AS_TEXT or AS_WHOLE? "
+ "Make up your mind, I'll ignore the subitem." );
+
+ // okay, found a ParagraphTarget with a valid XShape. Does the shape
+ // provide the given paragraph?
+ const DocTreeNode& rTreeNode(
+ mpShape->getTreeNodeSupplier().getTreeNode(
+ aTarget.Paragraph,
+ DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) );
+
+ // CAUTION: the creation of the subset shape
+ // _must_ stay in the node constructor, since
+ // Slide::prefetchShow() initializes shape
+ // attributes right after animation import (or
+ // the Slide class must be changed).
+ mpShapeSubset.reset(
+ new ShapeSubset( mpShape,
+ rTreeNode,
+ mpSubsetManager ));
+
+ // Override NodeContext, and flag this node as
+ // a special independent subset one. This is
+ // important when applying initial attributes:
+ // independent shape subsets must be setup
+ // when the slide starts, since they, as their
+ // name suggest, can have state independent to
+ // the master shape. The following example
+ // might illustrate that: a master shape has
+ // no effect, one of the text paragraphs
+ // within it has an appear effect. Now, the
+ // respective paragraph must be invisible when
+ // the slide is initially shown, and become
+ // visible only when the effect starts.
+ mbIsIndependentSubset = true;
+
+ // already enable subset right here, the
+ // setup of initial shape attributes of
+ // course needs the subset shape
+ // generated, to apply e.g. visibility
+ // changes.
+ mpShapeSubset->enableSubsetShape();
+ }
+ }
+}
+
+void AnimationBaseNode::dispose()
+{
+ if (mpActivity) {
+ mpActivity->dispose();
+ mpActivity.reset();
+ }
+
+ maAttributeLayerHolder.reset();
+ mxAnimateNode.clear();
+ mpShape.reset();
+ mpShapeSubset.reset();
+
+ BaseNode::dispose();
+}
+
+bool AnimationBaseNode::init_st()
+{
+ // if we've still got an old activity lying around, dispose it:
+ if (mpActivity) {
+ mpActivity->dispose();
+ mpActivity.reset();
+ }
+
+ // note: actually disposing the activity too early might cause problems,
+ // because on dequeued() it calls endAnimation(pAnim->end()), thus ending
+ // animation _after_ last screen update.
+ // review that end() is properly called (which calls endAnimation(), too).
+
+ try {
+ // TODO(F2): For restart functionality, we must regenerate activities,
+ // since they are not able to reset their state (or implement _that_)
+ mpActivity = createActivity();
+ }
+ catch (uno::Exception const&) {
+ OSL_ENSURE( false, rtl::OUStringToOString(
+ comphelper::anyToString(cppu::getCaughtException()),
+ RTL_TEXTENCODING_UTF8 ) );
+ // catch and ignore. We later handle empty activities, but for
+ // other nodes to function properly, the core functionality of
+ // this node must remain up and running.
+ }
+ return true;
+}
+
+bool AnimationBaseNode::resolve_st()
+{
+ // enable shape subset for automatically generated
+ // subsets. Independent subsets are already setup
+ // during construction time. Doing it only here
+ // saves us a lot of sprites and shapes lying
+ // around. This is especially important for
+ // character-wise iterations, since the shape
+ // content (e.g. thousands of characters) would
+ // otherwise be painted character-by-character.
+ if (isDependentSubsettedShape() && mpShapeSubset) {
+ mpShapeSubset->enableSubsetShape();
+ }
+ return true;
+}
+
+void AnimationBaseNode::activate_st()
+{
+ // create new attribute layer
+ maAttributeLayerHolder.createAttributeLayer( getShape() );
+
+ ENSURE_OR_THROW( maAttributeLayerHolder.get(),
+ "Could not generate shape attribute layer" );
+
+ // TODO(Q2): This affects the way mpActivity
+ // works, but is performed here because of
+ // locality (we're fiddling with the additive mode
+ // here, anyway, and it's the only place where we
+ // do). OTOH, maybe the complete additive mode
+ // setup should be moved to the activities.
+
+ // for simple by-animations, the SMIL spec
+ // requires us to emulate "0,by-value" value list
+ // behaviour, with additive mode forced to "sum",
+ // no matter what the input is
+ // (http://www.w3.org/TR/smil20/animation.html#adef-by).
+ if( mxAnimateNode->getBy().hasValue() &&
+ !mxAnimateNode->getTo().hasValue() &&
+ !mxAnimateNode->getFrom().hasValue() )
+ {
+ // force attribute mode to REPLACE (note the
+ // subtle discrepancy to the paragraph above,
+ // where SMIL requires SUM. This is internally
+ // handled by the FromToByActivity, and is
+ // because otherwise DOM values would not be
+ // handled correctly: the activity cannot
+ // determine whether an
+ // Activity::getUnderlyingValue() yields the
+ // DOM value, or already a summed-up conglomerate)
+ //
+ // Note that this poses problems with our
+ // hybrid activity duration (time or min number of frames),
+ // since if activities
+ // exceed their duration, wrong 'by' start
+ // values might arise ('Laser effect')
+ maAttributeLayerHolder.get()->setAdditiveMode(
+ animations::AnimationAdditiveMode::REPLACE );
+ }
+ else
+ {
+ // apply additive mode to newly created Attribute layer
+ maAttributeLayerHolder.get()->setAdditiveMode(
+ mxAnimateNode->getAdditive() );
+ }
+
+ // fake normal animation behaviour, even if we
+ // show nothing. This is the appropriate way to
+ // handle errors on Activity generation, because
+ // maybe all other effects on the slide are
+ // correctly initialized (but won't run, if we
+ // signal an error here)
+ if (mpActivity) {
+ // supply Activity (and the underlying Animation) with
+ // it's AttributeLayer, to perform the animation on
+ mpActivity->setTargets( getShape(), maAttributeLayerHolder.get() );
+
+ // add to activities queue
+ getContext().mrActivitiesQueue.addActivity( mpActivity );
+ }
+ else {
+ // Actually, DO generate the event for empty activity,
+ // to keep the chain of animations running
+ BaseNode::scheduleDeactivationEvent();
+ }
+}
+
+void AnimationBaseNode::deactivate_st( NodeState eDestState )
+{
+ if (eDestState == FROZEN) {
+ if (mpActivity)
+ mpActivity->end();
+ }
+
+ if (isDependentSubsettedShape()) {
+ // for dependent subsets, remove subset shape
+ // from layer, re-integrate subsetted part
+ // back into original shape. For independent
+ // subsets, we cannot make any assumptions
+ // about subset attribute state relative to
+ // master shape, thus, have to keep it. This
+ // will effectively re-integrate the subsetted
+ // part into the original shape (whose
+ // animation will hopefully have ended, too)
+
+ // this statement will save a whole lot of
+ // sprites for iterated text effects, since
+ // those sprites will only exist during the
+ // actual lifetime of the effects
+ if (mpShapeSubset) {
+ mpShapeSubset->disableSubsetShape();
+ }
+ }
+
+ if (eDestState == ENDED) {
+
+ // no shape anymore, no layer needed:
+ maAttributeLayerHolder.reset();
+
+ if (! isDependentSubsettedShape()) {
+
+ // for all other shapes, removing the
+ // attribute layer quite possibly changes
+ // shape display. Thus, force update
+ AttributableShapeSharedPtr const pShape( getShape() );
+
+ // don't anybody dare to check against
+ // pShape->isVisible() here, removing the
+ // attribute layer might actually make the
+ // shape invisible!
+ getContext().mpSubsettableShapeManager->notifyShapeUpdate( pShape );
+ }
+
+ if (mpActivity) {
+ // kill activity, if still running
+ mpActivity->dispose();
+ mpActivity.reset();
+ }
+ }
+}
+
+bool AnimationBaseNode::hasPendingAnimation() const
+{
+ // TODO(F1): This might not always be true. Are there 'inactive'
+ // animation nodes?
+ return true;
+}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+void AnimationBaseNode::showState() const
+{
+ BaseNode::showState();
+
+ VERBOSE_TRACE( "AnimationBaseNode info: independent subset=%s",
+ mbIsIndependentSubset ? "y" : "n" );
+}
+#endif
+
+ActivitiesFactory::CommonParameters
+AnimationBaseNode::fillCommonParameters() const
+{
+ double nDuration = 0.0;
+
+ // TODO(F3): Duration/End handling is barely there
+ if( !(mxAnimateNode->getDuration() >>= nDuration) ) {
+ mxAnimateNode->getEnd() >>= nDuration; // Wah.
+ }
+
+ // minimal duration we fallback to (avoid 0 here!)
+ nDuration = ::std::max( 0.001, nDuration );
+
+ const bool bAutoReverse( mxAnimateNode->getAutoReverse() );
+
+ boost::optional<double> aRepeats;
+ double nRepeats = 0;
+ if( (mxAnimateNode->getRepeatCount() >>= nRepeats) ) {
+ aRepeats.reset( nRepeats );
+ }
+ else {
+ if( (mxAnimateNode->getRepeatDuration() >>= nRepeats) ) {
+ // when repeatDuration is given,
+ // autoreverse does _not_ modify the
+ // active duration. Thus, calc repeat
+ // count with already adapted simple
+ // duration (twice the specified duration)
+
+ // convert duration back to repeat counts
+ if( bAutoReverse )
+ aRepeats.reset( nRepeats / (2.0 * nDuration) );
+ else
+ aRepeats.reset( nRepeats / nDuration );
+ }
+ else {
+ // no double value for both values - Timing::INDEFINITE?
+ animations::Timing eTiming;
+
+ if( !(mxAnimateNode->getRepeatDuration() >>= eTiming) ||
+ eTiming != animations::Timing_INDEFINITE )
+ {
+ if( !(mxAnimateNode->getRepeatCount() >>= eTiming) ||
+ eTiming != animations::Timing_INDEFINITE )
+ {
+ // no indefinite timing, no other values given -
+ // use simple run, i.e. repeat of 1.0
+ aRepeats.reset( 1.0 );
+ }
+ }
+ }
+ }
+
+ // calc accel/decel:
+ double nAcceleration = 0.0;
+ double nDeceleration = 0.0;
+ BaseNodeSharedPtr const pSelf( getSelf() );
+ for ( boost::shared_ptr<BaseNode> pNode( pSelf );
+ pNode; pNode = pNode->getParentNode() )
+ {
+ uno::Reference<animations::XAnimationNode> const xAnimationNode(
+ pNode->getXAnimationNode() );
+ nAcceleration = std::max( nAcceleration,
+ xAnimationNode->getAcceleration() );
+ nDeceleration = std::max( nDeceleration,
+ xAnimationNode->getDecelerate() );
+ }
+
+ EventSharedPtr pEndEvent;
+ if (pSelf) {
+ pEndEvent = makeEvent(
+ boost::bind( &AnimationNode::deactivate, pSelf ),
+ "AnimationBaseNode::deactivate");
+ }
+
+ // Calculate the minimum frame count that depends on the duration and
+ // the minimum frame count.
+ const sal_Int32 nMinFrameCount (basegfx::clamp<sal_Int32>(
+ basegfx::fround(nDuration * FrameRate::MinimumFramesPerSecond), 1, 10));
+
+ return ActivitiesFactory::CommonParameters(
+ pEndEvent,
+ getContext().mrEventQueue,
+ getContext().mrActivitiesQueue,
+ nDuration,
+ nMinFrameCount,
+ bAutoReverse,
+ aRepeats,
+ nAcceleration,
+ nDeceleration,
+ getShape(),
+ getSlideSize());
+}
+
+AttributableShapeSharedPtr AnimationBaseNode::getShape() const
+{
+ // any subsetting at all?
+ if (mpShapeSubset)
+ return mpShapeSubset->getSubsetShape();
+ else
+ return mpShape; // nope, plain shape always
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/animationbasenode.hxx b/slideshow/source/engine/animationnodes/animationbasenode.hxx
new file mode 100644
index 000000000000..fd6e92682988
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationbasenode.hxx
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONBASENODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONBASENODE_HXX
+
+#include <com/sun/star/animations/XAnimate.hpp>
+
+#include "basecontainernode.hxx"
+#include "activitiesfactory.hxx"
+#include "shapeattributelayer.hxx"
+#include "shapeattributelayerholder.hxx"
+#include "attributableshape.hxx"
+#include "shapesubset.hxx"
+
+namespace slideshow {
+namespace internal {
+
+/** Common base class for all leaf animation nodes.
+
+ This class basically holds the target shape
+*/
+class AnimationBaseNode : public BaseNode
+{
+public:
+ AnimationBaseNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext );
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual void showState() const;
+#endif
+
+protected:
+ virtual void dispose();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimate> const& getXAnimateNode() const
+ { return mxAnimateNode; }
+
+ /// Create parameter struct for ActivitiesFactory
+ ActivitiesFactory::CommonParameters fillCommonParameters() const;
+ ::basegfx::B2DVector const& getSlideSize() const { return maSlideSize; }
+ AttributableShapeSharedPtr getShape() const;
+
+private:
+ virtual bool hasPendingAnimation() const;
+
+private: // state transition callbacks
+ virtual bool init_st();
+ virtual bool resolve_st();
+ virtual void activate_st();
+ virtual void deactivate_st( NodeState eDestState );
+ virtual AnimationActivitySharedPtr createActivity() const = 0;
+
+private:
+ /** Returns true, if this is a subset animation, and
+ the subset is autogenerated (e.g. from an
+ iteration)
+ */
+ bool isDependentSubsettedShape() const
+ { return mpShapeSubset && !mbIsIndependentSubset; }
+
+ ShapeAttributeLayerHolder const & getAttributeLayerHolder() const
+ { return maAttributeLayerHolder; }
+
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimate> mxAnimateNode;
+ ShapeAttributeLayerHolder maAttributeLayerHolder;
+ ::basegfx::B2DVector maSlideSize;
+ AnimationActivitySharedPtr mpActivity;
+
+ /// When valid, this node has a plain target shape
+ AttributableShapeSharedPtr mpShape;
+ /// When valid, this is a subsetted target shape
+ ShapeSubsetSharedPtr mpShapeSubset;
+ SubsettableShapeManagerSharedPtr mpSubsetManager;
+ bool mbIsIndependentSubset;
+};
+
+} // namespace internal
+} // namespace presentation
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONBASENODE_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/animationcolornode.cxx b/slideshow/source/engine/animationnodes/animationcolornode.cxx
new file mode 100644
index 000000000000..d198ef08ae54
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationcolornode.cxx
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+#include <com/sun/star/animations/AnimationColorSpace.hpp>
+
+#include "coloranimation.hxx"
+#include "hslcoloranimation.hxx"
+#include "animationcolornode.hxx"
+#include "animationfactory.hxx"
+#include "activitiesfactory.hxx"
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+namespace {
+/** Little wrapper for HSL to RGB mapping.
+
+ This class implements the HSLColorAnimation interface,
+ internally converting to RGB and forwarding to
+ ColorAnimation.
+*/
+class HSLWrapper : public HSLColorAnimation
+{
+public:
+ HSLWrapper( const ColorAnimationSharedPtr& rAnimation )
+ : mpAnimation( rAnimation )
+ {
+ ENSURE_OR_THROW(
+ mpAnimation,
+ "HSLWrapper::HSLWrapper(): Invalid color animation delegate" );
+ }
+
+ virtual void prefetch( const AnimatableShapeSharedPtr&,
+ const ShapeAttributeLayerSharedPtr& )
+ {}
+
+ virtual void start( const AnimatableShapeSharedPtr& rShape,
+ const ShapeAttributeLayerSharedPtr& rAttrLayer )
+ {
+ mpAnimation->start( rShape, rAttrLayer );
+ }
+
+ virtual void end()
+ {
+ mpAnimation->end();
+ }
+
+ virtual bool operator()( const HSLColor& rColor )
+ {
+ return (*mpAnimation)( RGBColor( rColor ) );
+ }
+
+ virtual HSLColor getUnderlyingValue() const
+ {
+ return HSLColor( mpAnimation->getUnderlyingValue() );
+ }
+
+private:
+ ColorAnimationSharedPtr mpAnimation;
+};
+
+} // anon namespace
+
+AnimationActivitySharedPtr AnimationColorNode::createActivity() const
+{
+ ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
+
+ switch( mxColorNode->getColorInterpolation() )
+ {
+ case animations::AnimationColorSpace::RGB:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createColorPropertyAnimation(
+ mxColorNode->getAttributeName(),
+ getShape(),
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ getXAnimateNode() );
+
+ case animations::AnimationColorSpace::HSL:
+ // Wrap a plain ColorAnimation with the HSL
+ // wrapper, which implements the HSLColorAnimation
+ // interface, and internally converts HSL to RGB color
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ HSLColorAnimationSharedPtr(
+ new HSLWrapper(
+ AnimationFactory::createColorPropertyAnimation(
+ mxColorNode->getAttributeName(),
+ getShape(),
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ))),
+ mxColorNode );
+
+ default:
+ ENSURE_OR_THROW( false, "AnimationColorNode::createColorActivity(): "
+ "Unexpected color space" );
+ }
+
+ return AnimationActivitySharedPtr();
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/animationcolornode.hxx b/slideshow/source/engine/animationnodes/animationcolornode.hxx
new file mode 100644
index 000000000000..9f9758cc8e70
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationcolornode.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONCOLORNODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONCOLORNODE_HXX
+
+#include "animationbasenode.hxx"
+#include "com/sun/star/animations/XAnimateColor.hpp"
+
+namespace slideshow {
+namespace internal {
+
+class AnimationColorNode : public AnimationBaseNode
+{
+public:
+ AnimationColorNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext )
+ : AnimationBaseNode( xNode, pParent, rContext ),
+ mxColorNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW ) {}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual const char* getDescription() const { return "AnimationColorNode"; }
+#endif
+
+private:
+ virtual AnimationActivitySharedPtr createActivity() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimateColor > mxColorNode;
+};
+
+} // namespace internal
+} // namespace presentation
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONCOLORNODE_HXX */
diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.cxx b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
new file mode 100644
index 000000000000..e4bfed580f23
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+#include <com/sun/star/presentation/EffectCommands.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include "animationcommandnode.hxx"
+#include "delayevent.hxx"
+#include "tools.hxx"
+#include "nodetools.hxx"
+
+#include <boost/bind.hpp>
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+namespace EffectCommands = com::sun::star::presentation::EffectCommands;
+
+AnimationCommandNode::AnimationCommandNode( uno::Reference<animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext ) :
+ BaseNode( xNode, pParent, rContext ),
+ mpShape(),
+ mxCommandNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW )
+{
+ uno::Reference< drawing::XShape > xShape( mxCommandNode->getTarget(),
+ uno::UNO_QUERY );
+ ShapeSharedPtr pShape( getContext().mpSubsettableShapeManager->lookupShape( xShape ) );
+ mpShape = ::boost::dynamic_pointer_cast< ExternalMediaShape >( pShape );
+}
+
+void AnimationCommandNode::dispose()
+{
+ mxCommandNode.clear();
+ mpShape.reset();
+ BaseNode::dispose();
+}
+
+void AnimationCommandNode::activate_st()
+{
+ switch( mxCommandNode->getCommand() ) {
+ // the command is user defined
+ case EffectCommands::CUSTOM: break;
+ // the command is an ole verb.
+ case EffectCommands::VERB: break;
+ // the command starts playing on a media object
+ case EffectCommands::PLAY:
+ {
+ double fMediaTime=0.0;
+ beans::PropertyValue aMediaTime;
+ if( (mxCommandNode->getParameter() >>= aMediaTime) &&
+ aMediaTime.Name.equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("MediaTime") ))
+ {
+ aMediaTime.Value >>= fMediaTime;
+ }
+ if( mpShape )
+ {
+ mpShape->setMediaTime(fMediaTime/1000.0);
+ mpShape->play();
+ }
+ break;
+ }
+ // the command toggles the pause status on a media object
+ case EffectCommands::TOGGLEPAUSE:
+ {
+ if( mpShape )
+ {
+ if( mpShape->isPlaying() )
+ mpShape->pause();
+ else
+ mpShape->play();
+ }
+ break;
+ }
+ // the command stops the animation on a media object
+ case EffectCommands::STOP:
+ {
+ if( mpShape )
+ mpShape->stop();
+ break;
+ }
+ // the command stops all currently running sound effects
+ case EffectCommands::STOPAUDIO:
+ getContext().mrEventMultiplexer.notifyCommandStopAudio( getSelf() );
+ break;
+ }
+
+ // deactivate ASAP:
+ scheduleDeactivationEvent(
+ makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ "AnimationCommandNode::deactivate" ) );
+}
+
+bool AnimationCommandNode::hasPendingAnimation() const
+{
+ return mxCommandNode->getCommand() == EffectCommands::STOPAUDIO || mpShape;
+}
+
+} // namespace internal
+} // namespace slideshow
diff --git a/slideshow/source/engine/animationnodes/animationcommandnode.hxx b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
new file mode 100644
index 000000000000..bb6a57a7cc4a
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationcommandnode.hxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONCOMMANDNODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONCOMMANDNODE_HXX
+
+#include "basecontainernode.hxx"
+#include "externalmediashape.hxx"
+#include "soundplayer.hxx"
+#include "com/sun/star/animations/XCommand.hpp"
+
+namespace slideshow {
+namespace internal {
+
+/** Command node.
+
+ This animation node encapsulates a command. Not yet implemented:
+ verb & custom.
+*/
+class AnimationCommandNode : public BaseNode
+{
+public:
+ AnimationCommandNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext );
+
+protected:
+ virtual void dispose();
+
+private:
+ virtual void activate_st();
+ virtual bool hasPendingAnimation() const;
+
+private:
+ ExternalMediaShapeSharedPtr mpShape;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XCommand > mxCommandNode;
+ bool mbIsPaused;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONAUDIONODE_HXX */
diff --git a/slideshow/source/engine/animationnodes/animationnodefactory.cxx b/slideshow/source/engine/animationnodes/animationnodefactory.cxx
new file mode 100644
index 000000000000..868a0b8d81ac
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationnodefactory.cxx
@@ -0,0 +1,620 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/animations/AnimationNodeType.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/presentation/TextAnimationType.hpp>
+#include <com/sun/star/animations/XAnimateSet.hpp>
+#include <com/sun/star/animations/XIterateContainer.hpp>
+#include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
+#include <com/sun/star/animations/XAnimateMotion.hpp>
+#include <com/sun/star/animations/XAnimateColor.hpp>
+#include <com/sun/star/animations/XAnimateTransform.hpp>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+#include <com/sun/star/animations/XTransitionFilter.hpp>
+#include <com/sun/star/animations/XAudio.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <animations/animationnodehelper.hxx>
+#include <basegfx/numeric/ftools.hxx>
+
+#include "animationnodefactory.hxx"
+#include "paralleltimecontainer.hxx"
+#include "sequentialtimecontainer.hxx"
+#include "propertyanimationnode.hxx"
+#include "animationsetnode.hxx"
+#include "animationpathmotionnode.hxx"
+#include "animationcolornode.hxx"
+#include "animationtransformnode.hxx"
+#include "animationtransitionfilternode.hxx"
+#include "animationaudionode.hxx"
+#include "animationcommandnode.hxx"
+#include "nodetools.hxx"
+#include "tools.hxx"
+
+#include <boost/bind.hpp>
+
+using namespace ::com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+namespace {
+
+// forward declaration needed by NodeCreator
+BaseNodeSharedPtr implCreateAnimationNode(
+ const uno::Reference< animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext );
+
+class NodeCreator
+{
+public:
+ NodeCreator( BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+ : mrParent( rParent ), mrContext( rContext ) {}
+
+ void operator()(
+ const uno::Reference< animations::XAnimationNode >& xChildNode ) const
+ {
+ createChild( xChildNode, mrContext );
+ }
+
+protected:
+ void createChild(
+ const uno::Reference< animations::XAnimationNode >& xChildNode,
+ const NodeContext& rContext ) const
+ {
+ BaseNodeSharedPtr pChild( implCreateAnimationNode( xChildNode,
+ mrParent,
+ rContext ) );
+
+ OSL_ENSURE( pChild,
+ "NodeCreator::operator(): child creation failed" );
+
+ // TODO(Q1): This yields circular references, which, it seems, is
+ // unavoidable here
+ if( pChild )
+ mrParent->appendChildNode( pChild );
+ }
+
+ BaseContainerNodeSharedPtr& mrParent;
+ const NodeContext& mrContext;
+};
+
+/** Same as NodeCreator, only that NodeContext's
+ SubsetShape is cloned for every child node.
+
+ This is used for iterated animation node generation
+*/
+class CloningNodeCreator : private NodeCreator
+{
+public:
+ CloningNodeCreator( BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+ : NodeCreator( rParent, rContext ) {}
+
+ void operator()(
+ const uno::Reference< animations::XAnimationNode >& xChildNode ) const
+ {
+ NodeContext aContext( mrContext );
+
+ // TODO(Q1): There's a catch here. If you clone a
+ // subset whose actual subsetting has already been
+ // realized (i.e. if enableSubsetShape() has been
+ // called already), and the original of your clone
+ // goes out of scope, then your subset will be
+ // gone (SubsettableShapeManager::revokeSubset() be
+ // called). As of now, this behaviour is not
+ // triggered here (we either clone, XOR we enable
+ // subset initially), but one might consider
+ // reworking DrawShape/ShapeSubset to avoid this.
+
+ // clone ShapeSubset, since each node needs their
+ // own version of the ShapeSubset (otherwise,
+ // e.g. activity counting does not work - subset
+ // would be removed after first animation node
+ // disables it).
+ //
+ // NOTE: this is only a problem for animation
+ // nodes that explicitely call
+ // disableSubsetShape(). Independent shape subsets
+ // (like those created for ParagraphTargets)
+ // solely rely on the ShapeSubset destructor to
+ // normalize things, which does the right thing
+ // here: the subset is only removed after _the
+ // last_ animation node releases the shared ptr.
+ aContext.mpMasterShapeSubset.reset(
+ new ShapeSubset( *aContext.mpMasterShapeSubset ) );
+
+ createChild( xChildNode, aContext );
+ }
+};
+
+/** Create animation nodes for text iterations
+
+ This method clones the animation nodes below xIterNode
+ for every iterated shape entity.
+*/
+bool implCreateIteratedNodes(
+ const uno::Reference< animations::XIterateContainer >& xIterNode,
+ BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+{
+ ENSURE_OR_THROW( xIterNode.is(),
+ "implCreateIteratedNodes(): Invalid node" );
+
+ const double nIntervalTimeout( xIterNode->getIterateInterval() );
+
+ // valid iterate interval? We're ruling out monstrous
+ // values here, to avoid pseudo 'hangs' in the
+ // presentation
+ if( nIntervalTimeout < 0.0 ||
+ nIntervalTimeout > 1000.0 )
+ {
+ return false; // not an active iteration
+ }
+
+ if( ::basegfx::fTools::equalZero( nIntervalTimeout ) )
+ OSL_TRACE( "implCreateIteratedNodes(): "
+ "iterate interval close to zero, there's "
+ "no point in defining such an effect "
+ "(visually equivalent to whole-shape effect)" );
+
+ // Determine target shape (or subset)
+ // ==================================
+
+ // TODO(E1): I'm not too sure what to expect here...
+ ENSURE_OR_RETURN_FALSE(
+ xIterNode->getTarget().hasValue(),
+ "implCreateIteratedNodes(): no target on ITERATE node" );
+
+ uno::Reference< drawing::XShape > xTargetShape( xIterNode->getTarget(),
+ uno::UNO_QUERY );
+
+ presentation::ParagraphTarget aTarget;
+ sal_Int16 nSubItem( xIterNode->getSubItem() );
+ bool bParagraphTarget( false );
+
+ if( !xTargetShape.is() )
+ {
+ // no shape provided. Maybe a ParagraphTarget?
+ if( !(xIterNode->getTarget() >>= aTarget) )
+ ENSURE_OR_RETURN_FALSE(
+ false,
+ "implCreateIteratedNodes(): could not extract any "
+ "target information" );
+
+ xTargetShape = aTarget.Shape;
+
+ ENSURE_OR_RETURN_FALSE(
+ xTargetShape.is(),
+ "implCreateIteratedNodes(): invalid shape in ParagraphTarget" );
+
+ // we've a paragraph target to iterate over, thus,
+ // the whole animation container refers only to
+ // the text
+ nSubItem = presentation::ShapeAnimationSubType::ONLY_TEXT;
+
+ bParagraphTarget = true;
+ }
+
+ // Lookup shape, and fill NodeContext
+ // ==================================
+
+ AttributableShapeSharedPtr pTargetShape(
+ lookupAttributableShape( rContext.maContext.mpSubsettableShapeManager,
+ xTargetShape ) );
+
+ const DocTreeNodeSupplier& rTreeNodeSupplier(
+ pTargetShape->getTreeNodeSupplier() );
+
+ ShapeSubsetSharedPtr pTargetSubset;
+
+ NodeContext aContext( rContext );
+
+ // paragraph targets already need a subset as the
+ // master shape (they're representing only a single
+ // paragraph)
+ if( bParagraphTarget )
+ {
+ ENSURE_OR_RETURN_FALSE(
+ aTarget.Paragraph >= 0 &&
+ rTreeNodeSupplier.getNumberOfTreeNodes(
+ DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ) > aTarget.Paragraph,
+ "implCreateIteratedNodes(): paragraph index out of range" );
+
+ pTargetSubset.reset(
+ new ShapeSubset(
+ pTargetShape,
+ // retrieve index aTarget.Paragraph of
+ // type PARAGRAPH from this shape
+ rTreeNodeSupplier.getTreeNode(
+ aTarget.Paragraph,
+ DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH ),
+ rContext.maContext.mpSubsettableShapeManager ) );
+
+ // iterate target is not the whole shape, but only
+ // the selected paragraph - subset _must_ be
+ // independent, to be able to affect visibility
+ // independent of master shape
+ aContext.mbIsIndependentSubset = true;
+
+ // already enable parent subset right here, to
+ // make potentially generated subsets subtract
+ // their content from the parent subset (and not
+ // the original shape). Otherwise, already
+ // subsetted parents (e.g. paragraphs) would not
+ // have their characters removed, when the child
+ // iterations start.
+ // Furthermore, the setup of initial shape
+ // attributes of course needs the subset shape
+ // generated, to apply e.g. visibility changes.
+ pTargetSubset->enableSubsetShape();
+ }
+ else
+ {
+ pTargetSubset.reset(
+ new ShapeSubset( pTargetShape,
+ rContext.maContext.mpSubsettableShapeManager ));
+ }
+
+ aContext.mpMasterShapeSubset = pTargetSubset;
+ uno::Reference< animations::XAnimationNode > xNode( xIterNode,
+ uno::UNO_QUERY_THROW );
+
+ // Generate subsets
+ // ================
+
+ if( bParagraphTarget ||
+ nSubItem != presentation::ShapeAnimationSubType::ONLY_TEXT )
+ {
+ // prepend with animations for
+ // full Shape (will be subtracted
+ // from the subset parts within
+ // the Shape::createSubset()
+ // method). For ONLY_TEXT effects,
+ // we skip this part, to animate
+ // only the text.
+ //
+ // OR
+ //
+ // prepend with subset animation for full
+ // _paragraph_, from which the individual
+ // paragraph subsets are subtracted. Note that the
+ // subitem is superfluous here, we always assume
+ // ONLY_TEXT, if a paragraph is referenced as the
+ // master of an iteration effect.
+ NodeCreator aCreator( rParent, aContext );
+ if( !::anim::for_each_childNode( xNode,
+ aCreator ) )
+ {
+ ENSURE_OR_RETURN_FALSE(
+ false,
+ "implCreateIteratedNodes(): iterated child node creation failed" );
+ }
+ }
+
+ // TODO(F2): This does not do the correct
+ // thing. Having nSubItem be set to ONLY_BACKGROUND
+ // should result in the text staying unanimated in the
+ // foreground, while the shape moves in the background
+ // (this behaviour is perfectly possible with the
+ // slideshow engine, only that the text won't be
+ // currently visible, because animations are always in
+ // the foreground)
+ if( nSubItem != presentation::ShapeAnimationSubType::ONLY_BACKGROUND )
+ {
+ // determine type of subitem iteration (logical
+ // text unit to animate)
+ DocTreeNode::NodeType eIterateNodeType(
+ DocTreeNode::NODETYPE_LOGICAL_CHARACTER_CELL );
+
+ switch( xIterNode->getIterateType() )
+ {
+ case presentation::TextAnimationType::BY_PARAGRAPH:
+ eIterateNodeType = DocTreeNode::NODETYPE_LOGICAL_PARAGRAPH;
+ break;
+
+ case presentation::TextAnimationType::BY_WORD:
+ eIterateNodeType = DocTreeNode::NODETYPE_LOGICAL_WORD;
+ break;
+
+ case presentation::TextAnimationType::BY_LETTER:
+ eIterateNodeType = DocTreeNode::NODETYPE_LOGICAL_CHARACTER_CELL;
+ break;
+
+ default:
+ ENSURE_OR_THROW(
+ false, "implCreateIteratedNodes(): "
+ "Unexpected IterateType on XIterateContainer");
+ break;
+ }
+
+ if( bParagraphTarget &&
+ eIterateNodeType != DocTreeNode::NODETYPE_LOGICAL_WORD &&
+ eIterateNodeType != DocTreeNode::NODETYPE_LOGICAL_CHARACTER_CELL )
+ {
+ // will not animate the whole paragraph, when
+ // only the paragraph is animated at all.
+ OSL_ENSURE( false,
+ "implCreateIteratedNodes(): Ignoring paragraph iteration for paragraph master" );
+ }
+ else
+ {
+ // setup iteration parameters
+ // --------------------------
+
+ // iterate target is the whole shape (or the
+ // whole parent subshape), thus, can save
+ // loads of subset shapes by generating them
+ // only when the effects become active -
+ // before and after the effect active
+ // duration, all attributes are shared by
+ // master shape and subset (since the iterated
+ // effects are all the same).
+ aContext.mbIsIndependentSubset = false;
+
+ // determine number of nodes for given subitem
+ // type
+ sal_Int32 nTreeNodes( 0 );
+ if( bParagraphTarget )
+ {
+ // create the iterated subset _relative_ to
+ // the given paragraph index (i.e. animate the
+ // given subset type, but only when it's part
+ // of the given paragraph)
+ nTreeNodes = rTreeNodeSupplier.getNumberOfSubsetTreeNodes(
+ pTargetSubset->getSubset(),
+ eIterateNodeType );
+ }
+ else
+ {
+ // generate normal subset
+ nTreeNodes = rTreeNodeSupplier.getNumberOfTreeNodes(
+ eIterateNodeType );
+ }
+
+
+ // iterate node, generate copies of the children for each subset
+ // -------------------------------------------------------------
+
+ // NodeContext::mnStartDelay contains additional node delay.
+ // This will make the duplicated nodes for each iteration start
+ // increasingly later.
+ aContext.mnStartDelay = nIntervalTimeout;
+
+ for( sal_Int32 i=0; i<nTreeNodes; ++i )
+ {
+ // create subset with the corresponding tree nodes
+ if( bParagraphTarget )
+ {
+ // create subsets relative to paragraph subset
+ aContext.mpMasterShapeSubset.reset(
+ new ShapeSubset(
+ pTargetSubset,
+ rTreeNodeSupplier.getSubsetTreeNode(
+ pTargetSubset->getSubset(),
+ i,
+ eIterateNodeType ) ) );
+ }
+ else
+ {
+ // create subsets from main shape
+ aContext.mpMasterShapeSubset.reset(
+ new ShapeSubset( pTargetSubset,
+ rTreeNodeSupplier.getTreeNode(
+ i,
+ eIterateNodeType ) ) );
+ }
+
+ CloningNodeCreator aCreator( rParent, aContext );
+ if( !::anim::for_each_childNode( xNode,
+ aCreator ) )
+ {
+ ENSURE_OR_RETURN_FALSE(
+ false, "implCreateIteratedNodes(): "
+ "iterated child node creation failed" );
+ }
+
+ aContext.mnStartDelay += nIntervalTimeout;
+ }
+ }
+ }
+
+ // done with iterate child generation
+ return true;
+}
+
+BaseNodeSharedPtr implCreateAnimationNode(
+ const uno::Reference< animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+{
+ ENSURE_OR_THROW( xNode.is(),
+ "implCreateAnimationNode(): invalid XAnimationNode" );
+
+ BaseNodeSharedPtr pCreatedNode;
+ BaseContainerNodeSharedPtr pCreatedContainer;
+
+ // create the internal node, corresponding to xNode
+ switch( xNode->getType() )
+ {
+ case animations::AnimationNodeType::CUSTOM:
+ OSL_ENSURE( false, "implCreateAnimationNode(): "
+ "CUSTOM not yet implemented" );
+ return pCreatedNode;
+
+ case animations::AnimationNodeType::PAR:
+ pCreatedNode = pCreatedContainer = BaseContainerNodeSharedPtr(
+ new ParallelTimeContainer( xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::ITERATE:
+ // map iterate container to ParallelTimeContainer.
+ // the iterating functionality is to be found
+ // below, (see method implCreateIteratedNodes)
+ pCreatedNode = pCreatedContainer = BaseContainerNodeSharedPtr(
+ new ParallelTimeContainer( xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::SEQ:
+ pCreatedNode = pCreatedContainer = BaseContainerNodeSharedPtr(
+ new SequentialTimeContainer( xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::ANIMATE:
+ pCreatedNode.reset( new PropertyAnimationNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::SET:
+ pCreatedNode.reset( new AnimationSetNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::ANIMATEMOTION:
+ pCreatedNode.reset( new AnimationPathMotionNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::ANIMATECOLOR:
+ pCreatedNode.reset( new AnimationColorNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::ANIMATETRANSFORM:
+ pCreatedNode.reset( new AnimationTransformNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::TRANSITIONFILTER:
+ pCreatedNode.reset( new AnimationTransitionFilterNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::AUDIO:
+ pCreatedNode.reset( new AnimationAudioNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ case animations::AnimationNodeType::COMMAND:
+ pCreatedNode.reset( new AnimationCommandNode(
+ xNode, rParent, rContext ) );
+ break;
+
+ default:
+ OSL_ENSURE( false, "implCreateAnimationNode(): "
+ "invalid AnimationNodeType" );
+ return pCreatedNode;
+ }
+
+ // TODO(Q1): This yields circular references, which, it seems, is
+ // unavoidable here
+
+ // HACK: node objects need shared_ptr to themselves,
+ // which we pass them here.
+ pCreatedNode->setSelf( pCreatedNode );
+
+ // if we've got a container node object, recursively add
+ // its children
+ if( pCreatedContainer )
+ {
+ uno::Reference< animations::XIterateContainer > xIterNode(
+ xNode, uno::UNO_QUERY );
+
+ // when this node is an XIterateContainer with
+ // active iterations, this method will generate
+ // the appropriate children
+ if( xIterNode.is() )
+ {
+ // note that implCreateIteratedNodes() might
+ // choose not to generate any child nodes
+ // (e.g. when the iterate timeout is outside
+ // sensible limits). Then, no child nodes are
+ // generated at all, since typically, child
+ // node attribute are incomplete for iteration
+ // children.
+ implCreateIteratedNodes( xIterNode,
+ pCreatedContainer,
+ rContext );
+ }
+ else
+ {
+ // no iterate subset node, just plain child generation now
+ NodeCreator aCreator( pCreatedContainer, rContext );
+ if( !::anim::for_each_childNode( xNode, aCreator ) )
+ {
+ OSL_ENSURE( false, "implCreateAnimationNode(): "
+ "child node creation failed" );
+ return BaseNodeSharedPtr();
+ }
+ }
+ }
+
+ return pCreatedNode;
+}
+
+} // anon namespace
+
+AnimationNodeSharedPtr AnimationNodeFactory::createAnimationNode(
+ const uno::Reference< animations::XAnimationNode >& xNode,
+ const ::basegfx::B2DVector& rSlideSize,
+ const SlideShowContext& rContext )
+{
+ ENSURE_OR_THROW(
+ xNode.is(),
+ "AnimationNodeFactory::createAnimationNode(): invalid XAnimationNode" );
+
+ return BaseNodeSharedPtr( implCreateAnimationNode(
+ xNode,
+ BaseContainerNodeSharedPtr(), // no parent
+ NodeContext( rContext,
+ rSlideSize )));
+}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+void AnimationNodeFactory::showTree( AnimationNodeSharedPtr& pRootNode )
+{
+ if( pRootNode )
+ DEBUG_NODES_SHOWTREE( boost::dynamic_pointer_cast<BaseContainerNode>(
+ pRootNode).get() );
+}
+#endif
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/animationpathmotionnode.cxx b/slideshow/source/engine/animationnodes/animationpathmotionnode.cxx
new file mode 100644
index 000000000000..19636ef3753f
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationpathmotionnode.cxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include "animationpathmotionnode.hxx"
+#include "animationfactory.hxx"
+
+namespace slideshow {
+namespace internal {
+
+void AnimationPathMotionNode::dispose()
+{
+ mxPathMotionNode.clear();
+ AnimationBaseNode::dispose();
+}
+
+AnimationActivitySharedPtr AnimationPathMotionNode::createActivity() const
+{
+ rtl::OUString aString;
+ ENSURE_OR_THROW( (mxPathMotionNode->getPath() >>= aString),
+ "no string-based SVG:d path found" );
+
+ ActivitiesFactory::CommonParameters const aParms( fillCommonParameters() );
+ return ActivitiesFactory::createSimpleActivity(
+ aParms,
+ AnimationFactory::createPathMotionAnimation(
+ aString,
+ mxPathMotionNode->getAdditive(),
+ getShape(),
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ true );
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/animationpathmotionnode.hxx b/slideshow/source/engine/animationnodes/animationpathmotionnode.hxx
new file mode 100644
index 000000000000..294584778b39
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationpathmotionnode.hxx
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONPATHMOTIONNODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONPATHMOTIONNODE_HXX
+
+#include "animationbasenode.hxx"
+#include "com/sun/star/animations/XAnimateMotion.hpp"
+
+namespace slideshow {
+namespace internal {
+
+class AnimationPathMotionNode : public AnimationBaseNode
+{
+public:
+ AnimationPathMotionNode(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+ : AnimationBaseNode( xNode, rParent, rContext ),
+ mxPathMotionNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW ) {}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual const char* getDescription() const
+ { return "AnimationPathMotionNode"; }
+#endif
+
+protected:
+ virtual void dispose();
+
+private:
+ virtual AnimationActivitySharedPtr createActivity() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimateMotion > mxPathMotionNode;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONPATHMOTIONNODE_HXX */
diff --git a/slideshow/source/engine/animationnodes/animationsetnode.cxx b/slideshow/source/engine/animationnodes/animationsetnode.cxx
new file mode 100644
index 000000000000..fe5be321fdf1
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationsetnode.cxx
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include "animationfactory.hxx"
+#include "setactivity.hxx"
+#include "animationsetnode.hxx"
+#include "nodetools.hxx"
+#include "tools.hxx"
+#include "delayevent.hxx"
+
+#include <boost/bind.hpp>
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+void AnimationSetNode::implScheduleDeactivationEvent()
+{
+ scheduleDeactivationEvent();
+}
+
+AnimationActivitySharedPtr AnimationSetNode::createActivity() const
+{
+ ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
+ uno::Reference<animations::XAnimate> const xAnimateNode = getXAnimateNode();
+ rtl::OUString const attrName( xAnimateNode->getAttributeName() );
+ AttributableShapeSharedPtr const pShape( getShape() );
+
+ // make deactivation a two-step procedure. Normally, we
+ // could solely rely on
+ // BaseNode::scheduleDeactivationEvent() to deactivate()
+ // us. Unfortunately, that method on the one hand ignores
+ // indefinite timing, on the other hand generates
+ // zero-timeout delays, which might get fired _before_ our
+ // set activity has taken place. Therefore, we enforce
+ // sequentiality by letting only the set activity schedule
+ // the deactivation event (and AnimationBaseNode
+ // takes care for the fact when mpActivity should be zero).
+
+ // AnimationBaseNode::fillCommonParameters() has set up
+ // immediate deactivation as default when activity ends, but
+ if (! isIndefiniteTiming( xAnimateNode->getDuration() )) {
+ boost::shared_ptr<AnimationSetNode> const pSelf(
+ boost::dynamic_pointer_cast<AnimationSetNode>(getSelf()) );
+ ENSURE_OR_THROW(
+ pSelf, "cannot cast getSelf() to my type!" );
+ aParms.mpEndEvent = makeEvent(
+ boost::bind( &AnimationSetNode::implScheduleDeactivationEvent,
+ pSelf ),
+ "AnimationSetNode::implScheduleDeactivationEvent");
+ }
+
+ switch (AnimationFactory::classifyAttributeName( attrName )) {
+ default:
+ case AnimationFactory::CLASS_UNKNOWN_PROPERTY:
+ ENSURE_OR_THROW(
+ false, "AnimationSetNode::createSetActivity(): "
+ "Unexpected attribute class" );
+ break;
+
+ case AnimationFactory::CLASS_NUMBER_PROPERTY:
+ {
+ NumberAnimation::ValueType aValue;
+
+ ENSURE_OR_THROW(
+ extractValue( aValue,
+ xAnimateNode->getTo(),
+ pShape,
+ getSlideSize() ),
+ "AnimationSetNode::createSetActivity(): "
+ "Could not import numeric to value" );
+
+ return makeSetActivity(
+ aParms,
+ AnimationFactory::createNumberPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(),
+ AnimationFactory::FLAG_NO_SPRITE ),
+ aValue );
+ }
+
+ case AnimationFactory::CLASS_ENUM_PROPERTY:
+ {
+ EnumAnimation::ValueType aValue;
+
+ ENSURE_OR_THROW(
+ extractValue( aValue,
+ xAnimateNode->getTo(),
+ pShape,
+ getSlideSize() ),
+ "AnimationSetNode::createSetActivity(): "
+ "Could not import enum to value" );
+
+ return makeSetActivity(
+ aParms,
+ AnimationFactory::createEnumPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(),
+ AnimationFactory::FLAG_NO_SPRITE ),
+ aValue );
+ }
+
+ case AnimationFactory::CLASS_COLOR_PROPERTY:
+ {
+ ColorAnimation::ValueType aValue;
+
+ ENSURE_OR_THROW(
+ extractValue( aValue,
+ xAnimateNode->getTo(),
+ pShape,
+ getSlideSize() ),
+ "AnimationSetNode::createSetActivity(): "
+ "Could not import color to value" );
+
+ return makeSetActivity(
+ aParms,
+ AnimationFactory::createColorPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(),
+ AnimationFactory::FLAG_NO_SPRITE ),
+ aValue );
+ }
+
+ case AnimationFactory::CLASS_STRING_PROPERTY:
+ {
+ StringAnimation::ValueType aValue;
+
+ ENSURE_OR_THROW(
+ extractValue( aValue,
+ xAnimateNode->getTo(),
+ pShape,
+ getSlideSize() ),
+ "AnimationSetNode::createSetActivity(): "
+ "Could not import string to value" );
+
+ return makeSetActivity(
+ aParms,
+ AnimationFactory::createStringPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(),
+ AnimationFactory::FLAG_NO_SPRITE ),
+ aValue );
+ }
+
+ case AnimationFactory::CLASS_BOOL_PROPERTY:
+ {
+ BoolAnimation::ValueType aValue;
+
+ ENSURE_OR_THROW(
+ extractValue( aValue,
+ xAnimateNode->getTo(),
+ pShape,
+ getSlideSize() ),
+ "AnimationSetNode::createSetActivity(): "
+ "Could not import bool to value" );
+
+ return makeSetActivity(
+ aParms,
+ AnimationFactory::createBoolPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(),
+ AnimationFactory::FLAG_NO_SPRITE ),
+ aValue );
+ }
+ }
+
+ return AnimationActivitySharedPtr();
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/animationsetnode.hxx b/slideshow/source/engine/animationnodes/animationsetnode.hxx
new file mode 100644
index 000000000000..9fe265549983
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationsetnode.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONSETNODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONSETNODE_HXX
+
+#include "animationbasenode.hxx"
+
+namespace slideshow {
+namespace internal {
+
+class AnimationSetNode : public AnimationBaseNode
+{
+public:
+ AnimationSetNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext )
+ : AnimationBaseNode( xNode, pParent, rContext ) {}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual const char* getDescription() const { return "AnimationSetNode"; }
+#endif
+
+private:
+ virtual AnimationActivitySharedPtr createActivity() const;
+ void implScheduleDeactivationEvent();
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONSETNODE_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/animationtransformnode.cxx b/slideshow/source/engine/animationnodes/animationtransformnode.cxx
new file mode 100644
index 000000000000..2279b3fc824a
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationtransformnode.cxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+#include <com/sun/star/animations/AnimationTransformType.hpp>
+
+#include "animationtransformnode.hxx"
+#include "animationfactory.hxx"
+#include "activitiesfactory.hxx"
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+void AnimationTransformNode::dispose()
+{
+ mxTransformNode.clear();
+ AnimationBaseNode::dispose();
+}
+
+AnimationActivitySharedPtr AnimationTransformNode::createActivity() const
+{
+ ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
+
+ const sal_Int16 nTransformType( mxTransformNode->getTransformType() );
+
+ const AttributableShapeSharedPtr& rShape( getShape() );
+
+ switch( nTransformType )
+ {
+ default:
+ ENSURE_OR_THROW(
+ false, "AnimationTransformNode::createTransformActivity(): "
+ "Unknown transform type" );
+
+ case animations::AnimationTransformType::TRANSLATE:
+ // FALLTHROUGH intended
+ case animations::AnimationTransformType::SCALE:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createPairPropertyAnimation(
+ rShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(),
+ nTransformType ),
+ getXAnimateNode() );
+
+ case animations::AnimationTransformType::ROTATE:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createNumberPropertyAnimation(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("Rotate") ),
+ rShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ getXAnimateNode() );
+
+ case animations::AnimationTransformType::SKEWX:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createNumberPropertyAnimation(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("SkewX") ),
+ rShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ getXAnimateNode() );
+
+ case animations::AnimationTransformType::SKEWY:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createNumberPropertyAnimation(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM("SkewY") ),
+ rShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ getXAnimateNode() );
+ }
+}
+
+} // namespace internal
+} // namespace slideshow
diff --git a/slideshow/source/engine/animationnodes/animationtransformnode.hxx b/slideshow/source/engine/animationnodes/animationtransformnode.hxx
new file mode 100644
index 000000000000..2fa151712235
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationtransformnode.hxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONTRANSFORMNODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONTRANSFORMNODE_HXX
+
+#include "animationbasenode.hxx"
+#include "com/sun/star/animations/XAnimateTransform.hpp"
+
+namespace slideshow {
+namespace internal {
+
+class AnimationTransformNode : public AnimationBaseNode
+{
+public:
+ AnimationTransformNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext )
+ : AnimationBaseNode( xNode, pParent, rContext ),
+ mxTransformNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW ) {}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual const char* getDescription() const
+ { return "AnimationTransformNode"; }
+#endif
+
+protected:
+ virtual void dispose();
+
+private:
+ virtual AnimationActivitySharedPtr createActivity() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimateTransform > mxTransformNode;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONTRANSFORMNODE_HXX */
diff --git a/slideshow/source/engine/animationnodes/animationtransitionfilternode.cxx b/slideshow/source/engine/animationnodes/animationtransitionfilternode.cxx
new file mode 100644
index 000000000000..9ab203c75389
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationtransitionfilternode.cxx
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include "animationtransitionfilternode.hxx"
+#include "transitionfactory.hxx"
+
+namespace slideshow {
+namespace internal {
+
+void AnimationTransitionFilterNode::dispose()
+{
+ mxTransitionFilterNode.clear();
+ AnimationBaseNode::dispose();
+}
+
+AnimationActivitySharedPtr
+AnimationTransitionFilterNode::createActivity() const
+{
+ return TransitionFactory::createShapeTransition(
+ fillCommonParameters(),
+ getShape(),
+ getContext().mpSubsettableShapeManager,
+ getSlideSize(),
+ mxTransitionFilterNode );
+}
+
+} // namespace internal
+} // namespace slideshow
diff --git a/slideshow/source/engine/animationnodes/animationtransitionfilternode.hxx b/slideshow/source/engine/animationnodes/animationtransitionfilternode.hxx
new file mode 100644
index 000000000000..ac8fc660280a
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/animationtransitionfilternode.hxx
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_ANIMATIONTRANSITIONFILTERNODE_HXX
+#define INCLUDED_SLIDESHOW_ANIMATIONTRANSITIONFILTERNODE_HXX
+
+#include "animationbasenode.hxx"
+#include "com/sun/star/animations/XTransitionFilter.hpp"
+
+namespace slideshow {
+namespace internal {
+
+class AnimationTransitionFilterNode : public AnimationBaseNode
+{
+public:
+ AnimationTransitionFilterNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext )
+ : AnimationBaseNode( xNode, pParent, rContext ),
+ mxTransitionFilterNode( xNode, ::com::sun::star::uno::UNO_QUERY_THROW)
+ {}
+
+#if defined(VERBOSE)
+ virtual const char* getDescription() const
+ { return "AnimationTransitionFilterNode"; }
+#endif
+
+protected:
+ virtual void dispose();
+
+private:
+ virtual AnimationActivitySharedPtr createActivity() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XTransitionFilter> mxTransitionFilterNode;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_ANIMATIONTRANSITIONFILTERNODE_HXX */
diff --git a/slideshow/source/engine/animationnodes/basecontainernode.cxx b/slideshow/source/engine/animationnodes/basecontainernode.cxx
new file mode 100644
index 000000000000..5d12390d38dd
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/basecontainernode.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include "basecontainernode.hxx"
+#include "tools.hxx"
+#include "nodetools.hxx"
+#include "delayevent.hxx"
+
+#include <boost/mem_fn.hpp>
+#include <algorithm>
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+BaseContainerNode::BaseContainerNode(
+ const uno::Reference< animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+ : BaseNode( xNode, rParent, rContext ),
+ maChildren(),
+ mnFinishedChildren(0),
+ mbDurationIndefinite( isIndefiniteTiming( xNode->getEnd() ) &&
+ isIndefiniteTiming( xNode->getDuration() ) )
+{
+}
+
+void BaseContainerNode::dispose()
+{
+ forEachChildNode( boost::mem_fn(&Disposable::dispose) );
+ maChildren.clear();
+ BaseNode::dispose();
+}
+
+bool BaseContainerNode::init_st()
+{
+ mnFinishedChildren = 0;
+ // initialize all children
+ return (std::count_if(
+ maChildren.begin(), maChildren.end(),
+ boost::mem_fn(&AnimationNode::init) ) ==
+ static_cast<VectorOfNodes::difference_type>(maChildren.size()));
+}
+
+void BaseContainerNode::deactivate_st( NodeState eDestState )
+{
+ if (eDestState == FROZEN) {
+ // deactivate all children that are not FROZEN or ENDED:
+ forEachChildNode( boost::mem_fn(&AnimationNode::deactivate),
+ ~(FROZEN | ENDED) );
+ }
+ else {
+ // end all children that are not ENDED:
+ forEachChildNode( boost::mem_fn(&AnimationNode::end), ~ENDED );
+ }
+}
+
+bool BaseContainerNode::hasPendingAnimation() const
+{
+ // does any of our children returns "true" on
+ // AnimationNode::hasPendingAnimation()?
+ // If yes, we, too, return true
+ VectorOfNodes::const_iterator const iEnd( maChildren.end() );
+ return (std::find_if(
+ maChildren.begin(), iEnd,
+ boost::mem_fn(&AnimationNode::hasPendingAnimation) ) != iEnd);
+}
+
+void BaseContainerNode::appendChildNode( AnimationNodeSharedPtr const& pNode )
+{
+ if (! checkValidNode())
+ return;
+
+ // register derived classes as end listeners at all children.
+ // this is necessary to control the children animation
+ // sequence, and to determine our own end event
+ if (pNode->registerDeactivatingListener( getSelf() )) {
+ maChildren.push_back( pNode );
+ }
+}
+
+bool BaseContainerNode::isChildNode( AnimationNodeSharedPtr const& pNode ) const
+{
+ // find given notifier in child vector
+ VectorOfNodes::const_iterator const iBegin( maChildren.begin() );
+ VectorOfNodes::const_iterator const iEnd( maChildren.end() );
+ VectorOfNodes::const_iterator const iFind(
+ std::find( iBegin, iEnd, pNode ) );
+ return (iFind != iEnd);
+}
+
+bool BaseContainerNode::notifyDeactivatedChild(
+ AnimationNodeSharedPtr const& pChildNode )
+{
+ OSL_ASSERT( pChildNode->getState() == FROZEN ||
+ pChildNode->getState() == ENDED );
+ // early exit on invalid nodes
+ OSL_ASSERT( getState() != INVALID );
+ if( getState() == INVALID )
+ return false;
+
+ if (! isChildNode(pChildNode)) {
+ OSL_ENSURE( false, "unknown notifier!" );
+ return false;
+ }
+
+ std::size_t const nSize = maChildren.size();
+ OSL_ASSERT( mnFinishedChildren < nSize );
+ ++mnFinishedChildren;
+ bool const bFinished = (mnFinishedChildren >= nSize);
+
+ // all children finished, and we've got indefinite duration?
+ // think of ParallelTimeContainer::notifyDeactivating()
+ // if duration given, we will be deactivated by some end event
+ // @see fillCommonParameters()
+ if (bFinished && isDurationIndefinite()) {
+ deactivate();
+ }
+
+ return bFinished;
+}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+void BaseContainerNode::showState() const
+{
+ for( std::size_t i=0; i<maChildren.size(); ++i )
+ {
+ BaseNodeSharedPtr pNode =
+ boost::shared_dynamic_cast<BaseNode>(maChildren[i]);
+ VERBOSE_TRACE(
+ "Node connection: n0x%X -> n0x%X",
+ (const char*)this+debugGetCurrentOffset(),
+ (const char*)pNode.get()+debugGetCurrentOffset() );
+ pNode->showState();
+ }
+
+ BaseNode::showState();
+}
+#endif
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/basecontainernode.hxx b/slideshow/source/engine/animationnodes/basecontainernode.hxx
new file mode 100644
index 000000000000..820c53e28167
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/basecontainernode.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_BASECONTAINERNODE_HXX
+#define INCLUDED_SLIDESHOW_BASECONTAINERNODE_HXX
+
+#include "basenode.hxx"
+
+namespace slideshow {
+namespace internal {
+
+/** This interface extends BaseNode with child handling methods.
+ Used for XAnimationNode objects which have children
+*/
+class BaseContainerNode : public BaseNode
+{
+public:
+ BaseContainerNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext );
+
+ /** Add given child node to this container
+ */
+ void appendChildNode( AnimationNodeSharedPtr const& pNode );
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual void showState() const;
+ virtual const char* getDescription() const { return "BaseContainerNode"; }
+#endif
+
+protected:
+ // overrides from BaseNode
+ virtual void dispose();
+
+private:
+ virtual bool init_st();
+ virtual void deactivate_st( NodeState eDestState );
+ virtual bool hasPendingAnimation() const;
+ // force to be implemented by derived class:
+ virtual void activate_st() = 0;
+ virtual void notifyDeactivating(
+ AnimationNodeSharedPtr const& rNotifier ) = 0;
+
+protected:
+ bool isDurationIndefinite() const { return mbDurationIndefinite; }
+
+ bool isChildNode( AnimationNodeSharedPtr const& pNode ) const;
+
+ /// @return true: if all children have been deactivated
+ bool notifyDeactivatedChild( AnimationNodeSharedPtr const& pChildNode );
+
+ template <typename FuncT>
+ inline void forEachChildNode( FuncT const& func,
+ int nodeStateMask = -1 ) const
+ {
+ VectorOfNodes::const_iterator iPos( maChildren.begin() );
+ VectorOfNodes::const_iterator const iEnd( maChildren.end() );
+ for ( ; iPos != iEnd; ++iPos ) {
+ AnimationNodeSharedPtr const& pNode = *iPos;
+ if (nodeStateMask != -1 && (pNode->getState() & nodeStateMask) == 0)
+ continue;
+ func(pNode);
+ }
+ }
+
+ typedef ::std::vector<AnimationNodeSharedPtr> VectorOfNodes;
+ VectorOfNodes maChildren;
+ ::std::size_t mnFinishedChildren;
+
+private:
+ const bool mbDurationIndefinite;
+};
+
+typedef ::boost::shared_ptr< BaseContainerNode > BaseContainerNodeSharedPtr;
+
+} // namespace interface
+} // namespace presentation
+
+#endif /* INCLUDED_SLIDESHOW_BASECONTAINERNODE_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/basenode.cxx b/slideshow/source/engine/animationnodes/basenode.cxx
new file mode 100644
index 000000000000..b0cfa99c34f5
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/basenode.cxx
@@ -0,0 +1,769 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include <com/sun/star/animations/XAnimate.hpp>
+#include <com/sun/star/presentation/ParagraphTarget.hpp>
+#include <com/sun/star/animations/AnimationFill.hpp>
+#include <com/sun/star/animations/AnimationRestart.hpp>
+#include <com/sun/star/presentation/EffectNodeType.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include "basenode.hxx"
+#include "eventmultiplexer.hxx"
+#include "basecontainernode.hxx"
+#include "eventqueue.hxx"
+#include "delayevent.hxx"
+#include "tools.hxx"
+#include "nodetools.hxx"
+#include "generateevent.hxx"
+#include "debug.hxx"
+
+#include <boost/bind.hpp>
+#include <vector>
+#include <algorithm>
+#include <iterator>
+
+using namespace ::com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+namespace {
+
+typedef int StateTransitionTable[17];
+
+// State transition tables
+// =========================================================================
+
+const int* getStateTransitionTable( sal_Int16 nRestartMode,
+ sal_Int16 nFillMode )
+{
+ // TODO(F2): restart issues in below tables
+
+ // transition table for restart=NEVER, fill=REMOVE
+ static const StateTransitionTable stateTransitionTable_Never_Remove = {
+ AnimationNode::INVALID,
+ AnimationNode::RESOLVED|AnimationNode::ENDED, // active successors for UNRESOLVED
+ AnimationNode::ACTIVE|AnimationNode::ENDED, // active successors for RESOLVED
+ AnimationNode::INVALID,
+ AnimationNode::ENDED, // active successors for ACTIVE: no freeze here
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID, // active successors for FROZEN: this state is unreachable here
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED // active successors for ENDED: this state is a sink here (cannot restart)
+ };
+
+ // transition table for restart=WHEN_NOT_ACTIVE, fill=REMOVE
+ static const StateTransitionTable stateTransitionTable_NotActive_Remove = {
+ AnimationNode::INVALID,
+ AnimationNode::RESOLVED|AnimationNode::ENDED, // active successors for UNRESOLVED
+ AnimationNode::ACTIVE|AnimationNode::ENDED, // active successors for RESOLVED
+ AnimationNode::INVALID,
+ AnimationNode::ENDED, // active successors for ACTIVE: no freeze here
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID, // active successors for FROZEN:
+ // this state is unreachable here
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED|AnimationNode::RESOLVED|AnimationNode::ACTIVE // active successors for ENDED:
+ // restart possible when ended
+ };
+
+ // transition table for restart=ALWAYS, fill=REMOVE
+ static const StateTransitionTable stateTransitionTable_Always_Remove = {
+ AnimationNode::INVALID,
+ AnimationNode::RESOLVED|AnimationNode::ENDED, // active successors for UNRESOLVED
+ AnimationNode::ACTIVE|AnimationNode::ENDED, // active successors for RESOLVED
+ AnimationNode::INVALID,
+ AnimationNode::ENDED|AnimationNode::ACTIVE|AnimationNode::RESOLVED, // active successors for ACTIVE: restart
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID, // active successors for FROZEN:
+ // this state is unreachable here
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED|AnimationNode::ACTIVE|AnimationNode::RESOLVED // active successors for ENDED: restart
+ };
+
+ // transition table for restart=NEVER, fill=FREEZE
+ static const StateTransitionTable stateTransitionTable_Never_Freeze = {
+ AnimationNode::INVALID,
+ AnimationNode::RESOLVED|AnimationNode::ENDED, // active successors for UNRESOLVED
+ AnimationNode::ACTIVE|AnimationNode::ENDED, // active successors for RESOLVED
+ AnimationNode::INVALID,
+ AnimationNode::FROZEN|AnimationNode::ENDED, // active successors for ACTIVE: freeze object
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED, // active successors for FROZEN: end
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED, // active successors for ENDED: this state is a sink here (cannot restart)
+ };
+
+ // transition table for restart=WHEN_NOT_ACTIVE, fill=FREEZE
+ static const StateTransitionTable stateTransitionTable_NotActive_Freeze = {
+ AnimationNode::INVALID,
+ AnimationNode::RESOLVED|AnimationNode::ENDED, // active successors for UNRESOLVED
+ AnimationNode::ACTIVE|AnimationNode::ENDED, // active successors for RESOLVED
+ AnimationNode::INVALID,
+ AnimationNode::FROZEN|AnimationNode::ENDED, // active successors for ACTIVE: freeze object
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED|AnimationNode::RESOLVED|AnimationNode::ACTIVE, // active successors for FROZEN:
+ // restart possible when ended
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED|AnimationNode::RESOLVED|AnimationNode::ACTIVE // active successors for ENDED:
+ // restart possible when ended
+ };
+
+ // transition table for restart=ALWAYS, fill=FREEZE
+ static const StateTransitionTable stateTransitionTable_Always_Freeze = {
+ AnimationNode::INVALID,
+ AnimationNode::RESOLVED|AnimationNode::ENDED, // active successors for UNRESOLVED
+ AnimationNode::ACTIVE|AnimationNode::ENDED, // active successors for RESOLVED
+ AnimationNode::INVALID,
+ AnimationNode::FROZEN|AnimationNode::ENDED|AnimationNode::ACTIVE|AnimationNode::RESOLVED, // active successors for ACTIVE:
+ // end object, restart
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED|AnimationNode::RESOLVED|AnimationNode::ACTIVE, // active successors for FROZEN: restart possible
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::INVALID,
+ AnimationNode::ENDED|AnimationNode::ACTIVE|AnimationNode::RESOLVED // active successors for ENDED: restart
+ };
+
+ static const StateTransitionTable* tableGuide[] = {
+ &stateTransitionTable_Never_Remove,
+ &stateTransitionTable_NotActive_Remove,
+ &stateTransitionTable_Always_Remove,
+ &stateTransitionTable_Never_Freeze,
+ &stateTransitionTable_NotActive_Freeze,
+ &stateTransitionTable_Always_Freeze
+ };
+
+ int nRestartValue;
+ switch( nRestartMode ) {
+ default:
+ case animations::AnimationRestart::DEFAULT:
+ // same value: animations::AnimationRestart::INHERIT:
+ OSL_ENSURE(
+ false, "getStateTransitionTable(): unexpected case for restart" );
+ // FALLTHROUGH intended
+ case animations::AnimationRestart::NEVER:
+ nRestartValue = 0;
+ break;
+ case animations::AnimationRestart::WHEN_NOT_ACTIVE:
+ nRestartValue = 1;
+ break;
+ case animations::AnimationRestart::ALWAYS:
+ nRestartValue = 2;
+ break;
+ }
+
+ int nFillValue;
+ switch( nFillMode ) {
+ default:
+ case animations::AnimationFill::AUTO:
+ case animations::AnimationFill::DEFAULT:
+ // same value: animations::AnimationFill::INHERIT:
+ OSL_ENSURE(
+ false, "getStateTransitionTable(): unexpected case for fill" );
+ // FALLTHROUGH intended
+ case animations::AnimationFill::REMOVE:
+ nFillValue = 0;
+ break;
+ case animations::AnimationFill::FREEZE:
+ case animations::AnimationFill::HOLD:
+ case animations::AnimationFill::TRANSITION:
+ nFillValue = 1;
+ break;
+ }
+
+ return *tableGuide[ 3*nFillValue + nRestartValue ];
+}
+
+/// Little helper predicate, to detect main sequence root node
+bool isMainSequenceRootNode_(
+ const uno::Reference< animations::XAnimationNode >& xNode )
+{
+ // detect main sequence root node (need that for
+ // end-of-mainsequence signalling below)
+ beans::NamedValue const aSearchKey(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "node-type" ) ),
+ uno::makeAny( presentation::EffectNodeType::MAIN_SEQUENCE ) );
+
+ uno::Sequence<beans::NamedValue> const userData(xNode->getUserData());
+ return findNamedValue( userData, aSearchKey );
+}
+
+} // anon namespace
+
+// BaseNode implementation
+//=========================================================================
+
+/** state transition handling
+ */
+class BaseNode::StateTransition : private boost::noncopyable
+{
+public:
+ enum Options { NONE, FORCE };
+
+ explicit StateTransition( BaseNode * pNode )
+ : mpNode(pNode), meToState(INVALID) {}
+
+ ~StateTransition() {
+ clear();
+ }
+
+ bool enter( NodeState eToState, int options = NONE )
+ {
+ OSL_ENSURE( meToState == INVALID,
+ "### commit() before enter()ing again!" );
+ if (meToState != INVALID)
+ return false;
+ bool const bForce = ((options & FORCE) != 0);
+ if (!bForce && !mpNode->isTransition( mpNode->meCurrState, eToState ))
+ return false;
+ // recursion detection:
+ if ((mpNode->meCurrentStateTransition & eToState) != 0)
+ return false; // already in wanted transition
+ // mark transition:
+ mpNode->meCurrentStateTransition |= eToState;
+ meToState = eToState;
+ return true; // in transition
+ }
+
+ void commit() {
+ OSL_ENSURE( meToState != INVALID, "### nothing to commit!" );
+ if (meToState != INVALID) {
+ mpNode->meCurrState = meToState;
+ clear();
+ }
+
+ // Uncomment the following line to write the node tree to file on
+ // every state change of one of its nodes.
+ // Debug_ShowNodeTree(mpNode->mpSelf);
+ }
+
+ void clear() {
+ if (meToState != INVALID) {
+ OSL_ASSERT( (mpNode->meCurrentStateTransition & meToState) != 0 );
+ mpNode->meCurrentStateTransition &= ~meToState;
+ meToState = INVALID;
+ }
+ }
+
+private:
+ BaseNode *const mpNode;
+ NodeState meToState;
+};
+
+BaseNode::BaseNode( const uno::Reference< animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext ) :
+ maContext( rContext.maContext ),
+ maDeactivatingListeners(),
+ mxAnimationNode( xNode ),
+ mpParent( rParent ),
+ mpSelf(),
+ mpStateTransitionTable( NULL ),
+ mnStartDelay( rContext.mnStartDelay ),
+ meCurrState( UNRESOLVED ),
+ meCurrentStateTransition( 0 ),
+ mpCurrentEvent(),
+ mbIsMainSequenceRootNode( isMainSequenceRootNode_( xNode ) )
+{
+ ENSURE_OR_THROW( mxAnimationNode.is(),
+ "BaseNode::BaseNode(): Invalid XAnimationNode" );
+
+ // setup state transition table
+ mpStateTransitionTable = getStateTransitionTable( getRestartMode(),
+ getFillMode() );
+}
+
+void BaseNode::dispose()
+{
+ meCurrState = INVALID;
+
+ // discharge a loaded event, if any:
+ if (mpCurrentEvent) {
+ mpCurrentEvent->dispose();
+ mpCurrentEvent.reset();
+ }
+ maDeactivatingListeners.clear();
+ mxAnimationNode.clear();
+ mpParent.reset();
+ mpSelf.reset();
+ maContext.dispose();
+}
+
+
+sal_Int16 BaseNode::getRestartMode()
+{
+ const sal_Int16 nTmp( mxAnimationNode->getRestart() );
+ return (nTmp != animations::AnimationRestart::DEFAULT &&
+ nTmp != animations::AnimationRestart::INHERIT)
+ ? nTmp : getRestartDefaultMode();
+}
+
+sal_Int16 BaseNode::getFillMode()
+{
+ const sal_Int16 nTmp( mxAnimationNode->getFill() );
+ const sal_Int16 nFill((nTmp != animations::AnimationFill::DEFAULT &&
+ nTmp != animations::AnimationFill::INHERIT)
+ ? nTmp : getFillDefaultMode());
+
+ // For AUTO fill mode, SMIL specifies that fill mode is FREEZE,
+ // if no explicit active duration is given
+ // (no duration, end, repeatCount or repeatDuration given),
+ // and REMOVE otherwise
+ if( nFill == animations::AnimationFill::AUTO ) {
+ return (isIndefiniteTiming( mxAnimationNode->getDuration() ) &&
+ isIndefiniteTiming( mxAnimationNode->getEnd() ) &&
+ !mxAnimationNode->getRepeatCount().hasValue() &&
+ isIndefiniteTiming( mxAnimationNode->getRepeatDuration() ))
+ ? animations::AnimationFill::FREEZE
+ : animations::AnimationFill::REMOVE;
+ }
+ else {
+ return nFill;
+ }
+}
+
+sal_Int16 BaseNode::getFillDefaultMode() const
+{
+ sal_Int16 nFillDefault = mxAnimationNode->getFillDefault();
+ if (nFillDefault == animations::AnimationFill::DEFAULT) {
+ nFillDefault = (mpParent != 0
+ ? mpParent->getFillDefaultMode()
+ : animations::AnimationFill::AUTO);
+ }
+ return nFillDefault;
+}
+
+sal_Int16 BaseNode::getRestartDefaultMode() const
+{
+ sal_Int16 nRestartDefaultMode = mxAnimationNode->getRestartDefault();
+ if (nRestartDefaultMode == animations::AnimationRestart::DEFAULT) {
+ nRestartDefaultMode = (mpParent != 0
+ ? mpParent->getRestartDefaultMode()
+ : animations::AnimationRestart::ALWAYS);
+ }
+ return nRestartDefaultMode;
+}
+
+uno::Reference<animations::XAnimationNode> BaseNode::getXAnimationNode() const
+{
+ return mxAnimationNode;
+}
+
+bool BaseNode::init()
+{
+ if (! checkValidNode())
+ return false;
+ meCurrState = UNRESOLVED;
+ // discharge a loaded event, if any:
+ if (mpCurrentEvent) {
+ mpCurrentEvent->dispose();
+ mpCurrentEvent.reset();
+ }
+ return init_st(); // may call derived class
+}
+
+bool BaseNode::init_st()
+{
+ return true;
+}
+
+bool BaseNode::resolve()
+{
+ if (! checkValidNode())
+ return false;
+
+ OSL_ASSERT( meCurrState != RESOLVED );
+ if (inStateOrTransition( RESOLVED ))
+ return true;
+
+ StateTransition st(this);
+ if (st.enter( RESOLVED ) &&
+ isTransition( RESOLVED, ACTIVE ) &&
+ resolve_st() /* may call derived class */)
+ {
+ st.commit(); // changing state
+
+ // discharge a loaded event, if any:
+ if (mpCurrentEvent)
+ mpCurrentEvent->dispose();
+
+ // schedule activation event:
+
+ // This method takes the NodeContext::mnStartDelay value into account,
+ // to cater for iterate container time shifts. We cannot put different
+ // iterations of the iterate container's children into different
+ // subcontainer (such as a 'DelayContainer', which delays resolving its
+ // children by a fixed amount), since all iterations' nodes must be
+ // resolved at the same time (otherwise, the delayed subset creation
+ // will not work, i.e. deactivate the subsets too late in the master
+ // shape).
+ uno::Any const aBegin( mxAnimationNode->getBegin() );
+ if (aBegin.hasValue()) {
+ mpCurrentEvent = generateEvent(
+ aBegin, boost::bind( &AnimationNode::activate, mpSelf ),
+ maContext, mnStartDelay );
+ }
+ else {
+ // For some leaf nodes, PPT import yields empty begin time,
+ // although semantically, it should be 0.0
+ // TODO(F3): That should really be provided by the PPT import
+
+ // schedule delayed activation event. Take iterate node
+ // timeout into account
+ mpCurrentEvent = makeDelay(
+ boost::bind( &AnimationNode::activate, mpSelf ),
+ mnStartDelay,
+ "AnimationNode::activate with delay");
+ maContext.mrEventQueue.addEvent( mpCurrentEvent );
+ }
+
+ return true;
+ }
+ return false;
+}
+
+bool BaseNode::resolve_st()
+{
+ return true;
+}
+
+
+bool BaseNode::activate()
+{
+ if (! checkValidNode())
+ return false;
+
+ OSL_ASSERT( meCurrState != ACTIVE );
+ if (inStateOrTransition( ACTIVE ))
+ return true;
+
+ StateTransition st(this);
+ if (st.enter( ACTIVE )) {
+
+ activate_st(); // calling derived class
+
+ st.commit(); // changing state
+
+ maContext.mrEventMultiplexer.notifyAnimationStart( mpSelf );
+
+ return true;
+ }
+
+ return false;
+}
+
+void BaseNode::activate_st()
+{
+ scheduleDeactivationEvent();
+}
+
+void BaseNode::scheduleDeactivationEvent( EventSharedPtr const& pEvent )
+{
+ if (mpCurrentEvent) {
+ mpCurrentEvent->dispose();
+ mpCurrentEvent.reset();
+ }
+ if (pEvent) {
+ if (maContext.mrEventQueue.addEvent( pEvent ))
+ mpCurrentEvent = pEvent;
+ }
+ else {
+ // This method need not take the
+ // NodeContext::mnStartDelay value into account,
+ // because the deactivation event is only scheduled
+ // when the effect is started: the timeout is then
+ // already respected.
+
+ // xxx todo:
+ // think about set node, anim base node!
+ // if anim base node has no activity, this is called to schedule deactivatiion,
+ // but what if it does not schedule anything?
+
+ // TODO(F2): Handle end time attribute, too
+ mpCurrentEvent = generateEvent(
+ mxAnimationNode->getDuration(),
+ boost::bind( &AnimationNode::deactivate, mpSelf ),
+ maContext, 0.0 );
+ }
+}
+
+void BaseNode::deactivate()
+{
+ if (inStateOrTransition( ENDED | FROZEN ) || !checkValidNode())
+ return;
+
+ if (isTransition( meCurrState, FROZEN, false /* no OSL_ASSERT */ )) {
+ // do transition to FROZEN:
+ StateTransition st(this);
+ if (st.enter( FROZEN, StateTransition::FORCE )) {
+
+ deactivate_st( FROZEN );
+ st.commit();
+
+ notifyEndListeners();
+
+ // discharge a loaded event, before going on:
+ if (mpCurrentEvent) {
+ mpCurrentEvent->dispose();
+ mpCurrentEvent.reset();
+ }
+ }
+ }
+ else {
+ // use end instead:
+ end();
+ }
+ // state has changed either to FROZEN or ENDED
+}
+
+void BaseNode::deactivate_st( NodeState )
+{
+}
+
+void BaseNode::end()
+{
+ bool const bIsFrozenOrInTransitionToFrozen = inStateOrTransition( FROZEN );
+ if (inStateOrTransition( ENDED ) || !checkValidNode())
+ return;
+
+ // END must always be reachable. If not, that's an error in the
+ // transition tables
+ OSL_ENSURE( isTransition( meCurrState, ENDED ),
+ "end state not reachable in transition table" );
+
+ StateTransition st(this);
+ if (st.enter( ENDED, StateTransition::FORCE )) {
+
+ deactivate_st( ENDED );
+ st.commit(); // changing state
+
+ // if is FROZEN or is to be FROZEN, then
+ // will/already notified deactivating listeners
+ if (!bIsFrozenOrInTransitionToFrozen)
+ notifyEndListeners();
+
+ // discharge a loaded event, before going on:
+ if (mpCurrentEvent) {
+ mpCurrentEvent->dispose();
+ mpCurrentEvent.reset();
+ }
+ }
+}
+
+void BaseNode::notifyDeactivating( const AnimationNodeSharedPtr& rNotifier )
+{
+ (void) rNotifier; // avoid warning
+ OSL_ASSERT( rNotifier->getState() == FROZEN ||
+ rNotifier->getState() == ENDED );
+ // TODO(F1): for end sync functionality, this might indeed be used some day
+}
+
+void BaseNode::notifyEndListeners() const
+{
+ // notify all listeners
+ std::for_each( maDeactivatingListeners.begin(),
+ maDeactivatingListeners.end(),
+ boost::bind( &AnimationNode::notifyDeactivating, _1,
+ boost::cref(mpSelf) ) );
+
+ // notify state change
+ maContext.mrEventMultiplexer.notifyAnimationEnd( mpSelf );
+
+ // notify main sequence end (iff we're the main
+ // sequence root node). This is because the main
+ // sequence determines the active duration of the
+ // slide. All other sequences are secondary, in that
+ // they don't prevent a slide change from happening,
+ // even if they have not been completed. In other
+ // words, all sequences except the main sequence are
+ // optional for the slide lifetime.
+ if (isMainSequenceRootNode())
+ maContext.mrEventMultiplexer.notifySlideAnimationsEnd();
+}
+
+AnimationNode::NodeState BaseNode::getState() const
+{
+ return meCurrState;
+}
+
+bool BaseNode::registerDeactivatingListener(
+ const AnimationNodeSharedPtr& rNotifee )
+{
+ if (! checkValidNode())
+ return false;
+
+ ENSURE_OR_RETURN_FALSE(
+ rNotifee,
+ "BaseNode::registerDeactivatingListener(): invalid notifee" );
+ maDeactivatingListeners.push_back( rNotifee );
+
+ return true;
+}
+
+void BaseNode::setSelf( const BaseNodeSharedPtr& rSelf )
+{
+ ENSURE_OR_THROW( rSelf.get() == this,
+ "BaseNode::setSelf(): got ptr to different object" );
+ ENSURE_OR_THROW( !mpSelf,
+ "BaseNode::setSelf(): called multiple times" );
+
+ mpSelf = rSelf;
+}
+
+// Debug
+//=========================================================================
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+void BaseNode::showState() const
+{
+ const AnimationNode::NodeState eNodeState( getState() );
+
+ if( eNodeState == AnimationNode::INVALID )
+ VERBOSE_TRACE( "Node state: n0x%X [label=\"%s\",style=filled,"
+ "fillcolor=\"0.5,0.2,0.5\"]",
+ (const char*)this+debugGetCurrentOffset(),
+ getDescription() );
+ else
+ VERBOSE_TRACE( "Node state: n0x%X [label=\"%s\",style=filled,"
+ "fillcolor=\"%f,1.0,1.0\"]",
+ (const char*)this+debugGetCurrentOffset(),
+ getDescription(),
+ log(double(getState()))/4.0 );
+
+ // determine additional node information
+ uno::Reference<animations::XAnimate> const xAnimate( mxAnimationNode,
+ uno::UNO_QUERY );
+ if( xAnimate.is() )
+ {
+ uno::Reference< drawing::XShape > xTargetShape( xAnimate->getTarget(),
+ uno::UNO_QUERY );
+
+ if( !xTargetShape.is() )
+ {
+ ::com::sun::star::presentation::ParagraphTarget aTarget;
+
+ // no shape provided. Maybe a ParagraphTarget?
+ if( (xAnimate->getTarget() >>= aTarget) )
+ xTargetShape = aTarget.Shape;
+ }
+
+ if( xTargetShape.is() )
+ {
+ uno::Reference< beans::XPropertySet > xPropSet( xTargetShape,
+ uno::UNO_QUERY );
+
+ // read shape name
+ ::rtl::OUString aName;
+ if( (xPropSet->getPropertyValue(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) )
+ >>= aName) )
+ {
+ const ::rtl::OString& rAsciiName(
+ ::rtl::OUStringToOString( aName,
+ RTL_TEXTENCODING_ASCII_US ) );
+
+ VERBOSE_TRACE( "Node info: n0x%X, name \"%s\"",
+ (const char*)this+debugGetCurrentOffset(),
+ rAsciiName.getStr() );
+ }
+ }
+ }
+}
+
+const char* BaseNode::getDescription() const
+{
+ return "BaseNode";
+}
+
+void BaseNode::showTreeFromWithin() const
+{
+ // find root node
+ BaseNodeSharedPtr pCurrNode( mpSelf );
+ while( pCurrNode->mpParent ) pCurrNode = pCurrNode->mpParent;
+
+ pCurrNode->showState();
+}
+#endif
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/basenode.hxx b/slideshow/source/engine/animationnodes/basenode.hxx
new file mode 100644
index 000000000000..0ca893b5287a
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/basenode.hxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_BASENODE_HXX
+#define INCLUDED_SLIDESHOW_BASENODE_HXX
+
+#include <canvas/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <osl/diagnose.hxx>
+
+#include "event.hxx"
+#include "animationnode.hxx"
+#include "slideshowcontext.hxx"
+#include "shapesubset.hxx"
+
+#include <boost/noncopyable.hpp>
+#include <vector>
+
+namespace slideshow {
+namespace internal {
+
+/** Context for every node.
+
+ Besides the global AnimationNodeFactory::Context data,
+ this struct also contains the current DocTree subset
+ for this node. If start and end index of the
+ DocTreeNode are equal, the node should use the
+ complete shape.
+*/
+struct NodeContext
+{
+ NodeContext( const SlideShowContext& rContext,
+ const ::basegfx::B2DVector& rSlideSize )
+ : maContext( rContext ),
+ maSlideSize( rSlideSize ),
+ mpMasterShapeSubset(),
+ mnStartDelay(0.0),
+ mbIsIndependentSubset( true )
+ {}
+
+ void dispose()
+ {
+ maContext.dispose();
+ mpMasterShapeSubset.reset();
+ }
+
+ /// Context as passed to createAnimationNode()
+ SlideShowContext maContext;
+
+ /// Size in user coordinate space of the corresponding slide
+ ::basegfx::B2DVector maSlideSize;
+
+ /// Shape to be used (provided by parent, e.g. for iterations)
+ ShapeSubsetSharedPtr mpMasterShapeSubset;
+
+ /// Additional delay to node begin (to offset iterate effects)
+ double mnStartDelay;
+
+ /// When true, subset must be created during slide initialization
+ bool mbIsIndependentSubset;
+};
+
+class BaseContainerNode;
+
+/** This interface extends AnimationNode with some
+ file-private accessor methods.
+*/
+class BaseNode : public AnimationNode,
+ public ::osl::DebugBase<BaseNode>,
+ private ::boost::noncopyable
+{
+public:
+ BaseNode( ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext );
+
+ /** Provide the node with a shared_ptr to itself.
+
+ Since implementation has to create objects which need
+ a shared_ptr to this node, and a pointee cannot
+ retrieve a shared_ptr to itself internally, have to
+ set that from the outside.
+ */
+ void setSelf( const ::boost::shared_ptr< BaseNode >& rSelf );
+
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual void showState() const;
+ virtual const char* getDescription() const;
+ void showTreeFromWithin() const;
+#endif
+
+ const ::boost::shared_ptr< BaseContainerNode >& getParentNode() const
+ { return mpParent; }
+
+ // Disposable:
+ virtual void dispose();
+
+ // AnimationNode:
+ virtual bool init();
+ virtual bool resolve();
+ virtual bool activate();
+ virtual void deactivate();
+ virtual void end();
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> getXAnimationNode() const;
+ virtual NodeState getState() const;
+ virtual bool registerDeactivatingListener(
+ const AnimationNodeSharedPtr& rNotifee );
+ // nop:
+ virtual void notifyDeactivating( const AnimationNodeSharedPtr& rNotifier );
+
+ bool isMainSequenceRootNode() const { return mbIsMainSequenceRootNode; }
+
+protected:
+ void scheduleDeactivationEvent( EventSharedPtr const& pEvent =
+ EventSharedPtr() );
+
+ SlideShowContext const& getContext() const { return maContext; }
+ ::boost::shared_ptr<BaseNode> const& getSelf() const { return mpSelf; }
+
+ bool checkValidNode() const {
+ ENSURE_OR_THROW( mpSelf, "no self ptr set!" );
+ bool const bRet = (meCurrState != INVALID);
+ OSL_ENSURE( bRet, "### INVALID node!" );
+ return bRet;
+ }
+
+private:
+ // all state affecting methods have "_st" counterparts being called at
+ // derived classes when in state transistion: no-ops here at BaseNode...
+ virtual bool init_st();
+ virtual bool resolve_st();
+ virtual void activate_st();
+ virtual void deactivate_st( NodeState eDestState );
+
+private:
+ /// notifies
+ /// - all registered deactivation listeners
+ /// - single animation end (every node)
+ /// - slide animations (if main sequence root node)
+ void notifyEndListeners() const;
+
+ /// Get the node's restart mode
+ sal_Int16 getRestartMode();
+
+ /** Get the default restart mode
+
+ If this node's default mode is
+ AnimationRestart::DEFAULT, this method recursively
+ calls the parent node.
+ */
+ sal_Int16 getRestartDefaultMode() const;
+
+ /// Get the node's fill mode
+ sal_Int16 getFillMode();
+
+ /** Get the default fill mode.
+
+ If this node's default mode is AnimationFill::DEFAULT,
+ this method recursively calls the parent node.
+ */
+ sal_Int16 getFillDefaultMode() const;
+
+ bool isTransition( NodeState eFromState, NodeState eToState,
+ bool debugAssert = true ) const {
+ (void) debugAssert; // avoid warning
+ bool const bRet =((mpStateTransitionTable[eFromState] & eToState) != 0);
+ OSL_ENSURE( !debugAssert || bRet, "### state unreachable!" );
+ return bRet;
+ }
+
+ bool inStateOrTransition( int mask ) const {
+ return ((meCurrState & mask) != 0 ||
+ (meCurrentStateTransition & mask) != 0);
+ }
+
+ class StateTransition;
+ friend class StateTransition;
+
+private:
+ SlideShowContext maContext;
+
+ typedef ::std::vector< AnimationNodeSharedPtr > ListenerVector;
+
+ ListenerVector maDeactivatingListeners;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode > mxAnimationNode;
+ ::boost::shared_ptr< BaseContainerNode > mpParent;
+ ::boost::shared_ptr< BaseNode > mpSelf;
+ const int* mpStateTransitionTable;
+ const double mnStartDelay;
+ NodeState meCurrState;
+ int meCurrentStateTransition;
+ EventSharedPtr mpCurrentEvent;
+ const bool mbIsMainSequenceRootNode;
+};
+
+typedef ::boost::shared_ptr< BaseNode > BaseNodeSharedPtr;
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_BASENODE_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/generateevent.cxx b/slideshow/source/engine/animationnodes/generateevent.cxx
new file mode 100644
index 000000000000..d73cd0f0d494
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/generateevent.cxx
@@ -0,0 +1,246 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <canvas/verbosetrace.hxx>
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <com/sun/star/animations/Timing.hpp>
+#include <com/sun/star/animations/EventTrigger.hpp>
+#include <com/sun/star/animations/Event.hpp>
+
+#include "shape.hxx"
+#include "subsettableshapemanager.hxx"
+#include "usereventqueue.hxx"
+#include "slideshowcontext.hxx"
+#include "delayevent.hxx"
+
+namespace slideshow {
+namespace internal {
+
+using namespace com::sun::star;
+
+EventSharedPtr generateEvent(
+ uno::Any const& rEventDescription,
+ Delay::FunctorT const& rFunctor,
+ SlideShowContext const& rContext,
+ double nAdditionalDelay )
+{
+ EventSharedPtr pEvent;
+
+ if (! rEventDescription.hasValue())
+ return pEvent;
+
+ animations::Timing eTiming;
+ animations::Event aEvent;
+ uno::Sequence<uno::Any> aSequence;
+ double nDelay1 = 0;
+
+ if (rEventDescription >>= eTiming) {
+ switch (eTiming) {
+ case animations::Timing_INDEFINITE:
+ break; // don't schedule no event
+ case animations::Timing_MEDIA:
+ OSL_ENSURE( false, "MEDIA timing not yet implemented!" );
+ break;
+ default:
+ ENSURE_OR_THROW( false, "unexpected case!" );
+ }
+ }
+ else if (rEventDescription >>= aEvent) {
+
+ // try to extract additional event delay
+ double nDelay2 = 0.0;
+ if (aEvent.Offset.hasValue() && !(aEvent.Offset >>= nDelay2)) {
+ OSL_ENSURE( false, "offset values apart from DOUBLE not "
+ "recognized in animations::Event!" );
+ }
+
+ // common vars used inside switch
+ uno::Reference<animations::XAnimationNode> xNode;
+ uno::Reference<drawing::XShape> xShape;
+ ShapeSharedPtr pShape;
+
+ // TODO(F1): Respect aEvent.Repeat value
+
+ switch (aEvent.Trigger) {
+ default:
+ ENSURE_OR_THROW( false, "unexpected event trigger!" );
+ case animations::EventTrigger::NONE:
+ // no event at all
+ break;
+ case animations::EventTrigger::ON_BEGIN:
+ OSL_ENSURE( false, "event trigger ON_BEGIN not yet implemented!" );
+ break;
+ case animations::EventTrigger::ON_END:
+ OSL_ENSURE( false, "event trigger ON_END not yet implemented!" );
+ break;
+ case animations::EventTrigger::BEGIN_EVENT:
+ // try to extract XAnimationNode event source
+ if (aEvent.Source >>= xNode) {
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, BEGIN_EVENT");
+ rContext.mrUserEventQueue.registerAnimationStartEvent(
+ pEvent, xNode );
+ }
+ else {
+ OSL_ENSURE(false, "could not extract source XAnimationNode "
+ "for BEGIN_EVENT!" );
+ }
+ break;
+ case animations::EventTrigger::END_EVENT:
+ // try to extract XAnimationNode event source
+ if (aEvent.Source >>= xNode) {
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, END_EVENT");
+ rContext.mrUserEventQueue.registerAnimationEndEvent(
+ pEvent, xNode );
+ }
+ else {
+ OSL_ENSURE( false, "could not extract source XAnimationNode "
+ "for END_EVENT!" );
+ }
+ break;
+ case animations::EventTrigger::ON_CLICK:
+ // try to extract XShape event source
+ if ((aEvent.Source >>= xShape) &&
+ (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
+ {
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_CLICK");
+ rContext.mrUserEventQueue.registerShapeClickEvent(
+ pEvent, pShape );
+ }
+ else {
+ OSL_ENSURE( false, "could not extract source XAnimationNode "
+ "for ON_CLICK!" );
+ }
+ break;
+ case animations::EventTrigger::ON_DBL_CLICK:
+ // try to extract XShape event source
+ if ((aEvent.Source >>= xShape) &&
+ (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
+ {
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_DBL_CLICK");
+ rContext.mrUserEventQueue.registerShapeDoubleClickEvent(
+ pEvent, pShape );
+ }
+ else {
+ OSL_ENSURE( false, "could not extract source XAnimationNode "
+ "for ON_DBL_CLICK!" );
+ }
+ break;
+ case animations::EventTrigger::ON_MOUSE_ENTER:
+ // try to extract XShape event source
+ if ((aEvent.Source >>= xShape) &&
+ (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
+ {
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_MOUSE_ENTER");
+ rContext.mrUserEventQueue.registerMouseEnterEvent(
+ pEvent, pShape );
+ }
+ else {
+ OSL_ENSURE( false, "could not extract source XAnimationNode "
+ "for ON_MOUSE_ENTER!" );
+ }
+ break;
+ case animations::EventTrigger::ON_MOUSE_LEAVE:
+ // try to extract XShape event source
+ if ((aEvent.Source >>= xShape) &&
+ (pShape = rContext.mpSubsettableShapeManager->lookupShape(xShape)).get())
+ {
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_MOUSE_LEAVE");
+ rContext.mrUserEventQueue.registerMouseLeaveEvent(
+ pEvent, pShape );
+ }
+ else {
+ OSL_ENSURE( false, "could not extract source XAnimationNode "
+ "for ON_MOUSE_LEAVE!" );
+ }
+ break;
+ case animations::EventTrigger::ON_PREV:
+ OSL_ENSURE( false, "event trigger ON_PREV not yet implemented, "
+ "mapped to ON_NEXT!" );
+ // FALLTHROUGH intended
+ case animations::EventTrigger::ON_NEXT:
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_NEXT");
+ rContext.mrUserEventQueue.registerNextEffectEvent( pEvent );
+ break;
+ case animations::EventTrigger::ON_STOP_AUDIO:
+ // try to extract XAnimationNode event source
+ if (aEvent.Source >>= xNode) {
+ pEvent = makeDelay( rFunctor,
+ nDelay2 + nAdditionalDelay,
+ "generateEvent, ON_STOP_AUDIO");
+ rContext.mrUserEventQueue.registerAudioStoppedEvent(
+ pEvent, xNode );
+ }
+ else {
+ OSL_ENSURE( false, "could not extract source XAnimationNode "
+ "for ON_STOP_AUDIO!" );
+ }
+ break;
+ case animations::EventTrigger::REPEAT:
+ OSL_ENSURE( false, "event trigger REPEAT not yet implemented!" );
+ break;
+ }
+ }
+ else if (rEventDescription >>= aSequence) {
+ OSL_ENSURE( false, "sequence of timing primitives "
+ "not yet implemented!" );
+ }
+ else if (rEventDescription >>= nDelay1) {
+ pEvent = makeDelay( rFunctor,
+ nDelay1 + nAdditionalDelay,
+ "generateEvent with delay");
+ // schedule delay event
+ rContext.mrEventQueue.addEvent( pEvent );
+ }
+
+ return pEvent;
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/generateevent.hxx b/slideshow/source/engine/animationnodes/generateevent.hxx
new file mode 100644
index 000000000000..d0f4ce1b5ce4
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/generateevent.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_GENERATEEVENT_HXX
+#define INCLUDED_SLIDESHOW_GENERATEEVENT_HXX
+
+#include "slideshowcontext.hxx"
+#include "delayevent.hxx"
+#include "com/sun/star/uno/Any.hxx"
+
+namespace slideshow {
+namespace internal {
+
+/** Create an event for the given description, calling the given functor.
+
+ @param rEventDescription
+ Directly from API
+
+ @param rFunctor
+ Functor to call when event fires.
+
+ @param rContext
+ Context struct, to provide event queue
+
+ @param nAdditionalDelay
+ Additional delay, gets added on top of timeout.
+*/
+EventSharedPtr generateEvent(
+ ::com::sun::star::uno::Any const& rEventDescription,
+ Delay::FunctorT const& rFunctor,
+ SlideShowContext const& rContext,
+ double nAdditionalDelay );
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_GENERATEEVENT_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/makefile.mk b/slideshow/source/engine/animationnodes/makefile.mk
new file mode 100644
index 000000000000..fc1c80352703
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/makefile.mk
@@ -0,0 +1,61 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..
+
+PRJNAME=slideshow
+TARGET=animationnodes
+ENABLE_EXCEPTIONS=TRUE
+PRJINC=..$/..
+
+# --- Settings -----------------------------------------------------------
+
+.INCLUDE : settings.mk
+.INCLUDE : $(PRJ)$/util$/makefile.pmk
+
+# --- Common ----------------------------------------------------------
+
+SLOFILES = $(SLO)$/animationaudionode.obj \
+ $(SLO)$/animationcommandnode.obj \
+ $(SLO)$/animationbasenode.obj \
+ $(SLO)$/animationcolornode.obj \
+ $(SLO)$/animationnodefactory.obj \
+ $(SLO)$/animationpathmotionnode.obj \
+ $(SLO)$/animationsetnode.obj \
+ $(SLO)$/animationtransformnode.obj \
+ $(SLO)$/animationtransitionfilternode.obj \
+ $(SLO)$/basecontainernode.obj \
+ $(SLO)$/basenode.obj \
+ $(SLO)$/nodetools.obj \
+ $(SLO)$/paralleltimecontainer.obj \
+ $(SLO)$/propertyanimationnode.obj \
+ $(SLO)$/sequentialtimecontainer.obj \
+ $(SLO)$/generateevent.obj
+
+# ==========================================================================
+
+.INCLUDE : target.mk
diff --git a/slideshow/source/engine/animationnodes/nodetools.cxx b/slideshow/source/engine/animationnodes/nodetools.cxx
new file mode 100644
index 000000000000..198108b8be43
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/nodetools.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include <com/sun/star/animations/Timing.hpp>
+
+#include <tools.hxx>
+#include <nodetools.hxx>
+
+
+using namespace ::com::sun::star;
+
+namespace slideshow
+{
+ namespace internal
+ {
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ int& debugGetCurrentOffset()
+ {
+ static int lcl_nOffset = 0; // to make each tree output distinct
+
+ return lcl_nOffset;
+ }
+
+ void debugNodesShowTree( const BaseNode* pNode )
+ {
+ if( pNode )
+ pNode->showState();
+
+ ++debugGetCurrentOffset();
+ }
+
+ void debugNodesShowTreeWithin( const BaseNode* pNode )
+ {
+ if( pNode )
+ pNode->showTreeFromWithin();
+
+ ++debugGetCurrentOffset();
+ }
+#endif
+
+ AttributableShapeSharedPtr lookupAttributableShape( const ShapeManagerSharedPtr& rShapeManager,
+ const uno::Reference< drawing::XShape >& xShape )
+ {
+ ENSURE_OR_THROW( rShapeManager,
+ "lookupAttributableShape(): invalid ShapeManager" );
+
+ ShapeSharedPtr pShape( rShapeManager->lookupShape( xShape ) );
+
+ ENSURE_OR_THROW( pShape,
+ "lookupAttributableShape(): no shape found for given XShape" );
+
+ AttributableShapeSharedPtr pRes(
+ ::boost::dynamic_pointer_cast< AttributableShape >( pShape ) );
+
+ // TODO(E3): Cannot throw here, people might set animation info
+ // for non-animatable shapes from the API. AnimationNodes must catch
+ // the exception and handle that differently
+ ENSURE_OR_THROW( pRes,
+ "lookupAttributableShape(): shape found does not implement AttributableShape interface" );
+
+ return pRes;
+ }
+
+ bool isIndefiniteTiming( const uno::Any& rAny )
+ {
+ if( !rAny.hasValue() )
+ return true;
+
+ animations::Timing eTiming;
+
+ if( !(rAny >>= eTiming) ||
+ eTiming != animations::Timing_INDEFINITE )
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ /// Extract the node type from the user data
+ bool getNodeType( sal_Int16& o_rNodeType,
+ const uno::Sequence< beans::NamedValue >& rValues )
+ {
+ beans::NamedValue aNamedValue;
+
+ if( findNamedValue( &aNamedValue,
+ rValues,
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("node-type") ) ) )
+ {
+ if( (aNamedValue.Value >>= o_rNodeType) )
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/slideshow/source/engine/animationnodes/nodetools.hxx b/slideshow/source/engine/animationnodes/nodetools.hxx
new file mode 100644
index 000000000000..e70defd4dc5b
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/nodetools.hxx
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef INCLUDED_SLIDESHOW_NODETOOLS_HXX
+#define INCLUDED_SLIDESHOW_NODETOOLS_HXX
+
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+
+#include "shapemanager.hxx"
+#include "basenode.hxx"
+#include "doctreenode.hxx"
+#include "attributableshape.hxx"
+
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+# define DEBUG_NODES_SHOWTREE(a) debugNodesShowTree(a);
+# define DEBUG_NODES_SHOWTREE_WITHIN(a) debugNodesShowTreeWithin(a);
+#else
+# define DEBUG_NODES_SHOWTREE(a)
+# define DEBUG_NODES_SHOWTREE_WITHIN(a)
+#endif
+
+namespace slideshow
+{
+ namespace internal
+ {
+
+ // Tools
+ //=========================================================================
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ int& debugGetCurrentOffset();
+ void debugNodesShowTree( const BaseNode* );
+ void debugNodesShowTreeWithin( const BaseNode* );
+#endif
+
+ /** Look up an AttributableShape from ShapeManager.
+
+ This method retrieves an AttributableShape pointer, given
+ an XShape and a LayerManager.
+
+ Throws a runtime exception if there's no such shape, or if
+ it does not implement the AttributableShape interface.
+ */
+ AttributableShapeSharedPtr lookupAttributableShape( const ShapeManagerSharedPtr& rShapeManager,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >& xShape );
+
+ /** Predicate whether a Begin, Duration or End timing is
+ indefinite, i.e. either contains no value, or the
+ value Timing_INDEFINITE.
+ */
+ bool isIndefiniteTiming( const ::com::sun::star::uno::Any& rAny );
+
+ /// Extract the node type from the user data
+ bool getNodeType( sal_Int16& o_rNodeType,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::beans::NamedValue >& rValues );
+ }
+}
+
+#endif /* INCLUDED_SLIDESHOW_NODETOOLS_HXX */
diff --git a/slideshow/source/engine/animationnodes/paralleltimecontainer.cxx b/slideshow/source/engine/animationnodes/paralleltimecontainer.cxx
new file mode 100644
index 000000000000..969e789c57c8
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/paralleltimecontainer.cxx
@@ -0,0 +1,69 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+#include "paralleltimecontainer.hxx"
+#include "delayevent.hxx"
+
+#include <boost/bind.hpp>
+
+namespace slideshow {
+namespace internal {
+
+void ParallelTimeContainer::activate_st()
+{
+ // resolve all children:
+ std::size_t const nResolvedNodes =
+ static_cast<std::size_t>(std::count_if(
+ maChildren.begin(), maChildren.end(),
+ boost::mem_fn(&AnimationNode::resolve) ));
+ (void) nResolvedNodes; // avoid warning
+ OSL_ENSURE( nResolvedNodes == maChildren.size(),
+ "### resolving all children failed!" );
+
+ if (isDurationIndefinite() && maChildren.empty()) {
+ // deactivate ASAP:
+ scheduleDeactivationEvent(
+ makeEvent( boost::bind( &AnimationNode::deactivate, getSelf() ),
+ "ParallelTimeContainer::deactivate") );
+ }
+ else { // use default
+ scheduleDeactivationEvent();
+ }
+}
+
+void ParallelTimeContainer::notifyDeactivating(
+ AnimationNodeSharedPtr const& pChildNode )
+{
+ notifyDeactivatedChild( pChildNode );
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/paralleltimecontainer.hxx b/slideshow/source/engine/animationnodes/paralleltimecontainer.hxx
new file mode 100644
index 000000000000..1694d51b0669
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/paralleltimecontainer.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_PARALLELTIMECONTAINER_HXX
+#define INCLUDED_SLIDESHOW_PARALLELTIMECONTAINER_HXX
+
+#include "basecontainernode.hxx"
+
+namespace slideshow {
+namespace internal {
+
+/** This class implements parallel node containers
+
+ All children of this node are played in parallel
+*/
+class ParallelTimeContainer : public BaseContainerNode
+{
+public:
+ ParallelTimeContainer(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode >& xNode,
+ const BaseContainerNodeSharedPtr& rParent,
+ const NodeContext& rContext )
+ : BaseContainerNode( xNode, rParent, rContext ) {}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual const char* getDescription() const
+ { return "ParallelTimeContainer"; }
+#endif
+
+private:
+ virtual void activate_st();
+ virtual void notifyDeactivating( AnimationNodeSharedPtr const& pChildNode );
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_PARALLELTIMECONTAINER_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/propertyanimationnode.cxx b/slideshow/source/engine/animationnodes/propertyanimationnode.cxx
new file mode 100644
index 000000000000..a200cdfa3d59
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/propertyanimationnode.cxx
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+// must be first
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include "propertyanimationnode.hxx"
+#include "animationfactory.hxx"
+
+using namespace com::sun::star;
+
+namespace slideshow {
+namespace internal {
+
+AnimationActivitySharedPtr PropertyAnimationNode::createActivity() const
+{
+ // Create AnimationActivity from common XAnimate parameters:
+ ActivitiesFactory::CommonParameters aParms( fillCommonParameters() );
+ uno::Reference<animations::XAnimate> const& xAnimateNode =getXAnimateNode();
+ rtl::OUString const attrName( xAnimateNode->getAttributeName() );
+ AttributableShapeSharedPtr const pShape( getShape() );
+
+ switch (AnimationFactory::classifyAttributeName( attrName )) {
+ default:
+ case AnimationFactory::CLASS_UNKNOWN_PROPERTY:
+ ENSURE_OR_THROW(
+ false,
+ "Unexpected attribute class (unknown or empty attribute name)" );
+ break;
+
+ case AnimationFactory::CLASS_NUMBER_PROPERTY:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createNumberPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ xAnimateNode );
+
+ case AnimationFactory::CLASS_ENUM_PROPERTY:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createEnumPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ xAnimateNode );
+
+ case AnimationFactory::CLASS_COLOR_PROPERTY:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createColorPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ xAnimateNode );
+
+ case AnimationFactory::CLASS_STRING_PROPERTY:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createStringPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ xAnimateNode );
+
+ case AnimationFactory::CLASS_BOOL_PROPERTY:
+ return ActivitiesFactory::createAnimateActivity(
+ aParms,
+ AnimationFactory::createBoolPropertyAnimation(
+ attrName,
+ pShape,
+ getContext().mpSubsettableShapeManager,
+ getSlideSize() ),
+ xAnimateNode );
+ }
+
+ return AnimationActivitySharedPtr();
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/propertyanimationnode.hxx b/slideshow/source/engine/animationnodes/propertyanimationnode.hxx
new file mode 100644
index 000000000000..e96aa701b522
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/propertyanimationnode.hxx
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_PROPERTYANIMATIONNODE_HXX
+#define INCLUDED_SLIDESHOW_PROPERTYANIMATIONNODE_HXX
+
+#include "animationbasenode.hxx"
+
+namespace slideshow {
+namespace internal {
+
+class PropertyAnimationNode : public AnimationBaseNode
+{
+public:
+ PropertyAnimationNode(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ ::boost::shared_ptr<BaseContainerNode> const& pParent,
+ NodeContext const& rContext )
+ : AnimationBaseNode( xNode, pParent, rContext ) {}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual const char* getDescription() const
+ { return "PropertyAnimationNode"; }
+#endif
+
+private:
+ virtual AnimationActivitySharedPtr createActivity() const;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_PROPERTYANIMATIONNODE_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx b/slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx
new file mode 100644
index 000000000000..1b5458ca240f
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/sequentialtimecontainer.cxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_slideshow.hxx"
+
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
+
+#include "delayevent.hxx"
+#include "eventqueue.hxx"
+#include "usereventqueue.hxx"
+#include "sequentialtimecontainer.hxx"
+#include "tools.hxx"
+
+#include <boost/bind.hpp>
+#include <algorithm>
+
+namespace slideshow {
+namespace internal {
+
+void SequentialTimeContainer::activate_st()
+{
+ // resolve first possible child, ignore
+ for ( ; mnFinishedChildren < maChildren.size(); ++mnFinishedChildren ) {
+ if (resolveChild( maChildren[mnFinishedChildren] ))
+ break;
+ else {
+ // node still UNRESOLVED, no need to deactivate or end...
+ OSL_ENSURE( false, "### resolving child failed!" );
+ }
+ }
+
+ if (isDurationIndefinite() &&
+ (maChildren.empty() || mnFinishedChildren >= maChildren.size()))
+ {
+ // deactivate ASAP:
+ scheduleDeactivationEvent(
+ makeEvent(
+ boost::bind< void >( boost::mem_fn( &AnimationNode::deactivate ), getSelf() ),
+ "SequentialTimeContainer::deactivate") );
+ }
+ else // use default
+ scheduleDeactivationEvent();
+}
+
+void SequentialTimeContainer::dispose()
+{
+ BaseContainerNode::dispose();
+ if (mpCurrentSkipEvent) {
+ mpCurrentSkipEvent->dispose();
+ mpCurrentSkipEvent.reset();
+ }
+ if (mpCurrentRewindEvent) {
+ mpCurrentRewindEvent->dispose();
+ mpCurrentRewindEvent.reset();
+ }
+}
+
+void SequentialTimeContainer::skipEffect(
+ AnimationNodeSharedPtr const& pChildNode )
+{
+ if (isChildNode(pChildNode)) {
+ // empty all events ignoring timings => until next effect
+ getContext().mrEventQueue.forceEmpty();
+ getContext().mrEventQueue.addEvent(
+ makeEvent(
+ boost::bind<void>( boost::mem_fn( &AnimationNode::deactivate ), pChildNode ),
+ "SequentialTimeContainer::deactivate, skipEffect with delay") );
+ }
+ else
+ OSL_ENSURE( false, "unknown notifier!" );
+}
+
+void SequentialTimeContainer::rewindEffect(
+ AnimationNodeSharedPtr const& /*pChildNode*/ )
+{
+ // xxx todo: ...
+}
+
+bool SequentialTimeContainer::resolveChild(
+ AnimationNodeSharedPtr const& pChildNode )
+{
+ bool const bResolved = pChildNode->resolve();
+ if (bResolved && isMainSequenceRootNode()) {
+ // discharge events:
+ if (mpCurrentSkipEvent)
+ mpCurrentSkipEvent->dispose();
+ if (mpCurrentRewindEvent)
+ mpCurrentRewindEvent->dispose();
+
+ // event that will deactivate the resolved/running child:
+ mpCurrentSkipEvent = makeEvent(
+ boost::bind( &SequentialTimeContainer::skipEffect,
+ boost::dynamic_pointer_cast<SequentialTimeContainer>( getSelf() ),
+ pChildNode ),
+ "SequentialTimeContainer::skipEffect, resolveChild");
+ // event that will reresolve the resolved/activated child:
+ mpCurrentRewindEvent = makeEvent(
+ boost::bind( &SequentialTimeContainer::rewindEffect,
+ boost::dynamic_pointer_cast<SequentialTimeContainer>( getSelf() ),
+ pChildNode ),
+ "SequentialTimeContainer::rewindEffect, resolveChild");
+
+ // deactivate child node when skip event occurs:
+ getContext().mrUserEventQueue.registerSkipEffectEvent(
+ mpCurrentSkipEvent,
+ mnFinishedChildren+1<maChildren.size());
+ // rewind to previous child:
+ getContext().mrUserEventQueue.registerRewindEffectEvent(
+ mpCurrentRewindEvent );
+ }
+ return bResolved;
+}
+
+void SequentialTimeContainer::notifyDeactivating(
+ AnimationNodeSharedPtr const& rNotifier )
+{
+ if (notifyDeactivatedChild( rNotifier ))
+ return;
+
+ OSL_ASSERT( mnFinishedChildren < maChildren.size() );
+ AnimationNodeSharedPtr const& pNextChild = maChildren[mnFinishedChildren];
+ OSL_ASSERT( pNextChild->getState() == UNRESOLVED );
+
+ if (! resolveChild( pNextChild )) {
+ // could not resolve child - since we risk to
+ // stall the chain of events here, play it safe
+ // and deactivate this node (only if we have
+ // indefinite duration - otherwise, we'll get a
+ // deactivation event, anyways).
+ deactivate();
+ }
+}
+
+} // namespace internal
+} // namespace slideshow
+
diff --git a/slideshow/source/engine/animationnodes/sequentialtimecontainer.hxx b/slideshow/source/engine/animationnodes/sequentialtimecontainer.hxx
new file mode 100644
index 000000000000..4ea13062d244
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/sequentialtimecontainer.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_SEQUENTIALTIMECONTAINER_HXX
+#define INCLUDED_SLIDESHOW_SEQUENTIALTIMECONTAINER_HXX
+
+#include "basecontainernode.hxx"
+
+namespace slideshow {
+namespace internal {
+
+/** This class implements sequential node containers
+
+ All children of this node are played sequentially
+*/
+class SequentialTimeContainer : public BaseContainerNode
+{
+public:
+ SequentialTimeContainer(
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::animations::XAnimationNode> const& xNode,
+ BaseContainerNodeSharedPtr const& pParent,
+ NodeContext const& rContext )
+ : BaseContainerNode( xNode, pParent, rContext ) {}
+
+#if defined(VERBOSE) && defined(DBG_UTIL)
+ virtual const char* getDescription() const
+ { return "SequentialTimeContainer"; }
+#endif
+
+protected:
+ virtual void dispose();
+
+private:
+ virtual void activate_st();
+ virtual void notifyDeactivating( AnimationNodeSharedPtr const& rNotifier );
+
+ void skipEffect( AnimationNodeSharedPtr const& pChildNode );
+ void rewindEffect( AnimationNodeSharedPtr const& pChildNode );
+
+private:
+ bool resolveChild( AnimationNodeSharedPtr const& pChildNode );
+
+ EventSharedPtr mpCurrentSkipEvent;
+ EventSharedPtr mpCurrentRewindEvent;
+};
+
+} // namespace internal
+} // namespace slideshow
+
+#endif /* INCLUDED_SLIDESHOW_SEQUENTIALTIMECONTAINER_HXX */
+
diff --git a/slideshow/source/engine/animationnodes/setactivity.hxx b/slideshow/source/engine/animationnodes/setactivity.hxx
new file mode 100644
index 000000000000..06486f33c2ab
--- /dev/null
+++ b/slideshow/source/engine/animationnodes/setactivity.hxx
@@ -0,0 +1,155 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef INCLUDED_SLIDESHOW_SETACTIVITY_HXX
+#define INCLUDED_SLIDESHOW_SETACTIVITY_HXX
+
+// must be first
+#include <canvas/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <canvas/verbosetrace.hxx>
+
+#include "animationactivity.hxx"
+#include "animation.hxx"
+#include "animatableshape.hxx"
+#include "shapeattributelayer.hxx"
+#include "activitiesfactory.hxx"
+
+namespace slideshow {
+namespace internal {
+
+/** Templated setter for animation values
+
+ This template class implements the AnimationActivity
+ interface, but only the perform() and
+ setAttributeLayer() methods are functional. To be used for set animations.
+
+ @see AnimationSetNode.
+*/
+template <class AnimationT>
+class SetActivity : public AnimationActivity
+{
+public:
+ typedef ::boost::shared_ptr< AnimationT > AnimationSharedPtrT;
+ typedef typename AnimationT::ValueType ValueT;
+
+ SetActivity( const ActivitiesFactory::CommonParameters& rParms,
+ const AnimationSharedPtrT& rAnimation,
+ const ValueT& rToValue )
+ : mpAnimation( rAnimation ),
+ mpShape(),
+ mpAttributeLayer(),
+ mpEndEvent( rParms.mpEndEvent ),
+ mrEventQueue( rParms.mrEventQueue ),
+ maToValue( rToValue ),
+ mbIsActive(true)
+ {
+ ENSURE_OR_THROW( mpAnimation, "Invalid animation" );
+ }
+
+ virtual void dispose()
+ {
+ mbIsActive = false;
+ mpAnimation.reset();
+ mpShape.reset();
+ mpAttributeLayer.reset();
+ // discharge end event:
+ if (mpEndEvent && mpEndEvent->isCharged())
+ mpEndEvent->dispose();
+ mpEndEvent.reset();
+ }
+
+ virtual double calcTimeLag() const
+ {
+ return 0.0;
+ }
+
+ virtual bool perform()
+ {
+ if (! isActive())
+ return false;
+ // we're going inactive immediately:
+ mbIsActive = false;
+
+ if (mpAnimation && mpAttributeLayer && mpShape) {
+ mpAnimation->start( mpShape, mpAttributeLayer );
+ (*mpAnimation)(maToValue);
+ mpAnimation->end();
+ }
+ // fire end event, if any
+ if (mpEndEvent)
+ mrEventQueue.addEvent( mpEndEvent );
+
+ return false; // don't reinsert
+ }
+
+ virtual bool isActive() const
+ {
+ return mbIsActive;
+ }
+
+ virtual void dequeued()
+ {
+ }
+
+ virtual void end()
+ {
+ perform();
+ }
+
+ virtual void setTargets( const AnimatableShapeSharedPtr& rShape,
+ const ShapeAttributeLayerSharedPtr& rAttrLayer )
+ {
+ ENSURE_OR_THROW( rShape, "Invalid shape" );
+ ENSURE_OR_THROW( rAttrLayer, "Invalid attribute layer" );
+
+ mpShape = rShape;
+ mpAttributeLayer = rAttrLayer;
+ }
+
+private:
+ AnimationSharedPtrT mpAnimation;
+ AnimatableShapeSharedPtr mpShape;
+ ShapeAttributeLayerSharedPtr mpAttributeLayer;
+ EventSharedPtr mpEndEvent;
+ EventQueue& mrEventQueue;
+ ValueT maToValue;
+ bool mbIsActive;
+};
+
+template <class AnimationT> AnimationActivitySharedPtr makeSetActivity(
+ const ActivitiesFactory::CommonParameters& rParms,
+ const ::boost::shared_ptr< AnimationT >& rAnimation,
+ const typename AnimationT::ValueType& rToValue )
+{
+ return AnimationActivitySharedPtr(
+ new SetActivity<AnimationT>(rParms,rAnimation,rToValue) );
+}
+
+} // namespace internal
+} // namespace presentation
+
+#endif /* INCLUDED_SLIDESHOW_SETACTIVITY_HXX */