1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX
25 #define INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX
26 
27 #include "event.hxx"
28 #include "eventqueue.hxx"
29 #include "expressionnode.hxx"
30 #include "wakeupevent.hxx"
31 
32 #include <boost/optional.hpp>
33 #include <vector>
34 
35 namespace slideshow {
36 namespace internal {
37 
38 /** Parameter struct for animation activities
39 
40     This struct contains all common parameters needed to
41     initialize the activities generated by the ActivityFactory.
42 */
43 struct ActivityParameters
44 {
45     /** Create
46 
47         @param rEndEvent
48         Event to be fired, when the activity ends.
49 
50         @param rEventQueue
51         Queue to add end event to
52 
53         @param nMinDuration
54         Minimal duration of the activity (might actually be
55         longer because of nMinNumberOfFrames). Note that this
56         duration must always be the <em>simple</em> duration,
57         i.e. without any repeat.
58 
59         @param rRepeats
60         Number of repeats. If this parameter is invalid,
61         infinite repeat is assumed.
62 
63         @param nAccelerationFraction
64         Value between 0 and 1, denoting the fraction of the
65         total simple duration, which the animation should
66         accelerate.
67 
68         @param nDecelerationFraction
69         Value between 0 and 1, denoting the fraction of the
70         total simple duration, which the animation should
71         decelerate. Note that the ranges
72         [0,nAccelerationFraction] and
73         [nDecelerationFraction,1] must be non-overlapping!
74 
75         @param bAutoReverse
76         When true, at the end of the simple duration, the
77         animation plays reversed to the start value. Note that
78         nMinDuration still specifies the simple duration,
79         i.e. when bAutoReverse is true, the implicit duration
80         doubles.
81     */
ActivityParametersslideshow::internal::ActivityParameters82     ActivityParameters(
83         const EventSharedPtr&                       rEndEvent,
84         EventQueue&                                 rEventQueue,
85         ActivitiesQueue&                            rActivitiesQueue,
86         double                                      nMinDuration,
87         ::boost::optional<double> const&            rRepeats,
88         double                                      nAccelerationFraction,
89         double                                      nDecelerationFraction,
90         sal_uInt32                                  nMinNumberOfFrames,
91         bool                                        bAutoReverse )
92         : mrEndEvent( rEndEvent ),
93           mpWakeupEvent(),
94           mrEventQueue( rEventQueue ),
95           mrActivitiesQueue( rActivitiesQueue ),
96           mpFormula(),
97           maDiscreteTimes(),
98           mnMinDuration( nMinDuration ),
99           mrRepeats( rRepeats ),
100           mnAccelerationFraction( nAccelerationFraction ),
101           mnDecelerationFraction( nDecelerationFraction ),
102           mnMinNumberOfFrames( nMinNumberOfFrames ),
103           mbAutoReverse( bAutoReverse ) {}
104 
105     /// End event to fire, when activity is over
106     const EventSharedPtr&                       mrEndEvent;
107     /// Wakeup event to use for discrete activities
108     WakeupEventSharedPtr                        mpWakeupEvent;
109 
110     /// EventQueue to add events to
111     EventQueue&                                 mrEventQueue;
112 
113     /// ActivitiesQueue to add events to
114     ActivitiesQueue&                            mrActivitiesQueue;
115 
116     /// Optional formula
117     ExpressionNodeSharedPtr                     mpFormula;
118 
119     /// Key times, for discrete and key time activities
120     ::std::vector< double >                     maDiscreteTimes;
121 
122     /// Total duration of activity (including all repeats)
123     const double                                mnMinDuration;
124     ::boost::optional<double> const&            mrRepeats;
125     const double                                mnAccelerationFraction;
126     const double                                mnDecelerationFraction;
127 
128     /// Minimal number of frames this activity must render
129     const sal_uInt32                            mnMinNumberOfFrames;
130 
131     /// When true, activity is played reversed after mnDuration.
132     const bool                                  mbAutoReverse;
133 };
134 
135 } // namespace internal
136 } // namespace presentation
137 
138 #endif /* INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX */
139 
140