merge the formfield patch from ooo-build
[ooovba.git] / slideshow / source / inc / activitiesfactory.hxx
blobd8494516d4348b47730bdb0f0327476dbef33e33
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: activitiesfactory.hxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_ACTIVITIESFACTORY_HXX
32 #define INCLUDED_SLIDESHOW_ACTIVITIESFACTORY_HXX
34 #include <com/sun/star/animations/XAnimate.hpp>
35 #include <com/sun/star/animations/XAnimateColor.hpp>
37 #include "animationactivity.hxx"
38 #include "activitiesqueue.hxx"
39 #include "event.hxx"
40 #include "eventqueue.hxx"
41 #include "shape.hxx"
42 #include "numberanimation.hxx"
43 #include "enumanimation.hxx"
44 #include "coloranimation.hxx"
45 #include "hslcoloranimation.hxx"
46 #include "stringanimation.hxx"
47 #include "boolanimation.hxx"
48 #include "pairanimation.hxx"
50 #include <boost/optional.hpp>
51 #include <boost/utility.hpp>
53 /* Definition of ActivitiesFactory class */
55 namespace slideshow {
56 namespace internal {
58 class ActivitiesFactory : private ::boost::noncopyable
60 public:
61 /// Collection of common factory parameters
62 struct CommonParameters
64 CommonParameters(
65 const EventSharedPtr& rEndEvent,
66 EventQueue& rEventQueue,
67 ActivitiesQueue& rActivitiesQueue,
68 double nMinDuration,
69 sal_uInt32 nMinNumberOfFrames,
70 bool bAutoReverse,
71 ::boost::optional<double> const& aRepeats,
72 double nAcceleration,
73 double nDeceleration,
74 const ShapeSharedPtr& rShape,
75 const ::basegfx::B2DVector& rSlideBounds )
76 : mpEndEvent( rEndEvent ),
77 mrEventQueue( rEventQueue ),
78 mrActivitiesQueue( rActivitiesQueue ),
79 mnMinDuration( nMinDuration ),
80 mnMinNumberOfFrames( nMinNumberOfFrames ),
81 maRepeats( aRepeats ),
82 mnAcceleration( nAcceleration ),
83 mnDeceleration( nDeceleration ),
84 mpShape( rShape ),
85 maSlideBounds( rSlideBounds ),
86 mbAutoReverse( bAutoReverse ) {}
88 /// End event to fire when animation is over
89 EventSharedPtr mpEndEvent;
91 /// Event queue to insert the end event into.
92 EventQueue& mrEventQueue;
93 /// Event queue to insert the end event into.
94 ActivitiesQueue& mrActivitiesQueue;
96 /** Simple duration of the activity
98 Specifies the minimal simple duration of the
99 activity (minimal, because mnMinNumberOfFrames
100 might prolongue the activity). According to SMIL,
101 this might also be indefinite, which for our
102 framework does not make much sense, though
103 (wouldn't have a clue, then, how to scale the
104 animation over time).
106 double mnMinDuration;
108 /** Minimal number of frames for this activity.
110 This specifies the minimal number of frames this
111 activity will display per simple duration. If less
112 than this number are displayed until mnMinDuration
113 is over, the activity will be prolongued until
114 mnMinNumberOfFrames are rendered.
116 sal_uInt32 mnMinNumberOfFrames;
118 /** Number of repeats for the simple duration
120 This specified the number of repeats. The
121 mnMinDuration times maRepeats yields the total
122 duration of this activity. If this value is
123 unspecified, the activity will repeat
124 indefinitely.
126 ::boost::optional<double> const maRepeats;
128 /// Fraction of simple time to accelerate animation
129 double mnAcceleration;
131 /// Fraction of simple time to decelerate animation
132 double mnDeceleration;
134 /// Shape, to get bounds from
135 ShapeSharedPtr mpShape;
137 /// LayerManager, to get page size from
138 ::basegfx::B2DVector maSlideBounds;
140 /// When true, activity is played reversed after mnDuration.
141 bool mbAutoReverse;
144 /** Create an activity from an XAnimate node.
146 This method creates an animated activity from the
147 given XAnimate node, extracting all necessary
148 animation parameters from that. Note that due to the
149 animator parameter, the animation values must be
150 convertible to a double value.
152 @param rParms
153 Factory parameter structure
155 @param rAnimator
156 Animator sub-object
158 @param xNode
159 The SMIL animation node to animate
161 static AnimationActivitySharedPtr createAnimateActivity(
162 const CommonParameters& rParms,
163 const NumberAnimationSharedPtr& rAnimator,
164 const ::com::sun::star::uno::Reference<
165 ::com::sun::star::animations::XAnimate >& xNode );
167 /** Create an activity from an XAnimate node.
169 This method creates an animated activity from the
170 given XAnimate node, extracting all necessary
171 animation parameters from that. Note that due to the
172 animator parameter, the animation values must be
173 convertible to a double value.
175 @param rParms
176 Factory parameter structure
178 @param rAnimator
179 Animator sub-object
181 @param xNode
182 The SMIL animation node to animate
184 static AnimationActivitySharedPtr createAnimateActivity(
185 const CommonParameters& rParms,
186 const EnumAnimationSharedPtr& rAnimator,
187 const ::com::sun::star::uno::Reference<
188 ::com::sun::star::animations::XAnimate >& xNode );
190 /** Create an activity from an XAnimate node.
192 This method creates an animated activity from the
193 given XAnimate node, extracting all necessary
194 animation parameters from that. Note that due to the
195 animator parameter, the animation values must be
196 convertible to a color value.
198 @param rParms
199 Factory parameter structure
201 @param rAnimator
202 Animator sub-object
204 @param xNode
205 The SMIL animation node to animate
207 static AnimationActivitySharedPtr createAnimateActivity(
208 const CommonParameters& rParms,
209 const ColorAnimationSharedPtr& rAnimator,
210 const ::com::sun::star::uno::Reference<
211 ::com::sun::star::animations::XAnimate >& xNode );
213 /** Create an activity from an XAnimate node.
215 This method creates an animated activity from the
216 given XAnimate node, extracting all necessary
217 animation parameters from that. Note that due to the
218 animator parameter, the animation values must be
219 convertible to a color value.
221 @param rParms
222 Factory parameter structure
224 @param rAnimator
225 Animator sub-object
227 @param xNode
228 The SMIL animation node to animate
230 static AnimationActivitySharedPtr createAnimateActivity(
231 const CommonParameters& rParms,
232 const HSLColorAnimationSharedPtr& rAnimator,
233 const ::com::sun::star::uno::Reference<
234 ::com::sun::star::animations::XAnimateColor >& xNode );
236 /** Create an activity from an XAnimate node.
238 This method creates an animated activity from the
239 given XAnimate node, extracting all necessary
240 animation parameters from that. Note that due to the
241 animator parameter, the animation values must be
242 convertible to a pair of double values.
244 @param rParms
245 Factory parameter structure
247 @param rAnimator
248 Animator sub-object
250 @param xNode
251 The SMIL animation node to animate
253 static AnimationActivitySharedPtr createAnimateActivity(
254 const CommonParameters& rParms,
255 const PairAnimationSharedPtr& rAnimator,
256 const ::com::sun::star::uno::Reference<
257 ::com::sun::star::animations::XAnimate >& xNode );
259 /** Create an activity from an XAnimate node.
261 This method creates an animated activity from the
262 given XAnimate node, extracting all necessary
263 animation parameters from that. Note that due to the
264 animator parameter, the animation values must be
265 convertible to a string.
267 @param rParms
268 Factory parameter structure
270 @param rAnimator
271 Animator sub-object
273 @param xNode
274 The SMIL animation node to animate
276 static AnimationActivitySharedPtr createAnimateActivity(
277 const CommonParameters& rParms,
278 const StringAnimationSharedPtr& rAnimator,
279 const ::com::sun::star::uno::Reference<
280 ::com::sun::star::animations::XAnimate >& xNode );
282 /** Create an activity from an XAnimate node.
284 This method creates an animated activity from the
285 given XAnimate node, extracting all necessary
286 animation parameters from that. Note that due to the
287 animator parameter, the animation values must be
288 convertible to a bool value.
290 @param rParms
291 Factory parameter structure
293 @param rAnimator
294 Animator sub-object
296 @param xNode
297 The SMIL animation node to animate
299 static AnimationActivitySharedPtr createAnimateActivity(
300 const CommonParameters& rParms,
301 const BoolAnimationSharedPtr& rAnimator,
302 const ::com::sun::star::uno::Reference<
303 ::com::sun::star::animations::XAnimate >& xNode );
305 /** Create a simple activity for the given animator
307 This method is suited to create activities for custom
308 animations, which need a simple double value and lasts
309 a given timespan. This activity always generates values
310 from the [0,1] range.
312 @param rParms
313 Factory parameter structure
315 @param rAnimator
316 Animator sub-object
318 @param bDirectionForward
319 If true, the activity goes 'forward', i.e. from 0 to
320 1. With false, the direction is reversed.
322 static AnimationActivitySharedPtr createSimpleActivity(
323 const CommonParameters& rParms,
324 const NumberAnimationSharedPtr& rAnimator,
325 bool bDirectionForward );
327 private:
328 // default: constructor/destructor disabed
329 ActivitiesFactory();
330 ~ActivitiesFactory();
333 } // namespace internal
334 } // namespace presentation
336 #endif /* INCLUDED_SLIDESHOW_ACTIVITIESFACTORY_HXX */