21#include <com/sun/star/animations/XAnimate.hpp>
22#include <com/sun/star/presentation/ParagraphTarget.hpp>
23#include <com/sun/star/animations/AnimationFill.hpp>
24#include <com/sun/star/animations/AnimationRestart.hpp>
25#include <com/sun/star/presentation/EffectNodeType.hpp>
26#include <com/sun/star/beans/XPropertySet.hpp>
49typedef int StateTransitionTable[17];
54const int* getStateTransitionTable( sal_Int16 nRestartMode,
60 static const StateTransitionTable stateTransitionTable_Never_Remove = {
81 static const StateTransitionTable stateTransitionTable_NotActive_Remove = {
104 static const StateTransitionTable stateTransitionTable_Always_Remove = {
126 static const StateTransitionTable stateTransitionTable_Never_Freeze = {
147 static const StateTransitionTable stateTransitionTable_NotActive_Freeze = {
170 static const StateTransitionTable stateTransitionTable_Always_Freeze = {
191 static const StateTransitionTable* tableGuide[] = {
192 &stateTransitionTable_Never_Remove,
193 &stateTransitionTable_NotActive_Remove,
194 &stateTransitionTable_Always_Remove,
195 &stateTransitionTable_Never_Freeze,
196 &stateTransitionTable_NotActive_Freeze,
197 &stateTransitionTable_Always_Freeze
201 switch( nRestartMode ) {
203 case animations::AnimationRestart::DEFAULT:
206 "getStateTransitionTable(): unexpected case for restart" );
208 case animations::AnimationRestart::NEVER:
211 case animations::AnimationRestart::WHEN_NOT_ACTIVE:
214 case animations::AnimationRestart::ALWAYS:
220 switch( nFillMode ) {
222 case animations::AnimationFill::AUTO:
223 case animations::AnimationFill::DEFAULT:
226 "getStateTransitionTable(): unexpected case for fill" );
228 case animations::AnimationFill::REMOVE:
231 case animations::AnimationFill::FREEZE:
232 case animations::AnimationFill::HOLD:
233 case animations::AnimationFill::TRANSITION:
238 return *tableGuide[ 3*nFillValue + nRestartValue ];
242bool isMainSequenceRootNode_(
243 const uno::Reference< animations::XAnimationNode >& xNode )
247 beans::NamedValue
const aSearchKey(
249 uno::Any( presentation::EffectNodeType::MAIN_SEQUENCE ) );
251 uno::Sequence<beans::NamedValue>
const userData(xNode->getUserData());
280 "### commit() before enter()ing again!" );
320 maDeactivatingListeners(),
321 mxAnimationNode( xNode ),
324 mpStateTransitionTable( nullptr ),
325 mnStartDelay( rContext.mnStartDelay ),
326 meCurrState( UNRESOLVED ),
327 meCurrentStateTransition( 0 ),
329 mbIsMainSequenceRootNode( isMainSequenceRootNode_( xNode ) )
332 "BaseNode::BaseNode(): Invalid XAnimationNode" );
359 return nTmp != animations::AnimationRestart::DEFAULT
366 const sal_Int16 nFill(nTmp != animations::AnimationFill::DEFAULT
373 if( nFill == animations::AnimationFill::AUTO ) {
378 ? animations::AnimationFill::FREEZE
379 : animations::AnimationFill::REMOVE;
389 if (nFillDefault == animations::AnimationFill::DEFAULT) {
392 : animations::AnimationFill::AUTO);
400 if (nRestartDefaultMode == animations::AnimationRestart::DEFAULT) {
401 nRestartDefaultMode = (
mpParent !=
nullptr
403 : animations::AnimationRestart::ALWAYS);
405 return nRestartDefaultMode;
465 aBegin, [self] () { self->activate(); },
477 [self] () { self->activate(); },
479 "AnimationNode::activate with delay");
550 [self] () { self->deactivate(); },
558 [self] () { self->deactivate(); },
606 "end state not reachable in transition table" );
617 if (!bIsFrozenOrInTransitionToFrozen)
629 OSL_ASSERT( rNotifier->getState() ==
FROZEN ||
630 rNotifier->getState() ==
ENDED );
638 rListener->notifyDeactivating(
mpSelf );
668 "BaseNode::registerDeactivatingListener(): invalid notifee" );
677 "BaseNode::setSelf(): got ptr to different object" );
679 "BaseNode::setSelf(): called multiple times" );
693 SAL_INFO(
"slideshow.verbose",
"Node state: n" <<
697 "\",style=filled, fillcolor=\"0.5,0.2,0.5\"]");
699 SAL_INFO(
"slideshow.verbose",
"Node state: n" <<
716 if( !xTargetShape.is() )
718 css::presentation::ParagraphTarget aTarget;
721 if( xAnimate->getTarget() >>= aTarget )
722 xTargetShape = aTarget.Shape;
725 if( !xTargetShape.is() )
733 if( xPropSet->getPropertyValue(
"Name") >>=
aName )
735 SAL_INFO(
"slideshow.verbose",
"Node info: n" <<
NodeState
The current state of this AnimationNode.
@ UNRESOLVED
Unresolved start time.
@ FROZEN
Node is frozen (no longer active, but changes remain in place)
@ RESOLVED
Resolved start time, node will start eventually.
@ INVALID
Invalid state, node is disposed or otherwise invalid.
@ ENDED
Node has completed an active lifecycle, and any effect is removed from the document.
state transition handling
bool enter(NodeState eToState, Options options=Options::NONE)
StateTransition & operator=(const StateTransition &)=delete
StateTransition(const StateTransition &)=delete
StateTransition(BaseNode *pNode)
This interface extends AnimationNode with some file-private accessor methods.
virtual void end() override
End the animation on this node.
bool isMainSequenceRootNode() const
bool inStateOrTransition(int mask) const
virtual void activate() override
Immediately start this node.
virtual void showState() const
SlideShowContext maContext
virtual css::uno::Reference< css::animations::XAnimationNode > getXAnimationNode() const override
Query the corresponding XAnimationNode.
virtual bool init() override
Init this node.
int meCurrentStateTransition
::std::shared_ptr< BaseNode > mpSelf
bool isTransition(NodeState eFromState, NodeState eToState, bool debugAssert=true) const
sal_Int16 getFillMode()
Get the node's fill mode.
const int * mpStateTransitionTable
::std::shared_ptr< BaseContainerNode > mpParent
css::uno::Reference< css::animations::XAnimationNode > mxAnimationNode
bool checkValidNode() const
void setSelf(const BaseNodeSharedPtr &rSelf)
Provide the node with a shared_ptr to itself.
virtual void dispose() override
Dispose all object references.
virtual bool registerDeactivatingListener(const AnimationNodeSharedPtr &rNotifee) override
Register a deactivating listener.
EventSharedPtr mpCurrentEvent
void notifyEndListeners() const
notifies
virtual void deactivate_st(NodeState eDestState)
sal_Int16 getRestartMode()
Get the node's restart mode.
virtual const char * getDescription() const
virtual NodeState getState() const override
Query node state.
const double mnStartDelay
::std::vector< AnimationNodeSharedPtr > maDeactivatingListeners
BaseNode(css::uno::Reference< css::animations::XAnimationNode > const &xNode, BaseContainerNodeSharedPtr pParent, NodeContext const &rContext)
virtual void activate_st()
virtual bool resolve() override
Resolve node start time.
virtual void deactivate() override
Immediately stop this node.
virtual bool resolve_st()
sal_Int16 getRestartDefaultMode() const
Get the default restart mode.
sal_Int16 getFillDefaultMode() const
Get the default fill mode.
void scheduleDeactivationEvent(EventSharedPtr const &pEvent=EventSharedPtr())
virtual void notifyDeactivating(const AnimationNodeSharedPtr &rNotifier) override
Called to notify another AnimationNode's deactivation.
bool notifyAnimationStart(const AnimationNodeSharedPtr &rNode)
Notify that the given node enters its active duration.
bool notifySlideAnimationsEnd()
Notify that the slide animations sequence leaves its active duration.
bool notifyAnimationEnd(const AnimationNodeSharedPtr &rNode)
Notify that the given node leaves its active duration.
bool addEvent(const EventSharedPtr &event)
Add the given event to the queue.
#define makeDelay(f, t, d)
#define ENSURE_OR_RETURN_FALSE(c, m)
#define ENSURE_OR_THROW(c, m)
RegionData_Impl * mpParent
SlideShowContext maContext
#define SAL_INFO(area, stream)
::std::shared_ptr< BaseContainerNode > BaseContainerNodeSharedPtr
bool isIndefiniteTiming(const uno::Any &rAny)
bool findNamedValue(uno::Sequence< beans::NamedValue > const &rSequence, const beans::NamedValue &rSearchKey)
::std::shared_ptr< AnimationNode > AnimationNodeSharedPtr
::std::shared_ptr< Event > EventSharedPtr
::std::shared_ptr< BaseNode > BaseNodeSharedPtr
EventSharedPtr generateEvent(uno::Any const &rEventDescription, Delay::FunctorT const &rFunctor, SlideShowContext const &rContext, double nAdditionalDelay)
OUString debugGetNodeName(const BaseNode *pNode)
EventMultiplexer & mrEventMultiplexer
EventQueue & mrEventQueue