diff options
author | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-06-27 14:32:04 +0000 |
---|---|---|
committer | Jens-Heiner Rechtien <hr@openoffice.org> | 2007-06-27 14:32:04 +0000 |
commit | 6ed55380a134e6f3d10b36a593237a0335977be2 (patch) | |
tree | 1c3a7c3aba51a9824afd805f6b4d8fc0ca760b49 /xmloff/source/draw/animationimport.cxx | |
parent | 00c54972bfb2c1d5cb3eed349e96d016d2948867 (diff) |
INTEGRATION: CWS impress122 (1.10.38); FILE MERGED
2007/06/14 09:57:18 cl 1.10.38.1: #i24969# moved slide transition and sound to smil timing root node
Diffstat (limited to 'xmloff/source/draw/animationimport.cxx')
-rw-r--r-- | xmloff/source/draw/animationimport.cxx | 88 |
1 files changed, 86 insertions, 2 deletions
diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index a0f9e4f9ae7f..44c3a8957eec 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -4,9 +4,9 @@ * * $RCSfile: animationimport.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: hr $ $Date: 2007-06-27 15:01:02 $ + * last change: $Author: hr $ $Date: 2007-06-27 15:32:04 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -118,6 +118,9 @@ #ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_ #include <com/sun/star/container/XEnumerationAccess.hpp> #endif +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/animations/EventTrigger.hpp> +#include <com/sun/star/presentation/EffectCommands.hpp> #ifndef _COMPHELPER_PROCESSFACTORY_HXX_ #include <comphelper/processfactory.hxx> @@ -168,6 +171,7 @@ using namespace ::rtl; using namespace ::std; using namespace ::cppu; +using namespace ::com::sun::star::beans; using namespace ::com::sun::star::animations; using namespace ::com::sun::star::presentation; using namespace ::com::sun::star::drawing; @@ -377,6 +381,7 @@ const SvXMLTokenMap& AnimationsImportHelperImpl::getAnimationNodeAttributeTokenM { XML_NAMESPACE_ANIMATION, XML_ITERATE_INTERVAL, (sal_uInt16)ANA_IterateInterval }, { XML_NAMESPACE_ANIMATION, XML_FORMULA, (sal_uInt16)ANA_Formula }, { XML_NAMESPACE_ANIMATION, XML_ID, (sal_uInt16)ANA_ID }, + { XML_NAMESPACE_XML, XML_ID, (sal_uInt16)ANA_ID }, { XML_NAMESPACE_PRESENTATION, XML_GROUP_ID, (sal_uInt16)ANA_Group_Id }, { XML_NAMESPACE_ANIMATION, XML_AUDIO_LEVEL, (sal_uInt16)ANA_Volume }, { XML_NAMESPACE_ANIMATION, XML_COMMAND, (sal_uInt16)ANA_Command }, @@ -1471,6 +1476,85 @@ Reference< XAnimationNode > SAL_CALL AnimationsImport::getAnimationNode() throw return mxRootNode; } +void AnimationNodeContext::postProcessRootNode( SvXMLImport& /*rImport*/, const Reference< XAnimationNode >& xRootNode, Reference< XPropertySet >& xPageProps ) +{ + if( xRootNode.is() && xPageProps.is() ) try + { + Reference< XEnumerationAccess > xEnumerationAccess( xRootNode, UNO_QUERY_THROW ); + Reference< XEnumeration > xEnumeration( xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW ); + if( xEnumeration->hasMoreElements() ) + { + Reference< XAnimationNode > xNode( xEnumeration->nextElement(), UNO_QUERY_THROW ); + if( xNode->getType() == AnimationNodeType::PAR ) + { + Event aEvent; + if( (xNode->getBegin() >>= aEvent) && (aEvent.Trigger == EventTrigger::BEGIN_EVENT) ) + { + // found transition node + Reference< XEnumerationAccess > xChildEnumerationAccess( xNode, UNO_QUERY_THROW ); + Reference< XEnumeration > xChildEnumeration( xChildEnumerationAccess->createEnumeration(), UNO_QUERY_THROW ); + while( xChildEnumeration->hasMoreElements() ) + { + Reference< XAnimationNode > xChildNode( xChildEnumeration->nextElement(), UNO_QUERY_THROW ); + switch( xChildNode->getType() ) + { + case AnimationNodeType::TRANSITIONFILTER: + { + Reference< XTransitionFilter > xTransFilter( xChildNode, UNO_QUERY_THROW ); + + + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionType" ) ), Any( xTransFilter->getTransition() ) ); + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionSubtype" ) ), Any( xTransFilter->getSubtype() ) ); + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDirection" ) ), Any( xTransFilter->getDirection() ) ); + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionFadeColor" ) ), Any( xTransFilter->getFadeColor() ) ); + + double fDuration; + if( xTransFilter->getDuration() >>= fDuration ) + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TransitionDuration" ) ), Any( fDuration ) ); + + } + break; + + case AnimationNodeType::COMMAND: + { + Reference< XCommand > xCommand( xChildNode, UNO_QUERY_THROW ); + if( xCommand->getCommand() == EffectCommands::STOPAUDIO ) + { + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ), Any(sal_True) ); + } + } + break; + + case AnimationNodeType::AUDIO: + { + Reference< XAudio > xAudio( xChildNode, UNO_QUERY_THROW ); + OUString sSoundURL; + if( (xAudio->getSource() >>= sSoundURL) && (sSoundURL.getLength() != 0) ) + { + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Sound" ) ), Any(sSoundURL) ); + + Timing eTiming; + if( (xAudio->getRepeatCount() >>= eTiming) && (eTiming == Timing_INDEFINITE) ) + xPageProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "LoopSound" ) ), Any( sal_True ) ); + } + } + break; + + } + } + + Reference< XTimeContainer > xRootContainer( xRootNode, UNO_QUERY_THROW ); + xRootContainer->removeChild( xNode ); + } + } + } + } + catch( Exception& ) + { + DBG_ERROR("xmloff::AnimationsImport::postProcessRootNode(), exception caught!"); + } +} + } // namespace xmloff Sequence< OUString > SAL_CALL AnimationsImport_getSupportedServiceNames() throw() |