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>
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
#include <com/sun/star/animations/XAnimateTransform.hpp>
|
#include <com/sun/star/animations/XAnimateTransform.hpp>
|
||||||
#include <com/sun/star/animations/XAnimateMotion.hpp>
|
#include <com/sun/star/animations/XAnimateMotion.hpp>
|
||||||
#include <com/sun/star/animations/XAnimate.hpp>
|
#include <com/sun/star/animations/XAnimate.hpp>
|
||||||
|
#include <com/sun/star/animations/AnimationRestart.hpp>
|
||||||
#include <com/sun/star/beans/NamedValue.hpp>
|
#include <com/sun/star/beans/NamedValue.hpp>
|
||||||
#include <com/sun/star/beans/XPropertySet.hpp>
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
||||||
#include <com/sun/star/container/XEnumerationAccess.hpp>
|
#include <com/sun/star/container/XEnumerationAccess.hpp>
|
||||||
@@ -3099,6 +3100,7 @@ InteractiveSequencePtr MainSequence::createInteractiveSequence( const css::uno::
|
|||||||
uno::Sequence< css::beans::NamedValue > aUserData
|
uno::Sequence< css::beans::NamedValue > aUserData
|
||||||
{ { "node-type", css::uno::makeAny(css::presentation::EffectNodeType::INTERACTIVE_SEQUENCE) } };
|
{ { "node-type", css::uno::makeAny(css::presentation::EffectNodeType::INTERACTIVE_SEQUENCE) } };
|
||||||
xISRoot->setUserData( aUserData );
|
xISRoot->setUserData( aUserData );
|
||||||
|
xISRoot->setRestart( css::animations::AnimationRestart::WHEN_NOT_ACTIVE );
|
||||||
|
|
||||||
Reference< XChild > xChild( mxSequenceRoot, UNO_QUERY_THROW );
|
Reference< XChild > xChild( mxSequenceRoot, UNO_QUERY_THROW );
|
||||||
Reference< XTimeContainer > xParent( xChild->getParent(), UNO_QUERY_THROW );
|
Reference< XTimeContainer > xParent( xChild->getParent(), UNO_QUERY_THROW );
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <basecontainernode.hxx>
|
#include <basecontainernode.hxx>
|
||||||
|
#include <com/sun/star/animations/AnimationRestart.hpp>
|
||||||
#include <eventqueue.hxx>
|
#include <eventqueue.hxx>
|
||||||
#include <tools.hxx>
|
#include <tools.hxx>
|
||||||
#include "nodetools.hxx"
|
#include "nodetools.hxx"
|
||||||
@@ -32,6 +33,19 @@ using namespace com::sun::star;
|
|||||||
|
|
||||||
namespace slideshow {
|
namespace slideshow {
|
||||||
namespace internal {
|
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(
|
BaseContainerNode::BaseContainerNode(
|
||||||
const uno::Reference< animations::XAnimationNode >& xNode,
|
const uno::Reference< animations::XAnimationNode >& xNode,
|
||||||
@@ -41,7 +55,8 @@ BaseContainerNode::BaseContainerNode(
|
|||||||
maChildren(),
|
maChildren(),
|
||||||
mnFinishedChildren(0),
|
mnFinishedChildren(0),
|
||||||
mnLeftIterations(0),
|
mnLeftIterations(0),
|
||||||
mbRepeatIndefinite(xNode->getRepeatCount().hasValue() && isIndefiniteTiming(xNode->getRepeatCount())),
|
mbRepeatIndefinite(isRepeatIndefinite(xNode)),
|
||||||
|
mbRestart(isRestart(xNode)),
|
||||||
mbDurationIndefinite( isIndefiniteTiming( xNode->getEnd() ) &&
|
mbDurationIndefinite( isIndefiniteTiming( xNode->getEnd() ) &&
|
||||||
isIndefiniteTiming( xNode->getDuration() ) )
|
isIndefiniteTiming( xNode->getDuration() ) )
|
||||||
{
|
{
|
||||||
@@ -144,9 +159,11 @@ bool BaseContainerNode::notifyDeactivatedChild(
|
|||||||
{
|
{
|
||||||
mnLeftIterations -= 1.0;
|
mnLeftIterations -= 1.0;
|
||||||
}
|
}
|
||||||
if( mnLeftIterations >= 1.0 )
|
if(mnLeftIterations >= 1.0 || mbRestart)
|
||||||
{
|
{
|
||||||
bFinished = false;
|
if (mnLeftIterations >= 1.0)
|
||||||
|
bFinished = false;
|
||||||
|
|
||||||
EventSharedPtr aRepetitionEvent =
|
EventSharedPtr aRepetitionEvent =
|
||||||
makeDelay( [this] () { this->repeat(); },
|
makeDelay( [this] () { this->repeat(); },
|
||||||
0.0,
|
0.0,
|
||||||
|
@@ -86,6 +86,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const bool mbRepeatIndefinite;
|
const bool mbRepeatIndefinite;
|
||||||
|
const bool mbRestart;
|
||||||
const bool mbDurationIndefinite;
|
const bool mbDurationIndefinite;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user