merge the formfield patch from ooo-build
[ooovba.git] / slideshow / source / engine / activities / discreteactivitybase.hxx
blobcbaa544089fad2a276e465b3f698fa1130cdd8fd
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: discreteactivitybase.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_DISCRETEACTIVITYBASE_HXX
32 #define INCLUDED_SLIDESHOW_DISCRETEACTIVITYBASE_HXX
34 #include "activitybase.hxx"
35 #include "wakeupevent.hxx"
37 #include <vector>
40 namespace slideshow
42 namespace internal
44 /** Specialization of ActivityBase for discrete time activities.
46 A discrete time activity is one where time proceeds in
47 discrete steps, i.e. at given time instants.
49 class DiscreteActivityBase : public ActivityBase
51 public:
52 DiscreteActivityBase( const ActivityParameters& rParms );
54 /** Hook for derived classes.
56 This method is called for each discrete time
57 instant, with nFrame denoting the frame number
58 (starting with 0)
60 @param nFrame
61 Current frame number.
63 @param nRepeatCount
64 Number of full repeats already performed
66 virtual void perform( sal_uInt32 nFrame, sal_uInt32 nRepeatCount ) const = 0;
67 virtual void dispose();
68 virtual bool perform();
70 protected:
71 virtual void startAnimation();
73 sal_uInt32 calcFrameIndex( sal_uInt32 nCurrCalls,
74 ::std::size_t nVectorSize ) const;
76 sal_uInt32 calcRepeatCount( sal_uInt32 nCurrCalls,
77 ::std::size_t nVectorSize ) const;
79 ::std::size_t getNumberOfKeyTimes() const { return maDiscreteTimes.size(); }
81 private:
82 WakeupEventSharedPtr mpWakeupEvent;
83 const ::std::vector< double > maDiscreteTimes;
84 const double mnSimpleDuration;
85 sal_uInt32 mnCurrPerformCalls;
90 #endif /* INCLUDED_SLIDESHOW_DISCRETEACTIVITYBASE_HXX */