Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / drawinglayer / animation / animationtiming.hxx
blobf98136d1621a5b0a79494babc3c7646a764c8003
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>
26 #include <memory>
29 namespace drawinglayer
31 namespace animation
35 class DRAWINGLAYER_DLLPUBLIC AnimationEntry
37 private:
38 AnimationEntry(const AnimationEntry&) = delete;
39 AnimationEntry& operator=(const AnimationEntry& rCandidate) = delete;
41 public:
42 AnimationEntry();
43 virtual ~AnimationEntry();
44 virtual std::unique_ptr<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;
53 class DRAWINGLAYER_DLLPUBLIC AnimationEntryFixed : public AnimationEntry
55 protected:
56 double mfDuration;
57 double mfState;
59 public:
60 AnimationEntryFixed(double fDuration, double fState);
61 virtual ~AnimationEntryFixed() override;
62 virtual std::unique_ptr<AnimationEntry> clone() const override;
64 virtual bool operator==(const AnimationEntry& rCandidate) const override;
65 virtual double getDuration() const override;
66 virtual double getStateAtTime(double fTime) const override;
67 virtual double getNextEventTime(double fTime) const override;
71 class DRAWINGLAYER_DLLPUBLIC AnimationEntryLinear : public AnimationEntry
73 protected:
74 double mfDuration;
75 double mfFrequency;
76 double mfStart;
77 double mfStop;
79 public:
80 AnimationEntryLinear(double fDuration, double fFrequency, double fStart, double fStop);
81 virtual ~AnimationEntryLinear() override;
82 virtual std::unique_ptr<AnimationEntry> clone() const override;
84 virtual bool operator==(const AnimationEntry& rCandidate) const override;
85 virtual double getDuration() const override;
86 virtual double getStateAtTime(double fTime) const override;
87 virtual double getNextEventTime(double fTime) const override;
91 class DRAWINGLAYER_DLLPUBLIC AnimationEntryList : public AnimationEntry
93 protected:
94 using Entries = std::vector<std::unique_ptr<AnimationEntry>>;
96 double mfDuration;
97 Entries maEntries;
99 // helpers
100 Entries::size_type impGetIndexAtTime(double fTime, double &rfAddedTime) const;
102 public:
103 AnimationEntryList();
104 virtual ~AnimationEntryList() override;
105 virtual std::unique_ptr<AnimationEntry> clone() const override;
107 virtual bool operator==(const AnimationEntry& rCandidate) const override;
108 void append(const AnimationEntry& rCandidate);
109 virtual double getDuration() const override;
110 virtual double getStateAtTime(double fTime) const override;
111 virtual double getNextEventTime(double fTime) const override;
115 class DRAWINGLAYER_DLLPUBLIC AnimationEntryLoop : public AnimationEntryList
117 protected:
118 sal_uInt32 mnRepeat;
120 public:
121 AnimationEntryLoop(sal_uInt32 nRepeat);
122 virtual ~AnimationEntryLoop() override;
123 virtual std::unique_ptr<AnimationEntry> clone() const override;
125 virtual bool operator==(const AnimationEntry& rCandidate) const override;
126 virtual double getDuration() const override;
127 virtual double getStateAtTime(double fTime) const override;
128 virtual double getNextEventTime(double fTime) const override;
132 } // end of namespace animation
133 } // end of namespace drawinglayer
136 #endif //INCLUDED_DRAWINGLAYER_ANIMATION_ANIMATIONTIMING_HXX
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */