LibreOffice Module slideshow (master) 1
animationfactory.cxx
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
22#include <sal/log.hxx>
23
24#include <animationfactory.hxx>
25#include <attributemap.hxx>
26
27#include <com/sun/star/animations/AnimationAdditiveMode.hpp>
28#include <com/sun/star/animations/AnimationTransformType.hpp>
29#include <com/sun/star/beans/XPropertySet.hpp>
30#include <com/sun/star/drawing/FillStyle.hpp>
31#include <com/sun/star/drawing/LineStyle.hpp>
32#include <com/sun/star/awt/FontSlant.hpp>
33
37
38#include <box2dtools.hxx>
39#include <utility>
40
41using namespace ::com::sun::star;
42
43
44namespace slideshow::internal
45{
46 namespace
47 {
48 // attention, there is a similar implementation of Animation in
49 // transitions/transitionfactory.cxx
50
51 template< typename ValueT > class TupleAnimation : public PairAnimation
52 {
53 public:
54 TupleAnimation( const ShapeManagerSharedPtr& rShapeManager,
55 int nFlags,
56 bool (ShapeAttributeLayer::*pIs1stValid)() const,
57 bool (ShapeAttributeLayer::*pIs2ndValid)() const,
58 const ValueT& rDefaultValue,
59 const ::basegfx::B2DSize& rReferenceSize,
60 double (ShapeAttributeLayer::*pGet1stValue)() const,
61 double (ShapeAttributeLayer::*pGet2ndValue)() const,
62 void (ShapeAttributeLayer::*pSetValue)( const ValueT& ) ) :
63 mpShape(),
65 mpShapeManager( rShapeManager ),
66 mpIs1stValidFunc(pIs1stValid),
67 mpIs2ndValidFunc(pIs2ndValid),
68 mpGet1stValueFunc(pGet1stValue),
69 mpGet2ndValueFunc(pGet2ndValue),
70 mpSetValueFunc(pSetValue),
71 mnFlags( nFlags ),
72 maReferenceSize( rReferenceSize ),
73 maDefaultValue( rDefaultValue ),
74 mbAnimationStarted( false )
75 {
76 ENSURE_OR_THROW( rShapeManager,
77 "TupleAnimation::TupleAnimation(): Invalid ShapeManager" );
78 ENSURE_OR_THROW( pIs1stValid && pIs2ndValid && pGet1stValue && pGet2ndValue && pSetValue,
79 "TupleAnimation::TupleAnimation(): One of the method pointers is NULL" );
80 }
81
82 virtual ~TupleAnimation() override
83 {
84 end_();
85 }
86
87 // Animation interface
88
89 virtual void prefetch() override
90 {}
91
92 virtual void start( const AnimatableShapeSharedPtr& rShape,
93 const ShapeAttributeLayerSharedPtr& rAttrLayer ) override
94 {
95 OSL_ENSURE( !mpShape,
96 "TupleAnimation::start(): Shape already set" );
97 OSL_ENSURE( !mpAttrLayer,
98 "TupleAnimation::start(): Attribute layer already set" );
99
100 mpShape = rShape;
101 mpAttrLayer = rAttrLayer;
102
103 ENSURE_OR_THROW( rShape,
104 "TupleAnimation::start(): Invalid shape" );
105 ENSURE_OR_THROW( rAttrLayer,
106 "TupleAnimation::start(): Invalid attribute layer" );
107
108 if( !mbAnimationStarted )
109 {
110 mbAnimationStarted = true;
111
113 mpShapeManager->enterAnimationMode( mpShape );
114 }
115 }
116
117 virtual void end() override { end_(); }
118 void end_()
119 {
121 {
122 mbAnimationStarted = false;
123
125 mpShapeManager->leaveAnimationMode( mpShape );
126
127 if( mpShape->isContentChanged() )
128 mpShapeManager->notifyShapeUpdate( mpShape );
129 }
130 }
131
132 // PairAnimation interface
133
134
135 virtual bool operator()( const ::basegfx::B2DTuple& rValue ) override
136 {
138 "TupleAnimation::operator(): Invalid ShapeAttributeLayer" );
139
140 ValueT aValue(rValue.getX(), rValue.getY());
141
142 // Activities get values from the expression parser,
143 // which returns _relative_ sizes/positions.
144 // Convert back relative to reference coordinate system
146
147 ((*mpAttrLayer).*mpSetValueFunc)( aValue );
148
149 if( mpShape->isContentChanged() )
150 mpShapeManager->notifyShapeUpdate( mpShape );
151
152 return true;
153 }
154
155 virtual ::basegfx::B2DTuple getUnderlyingValue() const override
156 {
158 "TupleAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
159
160 ::basegfx::B2DTuple aRetVal;
161
162 // deviated from the (*shared_ptr).*mpFuncPtr
163 // notation here, since gcc does not seem to parse
164 // that as a member function call anymore.
166 aRetVal.setX( (mpAttrLayer.get()->*mpIs1stValidFunc)() ?
167 (mpAttrLayer.get()->*mpGet1stValueFunc)() :
168 aPoint.getX() );
169 aRetVal.setY( (mpAttrLayer.get()->*mpIs2ndValidFunc)() ?
170 (mpAttrLayer.get()->*mpGet2ndValueFunc)() :
171 aPoint.getY() );
172
173 // Activities get values from the expression
174 // parser, which returns _relative_
175 // sizes/positions. Convert start value to the
176 // same coordinate space (i.e. relative to given
177 // reference size).
179
180 return aRetVal;
181 }
182
183 private:
187 bool (ShapeAttributeLayer::*mpIs1stValidFunc)() const;
188 bool (ShapeAttributeLayer::*mpIs2ndValidFunc)() const;
189 double (ShapeAttributeLayer::*mpGet1stValueFunc)() const;
190 double (ShapeAttributeLayer::*mpGet2ndValueFunc)() const;
191 void (ShapeAttributeLayer::*mpSetValueFunc)( const ValueT& );
192
193 const int mnFlags;
194
195 const ::basegfx::B2DSize maReferenceSize;
196 const ValueT maDefaultValue;
198 };
199
200
201 class PathAnimation : public NumberAnimation
202 {
203 public:
204 PathAnimation( std::u16string_view rSVGDPath,
205 sal_Int16 nAdditive,
206 const ShapeManagerSharedPtr& rShapeManager,
207 const ::basegfx::B2DVector& rSlideSize,
208 int nFlags,
210 maPathPoly(),
211 mpShape(),
212 mpAttrLayer(),
213 mpShapeManager( rShapeManager ),
214 maPageSize( rSlideSize.getX(), rSlideSize.getY() ),
215 maShapeOrig(),
216 mnFlags( nFlags ),
217 mbAnimationStarted( false ),
219 mnAdditive( nAdditive ),
220 mpBox2DWorld(std::move( pBox2DWorld ))
221 {
222 ENSURE_OR_THROW( rShapeManager,
223 "PathAnimation::PathAnimation(): Invalid ShapeManager" );
224
226
227 ENSURE_OR_THROW( ::basegfx::utils::importFromSvgD( aPolyPoly, rSVGDPath, false, nullptr ),
228 "PathAnimation::PathAnimation(): failed to parse SVG:d path" );
229 ENSURE_OR_THROW( aPolyPoly.count() == 1,
230 "PathAnimation::PathAnimation(): motion path consists of multiple/zero polygon(s)" );
231
232 maPathPoly = aPolyPoly.getB2DPolygon(0);
233 }
234
235 virtual ~PathAnimation() override
236 {
237 end_();
238 }
239
240 // Animation interface
241
242 virtual void prefetch() override
243 {}
244
245 virtual void start( const AnimatableShapeSharedPtr& rShape,
246 const ShapeAttributeLayerSharedPtr& rAttrLayer ) override
247 {
248 OSL_ENSURE( !mpShape,
249 "PathAnimation::start(): Shape already set" );
250 OSL_ENSURE( !mpAttrLayer,
251 "PathAnimation::start(): Attribute layer already set" );
252
253 mpShape = rShape;
254 mpAttrLayer = rAttrLayer;
255
256 ENSURE_OR_THROW( rShape,
257 "PathAnimation::start(): Invalid shape" );
258 ENSURE_OR_THROW( rAttrLayer,
259 "PathAnimation::start(): Invalid attribute layer" );
260
261 // TODO(F1): Check whether _shape_ bounds are correct here.
262 // Theoretically, our AttrLayer is way down the stack, and
263 // we only have to consider _that_ value, not the one from
264 // the top of the stack as returned by Shape::getBounds()
265 if( mnAdditive == animations::AnimationAdditiveMode::SUM )
266 maShapeOrig = mpShape->getBounds().getCenter();
267 else
268 maShapeOrig = mpShape->getDomBounds().getCenter();
269
270 if( !mbAnimationStarted )
271 {
272 mbAnimationStarted = true;
273
275 mpShapeManager->enterAnimationMode( mpShape );
276 }
277 }
278
279 virtual void end() override { end_(); }
280 void end_()
281 {
282 if( !mbAnimationStarted )
283 return;
284
285 mbAnimationStarted = false;
286
288 mpShapeManager->leaveAnimationMode( mpShape );
289
290 if( mpShape->isContentChanged() )
291 mpShapeManager->notifyShapeUpdate( mpShape );
292
293 // if there is a physics animation going on report the animation ending
294 // and zero out the velocity of the shape
295 if( mpBox2DWorld->isInitialized() )
296 mpBox2DWorld->queueLinearVelocityUpdate( mpShape->getXShape(), {0,0});
297 }
298
299 // NumberAnimation interface
300
301
302 virtual bool operator()( double nValue ) override
303 {
305 "PathAnimation::operator(): Invalid ShapeAttributeLayer" );
306
307 ::basegfx::B2DPoint rOutPos = ::basegfx::utils::getPositionRelative( maPathPoly,
308 nValue );
309
310 // TODO(F1): Determine whether the path is
311 // absolute, or shape-relative.
312
313 // interpret path as page-relative. Scale up with page size
314 rOutPos *= basegfx::B2DPoint(maPageSize);
315
316 // TODO(F1): Determine whether the path origin is
317 // absolute, or shape-relative.
318
319 // interpret path as shape-originated. Offset to shape position
320
321 rOutPos += maShapeOrig;
322
323 mpAttrLayer->setPosition( rOutPos );
324
325 if( mpShape->isContentChanged() )
326 {
327 mpShapeManager->notifyShapeUpdate( mpShape );
328
329 // if there's a physics animation going on report the change to it
330 if ( mpBox2DWorld->isInitialized() )
331 {
332 mpBox2DWorld->queueShapePathAnimationUpdate( mpShape->getXShape(),
335 }
336 }
337
339
340 return true;
341 }
342
343 virtual double getUnderlyingValue() const override
344 {
346 "PathAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
347
348 return 0.0; // though this should be used in concert with
349 // ActivitiesFactory::createSimpleActivity, better
350 // explicitly name our start value.
351 // Permissible range for operator() above is [0,1]
352 }
353
354 private:
359 const ::basegfx::B2DSize maPageSize;
361 const int mnFlags;
364 sal_Int16 mnAdditive;
366 };
367
368 class PhysicsAnimation : public NumberAnimation
369 {
370 public:
371 PhysicsAnimation( ::box2d::utils::Box2DWorldSharedPtr pBox2DWorld,
372 const double fDuration,
373 const ShapeManagerSharedPtr& rShapeManager,
374 const ::basegfx::B2DVector& rSlideSize,
375 const ::basegfx::B2DVector& rStartVelocity,
376 const double fDensity,
377 const double fBounciness,
378 int nFlags ) :
379 mpShape(),
380 mpAttrLayer(),
381 mpShapeManager( rShapeManager ),
382 maPageSize( rSlideSize ),
383 mnFlags( nFlags ),
384 mbAnimationStarted( false ),
385 mpBox2DBody(),
386 mpBox2DWorld(std::move( pBox2DWorld )),
387 mfDuration(fDuration),
388 maStartVelocity(rStartVelocity),
389 mfDensity(fDensity),
390 mfBounciness(fBounciness),
393 {
394 ENSURE_OR_THROW( rShapeManager,
395 "PhysicsAnimation::PhysicsAnimation(): Invalid ShapeManager" );
396 }
397
398 virtual ~PhysicsAnimation() override
399 {
400 end_();
401 }
402
403 // Animation interface
404
405 virtual void prefetch() override
406 {}
407
408 virtual void start( const AnimatableShapeSharedPtr& rShape,
409 const ShapeAttributeLayerSharedPtr& rAttrLayer ) override
410 {
411 OSL_ENSURE( !mpShape,
412 "PhysicsAnimation::start(): Shape already set" );
413 OSL_ENSURE( !mpAttrLayer,
414 "PhysicsAnimation::start(): Attribute layer already set" );
415
416 mpShape = rShape;
417 mpAttrLayer = rAttrLayer;
418
419 ENSURE_OR_THROW( rShape,
420 "PhysicsAnimation::start(): Invalid shape" );
421 ENSURE_OR_THROW( rAttrLayer,
422 "PhysicsAnimation::start(): Invalid attribute layer" );
423
424 if( !mbAnimationStarted )
425 {
426 mbAnimationStarted = true;
427
429 mpBox2DBody = mpBox2DWorld->makeShapeDynamic( mpShape->getXShape(), maStartVelocity, mfDensity, mfBounciness );
430
432 mpShapeManager->enterAnimationMode( mpShape );
433 }
434 }
435
436 virtual void end() override { end_(); }
437 void end_()
438 {
440 {
441 mbIsBox2dWorldStepper = false;
442 mpBox2DWorld->setHasWorldStepper(false);
443 }
444
445 if( !mbAnimationStarted )
446 return;
447
448 mbAnimationStarted = false;
449
451 mpShapeManager->leaveAnimationMode( mpShape );
452
453 if( mpShape->isContentChanged() )
454 mpShapeManager->notifyShapeUpdate( mpShape );
455
456 mpBox2DWorld->alertPhysicsAnimationEnd(mpShape);
457 // if this was the only physics animation effect going on
458 // all box2d bodies were destroyed on alertPhysicsAnimationEnd
459 // except the one owned by the animation.
460 // Try to destroy the remaining body - if it is unique
461 // (it being unique means all physics animation effects have ended
462 // since otherwise mpBox2DWorld would own a copy of the shared_ptr )
463 mpBox2DBody.reset();
464
465 }
466
467 // NumberAnimation interface
468
469
470 virtual bool operator()( double nValue ) override
471 {
473 "PhysicsAnimation::operator(): Invalid ShapeAttributeLayer" );
474
475 // if there are multiple physics animations going in parallel
476 // Only one of them should step the box2d world
477 if( !mpBox2DWorld->hasWorldStepper() )
478 {
480 mpBox2DWorld->setHasWorldStepper(true);
481 }
482
484 {
485 double fPassedTime = (mfDuration * nValue) - mfPreviousElapsedTime;
486 mfPreviousElapsedTime += mpBox2DWorld->stepAmount( fPassedTime );
487 }
488
489 mpAttrLayer->setPosition( mpBox2DBody->getPosition() );
490 mpAttrLayer->setRotationAngle( mpBox2DBody->getAngle() );
491
492 if( mpShape->isContentChanged() )
493 mpShapeManager->notifyShapeUpdate( mpShape );
494
495 return true;
496 }
497
498 virtual double getUnderlyingValue() const override
499 {
501 "PhysicsAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
502
503 return 0.0;
504 }
505
506 private:
510 const ::basegfx::B2DSize maPageSize;
511 const int mnFlags;
516 const ::basegfx::B2DVector maStartVelocity;
517 const double mfDensity;
518 const double mfBounciness;
521 };
522
548 template< typename AnimationBase, typename ModifierFunctor > class GenericAnimation : public AnimationBase
549 {
550 public:
551 typedef typename AnimationBase::ValueType ValueT;
552
579 GenericAnimation( const ShapeManagerSharedPtr& rShapeManager,
580 int nFlags,
581 bool (ShapeAttributeLayer::*pIsValid)() const,
582 ValueT aDefaultValue,
583 ValueT (ShapeAttributeLayer::*pGetValue)() const,
584 void (ShapeAttributeLayer::*pSetValue)( const ValueT& ),
585 const ModifierFunctor& rGetterModifier,
586 const ModifierFunctor& rSetterModifier,
587 const AttributeType eAttrType,
589 mpShape(),
590 mpAttrLayer(),
591 mpShapeManager( rShapeManager ),
592 mpIsValidFunc(pIsValid),
593 mpGetValueFunc(pGetValue),
594 mpSetValueFunc(pSetValue),
595 maGetterModifier( rGetterModifier ),
596 maSetterModifier( rSetterModifier ),
597 mnFlags( nFlags ),
598 maDefaultValue(std::move(aDefaultValue)),
599 mbAnimationStarted( false ),
601 meAttrType( eAttrType ),
602 mpBox2DWorld (std::move( pBox2DWorld ))
603 {
604 ENSURE_OR_THROW( rShapeManager,
605 "GenericAnimation::GenericAnimation(): Invalid ShapeManager" );
606 ENSURE_OR_THROW( pIsValid && pGetValue && pSetValue,
607 "GenericAnimation::GenericAnimation(): One of the method pointers is NULL" );
608 }
609
610 ~GenericAnimation()
611 {
612 end();
613 }
614
615 // Animation interface
616
617 virtual void prefetch()
618 {}
619
620 virtual void start( const AnimatableShapeSharedPtr& rShape,
621 const ShapeAttributeLayerSharedPtr& rAttrLayer )
622 {
623 OSL_ENSURE( !mpShape,
624 "GenericAnimation::start(): Shape already set" );
625 OSL_ENSURE( !mpAttrLayer,
626 "GenericAnimation::start(): Attribute layer already set" );
627
628 mpShape = rShape;
629 mpAttrLayer = rAttrLayer;
630
631 ENSURE_OR_THROW( rShape,
632 "GenericAnimation::start(): Invalid shape" );
633 ENSURE_OR_THROW( rAttrLayer,
634 "GenericAnimation::start(): Invalid attribute layer" );
635
636 // only start animation once per repeated start() call,
637 // and only if sprites should be used for display
638 if( !mbAnimationStarted )
639 {
640 mbAnimationStarted = true;
641
643 mpShapeManager->enterAnimationMode( mpShape );
644 }
645 }
646
647 void end()
648 {
649 // TODO(Q2): Factor out common code (most
650 // prominently start() and end()) into base class
651
652 // only stop animation once per repeated end() call,
653 // and only if sprites are used for display
654 if( !mbAnimationStarted )
655 return;
656
657 mbAnimationStarted = false;
658
659 if( mpBox2DWorld && mpBox2DWorld->isInitialized() )
660 {
661 // if there's a physics animation going on report the animation ending to it
662 mpBox2DWorld->queueShapeAnimationEndUpdate( mpShape->getXShape(), meAttrType );
663 }
664
666 mpShapeManager->leaveAnimationMode( mpShape );
667
668 // Attention, this notifyShapeUpdate() is
669 // somewhat delicate here. Calling it
670 // unconditional (i.e. not guarded by
671 // mbAnimationStarted) will lead to shapes
672 // snapping back to their original state just
673 // before the slide ends. Not calling it at
674 // all might swallow final animation
675 // states. The current implementation relies
676 // on the fact that end() is either called by
677 // the Activity (then, the last animation
678 // state has been set, and corresponds to the
679 // shape's hold state), or by the animation
680 // node (then, it's a forced end, and we
681 // _have_ to snap back).
682
683 // To reiterate: normally, we're called from
684 // the Activity first, thus the
685 // notifyShapeUpdate() below will update to
686 // the last activity value.
687
688 // force shape update, activity might have changed
689 // state in the last round.
690 if( mpShape->isContentChanged() )
691 mpShapeManager->notifyShapeUpdate( mpShape );
692 }
693
694 // Derived Animation interface
695
696
699 bool operator()( const ValueT& x )
700 {
702 "GenericAnimation::operator(): Invalid ShapeAttributeLayer" );
703
704 ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) );
705
706 if( mpShape->isContentChanged() )
707 mpShapeManager->notifyShapeUpdate( mpShape );
708
710
711 return true;
712 }
713
716 bool operator()( ValueT x )
717 {
719 "GenericAnimation::operator(): Invalid ShapeAttributeLayer" );
720
721 ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) );
722
723 if( mpBox2DWorld && mpBox2DWorld->isInitialized() )
724 {
725 // if there's a physics animation going on report the change to it
726 mpBox2DWorld->queueShapeAnimationUpdate( mpShape->getXShape(), mpAttrLayer, meAttrType, mbAnimationFirstUpdate );
727 }
728
729 if( mpShape->isContentChanged() )
730 mpShapeManager->notifyShapeUpdate( mpShape );
731
733
734 return true;
735 }
736
737 ValueT getUnderlyingValue() const
738 {
740 "GenericAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
741
742 // deviated from the (*shared_ptr).*mpFuncPtr
743 // notation here, since gcc does not seem to parse
744 // that as a member function call anymore.
745 if( (mpAttrLayer.get()->*mpIsValidFunc)() )
746 return maGetterModifier( ((*mpAttrLayer).*mpGetValueFunc)() );
747 else
748 return maDefaultValue;
749 }
750
751 private:
755 bool (ShapeAttributeLayer::*mpIsValidFunc)() const;
756 ValueT (ShapeAttributeLayer::*mpGetValueFunc)() const;
757 void (ShapeAttributeLayer::*mpSetValueFunc)( const ValueT& );
758
759 ModifierFunctor maGetterModifier;
760 ModifierFunctor maSetterModifier;
761
762 const int mnFlags;
763
764 const ValueT maDefaultValue;
767
770 };
771
772 //Current c++0x draft (apparently) has std::identity, but not operator()
773 template<typename T> struct SGI_identity
774 {
775 T& operator()(T& x) const { return x; }
776 const T& operator()(const T& x) const { return x; }
777 };
778
785 template< typename AnimationBase > ::std::shared_ptr< AnimationBase >
786 makeGenericAnimation( const ShapeManagerSharedPtr& rShapeManager,
787 int nFlags,
788 bool (ShapeAttributeLayer::*pIsValid)() const,
789 const typename AnimationBase::ValueType& rDefaultValue,
790 typename AnimationBase::ValueType (ShapeAttributeLayer::*pGetValue)() const,
791 void (ShapeAttributeLayer::*pSetValue)( const typename AnimationBase::ValueType& ),
792 const AttributeType eAttrType,
793 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld )
794 {
795 return std::make_shared<GenericAnimation< AnimationBase,
796 SGI_identity< typename AnimationBase::ValueType > >>(
797 rShapeManager,
798 nFlags,
799 pIsValid,
800 rDefaultValue,
801 pGetValue,
802 pSetValue,
803 // no modification necessary, use identity functor here
804 SGI_identity< typename AnimationBase::ValueType >(),
805 SGI_identity< typename AnimationBase::ValueType >(),
806 eAttrType,
807 pBox2DWorld );
808 }
809
810 class Scaler
811 {
812 public:
813 explicit Scaler( double nScale ) :
814 mnScale( nScale )
815 {
816 }
817
818 double operator()( double nVal ) const
819 {
820 return mnScale * nVal;
821 }
822
823 private:
824 double mnScale;
825 };
826
829 NumberAnimationSharedPtr makeGenericAnimation( const ShapeManagerSharedPtr& rShapeManager,
830 int nFlags,
831 bool (ShapeAttributeLayer::*pIsValid)() const,
832 double nDefaultValue,
833 double (ShapeAttributeLayer::*pGetValue)() const,
834 void (ShapeAttributeLayer::*pSetValue)( const double& ),
835 double nScaleValue,
836 const AttributeType eAttrType,
837 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld )
838 {
839 return std::make_shared<GenericAnimation< NumberAnimation, Scaler >>( rShapeManager,
840 nFlags,
841 pIsValid,
842 nDefaultValue / nScaleValue,
843 pGetValue,
844 pSetValue,
845 Scaler( 1.0/nScaleValue ),
846 Scaler( nScaleValue ),
847 eAttrType,
848 pBox2DWorld );
849 }
850
851
852 uno::Any getShapeDefault( const AnimatableShapeSharedPtr& rShape,
853 const OUString& rPropertyName )
854 {
855 uno::Reference< drawing::XShape > xShape( rShape->getXShape() );
856
857 if( !xShape.is() )
858 return uno::Any(); // no regular shape, no defaults available
859
860
861 // extract relevant value from XShape's PropertySet
862 uno::Reference< beans::XPropertySet > xPropSet( xShape,
863 uno::UNO_QUERY );
864
865 ENSURE_OR_THROW( xPropSet.is(),
866 "getShapeDefault(): Cannot query property set from shape" );
867
868 return xPropSet->getPropertyValue( rPropertyName );
869 }
870
871 template< typename ValueType > ValueType getDefault( const AnimatableShapeSharedPtr& rShape,
872 const OUString& rPropertyName )
873 {
874 const uno::Any& rAny( getShapeDefault( rShape,
875 rPropertyName ) );
876
877 if( !rAny.hasValue() )
878 {
879 SAL_WARN("slideshow", "getDefault(): cannot get shape property " << rPropertyName );
880 return ValueType();
881 }
882 else
883 {
884 ValueType aValue = ValueType();
885
886 if( !(rAny >>= aValue) )
887 {
888 SAL_WARN("slideshow", "getDefault(): cannot extract shape property " << rPropertyName);
889 return ValueType();
890 }
891
892 return aValue;
893 }
894 }
895
896 template<> RGBColor getDefault< RGBColor >( const AnimatableShapeSharedPtr& rShape,
897 const OUString& rPropertyName )
898 {
899 const uno::Any& rAny( getShapeDefault( rShape,
900 rPropertyName ) );
901
902 if( !rAny.hasValue() )
903 {
904 SAL_WARN("slideshow", "getDefault(): cannot get shape color property " << rPropertyName);
905 return RGBColor();
906 }
907 else
908 {
909 sal_Int32 nValue = 0;
910
911 if( !(rAny >>= nValue) )
912 {
913 SAL_INFO("slideshow", "getDefault(): cannot extract shape color property " << rPropertyName);
914 return RGBColor();
915 }
916
917 // convert from 0xAARRGGBB API color to 0xRRGGBB00
918 // canvas color
919 return RGBColor( (nValue << 8U) & 0xFFFFFF00U );
920 }
921 }
922 }
923
925 {
926 // ATTENTION: When changing this map, also the create*PropertyAnimation() methods must
927 // be checked and possibly adapted in their switch statements
928
929 // TODO(Q2): Since this map must be coherent with the various switch statements
930 // in the create*PropertyAnimation methods, try to unify into a single method or table
931 switch( mapAttributeName( rAttrName ) )
932 {
933 default:
936
943
946
948 return CLASS_BOOL_PROPERTY;
949
961
966 return CLASS_ENUM_PROPERTY;
967 }
968 }
969
971 const AnimatableShapeSharedPtr& rShape,
972 const ShapeManagerSharedPtr& rShapeManager,
973 const ::basegfx::B2DVector& rSlideSize,
974 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld,
975 int nFlags )
976 {
977 // ATTENTION: When changing this map, also the classifyAttributeName() method must
978 // be checked and possibly adapted in their switch statement
979 AttributeType eAttrType = mapAttributeName(rAttrName);
980 switch( eAttrType )
981 {
982 default:
984 ENSURE_OR_THROW( false,
985 "AnimationFactory::createNumberPropertyAnimation(): Unknown attribute" );
986 break;
987
999 ENSURE_OR_THROW( false,
1000 "AnimationFactory::createNumberPropertyAnimation(): Attribute type mismatch" );
1001 break;
1002
1004 return makeGenericAnimation<NumberAnimation>( rShapeManager,
1005 nFlags,
1007 1.0, // CharHeight is a relative attribute, thus
1008 // default is 1.0
1011 eAttrType,
1012 pBox2DWorld );
1013
1015 return makeGenericAnimation<NumberAnimation>( rShapeManager,
1016 nFlags,
1018 getDefault<double>( rShape, rAttrName ),
1021 eAttrType,
1022 pBox2DWorld );
1023
1025 return makeGenericAnimation( rShapeManager,
1026 nFlags,
1028 // TODO(F1): Check whether _shape_ bounds are correct here.
1029 // Theoretically, our AttrLayer is way down the stack, and
1030 // we only have to consider _that_ value, not the one from
1031 // the top of the stack as returned by Shape::getBounds()
1032 rShape->getBounds().getHeight(),
1035 // convert expression parser value from relative page size
1036 rSlideSize.getY(),
1037 eAttrType,
1038 pBox2DWorld );
1039
1041 return makeGenericAnimation<NumberAnimation>( rShapeManager,
1042 nFlags,
1044 // TODO(F1): Provide shape default here (FillTransparency?)
1045 1.0,
1048 eAttrType,
1049 pBox2DWorld );
1050
1052 return makeGenericAnimation<NumberAnimation>( rShapeManager,
1053 nFlags,
1055 // NOTE: Since we paint the shape as-is from metafile,
1056 // rotation angle is always 0.0, even for rotated shapes
1057 0.0,
1060 eAttrType,
1061 pBox2DWorld );
1062
1064 return makeGenericAnimation<NumberAnimation>( rShapeManager,
1065 nFlags,
1067 // TODO(F1): Is there any shape property for skew?
1068 0.0,
1071 eAttrType,
1072 pBox2DWorld );
1073
1075 return makeGenericAnimation<NumberAnimation>( rShapeManager,
1076 nFlags,
1078 // TODO(F1): Is there any shape property for skew?
1079 0.0,
1082 eAttrType,
1083 pBox2DWorld );
1084
1086 return makeGenericAnimation( rShapeManager,
1087 nFlags,
1089 // TODO(F1): Check whether _shape_ bounds are correct here.
1090 // Theoretically, our AttrLayer is way down the stack, and
1091 // we only have to consider _that_ value, not the one from
1092 // the top of the stack as returned by Shape::getBounds()
1093 rShape->getBounds().getWidth(),
1096 // convert expression parser value from relative page size
1097 rSlideSize.getX(),
1098 eAttrType,
1099 pBox2DWorld );
1100
1102 return makeGenericAnimation( rShapeManager,
1103 nFlags,
1105 // TODO(F1): Check whether _shape_ bounds are correct here.
1106 // Theoretically, our AttrLayer is way down the stack, and
1107 // we only have to consider _that_ value, not the one from
1108 // the top of the stack as returned by Shape::getBounds()
1109 rShape->getBounds().getCenterX(),
1112 // convert expression parser value from relative page size
1113 rSlideSize.getX(),
1114 eAttrType,
1115 pBox2DWorld );
1116
1118 return makeGenericAnimation( rShapeManager,
1119 nFlags,
1121 // TODO(F1): Check whether _shape_ bounds are correct here.
1122 // Theoretically, our AttrLayer is way down the stack, and
1123 // we only have to consider _that_ value, not the one from
1124 // the top of the stack as returned by Shape::getBounds()
1125 rShape->getBounds().getCenterY(),
1128 // convert expression parser value from relative page size
1129 rSlideSize.getY(),
1130 eAttrType,
1131 pBox2DWorld );
1132 }
1133
1134 return NumberAnimationSharedPtr();
1135 }
1136
1138 const AnimatableShapeSharedPtr& rShape,
1139 const ShapeManagerSharedPtr& rShapeManager,
1140 const ::basegfx::B2DVector& /*rSlideSize*/,
1141 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld,
1142 int nFlags )
1143 {
1144 // ATTENTION: When changing this map, also the classifyAttributeName() method must
1145 // be checked and possibly adapted in their switch statement
1146 AttributeType eAttrType = mapAttributeName( rAttrName );
1147 switch( eAttrType )
1148 {
1149 default:
1151 ENSURE_OR_THROW( false,
1152 "AnimationFactory::createEnumPropertyAnimation(): Unknown attribute" );
1153 break;
1154
1172 ENSURE_OR_THROW( false,
1173 "AnimationFactory::createEnumPropertyAnimation(): Attribute type mismatch" );
1174 break;
1175
1176
1178 return makeGenericAnimation<EnumAnimation>( rShapeManager,
1179 nFlags,
1181 sal::static_int_cast<sal_Int16>(
1182 getDefault<drawing::FillStyle>( rShape, rAttrName )),
1185 eAttrType,
1186 pBox2DWorld );
1187
1189 return makeGenericAnimation<EnumAnimation>( rShapeManager,
1190 nFlags,
1192 sal::static_int_cast<sal_Int16>(
1193 getDefault<drawing::LineStyle>( rShape, rAttrName )),
1196 eAttrType,
1197 pBox2DWorld );
1198
1200 return makeGenericAnimation<EnumAnimation>( rShapeManager,
1201 nFlags,
1203 sal::static_int_cast<sal_Int16>(
1204 getDefault<awt::FontSlant>( rShape, rAttrName )),
1207 eAttrType,
1208 pBox2DWorld );
1209
1211 return makeGenericAnimation<EnumAnimation>( rShapeManager,
1212 nFlags,
1214 getDefault<sal_Int16>( rShape, rAttrName ),
1217 eAttrType,
1218 pBox2DWorld );
1219 }
1220
1221 return EnumAnimationSharedPtr();
1222 }
1223
1225 const AnimatableShapeSharedPtr& rShape,
1226 const ShapeManagerSharedPtr& rShapeManager,
1227 const ::basegfx::B2DVector& /*rSlideSize*/,
1228 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld,
1229 int nFlags )
1230 {
1231 // ATTENTION: When changing this map, also the classifyAttributeName() method must
1232 // be checked and possibly adapted in their switch statement
1233 AttributeType eAttrType = mapAttributeName(rAttrName);
1234 switch( eAttrType )
1235 {
1236 default:
1238 ENSURE_OR_THROW( false,
1239 "AnimationFactory::createColorPropertyAnimation(): Unknown attribute" );
1240 break;
1241
1258 ENSURE_OR_THROW( false,
1259 "AnimationFactory::createColorPropertyAnimation(): Attribute type mismatch" );
1260 break;
1261
1263 return makeGenericAnimation<ColorAnimation>( rShapeManager,
1264 nFlags,
1266 getDefault<RGBColor>( rShape, rAttrName ),
1269 eAttrType,
1270 pBox2DWorld );
1271
1273 // TODO(F2): This is just mapped to fill color to make it work
1274 return makeGenericAnimation<ColorAnimation>( rShapeManager,
1275 nFlags,
1277 getDefault<RGBColor>( rShape, rAttrName ),
1280 eAttrType,
1281 pBox2DWorld );
1282
1284 return makeGenericAnimation<ColorAnimation>( rShapeManager,
1285 nFlags,
1287 getDefault<RGBColor>( rShape, rAttrName ),
1290 eAttrType,
1291 pBox2DWorld );
1292
1294 return makeGenericAnimation<ColorAnimation>( rShapeManager,
1295 nFlags,
1297 getDefault<RGBColor>( rShape, rAttrName ),
1300 eAttrType,
1301 pBox2DWorld );
1302
1304 return makeGenericAnimation<ColorAnimation>( rShapeManager,
1305 nFlags,
1307 getDefault<RGBColor>( rShape, rAttrName ),
1310 eAttrType,
1311 pBox2DWorld );
1312 }
1313
1314 return ColorAnimationSharedPtr();
1315 }
1316
1318 const ShapeManagerSharedPtr& rShapeManager,
1319 const ::basegfx::B2DVector& rSlideSize,
1320 sal_Int16 nTransformType,
1321 int nFlags )
1322 {
1323 const ::basegfx::B2DRectangle& rBounds( rShape->getBounds() );
1324
1325 switch( nTransformType )
1326 {
1327 case animations::AnimationTransformType::SCALE:
1328 return std::make_shared<TupleAnimation< ::basegfx::B2DSize >>(
1329 rShapeManager,
1330 nFlags,
1333 // TODO(F1): Check whether _shape_ bounds are correct here.
1334 // Theoretically, our AttrLayer is way down the stack, and
1335 // we only have to consider _that_ value, not the one from
1336 // the top of the stack as returned by Shape::getBounds()
1337 basegfx::B2DSize(rBounds.getRange().getX(), rBounds.getRange().getY()),
1338 basegfx::B2DSize(rBounds.getRange().getX(), rBounds.getRange().getY()),
1342
1343 case animations::AnimationTransformType::TRANSLATE:
1344 return std::make_shared<TupleAnimation< ::basegfx::B2DPoint >>(
1345 rShapeManager,
1346 nFlags,
1349 // TODO(F1): Check whether _shape_ bounds are correct here.
1350 // Theoretically, our AttrLayer is way down the stack, and
1351 // we only have to consider _that_ value, not the one from
1352 // the top of the stack as returned by Shape::getBounds()
1353 rBounds.getCenter(),
1354 basegfx::B2DSize(rSlideSize.getX(), rSlideSize.getY()),
1358
1359 default:
1360 ENSURE_OR_THROW( false,
1361 "AnimationFactory::createPairPropertyAnimation(): Attribute type mismatch" );
1362 break;
1363 }
1364
1365 return PairAnimationSharedPtr();
1366 }
1367
1369 const AnimatableShapeSharedPtr& rShape,
1370 const ShapeManagerSharedPtr& rShapeManager,
1371 const ::basegfx::B2DVector& /*rSlideSize*/,
1372 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld,
1373 int nFlags )
1374 {
1375 // ATTENTION: When changing this map, also the classifyAttributeName() method must
1376 // be checked and possibly adapted in their switch statement
1377 AttributeType eAttrType = mapAttributeName(rAttrName);
1378 switch( eAttrType )
1379 {
1380 default:
1382 ENSURE_OR_THROW( false,
1383 "AnimationFactory::createStringPropertyAnimation(): Unknown attribute" );
1384 break;
1385
1406 ENSURE_OR_THROW( false,
1407 "AnimationFactory::createStringPropertyAnimation(): Attribute type mismatch" );
1408 break;
1409
1411 return makeGenericAnimation<StringAnimation>( rShapeManager,
1412 nFlags,
1414 getDefault< OUString >( rShape, rAttrName ),
1417 eAttrType,
1418 pBox2DWorld );
1419 }
1420
1421 return StringAnimationSharedPtr();
1422 }
1423
1425 const AnimatableShapeSharedPtr& /*rShape*/,
1426 const ShapeManagerSharedPtr& rShapeManager,
1427 const ::basegfx::B2DVector& /*rSlideSize*/,
1428 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld,
1429 int nFlags )
1430 {
1431 // ATTENTION: When changing this map, also the classifyAttributeName() method must
1432 // be checked and possibly adapted in their switch statement
1433 AttributeType eAttrType = mapAttributeName(rAttrName);
1434 switch( eAttrType )
1435 {
1436 default:
1438 ENSURE_OR_THROW( false,
1439 "AnimationFactory::createBoolPropertyAnimation(): Unknown attribute" );
1440 break;
1441
1462 ENSURE_OR_THROW( false,
1463 "AnimationFactory::createBoolPropertyAnimation(): Attribute type mismatch" );
1464 break;
1465
1467 return makeGenericAnimation<BoolAnimation>( rShapeManager,
1468 nFlags,
1470 // TODO(F1): Is there a corresponding shape property?
1471 true,
1474 eAttrType,
1475 pBox2DWorld );
1476 }
1477
1478 return BoolAnimationSharedPtr();
1479 }
1480
1482 sal_Int16 nAdditive,
1483 const AnimatableShapeSharedPtr& /*rShape*/,
1484 const ShapeManagerSharedPtr& rShapeManager,
1485 const ::basegfx::B2DVector& rSlideSize,
1486 const box2d::utils::Box2DWorldSharedPtr& pBox2DWorld,
1487 int nFlags )
1488 {
1489 return std::make_shared<PathAnimation>( rSVGDPath, nAdditive,
1490 rShapeManager,
1491 rSlideSize,
1492 nFlags,
1493 pBox2DWorld);
1494 }
1495
1497 const double fDuration,
1498 const ShapeManagerSharedPtr& rShapeManager,
1499 const ::basegfx::B2DVector& rSlideSize,
1500 const ::basegfx::B2DVector& rStartVelocity,
1501 const double fDensity,
1502 const double fBounciness,
1503 int nFlags )
1504 {
1505 return std::make_shared<PhysicsAnimation>( pBox2DWorld, fDuration,
1506 rShapeManager,
1507 rSlideSize,
1508 rStartVelocity,
1509 fDensity,
1510 fBounciness,
1511 nFlags );
1512 }
1513
1514}
1515
1516/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const ::basegfx::B2DVector maStartVelocity
const int mnFlags
double mfDuration
ShapeManagerSharedPtr mpShapeManager
bool mbIsBox2dWorldStepper
bool mbAnimationStarted
const double mfDensity
const ::basegfx::B2DSize maReferenceSize
AnimatableShapeSharedPtr mpShape
const double mfBounciness
const ValueT maDefaultValue
double(ShapeAttributeLayer::* mpGet1stValueFunc)() const
double mnScale
ShapeAttributeLayerSharedPtr mpAttrLayer
const ::basegfx::B2DSize maPageSize
ValueT(ShapeAttributeLayer::* mpGetValueFunc)() const
bool(ShapeAttributeLayer::* mpIs1stValidFunc)() const
box2d::utils::Box2DBodySharedPtr mpBox2DBody
bool(ShapeAttributeLayer::* mpIsValidFunc)() const
void(ShapeAttributeLayer::* mpSetValueFunc)(const ValueT &)
::basegfx::B2DPoint maShapeOrig
bool mbAnimationFirstUpdate
ModifierFunctor maSetterModifier
::basegfx::B2DPolygon maPathPoly
double mfPreviousElapsedTime
const AttributeType meAttrType
bool(ShapeAttributeLayer::* mpIs2ndValidFunc)() const
ModifierFunctor maGetterModifier
double(ShapeAttributeLayer::* mpGet2ndValueFunc)() const
sal_Int16 mnAdditive
box2d::utils::Box2DWorldSharedPtr mpBox2DWorld
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
sal_uInt32 count() const
TYPE getWidth() const
TYPE getHeight() const
void setY(TYPE fY)
void setX(TYPE fX)
void setCharPosture(const sal_Int16 &rStyle)
Set the italic style globally for the whole shape.
void setWidth(const double &rNewWidth)
Set the new width of the shape.
OUString getFontFamily() const
Get the current text font family for the whole shape.
double getShearYAngle() const
Query the current shear angle at the y axis of the shape.
void setVisibility(const bool &bVisible)
Set the shape visibility.
void setShearYAngle(const double &rNewAngle)
Set the new shear angle at the y axis of the shape.
RGBColor getFillColor() const
Get the fill color for the whole shape.
RGBColor getDimColor() const
Get the dim color for the whole shape.
bool isUnderlineModeValid() const
Query whether the underline mode attribute is valid.
bool isShearXAngleValid() const
Query whether the shear x angle attribute is valid.
void setFontFamily(const OUString &rName)
Set the text font family name globally for the whole shape.
void setPosX(const double &rNewX)
Set the new x position of the shape.
void setLineStyle(const sal_Int16 &rStyle)
Set line style for the whole shape.
void setSize(const ::basegfx::B2DSize &rNewSize)
Set the new size of the shape.
bool isShearYAngleValid() const
Query whether the shear y angle attribute is valid.
double getCharWeight() const
Get the current char weight value for the whole shape.
void setCharWeight(const double &rStyle)
Set the char weight globally for the whole shape.
void setAlpha(const double &rNewValue)
Set the new alpha value of the shape.
bool isCharPostureValid() const
Query whether the italic mode attribute is valid.
void setPosition(const ::basegfx::B2DPoint &rNewPos)
Set the new position of the shape.
void setFillStyle(const sal_Int16 &rStyle)
Changes polygon fillings.
bool isFillColorValid() const
Query whether the fill color attribute is valid.
void setUnderlineMode(const sal_Int16 &bUnderline)
Set the underline status globally for the whole shape.
void setHeight(const double &rNewHeight)
Set the new height of the shape.
bool isLineColorValid() const
Query whether the line color attribute is valid.
bool isFontFamilyValid() const
Query whether the font family attribute is valid.
bool isVisibilityValid() const
Query whether the visibility state attribute is valid.
bool isRotationAngleValid() const
Query whether the rotation angle attribute is valid.
RGBColor getCharColor() const
Get the text color for the whole shape.
double getPosY() const
Query the current y position of the shape.
void setRotationAngle(const double &rNewAngle)
Set the new rotation angle of the shape.
bool isCharColorValid() const
Query whether the char color attribute is valid.
sal_Int16 getLineStyle() const
Get the current line mode for line drawing.
void setCharColor(const RGBColor &nNewColor)
Set the text color globally for the whole shape.
bool isCharScaleValid() const
Query whether the char scaling attribute is valid.
bool isPosXValid() const
Query whether the x position attribute is valid.
bool isDimColorValid() const
Query whether the dim color attribute is valid.
double getShearXAngle() const
Query the current shear angle at the x axis of the shape.
sal_Int16 getFillStyle() const
Get the current fill mode for polygon fillings.
double getAlpha() const
Query the current alpha value of the shape.
bool isWidthValid() const
Query whether the width attribute is valid.
void setFillColor(const RGBColor &nNewColor)
Set the fill color globally for the whole shape.
void setCharScale(const double &rNewScale)
Set the new char scale globally for the shape.
bool isPosYValid() const
Query whether the y position attribute is valid.
bool isAlphaValid() const
Query whether the alpha attribute is valid.
double getRotationAngle() const
Query the current rotation angle of the shape.
void setDimColor(const RGBColor &nNewColor)
Set the dim color globally for the whole shape.
bool isLineStyleValid() const
Query whether the line mode attribute is valid.
double getHeight() const
Query the current height of the shape.
double getWidth() const
Query the current width of the shape.
sal_Int16 getUnderlineMode() const
Get the current text underline status for the whole shape.
bool isFillStyleValid() const
Query whether the fill mode attribute is valid.
sal_Int16 getCharPosture() const
Get the current text italic style for the whole shape.
bool isCharWeightValid() const
Query whether the char weight attribute is valid.
bool getVisibility() const
Get the current shape visibility.
double getPosX() const
Query the current x position of the shape.
void setShearXAngle(const double &rNewAngle)
Set the new shear angle at the x axis of the shape.
double getCharScale() const
Query the current char scaling attribute globally for the shape.
void setLineColor(const RGBColor &nNewColor)
Set the line color globally for the whole shape.
RGBColor getLineColor() const
Get the line color for the whole shape.
bool isHeightValid() const
Query whether the height attribute is valid.
void setPosY(const double &rNewY)
Set the new y position of the shape.
#define ENSURE_OR_RETURN_FALSE(c, m)
#define ENSURE_OR_THROW(c, m)
float x
sal_Int16 nValue
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
std::shared_ptr< box2DBody > Box2DBodySharedPtr
Definition: box2dtools.hxx:32
::std::shared_ptr< box2DWorld > Box2DWorldSharedPtr
end
ValueType
@ FLAG_NO_SPRITE
Don't call enter/leaveAnimation for the Shape.
NumberAnimationSharedPtr createNumberPropertyAnimation(const OUString &rAttrName, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, int nFlags=0)
PairAnimationSharedPtr createPairPropertyAnimation(const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, sal_Int16 nTransformType, int nFlags)
Create scale or move animation.
NumberAnimationSharedPtr createPhysicsAnimation(const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, const double fDuration, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const ::basegfx::B2DVector &rStartVelocity, const double fDensity, const double fBounciness, int nFlags)
AttributeClass classifyAttributeName(const OUString &rAttrName)
ColorAnimationSharedPtr createColorPropertyAnimation(const OUString &rAttrName, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, int nFlags=0)
NumberAnimationSharedPtr createPathMotionAnimation(const OUString &rSVGDPath, sal_Int16 nAdditive, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, int nFlags)
AttributeClass
Classifies the attribute name.
@ CLASS_STRING_PROPERTY
Use createStringPropertyAnimation.
@ CLASS_UNKNOWN_PROPERTY
Unknown, prolly invalid name.
@ CLASS_COLOR_PROPERTY
Use createColorPropertyAnimation.
@ CLASS_BOOL_PROPERTY
Use createBoolPropertyAnimation.
@ CLASS_NUMBER_PROPERTY
Use createNumberPropertyAnimation.
@ CLASS_ENUM_PROPERTY
Use createEnumPropertyAnimation.
BoolAnimationSharedPtr createBoolPropertyAnimation(const OUString &rAttrName, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, int nFlags)
EnumAnimationSharedPtr createEnumPropertyAnimation(const OUString &rAttrName, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, int nFlags)
StringAnimationSharedPtr createStringPropertyAnimation(const OUString &rAttrName, const AnimatableShapeSharedPtr &rShape, const ShapeManagerSharedPtr &rShapeManager, const ::basegfx::B2DVector &rSlideSize, const box2d::utils::Box2DWorldSharedPtr &pBox2DWorld, int nFlags)
::std::shared_ptr< NumberAnimation > NumberAnimationSharedPtr
::std::shared_ptr< AnimatableShape > AnimatableShapeSharedPtr
::std::shared_ptr< ShapeAttributeLayer > ShapeAttributeLayerSharedPtr
::std::shared_ptr< PairAnimation > PairAnimationSharedPtr
::std::shared_ptr< BoolAnimation > BoolAnimationSharedPtr
::std::shared_ptr< EnumAnimation > EnumAnimationSharedPtr
::std::shared_ptr< StringAnimation > StringAnimationSharedPtr
AttributeType
Type of to-be-animated attribute.
std::shared_ptr< ShapeManager > ShapeManagerSharedPtr
Definition: box2dtools.hxx:23
::std::shared_ptr< ColorAnimation > ColorAnimationSharedPtr
AttributeType mapAttributeName(const OUString &rAttrName)
Map attribute name to AttributeType enum.