1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: animcore.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <com/sun/star/util/XCloneable.hpp>
32 #include <com/sun/star/uno/XComponentContext.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/lang/XTypeProvider.hpp>
35 #include <com/sun/star/animations/XAnimateColor.hpp>
36 #include <com/sun/star/animations/XAnimateSet.hpp>
37 #include <com/sun/star/animations/XAnimateMotion.hpp>
38 #include <com/sun/star/animations/XAnimateTransform.hpp>
39 #include <com/sun/star/animations/XTransitionFilter.hpp>
40 #include <com/sun/star/animations/XTimeContainer.hpp>
41 #include <com/sun/star/animations/XIterateContainer.hpp>
42 #include <com/sun/star/animations/XAudio.hpp>
43 #include <com/sun/star/animations/XCommand.hpp>
44 #include <com/sun/star/animations/AnimationNodeType.hpp>
45 #include <com/sun/star/animations/AnimationCalcMode.hpp>
46 #include <com/sun/star/animations/AnimationFill.hpp>
47 #include <com/sun/star/animations/AnimationRestart.hpp>
48 #include <com/sun/star/animations/AnimationColorSpace.hpp>
49 #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
50 #include <com/sun/star/animations/AnimationTransformType.hpp>
51 #include <com/sun/star/animations/TransitionType.hpp>
52 #include <com/sun/star/animations/TransitionSubType.hpp>
53 #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
54 #include <com/sun/star/container/XEnumerationAccess.hpp>
55 #include <com/sun/star/beans/NamedValue.hpp>
56 #include <com/sun/star/util/XChangesNotifier.hpp>
57 #include <com/sun/star/lang/XUnoTunnel.hpp>
58 #include <cppuhelper/interfacecontainer.hxx>
60 #include <cppuhelper/implbase1.hxx>
63 #include <osl/mutex.hxx>
69 using ::rtl::OUString
;
70 using ::cppu::OInterfaceContainerHelper
;
71 using ::cppu::OInterfaceIteratorHelper
;
72 using ::com::sun::star::uno::Any
;
73 using ::com::sun::star::uno::UNO_QUERY
;
74 using ::com::sun::star::uno::XInterface
;
75 using ::com::sun::star::uno::RuntimeException
;
76 using ::com::sun::star::uno::Sequence
;
77 using ::com::sun::star::uno::Reference
;
78 using ::com::sun::star::uno::XComponentContext
;
79 using ::com::sun::star::uno::Exception
;
80 using ::com::sun::star::uno::XWeak
;
81 using ::com::sun::star::uno::Type
;
82 using ::com::sun::star::uno::makeAny
;
83 using ::com::sun::star::lang::NoSupportException
;
84 using ::com::sun::star::lang::IllegalArgumentException
;
85 using ::com::sun::star::lang::WrappedTargetException
;
86 using ::com::sun::star::lang::NoSupportException
;
87 using ::com::sun::star::lang::XServiceInfo
;
88 using ::com::sun::star::lang::XTypeProvider
;
89 using ::com::sun::star::container::NoSuchElementException
;
90 using ::com::sun::star::container::ElementExistException
;
91 using ::com::sun::star::container::XEnumeration
;
92 using ::com::sun::star::container::XEnumerationAccess
;
93 using ::com::sun::star::beans::NamedValue
;
94 using ::com::sun::star::util::XCloneable
;
95 using ::com::sun::star::lang::XUnoTunnel
;
96 using ::com::sun::star::util::XChangesNotifier
;
97 using ::com::sun::star::util::XChangesListener
;
98 using ::com::sun::star::util::ElementChange
;
99 using ::com::sun::star::util::ChangesEvent
;
101 using ::cppu::OWeakObject
;
103 using namespace ::com::sun::star::animations
;
104 using namespace ::com::sun::star::animations::AnimationNodeType
;
109 // ====================================================================
111 typedef ::std::list
< Reference
< XAnimationNode
> > ChildList_t
;
113 // ====================================================================
115 class AnimationNodeBase
: public XAnimateMotion
,
116 public XAnimateColor
,
117 public XTransitionFilter
,
119 public XAnimateTransform
,
120 public XIterateContainer
,
121 public XEnumerationAccess
,
123 public XTypeProvider
,
127 public XChangesNotifier
,
132 // our first, last and only protection from mutli-threads!
136 class AnimationNode
: public AnimationNodeBase
139 AnimationNode( sal_Int16 nNodeType
);
140 AnimationNode( const AnimationNode
& rNode
);
141 virtual ~AnimationNode();
144 virtual Any SAL_CALL
queryInterface( const Type
& aType
) throw (RuntimeException
);
145 virtual void SAL_CALL
acquire() throw ();
146 virtual void SAL_CALL
release() throw ();
149 virtual Sequence
< Type
> SAL_CALL
getTypes() throw (RuntimeException
);
150 virtual Sequence
< sal_Int8
> SAL_CALL
getImplementationId() throw (RuntimeException
);
153 OUString SAL_CALL
getImplementationName() throw();
154 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames(void) throw();
155 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw();
158 virtual Reference
< XInterface
> SAL_CALL
getParent() throw (RuntimeException
);
159 virtual void SAL_CALL
setParent( const Reference
< XInterface
>& Parent
) throw (NoSupportException
, RuntimeException
);
162 virtual Reference
< XCloneable
> SAL_CALL
createClone() throw (RuntimeException
);
165 virtual sal_Int16 SAL_CALL
getType() throw (RuntimeException
);
166 virtual Any SAL_CALL
getBegin() throw (RuntimeException
);
167 virtual void SAL_CALL
setBegin( const Any
& _begin
) throw (RuntimeException
);
168 virtual Any SAL_CALL
getDuration() throw (RuntimeException
);
169 virtual void SAL_CALL
setDuration( const Any
& _duration
) throw (RuntimeException
);
170 virtual Any SAL_CALL
getEnd() throw (RuntimeException
);
171 virtual void SAL_CALL
setEnd( const Any
& _end
) throw (RuntimeException
);
172 virtual Any SAL_CALL
getEndSync() throw (RuntimeException
);
173 virtual void SAL_CALL
setEndSync( const Any
& _endsync
) throw (RuntimeException
);
174 virtual Any SAL_CALL
getRepeatCount() throw (RuntimeException
);
175 virtual void SAL_CALL
setRepeatCount( const Any
& _repeatcount
) throw (RuntimeException
);
176 virtual Any SAL_CALL
getRepeatDuration() throw (RuntimeException
);
177 virtual void SAL_CALL
setRepeatDuration( const Any
& _repeatduration
) throw (RuntimeException
);
178 virtual sal_Int16 SAL_CALL
getFill() throw (RuntimeException
);
179 virtual void SAL_CALL
setFill( sal_Int16 _fill
) throw (RuntimeException
);
180 virtual sal_Int16 SAL_CALL
getFillDefault() throw (RuntimeException
);
181 virtual void SAL_CALL
setFillDefault( sal_Int16 _filldefault
) throw (RuntimeException
);
182 virtual sal_Int16 SAL_CALL
getRestart() throw (RuntimeException
);
183 virtual void SAL_CALL
setRestart( sal_Int16 _restart
) throw (RuntimeException
);
184 virtual sal_Int16 SAL_CALL
getRestartDefault() throw (RuntimeException
);
185 virtual void SAL_CALL
setRestartDefault( sal_Int16 _restartdefault
) throw (RuntimeException
);
186 virtual double SAL_CALL
getAcceleration() throw (RuntimeException
);
187 virtual void SAL_CALL
setAcceleration( double _acceleration
) throw (RuntimeException
);
188 virtual double SAL_CALL
getDecelerate() throw (RuntimeException
);
189 virtual void SAL_CALL
setDecelerate( double _decelerate
) throw (RuntimeException
);
190 virtual sal_Bool SAL_CALL
getAutoReverse() throw (RuntimeException
);
191 virtual void SAL_CALL
setAutoReverse( sal_Bool _autoreverse
) throw (RuntimeException
);
192 virtual Sequence
< NamedValue
> SAL_CALL
getUserData() throw (RuntimeException
);
193 virtual void SAL_CALL
setUserData( const Sequence
< NamedValue
>& _userdata
) throw (RuntimeException
);
196 virtual Any SAL_CALL
getTarget() throw (RuntimeException
);
197 virtual void SAL_CALL
setTarget( const Any
& _target
) throw (RuntimeException
);
198 virtual sal_Int16 SAL_CALL
getSubItem() throw (RuntimeException
);
199 virtual void SAL_CALL
setSubItem( sal_Int16 _subitem
) throw (RuntimeException
);
200 virtual OUString SAL_CALL
getAttributeName() throw (RuntimeException
);
201 virtual void SAL_CALL
setAttributeName( const OUString
& _attribute
) throw (RuntimeException
);
202 virtual Sequence
< Any
> SAL_CALL
getValues() throw (RuntimeException
);
203 virtual void SAL_CALL
setValues( const Sequence
< Any
>& _values
) throw (RuntimeException
);
204 virtual Sequence
< double > SAL_CALL
getKeyTimes() throw (RuntimeException
);
205 virtual void SAL_CALL
setKeyTimes( const Sequence
< double >& _keytimes
) throw (RuntimeException
);
206 virtual sal_Int16 SAL_CALL
getValueType() throw (RuntimeException
);
207 virtual void SAL_CALL
setValueType( sal_Int16 _valuetype
) throw (RuntimeException
);
208 virtual sal_Int16 SAL_CALL
getCalcMode() throw (RuntimeException
);
209 virtual void SAL_CALL
setCalcMode( sal_Int16 _calcmode
) throw (RuntimeException
);
210 virtual sal_Bool SAL_CALL
getAccumulate() throw (RuntimeException
);
211 virtual void SAL_CALL
setAccumulate( sal_Bool _accumulate
) throw (RuntimeException
);
212 virtual sal_Int16 SAL_CALL
getAdditive() throw (RuntimeException
);
213 virtual void SAL_CALL
setAdditive( sal_Int16 _additive
) throw (RuntimeException
);
214 virtual Any SAL_CALL
getFrom() throw (RuntimeException
);
215 virtual void SAL_CALL
setFrom( const Any
& _from
) throw (RuntimeException
);
216 virtual Any SAL_CALL
getTo() throw (RuntimeException
);
217 virtual void SAL_CALL
setTo( const Any
& _to
) throw (RuntimeException
);
218 virtual Any SAL_CALL
getBy() throw (RuntimeException
);
219 virtual void SAL_CALL
setBy( const Any
& _by
) throw (RuntimeException
);
220 virtual Sequence
< TimeFilterPair
> SAL_CALL
getTimeFilter() throw (RuntimeException
);
221 virtual void SAL_CALL
setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
) throw (RuntimeException
);
222 virtual OUString SAL_CALL
getFormula() throw (RuntimeException
);
223 virtual void SAL_CALL
setFormula( const OUString
& _formula
) throw (RuntimeException
);
226 virtual sal_Int16 SAL_CALL
getColorInterpolation() throw (RuntimeException
);
227 virtual void SAL_CALL
setColorInterpolation( sal_Int16 _colorspace
) throw (RuntimeException
);
228 virtual sal_Bool SAL_CALL
getDirection() throw (RuntimeException
);
229 virtual void SAL_CALL
setDirection( sal_Bool _direction
) throw (RuntimeException
);
232 virtual Any SAL_CALL
getPath() throw (RuntimeException
);
233 virtual void SAL_CALL
setPath( const Any
& _path
) throw (RuntimeException
);
234 virtual Any SAL_CALL
getOrigin() throw (RuntimeException
);
235 virtual void SAL_CALL
setOrigin( const Any
& _origin
) throw (RuntimeException
);
238 virtual sal_Int16 SAL_CALL
getTransformType() throw (RuntimeException
);
239 virtual void SAL_CALL
setTransformType( sal_Int16 _transformtype
) throw (RuntimeException
);
242 virtual sal_Int16 SAL_CALL
getTransition() throw (RuntimeException
);
243 virtual void SAL_CALL
setTransition( sal_Int16 _transition
) throw (RuntimeException
);
244 virtual sal_Int16 SAL_CALL
getSubtype() throw (RuntimeException
);
245 virtual void SAL_CALL
setSubtype( sal_Int16 _subtype
) throw (RuntimeException
);
246 virtual sal_Bool SAL_CALL
getMode() throw (RuntimeException
);
247 virtual void SAL_CALL
setMode( sal_Bool _mode
) throw (RuntimeException
);
248 // virtual sal_Bool SAL_CALL getDirection() throw (RuntimeException);
249 // virtual void SAL_CALL setDirection( sal_Bool _direction ) throw (RuntimeException);
250 virtual sal_Int32 SAL_CALL
getFadeColor() throw (RuntimeException
);
251 virtual void SAL_CALL
setFadeColor( sal_Int32 _fadecolor
) throw (RuntimeException
);
254 virtual Any SAL_CALL
getSource() throw (RuntimeException
);
255 virtual void SAL_CALL
setSource( const Any
& _source
) throw (RuntimeException
);
256 virtual double SAL_CALL
getVolume() throw (RuntimeException
);
257 virtual void SAL_CALL
setVolume( double _volume
) throw (RuntimeException
);
261 // virtual Any SAL_CALL getTarget() throw (RuntimeException);
262 // virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
263 virtual sal_Int16 SAL_CALL
getCommand() throw (RuntimeException
);
264 virtual void SAL_CALL
setCommand( sal_Int16 _command
) throw (RuntimeException
);
265 virtual Any SAL_CALL
getParameter() throw (RuntimeException
);
266 virtual void SAL_CALL
setParameter( const Any
& _parameter
) throw (RuntimeException
);
269 virtual Type SAL_CALL
getElementType() throw (RuntimeException
);
270 virtual sal_Bool SAL_CALL
hasElements() throw (RuntimeException
);
272 // XEnumerationAccess
273 virtual Reference
< XEnumeration
> SAL_CALL
createEnumeration() throw (RuntimeException
);
276 virtual Reference
< XAnimationNode
> SAL_CALL
insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
277 virtual Reference
< XAnimationNode
> SAL_CALL
insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
278 virtual Reference
< XAnimationNode
> SAL_CALL
replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
) throw( IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
279 virtual Reference
< XAnimationNode
> SAL_CALL
removeChild( const Reference
< XAnimationNode
>& oldChild
) throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
);
280 virtual Reference
< XAnimationNode
> SAL_CALL
appendChild( const Reference
< XAnimationNode
>& newChild
) throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
);
283 virtual sal_Int16 SAL_CALL
getIterateType() throw (RuntimeException
);
284 virtual void SAL_CALL
setIterateType( sal_Int16 _iteratetype
) throw (RuntimeException
);
285 virtual double SAL_CALL
getIterateInterval() throw (RuntimeException
);
286 virtual void SAL_CALL
setIterateInterval( double _iterateinterval
) throw (RuntimeException
);
289 virtual void SAL_CALL
addChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
);
290 virtual void SAL_CALL
removeChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
);
293 virtual ::sal_Int64 SAL_CALL
getSomething( const Sequence
< ::sal_Int8
>& aIdentifier
) throw (RuntimeException
);
295 static const Sequence
< sal_Int8
> & getUnoTunnelId();
296 void fireChangeListener();
299 OInterfaceContainerHelper maChangeListener
;
301 static void initTypeProvider( sal_Int16 nNodeType
) throw();
303 const sal_Int16 mnNodeType
;
306 static Sequence
< Type
>* mpTypes
[12];
307 static Sequence
< sal_Int8
>* mpId
[12];
309 // attributes for the XAnimationNode interface implementation
310 Any maBegin
, maDuration
, maEnd
, maEndSync
, maRepeatCount
, maRepeatDuration
;
311 sal_Int16 mnFill
, mnFillDefault
, mnRestart
, mnRestartDefault
;
312 double mfAcceleration
, mfDecelerate
;
313 sal_Bool mbAutoReverse
;
314 Sequence
< NamedValue
> maUserData
;
316 // parent interface for XChild interface implementation
317 Reference
<XInterface
> mxParent
;
318 AnimationNode
* mpParent
;
320 // attributes for XAnimate
322 OUString maAttributeName
, maFormula
;
323 Sequence
< Any
> maValues
;
324 Sequence
< double > maKeyTimes
;
325 sal_Int16 mnValueType
, mnSubItem
;
326 sal_Int16 mnCalcMode
, mnAdditive
;
327 sal_Bool mbAccumulate
;
328 Any maFrom
, maTo
, maBy
;
329 Sequence
< TimeFilterPair
> maTimeFilter
;
331 // attributes for XAnimateColor
332 sal_Int16 mnColorSpace
;
333 sal_Bool mbDirection
;
335 // atributes for XAnimateMotion
336 Any maPath
, maOrigin
;
338 // attributes for XAnimateTransform
339 sal_Int16 mnTransformType
;
341 // attributes for XTransitionFilter
342 sal_Int16 mnTransition
;
345 sal_Int32 mnFadeColor
;
355 sal_Int16 mnIterateType
;
356 double mfIterateInterval
;
358 /** sorted list of child nodes for XTimeContainer*/
359 ChildList_t maChilds
;
362 // ====================================================================
364 class TimeContainerEnumeration
: public ::cppu::WeakImplHelper1
< XEnumeration
>
367 TimeContainerEnumeration( const ChildList_t
&rChilds
);
368 virtual ~TimeContainerEnumeration();
371 virtual sal_Bool SAL_CALL
hasMoreElements() throw (RuntimeException
);
372 virtual Any SAL_CALL
nextElement( ) throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
);
375 /** sorted list of child nodes */
376 ChildList_t maChilds
;
378 /** current iteration position */
379 ChildList_t::iterator maIter
;
381 /** our first, last and only protection from mutli-threads! */
385 TimeContainerEnumeration::TimeContainerEnumeration( const ChildList_t
&rChilds
)
386 : maChilds( rChilds
)
388 maIter
= maChilds
.begin();
391 TimeContainerEnumeration::~TimeContainerEnumeration()
396 sal_Bool SAL_CALL
TimeContainerEnumeration::hasMoreElements() throw (RuntimeException
)
398 Guard
< Mutex
> aGuard( maMutex
);
400 return maIter
!= maChilds
.end();
403 Any SAL_CALL
TimeContainerEnumeration::nextElement()
404 throw (NoSuchElementException
, WrappedTargetException
, RuntimeException
)
406 Guard
< Mutex
> aGuard( maMutex
);
408 if( maIter
== maChilds
.end() )
409 throw NoSuchElementException();
411 return makeAny( (*maIter
++) );
414 // ====================================================================
416 Sequence
< Type
>* AnimationNode::mpTypes
[] = { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
417 Sequence
< sal_Int8
>* AnimationNode::mpId
[] = { NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
};
419 AnimationNode::AnimationNode( sal_Int16 nNodeType
)
420 : maChangeListener(maMutex
),
421 mnNodeType( nNodeType
),
422 mnFill( AnimationFill::DEFAULT
),
423 mnFillDefault( AnimationFill::INHERIT
),
424 mnRestart( AnimationRestart:: DEFAULT
),
425 mnRestartDefault( AnimationRestart:: INHERIT
),
426 mfAcceleration( 0.0 ),
428 mbAutoReverse( sal_False
),
432 mnCalcMode( (nNodeType
== AnimationNodeType::ANIMATEMOTION
) ? AnimationCalcMode::PACED
: AnimationCalcMode::LINEAR
),
433 mnAdditive(AnimationAdditiveMode::REPLACE
),
434 mbAccumulate(sal_False
),
435 mnColorSpace( AnimationColorSpace::RGB
),
436 mbDirection( sal_True
),
437 mnTransformType( AnimationTransformType::TRANSLATE
),
438 mnTransition(TransitionType::BARWIPE
),
439 mnSubtype(TransitionSubType::DEFAULT
),
444 mnIterateType( ::com::sun::star::presentation::ShapeAnimationSubType::AS_WHOLE
),
445 mfIterateInterval(0.0)
447 OSL_ENSURE((sal_uInt32
)nNodeType
< sizeof(mpTypes
)/sizeof(Sequence
<Type
>*), "NodeType out of range");
450 AnimationNode::AnimationNode( const AnimationNode
& rNode
)
451 : AnimationNodeBase(),
452 maChangeListener(maMutex
),
453 mnNodeType( rNode
.mnNodeType
),
455 // attributes for the XAnimationNode interface implementation
456 maBegin( rNode
.maBegin
),
457 maDuration( rNode
.maDuration
),
458 maEnd( rNode
.maEnd
),
459 maEndSync( rNode
.maEndSync
),
460 maRepeatCount( rNode
.maRepeatCount
),
461 maRepeatDuration( rNode
.maRepeatDuration
),
462 mnFill( rNode
.mnFill
),
463 mnFillDefault( rNode
.mnFillDefault
),
464 mnRestart( rNode
.mnRestart
),
465 mnRestartDefault( rNode
.mnRestartDefault
),
466 mfAcceleration( rNode
.mfAcceleration
),
467 mfDecelerate( rNode
.mfDecelerate
),
468 mbAutoReverse( rNode
.mbAutoReverse
),
469 maUserData( rNode
.maUserData
),
472 // attributes for XAnimate
473 maTarget( rNode
.maTarget
),
474 maAttributeName( rNode
.maAttributeName
),
475 maFormula( rNode
.maFormula
),
476 maValues( rNode
.maValues
),
477 maKeyTimes( rNode
.maKeyTimes
),
478 mnValueType( rNode
.mnValueType
),
479 mnSubItem( rNode
.mnSubItem
),
480 mnCalcMode( rNode
.mnCalcMode
),
481 mnAdditive( rNode
.mnAdditive
),
482 mbAccumulate( rNode
.mbAccumulate
),
483 maFrom( rNode
.maFrom
),
486 maTimeFilter( rNode
.maTimeFilter
),
488 // attributes for XAnimateColor
489 mnColorSpace( rNode
.mnColorSpace
),
490 mbDirection( rNode
.mbDirection
),
492 // atributes for XAnimateMotion
493 maPath( rNode
.maPath
),
494 maOrigin( rNode
.maOrigin
),
496 // attributes for XAnimateTransform
497 mnTransformType( rNode
.mnTransformType
),
499 // attributes for XTransitionFilter
500 mnTransition( rNode
.mnTransition
),
501 mnSubtype( rNode
.mnSubtype
),
502 mbMode( rNode
.mbMode
),
503 mnFadeColor( rNode
.mnFadeColor
),
506 mfVolume( rNode
.mfVolume
),
509 mnCommand( rNode
.mnCommand
),
510 maParameter( rNode
.maParameter
),
513 mnIterateType( rNode
.mnIterateType
),
514 mfIterateInterval( rNode
.mfIterateInterval
)
518 AnimationNode::~AnimationNode()
522 // --------------------------------------------------------------------
524 #define IMPL_NODE_FACTORY(N,IN,SN)\
525 Reference< XInterface > SAL_CALL createInstance_##N( const Reference< XComponentContext > & ) throw (Exception)\
527 return Reference < XInterface > ( SAL_STATIC_CAST( ::cppu::OWeakObject * , new AnimationNode( N ) ) );\
529 OUString getImplementationName_##N()\
531 return OUString( RTL_CONSTASCII_USTRINGPARAM ( IN ) );\
533 Sequence<OUString> getSupportedServiceNames_##N(void)\
535 Sequence<OUString> aRet(1);\
536 aRet.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SN ));\
540 IMPL_NODE_FACTORY( PAR
, "animcore::ParallelTimeContainer", "com.sun.star.animations.ParallelTimeContainer" )
541 IMPL_NODE_FACTORY( SEQ
, "animcore::SequenceTimeContainer", "com.sun.star.animations.SequenceTimeContainer" )
542 IMPL_NODE_FACTORY( ITERATE
, "animcore::IterateContainer", "com.sun.star.animations.IterateContainer" )
543 IMPL_NODE_FACTORY( ANIMATE
, "animcore::Animate", "com.sun.star.animations.Animate" )
544 IMPL_NODE_FACTORY( SET
, "animcore::AnimateSet", "com.sun.star.animations.AnimateSet" )
545 IMPL_NODE_FACTORY( ANIMATECOLOR
, "animcore::AnimateColor", "com.sun.star.animations.AnimateColor" )
546 IMPL_NODE_FACTORY( ANIMATEMOTION
, "animcore::AnimateMotion", "com.sun.star.animations.AnimateMotion" )
547 IMPL_NODE_FACTORY( ANIMATETRANSFORM
, "animcore::AnimateTransform", "com.sun.star.animations.AnimateTransform" )
548 IMPL_NODE_FACTORY( TRANSITIONFILTER
, "animcore::TransitionFilter", "com.sun.star.animations.TransitionFilter" )
549 IMPL_NODE_FACTORY( AUDIO
, "animcore::Audio", "com.sun.star.animations.Audio" );
550 IMPL_NODE_FACTORY( COMMAND
, "animcore::Command", "com.sun.star.animations.Command" );
552 // --------------------------------------------------------------------
555 Any SAL_CALL
AnimationNode::queryInterface( const Type
& aType
) throw (RuntimeException
)
557 Any
aRet( ::cppu::queryInterface(
559 static_cast< XServiceInfo
* >( this ),
560 static_cast< XTypeProvider
* >( this ),
561 static_cast< XChild
* >( static_cast< XTimeContainer
* >(this) ),
562 static_cast< XCloneable
* >( this ),
563 static_cast< XAnimationNode
* >( static_cast< XTimeContainer
* >(this) ),
564 static_cast< XInterface
* >(static_cast< OWeakObject
* >(this)),
565 static_cast< XWeak
* >(static_cast< OWeakObject
* >(this)),
566 static_cast< XChangesNotifier
* >( this ),
567 static_cast< XUnoTunnel
* >( this ) ) );
573 case AnimationNodeType::PAR
:
574 case AnimationNodeType::SEQ
:
575 aRet
= ::cppu::queryInterface(
577 static_cast< XTimeContainer
* >( this ),
578 static_cast< XEnumerationAccess
* >( this ),
579 static_cast< XElementAccess
* >( this ) );
581 case AnimationNodeType::ITERATE
:
582 aRet
= ::cppu::queryInterface(
584 static_cast< XTimeContainer
* >( this ),
585 static_cast< XIterateContainer
* >( this ),
586 static_cast< XEnumerationAccess
* >( this ),
587 static_cast< XElementAccess
* >( this ) );
589 case AnimationNodeType::ANIMATE
:
590 aRet
= ::cppu::queryInterface(
592 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ) );
594 case AnimationNodeType::ANIMATEMOTION
:
595 aRet
= ::cppu::queryInterface(
597 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ),
598 static_cast< XAnimateMotion
* >( this ) );
600 case AnimationNodeType::ANIMATECOLOR
:
601 aRet
= ::cppu::queryInterface(
603 static_cast< XAnimate
* >( static_cast< XAnimateColor
* >(this) ),
604 static_cast< XAnimateColor
* >( this ) );
606 case AnimationNodeType::SET
:
607 aRet
= ::cppu::queryInterface(
609 static_cast< XAnimate
* >( static_cast< XAnimateSet
* >(this) ),
610 static_cast< XAnimateSet
* >( this ) );
612 case AnimationNodeType::ANIMATETRANSFORM
:
613 aRet
= ::cppu::queryInterface(
615 static_cast< XAnimate
* >( static_cast< XAnimateTransform
* >(this) ),
616 static_cast< XAnimateTransform
* >( this ) );
618 case AnimationNodeType::AUDIO
:
619 aRet
= ::cppu::queryInterface(
621 static_cast< XAudio
* >( static_cast< XAudio
* >(this) ) );
623 case AnimationNodeType::COMMAND
:
624 aRet
= ::cppu::queryInterface(
626 static_cast< XCommand
* >( static_cast< XCommand
* >(this) ) );
628 case AnimationNodeType::TRANSITIONFILTER
:
629 aRet
= ::cppu::queryInterface(
631 static_cast< XAnimate
* >( static_cast< XTransitionFilter
* >(this) ),
632 static_cast< XTransitionFilter
* >( this ) );
637 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( aType
);
640 // --------------------------------------------------------------------
642 void AnimationNode::initTypeProvider( sal_Int16 nNodeType
) throw()
644 ::osl::MutexGuard
aGuard( ::osl::Mutex::getGlobalMutex() );
646 if(! mpTypes
[nNodeType
] )
649 mpId
[nNodeType
] = new Sequence
< sal_Int8
>( 16 );
650 rtl_createUuid( (sal_uInt8
*)mpId
[nNodeType
]->getArray(), 0, sal_True
);
652 static sal_Int32 type_numbers
[] =
662 8, // ANIMATETRANSFORM
663 8, // TRANSITIONFILTER
669 Sequence
< Type
> * types
= new Sequence
< Type
>( type_numbers
[nNodeType
] );
670 Type
* pTypeAr
= types
->getArray();
673 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XWeak
> *)0 );
674 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XChild
> *)0 );
675 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XCloneable
> *)0 );
676 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTypeProvider
> *)0 );
677 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XServiceInfo
> *)0 );
678 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XUnoTunnel
> *)0 );
679 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XChangesNotifier
> *)0 );
683 case AnimationNodeType::PAR
:
684 case AnimationNodeType::SEQ
:
685 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTimeContainer
> *)0 );
686 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XEnumerationAccess
> *)0 );
688 case AnimationNodeType::ITERATE
:
689 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XIterateContainer
> *)0 );
690 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XEnumerationAccess
> *)0 );
692 case AnimationNodeType::ANIMATE
:
693 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimate
> *)0 );
695 case AnimationNodeType::ANIMATEMOTION
:
696 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateMotion
> *)0 );
698 case AnimationNodeType::ANIMATECOLOR
:
699 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateColor
> *)0 );
701 case AnimationNodeType::ANIMATETRANSFORM
:
702 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateTransform
> *)0 );
704 case AnimationNodeType::SET
:
705 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAnimateSet
> *)0 );
707 case AnimationNodeType::TRANSITIONFILTER
:
708 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XTransitionFilter
> *)0 );
710 case AnimationNodeType::AUDIO
:
711 pTypeAr
[nPos
++] = ::getCppuType( (const Reference
< XAudio
> *)0 );
713 case AnimationNodeType::COMMAND
:
714 pTypeAr
[nPos
++] = ::getCppuType( ( const Reference
< XCommand
> *)0 );
717 mpTypes
[nNodeType
] = types
;
721 // --------------------------------------------------------------------
723 Sequence
< Type
> AnimationNode::getTypes() throw (RuntimeException
)
725 if (! mpTypes
[mnNodeType
])
726 initTypeProvider(mnNodeType
);
727 return *mpTypes
[mnNodeType
];
729 // --------------------------------------------------------------------
731 Sequence
< sal_Int8
> AnimationNode::getImplementationId() throw (RuntimeException
)
733 if (! mpId
[mnNodeType
])
734 initTypeProvider(mnNodeType
);
735 return *mpId
[mnNodeType
];
738 // --------------------------------------------------------------------
741 void SAL_CALL
AnimationNode::acquire( ) throw ()
743 OWeakObject::acquire();
746 // --------------------------------------------------------------------
749 void SAL_CALL
AnimationNode::release( ) throw ()
751 OWeakObject::acquire();
754 // --------------------------------------------------------------------
757 OUString
AnimationNode::getImplementationName() throw()
761 case AnimationNodeType::PAR
:
762 return getImplementationName_PAR();
763 case AnimationNodeType::SEQ
:
764 return getImplementationName_SEQ();
765 case AnimationNodeType::ITERATE
:
766 return getImplementationName_ITERATE();
767 case AnimationNodeType::SET
:
768 return getImplementationName_SET();
769 case AnimationNodeType::ANIMATECOLOR
:
770 return getImplementationName_ANIMATECOLOR();
771 case AnimationNodeType::ANIMATEMOTION
:
772 return getImplementationName_ANIMATEMOTION();
773 case AnimationNodeType::TRANSITIONFILTER
:
774 return getImplementationName_TRANSITIONFILTER();
775 case AnimationNodeType::ANIMATETRANSFORM
:
776 return getImplementationName_ANIMATETRANSFORM();
777 case AnimationNodeType::AUDIO
:
778 return getImplementationName_AUDIO();
779 case AnimationNodeType::COMMAND
:
780 return getImplementationName_COMMAND();
781 case AnimationNodeType::ANIMATE
:
783 return getImplementationName_ANIMATE();
787 // --------------------------------------------------------------------
790 sal_Bool
AnimationNode::supportsService(const OUString
& ServiceName
) throw()
792 Sequence
< OUString
> aSNL( getSupportedServiceNames() );
793 const OUString
* pArray
= aSNL
.getConstArray();
795 for( sal_Int32 i
= 0; i
< aSNL
.getLength(); i
++ )
796 if( pArray
[i
] == ServiceName
)
802 // --------------------------------------------------------------------
805 Sequence
< OUString
> AnimationNode::getSupportedServiceNames(void) throw()
809 case AnimationNodeType::PAR
:
810 return getSupportedServiceNames_PAR();
811 case AnimationNodeType::SEQ
:
812 return getSupportedServiceNames_SEQ();
813 case AnimationNodeType::ITERATE
:
814 return getSupportedServiceNames_ITERATE();
815 case AnimationNodeType::SET
:
816 return getSupportedServiceNames_SET();
817 case AnimationNodeType::ANIMATECOLOR
:
818 return getSupportedServiceNames_ANIMATECOLOR();
819 case AnimationNodeType::ANIMATEMOTION
:
820 return getSupportedServiceNames_ANIMATEMOTION();
821 case AnimationNodeType::TRANSITIONFILTER
:
822 return getSupportedServiceNames_TRANSITIONFILTER();
823 case AnimationNodeType::AUDIO
:
824 return getSupportedServiceNames_AUDIO();
825 case AnimationNodeType::COMMAND
:
826 return getSupportedServiceNames_COMMAND();
827 case AnimationNodeType::ANIMATE
:
829 return getSupportedServiceNames_ANIMATE();
833 // --------------------------------------------------------------------
836 sal_Int16 SAL_CALL
AnimationNode::getType() throw (RuntimeException
)
838 Guard
< Mutex
> aGuard( maMutex
);
842 // --------------------------------------------------------------------
845 Any SAL_CALL
AnimationNode::getBegin() throw (RuntimeException
)
847 Guard
< Mutex
> aGuard( maMutex
);
851 // --------------------------------------------------------------------
854 void SAL_CALL
AnimationNode::setBegin( const Any
& _begin
) throw (RuntimeException
)
856 Guard
< Mutex
> aGuard( maMutex
);
857 if( _begin
!= maBegin
)
860 fireChangeListener();
864 // --------------------------------------------------------------------
867 Any SAL_CALL
AnimationNode::getDuration() throw (RuntimeException
)
869 Guard
< Mutex
> aGuard( maMutex
);
873 // --------------------------------------------------------------------
876 void SAL_CALL
AnimationNode::setDuration( const Any
& _duration
) throw (RuntimeException
)
878 Guard
< Mutex
> aGuard( maMutex
);
879 if( _duration
!= maDuration
)
881 maDuration
= _duration
;
882 fireChangeListener();
886 // --------------------------------------------------------------------
889 Any SAL_CALL
AnimationNode::getEnd() throw (RuntimeException
)
891 Guard
< Mutex
> aGuard( maMutex
);
895 // --------------------------------------------------------------------
898 void SAL_CALL
AnimationNode::setEnd( const Any
& _end
) throw (RuntimeException
)
900 Guard
< Mutex
> aGuard( maMutex
);
904 fireChangeListener();
908 // --------------------------------------------------------------------
911 Any SAL_CALL
AnimationNode::getEndSync() throw (RuntimeException
)
913 Guard
< Mutex
> aGuard( maMutex
);
917 // --------------------------------------------------------------------
920 void SAL_CALL
AnimationNode::setEndSync( const Any
& _endsync
) throw (RuntimeException
)
922 Guard
< Mutex
> aGuard( maMutex
);
923 if( _endsync
!= maEndSync
)
925 maEndSync
= _endsync
;
926 fireChangeListener();
930 // --------------------------------------------------------------------
933 Any SAL_CALL
AnimationNode::getRepeatCount() throw (RuntimeException
)
935 Guard
< Mutex
> aGuard( maMutex
);
936 return maRepeatCount
;
939 // --------------------------------------------------------------------
942 void SAL_CALL
AnimationNode::setRepeatCount( const Any
& _repeatcount
) throw (RuntimeException
)
944 Guard
< Mutex
> aGuard( maMutex
);
945 if( _repeatcount
!= maRepeatCount
)
947 maRepeatCount
= _repeatcount
;
948 fireChangeListener();
952 // --------------------------------------------------------------------
955 Any SAL_CALL
AnimationNode::getRepeatDuration() throw (RuntimeException
)
957 Guard
< Mutex
> aGuard( maMutex
);
958 return maRepeatDuration
;
961 // --------------------------------------------------------------------
964 void SAL_CALL
AnimationNode::setRepeatDuration( const Any
& _repeatduration
) throw (RuntimeException
)
966 Guard
< Mutex
> aGuard( maMutex
);
967 if( _repeatduration
!= maRepeatDuration
)
969 maRepeatDuration
= _repeatduration
;
970 fireChangeListener();
974 // --------------------------------------------------------------------
977 sal_Int16 SAL_CALL
AnimationNode::getFill() throw (RuntimeException
)
979 Guard
< Mutex
> aGuard( maMutex
);
983 // --------------------------------------------------------------------
986 void SAL_CALL
AnimationNode::setFill( sal_Int16 _fill
) throw (RuntimeException
)
988 Guard
< Mutex
> aGuard( maMutex
);
989 if( _fill
!= mnFill
)
992 fireChangeListener();
996 // --------------------------------------------------------------------
999 sal_Int16 SAL_CALL
AnimationNode::getFillDefault() throw (RuntimeException
)
1001 Guard
< Mutex
> aGuard( maMutex
);
1002 return mnFillDefault
;
1005 // --------------------------------------------------------------------
1008 void SAL_CALL
AnimationNode::setFillDefault( sal_Int16 _filldefault
) throw (RuntimeException
)
1010 Guard
< Mutex
> aGuard( maMutex
);
1011 if( _filldefault
!= mnFillDefault
)
1013 mnFillDefault
= _filldefault
;
1014 fireChangeListener();
1018 // --------------------------------------------------------------------
1021 sal_Int16 SAL_CALL
AnimationNode::getRestart() throw (RuntimeException
)
1023 Guard
< Mutex
> aGuard( maMutex
);
1027 // --------------------------------------------------------------------
1030 void SAL_CALL
AnimationNode::setRestart( sal_Int16 _restart
) throw (RuntimeException
)
1032 Guard
< Mutex
> aGuard( maMutex
);
1033 if( _restart
!= mnRestart
)
1035 mnRestart
= _restart
;
1036 fireChangeListener();
1040 // --------------------------------------------------------------------
1043 sal_Int16 SAL_CALL
AnimationNode::getRestartDefault() throw (RuntimeException
)
1045 Guard
< Mutex
> aGuard( maMutex
);
1046 return mnRestartDefault
;
1049 // --------------------------------------------------------------------
1052 void SAL_CALL
AnimationNode::setRestartDefault( sal_Int16 _restartdefault
) throw (RuntimeException
)
1054 Guard
< Mutex
> aGuard( maMutex
);
1055 if( _restartdefault
!= mnRestartDefault
)
1057 mnRestartDefault
= _restartdefault
;
1058 fireChangeListener();
1062 // --------------------------------------------------------------------
1065 double SAL_CALL
AnimationNode::getAcceleration() throw (RuntimeException
)
1067 Guard
< Mutex
> aGuard( maMutex
);
1068 return mfAcceleration
;
1071 // --------------------------------------------------------------------
1074 void SAL_CALL
AnimationNode::setAcceleration( double _acceleration
) throw (RuntimeException
)
1076 Guard
< Mutex
> aGuard( maMutex
);
1077 if( _acceleration
!= mfAcceleration
)
1079 mfAcceleration
= _acceleration
;
1080 fireChangeListener();
1084 // --------------------------------------------------------------------
1087 double SAL_CALL
AnimationNode::getDecelerate() throw (RuntimeException
)
1089 Guard
< Mutex
> aGuard( maMutex
);
1090 return mfDecelerate
;
1093 // --------------------------------------------------------------------
1096 void SAL_CALL
AnimationNode::setDecelerate( double _decelerate
) throw (RuntimeException
)
1098 Guard
< Mutex
> aGuard( maMutex
);
1099 if( _decelerate
!= mfDecelerate
)
1101 mfDecelerate
= _decelerate
;
1102 fireChangeListener();
1106 // --------------------------------------------------------------------
1109 sal_Bool SAL_CALL
AnimationNode::getAutoReverse() throw (RuntimeException
)
1111 Guard
< Mutex
> aGuard( maMutex
);
1112 return mbAutoReverse
;
1115 // --------------------------------------------------------------------
1118 void SAL_CALL
AnimationNode::setAutoReverse( sal_Bool _autoreverse
) throw (RuntimeException
)
1120 Guard
< Mutex
> aGuard( maMutex
);
1121 if( _autoreverse
!= mbAutoReverse
)
1123 mbAutoReverse
= _autoreverse
;
1124 fireChangeListener();
1128 // --------------------------------------------------------------------
1130 Sequence
< NamedValue
> SAL_CALL
AnimationNode::getUserData() throw (RuntimeException
)
1132 Guard
< Mutex
> aGuard( maMutex
);
1136 // --------------------------------------------------------------------
1138 void SAL_CALL
AnimationNode::setUserData( const Sequence
< NamedValue
>& _userdata
) throw (RuntimeException
)
1140 Guard
< Mutex
> aGuard( maMutex
);
1141 maUserData
= _userdata
;
1142 fireChangeListener();
1145 // --------------------------------------------------------------------
1148 Reference
< XInterface
> SAL_CALL
AnimationNode::getParent() throw (RuntimeException
)
1150 Guard
< Mutex
> aGuard( maMutex
);
1154 // --------------------------------------------------------------------
1157 void SAL_CALL
AnimationNode::setParent( const Reference
< XInterface
>& Parent
) throw (NoSupportException
, RuntimeException
)
1159 Guard
< Mutex
> aGuard( maMutex
);
1160 if( Parent
!= mxParent
)
1165 Reference
< XUnoTunnel
> xTunnel( mxParent
, UNO_QUERY
);
1167 mpParent
= reinterpret_cast< AnimationNode
* >( sal::static_int_cast
< sal_IntPtr
>(xTunnel
->getSomething( getUnoTunnelId() )));
1169 fireChangeListener();
1173 // --------------------------------------------------------------------
1176 Reference
< XCloneable
> SAL_CALL
AnimationNode::createClone() throw (RuntimeException
)
1178 Guard
< Mutex
> aGuard( maMutex
);
1180 Reference
< XCloneable
> xNewNode
;
1183 xNewNode
= new AnimationNode( *this );
1185 if( maChilds
.size() )
1187 Reference
< XTimeContainer
> xContainer( xNewNode
, UNO_QUERY
);
1188 if( xContainer
.is() )
1190 ChildList_t::iterator
aIter( maChilds
.begin() );
1191 ChildList_t::iterator
aEnd( maChilds
.end() );
1192 while( aIter
!= aEnd
)
1194 Reference
< XCloneable
> xCloneable((*aIter
++), UNO_QUERY
);
1195 if( xCloneable
.is() ) try
1197 Reference
< XAnimationNode
> xNewChildNode( xCloneable
->createClone(), UNO_QUERY
);
1198 if( xNewChildNode
.is() )
1199 xContainer
->appendChild( xNewChildNode
);
1201 catch( Exception
& e
)
1204 OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1210 catch( Exception
& e
)
1213 OSL_TRACE( "animations::AnimationNode::createClone(), exception caught!" );
1219 // --------------------------------------------------------------------
1222 Any SAL_CALL
AnimationNode::getTarget()
1223 throw (RuntimeException
)
1225 Guard
< Mutex
> aGuard( maMutex
);
1229 // --------------------------------------------------------------------
1232 void SAL_CALL
AnimationNode::setTarget( const Any
& _target
)
1233 throw (RuntimeException
)
1235 Guard
< Mutex
> aGuard( maMutex
);
1236 if( _target
!= maTarget
)
1239 fireChangeListener();
1243 // --------------------------------------------------------------------
1246 OUString SAL_CALL
AnimationNode::getAttributeName() throw (RuntimeException
)
1248 Guard
< Mutex
> aGuard( maMutex
);
1249 return maAttributeName
;
1252 // --------------------------------------------------------------------
1255 void SAL_CALL
AnimationNode::setAttributeName( const OUString
& _attribute
)
1256 throw (RuntimeException
)
1258 Guard
< Mutex
> aGuard( maMutex
);
1259 if( _attribute
!= maAttributeName
)
1261 maAttributeName
= _attribute
;
1262 fireChangeListener();
1266 // --------------------------------------------------------------------
1269 Sequence
< Any
> SAL_CALL
AnimationNode::getValues()
1270 throw (RuntimeException
)
1272 Guard
< Mutex
> aGuard( maMutex
);
1276 // --------------------------------------------------------------------
1279 void SAL_CALL
AnimationNode::setValues( const Sequence
< Any
>& _values
)
1280 throw (RuntimeException
)
1282 Guard
< Mutex
> aGuard( maMutex
);
1284 fireChangeListener();
1287 // --------------------------------------------------------------------
1290 sal_Int16 SAL_CALL
AnimationNode::getSubItem() throw (RuntimeException
)
1292 Guard
< Mutex
> aGuard( maMutex
);
1296 // --------------------------------------------------------------------
1299 void SAL_CALL
AnimationNode::setSubItem( sal_Int16 _subitem
) throw (RuntimeException
)
1301 Guard
< Mutex
> aGuard( maMutex
);
1302 if( _subitem
!= mnSubItem
)
1304 mnSubItem
= _subitem
;
1305 fireChangeListener();
1309 // --------------------------------------------------------------------
1312 Sequence
< double > SAL_CALL
AnimationNode::getKeyTimes() throw (RuntimeException
)
1314 Guard
< Mutex
> aGuard( maMutex
);
1318 // --------------------------------------------------------------------
1321 void SAL_CALL
AnimationNode::setKeyTimes( const Sequence
< double >& _keytimes
) throw (RuntimeException
)
1323 Guard
< Mutex
> aGuard( maMutex
);
1324 maKeyTimes
= _keytimes
;
1325 fireChangeListener();
1328 // --------------------------------------------------------------------
1331 sal_Int16 SAL_CALL
AnimationNode::getValueType() throw (RuntimeException
)
1333 Guard
< Mutex
> aGuard( maMutex
);
1337 // --------------------------------------------------------------------
1339 void SAL_CALL
AnimationNode::setValueType( sal_Int16 _valuetype
) throw (RuntimeException
)
1341 Guard
< Mutex
> aGuard( maMutex
);
1342 if( _valuetype
!= mnValueType
)
1344 mnValueType
= _valuetype
;
1345 fireChangeListener();
1349 // --------------------------------------------------------------------
1352 sal_Int16 SAL_CALL
AnimationNode::getCalcMode()
1353 throw (RuntimeException
)
1355 Guard
< Mutex
> aGuard( maMutex
);
1359 // --------------------------------------------------------------------
1362 void SAL_CALL
AnimationNode::setCalcMode( sal_Int16 _calcmode
)
1363 throw (RuntimeException
)
1365 Guard
< Mutex
> aGuard( maMutex
);
1366 if( _calcmode
!= mnCalcMode
)
1368 mnCalcMode
= _calcmode
;
1369 fireChangeListener();
1373 // --------------------------------------------------------------------
1376 sal_Bool SAL_CALL
AnimationNode::getAccumulate()
1377 throw (RuntimeException
)
1379 Guard
< Mutex
> aGuard( maMutex
);
1380 return mbAccumulate
;
1383 // --------------------------------------------------------------------
1386 void SAL_CALL
AnimationNode::setAccumulate( sal_Bool _accumulate
)
1387 throw (RuntimeException
)
1389 Guard
< Mutex
> aGuard( maMutex
);
1390 if( _accumulate
!= mbAccumulate
)
1392 mbAccumulate
= _accumulate
;
1393 fireChangeListener();
1397 // --------------------------------------------------------------------
1400 sal_Int16 SAL_CALL
AnimationNode::getAdditive()
1401 throw (RuntimeException
)
1403 Guard
< Mutex
> aGuard( maMutex
);
1407 // --------------------------------------------------------------------
1410 void SAL_CALL
AnimationNode::setAdditive( sal_Int16 _additive
)
1411 throw (RuntimeException
)
1413 Guard
< Mutex
> aGuard( maMutex
);
1414 if( _additive
!= mnAdditive
)
1416 mnAdditive
= _additive
;
1417 fireChangeListener();
1421 // --------------------------------------------------------------------
1424 Any SAL_CALL
AnimationNode::getFrom()
1425 throw (RuntimeException
)
1427 Guard
< Mutex
> aGuard( maMutex
);
1431 // --------------------------------------------------------------------
1434 void SAL_CALL
AnimationNode::setFrom( const Any
& _from
)
1435 throw (RuntimeException
)
1437 Guard
< Mutex
> aGuard( maMutex
);
1438 if( _from
!= maFrom
)
1441 fireChangeListener();
1445 // --------------------------------------------------------------------
1448 Any SAL_CALL
AnimationNode::getTo()
1449 throw (RuntimeException
)
1451 Guard
< Mutex
> aGuard( maMutex
);
1455 // --------------------------------------------------------------------
1458 void SAL_CALL
AnimationNode::setTo( const Any
& _to
)
1459 throw (RuntimeException
)
1461 Guard
< Mutex
> aGuard( maMutex
);
1465 fireChangeListener();
1469 // --------------------------------------------------------------------
1472 Any SAL_CALL
AnimationNode::getBy()
1473 throw (RuntimeException
)
1475 Guard
< Mutex
> aGuard( maMutex
);
1479 // --------------------------------------------------------------------
1482 void SAL_CALL
AnimationNode::setBy( const Any
& _by
)
1483 throw (RuntimeException
)
1485 Guard
< Mutex
> aGuard( maMutex
);
1489 fireChangeListener();
1493 // --------------------------------------------------------------------
1496 Sequence
< TimeFilterPair
> SAL_CALL
AnimationNode::getTimeFilter()
1497 throw (RuntimeException
)
1499 Guard
< Mutex
> aGuard( maMutex
);
1500 return maTimeFilter
;
1503 // --------------------------------------------------------------------
1506 void SAL_CALL
AnimationNode::setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
)
1507 throw (RuntimeException
)
1509 Guard
< Mutex
> aGuard( maMutex
);
1510 maTimeFilter
= _timefilter
;
1511 fireChangeListener();
1514 // --------------------------------------------------------------------
1516 OUString SAL_CALL
AnimationNode::getFormula() throw (RuntimeException
)
1518 Guard
< Mutex
> aGuard( maMutex
);
1522 // --------------------------------------------------------------------
1524 void SAL_CALL
AnimationNode::setFormula( const OUString
& _formula
) throw (RuntimeException
)
1526 Guard
< Mutex
> aGuard( maMutex
);
1527 if( _formula
!= maFormula
)
1529 maFormula
= _formula
;
1530 fireChangeListener();
1534 // --------------------------------------------------------------------
1537 sal_Int16 SAL_CALL
AnimationNode::getColorInterpolation() throw (RuntimeException
)
1539 Guard
< Mutex
> aGuard( maMutex
);
1540 return mnColorSpace
;
1543 // --------------------------------------------------------------------
1546 void SAL_CALL
AnimationNode::setColorInterpolation( sal_Int16 _colorspace
) throw (RuntimeException
)
1548 Guard
< Mutex
> aGuard( maMutex
);
1549 if( _colorspace
!= mnColorSpace
)
1551 mnColorSpace
= _colorspace
;
1552 fireChangeListener();
1556 // --------------------------------------------------------------------
1559 sal_Bool SAL_CALL
AnimationNode::getDirection() throw (RuntimeException
)
1561 Guard
< Mutex
> aGuard( maMutex
);
1565 // --------------------------------------------------------------------
1568 void SAL_CALL
AnimationNode::setDirection( sal_Bool _direction
) throw (RuntimeException
)
1570 Guard
< Mutex
> aGuard( maMutex
);
1571 if( _direction
!= mbDirection
)
1573 mbDirection
= _direction
;
1574 fireChangeListener();
1578 // --------------------------------------------------------------------
1581 Any SAL_CALL
AnimationNode::getPath() throw (RuntimeException
)
1583 Guard
< Mutex
> aGuard( maMutex
);
1587 // --------------------------------------------------------------------
1590 void SAL_CALL
AnimationNode::setPath( const Any
& _path
) throw (RuntimeException
)
1592 Guard
< Mutex
> aGuard( maMutex
);
1594 fireChangeListener();
1597 // --------------------------------------------------------------------
1600 Any SAL_CALL
AnimationNode::getOrigin() throw (RuntimeException
)
1602 Guard
< Mutex
> aGuard( maMutex
);
1606 // --------------------------------------------------------------------
1609 void SAL_CALL
AnimationNode::setOrigin( const Any
& _origin
) throw (RuntimeException
)
1611 Guard
< Mutex
> aGuard( maMutex
);
1613 fireChangeListener();
1616 // --------------------------------------------------------------------
1618 // XAnimateTransform
1619 sal_Int16 SAL_CALL
AnimationNode::getTransformType() throw (RuntimeException
)
1621 Guard
< Mutex
> aGuard( maMutex
);
1622 return mnTransformType
;
1625 // --------------------------------------------------------------------
1627 // XAnimateTransform
1628 void SAL_CALL
AnimationNode::setTransformType( sal_Int16 _transformtype
) throw (RuntimeException
)
1630 Guard
< Mutex
> aGuard( maMutex
);
1631 if( _transformtype
!= mnTransformType
)
1633 mnTransformType
= _transformtype
;
1634 fireChangeListener();
1638 // --------------------------------------------------------------------
1640 // XTransitionFilter
1641 sal_Int16 SAL_CALL
AnimationNode::getTransition() throw (RuntimeException
)
1643 Guard
< Mutex
> aGuard( maMutex
);
1644 return mnTransition
;
1647 // --------------------------------------------------------------------
1649 // XTransitionFilter
1650 void SAL_CALL
AnimationNode::setTransition( sal_Int16 _transition
) throw (RuntimeException
)
1652 Guard
< Mutex
> aGuard( maMutex
);
1653 if( _transition
!= mnTransition
)
1655 mnTransition
= _transition
;
1656 fireChangeListener();
1660 // --------------------------------------------------------------------
1662 // XTransitionFilter
1663 sal_Int16 SAL_CALL
AnimationNode::getSubtype() throw (RuntimeException
)
1665 Guard
< Mutex
> aGuard( maMutex
);
1669 // --------------------------------------------------------------------
1671 // XTransitionFilter
1672 void SAL_CALL
AnimationNode::setSubtype( sal_Int16 _subtype
) throw (RuntimeException
)
1674 Guard
< Mutex
> aGuard( maMutex
);
1675 if( _subtype
!= mnSubtype
)
1677 mnSubtype
= _subtype
;
1678 fireChangeListener();
1682 // --------------------------------------------------------------------
1684 // XTransitionFilter
1685 sal_Bool SAL_CALL
AnimationNode::getMode() throw (RuntimeException
)
1687 Guard
< Mutex
> aGuard( maMutex
);
1691 // --------------------------------------------------------------------
1693 // XTransitionFilter
1694 void SAL_CALL
AnimationNode::setMode( sal_Bool _mode
) throw (RuntimeException
)
1696 Guard
< Mutex
> aGuard( maMutex
);
1697 if( _mode
!= mbMode
)
1700 fireChangeListener();
1704 // --------------------------------------------------------------------
1706 // XTransitionFilter
1707 sal_Int32 SAL_CALL
AnimationNode::getFadeColor() throw (RuntimeException
)
1709 Guard
< Mutex
> aGuard( maMutex
);
1713 // --------------------------------------------------------------------
1715 // XTransitionFilter
1716 void SAL_CALL
AnimationNode::setFadeColor( sal_Int32 _fadecolor
) throw (RuntimeException
)
1718 Guard
< Mutex
> aGuard( maMutex
);
1719 if( _fadecolor
!= mnFadeColor
)
1721 mnFadeColor
= _fadecolor
;
1722 fireChangeListener();
1726 // --------------------------------------------------------------------
1729 Any SAL_CALL
AnimationNode::getSource() throw (RuntimeException
)
1731 Guard
< Mutex
> aGuard( maMutex
);
1735 // --------------------------------------------------------------------
1738 void SAL_CALL
AnimationNode::setSource( const Any
& _source
) throw (RuntimeException
)
1740 Guard
< Mutex
> aGuard( maMutex
);
1742 fireChangeListener();
1745 // --------------------------------------------------------------------
1748 double SAL_CALL
AnimationNode::getVolume() throw (RuntimeException
)
1750 Guard
< Mutex
> aGuard( maMutex
);
1754 // --------------------------------------------------------------------
1757 void SAL_CALL
AnimationNode::setVolume( double _volume
) throw (RuntimeException
)
1759 Guard
< Mutex
> aGuard( maMutex
);
1760 if( _volume
!= mfVolume
)
1763 fireChangeListener();
1767 // --------------------------------------------------------------------
1770 sal_Int16 SAL_CALL
AnimationNode::getCommand() throw (RuntimeException
)
1772 Guard
< Mutex
> aGuard( maMutex
);
1776 // --------------------------------------------------------------------
1779 void SAL_CALL
AnimationNode::setCommand( sal_Int16 _command
) throw (RuntimeException
)
1781 Guard
< Mutex
> aGuard( maMutex
);
1782 if( _command
!= mnCommand
)
1784 mnCommand
= _command
;
1785 fireChangeListener();
1789 // --------------------------------------------------------------------
1792 Any SAL_CALL
AnimationNode::getParameter() throw (RuntimeException
)
1794 Guard
< Mutex
> aGuard( maMutex
);
1798 // --------------------------------------------------------------------
1801 void SAL_CALL
AnimationNode::setParameter( const Any
& _parameter
) throw (RuntimeException
)
1803 Guard
< Mutex
> aGuard( maMutex
);
1804 maParameter
= _parameter
;
1805 fireChangeListener();
1808 // --------------------------------------------------------------------
1811 Type SAL_CALL
AnimationNode::getElementType() throw (RuntimeException
)
1813 return ::getCppuType((const Reference
< XAnimationNode
>*)0);
1816 // --------------------------------------------------------------------
1819 sal_Bool SAL_CALL
AnimationNode::hasElements() throw (RuntimeException
)
1821 Guard
< Mutex
> aGuard( maMutex
);
1822 return !maChilds
.empty();
1825 // --------------------------------------------------------------------
1827 // XEnumerationAccess
1828 Reference
< XEnumeration
> SAL_CALL
AnimationNode::createEnumeration()
1829 throw (RuntimeException
)
1831 Guard
< Mutex
> aGuard( maMutex
);
1833 return new TimeContainerEnumeration( maChilds
);
1836 // --------------------------------------------------------------------
1840 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1841 throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1843 Guard
< Mutex
> aGuard( maMutex
);
1845 if( !newChild
.is() || !refChild
.is() )
1846 throw IllegalArgumentException();
1848 ChildList_t::iterator before
= ::std::find(maChilds
.begin(), maChilds
.end(), refChild
);
1849 if( before
== maChilds
.end() )
1850 throw NoSuchElementException();
1852 if( ::std::find(maChilds
.begin(), maChilds
.end(), newChild
) != maChilds
.end() )
1853 throw ElementExistException();
1855 maChilds
.insert( before
, newChild
);
1857 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1858 newChild
->setParent( xThis
);
1863 // --------------------------------------------------------------------
1866 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1867 throw (IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1869 Guard
< Mutex
> aGuard( maMutex
);
1871 if( !newChild
.is() || !refChild
.is() )
1872 throw IllegalArgumentException();
1874 ChildList_t::iterator before
= ::std::find(maChilds
.begin(), maChilds
.end(), refChild
);
1875 if( before
== maChilds
.end() )
1876 throw NoSuchElementException();
1878 if( ::std::find(maChilds
.begin(), maChilds
.end(), newChild
) != maChilds
.end() )
1879 throw ElementExistException();
1882 if( before
!= maChilds
.end() )
1883 maChilds
.insert( before
, newChild
);
1885 maChilds
.push_back( newChild
);
1887 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1888 newChild
->setParent( xThis
);
1893 // --------------------------------------------------------------------
1896 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
)
1897 throw( IllegalArgumentException
, NoSuchElementException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1899 Guard
< Mutex
> aGuard( maMutex
);
1901 if( !newChild
.is() || !oldChild
.is() )
1902 throw IllegalArgumentException();
1904 ChildList_t::iterator replace
= ::std::find(maChilds
.begin(), maChilds
.end(), oldChild
);
1905 if( replace
== maChilds
.end() )
1906 throw NoSuchElementException();
1908 if( ::std::find(maChilds
.begin(), maChilds
.end(), newChild
) != maChilds
.end() )
1909 throw ElementExistException();
1911 Reference
< XInterface
> xNull( 0 );
1912 oldChild
->setParent( xNull
);
1914 (*replace
) = newChild
;
1916 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1917 newChild
->setParent( xThis
);
1922 // --------------------------------------------------------------------
1925 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::removeChild( const Reference
< XAnimationNode
>& oldChild
)
1926 throw(IllegalArgumentException
, NoSuchElementException
, WrappedTargetException
, RuntimeException
)
1928 Guard
< Mutex
> aGuard( maMutex
);
1930 if( !oldChild
.is() )
1931 throw IllegalArgumentException();
1933 ChildList_t::iterator old
= ::std::find(maChilds
.begin(), maChilds
.end(), oldChild
);
1934 if( old
== maChilds
.end() )
1935 throw NoSuchElementException();
1937 Reference
< XInterface
> xNull( 0 );
1938 oldChild
->setParent( xNull
);
1940 maChilds
.erase( old
);
1945 // --------------------------------------------------------------------
1948 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::appendChild( const Reference
< XAnimationNode
>& newChild
)
1949 throw(IllegalArgumentException
, ElementExistException
, WrappedTargetException
, RuntimeException
)
1951 Guard
< Mutex
> aGuard( maMutex
);
1953 if( !newChild
.is() )
1954 throw IllegalArgumentException();
1956 if( ::std::find(maChilds
.begin(), maChilds
.end(), newChild
) != maChilds
.end() )
1957 throw ElementExistException();
1959 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1960 Reference
< XInterface
> xChild( newChild
);
1962 if( xThis
== xChild
)
1963 throw IllegalArgumentException();
1965 maChilds
.push_back( newChild
);
1967 newChild
->setParent( xThis
);
1972 // --------------------------------------------------------------------
1974 // XIterateContainer
1975 sal_Int16 SAL_CALL
AnimationNode::getIterateType() throw (RuntimeException
)
1977 Guard
< Mutex
> aGuard( maMutex
);
1978 return mnIterateType
;
1981 // --------------------------------------------------------------------
1983 // XIterateContainer
1984 void SAL_CALL
AnimationNode::setIterateType( sal_Int16 _iteratetype
) throw (RuntimeException
)
1986 Guard
< Mutex
> aGuard( maMutex
);
1987 if( _iteratetype
!= mnIterateType
)
1989 mnIterateType
= _iteratetype
;
1990 fireChangeListener();
1994 // --------------------------------------------------------------------
1996 // XIterateContainer
1997 double SAL_CALL
AnimationNode::getIterateInterval() throw (RuntimeException
)
1999 Guard
< Mutex
> aGuard( maMutex
);
2000 return mfIterateInterval
;
2003 // --------------------------------------------------------------------
2005 // XIterateContainer
2006 void SAL_CALL
AnimationNode::setIterateInterval( double _iterateinterval
) throw (RuntimeException
)
2008 Guard
< Mutex
> aGuard( maMutex
);
2009 if( _iterateinterval
!= mfIterateInterval
)
2011 mfIterateInterval
= _iterateinterval
;
2012 fireChangeListener();
2016 // --------------------------------------------------------------------
2019 void SAL_CALL
AnimationNode::addChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
)
2021 maChangeListener
.addInterface( aListener
);
2024 // --------------------------------------------------------------------
2027 void SAL_CALL
AnimationNode::removeChangesListener( const Reference
< XChangesListener
>& aListener
) throw (RuntimeException
)
2029 maChangeListener
.removeInterface(aListener
);
2032 // --------------------------------------------------------------------
2035 ::sal_Int64 SAL_CALL
AnimationNode::getSomething( const Sequence
< ::sal_Int8
>& rId
) throw (RuntimeException
)
2037 if( rId
.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), rId
.getConstArray(), 16 ) )
2039 return sal::static_int_cast
< sal_Int64
>(reinterpret_cast< sal_IntPtr
>(this));
2048 // --------------------------------------------------------------------
2050 const ::com::sun::star::uno::Sequence
< sal_Int8
> & AnimationNode::getUnoTunnelId()
2052 static ::com::sun::star::uno::Sequence
< sal_Int8
> * pSeq
= 0;
2055 ::osl::Guard
< ::osl::Mutex
> aGuard( ::osl::Mutex::getGlobalMutex() );
2058 static ::com::sun::star::uno::Sequence
< sal_Int8
> aSeq( 16 );
2059 rtl_createUuid( (sal_uInt8
*)aSeq
.getArray(), 0, sal_True
);
2066 // --------------------------------------------------------------------
2068 void AnimationNode::fireChangeListener()
2070 Guard
< Mutex
> aGuard( maMutex
);
2072 OInterfaceIteratorHelper
aIterator( maChangeListener
);
2073 if( aIterator
.hasMoreElements() )
2075 Reference
< XInterface
> xSource( static_cast<OWeakObject
*>(this), UNO_QUERY
);
2076 Sequence
< ElementChange
> aChanges
;
2077 const ChangesEvent
aEvent( xSource
, makeAny( mxParent
), aChanges
);
2078 while( aIterator
.hasMoreElements() )
2080 Reference
< XChangesListener
> xListener( aIterator
.next(), UNO_QUERY
);
2081 if( xListener
.is() )
2082 xListener
->changesOccurred( aEvent
);
2087 mpParent
->fireChangeListener();
2090 // --------------------------------------------------------------------
2092 } // namespace animcore