Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SLIDESHOW_ANIMATIONNODE_HXX
20 : #define INCLUDED_SLIDESHOW_ANIMATIONNODE_HXX
21 :
22 : #include "disposable.hxx"
23 :
24 : #include <com/sun/star/animations/XAnimationNode.hpp>
25 : #include <boost/shared_ptr.hpp>
26 :
27 : namespace slideshow {
28 : namespace internal {
29 :
30 : /** This interface is used to mirror every XAnimateNode object
31 : in the presentation core.
32 : */
33 0 : class AnimationNode : public Disposable
34 : {
35 : public:
36 : /** The current state of this AnimationNode
37 : */
38 : enum NodeState {
39 : /// Invalid state, node is disposed or otherwise invalid
40 : INVALID =0,
41 : /// Unresolved start time
42 : UNRESOLVED =1,
43 : /// Resolved start time, node will start eventually
44 : RESOLVED =2,
45 : /// Node is active
46 : ACTIVE =4,
47 : /// Node is frozen (no longer active, but changes remain in place)
48 : FROZEN =8,
49 : /// Node has completed an active lifecycle,
50 : /// and any effect is removed from the document
51 : ENDED =16
52 : };
53 :
54 : /** Query the corresponding XAnimationNode.
55 : */
56 : virtual ::com::sun::star::uno::Reference<
57 : ::com::sun::star::animations::XAnimationNode >
58 : getXAnimationNode() const = 0;
59 :
60 : /** Init this node
61 :
62 : If this node is not in state INVALID, init() sets up the
63 : node state and schedules necessary events.
64 : If this node has children, they have their init() called, too.
65 : You will call this method whenever a slide is going to be
66 : shown.
67 :
68 : @return true, if init was successful; state has changed to UNRESOLVED
69 : */
70 : virtual bool init() = 0;
71 :
72 : /** Resolve node start time
73 :
74 : Nodes can have unresolved start times, i.e. indefinite
75 : start time for container nodes, or child nodes whose
76 : parent has not yet started. Calling this method fixes
77 : the node's start time. This does not mean that this
78 : node immediately starts its animations, that is only
79 : the case for begin=0.0. The node will change its state
80 : to RESOLVED.
81 :
82 : @return true, if a start event was successfully scheduled.
83 : */
84 : virtual bool resolve() = 0;
85 :
86 : /** Immediately start this node
87 :
88 : This method starts the animation on this node, without
89 : begin timeout. The node will change its state to ACTIVE.
90 :
91 : @return true, if start was successful. This method
92 : might return false, if e.g. a restart is not permitted
93 : on this node.
94 : */
95 : virtual bool activate() = 0;
96 :
97 : /** Immediately stop this node
98 :
99 : This method stops the animation on this node. The node
100 : will change its state to either ENDED or FROZEN,
101 : depending on XAnimationNode attributes.
102 : */
103 : virtual void deactivate() = 0;
104 :
105 : /** End the animation on this node
106 :
107 : This method force-ends animation on this node. Parents
108 : may call this for their children, if their active
109 : duration ends. An ended animation will no longer have
110 : any effect on the shape attributes. The node will
111 : change its state to ENDED.
112 : */
113 : virtual void end() = 0;
114 :
115 : /** Query node state
116 :
117 : @return the current state of this animation node.
118 : */
119 : virtual NodeState getState() const = 0;
120 :
121 : /** Register a deactivating listener
122 :
123 : This method registers another AnimationNode as an
124 : deactivating listener, which gets notified via a
125 : notifyDeactivating() call. The node calls all
126 : registered listener, when it leaves the ACTIVE state.
127 :
128 : @param rNotifee AnimationNode to notify
129 : */
130 : virtual bool registerDeactivatingListener(
131 : const ::boost::shared_ptr< AnimationNode >& rNotifee ) = 0;
132 :
133 : /** Called to notify another AnimationNode's deactivation
134 :
135 : @param rNotifier The instance who calls this method.
136 : */
137 : virtual void notifyDeactivating(
138 : const ::boost::shared_ptr< AnimationNode >& rNotifier ) = 0;
139 :
140 : /** Query node whether it has an animation pending.
141 :
142 : @return true, if this node (or at least one of its children)
143 : has an animation pending. Used to determine if the main
144 : sequence is actually empty, or contains effects
145 : */
146 : virtual bool hasPendingAnimation() const = 0;
147 : };
148 :
149 : typedef ::boost::shared_ptr< AnimationNode > AnimationNodeSharedPtr;
150 :
151 : } // namespace internal
152 : } // namespace presentation
153 :
154 : #endif /* INCLUDED_SLIDESHOW_ANIMATIONNODE_HXX */
155 :
156 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|