Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX
21 : #define INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX
22 :
23 : #include "event.hxx"
24 : #include "eventqueue.hxx"
25 : #include "expressionnode.hxx"
26 : #include "wakeupevent.hxx"
27 :
28 : #include <boost/optional.hpp>
29 : #include <vector>
30 :
31 : namespace slideshow {
32 : namespace internal {
33 :
34 : /** Parameter struct for animation activities
35 :
36 : This struct contains all common parameters needed to
37 : initialize the activities generated by the ActivityFactory.
38 : */
39 0 : struct ActivityParameters
40 : {
41 : /** Create
42 :
43 : @param rEndEvent
44 : Event to be fired, when the activity ends.
45 :
46 : @param rEventQueue
47 : Queue to add end event to
48 :
49 : @param nMinDuration
50 : Minimal duration of the activity (might actually be
51 : longer because of nMinNumberOfFrames). Note that this
52 : duration must always be the <em>simple</em> duration,
53 : i.e. without any repeat.
54 :
55 : @param rRepeats
56 : Number of repeats. If this parameter is invalid,
57 : infinite repeat is assumed.
58 :
59 : @param nAccelerationFraction
60 : Value between 0 and 1, denoting the fraction of the
61 : total simple duration, which the animation should
62 : accelerate.
63 :
64 : @param nDecelerationFraction
65 : Value between 0 and 1, denoting the fraction of the
66 : total simple duration, which the animation should
67 : decelerate. Note that the ranges
68 : [0,nAccelerationFraction] and
69 : [nDecelerationFraction,1] must be non-overlapping!
70 :
71 : @param bAutoReverse
72 : When true, at the end of the simple duration, the
73 : animation plays reversed to the start value. Note that
74 : nMinDuration still specifies the simple duration,
75 : i.e. when bAutoReverse is true, the implicit duration
76 : doubles.
77 : */
78 0 : ActivityParameters(
79 : const EventSharedPtr& rEndEvent,
80 : EventQueue& rEventQueue,
81 : ActivitiesQueue& rActivitiesQueue,
82 : double nMinDuration,
83 : ::boost::optional<double> const& rRepeats,
84 : double nAccelerationFraction,
85 : double nDecelerationFraction,
86 : sal_uInt32 nMinNumberOfFrames,
87 : bool bAutoReverse )
88 : : mrEndEvent( rEndEvent ),
89 : mpWakeupEvent(),
90 : mrEventQueue( rEventQueue ),
91 : mrActivitiesQueue( rActivitiesQueue ),
92 : mpFormula(),
93 : maDiscreteTimes(),
94 : mnMinDuration( nMinDuration ),
95 : mrRepeats( rRepeats ),
96 : mnAccelerationFraction( nAccelerationFraction ),
97 : mnDecelerationFraction( nDecelerationFraction ),
98 : mnMinNumberOfFrames( nMinNumberOfFrames ),
99 0 : mbAutoReverse( bAutoReverse ) {}
100 :
101 : /// End event to fire, when activity is over
102 : const EventSharedPtr& mrEndEvent;
103 : /// Wakeup event to use for discrete activities
104 : WakeupEventSharedPtr mpWakeupEvent;
105 :
106 : /// EventQueue to add events to
107 : EventQueue& mrEventQueue;
108 :
109 : /// ActivitiesQueue to add events to
110 : ActivitiesQueue& mrActivitiesQueue;
111 :
112 : /// Optional formula
113 : ExpressionNodeSharedPtr mpFormula;
114 :
115 : /// Key times, for discrete and key time activities
116 : ::std::vector< double > maDiscreteTimes;
117 :
118 : /// Total duration of activity (including all repeats)
119 : const double mnMinDuration;
120 : ::boost::optional<double> const& mrRepeats;
121 : const double mnAccelerationFraction;
122 : const double mnDecelerationFraction;
123 :
124 : /// Minimal number of frames this activity must render
125 : const sal_uInt32 mnMinNumberOfFrames;
126 :
127 : /// When true, activity is played reversed after mnDuration.
128 : const bool mbAutoReverse;
129 : };
130 :
131 : } // namespace internal
132 : } // namespace presentation
133 :
134 : #endif /* INCLUDED_SLIDESHOW_ACTIVITYPARAMETERS_HXX */
135 :
136 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|