1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: activitiesfactory.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_slideshow.hxx"
35 #include <canvas/debug.hxx>
36 #include <tools/diagnose_ex.h>
37 #include <canvas/verbosetrace.hxx>
39 #include <com/sun/star/animations/AnimationCalcMode.hpp>
40 #include <comphelper/sequence.hxx>
42 #include "activitiesfactory.hxx"
43 #include "smilfunctionparser.hxx"
44 #include "accumulation.hxx"
45 #include "activityparameters.hxx"
46 #include "interpolation.hxx"
48 #include "simplecontinuousactivitybase.hxx"
49 #include "discreteactivitybase.hxx"
50 #include "continuousactivitybase.hxx"
51 #include "continuouskeytimeactivitybase.hxx"
53 #include <boost/bind.hpp>
54 #include <boost/optional.hpp>
56 #include <cmath> // for modf
60 using namespace com::sun::star
;
67 /** Traits template, to take formula application only for ValueType = double
69 template<typename ValueType
> struct FormulaTraits
71 static ValueType
getPresentationValue(
72 const ValueType
& rVal
, const ExpressionNodeSharedPtr
& )
78 /// Specialization for ValueType = double
79 template<> struct FormulaTraits
<double>
81 static double getPresentationValue(
82 double const& rVal
, ExpressionNodeSharedPtr
const& rFormula
)
84 return rFormula
? (*rFormula
)(rVal
) : rVal
;
88 // Various ActivityBase specializations for different animator types
89 // =================================================================
93 Provides the Activity specializations for FromToBy
94 animations (e.g. those without a values list).
96 This template makes heavy use of SFINAE, only one of
97 the perform*() methods will compile for each of the
100 Note that we omit the virtual keyword on the perform()
101 overrides on purpose; those that actually do override
102 baseclass virtual methods inherit the property, and
103 the others won't increase our vtable. What's more,
104 having all perform() method in the vtable actually
105 creates POIs for them, which breaks the whole SFINAE
106 concept (IOW, this template won't compile any longer).
109 Base class to use for this activity. Only
110 ContinuousActivityBase and DiscreteActivityBase are
114 Type of the Animation to call.
116 template<class BaseType
, typename AnimationType
>
117 class FromToByActivity
: public BaseType
120 typedef typename
AnimationType::ValueType ValueType
;
121 typedef boost::optional
<ValueType
> OptionalValueType
;
124 // some compilers don't inline whose definition they haven't
125 // seen before the call site...
126 ValueType
getPresentationValue( const ValueType
& rVal
) const
128 return FormulaTraits
<ValueType
>::getPresentationValue( rVal
, mpFormula
);
132 /** Create FromToByActivity.
135 From this value, the animation starts
138 With this value, the animation ends
141 With this value, the animation increments the start value
144 Standard Activity parameter struct
147 Shared ptr to AnimationType
150 Interpolator object to be used for lerping between
151 start and end value (need to be passed, since it
152 might contain state, e.g. interpolation direction
153 for HSL color space).
156 Whether repeated animations should cumulate the
157 value, or start fresh each time.
160 const OptionalValueType
& rFrom
,
161 const OptionalValueType
& rTo
,
162 const OptionalValueType
& rBy
,
163 const ActivityParameters
& rParms
,
164 const ::boost::shared_ptr
< AnimationType
>& rAnim
,
165 const Interpolator
< ValueType
>& rInterpolator
,
167 : BaseType( rParms
),
171 mpFormula( rParms
.mpFormula
),
175 maInterpolator( rInterpolator
),
176 mbDynamicStartValue( false ),
177 mbCumulative( bCumulative
)
179 ENSURE_OR_THROW( mpAnim
, "Invalid animation object" );
183 "From and one of To or By, or To or By alone must be valid" );
186 virtual void startAnimation()
188 if (this->isDisposed() || !mpAnim
)
190 BaseType::startAnimation();
193 mpAnim
->start( BaseType::getShape(),
194 BaseType::getShapeAttributeLayer() );
196 // setup start and end value. Determine animation
197 // start value only when animation actually
198 // started up (this order is part of the Animation
199 // interface contract)
200 const ValueType
aAnimationStartValue( mpAnim
->getUnderlyingValue() );
202 // first of all, determine general type of
203 // animation, by inspecting which of the FromToBy values
204 // are actually valid.
205 // See http://www.w3.org/TR/smil20/animation.html#AnimationNS-FromToBy
209 // From-to or From-by animation. According to
210 // SMIL spec, the To value takes precedence
211 // over the By value, if both are specified
215 maStartValue
= *maFrom
;
221 maStartValue
= *maFrom
;
222 maEndValue
= maStartValue
+ *maBy
;
227 // By or To animation. According to SMIL spec,
228 // the To value takes precedence over the By
229 // value, if both are specified
234 // According to the SMIL spec
235 // (http://www.w3.org/TR/smil20/animation.html#animationNS-ToAnimation),
236 // the to animation interpolates between
237 // the _running_ underlying value and the to value (as the end value)
238 mbDynamicStartValue
= true;
244 maStartValue
= aAnimationStartValue
;
245 maEndValue
= maStartValue
+ *maBy
;
250 virtual void endAnimation()
257 /// perform override for ContinuousActivityBase
258 void perform( double nModifiedTime
, sal_uInt32 nRepeatCount
) const
260 if (this->isDisposed() || !mpAnim
)
263 getPresentationValue(
264 accumulate( maEndValue
,
265 mbCumulative
* nRepeatCount
, // means: mbCumulative ? nRepeatCount : 0,
266 maInterpolator( (mbDynamicStartValue
267 ? mpAnim
->getUnderlyingValue()
270 nModifiedTime
) ) ) );
273 using BaseType::perform
;
275 /// perform override for DiscreteActivityBase base
276 void perform( sal_uInt32 nFrame
, sal_uInt32 nRepeatCount
) const
278 if (this->isDisposed() || !mpAnim
)
281 getPresentationValue(
282 accumulate( maEndValue
, mbCumulative
? nRepeatCount
: 0,
283 lerp( maInterpolator
,
285 ? mpAnim
->getUnderlyingValue()
289 BaseType::getNumberOfKeyTimes() ) ) ) );
292 virtual void performEnd()
294 // xxx todo: good guess
296 (*mpAnim
)( getPresentationValue( maEndValue
) );
300 virtual void dispose()
307 const OptionalValueType maFrom
;
308 const OptionalValueType maTo
;
309 const OptionalValueType maBy
;
311 ExpressionNodeSharedPtr mpFormula
;
313 ValueType maStartValue
;
314 ValueType maEndValue
;
316 ::boost::shared_ptr
< AnimationType
> mpAnim
;
317 Interpolator
< ValueType
> maInterpolator
;
318 bool mbDynamicStartValue
;
323 /** Generate Activity corresponding to given FromToBy values
326 BaseType to use for deriving the Activity from
329 Subtype of the Animation object (e.g. NumberAnimation)
331 template<class BaseType
, typename AnimationType
>
332 AnimationActivitySharedPtr
createFromToByActivity(
333 const uno::Any
& rFromAny
,
334 const uno::Any
& rToAny
,
335 const uno::Any
& rByAny
,
336 const ActivityParameters
& rParms
,
337 const ::boost::shared_ptr
< AnimationType
>& rAnim
,
338 const Interpolator
< typename
AnimationType::ValueType
>& rInterpolator
,
340 const ShapeSharedPtr
& rShape
,
341 const ::basegfx::B2DVector
& rSlideBounds
)
343 typedef typename
AnimationType::ValueType ValueType
;
344 typedef boost::optional
<ValueType
> OptionalValueType
;
346 OptionalValueType aFrom
;
347 OptionalValueType aTo
;
348 OptionalValueType aBy
;
352 if( rFromAny
.hasValue() )
355 extractValue( aTmpValue
, rFromAny
, rShape
, rSlideBounds
),
356 "createFromToByActivity(): Could not extract from value" );
357 aFrom
.reset(aTmpValue
);
359 if( rToAny
.hasValue() )
362 extractValue( aTmpValue
, rToAny
, rShape
, rSlideBounds
),
363 "createFromToByActivity(): Could not extract to value" );
364 aTo
.reset(aTmpValue
);
366 if( rByAny
.hasValue() )
369 extractValue( aTmpValue
, rByAny
, rShape
, rSlideBounds
),
370 "createFromToByActivity(): Could not extract by value" );
371 aBy
.reset(aTmpValue
);
374 return AnimationActivitySharedPtr(
375 new FromToByActivity
<BaseType
, AnimationType
>(
385 /* The following table shows which animator combines with
391 StringAnimation: DiscreteActivityBase
392 BoolAnimation: DiscreteActivityBase
397 Provides the Activity specializations for value lists
400 This template makes heavy use of SFINAE, only one of
401 the perform*() methods will compile for each of the
404 Note that we omit the virtual keyword on the perform()
405 overrides on purpose; those that actually do override
406 baseclass virtual methods inherit the property, and
407 the others won't increase our vtable. What's more,
408 having all perform() method in the vtable actually
409 creates POIs for them, which breaks the whole SFINAE
410 concept (IOW, this template won't compile any longer).
413 Base class to use for this activity. Only
414 ContinuousKeyTimeActivityBase and DiscreteActivityBase
415 are supported here. For values animation without key
416 times, the client must emulate key times by providing
417 a vector of equally spaced values between 0 and 1,
418 with the same number of entries as the values vector.
421 Type of the Animation to call.
423 template<class BaseType
, typename AnimationType
>
424 class ValuesActivity
: public BaseType
427 typedef typename
AnimationType::ValueType ValueType
;
428 typedef std::vector
<ValueType
> ValueVectorType
;
431 // some compilers don't inline methods whose definition they haven't
432 // seen before the call site...
433 ValueType
getPresentationValue( const ValueType
& rVal
) const
435 return FormulaTraits
<ValueType
>::getPresentationValue(
440 /** Create ValuesActivity.
443 Value vector to cycle animation through
446 Standard Activity parameter struct
449 Shared ptr to AnimationType
452 Interpolator object to be used for lerping between
453 start and end value (need to be passed, since it
454 might contain state, e.g. interpolation direction
455 for HSL color space).
458 Whether repeated animations should cumulate the
459 value, or start afresh each time.
462 const ValueVectorType
& rValues
,
463 const ActivityParameters
& rParms
,
464 const boost::shared_ptr
<AnimationType
>& rAnim
,
465 const Interpolator
< ValueType
>& rInterpolator
,
467 : BaseType( rParms
),
469 mpFormula( rParms
.mpFormula
),
471 maInterpolator( rInterpolator
),
472 mbCumulative( bCumulative
)
474 ENSURE_OR_THROW( mpAnim
, "Invalid animation object" );
475 ENSURE_OR_THROW( !rValues
.empty(), "Empty value vector" );
478 virtual void startAnimation()
480 if (this->isDisposed() || !mpAnim
)
482 BaseType::startAnimation();
485 mpAnim
->start( BaseType::getShape(),
486 BaseType::getShapeAttributeLayer() );
489 virtual void endAnimation()
496 /// perform override for ContinuousKeyTimeActivityBase base
497 void perform( sal_uInt32 nIndex
,
498 double nFractionalIndex
,
499 sal_uInt32 nRepeatCount
) const
501 if (this->isDisposed() || !mpAnim
)
503 ENSURE_OR_THROW( nIndex
+1 < maValues
.size(),
504 "ValuesActivity::perform(): index out of range" );
506 // interpolate between nIndex and nIndex+1 values
508 getPresentationValue(
509 accumulate( maValues
.back(),
510 mbCumulative
? nRepeatCount
: 0,
511 maInterpolator( maValues
[ nIndex
],
512 maValues
[ nIndex
+1 ],
513 nFractionalIndex
) ) ) );
516 using BaseType::perform
;
518 /// perform override for DiscreteActivityBase base
519 void perform( sal_uInt32 nFrame
, sal_uInt32 nRepeatCount
) const
521 if (this->isDisposed() || !mpAnim
)
523 ENSURE_OR_THROW( nFrame
< maValues
.size(),
524 "ValuesActivity::perform(): index out of range" );
526 // this is discrete, thus no lerp here.
528 getPresentationValue(
529 accumulate( maValues
.back(),
530 mbCumulative
? nRepeatCount
: 0,
531 maValues
[ nFrame
] ) ) );
534 virtual void performEnd()
536 // xxx todo: good guess
538 (*mpAnim
)( getPresentationValue( maValues
.back() ) );
542 virtual void dispose()
549 ValueVectorType maValues
;
551 ExpressionNodeSharedPtr mpFormula
;
553 boost::shared_ptr
<AnimationType
> mpAnim
;
554 Interpolator
< ValueType
> maInterpolator
;
558 /** Generate Activity corresponding to given Value vector
561 BaseType to use for deriving the Activity from
564 Subtype of the Animation object (e.g. NumberAnimation)
566 template<class BaseType
, typename AnimationType
>
567 AnimationActivitySharedPtr
createValueListActivity(
568 const uno::Sequence
<uno::Any
>& rValues
,
569 const ActivityParameters
& rParms
,
570 const boost::shared_ptr
<AnimationType
>& rAnim
,
571 const Interpolator
<typename
AnimationType::ValueType
>& rInterpolator
,
573 const ShapeSharedPtr
& rShape
,
574 const ::basegfx::B2DVector
& rSlideBounds
)
576 typedef typename
AnimationType::ValueType ValueType
;
577 typedef std::vector
<ValueType
> ValueVectorType
;
579 ValueVectorType aValueVector
;
580 aValueVector
.reserve( rValues
.getLength() );
582 for( ::std::size_t i
=0, nLen
=rValues
.getLength(); i
<nLen
; ++i
)
586 extractValue( aValue
, rValues
[i
], rShape
, rSlideBounds
),
587 "createValueListActivity(): Could not extract values" );
588 aValueVector
.push_back( aValue
);
591 return AnimationActivitySharedPtr(
592 new ValuesActivity
<BaseType
, AnimationType
>(
600 /** Generate Activity for given XAnimate, corresponding to given Value vector
603 Subtype of the Animation object (e.g. NumberAnimation)
606 Common activity parameters
609 XAnimate node, to retrieve animation values from
612 Actual animation to operate with (gets called with the
613 time-dependent values)
616 Interpolator object to be used for lerping between
617 start and end values (need to be passed, since it
618 might contain state, e.g. interpolation direction
619 for HSL color space).
621 template<typename AnimationType
>
622 AnimationActivitySharedPtr
createActivity(
623 const ActivitiesFactory::CommonParameters
& rParms
,
624 const uno::Reference
< animations::XAnimate
>& xNode
,
625 const ::boost::shared_ptr
< AnimationType
>& rAnim
,
626 const Interpolator
< typename
AnimationType::ValueType
>& rInterpolator
627 = Interpolator
< typename
AnimationType::ValueType
>() )
629 // setup common parameters
630 // =======================
632 ActivityParameters
aActivityParms( rParms
.mpEndEvent
,
634 rParms
.mrActivitiesQueue
,
635 rParms
.mnMinDuration
,
637 rParms
.mnAcceleration
,
638 rParms
.mnDeceleration
,
639 rParms
.mnMinNumberOfFrames
,
640 rParms
.mbAutoReverse
);
642 // is a formula given?
643 const ::rtl::OUString
& rFormulaString( xNode
->getFormula() );
644 if( rFormulaString
.getLength() )
646 // yep, parse and pass to ActivityParameters
649 aActivityParms
.mpFormula
=
650 SmilFunctionParser::parseSmilFunction(
652 calcRelativeShapeBounds(
653 rParms
.maSlideBounds
,
654 rParms
.mpShape
->getBounds() ) );
658 // parse error, thus no formula
660 "createActivity(): Error parsing formula string" );
664 // are key times given?
665 const uno::Sequence
< double >& aKeyTimes( xNode
->getKeyTimes() );
666 if( aKeyTimes
.hasElements() )
668 // yes, convert them from Sequence< double >
669 aActivityParms
.maDiscreteTimes
.resize( aKeyTimes
.getLength() );
670 comphelper::sequenceToArray(
671 &aActivityParms
.maDiscreteTimes
[0],
672 aKeyTimes
); // saves us some temporary vectors
675 // values sequence given?
676 const sal_Int32
nValueLen( xNode
->getValues().getLength() );
679 // Value list activity
680 // ===================
682 // fake keytimes, if necessary
683 if( !aKeyTimes
.hasElements() )
685 // create a dummy vector of key times,
686 // with aValues.getLength equally spaced entries.
687 for( sal_Int32 i
=0; i
<nValueLen
; ++i
)
688 aActivityParms
.maDiscreteTimes
.push_back( double(i
)/nValueLen
);
691 // determine type of animation needed here:
692 // Value list activities are possible with
693 // ContinuousKeyTimeActivityBase and DiscreteActivityBase
695 const sal_Int16
nCalcMode( xNode
->getCalcMode() );
699 case animations::AnimationCalcMode::DISCRETE
:
701 // since DiscreteActivityBase suspends itself
702 // between the frames, create a WakeupEvent for it.
703 aActivityParms
.mpWakeupEvent
.reset(
705 rParms
.mrEventQueue
.getTimer(),
706 rParms
.mrActivitiesQueue
) );
708 AnimationActivitySharedPtr
pActivity(
709 createValueListActivity
< DiscreteActivityBase
>(
714 xNode
->getAccumulate(),
716 rParms
.maSlideBounds
) );
718 // WakeupEvent and DiscreteActivityBase need circular
719 // references to the corresponding other object.
720 aActivityParms
.mpWakeupEvent
->setActivity( pActivity
);
726 OSL_ENSURE( false, "createActivity(): unexpected case" );
727 // FALLTHROUGH intended
728 case animations::AnimationCalcMode::PACED
:
729 // FALLTHROUGH intended
730 case animations::AnimationCalcMode::SPLINE
:
731 // FALLTHROUGH intended
732 case animations::AnimationCalcMode::LINEAR
:
733 return createValueListActivity
< ContinuousKeyTimeActivityBase
>(
738 xNode
->getAccumulate(),
740 rParms
.maSlideBounds
);
748 // determine type of animation needed here:
749 // FromToBy activities are possible with
750 // ContinuousActivityBase and DiscreteActivityBase
752 const sal_Int16
nCalcMode( xNode
->getCalcMode() );
756 case animations::AnimationCalcMode::DISCRETE
:
758 // fake keytimes, if necessary
759 if( !aKeyTimes
.hasElements() )
761 // create a dummy vector of 2 key times
762 const ::std::size_t nLen( 2 );
763 for( ::std::size_t i
=0; i
<nLen
; ++i
)
764 aActivityParms
.maDiscreteTimes
.push_back( double(i
)/nLen
);
767 // since DiscreteActivityBase suspends itself
768 // between the frames, create a WakeupEvent for it.
769 aActivityParms
.mpWakeupEvent
.reset(
771 rParms
.mrEventQueue
.getTimer(),
772 rParms
.mrActivitiesQueue
) );
774 AnimationActivitySharedPtr
pActivity(
775 createFromToByActivity
< DiscreteActivityBase
>(
782 xNode
->getAccumulate(),
784 rParms
.maSlideBounds
) );
786 // WakeupEvent and DiscreteActivityBase need circular
787 // references to the corresponding other object.
788 aActivityParms
.mpWakeupEvent
->setActivity( pActivity
);
794 OSL_ENSURE( false, "createActivity(): unexpected case" );
795 // FALLTHROUGH intended
796 case animations::AnimationCalcMode::PACED
:
797 // FALLTHROUGH intended
798 case animations::AnimationCalcMode::SPLINE
:
799 // FALLTHROUGH intended
800 case animations::AnimationCalcMode::LINEAR
:
801 return createFromToByActivity
< ContinuousActivityBase
>(
808 xNode
->getAccumulate(),
810 rParms
.maSlideBounds
);
815 /** Simple activity for ActivitiesFactory::createSimpleActivity
818 Determines direction of value generator. A 1 yields a
819 forward direction, starting with 0.0 and ending with
820 1.0. A 0 yields a backward direction, starting with
821 1.0 and ending with 0.0
823 template<int Direction
>
824 class SimpleActivity
: public ContinuousActivityBase
827 /** Create SimpleActivity.
830 Standard Activity parameter struct
832 SimpleActivity( const ActivityParameters
& rParms
,
833 const NumberAnimationSharedPtr
& rAnim
) :
834 ContinuousActivityBase( rParms
),
837 ENSURE_OR_THROW( mpAnim
, "Invalid animation object" );
840 virtual void startAnimation()
842 if (this->isDisposed() || !mpAnim
)
844 ContinuousActivityBase::startAnimation();
847 mpAnim
->start( getShape(),
848 getShapeAttributeLayer() );
851 virtual void endAnimation()
858 using SimpleContinuousActivityBase::perform
;
860 /// perform override for ContinuousActivityBase
861 virtual void perform( double nModifiedTime
, sal_uInt32
) const
863 if (this->isDisposed() || !mpAnim
)
865 // no cumulation, simple [0,1] range
866 (*mpAnim
)( 1.0 - Direction
+ nModifiedTime
*(2.0*Direction
- 1.0) );
869 virtual void performEnd()
873 (*mpAnim
)( 1.0*Direction
);
877 virtual void dispose()
880 ContinuousActivityBase::dispose();
884 NumberAnimationSharedPtr mpAnim
;
890 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
891 const CommonParameters
& rParms
,
892 const NumberAnimationSharedPtr
& rAnim
,
893 const uno::Reference
< animations::XAnimate
>& xNode
)
895 // forward to appropriate template instantiation
896 return createActivity( rParms
, xNode
, rAnim
);
899 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
900 const CommonParameters
& rParms
,
901 const EnumAnimationSharedPtr
& rAnim
,
902 const uno::Reference
< animations::XAnimate
>& xNode
)
904 // forward to appropriate template instantiation
905 return createActivity( rParms
, xNode
, rAnim
);
908 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
909 const CommonParameters
& rParms
,
910 const ColorAnimationSharedPtr
& rAnim
,
911 const uno::Reference
< animations::XAnimate
>& xNode
)
913 // forward to appropriate template instantiation
914 return createActivity( rParms
, xNode
, rAnim
);
917 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
918 const CommonParameters
& rParms
,
919 const HSLColorAnimationSharedPtr
& rAnim
,
920 const uno::Reference
< animations::XAnimateColor
>& xNode
)
922 // forward to appropriate template instantiation
923 return createActivity( rParms
,
924 uno::Reference
< animations::XAnimate
>(
925 xNode
, uno::UNO_QUERY_THROW
),
927 // Direction==true means clockwise in SMIL API
928 Interpolator
< HSLColor
>( !xNode
->getDirection() ) );
931 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
932 const CommonParameters
& rParms
,
933 const PairAnimationSharedPtr
& rAnim
,
934 const uno::Reference
< animations::XAnimate
>& xNode
)
936 // forward to appropriate template instantiation
937 return createActivity( rParms
, xNode
, rAnim
);
940 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
941 const CommonParameters
& rParms
,
942 const StringAnimationSharedPtr
& rAnim
,
943 const uno::Reference
< animations::XAnimate
>& xNode
)
945 // forward to appropriate template instantiation
946 return createActivity( rParms
, xNode
, rAnim
);
949 AnimationActivitySharedPtr
ActivitiesFactory::createAnimateActivity(
950 const CommonParameters
& rParms
,
951 const BoolAnimationSharedPtr
& rAnim
,
952 const uno::Reference
< animations::XAnimate
>& xNode
)
954 // forward to appropriate template instantiation
955 return createActivity( rParms
, xNode
, rAnim
);
958 AnimationActivitySharedPtr
ActivitiesFactory::createSimpleActivity(
959 const CommonParameters
& rParms
,
960 const NumberAnimationSharedPtr
& rAnim
,
961 bool bDirectionForward
)
963 ActivityParameters
aActivityParms( rParms
.mpEndEvent
,
965 rParms
.mrActivitiesQueue
,
966 rParms
.mnMinDuration
,
968 rParms
.mnAcceleration
,
969 rParms
.mnDeceleration
,
970 rParms
.mnMinNumberOfFrames
,
971 rParms
.mbAutoReverse
);
973 if( bDirectionForward
)
974 return AnimationActivitySharedPtr(
975 new SimpleActivity
<1>( aActivityParms
, rAnim
) );
977 return AnimationActivitySharedPtr(
978 new SimpleActivity
<0>( aActivityParms
, rAnim
) );
981 } // namespace internal
982 } // namespace presentation