nss: upgrade to release 3.73
[LibreOffice.git] / animations / source / animcore / animcore.cxx
blob2347dc08a2316a765c9fa4c87607d388a599290c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/util/XCloneable.hpp>
21 #include <com/sun/star/lang/IllegalArgumentException.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/XAnimatePhysics.hpp>
28 #include <com/sun/star/animations/XAnimateTransform.hpp>
29 #include <com/sun/star/animations/XParallelTimeContainer.hpp>
30 #include <com/sun/star/animations/XTransitionFilter.hpp>
31 #include <com/sun/star/animations/XTimeContainer.hpp>
32 #include <com/sun/star/animations/XIterateContainer.hpp>
33 #include <com/sun/star/animations/XAudio.hpp>
34 #include <com/sun/star/animations/XCommand.hpp>
35 #include <com/sun/star/animations/AnimationNodeType.hpp>
36 #include <com/sun/star/animations/AnimationCalcMode.hpp>
37 #include <com/sun/star/animations/AnimationFill.hpp>
38 #include <com/sun/star/animations/AnimationRestart.hpp>
39 #include <com/sun/star/animations/AnimationColorSpace.hpp>
40 #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
41 #include <com/sun/star/animations/AnimationTransformType.hpp>
42 #include <com/sun/star/animations/TransitionType.hpp>
43 #include <com/sun/star/animations/TransitionSubType.hpp>
44 #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
45 #include <com/sun/star/container/ElementExistException.hpp>
46 #include <com/sun/star/container/XEnumerationAccess.hpp>
47 #include <com/sun/star/util/XChangesNotifier.hpp>
48 #include <com/sun/star/lang/XUnoTunnel.hpp>
49 #include <comphelper/servicehelper.hxx>
50 #include <cppuhelper/queryinterface.hxx>
51 #include <comphelper/interfacecontainer2.hxx>
52 #include <cppuhelper/supportsservice.hxx>
53 #include <cppuhelper/weakref.hxx>
55 #include <cppuhelper/implbase.hxx>
57 #include <osl/mutex.hxx>
58 #include <sal/log.hxx>
59 #include <array>
60 #include <vector>
61 #include <algorithm>
63 namespace com::sun::star::uno { class XComponentContext; }
64 namespace com::sun::star::beans { struct NamedValue; }
66 using ::osl::Mutex;
67 using ::osl::Guard;
68 using ::comphelper::OInterfaceContainerHelper2;
69 using ::comphelper::OInterfaceIteratorHelper2;
70 using ::com::sun::star::uno::Any;
71 using ::com::sun::star::uno::UNO_QUERY;
72 using ::com::sun::star::uno::XInterface;
73 using ::com::sun::star::uno::Sequence;
74 using ::com::sun::star::uno::Reference;
75 using ::com::sun::star::uno::WeakReference;
76 using ::com::sun::star::uno::XComponentContext;
77 using ::com::sun::star::uno::Exception;
78 using ::com::sun::star::uno::XWeak;
79 using ::com::sun::star::uno::Type;
80 using ::com::sun::star::uno::Any;
81 using ::com::sun::star::lang::IllegalArgumentException;
82 using ::com::sun::star::lang::XServiceInfo;
83 using ::com::sun::star::lang::XTypeProvider;
84 using ::com::sun::star::container::NoSuchElementException;
85 using ::com::sun::star::container::ElementExistException;
86 using ::com::sun::star::container::XEnumeration;
87 using ::com::sun::star::container::XEnumerationAccess;
88 using ::com::sun::star::beans::NamedValue;
89 using ::com::sun::star::util::XCloneable;
90 using ::com::sun::star::lang::XUnoTunnel;
91 using ::com::sun::star::util::XChangesNotifier;
92 using ::com::sun::star::util::XChangesListener;
93 using ::com::sun::star::util::ElementChange;
94 using ::com::sun::star::util::ChangesEvent;
96 using ::cppu::OWeakObject;
98 using namespace ::com::sun::star::animations;
99 using namespace ::com::sun::star::animations::AnimationNodeType;
101 namespace animcore
104 namespace {
106 class AnimationNodeBase : public XAnimateMotion,
107 public XAnimatePhysics,
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
123 public:
124 // our first, last and only protection from multi-threads!
125 Mutex maMutex;
128 class AnimationNode : public AnimationNodeBase
130 public:
131 explicit AnimationNode(sal_Int16 nNodeType);
132 explicit AnimationNode(const AnimationNode& rNode);
134 // XInterface
135 virtual Any SAL_CALL queryInterface( const Type& aType ) override;
136 virtual void SAL_CALL acquire() throw () override;
137 virtual void SAL_CALL release() throw () override;
139 // XTypeProvider
140 virtual Sequence< Type > SAL_CALL getTypes() override;
141 virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
143 // XServiceInfo
144 OUString SAL_CALL getImplementationName() override;
145 Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
146 sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
148 // XChild
149 virtual Reference< XInterface > SAL_CALL getParent() override;
150 virtual void SAL_CALL setParent( const Reference< XInterface >& Parent ) override;
152 // XCloneable
153 virtual Reference< XCloneable > SAL_CALL createClone() override;
155 // XAnimationNode
156 virtual sal_Int16 SAL_CALL getType() override;
157 virtual Any SAL_CALL getBegin() override;
158 virtual void SAL_CALL setBegin( const Any& _begin ) override;
159 virtual Any SAL_CALL getDuration() override;
160 virtual void SAL_CALL setDuration( const Any& _duration ) override;
161 virtual Any SAL_CALL getEnd() override;
162 virtual void SAL_CALL setEnd( const Any& _end ) override;
163 virtual Any SAL_CALL getEndSync() override;
164 virtual void SAL_CALL setEndSync( const Any& _endsync ) override;
165 virtual Any SAL_CALL getRepeatCount() override;
166 virtual void SAL_CALL setRepeatCount( const Any& _repeatcount ) override;
167 virtual Any SAL_CALL getRepeatDuration() override;
168 virtual void SAL_CALL setRepeatDuration( const Any& _repeatduration ) override;
169 virtual sal_Int16 SAL_CALL getFill() override;
170 virtual void SAL_CALL setFill( sal_Int16 _fill ) override;
171 virtual sal_Int16 SAL_CALL getFillDefault() override;
172 virtual void SAL_CALL setFillDefault( sal_Int16 _filldefault ) override;
173 virtual sal_Int16 SAL_CALL getRestart() override;
174 virtual void SAL_CALL setRestart( sal_Int16 _restart ) override;
175 virtual sal_Int16 SAL_CALL getRestartDefault() override;
176 virtual void SAL_CALL setRestartDefault( sal_Int16 _restartdefault ) override;
177 virtual double SAL_CALL getAcceleration() override;
178 virtual void SAL_CALL setAcceleration( double _acceleration ) override;
179 virtual double SAL_CALL getDecelerate() override;
180 virtual void SAL_CALL setDecelerate( double _decelerate ) override;
181 virtual sal_Bool SAL_CALL getAutoReverse() override;
182 virtual void SAL_CALL setAutoReverse( sal_Bool _autoreverse ) override;
183 virtual Sequence< NamedValue > SAL_CALL getUserData() override;
184 virtual void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) override;
186 // XAnimate
187 virtual Any SAL_CALL getTarget() override;
188 virtual void SAL_CALL setTarget( const Any& _target ) override;
189 virtual sal_Int16 SAL_CALL getSubItem() override;
190 virtual void SAL_CALL setSubItem( sal_Int16 _subitem ) override;
191 virtual OUString SAL_CALL getAttributeName() override;
192 virtual void SAL_CALL setAttributeName( const OUString& _attribute ) override;
193 virtual Sequence< Any > SAL_CALL getValues() override;
194 virtual void SAL_CALL setValues( const Sequence< Any >& _values ) override;
195 virtual Sequence< double > SAL_CALL getKeyTimes() override;
196 virtual void SAL_CALL setKeyTimes( const Sequence< double >& _keytimes ) override;
197 virtual sal_Int16 SAL_CALL getValueType() override;
198 virtual void SAL_CALL setValueType( sal_Int16 _valuetype ) override;
199 virtual sal_Int16 SAL_CALL getCalcMode() override;
200 virtual void SAL_CALL setCalcMode( sal_Int16 _calcmode ) override;
201 virtual sal_Bool SAL_CALL getAccumulate() override;
202 virtual void SAL_CALL setAccumulate( sal_Bool _accumulate ) override;
203 virtual sal_Int16 SAL_CALL getAdditive() override;
204 virtual void SAL_CALL setAdditive( sal_Int16 _additive ) override;
205 virtual Any SAL_CALL getFrom() override;
206 virtual void SAL_CALL setFrom( const Any& _from ) override;
207 virtual Any SAL_CALL getTo() override;
208 virtual void SAL_CALL setTo( const Any& _to ) override;
209 virtual Any SAL_CALL getBy() override;
210 virtual void SAL_CALL setBy( const Any& _by ) override;
211 virtual Sequence< TimeFilterPair > SAL_CALL getTimeFilter() override;
212 virtual void SAL_CALL setTimeFilter( const Sequence< TimeFilterPair >& _timefilter ) override;
213 virtual OUString SAL_CALL getFormula() override;
214 virtual void SAL_CALL setFormula( const OUString& _formula ) override;
216 // XAnimateColor
217 virtual sal_Int16 SAL_CALL getColorInterpolation() override;
218 virtual void SAL_CALL setColorInterpolation( sal_Int16 _colorspace ) override;
219 virtual sal_Bool SAL_CALL getDirection() override;
220 virtual void SAL_CALL setDirection( sal_Bool _direction ) override;
222 // XAnimateMotion
223 virtual Any SAL_CALL getPath() override;
224 virtual void SAL_CALL setPath( const Any& _path ) override;
225 virtual Any SAL_CALL getOrigin() override;
226 virtual void SAL_CALL setOrigin( const Any& _origin ) override;
228 // XAnimatePhysics
229 virtual Any SAL_CALL getStartVelocityX() override;
230 virtual void SAL_CALL setStartVelocityX( const Any& _startvelocityx ) override;
231 virtual Any SAL_CALL getStartVelocityY() override;
232 virtual void SAL_CALL setStartVelocityY( const Any& _startvelocityy ) override;
233 virtual Any SAL_CALL getDensity() override;
234 virtual void SAL_CALL setDensity( const Any& _density ) override;
235 virtual Any SAL_CALL getBounciness() override;
236 virtual void SAL_CALL setBounciness( const Any& _bounciness ) override;
238 // XAnimateTransform
239 virtual sal_Int16 SAL_CALL getTransformType() override;
240 virtual void SAL_CALL setTransformType( sal_Int16 _transformtype ) override;
242 // XTransitionFilter
243 virtual sal_Int16 SAL_CALL getTransition() override;
244 virtual void SAL_CALL setTransition( sal_Int16 _transition ) override;
245 virtual sal_Int16 SAL_CALL getSubtype() override;
246 virtual void SAL_CALL setSubtype( sal_Int16 _subtype ) override;
247 virtual sal_Bool SAL_CALL getMode() override;
248 virtual void SAL_CALL setMode( sal_Bool _mode ) override;
249 virtual sal_Int32 SAL_CALL getFadeColor() override;
250 virtual void SAL_CALL setFadeColor( sal_Int32 _fadecolor ) override;
252 // XAudio
253 virtual Any SAL_CALL getSource() override;
254 virtual void SAL_CALL setSource( const Any& _source ) override;
255 virtual double SAL_CALL getVolume() override;
256 virtual void SAL_CALL setVolume( double _volume ) override;
259 // XCommand - the following two shadowed by animate, unfortunately
260 // virtual Any SAL_CALL getTarget() throw (RuntimeException);
261 // virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
262 virtual sal_Int16 SAL_CALL getCommand() override;
263 virtual void SAL_CALL setCommand( sal_Int16 _command ) override;
264 virtual Any SAL_CALL getParameter() override;
265 virtual void SAL_CALL setParameter( const Any& _parameter ) override;
267 // XElementAccess
268 virtual Type SAL_CALL getElementType() override;
269 virtual sal_Bool SAL_CALL hasElements() override;
271 // XEnumerationAccess
272 virtual Reference< XEnumeration > SAL_CALL createEnumeration() override;
274 // XTimeContainer
275 virtual Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) override;
276 virtual Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) override;
277 virtual Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) override;
278 virtual Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) override;
279 virtual Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) override;
281 // XIterateContainer
282 virtual sal_Int16 SAL_CALL getIterateType() override;
283 virtual void SAL_CALL setIterateType( sal_Int16 _iteratetype ) override;
284 virtual double SAL_CALL getIterateInterval() override;
285 virtual void SAL_CALL setIterateInterval( double _iterateinterval ) override;
287 // XChangesNotifier
288 virtual void SAL_CALL addChangesListener( const Reference< XChangesListener >& aListener ) override;
289 virtual void SAL_CALL removeChangesListener( const Reference< XChangesListener >& aListener ) override;
291 // XUnoTunnel
292 virtual ::sal_Int64 SAL_CALL getSomething( const Sequence< ::sal_Int8 >& aIdentifier ) override;
294 static const Sequence< sal_Int8 > & getUnoTunnelId();
295 void fireChangeListener();
297 private:
298 OInterfaceContainerHelper2 maChangeListener;
300 static void initTypeProvider( sal_Int16 nNodeType ) throw();
302 const sal_Int16 mnNodeType;
304 // for XTypeProvider
305 static std::array<Sequence< Type >*, 13> mpTypes;
307 // attributes for the XAnimationNode interface implementation
308 Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration;
309 sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
310 double mfAcceleration, mfDecelerate;
311 bool mbAutoReverse;
312 Sequence< NamedValue > maUserData;
314 // parent interface for XChild interface implementation
315 WeakReference<XInterface> mxParent;
316 AnimationNode* mpParent;
318 // attributes for XAnimate
319 Any maTarget;
320 OUString maAttributeName, maFormula;
321 Sequence< Any > maValues;
322 Sequence< double > maKeyTimes;
323 sal_Int16 mnValueType, mnSubItem;
324 sal_Int16 mnCalcMode, mnAdditive;
325 bool mbAccumulate;
326 Any maFrom, maTo, maBy;
327 Sequence< TimeFilterPair > maTimeFilter;
329 // attributes for XAnimateColor
330 sal_Int16 mnColorSpace;
331 bool mbDirection;
333 // attributes for XAnimateMotion
334 Any maPath, maOrigin;
336 // attributes for XAnimatePhysics
337 Any maStartVelocityX, maStartVelocityY, maDensity, maBounciness;
339 // attributes for XAnimateTransform
340 sal_Int16 mnTransformType;
342 // attributes for XTransitionFilter
343 sal_Int16 mnTransition;
344 sal_Int16 mnSubtype;
345 bool mbMode;
346 sal_Int32 mnFadeColor;
348 // XAudio
349 double mfVolume;
351 // XCommand
352 sal_Int16 mnCommand;
353 Any maParameter;
355 // XIterateContainer
356 sal_Int16 mnIterateType;
357 double mfIterateInterval;
359 /** sorted list of child nodes for XTimeContainer*/
360 std::vector< Reference< XAnimationNode > > maChildren;
364 class TimeContainerEnumeration : public ::cppu::WeakImplHelper< XEnumeration >
366 public:
367 explicit TimeContainerEnumeration( const std::vector< Reference< XAnimationNode > > &rChildren );
369 // Methods
370 virtual sal_Bool SAL_CALL hasMoreElements() override;
371 virtual Any SAL_CALL nextElement( ) override;
373 private:
374 /** sorted list of child nodes */
375 std::vector< Reference< XAnimationNode > > maChildren;
377 /** current iteration position */
378 std::vector< Reference< XAnimationNode > >::iterator maIter;
380 /** our first, last and only protection from multi-threads! */
381 Mutex maMutex;
386 TimeContainerEnumeration::TimeContainerEnumeration( const std::vector< Reference< XAnimationNode > > &rChildren )
387 : maChildren( rChildren )
389 maIter = maChildren.begin();
392 // Methods
393 sal_Bool SAL_CALL TimeContainerEnumeration::hasMoreElements()
395 Guard< Mutex > aGuard( maMutex );
397 return maIter != maChildren.end();
400 Any SAL_CALL TimeContainerEnumeration::nextElement()
402 Guard< Mutex > aGuard( maMutex );
404 if( maIter == maChildren.end() )
405 throw NoSuchElementException();
407 return Any( *maIter++ );
411 std::array<Sequence< Type >*, 13> AnimationNode::mpTypes = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
413 AnimationNode::AnimationNode( sal_Int16 nNodeType )
414 : maChangeListener(maMutex),
415 mnNodeType( nNodeType ),
416 mnFill( AnimationFill::DEFAULT ),
417 mnFillDefault( AnimationFill::INHERIT ),
418 mnRestart( AnimationRestart:: DEFAULT ),
419 mnRestartDefault( AnimationRestart:: INHERIT ),
420 mfAcceleration( 0.0 ),
421 mfDecelerate( 0.0 ),
422 mbAutoReverse( false ),
423 mpParent(nullptr),
424 mnValueType( 0 ),
425 mnSubItem( 0 ),
426 mnCalcMode( (nNodeType == AnimationNodeType::ANIMATEMOTION) ? AnimationCalcMode::PACED : AnimationCalcMode::LINEAR),
427 mnAdditive(AnimationAdditiveMode::REPLACE),
428 mbAccumulate(false),
429 mnColorSpace( AnimationColorSpace::RGB ),
430 mbDirection( true ),
431 mnTransformType( AnimationTransformType::TRANSLATE ),
432 mnTransition(TransitionType::BARWIPE),
433 mnSubtype(TransitionSubType::DEFAULT),
434 mbMode(true),
435 mnFadeColor(0),
436 mfVolume(1.0),
437 mnCommand(0),
438 mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE ),
439 mfIterateInterval(0.0)
441 assert(nNodeType < int(mpTypes.size()));
444 AnimationNode::AnimationNode( const AnimationNode& rNode )
445 : AnimationNodeBase(),
446 maChangeListener(maMutex),
447 mnNodeType( rNode.mnNodeType ),
449 // attributes for the XAnimationNode interface implementation
450 maBegin( rNode.maBegin ),
451 maDuration( rNode.maDuration ),
452 maEnd( rNode.maEnd ),
453 maEndSync( rNode.maEndSync ),
454 maRepeatCount( rNode.maRepeatCount ),
455 maRepeatDuration( rNode.maRepeatDuration ),
456 mnFill( rNode.mnFill ),
457 mnFillDefault( rNode.mnFillDefault ),
458 mnRestart( rNode.mnRestart ),
459 mnRestartDefault( rNode.mnRestartDefault ),
460 mfAcceleration( rNode.mfAcceleration ),
461 mfDecelerate( rNode.mfDecelerate ),
462 mbAutoReverse( rNode.mbAutoReverse ),
463 maUserData( rNode.maUserData ),
464 mpParent(nullptr),
466 // attributes for XAnimate
467 maTarget( rNode.maTarget ),
468 maAttributeName( rNode.maAttributeName ),
469 maFormula( rNode.maFormula ),
470 maValues( rNode.maValues ),
471 maKeyTimes( rNode.maKeyTimes ),
472 mnValueType( rNode.mnValueType ),
473 mnSubItem( rNode.mnSubItem ),
474 mnCalcMode( rNode.mnCalcMode ),
475 mnAdditive( rNode.mnAdditive ),
476 mbAccumulate( rNode.mbAccumulate ),
477 maFrom( rNode.maFrom ),
478 maTo( rNode.maTo ),
479 maBy( rNode.maBy ),
480 maTimeFilter( rNode.maTimeFilter ),
482 // attributes for XAnimateColor
483 mnColorSpace( rNode.mnColorSpace ),
484 mbDirection( rNode.mbDirection ),
486 // attributes for XAnimateMotion
487 maPath( rNode.maPath ),
488 maOrigin( rNode.maOrigin ),
490 // attributes for XAnimatePhysics
491 maStartVelocityX( rNode.maStartVelocityX ),
492 maStartVelocityY( rNode.maStartVelocityY ),
493 maDensity( rNode.maDensity ),
494 maBounciness( rNode.maBounciness ),
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 ),
505 // XAudio
506 mfVolume( rNode.mfVolume ),
508 // XCommand
509 mnCommand( rNode.mnCommand ),
510 maParameter( rNode.maParameter ),
512 // XIterateContainer
513 mnIterateType( rNode.mnIterateType ),
514 mfIterateInterval( rNode.mfIterateInterval )
518 static Sequence<OUString> getSupportedServiceNames_PAR()
520 return { "com.sun.star.animations.ParallelTimeContainer" };
523 static OUString getImplementationName_PAR()
525 return "animcore::ParallelTimeContainer";
528 static Sequence<OUString> getSupportedServiceNames_SEQ()
530 return { "com.sun.star.animations.SequenceTimeContainer" };
533 static OUString getImplementationName_SEQ()
535 return "animcore::SequenceTimeContainer";
538 static Sequence<OUString> getSupportedServiceNames_ITERATE()
540 return { "com.sun.star.animations.IterateContainer" };
543 static OUString getImplementationName_ITERATE()
545 return "animcore::IterateContainer";
548 static Sequence<OUString> getSupportedServiceNames_ANIMATE()
550 return { "com.sun.star.animations.Animate" };
553 static OUString getImplementationName_ANIMATE()
555 return "animcore::Animate";
558 static Sequence<OUString> getSupportedServiceNames_SET()
560 return { "com.sun.star.animations.AnimateSet" };
563 static OUString getImplementationName_SET()
565 return "animcore::AnimateSet";
568 static Sequence<OUString> getSupportedServiceNames_ANIMATECOLOR()
570 return { "com.sun.star.animations.AnimateColor" };
573 static OUString getImplementationName_ANIMATECOLOR()
575 return "animcore::AnimateColor";
578 static Sequence<OUString> getSupportedServiceNames_ANIMATEMOTION()
580 return { "com.sun.star.animations.AnimateMotion" };
583 static OUString getImplementationName_ANIMATEMOTION()
585 return "animcore::AnimateMotion";
588 static Sequence<OUString> getSupportedServiceNames_ANIMATEPHYSICS()
590 return { "com.sun.star.animations.AnimatePhysics" };
593 static OUString getImplementationName_ANIMATEPHYSICS()
595 return "animcore::AnimatePhysics";
598 static Sequence<OUString> getSupportedServiceNames_ANIMATETRANSFORM()
600 return { "com.sun.star.animations.AnimateTransform" };
603 static OUString getImplementationName_ANIMATETRANSFORM()
605 return "animcore::AnimateTransform";
608 static Sequence<OUString> getSupportedServiceNames_TRANSITIONFILTER()
610 return { "com.sun.star.animations.TransitionFilter" };
613 static OUString getImplementationName_TRANSITIONFILTER()
615 return "animcore::TransitionFilter";
618 static Sequence<OUString> getSupportedServiceNames_AUDIO()
620 return { "com.sun.star.animations.Audio" };
623 static OUString getImplementationName_AUDIO()
625 return "animcore::Audio";
628 static Sequence<OUString> getSupportedServiceNames_COMMAND()
630 return { "com.sun.star.animations.Command" };
633 static OUString getImplementationName_COMMAND()
635 return "animcore::Command";
638 // XInterface
639 Any SAL_CALL AnimationNode::queryInterface( const Type& aType )
641 Any aRet( ::cppu::queryInterface(
642 aType,
643 static_cast< XServiceInfo * >( this ),
644 static_cast< XTypeProvider * >( this ),
645 static_cast< XChild * >( static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ) ),
646 static_cast< XCloneable* >( this ),
647 static_cast< XAnimationNode* >( static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ) ),
648 static_cast< XInterface* >(static_cast< OWeakObject * >(this)),
649 static_cast< XWeak* >(static_cast< OWeakObject * >(this)),
650 static_cast< XChangesNotifier* >( this ),
651 static_cast< XUnoTunnel* >( this ) ) );
653 if(!aRet.hasValue())
655 switch( mnNodeType )
657 case AnimationNodeType::PAR:
658 aRet = ::cppu::queryInterface(
659 aType,
660 static_cast< XParallelTimeContainer * >( this ),
661 static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ),
662 static_cast< XEnumerationAccess * >( this ),
663 static_cast< XElementAccess * >( this ) );
664 break;
665 case AnimationNodeType::SEQ:
666 aRet = ::cppu::queryInterface(
667 aType,
668 static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ),
669 static_cast< XEnumerationAccess * >( this ),
670 static_cast< XElementAccess * >( this ) );
671 break;
672 case AnimationNodeType::ITERATE:
673 aRet = ::cppu::queryInterface(
674 aType,
675 static_cast< XTimeContainer * >( static_cast< XIterateContainer * >(this) ),
676 static_cast< XIterateContainer * >( this ),
677 static_cast< XEnumerationAccess * >( this ),
678 static_cast< XElementAccess * >( this ) );
679 break;
680 case AnimationNodeType::ANIMATE:
681 aRet = ::cppu::queryInterface(
682 aType,
683 static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ) );
684 break;
685 case AnimationNodeType::ANIMATEMOTION:
686 aRet = ::cppu::queryInterface(
687 aType,
688 static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ),
689 static_cast< XAnimateMotion * >( this ) );
690 break;
691 case AnimationNodeType::ANIMATEPHYSICS:
692 aRet = ::cppu::queryInterface(
693 aType,
694 static_cast< XAnimate * >( static_cast< XAnimatePhysics * >(this) ),
695 static_cast< XAnimatePhysics * >( this ) );
696 break;
697 case AnimationNodeType::ANIMATECOLOR:
698 aRet = ::cppu::queryInterface(
699 aType,
700 static_cast< XAnimate * >( static_cast< XAnimateColor * >(this) ),
701 static_cast< XAnimateColor * >( this ) );
702 break;
703 case AnimationNodeType::SET:
704 aRet = ::cppu::queryInterface(
705 aType,
706 static_cast< XAnimate * >( static_cast< XAnimateSet * >(this) ),
707 static_cast< XAnimateSet * >( this ) );
708 break;
709 case AnimationNodeType::ANIMATETRANSFORM:
710 aRet = ::cppu::queryInterface(
711 aType,
712 static_cast< XAnimate * >( static_cast< XAnimateTransform * >(this) ),
713 static_cast< XAnimateTransform * >( this ) );
714 break;
715 case AnimationNodeType::AUDIO:
716 aRet = ::cppu::queryInterface(aType, static_cast< XAudio * >(this) );
717 break;
718 case AnimationNodeType::COMMAND:
719 aRet = ::cppu::queryInterface(
720 aType, static_cast< XCommand * >(this) );
721 break;
722 case AnimationNodeType::TRANSITIONFILTER:
723 aRet = ::cppu::queryInterface(
724 aType,
725 static_cast< XAnimate * >( static_cast< XTransitionFilter * >(this) ),
726 static_cast< XTransitionFilter * >( this ) );
727 break;
731 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( aType );
735 void AnimationNode::initTypeProvider( sal_Int16 nNodeType ) throw()
737 ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
739 if( mpTypes[nNodeType] )
740 return;
742 static constexpr std::array<sal_Int32, mpTypes.size()> type_numbers =
744 7, // CUSTOM
745 9, // PAR
746 9, // SEQ
747 9, // ITERATE
748 8, // ANIMATE
749 8, // SET
750 8, // ANIMATEMOTION
751 8, // ANIMATECOLOR
752 8, // ANIMATETRANSFORM
753 8, // TRANSITIONFILTER
754 8, // AUDIO
755 8, // COMMAND
756 8, // ANIMATEPHYSICS
759 // collect types
760 Sequence< Type > * types = new Sequence< Type >( type_numbers[nNodeType] );
761 Type * pTypeAr = types->getArray();
762 sal_Int32 nPos = 0;
764 pTypeAr[nPos++] = cppu::UnoType<XWeak>::get();
765 pTypeAr[nPos++] = cppu::UnoType<XChild>::get();
766 pTypeAr[nPos++] = cppu::UnoType<XCloneable>::get();
767 pTypeAr[nPos++] = cppu::UnoType<XTypeProvider>::get();
768 pTypeAr[nPos++] = cppu::UnoType<XServiceInfo>::get();
769 pTypeAr[nPos++] = cppu::UnoType<XUnoTunnel>::get();
770 pTypeAr[nPos++] = cppu::UnoType<XChangesNotifier>::get();
772 switch( nNodeType )
774 case AnimationNodeType::PAR:
775 case AnimationNodeType::SEQ:
776 pTypeAr[nPos++] = cppu::UnoType<XTimeContainer>::get();
777 pTypeAr[nPos++] = cppu::UnoType<XEnumerationAccess>::get();
778 break;
779 case AnimationNodeType::ITERATE:
780 pTypeAr[nPos++] = cppu::UnoType<XIterateContainer>::get();
781 pTypeAr[nPos++] = cppu::UnoType<XEnumerationAccess>::get();
782 break;
783 case AnimationNodeType::ANIMATE:
784 pTypeAr[nPos++] = cppu::UnoType<XAnimate>::get();
785 break;
786 case AnimationNodeType::ANIMATEMOTION:
787 pTypeAr[nPos++] = cppu::UnoType<XAnimateMotion>::get();
788 break;
789 case AnimationNodeType::ANIMATEPHYSICS:
790 pTypeAr[nPos++] = cppu::UnoType<XAnimatePhysics>::get();
791 break;
792 case AnimationNodeType::ANIMATECOLOR:
793 pTypeAr[nPos++] = cppu::UnoType<XAnimateColor>::get();
794 break;
795 case AnimationNodeType::ANIMATETRANSFORM:
796 pTypeAr[nPos++] = cppu::UnoType<XAnimateTransform>::get();
797 break;
798 case AnimationNodeType::SET:
799 pTypeAr[nPos++] = cppu::UnoType<XAnimateSet>::get();
800 break;
801 case AnimationNodeType::TRANSITIONFILTER:
802 pTypeAr[nPos++] = cppu::UnoType<XTransitionFilter>::get();
803 break;
804 case AnimationNodeType::AUDIO:
805 pTypeAr[nPos++] = cppu::UnoType<XAudio>::get();
806 break;
807 case AnimationNodeType::COMMAND:
808 pTypeAr[nPos++] = cppu::UnoType<XCommand>::get();
809 break;
811 mpTypes[nNodeType] = types;
815 Sequence< Type > AnimationNode::getTypes()
817 if (! mpTypes[mnNodeType])
818 initTypeProvider(mnNodeType);
819 return *mpTypes[mnNodeType];
823 Sequence< sal_Int8 > AnimationNode::getImplementationId()
825 return css::uno::Sequence<sal_Int8>();
829 // XInterface
830 void SAL_CALL AnimationNode::acquire( ) throw ()
832 OWeakObject::acquire();
836 // XInterface
837 void SAL_CALL AnimationNode::release( ) throw ()
839 OWeakObject::release();
843 // XServiceInfo
844 OUString AnimationNode::getImplementationName()
846 switch( mnNodeType )
848 case AnimationNodeType::PAR:
849 return getImplementationName_PAR();
850 case AnimationNodeType::SEQ:
851 return getImplementationName_SEQ();
852 case AnimationNodeType::ITERATE:
853 return getImplementationName_ITERATE();
854 case AnimationNodeType::SET:
855 return getImplementationName_SET();
856 case AnimationNodeType::ANIMATECOLOR:
857 return getImplementationName_ANIMATECOLOR();
858 case AnimationNodeType::ANIMATEMOTION:
859 return getImplementationName_ANIMATEMOTION();
860 case AnimationNodeType::ANIMATEPHYSICS:
861 return getImplementationName_ANIMATEPHYSICS();
862 case AnimationNodeType::TRANSITIONFILTER:
863 return getImplementationName_TRANSITIONFILTER();
864 case AnimationNodeType::ANIMATETRANSFORM:
865 return getImplementationName_ANIMATETRANSFORM();
866 case AnimationNodeType::AUDIO:
867 return getImplementationName_AUDIO();
868 case AnimationNodeType::COMMAND:
869 return getImplementationName_COMMAND();
870 case AnimationNodeType::ANIMATE:
871 default:
872 return getImplementationName_ANIMATE();
876 // XServiceInfo
877 sal_Bool AnimationNode::supportsService(const OUString& ServiceName)
879 return cppu::supportsService(this, ServiceName);
882 // XServiceInfo
883 Sequence< OUString > AnimationNode::getSupportedServiceNames()
885 switch( mnNodeType )
887 case AnimationNodeType::PAR:
888 return getSupportedServiceNames_PAR();
889 case AnimationNodeType::SEQ:
890 return getSupportedServiceNames_SEQ();
891 case AnimationNodeType::ITERATE:
892 return getSupportedServiceNames_ITERATE();
893 case AnimationNodeType::SET:
894 return getSupportedServiceNames_SET();
895 case AnimationNodeType::ANIMATECOLOR:
896 return getSupportedServiceNames_ANIMATECOLOR();
897 case AnimationNodeType::ANIMATEMOTION:
898 return getSupportedServiceNames_ANIMATEMOTION();
899 case AnimationNodeType::ANIMATEPHYSICS:
900 return getSupportedServiceNames_ANIMATEPHYSICS();
901 case AnimationNodeType::TRANSITIONFILTER:
902 return getSupportedServiceNames_TRANSITIONFILTER();
903 case AnimationNodeType::ANIMATETRANSFORM:
904 return getSupportedServiceNames_ANIMATETRANSFORM();
905 case AnimationNodeType::AUDIO:
906 return getSupportedServiceNames_AUDIO();
907 case AnimationNodeType::COMMAND:
908 return getSupportedServiceNames_COMMAND();
909 case AnimationNodeType::ANIMATE:
910 default:
911 return getSupportedServiceNames_ANIMATE();
916 // XAnimationNode
917 sal_Int16 SAL_CALL AnimationNode::getType()
919 Guard< Mutex > aGuard( maMutex );
920 return mnNodeType;
924 // XAnimationNode
925 Any SAL_CALL AnimationNode::getBegin()
927 Guard< Mutex > aGuard( maMutex );
928 return maBegin;
932 // XAnimationNode
933 void SAL_CALL AnimationNode::setBegin( const Any& _begin )
935 Guard< Mutex > aGuard( maMutex );
936 if( _begin != maBegin )
938 maBegin = _begin;
939 fireChangeListener();
944 // XAnimationNode
945 Any SAL_CALL AnimationNode::getDuration()
947 Guard< Mutex > aGuard( maMutex );
948 return maDuration;
952 // XAnimationNode
953 void SAL_CALL AnimationNode::setDuration( const Any& _duration )
955 Guard< Mutex > aGuard( maMutex );
956 if( _duration != maDuration )
958 maDuration = _duration;
959 fireChangeListener();
964 // XAnimationNode
965 Any SAL_CALL AnimationNode::getEnd()
967 Guard< Mutex > aGuard( maMutex );
968 return maEnd;
972 // XAnimationNode
973 void SAL_CALL AnimationNode::setEnd( const Any& _end )
975 Guard< Mutex > aGuard( maMutex );
976 if( _end != maEnd )
978 maEnd = _end;
979 fireChangeListener();
984 // XAnimationNode
985 Any SAL_CALL AnimationNode::getEndSync()
987 Guard< Mutex > aGuard( maMutex );
988 return maEndSync;
992 // XAnimationNode
993 void SAL_CALL AnimationNode::setEndSync( const Any& _endsync )
995 Guard< Mutex > aGuard( maMutex );
996 if( _endsync != maEndSync )
998 maEndSync = _endsync;
999 fireChangeListener();
1004 // XAnimationNode
1005 Any SAL_CALL AnimationNode::getRepeatCount()
1007 Guard< Mutex > aGuard( maMutex );
1008 return maRepeatCount;
1012 // XAnimationNode
1013 void SAL_CALL AnimationNode::setRepeatCount( const Any& _repeatcount )
1015 Guard< Mutex > aGuard( maMutex );
1016 if( _repeatcount != maRepeatCount )
1018 maRepeatCount = _repeatcount;
1019 fireChangeListener();
1024 // XAnimationNode
1025 Any SAL_CALL AnimationNode::getRepeatDuration()
1027 Guard< Mutex > aGuard( maMutex );
1028 return maRepeatDuration;
1032 // XAnimationNode
1033 void SAL_CALL AnimationNode::setRepeatDuration( const Any& _repeatduration )
1035 Guard< Mutex > aGuard( maMutex );
1036 if( _repeatduration != maRepeatDuration )
1038 maRepeatDuration = _repeatduration;
1039 fireChangeListener();
1044 // XAnimationNode
1045 sal_Int16 SAL_CALL AnimationNode::getFill()
1047 Guard< Mutex > aGuard( maMutex );
1048 return mnFill;
1052 // XAnimationNode
1053 void SAL_CALL AnimationNode::setFill( sal_Int16 _fill )
1055 Guard< Mutex > aGuard( maMutex );
1056 if( _fill != mnFill )
1058 mnFill = _fill;
1059 fireChangeListener();
1064 // XAnimationNode
1065 sal_Int16 SAL_CALL AnimationNode::getFillDefault()
1067 Guard< Mutex > aGuard( maMutex );
1068 return mnFillDefault;
1072 // XAnimationNode
1073 void SAL_CALL AnimationNode::setFillDefault( sal_Int16 _filldefault )
1075 Guard< Mutex > aGuard( maMutex );
1076 if( _filldefault != mnFillDefault )
1078 mnFillDefault = _filldefault;
1079 fireChangeListener();
1084 // XAnimationNode
1085 sal_Int16 SAL_CALL AnimationNode::getRestart()
1087 Guard< Mutex > aGuard( maMutex );
1088 return mnRestart;
1092 // XAnimationNode
1093 void SAL_CALL AnimationNode::setRestart( sal_Int16 _restart )
1095 Guard< Mutex > aGuard( maMutex );
1096 if( _restart != mnRestart )
1098 mnRestart = _restart;
1099 fireChangeListener();
1104 // XAnimationNode
1105 sal_Int16 SAL_CALL AnimationNode::getRestartDefault()
1107 Guard< Mutex > aGuard( maMutex );
1108 return mnRestartDefault;
1112 // XAnimationNode
1113 void SAL_CALL AnimationNode::setRestartDefault( sal_Int16 _restartdefault )
1115 Guard< Mutex > aGuard( maMutex );
1116 if( _restartdefault != mnRestartDefault )
1118 mnRestartDefault = _restartdefault;
1119 fireChangeListener();
1124 // XAnimationNode
1125 double SAL_CALL AnimationNode::getAcceleration()
1127 Guard< Mutex > aGuard( maMutex );
1128 return mfAcceleration;
1132 // XAnimationNode
1133 void SAL_CALL AnimationNode::setAcceleration( double _acceleration )
1135 Guard< Mutex > aGuard( maMutex );
1136 if( _acceleration != mfAcceleration )
1138 mfAcceleration = _acceleration;
1139 fireChangeListener();
1144 // XAnimationNode
1145 double SAL_CALL AnimationNode::getDecelerate()
1147 Guard< Mutex > aGuard( maMutex );
1148 return mfDecelerate;
1152 // XAnimationNode
1153 void SAL_CALL AnimationNode::setDecelerate( double _decelerate )
1155 Guard< Mutex > aGuard( maMutex );
1156 if( _decelerate != mfDecelerate )
1158 mfDecelerate = _decelerate;
1159 fireChangeListener();
1164 // XAnimationNode
1165 sal_Bool SAL_CALL AnimationNode::getAutoReverse()
1167 Guard< Mutex > aGuard( maMutex );
1168 return mbAutoReverse;
1172 // XAnimationNode
1173 void SAL_CALL AnimationNode::setAutoReverse( sal_Bool _autoreverse )
1175 Guard< Mutex > aGuard( maMutex );
1176 if( bool(_autoreverse) != mbAutoReverse )
1178 mbAutoReverse = _autoreverse;
1179 fireChangeListener();
1184 Sequence< NamedValue > SAL_CALL AnimationNode::getUserData()
1186 Guard< Mutex > aGuard( maMutex );
1187 return maUserData;
1191 void SAL_CALL AnimationNode::setUserData( const Sequence< NamedValue >& _userdata )
1193 Guard< Mutex > aGuard( maMutex );
1194 maUserData = _userdata;
1195 fireChangeListener();
1199 // XChild
1200 Reference< XInterface > SAL_CALL AnimationNode::getParent()
1202 Guard< Mutex > aGuard( maMutex );
1203 return mxParent.get();
1207 // XChild
1208 void SAL_CALL AnimationNode::setParent( const Reference< XInterface >& Parent )
1210 Guard< Mutex > aGuard( maMutex );
1211 if( Parent != mxParent.get() )
1213 mxParent = Parent;
1215 mpParent = nullptr;
1216 Reference< XUnoTunnel > xTunnel( mxParent.get(), UNO_QUERY );
1217 if( xTunnel.is() )
1218 mpParent = reinterpret_cast< AnimationNode* >( sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething( getUnoTunnelId() )));
1220 fireChangeListener();
1225 // XCloneable
1226 Reference< XCloneable > SAL_CALL AnimationNode::createClone()
1228 Guard< Mutex > aGuard( maMutex );
1230 Reference< XCloneable > xNewNode;
1233 xNewNode = new AnimationNode( *this );
1235 if( !maChildren.empty() )
1237 Reference< XTimeContainer > xContainer( xNewNode, UNO_QUERY );
1238 if( xContainer.is() )
1240 for (auto const& child : maChildren)
1242 Reference< XCloneable > xCloneable(child, UNO_QUERY );
1243 if( xCloneable.is() ) try
1245 Reference< XAnimationNode > xNewChildNode( xCloneable->createClone(), UNO_QUERY );
1246 if( xNewChildNode.is() )
1247 xContainer->appendChild( xNewChildNode );
1249 catch(const Exception&)
1251 SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
1257 catch(const Exception&)
1259 SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
1262 return xNewNode;
1266 // XAnimate
1267 Any SAL_CALL AnimationNode::getTarget()
1269 Guard< Mutex > aGuard( maMutex );
1270 return maTarget;
1274 // XAnimate
1275 void SAL_CALL AnimationNode::setTarget( const Any& _target )
1277 Guard< Mutex > aGuard( maMutex );
1278 if( _target != maTarget )
1280 maTarget= _target;
1281 fireChangeListener();
1286 // XAnimate
1287 OUString SAL_CALL AnimationNode::getAttributeName()
1289 Guard< Mutex > aGuard( maMutex );
1290 return maAttributeName;
1294 // XAnimate
1295 void SAL_CALL AnimationNode::setAttributeName( const OUString& _attribute )
1297 Guard< Mutex > aGuard( maMutex );
1298 if( _attribute != maAttributeName )
1300 maAttributeName = _attribute;
1301 fireChangeListener();
1306 // XAnimate
1307 Sequence< Any > SAL_CALL AnimationNode::getValues()
1309 Guard< Mutex > aGuard( maMutex );
1310 return maValues;
1314 // XAnimate
1315 void SAL_CALL AnimationNode::setValues( const Sequence< Any >& _values )
1317 Guard< Mutex > aGuard( maMutex );
1318 maValues = _values;
1319 fireChangeListener();
1323 // XAnimate
1324 sal_Int16 SAL_CALL AnimationNode::getSubItem()
1326 Guard< Mutex > aGuard( maMutex );
1327 return mnSubItem;
1331 // XAnimate
1332 void SAL_CALL AnimationNode::setSubItem( sal_Int16 _subitem )
1334 Guard< Mutex > aGuard( maMutex );
1335 if( _subitem != mnSubItem )
1337 mnSubItem = _subitem;
1338 fireChangeListener();
1343 // XAnimate
1344 Sequence< double > SAL_CALL AnimationNode::getKeyTimes()
1346 Guard< Mutex > aGuard( maMutex );
1347 return maKeyTimes;
1351 // XAnimate
1352 void SAL_CALL AnimationNode::setKeyTimes( const Sequence< double >& _keytimes )
1354 Guard< Mutex > aGuard( maMutex );
1355 maKeyTimes = _keytimes;
1356 fireChangeListener();
1360 // XAnimate
1361 sal_Int16 SAL_CALL AnimationNode::getValueType()
1363 Guard< Mutex > aGuard( maMutex );
1364 return mnValueType;
1368 void SAL_CALL AnimationNode::setValueType( sal_Int16 _valuetype )
1370 Guard< Mutex > aGuard( maMutex );
1371 if( _valuetype != mnValueType )
1373 mnValueType = _valuetype;
1374 fireChangeListener();
1379 // XAnimate
1380 sal_Int16 SAL_CALL AnimationNode::getCalcMode()
1382 Guard< Mutex > aGuard( maMutex );
1383 return mnCalcMode;
1387 // XAnimate
1388 void SAL_CALL AnimationNode::setCalcMode( sal_Int16 _calcmode )
1390 Guard< Mutex > aGuard( maMutex );
1391 if( _calcmode != mnCalcMode )
1393 mnCalcMode = _calcmode;
1394 fireChangeListener();
1399 // XAnimate
1400 sal_Bool SAL_CALL AnimationNode::getAccumulate()
1402 Guard< Mutex > aGuard( maMutex );
1403 return mbAccumulate;
1407 // XAnimate
1408 void SAL_CALL AnimationNode::setAccumulate( sal_Bool _accumulate )
1410 Guard< Mutex > aGuard( maMutex );
1411 if( bool(_accumulate) != mbAccumulate )
1413 mbAccumulate = _accumulate;
1414 fireChangeListener();
1419 // XAnimate
1420 sal_Int16 SAL_CALL AnimationNode::getAdditive()
1422 Guard< Mutex > aGuard( maMutex );
1423 return mnAdditive;
1427 // XAnimate
1428 void SAL_CALL AnimationNode::setAdditive( sal_Int16 _additive )
1430 Guard< Mutex > aGuard( maMutex );
1431 if( _additive != mnAdditive )
1433 mnAdditive = _additive;
1434 fireChangeListener();
1439 // XAnimate
1440 Any SAL_CALL AnimationNode::getFrom()
1442 Guard< Mutex > aGuard( maMutex );
1443 return maFrom;
1447 // XAnimate
1448 void SAL_CALL AnimationNode::setFrom( const Any& _from )
1450 Guard< Mutex > aGuard( maMutex );
1451 if( _from != maFrom )
1453 maFrom = _from;
1454 fireChangeListener();
1459 // XAnimate
1460 Any SAL_CALL AnimationNode::getTo()
1462 Guard< Mutex > aGuard( maMutex );
1463 return maTo;
1467 // XAnimate
1468 void SAL_CALL AnimationNode::setTo( const Any& _to )
1470 Guard< Mutex > aGuard( maMutex );
1471 if( _to != maTo )
1473 maTo = _to;
1474 fireChangeListener();
1479 // XAnimate
1480 Any SAL_CALL AnimationNode::getBy()
1482 Guard< Mutex > aGuard( maMutex );
1483 return maBy;
1487 // XAnimate
1488 void SAL_CALL AnimationNode::setBy( const Any& _by )
1490 Guard< Mutex > aGuard( maMutex );
1491 if( _by != maBy )
1493 maBy = _by;
1494 fireChangeListener();
1499 // XAnimate
1500 Sequence< TimeFilterPair > SAL_CALL AnimationNode::getTimeFilter()
1502 Guard< Mutex > aGuard( maMutex );
1503 return maTimeFilter;
1507 // XAnimate
1508 void SAL_CALL AnimationNode::setTimeFilter( const Sequence< TimeFilterPair >& _timefilter )
1510 Guard< Mutex > aGuard( maMutex );
1511 maTimeFilter = _timefilter;
1512 fireChangeListener();
1516 OUString SAL_CALL AnimationNode::getFormula()
1518 Guard< Mutex > aGuard( maMutex );
1519 return maFormula;
1523 void SAL_CALL AnimationNode::setFormula( const OUString& _formula )
1525 Guard< Mutex > aGuard( maMutex );
1526 if( _formula != maFormula )
1528 maFormula = _formula;
1529 fireChangeListener();
1534 // XAnimateColor
1535 sal_Int16 SAL_CALL AnimationNode::getColorInterpolation()
1537 Guard< Mutex > aGuard( maMutex );
1538 return mnColorSpace;
1542 // XAnimateColor
1543 void SAL_CALL AnimationNode::setColorInterpolation( sal_Int16 _colorspace )
1545 Guard< Mutex > aGuard( maMutex );
1546 if( _colorspace != mnColorSpace )
1548 mnColorSpace = _colorspace;
1549 fireChangeListener();
1554 // XAnimateColor
1555 sal_Bool SAL_CALL AnimationNode::getDirection()
1557 Guard< Mutex > aGuard( maMutex );
1558 return mbDirection;
1562 // XAnimateColor
1563 void SAL_CALL AnimationNode::setDirection( sal_Bool _direction )
1565 Guard< Mutex > aGuard( maMutex );
1566 if( bool(_direction) != mbDirection )
1568 mbDirection = _direction;
1569 fireChangeListener();
1574 // XAnimateMotion
1575 Any SAL_CALL AnimationNode::getPath()
1577 Guard< Mutex > aGuard( maMutex );
1578 return maPath;
1582 // XAnimateMotion
1583 void SAL_CALL AnimationNode::setPath( const Any& _path )
1585 Guard< Mutex > aGuard( maMutex );
1586 maPath = _path;
1587 fireChangeListener();
1591 // XAnimateMotion
1592 Any SAL_CALL AnimationNode::getOrigin()
1594 Guard< Mutex > aGuard( maMutex );
1595 return maOrigin;
1599 // XAnimateMotion
1600 void SAL_CALL AnimationNode::setOrigin( const Any& _origin )
1602 Guard< Mutex > aGuard( maMutex );
1603 maOrigin = _origin;
1604 fireChangeListener();
1607 // XAnimatePhysics
1608 Any SAL_CALL AnimationNode::getStartVelocityX()
1610 Guard< Mutex > aGuard( maMutex );
1611 return maStartVelocityX;
1615 // XAnimatePhysics
1616 void SAL_CALL AnimationNode::setStartVelocityX( const Any& _startvelocityx )
1618 Guard< Mutex > aGuard( maMutex );
1619 maStartVelocityX = _startvelocityx;
1620 fireChangeListener();
1623 // XAnimatePhysics
1624 Any SAL_CALL AnimationNode::getStartVelocityY()
1626 Guard< Mutex > aGuard( maMutex );
1627 return maStartVelocityY;
1631 // XAnimatePhysics
1632 void SAL_CALL AnimationNode::setStartVelocityY( const Any& _startvelocityy )
1634 Guard< Mutex > aGuard( maMutex );
1635 maStartVelocityY = _startvelocityy;
1636 fireChangeListener();
1640 // XAnimatePhysics
1641 Any SAL_CALL AnimationNode::getDensity()
1643 Guard< Mutex > aGuard( maMutex );
1644 return maDensity;
1648 // XAnimatePhysics
1649 void SAL_CALL AnimationNode::setDensity( const Any& _density )
1651 Guard< Mutex > aGuard( maMutex );
1652 maDensity = _density;
1653 fireChangeListener();
1657 // XAnimatePhysics
1658 Any SAL_CALL AnimationNode::getBounciness()
1660 Guard< Mutex > aGuard( maMutex );
1661 return maBounciness;
1665 // XAnimatePhysics
1666 void SAL_CALL AnimationNode::setBounciness( const Any& _bounciness )
1668 Guard< Mutex > aGuard( maMutex );
1669 maBounciness = _bounciness;
1670 fireChangeListener();
1674 // XAnimateTransform
1675 sal_Int16 SAL_CALL AnimationNode::getTransformType()
1677 Guard< Mutex > aGuard( maMutex );
1678 return mnTransformType;
1682 // XAnimateTransform
1683 void SAL_CALL AnimationNode::setTransformType( sal_Int16 _transformtype )
1685 Guard< Mutex > aGuard( maMutex );
1686 if( _transformtype != mnTransformType )
1688 mnTransformType = _transformtype;
1689 fireChangeListener();
1694 // XTransitionFilter
1695 sal_Int16 SAL_CALL AnimationNode::getTransition()
1697 Guard< Mutex > aGuard( maMutex );
1698 return mnTransition;
1702 // XTransitionFilter
1703 void SAL_CALL AnimationNode::setTransition( sal_Int16 _transition )
1705 Guard< Mutex > aGuard( maMutex );
1706 if( _transition != mnTransition )
1708 mnTransition = _transition;
1709 fireChangeListener();
1714 // XTransitionFilter
1715 sal_Int16 SAL_CALL AnimationNode::getSubtype()
1717 Guard< Mutex > aGuard( maMutex );
1718 return mnSubtype;
1722 // XTransitionFilter
1723 void SAL_CALL AnimationNode::setSubtype( sal_Int16 _subtype )
1725 Guard< Mutex > aGuard( maMutex );
1726 if( _subtype != mnSubtype )
1728 mnSubtype = _subtype;
1729 fireChangeListener();
1734 // XTransitionFilter
1735 sal_Bool SAL_CALL AnimationNode::getMode()
1737 Guard< Mutex > aGuard( maMutex );
1738 return mbMode;
1742 // XTransitionFilter
1743 void SAL_CALL AnimationNode::setMode( sal_Bool _mode )
1745 Guard< Mutex > aGuard( maMutex );
1746 if( bool(_mode) != mbMode )
1748 mbMode = _mode;
1749 fireChangeListener();
1754 // XTransitionFilter
1755 sal_Int32 SAL_CALL AnimationNode::getFadeColor()
1757 Guard< Mutex > aGuard( maMutex );
1758 return mnFadeColor;
1762 // XTransitionFilter
1763 void SAL_CALL AnimationNode::setFadeColor( sal_Int32 _fadecolor )
1765 Guard< Mutex > aGuard( maMutex );
1766 if( _fadecolor != mnFadeColor )
1768 mnFadeColor = _fadecolor;
1769 fireChangeListener();
1774 // XAudio
1775 Any SAL_CALL AnimationNode::getSource()
1777 Guard< Mutex > aGuard( maMutex );
1778 return maTarget;
1782 // XAudio
1783 void SAL_CALL AnimationNode::setSource( const Any& _source )
1785 Guard< Mutex > aGuard( maMutex );
1786 maTarget = _source;
1787 fireChangeListener();
1791 // XAudio
1792 double SAL_CALL AnimationNode::getVolume()
1794 Guard< Mutex > aGuard( maMutex );
1795 return mfVolume;
1799 // XAudio
1800 void SAL_CALL AnimationNode::setVolume( double _volume )
1802 Guard< Mutex > aGuard( maMutex );
1803 if( _volume != mfVolume )
1805 mfVolume = _volume;
1806 fireChangeListener();
1811 // XCommand
1812 sal_Int16 SAL_CALL AnimationNode::getCommand()
1814 Guard< Mutex > aGuard( maMutex );
1815 return mnCommand;
1819 // XCommand
1820 void SAL_CALL AnimationNode::setCommand( sal_Int16 _command )
1822 Guard< Mutex > aGuard( maMutex );
1823 if( _command != mnCommand )
1825 mnCommand = _command;
1826 fireChangeListener();
1831 // XCommand
1832 Any SAL_CALL AnimationNode::getParameter()
1834 Guard< Mutex > aGuard( maMutex );
1835 return maParameter;
1839 // XCommand
1840 void SAL_CALL AnimationNode::setParameter( const Any& _parameter )
1842 Guard< Mutex > aGuard( maMutex );
1843 maParameter = _parameter;
1844 fireChangeListener();
1848 // XElementAccess
1849 Type SAL_CALL AnimationNode::getElementType()
1851 return cppu::UnoType<XAnimationNode>::get();
1855 // XElementAccess
1856 sal_Bool SAL_CALL AnimationNode::hasElements()
1858 Guard< Mutex > aGuard( maMutex );
1859 return !maChildren.empty();
1863 // XEnumerationAccess
1864 Reference< XEnumeration > SAL_CALL AnimationNode::createEnumeration()
1866 Guard< Mutex > aGuard( maMutex );
1868 return new TimeContainerEnumeration( maChildren);
1872 // XTimeContainer
1873 Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild )
1875 Guard< Mutex > aGuard( maMutex );
1877 if( !newChild.is() || !refChild.is() )
1878 throw IllegalArgumentException();
1880 if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
1881 throw ElementExistException();
1883 auto before = std::find(maChildren.begin(), maChildren.end(), refChild);
1884 if( before == maChildren.end() )
1885 throw NoSuchElementException();
1887 maChildren.insert( before, newChild );
1889 Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1890 newChild->setParent( xThis );
1892 return newChild;
1896 // XTimeContainer
1897 Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild )
1899 Guard< Mutex > aGuard( maMutex );
1901 if( !newChild.is() || !refChild.is() )
1902 throw IllegalArgumentException();
1904 if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
1905 throw ElementExistException();
1907 auto before = std::find(maChildren.begin(), maChildren.end(), refChild);
1908 if( before == maChildren.end() )
1909 throw NoSuchElementException();
1911 ++before;
1912 if( before != maChildren.end() )
1913 maChildren.insert( before, newChild );
1914 else
1915 maChildren.push_back( newChild );
1917 Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1918 newChild->setParent( xThis );
1920 return newChild;
1924 // XTimeContainer
1925 Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild )
1927 Guard< Mutex > aGuard( maMutex );
1929 if( !newChild.is() || !oldChild.is() )
1930 throw IllegalArgumentException();
1932 if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
1933 throw ElementExistException();
1935 auto replace = std::find(maChildren.begin(), maChildren.end(), oldChild);
1936 if( replace == maChildren.end() )
1937 throw NoSuchElementException();
1939 oldChild->setParent( Reference< XInterface >() );
1941 (*replace) = newChild;
1943 Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1944 newChild->setParent( xThis );
1946 return newChild;
1950 // XTimeContainer
1951 Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference< XAnimationNode >& oldChild )
1953 Guard< Mutex > aGuard( maMutex );
1955 if( !oldChild.is() )
1956 throw IllegalArgumentException();
1958 auto old = std::find(maChildren.begin(), maChildren.end(), oldChild);
1959 if( old == maChildren.end() )
1960 throw NoSuchElementException();
1962 oldChild->setParent( Reference< XInterface >() );
1964 maChildren.erase( old );
1966 return oldChild;
1970 // XTimeContainer
1971 Reference< XAnimationNode > SAL_CALL AnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
1973 Guard< Mutex > aGuard( maMutex );
1975 if( !newChild.is() )
1976 throw IllegalArgumentException();
1978 if( std::find(maChildren.begin(), maChildren.end(), newChild) != maChildren.end() )
1979 throw ElementExistException();
1981 Reference< XInterface > xThis( static_cast< OWeakObject * >(this) );
1982 Reference< XInterface > xChild( newChild );
1984 if( xThis == xChild )
1985 throw IllegalArgumentException();
1987 maChildren.push_back( newChild );
1989 newChild->setParent( xThis );
1991 return newChild;
1995 // XIterateContainer
1996 sal_Int16 SAL_CALL AnimationNode::getIterateType()
1998 Guard< Mutex > aGuard( maMutex );
1999 return mnIterateType;
2003 // XIterateContainer
2004 void SAL_CALL AnimationNode::setIterateType( sal_Int16 _iteratetype )
2006 Guard< Mutex > aGuard( maMutex );
2007 if( _iteratetype != mnIterateType )
2009 mnIterateType = _iteratetype;
2010 fireChangeListener();
2015 // XIterateContainer
2016 double SAL_CALL AnimationNode::getIterateInterval()
2018 Guard< Mutex > aGuard( maMutex );
2019 return mfIterateInterval;
2023 // XIterateContainer
2024 void SAL_CALL AnimationNode::setIterateInterval( double _iterateinterval )
2026 Guard< Mutex > aGuard( maMutex );
2027 if( _iterateinterval != mfIterateInterval )
2029 mfIterateInterval = _iterateinterval;
2030 fireChangeListener();
2035 // XChangesNotifier
2036 void SAL_CALL AnimationNode::addChangesListener( const Reference< XChangesListener >& aListener )
2038 maChangeListener.addInterface( aListener );
2042 // XChangesNotifier
2043 void SAL_CALL AnimationNode::removeChangesListener( const Reference< XChangesListener >& aListener )
2045 maChangeListener.removeInterface(aListener);
2049 // XUnoTunnel
2050 ::sal_Int64 SAL_CALL AnimationNode::getSomething( const Sequence< ::sal_Int8 >& rId )
2052 if( isUnoTunnelId<AnimationNode>(rId) )
2054 return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_IntPtr >(this));
2057 else
2059 return 0;
2063 namespace
2065 class theAnimationNodeUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theAnimationNodeUnoTunnelId > {};
2068 const css::uno::Sequence< sal_Int8 > & AnimationNode::getUnoTunnelId()
2070 return theAnimationNodeUnoTunnelId::get().getSeq();
2074 void AnimationNode::fireChangeListener()
2076 Guard< Mutex > aGuard( maMutex );
2078 OInterfaceIteratorHelper2 aIterator( maChangeListener );
2079 if( aIterator.hasMoreElements() )
2081 Reference< XInterface > xSource( static_cast<OWeakObject*>(this), UNO_QUERY );
2082 Sequence< ElementChange > aChanges;
2083 const ChangesEvent aEvent( xSource, Any( mxParent.get() ), aChanges );
2084 while( aIterator.hasMoreElements() )
2086 Reference< XChangesListener > xListener( aIterator.next(), UNO_QUERY );
2087 if( xListener.is() )
2088 xListener->changesOccurred( aEvent );
2092 //fdo#69645 use WeakReference of mxParent to test if mpParent is still valid
2093 if (mpParent)
2095 Reference<XInterface> xGuard(mxParent);
2096 if (xGuard.is())
2097 mpParent->fireChangeListener();
2102 } // namespace animcore
2105 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2106 com_sun_star_animations_ParallelTimeContainer_get_implementation(css::uno::XComponentContext*,
2107 css::uno::Sequence<css::uno::Any> const &)
2109 return cppu::acquire(new animcore::AnimationNode(PAR));
2112 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2113 com_sun_star_animations_SequenceTimeContainer_get_implementation(css::uno::XComponentContext*,
2114 css::uno::Sequence<css::uno::Any> const &)
2116 return cppu::acquire(new animcore::AnimationNode(SEQ));
2119 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2120 com_sun_star_animations_IterateContainer_get_implementation(css::uno::XComponentContext*,
2121 css::uno::Sequence<css::uno::Any> const &)
2123 return cppu::acquire(new animcore::AnimationNode(ITERATE));
2126 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2127 com_sun_star_animations_Animate_get_implementation(css::uno::XComponentContext*,
2128 css::uno::Sequence<css::uno::Any> const &)
2130 return cppu::acquire(new animcore::AnimationNode(ANIMATE));
2133 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2134 com_sun_star_animations_AnimateSet_get_implementation(css::uno::XComponentContext*,
2135 css::uno::Sequence<css::uno::Any> const &)
2137 return cppu::acquire(new animcore::AnimationNode(SET));
2140 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2141 com_sun_star_animations_AnimateColor_get_implementation(css::uno::XComponentContext*,
2142 css::uno::Sequence<css::uno::Any> const &)
2144 return cppu::acquire(new animcore::AnimationNode(ANIMATECOLOR));
2147 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2148 com_sun_star_animations_AnimateMotion_get_implementation(css::uno::XComponentContext*,
2149 css::uno::Sequence<css::uno::Any> const &)
2151 return cppu::acquire(new animcore::AnimationNode(ANIMATEMOTION));
2154 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2155 com_sun_star_animations_AnimatePhysics_get_implementation(css::uno::XComponentContext*,
2156 css::uno::Sequence<css::uno::Any> const &)
2158 return cppu::acquire(new animcore::AnimationNode(ANIMATEPHYSICS));
2161 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2162 com_sun_star_animations_AnimateTransform_get_implementation(css::uno::XComponentContext*,
2163 css::uno::Sequence<css::uno::Any> const &)
2165 return cppu::acquire(new animcore::AnimationNode(ANIMATETRANSFORM));
2168 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2169 com_sun_star_animations_TransitionFilter_get_implementation(css::uno::XComponentContext*,
2170 css::uno::Sequence<css::uno::Any> const &)
2172 return cppu::acquire(new animcore::AnimationNode(TRANSITIONFILTER));
2175 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2176 com_sun_star_animations_Audio_get_implementation(css::uno::XComponentContext*,
2177 css::uno::Sequence<css::uno::Any> const &)
2179 return cppu::acquire(new animcore::AnimationNode(AUDIO));
2182 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
2183 com_sun_star_animations_Command_get_implementation(css::uno::XComponentContext*,
2184 css::uno::Sequence<css::uno::Any> const &)
2186 return cppu::acquire(new animcore::AnimationNode(COMMAND));
2189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */