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