merge the formfield patch from ooo-build
[ooovba.git] / sd / source / ui / unoidl / randomnode.cxx
blob69408af84b79c1cbd768415f0566f673fe9790db
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: randomnode.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_sd.hxx"
34 #include <com/sun/star/animations/XTimeContainer.hpp>
35 #include <com/sun/star/presentation/ParagraphTarget.hpp>
36 #include <com/sun/star/animations/AnimationFill.hpp>
37 #include <com/sun/star/animations/XAnimate.hpp>
38 #include <com/sun/star/animations/AnimationRestart.hpp>
39 #include <com/sun/star/lang/XServiceInfo.hpp>
40 #include <com/sun/star/lang/XInitialization.hpp>
41 #include <com/sun/star/container/XEnumerationAccess.hpp>
42 #include <com/sun/star/util/XCloneable.hpp>
43 #include <comphelper/processfactory.hxx>
45 #include <cppuhelper/implbase5.hxx>
46 #include <osl/mutex.hxx>
47 #include "CustomAnimationPreset.hxx"
49 using ::osl::Mutex;
50 using ::osl::Guard;
51 using ::rtl::OUString;
53 using ::com::sun::star::uno::Reference;
54 using ::com::sun::star::uno::RuntimeException;
55 using ::com::sun::star::uno::Exception;
56 using ::com::sun::star::uno::Sequence;
57 using ::com::sun::star::uno::Any;
58 using ::com::sun::star::uno::UNO_QUERY;
59 using ::com::sun::star::uno::XInterface;
60 using ::com::sun::star::lang::NoSupportException;
61 using ::com::sun::star::beans::NamedValue;
62 using ::com::sun::star::lang::IllegalArgumentException;
63 using ::com::sun::star::container::NoSuchElementException;
64 using ::com::sun::star::container::ElementExistException;
65 using ::com::sun::star::lang::WrappedTargetException;
66 using ::com::sun::star::container::XEnumeration;
67 using ::com::sun::star::container::XEnumerationAccess;
68 using ::com::sun::star::util::XCloneable;
69 using ::com::sun::star::lang::XServiceInfo;
70 using ::com::sun::star::lang::XInitialization;
71 using ::com::sun::star::uno::Type;
72 using ::com::sun::star::uno::XWeak;
73 using ::com::sun::star::lang::XMultiServiceFactory;
74 using ::com::sun::star::presentation::ParagraphTarget;
75 using ::com::sun::star::drawing::XShape;
77 using namespace ::com::sun::star::animations;
78 namespace sd
81 typedef ::cppu::WeakImplHelper5< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization > RandomAnimationNodeBase;
82 class RandomAnimationNode : public RandomAnimationNodeBase
84 public:
85 RandomAnimationNode( const RandomAnimationNode& rNode );
86 RandomAnimationNode( sal_Int16 nPresetClass );
87 RandomAnimationNode();
89 void init( sal_Int16 nPresetClass );
91 // XInitialization
92 void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
94 // XChild
95 Reference< XInterface > SAL_CALL getParent( ) throw (RuntimeException);
96 void SAL_CALL setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException);
98 // XCloneable
99 virtual Reference< XCloneable > SAL_CALL createClone() throw (RuntimeException);
101 // XServiceInfo
102 OUString SAL_CALL getImplementationName() throw();
103 Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
104 sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw();
106 // XAnimationNode
107 ::sal_Int16 SAL_CALL getType() throw (RuntimeException);
108 Any SAL_CALL getBegin() throw (RuntimeException);
109 void SAL_CALL setBegin( const Any& _begin ) throw (RuntimeException);
110 Any SAL_CALL getDuration() throw (RuntimeException);
111 void SAL_CALL setDuration( const Any& _duration ) throw (RuntimeException);
112 Any SAL_CALL getEnd() throw (RuntimeException);
113 void SAL_CALL setEnd( const Any& _end ) throw (RuntimeException);
114 Any SAL_CALL getEndSync() throw (RuntimeException);
115 void SAL_CALL setEndSync( const Any& _endsync ) throw (RuntimeException);
116 Any SAL_CALL getRepeatCount() throw (RuntimeException);
117 void SAL_CALL setRepeatCount( const Any& _repeatcount ) throw (RuntimeException);
118 Any SAL_CALL getRepeatDuration() throw (RuntimeException);
119 void SAL_CALL setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException);
120 ::sal_Int16 SAL_CALL getFill() throw (RuntimeException);
121 void SAL_CALL setFill( ::sal_Int16 _fill ) throw (RuntimeException);
122 ::sal_Int16 SAL_CALL getFillDefault() throw (RuntimeException);
123 void SAL_CALL setFillDefault( ::sal_Int16 _filldefault ) throw (RuntimeException);
124 ::sal_Int16 SAL_CALL getRestart() throw (RuntimeException);
125 void SAL_CALL setRestart( ::sal_Int16 _restart ) throw (RuntimeException);
126 ::sal_Int16 SAL_CALL getRestartDefault() throw (RuntimeException);
127 void SAL_CALL setRestartDefault( ::sal_Int16 _restartdefault ) throw (RuntimeException);
128 double SAL_CALL getAcceleration() throw (RuntimeException);
129 void SAL_CALL setAcceleration( double _acceleration ) throw (RuntimeException);
130 double SAL_CALL getDecelerate() throw (RuntimeException);
131 void SAL_CALL setDecelerate( double _decelerate ) throw (RuntimeException);
132 ::sal_Bool SAL_CALL getAutoReverse() throw (RuntimeException);
133 void SAL_CALL setAutoReverse( ::sal_Bool _autoreverse ) throw (RuntimeException);
134 Sequence< NamedValue > SAL_CALL getUserData() throw (RuntimeException);
135 void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException);
137 // XElementAccess
138 virtual Type SAL_CALL getElementType() throw (RuntimeException);
139 virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
141 // XEnumerationAccess
142 virtual Reference< XEnumeration > SAL_CALL createEnumeration() throw (RuntimeException);
144 // XTimeContainer
145 Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
146 Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
147 Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
148 Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException);
149 Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException);
151 private:
152 // our first, last and only protection from mutli-threads!
153 Mutex maMutex;
155 sal_Int16 mnPresetClass;
156 Reference< XInterface > mxParent;
158 Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration, maTarget;
159 sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
160 double mfAcceleration, mfDecelerate;
161 sal_Bool mbAutoReverse;
162 Sequence< NamedValue > maUserData;
164 Reference< XAnimate > mxFirstNode;
167 // --------------------------------------------------------------------
169 static const sal_Char* pSN1 = "com.sun.star.animations.ParallelTimeContainer";
170 static const sal_Char* pSN2 = "com.sun.star.comp.sd.RandomAnimationNode";
172 // --------------------------------------------------------------------
174 SD_DLLPUBLIC Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass )
176 Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode( nPresetClass ) ) );
177 return xInt;
180 // --------------------------------------------------------------------
182 Reference< XInterface > SAL_CALL RandomNode_createInstance( const Reference< XMultiServiceFactory > & )
184 Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode() ) );
185 return xInt;
188 // --------------------------------------------------------------------
190 OUString RandomNode__getImplementationName() throw( RuntimeException )
192 return OUString( RTL_CONSTASCII_USTRINGPARAM( "sd::RandomAnimationNode" ) );
195 // --------------------------------------------------------------------
197 Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( RuntimeException )
199 // static const OUString aSN1( OUString::createFromAscii( pSN1 ) );
200 static const OUString aSN2( OUString::createFromAscii( pSN2 ) );
201 Sequence< OUString > aSeq( &aSN2, 1 );
202 // aSeq[0] = aSN1;
203 /// aSeq[1] = aSN2;
204 return aSeq;
207 // --------------------------------------------------------------------
209 RandomAnimationNode::RandomAnimationNode( const RandomAnimationNode& rNode )
210 : RandomAnimationNodeBase(),
211 mnPresetClass( rNode.mnPresetClass ),
212 maBegin( rNode.maBegin ),
213 maDuration( rNode.maDuration ),
214 maEnd( rNode.maEnd ),
215 maEndSync( rNode.maEndSync ),
216 maRepeatCount( rNode.maRepeatCount ),
217 maRepeatDuration( rNode.maRepeatDuration ),
218 maTarget( rNode.maTarget ),
219 mnFill( rNode.mnFill ),
220 mnFillDefault( rNode.mnFillDefault ),
221 mnRestart( rNode.mnRestart ),
222 mnRestartDefault( rNode.mnRestartDefault ),
223 mfAcceleration( rNode.mfAcceleration ),
224 mfDecelerate( rNode.mfDecelerate ),
225 mbAutoReverse( rNode.mbAutoReverse ),
226 maUserData( rNode.maUserData )
230 // --------------------------------------------------------------------
232 RandomAnimationNode::RandomAnimationNode( sal_Int16 nPresetClass )
234 init( nPresetClass );
237 RandomAnimationNode::RandomAnimationNode()
239 init( 1 );
242 void RandomAnimationNode::init( sal_Int16 nPresetClass )
244 mnPresetClass = nPresetClass;
245 mnFill = AnimationFill::DEFAULT;
246 mnFillDefault = AnimationFill::INHERIT;
247 mnRestart = AnimationRestart::DEFAULT;
248 mnRestartDefault = AnimationRestart::INHERIT;
249 mfAcceleration = 0.0;
250 mfDecelerate = 0.0;
251 mbAutoReverse = sal_False;
254 // --------------------------------------------------------------------
256 // XInitialization
257 void SAL_CALL RandomAnimationNode::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
259 if( aArguments.getLength() != 1 )
260 throw IllegalArgumentException();
262 if( aArguments[0].getValueType() == ::getCppuType((const sal_Int16*)0) )
264 aArguments[0] >>= mnPresetClass;
266 else if( aArguments[0].getValueType() != ::getCppuType((const ParagraphTarget*)0) )
268 Reference< XShape > xShape;
269 aArguments[0] >>= xShape;
270 if( !xShape.is() )
271 throw IllegalArgumentException();
273 maTarget = aArguments[0];
276 // --------------------------------------------------------------------
278 // XAnimationNode
279 sal_Int16 SAL_CALL RandomAnimationNode::getType() throw (RuntimeException)
281 Guard< Mutex > aGuard( maMutex );
282 return ::com::sun::star::animations::AnimationNodeType::PAR;
285 // --------------------------------------------------------------------
287 // XAnimationNode
288 Any SAL_CALL RandomAnimationNode::getBegin() throw (RuntimeException)
290 Guard< Mutex > aGuard( maMutex );
291 return maBegin;
294 // --------------------------------------------------------------------
296 // XAnimationNode
297 void SAL_CALL RandomAnimationNode::setBegin( const Any& _begin ) throw (RuntimeException)
299 Guard< Mutex > aGuard( maMutex );
300 maBegin = _begin;
303 // --------------------------------------------------------------------
305 // XAnimationNode
306 Any SAL_CALL RandomAnimationNode::getDuration() throw (RuntimeException)
308 Guard< Mutex > aGuard( maMutex );
309 return maDuration;
312 // --------------------------------------------------------------------
314 // XAnimationNode
315 void SAL_CALL RandomAnimationNode::setDuration( const Any& _duration ) throw (RuntimeException)
317 Guard< Mutex > aGuard( maMutex );
318 maDuration = _duration;
321 // --------------------------------------------------------------------
323 // XAnimationNode
324 Any SAL_CALL RandomAnimationNode::getEnd() throw (RuntimeException)
326 Guard< Mutex > aGuard( maMutex );
327 return maEnd;
330 // --------------------------------------------------------------------
332 // XAnimationNode
333 void SAL_CALL RandomAnimationNode::setEnd( const Any& _end ) throw (RuntimeException)
335 Guard< Mutex > aGuard( maMutex );
336 maEnd = _end;
339 // --------------------------------------------------------------------
341 // XAnimationNode
342 Any SAL_CALL RandomAnimationNode::getEndSync() throw (RuntimeException)
344 Guard< Mutex > aGuard( maMutex );
345 return maEndSync;
348 // --------------------------------------------------------------------
350 // XAnimationNode
351 void SAL_CALL RandomAnimationNode::setEndSync( const Any& _endsync ) throw (RuntimeException)
353 Guard< Mutex > aGuard( maMutex );
354 maEndSync = _endsync;
357 // --------------------------------------------------------------------
359 // XAnimationNode
360 Any SAL_CALL RandomAnimationNode::getRepeatCount() throw (RuntimeException)
362 Guard< Mutex > aGuard( maMutex );
363 return maRepeatCount;
366 // --------------------------------------------------------------------
368 // XAnimationNode
369 void SAL_CALL RandomAnimationNode::setRepeatCount( const Any& _repeatcount ) throw (RuntimeException)
371 Guard< Mutex > aGuard( maMutex );
372 maRepeatCount = _repeatcount;
375 // --------------------------------------------------------------------
377 // XAnimationNode
378 Any SAL_CALL RandomAnimationNode::getRepeatDuration() throw (RuntimeException)
380 Guard< Mutex > aGuard( maMutex );
381 return maRepeatDuration;
384 // --------------------------------------------------------------------
386 // XAnimationNode
387 void SAL_CALL RandomAnimationNode::setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException)
389 Guard< Mutex > aGuard( maMutex );
390 maRepeatDuration = _repeatduration;
393 // --------------------------------------------------------------------
395 // XAnimationNode
396 sal_Int16 SAL_CALL RandomAnimationNode::getFill() throw (RuntimeException)
398 Guard< Mutex > aGuard( maMutex );
399 return mnFill;
402 // --------------------------------------------------------------------
404 // XAnimationNode
405 void SAL_CALL RandomAnimationNode::setFill( sal_Int16 _fill ) throw (RuntimeException)
407 Guard< Mutex > aGuard( maMutex );
408 mnFill = _fill;
411 // --------------------------------------------------------------------
413 // XAnimationNode
414 sal_Int16 SAL_CALL RandomAnimationNode::getFillDefault() throw (RuntimeException)
416 Guard< Mutex > aGuard( maMutex );
417 return mnFillDefault;
420 // --------------------------------------------------------------------
422 // XAnimationNode
423 void SAL_CALL RandomAnimationNode::setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException)
425 Guard< Mutex > aGuard( maMutex );
426 mnFillDefault = _filldefault;
429 // --------------------------------------------------------------------
431 // XAnimationNode
432 sal_Int16 SAL_CALL RandomAnimationNode::getRestart() throw (RuntimeException)
434 Guard< Mutex > aGuard( maMutex );
435 return mnRestart;
438 // --------------------------------------------------------------------
440 // XAnimationNode
441 void SAL_CALL RandomAnimationNode::setRestart( sal_Int16 _restart ) throw (RuntimeException)
443 Guard< Mutex > aGuard( maMutex );
444 mnRestart = _restart;
447 // --------------------------------------------------------------------
449 // XAnimationNode
450 sal_Int16 SAL_CALL RandomAnimationNode::getRestartDefault() throw (RuntimeException)
452 Guard< Mutex > aGuard( maMutex );
453 return mnRestartDefault;
456 // --------------------------------------------------------------------
458 // XAnimationNode
459 void SAL_CALL RandomAnimationNode::setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException)
461 Guard< Mutex > aGuard( maMutex );
462 mnRestartDefault = _restartdefault;
465 // --------------------------------------------------------------------
467 // XAnimationNode
468 double SAL_CALL RandomAnimationNode::getAcceleration() throw (RuntimeException)
470 Guard< Mutex > aGuard( maMutex );
471 return mfAcceleration;
474 // --------------------------------------------------------------------
476 // XAnimationNode
477 void SAL_CALL RandomAnimationNode::setAcceleration( double _acceleration ) throw (RuntimeException)
479 Guard< Mutex > aGuard( maMutex );
480 mfAcceleration = _acceleration;
483 // --------------------------------------------------------------------
485 // XAnimationNode
486 double SAL_CALL RandomAnimationNode::getDecelerate() throw (RuntimeException)
488 Guard< Mutex > aGuard( maMutex );
489 return mfDecelerate;
492 // --------------------------------------------------------------------
494 // XAnimationNode
495 void SAL_CALL RandomAnimationNode::setDecelerate( double _decelerate ) throw (RuntimeException)
497 Guard< Mutex > aGuard( maMutex );
498 mfDecelerate = _decelerate;
501 // --------------------------------------------------------------------
503 // XAnimationNode
504 sal_Bool SAL_CALL RandomAnimationNode::getAutoReverse() throw (RuntimeException)
506 Guard< Mutex > aGuard( maMutex );
507 return mbAutoReverse;
510 // --------------------------------------------------------------------
512 // XAnimationNode
513 void SAL_CALL RandomAnimationNode::setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException)
515 Guard< Mutex > aGuard( maMutex );
516 mbAutoReverse = _autoreverse;
519 // --------------------------------------------------------------------
521 Sequence< NamedValue > SAL_CALL RandomAnimationNode::getUserData() throw (RuntimeException)
523 Guard< Mutex > aGuard( maMutex );
524 return maUserData;
527 // --------------------------------------------------------------------
529 void SAL_CALL RandomAnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException)
531 Guard< Mutex > aGuard( maMutex );
532 maUserData = _userdata;
535 // --------------------------------------------------------------------
537 // XChild
538 Reference< XInterface > SAL_CALL RandomAnimationNode::getParent() throw (RuntimeException)
540 Guard< Mutex > aGuard( maMutex );
541 return mxParent;
544 // --------------------------------------------------------------------
546 // XChild
547 void SAL_CALL RandomAnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException)
549 Guard< Mutex > aGuard( maMutex );
550 mxParent = Parent;
553 // --------------------------------------------------------------------
555 // XCloneable
556 Reference< XCloneable > SAL_CALL RandomAnimationNode::createClone() throw (RuntimeException)
558 Reference< XCloneable > xNewNode( new RandomAnimationNode( *this ) );
559 return xNewNode;
562 // --------------------------------------------------------------------
564 // XElementAccess
565 Type SAL_CALL RandomAnimationNode::getElementType() throw (RuntimeException)
567 return ::getCppuType((const Reference< XAnimationNode >*)0);
570 // --------------------------------------------------------------------
572 // XElementAccess
573 sal_Bool SAL_CALL RandomAnimationNode::hasElements() throw (RuntimeException)
575 return sal_True;
578 // --------------------------------------------------------------------
580 // XEnumerationAccess
581 Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration()
582 throw (RuntimeException)
584 Guard< Mutex > aGuard( maMutex );
586 if( !maTarget.hasValue() && mxFirstNode.is() )
588 Any aTarget( mxFirstNode->getTarget() );
589 if( aTarget.hasValue() )
591 maTarget = aTarget;
592 mxFirstNode.clear();
596 Reference< XEnumeration > xEnum;
598 Reference< XEnumerationAccess > aEnumAccess( CustomAnimationPresets::getCustomAnimationPresets().getRandomPreset( mnPresetClass ), UNO_QUERY );
600 if( aEnumAccess.is() )
602 Reference< XEnumeration > xEnumeration( aEnumAccess->createEnumeration(), UNO_QUERY );
603 if( xEnumeration.is() )
605 while( xEnumeration->hasMoreElements() )
607 Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
608 if( xAnimate.is() )
609 xAnimate->setTarget( maTarget );
612 xEnum = aEnumAccess->createEnumeration();
614 else
616 // no presets? give empty node!
617 Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
618 Reference< XEnumerationAccess > aEmptyEnumAccess(
619 xServiceFactory->createInstance(
620 OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.animations.ParallelTimeContainer" ))),
621 UNO_QUERY );
623 if( aEmptyEnumAccess.is() )
624 xEnum = aEmptyEnumAccess->createEnumeration();
627 return xEnum;
630 // --------------------------------------------------------------------
633 // XTimeContainer
634 Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
635 throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
637 return appendChild( newChild );
640 // --------------------------------------------------------------------
642 // XTimeContainer
643 Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
644 throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
646 return appendChild( newChild );
649 // --------------------------------------------------------------------
651 // XTimeContainer
652 Reference< XAnimationNode > SAL_CALL RandomAnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
653 throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
655 return appendChild( newChild );
658 // --------------------------------------------------------------------
660 // XTimeContainer
661 Reference< XAnimationNode > SAL_CALL RandomAnimationNode::removeChild( const Reference< XAnimationNode >& oldChild )
662 throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
664 return oldChild;
667 // --------------------------------------------------------------------
669 // XTimeContainer
670 Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
671 throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
673 Reference< XAnimate > xAnimate( newChild, UNO_QUERY );
674 if( xAnimate.is() )
676 Any aTarget( xAnimate->getTarget() );
677 if( aTarget.hasValue() )
678 maTarget = aTarget;
681 if( !maTarget.hasValue() && !mxFirstNode.is() )
682 mxFirstNode = xAnimate;
684 return newChild;
687 // XServiceInfo
688 OUString RandomAnimationNode::getImplementationName() throw()
690 return RandomNode__getImplementationName();
693 // XServiceInfo
694 sal_Bool RandomAnimationNode::supportsService(const OUString& ServiceName) throw()
696 return ServiceName.equalsAscii( pSN1 ) || ServiceName.equalsAscii( pSN2 );
699 // XServiceInfo
700 Sequence< OUString > RandomAnimationNode::getSupportedServiceNames(void) throw()
702 return RandomNode_getSupportedServiceNames();