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_DISCRETEACTIVITYBASE_HXX 25 #define INCLUDED_SLIDESHOW_DISCRETEACTIVITYBASE_HXX 26 27 #include "activitybase.hxx" 28 #include "wakeupevent.hxx" 29 30 #include <vector> 31 32 33 namespace slideshow 34 { 35 namespace internal 36 { 37 /** Specialization of ActivityBase for discrete time activities. 38 39 A discrete time activity is one where time proceeds in 40 discrete steps, i.e. at given time instants. 41 */ 42 class DiscreteActivityBase : public ActivityBase 43 { 44 public: 45 DiscreteActivityBase( const ActivityParameters& rParms ); 46 47 /** Hook for derived classes. 48 49 This method is called for each discrete time 50 instant, with nFrame denoting the frame number 51 (starting with 0) 52 53 @param nFrame 54 Current frame number. 55 56 @param nRepeatCount 57 Number of full repeats already performed 58 */ 59 virtual void perform( sal_uInt32 nFrame, sal_uInt32 nRepeatCount ) const = 0; 60 virtual void dispose(); 61 virtual bool perform(); 62 63 protected: 64 virtual void startAnimation(); 65 66 sal_uInt32 calcFrameIndex( sal_uInt32 nCurrCalls, 67 ::std::size_t nVectorSize ) const; 68 69 sal_uInt32 calcRepeatCount( sal_uInt32 nCurrCalls, 70 ::std::size_t nVectorSize ) const; 71 getNumberOfKeyTimes() const72 ::std::size_t getNumberOfKeyTimes() const { return maDiscreteTimes.size(); } 73 74 private: 75 WakeupEventSharedPtr mpWakeupEvent; 76 const ::std::vector< double > maDiscreteTimes; 77 const double mnSimpleDuration; 78 sal_uInt32 mnCurrPerformCalls; 79 }; 80 } 81 } 82 83 #endif /* INCLUDED_SLIDESHOW_DISCRETEACTIVITYBASE_HXX */ 84