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