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 .
21 #include <comphelper/diagnose_ex.hxx>
23 #include <com/sun/star/animations/AnimationCalcMode.hpp>
24 #include <comphelper/sequence.hxx>
26 #include <activitiesfactory.hxx>
27 #include <slideshowexceptions.hxx>
28 #include <smilfunctionparser.hxx>
29 #include "accumulation.hxx"
30 #include "activityparameters.hxx"
31 #include "interpolation.hxx"
33 #include "simplecontinuousactivitybase.hxx"
34 #include "discreteactivitybase.hxx"
35 #include "continuousactivitybase.hxx"
36 #include "continuouskeytimeactivitybase.hxx"
45 using namespace com::sun::star
;
47 namespace slideshow::internal
{
51 /** Traits template, to take formula application only for ValueType = double
53 template<typename ValueType
> struct FormulaTraits
55 static ValueType
getPresentationValue(
56 const ValueType
& rVal
, const std::shared_ptr
<ExpressionNode
>& )
62 /// Specialization for ValueType = double
63 template<> struct FormulaTraits
<double>
65 static double getPresentationValue(
66 double const& rVal
, std::shared_ptr
<ExpressionNode
> const& rFormula
)
68 return rFormula
? (*rFormula
)(rVal
) : rVal
;
72 // Various ActivityBase specializations for different animator types
73 // =================================================================
77 Provides the Activity specializations for FromToBy
78 animations (e.g. those without a values list).
80 This template makes heavy use of SFINAE, only one of
81 the perform*() methods will compile for each of the
84 Note that we omit the virtual keyword on the perform()
85 overrides on purpose; those that actually do override
86 baseclass virtual methods inherit the property, and
87 the others won't increase our vtable. What's more,
88 having all perform() method in the vtable actually
89 creates POIs for them, which breaks the whole SFINAE
90 concept (IOW, this template won't compile any longer).
93 Base class to use for this activity. Only
94 ContinuousActivityBase and DiscreteActivityBase are
98 Type of the Animation to call.
100 template<class BaseType
, typename AnimationType
>
101 class FromToByActivity
: public BaseType
104 typedef typename
AnimationType::ValueType ValueType
;
105 typedef std::optional
<ValueType
> OptionalValueType
;
108 // some compilers don't inline whose definition they haven't
109 // seen before the call site...
110 ValueType
getPresentationValue( const ValueType
& rVal
) const
112 return FormulaTraits
<ValueType
>::getPresentationValue( rVal
, mpFormula
);
116 /** Create FromToByActivity.
119 From this value, the animation starts
122 With this value, the animation ends
125 With this value, the animation increments the start value
128 Standard Activity parameter struct
131 Shared ptr to AnimationType
134 Interpolator object to be used for lerping between
135 start and end value (need to be passed, since it
136 might contain state, e.g. interpolation direction
137 for HSL color space).
140 Whether repeated animations should cumulate the
141 value, or start fresh each time.
144 OptionalValueType aFrom
,
145 const OptionalValueType
& rTo
,
146 const OptionalValueType
& rBy
,
147 const ActivityParameters
& rParms
,
148 ::std::shared_ptr
< AnimationType
> xAnim
,
149 const Interpolator
< ValueType
>& rInterpolator
,
151 : BaseType( rParms
),
152 maFrom(std::move( aFrom
)),
155 mpFormula( rParms
.mpFormula
),
159 maStartInterpolationValue(),
161 mpAnim(std::move( xAnim
)),
162 maInterpolator( rInterpolator
),
163 mbDynamicStartValue( false ),
164 mbCumulative( bCumulative
)
166 ENSURE_OR_THROW( mpAnim
, "Invalid animation object" );
170 "From and one of To or By, or To or By alone must be valid" );
173 virtual void startAnimation()
175 if (this->isDisposed() || !mpAnim
)
177 BaseType::startAnimation();
180 mpAnim
->start( BaseType::getShape(),
181 BaseType::getShapeAttributeLayer() );
183 // setup start and end value. Determine animation
184 // start value only when animation actually
185 // started up (this order is part of the Animation
186 // interface contract)
187 const ValueType
aAnimationStartValue( mpAnim
->getUnderlyingValue() );
189 // first of all, determine general type of
190 // animation, by inspecting which of the FromToBy values
191 // are actually valid.
192 // See http://www.w3.org/TR/smil20/animation.html#AnimationNS-FromToBy
196 // From-to or From-by animation. According to
197 // SMIL spec, the To value takes precedence
198 // over the By value, if both are specified
202 maStartValue
= *maFrom
;
208 maStartValue
= *maFrom
;
209 maEndValue
= maStartValue
+ *maBy
;
211 maStartInterpolationValue
= maStartValue
;
215 maStartValue
= aAnimationStartValue
;
216 maStartInterpolationValue
= maStartValue
;
218 // By or To animation. According to SMIL spec,
219 // the To value takes precedence over the By
220 // value, if both are specified
225 // According to the SMIL spec
226 // (http://www.w3.org/TR/smil20/animation.html#animationNS-ToAnimation),
227 // the to animation interpolates between
228 // the _running_ underlying value and the to value (as the end value)
229 mbDynamicStartValue
= true;
230 maPreviousValue
= maStartValue
;
236 maStartValue
= aAnimationStartValue
;
237 maEndValue
= maStartValue
+ *maBy
;
242 virtual void endAnimation()
249 /// perform override for ContinuousActivityBase
250 void perform( double nModifiedTime
, sal_uInt32 nRepeatCount
) const
252 if (this->isDisposed() || !mpAnim
)
255 // According to SMIL 3.0 spec 'to' animation if no other (lower priority)
256 // animations are active or frozen then a simple interpolation is performed.
257 // That is, the start interpolation value is constant while the animation
258 // is running, and is equal to the underlying value retrieved when
259 // the animation start.
260 // However if another animation is manipulating the underlying value,
261 // the 'to' animation will initially add to the effect of the lower priority
262 // animation, and increasingly dominate it as it nears the end of the
263 // simple duration, eventually overriding it completely.
264 // That is, each time the underlying value is changed between two
265 // computations of the animation function the new underlying value is used
266 // as start value for the interpolation.
268 // http://www.w3.org/TR/SMIL3/smil-animation.html#animationNS-ToAnimation
269 // (Figure 6 - Effect of Additive to animation example)
270 // Moreover when a 'to' animation is repeated, at each new iteration
271 // the start interpolation value is reset to the underlying value
272 // of the animated property when the animation started,
273 // as it is shown in the example provided by the SMIL 3.0 spec.
274 // This is exactly as Firefox performs SVG 'to' animations.
275 if( mbDynamicStartValue
)
277 if( mnIteration
!= nRepeatCount
)
279 mnIteration
= nRepeatCount
;
280 maStartInterpolationValue
= maStartValue
;
284 ValueType aActualValue
= mpAnim
->getUnderlyingValue();
285 if( aActualValue
!= maPreviousValue
)
286 maStartInterpolationValue
= aActualValue
;
290 ValueType aValue
= maInterpolator( maStartInterpolationValue
,
291 maEndValue
, nModifiedTime
);
293 // According to the SMIL spec:
294 // Because 'to' animation is defined in terms of absolute values of
295 // the target attribute, cumulative animation is not defined.
296 if( mbCumulative
&& !mbDynamicStartValue
)
298 // aValue = this.aEndValue * nRepeatCount + aValue;
299 aValue
= accumulate( maEndValue
, nRepeatCount
, aValue
);
302 (*mpAnim
)( getPresentationValue( aValue
) );
304 if( mbDynamicStartValue
)
306 maPreviousValue
= mpAnim
->getUnderlyingValue();
311 using BaseType::perform
;
313 /// perform override for DiscreteActivityBase base
314 void perform( sal_uInt32 nFrame
, sal_uInt32 nRepeatCount
) const
316 if (this->isDisposed() || !mpAnim
)
319 getPresentationValue(
320 accumulate( maEndValue
, mbCumulative
? nRepeatCount
: 0,
321 lerp( maInterpolator
,
323 ? mpAnim
->getUnderlyingValue()
327 BaseType::getNumberOfKeyTimes() ) ) ) );
330 using BaseType::isAutoReverse
;
332 virtual void performEnd()
334 // xxx todo: good guess
338 (*mpAnim
)( getPresentationValue( maStartValue
) );
340 (*mpAnim
)( getPresentationValue( maEndValue
) );
345 virtual void dispose()
352 const OptionalValueType maFrom
;
353 const OptionalValueType maTo
;
354 const OptionalValueType maBy
;
356 std::shared_ptr
<ExpressionNode
> mpFormula
;
358 ValueType maStartValue
;
359 ValueType maEndValue
;
361 mutable ValueType maPreviousValue
;
362 mutable ValueType maStartInterpolationValue
;
363 mutable sal_uInt32 mnIteration
;
365 ::std::shared_ptr
< AnimationType
> mpAnim
;
366 Interpolator
< ValueType
> maInterpolator
;
367 bool mbDynamicStartValue
;
372 /** Generate Activity corresponding to given FromToBy values
375 BaseType to use for deriving the Activity from
378 Subtype of the Animation object (e.g. NumberAnimation)
380 template<class BaseType
, typename AnimationType
>
381 AnimationActivitySharedPtr
createFromToByActivity(
382 const uno::Any
& rFromAny
,
383 const uno::Any
& rToAny
,
384 const uno::Any
& rByAny
,
385 const ActivityParameters
& rParms
,
386 const ::std::shared_ptr
< AnimationType
>& rAnim
,
387 const Interpolator
< typename
AnimationType::ValueType
>& rInterpolator
,
389 const ShapeSharedPtr
& rShape
,
390 const ::basegfx::B2DVector
& rSlideBounds
)
392 typedef typename
AnimationType::ValueType ValueType
;
393 typedef std::optional
<ValueType
> OptionalValueType
;
395 OptionalValueType aFrom
;
396 OptionalValueType aTo
;
397 OptionalValueType aBy
;
401 if( rFromAny
.hasValue() )
404 extractValue( aTmpValue
, rFromAny
, rShape
, rSlideBounds
),
405 "createFromToByActivity(): Could not extract from value" );
408 if( rToAny
.hasValue() )
411 extractValue( aTmpValue
, rToAny
, rShape
, rSlideBounds
),
412 "createFromToByActivity(): Could not extract to value" );
415 if( rByAny
.hasValue() )
418 extractValue( aTmpValue
, rByAny
, rShape
, rSlideBounds
),
419 "createFromToByActivity(): Could not extract by value" );
423 return std::make_shared
<FromToByActivity
<BaseType
, AnimationType
>>(
433 /* The following table shows which animator combines with
439 StringAnimation: DiscreteActivityBase
440 BoolAnimation: DiscreteActivityBase
445 Provides the Activity specializations for value lists
448 This template makes heavy use of SFINAE, only one of
449 the perform*() methods will compile for each of the
452 Note that we omit the virtual keyword on the perform()
453 overrides on purpose; those that actually do override
454 baseclass virtual methods inherit the property, and
455 the others won't increase our vtable. What's more,
456 having all perform() method in the vtable actually
457 creates POIs for them, which breaks the whole SFINAE
458 concept (IOW, this template won't compile any longer).
461 Base class to use for this activity. Only
462 ContinuousKeyTimeActivityBase and DiscreteActivityBase
463 are supported here. For values animation without key
464 times, the client must emulate key times by providing
465 a vector of equally spaced values between 0 and 1,
466 with the same number of entries as the values vector.
469 Type of the Animation to call.
471 template<class BaseType
, typename AnimationType
>
472 class ValuesActivity
: public BaseType
475 typedef typename
AnimationType::ValueType ValueType
;
476 typedef std::vector
<ValueType
> ValueVectorType
;
479 // some compilers don't inline methods whose definition they haven't
480 // seen before the call site...
481 ValueType
getPresentationValue( const ValueType
& rVal
) const
483 return FormulaTraits
<ValueType
>::getPresentationValue(
488 /** Create ValuesActivity.
491 Value vector to cycle animation through
494 Standard Activity parameter struct
497 Shared ptr to AnimationType
500 Interpolator object to be used for lerping between
501 start and end value (need to be passed, since it
502 might contain state, e.g. interpolation direction
503 for HSL color space).
506 Whether repeated animations should cumulate the
507 value, or start afresh each time.
510 const ValueVectorType
& rValues
,
511 const ActivityParameters
& rParms
,
512 std::shared_ptr
<AnimationType
> xAnim
,
513 const Interpolator
< ValueType
>& rInterpolator
,
515 : BaseType( rParms
),
517 mpFormula( rParms
.mpFormula
),
518 mpAnim(std::move( xAnim
)),
519 maInterpolator( rInterpolator
),
520 mbCumulative( bCumulative
)
522 ENSURE_OR_THROW( mpAnim
, "Invalid animation object" );
523 ENSURE_OR_THROW( !rValues
.empty(), "Empty value vector" );
526 virtual void startAnimation()
528 if (this->isDisposed() || !mpAnim
)
530 BaseType::startAnimation();
533 mpAnim
->start( BaseType::getShape(),
534 BaseType::getShapeAttributeLayer() );
537 virtual void endAnimation()
544 /// perform override for ContinuousKeyTimeActivityBase base
545 void perform( sal_uInt32 nIndex
,
546 double nFractionalIndex
,
547 sal_uInt32 nRepeatCount
) const
549 if (this->isDisposed() || !mpAnim
)
551 ENSURE_OR_THROW( nIndex
+1 < maValues
.size(),
552 "ValuesActivity::perform(): index out of range" );
554 // interpolate between nIndex and nIndex+1 values
556 getPresentationValue(
557 accumulate
<ValueType
>( maValues
.back(),
558 mbCumulative
? nRepeatCount
: 0,
559 maInterpolator( maValues
[ nIndex
],
560 maValues
[ nIndex
+1 ],
561 nFractionalIndex
) ) ) );
564 using BaseType::perform
;
566 /// perform override for DiscreteActivityBase base
567 void perform( sal_uInt32 nFrame
, sal_uInt32 nRepeatCount
) const
569 if (this->isDisposed() || !mpAnim
)
571 ENSURE_OR_THROW( nFrame
< maValues
.size(),
572 "ValuesActivity::perform(): index out of range" );
574 // this is discrete, thus no lerp here.
576 getPresentationValue(
577 slideshow::internal::accumulate
<ValueType
>( maValues
.back(),
578 mbCumulative
? nRepeatCount
: 0,
579 maValues
[ nFrame
] ) ) );
582 virtual void performEnd()
584 // xxx todo: good guess
586 (*mpAnim
)( getPresentationValue( maValues
.back() ) );
590 ValueVectorType maValues
;
592 std::shared_ptr
<ExpressionNode
> mpFormula
;
594 std::shared_ptr
<AnimationType
> mpAnim
;
595 Interpolator
< ValueType
> maInterpolator
;
599 /** Generate Activity corresponding to given Value vector
602 BaseType to use for deriving the Activity from
605 Subtype of the Animation object (e.g. NumberAnimation)
607 template<class BaseType
, typename AnimationType
>
608 AnimationActivitySharedPtr
createValueListActivity(
609 const uno::Sequence
<uno::Any
>& rValues
,
610 const ActivityParameters
& rParms
,
611 const std::shared_ptr
<AnimationType
>& rAnim
,
612 const Interpolator
<typename
AnimationType::ValueType
>& rInterpolator
,
614 const ShapeSharedPtr
& rShape
,
615 const ::basegfx::B2DVector
& rSlideBounds
)
617 typedef typename
AnimationType::ValueType ValueType
;
618 typedef std::vector
<ValueType
> ValueVectorType
;
620 ValueVectorType aValueVector
;
621 aValueVector
.reserve( rValues
.getLength() );
623 for( const auto& rValue
: rValues
)
627 extractValue( aValue
, rValue
, rShape
, rSlideBounds
),
628 "createValueListActivity(): Could not extract values" );
629 aValueVector
.push_back( aValue
);
632 return std::make_shared
<ValuesActivity
<BaseType
, AnimationType
>>(
640 /** Generate Activity for given XAnimate, corresponding to given Value vector
643 Subtype of the Animation object (e.g. NumberAnimation)
646 Common activity parameters
649 XAnimate node, to retrieve animation values from
652 Actual animation to operate with (gets called with the
653 time-dependent values)
656 Interpolator object to be used for lerping between
657 start and end values (need to be passed, since it
658 might contain state, e.g. interpolation direction
659 for HSL color space).
661 template<typename AnimationType
>
662 AnimationActivitySharedPtr
createActivity(
663 const ActivitiesFactory::CommonParameters
& rParms
,
664 const uno::Reference
< animations::XAnimate
>& xNode
,
665 const ::std::shared_ptr
< AnimationType
>& rAnim
,
666 const Interpolator
< typename
AnimationType::ValueType
>& rInterpolator
667 = Interpolator
< typename
AnimationType::ValueType
>() )
669 // setup common parameters
670 // =======================
672 ActivityParameters
aActivityParms( rParms
.mpEndEvent
,
674 rParms
.mrActivitiesQueue
,
675 rParms
.mnMinDuration
,
677 rParms
.mnAcceleration
,
678 rParms
.mnDeceleration
,
679 rParms
.mnMinNumberOfFrames
,
680 rParms
.mbAutoReverse
);
682 // is a formula given?
683 const OUString
& rFormulaString( xNode
->getFormula() );
684 if( !rFormulaString
.isEmpty() )
686 // yep, parse and pass to ActivityParameters
689 aActivityParms
.mpFormula
=
690 SmilFunctionParser::parseSmilFunction(
692 calcRelativeShapeBounds(
693 rParms
.maSlideBounds
,
694 rParms
.mpShape
->getBounds() ) );
698 // parse error, thus no formula
699 OSL_FAIL( "createActivity(): Error parsing formula string" );
703 // are key times given?
704 const uno::Sequence
< double >& aKeyTimes( xNode
->getKeyTimes() );
705 if( aKeyTimes
.hasElements() )
707 // yes, convert them from Sequence< double >
708 aActivityParms
.maDiscreteTimes
.resize( aKeyTimes
.getLength() );
709 comphelper::sequenceToArray(
710 aActivityParms
.maDiscreteTimes
.data(),
711 aKeyTimes
); // saves us some temporary vectors
714 // values sequence given?
715 const sal_Int32
nValueLen( xNode
->getValues().getLength() );
718 // Value list activity
719 // ===================
721 // fake keytimes, if necessary
722 if( !aKeyTimes
.hasElements() )
724 // create a dummy vector of key times,
725 // with aValues.getLength equally spaced entries.
726 for( sal_Int32 i
=0; i
<nValueLen
; ++i
)
727 aActivityParms
.maDiscreteTimes
.push_back( double(i
)/nValueLen
);
730 // determine type of animation needed here:
731 // Value list activities are possible with
732 // ContinuousKeyTimeActivityBase and DiscreteActivityBase
734 const sal_Int16
nCalcMode( xNode
->getCalcMode() );
738 case animations::AnimationCalcMode::DISCRETE
:
740 // since DiscreteActivityBase suspends itself
741 // between the frames, create a WakeupEvent for it.
742 aActivityParms
.mpWakeupEvent
=
743 std::make_shared
<WakeupEvent
>(
744 rParms
.mrEventQueue
.getTimer(),
745 rParms
.mrActivitiesQueue
);
747 AnimationActivitySharedPtr
pActivity(
748 createValueListActivity
< DiscreteActivityBase
>(
753 xNode
->getAccumulate(),
755 rParms
.maSlideBounds
) );
757 // WakeupEvent and DiscreteActivityBase need circular
758 // references to the corresponding other object.
759 aActivityParms
.mpWakeupEvent
->setActivity( pActivity
);
765 OSL_FAIL( "createActivity(): unexpected case" );
767 case animations::AnimationCalcMode::PACED
:
768 case animations::AnimationCalcMode::SPLINE
:
769 case animations::AnimationCalcMode::LINEAR
:
770 return createValueListActivity
< ContinuousKeyTimeActivityBase
>(
775 xNode
->getAccumulate(),
777 rParms
.maSlideBounds
);
785 // determine type of animation needed here:
786 // FromToBy activities are possible with
787 // ContinuousActivityBase and DiscreteActivityBase
789 const sal_Int16
nCalcMode( xNode
->getCalcMode() );
793 case animations::AnimationCalcMode::DISCRETE
:
795 // fake keytimes, if necessary
796 if( !aKeyTimes
.hasElements() )
798 // create a dummy vector of 2 key times
799 const ::std::size_t nLen( 2 );
800 for( ::std::size_t i
=0; i
<nLen
; ++i
)
801 aActivityParms
.maDiscreteTimes
.push_back( double(i
)/nLen
);
804 // since DiscreteActivityBase suspends itself
805 // between the frames, create a WakeupEvent for it.
806 aActivityParms
.mpWakeupEvent
=
807 std::make_shared
<WakeupEvent
>(
808 rParms
.mrEventQueue
.getTimer(),
809 rParms
.mrActivitiesQueue
);
811 AnimationActivitySharedPtr
pActivity(
812 createFromToByActivity
< DiscreteActivityBase
>(
819 xNode
->getAccumulate(),
821 rParms
.maSlideBounds
) );
823 // WakeupEvent and DiscreteActivityBase need circular
824 // references to the corresponding other object.
825 aActivityParms
.mpWakeupEvent
->setActivity( pActivity
);
831 OSL_FAIL( "createActivity(): unexpected case" );
833 case animations::AnimationCalcMode::PACED
:
834 case animations::AnimationCalcMode::SPLINE
:
835 case animations::AnimationCalcMode::LINEAR
:
836 return createFromToByActivity
< ContinuousActivityBase
>(
843 xNode
->getAccumulate(),
845 rParms
.maSlideBounds
);
850 /** Simple activity for ActivitiesFactory::createSimpleActivity
853 Determines direction of value generator. A 1 yields a
854 forward direction, starting with 0.0 and ending with
855 1.0. A 0 yields a backward direction, starting with
856 1.0 and ending with 0.0
858 template<int Direction
>
859 class SimpleActivity
: public ContinuousActivityBase
862 /** Create SimpleActivity.
865 Standard Activity parameter struct
867 SimpleActivity( const ActivityParameters
& rParms
,
868 NumberAnimationSharedPtr xAnim
) :
869 ContinuousActivityBase( rParms
),
870 mpAnim(std::move( xAnim
))
872 ENSURE_OR_THROW( mpAnim
, "Invalid animation object" );
875 virtual void startAnimation() override
877 if (this->isDisposed() || !mpAnim
)
879 ContinuousActivityBase::startAnimation();
882 mpAnim
->start( getShape(),
883 getShapeAttributeLayer() );
886 virtual void endAnimation() override
893 using SimpleContinuousActivityBase::perform
;
895 /// perform override for ContinuousActivityBase
896 virtual void perform( double nModifiedTime
, sal_uInt32
) const override
898 if (this->isDisposed() || !mpAnim
)
900 // no cumulation, simple [0,1] range
901 (*mpAnim
)( 1.0 - Direction
+ nModifiedTime
*(2.0*Direction
- 1.0) );
904 virtual void performEnd() override
908 (*mpAnim
)( 1.0*Direction
);
912 virtual void dispose() override
915 ContinuousActivityBase::dispose();
919 NumberAnimationSharedPtr mpAnim
;
925 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
926 const CommonParameters
& rParms
,
927 const NumberAnimationSharedPtr
& rAnim
,
928 const uno::Reference
< animations::XAnimate
>& xNode
)
930 // forward to appropriate template instantiation
931 return createActivity( rParms
, xNode
, rAnim
);
934 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
935 const CommonParameters
& rParms
,
936 const EnumAnimationSharedPtr
& rAnim
,
937 const uno::Reference
< animations::XAnimate
>& xNode
)
939 // forward to appropriate template instantiation
940 return createActivity( rParms
, xNode
, rAnim
);
943 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
944 const CommonParameters
& rParms
,
945 const ColorAnimationSharedPtr
& rAnim
,
946 const uno::Reference
< animations::XAnimate
>& xNode
)
948 // forward to appropriate template instantiation
949 return createActivity( rParms
, xNode
, rAnim
);
952 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
953 const CommonParameters
& rParms
,
954 const HSLColorAnimationSharedPtr
& rAnim
,
955 const uno::Reference
< animations::XAnimateColor
>& xNode
)
957 // forward to appropriate template instantiation
958 return createActivity( rParms
,
959 uno::Reference
< animations::XAnimate
>(
960 xNode
, uno::UNO_QUERY_THROW
),
962 // Direction==true means clockwise in SMIL API
963 Interpolator
< HSLColor
>( !xNode
->getDirection() ) );
966 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
967 const CommonParameters
& rParms
,
968 const PairAnimationSharedPtr
& rAnim
,
969 const uno::Reference
< animations::XAnimate
>& xNode
)
971 // forward to appropriate template instantiation
972 return createActivity( rParms
, xNode
, rAnim
);
975 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
976 const CommonParameters
& rParms
,
977 const StringAnimationSharedPtr
& rAnim
,
978 const uno::Reference
< animations::XAnimate
>& xNode
)
980 // forward to appropriate template instantiation
981 return createActivity( rParms
, xNode
, rAnim
);
984 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
985 const CommonParameters
& rParms
,
986 const BoolAnimationSharedPtr
& rAnim
,
987 const uno::Reference
< animations::XAnimate
>& xNode
)
989 // forward to appropriate template instantiation
990 return createActivity( rParms
, xNode
, rAnim
);
993 AnimationActivitySharedPtr
ActivitiesFactory::createSimpleActivity(
994 const CommonParameters
& rParms
,
995 const NumberAnimationSharedPtr
& rAnim
,
996 bool bDirectionForward
)
998 ActivityParameters
aActivityParms( rParms
.mpEndEvent
,
1000 rParms
.mrActivitiesQueue
,
1001 rParms
.mnMinDuration
,
1003 rParms
.mnAcceleration
,
1004 rParms
.mnDeceleration
,
1005 rParms
.mnMinNumberOfFrames
,
1006 rParms
.mbAutoReverse
);
1008 if( bDirectionForward
)
1009 return std::make_shared
<SimpleActivity
<1>>( aActivityParms
, rAnim
);
1011 return std::make_shared
<SimpleActivity
<0>>( aActivityParms
, rAnim
);
1014 } // namespace presentation
1016 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */