1
/* This file is part of the KDE project
2
* Copyright ( C ) 2007 Thorsten Zachmann <zachmann@kde.org>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or ( at your option ) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public License
15
* along with this library; see the file COPYING.LIB. If not, write to
16
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
20
#ifndef KPRSHAPEANIMATION_H
21
#define KPRSHAPEANIMATION_H
25
#include "kpresenter_export.h"
27
#define TIMEFACTOR 1000.0
34
class KoViewConverter;
35
class KPrAnimationData;
38
* This is the base class for shape animations.
40
* In the animation itself the state of the animation is not stored.
41
* With this design it is possible to use the same animation object
42
* for running the same animation e.g. on different views or at a
44
* The state of the animation is kept in the animationData and is
45
* passed to the ainmation when it is run e.g. on a special view.
47
class KPRESENTER_TEST_EXPORT KPrShapeAnimation
56
virtual ~KPrShapeAnimation();
59
* Get a animation data object
61
* The object is created on the heap by new so the caller of this function
62
* has to make sure to delete the object when he no longer needs it to
63
* avoid leaking memory. The object holds the data needed for running an
66
* @param canvas The canvas on which the animation will take place
67
* @return animationData the caller has to delete the animationData when
68
* it is no longer used.
70
virtual KPrAnimationData * animationData( KoCanvasBase * canvas, KoShapeManager * shapeManager, const QRectF & pageRect ) = 0;
73
* @brief Animate the shape
75
* This is done by maniplating the painter used for painting the shape.
77
* @param painter The painter used for painting the shape
78
* @param converter The converter to convert between internal and view coordinates
79
* @param animationData The data needed for running the animation
81
* @return true when the animations is finished
83
virtual bool animate( QPainter &painter, const KoViewConverter &converter, KPrAnimationData * animationData ) = 0;
86
* @brief Update the bounding rect of the shape in the animation
88
* @param rect The bounding rect of the shape to update
89
* @param animationData The data needed for running the animation
91
virtual void animateRect( QRectF & rect, KPrAnimationData * animationData ) = 0;
94
* @brief Trigger an update of the canvas needed for the given time
97
* @param animationData The data needed for running the animation
99
virtual void next( int currentTime, KPrAnimationData * animationData ) = 0;
102
* @brief Finish the shape animation
104
* @param animationData The data needed for running the animation
106
virtual void finish( KPrAnimationData * animationData ) = 0;
109
* Get the duration of the shape animation
111
* @return The duration of the shape animation
113
int duration() const;
116
* @brief Get the step on which the animation is shown.
121
* @brief Set the step on which the animation is shown.
123
void setStep( int step );
126
* @brief Get the shape the animation is for
128
KoShape * shape() const;
131
* @brief Get the type of the animation
139
* Only to be called form derived classes
141
KPrShapeAnimation( KoShape * shape, int step, Type type );
143
// the shape for which is aminated
145
// the timeline used for calculating the animation position
146
QTimeLine m_timeLine;
147
// the step ( click ) on which the animation is done
149
// The type of animation
151
// Indicates that the animation is finished
155
#endif // KPRSHAPEANIMATION_H