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