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_SIMPLECONTINUOUSACTIVITYBASE_HXX
25 #define INCLUDED_SLIDESHOW_SIMPLECONTINUOUSACTIVITYBASE_HXX
26 
27 #include "activitybase.hxx"
28 #include <canvas/elapsedtime.hxx>
29 
30 namespace slideshow
31 {
32     namespace internal
33     {
34         /** Simple, continuous animation.
35 
36 	        This class implements a simple, continuous animation
37             without considering repeats or acceleration on the
38             perform call. Only useful as a base class, you
39             probably want to use ContinuousActivityBase.
40         */
41         class SimpleContinuousActivityBase : public ActivityBase
42         {
43         public:
44             SimpleContinuousActivityBase( const ActivityParameters& rParms );
45 
46             virtual double calcTimeLag() const;
47             virtual bool perform();
48 
49         protected:
50             /** Hook for derived classes
51 
52 	            This method will be called from perform().
53 
54                 @param nSimpleTime
55                 Simple animation time, without repeat,
56                 acceleration or deceleration applied. This value
57                 is always in the [0,1] range, the repeat is
58                 accounted for with the nRepeatCount parameter.
59 
60                 @param nRepeatCount
61                 Number of full repeats already performed
62             */
63             virtual void simplePerform( double nSimpleTime, sal_uInt32 nRepeatCount ) const = 0;
64 
65             virtual void startAnimation();
66 
67         private:
68             /// Time elapsed since activity started
69             ::canvas::tools::ElapsedTime	maTimer;
70 
71             /// Simple duration of activity
72             const double					mnMinSimpleDuration;
73 
74             /// Minimal number of frames to show (see ActivityParameters)
75             const sal_uInt32				mnMinNumberOfFrames;
76 
77             /// Actual number of frames shown until now.
78             sal_uInt32						mnCurrPerformCalls;
79         };
80     }
81 }
82 
83 #endif /* INCLUDED_SLIDESHOW_SIMPLECONTINUOUSACTIVITYBASE_HXX */
84