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/supportsservice.hxx>
51 #include <cppuhelper/weakref.hxx>
53 #include <cppuhelper/implbase1.hxx>
56 #include <osl/mutex.hxx>
63 using ::cppu::OInterfaceContainerHelper
;
64 using ::cppu::OInterfaceIteratorHelper
;
65 using ::com::sun::star::uno::Any
;
66 using ::com::sun::star::uno::UNO_QUERY
;
67 using ::com::sun::star::uno::XInterface
;
68 using ::com::sun::star::uno::RuntimeException
;
69 using ::com::sun::star::uno::Sequence
;
70 using ::com::sun::star::uno::Reference
;
71 using ::com::sun::star::uno::WeakReference
;
72 using ::com::sun::star::uno::XComponentContext
;
73 using ::com::sun::star::uno::Exception
;
74 using ::com::sun::star::uno::XWeak
;
75 using ::com::sun::star::uno::Type
;
76 using ::com::sun::star::uno::makeAny
;
77 using ::com::sun::star::lang::NoSupportException
;
78 using ::com::sun::star::lang::IllegalArgumentException
;
79 using ::com::sun::star::lang::WrappedTargetException
;
80 using ::com::sun::star::lang::XServiceInfo
;
81 using ::com::sun::star::lang::XTypeProvider
;
82 using ::com::sun::star::container::NoSuchElementException
;
83 using ::com::sun::star::container::ElementExistException
;
84 using ::com::sun::star::container::XEnumeration
;
85 using ::com::sun::star::container::XEnumerationAccess
;
86 using ::com::sun::star::beans::NamedValue
;
87 using ::com::sun::star::util::XCloneable
;
88 using ::com::sun::star::lang::XUnoTunnel
;
89 using ::com::sun::star::util::XChangesNotifier
;
90 using ::com::sun::star::util::XChangesListener
;
91 using ::com::sun::star::util::ElementChange
;
92 using ::com::sun::star::util::ChangesEvent
;
94 using ::cppu::OWeakObject
;
96 using namespace ::com::sun::star::animations
;
97 using namespace ::com::sun::star::animations::AnimationNodeType
;
102 // ====================================================================
104 typedef ::std::list
< Reference
< XAnimationNode
> > ChildList_t
;
106 // ====================================================================
108 class AnimationNodeBase
: public XAnimateMotion
,
109 public XAnimateColor
,
110 public XTransitionFilter
,
112 public XAnimateTransform
,
113 public XParallelTimeContainer
,
114 public XIterateContainer
,
116 public XTypeProvider
,
120 public XChangesNotifier
,
125 // our first, last and only protection from mutli-threads!
129 class AnimationNode
: public AnimationNodeBase
132 AnimationNode( sal_Int16 nNodeType
);
133 AnimationNode( const AnimationNode
& rNode
);
134 virtual ~AnimationNode();
137 virtual Any SAL_CALL
queryInterface( const Type
& aType
) throw (RuntimeException
);
138 virtual void SAL_CALL
acquire() throw ();
139 virtual void SAL_CALL
release() throw ();
142 virtual Sequence
< Type
> SAL_CALL
getTypes() throw (RuntimeException
);
143 virtual Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (RuntimeException
);
146 OUString SAL_CALL
getImplementationName() throw();
147 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw();
148 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw();
151 virtual Reference
< XInterface
> SAL_CALL
getParent() throw (RuntimeException
);
152 virtual void SAL_CALL
setParent( const Reference
< XInterface
>& Parent
) throw (NoSupportException
, RuntimeException
);
155 virtual Reference
< XCloneable
> SAL_CALL
createClone() throw (RuntimeException
);
158 virtual sal_Int16 SAL_CALL
getType() throw (RuntimeException
);
159 virtual Any SAL_CALL
getBegin() throw (RuntimeException
);
160 virtual void SAL_CALL
setBegin( const Any
& _begin
) throw (RuntimeException
);
161 virtual Any SAL_CALL
getDuration() throw (RuntimeException
);
162 virtual void SAL_CALL
setDuration( const Any
& _duration
) throw (RuntimeException
);
163 virtual Any SAL_CALL
getEnd() throw (RuntimeException
);
164 virtual void SAL_CALL
setEnd( const Any
& _end
) throw (RuntimeException
);
165 virtual Any SAL_CALL
getEndSync() throw (RuntimeException
);
166 virtual void SAL_CALL
setEndSync( const Any
& _endsync
) throw (RuntimeException
);
167 virtual Any SAL_CALL
getRepeatCount() throw (RuntimeException
);
168 virtual void SAL_CALL
setRepeatCount( const Any
& _repeatcount
) throw (RuntimeException
);
169 virtual Any SAL_CALL
getRepeatDuration() throw (RuntimeException
);
170 virtual void SAL_CALL
setRepeatDuration( const Any
& _repeatduration
) throw (RuntimeException
);
171 virtual sal_Int16 SAL_CALL
getFill() throw (RuntimeException
);
172 virtual void SAL_CALL
setFill( sal_Int16 _fill
) throw (RuntimeException
);
173 virtual sal_Int16 SAL_CALL
getFillDefault() throw (RuntimeException
);
174 virtual void SAL_CALL
setFillDefault( sal_Int16 _filldefault
) throw (RuntimeException
);
175 virtual sal_Int16 SAL_CALL
getRestart() throw (RuntimeException
);
176 virtual void SAL_CALL
setRestart( sal_Int16 _restart
) throw (RuntimeException
);
177 virtual sal_Int16 SAL_CALL
getRestartDefault() throw (RuntimeException
);
178 virtual void SAL_CALL
setRestartDefault( sal_Int16 _restartdefault
) throw (RuntimeException
);
179 virtual double SAL_CALL
getAcceleration() throw (RuntimeException
);
180 virtual void SAL_CALL
setAcceleration( double _acceleration
) throw (RuntimeException
);
181 virtual double SAL_CALL
getDecelerate() throw (RuntimeException
);
182 virtual void SAL_CALL
setDecelerate( double _decelerate
) throw (RuntimeException
);
183 virtual sal_Bool SAL_CALL
getAutoReverse() throw (RuntimeException
);
184 virtual void SAL_CALL
setAutoReverse( sal_Bool _autoreverse
) throw (RuntimeException
);
185 virtual Sequence
< NamedValue
> SAL_CALL
getUserData() throw (RuntimeException
);
186 virtual void SAL_CALL
setUserData( const Sequence
< NamedValue
>& _userdata
) throw (RuntimeException
);
189 virtual Any SAL_CALL
getTarget() throw (RuntimeException
);
190 virtual void SAL_CALL
setTarget( const Any
& _target
) throw (RuntimeException
);
191 virtual sal_Int16 SAL_CALL
getSubItem() throw (RuntimeException
);
192 virtual void SAL_CALL
setSubItem( sal_Int16 _subitem
) throw (RuntimeException
);
193 virtual OUString SAL_CALL
getAttributeName() throw (RuntimeException
);
194 virtual void SAL_CALL
setAttributeName( const OUString
& _attribute
) throw (RuntimeException
);
195 virtual Sequence
< Any
> SAL_CALL
getValues() throw (RuntimeException
);
196 virtual void SAL_CALL
setValues( const Sequence
< Any
>& _values
) throw (RuntimeException
);
197 virtual Sequence
< double > SAL_CALL
getKeyTimes() throw (RuntimeException
);
198 virtual void SAL_CALL
setKeyTimes( const Sequence
< double >& _keytimes
) throw (RuntimeException
);
199 virtual sal_Int16 SAL_CALL
getValueType() throw (RuntimeException
);
200 virtual void SAL_CALL
setValueType( sal_Int16 _valuetype
) throw (RuntimeException
);
201 virtual sal_Int16 SAL_CALL
getCalcMode() throw (RuntimeException
);
202 virtual void SAL_CALL
setCalcMode( sal_Int16 _calcmode
) throw (RuntimeException
);
203 virtual sal_Bool SAL_CALL
getAccumulate() throw (RuntimeException
);
204 virtual void SAL_CALL
setAccumulate( sal_Bool _accumulate
) throw (RuntimeException
);
205 virtual sal_Int16 SAL_CALL
getAdditive() throw (RuntimeException
);
206 virtual void SAL_CALL
setAdditive( sal_Int16 _additive
) throw (RuntimeException
);
207 virtual Any SAL_CALL
getFrom() throw (RuntimeException
);
208 virtual void SAL_CALL
setFrom( const Any
& _from
) throw (RuntimeException
);
209 virtual Any SAL_CALL
getTo() throw (RuntimeException
);
210 virtual void SAL_CALL
setTo( const Any
& _to
) throw (RuntimeException
);
211 virtual Any SAL_CALL
getBy() throw (RuntimeException
);
212 virtual void SAL_CALL
setBy( const Any
& _by
) throw (RuntimeException
);
213 virtual Sequence
< TimeFilterPair
> SAL_CALL
getTimeFilter() throw (RuntimeException
);
214 virtual void SAL_CALL
setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
) throw (RuntimeException
);
215 virtual OUString SAL_CALL
getFormula() throw (RuntimeException
);
216 virtual void SAL_CALL
setFormula( const OUString
& _formula
) throw (RuntimeException
);
219 virtual sal_Int16 SAL_CALL
getColorInterpolation() throw (RuntimeException
);
220 virtual void SAL_CALL
setColorInterpolation( sal_Int16 _colorspace
) throw (RuntimeException
);
221 virtual sal_Bool SAL_CALL
getDirection() throw (RuntimeException
);
222 virtual void SAL_CALL
setDirection( sal_Bool _direction
) throw (RuntimeException
);
225 virtual Any SAL_CALL
getPath() throw (RuntimeException
);
226 virtual void SAL_CALL
setPath( const Any
& _path
) throw (RuntimeException
);
227 virtual Any SAL_CALL
getOrigin() throw (RuntimeException
);
228 virtual void SAL_CALL
setOrigin( const Any
& _origin
) throw (RuntimeException
);
231 virtual sal_Int16 SAL_CALL
getTransformType() throw (RuntimeException
);
232 virtual void SAL_CALL
setTransformType( sal_Int16 _transformtype
) throw (RuntimeException
);
235 virtual sal_Int16 SAL_CALL
getTransition() throw (RuntimeException
);
236 virtual void SAL_CALL
setTransition( sal_Int16 _transition
) throw (RuntimeException
);
237 virtual sal_Int16 SAL_CALL
getSubtype() throw (RuntimeException
);
238 virtual void SAL_CALL
setSubtype( sal_Int16 _subtype
) throw (RuntimeException
);
239 virtual sal_Bool SAL_CALL
getMode() throw (RuntimeException
);
240 virtual void SAL_CALL
setMode( sal_Bool _mode
) throw (RuntimeException
);
241 virtual sal_Int32 SAL_CALL
getFadeColor() throw (RuntimeException
);
242 virtual void SAL_CALL
setFadeColor( sal_Int32 _fadecolor
) throw (RuntimeException
);
245 virtual Any SAL_CALL
getSource() throw (RuntimeException
);
246 virtual void SAL_CALL
setSource( const Any
& _source
) throw (RuntimeException
);
247 virtual double SAL_CALL
getVolume() throw (RuntimeException
);
248 virtual void SAL_CALL
setVolume( double _volume
) throw (RuntimeException
);
251 // XCommand - the following two shadowed by animate, unfortunately
252 // virtual Any SAL_CALL getTarget() throw (RuntimeException);
253 // virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
254 virtual sal_Int16 SAL_CALL
getCommand() throw (RuntimeException
);
255 virtual void SAL_CALL
setCommand( sal_Int16 _command
) throw (RuntimeException
);
256 virtual Any SAL_CALL
getParameter() throw (RuntimeException
);
257 virtual void SAL_CALL
setParameter( const Any
& _parameter
) throw (RuntimeException
);
260 virtual Type SAL_CALL
getElementType() throw (RuntimeException
);
261 virtual sal_Bool SAL_CALL
hasElements() throw (RuntimeException
);
263 // XEnumerationAccess
264 virtual Reference
< XEnumeration
> SAL_CALL
createEnumeration() throw (RuntimeException
);
267 virtual Reference
< XAnimationNode
> SAL_CALL
insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
268 virtual Reference
< XAnimationNode
> SAL_CALL
insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
269 virtual Reference
< XAnimationNode
> SAL_CALL
replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
) throw( IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
270 virtual Reference
< XAnimationNode
> SAL_CALL
removeChild( const Reference
< XAnimationNode
>& oldChild
) throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
);
271 virtual Reference
< XAnimationNode
> SAL_CALL
appendChild( const Reference
< XAnimationNode
>& newChild
) throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
274 virtual sal_Int16 SAL_CALL
getIterateType() throw (RuntimeException
);
275 virtual void SAL_CALL
setIterateType( sal_Int16 _iteratetype
) throw (RuntimeException
);
276 virtual double SAL_CALL
getIterateInterval() throw (RuntimeException
);
277 virtual void SAL_CALL
setIterateInterval( double _iterateinterval
) throw (RuntimeException
);
280 virtual void SAL_CALL
addChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
);
281 virtual void SAL_CALL
removeChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
);
284 virtual ::sal_Int64 SAL_CALL
getSomething( const Sequence
< ::sal_Int8
>& aIdentifier
) throw (RuntimeException
);
286 static const Sequence
< sal_Int8
> & getUnoTunnelId();
287 void fireChangeListener();
290 OInterfaceContainerHelper maChangeListener
;
292 static void initTypeProvider( sal_Int16 nNodeType
) throw();
294 const sal_Int16 mnNodeType
;
297 static Sequence
< Type
>* mpTypes
[12];
298 static Sequence
< sal_Int8
>* mpId
[12];
300 // attributes for the XAnimationNode interface implementation
301 Any maBegin
, maDuration
, maEnd
, maEndSync
, maRepeatCount
, maRepeatDuration
;
302 sal_Int16 mnFill
, mnFillDefault
, mnRestart
, mnRestartDefault
;
303 double mfAcceleration
, mfDecelerate
;
304 sal_Bool mbAutoReverse
;
305 Sequence
< NamedValue
> maUserData
;
307 // parent interface for XChild interface implementation
308 WeakReference
<XInterface
> mxParent
;
309 AnimationNode
* mpParent
;
311 // attributes for XAnimate
313 OUString maAttributeName
, maFormula
;
314 Sequence
< Any
> maValues
;
315 Sequence
< double > maKeyTimes
;
316 sal_Int16 mnValueType
, mnSubItem
;
317 sal_Int16 mnCalcMode
, mnAdditive
;
318 sal_Bool mbAccumulate
;
319 Any maFrom
, maTo
, maBy
;
320 Sequence
< TimeFilterPair
> maTimeFilter
;
322 // attributes for XAnimateColor
323 sal_Int16 mnColorSpace
;
324 sal_Bool mbDirection
;
326 // atributes for XAnimateMotion
327 Any maPath
, maOrigin
;
329 // attributes for XAnimateTransform
330 sal_Int16 mnTransformType
;
332 // attributes for XTransitionFilter
333 sal_Int16 mnTransition
;
336 sal_Int32 mnFadeColor
;
346 sal_Int16 mnIterateType
;
347 double mfIterateInterval
;
349 /** sorted list of child nodes for XTimeContainer*/
350 ChildList_t maChildren
;
353 // ====================================================================
355 class TimeContainerEnumeration
: public ::cppu::WeakImplHelper1
< XEnumeration
>
358 TimeContainerEnumeration( const ChildList_t
&rChildren
);
359 virtual ~TimeContainerEnumeration();
362 virtual sal_Bool SAL_CALL
hasMoreElements() throw (RuntimeException
);
363 virtual Any SAL_CALL
nextElement( ) throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
);
366 /** sorted list of child nodes */
367 ChildList_t maChildren
;
369 /** current iteration position */
370 ChildList_t::iterator maIter
;
372 /** our first, last and only protection from mutli-threads! */
376 TimeContainerEnumeration::TimeContainerEnumeration( const ChildList_t
&rChildren
)
377 : maChildren( rChildren
)
379 maIter
= maChildren
.begin();
382 TimeContainerEnumeration::~TimeContainerEnumeration()
387 sal_Bool SAL_CALL
TimeContainerEnumeration::hasMoreElements() throw (RuntimeException
)
389 Guard
< Mutex
> aGuard( maMutex
);
391 return maIter
!= maChildren
.end();
394 Any SAL_CALL
TimeContainerEnumeration::nextElement()
395 throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
)
397 Guard
< Mutex
> aGuard( maMutex
);
399 if( maIter
== maChildren
.end() )
400 throw NoSuchElementException();
402 return makeAny( (*maIter
++) );
405 // ====================================================================
407 Sequence
< Type
>* AnimationNode::mpTypes
[] = { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
408 Sequence
< sal_Int8
>* AnimationNode::mpId
[] = { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
410 AnimationNode::AnimationNode( sal_Int16 nNodeType
)
411 : maChangeListener(maMutex
),
412 mnNodeType( nNodeType
),
413 mnFill( AnimationFill::DEFAULT
),
414 mnFillDefault( AnimationFill::INHERIT
),
415 mnRestart( AnimationRestart:: DEFAULT
),
416 mnRestartDefault( AnimationRestart:: INHERIT
),
417 mfAcceleration( 0.0 ),
419 mbAutoReverse( sal_False
),
423 mnCalcMode( (nNodeType
== AnimationNodeType::ANIMATEMOTION
) ? AnimationCalcMode::PACED
: AnimationCalcMode::LINEAR
),
424 mnAdditive(AnimationAdditiveMode::REPLACE
),
425 mbAccumulate(sal_False
),
426 mnColorSpace( AnimationColorSpace::RGB
),
427 mbDirection( sal_True
),
428 mnTransformType( AnimationTransformType::TRANSLATE
),
429 mnTransition(TransitionType::BARWIPE
),
430 mnSubtype(TransitionSubType::DEFAULT
),
435 mnIterateType( ::com::sun::star::presentation::ShapeAnimationSubType::AS_WHOLE
),
436 mfIterateInterval(0.0)
438 OSL_ENSURE((sal_uInt32
)nNodeType
< sizeof(mpTypes
)/sizeof(Sequence
<Type
>*), "NodeType out of range");
441 AnimationNode::AnimationNode( const AnimationNode
& rNode
)
442 : AnimationNodeBase(),
443 maChangeListener(maMutex
),
444 mnNodeType( rNode
.mnNodeType
),
446 // attributes for the XAnimationNode interface implementation
447 maBegin( rNode
.maBegin
),
448 maDuration( rNode
.maDuration
),
449 maEnd( rNode
.maEnd
),
450 maEndSync( rNode
.maEndSync
),
451 maRepeatCount( rNode
.maRepeatCount
),
452 maRepeatDuration( rNode
.maRepeatDuration
),
453 mnFill( rNode
.mnFill
),
454 mnFillDefault( rNode
.mnFillDefault
),
455 mnRestart( rNode
.mnRestart
),
456 mnRestartDefault( rNode
.mnRestartDefault
),
457 mfAcceleration( rNode
.mfAcceleration
),
458 mfDecelerate( rNode
.mfDecelerate
),
459 mbAutoReverse( rNode
.mbAutoReverse
),
460 maUserData( rNode
.maUserData
),
463 // attributes for XAnimate
464 maTarget( rNode
.maTarget
),
465 maAttributeName( rNode
.maAttributeName
),
466 maFormula( rNode
.maFormula
),
467 maValues( rNode
.maValues
),
468 maKeyTimes( rNode
.maKeyTimes
),
469 mnValueType( rNode
.mnValueType
),
470 mnSubItem( rNode
.mnSubItem
),
471 mnCalcMode( rNode
.mnCalcMode
),
472 mnAdditive( rNode
.mnAdditive
),
473 mbAccumulate( rNode
.mbAccumulate
),
474 maFrom( rNode
.maFrom
),
477 maTimeFilter( rNode
.maTimeFilter
),
479 // attributes for XAnimateColor
480 mnColorSpace( rNode
.mnColorSpace
),
481 mbDirection( rNode
.mbDirection
),
483 // atributes for XAnimateMotion
484 maPath( rNode
.maPath
),
485 maOrigin( rNode
.maOrigin
),
487 // attributes for XAnimateTransform
488 mnTransformType( rNode
.mnTransformType
),
490 // attributes for XTransitionFilter
491 mnTransition( rNode
.mnTransition
),
492 mnSubtype( rNode
.mnSubtype
),
493 mbMode( rNode
.mbMode
),
494 mnFadeColor( rNode
.mnFadeColor
),
497 mfVolume( rNode
.mfVolume
),
500 mnCommand( rNode
.mnCommand
),
501 maParameter( rNode
.maParameter
),
504 mnIterateType( rNode
.mnIterateType
),
505 mfIterateInterval( rNode
.mfIterateInterval
)
509 AnimationNode::~AnimationNode()
513 // --------------------------------------------------------------------
515 #define IMPL_NODE_FACTORY(N,IN,SN)\
516 Reference< XInterface > SAL_CALL createInstance_##N( const Reference< XComponentContext > & ) throw (Exception)\
518 return Reference < XInterface > ( (static_cast< ::cppu::OWeakObject * >(new AnimationNode( N )) ) );\
520 OUString getImplementationName_##N()\
522 return OUString( IN );\
524 Sequence<OUString> getSupportedServiceNames_##N(void)\
526 Sequence<OUString> aRet(1);\
527 aRet.getArray()[0] = SN;\
531 IMPL_NODE_FACTORY( PAR
, "animcore::ParallelTimeContainer", "com.sun.star.animations.ParallelTimeContainer" )
532 IMPL_NODE_FACTORY( SEQ
, "animcore::SequenceTimeContainer", "com.sun.star.animations.SequenceTimeContainer" )
533 IMPL_NODE_FACTORY( ITERATE
, "animcore::IterateContainer", "com.sun.star.animations.IterateContainer" )
534 IMPL_NODE_FACTORY( ANIMATE
, "animcore::Animate", "com.sun.star.animations.Animate" )
535 IMPL_NODE_FACTORY( SET
, "animcore::AnimateSet", "com.sun.star.animations.AnimateSet" )
536 IMPL_NODE_FACTORY( ANIMATECOLOR
, "animcore::AnimateColor", "com.sun.star.animations.AnimateColor" )
537 IMPL_NODE_FACTORY( ANIMATEMOTION
, "animcore::AnimateMotion", "com.sun.star.animations.AnimateMotion" )
538 IMPL_NODE_FACTORY( ANIMATETRANSFORM
, "animcore::AnimateTransform", "com.sun.star.animations.AnimateTransform" )
539 IMPL_NODE_FACTORY( TRANSITIONFILTER
, "animcore::TransitionFilter", "com.sun.star.animations.TransitionFilter" )
540 IMPL_NODE_FACTORY( AUDIO
, "animcore::Audio", "com.sun.star.animations.Audio" );
541 IMPL_NODE_FACTORY( COMMAND
, "animcore::Command", "com.sun.star.animations.Command" );
543 // --------------------------------------------------------------------
546 Any SAL_CALL
AnimationNode::queryInterface( const Type
& aType
) throw (RuntimeException
)
548 Any
aRet( ::cppu::queryInterface(
550 static_cast< XServiceInfo
* >( this ),
551 static_cast< XTypeProvider
* >( this ),
552 static_cast< XChild
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
553 static_cast< XCloneable
* >( this ),
554 static_cast< XAnimationNode
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
555 static_cast< XInterface
* >(static_cast< OWeakObject
* >(this)),
556 static_cast< XWeak
* >(static_cast< OWeakObject
* >(this)),
557 static_cast< XChangesNotifier
* >( this ),
558 static_cast< XUnoTunnel
* >( this ) ) );
564 case AnimationNodeType::PAR
:
565 aRet
= ::cppu::queryInterface(
567 static_cast< XParallelTimeContainer
* >( this ),
568 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
569 static_cast< XEnumerationAccess
* >( this ),
570 static_cast< XElementAccess
* >( this ) );
572 case AnimationNodeType::SEQ
:
573 aRet
= ::cppu::queryInterface(
575 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
576 static_cast< XEnumerationAccess
* >( this ),
577 static_cast< XElementAccess
* >( this ) );
579 case AnimationNodeType::ITERATE
:
580 aRet
= ::cppu::queryInterface(
582 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
583 static_cast< XIterateContainer
* >( this ),
584 static_cast< XEnumerationAccess
* >( this ),
585 static_cast< XElementAccess
* >( this ) );
587 case AnimationNodeType::ANIMATE
:
588 aRet
= ::cppu::queryInterface(
590 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ) );
592 case AnimationNodeType::ANIMATEMOTION
:
593 aRet
= ::cppu::queryInterface(
595 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ),
596 static_cast< XAnimateMotion
* >( this ) );
598 case AnimationNodeType::ANIMATECOLOR
:
599 aRet
= ::cppu::queryInterface(
601 static_cast< XAnimate
* >( static_cast< XAnimateColor
* >(this) ),
602 static_cast< XAnimateColor
* >( this ) );
604 case AnimationNodeType::SET
:
605 aRet
= ::cppu::queryInterface(
607 static_cast< XAnimate
* >( static_cast< XAnimateSet
* >(this) ),
608 static_cast< XAnimateSet
* >( this ) );
610 case AnimationNodeType::ANIMATETRANSFORM
:
611 aRet
= ::cppu::queryInterface(
613 static_cast< XAnimate
* >( static_cast< XAnimateTransform
* >(this) ),
614 static_cast< XAnimateTransform
* >( this ) );
616 case AnimationNodeType::AUDIO
:
617 aRet
= ::cppu::queryInterface(
619 static_cast< XAudio
* >( static_cast< XAudio
* >(this) ) );
621 case AnimationNodeType::COMMAND
:
622 aRet
= ::cppu::queryInterface(
624 static_cast< XCommand
* >( static_cast< XCommand
* >(this) ) );
626 case AnimationNodeType::TRANSITIONFILTER
:
627 aRet
= ::cppu::queryInterface(
629 static_cast< XAnimate
* >( static_cast< XTransitionFilter
* >(this) ),
630 static_cast< XTransitionFilter
* >( this ) );
635 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( aType
);
638 // --------------------------------------------------------------------
640 void AnimationNode::initTypeProvider( sal_Int16 nNodeType
) throw()
642 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
644 if(! mpTypes
[nNodeType
] )
647 mpId
[nNodeType
] = new Sequence
< sal_Int8
>( 16 );
648 rtl_createUuid( (sal_uInt8
*)mpId
[nNodeType
]->getArray(), 0, sal_True
);
650 static const sal_Int32 type_numbers
[] =
660 8, // ANIMATETRANSFORM
661 8, // TRANSITIONFILTER
667 Sequence
< Type
> * types
= new Sequence
< Type
>( type_numbers
[nNodeType
] );
668 Type
* pTypeAr
= types
->getArray();
671 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XWeak
> *)0 );
672 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XChild
> *)0 );
673 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XCloneable
> *)0 );
674 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTypeProvider
> *)0 );
675 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XServiceInfo
> *)0 );
676 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XUnoTunnel
> *)0 );
677 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XChangesNotifier
> *)0 );
681 case AnimationNodeType::PAR
:
682 case AnimationNodeType::SEQ
:
683 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTimeContainer
> *)0 );
684 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XEnumerationAccess
> *)0 );
686 case AnimationNodeType::ITERATE
:
687 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XIterateContainer
> *)0 );
688 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XEnumerationAccess
> *)0 );
690 case AnimationNodeType::ANIMATE
:
691 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimate
> *)0 );
693 case AnimationNodeType::ANIMATEMOTION
:
694 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateMotion
> *)0 );
696 case AnimationNodeType::ANIMATECOLOR
:
697 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateColor
> *)0 );
699 case AnimationNodeType::ANIMATETRANSFORM
:
700 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateTransform
> *)0 );
702 case AnimationNodeType::SET
:
703 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateSet
> *)0 );
705 case AnimationNodeType::TRANSITIONFILTER
:
706 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTransitionFilter
> *)0 );
708 case AnimationNodeType::AUDIO
:
709 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAudio
> *)0 );
711 case AnimationNodeType::COMMAND
:
712 pTypeAr
[nPos
++] = ::getCppuType( ( const Reference
< XCommand
> *)0 );
715 mpTypes
[nNodeType
] = types
;
719 // --------------------------------------------------------------------
721 Sequence
< Type
> AnimationNode::getTypes() throw (RuntimeException
)
723 if (! mpTypes
[mnNodeType
])
724 initTypeProvider(mnNodeType
);
725 return *mpTypes
[mnNodeType
];
727 // --------------------------------------------------------------------
729 Sequence
< sal_Int8
> AnimationNode::getImplementationId() throw (RuntimeException
)
731 if (! mpId
[mnNodeType
])
732 initTypeProvider(mnNodeType
);
733 return *mpId
[mnNodeType
];
736 // --------------------------------------------------------------------
739 void SAL_CALL
AnimationNode::acquire( ) throw ()
741 OWeakObject::acquire();
744 // --------------------------------------------------------------------
747 void SAL_CALL
AnimationNode::release( ) throw ()
749 OWeakObject::release();
752 // --------------------------------------------------------------------
755 OUString
AnimationNode::getImplementationName() throw()
759 case AnimationNodeType::PAR
:
760 return getImplementationName_PAR();
761 case AnimationNodeType::SEQ
:
762 return getImplementationName_SEQ();
763 case AnimationNodeType::ITERATE
:
764 return getImplementationName_ITERATE();
765 case AnimationNodeType::SET
:
766 return getImplementationName_SET();
767 case AnimationNodeType::ANIMATECOLOR
:
768 return getImplementationName_ANIMATECOLOR();
769 case AnimationNodeType::ANIMATEMOTION
:
770 return getImplementationName_ANIMATEMOTION();
771 case AnimationNodeType::TRANSITIONFILTER
:
772 return getImplementationName_TRANSITIONFILTER();
773 case AnimationNodeType::ANIMATETRANSFORM
:
774 return getImplementationName_ANIMATETRANSFORM();
775 case AnimationNodeType::AUDIO
:
776 return getImplementationName_AUDIO();
777 case AnimationNodeType::COMMAND
:
778 return getImplementationName_COMMAND();
779 case AnimationNodeType::ANIMATE
:
781 return getImplementationName_ANIMATE();
786 sal_Bool
AnimationNode::supportsService(const OUString
& ServiceName
) throw()
788 return cppu::supportsService(this, ServiceName
);
792 Sequence
< OUString
> AnimationNode::getSupportedServiceNames(void) throw()
796 case AnimationNodeType::PAR
:
797 return getSupportedServiceNames_PAR();
798 case AnimationNodeType::SEQ
:
799 return getSupportedServiceNames_SEQ();
800 case AnimationNodeType::ITERATE
:
801 return getSupportedServiceNames_ITERATE();
802 case AnimationNodeType::SET
:
803 return getSupportedServiceNames_SET();
804 case AnimationNodeType::ANIMATECOLOR
:
805 return getSupportedServiceNames_ANIMATECOLOR();
806 case AnimationNodeType::ANIMATEMOTION
:
807 return getSupportedServiceNames_ANIMATEMOTION();
808 case AnimationNodeType::TRANSITIONFILTER
:
809 return getSupportedServiceNames_TRANSITIONFILTER();
810 case AnimationNodeType::AUDIO
:
811 return getSupportedServiceNames_AUDIO();
812 case AnimationNodeType::COMMAND
:
813 return getSupportedServiceNames_COMMAND();
814 case AnimationNodeType::ANIMATE
:
816 return getSupportedServiceNames_ANIMATE();
820 // --------------------------------------------------------------------
823 sal_Int16 SAL_CALL
AnimationNode::getType() throw (RuntimeException
)
825 Guard
< Mutex
> aGuard( maMutex
);
829 // --------------------------------------------------------------------
832 Any SAL_CALL
AnimationNode::getBegin() throw (RuntimeException
)
834 Guard
< Mutex
> aGuard( maMutex
);
838 // --------------------------------------------------------------------
841 void SAL_CALL
AnimationNode::setBegin( const Any
& _begin
) throw (RuntimeException
)
843 Guard
< Mutex
> aGuard( maMutex
);
844 if( _begin
!= maBegin
)
847 fireChangeListener();
851 // --------------------------------------------------------------------
854 Any SAL_CALL
AnimationNode::getDuration() throw (RuntimeException
)
856 Guard
< Mutex
> aGuard( maMutex
);
860 // --------------------------------------------------------------------
863 void SAL_CALL
AnimationNode::setDuration( const Any
& _duration
) throw (RuntimeException
)
865 Guard
< Mutex
> aGuard( maMutex
);
866 if( _duration
!= maDuration
)
868 maDuration
= _duration
;
869 fireChangeListener();
873 // --------------------------------------------------------------------
876 Any SAL_CALL
AnimationNode::getEnd() throw (RuntimeException
)
878 Guard
< Mutex
> aGuard( maMutex
);
882 // --------------------------------------------------------------------
885 void SAL_CALL
AnimationNode::setEnd( const Any
& _end
) throw (RuntimeException
)
887 Guard
< Mutex
> aGuard( maMutex
);
891 fireChangeListener();
895 // --------------------------------------------------------------------
898 Any SAL_CALL
AnimationNode::getEndSync() throw (RuntimeException
)
900 Guard
< Mutex
> aGuard( maMutex
);
904 // --------------------------------------------------------------------
907 void SAL_CALL
AnimationNode::setEndSync( const Any
& _endsync
) throw (RuntimeException
)
909 Guard
< Mutex
> aGuard( maMutex
);
910 if( _endsync
!= maEndSync
)
912 maEndSync
= _endsync
;
913 fireChangeListener();
917 // --------------------------------------------------------------------
920 Any SAL_CALL
AnimationNode::getRepeatCount() throw (RuntimeException
)
922 Guard
< Mutex
> aGuard( maMutex
);
923 return maRepeatCount
;
926 // --------------------------------------------------------------------
929 void SAL_CALL
AnimationNode::setRepeatCount( const Any
& _repeatcount
) throw (RuntimeException
)
931 Guard
< Mutex
> aGuard( maMutex
);
932 if( _repeatcount
!= maRepeatCount
)
934 maRepeatCount
= _repeatcount
;
935 fireChangeListener();
939 // --------------------------------------------------------------------
942 Any SAL_CALL
AnimationNode::getRepeatDuration() throw (RuntimeException
)
944 Guard
< Mutex
> aGuard( maMutex
);
945 return maRepeatDuration
;
948 // --------------------------------------------------------------------
951 void SAL_CALL
AnimationNode::setRepeatDuration( const Any
& _repeatduration
) throw (RuntimeException
)
953 Guard
< Mutex
> aGuard( maMutex
);
954 if( _repeatduration
!= maRepeatDuration
)
956 maRepeatDuration
= _repeatduration
;
957 fireChangeListener();
961 // --------------------------------------------------------------------
964 sal_Int16 SAL_CALL
AnimationNode::getFill() throw (RuntimeException
)
966 Guard
< Mutex
> aGuard( maMutex
);
970 // --------------------------------------------------------------------
973 void SAL_CALL
AnimationNode::setFill( sal_Int16 _fill
) throw (RuntimeException
)
975 Guard
< Mutex
> aGuard( maMutex
);
976 if( _fill
!= mnFill
)
979 fireChangeListener();
983 // --------------------------------------------------------------------
986 sal_Int16 SAL_CALL
AnimationNode::getFillDefault() throw (RuntimeException
)
988 Guard
< Mutex
> aGuard( maMutex
);
989 return mnFillDefault
;
992 // --------------------------------------------------------------------
995 void SAL_CALL
AnimationNode::setFillDefault( sal_Int16 _filldefault
) throw (RuntimeException
)
997 Guard
< Mutex
> aGuard( maMutex
);
998 if( _filldefault
!= mnFillDefault
)
1000 mnFillDefault
= _filldefault
;
1001 fireChangeListener();
1005 // --------------------------------------------------------------------
1008 sal_Int16 SAL_CALL
AnimationNode::getRestart() throw (RuntimeException
)
1010 Guard
< Mutex
> aGuard( maMutex
);
1014 // --------------------------------------------------------------------
1017 void SAL_CALL
AnimationNode::setRestart( sal_Int16 _restart
) throw (RuntimeException
)
1019 Guard
< Mutex
> aGuard( maMutex
);
1020 if( _restart
!= mnRestart
)
1022 mnRestart
= _restart
;
1023 fireChangeListener();
1027 // --------------------------------------------------------------------
1030 sal_Int16 SAL_CALL
AnimationNode::getRestartDefault() throw (RuntimeException
)
1032 Guard
< Mutex
> aGuard( maMutex
);
1033 return mnRestartDefault
;
1036 // --------------------------------------------------------------------
1039 void SAL_CALL
AnimationNode::setRestartDefault( sal_Int16 _restartdefault
) throw (RuntimeException
)
1041 Guard
< Mutex
> aGuard( maMutex
);
1042 if( _restartdefault
!= mnRestartDefault
)
1044 mnRestartDefault
= _restartdefault
;
1045 fireChangeListener();
1049 // --------------------------------------------------------------------
1052 double SAL_CALL
AnimationNode::getAcceleration() throw (RuntimeException
)
1054 Guard
< Mutex
> aGuard( maMutex
);
1055 return mfAcceleration
;
1058 // --------------------------------------------------------------------
1061 void SAL_CALL
AnimationNode::setAcceleration( double _acceleration
) throw (RuntimeException
)
1063 Guard
< Mutex
> aGuard( maMutex
);
1064 if( _acceleration
!= mfAcceleration
)
1066 mfAcceleration
= _acceleration
;
1067 fireChangeListener();
1071 // --------------------------------------------------------------------
1074 double SAL_CALL
AnimationNode::getDecelerate() throw (RuntimeException
)
1076 Guard
< Mutex
> aGuard( maMutex
);
1077 return mfDecelerate
;
1080 // --------------------------------------------------------------------
1083 void SAL_CALL
AnimationNode::setDecelerate( double _decelerate
) throw (RuntimeException
)
1085 Guard
< Mutex
> aGuard( maMutex
);
1086 if( _decelerate
!= mfDecelerate
)
1088 mfDecelerate
= _decelerate
;
1089 fireChangeListener();
1093 // --------------------------------------------------------------------
1096 sal_Bool SAL_CALL
AnimationNode::getAutoReverse() throw (RuntimeException
)
1098 Guard
< Mutex
> aGuard( maMutex
);
1099 return mbAutoReverse
;
1102 // --------------------------------------------------------------------
1105 void SAL_CALL
AnimationNode::setAutoReverse( sal_Bool _autoreverse
) throw (RuntimeException
)
1107 Guard
< Mutex
> aGuard( maMutex
);
1108 if( _autoreverse
!= mbAutoReverse
)
1110 mbAutoReverse
= _autoreverse
;
1111 fireChangeListener();
1115 // --------------------------------------------------------------------
1117 Sequence
< NamedValue
> SAL_CALL
AnimationNode::getUserData() throw (RuntimeException
)
1119 Guard
< Mutex
> aGuard( maMutex
);
1123 // --------------------------------------------------------------------
1125 void SAL_CALL
AnimationNode::setUserData( const Sequence
< NamedValue
>& _userdata
) throw (RuntimeException
)
1127 Guard
< Mutex
> aGuard( maMutex
);
1128 maUserData
= _userdata
;
1129 fireChangeListener();
1132 // --------------------------------------------------------------------
1135 Reference
< XInterface
> SAL_CALL
AnimationNode::getParent() throw (RuntimeException
)
1137 Guard
< Mutex
> aGuard( maMutex
);
1138 return mxParent
.get();
1141 // --------------------------------------------------------------------
1144 void SAL_CALL
AnimationNode::setParent( const Reference
< XInterface
>& Parent
) throw (NoSupportException
, RuntimeException
)
1146 Guard
< Mutex
> aGuard( maMutex
);
1147 if( Parent
!= mxParent
.get() )
1152 Reference
< XUnoTunnel
> xTunnel( mxParent
.get(), UNO_QUERY
);
1154 mpParent
= reinterpret_cast< AnimationNode
* >( sal::static_int_cast
< sal_IntPtr
>(xTunnel
->getSomething( getUnoTunnelId() )));
1156 fireChangeListener();
1160 // --------------------------------------------------------------------
1163 Reference
< XCloneable
> SAL_CALL
AnimationNode::createClone() throw (RuntimeException
)
1165 Guard
< Mutex
> aGuard( maMutex
);
1167 Reference
< XCloneable
> xNewNode
;
1170 xNewNode
= new AnimationNode( *this );
1172 if( !maChildren
.empty() )
1174 Reference
< XTimeContainer
> xContainer( xNewNode
, UNO_QUERY
);
1175 if( xContainer
.is() )
1177 ChildList_t::iterator
aIter( maChildren
.begin() );
1178 ChildList_t::iterator
aEnd( maChildren
.end() );
1179 while( aIter
!= aEnd
)
1181 Reference
< XCloneable
> xCloneable((*aIter
++), UNO_QUERY
);
1182 if( xCloneable
.is() ) try
1184 Reference
< XAnimationNode
> xNewChildNode( xCloneable
->createClone(), UNO_QUERY
);
1185 if( xNewChildNode
.is() )
1186 xContainer
->appendChild( xNewChildNode
);
1188 catch(const Exception
&)
1190 OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1196 catch(const Exception
&)
1198 OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1204 // --------------------------------------------------------------------
1207 Any SAL_CALL
AnimationNode::getTarget()
1208 throw (RuntimeException
)
1210 Guard
< Mutex
> aGuard( maMutex
);
1214 // --------------------------------------------------------------------
1217 void SAL_CALL
AnimationNode::setTarget( const Any
& _target
)
1218 throw (RuntimeException
)
1220 Guard
< Mutex
> aGuard( maMutex
);
1221 if( _target
!= maTarget
)
1224 fireChangeListener();
1228 // --------------------------------------------------------------------
1231 OUString SAL_CALL
AnimationNode::getAttributeName() throw (RuntimeException
)
1233 Guard
< Mutex
> aGuard( maMutex
);
1234 return maAttributeName
;
1237 // --------------------------------------------------------------------
1240 void SAL_CALL
AnimationNode::setAttributeName( const OUString
& _attribute
)
1241 throw (RuntimeException
)
1243 Guard
< Mutex
> aGuard( maMutex
);
1244 if( _attribute
!= maAttributeName
)
1246 maAttributeName
= _attribute
;
1247 fireChangeListener();
1251 // --------------------------------------------------------------------
1254 Sequence
< Any
> SAL_CALL
AnimationNode::getValues()
1255 throw (RuntimeException
)
1257 Guard
< Mutex
> aGuard( maMutex
);
1261 // --------------------------------------------------------------------
1264 void SAL_CALL
AnimationNode::setValues( const Sequence
< Any
>& _values
)
1265 throw (RuntimeException
)
1267 Guard
< Mutex
> aGuard( maMutex
);
1269 fireChangeListener();
1272 // --------------------------------------------------------------------
1275 sal_Int16 SAL_CALL
AnimationNode::getSubItem() throw (RuntimeException
)
1277 Guard
< Mutex
> aGuard( maMutex
);
1281 // --------------------------------------------------------------------
1284 void SAL_CALL
AnimationNode::setSubItem( sal_Int16 _subitem
) throw (RuntimeException
)
1286 Guard
< Mutex
> aGuard( maMutex
);
1287 if( _subitem
!= mnSubItem
)
1289 mnSubItem
= _subitem
;
1290 fireChangeListener();
1294 // --------------------------------------------------------------------
1297 Sequence
< double > SAL_CALL
AnimationNode::getKeyTimes() throw (RuntimeException
)
1299 Guard
< Mutex
> aGuard( maMutex
);
1303 // --------------------------------------------------------------------
1306 void SAL_CALL
AnimationNode::setKeyTimes( const Sequence
< double >& _keytimes
) throw (RuntimeException
)
1308 Guard
< Mutex
> aGuard( maMutex
);
1309 maKeyTimes
= _keytimes
;
1310 fireChangeListener();
1313 // --------------------------------------------------------------------
1316 sal_Int16 SAL_CALL
AnimationNode::getValueType() throw (RuntimeException
)
1318 Guard
< Mutex
> aGuard( maMutex
);
1322 // --------------------------------------------------------------------
1324 void SAL_CALL
AnimationNode::setValueType( sal_Int16 _valuetype
) throw (RuntimeException
)
1326 Guard
< Mutex
> aGuard( maMutex
);
1327 if( _valuetype
!= mnValueType
)
1329 mnValueType
= _valuetype
;
1330 fireChangeListener();
1334 // --------------------------------------------------------------------
1337 sal_Int16 SAL_CALL
AnimationNode::getCalcMode()
1338 throw (RuntimeException
)
1340 Guard
< Mutex
> aGuard( maMutex
);
1344 // --------------------------------------------------------------------
1347 void SAL_CALL
AnimationNode::setCalcMode( sal_Int16 _calcmode
)
1348 throw (RuntimeException
)
1350 Guard
< Mutex
> aGuard( maMutex
);
1351 if( _calcmode
!= mnCalcMode
)
1353 mnCalcMode
= _calcmode
;
1354 fireChangeListener();
1358 // --------------------------------------------------------------------
1361 sal_Bool SAL_CALL
AnimationNode::getAccumulate()
1362 throw (RuntimeException
)
1364 Guard
< Mutex
> aGuard( maMutex
);
1365 return mbAccumulate
;
1368 // --------------------------------------------------------------------
1371 void SAL_CALL
AnimationNode::setAccumulate( sal_Bool _accumulate
)
1372 throw (RuntimeException
)
1374 Guard
< Mutex
> aGuard( maMutex
);
1375 if( _accumulate
!= mbAccumulate
)
1377 mbAccumulate
= _accumulate
;
1378 fireChangeListener();
1382 // --------------------------------------------------------------------
1385 sal_Int16 SAL_CALL
AnimationNode::getAdditive()
1386 throw (RuntimeException
)
1388 Guard
< Mutex
> aGuard( maMutex
);
1392 // --------------------------------------------------------------------
1395 void SAL_CALL
AnimationNode::setAdditive( sal_Int16 _additive
)
1396 throw (RuntimeException
)
1398 Guard
< Mutex
> aGuard( maMutex
);
1399 if( _additive
!= mnAdditive
)
1401 mnAdditive
= _additive
;
1402 fireChangeListener();
1406 // --------------------------------------------------------------------
1409 Any SAL_CALL
AnimationNode::getFrom()
1410 throw (RuntimeException
)
1412 Guard
< Mutex
> aGuard( maMutex
);
1416 // --------------------------------------------------------------------
1419 void SAL_CALL
AnimationNode::setFrom( const Any
& _from
)
1420 throw (RuntimeException
)
1422 Guard
< Mutex
> aGuard( maMutex
);
1423 if( _from
!= maFrom
)
1426 fireChangeListener();
1430 // --------------------------------------------------------------------
1433 Any SAL_CALL
AnimationNode::getTo()
1434 throw (RuntimeException
)
1436 Guard
< Mutex
> aGuard( maMutex
);
1440 // --------------------------------------------------------------------
1443 void SAL_CALL
AnimationNode::setTo( const Any
& _to
)
1444 throw (RuntimeException
)
1446 Guard
< Mutex
> aGuard( maMutex
);
1450 fireChangeListener();
1454 // --------------------------------------------------------------------
1457 Any SAL_CALL
AnimationNode::getBy()
1458 throw (RuntimeException
)
1460 Guard
< Mutex
> aGuard( maMutex
);
1464 // --------------------------------------------------------------------
1467 void SAL_CALL
AnimationNode::setBy( const Any
& _by
)
1468 throw (RuntimeException
)
1470 Guard
< Mutex
> aGuard( maMutex
);
1474 fireChangeListener();
1478 // --------------------------------------------------------------------
1481 Sequence
< TimeFilterPair
> SAL_CALL
AnimationNode::getTimeFilter()
1482 throw (RuntimeException
)
1484 Guard
< Mutex
> aGuard( maMutex
);
1485 return maTimeFilter
;
1488 // --------------------------------------------------------------------
1491 void SAL_CALL
AnimationNode::setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
)
1492 throw (RuntimeException
)
1494 Guard
< Mutex
> aGuard( maMutex
);
1495 maTimeFilter
= _timefilter
;
1496 fireChangeListener();
1499 // --------------------------------------------------------------------
1501 OUString SAL_CALL
AnimationNode::getFormula() throw (RuntimeException
)
1503 Guard
< Mutex
> aGuard( maMutex
);
1507 // --------------------------------------------------------------------
1509 void SAL_CALL
AnimationNode::setFormula( const OUString
& _formula
) throw (RuntimeException
)
1511 Guard
< Mutex
> aGuard( maMutex
);
1512 if( _formula
!= maFormula
)
1514 maFormula
= _formula
;
1515 fireChangeListener();
1519 // --------------------------------------------------------------------
1522 sal_Int16 SAL_CALL
AnimationNode::getColorInterpolation() throw (RuntimeException
)
1524 Guard
< Mutex
> aGuard( maMutex
);
1525 return mnColorSpace
;
1528 // --------------------------------------------------------------------
1531 void SAL_CALL
AnimationNode::setColorInterpolation( sal_Int16 _colorspace
) throw (RuntimeException
)
1533 Guard
< Mutex
> aGuard( maMutex
);
1534 if( _colorspace
!= mnColorSpace
)
1536 mnColorSpace
= _colorspace
;
1537 fireChangeListener();
1541 // --------------------------------------------------------------------
1544 sal_Bool SAL_CALL
AnimationNode::getDirection() throw (RuntimeException
)
1546 Guard
< Mutex
> aGuard( maMutex
);
1550 // --------------------------------------------------------------------
1553 void SAL_CALL
AnimationNode::setDirection( sal_Bool _direction
) throw (RuntimeException
)
1555 Guard
< Mutex
> aGuard( maMutex
);
1556 if( _direction
!= mbDirection
)
1558 mbDirection
= _direction
;
1559 fireChangeListener();
1563 // --------------------------------------------------------------------
1566 Any SAL_CALL
AnimationNode::getPath() throw (RuntimeException
)
1568 Guard
< Mutex
> aGuard( maMutex
);
1572 // --------------------------------------------------------------------
1575 void SAL_CALL
AnimationNode::setPath( const Any
& _path
) throw (RuntimeException
)
1577 Guard
< Mutex
> aGuard( maMutex
);
1579 fireChangeListener();
1582 // --------------------------------------------------------------------
1585 Any SAL_CALL
AnimationNode::getOrigin() throw (RuntimeException
)
1587 Guard
< Mutex
> aGuard( maMutex
);
1591 // --------------------------------------------------------------------
1594 void SAL_CALL
AnimationNode::setOrigin( const Any
& _origin
) throw (RuntimeException
)
1596 Guard
< Mutex
> aGuard( maMutex
);
1598 fireChangeListener();
1601 // --------------------------------------------------------------------
1603 // XAnimateTransform
1604 sal_Int16 SAL_CALL
AnimationNode::getTransformType() throw (RuntimeException
)
1606 Guard
< Mutex
> aGuard( maMutex
);
1607 return mnTransformType
;
1610 // --------------------------------------------------------------------
1612 // XAnimateTransform
1613 void SAL_CALL
AnimationNode::setTransformType( sal_Int16 _transformtype
) throw (RuntimeException
)
1615 Guard
< Mutex
> aGuard( maMutex
);
1616 if( _transformtype
!= mnTransformType
)
1618 mnTransformType
= _transformtype
;
1619 fireChangeListener();
1623 // --------------------------------------------------------------------
1625 // XTransitionFilter
1626 sal_Int16 SAL_CALL
AnimationNode::getTransition() throw (RuntimeException
)
1628 Guard
< Mutex
> aGuard( maMutex
);
1629 return mnTransition
;
1632 // --------------------------------------------------------------------
1634 // XTransitionFilter
1635 void SAL_CALL
AnimationNode::setTransition( sal_Int16 _transition
) throw (RuntimeException
)
1637 Guard
< Mutex
> aGuard( maMutex
);
1638 if( _transition
!= mnTransition
)
1640 mnTransition
= _transition
;
1641 fireChangeListener();
1645 // --------------------------------------------------------------------
1647 // XTransitionFilter
1648 sal_Int16 SAL_CALL
AnimationNode::getSubtype() throw (RuntimeException
)
1650 Guard
< Mutex
> aGuard( maMutex
);
1654 // --------------------------------------------------------------------
1656 // XTransitionFilter
1657 void SAL_CALL
AnimationNode::setSubtype( sal_Int16 _subtype
) throw (RuntimeException
)
1659 Guard
< Mutex
> aGuard( maMutex
);
1660 if( _subtype
!= mnSubtype
)
1662 mnSubtype
= _subtype
;
1663 fireChangeListener();
1667 // --------------------------------------------------------------------
1669 // XTransitionFilter
1670 sal_Bool SAL_CALL
AnimationNode::getMode() throw (RuntimeException
)
1672 Guard
< Mutex
> aGuard( maMutex
);
1676 // --------------------------------------------------------------------
1678 // XTransitionFilter
1679 void SAL_CALL
AnimationNode::setMode( sal_Bool _mode
) throw (RuntimeException
)
1681 Guard
< Mutex
> aGuard( maMutex
);
1682 if( _mode
!= mbMode
)
1685 fireChangeListener();
1689 // --------------------------------------------------------------------
1691 // XTransitionFilter
1692 sal_Int32 SAL_CALL
AnimationNode::getFadeColor() throw (RuntimeException
)
1694 Guard
< Mutex
> aGuard( maMutex
);
1698 // --------------------------------------------------------------------
1700 // XTransitionFilter
1701 void SAL_CALL
AnimationNode::setFadeColor( sal_Int32 _fadecolor
) throw (RuntimeException
)
1703 Guard
< Mutex
> aGuard( maMutex
);
1704 if( _fadecolor
!= mnFadeColor
)
1706 mnFadeColor
= _fadecolor
;
1707 fireChangeListener();
1711 // --------------------------------------------------------------------
1714 Any SAL_CALL
AnimationNode::getSource() throw (RuntimeException
)
1716 Guard
< Mutex
> aGuard( maMutex
);
1720 // --------------------------------------------------------------------
1723 void SAL_CALL
AnimationNode::setSource( const Any
& _source
) throw (RuntimeException
)
1725 Guard
< Mutex
> aGuard( maMutex
);
1727 fireChangeListener();
1730 // --------------------------------------------------------------------
1733 double SAL_CALL
AnimationNode::getVolume() throw (RuntimeException
)
1735 Guard
< Mutex
> aGuard( maMutex
);
1739 // --------------------------------------------------------------------
1742 void SAL_CALL
AnimationNode::setVolume( double _volume
) throw (RuntimeException
)
1744 Guard
< Mutex
> aGuard( maMutex
);
1745 if( _volume
!= mfVolume
)
1748 fireChangeListener();
1752 // --------------------------------------------------------------------
1755 sal_Int16 SAL_CALL
AnimationNode::getCommand() throw (RuntimeException
)
1757 Guard
< Mutex
> aGuard( maMutex
);
1761 // --------------------------------------------------------------------
1764 void SAL_CALL
AnimationNode::setCommand( sal_Int16 _command
) throw (RuntimeException
)
1766 Guard
< Mutex
> aGuard( maMutex
);
1767 if( _command
!= mnCommand
)
1769 mnCommand
= _command
;
1770 fireChangeListener();
1774 // --------------------------------------------------------------------
1777 Any SAL_CALL
AnimationNode::getParameter() throw (RuntimeException
)
1779 Guard
< Mutex
> aGuard( maMutex
);
1783 // --------------------------------------------------------------------
1786 void SAL_CALL
AnimationNode::setParameter( const Any
& _parameter
) throw (RuntimeException
)
1788 Guard
< Mutex
> aGuard( maMutex
);
1789 maParameter
= _parameter
;
1790 fireChangeListener();
1793 // --------------------------------------------------------------------
1796 Type SAL_CALL
AnimationNode::getElementType() throw (RuntimeException
)
1798 return ::getCppuType((const Reference
< XAnimationNode
>*)0);
1801 // --------------------------------------------------------------------
1804 sal_Bool SAL_CALL
AnimationNode::hasElements() throw (RuntimeException
)
1806 Guard
< Mutex
> aGuard( maMutex
);
1807 return !maChildren
.empty();
1810 // --------------------------------------------------------------------
1812 // XEnumerationAccess
1813 Reference
< XEnumeration
> SAL_CALL
AnimationNode::createEnumeration()
1814 throw (RuntimeException
)
1816 Guard
< Mutex
> aGuard( maMutex
);
1818 return new TimeContainerEnumeration( maChildren
);
1821 // --------------------------------------------------------------------
1825 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1826 throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1828 Guard
< Mutex
> aGuard( maMutex
);
1830 if( !newChild
.is() || !refChild
.is() )
1831 throw IllegalArgumentException();
1833 ChildList_t::iterator before
= ::std::find(maChildren
.begin(), maChildren
.end(), refChild
);
1834 if( before
== maChildren
.end() )
1835 throw NoSuchElementException();
1837 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1838 throw ElementExistException();
1840 maChildren
.insert( before
, newChild
);
1842 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1843 newChild
->setParent( xThis
);
1848 // --------------------------------------------------------------------
1851 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1852 throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1854 Guard
< Mutex
> aGuard( maMutex
);
1856 if( !newChild
.is() || !refChild
.is() )
1857 throw IllegalArgumentException();
1859 ChildList_t::iterator before
= ::std::find(maChildren
.begin(), maChildren
.end(), refChild
);
1860 if( before
== maChildren
.end() )
1861 throw NoSuchElementException();
1863 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1864 throw ElementExistException();
1867 if( before
!= maChildren
.end() )
1868 maChildren
.insert( before
, newChild
);
1870 maChildren
.push_back( newChild
);
1872 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1873 newChild
->setParent( xThis
);
1878 // --------------------------------------------------------------------
1881 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
)
1882 throw( IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1884 Guard
< Mutex
> aGuard( maMutex
);
1886 if( !newChild
.is() || !oldChild
.is() )
1887 throw IllegalArgumentException();
1889 ChildList_t::iterator replace
= ::std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1890 if( replace
== maChildren
.end() )
1891 throw NoSuchElementException();
1893 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1894 throw ElementExistException();
1896 Reference
< XInterface
> xNull( 0 );
1897 oldChild
->setParent( xNull
);
1899 (*replace
) = newChild
;
1901 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1902 newChild
->setParent( xThis
);
1907 // --------------------------------------------------------------------
1910 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::removeChild( const Reference
< XAnimationNode
>& oldChild
)
1911 throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
)
1913 Guard
< Mutex
> aGuard( maMutex
);
1915 if( !oldChild
.is() )
1916 throw IllegalArgumentException();
1918 ChildList_t::iterator old
= ::std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1919 if( old
== maChildren
.end() )
1920 throw NoSuchElementException();
1922 Reference
< XInterface
> xNull( 0 );
1923 oldChild
->setParent( xNull
);
1925 maChildren
.erase( old
);
1930 // --------------------------------------------------------------------
1933 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::appendChild( const Reference
< XAnimationNode
>& newChild
)
1934 throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1936 Guard
< Mutex
> aGuard( maMutex
);
1938 if( !newChild
.is() )
1939 throw IllegalArgumentException();
1941 if( ::std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1942 throw ElementExistException();
1944 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1945 Reference
< XInterface
> xChild( newChild
);
1947 if( xThis
== xChild
)
1948 throw IllegalArgumentException();
1950 maChildren
.push_back( newChild
);
1952 newChild
->setParent( xThis
);
1957 // --------------------------------------------------------------------
1959 // XIterateContainer
1960 sal_Int16 SAL_CALL
AnimationNode::getIterateType() throw (RuntimeException
)
1962 Guard
< Mutex
> aGuard( maMutex
);
1963 return mnIterateType
;
1966 // --------------------------------------------------------------------
1968 // XIterateContainer
1969 void SAL_CALL
AnimationNode::setIterateType( sal_Int16 _iteratetype
) throw (RuntimeException
)
1971 Guard
< Mutex
> aGuard( maMutex
);
1972 if( _iteratetype
!= mnIterateType
)
1974 mnIterateType
= _iteratetype
;
1975 fireChangeListener();
1979 // --------------------------------------------------------------------
1981 // XIterateContainer
1982 double SAL_CALL
AnimationNode::getIterateInterval() throw (RuntimeException
)
1984 Guard
< Mutex
> aGuard( maMutex
);
1985 return mfIterateInterval
;
1988 // --------------------------------------------------------------------
1990 // XIterateContainer
1991 void SAL_CALL
AnimationNode::setIterateInterval( double _iterateinterval
) throw (RuntimeException
)
1993 Guard
< Mutex
> aGuard( maMutex
);
1994 if( _iterateinterval
!= mfIterateInterval
)
1996 mfIterateInterval
= _iterateinterval
;
1997 fireChangeListener();
2001 // --------------------------------------------------------------------
2004 void SAL_CALL
AnimationNode::addChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
)
2006 maChangeListener
.addInterface( aListener
);
2009 // --------------------------------------------------------------------
2012 void SAL_CALL
AnimationNode::removeChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
)
2014 maChangeListener
.removeInterface(aListener
);
2017 // --------------------------------------------------------------------
2020 ::sal_Int64 SAL_CALL
AnimationNode::getSomething( const Sequence
< ::sal_Int8
>& rId
) throw (RuntimeException
)
2022 if( rId
.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(), rId
.getConstArray(), 16 ) )
2024 return sal::static_int_cast
< sal_Int64
>(reinterpret_cast< sal_IntPtr
>(this));
2035 class theAnimationNodeUnoTunnelId
: public rtl::Static
< UnoTunnelIdInit
, theAnimationNodeUnoTunnelId
> {};
2038 const ::com::sun::star::uno::Sequence
< sal_Int8
> & AnimationNode::getUnoTunnelId()
2040 return theAnimationNodeUnoTunnelId::get().getSeq();
2043 // --------------------------------------------------------------------
2045 void AnimationNode::fireChangeListener()
2047 Guard
< Mutex
> aGuard( maMutex
);
2049 OInterfaceIteratorHelper
aIterator( maChangeListener
);
2050 if( aIterator
.hasMoreElements() )
2052 Reference
< XInterface
> xSource( static_cast<OWeakObject
*>(this), UNO_QUERY
);
2053 Sequence
< ElementChange
> aChanges
;
2054 const ChangesEvent
aEvent( xSource
, makeAny( mxParent
.get() ), aChanges
);
2055 while( aIterator
.hasMoreElements() )
2057 Reference
< XChangesListener
> xListener( aIterator
.next(), UNO_QUERY
);
2058 if( xListener
.is() )
2059 xListener
->changesOccurred( aEvent
);
2063 //fdo#69645 use get() on WeakReference of mxParent to test if mpParent is still valid
2064 if( mpParent
&& mxParent
.get().is() )
2065 mpParent
->fireChangeListener();
2068 // --------------------------------------------------------------------
2070 } // namespace animcore
2072 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */