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_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX 25 #define INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX 26 27 #include <drawinglayer/drawinglayerdllapi.h> 28 #include <vector> 29 30 ////////////////////////////////////////////////////////////////////////////// 31 32 namespace drawinglayer 33 { 34 namespace animation 35 { 36 ////////////////////////////////////////////////////////////////////////////// 37 38 class DRAWINGLAYER_DLLPUBLIC AnimationEntry 39 { 40 private: 41 AnimationEntry(const AnimationEntry&); 42 AnimationEntry& operator=(const AnimationEntry& rCandidate); 43 44 public: 45 AnimationEntry(); 46 virtual ~AnimationEntry(); 47 virtual AnimationEntry* clone() const = 0; 48 49 virtual bool operator==(const AnimationEntry& rCandidate) const = 0; 50 virtual double getDuration() const = 0; 51 virtual double getStateAtTime(double fTime) const = 0; 52 virtual double getNextEventTime(double fTime) const = 0; 53 }; 54 55 ////////////////////////////////////////////////////////////////////////////// 56 57 class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed : public AnimationEntry 58 { 59 protected: 60 double mfDuration; 61 double mfState; 62 63 public: 64 AnimationEntryFixed(double fDuration, double fState = 0.0); 65 virtual ~AnimationEntryFixed(); 66 virtual AnimationEntry* clone() const; 67 68 virtual bool operator==(const AnimationEntry& rCandidate) const; 69 virtual double getDuration() const; 70 virtual double getStateAtTime(double fTime) const; 71 virtual double getNextEventTime(double fTime) const; 72 }; 73 74 ////////////////////////////////////////////////////////////////////////////// 75 76 class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear : public AnimationEntry 77 { 78 protected: 79 double mfDuration; 80 double mfFrequency; 81 double mfStart; 82 double mfStop; 83 84 public: 85 AnimationEntryLinear(double fDuration, double fFrequency = 250.0, double fStart = 0.0, double fStop = 1.0); 86 virtual ~AnimationEntryLinear(); 87 virtual AnimationEntry* clone() const; 88 89 virtual bool operator==(const AnimationEntry& rCandidate) const; 90 virtual double getDuration() const; 91 virtual double getStateAtTime(double fTime) const; 92 virtual double getNextEventTime(double fTime) const; 93 }; 94 95 ////////////////////////////////////////////////////////////////////////////// 96 97 class DRAWINGLAYER_DLLPUBLIC AnimationEntryList : public AnimationEntry 98 { 99 protected: 100 double mfDuration; 101 ::std::vector< AnimationEntry* > maEntries; 102 103 // helpers 104 sal_uInt32 impGetIndexAtTime(double fTime, double &rfAddedTime) const; 105 106 public: 107 AnimationEntryList(); 108 virtual ~AnimationEntryList(); 109 virtual AnimationEntry* clone() const; 110 111 virtual bool operator==(const AnimationEntry& rCandidate) const; 112 void append(const AnimationEntry& rCandidate); 113 virtual double getDuration() const; 114 virtual double getStateAtTime(double fTime) const; 115 virtual double getNextEventTime(double fTime) const; 116 }; 117 118 ////////////////////////////////////////////////////////////////////////////// 119 120 class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop : public AnimationEntryList 121 { 122 protected: 123 sal_uInt32 mnRepeat; 124 125 public: 126 AnimationEntryLoop(sal_uInt32 nRepeat = 0xffffffff); 127 virtual ~AnimationEntryLoop(); 128 virtual AnimationEntry* clone() const; 129 130 virtual bool operator==(const AnimationEntry& rCandidate) const; 131 virtual double getDuration() const; 132 virtual double getStateAtTime(double fTime) const; 133 virtual double getNextEventTime(double fTime) const; 134 }; 135 136 ////////////////////////////////////////////////////////////////////////////// 137 } // end of namespace animation 138 } // end of namespace drawinglayer 139 140 ////////////////////////////////////////////////////////////////////////////// 141 142 #endif //INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX 143 144 // eof 145