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