diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2004-11-29 09:36:52 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2004-11-29 09:36:52 +0000 |
commit | 2f5aafffd58f22e3facf23735e83cba1811d1b51 (patch) | |
tree | 135510c44d754defd4c128e1b564f0ce76cccad8 /animations | |
parent | 88dfb90b9d7a237d8a067802a28308b3a9e3710e (diff) |
INTEGRATION: CWS presentationengine01
Diffstat (limited to 'animations')
-rw-r--r-- | animations/inc/animations/animationnodehelper.hxx | 133 | ||||
-rw-r--r-- | animations/prj/build.lst | 3 | ||||
-rw-r--r-- | animations/prj/d.lst | 12 | ||||
-rw-r--r-- | animations/source/animcore/animcore.cxx | 1889 | ||||
-rw-r--r-- | animations/source/animcore/animcore.map | 10 | ||||
-rw-r--r-- | animations/source/animcore/animcore.xml | 30 | ||||
-rw-r--r-- | animations/source/animcore/factreg.cxx | 134 | ||||
-rw-r--r-- | animations/source/animcore/factreg.hxx | 87 | ||||
-rw-r--r-- | animations/source/animcore/makefile.mk | 105 | ||||
-rw-r--r-- | animations/source/animcore/targetpropertiescreator.cxx | 580 |
10 files changed, 2983 insertions, 0 deletions
diff --git a/animations/inc/animations/animationnodehelper.hxx b/animations/inc/animations/animationnodehelper.hxx new file mode 100644 index 000000000000..78ff26e80cf0 --- /dev/null +++ b/animations/inc/animations/animationnodehelper.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * $RCSfile: animationnodehelper.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2004-11-29 10:36:46 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX +#define INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX + +#ifndef _COM_SUN_STAR_UNO_REFERENCE_HXX_ +#include <com/sun/star/uno/Reference.hxx> +#endif + +#ifndef _COM_SUN_STAR_ANIMATIONS_XANIMATIONNODE_HPP_ +#include <com/sun/star/animations/XAnimationNode.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_ +#include <com/sun/star/container/XEnumerationAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATION_HPP_ +#include <com/sun/star/container/XEnumeration.hpp> +#endif + + +/* Declaration and definition of AnimationNode helper */ + +namespace anim +{ + // TODO(Q1): this could possibly be implemented with a somewhat + // more lightweight template, by having the actual worker receive + // only a function pointer, and a thin templated wrapper around + // that which converts member functions into that. + + /** Apply given functor to every animation node child. + + @param xNode + Parent node + + @param rFunctor + Functor to apply. The functor must have an appropriate + operator()( const ::com::sun::star::uno::Reference< + ::com::sun::star::animations::XAnimationNode >& ) member. + + @return true, if the functor was successfully applied to + all children, false otherwise. + */ + template< typename Functor > bool for_each_childNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, + Functor& rFunctor ) + { + try + { + // get an XEnumerationAccess to the children + ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > + xEnumerationAccess( xNode, + ::com::sun::star::uno::UNO_QUERY_THROW ); + ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > + xEnumeration( xEnumerationAccess->createEnumeration(), + ::com::sun::star::uno::UNO_QUERY_THROW ); + + while( xEnumeration->hasMoreElements() ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > + xChildNode( xEnumeration->nextElement(), + ::com::sun::star::uno::UNO_QUERY_THROW ); + + rFunctor( xChildNode ); + } + + return true; + } + catch( ::com::sun::star::uno::Exception& ) + { + return false; + } + } +} + +#endif /* INCLUDED_ANIMATIONS_ANIMATIONNODEHELPER_HXX */ diff --git a/animations/prj/build.lst b/animations/prj/build.lst new file mode 100644 index 000000000000..0d1b3fb1f67a --- /dev/null +++ b/animations/prj/build.lst @@ -0,0 +1,3 @@ +animations animations : cppuhelper offuh NULL +animations animations usr1 - all animations_mkout NULL +animations animations\source\animcore nmake - all animations_animcore NULL diff --git a/animations/prj/d.lst b/animations/prj/d.lst new file mode 100644 index 000000000000..9b1f1d1a71e8 --- /dev/null +++ b/animations/prj/d.lst @@ -0,0 +1,12 @@ +..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\* +..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\* +..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\* +..\source\animcore\animcore.xml %_DEST%\xml%_EXT%\animcore.xml + +..\%__SRC%\lib\lib*static*.dylib %_DEST%\lib%_EXT%\lib*static*.dylib + +dos: sh -c "if test %OS% = MACOSX; then create-bundle %_DEST%\lib%_EXT%\*.dylib; fi" +dos: sh -c "if test %OS% = MACOSX; then create-libstatic-link %_DEST%\lib%_EXT%; fi" + +mkdir: %_DEST%\inc%_EXT%\animations +..\inc\animations\animationnodehelper.hxx %_DEST%\inc%_EXT%\animations\animationnodehelper.hxx diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx new file mode 100644 index 000000000000..f11154e73817 --- /dev/null +++ b/animations/source/animcore/animcore.cxx @@ -0,0 +1,1889 @@ +/************************************************************************* + * + * $RCSfile: animcore.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2004-11-29 10:36:49 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_UTIL_XCLONEABLE_HPP_ +#include <com/sun/star/util/XCloneable.hpp> +#endif +#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ +#include <com/sun/star/uno/XComponentContext.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateColor_HPP_ +#include <com/sun/star/animations/XAnimateColor.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateSet_HPP_ +#include <com/sun/star/animations/XAnimateSet.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateMotion_HPP_ +#include <com/sun/star/animations/XAnimateMotion.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XAnimateTransform_HPP_ +#include <com/sun/star/animations/XAnimateTransform.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XTransitionFilter_HPP_ +#include <com/sun/star/animations/XTransitionFilter.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XTIMECONTAINER_HPP_ +#include <com/sun/star/animations/XTimeContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XITERATECONTAINER_HPP_ +#include <com/sun/star/animations/XIterateContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XAUDIO_HPP_ +#include <com/sun/star/animations/XAudio.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XCOMMAND_HPP_ +#include <com/sun/star/animations/XCommand.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONNODETYPE_HPP_ +#include <com/sun/star/animations/AnimationNodeType.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONCALCMODE_HPP_ +#include <com/sun/star/animations/AnimationCalcMode.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONFILL_HPP_ +#include <com/sun/star/animations/AnimationFill.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONRESTART_HPP_ +#include <com/sun/star/animations/AnimationRestart.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONCOLORSPACE_HPP_ +#include <com/sun/star/animations/AnimationColorSpace.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONADDITIVEMODE_HPP_ +#include <com/sun/star/animations/AnimationAdditiveMode.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONTRANSFORMTYPE_HPP_ +#include <com/sun/star/animations/AnimationTransformType.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_TRANSITIONTYPE_HPP_ +#include <com/sun/star/animations/TransitionType.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_TRANSITIONSUBTYPE_HPP_ +#include <com/sun/star/animations/TransitionSubType.hpp> +#endif +#ifndef _COM_SUN_STAR_PRESENTATION_SHAPEANIMATIONSUBTYPE_HPP_ +#include <com/sun/star/presentation/ShapeAnimationSubType.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_ +#include <com/sun/star/container/XEnumerationAccess.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_NAMEDVALUE_HPP_ +#include <com/sun/star/beans/NamedValue.hpp> +#endif + +#include <cppuhelper/implbase1.hxx> + +#ifndef _RTL_UUID_H_ +#include <rtl/uuid.h> +#endif + +#include <osl/mutex.hxx> +#include <list> +#include <algorithm> + +using ::osl::Mutex; +using ::osl::Guard; +using ::rtl::OUString; +using ::com::sun::star::uno::Any; +using ::com::sun::star::uno::UNO_QUERY; +using ::com::sun::star::uno::XInterface; +using ::com::sun::star::uno::RuntimeException; +using ::com::sun::star::uno::Sequence; +using ::com::sun::star::uno::Reference; +using ::com::sun::star::uno::XComponentContext; +using ::com::sun::star::uno::Exception; +using ::com::sun::star::uno::XWeak; +using ::com::sun::star::uno::Type; +using ::com::sun::star::uno::makeAny; +using ::com::sun::star::lang::NoSupportException; +using ::com::sun::star::lang::IllegalArgumentException; +using ::com::sun::star::lang::WrappedTargetException; +using ::com::sun::star::lang::NoSupportException; +using ::com::sun::star::lang::XServiceInfo; +using ::com::sun::star::lang::XTypeProvider; +using ::com::sun::star::container::NoSuchElementException; +using ::com::sun::star::container::ElementExistException; +using ::com::sun::star::container::XEnumeration; +using ::com::sun::star::container::XEnumerationAccess; +using ::com::sun::star::beans::NamedValue; +using ::com::sun::star::util::XCloneable; + +using ::cppu::OWeakObject; + +using namespace ::com::sun::star::animations; +using namespace ::com::sun::star::animations::AnimationNodeType; + +namespace animcore +{ + +// ==================================================================== + +typedef ::std::list< Reference< XAnimationNode > > ChildList_t; + +// ==================================================================== + +class AnimationNode : public XAnimateMotion, + public XAnimateColor, + public XTransitionFilter, + public XAnimateSet, + public XAnimateTransform, + public XIterateContainer, + public XEnumerationAccess, + public XServiceInfo, + public XTypeProvider, + public XAudio, + public XCommand, + public XCloneable, + public OWeakObject +{ +public: + AnimationNode( sal_Int16 nNodeType ); + AnimationNode( const AnimationNode& rNode ); + virtual ~AnimationNode(); + + // XInterface + virtual Any SAL_CALL queryInterface( const Type& aType ) throw (RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XTypeProvider + virtual Sequence< Type > SAL_CALL getTypes() throw (RuntimeException); + virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (RuntimeException); + + // XServiceInfo + OUString SAL_CALL getImplementationName() throw(); + Sequence< OUString > SAL_CALL getSupportedServiceNames(void) throw(); + sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(); + + // XChild + virtual Reference< XInterface > SAL_CALL getParent() throw (RuntimeException); + virtual void SAL_CALL setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException); + + // XCloneable + virtual Reference< XCloneable > SAL_CALL createClone() throw (RuntimeException); + + // XAnimationNode + virtual sal_Int16 SAL_CALL getType() throw (RuntimeException); + virtual Any SAL_CALL getBegin() throw (RuntimeException); + virtual void SAL_CALL setBegin( const Any& _begin ) throw (RuntimeException); + virtual Any SAL_CALL getDuration() throw (RuntimeException); + virtual void SAL_CALL setDuration( const Any& _duration ) throw (RuntimeException); + virtual Any SAL_CALL getEnd() throw (RuntimeException); + virtual void SAL_CALL setEnd( const Any& _end ) throw (RuntimeException); + virtual Any SAL_CALL getEndSync() throw (RuntimeException); + virtual void SAL_CALL setEndSync( const Any& _endsync ) throw (RuntimeException); + virtual Any SAL_CALL getRepeatCount() throw (RuntimeException); + virtual void SAL_CALL setRepeatCount( const Any& _repeatcount ) throw (RuntimeException); + virtual Any SAL_CALL getRepeatDuration() throw (RuntimeException); + virtual void SAL_CALL setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getFill() throw (RuntimeException); + virtual void SAL_CALL setFill( sal_Int16 _fill ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getFillDefault() throw (RuntimeException); + virtual void SAL_CALL setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getRestart() throw (RuntimeException); + virtual void SAL_CALL setRestart( sal_Int16 _restart ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getRestartDefault() throw (RuntimeException); + virtual void SAL_CALL setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException); + virtual double SAL_CALL getAcceleration() throw (RuntimeException); + virtual void SAL_CALL setAcceleration( double _acceleration ) throw (RuntimeException); + virtual double SAL_CALL getDecelerate() throw (RuntimeException); + virtual void SAL_CALL setDecelerate( double _decelerate ) throw (RuntimeException); + virtual sal_Bool SAL_CALL getAutoReverse() throw (RuntimeException); + virtual void SAL_CALL setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException); + virtual Sequence< NamedValue > SAL_CALL getUserData() throw (RuntimeException); + virtual void SAL_CALL setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException); + + // XAnimate + virtual Any SAL_CALL getTarget() throw (RuntimeException); + virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getSubItem() throw (RuntimeException); + virtual void SAL_CALL setSubItem( sal_Int16 _subitem ) throw (RuntimeException); + virtual OUString SAL_CALL getAttributeName() throw (RuntimeException); + virtual void SAL_CALL setAttributeName( const OUString& _attribute ) throw (RuntimeException); + virtual Sequence< Any > SAL_CALL getValues() throw (RuntimeException); + virtual void SAL_CALL setValues( const Sequence< Any >& _values ) throw (RuntimeException); + virtual Sequence< double > SAL_CALL getKeyTimes() throw (RuntimeException); + virtual void SAL_CALL setKeyTimes( const Sequence< double >& _keytimes ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getValueType() throw (RuntimeException); + virtual void SAL_CALL setValueType( sal_Int16 _valuetype ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getCalcMode() throw (RuntimeException); + virtual void SAL_CALL setCalcMode( sal_Int16 _calcmode ) throw (RuntimeException); + virtual sal_Bool SAL_CALL getAccumulate() throw (RuntimeException); + virtual void SAL_CALL setAccumulate( sal_Bool _accumulate ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getAdditive() throw (RuntimeException); + virtual void SAL_CALL setAdditive( sal_Int16 _additive ) throw (RuntimeException); + virtual Any SAL_CALL getFrom() throw (RuntimeException); + virtual void SAL_CALL setFrom( const Any& _from ) throw (RuntimeException); + virtual Any SAL_CALL getTo() throw (RuntimeException); + virtual void SAL_CALL setTo( const Any& _to ) throw (RuntimeException); + virtual Any SAL_CALL getBy() throw (RuntimeException); + virtual void SAL_CALL setBy( const Any& _by ) throw (RuntimeException); + virtual Sequence< TimeFilterPair > SAL_CALL getTimeFilter() throw (RuntimeException); + virtual void SAL_CALL setTimeFilter( const Sequence< TimeFilterPair >& _timefilter ) throw (RuntimeException); + virtual OUString SAL_CALL getFormula() throw (RuntimeException); + virtual void SAL_CALL setFormula( const OUString& _formula ) throw (RuntimeException); + + // XAnimateColor + virtual sal_Int16 SAL_CALL getColorInterpolation() throw (RuntimeException); + virtual void SAL_CALL setColorInterpolation( sal_Int16 _colorspace ) throw (RuntimeException); + virtual sal_Bool SAL_CALL getDirection() throw (RuntimeException); + virtual void SAL_CALL setDirection( sal_Bool _direction ) throw (RuntimeException); + + // XAnimateMotion + virtual Any SAL_CALL getPath() throw (RuntimeException); + virtual void SAL_CALL setPath( const Any& _path ) throw (RuntimeException); + virtual Any SAL_CALL getOrigin() throw (RuntimeException); + virtual void SAL_CALL setOrigin( const Any& _origin ) throw (RuntimeException); + + // XAnimateTransform + virtual sal_Int16 SAL_CALL getTransformType() throw (RuntimeException); + virtual void SAL_CALL setTransformType( sal_Int16 _transformtype ) throw (RuntimeException); + + // XTransitionFilter + virtual sal_Int16 SAL_CALL getTransition() throw (RuntimeException); + virtual void SAL_CALL setTransition( sal_Int16 _transition ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getSubtype() throw (RuntimeException); + virtual void SAL_CALL setSubtype( sal_Int16 _subtype ) throw (RuntimeException); + virtual sal_Bool SAL_CALL getMode() throw (RuntimeException); + virtual void SAL_CALL setMode( sal_Bool _mode ) throw (RuntimeException); +// virtual sal_Bool SAL_CALL getDirection() throw (RuntimeException); +// virtual void SAL_CALL setDirection( sal_Bool _direction ) throw (RuntimeException); + virtual sal_Int32 SAL_CALL getFadeColor() throw (RuntimeException); + virtual void SAL_CALL setFadeColor( sal_Int32 _fadecolor ) throw (RuntimeException); + + // XAudio + virtual Any SAL_CALL getSource() throw (RuntimeException); + virtual void SAL_CALL setSource( const Any& _source ) throw (RuntimeException); + virtual double SAL_CALL getVolume() throw (RuntimeException); + virtual void SAL_CALL setVolume( double _volume ) throw (RuntimeException); + + + // XCommand +// virtual Any SAL_CALL getTarget() throw (RuntimeException); +// virtual void SAL_CALL setTarget( const Any& _target ) throw (RuntimeException); + virtual sal_Int16 SAL_CALL getCommand() throw (RuntimeException); + virtual void SAL_CALL setCommand( sal_Int16 _command ) throw (RuntimeException); + virtual Any SAL_CALL getParameter() throw (RuntimeException); + virtual void SAL_CALL setParameter( const Any& _parameter ) throw (RuntimeException); + + // XElementAccess + virtual Type SAL_CALL getElementType() throw (RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw (RuntimeException); + + // XEnumerationAccess + virtual Reference< XEnumeration > SAL_CALL createEnumeration() throw (RuntimeException); + + // XTimeContainer + virtual Reference< XAnimationNode > SAL_CALL insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException); + virtual Reference< XAnimationNode > SAL_CALL insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException); + virtual Reference< XAnimationNode > SAL_CALL replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException); + virtual Reference< XAnimationNode > SAL_CALL removeChild( const Reference< XAnimationNode >& oldChild ) throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException); + virtual Reference< XAnimationNode > SAL_CALL appendChild( const Reference< XAnimationNode >& newChild ) throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException); + + // XIterateContainer + virtual sal_Int16 SAL_CALL getIterateType() throw (RuntimeException); + virtual void SAL_CALL setIterateType( sal_Int16 _iteratetype ) throw (RuntimeException); + virtual double SAL_CALL getIterateInterval() throw (RuntimeException); + virtual void SAL_CALL setIterateInterval( double _iterateinterval ) throw (RuntimeException); + +private: + static void initTypeProvider( sal_Int16 nNodeType ) throw(); + + const sal_Int16 mnNodeType; + + // for XTypeProvider + static Sequence< Type >* mpTypes[10]; + static Sequence< sal_Int8 >* mpId[10]; + + // our first, last and only protection from mutli-threads! + Mutex maMutex; + + // attributes for the XAnimationNode interface implementation + Any maBegin, maDuration, maEnd, maEndSync, maRepeatCount, maRepeatDuration; + sal_Int16 mnFill, mnFillDefault, mnRestart, mnRestartDefault; + double mfAcceleration, mfDecelerate; + sal_Bool mbAutoReverse; + Sequence< NamedValue > maUserData; + + // parent interface for XChild interface implementation + Reference<XInterface> mxParent; + + // attributes for XAnimate + Any maTarget; + OUString maAttributeName, maFormula; + Sequence< Any > maValues; + Sequence< double > maKeyTimes; + sal_Int16 mnValueType, mnSubItem; + sal_Int16 mnCalcMode, mnAdditive; + sal_Bool mbAccumulate; + Any maFrom, maTo, maBy; + Sequence< TimeFilterPair > maTimeFilter; + + // attributes for XAnimateColor + sal_Int16 mnColorSpace; + sal_Bool mbDirection; + + // atributes for XAnimateMotion + Any maPath, maOrigin; + + // attributes for XAnimateTransform + sal_Int16 mnTransformType; + + // attributes for XTransitionFilter + sal_Int16 mnTransition; + sal_Int16 mnSubtype; + sal_Bool mbMode; + sal_Int32 mnFadeColor; + + // XAudio + double mfVolume; + + // XCommand + sal_Int16 mnCommand; + Any maParameter; + + // XIterateContainer + sal_Int16 mnIterateType; + double mfIterateInterval; + + /** sorted list of child nodes for XTimeContainer*/ + ChildList_t maChilds; +}; + +// ==================================================================== + +class TimeContainerEnumeration : public ::cppu::WeakImplHelper1< XEnumeration > +{ +public: + TimeContainerEnumeration( const ChildList_t &rChilds ); + virtual ~TimeContainerEnumeration(); + + // Methods + virtual sal_Bool SAL_CALL hasMoreElements() throw (RuntimeException); + virtual Any SAL_CALL nextElement( ) throw (NoSuchElementException, WrappedTargetException, RuntimeException); + +private: + /** sorted list of child nodes */ + ChildList_t maChilds; + + /** current iteration position */ + ChildList_t::iterator maIter; + + /** our first, last and only protection from mutli-threads! */ + Mutex maMutex; +}; + +TimeContainerEnumeration::TimeContainerEnumeration( const ChildList_t &rChilds ) +: maChilds( rChilds ) +{ + maIter = maChilds.begin(); +} + +TimeContainerEnumeration::~TimeContainerEnumeration() +{ +} + +// Methods +sal_Bool SAL_CALL TimeContainerEnumeration::hasMoreElements() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + return maIter != maChilds.end(); +} + +Any SAL_CALL TimeContainerEnumeration::nextElement() + throw (NoSuchElementException, WrappedTargetException, RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + if( maIter == maChilds.end() ) + throw NoSuchElementException(); + + return makeAny( (*maIter++) ); +} + +// ==================================================================== + +Sequence< Type >* AnimationNode::mpTypes[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +Sequence< sal_Int8 >* AnimationNode::mpId[] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; + +AnimationNode::AnimationNode( sal_Int16 nNodeType ) +: mnNodeType( nNodeType ), + mnFill( AnimationFill::DEFAULT ), + mnFillDefault( AnimationFill::INHERIT ), + mnRestart( AnimationRestart:: DEFAULT ), + mnRestartDefault( AnimationRestart:: INHERIT ), + mfAcceleration( 0.0 ), + mfDecelerate( 0.0 ), + mbAutoReverse( sal_False ), + mnValueType( 0 ), + mnSubItem( 0 ), + mnCalcMode( (nNodeType == AnimationNodeType::ANIMATEMOTION) ? AnimationCalcMode::PACED : AnimationCalcMode::LINEAR), + mnAdditive(AnimationAdditiveMode::BASE), + mbAccumulate(sal_False), + mnColorSpace( AnimationColorSpace::RGB ), + mbDirection( sal_True ), + mnTransformType( AnimationTransformType::TRANSLATE ), + mnTransition(TransitionType::BARWIPE), + mnSubtype(TransitionSubType::DEFAULT), + mbMode(true), + mnFadeColor(0), + mfVolume(1.0), + mnCommand(0), + mnIterateType( ::com::sun::star::presentation::ShapeAnimationSubType::AS_WHOLE ), + mfIterateInterval(0.0) +{ +} + +AnimationNode::AnimationNode( const AnimationNode& rNode ) +: mnNodeType( rNode.mnNodeType ), + + // attributes for the XAnimationNode interface implementation + maBegin( rNode.maBegin ), + maDuration( rNode.maDuration ), + maEnd( rNode.maEnd ), + maEndSync( rNode.maEndSync ), + maRepeatCount( rNode.maRepeatCount ), + maRepeatDuration( rNode.maRepeatDuration ), + mnFill( rNode.mnFill ), + mnFillDefault( rNode.mnFillDefault ), + mnRestart( rNode.mnRestart ), + mnRestartDefault( rNode.mnRestartDefault ), + mfAcceleration( rNode.mfAcceleration ), + mfDecelerate( rNode.mfDecelerate ), + mbAutoReverse( rNode.mbAutoReverse ), + maUserData( rNode.maUserData ), + + // attributes for XAnimate + maTarget( rNode.maTarget ), + maAttributeName( rNode.maAttributeName ), + maFormula( rNode.maFormula ), + maValues( rNode.maValues ), + maKeyTimes( rNode.maKeyTimes ), + mnValueType( rNode.mnValueType ), + mnSubItem( rNode.mnSubItem ), + mnCalcMode( rNode.mnCalcMode ), + mnAdditive( rNode.mnAdditive ), + mbAccumulate( rNode.mbAccumulate ), + maFrom( rNode.maFrom ), + maTo( rNode.maTo ), + maBy( rNode.maBy ), + maTimeFilter( rNode.maTimeFilter ), + + // attributes for XAnimateColor + mnColorSpace( rNode.mnColorSpace ), + mbDirection( rNode.mbDirection ), + + // atributes for XAnimateMotion + maPath( rNode.maPath ), + maOrigin( rNode.maOrigin ), + + // attributes for XAnimateTransform + mnTransformType( rNode.mnTransformType ), + + // attributes for XTransitionFilter + mnTransition( rNode.mnTransition ), + mnSubtype( rNode.mnSubtype ), + mbMode( rNode.mbMode ), + mnFadeColor( rNode.mnFadeColor ), + + // XAudio + mfVolume( rNode.mfVolume ), + + // XCommand + mnCommand( rNode.mnCommand ), + maParameter( rNode.maParameter ), + + // XIterateContainer + mnIterateType( rNode.mnIterateType ), + mfIterateInterval( rNode.mfIterateInterval ) +{ +} + +AnimationNode::~AnimationNode() +{ +} + +// -------------------------------------------------------------------- + +#define IMPL_NODE_FACTORY(N,IN,SN)\ +Reference< XInterface > SAL_CALL createInstance_##N( const Reference< XComponentContext > & rSMgr ) throw (Exception)\ +{\ + return Reference < XInterface > ( SAL_STATIC_CAST( ::cppu::OWeakObject * , new AnimationNode( N ) ) );\ +}\ +OUString getImplementationName_##N()\ +{\ + return OUString( RTL_CONSTASCII_USTRINGPARAM ( IN ) );\ +}\ +Sequence<OUString> getSupportedServiceNames_##N(void)\ +{\ + Sequence<OUString> aRet(1);\ + aRet.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( SN ));\ + return aRet;\ +} + +IMPL_NODE_FACTORY( PAR, "animcore::ParallelTimeContainer", "com.sun.star.animations.ParallelTimeContainer" ) +IMPL_NODE_FACTORY( SEQ, "animcore::SequenceTimeContainer", "com.sun.star.animations.SequenceTimeContainer" ) +IMPL_NODE_FACTORY( ITERATE, "animcore::IterateContainer", "com.sun.star.animations.IterateContainer" ) +IMPL_NODE_FACTORY( ANIMATE, "animcore::Animate", "com.sun.star.animations.Animate" ) +IMPL_NODE_FACTORY( SET, "animcore::AnimateSet", "com.sun.star.animations.AnimateSet" ) +IMPL_NODE_FACTORY( ANIMATECOLOR, "animcore::AnimateColor", "com.sun.star.animations.AnimateColor" ) +IMPL_NODE_FACTORY( ANIMATEMOTION, "animcore::AnimateMotion", "com.sun.star.animations.AnimateMotion" ) +IMPL_NODE_FACTORY( ANIMATETRANSFORM, "animcore::AnimateTransform", "com.sun.star.animations.AnimateTransform" ) +IMPL_NODE_FACTORY( TRANSITIONFILTER, "animcore::TransitionFilter", "com.sun.star.animations.TransitionFilter" ) +IMPL_NODE_FACTORY( AUDIO, "animcore::Audio", "com.sun.star.animations.Audio" ); +IMPL_NODE_FACTORY( COMMAND, "animcore::Command", "com.sun.star.animations.Command" ); + +// -------------------------------------------------------------------- + +// XInterface +Any SAL_CALL AnimationNode::queryInterface( const Type& aType ) throw (RuntimeException) +{ + Any aRet( ::cppu::queryInterface( + aType, + static_cast< XServiceInfo * >( this ), + static_cast< XTypeProvider * >( this ), + static_cast< XChild * >( static_cast< XTimeContainer * >(this) ), + static_cast< XCloneable* >( this ), + static_cast< XAnimationNode* >( static_cast< XTimeContainer * >(this) ), + static_cast< XInterface* >(static_cast< OWeakObject * >(this)), + static_cast< XWeak* >(static_cast< OWeakObject * >(this)) ) ); + + if(!aRet.hasValue()) + { + switch( mnNodeType ) + { + case AnimationNodeType::PAR: + case AnimationNodeType::SEQ: + aRet = ::cppu::queryInterface( + aType, + static_cast< XTimeContainer * >( this ), + static_cast< XEnumerationAccess * >( this ), + static_cast< XElementAccess * >( this ) ); + break; + case AnimationNodeType::ITERATE: + aRet = ::cppu::queryInterface( + aType, + static_cast< XTimeContainer * >( this ), + static_cast< XIterateContainer * >( this ), + static_cast< XEnumerationAccess * >( this ), + static_cast< XElementAccess * >( this ) ); + break; + case AnimationNodeType::ANIMATE: + aRet = ::cppu::queryInterface( + aType, + static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ) ); + break; + case AnimationNodeType::ANIMATEMOTION: + aRet = ::cppu::queryInterface( + aType, + static_cast< XAnimate * >( static_cast< XAnimateMotion * >(this) ), + static_cast< XAnimateMotion * >( this ) ); + break; + case AnimationNodeType::ANIMATECOLOR: + aRet = ::cppu::queryInterface( + aType, + static_cast< XAnimate * >( static_cast< XAnimateColor * >(this) ), + static_cast< XAnimateColor * >( this ) ); + break; + case AnimationNodeType::SET: + aRet = ::cppu::queryInterface( + aType, + static_cast< XAnimate * >( static_cast< XAnimateSet * >(this) ), + static_cast< XAnimateSet * >( this ) ); + break; + case AnimationNodeType::ANIMATETRANSFORM: + aRet = ::cppu::queryInterface( + aType, + static_cast< XAnimate * >( static_cast< XAnimateTransform * >(this) ), + static_cast< XAnimateTransform * >( this ) ); + break; + case AnimationNodeType::AUDIO: + aRet = ::cppu::queryInterface( + aType, + static_cast< XAudio * >( static_cast< XAudio * >(this) ) ); + break; + case AnimationNodeType::COMMAND: + aRet = ::cppu::queryInterface( + aType, + static_cast< XCommand * >( static_cast< XCommand * >(this) ) ); + break; + case AnimationNodeType::TRANSITIONFILTER: + aRet = ::cppu::queryInterface( + aType, + static_cast< XAnimate * >( static_cast< XTransitionFilter * >(this) ), + static_cast< XTransitionFilter * >( this ) ); + break; + } + } + + return aRet.hasValue() ? aRet : OWeakObject::queryInterface( aType ); +} + +// -------------------------------------------------------------------- + +void AnimationNode::initTypeProvider( sal_Int16 nNodeType ) throw() +{ + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + + if(! mpTypes[nNodeType] ) + { + // create id + mpId[nNodeType] = new Sequence< sal_Int8 >( 16 ); + rtl_createUuid( (sal_uInt8 *)mpId[nNodeType]->getArray(), 0, sal_True ); + + static sal_Int32 type_numbers[] = + { + 5, // CUSTOM + 7, // PAR + 7, // SEQ + 7, // ITERATE + 6, // ANIMATE + 6, // SET + 6, // ANIMATEMOTION + 6, // ANIMATECOLOR + 6, // ANIMATETRANSFORM + 6, // TRANSITIONFILTER + 6, // AUDIO + 6, // COMMAND + }; + + // collect types + Sequence< Type > * types = new Sequence< Type >( type_numbers[nNodeType] ); + Type * pTypeAr = types->getArray(); + sal_Int32 nPos = 0; + + pTypeAr[nPos++] = ::getCppuType( (const Reference< XWeak > *)0 ); + pTypeAr[nPos++] = ::getCppuType( (const Reference< XChild > *)0 ); + pTypeAr[nPos++] = ::getCppuType( (const Reference< XCloneable > *)0 ); + pTypeAr[nPos++] = ::getCppuType( (const Reference< XTypeProvider > *)0 ); + pTypeAr[nPos++] = ::getCppuType( (const Reference< XServiceInfo > *)0 ); + + switch( nNodeType ) + { + case AnimationNodeType::PAR: + case AnimationNodeType::SEQ: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XTimeContainer > *)0 ); + pTypeAr[nPos++] = ::getCppuType( (const Reference< XEnumerationAccess > *)0 ); + break; + case AnimationNodeType::ITERATE: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XIterateContainer > *)0 ); + pTypeAr[nPos++] = ::getCppuType( (const Reference< XEnumerationAccess > *)0 ); + break; + case AnimationNodeType::ANIMATE: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimate > *)0 ); + break; + case AnimationNodeType::ANIMATEMOTION: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateMotion > *)0 ); + break; + case AnimationNodeType::ANIMATECOLOR: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateColor > *)0 ); + break; + case AnimationNodeType::ANIMATETRANSFORM: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateTransform > *)0 ); + break; + case AnimationNodeType::SET: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XAnimateSet > *)0 ); + break; + case AnimationNodeType::TRANSITIONFILTER: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XTransitionFilter > *)0 ); + break; + case AnimationNodeType::AUDIO: + pTypeAr[nPos++] = ::getCppuType( (const Reference< XAudio > *)0 ); + break; + case AnimationNodeType::COMMAND: + pTypeAr[nPos++] = ::getCppuType( ( const Reference< XCommand > *)0 ); + break; + } + mpTypes[nNodeType] = types; + } +} + +// -------------------------------------------------------------------- + +Sequence< Type > AnimationNode::getTypes() throw (RuntimeException) +{ + if (! mpTypes[mnNodeType]) + initTypeProvider(mnNodeType); + return *mpTypes[mnNodeType]; +} +// -------------------------------------------------------------------- + +Sequence< sal_Int8 > AnimationNode::getImplementationId() throw (RuntimeException) +{ + if (! mpId[mnNodeType]) + initTypeProvider(mnNodeType); + return *mpId[mnNodeType]; +} + +// -------------------------------------------------------------------- + +// XInterface +void SAL_CALL AnimationNode::acquire( ) throw () +{ + OWeakObject::acquire(); +} + +// -------------------------------------------------------------------- + +// XInterface +void SAL_CALL AnimationNode::release( ) throw () +{ + OWeakObject::acquire(); +} + +// -------------------------------------------------------------------- + +// XServiceInfo +OUString AnimationNode::getImplementationName() throw() +{ + switch( mnNodeType ) + { + case AnimationNodeType::PAR: + return getImplementationName_PAR(); + case AnimationNodeType::SEQ: + return getImplementationName_SEQ(); + case AnimationNodeType::ITERATE: + return getImplementationName_ITERATE(); + case AnimationNodeType::SET: + return getImplementationName_SET(); + case AnimationNodeType::ANIMATECOLOR: + return getImplementationName_ANIMATECOLOR(); + case AnimationNodeType::ANIMATEMOTION: + return getImplementationName_ANIMATEMOTION(); + case AnimationNodeType::TRANSITIONFILTER: + return getImplementationName_TRANSITIONFILTER(); + case AnimationNodeType::ANIMATETRANSFORM: + return getImplementationName_ANIMATETRANSFORM(); + case AnimationNodeType::AUDIO: + return getImplementationName_AUDIO(); + case AnimationNodeType::COMMAND: + return getImplementationName_COMMAND(); + case AnimationNodeType::ANIMATE: + default: + return getImplementationName_ANIMATE(); + } +} + +// -------------------------------------------------------------------- + +// XServiceInfo +sal_Bool AnimationNode::supportsService(const OUString& ServiceName) throw() +{ + Sequence< OUString > aSNL( getSupportedServiceNames() ); + const OUString * pArray = aSNL.getConstArray(); + + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) + if( pArray[i] == ServiceName ) + return sal_True; + + return sal_False; +} + +// -------------------------------------------------------------------- + +// XServiceInfo +Sequence< OUString > AnimationNode::getSupportedServiceNames(void) throw() +{ + switch( mnNodeType ) + { + case AnimationNodeType::PAR: + return getSupportedServiceNames_PAR(); + case AnimationNodeType::SEQ: + return getSupportedServiceNames_SEQ(); + case AnimationNodeType::ITERATE: + return getSupportedServiceNames_ITERATE(); + case AnimationNodeType::SET: + return getSupportedServiceNames_SET(); + case AnimationNodeType::ANIMATECOLOR: + return getSupportedServiceNames_ANIMATECOLOR(); + case AnimationNodeType::ANIMATEMOTION: + return getSupportedServiceNames_ANIMATEMOTION(); + case AnimationNodeType::TRANSITIONFILTER: + return getSupportedServiceNames_TRANSITIONFILTER(); + case AnimationNodeType::AUDIO: + return getSupportedServiceNames_AUDIO(); + case AnimationNodeType::COMMAND: + return getSupportedServiceNames_COMMAND(); + case AnimationNodeType::ANIMATE: + default: + return getSupportedServiceNames_ANIMATE(); + } +} + +// -------------------------------------------------------------------- + +// XAnimationNode +sal_Int16 SAL_CALL AnimationNode::getType() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnNodeType; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +Any SAL_CALL AnimationNode::getBegin() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maBegin; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setBegin( const Any& _begin ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maBegin = _begin; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +Any SAL_CALL AnimationNode::getDuration() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maDuration; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setDuration( const Any& _duration ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maDuration = _duration; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +Any SAL_CALL AnimationNode::getEnd() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maEnd; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setEnd( const Any& _end ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maEnd = _end; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +Any SAL_CALL AnimationNode::getEndSync() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maEndSync; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setEndSync( const Any& _endsync ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maEndSync = _endsync; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +Any SAL_CALL AnimationNode::getRepeatCount() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maRepeatCount; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setRepeatCount( const Any& _repeatcount ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maRepeatCount = _repeatcount; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +Any SAL_CALL AnimationNode::getRepeatDuration() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maRepeatDuration; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setRepeatDuration( const Any& _repeatduration ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maRepeatDuration = _repeatduration; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +sal_Int16 SAL_CALL AnimationNode::getFill() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnFill; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setFill( sal_Int16 _fill ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnFill = _fill; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +sal_Int16 SAL_CALL AnimationNode::getFillDefault() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnFillDefault; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setFillDefault( sal_Int16 _filldefault ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnFillDefault = _filldefault; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +sal_Int16 SAL_CALL AnimationNode::getRestart() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnRestart; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setRestart( sal_Int16 _restart ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnRestart = _restart; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +sal_Int16 SAL_CALL AnimationNode::getRestartDefault() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnRestartDefault; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setRestartDefault( sal_Int16 _restartdefault ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnRestartDefault = _restartdefault; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +double SAL_CALL AnimationNode::getAcceleration() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mfAcceleration; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setAcceleration( double _acceleration ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mfAcceleration = _acceleration; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +double SAL_CALL AnimationNode::getDecelerate() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mfDecelerate; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setDecelerate( double _decelerate ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mfDecelerate = _decelerate; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +sal_Bool SAL_CALL AnimationNode::getAutoReverse() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mbAutoReverse; +} + +// -------------------------------------------------------------------- + +// XAnimationNode +void SAL_CALL AnimationNode::setAutoReverse( sal_Bool _autoreverse ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mbAutoReverse = _autoreverse; +} + +// -------------------------------------------------------------------- + +Sequence< NamedValue > SAL_CALL AnimationNode::getUserData() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maUserData; +} + +// -------------------------------------------------------------------- + +void SAL_CALL AnimationNode::setUserData( const Sequence< NamedValue >& _userdata ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maUserData = _userdata; +} + +// -------------------------------------------------------------------- + +// XChild +Reference< XInterface > SAL_CALL AnimationNode::getParent() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mxParent; +} + +// -------------------------------------------------------------------- + +// XChild +void SAL_CALL AnimationNode::setParent( const Reference< XInterface >& Parent ) throw (NoSupportException, RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mxParent = Parent; +} + +// -------------------------------------------------------------------- + +// XCloneable +Reference< XCloneable > SAL_CALL AnimationNode::createClone() throw (RuntimeException) +{ + Reference< XCloneable > xNewNode; + + try + { + xNewNode = new AnimationNode( *this ); + + if( maChilds.size() ) + { + Reference< XTimeContainer > xContainer( xNewNode, UNO_QUERY ); + if( xContainer.is() ) + { + ChildList_t::iterator aIter( maChilds.begin() ); + ChildList_t::iterator aEnd( maChilds.end() ); + while( aIter != aEnd ) + { + Reference< XCloneable > xCloneable((*aIter++), UNO_QUERY ); + if( xCloneable.is() ) + { + Reference< XAnimationNode > xNewChildNode( xCloneable->createClone(), UNO_QUERY ); + if( xNewChildNode.is() ) + xContainer->appendChild( xNewChildNode ); + } + } + } + } + } + catch( Exception& e ) + { + (void)e; + OSL_TRACE( "animations::AnimationNode::createClone(), exception catched!" ); + } + + return xNewNode; +} + +// -------------------------------------------------------------------- + +// XAnimate +Any SAL_CALL AnimationNode::getTarget() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maTarget; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setTarget( const Any& _target ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maTarget= _target; +} + +// -------------------------------------------------------------------- + +// XAnimate +OUString SAL_CALL AnimationNode::getAttributeName() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maAttributeName; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setAttributeName( const OUString& _attribute ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maAttributeName = _attribute; +} + +// -------------------------------------------------------------------- + +// XAnimate +Sequence< Any > SAL_CALL AnimationNode::getValues() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maValues; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setValues( const Sequence< Any >& _values ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maValues = _values; +} + +// -------------------------------------------------------------------- + +// XAnimate +sal_Int16 SAL_CALL AnimationNode::getSubItem() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnSubItem; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setSubItem( sal_Int16 _subitem ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnSubItem = _subitem; +} + +// -------------------------------------------------------------------- + +// XAnimate +Sequence< double > SAL_CALL AnimationNode::getKeyTimes() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maKeyTimes; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setKeyTimes( const Sequence< double >& _keytimes ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maKeyTimes = _keytimes; +} + +// -------------------------------------------------------------------- + +// XAnimate +sal_Int16 SAL_CALL AnimationNode::getValueType() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnValueType; +} + +// -------------------------------------------------------------------- + +void SAL_CALL AnimationNode::setValueType( sal_Int16 _valuetype ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnValueType = _valuetype; +} + +// -------------------------------------------------------------------- + +// XAnimate +sal_Int16 SAL_CALL AnimationNode::getCalcMode() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnCalcMode; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setCalcMode( sal_Int16 _calcmode ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnCalcMode = _calcmode; +} + +// -------------------------------------------------------------------- + +// XAnimate +sal_Bool SAL_CALL AnimationNode::getAccumulate() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mbAccumulate; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setAccumulate( sal_Bool _accumulate ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mbAccumulate = _accumulate; +} + +// -------------------------------------------------------------------- + +// XAnimate +sal_Int16 SAL_CALL AnimationNode::getAdditive() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnAdditive; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setAdditive( sal_Int16 _additive ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnAdditive = _additive; +} + +// -------------------------------------------------------------------- + +// XAnimate +Any SAL_CALL AnimationNode::getFrom() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maFrom; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setFrom( const Any& _from ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maFrom = _from; +} + +// -------------------------------------------------------------------- + +// XAnimate +Any SAL_CALL AnimationNode::getTo() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maTo; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setTo( const Any& _to ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maTo = _to; +} + +// -------------------------------------------------------------------- + +// XAnimate +Any SAL_CALL AnimationNode::getBy() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maBy; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setBy( const Any& _by ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maBy = _by; +} + +// -------------------------------------------------------------------- + +// XAnimate +Sequence< TimeFilterPair > SAL_CALL AnimationNode::getTimeFilter() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maTimeFilter; +} + +// -------------------------------------------------------------------- + +// XAnimate +void SAL_CALL AnimationNode::setTimeFilter( const Sequence< TimeFilterPair >& _timefilter ) + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maTimeFilter = _timefilter; +} + +// -------------------------------------------------------------------- + +OUString SAL_CALL AnimationNode::getFormula() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maFormula; +} + +// -------------------------------------------------------------------- + +void SAL_CALL AnimationNode::setFormula( const OUString& _formula ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maFormula = _formula; +} + +// -------------------------------------------------------------------- + +// XAnimateColor +sal_Int16 SAL_CALL AnimationNode::getColorInterpolation() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnColorSpace; +} + +// -------------------------------------------------------------------- + +// XAnimateColor +void SAL_CALL AnimationNode::setColorInterpolation( sal_Int16 _colorspace ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnColorSpace = _colorspace; +} + +// -------------------------------------------------------------------- + +// XAnimateColor +sal_Bool SAL_CALL AnimationNode::getDirection() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mbDirection; +} + +// -------------------------------------------------------------------- + +// XAnimateColor +void SAL_CALL AnimationNode::setDirection( sal_Bool _direction ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mbDirection = _direction; +} + +// -------------------------------------------------------------------- + +// XAnimateMotion +Any SAL_CALL AnimationNode::getPath() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maPath; +} + +// -------------------------------------------------------------------- + +// XAnimateMotion +void SAL_CALL AnimationNode::setPath( const Any& _path ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maPath = _path; +} + +// -------------------------------------------------------------------- + +// XAnimateMotion +Any SAL_CALL AnimationNode::getOrigin() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maOrigin; +} + +// -------------------------------------------------------------------- + +// XAnimateMotion +void SAL_CALL AnimationNode::setOrigin( const Any& _origin ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maOrigin = _origin; +} + +// -------------------------------------------------------------------- + +// XAnimateTransform +sal_Int16 SAL_CALL AnimationNode::getTransformType() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnTransformType; +} + +// -------------------------------------------------------------------- + +// XAnimateTransform +void SAL_CALL AnimationNode::setTransformType( sal_Int16 _transformtype ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnTransformType = _transformtype; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +sal_Int16 SAL_CALL AnimationNode::getTransition() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnTransition; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +void SAL_CALL AnimationNode::setTransition( sal_Int16 _transition ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnTransition = _transition; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +sal_Int16 SAL_CALL AnimationNode::getSubtype() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnSubtype; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +void SAL_CALL AnimationNode::setSubtype( sal_Int16 _subtype ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnSubtype = _subtype; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +sal_Bool SAL_CALL AnimationNode::getMode() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mbMode; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +void SAL_CALL AnimationNode::setMode( sal_Bool _mode ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mbMode = _mode; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +sal_Int32 SAL_CALL AnimationNode::getFadeColor() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnFadeColor; +} + +// -------------------------------------------------------------------- + +// XTransitionFilter +void SAL_CALL AnimationNode::setFadeColor( sal_Int32 _fadecolor ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnFadeColor = _fadecolor; +} + +// -------------------------------------------------------------------- + +// XAudio +Any SAL_CALL AnimationNode::getSource() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maTarget; +} + +// -------------------------------------------------------------------- + +// XAudio +void SAL_CALL AnimationNode::setSource( const Any& _source ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maTarget = _source; +} + +// -------------------------------------------------------------------- + +// XAudio +double SAL_CALL AnimationNode::getVolume() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mfVolume; +} + +// -------------------------------------------------------------------- + +// XAudio +void SAL_CALL AnimationNode::setVolume( double _volume ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mfVolume = _volume; +} + +// -------------------------------------------------------------------- + +// XCommand +sal_Int16 SAL_CALL AnimationNode::getCommand() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnCommand; +} + +// -------------------------------------------------------------------- + +// XCommand +void SAL_CALL AnimationNode::setCommand( sal_Int16 _command ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnCommand = _command; +} + +// -------------------------------------------------------------------- + +// XCommand +Any SAL_CALL AnimationNode::getParameter() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return maParameter; +} + +// -------------------------------------------------------------------- + +// XCommand +void SAL_CALL AnimationNode::setParameter( const Any& _parameter ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + maParameter = _parameter; +} + +// -------------------------------------------------------------------- + +// XElementAccess +Type SAL_CALL AnimationNode::getElementType() throw (RuntimeException) +{ + return ::getCppuType((const Reference< XAnimationNode >*)0); +} + +// -------------------------------------------------------------------- + +// XElementAccess +sal_Bool SAL_CALL AnimationNode::hasElements() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return !maChilds.empty(); +} + +// -------------------------------------------------------------------- + +// XEnumerationAccess +Reference< XEnumeration > SAL_CALL AnimationNode::createEnumeration() + throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + return new TimeContainerEnumeration( maChilds); +} + +// -------------------------------------------------------------------- + + +// XTimeContainer +Reference< XAnimationNode > SAL_CALL AnimationNode::insertBefore( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) + throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + if( !newChild.is() || !refChild.is() ) + throw IllegalArgumentException(); + + ChildList_t::iterator before = ::std::find(maChilds.begin(), maChilds.end(), refChild); + if( before == maChilds.end() ) + throw NoSuchElementException(); + + if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() ) + throw ElementExistException(); + + maChilds.insert( before, newChild ); + + return newChild; +} + +// -------------------------------------------------------------------- + +// XTimeContainer +Reference< XAnimationNode > SAL_CALL AnimationNode::insertAfter( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& refChild ) + throw (IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + if( !newChild.is() || !refChild.is() ) + throw IllegalArgumentException(); + + ChildList_t::iterator before = ::std::find(maChilds.begin(), maChilds.end(), refChild); + if( before == maChilds.end() ) + throw NoSuchElementException(); + + if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() ) + throw ElementExistException(); + + before++; + if( before != maChilds.end() ) + maChilds.insert( before, newChild ); + else + maChilds.push_back( newChild ); + + Reference< XInterface > xThis( static_cast< OWeakObject * >(this) ); + newChild->setParent( xThis ); + + return newChild; +} + +// -------------------------------------------------------------------- + +// XTimeContainer +Reference< XAnimationNode > SAL_CALL AnimationNode::replaceChild( const Reference< XAnimationNode >& newChild, const Reference< XAnimationNode >& oldChild ) + throw( IllegalArgumentException, NoSuchElementException, ElementExistException, WrappedTargetException, RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + if( !newChild.is() || !oldChild.is() ) + throw IllegalArgumentException(); + + ChildList_t::iterator replace = ::std::find(maChilds.begin(), maChilds.end(), oldChild); + if( replace == maChilds.end() ) + throw NoSuchElementException(); + + if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() ) + throw ElementExistException(); + + Reference< XInterface > xNull( 0 ); + oldChild->setParent( xNull ); + + (*replace) = newChild; + + Reference< XInterface > xThis( static_cast< OWeakObject * >(this) ); + newChild->setParent( xThis ); + + return newChild; +} + +// -------------------------------------------------------------------- + +// XTimeContainer +Reference< XAnimationNode > SAL_CALL AnimationNode::removeChild( const Reference< XAnimationNode >& oldChild ) + throw(IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + if( !oldChild.is() ) + throw IllegalArgumentException(); + + ChildList_t::iterator old = ::std::find(maChilds.begin(), maChilds.end(), oldChild); + if( old == maChilds.end() ) + throw NoSuchElementException(); + + Reference< XInterface > xNull( 0 ); + oldChild->setParent( xNull ); + + maChilds.erase( old ); + + return oldChild; +} + +// -------------------------------------------------------------------- + +// XTimeContainer +Reference< XAnimationNode > SAL_CALL AnimationNode::appendChild( const Reference< XAnimationNode >& newChild ) + throw(IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + + if( !newChild.is() ) + throw IllegalArgumentException(); + + if( ::std::find(maChilds.begin(), maChilds.end(), newChild) != maChilds.end() ) + throw ElementExistException(); + + maChilds.push_back( newChild ); + + Reference< XInterface > xThis( static_cast< OWeakObject * >(this) ); + newChild->setParent( xThis ); + + return newChild; +} + +// -------------------------------------------------------------------- + +// XIterateContainer +sal_Int16 SAL_CALL AnimationNode::getIterateType() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mnIterateType; +} + +// -------------------------------------------------------------------- + +// XIterateContainer +void SAL_CALL AnimationNode::setIterateType( sal_Int16 _iteratetype ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mnIterateType = _iteratetype; +} + +// -------------------------------------------------------------------- + +// XIterateContainer +double SAL_CALL AnimationNode::getIterateInterval() throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + return mfIterateInterval; +} + +// -------------------------------------------------------------------- + +// XIterateContainer +void SAL_CALL AnimationNode::setIterateInterval( double _iterateinterval ) throw (RuntimeException) +{ + Guard< Mutex > aGuard( maMutex ); + mfIterateInterval = _iterateinterval; +} + +}; // namespace animcore diff --git a/animations/source/animcore/animcore.map b/animations/source/animcore/animcore.map new file mode 100644 index 000000000000..f76809fbd37b --- /dev/null +++ b/animations/source/animcore/animcore.map @@ -0,0 +1,10 @@ +UDK_3_0_0 { + global: + component_getImplementationEnvironment; + component_writeInfo; + component_getFactory; + component_canUnload; + component_getDescriptionFunc; + local: + *; +}; diff --git a/animations/source/animcore/animcore.xml b/animations/source/animcore/animcore.xml new file mode 100644 index 000000000000..9ccca0f02081 --- /dev/null +++ b/animations/source/animcore/animcore.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module-description PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "module-description.dtd"> +<module-description xmlns:xlink="http://www.w3.org/1999/xlink"> + <module-name> animations </module-name> + + <component-description> + <author> Christian Lippka </author> + <name> todo </name> + <description> + This component provides ... + </description> + <loader-name> com.sun.star.loader.SharedLibrary </loader-name> + <language> c++ </language> + <status value="draft"/> + <supported-service> </supported-service> + <service-dependency> ... </service-dependency> + <type> ... </type> + </component-description> + + <project-build-dependency> cppuhelper </project-build-dependency> + <project-build-dependency> cppu </project-build-dependency> + <project-build-dependency> vos </project-build-dependency> + <project-build-dependency> sal </project-build-dependency> + + <runtime-module-dependency> cppuhelper </runtime-module-dependency> + <runtime-module-dependency> cppu2 </runtime-module-dependency> + <runtime-module-dependency> vos2MSC </runtime-module-dependency> + <runtime-module-dependency> sal2 </runtime-module-dependency> +</module-description> + diff --git a/animations/source/animcore/factreg.cxx b/animations/source/animcore/factreg.cxx new file mode 100644 index 000000000000..621f9a6ed751 --- /dev/null +++ b/animations/source/animcore/factreg.cxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * $RCSfile: factreg.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2004-11-29 10:36:51 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#include <osl/diagnose.h> +#include <cppuhelper/factory.hxx> +#include <cppuhelper/implementationentry.hxx> + +#include <com/sun/star/registry/XRegistryKey.hpp> + +using namespace ::rtl; +using namespace ::cppu; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; + +#include "factreg.hxx" + +namespace animcore +{ + rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT; +} + +using namespace animcore; + +#define IMPLEMENTATION_ENTRY(N)\ +{\ + createInstance_##N, getImplementationName_##N ,\ + getSupportedServiceNames_##N, createSingleComponentFactory ,\ + &g_moduleCount.modCnt , 0\ +}\ + +static struct ImplementationEntry g_entries[] = +{ + IMPLEMENTATION_ENTRY( PAR ), + IMPLEMENTATION_ENTRY( SEQ ), + IMPLEMENTATION_ENTRY( ITERATE ), + IMPLEMENTATION_ENTRY( ANIMATE ), + IMPLEMENTATION_ENTRY( SET ), + IMPLEMENTATION_ENTRY( ANIMATECOLOR ), + IMPLEMENTATION_ENTRY( ANIMATEMOTION ), + IMPLEMENTATION_ENTRY( ANIMATETRANSFORM ), + IMPLEMENTATION_ENTRY( TRANSITIONFILTER ), + IMPLEMENTATION_ENTRY( AUDIO ), + IMPLEMENTATION_ENTRY( COMMAND ), + IMPLEMENTATION_ENTRY( TargetPropertiesCreator ), + { 0, 0, 0, 0, 0, 0 } +}; + +extern "C" +{ + +sal_Bool SAL_CALL component_canUnload( TimeValue *pTime ) +{ + return g_moduleCount.canUnload( &g_moduleCount , pTime ); +} + +//================================================================================================== +void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} +//================================================================================================== +sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey ) +{ + return component_writeInfoHelper( pServiceManager, pRegistryKey, g_entries ); +} +//================================================================================================== +void * SAL_CALL component_getFactory( + const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries ); +} + +} diff --git a/animations/source/animcore/factreg.hxx b/animations/source/animcore/factreg.hxx new file mode 100644 index 000000000000..120f79692d4a --- /dev/null +++ b/animations/source/animcore/factreg.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * $RCSfile: factreg.hxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2004-11-29 10:36:52 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ +#ifndef _RTL_UNLOAD_H_ +#include <rtl/unload.h> +#endif + +namespace animcore { + +extern rtl_StandardModuleCount g_moduleCount; + +#define DECL_NODE_FACTORY(N)\ +extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstance_##N( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rSMgr ) throw (::com::sun::star::uno::Exception);\ +extern ::rtl::OUString getImplementationName_##N();\ +extern ::com::sun::star::uno::Sequence< ::rtl::OUString> getSupportedServiceNames_##N(void) + +DECL_NODE_FACTORY( PAR ); +DECL_NODE_FACTORY( SEQ ); +DECL_NODE_FACTORY( ITERATE ); +DECL_NODE_FACTORY( ANIMATE ); +DECL_NODE_FACTORY( SET ); +DECL_NODE_FACTORY( ANIMATECOLOR ); +DECL_NODE_FACTORY( ANIMATEMOTION ); +DECL_NODE_FACTORY( ANIMATETRANSFORM ); +DECL_NODE_FACTORY( TRANSITIONFILTER ); +DECL_NODE_FACTORY( AUDIO ); +DECL_NODE_FACTORY( COMMAND ); +DECL_NODE_FACTORY( TargetPropertiesCreator ); + +} diff --git a/animations/source/animcore/makefile.mk b/animations/source/animcore/makefile.mk new file mode 100644 index 000000000000..6c9d2703734e --- /dev/null +++ b/animations/source/animcore/makefile.mk @@ -0,0 +1,105 @@ +#************************************************************************* +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.2 $ +# +# last change: $Author: rt $ $Date: 2004-11-29 10:36:52 $ +# +# The Contents of this file are made available subject to the terms of +# either of the following licenses +# +# - GNU Lesser General Public License Version 2.1 +# - Sun Industry Standards Source License Version 1.1 +# +# Sun Microsystems Inc., October, 2000 +# +# GNU Lesser General Public License Version 2.1 +# ============================================= +# Copyright 2000 by Sun Microsystems, Inc. +# 901 San Antonio Road, Palo Alto, CA 94303, USA +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License version 2.1, as published by the Free Software Foundation. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +# +# Sun Industry Standards Source License Version 1.1 +# ================================================= +# The contents of this file are subject to the Sun Industry Standards +# Source License Version 1.1 (the "License"); You may not use this file +# except in compliance with the License. You may obtain a copy of the +# License at http://www.openoffice.org/license.html. +# +# Software provided under this License is provided on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, +# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, +# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. +# See the License for the specific provisions governing your rights and +# obligations concerning the Software. +# +# The Initial Developer of the Original Code is: Sun Microsystems, Inc. +# +# Copyright: 2000 by Sun Microsystems, Inc. +# +# All Rights Reserved. +# +# Contributor(s): _______________________________________ +# +# +# +#************************************************************************* +PRJ=..$/.. + +PRJNAME=animations +TARGET=animcore +ENABLE_EXCEPTIONS=TRUE +NO_BSYMBOLIC=TRUE +#COMP1TYPELIST=$(TARGET) +#COMPRDB=$(SOLARBINDIR)$/offapi.rdb + +# --- Settings ----------------------------------------------------- +.INCLUDE : svpre.mk +.INCLUDE : settings.mk +.INCLUDE : sv.mk +# --- Files -------------------------------------------------------- +#UNOUCRDEP=$(SOLARBINDIR)$/offapi.rdb +#UNOUCRRDB=$(SOLARBINDIR)$/offapi.rdb +#UNOUCROUT=$(OUT)$/inc$/animations +#INCPRE+= $(UNOUCROUT) + + +SLOFILES = $(SLO)$/animcore.obj\ + $(SLO)$/factreg.obj\ + $(SLO)$/targetpropertiescreator.obj + +SHL1TARGET= $(TARGET) +SHL1VERSIONMAP= $(TARGET).map + +SHL1STDLIBS= \ + $(SALLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) + + +SHL1DEPN= +SHL1IMPLIB= i$(TARGET) +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) + + +# --- Targets ------------------------------------------------------ +.INCLUDE : target.mk + diff --git a/animations/source/animcore/targetpropertiescreator.cxx b/animations/source/animcore/targetpropertiescreator.cxx new file mode 100644 index 000000000000..8a90cbf964f9 --- /dev/null +++ b/animations/source/animcore/targetpropertiescreator.cxx @@ -0,0 +1,580 @@ +/************************************************************************* + * + * $RCSfile: targetpropertiescreator.cxx,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: rt $ $Date: 2004-11-29 10:36:52 $ + * + * The Contents of this file are made available subject to the terms of + * either of the following licenses + * + * - GNU Lesser General Public License Version 2.1 + * - Sun Industry Standards Source License Version 1.1 + * + * Sun Microsystems Inc., October, 2000 + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2000 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + * + * Sun Industry Standards Source License Version 1.1 + * ================================================= + * The contents of this file are subject to the Sun Industry Standards + * Source License Version 1.1 (the "License"); You may not use this file + * except in compliance with the License. You may obtain a copy of the + * License at http://www.openoffice.org/license.html. + * + * Software provided under this License is provided on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS, + * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING. + * See the License for the specific provisions governing your rights and + * obligations concerning the Software. + * + * The Initial Developer of the Original Code is: Sun Microsystems, Inc. + * + * Copyright: 2000 by Sun Microsystems, Inc. + * + * All Rights Reserved. + * + * Contributor(s): _______________________________________ + * + * + ************************************************************************/ + +#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ +#include <com/sun/star/uno/XComponentContext.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +#include <com/sun/star/lang/XServiceInfo.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ +#include <com/sun/star/lang/XTypeProvider.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XTARGETPROPERTIESCREATOR_HPP_ +#include <com/sun/star/animations/XTargetPropertiesCreator.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XITERATECONTAINER_HPP_ +#include <com/sun/star/animations/XIterateContainer.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_TARGETPROPERTIES_HPP_ +#include <com/sun/star/animations/TargetProperties.hpp> +#endif +#ifndef _COM_SUN_STAR_PRESENTATION_PARAGRAPHTARGET_HPP_ +#include <com/sun/star/presentation/ParagraphTarget.hpp> +#endif +#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_ +#include <com/sun/star/registry/XRegistryKey.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XINITIALIZATION_HPP_ +#include <com/sun/star/lang/XInitialization.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_ +#include <com/sun/star/lang/XServiceName.hpp> +#endif +#ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_ +#include <com/sun/star/drawing/XShape.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_ANIMATIONNODETYPE_HPP_ +#include <com/sun/star/animations/AnimationNodeType.hpp> +#endif +#ifndef _COM_SUN_STAR_ANIMATIONS_XANIMATE_HPP_ +#include <com/sun/star/animations/XAnimate.hpp> +#endif + +#ifndef _CPPUHELPER_COMPBASE3_HXX_ +#include <cppuhelper/compbase3.hxx> +#endif +#ifndef _CPPUHELPER_FACTORY_HXX_ +#include <cppuhelper/factory.hxx> +#endif +#ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_ +#include <cppuhelper/implementationentry.hxx> +#endif + +#ifndef _COMPHELPER_OPTIONALVALUE_HXX +#include <comphelper/optionalvalue.hxx> +#endif +#ifndef _COMPHELPER_BROADCASTHELPER_HXX_ +#include <comphelper/broadcasthelper.hxx> +#endif +#ifndef _COMPHELPER_SEQUENCE_HXX_ +#include <comphelper/sequence.hxx> +#endif + +#include <animations/animationnodehelper.hxx> + +#include <vector> +#include <hash_map> + + +using namespace ::com::sun::star; + +#define IMPLEMENTATION_NAME "animcore::TargetPropertiesCreator" +#define SERVICE_NAME "com.sun.star.animations.TargetPropertiesCreator" + +namespace animcore +{ + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::animations::XTargetPropertiesCreator, + lang::XServiceInfo, + lang::XServiceName > TargetPropertiesCreator_Base; + + class TargetPropertiesCreator : public ::comphelper::OBaseMutex, + public TargetPropertiesCreator_Base + { + public: + static uno::Reference< uno::XInterface > SAL_CALL createInstance( const uno::Reference< uno::XComponentContext >& xContext ) throw ( uno::Exception ) + { + return uno::Reference< uno::XInterface >( static_cast<cppu::OWeakObject*>(new TargetPropertiesCreator( xContext )) ); + } + + /// Dispose all internal references + virtual void SAL_CALL disposing(); + + // XTargetPropertiesCreator + virtual uno::Sequence< animations::TargetProperties > SAL_CALL createInitialTargetProperties( const uno::Reference< animations::XAnimationNode >& rootNode ) throw (uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException ); + virtual uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( uno::RuntimeException ); + + // XServiceName + virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (uno::RuntimeException); + + protected: + ~TargetPropertiesCreator(); // we're a ref-counted UNO class. _We_ destroy ourselves. + + private: + // default: disabled copy/assignment + TargetPropertiesCreator(const TargetPropertiesCreator&); + TargetPropertiesCreator& operator=( const TargetPropertiesCreator& ); + + TargetPropertiesCreator( const uno::Reference< uno::XComponentContext >& rxContext ); + }; + + // -------------------------------------------------------------------- + + uno::Reference< uno::XInterface > SAL_CALL createInstance_TargetPropertiesCreator( const uno::Reference< uno::XComponentContext > & rSMgr ) throw (uno::Exception) + { + return TargetPropertiesCreator::createInstance( rSMgr ); + } + + ::rtl::OUString getImplementationName_TargetPropertiesCreator() + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); + } + + uno::Sequence< ::rtl::OUString > getSupportedServiceNames_TargetPropertiesCreator(void) + { + uno::Sequence< ::rtl::OUString > aRet(1); + aRet.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); + return aRet; + } + + // -------------------------------------------------------------------- + + namespace + { + // Vector containing all properties for a given shape + typedef ::std::vector< beans::NamedValue > VectorOfNamedValues; + + /** The hash map key + + This key contains both XShape reference and a paragraph + index, as we somehow have to handle shape and paragraph + targets with the same data structure. + */ + struct ShapeHashKey + { + /// Shape target + uno::Reference< drawing::XShape > mxRef; + + /** Paragraph index. + + If this is a pure shape target, mnParagraphIndex is + set to -1. + */ + sal_Int16 mnParagraphIndex; + + /// Comparison needed for hash_map + bool operator==( const ShapeHashKey& rRHS ) const + { + return mxRef == rRHS.mxRef && mnParagraphIndex == rRHS.mnParagraphIndex; + } + }; + + // A hash map which maps a XShape to the corresponding vector of initial properties + typedef ::std::hash_map< ShapeHashKey, + VectorOfNamedValues, + ::std::size_t (*)(const ShapeHashKey&) > XShapeHash; + + ::std::size_t refhasher( const ShapeHashKey& rKey ) + { + // TODO(P2): Maybe a better hash function would be to + // spread mnParagraphIndex to 32 bit: a0b0c0d0e0... Hakmem + // should have a formula. + // + // Yes it has: + // x = (x & 0x0000FF00) << 8) | (x >> 8) & 0x0000FF00 | x & 0xFF0000FF; + // x = (x & 0x00F000F0) << 4) | (x >> 4) & 0x00F000F0 | x & 0xF00FF00F; + // x = (x & 0x0C0C0C0C) << 2) | (x >> 2) & 0x0C0C0C0C | x & 0xC3C3C3C3; + // x = (x & 0x22222222) << 1) | (x >> 1) & 0x22222222 | x & 0x99999999; + // + // Costs about 17 cycles on a RISC machine with infinite + // instruction level parallelism (~42 basic + // instructions). Thus I truly doubt this pays off... + return reinterpret_cast< ::std::size_t >(rKey.mxRef.get()) ^ (rKey.mnParagraphIndex << 16L); + } + + + class NodeFunctor + { + public: + explicit NodeFunctor( XShapeHash& rShapeHash ) : + mrShapeHash( rShapeHash ), + mxTargetShape(), + mnParagraphIndex( -1 ) + { + } + + NodeFunctor( XShapeHash& rShapeHash, + const uno::Reference< drawing::XShape >& rTargetShape, + sal_Int16 nParagraphIndex ) : + mrShapeHash( rShapeHash ), + mxTargetShape( rTargetShape ), + mnParagraphIndex( nParagraphIndex ) + { + } + + void operator()( const uno::Reference< animations::XAnimationNode >& xNode ) const + { + if( !xNode.is() ) + { + OSL_ENSURE( false, + "AnimCore: NodeFunctor::operator(): invalid XAnimationNode" ); + return; + } + + uno::Reference< drawing::XShape > xTargetShape( mxTargetShape ); + sal_Int16 nParagraphIndex( mnParagraphIndex ); + + switch( xNode->getType() ) + { + case animations::AnimationNodeType::ITERATE: + { + // extract target shape from iterate node + // (will override the target for all children) + // -------------------------------------------------- + + uno::Reference< animations::XIterateContainer > xIterNode( xNode, + uno::UNO_QUERY ); + + // TODO(E1): I'm not too sure what to expect here... + if( !xIterNode->getTarget().hasValue() ) + { + OSL_ENSURE( false, + "animcore: NodeFunctor::operator(): no target on ITERATE node" ); + return; + } + + xTargetShape.set( xIterNode->getTarget(), + uno::UNO_QUERY ); + + if( !xTargetShape.is() ) + { + ::com::sun::star::presentation::ParagraphTarget aTarget; + + // no shape provided. Maybe a ParagraphTarget? + if( !(xIterNode->getTarget() >>= aTarget) ) + { + OSL_ENSURE( false, + "animcore: NodeFunctor::operator(): could not extract any " + "target information" ); + return; + } + + xTargetShape = aTarget.Shape; + nParagraphIndex = aTarget.Paragraph; + + if( !xTargetShape.is() ) + { + OSL_ENSURE( false, + "animcore: NodeFunctor::operator(): invalid shape in ParagraphTarget" ); + return; + } + } + } + // FALLTHROUGH intended + case animations::AnimationNodeType::PAR: + // FALLTHROUGH intended + case animations::AnimationNodeType::SEQ: + { + NodeFunctor aFunctor( mrShapeHash, + xTargetShape, + nParagraphIndex ); + if( !::anim::for_each_childNode( xNode, + aFunctor ) ) + { + OSL_ENSURE( false, + "AnimCore: NodeFunctor::operator(): child node iteration failed, " + "or extraneous container nodes encountered" ); + } + } + break; + + case animations::AnimationNodeType::CUSTOM: + // FALLTHROUGH intended + case animations::AnimationNodeType::ANIMATE: + // FALLTHROUGH intended + case animations::AnimationNodeType::ANIMATEMOTION: + // FALLTHROUGH intended + case animations::AnimationNodeType::ANIMATECOLOR: + // FALLTHROUGH intended + case animations::AnimationNodeType::ANIMATETRANSFORM: + // FALLTHROUGH intended + case animations::AnimationNodeType::TRANSITIONFILTER: + // FALLTHROUGH intended + case animations::AnimationNodeType::AUDIO: + // FALLTHROUGH intended + default: + // ignore this node, no valuable content for now. + break; + + case animations::AnimationNodeType::SET: + { + // evaluate set node content + uno::Reference< animations::XAnimate > xAnimateNode( xNode, + uno::UNO_QUERY ); + + if( !xAnimateNode.is() ) + break; // invalid node + + // determine target shape (if any) + ShapeHashKey aTarget; + if( xTargetShape.is() ) + { + // override target shape with parent-supplied + aTarget.mxRef = xTargetShape; + aTarget.mnParagraphIndex = nParagraphIndex; + } + else + { + // no parent-supplied target, retrieve + // node target + if( (xAnimateNode->getTarget() >>= aTarget.mxRef) ) + { + // pure shape target - set paragraph + // index to magic + aTarget.mnParagraphIndex = -1; + } + else + { + // not a pure shape target - maybe a + // ParagraphTarget? + presentation::ParagraphTarget aUnoTarget; + + if( !(xAnimateNode->getTarget() >>= aUnoTarget) ) + { + OSL_ENSURE( false, + "AnimCore: NodeFunctor::operator(): unknown target type encountered" ); + break; + } + + aTarget.mxRef = aUnoTarget.Shape; + aTarget.mnParagraphIndex = aUnoTarget.Paragraph; + } + } + + if( !aTarget.mxRef.is() ) + { + OSL_ENSURE( false, + "AnimCore: NodeFunctor::operator(): Found target, but XShape is NULL" ); + break; // invalid target XShape + } + + // check whether we already have an entry for + // this target (we only take the first set + // effect for every shape) + XShapeHash::const_iterator aIter; + if( (aIter=mrShapeHash.find( aTarget )) != mrShapeHash.end() ) + break; // already an entry in existence for given XShape + + // if this is an appear effect, hide shape + // initially. This is currently the only place + // where a shape effect influences shape + // attributes outside it's effective duration. + if( xAnimateNode->getAttributeName().equalsIgnoreAsciiCaseAscii("visibility") ) + { + sal_Bool bVisible( sal_False ); + + uno::Any aAny( xAnimateNode->getTo() ); + + // try to extract bool value + if( !(aAny >>= bVisible) ) + { + // try to extract string + ::rtl::OUString aString; + if( (aAny >>= aString) ) + { + // we also take the strings "true" and "false", + // as well as "on" and "off" here + if( aString.equalsIgnoreAsciiCaseAscii("true") || + aString.equalsIgnoreAsciiCaseAscii("on") ) + { + bVisible = sal_True; + } + if( aString.equalsIgnoreAsciiCaseAscii("false") || + aString.equalsIgnoreAsciiCaseAscii("off") ) + { + bVisible = sal_False; + } + } + } + + if( bVisible ) + { + // target is set to 'visible' at the + // first relevant effect. Thus, target + // must be initially _hidden_, for the + // effect to have visible impact. + mrShapeHash.insert( + XShapeHash::value_type( + aTarget, + VectorOfNamedValues( + 1, + beans::NamedValue( + xAnimateNode->getAttributeName(), + uno::makeAny( sal_False ) ) ) ) ); + } + } + } + break; + } + } + + private: + XShapeHash& mrShapeHash; + uno::Reference< drawing::XShape > mxTargetShape; + sal_Int16 mnParagraphIndex; + }; + } + + // -------------------------------------------------------------------- + + TargetPropertiesCreator::TargetPropertiesCreator( const uno::Reference< uno::XComponentContext >& rxContext ) : + TargetPropertiesCreator_Base( m_aMutex ) + { + } + + TargetPropertiesCreator::~TargetPropertiesCreator() + { + } + + void SAL_CALL TargetPropertiesCreator::disposing() + { + ::osl::MutexGuard aGuard( m_aMutex ); + } + + // XTargetPropertiesCreator + uno::Sequence< animations::TargetProperties > SAL_CALL TargetPropertiesCreator::createInitialTargetProperties + ( + const uno::Reference< animations::XAnimationNode >& xRootNode + ) throw (uno::RuntimeException) + { + ::osl::MutexGuard aGuard( m_aMutex ); + + // scan all nodes for visibility changes, and record first + // 'visibility=true' for each shape + XShapeHash aShapeHash( 101, + &refhasher ); + + NodeFunctor aFunctor( aShapeHash ); + + // TODO(F1): Maybe limit functor application to main sequence + // alone (CL said something that shape visibility is only + // affected by effects in the main sequence for PPT). + // + // OTOH, client code can pass us only the main sequence (which + // it actually does right now, for the slideshow implementation). + aFunctor( xRootNode ); + + + // output to result sequence + // ---------------------------------------------------------------------- + + uno::Sequence< animations::TargetProperties > aRes( aShapeHash.size() ); + + ::std::size_t nCurrIndex(0); + XShapeHash::const_iterator aCurr( aShapeHash.begin() ); + const XShapeHash::const_iterator aEnd ( aShapeHash.end() ); + while( aCurr != aEnd ) + { + animations::TargetProperties& rCurrProps( aRes[ nCurrIndex++ ] ); + + if( aCurr->first.mnParagraphIndex == -1 ) + { + rCurrProps.Target = uno::makeAny( aCurr->first.mxRef ); + } + else + { + rCurrProps.Target = uno::makeAny( + presentation::ParagraphTarget( + aCurr->first.mxRef, + aCurr->first.mnParagraphIndex ) ); + } + + rCurrProps.Properties = ::comphelper::containerToSequence< beans::NamedValue >( aCurr->second ); + + ++aCurr; + } + + return aRes; + } + + // XServiceInfo + ::rtl::OUString SAL_CALL TargetPropertiesCreator::getImplementationName() throw( uno::RuntimeException ) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLEMENTATION_NAME ) ); + } + + sal_Bool SAL_CALL TargetPropertiesCreator::supportsService( const ::rtl::OUString& ServiceName ) throw( uno::RuntimeException ) + { + return ServiceName.equalsIgnoreAsciiCaseAscii( SERVICE_NAME ); + } + + uno::Sequence< ::rtl::OUString > SAL_CALL TargetPropertiesCreator::getSupportedServiceNames() throw( uno::RuntimeException ) + { + uno::Sequence< ::rtl::OUString > aRet(1); + aRet[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); + + return aRet; + } + + // XServiceName + ::rtl::OUString SAL_CALL TargetPropertiesCreator::getServiceName( ) throw (uno::RuntimeException) + { + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICE_NAME ) ); + } + +}; // namespace animcore |