LibreOffice Module slideshow (master) 1
activitybase.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACTIVITYBASE_HXX
21#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACTIVITYBASE_HXX
22
23#include <animationactivity.hxx>
25#include <animatableshape.hxx>
27
28namespace slideshow::internal {
29
37{
38public:
39 explicit ActivityBase( const ActivityParameters& rParms );
40
42 virtual void dispose() override;
43
44protected:
50 virtual bool perform() override;
51 virtual double calcTimeLag() const override;
52 virtual bool isActive() const override;
53
54private:
55 virtual void dequeued() override;
56
57 // From AnimationActivity interface
58 virtual void setTargets(
59 const AnimatableShapeSharedPtr& rShape,
60 const ShapeAttributeLayerSharedPtr& rAttrLayer ) override;
61
62private:
69 virtual void startAnimation() = 0;
70
80 virtual void endAnimation() = 0;
81
82protected:
83
90 void endActivity();
91
99 double calcAcceleratedTime( double nT ) const;
100
101 bool isDisposed() const {
102 return (!mbIsActive && !mpEndEvent && !mpShape &&
104 }
105
107
108 const AnimatableShapeSharedPtr& getShape() const { return mpShape; }
109
111 { return mpAttributeLayer; }
112
113 bool isRepeatCountValid() const { return bool(maRepeats); }
114 double getRepeatCount() const { return *maRepeats; }
115 bool isAutoReverse() const { return mbAutoReverse; }
116
117private:
119 virtual void end() override;
120 virtual void performEnd() = 0;
121
122private:
125 AnimatableShapeSharedPtr mpShape; // only to pass on to animation
127
128 ::std::optional<double> const maRepeats;
131
132 const bool mbAutoReverse;
133
134 // true, if perform() has not yet been called:
135 mutable bool mbFirstPerformCall;
137};
138
139} // namespace presentation::internal
140
141#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACTIVITYBASE_HXX
142
143/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Base class for animation activities.
virtual void end() override
Activity:
virtual bool perform() override
From Activity interface.
virtual void setTargets(const AnimatableShapeSharedPtr &rShape, const ShapeAttributeLayerSharedPtr &rAttrLayer) override
Sets targets (shape and attributeLayer)
EventQueue & getEventQueue() const
AnimatableShapeSharedPtr mpShape
const AnimatableShapeSharedPtr & getShape() const
virtual bool isActive() const override
Query whether this activity is still continuing.
const ShapeAttributeLayerSharedPtr & getShapeAttributeLayer() const
::std::optional< double > const maRepeats
virtual void endAnimation()=0
Hook for derived classes.
virtual void dispose() override
From Disposable interface.
virtual double calcTimeLag() const override
Calculates whether the activity lags time.
void endActivity()
End this activity, in a regular way.
ActivityBase(const ActivityParameters &rParms)
virtual void startAnimation()=0
Hook for derived classes.
virtual void dequeued() override
Notifies the Activity that it has now left the ActivitiesQueue.
double calcAcceleratedTime(double nT) const
Modify fractional time.
ShapeAttributeLayerSharedPtr mpAttributeLayer
Extends the Activity interface with animation-specific functions.
This class handles events in a presentation.
Definition: eventqueue.hxx:41
::std::shared_ptr< AnimatableShape > AnimatableShapeSharedPtr
::std::shared_ptr< ShapeAttributeLayer > ShapeAttributeLayerSharedPtr
::std::shared_ptr< Event > EventSharedPtr
Definition: event.hxx:76
Parameter struct for animation activities.