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