Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/animations/XTimeContainer.hpp>
31 : : #include <com/sun/star/presentation/ParagraphTarget.hpp>
32 : : #include <com/sun/star/animations/AnimationFill.hpp>
33 : : #include <com/sun/star/animations/XAnimate.hpp>
34 : : #include <com/sun/star/animations/AnimationRestart.hpp>
35 : : #include <com/sun/star/lang/XServiceInfo.hpp>
36 : : #include <com/sun/star/lang/XInitialization.hpp>
37 : : #include <com/sun/star/container/XEnumerationAccess.hpp>
38 : : #include <com/sun/star/util/XCloneable.hpp>
39 : : #include <comphelper/processfactory.hxx>
40 : :
41 : : #include <cppuhelper/implbase5.hxx>
42 : : #include <osl/mutex.hxx>
43 : : #include "CustomAnimationPreset.hxx"
44 : :
45 : : using ::osl::Mutex;
46 : : using ::osl::Guard;
47 : : using ::rtl::OUString;
48 : :
49 : : using ::com::sun::star::uno::Reference;
50 : : using ::com::sun::star::uno::RuntimeException;
51 : : using ::com::sun::star::uno::Exception;
52 : : using ::com::sun::star::uno::Sequence;
53 : : using ::com::sun::star::uno::Any;
54 : : using ::com::sun::star::uno::UNO_QUERY;
55 : : using ::com::sun::star::uno::XInterface;
56 : : using ::com::sun::star::lang::NoSupportException;
57 : : using ::com::sun::star::beans::NamedValue;
58 : : using ::com::sun::star::lang::IllegalArgumentException;
59 : : using ::com::sun::star::container::NoSuchElementException;
60 : : using ::com::sun::star::container::ElementExistException;
61 : : using ::com::sun::star::lang::WrappedTargetException;
62 : : using ::com::sun::star::container::XEnumeration;
63 : : using ::com::sun::star::container::XEnumerationAccess;
64 : : using ::com::sun::star::util::XCloneable;
65 : : using ::com::sun::star::lang::XServiceInfo;
66 : : using ::com::sun::star::lang::XInitialization;
67 : : using ::com::sun::star::uno::Type;
68 : : using ::com::sun::star::uno::XWeak;
69 : : using ::com::sun::star::lang::XMultiServiceFactory;
70 : : using ::com::sun::star::presentation::ParagraphTarget;
71 : : using ::com::sun::star::drawing::XShape;
72 : :
73 : : using namespace ::com::sun::star::animations;
74 : : namespace sd
75 : : {
76 : :
77 : : typedef ::cppu::WeakImplHelper5< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization > RandomAnimationNodeBase;
78 [ # # ][ # # ]: 0 : class RandomAnimationNode : public RandomAnimationNodeBase
[ # # ]
79 : : {
80 : : public:
81 : : RandomAnimationNode( const RandomAnimationNode& rNode );
82 : : RandomAnimationNode( sal_Int16 nPresetClass );
83 : : RandomAnimationNode();
84 : :
85 : : void init( sal_Int16 nPresetClass );
86 : :
87 : : // XInitialization
88 : : void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
89 : :
90 : : // XChild
91 : : Reference< XInterface > SAL_CALL getParent( ) throw (RuntimeException);
92 : : void SAL_CALL setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException);
93 : :
94 : : // XCloneable
95 : : virtual Reference< XCloneable > SAL_CALL createClone() throw (RuntimeException);
96 : :
97 : : // XServiceInfo
98 : : OUString SAL_CALL getImplementationName() throw();
99 : : Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw();
100 : : sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw();
101 : :
102 : : // XAnimationNode
103 : : ::sal_Int16 SAL_CALL getType() throw (RuntimeException);
104 : : Any SAL_CALL getBegin() throw (RuntimeException);
105 : : void SAL_CALL setBegin( const Any& _begin ) throw (RuntimeException);
106 : : Any SAL_CALL getDuration() throw (RuntimeException);
107 : : void SAL_CALL setDuration( const Any& _duration ) throw (RuntimeException);
108 : : Any SAL_CALL getEnd() throw (RuntimeException);
109 : : void SAL_CALL setEnd( const Any& _end ) throw (RuntimeException);
110 : : Any SAL_CALL getEndSync() throw (RuntimeException);
111 : : void SAL_CALL setEndSync( const Any& _endsync ) throw (RuntimeException);
112 : : Any SAL_CALL getRepeatCount() throw (RuntimeException);
113 : : void SAL_CALL setRepeatCount( const Any& _repeatcount ) throw (RuntimeException);
114 : : Any SAL_CALL getRepeatDuration() throw (RuntimeException);
115 : : void SAL_CALL setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException);
116 : : ::sal_Int16 SAL_CALL getFill() throw (RuntimeException);
117 : : void SAL_CALL setFill( ::sal_Int16 _fill ) throw (RuntimeException);
118 : : ::sal_Int16 SAL_CALL getFillDefault() throw (RuntimeException);
119 : : void SAL_CALL setFillDefault( ::sal_Int16 _filldefault ) throw (RuntimeException);
120 : : ::sal_Int16 SAL_CALL getRestart() throw (RuntimeException);
121 : : void SAL_CALL setRestart( ::sal_Int16 _restart ) throw (RuntimeException);
122 : : ::sal_Int16 SAL_CALL getRestartDefault() throw (RuntimeException);
123 : : void SAL_CALL setRestartDefault( ::sal_Int16 _restartdefault ) throw (RuntimeException);
124 : : double SAL_CALL getAcceleration() throw (RuntimeException);
125 : : void SAL_CALL setAcceleration( double _acceleration ) throw (RuntimeException);
126 : : double SAL_CALL getDecelerate() throw (RuntimeException);
127 : : void SAL_CALL setDecelerate( double _decelerate ) throw (RuntimeException);
128 : : ::sal_Bool SAL_CALL getAutoReverse() throw (RuntimeException);
129 : : void SAL_CALL setAutoReverse( ::sal_Bool _autoreverse ) throw (RuntimeException);
130 : : Sequence< NamedValue > SAL_CALL getUserData() throw (RuntimeException);
131 : : void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException);
132 : :
133 : : // XElementAccess
134 : : virtual Type SAL_CALL getElementType() throw (RuntimeException);
135 : : virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException);
136 : :
137 : : // XEnumerationAccess
138 : : virtual Reference< XEnumeration > SAL_CALL createEnumeration() throw (RuntimeException);
139 : :
140 : : // XTimeContainer
141 : : Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
142 : : Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
143 : : Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException);
144 : : Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException);
145 : : Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException);
146 : :
147 : : private:
148 : : // our first, last and only protection from mutli-threads!
149 : : Mutex maMutex;
150 : :
151 : : sal_Int16 mnPresetClass;
152 : : Reference< XInterface > mxParent;
153 : :
154 : : Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration, maTarget;
155 : : sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
156 : : double mfAcceleration, mfDecelerate;
157 : : sal_Bool mbAutoReverse;
158 : : Sequence< NamedValue > maUserData;
159 : :
160 : : Reference< XAnimate > mxFirstNode;
161 : : };
162 : :
163 : : // --------------------------------------------------------------------
164 : :
165 : : static const sal_Char* pSN1 = "com.sun.star.animations.ParallelTimeContainer";
166 : : static const sal_Char* pSN2 = "com.sun.star.comp.sd.RandomAnimationNode";
167 : :
168 : : // --------------------------------------------------------------------
169 : :
170 : 0 : SD_DLLPUBLIC Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass )
171 : : {
172 [ # # ][ # # ]: 0 : Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode( nPresetClass ) ) );
173 : 0 : return xInt;
174 : : }
175 : :
176 : : // --------------------------------------------------------------------
177 : :
178 : 0 : Reference< XInterface > SAL_CALL RandomNode_createInstance( const Reference< XMultiServiceFactory > & )
179 : : {
180 [ # # ][ # # ]: 0 : Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode() ) );
181 : 0 : return xInt;
182 : : }
183 : :
184 : : // --------------------------------------------------------------------
185 : :
186 : 22 : OUString RandomNode__getImplementationName() throw( RuntimeException )
187 : : {
188 : 22 : return OUString( "sd::RandomAnimationNode" ) ;
189 : : }
190 : :
191 : : // --------------------------------------------------------------------
192 : :
193 : 0 : Sequence< OUString > SAL_CALL RandomNode_getSupportedServiceNames() throw( RuntimeException )
194 : : {
195 [ # # ][ # # ]: 0 : static const OUString aSN2( OUString::createFromAscii( pSN2 ) );
196 : 0 : Sequence< OUString > aSeq( &aSN2, 1 );
197 : 0 : return aSeq;
198 : : }
199 : :
200 : : // --------------------------------------------------------------------
201 : :
202 : 0 : RandomAnimationNode::RandomAnimationNode( const RandomAnimationNode& rNode )
203 : : : RandomAnimationNodeBase(),
204 : : mnPresetClass( rNode.mnPresetClass ),
205 : : maBegin( rNode.maBegin ),
206 : : maDuration( rNode.maDuration ),
207 : : maEnd( rNode.maEnd ),
208 : : maEndSync( rNode.maEndSync ),
209 : : maRepeatCount( rNode.maRepeatCount ),
210 : : maRepeatDuration( rNode.maRepeatDuration ),
211 : : maTarget( rNode.maTarget ),
212 : : mnFill( rNode.mnFill ),
213 : : mnFillDefault( rNode.mnFillDefault ),
214 : : mnRestart( rNode.mnRestart ),
215 : : mnRestartDefault( rNode.mnRestartDefault ),
216 : : mfAcceleration( rNode.mfAcceleration ),
217 : : mfDecelerate( rNode.mfDecelerate ),
218 : : mbAutoReverse( rNode.mbAutoReverse ),
219 [ # # ][ # # ]: 0 : maUserData( rNode.maUserData )
220 : : {
221 : 0 : }
222 : :
223 : : // --------------------------------------------------------------------
224 : :
225 [ # # ][ # # ]: 0 : RandomAnimationNode::RandomAnimationNode( sal_Int16 nPresetClass )
226 : : {
227 : 0 : init( nPresetClass );
228 : 0 : }
229 : :
230 [ # # ][ # # ]: 0 : RandomAnimationNode::RandomAnimationNode()
231 : : {
232 : 0 : init( 1 );
233 : 0 : }
234 : :
235 : 0 : void RandomAnimationNode::init( sal_Int16 nPresetClass )
236 : : {
237 : 0 : mnPresetClass = nPresetClass;
238 : 0 : mnFill = AnimationFill::DEFAULT;
239 : 0 : mnFillDefault = AnimationFill::INHERIT;
240 : 0 : mnRestart = AnimationRestart::DEFAULT;
241 : 0 : mnRestartDefault = AnimationRestart::INHERIT;
242 : 0 : mfAcceleration = 0.0;
243 : 0 : mfDecelerate = 0.0;
244 : 0 : mbAutoReverse = sal_False;
245 : 0 : }
246 : :
247 : : // --------------------------------------------------------------------
248 : :
249 : : // XInitialization
250 : 0 : void SAL_CALL RandomAnimationNode::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
251 : : {
252 [ # # ]: 0 : if( aArguments.getLength() != 1 )
253 [ # # ]: 0 : throw IllegalArgumentException();
254 : :
255 [ # # ]: 0 : if( aArguments[0].getValueType() == ::getCppuType((const sal_Int16*)0) )
256 : : {
257 : 0 : aArguments[0] >>= mnPresetClass;
258 : : }
259 [ # # ]: 0 : else if( aArguments[0].getValueType() != ::getCppuType((const ParagraphTarget*)0) )
260 : : {
261 : 0 : Reference< XShape > xShape;
262 [ # # ]: 0 : aArguments[0] >>= xShape;
263 [ # # ]: 0 : if( !xShape.is() )
264 [ # # ]: 0 : throw IllegalArgumentException();
265 : : }
266 : 0 : maTarget = aArguments[0];
267 : 0 : }
268 : :
269 : : // --------------------------------------------------------------------
270 : :
271 : : // XAnimationNode
272 : 0 : sal_Int16 SAL_CALL RandomAnimationNode::getType() throw (RuntimeException)
273 : : {
274 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
275 [ # # ]: 0 : return ::com::sun::star::animations::AnimationNodeType::PAR;
276 : : }
277 : :
278 : : // --------------------------------------------------------------------
279 : :
280 : : // XAnimationNode
281 : 0 : Any SAL_CALL RandomAnimationNode::getBegin() throw (RuntimeException)
282 : : {
283 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
284 [ # # ]: 0 : return maBegin;
285 : : }
286 : :
287 : : // --------------------------------------------------------------------
288 : :
289 : : // XAnimationNode
290 : 0 : void SAL_CALL RandomAnimationNode::setBegin( const Any& _begin ) throw (RuntimeException)
291 : : {
292 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
293 [ # # ]: 0 : maBegin = _begin;
294 : 0 : }
295 : :
296 : : // --------------------------------------------------------------------
297 : :
298 : : // XAnimationNode
299 : 0 : Any SAL_CALL RandomAnimationNode::getDuration() throw (RuntimeException)
300 : : {
301 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
302 [ # # ]: 0 : return maDuration;
303 : : }
304 : :
305 : : // --------------------------------------------------------------------
306 : :
307 : : // XAnimationNode
308 : 0 : void SAL_CALL RandomAnimationNode::setDuration( const Any& _duration ) throw (RuntimeException)
309 : : {
310 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
311 [ # # ]: 0 : maDuration = _duration;
312 : 0 : }
313 : :
314 : : // --------------------------------------------------------------------
315 : :
316 : : // XAnimationNode
317 : 0 : Any SAL_CALL RandomAnimationNode::getEnd() throw (RuntimeException)
318 : : {
319 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
320 [ # # ]: 0 : return maEnd;
321 : : }
322 : :
323 : : // --------------------------------------------------------------------
324 : :
325 : : // XAnimationNode
326 : 0 : void SAL_CALL RandomAnimationNode::setEnd( const Any& _end ) throw (RuntimeException)
327 : : {
328 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
329 [ # # ]: 0 : maEnd = _end;
330 : 0 : }
331 : :
332 : : // --------------------------------------------------------------------
333 : :
334 : : // XAnimationNode
335 : 0 : Any SAL_CALL RandomAnimationNode::getEndSync() throw (RuntimeException)
336 : : {
337 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
338 [ # # ]: 0 : return maEndSync;
339 : : }
340 : :
341 : : // --------------------------------------------------------------------
342 : :
343 : : // XAnimationNode
344 : 0 : void SAL_CALL RandomAnimationNode::setEndSync( const Any& _endsync ) throw (RuntimeException)
345 : : {
346 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
347 [ # # ]: 0 : maEndSync = _endsync;
348 : 0 : }
349 : :
350 : : // --------------------------------------------------------------------
351 : :
352 : : // XAnimationNode
353 : 0 : Any SAL_CALL RandomAnimationNode::getRepeatCount() throw (RuntimeException)
354 : : {
355 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
356 [ # # ]: 0 : return maRepeatCount;
357 : : }
358 : :
359 : : // --------------------------------------------------------------------
360 : :
361 : : // XAnimationNode
362 : 0 : void SAL_CALL RandomAnimationNode::setRepeatCount( const Any& _repeatcount ) throw (RuntimeException)
363 : : {
364 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
365 [ # # ]: 0 : maRepeatCount = _repeatcount;
366 : 0 : }
367 : :
368 : : // --------------------------------------------------------------------
369 : :
370 : : // XAnimationNode
371 : 0 : Any SAL_CALL RandomAnimationNode::getRepeatDuration() throw (RuntimeException)
372 : : {
373 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
374 [ # # ]: 0 : return maRepeatDuration;
375 : : }
376 : :
377 : : // --------------------------------------------------------------------
378 : :
379 : : // XAnimationNode
380 : 0 : void SAL_CALL RandomAnimationNode::setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException)
381 : : {
382 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
383 [ # # ]: 0 : maRepeatDuration = _repeatduration;
384 : 0 : }
385 : :
386 : : // --------------------------------------------------------------------
387 : :
388 : : // XAnimationNode
389 : 0 : sal_Int16 SAL_CALL RandomAnimationNode::getFill() throw (RuntimeException)
390 : : {
391 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
392 [ # # ]: 0 : return mnFill;
393 : : }
394 : :
395 : : // --------------------------------------------------------------------
396 : :
397 : : // XAnimationNode
398 : 0 : void SAL_CALL RandomAnimationNode::setFill( sal_Int16 _fill ) throw (RuntimeException)
399 : : {
400 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
401 [ # # ]: 0 : mnFill = _fill;
402 : 0 : }
403 : :
404 : : // --------------------------------------------------------------------
405 : :
406 : : // XAnimationNode
407 : 0 : sal_Int16 SAL_CALL RandomAnimationNode::getFillDefault() throw (RuntimeException)
408 : : {
409 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
410 [ # # ]: 0 : return mnFillDefault;
411 : : }
412 : :
413 : : // --------------------------------------------------------------------
414 : :
415 : : // XAnimationNode
416 : 0 : void SAL_CALL RandomAnimationNode::setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException)
417 : : {
418 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
419 [ # # ]: 0 : mnFillDefault = _filldefault;
420 : 0 : }
421 : :
422 : : // --------------------------------------------------------------------
423 : :
424 : : // XAnimationNode
425 : 0 : sal_Int16 SAL_CALL RandomAnimationNode::getRestart() throw (RuntimeException)
426 : : {
427 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
428 [ # # ]: 0 : return mnRestart;
429 : : }
430 : :
431 : : // --------------------------------------------------------------------
432 : :
433 : : // XAnimationNode
434 : 0 : void SAL_CALL RandomAnimationNode::setRestart( sal_Int16 _restart ) throw (RuntimeException)
435 : : {
436 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
437 [ # # ]: 0 : mnRestart = _restart;
438 : 0 : }
439 : :
440 : : // --------------------------------------------------------------------
441 : :
442 : : // XAnimationNode
443 : 0 : sal_Int16 SAL_CALL RandomAnimationNode::getRestartDefault() throw (RuntimeException)
444 : : {
445 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
446 [ # # ]: 0 : return mnRestartDefault;
447 : : }
448 : :
449 : : // --------------------------------------------------------------------
450 : :
451 : : // XAnimationNode
452 : 0 : void SAL_CALL RandomAnimationNode::setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException)
453 : : {
454 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
455 [ # # ]: 0 : mnRestartDefault = _restartdefault;
456 : 0 : }
457 : :
458 : : // --------------------------------------------------------------------
459 : :
460 : : // XAnimationNode
461 : 0 : double SAL_CALL RandomAnimationNode::getAcceleration() throw (RuntimeException)
462 : : {
463 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
464 [ # # ]: 0 : return mfAcceleration;
465 : : }
466 : :
467 : : // --------------------------------------------------------------------
468 : :
469 : : // XAnimationNode
470 : 0 : void SAL_CALL RandomAnimationNode::setAcceleration( double _acceleration ) throw (RuntimeException)
471 : : {
472 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
473 [ # # ]: 0 : mfAcceleration = _acceleration;
474 : 0 : }
475 : :
476 : : // --------------------------------------------------------------------
477 : :
478 : : // XAnimationNode
479 : 0 : double SAL_CALL RandomAnimationNode::getDecelerate() throw (RuntimeException)
480 : : {
481 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
482 [ # # ]: 0 : return mfDecelerate;
483 : : }
484 : :
485 : : // --------------------------------------------------------------------
486 : :
487 : : // XAnimationNode
488 : 0 : void SAL_CALL RandomAnimationNode::setDecelerate( double _decelerate ) throw (RuntimeException)
489 : : {
490 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
491 [ # # ]: 0 : mfDecelerate = _decelerate;
492 : 0 : }
493 : :
494 : : // --------------------------------------------------------------------
495 : :
496 : : // XAnimationNode
497 : 0 : sal_Bool SAL_CALL RandomAnimationNode::getAutoReverse() throw (RuntimeException)
498 : : {
499 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
500 [ # # ]: 0 : return mbAutoReverse;
501 : : }
502 : :
503 : : // --------------------------------------------------------------------
504 : :
505 : : // XAnimationNode
506 : 0 : void SAL_CALL RandomAnimationNode::setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException)
507 : : {
508 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
509 [ # # ]: 0 : mbAutoReverse = _autoreverse;
510 : 0 : }
511 : :
512 : : // --------------------------------------------------------------------
513 : :
514 : 0 : Sequence< NamedValue > SAL_CALL RandomAnimationNode::getUserData() throw (RuntimeException)
515 : : {
516 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
517 [ # # ][ # # ]: 0 : return maUserData;
518 : : }
519 : :
520 : : // --------------------------------------------------------------------
521 : :
522 : 0 : void SAL_CALL RandomAnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException)
523 : : {
524 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
525 [ # # ][ # # ]: 0 : maUserData = _userdata;
526 : 0 : }
527 : :
528 : : // --------------------------------------------------------------------
529 : :
530 : : // XChild
531 : 0 : Reference< XInterface > SAL_CALL RandomAnimationNode::getParent() throw (RuntimeException)
532 : : {
533 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
534 [ # # ]: 0 : return mxParent;
535 : : }
536 : :
537 : : // --------------------------------------------------------------------
538 : :
539 : : // XChild
540 : 0 : void SAL_CALL RandomAnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException)
541 : : {
542 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
543 [ # # ][ # # ]: 0 : mxParent = Parent;
544 : 0 : }
545 : :
546 : : // --------------------------------------------------------------------
547 : :
548 : : // XCloneable
549 : 0 : Reference< XCloneable > SAL_CALL RandomAnimationNode::createClone() throw (RuntimeException)
550 : : {
551 [ # # ][ # # ]: 0 : Reference< XCloneable > xNewNode( new RandomAnimationNode( *this ) );
[ # # ]
552 : 0 : return xNewNode;
553 : : }
554 : :
555 : : // --------------------------------------------------------------------
556 : :
557 : : // XElementAccess
558 : 0 : Type SAL_CALL RandomAnimationNode::getElementType() throw (RuntimeException)
559 : : {
560 : 0 : return ::getCppuType((const Reference< XAnimationNode >*)0);
561 : : }
562 : :
563 : : // --------------------------------------------------------------------
564 : :
565 : : // XElementAccess
566 : 0 : sal_Bool SAL_CALL RandomAnimationNode::hasElements() throw (RuntimeException)
567 : : {
568 : 0 : return sal_True;
569 : : }
570 : :
571 : : // --------------------------------------------------------------------
572 : :
573 : : // XEnumerationAccess
574 : 0 : Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration()
575 : : throw (RuntimeException)
576 : : {
577 [ # # ]: 0 : Guard< Mutex > aGuard( maMutex );
578 : :
579 [ # # ][ # # ]: 0 : if( !maTarget.hasValue() && mxFirstNode.is() )
[ # # ]
580 : : {
581 [ # # ][ # # ]: 0 : Any aTarget( mxFirstNode->getTarget() );
582 [ # # ]: 0 : if( aTarget.hasValue() )
583 : : {
584 : 0 : maTarget = aTarget;
585 : 0 : mxFirstNode.clear();
586 : 0 : }
587 : : }
588 : :
589 : 0 : Reference< XEnumeration > xEnum;
590 : :
591 [ # # ][ # # ]: 0 : Reference< XEnumerationAccess > aEnumAccess( CustomAnimationPresets::getCustomAnimationPresets().getRandomPreset( mnPresetClass ), UNO_QUERY );
[ # # ]
592 : :
593 [ # # ]: 0 : if( aEnumAccess.is() )
594 : : {
595 [ # # ][ # # ]: 0 : Reference< XEnumeration > xEnumeration( aEnumAccess->createEnumeration(), UNO_QUERY );
[ # # ]
596 [ # # ]: 0 : if( xEnumeration.is() )
597 : : {
598 [ # # ][ # # ]: 0 : while( xEnumeration->hasMoreElements() )
[ # # ]
599 : : {
600 [ # # ][ # # ]: 0 : Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
[ # # ]
601 [ # # ]: 0 : if( xAnimate.is() )
602 [ # # ][ # # ]: 0 : xAnimate->setTarget( maTarget );
603 : 0 : }
604 : : }
605 [ # # ][ # # ]: 0 : xEnum = aEnumAccess->createEnumeration();
[ # # ]
606 : : }
607 : : else
608 : : {
609 : : // no presets? give empty node!
610 [ # # ]: 0 : Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
611 : : Reference< XEnumerationAccess > aEmptyEnumAccess(
612 [ # # ]: 0 : xServiceFactory->createInstance( "com.sun.star.animations.ParallelTimeContainer" ),
613 [ # # ][ # # ]: 0 : UNO_QUERY );
614 : :
615 [ # # ]: 0 : if( aEmptyEnumAccess.is() )
616 [ # # ][ # # ]: 0 : xEnum = aEmptyEnumAccess->createEnumeration();
[ # # ]
617 : : }
618 : :
619 [ # # ]: 0 : return xEnum;
620 : : }
621 : :
622 : : // --------------------------------------------------------------------
623 : :
624 : :
625 : : // XTimeContainer
626 : 0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
627 : : throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
628 : : {
629 : 0 : return appendChild( newChild );
630 : : }
631 : :
632 : : // --------------------------------------------------------------------
633 : :
634 : : // XTimeContainer
635 : 0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
636 : : throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
637 : : {
638 : 0 : return appendChild( newChild );
639 : : }
640 : :
641 : : // --------------------------------------------------------------------
642 : :
643 : : // XTimeContainer
644 : 0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& )
645 : : throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException)
646 : : {
647 : 0 : return appendChild( newChild );
648 : : }
649 : :
650 : : // --------------------------------------------------------------------
651 : :
652 : : // XTimeContainer
653 : 0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::removeChild( const Reference< XAnimationNode >& oldChild )
654 : : throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException)
655 : : {
656 : 0 : return oldChild;
657 : : }
658 : :
659 : : // --------------------------------------------------------------------
660 : :
661 : : // XTimeContainer
662 : 0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
663 : : throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException)
664 : : {
665 [ # # ]: 0 : Reference< XAnimate > xAnimate( newChild, UNO_QUERY );
666 [ # # ]: 0 : if( xAnimate.is() )
667 : : {
668 [ # # ][ # # ]: 0 : Any aTarget( xAnimate->getTarget() );
669 [ # # ]: 0 : if( aTarget.hasValue() )
670 : 0 : maTarget = aTarget;
671 : : }
672 : :
673 [ # # ][ # # ]: 0 : if( !maTarget.hasValue() && !mxFirstNode.is() )
[ # # ]
674 [ # # ]: 0 : mxFirstNode = xAnimate;
675 : :
676 : 0 : return newChild;
677 : : }
678 : :
679 : : // XServiceInfo
680 : 0 : OUString RandomAnimationNode::getImplementationName() throw()
681 : : {
682 : 0 : return RandomNode__getImplementationName();
683 : : }
684 : :
685 : : // XServiceInfo
686 : 0 : sal_Bool RandomAnimationNode::supportsService(const OUString& ServiceName) throw()
687 : : {
688 [ # # ][ # # ]: 0 : return ServiceName.equalsAscii( pSN1 ) || ServiceName.equalsAscii( pSN2 );
689 : : }
690 : :
691 : : // XServiceInfo
692 : 0 : Sequence< OUString > RandomAnimationNode::getSupportedServiceNames(void) throw()
693 : : {
694 : 0 : return RandomNode_getSupportedServiceNames();
695 : : }
696 : :
697 : : }
698 : :
699 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|