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>
41 /* Definition of ActivitiesFactory class */
46 namespace ActivitiesFactory
48 /// Collection of common factory parameters
49 struct CommonParameters
52 const EventSharedPtr
& rEndEvent
,
53 EventQueue
& rEventQueue
,
54 ActivitiesQueue
& rActivitiesQueue
,
56 sal_uInt32 nMinNumberOfFrames
,
58 ::boost::optional
<double> const& aRepeats
,
61 const ShapeSharedPtr
& rShape
,
62 const ::basegfx::B2DVector
& rSlideBounds
)
63 : mpEndEvent( rEndEvent
),
64 mrEventQueue( rEventQueue
),
65 mrActivitiesQueue( rActivitiesQueue
),
66 mnMinDuration( nMinDuration
),
67 mnMinNumberOfFrames( nMinNumberOfFrames
),
68 maRepeats( aRepeats
),
69 mnAcceleration( nAcceleration
),
70 mnDeceleration( nDeceleration
),
72 maSlideBounds( rSlideBounds
),
73 mbAutoReverse( bAutoReverse
) {}
75 /// End event to fire when animation is over
76 EventSharedPtr mpEndEvent
;
78 /// Event queue to insert the end event into.
79 EventQueue
& mrEventQueue
;
80 /// Event queue to insert the end event into.
81 ActivitiesQueue
& mrActivitiesQueue
;
83 /** Simple duration of the activity
85 Specifies the minimal simple duration of the
86 activity (minimal, because mnMinNumberOfFrames
87 might prolong the activity). According to SMIL,
88 this might also be indefinite, which for our
89 framework does not make much sense, though
90 (wouldn't have a clue, then, how to scale the
95 /** Minimal number of frames for this activity.
97 This specifies the minimal number of frames this
98 activity will display per simple duration. If less
99 than this number are displayed until mnMinDuration
100 is over, the activity will be prolonged until
101 mnMinNumberOfFrames are rendered.
103 sal_uInt32 mnMinNumberOfFrames
;
105 /** Number of repeats for the simple duration
107 This specified the number of repeats. The
108 mnMinDuration times maRepeats yields the total
109 duration of this activity. If this value is
110 unspecified, the activity will repeat
113 ::boost::optional
<double> const maRepeats
;
115 /// Fraction of simple time to accelerate animation
116 double mnAcceleration
;
118 /// Fraction of simple time to decelerate animation
119 double mnDeceleration
;
121 /// Shape, to get bounds from
122 ShapeSharedPtr mpShape
;
124 /// LayerManager, to get page size from
125 ::basegfx::B2DVector maSlideBounds
;
127 /// When true, activity is played reversed after mnDuration.
131 /** Create an activity from an XAnimate node.
133 This method creates an animated activity from the
134 given XAnimate node, extracting all necessary
135 animation parameters from that. Note that due to the
136 animator parameter, the animation values must be
137 convertible to a double value.
140 Factory parameter structure
146 The SMIL animation node to animate
148 AnimationActivitySharedPtr
createAnimateActivity(
149 const CommonParameters
& rParms
,
150 const NumberAnimationSharedPtr
& rAnimator
,
151 const css::uno::Reference
< css::animations::XAnimate
>& xNode
);
153 /** Create an activity from an XAnimate node.
155 This method creates an animated activity from the
156 given XAnimate node, extracting all necessary
157 animation parameters from that. Note that due to the
158 animator parameter, the animation values must be
159 convertible to a double value.
162 Factory parameter structure
168 The SMIL animation node to animate
170 AnimationActivitySharedPtr
createAnimateActivity(
171 const CommonParameters
& rParms
,
172 const EnumAnimationSharedPtr
& rAnimator
,
173 const css::uno::Reference
< css::animations::XAnimate
>& xNode
);
175 /** Create an activity from an XAnimate node.
177 This method creates an animated activity from the
178 given XAnimate node, extracting all necessary
179 animation parameters from that. Note that due to the
180 animator parameter, the animation values must be
181 convertible to a color value.
184 Factory parameter structure
190 The SMIL animation node to animate
192 AnimationActivitySharedPtr
createAnimateActivity(
193 const CommonParameters
& rParms
,
194 const ColorAnimationSharedPtr
& rAnimator
,
195 const css::uno::Reference
< css::animations::XAnimate
>& xNode
);
197 /** Create an activity from an XAnimate node.
199 This method creates an animated activity from the
200 given XAnimate node, extracting all necessary
201 animation parameters from that. Note that due to the
202 animator parameter, the animation values must be
203 convertible to a color value.
206 Factory parameter structure
212 The SMIL animation node to animate
214 AnimationActivitySharedPtr
createAnimateActivity(
215 const CommonParameters
& rParms
,
216 const HSLColorAnimationSharedPtr
& rAnimator
,
217 const css::uno::Reference
< css::animations::XAnimateColor
>& xNode
);
219 /** Create an activity from an XAnimate node.
221 This method creates an animated activity from the
222 given XAnimate node, extracting all necessary
223 animation parameters from that. Note that due to the
224 animator parameter, the animation values must be
225 convertible to a pair of double values.
228 Factory parameter structure
234 The SMIL animation node to animate
236 AnimationActivitySharedPtr
createAnimateActivity(
237 const CommonParameters
& rParms
,
238 const PairAnimationSharedPtr
& rAnimator
,
239 const css::uno::Reference
< css::animations::XAnimate
>& xNode
);
241 /** Create an activity from an XAnimate node.
243 This method creates an animated activity from the
244 given XAnimate node, extracting all necessary
245 animation parameters from that. Note that due to the
246 animator parameter, the animation values must be
247 convertible to a string.
250 Factory parameter structure
256 The SMIL animation node to animate
258 AnimationActivitySharedPtr
createAnimateActivity(
259 const CommonParameters
& rParms
,
260 const StringAnimationSharedPtr
& rAnimator
,
261 const css::uno::Reference
< css::animations::XAnimate
>& xNode
);
263 /** Create an activity from an XAnimate node.
265 This method creates an animated activity from the
266 given XAnimate node, extracting all necessary
267 animation parameters from that. Note that due to the
268 animator parameter, the animation values must be
269 convertible to a bool value.
272 Factory parameter structure
278 The SMIL animation node to animate
280 AnimationActivitySharedPtr
createAnimateActivity(
281 const CommonParameters
& rParms
,
282 const BoolAnimationSharedPtr
& rAnimator
,
283 const css::uno::Reference
< css::animations::XAnimate
>& xNode
);
285 /** Create a simple activity for the given animator
287 This method is suited to create activities for custom
288 animations, which need a simple double value and lasts
289 a given timespan. This activity always generates values
290 from the [0,1] range.
293 Factory parameter structure
298 @param bDirectionForward
299 If true, the activity goes 'forward', i.e. from 0 to
300 1. With false, the direction is reversed.
302 AnimationActivitySharedPtr
createSimpleActivity(
303 const CommonParameters
& rParms
,
304 const NumberAnimationSharedPtr
& rAnimator
,
305 bool bDirectionForward
);
308 } // namespace internal
309 } // namespace presentation
311 #endif // INCLUDED_SLIDESHOW_SOURCE_INC_ACTIVITIESFACTORY_HXX
313 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */