update credits
[LibreOffice.git] / include / drawinglayer / animation / animationtiming.hxx
blob08ee95090f6c2af62e76d992fa800a54b15f13a1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
21 #define INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <vector>
27 //////////////////////////////////////////////////////////////////////////////
29 namespace drawinglayer
31 namespace animation
33 //////////////////////////////////////////////////////////////////////////////
35 class DRAWINGLAYER_DLLPUBLIC AnimationEntry
37 private:
38 AnimationEntry(const AnimationEntry&);
39 AnimationEntry& operator=(const AnimationEntry& rCandidate);
41 public:
42 AnimationEntry();
43 virtual ~AnimationEntry();
44 virtual AnimationEntry* clone() const = 0;
46 virtual bool operator==(const AnimationEntry& rCandidate) const = 0;
47 virtual double getDuration() const = 0;
48 virtual double getStateAtTime(double fTime) const = 0;
49 virtual double getNextEventTime(double fTime) const = 0;
52 //////////////////////////////////////////////////////////////////////////////
54 class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed : public AnimationEntry
56 protected:
57 double mfDuration;
58 double mfState;
60 public:
61 AnimationEntryFixed(double fDuration, double fState = 0.0);
62 virtual ~AnimationEntryFixed();
63 virtual AnimationEntry* clone() const;
65 virtual bool operator==(const AnimationEntry& rCandidate) const;
66 virtual double getDuration() const;
67 virtual double getStateAtTime(double fTime) const;
68 virtual double getNextEventTime(double fTime) const;
71 //////////////////////////////////////////////////////////////////////////////
73 class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear : public AnimationEntry
75 protected:
76 double mfDuration;
77 double mfFrequency;
78 double mfStart;
79 double mfStop;
81 public:
82 AnimationEntryLinear(double fDuration, double fFrequency = 250.0, double fStart = 0.0, double fStop = 1.0);
83 virtual ~AnimationEntryLinear();
84 virtual AnimationEntry* clone() const;
86 virtual bool operator==(const AnimationEntry& rCandidate) const;
87 virtual double getDuration() const;
88 virtual double getStateAtTime(double fTime) const;
89 virtual double getNextEventTime(double fTime) const;
92 //////////////////////////////////////////////////////////////////////////////
94 class DRAWINGLAYER_DLLPUBLIC AnimationEntryList : public AnimationEntry
96 protected:
97 double mfDuration;
98 ::std::vector< AnimationEntry* > maEntries;
100 // helpers
101 sal_uInt32 impGetIndexAtTime(double fTime, double &rfAddedTime) const;
103 public:
104 AnimationEntryList();
105 virtual ~AnimationEntryList();
106 virtual AnimationEntry* clone() const;
108 virtual bool operator==(const AnimationEntry& rCandidate) const;
109 void append(const AnimationEntry& rCandidate);
110 virtual double getDuration() const;
111 virtual double getStateAtTime(double fTime) const;
112 virtual double getNextEventTime(double fTime) const;
115 //////////////////////////////////////////////////////////////////////////////
117 class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop : public AnimationEntryList
119 protected:
120 sal_uInt32 mnRepeat;
122 public:
123 AnimationEntryLoop(sal_uInt32 nRepeat = 0xffffffff);
124 virtual ~AnimationEntryLoop();
125 virtual AnimationEntry* clone() const;
127 virtual bool operator==(const AnimationEntry& rCandidate) const;
128 virtual double getDuration() const;
129 virtual double getStateAtTime(double fTime) const;
130 virtual double getNextEventTime(double fTime) const;
133 //////////////////////////////////////////////////////////////////////////////
134 } // end of namespace animation
135 } // end of namespace drawinglayer
137 //////////////////////////////////////////////////////////////////////////////
139 #endif //INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */