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 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESFACTORY_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESFACTORY_HXX
23 #include <com/sun/star/animations/XAnimate.hpp>
24 #include <com/sun/star/animations/XAnimateColor.hpp>
26 #include "animationactivity.hxx"
27 #include "activitiesqueue.hxx"
29 #include "eventqueue.hxx"
31 #include "numberanimation.hxx"
32 #include "enumanimation.hxx"
33 #include "coloranimation.hxx"
34 #include "hslcoloranimation.hxx"
35 #include "stringanimation.hxx"
36 #include "boolanimation.hxx"
37 #include "pairanimation.hxx"
39 #include <boost/optional.hpp>
40 #include <boost/utility.hpp>
42 /* Definition of ActivitiesFactory class */
47 namespace ActivitiesFactory
49 /// Collection of common factory parameters
50 struct CommonParameters
53 const EventSharedPtr
& rEndEvent
,
54 EventQueue
& rEventQueue
,
55 ActivitiesQueue
& rActivitiesQueue
,
57 sal_uInt32 nMinNumberOfFrames
,
59 ::boost::optional
<double> const& aRepeats
,
62 const ShapeSharedPtr
& rShape
,
63 const ::basegfx::B2DVector
& rSlideBounds
)
64 : mpEndEvent( rEndEvent
),
65 mrEventQueue( rEventQueue
),
66 mrActivitiesQueue( rActivitiesQueue
),
67 mnMinDuration( nMinDuration
),
68 mnMinNumberOfFrames( nMinNumberOfFrames
),
69 maRepeats( aRepeats
),
70 mnAcceleration( nAcceleration
),
71 mnDeceleration( nDeceleration
),
73 maSlideBounds( rSlideBounds
),
74 mbAutoReverse( bAutoReverse
) {}
76 /// End event to fire when animation is over
77 EventSharedPtr mpEndEvent
;
79 /// Event queue to insert the end event into.
80 EventQueue
& mrEventQueue
;
81 /// Event queue to insert the end event into.
82 ActivitiesQueue
& mrActivitiesQueue
;
84 /** Simple duration of the activity
86 Specifies the minimal simple duration of the
87 activity (minimal, because mnMinNumberOfFrames
88 might prolongue the activity). According to SMIL,
89 this might also be indefinite, which for our
90 framework does not make much sense, though
91 (wouldn't have a clue, then, how to scale the
96 /** Minimal number of frames for this activity.
98 This specifies the minimal number of frames this
99 activity will display per simple duration. If less
100 than this number are displayed until mnMinDuration
101 is over, the activity will be prolongued until
102 mnMinNumberOfFrames are rendered.
104 sal_uInt32 mnMinNumberOfFrames
;
106 /** Number of repeats for the simple duration
108 This specified the number of repeats. The
109 mnMinDuration times maRepeats yields the total
110 duration of this activity. If this value is
111 unspecified, the activity will repeat
114 ::boost::optional
<double> const maRepeats
;
116 /// Fraction of simple time to accelerate animation
117 double mnAcceleration
;
119 /// Fraction of simple time to decelerate animation
120 double mnDeceleration
;
122 /// Shape, to get bounds from
123 ShapeSharedPtr mpShape
;
125 /// LayerManager, to get page size from
126 ::basegfx::B2DVector maSlideBounds
;
128 /// When true, activity is played reversed after mnDuration.
132 /** Create an activity from an XAnimate node.
134 This method creates an animated activity from the
135 given XAnimate node, extracting all necessary
136 animation parameters from that. Note that due to the
137 animator parameter, the animation values must be
138 convertible to a double value.
141 Factory parameter structure
147 The SMIL animation node to animate
149 AnimationActivitySharedPtr
createAnimateActivity(
150 const CommonParameters
& rParms
,
151 const NumberAnimationSharedPtr
& rAnimator
,
152 const ::com::sun::star::uno::Reference
<
153 ::com::sun::star::animations::XAnimate
>& xNode
);
155 /** Create an activity from an XAnimate node.
157 This method creates an animated activity from the
158 given XAnimate node, extracting all necessary
159 animation parameters from that. Note that due to the
160 animator parameter, the animation values must be
161 convertible to a double value.
164 Factory parameter structure
170 The SMIL animation node to animate
172 AnimationActivitySharedPtr
createAnimateActivity(
173 const CommonParameters
& rParms
,
174 const EnumAnimationSharedPtr
& rAnimator
,
175 const ::com::sun::star::uno::Reference
<
176 ::com::sun::star::animations::XAnimate
>& xNode
);
178 /** Create an activity from an XAnimate node.
180 This method creates an animated activity from the
181 given XAnimate node, extracting all necessary
182 animation parameters from that. Note that due to the
183 animator parameter, the animation values must be
184 convertible to a color value.
187 Factory parameter structure
193 The SMIL animation node to animate
195 AnimationActivitySharedPtr
createAnimateActivity(
196 const CommonParameters
& rParms
,
197 const ColorAnimationSharedPtr
& rAnimator
,
198 const ::com::sun::star::uno::Reference
<
199 ::com::sun::star::animations::XAnimate
>& xNode
);
201 /** Create an activity from an XAnimate node.
203 This method creates an animated activity from the
204 given XAnimate node, extracting all necessary
205 animation parameters from that. Note that due to the
206 animator parameter, the animation values must be
207 convertible to a color value.
210 Factory parameter structure
216 The SMIL animation node to animate
218 AnimationActivitySharedPtr
createAnimateActivity(
219 const CommonParameters
& rParms
,
220 const HSLColorAnimationSharedPtr
& rAnimator
,
221 const ::com::sun::star::uno::Reference
<
222 ::com::sun::star::animations::XAnimateColor
>& xNode
);
224 /** Create an activity from an XAnimate node.
226 This method creates an animated activity from the
227 given XAnimate node, extracting all necessary
228 animation parameters from that. Note that due to the
229 animator parameter, the animation values must be
230 convertible to a pair of double values.
233 Factory parameter structure
239 The SMIL animation node to animate
241 AnimationActivitySharedPtr
createAnimateActivity(
242 const CommonParameters
& rParms
,
243 const PairAnimationSharedPtr
& rAnimator
,
244 const ::com::sun::star::uno::Reference
<
245 ::com::sun::star::animations::XAnimate
>& xNode
);
247 /** Create an activity from an XAnimate node.
249 This method creates an animated activity from the
250 given XAnimate node, extracting all necessary
251 animation parameters from that. Note that due to the
252 animator parameter, the animation values must be
253 convertible to a string.
256 Factory parameter structure
262 The SMIL animation node to animate
264 AnimationActivitySharedPtr
createAnimateActivity(
265 const CommonParameters
& rParms
,
266 const StringAnimationSharedPtr
& rAnimator
,
267 const ::com::sun::star::uno::Reference
<
268 ::com::sun::star::animations::XAnimate
>& xNode
);
270 /** Create an activity from an XAnimate node.
272 This method creates an animated activity from the
273 given XAnimate node, extracting all necessary
274 animation parameters from that. Note that due to the
275 animator parameter, the animation values must be
276 convertible to a bool value.
279 Factory parameter structure
285 The SMIL animation node to animate
287 AnimationActivitySharedPtr
createAnimateActivity(
288 const CommonParameters
& rParms
,
289 const BoolAnimationSharedPtr
& rAnimator
,
290 const ::com::sun::star::uno::Reference
<
291 ::com::sun::star::animations::XAnimate
>& xNode
);
293 /** Create a simple activity for the given animator
295 This method is suited to create activities for custom
296 animations, which need a simple double value and lasts
297 a given timespan. This activity always generates values
298 from the [0,1] range.
301 Factory parameter structure
306 @param bDirectionForward
307 If true, the activity goes 'forward', i.e. from 0 to
308 1. With false, the direction is reversed.
310 AnimationActivitySharedPtr
createSimpleActivity(
311 const CommonParameters
& rParms
,
312 const NumberAnimationSharedPtr
& rAnimator
,
313 bool bDirectionForward
);
316 } // namespace internal
317 } // namespace presentation
319 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESFACTORY_HXX
321 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */