1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_ANIMATIONNODE_HXX
20 #define INCLUDED_SLIDESHOW_SOURCE_INC_ANIMATIONNODE_HXX
22 #include "disposable.hxx"
24 #include <com/sun/star/animations/XAnimationNode.hpp>
27 namespace slideshow::internal
30 typedef ::std::shared_ptr
<AnimationNode
> AnimationNodeSharedPtr
;
32 /** This interface is used to mirror every XAnimateNode object
33 in the presentation core.
35 class AnimationNode
: public Disposable
38 /** The current state of this AnimationNode
42 /// Invalid state, node is disposed or otherwise invalid
44 /// Unresolved start time
46 /// Resolved start time, node will start eventually
50 /// Node is frozen (no longer active, but changes remain in place)
52 /// Node has completed an active lifecycle,
53 /// and any effect is removed from the document
57 /** Query the corresponding XAnimationNode.
59 virtual css::uno::Reference
<css::animations::XAnimationNode
> getXAnimationNode() const = 0;
63 If this node is not in state INVALID, init() sets up the
64 node state and schedules necessary events.
65 If this node has children, they have their init() called, too.
66 You will call this method whenever a slide is going to be
69 @return true, if init was successful; state has changed to UNRESOLVED
71 virtual bool init() = 0;
73 /** Resolve node start time
75 Nodes can have unresolved start times, i.e. indefinite
76 start time for container nodes, or child nodes whose
77 parent has not yet started. Calling this method fixes
78 the node's start time. This does not mean that this
79 node immediately starts its animations, that is only
80 the case for begin=0.0. The node will change its state
83 @return true, if a start event was successfully scheduled.
85 virtual bool resolve() = 0;
87 /** Immediately start this node
89 This method starts the animation on this node, without
90 begin timeout. The node will change its state to ACTIVE.
92 virtual void activate() = 0;
94 /** Immediately stop this node
96 This method stops the animation on this node. The node
97 will change its state to either ENDED or FROZEN,
98 depending on XAnimationNode attributes.
100 virtual void deactivate() = 0;
102 /** End the animation on this node
104 This method force-ends animation on this node. Parents
105 may call this for their children, if their active
106 duration ends. An ended animation will no longer have
107 any effect on the shape attributes. The node will
108 change its state to ENDED.
110 virtual void end() = 0;
114 @return the current state of this animation node.
116 virtual NodeState
getState() const = 0;
118 /** Register a deactivating listener
120 This method registers another AnimationNode as an
121 deactivating listener, which gets notified via a
122 notifyDeactivating() call. The node calls all
123 registered listener, when it leaves the ACTIVE state.
125 @param rNotifee AnimationNode to notify
127 virtual bool registerDeactivatingListener(const AnimationNodeSharedPtr
& rNotifee
) = 0;
129 /** Called to notify another AnimationNode's deactivation
131 @param rNotifier The instance who calls this method.
133 virtual void notifyDeactivating(const AnimationNodeSharedPtr
& rNotifier
) = 0;
135 /** Called by the container to remove the animation effect
136 to make the painted shape correct if it restart because
137 of repeat or rewind ( fill mode is AnimationFill::REMOVE )
140 virtual void removeEffect() = 0;
142 /** Query node whether it has an animation pending.
144 @return true, if this node (or at least one of its children)
145 has an animation pending. Used to determine if the main
146 sequence is actually empty, or contains effects
148 virtual bool hasPendingAnimation() const = 0;
151 } // namespace presentation::internal
153 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ANIMATIONNODE_HXX
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */