1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_slideshow.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir // must be first
32*cdf0e10cSrcweir #include <canvas/debug.hxx>
33*cdf0e10cSrcweir #include <tools/diagnose_ex.h>
34*cdf0e10cSrcweir #include <canvas/verbosetrace.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <animationfactory.hxx>
37*cdf0e10cSrcweir #include <attributemap.hxx>
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/animations/AnimationTransformType.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/drawing/FillStyle.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/drawing/LineStyle.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/awt/FontSlant.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/awt/FontUnderline.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx>
49*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygontools.hxx>
50*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolypolygontools.hxx>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #include <functional>
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir using namespace ::com::sun::star;
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir namespace slideshow
59*cdf0e10cSrcweir {
60*cdf0e10cSrcweir     namespace internal
61*cdf0e10cSrcweir     {
62*cdf0e10cSrcweir         namespace
63*cdf0e10cSrcweir         {
64*cdf0e10cSrcweir             // attention, there is a similar implementation of Animation in
65*cdf0e10cSrcweir             // transitions/transitionfactory.cxx
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir             template< typename ValueT > class TupleAnimation : public PairAnimation
68*cdf0e10cSrcweir             {
69*cdf0e10cSrcweir             public:
70*cdf0e10cSrcweir                 TupleAnimation( const ShapeManagerSharedPtr&		rShapeManager,
71*cdf0e10cSrcweir                                 int									nFlags,
72*cdf0e10cSrcweir                                 bool      	 (ShapeAttributeLayer::*pIs1stValid)() const,
73*cdf0e10cSrcweir                                 bool      	 (ShapeAttributeLayer::*pIs2ndValid)() const,
74*cdf0e10cSrcweir                                 const ValueT&						rDefaultValue,
75*cdf0e10cSrcweir                                 const ::basegfx::B2DSize&			rReferenceSize,
76*cdf0e10cSrcweir                                 double 	 	 (ShapeAttributeLayer::*pGet1stValue)() const,
77*cdf0e10cSrcweir                                 double 	 	 (ShapeAttributeLayer::*pGet2ndValue)() const,
78*cdf0e10cSrcweir                                 void      	 (ShapeAttributeLayer::*pSetValue)( const ValueT& ) ) :
79*cdf0e10cSrcweir                     mpShape(),
80*cdf0e10cSrcweir                     mpAttrLayer(),
81*cdf0e10cSrcweir                     mpShapeManager( rShapeManager ),
82*cdf0e10cSrcweir                     mpIs1stValidFunc(pIs1stValid),
83*cdf0e10cSrcweir                     mpIs2ndValidFunc(pIs2ndValid),
84*cdf0e10cSrcweir                     mpGet1stValueFunc(pGet1stValue),
85*cdf0e10cSrcweir                     mpGet2ndValueFunc(pGet2ndValue),
86*cdf0e10cSrcweir                     mpSetValueFunc(pSetValue),
87*cdf0e10cSrcweir                     mnFlags( nFlags ),
88*cdf0e10cSrcweir                     maReferenceSize( rReferenceSize ),
89*cdf0e10cSrcweir                     maDefaultValue( rDefaultValue ),
90*cdf0e10cSrcweir                     mbAnimationStarted( false )
91*cdf0e10cSrcweir                 {
92*cdf0e10cSrcweir                     ENSURE_OR_THROW( rShapeManager,
93*cdf0e10cSrcweir                                       "TupleAnimation::TupleAnimation(): Invalid ShapeManager" );
94*cdf0e10cSrcweir                     ENSURE_OR_THROW( pIs1stValid && pIs2ndValid && pGet1stValue && pGet2ndValue && pSetValue,
95*cdf0e10cSrcweir                                       "TupleAnimation::TupleAnimation(): One of the method pointers is NULL" );
96*cdf0e10cSrcweir                 }
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir                 ~TupleAnimation()
99*cdf0e10cSrcweir                 {
100*cdf0e10cSrcweir                     end_();
101*cdf0e10cSrcweir                 }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir                 // Animation interface
104*cdf0e10cSrcweir                 // -------------------
105*cdf0e10cSrcweir                 virtual void prefetch( const AnimatableShapeSharedPtr&,
106*cdf0e10cSrcweir                                        const ShapeAttributeLayerSharedPtr& )
107*cdf0e10cSrcweir                 {}
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir                 virtual void start( const AnimatableShapeSharedPtr& 	rShape,
110*cdf0e10cSrcweir                                     const ShapeAttributeLayerSharedPtr& rAttrLayer )
111*cdf0e10cSrcweir                 {
112*cdf0e10cSrcweir                     OSL_ENSURE( !mpShape,
113*cdf0e10cSrcweir                                 "TupleAnimation::start(): Shape already set" );
114*cdf0e10cSrcweir                     OSL_ENSURE( !mpAttrLayer,
115*cdf0e10cSrcweir                                 "TupleAnimation::start(): Attribute layer already set" );
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir                     mpShape = rShape;
118*cdf0e10cSrcweir                     mpAttrLayer = rAttrLayer;
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir                     ENSURE_OR_THROW( rShape,
121*cdf0e10cSrcweir                                       "TupleAnimation::start(): Invalid shape" );
122*cdf0e10cSrcweir                     ENSURE_OR_THROW( rAttrLayer,
123*cdf0e10cSrcweir                                       "TupleAnimation::start(): Invalid attribute layer" );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir                     if( !mbAnimationStarted )
126*cdf0e10cSrcweir                     {
127*cdf0e10cSrcweir                         mbAnimationStarted = true;
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir                         if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
130*cdf0e10cSrcweir                             mpShapeManager->enterAnimationMode( mpShape );
131*cdf0e10cSrcweir                     }
132*cdf0e10cSrcweir                 }
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir                 virtual void end() { end_(); }
135*cdf0e10cSrcweir                 void end_()
136*cdf0e10cSrcweir                 {
137*cdf0e10cSrcweir                     if( mbAnimationStarted )
138*cdf0e10cSrcweir                     {
139*cdf0e10cSrcweir                         mbAnimationStarted = false;
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir                         if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
142*cdf0e10cSrcweir                             mpShapeManager->leaveAnimationMode( mpShape );
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir                         if( mpShape->isContentChanged() )
145*cdf0e10cSrcweir                             mpShapeManager->notifyShapeUpdate( mpShape );
146*cdf0e10cSrcweir                     }
147*cdf0e10cSrcweir                 }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir                 // PairAnimation interface
150*cdf0e10cSrcweir                 // -----------------------
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir                 virtual bool operator()( const ::basegfx::B2DTuple& rValue )
153*cdf0e10cSrcweir                 {
154*cdf0e10cSrcweir                     ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape,
155*cdf0e10cSrcweir                                        "TupleAnimation::operator(): Invalid ShapeAttributeLayer" );
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir                     ValueT aValue( rValue.getX(),
158*cdf0e10cSrcweir                                    rValue.getY() );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir                     // Activitis get values from the expression parser,
161*cdf0e10cSrcweir                     // which returns _relative_ sizes/positions.
162*cdf0e10cSrcweir                     // Convert back relative to reference coordinate system
163*cdf0e10cSrcweir                     aValue *= maReferenceSize;
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir                     ((*mpAttrLayer).*mpSetValueFunc)( aValue );
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir                     if( mpShape->isContentChanged() )
168*cdf0e10cSrcweir                         mpShapeManager->notifyShapeUpdate( mpShape );
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir                     return true;
171*cdf0e10cSrcweir                 }
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir                 virtual ::basegfx::B2DTuple getUnderlyingValue() const
174*cdf0e10cSrcweir                 {
175*cdf0e10cSrcweir                     ENSURE_OR_THROW( mpAttrLayer,
176*cdf0e10cSrcweir                                       "TupleAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir                     ::basegfx::B2DTuple aRetVal;
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir                     // deviated from the (*shared_ptr).*mpFuncPtr
181*cdf0e10cSrcweir                     // notation here, since gcc does not seem to parse
182*cdf0e10cSrcweir                     // that as a member function call anymore.
183*cdf0e10cSrcweir                     aRetVal.setX( (mpAttrLayer.get()->*mpIs1stValidFunc)() ?
184*cdf0e10cSrcweir                                   (mpAttrLayer.get()->*mpGet1stValueFunc)() :
185*cdf0e10cSrcweir                                   maDefaultValue.getX() );
186*cdf0e10cSrcweir                     aRetVal.setY( (mpAttrLayer.get()->*mpIs2ndValidFunc)() ?
187*cdf0e10cSrcweir                                   (mpAttrLayer.get()->*mpGet2ndValueFunc)() :
188*cdf0e10cSrcweir                                   maDefaultValue.getY() );
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir                     // Activities get values from the expression
191*cdf0e10cSrcweir                     // parser, which returns _relative_
192*cdf0e10cSrcweir                     // sizes/positions.  Convert start value to the
193*cdf0e10cSrcweir                     // same coordinate space (i.e. relative to given
194*cdf0e10cSrcweir                     // reference size).
195*cdf0e10cSrcweir                     aRetVal /= maReferenceSize;
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir                     return aRetVal;
198*cdf0e10cSrcweir                 }
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir             private:
201*cdf0e10cSrcweir                 AnimatableShapeSharedPtr		   mpShape;
202*cdf0e10cSrcweir                 ShapeAttributeLayerSharedPtr	   mpAttrLayer;
203*cdf0e10cSrcweir                 ShapeManagerSharedPtr			   mpShapeManager;
204*cdf0e10cSrcweir                 bool 		(ShapeAttributeLayer::*mpIs1stValidFunc)() const;
205*cdf0e10cSrcweir                 bool 		(ShapeAttributeLayer::*mpIs2ndValidFunc)() const;
206*cdf0e10cSrcweir                 double 		(ShapeAttributeLayer::*mpGet1stValueFunc)() const;
207*cdf0e10cSrcweir                 double 		(ShapeAttributeLayer::*mpGet2ndValueFunc)() const;
208*cdf0e10cSrcweir                 void 		(ShapeAttributeLayer::*mpSetValueFunc)( const ValueT& );
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir                 const int						   mnFlags;
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir                 const ::basegfx::B2DSize		   maReferenceSize;
213*cdf0e10cSrcweir                 const ValueT					   maDefaultValue;
214*cdf0e10cSrcweir                 bool							   mbAnimationStarted;
215*cdf0e10cSrcweir             };
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir             class PathAnimation : public NumberAnimation
219*cdf0e10cSrcweir             {
220*cdf0e10cSrcweir             public:
221*cdf0e10cSrcweir                 PathAnimation( const ::rtl::OUString&		rSVGDPath,
222*cdf0e10cSrcweir                                sal_Int16                    nAdditive,
223*cdf0e10cSrcweir                                const ShapeManagerSharedPtr&	rShapeManager,
224*cdf0e10cSrcweir                                const ::basegfx::B2DVector&  rSlideSize,
225*cdf0e10cSrcweir                                int							nFlags ) :
226*cdf0e10cSrcweir                     maPathPoly(),
227*cdf0e10cSrcweir                     mpShape(),
228*cdf0e10cSrcweir                     mpAttrLayer(),
229*cdf0e10cSrcweir                     mpShapeManager( rShapeManager ),
230*cdf0e10cSrcweir                     maPageSize( rSlideSize ),
231*cdf0e10cSrcweir 					maShapeOrig(),
232*cdf0e10cSrcweir                     mnFlags( nFlags ),
233*cdf0e10cSrcweir 					mbAnimationStarted( false ),
234*cdf0e10cSrcweir 					mnAdditive( nAdditive )
235*cdf0e10cSrcweir                 {
236*cdf0e10cSrcweir                     ENSURE_OR_THROW( rShapeManager,
237*cdf0e10cSrcweir                                       "PathAnimation::PathAnimation(): Invalid ShapeManager" );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir                     ::basegfx::B2DPolyPolygon aPolyPoly;
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir                     ENSURE_OR_THROW( ::basegfx::tools::importFromSvgD( aPolyPoly, rSVGDPath ),
242*cdf0e10cSrcweir                                       "PathAnimation::PathAnimation(): failed to parse SVG:d path" );
243*cdf0e10cSrcweir                     ENSURE_OR_THROW( aPolyPoly.count() == 1,
244*cdf0e10cSrcweir                                       "PathAnimation::PathAnimation(): motion path consists of multiple/zero polygon(s)" );
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir                     // TODO(F2): Since getPositionRelative() currently
247*cdf0e10cSrcweir                     // cannot handle beziers, have to subdivide.
248*cdf0e10cSrcweir                     // AW: Should be no longer necessary; getPositionRelative is now bezier-safe
249*cdf0e10cSrcweir                     maPathPoly = ::basegfx::tools::adaptiveSubdivideByAngle(aPolyPoly.getB2DPolygon(0) );
250*cdf0e10cSrcweir                 }
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir                 ~PathAnimation()
253*cdf0e10cSrcweir                 {
254*cdf0e10cSrcweir                     end_();
255*cdf0e10cSrcweir                 }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir                 // Animation interface
258*cdf0e10cSrcweir                 // -------------------
259*cdf0e10cSrcweir                 virtual void prefetch( const AnimatableShapeSharedPtr&,
260*cdf0e10cSrcweir                                        const ShapeAttributeLayerSharedPtr& )
261*cdf0e10cSrcweir                 {}
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir                 virtual void start( const AnimatableShapeSharedPtr& 	rShape,
264*cdf0e10cSrcweir                                     const ShapeAttributeLayerSharedPtr& rAttrLayer )
265*cdf0e10cSrcweir                 {
266*cdf0e10cSrcweir                     OSL_ENSURE( !mpShape,
267*cdf0e10cSrcweir                                 "PathAnimation::start(): Shape already set" );
268*cdf0e10cSrcweir                     OSL_ENSURE( !mpAttrLayer,
269*cdf0e10cSrcweir                                 "PathAnimation::start(): Attribute layer already set" );
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir                     mpShape = rShape;
272*cdf0e10cSrcweir                     mpAttrLayer = rAttrLayer;
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir                     ENSURE_OR_THROW( rShape,
275*cdf0e10cSrcweir                                       "PathAnimation::start(): Invalid shape" );
276*cdf0e10cSrcweir                     ENSURE_OR_THROW( rAttrLayer,
277*cdf0e10cSrcweir                                       "PathAnimation::start(): Invalid attribute layer" );
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir                     // TODO(F1): Check whether _shape_ bounds are correct here.
280*cdf0e10cSrcweir                     // Theoretically, our AttrLayer is way down the stack, and
281*cdf0e10cSrcweir                     // we only have to consider _that_ value, not the one from
282*cdf0e10cSrcweir                     // the top of the stack as returned by Shape::getBounds()
283*cdf0e10cSrcweir 					if( mnAdditive == animations::AnimationAdditiveMode::SUM )
284*cdf0e10cSrcweir 						maShapeOrig = mpShape->getBounds().getCenter();
285*cdf0e10cSrcweir 					else
286*cdf0e10cSrcweir 						maShapeOrig = mpShape->getDomBounds().getCenter();
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir                     if( !mbAnimationStarted )
289*cdf0e10cSrcweir                     {
290*cdf0e10cSrcweir                         mbAnimationStarted = true;
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir                         if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
293*cdf0e10cSrcweir                             mpShapeManager->enterAnimationMode( mpShape );
294*cdf0e10cSrcweir                     }
295*cdf0e10cSrcweir                 }
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir                 virtual void end() { end_(); }
298*cdf0e10cSrcweir                 void end_()
299*cdf0e10cSrcweir                 {
300*cdf0e10cSrcweir                     if( mbAnimationStarted )
301*cdf0e10cSrcweir                     {
302*cdf0e10cSrcweir                         mbAnimationStarted = false;
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir                         if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
305*cdf0e10cSrcweir                             mpShapeManager->leaveAnimationMode( mpShape );
306*cdf0e10cSrcweir 
307*cdf0e10cSrcweir                         if( mpShape->isContentChanged() )
308*cdf0e10cSrcweir                             mpShapeManager->notifyShapeUpdate( mpShape );
309*cdf0e10cSrcweir                     }
310*cdf0e10cSrcweir                 }
311*cdf0e10cSrcweir 
312*cdf0e10cSrcweir                 // NumberAnimation interface
313*cdf0e10cSrcweir                 // -----------------------
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir                 virtual bool operator()( double nValue )
316*cdf0e10cSrcweir                 {
317*cdf0e10cSrcweir                     ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape,
318*cdf0e10cSrcweir                                        "PathAnimation::operator(): Invalid ShapeAttributeLayer" );
319*cdf0e10cSrcweir 
320*cdf0e10cSrcweir                     ::basegfx::B2DPoint rOutPos = ::basegfx::tools::getPositionRelative( maPathPoly,
321*cdf0e10cSrcweir                                                                                          nValue );
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir                     // TODO(F1): Determine whether the path is
324*cdf0e10cSrcweir                     // absolute, or shape-relative.
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir                     // interpret path as page-relative. Scale up with page size
327*cdf0e10cSrcweir                     rOutPos *= maPageSize;
328*cdf0e10cSrcweir 
329*cdf0e10cSrcweir                     // TODO(F1): Determine whether the path origin is
330*cdf0e10cSrcweir                     // absolute, or shape-relative.
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir                     // interpret path as shape-originated. Offset to shape position
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir                     rOutPos += maShapeOrig;
335*cdf0e10cSrcweir 
336*cdf0e10cSrcweir                     mpAttrLayer->setPosition( rOutPos );
337*cdf0e10cSrcweir 
338*cdf0e10cSrcweir                     if( mpShape->isContentChanged() )
339*cdf0e10cSrcweir                         mpShapeManager->notifyShapeUpdate( mpShape );
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir                     return true;
342*cdf0e10cSrcweir                 }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir                 virtual double getUnderlyingValue() const
345*cdf0e10cSrcweir                 {
346*cdf0e10cSrcweir                     ENSURE_OR_THROW( mpAttrLayer,
347*cdf0e10cSrcweir                                       "PathAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir                     return 0.0; // though this should be used in concert with
350*cdf0e10cSrcweir                     			// ActivitiesFactory::createSimpleActivity, better
351*cdf0e10cSrcweir                     			// explicitely name our start value.
352*cdf0e10cSrcweir                     			// Permissible range for operator() above is [0,1]
353*cdf0e10cSrcweir                 }
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir             private:
356*cdf0e10cSrcweir                 ::basegfx::B2DPolygon			   maPathPoly;
357*cdf0e10cSrcweir                 AnimatableShapeSharedPtr		   mpShape;
358*cdf0e10cSrcweir                 ShapeAttributeLayerSharedPtr	   mpAttrLayer;
359*cdf0e10cSrcweir                 ShapeManagerSharedPtr			   mpShapeManager;
360*cdf0e10cSrcweir                 const ::basegfx::B2DSize		   maPageSize;
361*cdf0e10cSrcweir                 ::basegfx::B2DPoint				   maShapeOrig;
362*cdf0e10cSrcweir                 const int						   mnFlags;
363*cdf0e10cSrcweir                 bool							   mbAnimationStarted;
364*cdf0e10cSrcweir 				sal_Int16						   mnAdditive;
365*cdf0e10cSrcweir             };
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir             /** GenericAnimation template
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir             	This template makes heavy use of SFINAE, only one of
371*cdf0e10cSrcweir             	the operator()() methods will compile for each of the
372*cdf0e10cSrcweir             	base classes.
373*cdf0e10cSrcweir 
374*cdf0e10cSrcweir                 Note that we omit the virtual keyword on the
375*cdf0e10cSrcweir                 operator()() overrides and getUnderlyingValue() methods on
376*cdf0e10cSrcweir                 purpose; those that actually do override baseclass
377*cdf0e10cSrcweir                 virtual methods inherit the property, and the others
378*cdf0e10cSrcweir                 won't increase our vtable. What's more, having all
379*cdf0e10cSrcweir                 those methods in the vtable actually creates POIs for
380*cdf0e10cSrcweir                 them, which breaks the whole SFINAE concept (IOW, this
381*cdf0e10cSrcweir                 template won't compile any longer).
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir             	@tpl AnimationBase
384*cdf0e10cSrcweir                 Type of animation to generate (determines the
385*cdf0e10cSrcweir                 interface GenericAnimation will implement). Must be
386*cdf0e10cSrcweir                 one of NumberAnimation, ColorAnimation,
387*cdf0e10cSrcweir                 StringAnimation, PairAnimation or BoolAnimation.
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir                 @tpl ModifierFunctor
390*cdf0e10cSrcweir                 Type of a functor object, which can optionally be used to
391*cdf0e10cSrcweir                 modify the getter/setter values.
392*cdf0e10cSrcweir              */
393*cdf0e10cSrcweir             template< typename AnimationBase, typename ModifierFunctor > class GenericAnimation : public AnimationBase
394*cdf0e10cSrcweir             {
395*cdf0e10cSrcweir             public:
396*cdf0e10cSrcweir                 typedef typename AnimationBase::ValueType ValueT;
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir                 /** Create generic animation
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir                 	@param pIsValid
401*cdf0e10cSrcweir                     Function pointer to one of the is*Valid
402*cdf0e10cSrcweir                     methods. Used to either take the given getter
403*cdf0e10cSrcweir                     method, or the given default value for the start value.
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir                     @param rDefaultValue
406*cdf0e10cSrcweir                     Default value, to take as the start value if
407*cdf0e10cSrcweir                     is*Valid returns false.
408*cdf0e10cSrcweir 
409*cdf0e10cSrcweir                     @param pGetValue
410*cdf0e10cSrcweir                     Getter method, to fetch start value if valid.
411*cdf0e10cSrcweir 
412*cdf0e10cSrcweir                     @param pSetValue
413*cdf0e10cSrcweir                     Setter method. This one puts the current animation
414*cdf0e10cSrcweir                     value to the ShapeAttributeLayer.
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir                     @param rGetterModifier
417*cdf0e10cSrcweir                     Modifies up values retrieved from the pGetValue method.
418*cdf0e10cSrcweir                     Must provide operator()( const ValueT& ) method.
419*cdf0e10cSrcweir 
420*cdf0e10cSrcweir                     @param rSetterModifier
421*cdf0e10cSrcweir                     Modifies up values before passing them to the pSetValue method.
422*cdf0e10cSrcweir                     Must provide operator()( const ValueT& ) method.
423*cdf0e10cSrcweir                  */
424*cdf0e10cSrcweir             	GenericAnimation( const ShapeManagerSharedPtr&			rShapeManager,
425*cdf0e10cSrcweir                                   int									nFlags,
426*cdf0e10cSrcweir                     			  bool      	 (ShapeAttributeLayer::*pIsValid)() const,
427*cdf0e10cSrcweir                                   const ValueT&				  	   		rDefaultValue,
428*cdf0e10cSrcweir                                   ValueT 		 (ShapeAttributeLayer::*pGetValue)() const,
429*cdf0e10cSrcweir                                   void      	 (ShapeAttributeLayer::*pSetValue)( const ValueT& ),
430*cdf0e10cSrcweir                                   const ModifierFunctor&				rGetterModifier,
431*cdf0e10cSrcweir                                   const ModifierFunctor&				rSetterModifier ) :
432*cdf0e10cSrcweir                     mpShape(),
433*cdf0e10cSrcweir                     mpAttrLayer(),
434*cdf0e10cSrcweir                     mpShapeManager( rShapeManager ),
435*cdf0e10cSrcweir                     mpIsValidFunc(pIsValid),
436*cdf0e10cSrcweir                     mpGetValueFunc(pGetValue),
437*cdf0e10cSrcweir                     mpSetValueFunc(pSetValue),
438*cdf0e10cSrcweir                     maGetterModifier( rGetterModifier ),
439*cdf0e10cSrcweir                     maSetterModifier( rSetterModifier ),
440*cdf0e10cSrcweir                     mnFlags( nFlags ),
441*cdf0e10cSrcweir                     maDefaultValue(rDefaultValue),
442*cdf0e10cSrcweir                     mbAnimationStarted( false )
443*cdf0e10cSrcweir                 {
444*cdf0e10cSrcweir                     ENSURE_OR_THROW( rShapeManager,
445*cdf0e10cSrcweir                                       "GenericAnimation::GenericAnimation(): Invalid ShapeManager" );
446*cdf0e10cSrcweir                     ENSURE_OR_THROW( pIsValid && pGetValue && pSetValue,
447*cdf0e10cSrcweir                                       "GenericAnimation::GenericAnimation(): One of the method pointers is NULL" );
448*cdf0e10cSrcweir                 }
449*cdf0e10cSrcweir 
450*cdf0e10cSrcweir                 ~GenericAnimation()
451*cdf0e10cSrcweir                 {
452*cdf0e10cSrcweir                     end_();
453*cdf0e10cSrcweir                 }
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir                 // Animation interface
456*cdf0e10cSrcweir                 // -------------------
457*cdf0e10cSrcweir                 virtual void prefetch( const AnimatableShapeSharedPtr&,
458*cdf0e10cSrcweir                                        const ShapeAttributeLayerSharedPtr& )
459*cdf0e10cSrcweir                 {}
460*cdf0e10cSrcweir 
461*cdf0e10cSrcweir                 virtual void start( const AnimatableShapeSharedPtr& 	rShape,
462*cdf0e10cSrcweir                                     const ShapeAttributeLayerSharedPtr& rAttrLayer )
463*cdf0e10cSrcweir                 {
464*cdf0e10cSrcweir                     OSL_ENSURE( !mpShape,
465*cdf0e10cSrcweir                                 "GenericAnimation::start(): Shape already set" );
466*cdf0e10cSrcweir                     OSL_ENSURE( !mpAttrLayer,
467*cdf0e10cSrcweir                                 "GenericAnimation::start(): Attribute layer already set" );
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir                     mpShape = rShape;
470*cdf0e10cSrcweir                     mpAttrLayer = rAttrLayer;
471*cdf0e10cSrcweir 
472*cdf0e10cSrcweir                     ENSURE_OR_THROW( rShape,
473*cdf0e10cSrcweir                                       "GenericAnimation::start(): Invalid shape" );
474*cdf0e10cSrcweir                     ENSURE_OR_THROW( rAttrLayer,
475*cdf0e10cSrcweir                                       "GenericAnimation::start(): Invalid attribute layer" );
476*cdf0e10cSrcweir 
477*cdf0e10cSrcweir                     // only start animation once per repeated start() call,
478*cdf0e10cSrcweir                     // and only if sprites should be used for display
479*cdf0e10cSrcweir                     if( !mbAnimationStarted )
480*cdf0e10cSrcweir                     {
481*cdf0e10cSrcweir                         mbAnimationStarted = true;
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir                         if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
484*cdf0e10cSrcweir                             mpShapeManager->enterAnimationMode( mpShape );
485*cdf0e10cSrcweir                     }
486*cdf0e10cSrcweir                 }
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir                 virtual void end() { end_(); }
489*cdf0e10cSrcweir                 void end_()
490*cdf0e10cSrcweir                 {
491*cdf0e10cSrcweir                     // TODO(Q2): Factor out common code (most
492*cdf0e10cSrcweir                     // prominently start() and end()) into base class
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir                     // only stop animation once per repeated end() call,
495*cdf0e10cSrcweir                     // and only if sprites are used for display
496*cdf0e10cSrcweir                     if( mbAnimationStarted )
497*cdf0e10cSrcweir                     {
498*cdf0e10cSrcweir                         mbAnimationStarted = false;
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir                         if( !(mnFlags & AnimationFactory::FLAG_NO_SPRITE) )
501*cdf0e10cSrcweir                             mpShapeManager->leaveAnimationMode( mpShape );
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir                         // Attention, this notifyShapeUpdate() is
504*cdf0e10cSrcweir                         // somewhat delicate here. Calling it
505*cdf0e10cSrcweir                         // unconditional (i.e. not guarded by
506*cdf0e10cSrcweir                         // mbAnimationStarted) will lead to shapes
507*cdf0e10cSrcweir                         // snapping back to their original state just
508*cdf0e10cSrcweir                         // before the slide ends. Not calling it at
509*cdf0e10cSrcweir                         // all might swallow final animation
510*cdf0e10cSrcweir                         // states. The current implementation relies
511*cdf0e10cSrcweir                         // on the fact that end() is either called by
512*cdf0e10cSrcweir                         // the Activity (then, the last animation
513*cdf0e10cSrcweir                         // state has been set, and corresponds to the
514*cdf0e10cSrcweir                         // shape's hold state), or by the animation
515*cdf0e10cSrcweir                         // node (then, it's a forced end, and we
516*cdf0e10cSrcweir                         // _have_ to snap back).
517*cdf0e10cSrcweir                         //
518*cdf0e10cSrcweir                         // To reiterate: normally, we're called from
519*cdf0e10cSrcweir                         // the Activity first, thus the
520*cdf0e10cSrcweir                         // notifyShapeUpdate() below will update to
521*cdf0e10cSrcweir                         // the last activity value.
522*cdf0e10cSrcweir 
523*cdf0e10cSrcweir                         // force shape update, activity might have changed
524*cdf0e10cSrcweir                         // state in the last round.
525*cdf0e10cSrcweir                         if( mpShape->isContentChanged() )
526*cdf0e10cSrcweir                             mpShapeManager->notifyShapeUpdate( mpShape );
527*cdf0e10cSrcweir                     }
528*cdf0e10cSrcweir                 }
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir                 // Derived Animation interface
531*cdf0e10cSrcweir                 // ---------------------------
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir                 /** For by-reference interfaces (B2DTuple, OUString)
534*cdf0e10cSrcweir                  */
535*cdf0e10cSrcweir                 bool operator()( const ValueT& x )
536*cdf0e10cSrcweir                 {
537*cdf0e10cSrcweir                     ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape,
538*cdf0e10cSrcweir                                        "GenericAnimation::operator(): Invalid ShapeAttributeLayer" );
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir                     ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) );
541*cdf0e10cSrcweir 
542*cdf0e10cSrcweir                     if( mpShape->isContentChanged() )
543*cdf0e10cSrcweir                         mpShapeManager->notifyShapeUpdate( mpShape );
544*cdf0e10cSrcweir 
545*cdf0e10cSrcweir                     return true;
546*cdf0e10cSrcweir                 }
547*cdf0e10cSrcweir 
548*cdf0e10cSrcweir                 /** For by-value interfaces (bool, double)
549*cdf0e10cSrcweir                  */
550*cdf0e10cSrcweir                 bool operator()( ValueT x )
551*cdf0e10cSrcweir                 {
552*cdf0e10cSrcweir                     ENSURE_OR_RETURN_FALSE( mpAttrLayer && mpShape,
553*cdf0e10cSrcweir                                        "GenericAnimation::operator(): Invalid ShapeAttributeLayer" );
554*cdf0e10cSrcweir 
555*cdf0e10cSrcweir                     ((*mpAttrLayer).*mpSetValueFunc)( maSetterModifier( x ) );
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir                     if( mpShape->isContentChanged() )
558*cdf0e10cSrcweir                         mpShapeManager->notifyShapeUpdate( mpShape );
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir                     return true;
561*cdf0e10cSrcweir                 }
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir                 ValueT getUnderlyingValue() const
564*cdf0e10cSrcweir                 {
565*cdf0e10cSrcweir                     ENSURE_OR_THROW( mpAttrLayer,
566*cdf0e10cSrcweir                                       "GenericAnimation::getUnderlyingValue(): Invalid ShapeAttributeLayer" );
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir                     // deviated from the (*shared_ptr).*mpFuncPtr
569*cdf0e10cSrcweir                     // notation here, since gcc does not seem to parse
570*cdf0e10cSrcweir                     // that as a member function call anymore.
571*cdf0e10cSrcweir                     if( (mpAttrLayer.get()->*mpIsValidFunc)() )
572*cdf0e10cSrcweir                         return maGetterModifier( ((*mpAttrLayer).*mpGetValueFunc)() );
573*cdf0e10cSrcweir                     else
574*cdf0e10cSrcweir                         return maDefaultValue;
575*cdf0e10cSrcweir                 }
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir             private:
578*cdf0e10cSrcweir                 AnimatableShapeSharedPtr		   mpShape;
579*cdf0e10cSrcweir                 ShapeAttributeLayerSharedPtr	   mpAttrLayer;
580*cdf0e10cSrcweir                 ShapeManagerSharedPtr			   mpShapeManager;
581*cdf0e10cSrcweir                 bool 		(ShapeAttributeLayer::*mpIsValidFunc)() const;
582*cdf0e10cSrcweir                 ValueT	 	(ShapeAttributeLayer::*mpGetValueFunc)() const;
583*cdf0e10cSrcweir                 void 		(ShapeAttributeLayer::*mpSetValueFunc)( const ValueT& );
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir                 ModifierFunctor					   maGetterModifier;
586*cdf0e10cSrcweir                 ModifierFunctor					   maSetterModifier;
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir                 const int						   mnFlags;
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir                 const ValueT				 	   maDefaultValue;
591*cdf0e10cSrcweir                 bool							   mbAnimationStarted;
592*cdf0e10cSrcweir             };
593*cdf0e10cSrcweir 
594*cdf0e10cSrcweir             /** Function template wrapper around GenericAnimation template
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir             	@tpl AnimationBase
597*cdf0e10cSrcweir                 Type of animation to generate (determines the
598*cdf0e10cSrcweir                 interface GenericAnimation will implement).
599*cdf0e10cSrcweir              */
600*cdf0e10cSrcweir             template< typename AnimationBase > ::boost::shared_ptr< AnimationBase >
601*cdf0e10cSrcweir             	makeGenericAnimation( const ShapeManagerSharedPtr&							   rShapeManager,
602*cdf0e10cSrcweir                                       int													   nFlags,
603*cdf0e10cSrcweir                                       bool 								(ShapeAttributeLayer::*pIsValid)() const,
604*cdf0e10cSrcweir                                       const typename AnimationBase::ValueType&				   rDefaultValue,
605*cdf0e10cSrcweir                                       typename AnimationBase::ValueType (ShapeAttributeLayer::*pGetValue)() const,
606*cdf0e10cSrcweir                                       void 								(ShapeAttributeLayer::*pSetValue)( const typename AnimationBase::ValueType& ) )
607*cdf0e10cSrcweir             {
608*cdf0e10cSrcweir                 return ::boost::shared_ptr< AnimationBase >(
609*cdf0e10cSrcweir                     new GenericAnimation< AnimationBase,
610*cdf0e10cSrcweir                     					  ::std::identity< typename AnimationBase::ValueType > >(
611*cdf0e10cSrcweir                                               rShapeManager,
612*cdf0e10cSrcweir                                               nFlags,
613*cdf0e10cSrcweir                                               pIsValid,
614*cdf0e10cSrcweir                                               rDefaultValue,
615*cdf0e10cSrcweir                                               pGetValue,
616*cdf0e10cSrcweir                                               pSetValue,
617*cdf0e10cSrcweir                                               // no modification necessary, use identity functor here
618*cdf0e10cSrcweir                                               ::std::identity< typename AnimationBase::ValueType >(),
619*cdf0e10cSrcweir                                               ::std::identity< typename AnimationBase::ValueType >() ) );
620*cdf0e10cSrcweir             }
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir             class Scaler
623*cdf0e10cSrcweir             {
624*cdf0e10cSrcweir             public:
625*cdf0e10cSrcweir                 Scaler( double nScale ) :
626*cdf0e10cSrcweir                     mnScale( nScale )
627*cdf0e10cSrcweir                 {
628*cdf0e10cSrcweir                 }
629*cdf0e10cSrcweir 
630*cdf0e10cSrcweir                 double operator()( double nVal ) const
631*cdf0e10cSrcweir                 {
632*cdf0e10cSrcweir                     return mnScale * nVal;
633*cdf0e10cSrcweir                 }
634*cdf0e10cSrcweir 
635*cdf0e10cSrcweir             private:
636*cdf0e10cSrcweir                 double mnScale;
637*cdf0e10cSrcweir             };
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir             /** Overload for NumberAnimations which need scaling (width,height,x,y currently)
640*cdf0e10cSrcweir              */
641*cdf0e10cSrcweir             NumberAnimationSharedPtr makeGenericAnimation( const ShapeManagerSharedPtr&							    rShapeManager,
642*cdf0e10cSrcweir                                                            int													    nFlags,
643*cdf0e10cSrcweir                                                            bool 							 (ShapeAttributeLayer::*pIsValid)() const,
644*cdf0e10cSrcweir                                                            double				    								nDefaultValue,
645*cdf0e10cSrcweir                                                            double							 (ShapeAttributeLayer::*pGetValue)() const,
646*cdf0e10cSrcweir                                                            void 							 (ShapeAttributeLayer::*pSetValue)( const double& ),
647*cdf0e10cSrcweir                                                            double								 				    nScaleValue )
648*cdf0e10cSrcweir             {
649*cdf0e10cSrcweir                 return NumberAnimationSharedPtr(
650*cdf0e10cSrcweir                     new GenericAnimation< NumberAnimation, Scaler >( rShapeManager,
651*cdf0e10cSrcweir                                                                      nFlags,
652*cdf0e10cSrcweir                                                                      pIsValid,
653*cdf0e10cSrcweir                                                                      nDefaultValue / nScaleValue,
654*cdf0e10cSrcweir                                                                      pGetValue,
655*cdf0e10cSrcweir                                                                      pSetValue,
656*cdf0e10cSrcweir                                                                      Scaler( 1.0/nScaleValue ),
657*cdf0e10cSrcweir                                                                      Scaler( nScaleValue ) ) );
658*cdf0e10cSrcweir             }
659*cdf0e10cSrcweir 
660*cdf0e10cSrcweir 
661*cdf0e10cSrcweir             uno::Any getShapeDefault( const AnimatableShapeSharedPtr& 	rShape,
662*cdf0e10cSrcweir                                       const ::rtl::OUString& 			rPropertyName )
663*cdf0e10cSrcweir             {
664*cdf0e10cSrcweir                 uno::Reference< drawing::XShape > xShape( rShape->getXShape() );
665*cdf0e10cSrcweir 
666*cdf0e10cSrcweir                 if( !xShape.is() )
667*cdf0e10cSrcweir                     return uno::Any(); // no regular shape, no defaults available
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir                 // extract relevant value from XShape's PropertySet
671*cdf0e10cSrcweir                 uno::Reference< beans::XPropertySet > xPropSet( xShape,
672*cdf0e10cSrcweir                                                                 uno::UNO_QUERY );
673*cdf0e10cSrcweir 
674*cdf0e10cSrcweir                 ENSURE_OR_THROW( xPropSet.is(),
675*cdf0e10cSrcweir                                   "getShapeDefault(): Cannot query property set from shape" );
676*cdf0e10cSrcweir 
677*cdf0e10cSrcweir                 return xPropSet->getPropertyValue( rPropertyName );
678*cdf0e10cSrcweir             }
679*cdf0e10cSrcweir 
680*cdf0e10cSrcweir             template< typename ValueType > ValueType getDefault( const AnimatableShapeSharedPtr& 	rShape,
681*cdf0e10cSrcweir                                                                  const ::rtl::OUString& 			rPropertyName )
682*cdf0e10cSrcweir             {
683*cdf0e10cSrcweir                 const uno::Any& rAny( getShapeDefault( rShape,
684*cdf0e10cSrcweir                                                        rPropertyName ) );
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir                 if( !rAny.hasValue() )
687*cdf0e10cSrcweir                 {
688*cdf0e10cSrcweir                     OSL_ENSURE( false, "getDefault(): cannot get requested shape property" );
689*cdf0e10cSrcweir                     OSL_TRACE( "getDefault(): cannot get '%s' shape property",
690*cdf0e10cSrcweir                                ::rtl::OUStringToOString( rPropertyName,
691*cdf0e10cSrcweir                                                          RTL_TEXTENCODING_ASCII_US ).getStr() );
692*cdf0e10cSrcweir                     return ValueType();
693*cdf0e10cSrcweir                 }
694*cdf0e10cSrcweir                 else
695*cdf0e10cSrcweir                 {
696*cdf0e10cSrcweir                     ValueType aValue = ValueType();
697*cdf0e10cSrcweir 
698*cdf0e10cSrcweir                     if( !(rAny >>= aValue) )
699*cdf0e10cSrcweir                     {
700*cdf0e10cSrcweir                         OSL_ENSURE( false, "getDefault(): cannot extract requested shape property" );
701*cdf0e10cSrcweir                         OSL_TRACE( "getDefault(): cannot extract '%s' shape property",
702*cdf0e10cSrcweir                                    ::rtl::OUStringToOString( rPropertyName,
703*cdf0e10cSrcweir                                                              RTL_TEXTENCODING_ASCII_US ).getStr() );
704*cdf0e10cSrcweir                         return ValueType();
705*cdf0e10cSrcweir                     }
706*cdf0e10cSrcweir 
707*cdf0e10cSrcweir                     return aValue;
708*cdf0e10cSrcweir                 }
709*cdf0e10cSrcweir             }
710*cdf0e10cSrcweir 
711*cdf0e10cSrcweir             template<> RGBColor getDefault< RGBColor >( const AnimatableShapeSharedPtr& rShape,
712*cdf0e10cSrcweir                                                         const ::rtl::OUString& 			rPropertyName )
713*cdf0e10cSrcweir             {
714*cdf0e10cSrcweir                 const uno::Any& rAny( getShapeDefault( rShape,
715*cdf0e10cSrcweir                                                        rPropertyName ) );
716*cdf0e10cSrcweir 
717*cdf0e10cSrcweir                 if( !rAny.hasValue() )
718*cdf0e10cSrcweir                 {
719*cdf0e10cSrcweir                     OSL_ENSURE( false, "getDefault(): cannot get requested shape color property" );
720*cdf0e10cSrcweir                     OSL_TRACE( "getDefault(): cannot get '%s' shape color property",
721*cdf0e10cSrcweir                                ::rtl::OUStringToOString( rPropertyName,
722*cdf0e10cSrcweir                                                          RTL_TEXTENCODING_ASCII_US ).getStr() );
723*cdf0e10cSrcweir                     return RGBColor();
724*cdf0e10cSrcweir                 }
725*cdf0e10cSrcweir                 else
726*cdf0e10cSrcweir                 {
727*cdf0e10cSrcweir                     sal_Int32 nValue = 0;
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir                     if( !(rAny >>= nValue) )
730*cdf0e10cSrcweir                     {
731*cdf0e10cSrcweir                         OSL_ENSURE( false, "getDefault(): cannot extract requested shape color property" );
732*cdf0e10cSrcweir                         OSL_TRACE( "getDefault(): cannot extract '%s' shape color property",
733*cdf0e10cSrcweir                                    ::rtl::OUStringToOString( rPropertyName,
734*cdf0e10cSrcweir                                                              RTL_TEXTENCODING_ASCII_US ).getStr() );
735*cdf0e10cSrcweir                         return RGBColor();
736*cdf0e10cSrcweir                     }
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir                     // convert from 0xAARRGGBB API color to 0xRRGGBB00
739*cdf0e10cSrcweir                     // canvas color
740*cdf0e10cSrcweir                     return RGBColor( (nValue << 8U) & 0xFFFFFF00U );
741*cdf0e10cSrcweir                 }
742*cdf0e10cSrcweir             }
743*cdf0e10cSrcweir         }
744*cdf0e10cSrcweir 
745*cdf0e10cSrcweir         AnimationFactory::AttributeClass AnimationFactory::classifyAttributeName( const ::rtl::OUString& rAttrName )
746*cdf0e10cSrcweir         {
747*cdf0e10cSrcweir             // ATTENTION: When changing this map, also the create*PropertyAnimation() methods must
748*cdf0e10cSrcweir             // be checked and possibly adapted in their switch statements
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir             // TODO(Q2): Since this map must be coherent with the various switch statements
751*cdf0e10cSrcweir             // in the create*PropertyAnimation methods, try to unify into a single method or table
752*cdf0e10cSrcweir             switch( mapAttributeName( rAttrName ) )
753*cdf0e10cSrcweir             {
754*cdf0e10cSrcweir                 default:
755*cdf0e10cSrcweir                     // FALLTHROUGH intended
756*cdf0e10cSrcweir                 case ATTRIBUTE_INVALID:
757*cdf0e10cSrcweir                     return CLASS_UNKNOWN_PROPERTY;
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_COLOR:
760*cdf0e10cSrcweir                     // FALLTHROUGH intended
761*cdf0e10cSrcweir                 case ATTRIBUTE_COLOR:
762*cdf0e10cSrcweir                     // FALLTHROUGH intended
763*cdf0e10cSrcweir                 case ATTRIBUTE_DIMCOLOR:
764*cdf0e10cSrcweir                     // FALLTHROUGH intended
765*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_COLOR:
766*cdf0e10cSrcweir                     // FALLTHROUGH intended
767*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_COLOR:
768*cdf0e10cSrcweir                     return CLASS_COLOR_PROPERTY;
769*cdf0e10cSrcweir 
770*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_FONT_NAME:
771*cdf0e10cSrcweir                     return CLASS_STRING_PROPERTY;
772*cdf0e10cSrcweir 
773*cdf0e10cSrcweir                 case ATTRIBUTE_VISIBILITY:
774*cdf0e10cSrcweir                     return CLASS_BOOL_PROPERTY;
775*cdf0e10cSrcweir 
776*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_HEIGHT:
777*cdf0e10cSrcweir                     // FALLTHROUGH intended
778*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_WEIGHT:
779*cdf0e10cSrcweir                     // FALLTHROUGH intended
780*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_ROTATION:
781*cdf0e10cSrcweir                     // FALLTHROUGH intended
782*cdf0e10cSrcweir                 case ATTRIBUTE_HEIGHT:
783*cdf0e10cSrcweir                     // FALLTHROUGH intended
784*cdf0e10cSrcweir                 case ATTRIBUTE_OPACITY:
785*cdf0e10cSrcweir                     // FALLTHROUGH intended
786*cdf0e10cSrcweir                 case ATTRIBUTE_ROTATE:
787*cdf0e10cSrcweir                     // FALLTHROUGH intended
788*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_X:
789*cdf0e10cSrcweir                     // FALLTHROUGH intended
790*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_Y:
791*cdf0e10cSrcweir                     // FALLTHROUGH intended
792*cdf0e10cSrcweir                 case ATTRIBUTE_WIDTH:
793*cdf0e10cSrcweir                     // FALLTHROUGH intended
794*cdf0e10cSrcweir                 case ATTRIBUTE_POS_X:
795*cdf0e10cSrcweir                     // FALLTHROUGH intended
796*cdf0e10cSrcweir                 case ATTRIBUTE_POS_Y:
797*cdf0e10cSrcweir                     return CLASS_NUMBER_PROPERTY;
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_UNDERLINE:
800*cdf0e10cSrcweir                     // FALLTHROUGH intended
801*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_STYLE:
802*cdf0e10cSrcweir                     // FALLTHROUGH intended
803*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_STYLE:
804*cdf0e10cSrcweir                     // FALLTHROUGH intended
805*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_POSTURE:
806*cdf0e10cSrcweir                     return CLASS_ENUM_PROPERTY;
807*cdf0e10cSrcweir             }
808*cdf0e10cSrcweir         }
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir         NumberAnimationSharedPtr AnimationFactory::createNumberPropertyAnimation( const ::rtl::OUString&				rAttrName,
811*cdf0e10cSrcweir                                                                                   const AnimatableShapeSharedPtr&		rShape,
812*cdf0e10cSrcweir                                                                                   const ShapeManagerSharedPtr&			rShapeManager,
813*cdf0e10cSrcweir                                                                                   const ::basegfx::B2DVector&           rSlideSize,
814*cdf0e10cSrcweir                                                                                   int									nFlags )
815*cdf0e10cSrcweir         {
816*cdf0e10cSrcweir             // ATTENTION: When changing this map, also the classifyAttributeName() method must
817*cdf0e10cSrcweir             // be checked and possibly adapted in their switch statement
818*cdf0e10cSrcweir             switch( mapAttributeName( rAttrName ) )
819*cdf0e10cSrcweir             {
820*cdf0e10cSrcweir                 default:
821*cdf0e10cSrcweir                     // FALLTHROUGH intended
822*cdf0e10cSrcweir                 case ATTRIBUTE_INVALID:
823*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
824*cdf0e10cSrcweir                                       "AnimationFactory::createNumberPropertyAnimation(): Unknown attribute" );
825*cdf0e10cSrcweir                     break;
826*cdf0e10cSrcweir 
827*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_COLOR:
828*cdf0e10cSrcweir                     // FALLTHROUGH intended
829*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_FONT_NAME:
830*cdf0e10cSrcweir                     // FALLTHROUGH intended
831*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_POSTURE:
832*cdf0e10cSrcweir                     // FALLTHROUGH intended
833*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_UNDERLINE:
834*cdf0e10cSrcweir                     // FALLTHROUGH intended
835*cdf0e10cSrcweir                 case ATTRIBUTE_COLOR:
836*cdf0e10cSrcweir                     // FALLTHROUGH intended
837*cdf0e10cSrcweir                 case ATTRIBUTE_DIMCOLOR:
838*cdf0e10cSrcweir                     // FALLTHROUGH intended
839*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_COLOR:
840*cdf0e10cSrcweir                     // FALLTHROUGH intended
841*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_STYLE:
842*cdf0e10cSrcweir                     // FALLTHROUGH intended
843*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_COLOR:
844*cdf0e10cSrcweir                     // FALLTHROUGH intended
845*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_STYLE:
846*cdf0e10cSrcweir                     // FALLTHROUGH intended
847*cdf0e10cSrcweir                 case ATTRIBUTE_VISIBILITY:
848*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
849*cdf0e10cSrcweir                                       "AnimationFactory::createNumberPropertyAnimation(): Attribute type mismatch" );
850*cdf0e10cSrcweir                     break;
851*cdf0e10cSrcweir 
852*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_HEIGHT:
853*cdf0e10cSrcweir                     return makeGenericAnimation<NumberAnimation>( rShapeManager,
854*cdf0e10cSrcweir                                                                   nFlags,
855*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isCharScaleValid,
856*cdf0e10cSrcweir                                                                   1.0, // CharHeight is a relative attribute, thus
857*cdf0e10cSrcweir                                                                   	   // default is 1.0
858*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getCharScale,
859*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setCharScale );
860*cdf0e10cSrcweir 
861*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_WEIGHT:
862*cdf0e10cSrcweir                     return makeGenericAnimation<NumberAnimation>( rShapeManager,
863*cdf0e10cSrcweir                                                                   nFlags,
864*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isCharWeightValid,
865*cdf0e10cSrcweir                                                                   getDefault<double>( rShape, rAttrName ),
866*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getCharWeight,
867*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setCharWeight );
868*cdf0e10cSrcweir 
869*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_ROTATION:
870*cdf0e10cSrcweir                     return makeGenericAnimation<NumberAnimation>( rShapeManager,
871*cdf0e10cSrcweir                                                                   nFlags,
872*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isCharRotationAngleValid,
873*cdf0e10cSrcweir                                                                   getDefault<double>( rShape, rAttrName ),
874*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getCharRotationAngle,
875*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setCharRotationAngle );
876*cdf0e10cSrcweir 
877*cdf0e10cSrcweir                 case ATTRIBUTE_HEIGHT:
878*cdf0e10cSrcweir                     return makeGenericAnimation( rShapeManager,
879*cdf0e10cSrcweir                                                  nFlags,
880*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::isHeightValid,
881*cdf0e10cSrcweir                                                  // TODO(F1): Check whether _shape_ bounds are correct here.
882*cdf0e10cSrcweir                                                  // Theoretically, our AttrLayer is way down the stack, and
883*cdf0e10cSrcweir                                                  // we only have to consider _that_ value, not the one from
884*cdf0e10cSrcweir                                                  // the top of the stack as returned by Shape::getBounds()
885*cdf0e10cSrcweir                                                  rShape->getBounds().getHeight(),
886*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::getHeight,
887*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::setHeight,
888*cdf0e10cSrcweir                                                  // convert expression parser value from relative page size
889*cdf0e10cSrcweir                                                  rSlideSize.getY() );
890*cdf0e10cSrcweir 
891*cdf0e10cSrcweir                 case ATTRIBUTE_OPACITY:
892*cdf0e10cSrcweir                     return makeGenericAnimation<NumberAnimation>( rShapeManager,
893*cdf0e10cSrcweir                                                                   nFlags,
894*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isAlphaValid,
895*cdf0e10cSrcweir                                                                   // TODO(F1): Provide shape default here (FillTransparency?)
896*cdf0e10cSrcweir                                                                   1.0,
897*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getAlpha,
898*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setAlpha );
899*cdf0e10cSrcweir 
900*cdf0e10cSrcweir                 case ATTRIBUTE_ROTATE:
901*cdf0e10cSrcweir                     return makeGenericAnimation<NumberAnimation>( rShapeManager,
902*cdf0e10cSrcweir                                                                   nFlags,
903*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isRotationAngleValid,
904*cdf0e10cSrcweir                                                                   // NOTE: Since we paint the shape as-is from metafile,
905*cdf0e10cSrcweir                                                                   // rotation angle is always 0.0, even for rotated shapes
906*cdf0e10cSrcweir                                                                   0.0,
907*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getRotationAngle,
908*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setRotationAngle );
909*cdf0e10cSrcweir 
910*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_X:
911*cdf0e10cSrcweir                     return makeGenericAnimation<NumberAnimation>( rShapeManager,
912*cdf0e10cSrcweir                                                                   nFlags,
913*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isShearXAngleValid,
914*cdf0e10cSrcweir                                                                   // TODO(F1): Is there any shape property for skew?
915*cdf0e10cSrcweir                                                                   0.0,
916*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getShearXAngle,
917*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setShearXAngle );
918*cdf0e10cSrcweir 
919*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_Y:
920*cdf0e10cSrcweir                     return makeGenericAnimation<NumberAnimation>( rShapeManager,
921*cdf0e10cSrcweir                                                                   nFlags,
922*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isShearYAngleValid,
923*cdf0e10cSrcweir                                                                   // TODO(F1): Is there any shape property for skew?
924*cdf0e10cSrcweir                                                                   0.0,
925*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getShearYAngle,
926*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setShearYAngle );
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir                 case ATTRIBUTE_WIDTH:
929*cdf0e10cSrcweir                     return makeGenericAnimation( rShapeManager,
930*cdf0e10cSrcweir                                                  nFlags,
931*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::isWidthValid,
932*cdf0e10cSrcweir                                                  // TODO(F1): Check whether _shape_ bounds are correct here.
933*cdf0e10cSrcweir                                                  // Theoretically, our AttrLayer is way down the stack, and
934*cdf0e10cSrcweir                                                  // we only have to consider _that_ value, not the one from
935*cdf0e10cSrcweir                                                  // the top of the stack as returned by Shape::getBounds()
936*cdf0e10cSrcweir                                                  rShape->getBounds().getWidth(),
937*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::getWidth,
938*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::setWidth,
939*cdf0e10cSrcweir                                                  // convert expression parser value from relative page size
940*cdf0e10cSrcweir                                                  rSlideSize.getX() );
941*cdf0e10cSrcweir 
942*cdf0e10cSrcweir                 case ATTRIBUTE_POS_X:
943*cdf0e10cSrcweir                     return makeGenericAnimation( rShapeManager,
944*cdf0e10cSrcweir                                                  nFlags,
945*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::isPosXValid,
946*cdf0e10cSrcweir                                                  // TODO(F1): Check whether _shape_ bounds are correct here.
947*cdf0e10cSrcweir                                                  // Theoretically, our AttrLayer is way down the stack, and
948*cdf0e10cSrcweir                                                  // we only have to consider _that_ value, not the one from
949*cdf0e10cSrcweir                                                  // the top of the stack as returned by Shape::getBounds()
950*cdf0e10cSrcweir                                                  rShape->getBounds().getCenterX(),
951*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::getPosX,
952*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::setPosX,
953*cdf0e10cSrcweir                                                  // convert expression parser value from relative page size
954*cdf0e10cSrcweir                                                  rSlideSize.getX() );
955*cdf0e10cSrcweir 
956*cdf0e10cSrcweir                 case ATTRIBUTE_POS_Y:
957*cdf0e10cSrcweir                     return makeGenericAnimation( rShapeManager,
958*cdf0e10cSrcweir                                                  nFlags,
959*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::isPosYValid,
960*cdf0e10cSrcweir                                                  // TODO(F1): Check whether _shape_ bounds are correct here.
961*cdf0e10cSrcweir                                                  // Theoretically, our AttrLayer is way down the stack, and
962*cdf0e10cSrcweir                                                  // we only have to consider _that_ value, not the one from
963*cdf0e10cSrcweir                                                  // the top of the stack as returned by Shape::getBounds()
964*cdf0e10cSrcweir                                                  rShape->getBounds().getCenterY(),
965*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::getPosY,
966*cdf0e10cSrcweir                                                  &ShapeAttributeLayer::setPosY,
967*cdf0e10cSrcweir                                                  // convert expression parser value from relative page size
968*cdf0e10cSrcweir                                                  rSlideSize.getY() );
969*cdf0e10cSrcweir             }
970*cdf0e10cSrcweir 
971*cdf0e10cSrcweir             return NumberAnimationSharedPtr();
972*cdf0e10cSrcweir         }
973*cdf0e10cSrcweir 
974*cdf0e10cSrcweir         EnumAnimationSharedPtr AnimationFactory::createEnumPropertyAnimation( const ::rtl::OUString&				rAttrName,
975*cdf0e10cSrcweir                                                                               const AnimatableShapeSharedPtr&		rShape,
976*cdf0e10cSrcweir                                                                               const ShapeManagerSharedPtr&			rShapeManager,
977*cdf0e10cSrcweir                                                                               const ::basegfx::B2DVector&           /*rSlideSize*/,
978*cdf0e10cSrcweir                                                                               int									nFlags )
979*cdf0e10cSrcweir         {
980*cdf0e10cSrcweir             // ATTENTION: When changing this map, also the classifyAttributeName() method must
981*cdf0e10cSrcweir             // be checked and possibly adapted in their switch statement
982*cdf0e10cSrcweir             switch( mapAttributeName( rAttrName ) )
983*cdf0e10cSrcweir             {
984*cdf0e10cSrcweir                 default:
985*cdf0e10cSrcweir                     // FALLTHROUGH intended
986*cdf0e10cSrcweir                 case ATTRIBUTE_INVALID:
987*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
988*cdf0e10cSrcweir                                       "AnimationFactory::createEnumPropertyAnimation(): Unknown attribute" );
989*cdf0e10cSrcweir                     break;
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_COLOR:
992*cdf0e10cSrcweir                     // FALLTHROUGH intended
993*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_FONT_NAME:
994*cdf0e10cSrcweir                     // FALLTHROUGH intended
995*cdf0e10cSrcweir                 case ATTRIBUTE_COLOR:
996*cdf0e10cSrcweir                     // FALLTHROUGH intended
997*cdf0e10cSrcweir                 case ATTRIBUTE_DIMCOLOR:
998*cdf0e10cSrcweir                     // FALLTHROUGH intended
999*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_COLOR:
1000*cdf0e10cSrcweir                     // FALLTHROUGH intended
1001*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_COLOR:
1002*cdf0e10cSrcweir                     // FALLTHROUGH intended
1003*cdf0e10cSrcweir                 case ATTRIBUTE_VISIBILITY:
1004*cdf0e10cSrcweir                     // FALLTHROUGH intended
1005*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_HEIGHT:
1006*cdf0e10cSrcweir                     // FALLTHROUGH intended
1007*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_WEIGHT:
1008*cdf0e10cSrcweir                     // FALLTHROUGH intended
1009*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_ROTATION:
1010*cdf0e10cSrcweir                     // FALLTHROUGH intended
1011*cdf0e10cSrcweir                 case ATTRIBUTE_HEIGHT:
1012*cdf0e10cSrcweir                     // FALLTHROUGH intended
1013*cdf0e10cSrcweir                 case ATTRIBUTE_OPACITY:
1014*cdf0e10cSrcweir                     // FALLTHROUGH intended
1015*cdf0e10cSrcweir                 case ATTRIBUTE_ROTATE:
1016*cdf0e10cSrcweir                     // FALLTHROUGH intended
1017*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_X:
1018*cdf0e10cSrcweir                     // FALLTHROUGH intended
1019*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_Y:
1020*cdf0e10cSrcweir                     // FALLTHROUGH intended
1021*cdf0e10cSrcweir                 case ATTRIBUTE_WIDTH:
1022*cdf0e10cSrcweir                     // FALLTHROUGH intended
1023*cdf0e10cSrcweir                 case ATTRIBUTE_POS_X:
1024*cdf0e10cSrcweir                     // FALLTHROUGH intended
1025*cdf0e10cSrcweir                 case ATTRIBUTE_POS_Y:
1026*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1027*cdf0e10cSrcweir                                       "AnimationFactory::createEnumPropertyAnimation(): Attribute type mismatch" );
1028*cdf0e10cSrcweir                     break;
1029*cdf0e10cSrcweir 
1030*cdf0e10cSrcweir 
1031*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_STYLE:
1032*cdf0e10cSrcweir                     return makeGenericAnimation<EnumAnimation>( rShapeManager,
1033*cdf0e10cSrcweir                                                                 nFlags,
1034*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::isFillStyleValid,
1035*cdf0e10cSrcweir                                                                 sal::static_int_cast<sal_Int16>(
1036*cdf0e10cSrcweir                                                                     getDefault<drawing::FillStyle>( rShape, rAttrName )),
1037*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::getFillStyle,
1038*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::setFillStyle );
1039*cdf0e10cSrcweir 
1040*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_STYLE:
1041*cdf0e10cSrcweir                     return makeGenericAnimation<EnumAnimation>( rShapeManager,
1042*cdf0e10cSrcweir                                                                 nFlags,
1043*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::isLineStyleValid,
1044*cdf0e10cSrcweir                                                                 sal::static_int_cast<sal_Int16>(
1045*cdf0e10cSrcweir                                                                     getDefault<drawing::LineStyle>( rShape, rAttrName )),
1046*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::getLineStyle,
1047*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::setLineStyle );
1048*cdf0e10cSrcweir 
1049*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_POSTURE:
1050*cdf0e10cSrcweir                     return makeGenericAnimation<EnumAnimation>( rShapeManager,
1051*cdf0e10cSrcweir                                                                 nFlags,
1052*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::isCharPostureValid,
1053*cdf0e10cSrcweir                                                                 sal::static_int_cast<sal_Int16>(
1054*cdf0e10cSrcweir                                                                     getDefault<awt::FontSlant>( rShape, rAttrName )),
1055*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::getCharPosture,
1056*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::setCharPosture );
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_UNDERLINE:
1059*cdf0e10cSrcweir                     return makeGenericAnimation<EnumAnimation>( rShapeManager,
1060*cdf0e10cSrcweir                                                                 nFlags,
1061*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::isUnderlineModeValid,
1062*cdf0e10cSrcweir                                                                 getDefault<sal_Int16>( rShape, rAttrName ),
1063*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::getUnderlineMode,
1064*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::setUnderlineMode );
1065*cdf0e10cSrcweir             }
1066*cdf0e10cSrcweir 
1067*cdf0e10cSrcweir             return EnumAnimationSharedPtr();
1068*cdf0e10cSrcweir         }
1069*cdf0e10cSrcweir 
1070*cdf0e10cSrcweir         ColorAnimationSharedPtr AnimationFactory::createColorPropertyAnimation( const ::rtl::OUString&				rAttrName,
1071*cdf0e10cSrcweir                                                                                 const AnimatableShapeSharedPtr&		rShape,
1072*cdf0e10cSrcweir                                                                                 const ShapeManagerSharedPtr&		rShapeManager,
1073*cdf0e10cSrcweir                                                                                 const ::basegfx::B2DVector&         /*rSlideSize*/,
1074*cdf0e10cSrcweir                                                                                 int									nFlags )
1075*cdf0e10cSrcweir         {
1076*cdf0e10cSrcweir             // ATTENTION: When changing this map, also the classifyAttributeName() method must
1077*cdf0e10cSrcweir             // be checked and possibly adapted in their switch statement
1078*cdf0e10cSrcweir             switch( mapAttributeName( rAttrName ) )
1079*cdf0e10cSrcweir             {
1080*cdf0e10cSrcweir                 default:
1081*cdf0e10cSrcweir                     // FALLTHROUGH intended
1082*cdf0e10cSrcweir                 case ATTRIBUTE_INVALID:
1083*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1084*cdf0e10cSrcweir                                       "AnimationFactory::createColorPropertyAnimation(): Unknown attribute" );
1085*cdf0e10cSrcweir                     break;
1086*cdf0e10cSrcweir 
1087*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_FONT_NAME:
1088*cdf0e10cSrcweir                     // FALLTHROUGH intended
1089*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_HEIGHT:
1090*cdf0e10cSrcweir                     // FALLTHROUGH intended
1091*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_POSTURE:
1092*cdf0e10cSrcweir                     // FALLTHROUGH intended
1093*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_ROTATION:
1094*cdf0e10cSrcweir                     // FALLTHROUGH intended
1095*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_UNDERLINE:
1096*cdf0e10cSrcweir                     // FALLTHROUGH intended
1097*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_WEIGHT:
1098*cdf0e10cSrcweir                     // FALLTHROUGH intended
1099*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_STYLE:
1100*cdf0e10cSrcweir                     // FALLTHROUGH intended
1101*cdf0e10cSrcweir                 case ATTRIBUTE_HEIGHT:
1102*cdf0e10cSrcweir                     // FALLTHROUGH intended
1103*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_STYLE:
1104*cdf0e10cSrcweir                     // FALLTHROUGH intended
1105*cdf0e10cSrcweir                 case ATTRIBUTE_OPACITY:
1106*cdf0e10cSrcweir                     // FALLTHROUGH intended
1107*cdf0e10cSrcweir                 case ATTRIBUTE_ROTATE:
1108*cdf0e10cSrcweir                     // FALLTHROUGH intended
1109*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_X:
1110*cdf0e10cSrcweir                     // FALLTHROUGH intended
1111*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_Y:
1112*cdf0e10cSrcweir                     // FALLTHROUGH intended
1113*cdf0e10cSrcweir                 case ATTRIBUTE_VISIBILITY:
1114*cdf0e10cSrcweir                     // FALLTHROUGH intended
1115*cdf0e10cSrcweir                 case ATTRIBUTE_WIDTH:
1116*cdf0e10cSrcweir                     // FALLTHROUGH intended
1117*cdf0e10cSrcweir                 case ATTRIBUTE_POS_X:
1118*cdf0e10cSrcweir                     // FALLTHROUGH intended
1119*cdf0e10cSrcweir                 case ATTRIBUTE_POS_Y:
1120*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1121*cdf0e10cSrcweir                                       "AnimationFactory::createColorPropertyAnimation(): Attribute type mismatch" );
1122*cdf0e10cSrcweir                     break;
1123*cdf0e10cSrcweir 
1124*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_COLOR:
1125*cdf0e10cSrcweir                     return makeGenericAnimation<ColorAnimation>( rShapeManager,
1126*cdf0e10cSrcweir                                                                  nFlags,
1127*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::isCharColorValid,
1128*cdf0e10cSrcweir                                                                  getDefault<RGBColor>( rShape, rAttrName ),
1129*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::getCharColor,
1130*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::setCharColor );
1131*cdf0e10cSrcweir 
1132*cdf0e10cSrcweir                 case ATTRIBUTE_COLOR:
1133*cdf0e10cSrcweir                     // TODO(F2): This is just mapped to fill color to make it work
1134*cdf0e10cSrcweir                     return makeGenericAnimation<ColorAnimation>( rShapeManager,
1135*cdf0e10cSrcweir                                                                  nFlags,
1136*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::isFillColorValid,
1137*cdf0e10cSrcweir                                                                  getDefault<RGBColor>( rShape, rAttrName ),
1138*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::getFillColor,
1139*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::setFillColor );
1140*cdf0e10cSrcweir 
1141*cdf0e10cSrcweir                 case ATTRIBUTE_DIMCOLOR:
1142*cdf0e10cSrcweir                     return makeGenericAnimation<ColorAnimation>( rShapeManager,
1143*cdf0e10cSrcweir                                                                  nFlags,
1144*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::isDimColorValid,
1145*cdf0e10cSrcweir                                                                  getDefault<RGBColor>( rShape, rAttrName ),
1146*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::getDimColor,
1147*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::setDimColor );
1148*cdf0e10cSrcweir 
1149*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_COLOR:
1150*cdf0e10cSrcweir                     return makeGenericAnimation<ColorAnimation>( rShapeManager,
1151*cdf0e10cSrcweir                                                                  nFlags,
1152*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::isFillColorValid,
1153*cdf0e10cSrcweir                                                                  getDefault<RGBColor>( rShape, rAttrName ),
1154*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::getFillColor,
1155*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::setFillColor );
1156*cdf0e10cSrcweir 
1157*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_COLOR:
1158*cdf0e10cSrcweir                     return makeGenericAnimation<ColorAnimation>( rShapeManager,
1159*cdf0e10cSrcweir                                                                  nFlags,
1160*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::isLineColorValid,
1161*cdf0e10cSrcweir                                                                  getDefault<RGBColor>( rShape, rAttrName ),
1162*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::getLineColor,
1163*cdf0e10cSrcweir                                                                  &ShapeAttributeLayer::setLineColor );
1164*cdf0e10cSrcweir             }
1165*cdf0e10cSrcweir 
1166*cdf0e10cSrcweir             return ColorAnimationSharedPtr();
1167*cdf0e10cSrcweir         }
1168*cdf0e10cSrcweir 
1169*cdf0e10cSrcweir         PairAnimationSharedPtr AnimationFactory::createPairPropertyAnimation( const AnimatableShapeSharedPtr&		rShape,
1170*cdf0e10cSrcweir                                                                               const ShapeManagerSharedPtr&			rShapeManager,
1171*cdf0e10cSrcweir                                                                               const ::basegfx::B2DVector&           rSlideSize,
1172*cdf0e10cSrcweir                                                                               sal_Int16								nTransformType,
1173*cdf0e10cSrcweir                                                                               int									nFlags )
1174*cdf0e10cSrcweir         {
1175*cdf0e10cSrcweir             const ::basegfx::B2DRectangle& rBounds( rShape->getBounds() );
1176*cdf0e10cSrcweir 
1177*cdf0e10cSrcweir             switch( nTransformType )
1178*cdf0e10cSrcweir             {
1179*cdf0e10cSrcweir                 case animations::AnimationTransformType::SCALE:
1180*cdf0e10cSrcweir                     return PairAnimationSharedPtr(
1181*cdf0e10cSrcweir                         new TupleAnimation< ::basegfx::B2DSize >(
1182*cdf0e10cSrcweir                             rShapeManager,
1183*cdf0e10cSrcweir                             nFlags,
1184*cdf0e10cSrcweir                             &ShapeAttributeLayer::isWidthValid,
1185*cdf0e10cSrcweir                             &ShapeAttributeLayer::isHeightValid,
1186*cdf0e10cSrcweir                             // TODO(F1): Check whether _shape_ bounds are correct here.
1187*cdf0e10cSrcweir                             // Theoretically, our AttrLayer is way down the stack, and
1188*cdf0e10cSrcweir                             // we only have to consider _that_ value, not the one from
1189*cdf0e10cSrcweir                             // the top of the stack as returned by Shape::getBounds()
1190*cdf0e10cSrcweir                             rBounds.getRange(),
1191*cdf0e10cSrcweir                             rBounds.getRange(),
1192*cdf0e10cSrcweir                             &ShapeAttributeLayer::getWidth,
1193*cdf0e10cSrcweir                             &ShapeAttributeLayer::getHeight,
1194*cdf0e10cSrcweir                             &ShapeAttributeLayer::setSize ) );
1195*cdf0e10cSrcweir 
1196*cdf0e10cSrcweir                 case animations::AnimationTransformType::TRANSLATE:
1197*cdf0e10cSrcweir                     return PairAnimationSharedPtr(
1198*cdf0e10cSrcweir                         new TupleAnimation< ::basegfx::B2DPoint >(
1199*cdf0e10cSrcweir                             rShapeManager,
1200*cdf0e10cSrcweir                             nFlags,
1201*cdf0e10cSrcweir                             &ShapeAttributeLayer::isPosXValid,
1202*cdf0e10cSrcweir                             &ShapeAttributeLayer::isPosYValid,
1203*cdf0e10cSrcweir                             // TODO(F1): Check whether _shape_ bounds are correct here.
1204*cdf0e10cSrcweir                             // Theoretically, our AttrLayer is way down the stack, and
1205*cdf0e10cSrcweir                             // we only have to consider _that_ value, not the one from
1206*cdf0e10cSrcweir                             // the top of the stack as returned by Shape::getBounds()
1207*cdf0e10cSrcweir                             rBounds.getCenter(),
1208*cdf0e10cSrcweir                             rSlideSize,
1209*cdf0e10cSrcweir                             &ShapeAttributeLayer::getPosX,
1210*cdf0e10cSrcweir                             &ShapeAttributeLayer::getPosY,
1211*cdf0e10cSrcweir                             &ShapeAttributeLayer::setPosition ) );
1212*cdf0e10cSrcweir 
1213*cdf0e10cSrcweir                 default:
1214*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1215*cdf0e10cSrcweir                                       "AnimationFactory::createPairPropertyAnimation(): Attribute type mismatch" );
1216*cdf0e10cSrcweir                     break;
1217*cdf0e10cSrcweir             }
1218*cdf0e10cSrcweir 
1219*cdf0e10cSrcweir             return PairAnimationSharedPtr();
1220*cdf0e10cSrcweir         }
1221*cdf0e10cSrcweir 
1222*cdf0e10cSrcweir         StringAnimationSharedPtr AnimationFactory::createStringPropertyAnimation( const ::rtl::OUString&				rAttrName,
1223*cdf0e10cSrcweir                                                                                   const AnimatableShapeSharedPtr&		rShape,
1224*cdf0e10cSrcweir                                                                                   const ShapeManagerSharedPtr&			rShapeManager,
1225*cdf0e10cSrcweir                                                                                   const ::basegfx::B2DVector&           /*rSlideSize*/,
1226*cdf0e10cSrcweir                                                                                   int									nFlags )
1227*cdf0e10cSrcweir         {
1228*cdf0e10cSrcweir             // ATTENTION: When changing this map, also the classifyAttributeName() method must
1229*cdf0e10cSrcweir             // be checked and possibly adapted in their switch statement
1230*cdf0e10cSrcweir             switch( mapAttributeName( rAttrName ) )
1231*cdf0e10cSrcweir             {
1232*cdf0e10cSrcweir                 default:
1233*cdf0e10cSrcweir                     // FALLTHROUGH intended
1234*cdf0e10cSrcweir                 case ATTRIBUTE_INVALID:
1235*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1236*cdf0e10cSrcweir                                       "AnimationFactory::createStringPropertyAnimation(): Unknown attribute" );
1237*cdf0e10cSrcweir                     break;
1238*cdf0e10cSrcweir 
1239*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_COLOR:
1240*cdf0e10cSrcweir                     // FALLTHROUGH intended
1241*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_HEIGHT:
1242*cdf0e10cSrcweir                     // FALLTHROUGH intended
1243*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_ROTATION:
1244*cdf0e10cSrcweir                     // FALLTHROUGH intended
1245*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_UNDERLINE:
1246*cdf0e10cSrcweir                     // FALLTHROUGH intended
1247*cdf0e10cSrcweir                 case ATTRIBUTE_COLOR:
1248*cdf0e10cSrcweir                     // FALLTHROUGH intended
1249*cdf0e10cSrcweir                 case ATTRIBUTE_DIMCOLOR:
1250*cdf0e10cSrcweir                     // FALLTHROUGH intended
1251*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_COLOR:
1252*cdf0e10cSrcweir                     // FALLTHROUGH intended
1253*cdf0e10cSrcweir                 case ATTRIBUTE_HEIGHT:
1254*cdf0e10cSrcweir                     // FALLTHROUGH intended
1255*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_COLOR:
1256*cdf0e10cSrcweir                     // FALLTHROUGH intended
1257*cdf0e10cSrcweir                 case ATTRIBUTE_OPACITY:
1258*cdf0e10cSrcweir                     // FALLTHROUGH intended
1259*cdf0e10cSrcweir                 case ATTRIBUTE_ROTATE:
1260*cdf0e10cSrcweir                     // FALLTHROUGH intended
1261*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_X:
1262*cdf0e10cSrcweir                     // FALLTHROUGH intended
1263*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_Y:
1264*cdf0e10cSrcweir                     // FALLTHROUGH intended
1265*cdf0e10cSrcweir                 case ATTRIBUTE_VISIBILITY:
1266*cdf0e10cSrcweir                     // FALLTHROUGH intended
1267*cdf0e10cSrcweir                 case ATTRIBUTE_WIDTH:
1268*cdf0e10cSrcweir                     // FALLTHROUGH intended
1269*cdf0e10cSrcweir                 case ATTRIBUTE_POS_X:
1270*cdf0e10cSrcweir                     // FALLTHROUGH intended
1271*cdf0e10cSrcweir                 case ATTRIBUTE_POS_Y:
1272*cdf0e10cSrcweir                     // FALLTHROUGH intended
1273*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_POSTURE:
1274*cdf0e10cSrcweir                     // FALLTHROUGH intended
1275*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_WEIGHT:
1276*cdf0e10cSrcweir                     // FALLTHROUGH intended
1277*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_STYLE:
1278*cdf0e10cSrcweir                     // FALLTHROUGH intended
1279*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_STYLE:
1280*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1281*cdf0e10cSrcweir                                       "AnimationFactory::createStringPropertyAnimation(): Attribute type mismatch" );
1282*cdf0e10cSrcweir                     break;
1283*cdf0e10cSrcweir 
1284*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_FONT_NAME:
1285*cdf0e10cSrcweir                     return makeGenericAnimation<StringAnimation>( rShapeManager,
1286*cdf0e10cSrcweir                                                                   nFlags,
1287*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::isFontFamilyValid,
1288*cdf0e10cSrcweir                                                                   getDefault< ::rtl::OUString >( rShape, rAttrName ),
1289*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::getFontFamily,
1290*cdf0e10cSrcweir                                                                   &ShapeAttributeLayer::setFontFamily );
1291*cdf0e10cSrcweir             }
1292*cdf0e10cSrcweir 
1293*cdf0e10cSrcweir             return StringAnimationSharedPtr();
1294*cdf0e10cSrcweir         }
1295*cdf0e10cSrcweir 
1296*cdf0e10cSrcweir         BoolAnimationSharedPtr AnimationFactory::createBoolPropertyAnimation( const ::rtl::OUString&				rAttrName,
1297*cdf0e10cSrcweir                                                                               const AnimatableShapeSharedPtr&		/*rShape*/,
1298*cdf0e10cSrcweir                                                                               const ShapeManagerSharedPtr&			rShapeManager,
1299*cdf0e10cSrcweir                                                                               const ::basegfx::B2DVector&           /*rSlideSize*/,
1300*cdf0e10cSrcweir                                                                               int									nFlags )
1301*cdf0e10cSrcweir         {
1302*cdf0e10cSrcweir             // ATTENTION: When changing this map, also the classifyAttributeName() method must
1303*cdf0e10cSrcweir             // be checked and possibly adapted in their switch statement
1304*cdf0e10cSrcweir             switch( mapAttributeName( rAttrName ) )
1305*cdf0e10cSrcweir             {
1306*cdf0e10cSrcweir                 default:
1307*cdf0e10cSrcweir                     // FALLTHROUGH intended
1308*cdf0e10cSrcweir                 case ATTRIBUTE_INVALID:
1309*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1310*cdf0e10cSrcweir                                       "AnimationFactory::createBoolPropertyAnimation(): Unknown attribute" );
1311*cdf0e10cSrcweir                     break;
1312*cdf0e10cSrcweir 
1313*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_COLOR:
1314*cdf0e10cSrcweir                     // FALLTHROUGH intended
1315*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_FONT_NAME:
1316*cdf0e10cSrcweir                     // FALLTHROUGH intended
1317*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_HEIGHT:
1318*cdf0e10cSrcweir                     // FALLTHROUGH intended
1319*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_POSTURE:
1320*cdf0e10cSrcweir                     // FALLTHROUGH intended
1321*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_ROTATION:
1322*cdf0e10cSrcweir                     // FALLTHROUGH intended
1323*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_WEIGHT:
1324*cdf0e10cSrcweir                     // FALLTHROUGH intended
1325*cdf0e10cSrcweir                 case ATTRIBUTE_COLOR:
1326*cdf0e10cSrcweir                     // FALLTHROUGH intended
1327*cdf0e10cSrcweir                 case ATTRIBUTE_DIMCOLOR:
1328*cdf0e10cSrcweir                     // FALLTHROUGH intended
1329*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_COLOR:
1330*cdf0e10cSrcweir                     // FALLTHROUGH intended
1331*cdf0e10cSrcweir                 case ATTRIBUTE_FILL_STYLE:
1332*cdf0e10cSrcweir                     // FALLTHROUGH intended
1333*cdf0e10cSrcweir                 case ATTRIBUTE_HEIGHT:
1334*cdf0e10cSrcweir                     // FALLTHROUGH intended
1335*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_COLOR:
1336*cdf0e10cSrcweir                     // FALLTHROUGH intended
1337*cdf0e10cSrcweir                 case ATTRIBUTE_LINE_STYLE:
1338*cdf0e10cSrcweir                     // FALLTHROUGH intended
1339*cdf0e10cSrcweir                 case ATTRIBUTE_OPACITY:
1340*cdf0e10cSrcweir                     // FALLTHROUGH intended
1341*cdf0e10cSrcweir                 case ATTRIBUTE_ROTATE:
1342*cdf0e10cSrcweir                     // FALLTHROUGH intended
1343*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_X:
1344*cdf0e10cSrcweir                     // FALLTHROUGH intended
1345*cdf0e10cSrcweir                 case ATTRIBUTE_SKEW_Y:
1346*cdf0e10cSrcweir                     // FALLTHROUGH intended
1347*cdf0e10cSrcweir                 case ATTRIBUTE_WIDTH:
1348*cdf0e10cSrcweir                     // FALLTHROUGH intended
1349*cdf0e10cSrcweir                 case ATTRIBUTE_POS_X:
1350*cdf0e10cSrcweir                     // FALLTHROUGH intended
1351*cdf0e10cSrcweir                 case ATTRIBUTE_POS_Y:
1352*cdf0e10cSrcweir                     // FALLTHROUGH intended
1353*cdf0e10cSrcweir                 case ATTRIBUTE_CHAR_UNDERLINE:
1354*cdf0e10cSrcweir                     ENSURE_OR_THROW( false,
1355*cdf0e10cSrcweir                                       "AnimationFactory::createBoolPropertyAnimation(): Attribute type mismatch" );
1356*cdf0e10cSrcweir                     break;
1357*cdf0e10cSrcweir 
1358*cdf0e10cSrcweir                 case ATTRIBUTE_VISIBILITY:
1359*cdf0e10cSrcweir                     return makeGenericAnimation<BoolAnimation>( rShapeManager,
1360*cdf0e10cSrcweir                                                                 nFlags,
1361*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::isVisibilityValid,
1362*cdf0e10cSrcweir                                                                 // TODO(F1): Is there a corresponding shape property?
1363*cdf0e10cSrcweir                                                                 true,
1364*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::getVisibility,
1365*cdf0e10cSrcweir                                                                 &ShapeAttributeLayer::setVisibility );
1366*cdf0e10cSrcweir             }
1367*cdf0e10cSrcweir 
1368*cdf0e10cSrcweir             return BoolAnimationSharedPtr();
1369*cdf0e10cSrcweir         }
1370*cdf0e10cSrcweir 
1371*cdf0e10cSrcweir         NumberAnimationSharedPtr AnimationFactory::createPathMotionAnimation( const ::rtl::OUString&			rSVGDPath,
1372*cdf0e10cSrcweir 																			  sal_Int16							nAdditive,
1373*cdf0e10cSrcweir                                                                               const AnimatableShapeSharedPtr&	/*rShape*/,
1374*cdf0e10cSrcweir                                                                               const ShapeManagerSharedPtr&		rShapeManager,
1375*cdf0e10cSrcweir                                                                               const ::basegfx::B2DVector&       rSlideSize,
1376*cdf0e10cSrcweir                                                                               int								nFlags )
1377*cdf0e10cSrcweir         {
1378*cdf0e10cSrcweir             return NumberAnimationSharedPtr(
1379*cdf0e10cSrcweir                 new PathAnimation( rSVGDPath, nAdditive,
1380*cdf0e10cSrcweir                                    rShapeManager,
1381*cdf0e10cSrcweir                                    rSlideSize,
1382*cdf0e10cSrcweir                                    nFlags ) );
1383*cdf0e10cSrcweir         }
1384*cdf0e10cSrcweir 
1385*cdf0e10cSrcweir     }
1386*cdf0e10cSrcweir }
1387