1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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/XParallelTimeContainer.hpp>
29 #include <com/sun/star/animations/XTransitionFilter.hpp>
30 #include <com/sun/star/animations/XTimeContainer.hpp>
31 #include <com/sun/star/animations/XIterateContainer.hpp>
32 #include <com/sun/star/animations/XAudio.hpp>
33 #include <com/sun/star/animations/XCommand.hpp>
34 #include <com/sun/star/animations/AnimationNodeType.hpp>
35 #include <com/sun/star/animations/AnimationCalcMode.hpp>
36 #include <com/sun/star/animations/AnimationFill.hpp>
37 #include <com/sun/star/animations/AnimationRestart.hpp>
38 #include <com/sun/star/animations/AnimationColorSpace.hpp>
39 #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
40 #include <com/sun/star/animations/AnimationTransformType.hpp>
41 #include <com/sun/star/animations/TransitionType.hpp>
42 #include <com/sun/star/animations/TransitionSubType.hpp>
43 #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
44 #include <com/sun/star/container/XEnumerationAccess.hpp>
45 #include <com/sun/star/beans/NamedValue.hpp>
46 #include <com/sun/star/util/XChangesNotifier.hpp>
47 #include <com/sun/star/lang/XUnoTunnel.hpp>
48 #include <comphelper/servicehelper.hxx>
49 #include <cppuhelper/interfacecontainer.hxx>
50 #include <cppuhelper/weakref.hxx>
52 #include <cppuhelper/implbase1.hxx>
55 #include <osl/mutex.hxx>
62 using ::cppu::OInterfaceContainerHelper
;
63 using ::cppu::OInterfaceIteratorHelper
;
64 using ::com::sun::star::uno::Any
;
65 using ::com::sun::star::uno::UNO_QUERY
;
66 using ::com::sun::star::uno::XInterface
;
67 using ::com::sun::star::uno::RuntimeException
;
68 using ::com::sun::star::uno::Sequence
;
69 using ::com::sun::star::uno::Reference
;
70 using ::com::sun::star::uno::WeakReference
;
71 using ::com::sun::star::uno::XComponentContext
;
72 using ::com::sun::star::uno::Exception
;
73 using ::com::sun::star::uno::XWeak
;
74 using ::com::sun::star::uno::Type
;
75 using ::com::sun::star::uno::makeAny
;
76 using ::com::sun::star::lang::NoSupportException
;
77 using ::com::sun::star::lang::IllegalArgumentException
;
78 using ::com::sun::star::lang::WrappedTargetException
;
79 using ::com::sun::star::lang::XServiceInfo
;
80 using ::com::sun::star::lang::XTypeProvider
;
81 using ::com::sun::star::container::NoSuchElementException
;
82 using ::com::sun::star::container::ElementExistException
;
83 using ::com::sun::star::container::XEnumeration
;
84 using ::com::sun::star::container::XEnumerationAccess
;
85 using ::com::sun::star::beans::NamedValue
;
86 using ::com::sun::star::util::XCloneable
;
87 using ::com::sun::star::lang::XUnoTunnel
;
88 using ::com::sun::star::util::XChangesNotifier
;
89 using ::com::sun::star::util::XChangesListener
;
90 using ::com::sun::star::util::ElementChange
;
91 using ::com::sun::star::util::ChangesEvent
;
93 using ::cppu::OWeakObject
;
95 using namespace ::com::sun::star::animations
;
96 using namespace ::com::sun::star::animations::AnimationNodeType
;
101 // ====================================================================
103 typedef ::std::list
< Reference
< XAnimationNode
> > ChildList_t
;
105 // ====================================================================
107 class AnimationNodeBase
: public XAnimateMotion
,
108 public XAnimateColor
,
109 public XTransitionFilter
,
111 public XAnimateTransform
,
112 public XParallelTimeContainer
,
113 public XIterateContainer
,
115 public XTypeProvider
,
119 public XChangesNotifier
,
124 // our first, last and only protection from mutli-threads!
128 class AnimationNode
: public AnimationNodeBase
131 AnimationNode( sal_Int16 nNodeType
);
132 AnimationNode( const AnimationNode
& rNode
);
133 virtual ~AnimationNode();
136 virtual Any SAL_CALL
queryInterface( const Type
& aType
) throw (RuntimeException
);
137 virtual void SAL_CALL
acquire() throw ();
138 virtual void SAL_CALL
release() throw ();
141 virtual Sequence
< Type
> SAL_CALL
getTypes() throw (RuntimeException
);
142 virtual Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (RuntimeException
);
145 OUString SAL_CALL
getImplementationName() throw();
146 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw();
147 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw();
150 virtual Reference
< XInterface
> SAL_CALL
getParent() throw (RuntimeException
);
151 virtual void SAL_CALL
setParent( const Reference
< XInterface
>& Parent
) throw (NoSupportException
, RuntimeException
);
154 virtual Reference
< XCloneable
> SAL_CALL
createClone() throw (RuntimeException
);
157 virtual sal_Int16 SAL_CALL
getType() throw (RuntimeException
);
158 virtual Any SAL_CALL
getBegin() throw (RuntimeException
);
159 virtual void SAL_CALL
setBegin( const Any
& _begin
) throw (RuntimeException
);
160 virtual Any SAL_CALL
getDuration() throw (RuntimeException
);
161 virtual void SAL_CALL
setDuration( const Any
& _duration
) throw (RuntimeException
);
162 virtual Any SAL_CALL
getEnd() throw (RuntimeException
);
163 virtual void SAL_CALL
setEnd( const Any
& _end
) throw (RuntimeException
);
164 virtual Any SAL_CALL
getEndSync() throw (RuntimeException
);
165 virtual void SAL_CALL
setEndSync( const Any
& _endsync
) throw (RuntimeException
);
166 virtual Any SAL_CALL
getRepeatCount() throw (RuntimeException
);
167 virtual void SAL_CALL
setRepeatCount( const Any
& _repeatcount
) throw (RuntimeException
);
168 virtual Any SAL_CALL
getRepeatDuration() throw (RuntimeException
);
169 virtual void SAL_CALL
setRepeatDuration( const Any
& _repeatduration
) throw (RuntimeException
);
170 virtual sal_Int16 SAL_CALL
getFill() throw (RuntimeException
);
171 virtual void SAL_CALL
setFill( sal_Int16 _fill
) throw (RuntimeException
);
172 virtual sal_Int16 SAL_CALL
getFillDefault() throw (RuntimeException
);
173 virtual void SAL_CALL
setFillDefault( sal_Int16 _filldefault
) throw (RuntimeException
);
174 virtual sal_Int16 SAL_CALL
getRestart() throw (RuntimeException
);
175 virtual void SAL_CALL
setRestart( sal_Int16 _restart
) throw (RuntimeException
);
176 virtual sal_Int16 SAL_CALL
getRestartDefault() throw (RuntimeException
);
177 virtual void SAL_CALL
setRestartDefault( sal_Int16 _restartdefault
) throw (RuntimeException
);
178 virtual double SAL_CALL
getAcceleration() throw (RuntimeException
);
179 virtual void SAL_CALL
setAcceleration( double _acceleration
) throw (RuntimeException
);
180 virtual double SAL_CALL
getDecelerate() throw (RuntimeException
);
181 virtual void SAL_CALL
setDecelerate( double _decelerate
) throw (RuntimeException
);
182 virtual sal_Bool SAL_CALL
getAutoReverse() throw (RuntimeException
);
183 virtual void SAL_CALL
setAutoReverse( sal_Bool _autoreverse
) throw (RuntimeException
);
184 virtual Sequence
< NamedValue
> SAL_CALL
getUserData() throw (RuntimeException
);
185 virtual void SAL_CALL
setUserData( const Sequence
< NamedValue
>& _userdata
) throw (RuntimeException
);
188 virtual Any SAL_CALL
getTarget() throw (RuntimeException
);
189 virtual void SAL_CALL
setTarget( const Any
& _target
) throw (RuntimeException
);
190 virtual sal_Int16 SAL_CALL
getSubItem() throw (RuntimeException
);
191 virtual void SAL_CALL
setSubItem( sal_Int16 _subitem
) throw (RuntimeException
);
192 virtual OUString SAL_CALL
getAttributeName() throw (RuntimeException
);
193 virtual void SAL_CALL
setAttributeName( const OUString
& _attribute
) throw (RuntimeException
);
194 virtual Sequence
< Any
> SAL_CALL
getValues() throw (RuntimeException
);
195 virtual void SAL_CALL
setValues( const Sequence
< Any
>& _values
) throw (RuntimeException
);
196 virtual Sequence
< double > SAL_CALL
getKeyTimes() throw (RuntimeException
);
197 virtual void SAL_CALL
setKeyTimes( const Sequence
< double >& _keytimes
) throw (RuntimeException
);
198 virtual sal_Int16 SAL_CALL
getValueType() throw (RuntimeException
);
199 virtual void SAL_CALL
setValueType( sal_Int16 _valuetype
) throw (RuntimeException
);
200 virtual sal_Int16 SAL_CALL
getCalcMode() throw (RuntimeException
);
201 virtual void SAL_CALL
setCalcMode( sal_Int16 _calcmode
) throw (RuntimeException
);
202 virtual sal_Bool SAL_CALL
getAccumulate() throw (RuntimeException
);
203 virtual void SAL_CALL
setAccumulate( sal_Bool _accumulate
) throw (RuntimeException
);
204 virtual sal_Int16 SAL_CALL
getAdditive() throw (RuntimeException
);
205 virtual void SAL_CALL
setAdditive( sal_Int16 _additive
) throw (RuntimeException
);
206 virtual Any SAL_CALL
getFrom() throw (RuntimeException
);
207 virtual void SAL_CALL
setFrom( const Any
& _from
) throw (RuntimeException
);
208 virtual Any SAL_CALL
getTo() throw (RuntimeException
);
209 virtual void SAL_CALL
setTo( const Any
& _to
) throw (RuntimeException
);
210 virtual Any SAL_CALL
getBy() throw (RuntimeException
);
211 virtual void SAL_CALL
setBy( const Any
& _by
) throw (RuntimeException
);
212 virtual Sequence
< TimeFilterPair
> SAL_CALL
getTimeFilter() throw (RuntimeException
);
213 virtual void SAL_CALL
setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
) throw (RuntimeException
);
214 virtual OUString SAL_CALL
getFormula() throw (RuntimeException
);
215 virtual void SAL_CALL
setFormula( const OUString
& _formula
) throw (RuntimeException
);
218 virtual sal_Int16 SAL_CALL
getColorInterpolation() throw (RuntimeException
);
219 virtual void SAL_CALL
setColorInterpolation( sal_Int16 _colorspace
) throw (RuntimeException
);
220 virtual sal_Bool SAL_CALL
getDirection() throw (RuntimeException
);
221 virtual void SAL_CALL
setDirection( sal_Bool _direction
) throw (RuntimeException
);
224 virtual Any SAL_CALL
getPath() throw (RuntimeException
);
225 virtual void SAL_CALL
setPath( const Any
& _path
) throw (RuntimeException
);
226 virtual Any SAL_CALL
getOrigin() throw (RuntimeException
);
227 virtual void SAL_CALL
setOrigin( const Any
& _origin
) throw (RuntimeException
);
230 virtual sal_Int16 SAL_CALL
getTransformType() throw (RuntimeException
);
231 virtual void SAL_CALL
setTransformType( sal_Int16 _transformtype
) throw (RuntimeException
);
234 virtual sal_Int16 SAL_CALL
getTransition() throw (RuntimeException
);
235 virtual void SAL_CALL
setTransition( sal_Int16 _transition
) throw (RuntimeException
);
236 virtual sal_Int16 SAL_CALL
getSubtype() throw (RuntimeException
);
237 virtual void SAL_CALL
setSubtype( sal_Int16 _subtype
) throw (RuntimeException
);
238 virtual sal_Bool SAL_CALL
getMode() throw (RuntimeException
);
239 virtual void SAL_CALL
setMode( sal_Bool _mode
) throw (RuntimeException
);
240 virtual sal_Int32 SAL_CALL
getFadeColor() throw (RuntimeException
);
241 virtual void SAL_CALL
setFadeColor( sal_Int32 _fadecolor
) throw (RuntimeException
);
244 virtual Any SAL_CALL
getSource() throw (RuntimeException
);
245 virtual void SAL_CALL
setSource( const Any
& _source
) throw (RuntimeException
);
246 virtual double SAL_CALL
getVolume() throw (RuntimeException
);
247 virtual void SAL_CALL
setVolume( double _volume
) throw (RuntimeException
);
250 // XCommand - the following two shadowed by animate, unfortunately
251 // virtual Any SAL_CALL getTarget() throw (RuntimeException);
252 // virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
253 virtual sal_Int16 SAL_CALL
getCommand() throw (RuntimeException
);
254 virtual void SAL_CALL
setCommand( sal_Int16 _command
) throw (RuntimeException
);
255 virtual Any SAL_CALL
getParameter() throw (RuntimeException
);
256 virtual void SAL_CALL
setParameter( const Any
& _parameter
) throw (RuntimeException
);
259 virtual Type SAL_CALL
getElementType() throw (RuntimeException
);
260 virtual sal_Bool SAL_CALL
hasElements() throw (RuntimeException
);
262 // XEnumerationAccess
263 virtual Reference
< XEnumeration
> SAL_CALL
createEnumeration() throw (RuntimeException
);
266 virtual Reference
< XAnimationNode
> SAL_CALL
insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
267 virtual Reference
< XAnimationNode
> SAL_CALL
insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
268 virtual Reference
< XAnimationNode
> SAL_CALL
replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
) throw( IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
269 virtual Reference
< XAnimationNode
> SAL_CALL
removeChild( const Reference
< XAnimationNode
>& oldChild
) throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
);
270 virtual Reference
< XAnimationNode
> SAL_CALL
appendChild( const Reference
< XAnimationNode
>& newChild
) throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
273 virtual sal_Int16 SAL_CALL
getIterateType() throw (RuntimeException
);
274 virtual void SAL_CALL
setIterateType( sal_Int16 _iteratetype
) throw (RuntimeException
);
275 virtual double SAL_CALL
getIterateInterval() throw (RuntimeException
);
276 virtual void SAL_CALL
setIterateInterval( double _iterateinterval
) throw (RuntimeException
);
279 virtual void SAL_CALL
addChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
);
280 virtual void SAL_CALL
removeChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
);
283 virtual ::sal_Int64 SAL_CALL
getSomething( const Sequence
< ::sal_Int8
>& aIdentifier
) throw (RuntimeException
);
285 static const Sequence
< sal_Int8
> & getUnoTunnelId();
286 void fireChangeListener();
289 OInterfaceContainerHelper maChangeListener
;
291 static void initTypeProvider( sal_Int16 nNodeType
) throw();
293 const sal_Int16 mnNodeType
;
296 static Sequence
< Type
>* mpTypes
[12];
297 static Sequence
< sal_Int8
>* mpId
[12];
299 // attributes for the XAnimationNode interface implementation
300 Any maBegin
, maDuration
, maEnd
, maEndSync
, maRepeatCount
, maRepeatDuration
;
301 sal_Int16 mnFill
, mnFillDefault
, mnRestart
, mnRestartDefault
;
302 double mfAcceleration
, mfDecelerate
;
303 sal_Bool mbAutoReverse
;
304 Sequence
< NamedValue
> maUserData
;
306 // parent interface for XChild interface implementation
307 WeakReference
<XInterface
> mxParent
;
308 AnimationNode
* mpParent
;
310 // attributes for XAnimate
312 OUString maAttributeName
, maFormula
;
313 Sequence
< Any
> maValues
;
314 Sequence
< double > maKeyTimes
;
315 sal_Int16 mnValueType
, mnSubItem
;
316 sal_Int16 mnCalcMode
, mnAdditive
;
317 sal_Bool mbAccumulate
;
318 Any maFrom
, maTo
, maBy
;
319 Sequence
< TimeFilterPair
> maTimeFilter
;
321 // attributes for XAnimateColor
322 sal_Int16 mnColorSpace
;
323 sal_Bool mbDirection
;
325 // atributes for XAnimateMotion
326 Any maPath
, maOrigin
;
328 // attributes for XAnimateTransform
329 sal_Int16 mnTransformType
;
331 // attributes for XTransitionFilter
332 sal_Int16 mnTransition
;
335 sal_Int32 mnFadeColor
;
345 sal_Int16 mnIterateType
;
346 double mfIterateInterval
;
348 /** sorted list of child nodes for XTimeContainer*/
349 ChildList_t maChildren
;
352 // ====================================================================
354 class TimeContainerEnumeration
: public ::cppu::WeakImplHelper1
< XEnumeration
>
357 TimeContainerEnumeration( const ChildList_t
&rChildren
);
358 virtual ~TimeContainerEnumeration();
361 virtual sal_Bool SAL_CALL
hasMoreElements() throw (RuntimeException
);
362 virtual Any SAL_CALL
nextElement( ) throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
);
365 /** sorted list of child nodes */
366 ChildList_t maChildren
;
368 /** current iteration position */
369 ChildList_t::iterator maIter
;
371 /** our first, last and only protection from mutli-threads! */
375 TimeContainerEnumeration::TimeContainerEnumeration( const ChildList_t
&rChildren
)
376 : maChildren( rChildren
)
378 maIter
= maChildren
.begin();
381 TimeContainerEnumeration::~TimeContainerEnumeration()
386 sal_Bool SAL_CALL
TimeContainerEnumeration::hasMoreElements() throw (RuntimeException
)
388 Guard
< Mutex
> aGuard( maMutex
);
390 return maIter
!= maChildren
.end();
393 Any SAL_CALL
TimeContainerEnumeration::nextElement()
394 throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
)
396 Guard
< Mutex
> aGuard( maMutex
);
398 if( maIter
== maChildren
.end() )
399 throw NoSuchElementException();
401 return makeAny( (*maIter
++) );
404 // ====================================================================
406 Sequence
< Type
>* AnimationNode::mpTypes
[] = { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
407 Sequence
< sal_Int8
>* AnimationNode::mpId
[] = { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
409 AnimationNode::AnimationNode( sal_Int16 nNodeType
)
410 : maChangeListener(maMutex
),
411 mnNodeType( nNodeType
),
412 mnFill( AnimationFill::DEFAULT
),
413 mnFillDefault( AnimationFill::INHERIT
),
414 mnRestart( AnimationRestart:: DEFAULT
),
415 mnRestartDefault( AnimationRestart:: INHERIT
),
416 mfAcceleration( 0.0 ),
418 mbAutoReverse( sal_False
),
422 mnCalcMode( (nNodeType
== AnimationNodeType::ANIMATEMOTION
) ? AnimationCalcMode::PACED
: AnimationCalcMode::LINEAR
),
423 mnAdditive(AnimationAdditiveMode::REPLACE
),
424 mbAccumulate(sal_False
),
425 mnColorSpace( AnimationColorSpace::RGB
),
426 mbDirection( sal_True
),
427 mnTransformType( AnimationTransformType::TRANSLATE
),
428 mnTransition(TransitionType::BARWIPE
),
429 mnSubtype(TransitionSubType::DEFAULT
),
434 mnIterateType( ::com::sun::star::presentation::ShapeAnimationSubType::AS_WHOLE
),
435 mfIterateInterval(0.0)
437 OSL_ENSURE((sal_uInt32
)nNodeType
< sizeof(mpTypes
)/sizeof(Sequence
<Type
>*), "NodeType out of range");
440 AnimationNode::AnimationNode( const AnimationNode
& rNode
)
441 : AnimationNodeBase(),
442 maChangeListener(maMutex
),
443 mnNodeType( rNode
.mnNodeType
),
445 // attributes for the XAnimationNode interface implementation
446 maBegin( rNode
.maBegin
),
447 maDuration( rNode
.maDuration
),
448 maEnd( rNode
.maEnd
),
449 maEndSync( rNode
.maEndSync
),
450 maRepeatCount( rNode
.maRepeatCount
),
451 maRepeatDuration( rNode
.maRepeatDuration
),
452 mnFill( rNode
.mnFill
),
453 mnFillDefault( rNode
.mnFillDefault
),
454 mnRestart( rNode
.mnRestart
),
455 mnRestartDefault( rNode
.mnRestartDefault
),
456 mfAcceleration( rNode
.mfAcceleration
),
457 mfDecelerate( rNode
.mfDecelerate
),
458 mbAutoReverse( rNode
.mbAutoReverse
),
459 maUserData( rNode
.maUserData
),
462 // attributes for XAnimate
463 maTarget( rNode
.maTarget
),
464 maAttributeName( rNode
.maAttributeName
),
465 maFormula( rNode
.maFormula
),
466 maValues( rNode
.maValues
),
467 maKeyTimes( rNode
.maKeyTimes
),
468 mnValueType( rNode
.mnValueType
),
469 mnSubItem( rNode
.mnSubItem
),
470 mnCalcMode( rNode
.mnCalcMode
),
471 mnAdditive( rNode
.mnAdditive
),
472 mbAccumulate( rNode
.mbAccumulate
),
473 maFrom( rNode
.maFrom
),
476 maTimeFilter( rNode
.maTimeFilter
),
478 // attributes for XAnimateColor
479 mnColorSpace( rNode
.mnColorSpace
),
480 mbDirection( rNode
.mbDirection
),
482 // atributes for XAnimateMotion
483 maPath( rNode
.maPath
),
484 maOrigin( rNode
.maOrigin
),
486 // attributes for XAnimateTransform
487 mnTransformType( rNode
.mnTransformType
),
489 // attributes for XTransitionFilter
490 mnTransition( rNode
.mnTransition
),
491 mnSubtype( rNode
.mnSubtype
),
492 mbMode( rNode
.mbMode
),
493 mnFadeColor( rNode
.mnFadeColor
),
496 mfVolume( rNode
.mfVolume
),
499 mnCommand( rNode
.mnCommand
),
500 maParameter( rNode
.maParameter
),
503 mnIterateType( rNode
.mnIterateType
),
504 mfIterateInterval( rNode
.mfIterateInterval
)
508 AnimationNode::~AnimationNode()
512 // --------------------------------------------------------------------
514 #define IMPL_NODE_FACTORY(N,IN,SN)\
515 Reference< XInterface > SAL_CALL createInstance_##N( const Reference< XComponentContext > & ) throw (Exception)\
517 return Reference < XInterface > ( (static_cast< ::cppu::OWeakObject * >(new AnimationNode( N )) ) );\
519 OUString getImplementationName_##N()\
521 return OUString( IN );\
523 Sequence<OUString> getSupportedServiceNames_##N(void)\
525 Sequence<OUString> aRet(1);\
526 aRet.getArray()[0] = SN;\
530 IMPL_NODE_FACTORY( PAR
, "animcore::ParallelTimeContainer", "com.sun.star.animations.ParallelTimeContainer" )
531 IMPL_NODE_FACTORY( SEQ
, "animcore::SequenceTimeContainer", "com.sun.star.animations.SequenceTimeContainer" )
532 IMPL_NODE_FACTORY( ITERATE
, "animcore::IterateContainer", "com.sun.star.animations.IterateContainer" )
533 IMPL_NODE_FACTORY( ANIMATE
, "animcore::Animate", "com.sun.star.animations.Animate" )
534 IMPL_NODE_FACTORY( SET
, "animcore::AnimateSet", "com.sun.star.animations.AnimateSet" )
535 IMPL_NODE_FACTORY( ANIMATECOLOR
, "animcore::AnimateColor", "com.sun.star.animations.AnimateColor" )
536 IMPL_NODE_FACTORY( ANIMATEMOTION
, "animcore::AnimateMotion", "com.sun.star.animations.AnimateMotion" )
537 IMPL_NODE_FACTORY( ANIMATETRANSFORM
, "animcore::AnimateTransform", "com.sun.star.animations.AnimateTransform" )
538 IMPL_NODE_FACTORY( TRANSITIONFILTER
, "animcore::TransitionFilter", "com.sun.star.animations.TransitionFilter" )
539 IMPL_NODE_FACTORY( AUDIO
, "animcore::Audio", "com.sun.star.animations.Audio" );
540 IMPL_NODE_FACTORY( COMMAND
, "animcore::Command", "com.sun.star.animations.Command" );
542 // --------------------------------------------------------------------
545 Any SAL_CALL
AnimationNode::queryInterface( const Type
& aType
) throw (RuntimeException
)
547 Any
aRet( ::cppu::queryInterface(
549 static_cast< XServiceInfo
* >( this ),
550 static_cast< XTypeProvider
* >( this ),
551 static_cast< XChild
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
552 static_cast< XCloneable
* >( this ),
553 static_cast< XAnimationNode
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
554 static_cast< XInterface
* >(static_cast< OWeakObject
* >(this)),
555 static_cast< XWeak
* >(static_cast< OWeakObject
* >(this)),
556 static_cast< XChangesNotifier
* >( this ),
557 static_cast< XUnoTunnel
* >( this ) ) );
563 case AnimationNodeType::PAR
:
564 aRet
= ::cppu::queryInterface(
566 static_cast< XParallelTimeContainer
* >( this ),
567 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
568 static_cast< XEnumerationAccess
* >( this ),
569 static_cast< XElementAccess
* >( this ) );
571 case AnimationNodeType::SEQ
:
572 aRet
= ::cppu::queryInterface(
574 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
575 static_cast< XEnumerationAccess
* >( this ),
576 static_cast< XElementAccess
* >( this ) );
578 case AnimationNodeType::ITERATE
:
579 aRet
= ::cppu::queryInterface(
581 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
582 static_cast< XIterateContainer
* >( this ),
583 static_cast< XEnumerationAccess
* >( this ),
584 static_cast< XElementAccess
* >( this ) );
586 case AnimationNodeType::ANIMATE
:
587 aRet
= ::cppu::queryInterface(
589 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ) );
591 case AnimationNodeType::ANIMATEMOTION
:
592 aRet
= ::cppu::queryInterface(
594 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ),
595 static_cast< XAnimateMotion
* >( this ) );
597 case AnimationNodeType::ANIMATECOLOR
:
598 aRet
= ::cppu::queryInterface(
600 static_cast< XAnimate
* >( static_cast< XAnimateColor
* >(this) ),
601 static_cast< XAnimateColor
* >( this ) );
603 case AnimationNodeType::SET
:
604 aRet
= ::cppu::queryInterface(
606 static_cast< XAnimate
* >( static_cast< XAnimateSet
* >(this) ),
607 static_cast< XAnimateSet
* >( this ) );
609 case AnimationNodeType::ANIMATETRANSFORM
:
610 aRet
= ::cppu::queryInterface(
612 static_cast< XAnimate
* >( static_cast< XAnimateTransform
* >(this) ),
613 static_cast< XAnimateTransform
* >( this ) );
615 case AnimationNodeType::AUDIO
:
616 aRet
= ::cppu::queryInterface(
618 static_cast< XAudio
* >( static_cast< XAudio
* >(this) ) );
620 case AnimationNodeType::COMMAND
:
621 aRet
= ::cppu::queryInterface(
623 static_cast< XCommand
* >( static_cast< XCommand
* >(this) ) );
625 case AnimationNodeType::TRANSITIONFILTER
:
626 aRet
= ::cppu::queryInterface(
628 static_cast< XAnimate
* >( static_cast< XTransitionFilter
* >(this) ),
629 static_cast< XTransitionFilter
* >( this ) );
634 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( aType
);
637 // --------------------------------------------------------------------
639 void AnimationNode::initTypeProvider( sal_Int16 nNodeType
) throw()
641 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
643 if(! mpTypes
[nNodeType
] )
646 mpId
[nNodeType
] = new Sequence
< sal_Int8
>( 16 );
647 rtl_createUuid( (sal_uInt8
*)mpId
[nNodeType
]->getArray(), 0, sal_True
);
649 static sal_Int32 type_numbers
[] =
659 8, // ANIMATETRANSFORM
660 8, // TRANSITIONFILTER
666 Sequence
< Type
> * types
= new Sequence
< Type
>( type_numbers
[nNodeType
] );
667 Type
* pTypeAr
= types
->getArray();
670 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XWeak
> *)0 );
671 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XChild
> *)0 );
672 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XCloneable
> *)0 );
673 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTypeProvider
> *)0 );
674 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XServiceInfo
> *)0 );
675 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XUnoTunnel
> *)0 );
676 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XChangesNotifier
> *)0 );
680 case AnimationNodeType::PAR
:
681 case AnimationNodeType::SEQ
:
682 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTimeContainer
> *)0 );
683 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XEnumerationAccess
> *)0 );
685 case AnimationNodeType::ITERATE
:
686 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XIterateContainer
> *)0 );
687 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XEnumerationAccess
> *)0 );
689 case AnimationNodeType::ANIMATE
:
690 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimate
> *)0 );
692 case AnimationNodeType::ANIMATEMOTION
:
693 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateMotion
> *)0 );
695 case AnimationNodeType::ANIMATECOLOR
:
696 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateColor
> *)0 );
698 case AnimationNodeType::ANIMATETRANSFORM
:
699 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateTransform
> *)0 );
701 case AnimationNodeType::SET
:
702 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateSet
> *)0 );
704 case AnimationNodeType::TRANSITIONFILTER
:
705 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTransitionFilter
> *)0 );
707 case AnimationNodeType::AUDIO
:
708 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAudio
> *)0 );
710 case AnimationNodeType::COMMAND
:
711 pTypeAr
[nPos
++] = ::getCppuType( ( const Reference
< XCommand
> *)0 );
714 mpTypes
[nNodeType
] = types
;
718 // --------------------------------------------------------------------
720 Sequence
< Type
> AnimationNode::getTypes() throw (RuntimeException
)
722 if (! mpTypes
[mnNodeType
])
723 initTypeProvider(mnNodeType
);
724 return *mpTypes
[mnNodeType
];
726 // --------------------------------------------------------------------
728 Sequence
< sal_Int8
> AnimationNode::getImplementationId() throw (RuntimeException
)
730 if (! mpId
[mnNodeType
])
731 initTypeProvider(mnNodeType
);
732 return *mpId
[mnNodeType
];
735 // --------------------------------------------------------------------
738 void SAL_CALL
AnimationNode::acquire( ) throw ()
740 OWeakObject::acquire();
743 // --------------------------------------------------------------------
746 void SAL_CALL
AnimationNode::release( ) throw ()
748 OWeakObject::release();
751 // --------------------------------------------------------------------
754 OUString
AnimationNode::getImplementationName() throw()
758 case AnimationNodeType::PAR
:
759 return getImplementationName_PAR();
760 case AnimationNodeType::SEQ
:
761 return getImplementationName_SEQ();
762 case AnimationNodeType::ITERATE
:
763 return getImplementationName_ITERATE();
764 case AnimationNodeType::SET
:
765 return getImplementationName_SET();
766 case AnimationNodeType::ANIMATECOLOR
:
767 return getImplementationName_ANIMATECOLOR();
768 case AnimationNodeType::ANIMATEMOTION
:
769 return getImplementationName_ANIMATEMOTION();
770 case AnimationNodeType::TRANSITIONFILTER
:
771 return getImplementationName_TRANSITIONFILTER();
772 case AnimationNodeType::ANIMATETRANSFORM
:
773 return getImplementationName_ANIMATETRANSFORM();
774 case AnimationNodeType::AUDIO
:
775 return getImplementationName_AUDIO();
776 case AnimationNodeType::COMMAND
:
777 return getImplementationName_COMMAND();
778 case AnimationNodeType::ANIMATE
:
780 return getImplementationName_ANIMATE();
784 // --------------------------------------------------------------------
787 sal_Bool
AnimationNode::supportsService(const OUString
& ServiceName
) throw()
789 Sequence
< OUString
> aSNL( getSupportedServiceNames() );
790 const OUString
* pArray
= aSNL
.getConstArray();
792 for( sal_Int32 i
= 0; i
< aSNL
.getLength(); i
++ )
793 if( pArray
[i
] == ServiceName
)
799 // --------------------------------------------------------------------
802 Sequence
< OUString
> AnimationNode::getSupportedServiceNames(void) throw()
806 case AnimationNodeType::PAR
:
807 return getSupportedServiceNames_PAR();
808 case AnimationNodeType::SEQ
:
809 return getSupportedServiceNames_SEQ();
810 case AnimationNodeType::ITERATE
:
811 return getSupportedServiceNames_ITERATE();
812 case AnimationNodeType::SET
:
813 return getSupportedServiceNames_SET();
814 case AnimationNodeType::ANIMATECOLOR
:
815 return getSupportedServiceNames_ANIMATECOLOR();
816 case AnimationNodeType::ANIMATEMOTION
:
817 return getSupportedServiceNames_ANIMATEMOTION();
818 case AnimationNodeType::TRANSITIONFILTER
:
819 return getSupportedServiceNames_TRANSITIONFILTER();
820 case AnimationNodeType::AUDIO
:
821 return getSupportedServiceNames_AUDIO();
822 case AnimationNodeType::COMMAND
:
823 return getSupportedServiceNames_COMMAND();
824 case AnimationNodeType::ANIMATE
:
826 return getSupportedServiceNames_ANIMATE();
830 // --------------------------------------------------------------------
833 sal_Int16 SAL_CALL
AnimationNode::getType() throw (RuntimeException
)
835 Guard
< Mutex
> aGuard( maMutex
);
839 // --------------------------------------------------------------------
842 Any SAL_CALL
AnimationNode::getBegin() throw (RuntimeException
)
844 Guard
< Mutex
> aGuard( maMutex
);
848 // --------------------------------------------------------------------
851 void SAL_CALL
AnimationNode::setBegin( const Any
& _begin
) throw (RuntimeException
)
853 Guard
< Mutex
> aGuard( maMutex
);
854 if( _begin
!= maBegin
)
857 fireChangeListener();
861 // --------------------------------------------------------------------
864 Any SAL_CALL
AnimationNode::getDuration() throw (RuntimeException
)
866 Guard
< Mutex
> aGuard( maMutex
);
870 // --------------------------------------------------------------------
873 void SAL_CALL
AnimationNode::setDuration( const Any
& _duration
) throw (RuntimeException
)
875 Guard
< Mutex
> aGuard( maMutex
);
876 if( _duration
!= maDuration
)
878 maDuration
= _duration
;
879 fireChangeListener();
883 // --------------------------------------------------------------------
886 Any SAL_CALL
AnimationNode::getEnd() throw (RuntimeException
)
888 Guard
< Mutex
> aGuard( maMutex
);
892 // --------------------------------------------------------------------
895 void SAL_CALL
AnimationNode::setEnd( const Any
& _end
) throw (RuntimeException
)
897 Guard
< Mutex
> aGuard( maMutex
);
901 fireChangeListener();
905 // --------------------------------------------------------------------
908 Any SAL_CALL
AnimationNode::getEndSync() throw (RuntimeException
)
910 Guard
< Mutex
> aGuard( maMutex
);
914 // --------------------------------------------------------------------
917 void SAL_CALL
AnimationNode::setEndSync( const Any
& _endsync
) throw (RuntimeException
)
919 Guard
< Mutex
> aGuard( maMutex
);
920 if( _endsync
!= maEndSync
)
922 maEndSync
= _endsync
;
923 fireChangeListener();
927 // --------------------------------------------------------------------
930 Any SAL_CALL
AnimationNode::getRepeatCount() throw (RuntimeException
)
932 Guard
< Mutex
> aGuard( maMutex
);
933 return maRepeatCount
;
936 // --------------------------------------------------------------------
939 void SAL_CALL
AnimationNode::setRepeatCount( const Any
& _repeatcount
) throw (RuntimeException
)
941 Guard
< Mutex
> aGuard( maMutex
);
942 if( _repeatcount
!= maRepeatCount
)
944 maRepeatCount
= _repeatcount
;
945 fireChangeListener();
949 // --------------------------------------------------------------------
952 Any SAL_CALL
AnimationNode::getRepeatDuration() throw (RuntimeException
)
954 Guard
< Mutex
> aGuard( maMutex
);
955 return maRepeatDuration
;
958 // --------------------------------------------------------------------
961 void SAL_CALL
AnimationNode::setRepeatDuration( const Any
& _repeatduration
) throw (RuntimeException
)
963 Guard
< Mutex
> aGuard( maMutex
);
964 if( _repeatduration
!= maRepeatDuration
)
966 maRepeatDuration
= _repeatduration
;
967 fireChangeListener();
971 // --------------------------------------------------------------------
974 sal_Int16 SAL_CALL
AnimationNode::getFill() throw (RuntimeException
)
976 Guard
< Mutex
> aGuard( maMutex
);
980 // --------------------------------------------------------------------
983 void SAL_CALL
AnimationNode::setFill( sal_Int16 _fill
) throw (RuntimeException
)
985 Guard
< Mutex
> aGuard( maMutex
);
986 if( _fill
!= mnFill
)
989 fireChangeListener();
993 // --------------------------------------------------------------------
996 sal_Int16 SAL_CALL
AnimationNode::getFillDefault() throw (RuntimeException
)
998 Guard
< Mutex
> aGuard( maMutex
);
999 return mnFillDefault
;
1002 // --------------------------------------------------------------------
1005 void SAL_CALL
AnimationNode::setFillDefault( sal_Int16 _filldefault
) throw (RuntimeException
)
1007 Guard
< Mutex
> aGuard( maMutex
);
1008 if( _filldefault
!= mnFillDefault
)
1010 mnFillDefault
= _filldefault
;
1011 fireChangeListener();
1015 // --------------------------------------------------------------------
1018 sal_Int16 SAL_CALL
AnimationNode::getRestart() throw (RuntimeException
)
1020 Guard
< Mutex
> aGuard( maMutex
);
1024 // --------------------------------------------------------------------
1027 void SAL_CALL
AnimationNode::setRestart( sal_Int16 _restart
) throw (RuntimeException
)
1029 Guard
< Mutex
> aGuard( maMutex
);
1030 if( _restart
!= mnRestart
)
1032 mnRestart
= _restart
;
1033 fireChangeListener();
1037 // --------------------------------------------------------------------
1040 sal_Int16 SAL_CALL
AnimationNode::getRestartDefault() throw (RuntimeException
)
1042 Guard
< Mutex
> aGuard( maMutex
);
1043 return mnRestartDefault
;
1046 // --------------------------------------------------------------------
1049 void SAL_CALL
AnimationNode::setRestartDefault( sal_Int16 _restartdefault
) throw (RuntimeException
)
1051 Guard
< Mutex
> aGuard( maMutex
);
1052 if( _restartdefault
!= mnRestartDefault
)
1054 mnRestartDefault
= _restartdefault
;
1055 fireChangeListener();
1059 // --------------------------------------------------------------------
1062 double SAL_CALL
AnimationNode::getAcceleration() throw (RuntimeException
)
1064 Guard
< Mutex
> aGuard( maMutex
);
1065 return mfAcceleration
;
1068 // --------------------------------------------------------------------
1071 void SAL_CALL
AnimationNode::setAcceleration( double _acceleration
) throw (RuntimeException
)
1073 Guard
< Mutex
> aGuard( maMutex
);
1074 if( _acceleration
!= mfAcceleration
)
1076 mfAcceleration
= _acceleration
;
1077 fireChangeListener();
1081 // --------------------------------------------------------------------
1084 double SAL_CALL
AnimationNode::getDecelerate() throw (RuntimeException
)
1086 Guard
< Mutex
> aGuard( maMutex
);
1087 return mfDecelerate
;
1090 // --------------------------------------------------------------------
1093 void SAL_CALL
AnimationNode::setDecelerate( double _decelerate
) throw (RuntimeException
)
1095 Guard
< Mutex
> aGuard( maMutex
);
1096 if( _decelerate
!= mfDecelerate
)
1098 mfDecelerate
= _decelerate
;
1099 fireChangeListener();
1103 // --------------------------------------------------------------------
1106 sal_Bool SAL_CALL
AnimationNode::getAutoReverse() throw (RuntimeException
)
1108 Guard
< Mutex
> aGuard( maMutex
);
1109 return mbAutoReverse
;
1112 // --------------------------------------------------------------------
1115 void SAL_CALL
AnimationNode::setAutoReverse( sal_Bool _autoreverse
) throw (RuntimeException
)
1117 Guard
< Mutex
> aGuard( maMutex
);
1118 if( _autoreverse
!= mbAutoReverse
)
1120 mbAutoReverse
= _autoreverse
;
1121 fireChangeListener();
1125 // --------------------------------------------------------------------
1127 Sequence
< NamedValue
> SAL_CALL
AnimationNode::getUserData() throw (RuntimeException
)
1129 Guard
< Mutex
> aGuard( maMutex
);
1133 // --------------------------------------------------------------------
1135 void SAL_CALL
AnimationNode::setUserData( const Sequence
< NamedValue
>& _userdata
) throw (RuntimeException
)
1137 Guard
< Mutex
> aGuard( maMutex
);
1138 maUserData
= _userdata
;
1139 fireChangeListener();
1142 // --------------------------------------------------------------------
1145 Reference
< XInterface
> SAL_CALL
AnimationNode::getParent() throw (RuntimeException
)
1147 Guard
< Mutex
> aGuard( maMutex
);
1148 return mxParent
.get();
1151 // --------------------------------------------------------------------
1154 void SAL_CALL
AnimationNode::setParent( const Reference
< XInterface
>& Parent
) throw (NoSupportException
, RuntimeException
)
1156 Guard
< Mutex
> aGuard( maMutex
);
1157 if( Parent
!= mxParent
.get() )
1162 Reference
< XUnoTunnel
> xTunnel( mxParent
.get(), UNO_QUERY
);
1164 mpParent
= reinterpret_cast< AnimationNode
* >( sal::static_int_cast
< sal_IntPtr
>(xTunnel
->getSomething( getUnoTunnelId() )));
1166 fireChangeListener();
1170 // --------------------------------------------------------------------
1173 Reference
< XCloneable
> SAL_CALL
AnimationNode::createClone() throw (RuntimeException
)
1175 Guard
< Mutex
> aGuard( maMutex
);
1177 Reference
< XCloneable
> xNewNode
;
1180 xNewNode
= new AnimationNode( *this );
1182 if( !maChildren
.empty() )
1184 Reference
< XTimeContainer
> xContainer( xNewNode
, UNO_QUERY
);
1185 if( xContainer
.is() )
1187 ChildList_t::iterator
aIter( maChildren
.begin() );
1188 ChildList_t::iterator
aEnd( maChildren
.end() );
1189 while( aIter
!= aEnd
)
1191 Reference
< XCloneable
> xCloneable((*aIter
++), UNO_QUERY
);
1192 if( xCloneable
.is() ) try
1194 Reference
< XAnimationNode
> xNewChildNode( xCloneable
->createClone(), UNO_QUERY
);
1195 if( xNewChildNode
.is() )
1196 xContainer
->appendChild( xNewChildNode
);
1198 catch(const Exception
&)
1200 OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1206 catch(const Exception
&)
1208 OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1214 // --------------------------------------------------------------------
1217 Any SAL_CALL
AnimationNode::getTarget()
1218 throw (RuntimeException
)
1220 Guard
< Mutex
> aGuard( maMutex
);
1224 // --------------------------------------------------------------------
1227 void SAL_CALL
AnimationNode::setTarget( const Any
& _target
)
1228 throw (RuntimeException
)
1230 Guard
< Mutex
> aGuard( maMutex
);
1231 if( _target
!= maTarget
)
1234 fireChangeListener();
1238 // --------------------------------------------------------------------
1241 OUString SAL_CALL
AnimationNode::getAttributeName() throw (RuntimeException
)
1243 Guard
< Mutex
> aGuard( maMutex
);
1244 return maAttributeName
;
1247 // --------------------------------------------------------------------
1250 void SAL_CALL
AnimationNode::setAttributeName( const OUString
& _attribute
)
1251 throw (RuntimeException
)
1253 Guard
< Mutex
> aGuard( maMutex
);
1254 if( _attribute
!= maAttributeName
)
1256 maAttributeName
= _attribute
;
1257 fireChangeListener();
1261 // --------------------------------------------------------------------
1264 Sequence
< Any
> SAL_CALL
AnimationNode::getValues()
1265 throw (RuntimeException
)
1267 Guard
< Mutex
> aGuard( maMutex
);
1271 // --------------------------------------------------------------------
1274 void SAL_CALL
AnimationNode::setValues( const Sequence
< Any
>& _values
)
1275 throw (RuntimeException
)
1277 Guard
< Mutex
> aGuard( maMutex
);
1279 fireChangeListener();
1282 // --------------------------------------------------------------------
1285 sal_Int16 SAL_CALL
AnimationNode::getSubItem() throw (RuntimeException
)
1287 Guard
< Mutex
> aGuard( maMutex
);
1291 // --------------------------------------------------------------------
1294 void SAL_CALL
AnimationNode::setSubItem( sal_Int16 _subitem
) throw (RuntimeException
)
1296 Guard
< Mutex
> aGuard( maMutex
);
1297 if( _subitem
!= mnSubItem
)
1299 mnSubItem
= _subitem
;
1300 fireChangeListener();
1304 // --------------------------------------------------------------------
1307 Sequence
< double > SAL_CALL
AnimationNode::getKeyTimes() throw (RuntimeException
)
1309 Guard
< Mutex
> aGuard( maMutex
);
1313 // --------------------------------------------------------------------
1316 void SAL_CALL
AnimationNode::setKeyTimes( const Sequence
< double >& _keytimes
) throw (RuntimeException
)
1318 Guard
< Mutex
> aGuard( maMutex
);
1319 maKeyTimes
= _keytimes
;
1320 fireChangeListener();
1323 // --------------------------------------------------------------------
1326 sal_Int16 SAL_CALL
AnimationNode::getValueType() throw (RuntimeException
)
1328 Guard
< Mutex
> aGuard( maMutex
);
1332 // --------------------------------------------------------------------
1334 void SAL_CALL
AnimationNode::setValueType( sal_Int16 _valuetype
) throw (RuntimeException
)
1336 Guard
< Mutex
> aGuard( maMutex
);
1337 if( _valuetype
!= mnValueType
)
1339 mnValueType
= _valuetype
;
1340 fireChangeListener();
1344 // --------------------------------------------------------------------
1347 sal_Int16 SAL_CALL
AnimationNode::getCalcMode()
1348 throw (RuntimeException
)
1350 Guard
< Mutex
> aGuard( maMutex
);
1354 // --------------------------------------------------------------------
1357 void SAL_CALL
AnimationNode::setCalcMode( sal_Int16 _calcmode
)
1358 throw (RuntimeException
)
1360 Guard
< Mutex
> aGuard( maMutex
);
1361 if( _calcmode
!= mnCalcMode
)
1363 mnCalcMode
= _calcmode
;
1364 fireChangeListener();
1368 // --------------------------------------------------------------------
1371 sal_Bool SAL_CALL
AnimationNode::getAccumulate()
1372 throw (RuntimeException
)
1374 Guard
< Mutex
> aGuard( maMutex
);
1375 return mbAccumulate
;
1378 // --------------------------------------------------------------------
1381 void SAL_CALL
AnimationNode::setAccumulate( sal_Bool _accumulate
)
1382 throw (RuntimeException
)
1384 Guard
< Mutex
> aGuard( maMutex
);
1385 if( _accumulate
!= mbAccumulate
)
1387 mbAccumulate
= _accumulate
;
1388 fireChangeListener();
1392 // --------------------------------------------------------------------
1395 sal_Int16 SAL_CALL
AnimationNode::getAdditive()
1396 throw (RuntimeException
)
1398 Guard
< Mutex
> aGuard( maMutex
);
1402 // --------------------------------------------------------------------
1405 void SAL_CALL
AnimationNode::setAdditive( sal_Int16 _additive
)
1406 throw (RuntimeException
)
1408 Guard
< Mutex
> aGuard( maMutex
);
1409 if( _additive
!= mnAdditive
)
1411 mnAdditive
= _additive
;
1412 fireChangeListener();
1416 // --------------------------------------------------------------------
1419 Any SAL_CALL
AnimationNode::getFrom()
1420 throw (RuntimeException
)
1422 Guard
< Mutex
> aGuard( maMutex
);
1426 // --------------------------------------------------------------------
1429 void SAL_CALL
AnimationNode::setFrom( const Any
& _from
)
1430 throw (RuntimeException
)
1432 Guard
< Mutex
> aGuard( maMutex
);
1433 if( _from
!= maFrom
)
1436 fireChangeListener();
1440 // --------------------------------------------------------------------
1443 Any SAL_CALL
AnimationNode::getTo()
1444 throw (RuntimeException
)
1446 Guard
< Mutex
> aGuard( maMutex
);
1450 // --------------------------------------------------------------------
1453 void SAL_CALL
AnimationNode::setTo( const Any
& _to
)
1454 throw (RuntimeException
)
1456 Guard
< Mutex
> aGuard( maMutex
);
1460 fireChangeListener();
1464 // --------------------------------------------------------------------
1467 Any SAL_CALL
AnimationNode::getBy()
1468 throw (RuntimeException
)
1470 Guard
< Mutex
> aGuard( maMutex
);
1474 // --------------------------------------------------------------------
1477 void SAL_CALL
AnimationNode::setBy( const Any
& _by
)
1478 throw (RuntimeException
)
1480 Guard
< Mutex
> aGuard( maMutex
);
1484 fireChangeListener();
1488 // --------------------------------------------------------------------
1491 Sequence
< TimeFilterPair
> SAL_CALL
AnimationNode::getTimeFilter()
1492 throw (RuntimeException
)
1494 Guard
< Mutex
> aGuard( maMutex
);
1495 return maTimeFilter
;
1498 // --------------------------------------------------------------------
1501 void SAL_CALL
AnimationNode::setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
)
1502 throw (RuntimeException
)
1504 Guard
< Mutex
> aGuard( maMutex
);
1505 maTimeFilter
= _timefilter
;
1506 fireChangeListener();
1509 // --------------------------------------------------------------------
1511 OUString SAL_CALL
AnimationNode::getFormula() throw (RuntimeException
)
1513 Guard
< Mutex
> aGuard( maMutex
);
1517 // --------------------------------------------------------------------
1519 void SAL_CALL
AnimationNode::setFormula( const OUString
& _formula
) throw (RuntimeException
)
1521 Guard
< Mutex
> aGuard( maMutex
);
1522 if( _formula
!= maFormula
)
1524 maFormula
= _formula
;
1525 fireChangeListener();
1529 // --------------------------------------------------------------------
1532 sal_Int16 SAL_CALL
AnimationNode::getColorInterpolation() throw (RuntimeException
)
1534 Guard
< Mutex
> aGuard( maMutex
);
1535 return mnColorSpace
;
1538 // --------------------------------------------------------------------
1541 void SAL_CALL
AnimationNode::setColorInterpolation( sal_Int16 _colorspace
) throw (RuntimeException
)
1543 Guard
< Mutex
> aGuard( maMutex
);
1544 if( _colorspace
!= mnColorSpace
)
1546 mnColorSpace
= _colorspace
;
1547 fireChangeListener();
1551 // --------------------------------------------------------------------
1554 sal_Bool SAL_CALL
AnimationNode::getDirection() throw (RuntimeException
)
1556 Guard
< Mutex
> aGuard( maMutex
);
1560 // --------------------------------------------------------------------
1563 void SAL_CALL
AnimationNode::setDirection( sal_Bool _direction
) throw (RuntimeException
)
1565 Guard
< Mutex
> aGuard( maMutex
);
1566 if( _direction
!= mbDirection
)
1568 mbDirection
= _direction
;
1569 fireChangeListener();
1573 // --------------------------------------------------------------------
1576 Any SAL_CALL
AnimationNode::getPath() throw (RuntimeException
)
1578 Guard
< Mutex
> aGuard( maMutex
);
1582 // --------------------------------------------------------------------
1585 void SAL_CALL
AnimationNode::setPath( const Any
& _path
) throw (RuntimeException
)
1587 Guard
< Mutex
> aGuard( maMutex
);
1589 fireChangeListener();
1592 // --------------------------------------------------------------------
1595 Any SAL_CALL
AnimationNode::getOrigin() throw (RuntimeException
)
1597 Guard
< Mutex
> aGuard( maMutex
);
1601 // --------------------------------------------------------------------
1604 void SAL_CALL
AnimationNode::setOrigin( const Any
& _origin
) throw (RuntimeException
)
1606 Guard
< Mutex
> aGuard( maMutex
);
1608 fireChangeListener();
1611 // --------------------------------------------------------------------
1613 // XAnimateTransform
1614 sal_Int16 SAL_CALL
AnimationNode::getTransformType() throw (RuntimeException
)
1616 Guard
< Mutex
> aGuard( maMutex
);
1617 return mnTransformType
;
1620 // --------------------------------------------------------------------
1622 // XAnimateTransform
1623 void SAL_CALL
AnimationNode::setTransformType( sal_Int16 _transformtype
) throw (RuntimeException
)
1625 Guard
< Mutex
> aGuard( maMutex
);
1626 if( _transformtype
!= mnTransformType
)
1628 mnTransformType
= _transformtype
;
1629 fireChangeListener();
1633 // --------------------------------------------------------------------
1635 // XTransitionFilter
1636 sal_Int16 SAL_CALL
AnimationNode::getTransition() throw (RuntimeException
)
1638 Guard
< Mutex
> aGuard( maMutex
);
1639 return mnTransition
;
1642 // --------------------------------------------------------------------
1644 // XTransitionFilter
1645 void SAL_CALL
AnimationNode::setTransition( sal_Int16 _transition
) throw (RuntimeException
)
1647 Guard
< Mutex
> aGuard( maMutex
);
1648 if( _transition
!= mnTransition
)
1650 mnTransition
= _transition
;
1651 fireChangeListener();
1655 // --------------------------------------------------------------------
1657 // XTransitionFilter
1658 sal_Int16 SAL_CALL
AnimationNode::getSubtype() throw (RuntimeException
)
1660 Guard
< Mutex
> aGuard( maMutex
);
1664 // --------------------------------------------------------------------
1666 // XTransitionFilter
1667 void SAL_CALL
AnimationNode::setSubtype( sal_Int16 _subtype
) throw (RuntimeException
)
1669 Guard
< Mutex
> aGuard( maMutex
);
1670 if( _subtype
!= mnSubtype
)
1672 mnSubtype
= _subtype
;
1673 fireChangeListener();
1677 // --------------------------------------------------------------------
1679 // XTransitionFilter
1680 sal_Bool SAL_CALL
AnimationNode::getMode() throw (RuntimeException
)
1682 Guard
< Mutex
> aGuard( maMutex
);
1686 // --------------------------------------------------------------------
1688 // XTransitionFilter
1689 void SAL_CALL
AnimationNode::setMode( sal_Bool _mode
) throw (RuntimeException
)
1691 Guard
< Mutex
> aGuard( maMutex
);
1692 if( _mode
!= mbMode
)
1695 fireChangeListener();
1699 // --------------------------------------------------------------------
1701 // XTransitionFilter
1702 sal_Int32 SAL_CALL
AnimationNode::getFadeColor() throw (RuntimeException
)
1704 Guard
< Mutex
> aGuard( maMutex
);
1708 // --------------------------------------------------------------------
1710 // XTransitionFilter
1711 void SAL_CALL
AnimationNode::setFadeColor( sal_Int32 _fadecolor
) throw (RuntimeException
)
1713 Guard
< Mutex
> aGuard( maMutex
);
1714 if( _fadecolor
!= mnFadeColor
)
1716 mnFadeColor
= _fadecolor
;
1717 fireChangeListener();
1721 // --------------------------------------------------------------------
1724 Any SAL_CALL
AnimationNode::getSource() throw (RuntimeException
)
1726 Guard
< Mutex
> aGuard( maMutex
);
1730 // --------------------------------------------------------------------
1733 void SAL_CALL
AnimationNode::setSource( const Any
& _source
) throw (RuntimeException
)
1735 Guard
< Mutex
> aGuard( maMutex
);
1737 fireChangeListener();
1740 // --------------------------------------------------------------------
1743 double SAL_CALL
AnimationNode::getVolume() throw (RuntimeException
)
1745 Guard
< Mutex
> aGuard( maMutex
);
1749 // --------------------------------------------------------------------
1752 void SAL_CALL
AnimationNode::setVolume( double _volume
) throw (RuntimeException
)
1754 Guard
< Mutex
> aGuard( maMutex
);
1755 if( _volume
!= mfVolume
)
1758 fireChangeListener();
1762 // --------------------------------------------------------------------
1765 sal_Int16 SAL_CALL
AnimationNode::getCommand() throw (RuntimeException
)
1767 Guard
< Mutex
> aGuard( maMutex
);
1771 // --------------------------------------------------------------------
1774 void SAL_CALL
AnimationNode::setCommand( sal_Int16 _command
) throw (RuntimeException
)
1776 Guard
< Mutex
> aGuard( maMutex
);
1777 if( _command
!= mnCommand
)
1779 mnCommand
= _command
;
1780 fireChangeListener();
1784 // --------------------------------------------------------------------
1787 Any SAL_CALL
AnimationNode::getParameter() throw (RuntimeException
)
1789 Guard
< Mutex
> aGuard( maMutex
);
1793 // --------------------------------------------------------------------
1796 void SAL_CALL
AnimationNode::setParameter( const Any
& _parameter
) throw (RuntimeException
)
1798 Guard
< Mutex
> aGuard( maMutex
);
1799 maParameter
= _parameter
;
1800 fireChangeListener();
1803 // --------------------------------------------------------------------
1806 Type SAL_CALL
AnimationNode::getElementType() throw (RuntimeException
)
1808 return ::getCppuType((const Reference
< XAnimationNode
>*)0);
1811 // --------------------------------------------------------------------
1814 sal_Bool SAL_CALL
AnimationNode::hasElements() throw (RuntimeException
)
1816 Guard
< Mutex
> aGuard( maMutex
);
1817 return !maChildren
.empty();
1820 // --------------------------------------------------------------------
1822 // XEnumerationAccess
1823 Reference
< XEnumeration
> SAL_CALL
AnimationNode::createEnumeration()
1824 throw (RuntimeException
)
1826 Guard
< Mutex
> aGuard( maMutex
);
1828 return new TimeContainerEnumeration( maChildren
);
1831 // --------------------------------------------------------------------
1835 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1836 throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1838 Guard
< Mutex
> aGuard( maMutex
);
1840 if( !newChild
.is() || !refChild
.is() )
1841 throw IllegalArgumentException();
1843 ChildList_t::iterator before
= ::std::find(maChildren
.begin(), maChildren
.end(), refChild
);
1844 if( before
== maChildren
.end() )
1845 throw NoSuchElementException();
1847 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1848 throw ElementExistException();
1850 maChildren
.insert( before
, newChild
);
1852 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1853 newChild
->setParent( xThis
);
1858 // --------------------------------------------------------------------
1861 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1862 throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1864 Guard
< Mutex
> aGuard( maMutex
);
1866 if( !newChild
.is() || !refChild
.is() )
1867 throw IllegalArgumentException();
1869 ChildList_t::iterator before
= ::std::find(maChildren
.begin(), maChildren
.end(), refChild
);
1870 if( before
== maChildren
.end() )
1871 throw NoSuchElementException();
1873 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1874 throw ElementExistException();
1877 if( before
!= maChildren
.end() )
1878 maChildren
.insert( before
, newChild
);
1880 maChildren
.push_back( newChild
);
1882 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1883 newChild
->setParent( xThis
);
1888 // --------------------------------------------------------------------
1891 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
)
1892 throw( IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1894 Guard
< Mutex
> aGuard( maMutex
);
1896 if( !newChild
.is() || !oldChild
.is() )
1897 throw IllegalArgumentException();
1899 ChildList_t::iterator replace
= ::std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1900 if( replace
== maChildren
.end() )
1901 throw NoSuchElementException();
1903 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1904 throw ElementExistException();
1906 Reference
< XInterface
> xNull( 0 );
1907 oldChild
->setParent( xNull
);
1909 (*replace
) = newChild
;
1911 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1912 newChild
->setParent( xThis
);
1917 // --------------------------------------------------------------------
1920 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::removeChild( const Reference
< XAnimationNode
>& oldChild
)
1921 throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
)
1923 Guard
< Mutex
> aGuard( maMutex
);
1925 if( !oldChild
.is() )
1926 throw IllegalArgumentException();
1928 ChildList_t::iterator old
= ::std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1929 if( old
== maChildren
.end() )
1930 throw NoSuchElementException();
1932 Reference
< XInterface
> xNull( 0 );
1933 oldChild
->setParent( xNull
);
1935 maChildren
.erase( old
);
1940 // --------------------------------------------------------------------
1943 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::appendChild( const Reference
< XAnimationNode
>& newChild
)
1944 throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1946 Guard
< Mutex
> aGuard( maMutex
);
1948 if( !newChild
.is() )
1949 throw IllegalArgumentException();
1951 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1952 throw ElementExistException();
1954 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1955 Reference
< XInterface
> xChild( newChild
);
1957 if( xThis
== xChild
)
1958 throw IllegalArgumentException();
1960 maChildren
.push_back( newChild
);
1962 newChild
->setParent( xThis
);
1967 // --------------------------------------------------------------------
1969 // XIterateContainer
1970 sal_Int16 SAL_CALL
AnimationNode::getIterateType() throw (RuntimeException
)
1972 Guard
< Mutex
> aGuard( maMutex
);
1973 return mnIterateType
;
1976 // --------------------------------------------------------------------
1978 // XIterateContainer
1979 void SAL_CALL
AnimationNode::setIterateType( sal_Int16 _iteratetype
) throw (RuntimeException
)
1981 Guard
< Mutex
> aGuard( maMutex
);
1982 if( _iteratetype
!= mnIterateType
)
1984 mnIterateType
= _iteratetype
;
1985 fireChangeListener();
1989 // --------------------------------------------------------------------
1991 // XIterateContainer
1992 double SAL_CALL
AnimationNode::getIterateInterval() throw (RuntimeException
)
1994 Guard
< Mutex
> aGuard( maMutex
);
1995 return mfIterateInterval
;
1998 // --------------------------------------------------------------------
2000 // XIterateContainer
2001 void SAL_CALL
AnimationNode::setIterateInterval( double _iterateinterval
) throw (RuntimeException
)
2003 Guard
< Mutex
> aGuard( maMutex
);
2004 if( _iterateinterval
!= mfIterateInterval
)
2006 mfIterateInterval
= _iterateinterval
;
2007 fireChangeListener();
2011 // --------------------------------------------------------------------
2014 void SAL_CALL
AnimationNode::addChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
)
2016 maChangeListener
.addInterface( aListener
);
2019 // --------------------------------------------------------------------
2022 void SAL_CALL
AnimationNode::removeChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
)
2024 maChangeListener
.removeInterface(aListener
);
2027 // --------------------------------------------------------------------
2030 ::sal_Int64 SAL_CALL
AnimationNode::getSomething( const Sequence
< ::sal_Int8
>& rId
) throw (RuntimeException
)
2032 if( rId
.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId
.getConstArray(), 16 ) )
2034 return sal::static_int_cast
< sal_Int64
>(reinterpret_cast< sal_IntPtr
>(this));
2045 class theAnimationNodeUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theAnimationNodeUnoTunnelId
> {};
2048 const ::com::sun::star::uno::Sequence
< sal_Int8
> & AnimationNode::getUnoTunnelId()
2050 return theAnimationNodeUnoTunnelId::get().getSeq();
2053 // --------------------------------------------------------------------
2055 void AnimationNode::fireChangeListener()
2057 Guard
< Mutex
> aGuard( maMutex
);
2059 OInterfaceIteratorHelper
aIterator( maChangeListener
);
2060 if( aIterator
.hasMoreElements() )
2062 Reference
< XInterface
> xSource( static_cast<OWeakObject
*>(this), UNO_QUERY
);
2063 Sequence
< ElementChange
> aChanges
;
2064 const ChangesEvent
aEvent( xSource
, makeAny( mxParent
.get() ), aChanges
);
2065 while( aIterator
.hasMoreElements() )
2067 Reference
< XChangesListener
> xListener( aIterator
.next(), UNO_QUERY
);
2068 if( xListener
.is() )
2069 xListener
->changesOccurred( aEvent
);
2073 //fdo#69645 use get() on WeakReference of mxParent to test if mpParent is still valid
2074 if( mpParent
&& mxParent
.get().is() )
2075 mpParent
->fireChangeListener();
2078 // --------------------------------------------------------------------
2080 } // namespace animcore
2082 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */