1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX
29 #define INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX
30 
31 #include "event.hxx"
32 #include "eventqueue.hxx"
33 #include "expressionnode.hxx"
34 #include "wakeupevent.hxx"
35 
36 #include <boost/optional.hpp>
37 #include <vector>
38 
39 namespace slideshow {
40 namespace internal {
41 
42 /** Parameter struct for animation activities
43 
44     This struct contains all common parameters needed to
45     initialize the activities generated by the ActivityFactory.
46 */
47 struct ActivityParameters
48 {
49     /** Create
50 
51         @param rEndEvent
52         Event to be fired, when the activity ends.
53 
54         @param rEventQueue
55         Queue to add end event to
56 
57         @param nMinDuration
58         Minimal duration of the activity (might actually be
59         longer because of nMinNumberOfFrames). Note that this
60         duration must always be the <em>simple</em> duration,
61         i.e. without any repeat.
62 
63         @param rRepeats
64         Number of repeats. If this parameter is invalid,
65         infinite repeat is assumed.
66 
67         @param nAccelerationFraction
68         Value between 0 and 1, denoting the fraction of the
69         total simple duration, which the animation should
70         accelerate.
71 
72         @param nDecelerationFraction
73         Value between 0 and 1, denoting the fraction of the
74         total simple duration, which the animation should
75         decelerate. Note that the ranges
76         [0,nAccelerationFraction] and
77         [nDecelerationFraction,1] must be non-overlapping!
78 
79         @param bAutoReverse
80         When true, at the end of the simple duration, the
81         animation plays reversed to the start value. Note that
82         nMinDuration still specifies the simple duration,
83         i.e. when bAutoReverse is true, the implicit duration
84         doubles.
85     */
86     ActivityParameters(
87         const EventSharedPtr&                       rEndEvent,
88         EventQueue&                                 rEventQueue,
89         ActivitiesQueue&                            rActivitiesQueue,
90         double                                      nMinDuration,
91         ::boost::optional<double> const&            rRepeats,
92         double                                      nAccelerationFraction,
93         double                                      nDecelerationFraction,
94         sal_uInt32                                  nMinNumberOfFrames,
95         bool                                        bAutoReverse )
96         : mrEndEvent( rEndEvent ),
97           mpWakeupEvent(),
98           mrEventQueue( rEventQueue ),
99           mrActivitiesQueue( rActivitiesQueue ),
100           mpFormula(),
101           maDiscreteTimes(),
102           mnMinDuration( nMinDuration ),
103           mrRepeats( rRepeats ),
104           mnAccelerationFraction( nAccelerationFraction ),
105           mnDecelerationFraction( nDecelerationFraction ),
106           mnMinNumberOfFrames( nMinNumberOfFrames ),
107           mbAutoReverse( bAutoReverse ) {}
108 
109     /// End event to fire, when activity is over
110     const EventSharedPtr&                       mrEndEvent;
111     /// Wakeup event to use for discrete activities
112     WakeupEventSharedPtr                        mpWakeupEvent;
113 
114     /// EventQueue to add events to
115     EventQueue&                                 mrEventQueue;
116 
117     /// ActivitiesQueue to add events to
118     ActivitiesQueue&                            mrActivitiesQueue;
119 
120     /// Optional formula
121     ExpressionNodeSharedPtr                     mpFormula;
122 
123     /// Key times, for discrete and key time activities
124     ::std::vector< double >                     maDiscreteTimes;
125 
126     /// Total duration of activity (including all repeats)
127     const double                                mnMinDuration;
128     ::boost::optional<double> const&            mrRepeats;
129     const double                                mnAccelerationFraction;
130     const double                                mnDecelerationFraction;
131 
132     /// Minimal number of frames this activity must render
133     const sal_uInt32                            mnMinNumberOfFrames;
134 
135     /// When true, activity is played reversed after mnDuration.
136     const bool                                  mbAutoReverse;
137 };
138 
139 } // namespace internal
140 } // namespace presentation
141 
142 #endif /* INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX */
143 
144