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 <cppuhelper/queryinterface.hxx>
49 #include <comphelper/interfacecontainer4.hxx>
50 #include <cppuhelper/supportsservice.hxx>
52 #include <cppuhelper/implbase.hxx>
54 #include <sal/log.hxx>
55 #include <unotools/weakref.hxx>
61 namespace com::sun::star::uno
{ class XComponentContext
; }
62 namespace com::sun::star::beans
{ struct NamedValue
; }
64 using ::comphelper::OInterfaceContainerHelper4
;
65 using ::comphelper::OInterfaceIteratorHelper4
;
66 using ::com::sun::star::uno::Any
;
67 using ::com::sun::star::uno::UNO_QUERY
;
68 using ::com::sun::star::uno::XInterface
;
69 using ::com::sun::star::uno::Sequence
;
70 using ::com::sun::star::uno::Reference
;
71 using ::com::sun::star::uno::Exception
;
72 using ::com::sun::star::uno::XWeak
;
73 using ::com::sun::star::uno::Type
;
74 using ::com::sun::star::uno::Any
;
75 using ::com::sun::star::lang::IllegalArgumentException
;
76 using ::com::sun::star::lang::XServiceInfo
;
77 using ::com::sun::star::lang::XTypeProvider
;
78 using ::com::sun::star::container::NoSuchElementException
;
79 using ::com::sun::star::container::ElementExistException
;
80 using ::com::sun::star::container::XEnumeration
;
81 using ::com::sun::star::container::XEnumerationAccess
;
82 using ::com::sun::star::beans::NamedValue
;
83 using ::com::sun::star::util::XCloneable
;
84 using ::com::sun::star::util::XChangesNotifier
;
85 using ::com::sun::star::util::XChangesListener
;
86 using ::com::sun::star::util::ElementChange
;
87 using ::com::sun::star::util::ChangesEvent
;
89 using ::cppu::OWeakObject
;
91 using namespace ::com::sun::star::animations
;
92 using namespace ::com::sun::star::animations::AnimationNodeType
;
98 class AnimationNodeBase
: public XAnimateMotion
,
99 public XAnimatePhysics
,
100 public XAnimateColor
,
101 public XTransitionFilter
,
103 public XAnimateTransform
,
104 public XParallelTimeContainer
,
105 public XIterateContainer
,
107 public XTypeProvider
,
111 public XChangesNotifier
,
117 class AnimationNode final
: public AnimationNodeBase
120 explicit AnimationNode(sal_Int16 nNodeType
);
121 explicit AnimationNode(const AnimationNode
& rNode
);
124 virtual Any SAL_CALL
queryInterface( const Type
& aType
) override
;
125 virtual void SAL_CALL
acquire() noexcept override
;
126 virtual void SAL_CALL
release() noexcept override
;
129 virtual Sequence
< Type
> SAL_CALL
getTypes() override
;
130 virtual Sequence
< sal_Int8
> SAL_CALL
getImplementationId() override
;
133 OUString SAL_CALL
getImplementationName() override
;
134 Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
135 sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
138 virtual Reference
< XInterface
> SAL_CALL
getParent() override
;
139 virtual void SAL_CALL
setParent( const Reference
< XInterface
>& Parent
) override
;
142 virtual Reference
< XCloneable
> SAL_CALL
createClone() override
;
145 virtual sal_Int16 SAL_CALL
getType() override
;
146 virtual Any SAL_CALL
getBegin() override
;
147 virtual void SAL_CALL
setBegin( const Any
& _begin
) override
;
148 virtual Any SAL_CALL
getDuration() override
;
149 virtual void SAL_CALL
setDuration( const Any
& _duration
) override
;
150 virtual Any SAL_CALL
getEnd() override
;
151 virtual void SAL_CALL
setEnd( const Any
& _end
) override
;
152 virtual Any SAL_CALL
getEndSync() override
;
153 virtual void SAL_CALL
setEndSync( const Any
& _endsync
) override
;
154 virtual Any SAL_CALL
getRepeatCount() override
;
155 virtual void SAL_CALL
setRepeatCount( const Any
& _repeatcount
) override
;
156 virtual Any SAL_CALL
getRepeatDuration() override
;
157 virtual void SAL_CALL
setRepeatDuration( const Any
& _repeatduration
) override
;
158 virtual sal_Int16 SAL_CALL
getFill() override
;
159 virtual void SAL_CALL
setFill( sal_Int16 _fill
) override
;
160 virtual sal_Int16 SAL_CALL
getFillDefault() override
;
161 virtual void SAL_CALL
setFillDefault( sal_Int16 _filldefault
) override
;
162 virtual sal_Int16 SAL_CALL
getRestart() override
;
163 virtual void SAL_CALL
setRestart( sal_Int16 _restart
) override
;
164 virtual sal_Int16 SAL_CALL
getRestartDefault() override
;
165 virtual void SAL_CALL
setRestartDefault( sal_Int16 _restartdefault
) override
;
166 virtual double SAL_CALL
getAcceleration() override
;
167 virtual void SAL_CALL
setAcceleration( double _acceleration
) override
;
168 virtual double SAL_CALL
getDecelerate() override
;
169 virtual void SAL_CALL
setDecelerate( double _decelerate
) override
;
170 virtual sal_Bool SAL_CALL
getAutoReverse() override
;
171 virtual void SAL_CALL
setAutoReverse( sal_Bool _autoreverse
) override
;
172 virtual Sequence
< NamedValue
> SAL_CALL
getUserData() override
;
173 virtual void SAL_CALL
setUserData( const Sequence
< NamedValue
>& _userdata
) override
;
176 virtual Any SAL_CALL
getTarget() override
;
177 virtual void SAL_CALL
setTarget( const Any
& _target
) override
;
178 virtual sal_Int16 SAL_CALL
getSubItem() override
;
179 virtual void SAL_CALL
setSubItem( sal_Int16 _subitem
) override
;
180 virtual OUString SAL_CALL
getAttributeName() override
;
181 virtual void SAL_CALL
setAttributeName( const OUString
& _attribute
) override
;
182 virtual Sequence
< Any
> SAL_CALL
getValues() override
;
183 virtual void SAL_CALL
setValues( const Sequence
< Any
>& _values
) override
;
184 virtual Sequence
< double > SAL_CALL
getKeyTimes() override
;
185 virtual void SAL_CALL
setKeyTimes( const Sequence
< double >& _keytimes
) override
;
186 virtual sal_Int16 SAL_CALL
getValueType() override
;
187 virtual void SAL_CALL
setValueType( sal_Int16 _valuetype
) override
;
188 virtual sal_Int16 SAL_CALL
getCalcMode() override
;
189 virtual void SAL_CALL
setCalcMode( sal_Int16 _calcmode
) override
;
190 virtual sal_Bool SAL_CALL
getAccumulate() override
;
191 virtual void SAL_CALL
setAccumulate( sal_Bool _accumulate
) override
;
192 virtual sal_Int16 SAL_CALL
getAdditive() override
;
193 virtual void SAL_CALL
setAdditive( sal_Int16 _additive
) override
;
194 virtual Any SAL_CALL
getFrom() override
;
195 virtual void SAL_CALL
setFrom( const Any
& _from
) override
;
196 virtual Any SAL_CALL
getTo() override
;
197 virtual void SAL_CALL
setTo( const Any
& _to
) override
;
198 virtual Any SAL_CALL
getBy() override
;
199 virtual void SAL_CALL
setBy( const Any
& _by
) override
;
200 virtual Sequence
< TimeFilterPair
> SAL_CALL
getTimeFilter() override
;
201 virtual void SAL_CALL
setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
) override
;
202 virtual OUString SAL_CALL
getFormula() override
;
203 virtual void SAL_CALL
setFormula( const OUString
& _formula
) override
;
206 virtual sal_Int16 SAL_CALL
getColorInterpolation() override
;
207 virtual void SAL_CALL
setColorInterpolation( sal_Int16 _colorspace
) override
;
208 virtual sal_Bool SAL_CALL
getDirection() override
;
209 virtual void SAL_CALL
setDirection( sal_Bool _direction
) override
;
212 virtual Any SAL_CALL
getPath() override
;
213 virtual void SAL_CALL
setPath( const Any
& _path
) override
;
214 virtual Any SAL_CALL
getOrigin() override
;
215 virtual void SAL_CALL
setOrigin( const Any
& _origin
) override
;
218 virtual Any SAL_CALL
getStartVelocityX() override
;
219 virtual void SAL_CALL
setStartVelocityX( const Any
& _startvelocityx
) override
;
220 virtual Any SAL_CALL
getStartVelocityY() override
;
221 virtual void SAL_CALL
setStartVelocityY( const Any
& _startvelocityy
) override
;
222 virtual Any SAL_CALL
getDensity() override
;
223 virtual void SAL_CALL
setDensity( const Any
& _density
) override
;
224 virtual Any SAL_CALL
getBounciness() override
;
225 virtual void SAL_CALL
setBounciness( const Any
& _bounciness
) override
;
228 virtual sal_Int16 SAL_CALL
getTransformType() override
;
229 virtual void SAL_CALL
setTransformType( sal_Int16 _transformtype
) override
;
232 virtual sal_Int16 SAL_CALL
getTransition() override
;
233 virtual void SAL_CALL
setTransition( sal_Int16 _transition
) override
;
234 virtual sal_Int16 SAL_CALL
getSubtype() override
;
235 virtual void SAL_CALL
setSubtype( sal_Int16 _subtype
) override
;
236 virtual sal_Bool SAL_CALL
getMode() override
;
237 virtual void SAL_CALL
setMode( sal_Bool _mode
) override
;
238 virtual sal_Int32 SAL_CALL
getFadeColor() override
;
239 virtual void SAL_CALL
setFadeColor( sal_Int32 _fadecolor
) override
;
242 virtual Any SAL_CALL
getSource() override
;
243 virtual void SAL_CALL
setSource( const Any
& _source
) override
;
244 virtual double SAL_CALL
getVolume() override
;
245 virtual void SAL_CALL
setVolume( double _volume
) override
;
246 sal_Bool SAL_CALL
getHideDuringShow() override
;
247 void SAL_CALL
setHideDuringShow(sal_Bool bHideDuringShow
) override
;
248 sal_Bool SAL_CALL
getNarration() override
;
249 void SAL_CALL
setNarration(sal_Bool bNarration
) override
;
252 // XCommand - the following two shadowed by animate, unfortunately
253 // virtual Any SAL_CALL getTarget() throw (RuntimeException);
254 // virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException);
255 virtual sal_Int16 SAL_CALL
getCommand() override
;
256 virtual void SAL_CALL
setCommand( sal_Int16 _command
) override
;
257 virtual Any SAL_CALL
getParameter() override
;
258 virtual void SAL_CALL
setParameter( const Any
& _parameter
) override
;
261 virtual Type SAL_CALL
getElementType() override
;
262 virtual sal_Bool SAL_CALL
hasElements() override
;
264 // XEnumerationAccess
265 virtual Reference
< XEnumeration
> SAL_CALL
createEnumeration() override
;
268 virtual Reference
< XAnimationNode
> SAL_CALL
insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) override
;
269 virtual Reference
< XAnimationNode
> SAL_CALL
insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
) override
;
270 virtual Reference
< XAnimationNode
> SAL_CALL
replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
) override
;
271 virtual Reference
< XAnimationNode
> SAL_CALL
removeChild( const Reference
< XAnimationNode
>& oldChild
) override
;
272 virtual Reference
< XAnimationNode
> SAL_CALL
appendChild( const Reference
< XAnimationNode
>& newChild
) override
;
275 virtual sal_Int16 SAL_CALL
getIterateType() override
;
276 virtual void SAL_CALL
setIterateType( sal_Int16 _iteratetype
) override
;
277 virtual double SAL_CALL
getIterateInterval() override
;
278 virtual void SAL_CALL
setIterateInterval( double _iterateinterval
) override
;
281 virtual void SAL_CALL
addChangesListener( const Reference
< XChangesListener
>& aListener
) override
;
282 virtual void SAL_CALL
removeChangesListener( const Reference
< XChangesListener
>& aListener
) override
;
284 void fireChangeListener(std::unique_lock
<std::mutex
>&);
288 OInterfaceContainerHelper4
<XChangesListener
> maChangeListener
;
290 static void initTypeProvider( sal_Int16 nNodeType
) noexcept
;
292 const sal_Int16 mnNodeType
;
295 static std::array
<Sequence
< Type
>*, 13> mpTypes
;
297 // attributes for the XAnimationNode interface implementation
298 Any maBegin
, maDuration
, maEnd
, maEndSync
, maRepeatCount
, maRepeatDuration
;
299 sal_Int16 mnFill
, mnFillDefault
, mnRestart
, mnRestartDefault
;
300 double mfAcceleration
, mfDecelerate
;
302 Sequence
< NamedValue
> maUserData
;
304 // parent interface for XChild interface implementation
305 unotools::WeakReference
<AnimationNode
> mxParent
;
307 // attributes for XAnimate
309 OUString maAttributeName
, maFormula
;
310 Sequence
< Any
> maValues
;
311 Sequence
< double > maKeyTimes
;
312 sal_Int16 mnValueType
, mnSubItem
;
313 sal_Int16 mnCalcMode
, mnAdditive
;
315 Any maFrom
, maTo
, maBy
;
316 Sequence
< TimeFilterPair
> maTimeFilter
;
318 // attributes for XAnimateColor
319 sal_Int16 mnColorSpace
;
322 // attributes for XAnimateMotion
323 Any maPath
, maOrigin
;
325 // attributes for XAnimatePhysics
326 Any maStartVelocityX
, maStartVelocityY
, maDensity
, maBounciness
;
328 // attributes for XAnimateTransform
329 sal_Int16 mnTransformType
;
331 // attributes for XTransitionFilter
332 sal_Int16 mnTransition
;
335 sal_Int32 mnFadeColor
;
339 bool mbHideDuringShow
;
347 sal_Int16 mnIterateType
;
348 double mfIterateInterval
;
350 /** sorted list of child nodes for XTimeContainer*/
351 std::vector
< Reference
< XAnimationNode
> > maChildren
;
355 class TimeContainerEnumeration
: public ::cppu::WeakImplHelper
< XEnumeration
>
358 explicit TimeContainerEnumeration( std::vector
< Reference
< XAnimationNode
> >&& rChildren
);
361 virtual sal_Bool SAL_CALL
hasMoreElements() override
;
362 virtual Any SAL_CALL
nextElement( ) override
;
367 /** sorted list of child nodes */
368 std::vector
< Reference
< XAnimationNode
> > maChildren
;
370 /** current iteration position */
371 std::vector
< Reference
< XAnimationNode
> >::iterator maIter
;
376 TimeContainerEnumeration::TimeContainerEnumeration( std::vector
< Reference
< XAnimationNode
> >&& rChildren
)
377 : maChildren( std::move(rChildren
) )
379 maIter
= maChildren
.begin();
383 sal_Bool SAL_CALL
TimeContainerEnumeration::hasMoreElements()
385 std::unique_lock
aGuard( m_aMutex
);
387 return maIter
!= maChildren
.end();
390 Any SAL_CALL
TimeContainerEnumeration::nextElement()
392 std::unique_lock
aGuard( m_aMutex
);
394 if( maIter
== maChildren
.end() )
395 throw NoSuchElementException();
397 return Any( *maIter
++ );
401 std::array
<Sequence
< Type
>*, 13> AnimationNode::mpTypes
= { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
403 AnimationNode::AnimationNode( sal_Int16 nNodeType
)
404 : AnimationNodeBase(),
405 mnNodeType( nNodeType
),
406 mnFill( AnimationFill::DEFAULT
),
407 mnFillDefault( AnimationFill::INHERIT
),
408 mnRestart( AnimationRestart:: DEFAULT
),
409 mnRestartDefault( AnimationRestart:: INHERIT
),
410 mfAcceleration( 0.0 ),
412 mbAutoReverse( false ),
415 mnCalcMode( (nNodeType
== AnimationNodeType::ANIMATEMOTION
) ? AnimationCalcMode::PACED
: AnimationCalcMode::LINEAR
),
416 mnAdditive(AnimationAdditiveMode::REPLACE
),
418 mnColorSpace( AnimationColorSpace::RGB
),
420 mnTransformType( AnimationTransformType::TRANSLATE
),
421 mnTransition(TransitionType::BARWIPE
),
422 mnSubtype(TransitionSubType::DEFAULT
),
426 mbHideDuringShow(false),
429 mnIterateType( css::presentation::ShapeAnimationSubType::AS_WHOLE
),
430 mfIterateInterval(0.0)
432 assert(nNodeType
>= 0 && o3tl::make_unsigned(nNodeType
) < mpTypes
.size());
435 AnimationNode::AnimationNode( const AnimationNode
& rNode
)
436 : AnimationNodeBase(),
437 mnNodeType( rNode
.mnNodeType
),
439 // attributes for the XAnimationNode interface implementation
440 maBegin( rNode
.maBegin
),
441 maDuration( rNode
.maDuration
),
442 maEnd( rNode
.maEnd
),
443 maEndSync( rNode
.maEndSync
),
444 maRepeatCount( rNode
.maRepeatCount
),
445 maRepeatDuration( rNode
.maRepeatDuration
),
446 mnFill( rNode
.mnFill
),
447 mnFillDefault( rNode
.mnFillDefault
),
448 mnRestart( rNode
.mnRestart
),
449 mnRestartDefault( rNode
.mnRestartDefault
),
450 mfAcceleration( rNode
.mfAcceleration
),
451 mfDecelerate( rNode
.mfDecelerate
),
452 mbAutoReverse( rNode
.mbAutoReverse
),
453 maUserData( rNode
.maUserData
),
455 // attributes for XAnimate
456 maTarget( rNode
.maTarget
),
457 maAttributeName( rNode
.maAttributeName
),
458 maFormula( rNode
.maFormula
),
459 maValues( rNode
.maValues
),
460 maKeyTimes( rNode
.maKeyTimes
),
461 mnValueType( rNode
.mnValueType
),
462 mnSubItem( rNode
.mnSubItem
),
463 mnCalcMode( rNode
.mnCalcMode
),
464 mnAdditive( rNode
.mnAdditive
),
465 mbAccumulate( rNode
.mbAccumulate
),
466 maFrom( rNode
.maFrom
),
469 maTimeFilter( rNode
.maTimeFilter
),
471 // attributes for XAnimateColor
472 mnColorSpace( rNode
.mnColorSpace
),
473 mbDirection( rNode
.mbDirection
),
475 // attributes for XAnimateMotion
476 maPath( rNode
.maPath
),
477 maOrigin( rNode
.maOrigin
),
479 // attributes for XAnimatePhysics
480 maStartVelocityX( rNode
.maStartVelocityX
),
481 maStartVelocityY( rNode
.maStartVelocityY
),
482 maDensity( rNode
.maDensity
),
483 maBounciness( rNode
.maBounciness
),
485 // attributes for XAnimateTransform
486 mnTransformType( rNode
.mnTransformType
),
488 // attributes for XTransitionFilter
489 mnTransition( rNode
.mnTransition
),
490 mnSubtype( rNode
.mnSubtype
),
491 mbMode( rNode
.mbMode
),
492 mnFadeColor( rNode
.mnFadeColor
),
495 mfVolume( rNode
.mfVolume
),
496 mbHideDuringShow(rNode
.mbHideDuringShow
),
497 mbNarration(rNode
.mbNarration
),
500 mnCommand( rNode
.mnCommand
),
501 maParameter( rNode
.maParameter
),
504 mnIterateType( rNode
.mnIterateType
),
505 mfIterateInterval( rNode
.mfIterateInterval
)
509 static Sequence
<OUString
> getSupportedServiceNames_PAR()
511 return { u
"com.sun.star.animations.ParallelTimeContainer"_ustr
};
514 static OUString
getImplementationName_PAR()
516 return u
"animcore::ParallelTimeContainer"_ustr
;
519 static Sequence
<OUString
> getSupportedServiceNames_SEQ()
521 return { u
"com.sun.star.animations.SequenceTimeContainer"_ustr
};
524 static OUString
getImplementationName_SEQ()
526 return u
"animcore::SequenceTimeContainer"_ustr
;
529 static Sequence
<OUString
> getSupportedServiceNames_ITERATE()
531 return { u
"com.sun.star.animations.IterateContainer"_ustr
};
534 static OUString
getImplementationName_ITERATE()
536 return u
"animcore::IterateContainer"_ustr
;
539 static Sequence
<OUString
> getSupportedServiceNames_ANIMATE()
541 return { u
"com.sun.star.animations.Animate"_ustr
};
544 static OUString
getImplementationName_ANIMATE()
546 return u
"animcore::Animate"_ustr
;
549 static Sequence
<OUString
> getSupportedServiceNames_SET()
551 return { u
"com.sun.star.animations.AnimateSet"_ustr
};
554 static OUString
getImplementationName_SET()
556 return u
"animcore::AnimateSet"_ustr
;
559 static Sequence
<OUString
> getSupportedServiceNames_ANIMATECOLOR()
561 return { u
"com.sun.star.animations.AnimateColor"_ustr
};
564 static OUString
getImplementationName_ANIMATECOLOR()
566 return u
"animcore::AnimateColor"_ustr
;
569 static Sequence
<OUString
> getSupportedServiceNames_ANIMATEMOTION()
571 return { u
"com.sun.star.animations.AnimateMotion"_ustr
};
574 static OUString
getImplementationName_ANIMATEMOTION()
576 return u
"animcore::AnimateMotion"_ustr
;
579 static Sequence
<OUString
> getSupportedServiceNames_ANIMATEPHYSICS()
581 return { u
"com.sun.star.animations.AnimatePhysics"_ustr
};
584 static OUString
getImplementationName_ANIMATEPHYSICS()
586 return u
"animcore::AnimatePhysics"_ustr
;
589 static Sequence
<OUString
> getSupportedServiceNames_ANIMATETRANSFORM()
591 return { u
"com.sun.star.animations.AnimateTransform"_ustr
};
594 static OUString
getImplementationName_ANIMATETRANSFORM()
596 return u
"animcore::AnimateTransform"_ustr
;
599 static Sequence
<OUString
> getSupportedServiceNames_TRANSITIONFILTER()
601 return { u
"com.sun.star.animations.TransitionFilter"_ustr
};
604 static OUString
getImplementationName_TRANSITIONFILTER()
606 return u
"animcore::TransitionFilter"_ustr
;
609 static Sequence
<OUString
> getSupportedServiceNames_AUDIO()
611 return { u
"com.sun.star.animations.Audio"_ustr
};
614 static OUString
getImplementationName_AUDIO()
616 return u
"animcore::Audio"_ustr
;
619 static Sequence
<OUString
> getSupportedServiceNames_COMMAND()
621 return { u
"com.sun.star.animations.Command"_ustr
};
624 static OUString
getImplementationName_COMMAND()
626 return u
"animcore::Command"_ustr
;
630 Any SAL_CALL
AnimationNode::queryInterface( const Type
& aType
)
632 Any
aRet( ::cppu::queryInterface(
634 static_cast< XServiceInfo
* >( this ),
635 static_cast< XTypeProvider
* >( this ),
636 static_cast< XChild
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
637 static_cast< XCloneable
* >( this ),
638 static_cast< XAnimationNode
* >( static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ) ),
639 static_cast< XInterface
* >(static_cast< OWeakObject
* >(this)),
640 static_cast< XWeak
* >(static_cast< OWeakObject
* >(this)),
641 static_cast< XChangesNotifier
* >( this ) ) );
647 case AnimationNodeType::PAR
:
648 aRet
= ::cppu::queryInterface(
650 static_cast< XParallelTimeContainer
* >( this ),
651 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
652 static_cast< XEnumerationAccess
* >( this ),
653 static_cast< XElementAccess
* >( this ) );
655 case AnimationNodeType::SEQ
:
656 aRet
= ::cppu::queryInterface(
658 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
659 static_cast< XEnumerationAccess
* >( this ),
660 static_cast< XElementAccess
* >( this ) );
662 case AnimationNodeType::ITERATE
:
663 aRet
= ::cppu::queryInterface(
665 static_cast< XTimeContainer
* >( static_cast< XIterateContainer
* >(this) ),
666 static_cast< XIterateContainer
* >( this ),
667 static_cast< XEnumerationAccess
* >( this ),
668 static_cast< XElementAccess
* >( this ) );
670 case AnimationNodeType::ANIMATE
:
671 aRet
= ::cppu::queryInterface(
673 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ) );
675 case AnimationNodeType::ANIMATEMOTION
:
676 aRet
= ::cppu::queryInterface(
678 static_cast< XAnimate
* >( static_cast< XAnimateMotion
* >(this) ),
679 static_cast< XAnimateMotion
* >( this ) );
681 case AnimationNodeType::ANIMATEPHYSICS
:
682 aRet
= ::cppu::queryInterface(
684 static_cast< XAnimate
* >( static_cast< XAnimatePhysics
* >(this) ),
685 static_cast< XAnimatePhysics
* >( this ) );
687 case AnimationNodeType::ANIMATECOLOR
:
688 aRet
= ::cppu::queryInterface(
690 static_cast< XAnimate
* >( static_cast< XAnimateColor
* >(this) ),
691 static_cast< XAnimateColor
* >( this ) );
693 case AnimationNodeType::SET
:
694 aRet
= ::cppu::queryInterface(
696 static_cast< XAnimate
* >( static_cast< XAnimateSet
* >(this) ),
697 static_cast< XAnimateSet
* >( this ) );
699 case AnimationNodeType::ANIMATETRANSFORM
:
700 aRet
= ::cppu::queryInterface(
702 static_cast< XAnimate
* >( static_cast< XAnimateTransform
* >(this) ),
703 static_cast< XAnimateTransform
* >( this ) );
705 case AnimationNodeType::AUDIO
:
706 aRet
= ::cppu::queryInterface(aType
, static_cast< XAudio
* >(this) );
708 case AnimationNodeType::COMMAND
:
709 aRet
= ::cppu::queryInterface(
710 aType
, static_cast< XCommand
* >(this) );
712 case AnimationNodeType::TRANSITIONFILTER
:
713 aRet
= ::cppu::queryInterface(
715 static_cast< XAnimate
* >( static_cast< XTransitionFilter
* >(this) ),
716 static_cast< XTransitionFilter
* >( this ) );
721 return aRet
.hasValue() ? aRet
: OWeakObject::queryInterface( aType
);
725 void AnimationNode::initTypeProvider( sal_Int16 nNodeType
) noexcept
727 static std::mutex aMutex
;
729 std::scoped_lock
aGuard(aMutex
);
731 if( mpTypes
[nNodeType
] )
734 static constexpr std::array
<sal_Int32
, mpTypes
.size()> type_numbers
=
744 7, // ANIMATETRANSFORM
745 7, // TRANSITIONFILTER
752 Sequence
< Type
> * types
= new Sequence
< Type
>( type_numbers
[nNodeType
] );
753 Type
* pTypeAr
= types
->getArray();
756 pTypeAr
[nPos
++] = cppu::UnoType
<XWeak
>::get();
757 pTypeAr
[nPos
++] = cppu::UnoType
<XChild
>::get();
758 pTypeAr
[nPos
++] = cppu::UnoType
<XCloneable
>::get();
759 pTypeAr
[nPos
++] = cppu::UnoType
<XTypeProvider
>::get();
760 pTypeAr
[nPos
++] = cppu::UnoType
<XServiceInfo
>::get();
761 pTypeAr
[nPos
++] = cppu::UnoType
<XChangesNotifier
>::get();
765 case AnimationNodeType::PAR
:
766 case AnimationNodeType::SEQ
:
767 pTypeAr
[nPos
++] = cppu::UnoType
<XTimeContainer
>::get();
768 pTypeAr
[nPos
++] = cppu::UnoType
<XEnumerationAccess
>::get();
770 case AnimationNodeType::ITERATE
:
771 pTypeAr
[nPos
++] = cppu::UnoType
<XIterateContainer
>::get();
772 pTypeAr
[nPos
++] = cppu::UnoType
<XEnumerationAccess
>::get();
774 case AnimationNodeType::ANIMATE
:
775 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimate
>::get();
777 case AnimationNodeType::ANIMATEMOTION
:
778 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateMotion
>::get();
780 case AnimationNodeType::ANIMATEPHYSICS
:
781 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimatePhysics
>::get();
783 case AnimationNodeType::ANIMATECOLOR
:
784 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateColor
>::get();
786 case AnimationNodeType::ANIMATETRANSFORM
:
787 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateTransform
>::get();
789 case AnimationNodeType::SET
:
790 pTypeAr
[nPos
++] = cppu::UnoType
<XAnimateSet
>::get();
792 case AnimationNodeType::TRANSITIONFILTER
:
793 pTypeAr
[nPos
++] = cppu::UnoType
<XTransitionFilter
>::get();
795 case AnimationNodeType::AUDIO
:
796 pTypeAr
[nPos
++] = cppu::UnoType
<XAudio
>::get();
798 case AnimationNodeType::COMMAND
:
799 pTypeAr
[nPos
++] = cppu::UnoType
<XCommand
>::get();
802 mpTypes
[nNodeType
] = types
;
806 Sequence
< Type
> AnimationNode::getTypes()
808 if (! mpTypes
[mnNodeType
])
809 initTypeProvider(mnNodeType
);
810 return *mpTypes
[mnNodeType
];
814 Sequence
< sal_Int8
> AnimationNode::getImplementationId()
816 return css::uno::Sequence
<sal_Int8
>();
821 void SAL_CALL
AnimationNode::acquire( ) noexcept
823 OWeakObject::acquire();
828 void SAL_CALL
AnimationNode::release( ) noexcept
830 OWeakObject::release();
835 OUString
AnimationNode::getImplementationName()
839 case AnimationNodeType::PAR
:
840 return getImplementationName_PAR();
841 case AnimationNodeType::SEQ
:
842 return getImplementationName_SEQ();
843 case AnimationNodeType::ITERATE
:
844 return getImplementationName_ITERATE();
845 case AnimationNodeType::SET
:
846 return getImplementationName_SET();
847 case AnimationNodeType::ANIMATECOLOR
:
848 return getImplementationName_ANIMATECOLOR();
849 case AnimationNodeType::ANIMATEMOTION
:
850 return getImplementationName_ANIMATEMOTION();
851 case AnimationNodeType::ANIMATEPHYSICS
:
852 return getImplementationName_ANIMATEPHYSICS();
853 case AnimationNodeType::TRANSITIONFILTER
:
854 return getImplementationName_TRANSITIONFILTER();
855 case AnimationNodeType::ANIMATETRANSFORM
:
856 return getImplementationName_ANIMATETRANSFORM();
857 case AnimationNodeType::AUDIO
:
858 return getImplementationName_AUDIO();
859 case AnimationNodeType::COMMAND
:
860 return getImplementationName_COMMAND();
861 case AnimationNodeType::ANIMATE
:
863 return getImplementationName_ANIMATE();
868 sal_Bool
AnimationNode::supportsService(const OUString
& ServiceName
)
870 return cppu::supportsService(this, ServiceName
);
874 Sequence
< OUString
> AnimationNode::getSupportedServiceNames()
878 case AnimationNodeType::PAR
:
879 return getSupportedServiceNames_PAR();
880 case AnimationNodeType::SEQ
:
881 return getSupportedServiceNames_SEQ();
882 case AnimationNodeType::ITERATE
:
883 return getSupportedServiceNames_ITERATE();
884 case AnimationNodeType::SET
:
885 return getSupportedServiceNames_SET();
886 case AnimationNodeType::ANIMATECOLOR
:
887 return getSupportedServiceNames_ANIMATECOLOR();
888 case AnimationNodeType::ANIMATEMOTION
:
889 return getSupportedServiceNames_ANIMATEMOTION();
890 case AnimationNodeType::ANIMATEPHYSICS
:
891 return getSupportedServiceNames_ANIMATEPHYSICS();
892 case AnimationNodeType::TRANSITIONFILTER
:
893 return getSupportedServiceNames_TRANSITIONFILTER();
894 case AnimationNodeType::ANIMATETRANSFORM
:
895 return getSupportedServiceNames_ANIMATETRANSFORM();
896 case AnimationNodeType::AUDIO
:
897 return getSupportedServiceNames_AUDIO();
898 case AnimationNodeType::COMMAND
:
899 return getSupportedServiceNames_COMMAND();
900 case AnimationNodeType::ANIMATE
:
902 return getSupportedServiceNames_ANIMATE();
908 sal_Int16 SAL_CALL
AnimationNode::getType()
915 Any SAL_CALL
AnimationNode::getBegin()
917 std::unique_lock
aGuard( m_aMutex
);
923 void SAL_CALL
AnimationNode::setBegin( const Any
& _begin
)
925 std::unique_lock
aGuard( m_aMutex
);
926 if( _begin
!= maBegin
)
929 fireChangeListener(aGuard
);
935 Any SAL_CALL
AnimationNode::getDuration()
937 std::unique_lock
aGuard( m_aMutex
);
943 void SAL_CALL
AnimationNode::setDuration( const Any
& _duration
)
945 std::unique_lock
aGuard( m_aMutex
);
946 if( _duration
!= maDuration
)
948 maDuration
= _duration
;
949 fireChangeListener(aGuard
);
955 Any SAL_CALL
AnimationNode::getEnd()
957 std::unique_lock
aGuard( m_aMutex
);
963 void SAL_CALL
AnimationNode::setEnd( const Any
& _end
)
965 std::unique_lock
aGuard( m_aMutex
);
969 fireChangeListener(aGuard
);
975 Any SAL_CALL
AnimationNode::getEndSync()
977 std::unique_lock
aGuard( m_aMutex
);
983 void SAL_CALL
AnimationNode::setEndSync( const Any
& _endsync
)
985 std::unique_lock
l( m_aMutex
);
986 if( _endsync
!= maEndSync
)
988 maEndSync
= _endsync
;
989 fireChangeListener(l
);
995 Any SAL_CALL
AnimationNode::getRepeatCount()
997 std::unique_lock
aGuard( m_aMutex
);
998 return maRepeatCount
;
1003 void SAL_CALL
AnimationNode::setRepeatCount( const Any
& _repeatcount
)
1005 std::unique_lock
l( m_aMutex
);
1006 if( _repeatcount
!= maRepeatCount
)
1008 maRepeatCount
= _repeatcount
;
1009 fireChangeListener(l
);
1015 Any SAL_CALL
AnimationNode::getRepeatDuration()
1017 std::unique_lock
aGuard( m_aMutex
);
1018 return maRepeatDuration
;
1023 void SAL_CALL
AnimationNode::setRepeatDuration( const Any
& _repeatduration
)
1025 std::unique_lock
l( m_aMutex
);
1026 if( _repeatduration
!= maRepeatDuration
)
1028 maRepeatDuration
= _repeatduration
;
1029 fireChangeListener(l
);
1035 sal_Int16 SAL_CALL
AnimationNode::getFill()
1037 std::unique_lock
aGuard( m_aMutex
);
1043 void SAL_CALL
AnimationNode::setFill( sal_Int16 _fill
)
1045 std::unique_lock
l( m_aMutex
);
1046 if( _fill
!= mnFill
)
1049 fireChangeListener(l
);
1055 sal_Int16 SAL_CALL
AnimationNode::getFillDefault()
1057 std::unique_lock
aGuard( m_aMutex
);
1058 return mnFillDefault
;
1063 void SAL_CALL
AnimationNode::setFillDefault( sal_Int16 _filldefault
)
1065 std::unique_lock
l( m_aMutex
);
1066 if( _filldefault
!= mnFillDefault
)
1068 mnFillDefault
= _filldefault
;
1069 fireChangeListener(l
);
1075 sal_Int16 SAL_CALL
AnimationNode::getRestart()
1077 std::unique_lock
aGuard( m_aMutex
);
1083 void SAL_CALL
AnimationNode::setRestart( sal_Int16 _restart
)
1085 std::unique_lock
l( m_aMutex
);
1086 if( _restart
!= mnRestart
)
1088 mnRestart
= _restart
;
1089 fireChangeListener(l
);
1095 sal_Int16 SAL_CALL
AnimationNode::getRestartDefault()
1097 std::unique_lock
aGuard( m_aMutex
);
1098 return mnRestartDefault
;
1103 void SAL_CALL
AnimationNode::setRestartDefault( sal_Int16 _restartdefault
)
1105 std::unique_lock
l( m_aMutex
);
1106 if( _restartdefault
!= mnRestartDefault
)
1108 mnRestartDefault
= _restartdefault
;
1109 fireChangeListener(l
);
1115 double SAL_CALL
AnimationNode::getAcceleration()
1117 std::unique_lock
aGuard( m_aMutex
);
1118 return mfAcceleration
;
1123 void SAL_CALL
AnimationNode::setAcceleration( double _acceleration
)
1125 std::unique_lock
l( m_aMutex
);
1126 if( _acceleration
!= mfAcceleration
)
1128 mfAcceleration
= _acceleration
;
1129 fireChangeListener(l
);
1135 double SAL_CALL
AnimationNode::getDecelerate()
1137 std::unique_lock
aGuard( m_aMutex
);
1138 return mfDecelerate
;
1143 void SAL_CALL
AnimationNode::setDecelerate( double _decelerate
)
1145 std::unique_lock
l( m_aMutex
);
1146 if( _decelerate
!= mfDecelerate
)
1148 mfDecelerate
= _decelerate
;
1149 fireChangeListener(l
);
1155 sal_Bool SAL_CALL
AnimationNode::getAutoReverse()
1157 std::unique_lock
aGuard( m_aMutex
);
1158 return mbAutoReverse
;
1163 void SAL_CALL
AnimationNode::setAutoReverse( sal_Bool _autoreverse
)
1165 std::unique_lock
l( m_aMutex
);
1166 if( bool(_autoreverse
) != mbAutoReverse
)
1168 mbAutoReverse
= _autoreverse
;
1169 fireChangeListener(l
);
1174 Sequence
< NamedValue
> SAL_CALL
AnimationNode::getUserData()
1176 std::unique_lock
aGuard( m_aMutex
);
1181 void SAL_CALL
AnimationNode::setUserData( const Sequence
< NamedValue
>& _userdata
)
1183 std::unique_lock
l( m_aMutex
);
1184 maUserData
= _userdata
;
1185 fireChangeListener(l
);
1190 Reference
< XInterface
> SAL_CALL
AnimationNode::getParent()
1192 std::unique_lock
aGuard( m_aMutex
);
1193 return static_cast<cppu::OWeakObject
*>(mxParent
.get().get());
1198 void SAL_CALL
AnimationNode::setParent( const Reference
< XInterface
>& Parent
)
1200 std::unique_lock
l( m_aMutex
);
1201 if( Parent
.get() != static_cast<cppu::OWeakObject
*>(mxParent
.get().get()) )
1203 rtl::Reference
<AnimationNode
> xParent
= dynamic_cast<AnimationNode
*>(Parent
.get());
1204 mxParent
= xParent
.get();
1205 assert(bool(xParent
) == bool(Parent
) && "only support AnimationNode subtypes");
1207 fireChangeListener(l
);
1213 Reference
< XCloneable
> SAL_CALL
AnimationNode::createClone()
1215 std::unique_lock
aGuard( m_aMutex
);
1217 Reference
< XCloneable
> xNewNode
;
1220 xNewNode
= new AnimationNode( *this );
1222 if( !maChildren
.empty() )
1224 Reference
< XTimeContainer
> xContainer( xNewNode
, UNO_QUERY
);
1225 if( xContainer
.is() )
1227 for (auto const& child
: maChildren
)
1229 Reference
< XCloneable
> xCloneable(child
, UNO_QUERY
);
1230 if( xCloneable
.is() ) try
1232 Reference
< XAnimationNode
> xNewChildNode( xCloneable
->createClone(), UNO_QUERY
);
1233 if( xNewChildNode
.is() )
1234 xContainer
->appendChild( xNewChildNode
);
1236 catch(const Exception
&)
1238 SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
1244 catch(const Exception
&)
1246 SAL_INFO("animations", "animations::AnimationNode::createClone(), exception caught!");
1254 Any SAL_CALL
AnimationNode::getTarget()
1256 std::unique_lock
aGuard( m_aMutex
);
1262 void SAL_CALL
AnimationNode::setTarget( const Any
& _target
)
1264 std::unique_lock
l( m_aMutex
);
1265 if( _target
!= maTarget
)
1268 fireChangeListener(l
);
1274 OUString SAL_CALL
AnimationNode::getAttributeName()
1276 std::unique_lock
aGuard( m_aMutex
);
1277 return maAttributeName
;
1282 void SAL_CALL
AnimationNode::setAttributeName( const OUString
& _attribute
)
1284 std::unique_lock
l( m_aMutex
);
1285 if( _attribute
!= maAttributeName
)
1287 maAttributeName
= _attribute
;
1288 fireChangeListener(l
);
1294 Sequence
< Any
> SAL_CALL
AnimationNode::getValues()
1296 std::unique_lock
aGuard( m_aMutex
);
1302 void SAL_CALL
AnimationNode::setValues( const Sequence
< Any
>& _values
)
1304 std::unique_lock
l( m_aMutex
);
1306 fireChangeListener(l
);
1311 sal_Int16 SAL_CALL
AnimationNode::getSubItem()
1313 std::unique_lock
aGuard( m_aMutex
);
1319 void SAL_CALL
AnimationNode::setSubItem( sal_Int16 _subitem
)
1321 std::unique_lock
l( m_aMutex
);
1322 if( _subitem
!= mnSubItem
)
1324 mnSubItem
= _subitem
;
1325 fireChangeListener(l
);
1331 Sequence
< double > SAL_CALL
AnimationNode::getKeyTimes()
1333 std::unique_lock
aGuard( m_aMutex
);
1339 void SAL_CALL
AnimationNode::setKeyTimes( const Sequence
< double >& _keytimes
)
1341 std::unique_lock
l( m_aMutex
);
1342 maKeyTimes
= _keytimes
;
1343 fireChangeListener(l
);
1348 sal_Int16 SAL_CALL
AnimationNode::getValueType()
1350 std::unique_lock
aGuard( m_aMutex
);
1355 void SAL_CALL
AnimationNode::setValueType( sal_Int16 _valuetype
)
1357 std::unique_lock
l( m_aMutex
);
1358 if( _valuetype
!= mnValueType
)
1360 mnValueType
= _valuetype
;
1361 fireChangeListener(l
);
1367 sal_Int16 SAL_CALL
AnimationNode::getCalcMode()
1369 std::unique_lock
aGuard( m_aMutex
);
1375 void SAL_CALL
AnimationNode::setCalcMode( sal_Int16 _calcmode
)
1377 std::unique_lock
l( m_aMutex
);
1378 if( _calcmode
!= mnCalcMode
)
1380 mnCalcMode
= _calcmode
;
1381 fireChangeListener(l
);
1387 sal_Bool SAL_CALL
AnimationNode::getAccumulate()
1389 std::unique_lock
aGuard( m_aMutex
);
1390 return mbAccumulate
;
1395 void SAL_CALL
AnimationNode::setAccumulate( sal_Bool _accumulate
)
1397 std::unique_lock
l( m_aMutex
);
1398 if( bool(_accumulate
) != mbAccumulate
)
1400 mbAccumulate
= _accumulate
;
1401 fireChangeListener(l
);
1407 sal_Int16 SAL_CALL
AnimationNode::getAdditive()
1409 std::unique_lock
aGuard( m_aMutex
);
1415 void SAL_CALL
AnimationNode::setAdditive( sal_Int16 _additive
)
1417 std::unique_lock
l( m_aMutex
);
1418 if( _additive
!= mnAdditive
)
1420 mnAdditive
= _additive
;
1421 fireChangeListener(l
);
1427 Any SAL_CALL
AnimationNode::getFrom()
1429 std::unique_lock
aGuard( m_aMutex
);
1435 void SAL_CALL
AnimationNode::setFrom( const Any
& _from
)
1437 std::unique_lock
l( m_aMutex
);
1438 if( _from
!= maFrom
)
1441 fireChangeListener(l
);
1447 Any SAL_CALL
AnimationNode::getTo()
1449 std::unique_lock
aGuard( m_aMutex
);
1455 void SAL_CALL
AnimationNode::setTo( const Any
& _to
)
1457 std::unique_lock
l( m_aMutex
);
1461 fireChangeListener(l
);
1467 Any SAL_CALL
AnimationNode::getBy()
1469 std::unique_lock
aGuard( m_aMutex
);
1475 void SAL_CALL
AnimationNode::setBy( const Any
& _by
)
1477 std::unique_lock
l( m_aMutex
);
1481 fireChangeListener(l
);
1487 Sequence
< TimeFilterPair
> SAL_CALL
AnimationNode::getTimeFilter()
1489 std::unique_lock
aGuard( m_aMutex
);
1490 return maTimeFilter
;
1495 void SAL_CALL
AnimationNode::setTimeFilter( const Sequence
< TimeFilterPair
>& _timefilter
)
1497 std::unique_lock
l( m_aMutex
);
1498 maTimeFilter
= _timefilter
;
1499 fireChangeListener(l
);
1503 OUString SAL_CALL
AnimationNode::getFormula()
1505 std::unique_lock
aGuard( m_aMutex
);
1510 void SAL_CALL
AnimationNode::setFormula( const OUString
& _formula
)
1512 std::unique_lock
l( m_aMutex
);
1513 if( _formula
!= maFormula
)
1515 maFormula
= _formula
;
1516 fireChangeListener(l
);
1522 sal_Int16 SAL_CALL
AnimationNode::getColorInterpolation()
1524 std::unique_lock
aGuard( m_aMutex
);
1525 return mnColorSpace
;
1530 void SAL_CALL
AnimationNode::setColorInterpolation( sal_Int16 _colorspace
)
1532 std::unique_lock
l( m_aMutex
);
1533 if( _colorspace
!= mnColorSpace
)
1535 mnColorSpace
= _colorspace
;
1536 fireChangeListener(l
);
1542 sal_Bool SAL_CALL
AnimationNode::getDirection()
1544 std::unique_lock
aGuard( m_aMutex
);
1550 void SAL_CALL
AnimationNode::setDirection( sal_Bool _direction
)
1552 std::unique_lock
l( m_aMutex
);
1553 if( bool(_direction
) != mbDirection
)
1555 mbDirection
= _direction
;
1556 fireChangeListener(l
);
1562 Any SAL_CALL
AnimationNode::getPath()
1564 std::unique_lock
aGuard( m_aMutex
);
1570 void SAL_CALL
AnimationNode::setPath( const Any
& _path
)
1572 std::unique_lock
l( m_aMutex
);
1574 fireChangeListener(l
);
1579 Any SAL_CALL
AnimationNode::getOrigin()
1581 std::unique_lock
aGuard( m_aMutex
);
1587 void SAL_CALL
AnimationNode::setOrigin( const Any
& _origin
)
1589 std::unique_lock
l( m_aMutex
);
1591 fireChangeListener(l
);
1595 Any SAL_CALL
AnimationNode::getStartVelocityX()
1597 std::unique_lock
aGuard( m_aMutex
);
1598 return maStartVelocityX
;
1603 void SAL_CALL
AnimationNode::setStartVelocityX( const Any
& _startvelocityx
)
1605 std::unique_lock
l( m_aMutex
);
1606 maStartVelocityX
= _startvelocityx
;
1607 fireChangeListener(l
);
1611 Any SAL_CALL
AnimationNode::getStartVelocityY()
1613 std::unique_lock
aGuard( m_aMutex
);
1614 return maStartVelocityY
;
1619 void SAL_CALL
AnimationNode::setStartVelocityY( const Any
& _startvelocityy
)
1621 std::unique_lock
l( m_aMutex
);
1622 maStartVelocityY
= _startvelocityy
;
1623 fireChangeListener(l
);
1628 Any SAL_CALL
AnimationNode::getDensity()
1630 std::unique_lock
aGuard( m_aMutex
);
1636 void SAL_CALL
AnimationNode::setDensity( const Any
& _density
)
1638 std::unique_lock
l( m_aMutex
);
1639 maDensity
= _density
;
1640 fireChangeListener(l
);
1645 Any SAL_CALL
AnimationNode::getBounciness()
1647 std::unique_lock
aGuard( m_aMutex
);
1648 return maBounciness
;
1653 void SAL_CALL
AnimationNode::setBounciness( const Any
& _bounciness
)
1655 std::unique_lock
l( m_aMutex
);
1656 maBounciness
= _bounciness
;
1657 fireChangeListener(l
);
1661 // XAnimateTransform
1662 sal_Int16 SAL_CALL
AnimationNode::getTransformType()
1664 std::unique_lock
aGuard( m_aMutex
);
1665 return mnTransformType
;
1669 // XAnimateTransform
1670 void SAL_CALL
AnimationNode::setTransformType( sal_Int16 _transformtype
)
1672 std::unique_lock
l( m_aMutex
);
1673 if( _transformtype
!= mnTransformType
)
1675 mnTransformType
= _transformtype
;
1676 fireChangeListener(l
);
1681 // XTransitionFilter
1682 sal_Int16 SAL_CALL
AnimationNode::getTransition()
1684 std::unique_lock
aGuard( m_aMutex
);
1685 return mnTransition
;
1689 // XTransitionFilter
1690 void SAL_CALL
AnimationNode::setTransition( sal_Int16 _transition
)
1692 std::unique_lock
l( m_aMutex
);
1693 if( _transition
!= mnTransition
)
1695 mnTransition
= _transition
;
1696 fireChangeListener(l
);
1701 // XTransitionFilter
1702 sal_Int16 SAL_CALL
AnimationNode::getSubtype()
1704 std::unique_lock
aGuard( m_aMutex
);
1709 // XTransitionFilter
1710 void SAL_CALL
AnimationNode::setSubtype( sal_Int16 _subtype
)
1712 std::unique_lock
l( m_aMutex
);
1713 if( _subtype
!= mnSubtype
)
1715 mnSubtype
= _subtype
;
1716 fireChangeListener(l
);
1721 // XTransitionFilter
1722 sal_Bool SAL_CALL
AnimationNode::getMode()
1724 std::unique_lock
aGuard( m_aMutex
);
1729 // XTransitionFilter
1730 void SAL_CALL
AnimationNode::setMode( sal_Bool _mode
)
1732 std::unique_lock
l( m_aMutex
);
1733 if( bool(_mode
) != mbMode
)
1736 fireChangeListener(l
);
1741 // XTransitionFilter
1742 sal_Int32 SAL_CALL
AnimationNode::getFadeColor()
1744 std::unique_lock
aGuard( m_aMutex
);
1749 // XTransitionFilter
1750 void SAL_CALL
AnimationNode::setFadeColor( sal_Int32 _fadecolor
)
1752 std::unique_lock
l( m_aMutex
);
1753 if( _fadecolor
!= mnFadeColor
)
1755 mnFadeColor
= _fadecolor
;
1756 fireChangeListener(l
);
1762 Any SAL_CALL
AnimationNode::getSource()
1764 std::unique_lock
aGuard( m_aMutex
);
1770 void SAL_CALL
AnimationNode::setSource( const Any
& _source
)
1772 std::unique_lock
l( m_aMutex
);
1774 fireChangeListener(l
);
1779 double SAL_CALL
AnimationNode::getVolume()
1781 std::unique_lock
aGuard( m_aMutex
);
1787 void SAL_CALL
AnimationNode::setVolume( double _volume
)
1789 std::unique_lock
l( m_aMutex
);
1790 if( _volume
!= mfVolume
)
1793 fireChangeListener(l
);
1797 sal_Bool SAL_CALL
AnimationNode::getHideDuringShow()
1799 std::unique_lock
aGuard(m_aMutex
);
1800 return mbHideDuringShow
;
1803 void SAL_CALL
AnimationNode::setHideDuringShow(sal_Bool bHideDuringShow
)
1805 std::unique_lock
l(m_aMutex
);
1806 if (static_cast<bool>(bHideDuringShow
) != mbHideDuringShow
)
1808 mbHideDuringShow
= bHideDuringShow
;
1809 fireChangeListener(l
);
1813 sal_Bool SAL_CALL
AnimationNode::getNarration()
1815 std::unique_lock
aGuard(m_aMutex
);
1819 void SAL_CALL
AnimationNode::setNarration(sal_Bool bNarration
)
1821 std::unique_lock
l(m_aMutex
);
1822 if (static_cast<bool>(bNarration
) != mbNarration
)
1824 mbNarration
= bNarration
;
1825 fireChangeListener(l
);
1830 sal_Int16 SAL_CALL
AnimationNode::getCommand()
1832 std::unique_lock
aGuard( m_aMutex
);
1838 void SAL_CALL
AnimationNode::setCommand( sal_Int16 _command
)
1840 std::unique_lock
l( m_aMutex
);
1841 if( _command
!= mnCommand
)
1843 mnCommand
= _command
;
1844 fireChangeListener(l
);
1850 Any SAL_CALL
AnimationNode::getParameter()
1852 std::unique_lock
aGuard( m_aMutex
);
1858 void SAL_CALL
AnimationNode::setParameter( const Any
& _parameter
)
1860 std::unique_lock
l( m_aMutex
);
1861 maParameter
= _parameter
;
1862 fireChangeListener(l
);
1867 Type SAL_CALL
AnimationNode::getElementType()
1869 return cppu::UnoType
<XAnimationNode
>::get();
1874 sal_Bool SAL_CALL
AnimationNode::hasElements()
1876 std::unique_lock
aGuard( m_aMutex
);
1877 return !maChildren
.empty();
1881 // XEnumerationAccess
1882 Reference
< XEnumeration
> SAL_CALL
AnimationNode::createEnumeration()
1884 std::unique_lock
aGuard( m_aMutex
);
1886 return new TimeContainerEnumeration(std::vector(maChildren
));
1891 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertBefore( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1893 std::unique_lock
l( m_aMutex
);
1895 if( !newChild
.is() || !refChild
.is() )
1896 throw IllegalArgumentException(u
"no child"_ustr
, static_cast<cppu::OWeakObject
*>(this), -1);
1898 if( std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1899 throw ElementExistException();
1901 auto before
= std::find(maChildren
.begin(), maChildren
.end(), refChild
);
1902 if( before
== maChildren
.end() )
1903 throw NoSuchElementException();
1905 maChildren
.insert( before
, newChild
);
1907 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1909 newChild
->setParent( xThis
);
1916 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::insertAfter( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& refChild
)
1918 std::unique_lock
l( m_aMutex
);
1920 if( !newChild
.is() || !refChild
.is() )
1921 throw IllegalArgumentException(u
"no child"_ustr
, static_cast<cppu::OWeakObject
*>(this), -1);
1923 if( std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1924 throw ElementExistException();
1926 auto before
= std::find(maChildren
.begin(), maChildren
.end(), refChild
);
1927 if( before
== maChildren
.end() )
1928 throw NoSuchElementException();
1931 if( before
!= maChildren
.end() )
1932 maChildren
.insert( before
, newChild
);
1934 maChildren
.push_back( newChild
);
1936 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1938 newChild
->setParent( xThis
);
1945 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::replaceChild( const Reference
< XAnimationNode
>& newChild
, const Reference
< XAnimationNode
>& oldChild
)
1947 std::unique_lock
l( m_aMutex
);
1949 if( !newChild
.is() || !oldChild
.is() )
1950 throw IllegalArgumentException(u
"no child"_ustr
, static_cast<cppu::OWeakObject
*>(this), -1);
1952 if( std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
1953 throw ElementExistException();
1955 auto replace
= std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1956 if( replace
== maChildren
.end() )
1957 throw NoSuchElementException();
1959 (*replace
) = newChild
;
1961 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1963 oldChild
->setParent( Reference
< XInterface
>() );
1964 newChild
->setParent( xThis
);
1971 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::removeChild( const Reference
< XAnimationNode
>& oldChild
)
1973 std::unique_lock
l( m_aMutex
);
1975 if( !oldChild
.is() )
1976 throw IllegalArgumentException(u
"no child"_ustr
, static_cast<cppu::OWeakObject
*>(this), 1);
1978 auto old
= std::find(maChildren
.begin(), maChildren
.end(), oldChild
);
1979 if( old
== maChildren
.end() )
1980 throw NoSuchElementException();
1982 maChildren
.erase( old
);
1985 oldChild
->setParent( Reference
< XInterface
>() );
1992 Reference
< XAnimationNode
> SAL_CALL
AnimationNode::appendChild( const Reference
< XAnimationNode
>& newChild
)
1994 Reference
< XInterface
> xThis( static_cast< OWeakObject
* >(this) );
1996 std::unique_lock
aGuard( m_aMutex
);
1998 if( !newChild
.is() )
1999 throw IllegalArgumentException(u
"no child"_ustr
, xThis
, 1);
2001 if( std::find(maChildren
.begin(), maChildren
.end(), newChild
) != maChildren
.end() )
2002 throw ElementExistException({}, xThis
);
2004 if( xThis
== newChild
)
2005 throw IllegalArgumentException(u
"cannot append self"_ustr
, xThis
, -1);
2007 maChildren
.push_back( newChild
);
2009 newChild
->setParent( xThis
);
2015 // XIterateContainer
2016 sal_Int16 SAL_CALL
AnimationNode::getIterateType()
2018 std::unique_lock
aGuard( m_aMutex
);
2019 return mnIterateType
;
2023 // XIterateContainer
2024 void SAL_CALL
AnimationNode::setIterateType( sal_Int16 _iteratetype
)
2026 std::unique_lock
l( m_aMutex
);
2027 if( _iteratetype
!= mnIterateType
)
2029 mnIterateType
= _iteratetype
;
2030 fireChangeListener(l
);
2035 // XIterateContainer
2036 double SAL_CALL
AnimationNode::getIterateInterval()
2038 std::unique_lock
aGuard( m_aMutex
);
2039 return mfIterateInterval
;
2043 // XIterateContainer
2044 void SAL_CALL
AnimationNode::setIterateInterval( double _iterateinterval
)
2046 std::unique_lock
l( m_aMutex
);
2047 if( _iterateinterval
!= mfIterateInterval
)
2049 mfIterateInterval
= _iterateinterval
;
2050 fireChangeListener(l
);
2056 void SAL_CALL
AnimationNode::addChangesListener( const Reference
< XChangesListener
>& aListener
)
2058 std::unique_lock
l( m_aMutex
);
2059 maChangeListener
.addInterface( l
, aListener
);
2064 void SAL_CALL
AnimationNode::removeChangesListener( const Reference
< XChangesListener
>& aListener
)
2066 std::unique_lock
l( m_aMutex
);
2067 maChangeListener
.removeInterface(l
, aListener
);
2071 void AnimationNode::fireChangeListener(std::unique_lock
<std::mutex
>& l
)
2073 if( maChangeListener
.getLength(l
) != 0 )
2075 Reference
< XInterface
> xSource( static_cast<OWeakObject
*>(this), UNO_QUERY
);
2076 Sequence
< ElementChange
> aChanges
;
2077 const ChangesEvent
aEvent( xSource
, Any( css::uno::Reference
<XInterface
>(static_cast<cppu::OWeakObject
*>(mxParent
.get().get())) ), aChanges
);
2078 OInterfaceIteratorHelper4
aIterator( l
, maChangeListener
);
2080 while( aIterator
.hasMoreElements() )
2081 aIterator
.next()->changesOccurred( aEvent
);
2085 //fdo#69645 use WeakReference of mxParent to test if mpParent is still valid
2086 rtl::Reference
<AnimationNode
> xGuard(mxParent
);
2090 std::unique_lock
l2(xGuard
->m_aMutex
);
2091 xGuard
->fireChangeListener(l2
);
2096 } // namespace animcore
2099 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2100 com_sun_star_animations_ParallelTimeContainer_get_implementation(css::uno::XComponentContext
*,
2101 css::uno::Sequence
<css::uno::Any
> const &)
2103 return cppu::acquire(new animcore::AnimationNode(PAR
));
2106 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2107 com_sun_star_animations_SequenceTimeContainer_get_implementation(css::uno::XComponentContext
*,
2108 css::uno::Sequence
<css::uno::Any
> const &)
2110 return cppu::acquire(new animcore::AnimationNode(SEQ
));
2113 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2114 com_sun_star_animations_IterateContainer_get_implementation(css::uno::XComponentContext
*,
2115 css::uno::Sequence
<css::uno::Any
> const &)
2117 return cppu::acquire(new animcore::AnimationNode(ITERATE
));
2120 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2121 com_sun_star_animations_Animate_get_implementation(css::uno::XComponentContext
*,
2122 css::uno::Sequence
<css::uno::Any
> const &)
2124 return cppu::acquire(new animcore::AnimationNode(ANIMATE
));
2127 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2128 com_sun_star_animations_AnimateSet_get_implementation(css::uno::XComponentContext
*,
2129 css::uno::Sequence
<css::uno::Any
> const &)
2131 return cppu::acquire(new animcore::AnimationNode(SET
));
2134 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2135 com_sun_star_animations_AnimateColor_get_implementation(css::uno::XComponentContext
*,
2136 css::uno::Sequence
<css::uno::Any
> const &)
2138 return cppu::acquire(new animcore::AnimationNode(ANIMATECOLOR
));
2141 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2142 com_sun_star_animations_AnimateMotion_get_implementation(css::uno::XComponentContext
*,
2143 css::uno::Sequence
<css::uno::Any
> const &)
2145 return cppu::acquire(new animcore::AnimationNode(ANIMATEMOTION
));
2148 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2149 com_sun_star_animations_AnimatePhysics_get_implementation(css::uno::XComponentContext
*,
2150 css::uno::Sequence
<css::uno::Any
> const &)
2152 return cppu::acquire(new animcore::AnimationNode(ANIMATEPHYSICS
));
2155 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2156 com_sun_star_animations_AnimateTransform_get_implementation(css::uno::XComponentContext
*,
2157 css::uno::Sequence
<css::uno::Any
> const &)
2159 return cppu::acquire(new animcore::AnimationNode(ANIMATETRANSFORM
));
2162 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2163 com_sun_star_animations_TransitionFilter_get_implementation(css::uno::XComponentContext
*,
2164 css::uno::Sequence
<css::uno::Any
> const &)
2166 return cppu::acquire(new animcore::AnimationNode(TRANSITIONFILTER
));
2169 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2170 com_sun_star_animations_Audio_get_implementation(css::uno::XComponentContext
*,
2171 css::uno::Sequence
<css::uno::Any
> const &)
2173 return cppu::acquire(new animcore::AnimationNode(AUDIO
));
2176 extern "C" SAL_DLLPUBLIC_EXPORT
css::uno::XInterface
*
2177 com_sun_star_animations_Command_get_implementation(css::uno::XComponentContext
*,
2178 css::uno::Sequence
<css::uno::Any
> const &)
2180 return cppu::acquire(new animcore::AnimationNode(COMMAND
));
2183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */