LibreOffice Module slideshow (master) 1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
slideshow::internal::ActivityBase Class Referenceabstract

Base class for animation activities. More...

#include <activitybase.hxx>

Inheritance diagram for slideshow::internal::ActivityBase:
[legend]
Collaboration diagram for slideshow::internal::ActivityBase:
[legend]

Public Member Functions

 ActivityBase (const ActivityParameters &rParms)
 
virtual void dispose () override
 From Disposable interface. More...
 
virtual void setTargets (const AnimatableShapeSharedPtr &rShape, const ShapeAttributeLayerSharedPtr &rAttrLayer)=0
 Sets targets (shape and attributeLayer) More...
 
virtual bool perform ()=0
 Perform the activity associated with this interface's implementation. More...
 
virtual double calcTimeLag () const =0
 Calculates whether the activity lags time. More...
 
virtual bool isActive () const =0
 Query whether this activity is still continuing. More...
 
virtual void dequeued ()=0
 Notifies the Activity that it has now left the ActivitiesQueue. More...
 
virtual void end ()=0
 Forces this activity deactivate and get to its end state (if possible), but does not dispose. More...
 
- Public Member Functions inherited from slideshow::internal::Disposable
virtual ~Disposable ()
 
virtual void dispose ()=0
 Dispose all object references. More...
 
- Public Member Functions inherited from slideshow::internal::SharedPtrAble
virtual ~SharedPtrAble ()
 

Protected Member Functions

virtual bool perform () override
 From Activity interface. More...
 
virtual double calcTimeLag () const override
 Calculates whether the activity lags time. More...
 
virtual bool isActive () const override
 Query whether this activity is still continuing. More...
 
void endActivity ()
 End this activity, in a regular way. More...
 
double calcAcceleratedTime (double nT) const
 Modify fractional time. More...
 
bool isDisposed () const
 
EventQueuegetEventQueue () const
 
const AnimatableShapeSharedPtrgetShape () const
 
const ShapeAttributeLayerSharedPtrgetShapeAttributeLayer () const
 
bool isRepeatCountValid () const
 
double getRepeatCount () const
 
bool isAutoReverse () const
 

Private Member Functions

virtual void dequeued () override
 Notifies the Activity that it has now left the ActivitiesQueue. More...
 
virtual void setTargets (const AnimatableShapeSharedPtr &rShape, const ShapeAttributeLayerSharedPtr &rAttrLayer) override
 Sets targets (shape and attributeLayer) More...
 
virtual void startAnimation ()=0
 Hook for derived classes. More...
 
virtual void endAnimation ()=0
 Hook for derived classes. More...
 
virtual void end () override
 Activity: More...
 
virtual void performEnd ()=0
 

Private Attributes

EventSharedPtr mpEndEvent
 
EventQueuemrEventQueue
 
AnimatableShapeSharedPtr mpShape
 
ShapeAttributeLayerSharedPtr mpAttributeLayer
 
::std::optional< double > const maRepeats
 
const double mnAccelerationFraction
 
const double mnDecelerationFraction
 
const bool mbAutoReverse
 
bool mbFirstPerformCall
 
bool mbIsActive
 

Detailed Description

Base class for animation activities.

This whole class hierarchy is only for code sharing between the various specializations (with or without key times, fully discrete, etc.).

Definition at line 36 of file activitybase.hxx.

Constructor & Destructor Documentation

◆ ActivityBase()

slideshow::internal::ActivityBase::ActivityBase ( const ActivityParameters rParms)
explicit

Definition at line 34 of file activitybase.cxx.

References mbAutoReverse.

Member Function Documentation

◆ calcAcceleratedTime()

double slideshow::internal::ActivityBase::calcAcceleratedTime ( double  nT) const
protected

Modify fractional time.

This method modifies the fractional time (total duration mapped to the [0,1] range) to the effective simple time, but only according to acceleration/deceleration.

Definition at line 143 of file activitybase.cxx.

References clamp(), mnAccelerationFraction, and mnDecelerationFraction.

Referenced by slideshow::internal::DiscreteActivityBase::perform(), slideshow::internal::ContinuousActivityBase::simplePerform(), and slideshow::internal::ContinuousKeyTimeActivityBase::simplePerform().

◆ calcTimeLag()

double slideshow::internal::ActivityBase::calcTimeLag ( ) const
overrideprotectedvirtual

Calculates whether the activity lags time.

If this method returns a time lag greater than 0.0, the ActivitiesQueue will adjust the global slideshow time, by subtracting the given amount of lag.

Returns
time lag or 0.0. Value must be greater or equal than zero.

Implements slideshow::internal::Activity.

Reimplemented in slideshow::internal::SimpleContinuousActivityBase.

Definition at line 61 of file activitybase.cxx.

References isActive(), mbFirstPerformCall, and startAnimation().

Referenced by slideshow::internal::SimpleContinuousActivityBase::calcTimeLag().

◆ dequeued()

void slideshow::internal::ActivityBase::dequeued ( )
overrideprivatevirtual

Notifies the Activity that it has now left the ActivitiesQueue.

Use this method to react on the queue removal event. For animated shapes, this is e.g. used to switch back to the non-sprite presentation mode of the shape.

Implements slideshow::internal::Activity.

Definition at line 116 of file activitybase.cxx.

References endAnimation(), and isActive().

◆ dispose()

void slideshow::internal::ActivityBase::dispose ( void  )
overridevirtual

◆ end()

void slideshow::internal::ActivityBase::end ( )
overrideprivatevirtual

◆ endActivity()

void slideshow::internal::ActivityBase::endActivity ( )
protected

End this activity, in a regular way.

This method is for derived classes needing to signal a regular activity end (i.e. because the regular duration is over)

Definition at line 103 of file activitybase.cxx.

References slideshow::internal::EventQueue::addEvent(), mbIsActive, mpEndEvent, and mrEventQueue.

Referenced by end(), slideshow::internal::DiscreteActivityBase::perform(), and slideshow::internal::SimpleContinuousActivityBase::perform().

◆ endAnimation()

virtual void slideshow::internal::ActivityBase::endAnimation ( )
privatepure virtual

Hook for derived classes.

This method will be called after the last perform() invocation, and after the potential changes of that perform() call are committed to screen. That is, in endAnimation(), the animation objects (sprites, animation) can safely be destroyed, without causing visible artifacts on screen.

Referenced by dequeued(), and end().

◆ getEventQueue()

EventQueue & slideshow::internal::ActivityBase::getEventQueue ( ) const
inlineprotected

Definition at line 106 of file activitybase.hxx.

References mrEventQueue.

Referenced by slideshow::internal::DiscreteActivityBase::perform().

◆ getRepeatCount()

double slideshow::internal::ActivityBase::getRepeatCount ( ) const
inlineprotected

◆ getShape()

const AnimatableShapeSharedPtr & slideshow::internal::ActivityBase::getShape ( ) const
inlineprotected

Definition at line 108 of file activitybase.hxx.

References mpShape.

◆ getShapeAttributeLayer()

const ShapeAttributeLayerSharedPtr & slideshow::internal::ActivityBase::getShapeAttributeLayer ( ) const
inlineprotected

Definition at line 110 of file activitybase.hxx.

References mpAttributeLayer.

◆ isActive()

bool slideshow::internal::ActivityBase::isActive ( ) const
overrideprotectedvirtual

Query whether this activity is still continuing.

Returns
true, if this activity still continues. Returns false, if activity has ended. It is required that operator() returns false, when isActive() returns false. Furthermore, it is required that the inactive state is persistent; an activity that has become inactive (i.e. isActive() once returned false) must stay in that state eternally.

Implements slideshow::internal::Activity.

Definition at line 86 of file activitybase.cxx.

References mbIsActive.

Referenced by calcTimeLag(), slideshow::internal::SimpleContinuousActivityBase::calcTimeLag(), dequeued(), end(), perform(), and slideshow::internal::SimpleContinuousActivityBase::perform().

◆ isAutoReverse()

bool slideshow::internal::ActivityBase::isAutoReverse ( ) const
inlineprotected

◆ isDisposed()

bool slideshow::internal::ActivityBase::isDisposed ( ) const
inlineprotected

Definition at line 101 of file activitybase.hxx.

References mbIsActive, mpAttributeLayer, mpEndEvent, and mpShape.

Referenced by end().

◆ isRepeatCountValid()

bool slideshow::internal::ActivityBase::isRepeatCountValid ( ) const
inlineprotected

◆ perform()

bool slideshow::internal::ActivityBase::perform ( )
overrideprotectedvirtual

◆ performEnd()

virtual void slideshow::internal::ActivityBase::performEnd ( )
privatepure virtual

Referenced by end().

◆ setTargets()

void slideshow::internal::ActivityBase::setTargets ( const AnimatableShapeSharedPtr rShape,
const ShapeAttributeLayerSharedPtr rAttrLayer 
)
overrideprivatevirtual

Sets targets (shape and attributeLayer)

Since attribute layers can only be generated when the animation starts, the Activity owner must be able to pass it into the Activity after initial creation. The same applies to the actual shape the animation must run for, since e.g. subsetted shapes are generated close before the animation starts, too (this is not necessary in and out of itself, but for performance reasons. Otherwise, character iterations produce tons of subset shapes).

Parameters
rShapeShape to play the animation on.
rAttrLayerAttribute layer to change the animated values on.

Implements slideshow::internal::AnimationActivity.

Definition at line 91 of file activitybase.cxx.

References ENSURE_OR_THROW, mpAttributeLayer, and mpShape.

◆ startAnimation()

virtual void slideshow::internal::ActivityBase::startAnimation ( )
privatepure virtual

Hook for derived classes.

This method will be called from the first perform() invocation, to signal the start of the activity.

Implemented in slideshow::internal::DiscreteActivityBase, and slideshow::internal::SimpleContinuousActivityBase.

Referenced by calcTimeLag(), and end().

Member Data Documentation

◆ maRepeats

::std::optional<double> const slideshow::internal::ActivityBase::maRepeats
private

Definition at line 128 of file activitybase.hxx.

Referenced by getRepeatCount(), and isRepeatCountValid().

◆ mbAutoReverse

const bool slideshow::internal::ActivityBase::mbAutoReverse
private

Definition at line 132 of file activitybase.hxx.

Referenced by isAutoReverse().

◆ mbFirstPerformCall

bool slideshow::internal::ActivityBase::mbFirstPerformCall
mutableprivate

Definition at line 135 of file activitybase.hxx.

Referenced by calcTimeLag(), end(), and perform().

◆ mbIsActive

bool slideshow::internal::ActivityBase::mbIsActive
private

Definition at line 136 of file activitybase.hxx.

Referenced by dispose(), endActivity(), isActive(), and isDisposed().

◆ mnAccelerationFraction

const double slideshow::internal::ActivityBase::mnAccelerationFraction
private

Definition at line 129 of file activitybase.hxx.

Referenced by calcAcceleratedTime().

◆ mnDecelerationFraction

const double slideshow::internal::ActivityBase::mnDecelerationFraction
private

Definition at line 130 of file activitybase.hxx.

Referenced by calcAcceleratedTime().

◆ mpAttributeLayer

ShapeAttributeLayerSharedPtr slideshow::internal::ActivityBase::mpAttributeLayer
private

Definition at line 126 of file activitybase.hxx.

Referenced by dispose(), getShapeAttributeLayer(), isDisposed(), and setTargets().

◆ mpEndEvent

EventSharedPtr slideshow::internal::ActivityBase::mpEndEvent
private

Definition at line 123 of file activitybase.hxx.

Referenced by dispose(), endActivity(), and isDisposed().

◆ mpShape

AnimatableShapeSharedPtr slideshow::internal::ActivityBase::mpShape
private

Definition at line 125 of file activitybase.hxx.

Referenced by dispose(), getShape(), isDisposed(), and setTargets().

◆ mrEventQueue

EventQueue& slideshow::internal::ActivityBase::mrEventQueue
private

Definition at line 124 of file activitybase.hxx.

Referenced by endActivity(), and getEventQueue().


The documentation for this class was generated from the following files: