20#include <com/sun/star/animations/XTimeContainer.hpp>
21#include <com/sun/star/presentation/ParagraphTarget.hpp>
22#include <com/sun/star/animations/AnimationFill.hpp>
23#include <com/sun/star/animations/AnimationNodeType.hpp>
24#include <com/sun/star/animations/XAnimate.hpp>
25#include <com/sun/star/animations/AnimationRestart.hpp>
26#include <com/sun/star/animations/ParallelTimeContainer.hpp>
27#include <com/sun/star/lang/IllegalArgumentException.hpp>
28#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <com/sun/star/lang/XInitialization.hpp>
30#include <com/sun/star/container/XEnumerationAccess.hpp>
31#include <com/sun/star/util/XCloneable.hpp>
41using ::com::sun::star::uno::Reference;
42using ::com::sun::star::uno::Sequence;
43using ::com::sun::star::uno::Any;
44using ::com::sun::star::uno::UNO_QUERY;
45using ::com::sun::star::uno::XInterface;
46using ::com::sun::star::uno::WeakReference;
47using ::com::sun::star::beans::NamedValue;
48using ::com::sun::star::lang::IllegalArgumentException;
49using ::com::sun::star::container::XEnumeration;
50using ::com::sun::star::container::XEnumerationAccess;
51using ::com::sun::star::util::XCloneable;
52using ::com::sun::star::lang::XServiceInfo;
53using ::com::sun::star::lang::XInitialization;
54using ::com::sun::star::uno::Type;
55using ::com::sun::star::uno::XWeak;
56using ::com::sun::star::presentation::ParagraphTarget;
57using ::com::sun::star::drawing::XShape;
64typedef ::cppu::WeakImplHelper< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization >
RandomAnimationNodeBase;
71 RandomAnimationNode(
const RandomAnimationNode& rNode );
72 explicit RandomAnimationNode( sal_Int16 nPresetClass );
73 RandomAnimationNode();
75 void init( sal_Int16 nPresetClass );
78 void SAL_CALL initialize(
const Sequence< Any >&
aArguments )
override;
81 Reference< XInterface > SAL_CALL getParent( )
override;
82 void SAL_CALL setParent(
const Reference< XInterface >&
Parent )
override;
85 virtual Reference< XCloneable > SAL_CALL createClone()
override;
93 ::sal_Int16 SAL_CALL
getType()
override;
94 Any SAL_CALL getBegin()
override;
95 void SAL_CALL setBegin(
const Any& _begin )
override;
96 Any SAL_CALL getDuration()
override;
97 void SAL_CALL setDuration(
const Any& _duration )
override;
98 Any SAL_CALL getEnd()
override;
99 void SAL_CALL setEnd(
const Any& _end )
override;
100 Any SAL_CALL getEndSync()
override;
101 void SAL_CALL setEndSync(
const Any& _endsync )
override;
102 Any SAL_CALL getRepeatCount()
override;
103 void SAL_CALL setRepeatCount(
const Any& _repeatcount )
override;
104 Any SAL_CALL getRepeatDuration()
override;
105 void SAL_CALL setRepeatDuration(
const Any& _repeatduration )
override;
106 ::sal_Int16 SAL_CALL getFill()
override;
107 void SAL_CALL setFill( ::sal_Int16 _fill )
override;
108 ::sal_Int16 SAL_CALL getFillDefault()
override;
109 void SAL_CALL setFillDefault( ::sal_Int16 _filldefault )
override;
110 ::sal_Int16 SAL_CALL getRestart()
override;
111 void SAL_CALL setRestart( ::sal_Int16 _restart )
override;
112 ::sal_Int16 SAL_CALL getRestartDefault()
override;
113 void SAL_CALL setRestartDefault( ::sal_Int16 _restartdefault )
override;
114 double SAL_CALL getAcceleration()
override;
115 void SAL_CALL setAcceleration(
double _acceleration )
override;
116 double SAL_CALL getDecelerate()
override;
117 void SAL_CALL setDecelerate(
double _decelerate )
override;
118 sal_Bool SAL_CALL getAutoReverse()
override;
119 void SAL_CALL setAutoReverse(
sal_Bool _autoreverse )
override;
120 Sequence< NamedValue > SAL_CALL
getUserData()
override;
121 void SAL_CALL setUserData(
const Sequence< NamedValue >& _userdata )
override;
124 virtual Type SAL_CALL getElementType()
override;
125 virtual sal_Bool SAL_CALL hasElements()
override;
128 virtual Reference< XEnumeration > SAL_CALL createEnumeration()
override;
131 Reference< XAnimationNode > SAL_CALL insertBefore(
const Reference< XAnimationNode >& newChild,
const Reference< XAnimationNode >& refChild )
override;
132 Reference< XAnimationNode > SAL_CALL insertAfter(
const Reference< XAnimationNode >& newChild,
const Reference< XAnimationNode >& refChild )
override;
133 Reference< XAnimationNode > SAL_CALL replaceChild(
const Reference< XAnimationNode >& newChild,
const Reference< XAnimationNode >& oldChild )
override;
134 Reference< XAnimationNode > SAL_CALL removeChild(
const Reference< XAnimationNode >& oldChild )
override;
135 Reference< XAnimationNode > SAL_CALL appendChild(
const Reference< XAnimationNode >& newChild )
override;
141 sal_Int16 mnPresetClass;
150 Reference< XAnimate > mxFirstNode;
157 Reference< XInterface > xInt(
static_cast<XWeak*
>(
new RandomAnimationNode( nPresetClass ) ) );
161RandomAnimationNode::RandomAnimationNode(
const RandomAnimationNode& rNode )
163 mnPresetClass( rNode.mnPresetClass ),
182RandomAnimationNode::RandomAnimationNode( sal_Int16 nPresetClass )
184 init( nPresetClass );
187RandomAnimationNode::RandomAnimationNode()
192void RandomAnimationNode::init( sal_Int16 nPresetClass )
194 mnPresetClass = nPresetClass;
195 mnFill = AnimationFill::DEFAULT;
205void SAL_CALL RandomAnimationNode::initialize(
const Sequence< Any >& aArguments )
208 throw IllegalArgumentException();
216 Reference< XShape > xShape;
219 throw IllegalArgumentException();
225sal_Int16 SAL_CALL RandomAnimationNode::getType()
227 return css::animations::AnimationNodeType::PAR;
231Any SAL_CALL RandomAnimationNode::getBegin()
233 std::unique_lock aGuard( maMutex );
238void SAL_CALL RandomAnimationNode::setBegin(
const Any& _begin )
240 std::unique_lock aGuard( maMutex );
245Any SAL_CALL RandomAnimationNode::getDuration()
247 std::unique_lock aGuard( maMutex );
252void SAL_CALL RandomAnimationNode::setDuration(
const Any& _duration )
254 std::unique_lock aGuard( maMutex );
259Any SAL_CALL RandomAnimationNode::getEnd()
261 std::unique_lock aGuard( maMutex );
266void SAL_CALL RandomAnimationNode::setEnd(
const Any& _end )
268 std::unique_lock aGuard( maMutex );
273Any SAL_CALL RandomAnimationNode::getEndSync()
275 std::unique_lock aGuard( maMutex );
280void SAL_CALL RandomAnimationNode::setEndSync(
const Any& _endsync )
282 std::unique_lock aGuard( maMutex );
287Any SAL_CALL RandomAnimationNode::getRepeatCount()
289 std::unique_lock aGuard( maMutex );
294void SAL_CALL RandomAnimationNode::setRepeatCount(
const Any& _repeatcount )
296 std::unique_lock aGuard( maMutex );
301Any SAL_CALL RandomAnimationNode::getRepeatDuration()
303 std::unique_lock aGuard( maMutex );
308void SAL_CALL RandomAnimationNode::setRepeatDuration(
const Any& _repeatduration )
310 std::unique_lock aGuard( maMutex );
315sal_Int16 SAL_CALL RandomAnimationNode::getFill()
317 std::unique_lock aGuard( maMutex );
322void SAL_CALL RandomAnimationNode::setFill( sal_Int16 _fill )
324 std::unique_lock aGuard( maMutex );
329sal_Int16 SAL_CALL RandomAnimationNode::getFillDefault()
331 std::unique_lock aGuard( maMutex );
336void SAL_CALL RandomAnimationNode::setFillDefault( sal_Int16 _filldefault )
338 std::unique_lock aGuard( maMutex );
343sal_Int16 SAL_CALL RandomAnimationNode::getRestart()
345 std::unique_lock aGuard( maMutex );
350void SAL_CALL RandomAnimationNode::setRestart( sal_Int16 _restart )
352 std::unique_lock aGuard( maMutex );
357sal_Int16 SAL_CALL RandomAnimationNode::getRestartDefault()
359 std::unique_lock aGuard( maMutex );
364void SAL_CALL RandomAnimationNode::setRestartDefault( sal_Int16 _restartdefault )
366 std::unique_lock aGuard( maMutex );
371double SAL_CALL RandomAnimationNode::getAcceleration()
373 std::unique_lock aGuard( maMutex );
378void SAL_CALL RandomAnimationNode::setAcceleration(
double _acceleration )
380 std::unique_lock aGuard( maMutex );
385double SAL_CALL RandomAnimationNode::getDecelerate()
387 std::unique_lock aGuard( maMutex );
392void SAL_CALL RandomAnimationNode::setDecelerate(
double _decelerate )
394 std::unique_lock aGuard( maMutex );
399sal_Bool SAL_CALL RandomAnimationNode::getAutoReverse()
401 std::unique_lock aGuard( maMutex );
406void SAL_CALL RandomAnimationNode::setAutoReverse(
sal_Bool _autoreverse )
408 std::unique_lock aGuard( maMutex );
412Sequence< NamedValue > SAL_CALL RandomAnimationNode::getUserData()
414 std::unique_lock aGuard( maMutex );
418void SAL_CALL RandomAnimationNode::setUserData(
const Sequence< NamedValue >& _userdata )
420 std::unique_lock aGuard( maMutex );
425Reference< XInterface > SAL_CALL RandomAnimationNode::getParent()
427 std::unique_lock aGuard( maMutex );
432void SAL_CALL RandomAnimationNode::setParent(
const Reference< XInterface >& Parent )
434 std::unique_lock aGuard( maMutex );
439Reference< XCloneable > SAL_CALL RandomAnimationNode::createClone()
441 Reference< XCloneable > xNewNode(
new RandomAnimationNode( *
this ) );
446Type SAL_CALL RandomAnimationNode::getElementType()
452sal_Bool SAL_CALL RandomAnimationNode::hasElements()
458Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration()
460 std::unique_lock aGuard( maMutex );
462 if( !
maTarget.hasValue() && mxFirstNode.is() )
464 Any aTarget( mxFirstNode->getTarget() );
465 if( aTarget.hasValue() )
472 Reference< XEnumeration > xEnum;
474 Reference< XEnumerationAccess > aEnumAccess( CustomAnimationPresets::getCustomAnimationPresets().getRandomPreset( mnPresetClass ), UNO_QUERY );
476 if( aEnumAccess.is() )
478 Reference< XEnumeration > xEnumeration = aEnumAccess->createEnumeration();
479 if( xEnumeration.is() )
481 while( xEnumeration->hasMoreElements() )
483 Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
485 xAnimate->setTarget( maTarget );
488 xEnum = aEnumAccess->createEnumeration();
494 xEnum = xTimeContainer->createEnumeration();
501Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertBefore(
const Reference< XAnimationNode >& newChild,
const Reference< XAnimationNode >& )
503 return appendChild( newChild );
507Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertAfter(
const Reference< XAnimationNode >& newChild,
const Reference< XAnimationNode >& )
509 return appendChild( newChild );
513Reference< XAnimationNode > SAL_CALL RandomAnimationNode::replaceChild(
const Reference< XAnimationNode >& newChild,
const Reference< XAnimationNode >& )
515 return appendChild( newChild );
519Reference< XAnimationNode > SAL_CALL RandomAnimationNode::removeChild(
const Reference< XAnimationNode >& oldChild )
525Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild(
const Reference< XAnimationNode >& newChild )
527 Reference< XAnimate > xAnimate( newChild, UNO_QUERY );
530 Any aTarget( xAnimate->getTarget() );
531 if( aTarget.hasValue() )
535 if( !
maTarget.hasValue() && !mxFirstNode.is() )
536 mxFirstNode = xAnimate;
542OUString RandomAnimationNode::getImplementationName()
544 return "sd::RandomAnimationNode" ;
548sal_Bool RandomAnimationNode::supportsService(
const OUString& ServiceName)
554Sequence< OUString > RandomAnimationNode::getSupportedServiceNames()
556 return {
"com.sun.star.animations.ParallelTimeContainer",
"com.sun.star.comp.sd.RandomAnimationNode" };
561extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
563 css::uno::Sequence<css::uno::Any>
const &)
565 return cppu::acquire(
new sd::RandomAnimationNode());
unotools::WeakReference< AnimationNode > mxParent
Sequence< NamedValue > maUserData
sal_Int16 mnRestartDefault
FILE * init(int, char **)
css::uno::Type const & get()
Sequence< PropertyValue > aArguments
Reference< XComponentContext > getProcessComponentContext()
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
::cppu::WeakImplHelper< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization > RandomAnimationNodeBase
Reference< XInterface > RandomAnimationNode_createInstance(sal_Int16 nPresetClass)
bool getType(BSTR name, Type &type)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * RandomAnimationNode_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)