LCOV - code coverage report
Current view: top level - sd/source/ui/unoidl - randomnode.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 200 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 52 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <com/sun/star/animations/XTimeContainer.hpp>
      21             : #include <com/sun/star/presentation/ParagraphTarget.hpp>
      22             : #include <com/sun/star/animations/AnimationFill.hpp>
      23             : #include <com/sun/star/animations/XAnimate.hpp>
      24             : #include <com/sun/star/animations/AnimationRestart.hpp>
      25             : #include <com/sun/star/animations/ParallelTimeContainer.hpp>
      26             : #include <com/sun/star/lang/XServiceInfo.hpp>
      27             : #include <com/sun/star/lang/XInitialization.hpp>
      28             : #include <com/sun/star/container/XEnumerationAccess.hpp>
      29             : #include <com/sun/star/util/XCloneable.hpp>
      30             : #include <comphelper/processfactory.hxx>
      31             : 
      32             : #include <cppuhelper/implbase5.hxx>
      33             : #include <cppuhelper/supportsservice.hxx>
      34             : #include <osl/mutex.hxx>
      35             : #include "CustomAnimationPreset.hxx"
      36             : #include "facreg.hxx"
      37             : #include "randomnode.hxx"
      38             : 
      39             : using ::osl::Mutex;
      40             : using ::osl::Guard;
      41             : 
      42             : using ::com::sun::star::uno::Reference;
      43             : using ::com::sun::star::uno::RuntimeException;
      44             : using ::com::sun::star::uno::Exception;
      45             : using ::com::sun::star::uno::Sequence;
      46             : using ::com::sun::star::uno::Any;
      47             : using ::com::sun::star::uno::UNO_QUERY;
      48             : using ::com::sun::star::uno::XInterface;
      49             : using ::com::sun::star::lang::NoSupportException;
      50             : using ::com::sun::star::beans::NamedValue;
      51             : using ::com::sun::star::lang::IllegalArgumentException;
      52             : using ::com::sun::star::container::NoSuchElementException;
      53             : using ::com::sun::star::container::ElementExistException;
      54             : using ::com::sun::star::lang::WrappedTargetException;
      55             : using ::com::sun::star::container::XEnumeration;
      56             : using ::com::sun::star::container::XEnumerationAccess;
      57             : using ::com::sun::star::util::XCloneable;
      58             : using ::com::sun::star::lang::XServiceInfo;
      59             : using ::com::sun::star::lang::XInitialization;
      60             : using ::com::sun::star::uno::Type;
      61             : using ::com::sun::star::uno::XWeak;
      62             : using ::com::sun::star::lang::XMultiServiceFactory;
      63             : using ::com::sun::star::presentation::ParagraphTarget;
      64             : using ::com::sun::star::drawing::XShape;
      65             : 
      66             : using namespace ::com::sun::star::animations;
      67             : namespace sd
      68             : {
      69             : 
      70             : typedef ::cppu::WeakImplHelper5< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization > RandomAnimationNodeBase;
      71           0 : class RandomAnimationNode : public RandomAnimationNodeBase
      72             : {
      73             : public:
      74             :     RandomAnimationNode( const RandomAnimationNode& rNode );
      75             :     RandomAnimationNode( sal_Int16 nPresetClass );
      76             :     RandomAnimationNode();
      77             : 
      78             :     void init( sal_Int16 nPresetClass );
      79             : 
      80             :     // XInitialization
      81             :     void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException, std::exception) SAL_OVERRIDE;
      82             : 
      83             :     // XChild
      84             :     Reference< XInterface > SAL_CALL getParent(  ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
      85             :     void SAL_CALL setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException, std::exception) SAL_OVERRIDE;
      86             : 
      87             :     // XCloneable
      88             :     virtual Reference< XCloneable > SAL_CALL createClone() throw (RuntimeException, std::exception) SAL_OVERRIDE;
      89             : 
      90             :     // XServiceInfo
      91             :     OUString SAL_CALL getImplementationName() throw(std::exception) SAL_OVERRIDE;
      92             :     Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(std::exception) SAL_OVERRIDE;
      93             :     sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(std::exception) SAL_OVERRIDE;
      94             : 
      95             :     // XAnimationNode
      96             :     ::sal_Int16 SAL_CALL getType() throw (RuntimeException, std::exception) SAL_OVERRIDE;
      97             :     Any SAL_CALL getBegin() throw (RuntimeException, std::exception) SAL_OVERRIDE;
      98             :     void SAL_CALL setBegin( const Any& _begin ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
      99             :     Any SAL_CALL getDuration() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     100             :     void SAL_CALL setDuration( const Any& _duration ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     101             :     Any SAL_CALL getEnd() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     102             :     void SAL_CALL setEnd( const Any& _end ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     103             :     Any SAL_CALL getEndSync() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     104             :     void SAL_CALL setEndSync( const Any& _endsync ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     105             :     Any SAL_CALL getRepeatCount() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     106             :     void SAL_CALL setRepeatCount( const Any& _repeatcount ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     107             :     Any SAL_CALL getRepeatDuration() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     108             :     void SAL_CALL setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     109             :     ::sal_Int16 SAL_CALL getFill() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     110             :     void SAL_CALL setFill( ::sal_Int16 _fill ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     111             :     ::sal_Int16 SAL_CALL getFillDefault() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     112             :     void SAL_CALL setFillDefault( ::sal_Int16 _filldefault ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     113             :     ::sal_Int16 SAL_CALL getRestart() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     114             :     void SAL_CALL setRestart( ::sal_Int16 _restart ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     115             :     ::sal_Int16 SAL_CALL getRestartDefault() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     116             :     void SAL_CALL setRestartDefault( ::sal_Int16 _restartdefault ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     117             :     double SAL_CALL getAcceleration() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     118             :     void SAL_CALL setAcceleration( double _acceleration ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     119             :     double SAL_CALL getDecelerate() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     120             :     void SAL_CALL setDecelerate( double _decelerate ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     121             :     sal_Bool SAL_CALL getAutoReverse() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     122             :     void SAL_CALL setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     123             :     Sequence< NamedValue > SAL_CALL getUserData() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     124             :     void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException, std::exception) SAL_OVERRIDE;
     125             : 
     126             :     // XElementAccess
     127             :     virtual Type SAL_CALL getElementType() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     128             :     virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     129             : 
     130             :     // XEnumerationAccess
     131             :     virtual Reference< XEnumeration > SAL_CALL createEnumeration() throw (RuntimeException, std::exception) SAL_OVERRIDE;
     132             : 
     133             :     // XTimeContainer
     134             :     Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     135             :     Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     136             :     Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     137             :     Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) throw (IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     138             :     Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) throw (IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception) SAL_OVERRIDE;
     139             : 
     140             : private:
     141             :     // our first, last and only protection from mutli-threads!
     142             :     Mutex maMutex;
     143             : 
     144             :     sal_Int16 mnPresetClass;
     145             :     Reference< XInterface > mxParent;
     146             : 
     147             :     Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration, maTarget;
     148             :     sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault;
     149             :     double mfAcceleration, mfDecelerate;
     150             :     bool mbAutoReverse;
     151             :     Sequence< NamedValue > maUserData;
     152             : 
     153             :     Reference< XAnimate > mxFirstNode;
     154             : };
     155             : 
     156           0 : Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass )
     157             : {
     158           0 :     Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode( nPresetClass ) ) );
     159           0 :     return xInt;
     160             : }
     161             : 
     162           0 : RandomAnimationNode::RandomAnimationNode( const RandomAnimationNode& rNode )
     163             : :   RandomAnimationNodeBase(),
     164             :     mnPresetClass( rNode.mnPresetClass ),
     165             :     maBegin( rNode.maBegin ),
     166             :     maDuration( rNode.maDuration ),
     167             :     maEnd( rNode.maEnd ),
     168             :     maEndSync( rNode.maEndSync ),
     169             :     maRepeatCount( rNode.maRepeatCount ),
     170             :     maRepeatDuration( rNode.maRepeatDuration ),
     171             :     maTarget( rNode.maTarget ),
     172             :     mnFill( rNode.mnFill ),
     173             :     mnFillDefault( rNode.mnFillDefault ),
     174             :     mnRestart( rNode.mnRestart ),
     175             :     mnRestartDefault( rNode.mnRestartDefault ),
     176             :     mfAcceleration( rNode.mfAcceleration ),
     177             :     mfDecelerate( rNode.mfDecelerate ),
     178             :     mbAutoReverse( rNode.mbAutoReverse ),
     179           0 :     maUserData( rNode.maUserData )
     180             : {
     181           0 : }
     182             : 
     183           0 : RandomAnimationNode::RandomAnimationNode( sal_Int16 nPresetClass )
     184             : {
     185           0 :     init( nPresetClass );
     186           0 : }
     187             : 
     188           0 : RandomAnimationNode::RandomAnimationNode()
     189             : {
     190           0 :     init( 1 );
     191           0 : }
     192             : 
     193           0 : void RandomAnimationNode::init( sal_Int16 nPresetClass )
     194             : {
     195           0 :     mnPresetClass = nPresetClass;
     196           0 :     mnFill = AnimationFill::DEFAULT;
     197           0 :     mnFillDefault = AnimationFill::INHERIT;
     198           0 :     mnRestart = AnimationRestart::DEFAULT;
     199           0 :     mnRestartDefault = AnimationRestart::INHERIT;
     200           0 :     mfAcceleration = 0.0;
     201           0 :     mfDecelerate = 0.0;
     202           0 :     mbAutoReverse = false;
     203           0 : }
     204             : 
     205             : // XInitialization
     206           0 : void SAL_CALL RandomAnimationNode::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException, std::exception)
     207             : {
     208           0 :     if( aArguments.getLength() != 1 )
     209           0 :         throw IllegalArgumentException();
     210             : 
     211           0 :     if( aArguments[0].getValueType() == ::cppu::UnoType<sal_Int16>::get() )
     212             :     {
     213           0 :         aArguments[0] >>= mnPresetClass;
     214             :     }
     215           0 :     else if( aArguments[0].getValueType() != ::cppu::UnoType<ParagraphTarget>::get() )
     216             :     {
     217           0 :         Reference< XShape > xShape;
     218           0 :         aArguments[0] >>= xShape;
     219           0 :         if( !xShape.is() )
     220           0 :             throw IllegalArgumentException();
     221             :     }
     222           0 :     maTarget = aArguments[0];
     223           0 : }
     224             : 
     225             : // XAnimationNode
     226           0 : sal_Int16 SAL_CALL RandomAnimationNode::getType() throw (RuntimeException, std::exception)
     227             : {
     228           0 :     Guard< Mutex > aGuard( maMutex );
     229           0 :     return ::com::sun::star::animations::AnimationNodeType::PAR;
     230             : }
     231             : 
     232             : // XAnimationNode
     233           0 : Any SAL_CALL RandomAnimationNode::getBegin() throw (RuntimeException, std::exception)
     234             : {
     235           0 :     Guard< Mutex > aGuard( maMutex );
     236           0 :     return maBegin;
     237             : }
     238             : 
     239             : // XAnimationNode
     240           0 : void SAL_CALL RandomAnimationNode::setBegin( const Any& _begin ) throw (RuntimeException, std::exception)
     241             : {
     242           0 :     Guard< Mutex > aGuard( maMutex );
     243           0 :     maBegin = _begin;
     244           0 : }
     245             : 
     246             : // XAnimationNode
     247           0 : Any SAL_CALL RandomAnimationNode::getDuration() throw (RuntimeException, std::exception)
     248             : {
     249           0 :     Guard< Mutex > aGuard( maMutex );
     250           0 :     return maDuration;
     251             : }
     252             : 
     253             : // XAnimationNode
     254           0 : void SAL_CALL RandomAnimationNode::setDuration( const Any& _duration ) throw (RuntimeException, std::exception)
     255             : {
     256           0 :     Guard< Mutex > aGuard( maMutex );
     257           0 :     maDuration = _duration;
     258           0 : }
     259             : 
     260             : // XAnimationNode
     261           0 : Any SAL_CALL RandomAnimationNode::getEnd() throw (RuntimeException, std::exception)
     262             : {
     263           0 :     Guard< Mutex > aGuard( maMutex );
     264           0 :     return maEnd;
     265             : }
     266             : 
     267             : // XAnimationNode
     268           0 : void SAL_CALL RandomAnimationNode::setEnd( const Any& _end ) throw (RuntimeException, std::exception)
     269             : {
     270           0 :     Guard< Mutex > aGuard( maMutex );
     271           0 :     maEnd = _end;
     272           0 : }
     273             : 
     274             : // XAnimationNode
     275           0 : Any SAL_CALL RandomAnimationNode::getEndSync() throw (RuntimeException, std::exception)
     276             : {
     277           0 :     Guard< Mutex > aGuard( maMutex );
     278           0 :     return maEndSync;
     279             : }
     280             : 
     281             : // XAnimationNode
     282           0 : void SAL_CALL RandomAnimationNode::setEndSync( const Any& _endsync ) throw (RuntimeException, std::exception)
     283             : {
     284           0 :     Guard< Mutex > aGuard( maMutex );
     285           0 :     maEndSync = _endsync;
     286           0 : }
     287             : 
     288             : // XAnimationNode
     289           0 : Any SAL_CALL RandomAnimationNode::getRepeatCount() throw (RuntimeException, std::exception)
     290             : {
     291           0 :     Guard< Mutex > aGuard( maMutex );
     292           0 :     return maRepeatCount;
     293             : }
     294             : 
     295             : // XAnimationNode
     296           0 : void SAL_CALL RandomAnimationNode::setRepeatCount( const Any& _repeatcount ) throw (RuntimeException, std::exception)
     297             : {
     298           0 :     Guard< Mutex > aGuard( maMutex );
     299           0 :     maRepeatCount = _repeatcount;
     300           0 : }
     301             : 
     302             : // XAnimationNode
     303           0 : Any SAL_CALL RandomAnimationNode::getRepeatDuration() throw (RuntimeException, std::exception)
     304             : {
     305           0 :     Guard< Mutex > aGuard( maMutex );
     306           0 :     return maRepeatDuration;
     307             : }
     308             : 
     309             : // XAnimationNode
     310           0 : void SAL_CALL RandomAnimationNode::setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException, std::exception)
     311             : {
     312           0 :     Guard< Mutex > aGuard( maMutex );
     313           0 :     maRepeatDuration = _repeatduration;
     314           0 : }
     315             : 
     316             : // XAnimationNode
     317           0 : sal_Int16 SAL_CALL RandomAnimationNode::getFill() throw (RuntimeException, std::exception)
     318             : {
     319           0 :     Guard< Mutex > aGuard( maMutex );
     320           0 :     return mnFill;
     321             : }
     322             : 
     323             : // XAnimationNode
     324           0 : void SAL_CALL RandomAnimationNode::setFill( sal_Int16 _fill ) throw (RuntimeException, std::exception)
     325             : {
     326           0 :     Guard< Mutex > aGuard( maMutex );
     327           0 :     mnFill = _fill;
     328           0 : }
     329             : 
     330             : // XAnimationNode
     331           0 : sal_Int16 SAL_CALL RandomAnimationNode::getFillDefault() throw (RuntimeException, std::exception)
     332             : {
     333           0 :     Guard< Mutex > aGuard( maMutex );
     334           0 :     return mnFillDefault;
     335             : }
     336             : 
     337             : // XAnimationNode
     338           0 : void SAL_CALL RandomAnimationNode::setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException, std::exception)
     339             : {
     340           0 :     Guard< Mutex > aGuard( maMutex );
     341           0 :     mnFillDefault = _filldefault;
     342           0 : }
     343             : 
     344             : // XAnimationNode
     345           0 : sal_Int16 SAL_CALL RandomAnimationNode::getRestart() throw (RuntimeException, std::exception)
     346             : {
     347           0 :     Guard< Mutex > aGuard( maMutex );
     348           0 :     return mnRestart;
     349             : }
     350             : 
     351             : // XAnimationNode
     352           0 : void SAL_CALL RandomAnimationNode::setRestart( sal_Int16 _restart ) throw (RuntimeException, std::exception)
     353             : {
     354           0 :     Guard< Mutex > aGuard( maMutex );
     355           0 :     mnRestart = _restart;
     356           0 : }
     357             : 
     358             : // XAnimationNode
     359           0 : sal_Int16 SAL_CALL RandomAnimationNode::getRestartDefault() throw (RuntimeException, std::exception)
     360             : {
     361           0 :     Guard< Mutex > aGuard( maMutex );
     362           0 :     return mnRestartDefault;
     363             : }
     364             : 
     365             : // XAnimationNode
     366           0 : void SAL_CALL RandomAnimationNode::setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException, std::exception)
     367             : {
     368           0 :     Guard< Mutex > aGuard( maMutex );
     369           0 :     mnRestartDefault = _restartdefault;
     370           0 : }
     371             : 
     372             : // XAnimationNode
     373           0 : double SAL_CALL RandomAnimationNode::getAcceleration() throw (RuntimeException, std::exception)
     374             : {
     375           0 :     Guard< Mutex > aGuard( maMutex );
     376           0 :     return mfAcceleration;
     377             : }
     378             : 
     379             : // XAnimationNode
     380           0 : void SAL_CALL RandomAnimationNode::setAcceleration( double _acceleration ) throw (RuntimeException, std::exception)
     381             : {
     382           0 :     Guard< Mutex > aGuard( maMutex );
     383           0 :     mfAcceleration = _acceleration;
     384           0 : }
     385             : 
     386             : // XAnimationNode
     387           0 : double SAL_CALL RandomAnimationNode::getDecelerate() throw (RuntimeException, std::exception)
     388             : {
     389           0 :     Guard< Mutex > aGuard( maMutex );
     390           0 :     return mfDecelerate;
     391             : }
     392             : 
     393             : // XAnimationNode
     394           0 : void SAL_CALL RandomAnimationNode::setDecelerate( double _decelerate ) throw (RuntimeException, std::exception)
     395             : {
     396           0 :     Guard< Mutex > aGuard( maMutex );
     397           0 :     mfDecelerate = _decelerate;
     398           0 : }
     399             : 
     400             : // XAnimationNode
     401           0 : sal_Bool SAL_CALL RandomAnimationNode::getAutoReverse() throw (RuntimeException, std::exception)
     402             : {
     403           0 :     Guard< Mutex > aGuard( maMutex );
     404           0 :     return mbAutoReverse;
     405             : }
     406             : 
     407             : // XAnimationNode
     408           0 : void SAL_CALL RandomAnimationNode::setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException, std::exception)
     409             : {
     410           0 :     Guard< Mutex > aGuard( maMutex );
     411           0 :     mbAutoReverse = _autoreverse;
     412           0 : }
     413             : 
     414           0 : Sequence< NamedValue > SAL_CALL RandomAnimationNode::getUserData() throw (RuntimeException, std::exception)
     415             : {
     416           0 :     Guard< Mutex > aGuard( maMutex );
     417           0 :     return maUserData;
     418             : }
     419             : 
     420           0 : void SAL_CALL RandomAnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException, std::exception)
     421             : {
     422           0 :     Guard< Mutex > aGuard( maMutex );
     423           0 :     maUserData = _userdata;
     424           0 : }
     425             : 
     426             : // XChild
     427           0 : Reference< XInterface > SAL_CALL RandomAnimationNode::getParent() throw (RuntimeException, std::exception)
     428             : {
     429           0 :     Guard< Mutex > aGuard( maMutex );
     430           0 :     return mxParent;
     431             : }
     432             : 
     433             : // XChild
     434           0 : void SAL_CALL RandomAnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException, std::exception)
     435             : {
     436           0 :     Guard< Mutex > aGuard( maMutex );
     437           0 :     mxParent = Parent;
     438           0 : }
     439             : 
     440             : // XCloneable
     441           0 : Reference< XCloneable > SAL_CALL RandomAnimationNode::createClone() throw (RuntimeException, std::exception)
     442             : {
     443           0 :     Reference< XCloneable > xNewNode( new RandomAnimationNode( *this ) );
     444           0 :     return xNewNode;
     445             : }
     446             : 
     447             : // XElementAccess
     448           0 : Type SAL_CALL RandomAnimationNode::getElementType() throw (RuntimeException, std::exception)
     449             : {
     450           0 :     return cppu::UnoType<XAnimationNode>::get();
     451             : }
     452             : 
     453             : // XElementAccess
     454           0 : sal_Bool SAL_CALL RandomAnimationNode::hasElements() throw (RuntimeException, std::exception)
     455             : {
     456           0 :     return sal_True;
     457             : }
     458             : 
     459             : // XEnumerationAccess
     460           0 : Reference< XEnumeration > SAL_CALL RandomAnimationNode::createEnumeration()
     461             :     throw (RuntimeException, std::exception)
     462             : {
     463           0 :     Guard< Mutex > aGuard( maMutex );
     464             : 
     465           0 :     if( !maTarget.hasValue() && mxFirstNode.is() )
     466             :     {
     467           0 :         Any aTarget( mxFirstNode->getTarget() );
     468           0 :         if( aTarget.hasValue() )
     469             :         {
     470           0 :             maTarget = aTarget;
     471           0 :             mxFirstNode.clear();
     472           0 :         }
     473             :     }
     474             : 
     475           0 :     Reference< XEnumeration > xEnum;
     476             : 
     477           0 :     Reference< XEnumerationAccess > aEnumAccess( CustomAnimationPresets::getCustomAnimationPresets().getRandomPreset( mnPresetClass ), UNO_QUERY );
     478             : 
     479           0 :     if( aEnumAccess.is() )
     480             :     {
     481           0 :         Reference< XEnumeration > xEnumeration( aEnumAccess->createEnumeration(), UNO_QUERY );
     482           0 :         if( xEnumeration.is() )
     483             :         {
     484           0 :             while( xEnumeration->hasMoreElements() )
     485             :             {
     486           0 :                 Reference< XAnimate > xAnimate( xEnumeration->nextElement(), UNO_QUERY );
     487           0 :                 if( xAnimate.is() )
     488           0 :                     xAnimate->setTarget( maTarget );
     489           0 :             }
     490             :         }
     491           0 :         xEnum = aEnumAccess->createEnumeration();
     492             :     }
     493             :     else
     494             :     {
     495             :         // no presets? give empty node!
     496           0 :         Reference< XParallelTimeContainer > xTimeContainer  = ParallelTimeContainer::create( comphelper::getProcessComponentContext() );
     497           0 :         xEnum = xTimeContainer->createEnumeration();
     498             :     }
     499             : 
     500           0 :     return xEnum;
     501             : }
     502             : 
     503             : // XTimeContainer
     504           0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >&  )
     505             :     throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException, std::exception)
     506             : {
     507           0 :     return appendChild( newChild );
     508             : }
     509             : 
     510             : // XTimeContainer
     511           0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >&  )
     512             :     throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException, std::exception)
     513             : {
     514           0 :     return appendChild( newChild );
     515             : }
     516             : 
     517             : // XTimeContainer
     518           0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >&  )
     519             :     throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException, std::exception)
     520             : {
     521           0 :     return appendChild( newChild );
     522             : }
     523             : 
     524             : // XTimeContainer
     525           0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::removeChild( const Reference< XAnimationNode >& oldChild )
     526             :     throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException, std::exception)
     527             : {
     528           0 :     return oldChild;
     529             : }
     530             : 
     531             : // XTimeContainer
     532           0 : Reference< XAnimationNode > SAL_CALL RandomAnimationNode::appendChild( const Reference< XAnimationNode >& newChild )
     533             :     throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException, std::exception)
     534             : {
     535           0 :     Reference< XAnimate > xAnimate( newChild, UNO_QUERY );
     536           0 :     if( xAnimate.is() )
     537             :     {
     538           0 :         Any aTarget( xAnimate->getTarget() );
     539           0 :         if( aTarget.hasValue() )
     540           0 :             maTarget = aTarget;
     541             :     }
     542             : 
     543           0 :     if( !maTarget.hasValue() && !mxFirstNode.is() )
     544           0 :         mxFirstNode = xAnimate;
     545             : 
     546           0 :     return newChild;
     547             : }
     548             : 
     549             : // XServiceInfo
     550           0 : OUString RandomAnimationNode::getImplementationName() throw(std::exception)
     551             : {
     552           0 :     return OUString( "sd::RandomAnimationNode" ) ;
     553             : }
     554             : 
     555             : // XServiceInfo
     556           0 : sal_Bool RandomAnimationNode::supportsService(const OUString& ServiceName) throw(std::exception)
     557             : {
     558           0 :     return cppu::supportsService(this, ServiceName);
     559             : }
     560             : 
     561             : // XServiceInfo
     562           0 : Sequence< OUString > RandomAnimationNode::getSupportedServiceNames() throw(std::exception)
     563             : {
     564           0 :     Sequence< OUString > aSeq( 2 );
     565           0 :     aSeq[0] = "com.sun.star.animations.ParallelTimeContainer";
     566           0 :     aSeq[1] = "com.sun.star.comp.sd.RandomAnimationNode";
     567           0 :     return aSeq;
     568             : }
     569             : 
     570             : }
     571             : 
     572             : extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
     573           0 : RandomAnimationNode_get_implementation(::com::sun::star::uno::XComponentContext*,
     574             :                                                                     ::com::sun::star::uno::Sequence<css::uno::Any> const &)
     575             : {
     576           0 :     return cppu::acquire(new sd::RandomAnimationNode());
     577             : }
     578             : 
     579             : 
     580             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11