1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACTIVITYBASE_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACTIVITYBASE_HXX
23 #include "animationactivity.hxx"
24 #include "activityparameters.hxx"
25 #include "animatableshape.hxx"
26 #include "shapeattributelayer.hxx"
31 /** Base class for animation activities.
33 This whole class hierarchy is only for code sharing
34 between the various specializations (with or without
35 key times, fully discrete, etc.).
37 class ActivityBase
: public AnimationActivity
40 ActivityBase( const ActivityParameters
& rParms
);
42 /// From Disposable interface
43 virtual void dispose() SAL_OVERRIDE
;
46 /** From Activity interface
48 Derived classes should override, call this first
49 and then perform their work.
51 virtual bool perform() SAL_OVERRIDE
;
52 virtual double calcTimeLag() const SAL_OVERRIDE
;
53 virtual bool isActive() const SAL_OVERRIDE
;
56 virtual void dequeued() SAL_OVERRIDE
;
58 // From AnimationActivity interface
59 virtual void setTargets(
60 const AnimatableShapeSharedPtr
& rShape
,
61 const ShapeAttributeLayerSharedPtr
& rAttrLayer
) SAL_OVERRIDE
;
64 /** Hook for derived classes
66 This method will be called from the first
67 perform() invocation, to signal the start of the
70 virtual void startAnimation() = 0;
72 /** Hook for derived classes
74 This method will be called after the last perform()
75 invocation, and after the potential changes of that
76 perform() call are committed to screen. That is, in
77 endAnimation(), the animation objects (sprites,
78 animation) can safely be destroyed, without causing
79 visible artifacts on screen.
81 virtual void endAnimation() = 0;
85 /** End this activity, in a regular way.
87 This method is for derived classes needing to signal a
88 regular activity end (i.e. because the regular
93 /** Modify fractional time.
95 This method modifies the fractional time (total
96 duration mapped to the [0,1] range) to the
97 effective simple time, but only according to
98 acceleration/deceleration.
100 double calcAcceleratedTime( double nT
) const;
102 bool isDisposed() const {
103 return (!mbIsActive
&& !mpEndEvent
&& !mpShape
&&
107 EventQueue
& getEventQueue() const { return mrEventQueue
; }
109 AnimatableShapeSharedPtr
getShape() const { return mpShape
; }
111 ShapeAttributeLayerSharedPtr
getShapeAttributeLayer() const
112 { return mpAttributeLayer
; }
114 bool isRepeatCountValid() const { return bool(maRepeats
); }
115 double getRepeatCount() const { return *maRepeats
; }
116 bool isAutoReverse() const { return mbAutoReverse
; }
120 virtual void end() SAL_OVERRIDE
;
121 virtual void performEnd() = 0;
124 EventSharedPtr mpEndEvent
;
125 EventQueue
& mrEventQueue
;
126 AnimatableShapeSharedPtr mpShape
; // only to pass on to animation
127 ShapeAttributeLayerSharedPtr mpAttributeLayer
; // only to pass on to anim
129 ::boost::optional
<double> const maRepeats
;
130 const double mnAccelerationFraction
;
131 const double mnDecelerationFraction
;
133 const bool mbAutoReverse
;
135 // true, if perform() has not yet been called:
136 mutable bool mbFirstPerformCall
;
140 } // namespace internal
141 } // namespace presentation
143 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACTIVITYBASE_HXX
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */