diff options
author | Mark Hung <marklh9@gmail.com> | 2019-02-24 17:49:03 +0800 |
---|---|---|
committer | Mark Hung <marklh9@gmail.com> | 2019-02-26 04:57:21 +0100 |
commit | 7e18b87566c55b38ca812c28b01ed346d45e94b8 (patch) | |
tree | 9b48f76c7ab23184938b0e7f78c8d6ad534b6895 /slideshow/source/engine | |
parent | 140fd0a1b1da1b0b14bda17c926dd8f95750ba92 (diff) |
tdf#88969 restart interactive sequence.
This patch allows the whole interactive sequence to
restart automatically when it's done. User don't
need to insert multiple pause toggle command to
a media object just for toggling the media
multiple times.
Change-Id: I000a55f580917327ae438ea8e79e62f63275cce7
Reviewed-on: https://gerrit.libreoffice.org/68283
Tested-by: Jenkins
Reviewed-by: Mark Hung <marklh9@gmail.com>
Diffstat (limited to 'slideshow/source/engine')
-rw-r--r-- | slideshow/source/engine/animationnodes/basecontainernode.cxx | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/slideshow/source/engine/animationnodes/basecontainernode.cxx b/slideshow/source/engine/animationnodes/basecontainernode.cxx index d48df81161cb..e8e5dfbd7f88 100644 --- a/slideshow/source/engine/animationnodes/basecontainernode.cxx +++ b/slideshow/source/engine/animationnodes/basecontainernode.cxx @@ -19,6 +19,7 @@ #include <basecontainernode.hxx> +#include <com/sun/star/animations/AnimationRestart.hpp> #include <eventqueue.hxx> #include <tools.hxx> #include "nodetools.hxx" @@ -32,6 +33,19 @@ using namespace com::sun::star; namespace slideshow { namespace internal { +namespace { +bool isRepeatIndefinite(const uno::Reference<animations::XAnimationNode>& xNode) +{ + return xNode->getRepeatCount().hasValue() && isIndefiniteTiming(xNode->getRepeatCount()); +} + +bool isRestart(const uno::Reference<animations::XAnimationNode>& xNode) +{ + sal_Int16 nRestart = xNode->getRestart(); + return nRestart == animations::AnimationRestart::WHEN_NOT_ACTIVE || + nRestart == animations::AnimationRestart::ALWAYS; +} +} BaseContainerNode::BaseContainerNode( const uno::Reference< animations::XAnimationNode >& xNode, @@ -41,7 +55,8 @@ BaseContainerNode::BaseContainerNode( maChildren(), mnFinishedChildren(0), mnLeftIterations(0), - mbRepeatIndefinite(xNode->getRepeatCount().hasValue() && isIndefiniteTiming(xNode->getRepeatCount())), + mbRepeatIndefinite(isRepeatIndefinite(xNode)), + mbRestart(isRestart(xNode)), mbDurationIndefinite( isIndefiniteTiming( xNode->getEnd() ) && isIndefiniteTiming( xNode->getDuration() ) ) { @@ -144,9 +159,11 @@ bool BaseContainerNode::notifyDeactivatedChild( { mnLeftIterations -= 1.0; } - if( mnLeftIterations >= 1.0 ) + if(mnLeftIterations >= 1.0 || mbRestart) { - bFinished = false; + if (mnLeftIterations >= 1.0) + bFinished = false; + EventSharedPtr aRepetitionEvent = makeDelay( [this] () { this->repeat(); }, 0.0, |