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