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