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