1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include <com/sun/star/util/XCloneable.hpp>
25 #include <com/sun/star/uno/XComponentContext.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/lang/XTypeProvider.hpp>
28 #include <com/sun/star/animations/XAnimateColor.hpp>
29 #include <com/sun/star/animations/XAnimateSet.hpp>
30 #include <com/sun/star/animations/XAnimateMotion.hpp>
31 #include <com/sun/star/animations/XAnimateTransform.hpp>
32 #include <com/sun/star/animations/XTransitionFilter.hpp>
33 #include <com/sun/star/animations/XTimeContainer.hpp>
34 #include <com/sun/star/animations/XIterateContainer.hpp>
35 #include <com/sun/star/animations/XAudio.hpp>
36 #include <com/sun/star/animations/XCommand.hpp>
37 #include <com/sun/star/animations/AnimationNodeType.hpp>
38 #include <com/sun/star/animations/AnimationCalcMode.hpp>
39 #include <com/sun/star/animations/AnimationFill.hpp>
40 #include <com/sun/star/animations/AnimationRestart.hpp>
41 #include <com/sun/star/animations/AnimationColorSpace.hpp>
42 #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
43 #include <com/sun/star/animations/AnimationTransformType.hpp>
44 #include <com/sun/star/animations/TransitionType.hpp>
45 #include <com/sun/star/animations/TransitionSubType.hpp>
46 #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
47 #include <com/sun/star/container/XEnumerationAccess.hpp>
48 #include <com/sun/star/beans/NamedValue.hpp>
49 #include <com/sun/star/util/XChangesNotifier.hpp>
50 #include <com/sun/star/lang/XUnoTunnel.hpp>
51 #include <cppuhelper/interfacecontainer.hxx>
52 
53 #include <cppuhelper/implbase1.hxx>
54 #include <rtl/uuid.h>
55 
56 #include <osl/mutex.hxx>
57 #include <list>
58 #include <algorithm>
59 
60 using ::osl::Mutex;
61 using ::osl::Guard;
62 using ::rtl::OUString;
63 using ::cppu::OInterfaceContainerHelper;
64 using ::cppu::OInterfaceIteratorHelper;
65 using ::com::sun::star::uno::Any;
66 using ::com::sun::star::uno::UNO_QUERY;
67 using ::com::sun::star::uno::XInterface;
68 using ::com::sun::star::uno::RuntimeException;
69 using ::com::sun::star::uno::Sequence;
70 using ::com::sun::star::uno::Reference;
71 using ::com::sun::star::uno::XComponentContext;
72 using ::com::sun::star::uno::Exception;
73 using ::com::sun::star::uno::XWeak;
74 using ::com::sun::star::uno::Type;
75 using ::com::sun::star::uno::makeAny;
76 using ::com::sun::star::lang::NoSupportException;
77 using ::com::sun::star::lang::IllegalArgumentException;
78 using ::com::sun::star::lang::WrappedTargetException;
79 using ::com::sun::star::lang::NoSupportException;
80 using ::com::sun::star::lang::XServiceInfo;
81 using ::com::sun::star::lang::XTypeProvider;
82 using ::com::sun::star::container::NoSuchElementException;
83 using ::com::sun::star::container::ElementExistException;
84 using ::com::sun::star::container::XEnumeration;
85 using ::com::sun::star::container::XEnumerationAccess;
86 using ::com::sun::star::beans::NamedValue;
87 using ::com::sun::star::util::XCloneable;
88 using ::com::sun::star::lang::XUnoTunnel;
89 using ::com::sun::star::util::XChangesNotifier;
90 using ::com::sun::star::util::XChangesListener;
91 using ::com::sun::star::util::ElementChange;
92 using ::com::sun::star::util::ChangesEvent;
93 
94 using ::cppu::OWeakObject;
95 
96 using namespace ::com::sun::star::animations;
97 using namespace ::com::sun::star::animations::AnimationNodeType;
98 
99 namespace animcore
100 {
101 
102 // ====================================================================
103 
104 typedef ::std::list< Reference< XAnimationNode > > ChildList_t;
105 
106 // ====================================================================
107 
108 class AnimationNodeBase :	public XAnimateMotion,
109 							public XAnimateColor,
110 							public XTransitionFilter,
111 							public XAnimateSet,
112 							public XAnimateTransform,
113 							public XIterateContainer,
114 							public XEnumerationAccess,
115 							public XServiceInfo,
116 							public XTypeProvider,
117 							public XAudio,
118 							public XCommand,
119 							public XCloneable,
120 							public XChangesNotifier,
121 							public XUnoTunnel,
122 							public OWeakObject
123 {
124 public:
125 	// our first, last and only protection from mutli-threads!
126 	Mutex maMutex;
127 };
128 
129 class AnimationNode : public AnimationNodeBase
130 {
131 public:
132 	AnimationNode( sal_Int16 nNodeType );
133 	AnimationNode( const AnimationNode& rNode );
134 	virtual ~AnimationNode();
135 
136 	// XInterface
137     virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException);
138     virtual void SAL_CALL acquire() throw ();
139     virtual void SAL_CALL release() throw ();
140 
141     // XTypeProvider
142     virtual Sequence< Type > SAL_CALL getTypes() throw (RuntimeException);
143     virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (RuntimeException);
144 
145 	// XServiceInfo
146     OUString SAL_CALL getImplementationName() throw();
147     Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
148     sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw();
149 
150 	// XChild
151 	virtual Reference< XInterface > SAL_CALL getParent() throw (RuntimeException);
152 	virtual void SAL_CALL setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException);
153 
154     // XCloneable
155     virtual Reference< XCloneable > SAL_CALL createClone() throw (RuntimeException);
156 
157     // XAnimationNode
158     virtual sal_Int16 SAL_CALL getType() throw (RuntimeException);
159     virtual Any SAL_CALL getBegin() throw (RuntimeException);
160     virtual void SAL_CALL setBegin( const Any& _begin ) throw (RuntimeException);
161     virtual Any SAL_CALL getDuration() throw (RuntimeException);
162     virtual void SAL_CALL setDuration( const Any& _duration ) throw (RuntimeException);
163     virtual Any SAL_CALL getEnd() throw (RuntimeException);
164     virtual void SAL_CALL setEnd( const Any& _end ) throw (RuntimeException);
165     virtual Any SAL_CALL getEndSync() throw (RuntimeException);
166     virtual void SAL_CALL setEndSync( const Any& _endsync ) throw (RuntimeException);
167     virtual Any SAL_CALL getRepeatCount() throw (RuntimeException);
168     virtual void SAL_CALL setRepeatCount( const Any& _repeatcount ) throw (RuntimeException);
169     virtual Any SAL_CALL getRepeatDuration() throw (RuntimeException);
170     virtual void SAL_CALL setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException);
171     virtual sal_Int16 SAL_CALL getFill() throw (RuntimeException);
172     virtual void SAL_CALL setFill( sal_Int16 _fill ) throw (RuntimeException);
173     virtual sal_Int16 SAL_CALL getFillDefault() throw (RuntimeException);
174     virtual void SAL_CALL setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException);
175     virtual sal_Int16 SAL_CALL getRestart() throw (RuntimeException);
176     virtual void SAL_CALL setRestart( sal_Int16 _restart ) throw (RuntimeException);
177     virtual sal_Int16 SAL_CALL getRestartDefault() throw (RuntimeException);
178     virtual void SAL_CALL setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException);
179     virtual double SAL_CALL getAcceleration() throw (RuntimeException);
180     virtual void SAL_CALL setAcceleration( double _acceleration ) throw (RuntimeException);
181     virtual double SAL_CALL getDecelerate() throw (RuntimeException);
182     virtual void SAL_CALL setDecelerate( double _decelerate ) throw (RuntimeException);
183     virtual sal_Bool SAL_CALL getAutoReverse() throw (RuntimeException);
184     virtual void SAL_CALL setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException);
185     virtual Sequence< NamedValue > SAL_CALL getUserData() throw (RuntimeException);
186     virtual void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException);
187 
188     // XAnimate
189     virtual Any SAL_CALL getTarget() throw (RuntimeException);
190     virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
191     virtual sal_Int16 SAL_CALL getSubItem() throw (RuntimeException);
192     virtual void SAL_CALL setSubItem( sal_Int16 _subitem ) throw (RuntimeException);
193     virtual OUString SAL_CALL getAttributeName() throw (RuntimeException);
194     virtual void SAL_CALL setAttributeName( const OUString& _attribute ) throw (RuntimeException);
195     virtual Sequence< Any > SAL_CALL getValues() throw (RuntimeException);
196     virtual void SAL_CALL setValues( const Sequence< Any >& _values ) throw (RuntimeException);
197     virtual Sequence< double > SAL_CALL getKeyTimes() throw (RuntimeException);
198     virtual void SAL_CALL setKeyTimes( const Sequence< double >& _keytimes ) throw (RuntimeException);
199     virtual sal_Int16 SAL_CALL getValueType() throw (RuntimeException);
200     virtual void SAL_CALL setValueType( sal_Int16 _valuetype ) throw (RuntimeException);
201     virtual sal_Int16 SAL_CALL getCalcMode() throw (RuntimeException);
202     virtual void SAL_CALL setCalcMode( sal_Int16 _calcmode ) throw (RuntimeException);
203     virtual sal_Bool SAL_CALL getAccumulate() throw (RuntimeException);
204     virtual void SAL_CALL setAccumulate( sal_Bool _accumulate ) throw (RuntimeException);
205     virtual sal_Int16 SAL_CALL getAdditive() throw (RuntimeException);
206     virtual void SAL_CALL setAdditive( sal_Int16 _additive ) throw (RuntimeException);
207     virtual Any SAL_CALL getFrom() throw (RuntimeException);
208     virtual void SAL_CALL setFrom( const Any& _from ) throw (RuntimeException);
209     virtual Any SAL_CALL getTo() throw (RuntimeException);
210     virtual void SAL_CALL setTo( const Any& _to ) throw (RuntimeException);
211     virtual Any SAL_CALL getBy() throw (RuntimeException);
212     virtual void SAL_CALL setBy( const Any& _by ) throw (RuntimeException);
213     virtual Sequence< TimeFilterPair > SAL_CALL getTimeFilter() throw (RuntimeException);
214     virtual void SAL_CALL setTimeFilter( const Sequence< TimeFilterPair >& _timefilter ) throw (RuntimeException);
215     virtual OUString SAL_CALL getFormula() throw (RuntimeException);
216     virtual void SAL_CALL setFormula( const OUString& _formula ) throw (RuntimeException);
217 
218 	// XAnimateColor
219     virtual sal_Int16 SAL_CALL getColorInterpolation() throw (RuntimeException);
220     virtual void SAL_CALL setColorInterpolation( sal_Int16 _colorspace ) throw (RuntimeException);
221     virtual sal_Bool SAL_CALL getDirection() throw (RuntimeException);
222     virtual void SAL_CALL setDirection( sal_Bool _direction ) throw (RuntimeException);
223 
224 	// XAnimateMotion
225     virtual Any SAL_CALL getPath() throw (RuntimeException);
226     virtual void SAL_CALL setPath( const Any& _path ) throw (RuntimeException);
227     virtual Any SAL_CALL getOrigin() throw (RuntimeException);
228     virtual void SAL_CALL setOrigin( const Any& _origin ) throw (RuntimeException);
229 
230 	// XAnimateTransform
231     virtual sal_Int16 SAL_CALL getTransformType() throw (RuntimeException);
232     virtual void SAL_CALL setTransformType( sal_Int16 _transformtype ) throw (RuntimeException);
233 
234     // XTransitionFilter
235     virtual sal_Int16 SAL_CALL getTransition() throw (RuntimeException);
236     virtual void SAL_CALL setTransition( sal_Int16 _transition ) throw (RuntimeException);
237     virtual sal_Int16 SAL_CALL getSubtype() throw (RuntimeException);
238     virtual void SAL_CALL setSubtype( sal_Int16 _subtype ) throw (RuntimeException);
239     virtual sal_Bool SAL_CALL getMode() throw (RuntimeException);
240     virtual void SAL_CALL setMode( sal_Bool _mode ) throw (RuntimeException);
241 //    virtual sal_Bool SAL_CALL getDirection() throw (RuntimeException);
242 //    virtual void SAL_CALL setDirection( sal_Bool _direction ) throw (RuntimeException);
243     virtual sal_Int32 SAL_CALL getFadeColor() throw (RuntimeException);
244     virtual void SAL_CALL setFadeColor( sal_Int32 _fadecolor ) throw (RuntimeException);
245 
246 	// XAudio
247     virtual Any SAL_CALL getSource() throw (RuntimeException);
248     virtual void SAL_CALL setSource( const Any& _source ) throw (RuntimeException);
249     virtual double SAL_CALL getVolume() throw (RuntimeException);
250     virtual void SAL_CALL setVolume( double _volume ) throw (RuntimeException);
251 
252 
253     // XCommand
254 //    virtual Any SAL_CALL getTarget() throw (RuntimeException);
255 //    virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
256     virtual sal_Int16 SAL_CALL getCommand() throw (RuntimeException);
257     virtual void SAL_CALL setCommand( sal_Int16 _command ) throw (RuntimeException);
258     virtual Any SAL_CALL getParameter() throw (RuntimeException);
259     virtual void SAL_CALL setParameter( const Any& _parameter ) throw (RuntimeException);
260 
261 	// XElementAccess
262 	virtual Type SAL_CALL getElementType() throw (RuntimeException);
263 	virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
264 
265 	// XEnumerationAccess
266     virtual Reference< XEnumeration > SAL_CALL createEnumeration() throw (RuntimeException);
267 
268     // XTimeContainer
269 	virtual Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
270 	virtual Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
271     virtual Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
272     virtual Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException);
273 	virtual Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException);
274 
275 	// XIterateContainer
276     virtual sal_Int16 SAL_CALL getIterateType() throw (RuntimeException);
277     virtual void SAL_CALL setIterateType( sal_Int16 _iteratetype ) throw (RuntimeException);
278     virtual double SAL_CALL getIterateInterval() throw (RuntimeException);
279     virtual void SAL_CALL setIterateInterval( double _iterateinterval ) throw (RuntimeException);
280 
281 	// XChangesNotifier
282     virtual void SAL_CALL addChangesListener( const Reference< XChangesListener >& aListener ) throw (RuntimeException);
283     virtual void SAL_CALL removeChangesListener( const Reference< XChangesListener >& aListener ) throw (RuntimeException);
284 
285     // XUnoTunnel
286     virtual ::sal_Int64 SAL_CALL getSomething( const Sequence< ::sal_Int8 >& aIdentifier ) throw (RuntimeException);
287 
288 	static const Sequence< sal_Int8 > & getUnoTunnelId();
289 	void fireChangeListener();
290 
291 private:
292 	OInterfaceContainerHelper	maChangeListener;
293 
294 	static void initTypeProvider( sal_Int16 nNodeType ) throw();
295 
296 	const sal_Int16 mnNodeType;
297 
298 	// for XTypeProvider
299 	static Sequence< Type >* mpTypes[12];
300 	static Sequence< sal_Int8 >* mpId[12];
301 
302 	// attributes for the XAnimationNode interface implementation
303 	Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration;
304 	sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
305 	double mfAcceleration, mfDecelerate;
306 	sal_Bool mbAutoReverse;
307 	Sequence< NamedValue > maUserData;
308 
309 	// parent interface for XChild interface implementation
310 	Reference<XInterface>	mxParent;
311 	AnimationNode*			mpParent;
312 
313 	// attributes for XAnimate
314 	Any	maTarget;
315 	OUString maAttributeName, maFormula;
316 	Sequence< Any > maValues;
317 	Sequence< double > maKeyTimes;
318 	sal_Int16 mnValueType, mnSubItem;
319 	sal_Int16 mnCalcMode, mnAdditive;
320 	sal_Bool mbAccumulate;
321 	Any maFrom, maTo, maBy;
322 	Sequence< TimeFilterPair > maTimeFilter;
323 
324 	// attributes for XAnimateColor
325 	sal_Int16 mnColorSpace;
326 	sal_Bool mbDirection;
327 
328 	// atributes for XAnimateMotion
329 	Any maPath, maOrigin;
330 
331 	// attributes for XAnimateTransform
332 	sal_Int16 mnTransformType;
333 
334 	// attributes for XTransitionFilter
335 	sal_Int16 mnTransition;
336 	sal_Int16 mnSubtype;
337 	sal_Bool mbMode;
338 	sal_Int32 mnFadeColor;
339 
340 	// XAudio
341 	double mfVolume;
342 
343 	// XCommand
344 	sal_Int16 mnCommand;
345 	Any maParameter;
346 
347 	// XIterateContainer
348 	sal_Int16 mnIterateType;
349 	double	mfIterateInterval;
350 
351 	/** sorted list of child nodes for XTimeContainer*/
352 	ChildList_t				maChilds;
353 };
354 
355 // ====================================================================
356 
357 class TimeContainerEnumeration : public ::cppu::WeakImplHelper1< XEnumeration >
358 {
359 public:
360 	TimeContainerEnumeration( const ChildList_t &rChilds );
361 	virtual ~TimeContainerEnumeration();
362 
363     // Methods
364     virtual sal_Bool SAL_CALL hasMoreElements() throw (RuntimeException);
365     virtual Any SAL_CALL nextElement(  ) throw (NoSuchElementException, WrappedTargetException, RuntimeException);
366 
367 private:
368 	/** sorted list of child nodes */
369 	ChildList_t				maChilds;
370 
371 	/** current iteration position */
372 	ChildList_t::iterator	maIter;
373 
374 	/** our first, last and only protection from mutli-threads! */
375 	Mutex					maMutex;
376 };
377 
378 TimeContainerEnumeration::TimeContainerEnumeration( const ChildList_t &rChilds )
379 : maChilds( rChilds )
380 {
381 	maIter = maChilds.begin();
382 }
383 
384 TimeContainerEnumeration::~TimeContainerEnumeration()
385 {
386 }
387 
388 // Methods
389 sal_Bool SAL_CALL TimeContainerEnumeration::hasMoreElements() throw (RuntimeException)
390 {
391 	Guard< Mutex > aGuard( maMutex );
392 
393 	return maIter != maChilds.end();
394 }
395 
396 Any SAL_CALL TimeContainerEnumeration::nextElement()
397 	throw (NoSuchElementException, WrappedTargetException, RuntimeException)
398 {
399 	Guard< Mutex > aGuard( maMutex );
400 
401 	if( maIter == maChilds.end() )
402 		throw NoSuchElementException();
403 
404 	return makeAny( (*maIter++) );
405 }
406 
407 // ====================================================================
408 
409 Sequence< Type >* AnimationNode::mpTypes[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
410 Sequence< sal_Int8 >* AnimationNode::mpId[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
411 
412 AnimationNode::AnimationNode( sal_Int16 nNodeType )
413 :	maChangeListener(maMutex),
414 	mnNodeType( nNodeType ),
415 	mnFill( AnimationFill::DEFAULT ),
416     mnFillDefault( AnimationFill::INHERIT ),
417 	mnRestart( AnimationRestart:: DEFAULT ),
418 	mnRestartDefault( AnimationRestart:: INHERIT ),
419 	mfAcceleration( 0.0 ),
420 	mfDecelerate( 0.0 ),
421 	mbAutoReverse( sal_False ),
422 	mpParent(0),
423 	mnValueType( 0 ),
424 	mnSubItem( 0 ),
425 	mnCalcMode( (nNodeType == AnimationNodeType::ANIMATEMOTION) ? AnimationCalcMode::PACED : AnimationCalcMode::LINEAR),
426 	mnAdditive(AnimationAdditiveMode::REPLACE),
427 	mbAccumulate(sal_False),
428 	mnColorSpace( AnimationColorSpace::RGB ),
429 	mbDirection( sal_True ),
430 	mnTransformType( AnimationTransformType::TRANSLATE ),
431 	mnTransition(TransitionType::BARWIPE),
432 	mnSubtype(TransitionSubType::DEFAULT),
433 	mbMode(true),
434 	mnFadeColor(0),
435 	mfVolume(1.0),
436     mnCommand(0),
437     mnIterateType( ::com::sun::star::presentation::ShapeAnimationSubType::AS_WHOLE ),
438     mfIterateInterval(0.0)
439 {
440 	OSL_ENSURE((sal_uInt32)nNodeType < sizeof(mpTypes)/sizeof(Sequence<Type>*), "NodeType out of range");
441 }
442 
443 AnimationNode::AnimationNode( const AnimationNode& rNode )
444 :	AnimationNodeBase(),
445     maChangeListener(maMutex),
446 	mnNodeType( rNode.mnNodeType ),
447 
448 	// attributes for the XAnimationNode interface implementation
449 	maBegin( rNode.maBegin ),
450 	maDuration( rNode.maDuration ),
451 	maEnd( rNode.maEnd ),
452 	maEndSync( rNode.maEndSync ),
453 	maRepeatCount( rNode.maRepeatCount ),
454 	maRepeatDuration( rNode.maRepeatDuration ),
455 	mnFill( rNode.mnFill ),
456     mnFillDefault( rNode.mnFillDefault ),
457 	mnRestart( rNode.mnRestart ),
458 	mnRestartDefault( rNode.mnRestartDefault ),
459 	mfAcceleration( rNode.mfAcceleration ),
460 	mfDecelerate( rNode.mfDecelerate ),
461 	mbAutoReverse( rNode.mbAutoReverse ),
462 	maUserData( rNode.maUserData ),
463 	mpParent(0),
464 
465 	// attributes for XAnimate
466 	maTarget( rNode.maTarget ),
467 	maAttributeName( rNode.maAttributeName ),
468 	maFormula( rNode.maFormula ),
469 	maValues( rNode.maValues ),
470 	maKeyTimes( rNode.maKeyTimes ),
471 	mnValueType( rNode.mnValueType ),
472 	mnSubItem( rNode.mnSubItem ),
473 	mnCalcMode( rNode.mnCalcMode ),
474 	mnAdditive( rNode.mnAdditive ),
475 	mbAccumulate( rNode.mbAccumulate ),
476 	maFrom( rNode.maFrom ),
477 	maTo( rNode.maTo ),
478 	maBy( rNode.maBy ),
479 	maTimeFilter( rNode.maTimeFilter ),
480 
481 	// attributes for XAnimateColor
482 	mnColorSpace( rNode.mnColorSpace ),
483 	mbDirection( rNode.mbDirection ),
484 
485 	// atributes for XAnimateMotion
486 	maPath( rNode.maPath ),
487 	maOrigin( rNode.maOrigin ),
488 
489 	// attributes for XAnimateTransform
490 	mnTransformType( rNode.mnTransformType ),
491 
492 	// attributes for XTransitionFilter
493 	mnTransition( rNode.mnTransition ),
494 	mnSubtype( rNode.mnSubtype ),
495 	mbMode( rNode.mbMode ),
496 	mnFadeColor( rNode.mnFadeColor ),
497 
498 	// XAudio
499 	mfVolume( rNode.mfVolume ),
500 
501 	// XCommand
502 	mnCommand( rNode.mnCommand ),
503 	maParameter( rNode.maParameter ),
504 
505 	// XIterateContainer
506 	mnIterateType( rNode.mnIterateType ),
507 	mfIterateInterval( rNode.mfIterateInterval )
508 {
509 }
510 
511 AnimationNode::~AnimationNode()
512 {
513 }
514 
515 // --------------------------------------------------------------------
516 
517 #define IMPL_NODE_FACTORY(N,IN,SN)\
518 Reference< XInterface > SAL_CALL createInstance_##N( const Reference< XComponentContext > &  ) throw (Exception)\
519 {\
520 	return Reference < XInterface > ( SAL_STATIC_CAST( ::cppu::OWeakObject * , new AnimationNode( N ) ) );\
521 }\
522 OUString getImplementationName_##N()\
523 {\
524 	return OUString( RTL_CONSTASCII_USTRINGPARAM ( IN ) );\
525 }\
526 Sequence<OUString> getSupportedServiceNames_##N(void)\
527 {\
528 	Sequence<OUString> aRet(1);\
529 	aRet.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SN ));\
530 	return aRet;\
531 }
532 
533 IMPL_NODE_FACTORY( PAR, "animcore::ParallelTimeContainer", "com.sun.star.animations.ParallelTimeContainer" )
534 IMPL_NODE_FACTORY( SEQ, "animcore::SequenceTimeContainer", "com.sun.star.animations.SequenceTimeContainer" )
535 IMPL_NODE_FACTORY( ITERATE, "animcore::IterateContainer", "com.sun.star.animations.IterateContainer" )
536 IMPL_NODE_FACTORY( ANIMATE, "animcore::Animate", "com.sun.star.animations.Animate" )
537 IMPL_NODE_FACTORY( SET, "animcore::AnimateSet", "com.sun.star.animations.AnimateSet" )
538 IMPL_NODE_FACTORY( ANIMATECOLOR, "animcore::AnimateColor", "com.sun.star.animations.AnimateColor" )
539 IMPL_NODE_FACTORY( ANIMATEMOTION, "animcore::AnimateMotion", "com.sun.star.animations.AnimateMotion" )
540 IMPL_NODE_FACTORY( ANIMATETRANSFORM, "animcore::AnimateTransform", "com.sun.star.animations.AnimateTransform" )
541 IMPL_NODE_FACTORY( TRANSITIONFILTER, "animcore::TransitionFilter", "com.sun.star.animations.TransitionFilter" )
542 IMPL_NODE_FACTORY( AUDIO, "animcore::Audio", "com.sun.star.animations.Audio" );
543 IMPL_NODE_FACTORY( COMMAND, "animcore::Command", "com.sun.star.animations.Command" );
544 
545 // --------------------------------------------------------------------
546 
547 // XInterface
548 Any SAL_CALL AnimationNode::queryInterface( const Type& aType ) throw (RuntimeException)
549 {
550 	Any aRet( ::cppu::queryInterface(
551 		aType,
552 		static_cast< XServiceInfo * >( this ),
553 		static_cast< XTypeProvider * >( this ),
554 		static_cast< XChild * >( static_cast< XTimeContainer * >(this) ),
555 		static_cast< XCloneable* >( this ),
556 		static_cast< XAnimationNode* >( static_cast< XTimeContainer * >(this) ),
557 		static_cast< XInterface* >(static_cast< OWeakObject * >(this)),
558 		static_cast< XWeak* >(static_cast< OWeakObject * >(this)),
559 		static_cast< XChangesNotifier* >( this ),
560 		static_cast< XUnoTunnel* >( this ) ) );
561 
562 	if(!aRet.hasValue())
563 	{
564 		switch( mnNodeType )
565 		{
566 		case AnimationNodeType::PAR:
567 		case AnimationNodeType::SEQ:
568 			aRet = ::cppu::queryInterface(
569 				aType,
570 				static_cast< XTimeContainer * >( this ),
571 				static_cast< XEnumerationAccess * >( this ),
572 				static_cast< XElementAccess * >( this ) );
573 			break;
574 		case AnimationNodeType::ITERATE:
575 			aRet = ::cppu::queryInterface(
576 				aType,
577 				static_cast< XTimeContainer * >( this ),
578 				static_cast< XIterateContainer * >( this ),
579 				static_cast< XEnumerationAccess * >( this ),
580 				static_cast< XElementAccess * >( this ) );
581 			break;
582 		case AnimationNodeType::ANIMATE:
583 			aRet = ::cppu::queryInterface(
584 				aType,
585 				static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ) );
586 			break;
587 		case AnimationNodeType::ANIMATEMOTION:
588 			aRet = ::cppu::queryInterface(
589 				aType,
590 				static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ),
591 				static_cast< XAnimateMotion * >( this ) );
592 			break;
593 		case AnimationNodeType::ANIMATECOLOR:
594 			aRet = ::cppu::queryInterface(
595 				aType,
596 				static_cast< XAnimate * >( static_cast< XAnimateColor * >(this) ),
597 				static_cast< XAnimateColor * >( this ) );
598 			break;
599 		case AnimationNodeType::SET:
600 			aRet = ::cppu::queryInterface(
601 				aType,
602 				static_cast< XAnimate * >( static_cast< XAnimateSet * >(this) ),
603 				static_cast< XAnimateSet * >( this ) );
604 			break;
605 		case AnimationNodeType::ANIMATETRANSFORM:
606 			aRet = ::cppu::queryInterface(
607 				aType,
608 				static_cast< XAnimate * >( static_cast< XAnimateTransform * >(this) ),
609 				static_cast< XAnimateTransform * >( this ) );
610 			break;
611 		case AnimationNodeType::AUDIO:
612 			aRet = ::cppu::queryInterface(
613 				aType,
614 				static_cast< XAudio * >( static_cast< XAudio * >(this) ) );
615 			break;
616 		case AnimationNodeType::COMMAND:
617 			aRet = ::cppu::queryInterface(
618 				aType,
619 				static_cast< XCommand * >( static_cast< XCommand * >(this) ) );
620 			break;
621 		case AnimationNodeType::TRANSITIONFILTER:
622 			aRet = ::cppu::queryInterface(
623 				aType,
624 				static_cast< XAnimate * >( static_cast< XTransitionFilter * >(this) ),
625 				static_cast< XTransitionFilter * >( this ) );
626 			break;
627 		}
628 	}
629 
630 	return aRet.hasValue() ? aRet : OWeakObject::queryInterface( aType );
631 }
632 
633 // --------------------------------------------------------------------
634 
635 void AnimationNode::initTypeProvider( sal_Int16 nNodeType ) throw()
636 {
637 	::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
638 
639 	if(! mpTypes[nNodeType] )
640 	{
641 		// create id
642 		mpId[nNodeType] = new Sequence< sal_Int8 >( 16 );
643 		rtl_createUuid( (sal_uInt8 *)mpId[nNodeType]->getArray(), 0, sal_True );
644 
645 		static sal_Int32 type_numbers[] =
646 		{
647 			7, // CUSTOM
648 			9, // PAR
649 			9, // SEQ
650 			9, // ITERATE
651 			8, // ANIMATE
652 			8, // SET
653 			8, // ANIMATEMOTION
654 			8, // ANIMATECOLOR
655 			8, // ANIMATETRANSFORM
656 			8, // TRANSITIONFILTER
657 			8, // AUDIO
658 			8, // COMMAND
659 		};
660 
661 		// collect types
662 		Sequence< Type > * types = new Sequence< Type >( type_numbers[nNodeType] );
663 		Type * pTypeAr = types->getArray();
664 		sal_Int32 nPos = 0;
665 
666 		pTypeAr[nPos++] = ::getCppuType( (const Reference< XWeak > *)0 );
667 		pTypeAr[nPos++] = ::getCppuType( (const Reference< XChild > *)0 );
668 		pTypeAr[nPos++] = ::getCppuType( (const Reference< XCloneable > *)0 );
669 		pTypeAr[nPos++] = ::getCppuType( (const Reference< XTypeProvider > *)0 );
670 		pTypeAr[nPos++] = ::getCppuType( (const Reference< XServiceInfo > *)0 );
671 		pTypeAr[nPos++] = ::getCppuType( (const Reference< XUnoTunnel > *)0 );
672 		pTypeAr[nPos++] = ::getCppuType( (const Reference< XChangesNotifier> *)0 );
673 
674 		switch( nNodeType )
675 		{
676 		case AnimationNodeType::PAR:
677 		case AnimationNodeType::SEQ:
678 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XTimeContainer > *)0 );
679 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XEnumerationAccess > *)0 );
680 			break;
681 		case AnimationNodeType::ITERATE:
682 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XIterateContainer > *)0 );
683 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XEnumerationAccess > *)0 );
684 			break;
685 		case AnimationNodeType::ANIMATE:
686 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimate > *)0 );
687 			break;
688 		case AnimationNodeType::ANIMATEMOTION:
689 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateMotion > *)0 );
690 			break;
691 		case AnimationNodeType::ANIMATECOLOR:
692 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateColor > *)0 );
693 			break;
694 		case AnimationNodeType::ANIMATETRANSFORM:
695 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateTransform > *)0 );
696 			break;
697 		case AnimationNodeType::SET:
698 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateSet > *)0 );
699 			break;
700 		case AnimationNodeType::TRANSITIONFILTER:
701 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XTransitionFilter > *)0 );
702 			break;
703 		case AnimationNodeType::AUDIO:
704 			pTypeAr[nPos++] = ::getCppuType( (const Reference< XAudio > *)0 );
705 			break;
706 		case AnimationNodeType::COMMAND:
707 			pTypeAr[nPos++] = ::getCppuType( ( const Reference< XCommand > *)0 );
708 			break;
709 		}
710 		mpTypes[nNodeType] = types;
711 	}
712 }
713 
714 // --------------------------------------------------------------------
715 
716 Sequence< Type > AnimationNode::getTypes() throw (RuntimeException)
717 {
718 	if (! mpTypes[mnNodeType])
719 		initTypeProvider(mnNodeType);
720 	return *mpTypes[mnNodeType];
721 }
722 // --------------------------------------------------------------------
723 
724 Sequence< sal_Int8 > AnimationNode::getImplementationId() throw (RuntimeException)
725 {
726 	if (! mpId[mnNodeType])
727 		initTypeProvider(mnNodeType);
728 	return *mpId[mnNodeType];
729 }
730 
731 // --------------------------------------------------------------------
732 
733 // XInterface
734 void SAL_CALL AnimationNode::acquire(  ) throw ()
735 {
736 	OWeakObject::acquire();
737 }
738 
739 // --------------------------------------------------------------------
740 
741 // XInterface
742 void SAL_CALL AnimationNode::release(  ) throw ()
743 {
744 	OWeakObject::release();
745 }
746 
747 // --------------------------------------------------------------------
748 
749 // XServiceInfo
750 OUString AnimationNode::getImplementationName() throw()
751 {
752 	switch( mnNodeType )
753 	{
754 	case AnimationNodeType::PAR:
755 	    return getImplementationName_PAR();
756 	case AnimationNodeType::SEQ:
757 	    return getImplementationName_SEQ();
758 	case AnimationNodeType::ITERATE:
759 		return getImplementationName_ITERATE();
760 	case AnimationNodeType::SET:
761 	    return getImplementationName_SET();
762 	case AnimationNodeType::ANIMATECOLOR:
763 	    return getImplementationName_ANIMATECOLOR();
764 	case AnimationNodeType::ANIMATEMOTION:
765 	    return getImplementationName_ANIMATEMOTION();
766 	case AnimationNodeType::TRANSITIONFILTER:
767 	    return getImplementationName_TRANSITIONFILTER();
768 	case AnimationNodeType::ANIMATETRANSFORM:
769 		return getImplementationName_ANIMATETRANSFORM();
770 	case AnimationNodeType::AUDIO:
771 		return getImplementationName_AUDIO();
772 	case AnimationNodeType::COMMAND:
773 		return getImplementationName_COMMAND();
774 	case AnimationNodeType::ANIMATE:
775 	default:
776 	    return getImplementationName_ANIMATE();
777 	}
778 }
779 
780 // --------------------------------------------------------------------
781 
782 // XServiceInfo
783 sal_Bool AnimationNode::supportsService(const OUString& ServiceName) throw()
784 {
785     Sequence< OUString > aSNL( getSupportedServiceNames() );
786     const OUString * pArray = aSNL.getConstArray();
787 
788     for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
789         if( pArray[i] == ServiceName )
790             return sal_True;
791 
792     return sal_False;
793 }
794 
795 // --------------------------------------------------------------------
796 
797 // XServiceInfo
798 Sequence< OUString > AnimationNode::getSupportedServiceNames(void) throw()
799 {
800 	switch( mnNodeType )
801 	{
802 	case AnimationNodeType::PAR:
803 	    return getSupportedServiceNames_PAR();
804 	case AnimationNodeType::SEQ:
805 	    return getSupportedServiceNames_SEQ();
806 	case AnimationNodeType::ITERATE:
807 		return getSupportedServiceNames_ITERATE();
808 	case AnimationNodeType::SET:
809 	    return getSupportedServiceNames_SET();
810 	case AnimationNodeType::ANIMATECOLOR:
811 	    return getSupportedServiceNames_ANIMATECOLOR();
812 	case AnimationNodeType::ANIMATEMOTION:
813 	    return getSupportedServiceNames_ANIMATEMOTION();
814 	case AnimationNodeType::TRANSITIONFILTER:
815 	    return getSupportedServiceNames_TRANSITIONFILTER();
816 	case AnimationNodeType::AUDIO:
817 	    return getSupportedServiceNames_AUDIO();
818 	case AnimationNodeType::COMMAND:
819 		return getSupportedServiceNames_COMMAND();
820 	case AnimationNodeType::ANIMATE:
821 	default:
822 	    return getSupportedServiceNames_ANIMATE();
823 	}
824 }
825 
826 // --------------------------------------------------------------------
827 
828 // XAnimationNode
829 sal_Int16 SAL_CALL AnimationNode::getType() throw (RuntimeException)
830 {
831 	Guard< Mutex > aGuard( maMutex );
832 	return mnNodeType;
833 }
834 
835 // --------------------------------------------------------------------
836 
837 // XAnimationNode
838 Any SAL_CALL AnimationNode::getBegin() throw (RuntimeException)
839 {
840 	Guard< Mutex > aGuard( maMutex );
841 	return maBegin;
842 }
843 
844 // --------------------------------------------------------------------
845 
846 // XAnimationNode
847 void SAL_CALL AnimationNode::setBegin( const Any& _begin ) throw (RuntimeException)
848 {
849 	Guard< Mutex > aGuard( maMutex );
850 	if( _begin != maBegin )
851 	{
852 		maBegin = _begin;
853 		fireChangeListener();
854 	}
855 }
856 
857 // --------------------------------------------------------------------
858 
859 // XAnimationNode
860 Any SAL_CALL AnimationNode::getDuration() throw (RuntimeException)
861 {
862 	Guard< Mutex > aGuard( maMutex );
863 	return maDuration;
864 }
865 
866 // --------------------------------------------------------------------
867 
868 // XAnimationNode
869 void SAL_CALL AnimationNode::setDuration( const Any& _duration ) throw (RuntimeException)
870 {
871 	Guard< Mutex > aGuard( maMutex );
872 	if( _duration != maDuration )
873 	{
874 		maDuration = _duration;
875 		fireChangeListener();
876 	}
877 }
878 
879 // --------------------------------------------------------------------
880 
881 // XAnimationNode
882 Any SAL_CALL AnimationNode::getEnd() throw (RuntimeException)
883 {
884 	Guard< Mutex > aGuard( maMutex );
885 	return maEnd;
886 }
887 
888 // --------------------------------------------------------------------
889 
890 // XAnimationNode
891 void SAL_CALL AnimationNode::setEnd( const Any& _end ) throw (RuntimeException)
892 {
893 	Guard< Mutex > aGuard( maMutex );
894 	if( _end != maEnd )
895 	{
896 		maEnd = _end;
897 		fireChangeListener();
898 	}
899 }
900 
901 // --------------------------------------------------------------------
902 
903 // XAnimationNode
904 Any SAL_CALL AnimationNode::getEndSync() throw (RuntimeException)
905 {
906 	Guard< Mutex > aGuard( maMutex );
907 	return maEndSync;
908 }
909 
910 // --------------------------------------------------------------------
911 
912 // XAnimationNode
913 void SAL_CALL AnimationNode::setEndSync( const Any& _endsync ) throw (RuntimeException)
914 {
915 	Guard< Mutex > aGuard( maMutex );
916 	if( _endsync != maEndSync )
917 	{
918 		maEndSync = _endsync;
919 		fireChangeListener();
920 	}
921 }
922 
923 // --------------------------------------------------------------------
924 
925 // XAnimationNode
926 Any SAL_CALL AnimationNode::getRepeatCount() throw (RuntimeException)
927 {
928 	Guard< Mutex > aGuard( maMutex );
929 	return maRepeatCount;
930 }
931 
932 // --------------------------------------------------------------------
933 
934 // XAnimationNode
935 void SAL_CALL AnimationNode::setRepeatCount( const Any& _repeatcount ) throw (RuntimeException)
936 {
937 	Guard< Mutex > aGuard( maMutex );
938 	if( _repeatcount != maRepeatCount )
939 	{
940 		maRepeatCount = _repeatcount;
941 		fireChangeListener();
942 	}
943 }
944 
945 // --------------------------------------------------------------------
946 
947 // XAnimationNode
948 Any SAL_CALL AnimationNode::getRepeatDuration() throw (RuntimeException)
949 {
950 	Guard< Mutex > aGuard( maMutex );
951 	return maRepeatDuration;
952 }
953 
954 // --------------------------------------------------------------------
955 
956 // XAnimationNode
957 void SAL_CALL AnimationNode::setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException)
958 {
959 	Guard< Mutex > aGuard( maMutex );
960 	if( _repeatduration != maRepeatDuration )
961 	{
962 		maRepeatDuration = _repeatduration;
963 		fireChangeListener();
964 	}
965 }
966 
967 // --------------------------------------------------------------------
968 
969 // XAnimationNode
970 sal_Int16 SAL_CALL AnimationNode::getFill() throw (RuntimeException)
971 {
972 	Guard< Mutex > aGuard( maMutex );
973 	return mnFill;
974 }
975 
976 // --------------------------------------------------------------------
977 
978 // XAnimationNode
979 void SAL_CALL AnimationNode::setFill( sal_Int16 _fill ) throw (RuntimeException)
980 {
981 	Guard< Mutex > aGuard( maMutex );
982 	if( _fill != mnFill )
983 	{
984 		mnFill = _fill;
985 		fireChangeListener();
986 	}
987 }
988 
989 // --------------------------------------------------------------------
990 
991 // XAnimationNode
992 sal_Int16 SAL_CALL AnimationNode::getFillDefault() throw (RuntimeException)
993 {
994 	Guard< Mutex > aGuard( maMutex );
995 	return mnFillDefault;
996 }
997 
998 // --------------------------------------------------------------------
999 
1000 // XAnimationNode
1001 void SAL_CALL AnimationNode::setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException)
1002 {
1003 	Guard< Mutex > aGuard( maMutex );
1004 	if( _filldefault != mnFillDefault )
1005 	{
1006 		mnFillDefault = _filldefault;
1007 		fireChangeListener();
1008 	}
1009 }
1010 
1011 // --------------------------------------------------------------------
1012 
1013 // XAnimationNode
1014 sal_Int16 SAL_CALL AnimationNode::getRestart() throw (RuntimeException)
1015 {
1016 	Guard< Mutex > aGuard( maMutex );
1017 	return mnRestart;
1018 }
1019 
1020 // --------------------------------------------------------------------
1021 
1022 // XAnimationNode
1023 void SAL_CALL AnimationNode::setRestart( sal_Int16 _restart ) throw (RuntimeException)
1024 {
1025 	Guard< Mutex > aGuard( maMutex );
1026 	if( _restart != mnRestart )
1027 	{
1028 		mnRestart = _restart;
1029 		fireChangeListener();
1030 	}
1031 }
1032 
1033 // --------------------------------------------------------------------
1034 
1035 // XAnimationNode
1036 sal_Int16 SAL_CALL AnimationNode::getRestartDefault() throw (RuntimeException)
1037 {
1038 	Guard< Mutex > aGuard( maMutex );
1039 	return mnRestartDefault;
1040 }
1041 
1042 // --------------------------------------------------------------------
1043 
1044 // XAnimationNode
1045 void SAL_CALL AnimationNode::setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException)
1046 {
1047 	Guard< Mutex > aGuard( maMutex );
1048 	if( _restartdefault != mnRestartDefault )
1049 	{
1050 		mnRestartDefault = _restartdefault;
1051 		fireChangeListener();
1052 	}
1053 }
1054 
1055 // --------------------------------------------------------------------
1056 
1057 // XAnimationNode
1058 double SAL_CALL AnimationNode::getAcceleration() throw (RuntimeException)
1059 {
1060 	Guard< Mutex > aGuard( maMutex );
1061 	return mfAcceleration;
1062 }
1063 
1064 // --------------------------------------------------------------------
1065 
1066 // XAnimationNode
1067 void SAL_CALL AnimationNode::setAcceleration( double _acceleration ) throw (RuntimeException)
1068 {
1069 	Guard< Mutex > aGuard( maMutex );
1070 	if( _acceleration != mfAcceleration )
1071 	{
1072 		mfAcceleration = _acceleration;
1073 		fireChangeListener();
1074 	}
1075 }
1076 
1077 // --------------------------------------------------------------------
1078 
1079 // XAnimationNode
1080 double SAL_CALL AnimationNode::getDecelerate() throw (RuntimeException)
1081 {
1082 	Guard< Mutex > aGuard( maMutex );
1083 	return mfDecelerate;
1084 }
1085 
1086 // --------------------------------------------------------------------
1087 
1088 // XAnimationNode
1089 void SAL_CALL AnimationNode::setDecelerate( double _decelerate ) throw (RuntimeException)
1090 {
1091 	Guard< Mutex > aGuard( maMutex );
1092 	if( _decelerate != mfDecelerate )
1093 	{
1094 		mfDecelerate = _decelerate;
1095 		fireChangeListener();
1096 	}
1097 }
1098 
1099 // --------------------------------------------------------------------
1100 
1101 // XAnimationNode
1102 sal_Bool SAL_CALL AnimationNode::getAutoReverse() throw (RuntimeException)
1103 {
1104 	Guard< Mutex > aGuard( maMutex );
1105 	return mbAutoReverse;
1106 }
1107 
1108 // --------------------------------------------------------------------
1109 
1110 // XAnimationNode
1111 void SAL_CALL AnimationNode::setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException)
1112 {
1113 	Guard< Mutex > aGuard( maMutex );
1114 	if( _autoreverse != mbAutoReverse )
1115 	{
1116 		mbAutoReverse = _autoreverse;
1117 		fireChangeListener();
1118 	}
1119 }
1120 
1121 // --------------------------------------------------------------------
1122 
1123 Sequence< NamedValue > SAL_CALL AnimationNode::getUserData() throw (RuntimeException)
1124 {
1125 	Guard< Mutex > aGuard( maMutex );
1126 	return maUserData;
1127 }
1128 
1129 // --------------------------------------------------------------------
1130 
1131 void SAL_CALL AnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException)
1132 {
1133 	Guard< Mutex > aGuard( maMutex );
1134 	maUserData = _userdata;
1135 	fireChangeListener();
1136 }
1137 
1138 // --------------------------------------------------------------------
1139 
1140 // XChild
1141 Reference< XInterface > SAL_CALL AnimationNode::getParent() throw (RuntimeException)
1142 {
1143 	Guard< Mutex > aGuard( maMutex );
1144 	return mxParent;
1145 }
1146 
1147 // --------------------------------------------------------------------
1148 
1149 // XChild
1150 void SAL_CALL AnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException)
1151 {
1152 	Guard< Mutex > aGuard( maMutex );
1153 	if( Parent != mxParent )
1154 	{
1155 		mxParent = Parent;
1156 
1157 		mpParent = 0;
1158 		Reference< XUnoTunnel > xTunnel( mxParent, UNO_QUERY );
1159 		if( xTunnel.is() )
1160 			mpParent = reinterpret_cast< AnimationNode* >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething( getUnoTunnelId() )));
1161 
1162 		fireChangeListener();
1163 	}
1164 }
1165 
1166 // --------------------------------------------------------------------
1167 
1168 // XCloneable
1169 Reference< XCloneable > SAL_CALL AnimationNode::createClone() throw (RuntimeException)
1170 {
1171 	Guard< Mutex > aGuard( maMutex );
1172 
1173 	Reference< XCloneable > xNewNode;
1174 	try
1175 	{
1176 		xNewNode = new AnimationNode( *this );
1177 
1178 		if( maChilds.size() )
1179 		{
1180 			Reference< XTimeContainer > xContainer( xNewNode, UNO_QUERY );
1181 			if( xContainer.is() )
1182 			{
1183 				ChildList_t::iterator aIter( maChilds.begin() );
1184 				ChildList_t::iterator aEnd( maChilds.end() );
1185 				while( aIter != aEnd )
1186 				{
1187 					Reference< XCloneable > xCloneable((*aIter++), UNO_QUERY );
1188 					if( xCloneable.is() ) try
1189 					{
1190 						Reference< XAnimationNode > xNewChildNode( xCloneable->createClone(), UNO_QUERY );
1191 						if( xNewChildNode.is() )
1192 							xContainer->appendChild( xNewChildNode );
1193 					}
1194 					catch( Exception& e )
1195 					{
1196 						(void)e;
1197 						OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1198 					}
1199 				}
1200 			}
1201 		}
1202 	}
1203 	catch( Exception& e )
1204 	{
1205 		(void)e;
1206 		OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1207 	}
1208 
1209 	return xNewNode;
1210 }
1211 
1212 // --------------------------------------------------------------------
1213 
1214 // XAnimate
1215 Any SAL_CALL AnimationNode::getTarget()
1216 	throw (RuntimeException)
1217 {
1218 	Guard< Mutex > aGuard( maMutex );
1219 	return maTarget;
1220 }
1221 
1222 // --------------------------------------------------------------------
1223 
1224 // XAnimate
1225 void SAL_CALL AnimationNode::setTarget( const Any& _target )
1226 	throw (RuntimeException)
1227 {
1228 	Guard< Mutex > aGuard( maMutex );
1229 	if( _target != maTarget )
1230 	{
1231 		maTarget= _target;
1232 		fireChangeListener();
1233 	}
1234 }
1235 
1236 // --------------------------------------------------------------------
1237 
1238 // XAnimate
1239 OUString SAL_CALL AnimationNode::getAttributeName() throw (RuntimeException)
1240 {
1241 	Guard< Mutex > aGuard( maMutex );
1242 	return maAttributeName;
1243 }
1244 
1245 // --------------------------------------------------------------------
1246 
1247 // XAnimate
1248 void SAL_CALL AnimationNode::setAttributeName( const OUString& _attribute )
1249 	throw (RuntimeException)
1250 {
1251 	Guard< Mutex > aGuard( maMutex );
1252 	if( _attribute != maAttributeName )
1253 	{
1254 		maAttributeName = _attribute;
1255 		fireChangeListener();
1256 	}
1257 }
1258 
1259 // --------------------------------------------------------------------
1260 
1261 // XAnimate
1262 Sequence< Any > SAL_CALL AnimationNode::getValues()
1263 	throw (RuntimeException)
1264 {
1265 	Guard< Mutex > aGuard( maMutex );
1266 	return maValues;
1267 }
1268 
1269 // --------------------------------------------------------------------
1270 
1271 // XAnimate
1272 void SAL_CALL AnimationNode::setValues( const Sequence< Any >& _values )
1273 	throw (RuntimeException)
1274 {
1275 	Guard< Mutex > aGuard( maMutex );
1276 	maValues = _values;
1277 	fireChangeListener();
1278 }
1279 
1280 // --------------------------------------------------------------------
1281 
1282 // XAnimate
1283 sal_Int16 SAL_CALL AnimationNode::getSubItem() throw (RuntimeException)
1284 {
1285 	Guard< Mutex > aGuard( maMutex );
1286 	return mnSubItem;
1287 }
1288 
1289 // --------------------------------------------------------------------
1290 
1291 // XAnimate
1292 void SAL_CALL AnimationNode::setSubItem( sal_Int16 _subitem ) throw (RuntimeException)
1293 {
1294 	Guard< Mutex > aGuard( maMutex );
1295 	if( _subitem != mnSubItem )
1296 	{
1297 		mnSubItem = _subitem;
1298 		fireChangeListener();
1299 	}
1300 }
1301 
1302 // --------------------------------------------------------------------
1303 
1304 // XAnimate
1305 Sequence< double > SAL_CALL AnimationNode::getKeyTimes() throw (RuntimeException)
1306 {
1307 	Guard< Mutex > aGuard( maMutex );
1308 	return maKeyTimes;
1309 }
1310 
1311 // --------------------------------------------------------------------
1312 
1313 // XAnimate
1314 void SAL_CALL AnimationNode::setKeyTimes( const Sequence< double >& _keytimes ) throw (RuntimeException)
1315 {
1316 	Guard< Mutex > aGuard( maMutex );
1317 	maKeyTimes = _keytimes;
1318 	fireChangeListener();
1319 }
1320 
1321 // --------------------------------------------------------------------
1322 
1323 // XAnimate
1324 sal_Int16 SAL_CALL AnimationNode::getValueType() throw (RuntimeException)
1325 {
1326 	Guard< Mutex > aGuard( maMutex );
1327 	return mnValueType;
1328 }
1329 
1330 // --------------------------------------------------------------------
1331 
1332 void SAL_CALL AnimationNode::setValueType( sal_Int16 _valuetype ) throw (RuntimeException)
1333 {
1334 	Guard< Mutex > aGuard( maMutex );
1335 	if( _valuetype != mnValueType )
1336 	{
1337 		mnValueType = _valuetype;
1338 		fireChangeListener();
1339 	}
1340 }
1341 
1342 // --------------------------------------------------------------------
1343 
1344 // XAnimate
1345 sal_Int16 SAL_CALL AnimationNode::getCalcMode()
1346 	throw (RuntimeException)
1347 {
1348 	Guard< Mutex > aGuard( maMutex );
1349 	return mnCalcMode;
1350 }
1351 
1352 // --------------------------------------------------------------------
1353 
1354 // XAnimate
1355 void SAL_CALL AnimationNode::setCalcMode( sal_Int16 _calcmode )
1356 	throw (RuntimeException)
1357 {
1358 	Guard< Mutex > aGuard( maMutex );
1359 	if( _calcmode != mnCalcMode )
1360 	{
1361 		mnCalcMode = _calcmode;
1362 		fireChangeListener();
1363 	}
1364 }
1365 
1366 // --------------------------------------------------------------------
1367 
1368 // XAnimate
1369 sal_Bool SAL_CALL AnimationNode::getAccumulate()
1370 	throw (RuntimeException)
1371 {
1372 	Guard< Mutex > aGuard( maMutex );
1373 	return mbAccumulate;
1374 }
1375 
1376 // --------------------------------------------------------------------
1377 
1378 // XAnimate
1379 void SAL_CALL AnimationNode::setAccumulate( sal_Bool _accumulate )
1380 	throw (RuntimeException)
1381 {
1382 	Guard< Mutex > aGuard( maMutex );
1383 	if( _accumulate != mbAccumulate )
1384 	{
1385 		mbAccumulate = _accumulate;
1386 		fireChangeListener();
1387 	}
1388 }
1389 
1390 // --------------------------------------------------------------------
1391 
1392 // XAnimate
1393 sal_Int16 SAL_CALL AnimationNode::getAdditive()
1394 	throw (RuntimeException)
1395 {
1396 	Guard< Mutex > aGuard( maMutex );
1397 	return mnAdditive;
1398 }
1399 
1400 // --------------------------------------------------------------------
1401 
1402 // XAnimate
1403 void SAL_CALL AnimationNode::setAdditive( sal_Int16 _additive )
1404 	throw (RuntimeException)
1405 {
1406 	Guard< Mutex > aGuard( maMutex );
1407 	if( _additive != mnAdditive )
1408 	{
1409 		mnAdditive = _additive;
1410 		fireChangeListener();
1411 	}
1412 }
1413 
1414 // --------------------------------------------------------------------
1415 
1416 // XAnimate
1417 Any SAL_CALL AnimationNode::getFrom()
1418 	throw (RuntimeException)
1419 {
1420 	Guard< Mutex > aGuard( maMutex );
1421 	return maFrom;
1422 }
1423 
1424 // --------------------------------------------------------------------
1425 
1426 // XAnimate
1427 void SAL_CALL AnimationNode::setFrom( const Any& _from )
1428 	throw (RuntimeException)
1429 {
1430 	Guard< Mutex > aGuard( maMutex );
1431 	if( _from != maFrom )
1432 	{
1433 		maFrom = _from;
1434 		fireChangeListener();
1435 	}
1436 }
1437 
1438 // --------------------------------------------------------------------
1439 
1440 // XAnimate
1441 Any SAL_CALL AnimationNode::getTo()
1442 	throw (RuntimeException)
1443 {
1444 	Guard< Mutex > aGuard( maMutex );
1445 	return maTo;
1446 }
1447 
1448 // --------------------------------------------------------------------
1449 
1450 // XAnimate
1451 void SAL_CALL AnimationNode::setTo( const Any& _to )
1452 	throw (RuntimeException)
1453 {
1454 	Guard< Mutex > aGuard( maMutex );
1455 	if( _to != maTo )
1456 	{
1457 		maTo = _to;
1458 		fireChangeListener();
1459 	}
1460 }
1461 
1462 // --------------------------------------------------------------------
1463 
1464 // XAnimate
1465 Any SAL_CALL AnimationNode::getBy()
1466 	throw (RuntimeException)
1467 {
1468 	Guard< Mutex > aGuard( maMutex );
1469 	return maBy;
1470 }
1471 
1472 // --------------------------------------------------------------------
1473 
1474 // XAnimate
1475 void SAL_CALL AnimationNode::setBy( const Any& _by )
1476 	throw (RuntimeException)
1477 {
1478 	Guard< Mutex > aGuard( maMutex );
1479 	if( _by != maBy )
1480 	{
1481 		maBy = _by;
1482 		fireChangeListener();
1483 	}
1484 }
1485 
1486 // --------------------------------------------------------------------
1487 
1488 // XAnimate
1489 Sequence< TimeFilterPair > SAL_CALL AnimationNode::getTimeFilter()
1490 	throw (RuntimeException)
1491 {
1492 	Guard< Mutex > aGuard( maMutex );
1493 	return maTimeFilter;
1494 }
1495 
1496 // --------------------------------------------------------------------
1497 
1498 // XAnimate
1499 void SAL_CALL AnimationNode::setTimeFilter( const Sequence< TimeFilterPair >& _timefilter )
1500 	throw (RuntimeException)
1501 {
1502 	Guard< Mutex > aGuard( maMutex );
1503 	maTimeFilter = _timefilter;
1504 	fireChangeListener();
1505 }
1506 
1507 // --------------------------------------------------------------------
1508 
1509 OUString SAL_CALL AnimationNode::getFormula() throw (RuntimeException)
1510 {
1511 	Guard< Mutex > aGuard( maMutex );
1512 	return maFormula;
1513 }
1514 
1515 // --------------------------------------------------------------------
1516 
1517 void SAL_CALL AnimationNode::setFormula( const OUString& _formula ) throw (RuntimeException)
1518 {
1519 	Guard< Mutex > aGuard( maMutex );
1520 	if( _formula != maFormula )
1521 	{
1522 		maFormula = _formula;
1523 		fireChangeListener();
1524 	}
1525 }
1526 
1527 // --------------------------------------------------------------------
1528 
1529 // XAnimateColor
1530 sal_Int16 SAL_CALL AnimationNode::getColorInterpolation() throw (RuntimeException)
1531 {
1532 	Guard< Mutex > aGuard( maMutex );
1533 	return mnColorSpace;
1534 }
1535 
1536 // --------------------------------------------------------------------
1537 
1538 // XAnimateColor
1539 void SAL_CALL AnimationNode::setColorInterpolation( sal_Int16 _colorspace ) throw (RuntimeException)
1540 {
1541 	Guard< Mutex > aGuard( maMutex );
1542 	if( _colorspace != mnColorSpace )
1543 	{
1544 		mnColorSpace = _colorspace;
1545 		fireChangeListener();
1546 	}
1547 }
1548 
1549 // --------------------------------------------------------------------
1550 
1551 // XAnimateColor
1552 sal_Bool SAL_CALL AnimationNode::getDirection() throw (RuntimeException)
1553 {
1554 	Guard< Mutex > aGuard( maMutex );
1555 	return mbDirection;
1556 }
1557 
1558 // --------------------------------------------------------------------
1559 
1560 // XAnimateColor
1561 void SAL_CALL AnimationNode::setDirection( sal_Bool _direction ) throw (RuntimeException)
1562 {
1563 	Guard< Mutex > aGuard( maMutex );
1564 	if( _direction != mbDirection )
1565 	{
1566 		mbDirection = _direction;
1567 		fireChangeListener();
1568 	}
1569 }
1570 
1571 // --------------------------------------------------------------------
1572 
1573 // XAnimateMotion
1574 Any SAL_CALL AnimationNode::getPath() throw (RuntimeException)
1575 {
1576 	Guard< Mutex > aGuard( maMutex );
1577 	return maPath;
1578 }
1579 
1580 // --------------------------------------------------------------------
1581 
1582 // XAnimateMotion
1583 void SAL_CALL AnimationNode::setPath( const Any& _path ) throw (RuntimeException)
1584 {
1585 	Guard< Mutex > aGuard( maMutex );
1586 	maPath = _path;
1587 	fireChangeListener();
1588 }
1589 
1590 // --------------------------------------------------------------------
1591 
1592 // XAnimateMotion
1593 Any SAL_CALL AnimationNode::getOrigin() throw (RuntimeException)
1594 {
1595 	Guard< Mutex > aGuard( maMutex );
1596 	return maOrigin;
1597 }
1598 
1599 // --------------------------------------------------------------------
1600 
1601 // XAnimateMotion
1602 void SAL_CALL AnimationNode::setOrigin( const Any& _origin ) throw (RuntimeException)
1603 {
1604 	Guard< Mutex > aGuard( maMutex );
1605 	maOrigin = _origin;
1606 	fireChangeListener();
1607 }
1608 
1609 // --------------------------------------------------------------------
1610 
1611 // XAnimateTransform
1612 sal_Int16 SAL_CALL AnimationNode::getTransformType() throw (RuntimeException)
1613 {
1614 	Guard< Mutex > aGuard( maMutex );
1615 	return mnTransformType;
1616 }
1617 
1618 // --------------------------------------------------------------------
1619 
1620 // XAnimateTransform
1621 void SAL_CALL AnimationNode::setTransformType( sal_Int16 _transformtype ) throw (RuntimeException)
1622 {
1623 	Guard< Mutex > aGuard( maMutex );
1624 	if( _transformtype != mnTransformType )
1625 	{
1626 		mnTransformType = _transformtype;
1627 		fireChangeListener();
1628 	}
1629 }
1630 
1631 // --------------------------------------------------------------------
1632 
1633 // XTransitionFilter
1634 sal_Int16 SAL_CALL AnimationNode::getTransition() throw (RuntimeException)
1635 {
1636 	Guard< Mutex > aGuard( maMutex );
1637 	return mnTransition;
1638 }
1639 
1640 // --------------------------------------------------------------------
1641 
1642 // XTransitionFilter
1643 void SAL_CALL AnimationNode::setTransition( sal_Int16 _transition ) throw (RuntimeException)
1644 {
1645 	Guard< Mutex > aGuard( maMutex );
1646 	if( _transition != mnTransition )
1647 	{
1648 		mnTransition = _transition;
1649 		fireChangeListener();
1650 	}
1651 }
1652 
1653 // --------------------------------------------------------------------
1654 
1655 // XTransitionFilter
1656 sal_Int16 SAL_CALL AnimationNode::getSubtype() throw (RuntimeException)
1657 {
1658 	Guard< Mutex > aGuard( maMutex );
1659 	return mnSubtype;
1660 }
1661 
1662 // --------------------------------------------------------------------
1663 
1664 // XTransitionFilter
1665 void SAL_CALL AnimationNode::setSubtype( sal_Int16 _subtype ) throw (RuntimeException)
1666 {
1667 	Guard< Mutex > aGuard( maMutex );
1668 	if( _subtype != mnSubtype )
1669 	{
1670 		mnSubtype = _subtype;
1671 		fireChangeListener();
1672 	}
1673 }
1674 
1675 // --------------------------------------------------------------------
1676 
1677 // XTransitionFilter
1678 sal_Bool SAL_CALL AnimationNode::getMode() throw (RuntimeException)
1679 {
1680 	Guard< Mutex > aGuard( maMutex );
1681 	return mbMode;
1682 }
1683 
1684 // --------------------------------------------------------------------
1685 
1686 // XTransitionFilter
1687 void SAL_CALL AnimationNode::setMode( sal_Bool _mode ) throw (RuntimeException)
1688 {
1689 	Guard< Mutex > aGuard( maMutex );
1690 	if( _mode != mbMode )
1691 	{
1692 		mbMode = _mode;
1693 		fireChangeListener();
1694 	}
1695 }
1696 
1697 // --------------------------------------------------------------------
1698 
1699 // XTransitionFilter
1700 sal_Int32 SAL_CALL AnimationNode::getFadeColor() throw (RuntimeException)
1701 {
1702 	Guard< Mutex > aGuard( maMutex );
1703 	return mnFadeColor;
1704 }
1705 
1706 // --------------------------------------------------------------------
1707 
1708 // XTransitionFilter
1709 void SAL_CALL AnimationNode::setFadeColor( sal_Int32 _fadecolor ) throw (RuntimeException)
1710 {
1711 	Guard< Mutex > aGuard( maMutex );
1712 	if( _fadecolor != mnFadeColor )
1713 	{
1714 		mnFadeColor = _fadecolor;
1715 		fireChangeListener();
1716 	}
1717 }
1718 
1719 // --------------------------------------------------------------------
1720 
1721 // XAudio
1722 Any SAL_CALL AnimationNode::getSource() throw (RuntimeException)
1723 {
1724 	Guard< Mutex > aGuard( maMutex );
1725 	return maTarget;
1726 }
1727 
1728 // --------------------------------------------------------------------
1729 
1730 // XAudio
1731 void SAL_CALL AnimationNode::setSource( const Any& _source ) throw (RuntimeException)
1732 {
1733 	Guard< Mutex > aGuard( maMutex );
1734 	maTarget = _source;
1735 	fireChangeListener();
1736 }
1737 
1738 // --------------------------------------------------------------------
1739 
1740 // XAudio
1741 double SAL_CALL AnimationNode::getVolume() throw (RuntimeException)
1742 {
1743 	Guard< Mutex > aGuard( maMutex );
1744 	return mfVolume;
1745 }
1746 
1747 // --------------------------------------------------------------------
1748 
1749 // XAudio
1750 void SAL_CALL AnimationNode::setVolume( double _volume ) throw (RuntimeException)
1751 {
1752 	Guard< Mutex > aGuard( maMutex );
1753 	if( _volume != mfVolume )
1754 	{
1755 		mfVolume = _volume;
1756 		fireChangeListener();
1757 	}
1758 }
1759 
1760 // --------------------------------------------------------------------
1761 
1762 // XCommand
1763 sal_Int16 SAL_CALL AnimationNode::getCommand() throw (RuntimeException)
1764 {
1765 	Guard< Mutex > aGuard( maMutex );
1766 	return mnCommand;
1767 }
1768 
1769 // --------------------------------------------------------------------
1770 
1771 // XCommand
1772 void SAL_CALL AnimationNode::setCommand( sal_Int16 _command ) throw (RuntimeException)
1773 {
1774 	Guard< Mutex > aGuard( maMutex );
1775 	if( _command != mnCommand )
1776 	{
1777 		mnCommand = _command;
1778 		fireChangeListener();
1779 	}
1780 }
1781 
1782 // --------------------------------------------------------------------
1783 
1784 // XCommand
1785 Any SAL_CALL AnimationNode::getParameter() throw (RuntimeException)
1786 {
1787 	Guard< Mutex > aGuard( maMutex );
1788 	return maParameter;
1789 }
1790 
1791 // --------------------------------------------------------------------
1792 
1793 // XCommand
1794 void SAL_CALL AnimationNode::setParameter( const Any& _parameter ) throw (RuntimeException)
1795 {
1796 	Guard< Mutex > aGuard( maMutex );
1797 	maParameter = _parameter;
1798 	fireChangeListener();
1799 }
1800 
1801 // --------------------------------------------------------------------
1802 
1803 // XElementAccess
1804 Type SAL_CALL AnimationNode::getElementType() throw (RuntimeException)
1805 {
1806 	return ::getCppuType((const Reference< XAnimationNode >*)0);
1807 }
1808 
1809 // --------------------------------------------------------------------
1810 
1811 // XElementAccess
1812 sal_Bool SAL_CALL AnimationNode::hasElements() throw (RuntimeException)
1813 {
1814 	Guard< Mutex > aGuard( maMutex );
1815 	return !maChilds.empty();
1816 }
1817 
1818 // --------------------------------------------------------------------
1819 
1820 // XEnumerationAccess
1821 Reference< XEnumeration > SAL_CALL AnimationNode::createEnumeration()
1822 	throw (RuntimeException)
1823 {
1824 	Guard< Mutex > aGuard( maMutex );
1825 
1826 	return new TimeContainerEnumeration( maChilds);
1827 }
1828 
1829 // --------------------------------------------------------------------
1830 
1831 
1832 // XTimeContainer
1833 Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild )
1834 	throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
1835 {
1836 	Guard< Mutex > aGuard( maMutex );
1837 
1838 	if( !newChild.is() || !refChild.is() )
1839 		throw IllegalArgumentException();
1840 
1841 	ChildList_t::iterator before = ::std::find(maChilds.begin(), maChilds.end(), refChild);
1842 	if( before == maChilds.end() )
1843 		throw NoSuchElementException();
1844 
1845 	if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() )
1846 		throw ElementExistException();
1847 
1848 	maChilds.insert( before, newChild );
1849 
1850 	Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1851 	newChild->setParent( xThis );
1852 
1853 	return newChild;
1854 }
1855 
1856 // --------------------------------------------------------------------
1857 
1858 // XTimeContainer
1859 Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild )
1860 	throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
1861 {
1862 	Guard< Mutex > aGuard( maMutex );
1863 
1864 	if( !newChild.is() || !refChild.is() )
1865 		throw IllegalArgumentException();
1866 
1867 	ChildList_t::iterator before = ::std::find(maChilds.begin(), maChilds.end(), refChild);
1868 	if( before == maChilds.end() )
1869 		throw NoSuchElementException();
1870 
1871 	if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() )
1872 		throw ElementExistException();
1873 
1874 	before++;
1875 	if( before != maChilds.end() )
1876 		maChilds.insert( before, newChild );
1877 	else
1878 		maChilds.push_back( newChild );
1879 
1880 	Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1881 	newChild->setParent( xThis );
1882 
1883 	return newChild;
1884 }
1885 
1886 // --------------------------------------------------------------------
1887 
1888 // XTimeContainer
1889 Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild )
1890 	throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
1891 {
1892 	Guard< Mutex > aGuard( maMutex );
1893 
1894 	if( !newChild.is() || !oldChild.is() )
1895 		throw IllegalArgumentException();
1896 
1897 	ChildList_t::iterator replace = ::std::find(maChilds.begin(), maChilds.end(), oldChild);
1898 	if( replace == maChilds.end() )
1899 		throw NoSuchElementException();
1900 
1901 	if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() )
1902 		throw ElementExistException();
1903 
1904 	Reference< XInterface > xNull( 0 );
1905 	oldChild->setParent( xNull );
1906 
1907 	(*replace) = newChild;
1908 
1909 	Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1910 	newChild->setParent( xThis );
1911 
1912 	return newChild;
1913 }
1914 
1915 // --------------------------------------------------------------------
1916 
1917 // XTimeContainer
1918 Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference< XAnimationNode >& oldChild )
1919 	throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
1920 {
1921 	Guard< Mutex > aGuard( maMutex );
1922 
1923 	if( !oldChild.is() )
1924 		throw IllegalArgumentException();
1925 
1926 	ChildList_t::iterator old = ::std::find(maChilds.begin(), maChilds.end(), oldChild);
1927 	if( old == maChilds.end() )
1928 		throw NoSuchElementException();
1929 
1930 	Reference< XInterface > xNull( 0 );
1931 	oldChild->setParent( xNull );
1932 
1933 	maChilds.erase( old );
1934 
1935 	return oldChild;
1936 }
1937 
1938 // --------------------------------------------------------------------
1939 
1940 // XTimeContainer
1941 Reference< XAnimationNode > SAL_CALL AnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
1942 	throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
1943 {
1944 	Guard< Mutex > aGuard( maMutex );
1945 
1946 	if( !newChild.is() )
1947 		throw IllegalArgumentException();
1948 
1949 	if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() )
1950 		throw ElementExistException();
1951 
1952 	Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1953 	Reference< XInterface > xChild( newChild );
1954 
1955 	if( xThis == xChild )
1956 		throw IllegalArgumentException();
1957 
1958 	maChilds.push_back( newChild );
1959 
1960 	newChild->setParent( xThis );
1961 
1962 	return newChild;
1963 }
1964 
1965 // --------------------------------------------------------------------
1966 
1967 // XIterateContainer
1968 sal_Int16 SAL_CALL AnimationNode::getIterateType() throw (RuntimeException)
1969 {
1970 	Guard< Mutex > aGuard( maMutex );
1971 	return mnIterateType;
1972 }
1973 
1974 // --------------------------------------------------------------------
1975 
1976 // XIterateContainer
1977 void SAL_CALL AnimationNode::setIterateType( sal_Int16 _iteratetype ) throw (RuntimeException)
1978 {
1979 	Guard< Mutex > aGuard( maMutex );
1980 	if( _iteratetype != mnIterateType )
1981 	{
1982 		mnIterateType = _iteratetype;
1983 		fireChangeListener();
1984 	}
1985 }
1986 
1987 // --------------------------------------------------------------------
1988 
1989 // XIterateContainer
1990 double SAL_CALL AnimationNode::getIterateInterval() throw (RuntimeException)
1991 {
1992 	Guard< Mutex > aGuard( maMutex );
1993 	return mfIterateInterval;
1994 }
1995 
1996 // --------------------------------------------------------------------
1997 
1998 // XIterateContainer
1999 void SAL_CALL AnimationNode::setIterateInterval( double _iterateinterval ) throw (RuntimeException)
2000 {
2001 	Guard< Mutex > aGuard( maMutex );
2002 	if( _iterateinterval != mfIterateInterval )
2003 	{
2004 		mfIterateInterval = _iterateinterval;
2005 		fireChangeListener();
2006 	}
2007 }
2008 
2009 // --------------------------------------------------------------------
2010 
2011 // XChangesNotifier
2012 void SAL_CALL AnimationNode::addChangesListener( const Reference< XChangesListener >& aListener ) throw (RuntimeException)
2013 {
2014 	maChangeListener.addInterface( aListener );
2015 }
2016 
2017 // --------------------------------------------------------------------
2018 
2019 // XChangesNotifier
2020 void SAL_CALL AnimationNode::removeChangesListener( const Reference< XChangesListener >& aListener ) throw (RuntimeException)
2021 {
2022 	maChangeListener.removeInterface(aListener);
2023 }
2024 
2025 // --------------------------------------------------------------------
2026 
2027 // XUnoTunnel
2028 ::sal_Int64 SAL_CALL AnimationNode::getSomething( const Sequence< ::sal_Int8 >& rId ) throw (RuntimeException)
2029 {
2030 	if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) )
2031 	{
2032 		return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this));
2033 
2034 	}
2035 	else
2036 	{
2037 		return 0;
2038 	}
2039 }
2040 
2041 // --------------------------------------------------------------------
2042 
2043 const ::com::sun::star::uno::Sequence< sal_Int8 > & AnimationNode::getUnoTunnelId()
2044 {
2045 	static ::com::sun::star::uno::Sequence< sal_Int8 > * pSeq = 0;
2046 	if( !pSeq )
2047 	{
2048 		::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() );
2049 		if( !pSeq )
2050 		{
2051 			static ::com::sun::star::uno::Sequence< sal_Int8 > aSeq( 16 );
2052 			rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
2053 			pSeq = &aSeq;
2054 		}
2055 	}
2056 	return *pSeq;
2057 }
2058 
2059 // --------------------------------------------------------------------
2060 
2061 void AnimationNode::fireChangeListener()
2062 {
2063 	Guard< Mutex > aGuard( maMutex );
2064 
2065 	OInterfaceIteratorHelper aIterator( maChangeListener );
2066 	if( aIterator.hasMoreElements() )
2067 	{
2068 		Reference< XInterface > xSource( static_cast<OWeakObject*>(this), UNO_QUERY );
2069 		Sequence< ElementChange > aChanges;
2070 		const ChangesEvent aEvent( xSource, makeAny( mxParent ), aChanges );
2071 		while( aIterator.hasMoreElements() )
2072 		{
2073 			Reference< XChangesListener > xListener( aIterator.next(), UNO_QUERY );
2074 			if( xListener.is() )
2075 				xListener->changesOccurred( aEvent );
2076 		}
2077 	}
2078 
2079 	if( mpParent )
2080 		mpParent->fireChangeListener();
2081 }
2082 
2083 // --------------------------------------------------------------------
2084 
2085 } // namespace animcore
2086