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