1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <com/sun/star/util/XCloneable.hpp>
21 #include <com/sun/star/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 <comphelper/servicehelper.hxx>
49 #include <cppuhelper/basemutex.hxx>
50 #include <cppuhelper/queryinterface.hxx>
51 #include <comphelper/interfacecontainer4.hxx>
52 #include <cppuhelper/supportsservice.hxx>
53 #include <cppuhelper/weakref.hxx>
55 #include <cppuhelper/implbase.hxx>
57 #include <o3tl/safeint.hxx>
58 #include <sal/log.hxx>
59 #include <unotools/weakref.hxx>
65 namespace com::sun::star::uno
{ class XComponentContext
; }
66 namespace com::sun::star::beans
{ struct NamedValue
; }
68 using ::comphelper::OInterfaceContainerHelper4
;
69 using ::comphelper::OInterfaceIteratorHelper4
;
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::XComponentContext
;
76 using ::com::sun::star::uno::Exception
;
77 using ::com::sun::star::uno::XWeak
;
78 using ::com::sun::star::uno::Type
;
79 using ::com::sun::star::uno::Any
;
80 using ::com::sun::star::lang::IllegalArgumentException
;
81 using ::com::sun::star::lang::XServiceInfo
;
82 using ::com::sun::star::lang::XTypeProvider
;
83 using ::com::sun::star::container::NoSuchElementException
;
84 using ::com::sun::star::container::ElementExistException
;
85 using ::com::sun::star::container::XEnumeration
;
86 using ::com::sun::star::container::XEnumerationAccess
;
87 using ::com::sun::star::beans::NamedValue
;
88 using ::com::sun::star::util::XCloneable
;
89 using ::com::sun::star::util::XChangesNotifier
;
90 using ::com::sun::star::util::XChangesListener
;
91 using ::com::sun::star::util::ElementChange
;
92 using ::com::sun::star::util::ChangesEvent
;
94 using ::cppu::OWeakObject
;
96 using namespace ::com::sun::star::animations
;
97 using namespace ::com::sun::star::animations::AnimationNodeType
;
103 class AnimationNodeBase
: public XAnimateMotion
,
104 public XAnimatePhysics
,
105 public XAnimateColor
,
106 public XTransitionFilter
,
108 public XAnimateTransform
,
109 public XParallelTimeContainer
,
110 public XIterateContainer
,
112 public XTypeProvider
,
116 public XChangesNotifier
,
122 class AnimationNode final
: public AnimationNodeBase
125 explicit AnimationNode(sal_Int16 nNodeType
);
126 explicit AnimationNode(const AnimationNode
& rNode
);
129 virtual Any SAL_CALL
queryInterface( const Type
& aType
) override
;
130 virtual void SAL_CALL
acquire() noexcept override
;
131 virtual void SAL_CALL
release() noexcept override
;
134 virtual Sequence
< Type
> SAL_CALL
getTypes() override
;
135 virtual Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
138 OUString SAL_CALL
getImplementationName() override
;
139 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
140 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
143 virtual Reference
< XInterface
> SAL_CALL
getParent() override
;
144 virtual void SAL_CALL
setParent( const Reference
< XInterface
>& Parent
) override
;
147 virtual Reference
< XCloneable
> SAL_CALL
createClone() override
;
150 virtual sal_Int16 SAL_CALL
getType() override
;
151 virtual Any SAL_CALL
getBegin() override
;
152 virtual void SAL_CALL
setBegin( const Any
& _begin
) override
;
153 virtual Any SAL_CALL
getDuration() override
;
154 virtual void SAL_CALL
setDuration( const Any
& _duration
) override
;
155 virtual Any SAL_CALL
getEnd() override
;
156 virtual void SAL_CALL
setEnd( const Any
& _end
) override
;
157 virtual Any SAL_CALL
getEndSync() override
;
158 virtual void SAL_CALL
setEndSync( const Any
& _endsync
) override
;
159 virtual Any SAL_CALL
getRepeatCount() override
;
160 virtual void SAL_CALL
setRepeatCount( const Any
& _repeatcount
) override
;
161 virtual Any SAL_CALL
getRepeatDuration() override
;
162 virtual void SAL_CALL
setRepeatDuration( const Any
& _repeatduration
) override
;
163 virtual sal_Int16 SAL_CALL
getFill() override
;
164 virtual void SAL_CALL
setFill( sal_Int16 _fill
) override
;
165 virtual sal_Int16 SAL_CALL
getFillDefault() override
;
166 virtual void SAL_CALL
setFillDefault( sal_Int16 _filldefault
) override
;
167 virtual sal_Int16 SAL_CALL
getRestart() override
;
168 virtual void SAL_CALL
setRestart( sal_Int16 _restart
) override
;
169 virtual sal_Int16 SAL_CALL
getRestartDefault() override
;
170 virtual void SAL_CALL
setRestartDefault( sal_Int16 _restartdefault
) override
;
171 virtual double SAL_CALL
getAcceleration() override
;
172 virtual void SAL_CALL
setAcceleration( double _acceleration
) override
;
173 virtual double SAL_CALL
getDecelerate() override
;
174 virtual void SAL_CALL
setDecelerate( double _decelerate
) override
;
175 virtual sal_Bool SAL_CALL
getAutoReverse() override
;
176 virtual void SAL_CALL
setAutoReverse( sal_Bool _autoreverse
) override
;
177 virtual Sequence
< NamedValue
> SAL_CALL
getUserData() override
;
178 virtual void SAL_CALL
setUserData( const Sequence
< NamedValue
>& _userdata
) override
;
181 virtual Any SAL_CALL
getTarget() override
;
182 virtual void SAL_CALL
setTarget( const Any
& _target
) override
;
183 virtual sal_Int16 SAL_CALL
getSubItem() override
;
184 virtual void SAL_CALL
setSubItem( sal_Int16 _subitem
) override
;
185 virtual OUString SAL_CALL
getAttributeName() override
;
186 virtual void SAL_CALL
setAttributeName( const OUString
& _attribute
) override
;
187 virtual Sequence
< Any
> SAL_CALL
getValues() override
;
188 virtual void SAL_CALL
setValues( const Sequence
< Any
>& _values
) override
;
189 virtual Sequence
< double > SAL_CALL
getKeyTimes() override
;
190 virtual void SAL_CALL
setKeyTimes( const Sequence
< double >& _keytimes
) override
;
191 virtual sal_Int16 SAL_CALL
getValueType() override
;
192 virtual void SAL_CALL
setValueType( sal_Int16 _valuetype
) override
;
193 virtual sal_Int16 SAL_CALL
getCalcMode() override
;
194 virtual void SAL_CALL
setCalcMode( sal_Int16 _calcmode
) override
;
195 virtual sal_Bool SAL_CALL
getAccumulate() override
;
196 virtual void SAL_CALL
setAccumulate( sal_Bool _accumulate
) override
;
197 virtual sal_Int16 SAL_CALL
getAdditive() override
;
198 virtual void SAL_CALL
setAdditive( sal_Int16 _additive
) override
;
199 virtual Any SAL_CALL
getFrom() override
;
200 virtual void SAL_CALL
setFrom( const Any
& _from
) override
;
201 virtual Any SAL_CALL
getTo() override
;
202 virtual void SAL_CALL
setTo( const Any
& _to
) override
;
203 virtual Any SAL_CALL
getBy() override
;
204 virtual void SAL_CALL
setBy( const Any
& _by
) override
;
205 virtual Sequence
< TimeFilterPair
> SAL_CALL
getTimeFilter() override
;
206 virtual void SAL_CALL
setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
) override
;
207 virtual OUString SAL_CALL
getFormula() override
;
208 virtual void SAL_CALL
setFormula( const OUString
& _formula
) override
;
211 virtual sal_Int16 SAL_CALL
getColorInterpolation() override
;
212 virtual void SAL_CALL
setColorInterpolation( sal_Int16 _colorspace
) override
;
213 virtual sal_Bool SAL_CALL
getDirection() override
;
214 virtual void SAL_CALL
setDirection( sal_Bool _direction
) override
;
217 virtual Any SAL_CALL
getPath() override
;
218 virtual void SAL_CALL
setPath( const Any
& _path
) override
;
219 virtual Any SAL_CALL
getOrigin() override
;
220 virtual void SAL_CALL
setOrigin( const Any
& _origin
) override
;
223 virtual Any SAL_CALL
getStartVelocityX() override
;
224 virtual void SAL_CALL
setStartVelocityX( const Any
& _startvelocityx
) override
;
225 virtual Any SAL_CALL
getStartVelocityY() override
;
226 virtual void SAL_CALL
setStartVelocityY( const Any
& _startvelocityy
) override
;
227 virtual Any SAL_CALL
getDensity() override
;
228 virtual void SAL_CALL
setDensity( const Any
& _density
) override
;
229 virtual Any SAL_CALL
getBounciness() override
;
230 virtual void SAL_CALL
setBounciness( const Any
& _bounciness
) override
;
233 virtual sal_Int16 SAL_CALL
getTransformType() override
;
234 virtual void SAL_CALL
setTransformType( sal_Int16 _transformtype
) override
;
237 virtual sal_Int16 SAL_CALL
getTransition() override
;
238 virtual void SAL_CALL
setTransition( sal_Int16 _transition
) override
;
239 virtual sal_Int16 SAL_CALL
getSubtype() override
;
240 virtual void SAL_CALL
setSubtype( sal_Int16 _subtype
) override
;
241 virtual sal_Bool SAL_CALL
getMode() override
;
242 virtual void SAL_CALL
setMode( sal_Bool _mode
) override
;
243 virtual sal_Int32 SAL_CALL
getFadeColor() override
;
244 virtual void SAL_CALL
setFadeColor( sal_Int32 _fadecolor
) override
;
247 virtual Any SAL_CALL
getSource() override
;
248 virtual void SAL_CALL
setSource( const Any
& _source
) override
;
249 virtual double SAL_CALL
getVolume() override
;
250 virtual void SAL_CALL
setVolume( double _volume
) override
;
251 sal_Bool SAL_CALL
getHideDuringShow() override
;
252 void SAL_CALL
setHideDuringShow(sal_Bool bHideDuringShow
) override
;
253 sal_Bool SAL_CALL
getNarration() override
;
254 void SAL_CALL
setNarration(sal_Bool bNarration
) override
;
257 // XCommand - the following two shadowed by animate, unfortunately
258 // virtual Any SAL_CALL getTarget() throw (RuntimeException);
259 // virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
260 virtual sal_Int16 SAL_CALL
getCommand() override
;
261 virtual void SAL_CALL
setCommand( sal_Int16 _command
) override
;
262 virtual Any SAL_CALL
getParameter() override
;
263 virtual void SAL_CALL
setParameter( const Any
& _parameter
) override
;
266 virtual Type SAL_CALL
getElementType() override
;
267 virtual sal_Bool SAL_CALL
hasElements() override
;
269 // XEnumerationAccess
270 virtual Reference
< XEnumeration
> SAL_CALL
createEnumeration() override
;
273 virtual Reference
< XAnimationNode
> SAL_CALL
insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) override
;
274 virtual Reference
< XAnimationNode
> SAL_CALL
insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) override
;
275 virtual Reference
< XAnimationNode
> SAL_CALL
replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
) override
;
276 virtual Reference
< XAnimationNode
> SAL_CALL
removeChild( const Reference
< XAnimationNode
>& oldChild
) override
;
277 virtual Reference
< XAnimationNode
> SAL_CALL
appendChild( const Reference
< XAnimationNode
>& newChild
) override
;
280 virtual sal_Int16 SAL_CALL
getIterateType() override
;
281 virtual void SAL_CALL
setIterateType( sal_Int16 _iteratetype
) override
;
282 virtual double SAL_CALL
getIterateInterval() override
;
283 virtual void SAL_CALL
setIterateInterval( double _iterateinterval
) override
;
286 virtual void SAL_CALL
addChangesListener( const Reference
< XChangesListener
>& aListener
) override
;
287 virtual void SAL_CALL
removeChangesListener( const Reference
< XChangesListener
>& aListener
) override
;
289 void fireChangeListener(std::unique_lock
<std::mutex
>&);
293 OInterfaceContainerHelper4
<XChangesListener
> maChangeListener
;
295 static void initTypeProvider( sal_Int16 nNodeType
) noexcept
;
297 const sal_Int16 mnNodeType
;
300 static std::array
<Sequence
< Type
>*, 13> mpTypes
;
302 // attributes for the XAnimationNode interface implementation
303 Any maBegin
, maDuration
, maEnd
, maEndSync
, maRepeatCount
, maRepeatDuration
;
304 sal_Int16 mnFill
, mnFillDefault
, mnRestart
, mnRestartDefault
;
305 double mfAcceleration
, mfDecelerate
;
307 Sequence
< NamedValue
> maUserData
;
309 // parent interface for XChild interface implementation
310 unotools::WeakReference
<AnimationNode
> mxParent
;
312 // attributes for XAnimate
314 OUString maAttributeName
, maFormula
;
315 Sequence
< Any
> maValues
;
316 Sequence
< double > maKeyTimes
;
317 sal_Int16 mnValueType
, mnSubItem
;
318 sal_Int16 mnCalcMode
, mnAdditive
;
320 Any maFrom
, maTo
, maBy
;
321 Sequence
< TimeFilterPair
> maTimeFilter
;
323 // attributes for XAnimateColor
324 sal_Int16 mnColorSpace
;
327 // attributes for XAnimateMotion
328 Any maPath
, maOrigin
;
330 // attributes for XAnimatePhysics
331 Any maStartVelocityX
, maStartVelocityY
, maDensity
, maBounciness
;
333 // attributes for XAnimateTransform
334 sal_Int16 mnTransformType
;
336 // attributes for XTransitionFilter
337 sal_Int16 mnTransition
;
340 sal_Int32 mnFadeColor
;
344 bool mbHideDuringShow
;
352 sal_Int16 mnIterateType
;
353 double mfIterateInterval
;
355 /** sorted list of child nodes for XTimeContainer*/
356 std::vector
< Reference
< XAnimationNode
> > maChildren
;
360 class TimeContainerEnumeration
: public ::cppu::WeakImplHelper
< XEnumeration
>
363 explicit TimeContainerEnumeration( std::vector
< Reference
< XAnimationNode
> >&& rChildren
);
366 virtual sal_Bool SAL_CALL
hasMoreElements() override
;
367 virtual Any SAL_CALL
nextElement( ) override
;
372 /** sorted list of child nodes */
373 std::vector
< Reference
< XAnimationNode
> > maChildren
;
375 /** current iteration position */
376 std::vector
< Reference
< XAnimationNode
> >::iterator maIter
;
381 TimeContainerEnumeration::TimeContainerEnumeration( std::vector
< Reference
< XAnimationNode
> >&& rChildren
)
382 : maChildren( std::move(rChildren
) )
384 maIter
= maChildren
.begin();
388 sal_Bool SAL_CALL
TimeContainerEnumeration::hasMoreElements()
390 std::unique_lock
aGuard( m_aMutex
);
392 return maIter
!= maChildren
.end();
395 Any SAL_CALL
TimeContainerEnumeration::nextElement()
397 std::unique_lock
aGuard( m_aMutex
);
399 if( maIter
== maChildren
.end() )
400 throw NoSuchElementException();
402 return Any( *maIter
++ );
406 std::array
<Sequence
< Type
>*, 13> AnimationNode::mpTypes
= { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
408 AnimationNode::AnimationNode( sal_Int16 nNodeType
)
409 : AnimationNodeBase(),
410 mnNodeType( nNodeType
),
411 mnFill( AnimationFill::DEFAULT
),
412 mnFillDefault( AnimationFill::INHERIT
),
413 mnRestart( AnimationRestart:: DEFAULT
),
414 mnRestartDefault( AnimationRestart:: INHERIT
),
415 mfAcceleration( 0.0 ),
417 mbAutoReverse( false ),
420 mnCalcMode( (nNodeType
== AnimationNodeType::ANIMATEMOTION
) ? AnimationCalcMode::PACED
: AnimationCalcMode::LINEAR
),
421 mnAdditive(AnimationAdditiveMode::REPLACE
),
423 mnColorSpace( AnimationColorSpace::RGB
),
425 mnTransformType( AnimationTransformType::TRANSLATE
),
426 mnTransition(TransitionType::BARWIPE
),
427 mnSubtype(TransitionSubType::DEFAULT
),
431 mbHideDuringShow(false),
434 mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE
),
435 mfIterateInterval(0.0)
437 assert(nNodeType
>= 0 && o3tl::make_unsigned(nNodeType
) < mpTypes
.size());
440 AnimationNode::AnimationNode( const AnimationNode
& rNode
)
441 : AnimationNodeBase(),
442 mnNodeType( rNode
.mnNodeType
),
444 // attributes for the XAnimationNode interface implementation
445 maBegin( rNode
.maBegin
),
446 maDuration( rNode
.maDuration
),
447 maEnd( rNode
.maEnd
),
448 maEndSync( rNode
.maEndSync
),
449 maRepeatCount( rNode
.maRepeatCount
),
450 maRepeatDuration( rNode
.maRepeatDuration
),
451 mnFill( rNode
.mnFill
),
452 mnFillDefault( rNode
.mnFillDefault
),
453 mnRestart( rNode
.mnRestart
),
454 mnRestartDefault( rNode
.mnRestartDefault
),
455 mfAcceleration( rNode
.mfAcceleration
),
456 mfDecelerate( rNode
.mfDecelerate
),
457 mbAutoReverse( rNode
.mbAutoReverse
),
458 maUserData( rNode
.maUserData
),
460 // attributes for XAnimate
461 maTarget( rNode
.maTarget
),
462 maAttributeName( rNode
.maAttributeName
),
463 maFormula( rNode
.maFormula
),
464 maValues( rNode
.maValues
),
465 maKeyTimes( rNode
.maKeyTimes
),
466 mnValueType( rNode
.mnValueType
),
467 mnSubItem( rNode
.mnSubItem
),
468 mnCalcMode( rNode
.mnCalcMode
),
469 mnAdditive( rNode
.mnAdditive
),
470 mbAccumulate( rNode
.mbAccumulate
),
471 maFrom( rNode
.maFrom
),
474 maTimeFilter( rNode
.maTimeFilter
),
476 // attributes for XAnimateColor
477 mnColorSpace( rNode
.mnColorSpace
),
478 mbDirection( rNode
.mbDirection
),
480 // attributes for XAnimateMotion
481 maPath( rNode
.maPath
),
482 maOrigin( rNode
.maOrigin
),
484 // attributes for XAnimatePhysics
485 maStartVelocityX( rNode
.maStartVelocityX
),
486 maStartVelocityY( rNode
.maStartVelocityY
),
487 maDensity( rNode
.maDensity
),
488 maBounciness( rNode
.maBounciness
),
490 // attributes for XAnimateTransform
491 mnTransformType( rNode
.mnTransformType
),
493 // attributes for XTransitionFilter
494 mnTransition( rNode
.mnTransition
),
495 mnSubtype( rNode
.mnSubtype
),
496 mbMode( rNode
.mbMode
),
497 mnFadeColor( rNode
.mnFadeColor
),
500 mfVolume( rNode
.mfVolume
),
501 mbHideDuringShow(rNode
.mbHideDuringShow
),
502 mbNarration(rNode
.mbNarration
),
505 mnCommand( rNode
.mnCommand
),
506 maParameter( rNode
.maParameter
),
509 mnIterateType( rNode
.mnIterateType
),
510 mfIterateInterval( rNode
.mfIterateInterval
)
514 static Sequence
<OUString
> getSupportedServiceNames_PAR()
516 return { "com.sun.star.animations.ParallelTimeContainer" };
519 static OUString
getImplementationName_PAR()
521 return "animcore::ParallelTimeContainer";
524 static Sequence
<OUString
> getSupportedServiceNames_SEQ()
526 return { "com.sun.star.animations.SequenceTimeContainer" };
529 static OUString
getImplementationName_SEQ()
531 return "animcore::SequenceTimeContainer";
534 static Sequence
<OUString
> getSupportedServiceNames_ITERATE()
536 return { "com.sun.star.animations.IterateContainer" };
539 static OUString
getImplementationName_ITERATE()
541 return "animcore::IterateContainer";
544 static Sequence
<OUString
> getSupportedServiceNames_ANIMATE()
546 return { "com.sun.star.animations.Animate" };
549 static OUString
getImplementationName_ANIMATE()
551 return "animcore::Animate";
554 static Sequence
<OUString
> getSupportedServiceNames_SET()
556 return { "com.sun.star.animations.AnimateSet" };
559 static OUString
getImplementationName_SET()
561 return "animcore::AnimateSet";
564 static Sequence
<OUString
> getSupportedServiceNames_ANIMATECOLOR()
566 return { "com.sun.star.animations.AnimateColor" };
569 static OUString
getImplementationName_ANIMATECOLOR()
571 return "animcore::AnimateColor";
574 static Sequence
<OUString
> getSupportedServiceNames_ANIMATEMOTION()
576 return { "com.sun.star.animations.AnimateMotion" };
579 static OUString
getImplementationName_ANIMATEMOTION()
581 return "animcore::AnimateMotion";
584 static Sequence
<OUString
> getSupportedServiceNames_ANIMATEPHYSICS()
586 return { "com.sun.star.animations.AnimatePhysics" };
589 static OUString
getImplementationName_ANIMATEPHYSICS()
591 return "animcore::AnimatePhysics";
594 static Sequence
<OUString
> getSupportedServiceNames_ANIMATETRANSFORM()
596 return { "com.sun.star.animations.AnimateTransform" };
599 static OUString
getImplementationName_ANIMATETRANSFORM()
601 return "animcore::AnimateTransform";
604 static Sequence
<OUString
> getSupportedServiceNames_TRANSITIONFILTER()
606 return { "com.sun.star.animations.TransitionFilter" };
609 static OUString
getImplementationName_TRANSITIONFILTER()
611 return "animcore::TransitionFilter";
614 static Sequence
<OUString
> getSupportedServiceNames_AUDIO()
616 return { "com.sun.star.animations.Audio" };
619 static OUString
getImplementationName_AUDIO()
621 return "animcore::Audio";
624 static Sequence
<OUString
> getSupportedServiceNames_COMMAND()
626 return { "com.sun.star.animations.Command" };
629 static OUString
getImplementationName_COMMAND()
631 return "animcore::Command";
635 Any SAL_CALL
AnimationNode::queryInterface( const Type
& aType
)
637 Any
aRet( ::cppu::queryInterface(
639 static_cast< XServiceInfo
* >( this ),
640 static_cast< XTypeProvider
* >( this ),
641 static_cast< XChild
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
642 static_cast< XCloneable
* >( this ),
643 static_cast< XAnimationNode
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
644 static_cast< XInterface
* >(static_cast< OWeakObject
* >(this)),
645 static_cast< XWeak
* >(static_cast< OWeakObject
* >(this)),
646 static_cast< XChangesNotifier
* >( this ) ) );
652 case AnimationNodeType::PAR
:
653 aRet
= ::cppu::queryInterface(
655 static_cast< XParallelTimeContainer
* >( this ),
656 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
657 static_cast< XEnumerationAccess
* >( this ),
658 static_cast< XElementAccess
* >( this ) );
660 case AnimationNodeType::SEQ
:
661 aRet
= ::cppu::queryInterface(
663 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
664 static_cast< XEnumerationAccess
* >( this ),
665 static_cast< XElementAccess
* >( this ) );
667 case AnimationNodeType::ITERATE
:
668 aRet
= ::cppu::queryInterface(
670 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
671 static_cast< XIterateContainer
* >( this ),
672 static_cast< XEnumerationAccess
* >( this ),
673 static_cast< XElementAccess
* >( this ) );
675 case AnimationNodeType::ANIMATE
:
676 aRet
= ::cppu::queryInterface(
678 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ) );
680 case AnimationNodeType::ANIMATEMOTION
:
681 aRet
= ::cppu::queryInterface(
683 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ),
684 static_cast< XAnimateMotion
* >( this ) );
686 case AnimationNodeType::ANIMATEPHYSICS
:
687 aRet
= ::cppu::queryInterface(
689 static_cast< XAnimate
* >( static_cast< XAnimatePhysics
* >(this) ),
690 static_cast< XAnimatePhysics
* >( this ) );
692 case AnimationNodeType::ANIMATECOLOR
:
693 aRet
= ::cppu::queryInterface(
695 static_cast< XAnimate
* >( static_cast< XAnimateColor
* >(this) ),
696 static_cast< XAnimateColor
* >( this ) );
698 case AnimationNodeType::SET
:
699 aRet
= ::cppu::queryInterface(
701 static_cast< XAnimate
* >( static_cast< XAnimateSet
* >(this) ),
702 static_cast< XAnimateSet
* >( this ) );
704 case AnimationNodeType::ANIMATETRANSFORM
:
705 aRet
= ::cppu::queryInterface(
707 static_cast< XAnimate
* >( static_cast< XAnimateTransform
* >(this) ),
708 static_cast< XAnimateTransform
* >( this ) );
710 case AnimationNodeType::AUDIO
:
711 aRet
= ::cppu::queryInterface(aType
, static_cast< XAudio
* >(this) );
713 case AnimationNodeType::COMMAND
:
714 aRet
= ::cppu::queryInterface(
715 aType
, static_cast< XCommand
* >(this) );
717 case AnimationNodeType::TRANSITIONFILTER
:
718 aRet
= ::cppu::queryInterface(
720 static_cast< XAnimate
* >( static_cast< XTransitionFilter
* >(this) ),
721 static_cast< XTransitionFilter
* >( this ) );
726 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( aType
);
730 void AnimationNode::initTypeProvider( sal_Int16 nNodeType
) noexcept
732 static std::mutex aMutex
;
734 std::scoped_lock
aGuard(aMutex
);
736 if( mpTypes
[nNodeType
] )
739 static constexpr std::array
<sal_Int32
, mpTypes
.size()> type_numbers
=
749 7, // ANIMATETRANSFORM
750 7, // TRANSITIONFILTER
757 Sequence
< Type
> * types
= new Sequence
< Type
>( type_numbers
[nNodeType
] );
758 Type
* pTypeAr
= types
->getArray();
761 pTypeAr
[nPos
++] = cppu::UnoType
<XWeak
>::get();
762 pTypeAr
[nPos
++] = cppu::UnoType
<XChild
>::get();
763 pTypeAr
[nPos
++] = cppu::UnoType
<XCloneable
>::get();
764 pTypeAr
[nPos
++] = cppu::UnoType
<XTypeProvider
>::get();
765 pTypeAr
[nPos
++] = cppu::UnoType
<XServiceInfo
>::get();
766 pTypeAr
[nPos
++] = cppu::UnoType
<XChangesNotifier
>::get();
770 case AnimationNodeType::PAR
:
771 case AnimationNodeType::SEQ
:
772 pTypeAr
[nPos
++] = cppu::UnoType
<XTimeContainer
>::get();
773 pTypeAr
[nPos
++] = cppu::UnoType
<XEnumerationAccess
>::get();
775 case AnimationNodeType::ITERATE
:
776 pTypeAr
[nPos
++] = cppu::UnoType
<XIterateContainer
>::get();
777 pTypeAr
[nPos
++] = cppu::UnoType
<XEnumerationAccess
>::get();
779 case AnimationNodeType::ANIMATE
:
780 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimate
>::get();
782 case AnimationNodeType::ANIMATEMOTION
:
783 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateMotion
>::get();
785 case AnimationNodeType::ANIMATEPHYSICS
:
786 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimatePhysics
>::get();
788 case AnimationNodeType::ANIMATECOLOR
:
789 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateColor
>::get();
791 case AnimationNodeType::ANIMATETRANSFORM
:
792 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateTransform
>::get();
794 case AnimationNodeType::SET
:
795 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateSet
>::get();
797 case AnimationNodeType::TRANSITIONFILTER
:
798 pTypeAr
[nPos
++] = cppu::UnoType
<XTransitionFilter
>::get();
800 case AnimationNodeType::AUDIO
:
801 pTypeAr
[nPos
++] = cppu::UnoType
<XAudio
>::get();
803 case AnimationNodeType::COMMAND
:
804 pTypeAr
[nPos
++] = cppu::UnoType
<XCommand
>::get();
807 mpTypes
[nNodeType
] = types
;
811 Sequence
< Type
> AnimationNode::getTypes()
813 if (! mpTypes
[mnNodeType
])
814 initTypeProvider(mnNodeType
);
815 return *mpTypes
[mnNodeType
];
819 Sequence
< sal_Int8
> AnimationNode::getImplementationId()
821 return css::uno::Sequence
<sal_Int8
>();
826 void SAL_CALL
AnimationNode::acquire( ) noexcept
828 OWeakObject::acquire();
833 void SAL_CALL
AnimationNode::release( ) noexcept
835 OWeakObject::release();
840 OUString
AnimationNode::getImplementationName()
844 case AnimationNodeType::PAR
:
845 return getImplementationName_PAR();
846 case AnimationNodeType::SEQ
:
847 return getImplementationName_SEQ();
848 case AnimationNodeType::ITERATE
:
849 return getImplementationName_ITERATE();
850 case AnimationNodeType::SET
:
851 return getImplementationName_SET();
852 case AnimationNodeType::ANIMATECOLOR
:
853 return getImplementationName_ANIMATECOLOR();
854 case AnimationNodeType::ANIMATEMOTION
:
855 return getImplementationName_ANIMATEMOTION();
856 case AnimationNodeType::ANIMATEPHYSICS
:
857 return getImplementationName_ANIMATEPHYSICS();
858 case AnimationNodeType::TRANSITIONFILTER
:
859 return getImplementationName_TRANSITIONFILTER();
860 case AnimationNodeType::ANIMATETRANSFORM
:
861 return getImplementationName_ANIMATETRANSFORM();
862 case AnimationNodeType::AUDIO
:
863 return getImplementationName_AUDIO();
864 case AnimationNodeType::COMMAND
:
865 return getImplementationName_COMMAND();
866 case AnimationNodeType::ANIMATE
:
868 return getImplementationName_ANIMATE();
873 sal_Bool
AnimationNode::supportsService(const OUString
& ServiceName
)
875 return cppu::supportsService(this, ServiceName
);
879 Sequence
< OUString
> AnimationNode::getSupportedServiceNames()
883 case AnimationNodeType::PAR
:
884 return getSupportedServiceNames_PAR();
885 case AnimationNodeType::SEQ
:
886 return getSupportedServiceNames_SEQ();
887 case AnimationNodeType::ITERATE
:
888 return getSupportedServiceNames_ITERATE();
889 case AnimationNodeType::SET
:
890 return getSupportedServiceNames_SET();
891 case AnimationNodeType::ANIMATECOLOR
:
892 return getSupportedServiceNames_ANIMATECOLOR();
893 case AnimationNodeType::ANIMATEMOTION
:
894 return getSupportedServiceNames_ANIMATEMOTION();
895 case AnimationNodeType::ANIMATEPHYSICS
:
896 return getSupportedServiceNames_ANIMATEPHYSICS();
897 case AnimationNodeType::TRANSITIONFILTER
:
898 return getSupportedServiceNames_TRANSITIONFILTER();
899 case AnimationNodeType::ANIMATETRANSFORM
:
900 return getSupportedServiceNames_ANIMATETRANSFORM();
901 case AnimationNodeType::AUDIO
:
902 return getSupportedServiceNames_AUDIO();
903 case AnimationNodeType::COMMAND
:
904 return getSupportedServiceNames_COMMAND();
905 case AnimationNodeType::ANIMATE
:
907 return getSupportedServiceNames_ANIMATE();
913 sal_Int16 SAL_CALL
AnimationNode::getType()
915 std::unique_lock
aGuard( m_aMutex
);
921 Any SAL_CALL
AnimationNode::getBegin()
923 std::unique_lock
aGuard( m_aMutex
);
929 void SAL_CALL
AnimationNode::setBegin( const Any
& _begin
)
931 std::unique_lock
aGuard( m_aMutex
);
932 if( _begin
!= maBegin
)
935 fireChangeListener(aGuard
);
941 Any SAL_CALL
AnimationNode::getDuration()
943 std::unique_lock
aGuard( m_aMutex
);
949 void SAL_CALL
AnimationNode::setDuration( const Any
& _duration
)
951 std::unique_lock
aGuard( m_aMutex
);
952 if( _duration
!= maDuration
)
954 maDuration
= _duration
;
955 fireChangeListener(aGuard
);
961 Any SAL_CALL
AnimationNode::getEnd()
963 std::unique_lock
aGuard( m_aMutex
);
969 void SAL_CALL
AnimationNode::setEnd( const Any
& _end
)
971 std::unique_lock
aGuard( m_aMutex
);
975 fireChangeListener(aGuard
);
981 Any SAL_CALL
AnimationNode::getEndSync()
983 std::unique_lock
aGuard( m_aMutex
);
989 void SAL_CALL
AnimationNode::setEndSync( const Any
& _endsync
)
991 std::unique_lock
l( m_aMutex
);
992 if( _endsync
!= maEndSync
)
994 maEndSync
= _endsync
;
995 fireChangeListener(l
);
1001 Any SAL_CALL
AnimationNode::getRepeatCount()
1003 std::unique_lock
aGuard( m_aMutex
);
1004 return maRepeatCount
;
1009 void SAL_CALL
AnimationNode::setRepeatCount( const Any
& _repeatcount
)
1011 std::unique_lock
l( m_aMutex
);
1012 if( _repeatcount
!= maRepeatCount
)
1014 maRepeatCount
= _repeatcount
;
1015 fireChangeListener(l
);
1021 Any SAL_CALL
AnimationNode::getRepeatDuration()
1023 std::unique_lock
aGuard( m_aMutex
);
1024 return maRepeatDuration
;
1029 void SAL_CALL
AnimationNode::setRepeatDuration( const Any
& _repeatduration
)
1031 std::unique_lock
l( m_aMutex
);
1032 if( _repeatduration
!= maRepeatDuration
)
1034 maRepeatDuration
= _repeatduration
;
1035 fireChangeListener(l
);
1041 sal_Int16 SAL_CALL
AnimationNode::getFill()
1043 std::unique_lock
aGuard( m_aMutex
);
1049 void SAL_CALL
AnimationNode::setFill( sal_Int16 _fill
)
1051 std::unique_lock
l( m_aMutex
);
1052 if( _fill
!= mnFill
)
1055 fireChangeListener(l
);
1061 sal_Int16 SAL_CALL
AnimationNode::getFillDefault()
1063 std::unique_lock
aGuard( m_aMutex
);
1064 return mnFillDefault
;
1069 void SAL_CALL
AnimationNode::setFillDefault( sal_Int16 _filldefault
)
1071 std::unique_lock
l( m_aMutex
);
1072 if( _filldefault
!= mnFillDefault
)
1074 mnFillDefault
= _filldefault
;
1075 fireChangeListener(l
);
1081 sal_Int16 SAL_CALL
AnimationNode::getRestart()
1083 std::unique_lock
aGuard( m_aMutex
);
1089 void SAL_CALL
AnimationNode::setRestart( sal_Int16 _restart
)
1091 std::unique_lock
l( m_aMutex
);
1092 if( _restart
!= mnRestart
)
1094 mnRestart
= _restart
;
1095 fireChangeListener(l
);
1101 sal_Int16 SAL_CALL
AnimationNode::getRestartDefault()
1103 std::unique_lock
aGuard( m_aMutex
);
1104 return mnRestartDefault
;
1109 void SAL_CALL
AnimationNode::setRestartDefault( sal_Int16 _restartdefault
)
1111 std::unique_lock
l( m_aMutex
);
1112 if( _restartdefault
!= mnRestartDefault
)
1114 mnRestartDefault
= _restartdefault
;
1115 fireChangeListener(l
);
1121 double SAL_CALL
AnimationNode::getAcceleration()
1123 std::unique_lock
aGuard( m_aMutex
);
1124 return mfAcceleration
;
1129 void SAL_CALL
AnimationNode::setAcceleration( double _acceleration
)
1131 std::unique_lock
l( m_aMutex
);
1132 if( _acceleration
!= mfAcceleration
)
1134 mfAcceleration
= _acceleration
;
1135 fireChangeListener(l
);
1141 double SAL_CALL
AnimationNode::getDecelerate()
1143 std::unique_lock
aGuard( m_aMutex
);
1144 return mfDecelerate
;
1149 void SAL_CALL
AnimationNode::setDecelerate( double _decelerate
)
1151 std::unique_lock
l( m_aMutex
);
1152 if( _decelerate
!= mfDecelerate
)
1154 mfDecelerate
= _decelerate
;
1155 fireChangeListener(l
);
1161 sal_Bool SAL_CALL
AnimationNode::getAutoReverse()
1163 std::unique_lock
aGuard( m_aMutex
);
1164 return mbAutoReverse
;
1169 void SAL_CALL
AnimationNode::setAutoReverse( sal_Bool _autoreverse
)
1171 std::unique_lock
l( m_aMutex
);
1172 if( bool(_autoreverse
) != mbAutoReverse
)
1174 mbAutoReverse
= _autoreverse
;
1175 fireChangeListener(l
);
1180 Sequence
< NamedValue
> SAL_CALL
AnimationNode::getUserData()
1182 std::unique_lock
aGuard( m_aMutex
);
1187 void SAL_CALL
AnimationNode::setUserData( const Sequence
< NamedValue
>& _userdata
)
1189 std::unique_lock
l( m_aMutex
);
1190 maUserData
= _userdata
;
1191 fireChangeListener(l
);
1196 Reference
< XInterface
> SAL_CALL
AnimationNode::getParent()
1198 std::unique_lock
aGuard( m_aMutex
);
1199 return static_cast<cppu::OWeakObject
*>(mxParent
.get().get());
1204 void SAL_CALL
AnimationNode::setParent( const Reference
< XInterface
>& Parent
)
1206 std::unique_lock
l( m_aMutex
);
1207 if( Parent
.get() != static_cast<cppu::OWeakObject
*>(mxParent
.get().get()) )
1209 rtl::Reference
<AnimationNode
> xParent
= dynamic_cast<AnimationNode
*>(Parent
.get());
1210 mxParent
= xParent
.get();
1211 assert(bool(xParent
) == bool(Parent
) && "only support AnimationNode subtypes");
1213 fireChangeListener(l
);
1219 Reference
< XCloneable
> SAL_CALL
AnimationNode::createClone()
1221 std::unique_lock
aGuard( m_aMutex
);
1223 Reference
< XCloneable
> xNewNode
;
1226 xNewNode
= new AnimationNode( *this );
1228 if( !maChildren
.empty() )
1230 Reference
< XTimeContainer
> xContainer( xNewNode
, UNO_QUERY
);
1231 if( xContainer
.is() )
1233 for (auto const& child
: maChildren
)
1235 Reference
< XCloneable
> xCloneable(child
, UNO_QUERY
);
1236 if( xCloneable
.is() ) try
1238 Reference
< XAnimationNode
> xNewChildNode( xCloneable
->createClone(), UNO_QUERY
);
1239 if( xNewChildNode
.is() )
1240 xContainer
->appendChild( xNewChildNode
);
1242 catch(const Exception
&)
1244 SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
1250 catch(const Exception
&)
1252 SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
1260 Any SAL_CALL
AnimationNode::getTarget()
1262 std::unique_lock
aGuard( m_aMutex
);
1268 void SAL_CALL
AnimationNode::setTarget( const Any
& _target
)
1270 std::unique_lock
l( m_aMutex
);
1271 if( _target
!= maTarget
)
1274 fireChangeListener(l
);
1280 OUString SAL_CALL
AnimationNode::getAttributeName()
1282 std::unique_lock
aGuard( m_aMutex
);
1283 return maAttributeName
;
1288 void SAL_CALL
AnimationNode::setAttributeName( const OUString
& _attribute
)
1290 std::unique_lock
l( m_aMutex
);
1291 if( _attribute
!= maAttributeName
)
1293 maAttributeName
= _attribute
;
1294 fireChangeListener(l
);
1300 Sequence
< Any
> SAL_CALL
AnimationNode::getValues()
1302 std::unique_lock
aGuard( m_aMutex
);
1308 void SAL_CALL
AnimationNode::setValues( const Sequence
< Any
>& _values
)
1310 std::unique_lock
l( m_aMutex
);
1312 fireChangeListener(l
);
1317 sal_Int16 SAL_CALL
AnimationNode::getSubItem()
1319 std::unique_lock
aGuard( m_aMutex
);
1325 void SAL_CALL
AnimationNode::setSubItem( sal_Int16 _subitem
)
1327 std::unique_lock
l( m_aMutex
);
1328 if( _subitem
!= mnSubItem
)
1330 mnSubItem
= _subitem
;
1331 fireChangeListener(l
);
1337 Sequence
< double > SAL_CALL
AnimationNode::getKeyTimes()
1339 std::unique_lock
aGuard( m_aMutex
);
1345 void SAL_CALL
AnimationNode::setKeyTimes( const Sequence
< double >& _keytimes
)
1347 std::unique_lock
l( m_aMutex
);
1348 maKeyTimes
= _keytimes
;
1349 fireChangeListener(l
);
1354 sal_Int16 SAL_CALL
AnimationNode::getValueType()
1356 std::unique_lock
aGuard( m_aMutex
);
1361 void SAL_CALL
AnimationNode::setValueType( sal_Int16 _valuetype
)
1363 std::unique_lock
l( m_aMutex
);
1364 if( _valuetype
!= mnValueType
)
1366 mnValueType
= _valuetype
;
1367 fireChangeListener(l
);
1373 sal_Int16 SAL_CALL
AnimationNode::getCalcMode()
1375 std::unique_lock
aGuard( m_aMutex
);
1381 void SAL_CALL
AnimationNode::setCalcMode( sal_Int16 _calcmode
)
1383 std::unique_lock
l( m_aMutex
);
1384 if( _calcmode
!= mnCalcMode
)
1386 mnCalcMode
= _calcmode
;
1387 fireChangeListener(l
);
1393 sal_Bool SAL_CALL
AnimationNode::getAccumulate()
1395 std::unique_lock
aGuard( m_aMutex
);
1396 return mbAccumulate
;
1401 void SAL_CALL
AnimationNode::setAccumulate( sal_Bool _accumulate
)
1403 std::unique_lock
l( m_aMutex
);
1404 if( bool(_accumulate
) != mbAccumulate
)
1406 mbAccumulate
= _accumulate
;
1407 fireChangeListener(l
);
1413 sal_Int16 SAL_CALL
AnimationNode::getAdditive()
1415 std::unique_lock
aGuard( m_aMutex
);
1421 void SAL_CALL
AnimationNode::setAdditive( sal_Int16 _additive
)
1423 std::unique_lock
l( m_aMutex
);
1424 if( _additive
!= mnAdditive
)
1426 mnAdditive
= _additive
;
1427 fireChangeListener(l
);
1433 Any SAL_CALL
AnimationNode::getFrom()
1435 std::unique_lock
aGuard( m_aMutex
);
1441 void SAL_CALL
AnimationNode::setFrom( const Any
& _from
)
1443 std::unique_lock
l( m_aMutex
);
1444 if( _from
!= maFrom
)
1447 fireChangeListener(l
);
1453 Any SAL_CALL
AnimationNode::getTo()
1455 std::unique_lock
aGuard( m_aMutex
);
1461 void SAL_CALL
AnimationNode::setTo( const Any
& _to
)
1463 std::unique_lock
l( m_aMutex
);
1467 fireChangeListener(l
);
1473 Any SAL_CALL
AnimationNode::getBy()
1475 std::unique_lock
aGuard( m_aMutex
);
1481 void SAL_CALL
AnimationNode::setBy( const Any
& _by
)
1483 std::unique_lock
l( m_aMutex
);
1487 fireChangeListener(l
);
1493 Sequence
< TimeFilterPair
> SAL_CALL
AnimationNode::getTimeFilter()
1495 std::unique_lock
aGuard( m_aMutex
);
1496 return maTimeFilter
;
1501 void SAL_CALL
AnimationNode::setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
)
1503 std::unique_lock
l( m_aMutex
);
1504 maTimeFilter
= _timefilter
;
1505 fireChangeListener(l
);
1509 OUString SAL_CALL
AnimationNode::getFormula()
1511 std::unique_lock
aGuard( m_aMutex
);
1516 void SAL_CALL
AnimationNode::setFormula( const OUString
& _formula
)
1518 std::unique_lock
l( m_aMutex
);
1519 if( _formula
!= maFormula
)
1521 maFormula
= _formula
;
1522 fireChangeListener(l
);
1528 sal_Int16 SAL_CALL
AnimationNode::getColorInterpolation()
1530 std::unique_lock
aGuard( m_aMutex
);
1531 return mnColorSpace
;
1536 void SAL_CALL
AnimationNode::setColorInterpolation( sal_Int16 _colorspace
)
1538 std::unique_lock
l( m_aMutex
);
1539 if( _colorspace
!= mnColorSpace
)
1541 mnColorSpace
= _colorspace
;
1542 fireChangeListener(l
);
1548 sal_Bool SAL_CALL
AnimationNode::getDirection()
1550 std::unique_lock
aGuard( m_aMutex
);
1556 void SAL_CALL
AnimationNode::setDirection( sal_Bool _direction
)
1558 std::unique_lock
l( m_aMutex
);
1559 if( bool(_direction
) != mbDirection
)
1561 mbDirection
= _direction
;
1562 fireChangeListener(l
);
1568 Any SAL_CALL
AnimationNode::getPath()
1570 std::unique_lock
aGuard( m_aMutex
);
1576 void SAL_CALL
AnimationNode::setPath( const Any
& _path
)
1578 std::unique_lock
l( m_aMutex
);
1580 fireChangeListener(l
);
1585 Any SAL_CALL
AnimationNode::getOrigin()
1587 std::unique_lock
aGuard( m_aMutex
);
1593 void SAL_CALL
AnimationNode::setOrigin( const Any
& _origin
)
1595 std::unique_lock
l( m_aMutex
);
1597 fireChangeListener(l
);
1601 Any SAL_CALL
AnimationNode::getStartVelocityX()
1603 std::unique_lock
aGuard( m_aMutex
);
1604 return maStartVelocityX
;
1609 void SAL_CALL
AnimationNode::setStartVelocityX( const Any
& _startvelocityx
)
1611 std::unique_lock
l( m_aMutex
);
1612 maStartVelocityX
= _startvelocityx
;
1613 fireChangeListener(l
);
1617 Any SAL_CALL
AnimationNode::getStartVelocityY()
1619 std::unique_lock
aGuard( m_aMutex
);
1620 return maStartVelocityY
;
1625 void SAL_CALL
AnimationNode::setStartVelocityY( const Any
& _startvelocityy
)
1627 std::unique_lock
l( m_aMutex
);
1628 maStartVelocityY
= _startvelocityy
;
1629 fireChangeListener(l
);
1634 Any SAL_CALL
AnimationNode::getDensity()
1636 std::unique_lock
aGuard( m_aMutex
);
1642 void SAL_CALL
AnimationNode::setDensity( const Any
& _density
)
1644 std::unique_lock
l( m_aMutex
);
1645 maDensity
= _density
;
1646 fireChangeListener(l
);
1651 Any SAL_CALL
AnimationNode::getBounciness()
1653 std::unique_lock
aGuard( m_aMutex
);
1654 return maBounciness
;
1659 void SAL_CALL
AnimationNode::setBounciness( const Any
& _bounciness
)
1661 std::unique_lock
l( m_aMutex
);
1662 maBounciness
= _bounciness
;
1663 fireChangeListener(l
);
1667 // XAnimateTransform
1668 sal_Int16 SAL_CALL
AnimationNode::getTransformType()
1670 std::unique_lock
aGuard( m_aMutex
);
1671 return mnTransformType
;
1675 // XAnimateTransform
1676 void SAL_CALL
AnimationNode::setTransformType( sal_Int16 _transformtype
)
1678 std::unique_lock
l( m_aMutex
);
1679 if( _transformtype
!= mnTransformType
)
1681 mnTransformType
= _transformtype
;
1682 fireChangeListener(l
);
1687 // XTransitionFilter
1688 sal_Int16 SAL_CALL
AnimationNode::getTransition()
1690 std::unique_lock
aGuard( m_aMutex
);
1691 return mnTransition
;
1695 // XTransitionFilter
1696 void SAL_CALL
AnimationNode::setTransition( sal_Int16 _transition
)
1698 std::unique_lock
l( m_aMutex
);
1699 if( _transition
!= mnTransition
)
1701 mnTransition
= _transition
;
1702 fireChangeListener(l
);
1707 // XTransitionFilter
1708 sal_Int16 SAL_CALL
AnimationNode::getSubtype()
1710 std::unique_lock
aGuard( m_aMutex
);
1715 // XTransitionFilter
1716 void SAL_CALL
AnimationNode::setSubtype( sal_Int16 _subtype
)
1718 std::unique_lock
l( m_aMutex
);
1719 if( _subtype
!= mnSubtype
)
1721 mnSubtype
= _subtype
;
1722 fireChangeListener(l
);
1727 // XTransitionFilter
1728 sal_Bool SAL_CALL
AnimationNode::getMode()
1730 std::unique_lock
aGuard( m_aMutex
);
1735 // XTransitionFilter
1736 void SAL_CALL
AnimationNode::setMode( sal_Bool _mode
)
1738 std::unique_lock
l( m_aMutex
);
1739 if( bool(_mode
) != mbMode
)
1742 fireChangeListener(l
);
1747 // XTransitionFilter
1748 sal_Int32 SAL_CALL
AnimationNode::getFadeColor()
1750 std::unique_lock
aGuard( m_aMutex
);
1755 // XTransitionFilter
1756 void SAL_CALL
AnimationNode::setFadeColor( sal_Int32 _fadecolor
)
1758 std::unique_lock
l( m_aMutex
);
1759 if( _fadecolor
!= mnFadeColor
)
1761 mnFadeColor
= _fadecolor
;
1762 fireChangeListener(l
);
1768 Any SAL_CALL
AnimationNode::getSource()
1770 std::unique_lock
aGuard( m_aMutex
);
1776 void SAL_CALL
AnimationNode::setSource( const Any
& _source
)
1778 std::unique_lock
l( m_aMutex
);
1780 fireChangeListener(l
);
1785 double SAL_CALL
AnimationNode::getVolume()
1787 std::unique_lock
aGuard( m_aMutex
);
1793 void SAL_CALL
AnimationNode::setVolume( double _volume
)
1795 std::unique_lock
l( m_aMutex
);
1796 if( _volume
!= mfVolume
)
1799 fireChangeListener(l
);
1803 sal_Bool SAL_CALL
AnimationNode::getHideDuringShow()
1805 std::unique_lock
aGuard(m_aMutex
);
1806 return mbHideDuringShow
;
1809 void SAL_CALL
AnimationNode::setHideDuringShow(sal_Bool bHideDuringShow
)
1811 std::unique_lock
l(m_aMutex
);
1812 if (static_cast<bool>(bHideDuringShow
) != mbHideDuringShow
)
1814 mbHideDuringShow
= bHideDuringShow
;
1815 fireChangeListener(l
);
1819 sal_Bool SAL_CALL
AnimationNode::getNarration()
1821 std::unique_lock
aGuard(m_aMutex
);
1825 void SAL_CALL
AnimationNode::setNarration(sal_Bool bNarration
)
1827 std::unique_lock
l(m_aMutex
);
1828 if (static_cast<bool>(bNarration
) != mbNarration
)
1830 mbNarration
= bNarration
;
1831 fireChangeListener(l
);
1836 sal_Int16 SAL_CALL
AnimationNode::getCommand()
1838 std::unique_lock
aGuard( m_aMutex
);
1844 void SAL_CALL
AnimationNode::setCommand( sal_Int16 _command
)
1846 std::unique_lock
l( m_aMutex
);
1847 if( _command
!= mnCommand
)
1849 mnCommand
= _command
;
1850 fireChangeListener(l
);
1856 Any SAL_CALL
AnimationNode::getParameter()
1858 std::unique_lock
aGuard( m_aMutex
);
1864 void SAL_CALL
AnimationNode::setParameter( const Any
& _parameter
)
1866 std::unique_lock
l( m_aMutex
);
1867 maParameter
= _parameter
;
1868 fireChangeListener(l
);
1873 Type SAL_CALL
AnimationNode::getElementType()
1875 return cppu::UnoType
<XAnimationNode
>::get();
1880 sal_Bool SAL_CALL
AnimationNode::hasElements()
1882 std::unique_lock
aGuard( m_aMutex
);
1883 return !maChildren
.empty();
1887 // XEnumerationAccess
1888 Reference
< XEnumeration
> SAL_CALL
AnimationNode::createEnumeration()
1890 std::unique_lock
aGuard( m_aMutex
);
1892 return new TimeContainerEnumeration(std::vector(maChildren
));
1897 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1899 std::unique_lock
l( m_aMutex
);
1901 if( !newChild
.is() || !refChild
.is() )
1902 throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject
*>(this), -1);
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 maChildren
.insert( before
, newChild
);
1913 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1915 newChild
->setParent( xThis
);
1922 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1924 std::unique_lock
l( m_aMutex
);
1926 if( !newChild
.is() || !refChild
.is() )
1927 throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject
*>(this), -1);
1929 if( std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1930 throw ElementExistException();
1932 auto before
= std::find(maChildren
.begin(), maChildren
.end(), refChild
);
1933 if( before
== maChildren
.end() )
1934 throw NoSuchElementException();
1937 if( before
!= maChildren
.end() )
1938 maChildren
.insert( before
, newChild
);
1940 maChildren
.push_back( newChild
);
1942 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1944 newChild
->setParent( xThis
);
1951 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
)
1953 std::unique_lock
l( m_aMutex
);
1955 if( !newChild
.is() || !oldChild
.is() )
1956 throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject
*>(this), -1);
1958 if( std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1959 throw ElementExistException();
1961 auto replace
= std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1962 if( replace
== maChildren
.end() )
1963 throw NoSuchElementException();
1965 (*replace
) = newChild
;
1967 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1969 oldChild
->setParent( Reference
< XInterface
>() );
1970 newChild
->setParent( xThis
);
1977 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::removeChild( const Reference
< XAnimationNode
>& oldChild
)
1979 std::unique_lock
l( m_aMutex
);
1981 if( !oldChild
.is() )
1982 throw IllegalArgumentException("no child", static_cast<cppu::OWeakObject
*>(this), 1);
1984 auto old
= std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1985 if( old
== maChildren
.end() )
1986 throw NoSuchElementException();
1988 maChildren
.erase( old
);
1991 oldChild
->setParent( Reference
< XInterface
>() );
1998 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::appendChild( const Reference
< XAnimationNode
>& newChild
)
2000 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
2002 std::unique_lock
aGuard( m_aMutex
);
2004 if( !newChild
.is() )
2005 throw IllegalArgumentException("no child", xThis
, 1);
2007 if( std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
2008 throw ElementExistException({}, xThis
);
2010 if( xThis
== newChild
)
2011 throw IllegalArgumentException("cannot append self", xThis
, -1);
2013 maChildren
.push_back( newChild
);
2015 newChild
->setParent( xThis
);
2021 // XIterateContainer
2022 sal_Int16 SAL_CALL
AnimationNode::getIterateType()
2024 std::unique_lock
aGuard( m_aMutex
);
2025 return mnIterateType
;
2029 // XIterateContainer
2030 void SAL_CALL
AnimationNode::setIterateType( sal_Int16 _iteratetype
)
2032 std::unique_lock
l( m_aMutex
);
2033 if( _iteratetype
!= mnIterateType
)
2035 mnIterateType
= _iteratetype
;
2036 fireChangeListener(l
);
2041 // XIterateContainer
2042 double SAL_CALL
AnimationNode::getIterateInterval()
2044 std::unique_lock
aGuard( m_aMutex
);
2045 return mfIterateInterval
;
2049 // XIterateContainer
2050 void SAL_CALL
AnimationNode::setIterateInterval( double _iterateinterval
)
2052 std::unique_lock
l( m_aMutex
);
2053 if( _iterateinterval
!= mfIterateInterval
)
2055 mfIterateInterval
= _iterateinterval
;
2056 fireChangeListener(l
);
2062 void SAL_CALL
AnimationNode::addChangesListener( const Reference
< XChangesListener
>& aListener
)
2064 std::unique_lock
l( m_aMutex
);
2065 maChangeListener
.addInterface( l
, aListener
);
2070 void SAL_CALL
AnimationNode::removeChangesListener( const Reference
< XChangesListener
>& aListener
)
2072 std::unique_lock
l( m_aMutex
);
2073 maChangeListener
.removeInterface(l
, aListener
);
2077 void AnimationNode::fireChangeListener(std::unique_lock
<std::mutex
>& l
)
2079 if( maChangeListener
.getLength(l
) != 0 )
2081 Reference
< XInterface
> xSource( static_cast<OWeakObject
*>(this), UNO_QUERY
);
2082 Sequence
< ElementChange
> aChanges
;
2083 const ChangesEvent
aEvent( xSource
, Any( css::uno::Reference
<XInterface
>(static_cast<cppu::OWeakObject
*>(mxParent
.get().get())) ), aChanges
);
2084 OInterfaceIteratorHelper4
aIterator( l
, maChangeListener
);
2086 while( aIterator
.hasMoreElements() )
2087 aIterator
.next()->changesOccurred( aEvent
);
2091 //fdo#69645 use WeakReference of mxParent to test if mpParent is still valid
2092 rtl::Reference
<AnimationNode
> xGuard(mxParent
);
2096 std::unique_lock
l2(xGuard
->m_aMutex
);
2097 xGuard
->fireChangeListener(l2
);
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: */