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