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