1*ca5ec200SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ca5ec200SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ca5ec200SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ca5ec200SAndrew Rist * distributed with this work for additional information 6*ca5ec200SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ca5ec200SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ca5ec200SAndrew Rist * "License"); you may not use this file except in compliance 9*ca5ec200SAndrew Rist * with the License. You may obtain a copy of the License at 10*ca5ec200SAndrew Rist * 11*ca5ec200SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ca5ec200SAndrew Rist * 13*ca5ec200SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ca5ec200SAndrew Rist * software distributed under the License is distributed on an 15*ca5ec200SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ca5ec200SAndrew Rist * KIND, either express or implied. See the License for the 17*ca5ec200SAndrew Rist * specific language governing permissions and limitations 18*ca5ec200SAndrew Rist * under the License. 19*ca5ec200SAndrew Rist * 20*ca5ec200SAndrew Rist *************************************************************/ 21*ca5ec200SAndrew Rist 22*ca5ec200SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "oox/ppt/timenode.hxx" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <boost/bind.hpp> 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp> 29cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp> 31cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 32cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp> 33cdf0e10cSrcweir #include <com/sun/star/animations/XAnimateColor.hpp> 34cdf0e10cSrcweir #include <com/sun/star/animations/XAnimateMotion.hpp> 35cdf0e10cSrcweir #include <com/sun/star/animations/XAnimateTransform.hpp> 36cdf0e10cSrcweir #include <com/sun/star/animations/XCommand.hpp> 37cdf0e10cSrcweir #include <com/sun/star/animations/XIterateContainer.hpp> 38cdf0e10cSrcweir #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> 39cdf0e10cSrcweir #include <com/sun/star/animations/XTimeContainer.hpp> 40cdf0e10cSrcweir #include <com/sun/star/animations/AnimationNodeType.hpp> 41cdf0e10cSrcweir #include <com/sun/star/animations/Event.hpp> 42cdf0e10cSrcweir #include <com/sun/star/animations/EventTrigger.hpp> 43cdf0e10cSrcweir #include <com/sun/star/presentation/EffectNodeType.hpp> 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include "oox/helper/helper.hxx" 46cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx" 47cdf0e10cSrcweir 48cdf0e10cSrcweir using ::rtl::OUString; 49cdf0e10cSrcweir using namespace ::oox::core; 50cdf0e10cSrcweir using namespace ::com::sun::star::beans; 51cdf0e10cSrcweir using namespace ::com::sun::star::container; 52cdf0e10cSrcweir using namespace ::com::sun::star::uno; 53cdf0e10cSrcweir using namespace ::com::sun::star::lang; 54cdf0e10cSrcweir using namespace ::com::sun::star::animations; 55cdf0e10cSrcweir using namespace ::com::sun::star::frame; 56cdf0e10cSrcweir using namespace ::com::sun::star::presentation; 57cdf0e10cSrcweir 58cdf0e10cSrcweir namespace oox { namespace ppt { 59cdf0e10cSrcweir getServiceName(sal_Int16 nNodeType)60cdf0e10cSrcweir OUString TimeNode::getServiceName( sal_Int16 nNodeType ) 61cdf0e10cSrcweir { 62cdf0e10cSrcweir OUString sServiceName; 63cdf0e10cSrcweir switch( nNodeType ) 64cdf0e10cSrcweir { 65cdf0e10cSrcweir case AnimationNodeType::PAR: 66cdf0e10cSrcweir // sServiceName = CREATE_OUSTRING("com.sun.star.animations.IterateContainer"); 67cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.ParallelTimeContainer"); 68cdf0e10cSrcweir break; 69cdf0e10cSrcweir case AnimationNodeType::SEQ: 70cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.SequenceTimeContainer"); 71cdf0e10cSrcweir break; 72cdf0e10cSrcweir case AnimationNodeType::ANIMATE: 73cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.Animate"); 74cdf0e10cSrcweir break; 75cdf0e10cSrcweir case AnimationNodeType::ANIMATECOLOR: 76cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.AnimateColor"); 77cdf0e10cSrcweir break; 78cdf0e10cSrcweir case AnimationNodeType::TRANSITIONFILTER: 79cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.TransitionFilter"); 80cdf0e10cSrcweir break; 81cdf0e10cSrcweir case AnimationNodeType::ANIMATEMOTION: 82cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.AnimateMotion"); 83cdf0e10cSrcweir break; 84cdf0e10cSrcweir case AnimationNodeType::ANIMATETRANSFORM: 85cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.AnimateTransform"); 86cdf0e10cSrcweir break; 87cdf0e10cSrcweir case AnimationNodeType::COMMAND: 88cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.Command"); 89cdf0e10cSrcweir break; 90cdf0e10cSrcweir case AnimationNodeType::SET: 91cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.AnimateSet"); 92cdf0e10cSrcweir break; 93cdf0e10cSrcweir case AnimationNodeType::AUDIO: 94cdf0e10cSrcweir sServiceName = CREATE_OUSTRING("com.sun.star.animations.Audio"); 95cdf0e10cSrcweir break; 96cdf0e10cSrcweir default: 97cdf0e10cSrcweir OSL_TRACE( "OOX: uhandled type %x", nNodeType ); 98cdf0e10cSrcweir break; 99cdf0e10cSrcweir } 100cdf0e10cSrcweir return sServiceName; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir 103cdf0e10cSrcweir 104cdf0e10cSrcweir TimeNode(sal_Int16 nNodeType)105cdf0e10cSrcweir TimeNode::TimeNode( sal_Int16 nNodeType ) 106cdf0e10cSrcweir : mnNodeType( nNodeType ) 107cdf0e10cSrcweir , mbHasEndSyncValue( false ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir } 110cdf0e10cSrcweir 111cdf0e10cSrcweir ~TimeNode()112cdf0e10cSrcweir TimeNode::~TimeNode() 113cdf0e10cSrcweir { 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir // BEGIN CUT&PASTE from sd/source/filter/ppt/pptinanimations.hxx 117cdf0e10cSrcweir // -------------------------------------------------------------------- fixMainSequenceTiming(const::com::sun::star::uno::Reference<::com::sun::star::animations::XAnimationNode> & xNode)118cdf0e10cSrcweir static void fixMainSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) 119cdf0e10cSrcweir { 120cdf0e10cSrcweir try 121cdf0e10cSrcweir { 122cdf0e10cSrcweir bool bFirst = true; 123cdf0e10cSrcweir Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW ); 124cdf0e10cSrcweir Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW ); 125cdf0e10cSrcweir while( xE->hasMoreElements() ) 126cdf0e10cSrcweir { 127cdf0e10cSrcweir // click node 128cdf0e10cSrcweir Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY ); 129cdf0e10cSrcweir 130cdf0e10cSrcweir Event aEvent; 131cdf0e10cSrcweir aEvent.Trigger = EventTrigger::ON_NEXT; 132cdf0e10cSrcweir aEvent.Repeat = 0; 133cdf0e10cSrcweir xClickNode->setBegin( makeAny( aEvent ) ); 134cdf0e10cSrcweir 135cdf0e10cSrcweir if( bFirst ) 136cdf0e10cSrcweir { 137cdf0e10cSrcweir bFirst = false; 138cdf0e10cSrcweir Reference< XEnumerationAccess > xEA2( xClickNode, UNO_QUERY_THROW ); 139cdf0e10cSrcweir Reference< XEnumeration > xE2( xEA2->createEnumeration(), UNO_QUERY_THROW ); 140cdf0e10cSrcweir if( xE2->hasMoreElements() ) 141cdf0e10cSrcweir { 142cdf0e10cSrcweir // with node 143cdf0e10cSrcweir xE2->nextElement() >>= xEA2; 144cdf0e10cSrcweir if( xEA2.is() ) 145cdf0e10cSrcweir xE2.query( xEA2->createEnumeration() ); 146cdf0e10cSrcweir else 147cdf0e10cSrcweir xE2.clear(); 148cdf0e10cSrcweir 149cdf0e10cSrcweir if( xE2.is() && xE2->hasMoreElements() ) 150cdf0e10cSrcweir { 151cdf0e10cSrcweir Reference< XAnimationNode > xEffectNode( xE2->nextElement(), UNO_QUERY_THROW ); 152cdf0e10cSrcweir const Sequence< NamedValue > aUserData( xEffectNode->getUserData() ); 153cdf0e10cSrcweir const NamedValue* p = aUserData.getConstArray(); 154cdf0e10cSrcweir sal_Int32 nLength = aUserData.getLength(); 155cdf0e10cSrcweir while( nLength-- ) 156cdf0e10cSrcweir { 157cdf0e10cSrcweir if( p->Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "node-type" ) ) ) 158cdf0e10cSrcweir { 159cdf0e10cSrcweir sal_Int16 nNodeType = 0; 160cdf0e10cSrcweir p->Value >>= nNodeType; 161cdf0e10cSrcweir if( nNodeType != ::com::sun::star::presentation::EffectNodeType::ON_CLICK ) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir // first effect does not start on click, so correct 164cdf0e10cSrcweir // first click nodes begin to 0s 165cdf0e10cSrcweir xClickNode->setBegin( makeAny( (double)0.0 ) ); 166cdf0e10cSrcweir break; 167cdf0e10cSrcweir } 168cdf0e10cSrcweir } 169cdf0e10cSrcweir p++; 170cdf0e10cSrcweir } 171cdf0e10cSrcweir } 172cdf0e10cSrcweir } 173cdf0e10cSrcweir } 174cdf0e10cSrcweir } 175cdf0e10cSrcweir } 176cdf0e10cSrcweir catch( Exception& e ) 177cdf0e10cSrcweir { 178cdf0e10cSrcweir (void)e; 179cdf0e10cSrcweir OSL_TRACE("fixMainSequenceTiming(), exception caught!" ); 180cdf0e10cSrcweir } 181cdf0e10cSrcweir } 182cdf0e10cSrcweir 183cdf0e10cSrcweir // -------------------------------------------------------------------- 184cdf0e10cSrcweir fixInteractiveSequenceTiming(const::com::sun::star::uno::Reference<::com::sun::star::animations::XAnimationNode> & xNode)185cdf0e10cSrcweir static void fixInteractiveSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) 186cdf0e10cSrcweir { 187cdf0e10cSrcweir try 188cdf0e10cSrcweir { 189cdf0e10cSrcweir Any aBegin( xNode->getBegin() ); 190cdf0e10cSrcweir Any aEmpty; 191cdf0e10cSrcweir xNode->setBegin( aEmpty ); 192cdf0e10cSrcweir 193cdf0e10cSrcweir Reference< XEnumerationAccess > xEA( xNode, UNO_QUERY_THROW ); 194cdf0e10cSrcweir Reference< XEnumeration > xE( xEA->createEnumeration(), UNO_QUERY_THROW ); 195cdf0e10cSrcweir while( xE->hasMoreElements() ) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir // click node 198cdf0e10cSrcweir Reference< XAnimationNode > xClickNode( xE->nextElement(), UNO_QUERY ); 199cdf0e10cSrcweir xClickNode->setBegin( aBegin ); 200cdf0e10cSrcweir } 201cdf0e10cSrcweir } 202cdf0e10cSrcweir catch( Exception& e ) 203cdf0e10cSrcweir { 204cdf0e10cSrcweir (void)e; 205cdf0e10cSrcweir OSL_TRACE("fixInteractiveSequenceTiming(), exception caught!" ); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir } 208cdf0e10cSrcweir 209cdf0e10cSrcweir // END CUT&PASTE 210cdf0e10cSrcweir addNode(const XmlFilterBase & rFilter,const Reference<XAnimationNode> & rxNode,const SlidePersistPtr & pSlide)211cdf0e10cSrcweir void TimeNode::addNode( const XmlFilterBase& rFilter, const Reference< XAnimationNode >& rxNode, const SlidePersistPtr & pSlide ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir try { 214cdf0e10cSrcweir OUString sServiceName = getServiceName( mnNodeType ); 215cdf0e10cSrcweir Reference< XAnimationNode > xNode = createAndInsert( rFilter, sServiceName, rxNode ); 216cdf0e10cSrcweir setNode( rFilter, xNode, pSlide ); 217cdf0e10cSrcweir } 218cdf0e10cSrcweir catch( const Exception& e ) 219cdf0e10cSrcweir { 220cdf0e10cSrcweir OSL_TRACE( "OOX: exception raised in TimeNode::addNode() - %s", 221cdf0e10cSrcweir OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); 222cdf0e10cSrcweir } 223cdf0e10cSrcweir } 224cdf0e10cSrcweir setNode(const XmlFilterBase & rFilter,const Reference<XAnimationNode> & xNode,const SlidePersistPtr & pSlide)225cdf0e10cSrcweir void TimeNode::setNode( const XmlFilterBase& rFilter, const Reference< XAnimationNode >& xNode, const SlidePersistPtr & pSlide ) 226cdf0e10cSrcweir { 227cdf0e10cSrcweir OSL_ENSURE( xNode.is(), "null node passed" ); 228cdf0e10cSrcweir 229cdf0e10cSrcweir try { 230cdf0e10cSrcweir if( msId.getLength() ) 231cdf0e10cSrcweir { 232cdf0e10cSrcweir pSlide->getAnimNodesMap()[ msId ] = xNode; 233cdf0e10cSrcweir } 234cdf0e10cSrcweir 235cdf0e10cSrcweir if( mpTarget ) 236cdf0e10cSrcweir { 237cdf0e10cSrcweir sal_Int16 nSubType; 238cdf0e10cSrcweir maNodeProperties[ NP_TARGET ] = mpTarget->convert( pSlide, nSubType ); 239cdf0e10cSrcweir if( mpTarget->mnType == XML_spTgt ) 240cdf0e10cSrcweir { 241cdf0e10cSrcweir maNodeProperties[ NP_SUBITEM ] <<= nSubType; 242cdf0e10cSrcweir } 243cdf0e10cSrcweir } 244cdf0e10cSrcweir 245cdf0e10cSrcweir if( !maStCondList.empty() ) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir Any aAny = AnimationCondition::convertList( pSlide, maStCondList ); 248cdf0e10cSrcweir if( aAny.hasValue() ) 249cdf0e10cSrcweir { 250cdf0e10cSrcweir xNode->setBegin( aAny ); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir } 254cdf0e10cSrcweir if( !maEndCondList.empty() ) 255cdf0e10cSrcweir { 256cdf0e10cSrcweir Any aAny = AnimationCondition::convertList( pSlide, maEndCondList ); 257cdf0e10cSrcweir if( aAny.hasValue() ) 258cdf0e10cSrcweir { 259cdf0e10cSrcweir xNode->setEnd( aAny ); 260cdf0e10cSrcweir } 261cdf0e10cSrcweir } 262cdf0e10cSrcweir #if 0 // FIXME even the binary filter has this disabled. 263cdf0e10cSrcweir if( !maNextCondList.empty() ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir Any aAny = AnimationCondition::convertList( pSlide, maNextCondList ); 266cdf0e10cSrcweir if( aAny.hasValue() ) 267cdf0e10cSrcweir { 268cdf0e10cSrcweir xNode->setNext( aAny ); 269cdf0e10cSrcweir } 270cdf0e10cSrcweir } 271cdf0e10cSrcweir if( !maPrevCondList.empty() ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir Any aAny = AnimationCondition::convertList( pSlide, maPrevCondList ); 274cdf0e10cSrcweir if( aAny.hasValue() ) 275cdf0e10cSrcweir { 276cdf0e10cSrcweir xNode->setPrev( aAny ); 277cdf0e10cSrcweir } 278cdf0e10cSrcweir } 279cdf0e10cSrcweir #endif 280cdf0e10cSrcweir if( mbHasEndSyncValue ) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir Any aValue = maEndSyncValue.convert( pSlide ); 283cdf0e10cSrcweir xNode->setEndSync(aValue); 284cdf0e10cSrcweir } 285cdf0e10cSrcweir 286cdf0e10cSrcweir if( !maUserData.empty() ) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir Sequence< NamedValue > aUserDataSeq( static_cast< sal_Int32 >( maUserData.size() ) ); 289cdf0e10cSrcweir NamedValue* pValues = aUserDataSeq.getArray(); 290cdf0e10cSrcweir for( UserDataMap::const_iterator aIt = maUserData.begin(), aEnd = maUserData.end(); aIt != aEnd; ++aIt, ++pValues ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir pValues->Name = aIt->first; 293cdf0e10cSrcweir pValues->Value = aIt->second; 294cdf0e10cSrcweir } 295cdf0e10cSrcweir maNodeProperties[ NP_USERDATA ] <<= aUserDataSeq; 296cdf0e10cSrcweir } 297cdf0e10cSrcweir 298cdf0e10cSrcweir Reference< XAnimate > xAnimate( xNode, UNO_QUERY ); 299cdf0e10cSrcweir Reference< XAnimateColor > xAnimateColor( xNode, UNO_QUERY ); 300cdf0e10cSrcweir Reference< XAnimateMotion > xAnimateMotion( xNode, UNO_QUERY ); 301cdf0e10cSrcweir Reference< XAnimateTransform > xAnimateTransform( xNode, UNO_QUERY ); 302cdf0e10cSrcweir Reference< XCommand > xCommand( xNode, UNO_QUERY ); 303cdf0e10cSrcweir Reference< XIterateContainer > xIterateContainer( xNode, UNO_QUERY ); 304cdf0e10cSrcweir sal_Int16 nInt16 = 0; 305cdf0e10cSrcweir sal_Bool bBool = sal_False; 306cdf0e10cSrcweir double fDouble = 0; 307cdf0e10cSrcweir OUString sString; 308cdf0e10cSrcweir Sequence< NamedValue > aSeq; 309cdf0e10cSrcweir 310cdf0e10cSrcweir for( int i = 0; i < _NP_SIZE; i++) 311cdf0e10cSrcweir { 312cdf0e10cSrcweir Any & aValue( maNodeProperties[ i ] ); 313cdf0e10cSrcweir if( aValue.hasValue() ) 314cdf0e10cSrcweir { 315cdf0e10cSrcweir switch( i ) 316cdf0e10cSrcweir { 317cdf0e10cSrcweir case NP_TO: 318cdf0e10cSrcweir if( xAnimate.is() ) 319cdf0e10cSrcweir xAnimate->setTo( aValue ); 320cdf0e10cSrcweir break; 321cdf0e10cSrcweir case NP_FROM: 322cdf0e10cSrcweir if( xAnimate.is() ) 323cdf0e10cSrcweir xAnimate->setFrom( aValue ); 324cdf0e10cSrcweir break; 325cdf0e10cSrcweir case NP_BY: 326cdf0e10cSrcweir if( xAnimate.is() ) 327cdf0e10cSrcweir xAnimate->setBy( aValue ); 328cdf0e10cSrcweir break; 329cdf0e10cSrcweir case NP_TARGET: 330cdf0e10cSrcweir if( xAnimate.is() ) 331cdf0e10cSrcweir xAnimate->setTarget( aValue ); 332cdf0e10cSrcweir break; 333cdf0e10cSrcweir case NP_SUBITEM: 334cdf0e10cSrcweir if( xAnimate.is() ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir if( aValue >>= nInt16 ) 337cdf0e10cSrcweir xAnimate->setSubItem( nInt16 ); 338cdf0e10cSrcweir else 339cdf0e10cSrcweir { 340cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 341cdf0e10cSrcweir } 342cdf0e10cSrcweir } 343cdf0e10cSrcweir break; 344cdf0e10cSrcweir case NP_ATTRIBUTENAME: 345cdf0e10cSrcweir if( xAnimate.is() ) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir if( aValue >>= sString ) 348cdf0e10cSrcweir xAnimate->setAttributeName( sString ); 349cdf0e10cSrcweir else 350cdf0e10cSrcweir { 351cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 352cdf0e10cSrcweir } 353cdf0e10cSrcweir } 354cdf0e10cSrcweir break; 355cdf0e10cSrcweir case NP_CALCMODE: 356cdf0e10cSrcweir if( xAnimate.is() ) 357cdf0e10cSrcweir { 358cdf0e10cSrcweir if( aValue >>= nInt16 ) 359cdf0e10cSrcweir xAnimate->setCalcMode( nInt16 ); 360cdf0e10cSrcweir else 361cdf0e10cSrcweir { 362cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir } 365cdf0e10cSrcweir break; 366cdf0e10cSrcweir case NP_KEYTIMES: 367cdf0e10cSrcweir if( xAnimate.is() ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir Sequence<double> aKeyTimes; 370cdf0e10cSrcweir if( aValue >>= aKeyTimes ) 371cdf0e10cSrcweir xAnimate->setKeyTimes(aKeyTimes); 372cdf0e10cSrcweir else 373cdf0e10cSrcweir { 374cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 375cdf0e10cSrcweir } 376cdf0e10cSrcweir } 377cdf0e10cSrcweir break; 378cdf0e10cSrcweir case NP_VALUES: 379cdf0e10cSrcweir if( xAnimate.is() ) 380cdf0e10cSrcweir { 381cdf0e10cSrcweir Sequence<Any> aValues; 382cdf0e10cSrcweir if( aValue >>= aValues ) 383cdf0e10cSrcweir xAnimate->setValues(aValues); 384cdf0e10cSrcweir else 385cdf0e10cSrcweir { 386cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 387cdf0e10cSrcweir } 388cdf0e10cSrcweir } 389cdf0e10cSrcweir break; 390cdf0e10cSrcweir case NP_FORMULA: 391cdf0e10cSrcweir if( xAnimate.is() ) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir if( aValue >>= sString ) 394cdf0e10cSrcweir xAnimate->setFormula(sString); 395cdf0e10cSrcweir else 396cdf0e10cSrcweir { 397cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 398cdf0e10cSrcweir } 399cdf0e10cSrcweir } 400cdf0e10cSrcweir break; 401cdf0e10cSrcweir case NP_COLORINTERPOLATION: 402cdf0e10cSrcweir if( xAnimateColor.is() ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir if( aValue >>= nInt16 ) 405cdf0e10cSrcweir xAnimateColor->setColorInterpolation( nInt16 ); 406cdf0e10cSrcweir else 407cdf0e10cSrcweir { 408cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 409cdf0e10cSrcweir } 410cdf0e10cSrcweir } 411cdf0e10cSrcweir break; 412cdf0e10cSrcweir case NP_DIRECTION: 413cdf0e10cSrcweir if( xAnimateColor.is() ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir if( aValue >>= bBool ) 416cdf0e10cSrcweir xAnimateColor->setDirection( bBool ); 417cdf0e10cSrcweir else 418cdf0e10cSrcweir { 419cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 420cdf0e10cSrcweir } 421cdf0e10cSrcweir } 422cdf0e10cSrcweir break; 423cdf0e10cSrcweir case NP_PATH: 424cdf0e10cSrcweir if( xAnimateMotion.is() ) 425cdf0e10cSrcweir xAnimateMotion->setPath( aValue ); 426cdf0e10cSrcweir break; 427cdf0e10cSrcweir case NP_TRANSFORMTYPE: 428cdf0e10cSrcweir if( xAnimateTransform.is() ) 429cdf0e10cSrcweir { 430cdf0e10cSrcweir if( aValue >>= nInt16 ) 431cdf0e10cSrcweir xAnimateTransform->setTransformType( nInt16 ); 432cdf0e10cSrcweir else 433cdf0e10cSrcweir { 434cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 435cdf0e10cSrcweir } 436cdf0e10cSrcweir } 437cdf0e10cSrcweir break; 438cdf0e10cSrcweir case NP_USERDATA: 439cdf0e10cSrcweir if( aValue >>= aSeq ) 440cdf0e10cSrcweir xNode->setUserData( aSeq ); 441cdf0e10cSrcweir else 442cdf0e10cSrcweir { 443cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 444cdf0e10cSrcweir } 445cdf0e10cSrcweir break; 446cdf0e10cSrcweir case NP_ACCELERATION: 447cdf0e10cSrcweir if( aValue >>= fDouble ) 448cdf0e10cSrcweir xNode->setAcceleration( fDouble ); 449cdf0e10cSrcweir else 450cdf0e10cSrcweir { 451cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 452cdf0e10cSrcweir } 453cdf0e10cSrcweir break; 454cdf0e10cSrcweir case NP_DECELERATE: 455cdf0e10cSrcweir if( aValue >>= fDouble ) 456cdf0e10cSrcweir xNode->setDecelerate( fDouble ); 457cdf0e10cSrcweir else 458cdf0e10cSrcweir { 459cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir break; 462cdf0e10cSrcweir case NP_AUTOREVERSE: 463cdf0e10cSrcweir if( aValue >>= bBool ) 464cdf0e10cSrcweir xNode->setAutoReverse( bBool ); 465cdf0e10cSrcweir else 466cdf0e10cSrcweir { 467cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 468cdf0e10cSrcweir } 469cdf0e10cSrcweir break; 470cdf0e10cSrcweir case NP_DURATION: 471cdf0e10cSrcweir xNode->setDuration( aValue ); 472cdf0e10cSrcweir break; 473cdf0e10cSrcweir case NP_FILL: 474cdf0e10cSrcweir if( aValue >>= nInt16 ) 475cdf0e10cSrcweir xNode->setFill( nInt16 ); 476cdf0e10cSrcweir else 477cdf0e10cSrcweir { 478cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 479cdf0e10cSrcweir } 480cdf0e10cSrcweir break; 481cdf0e10cSrcweir case NP_REPEATCOUNT: 482cdf0e10cSrcweir xNode->setRepeatCount( aValue ); 483cdf0e10cSrcweir break; 484cdf0e10cSrcweir case NP_REPEATDURATION: 485cdf0e10cSrcweir xNode->setRepeatDuration( aValue ); 486cdf0e10cSrcweir break; 487cdf0e10cSrcweir case NP_RESTART: 488cdf0e10cSrcweir if( aValue >>= nInt16 ) 489cdf0e10cSrcweir xNode->setRestart( nInt16 ); 490cdf0e10cSrcweir else 491cdf0e10cSrcweir { 492cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 493cdf0e10cSrcweir } 494cdf0e10cSrcweir break; 495cdf0e10cSrcweir case NP_COMMAND: 496cdf0e10cSrcweir if( xCommand.is() ) 497cdf0e10cSrcweir { 498cdf0e10cSrcweir if( aValue >>= nInt16 ) 499cdf0e10cSrcweir xCommand->setCommand( nInt16 ); 500cdf0e10cSrcweir else 501cdf0e10cSrcweir { 502cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 503cdf0e10cSrcweir } 504cdf0e10cSrcweir } 505cdf0e10cSrcweir break; 506cdf0e10cSrcweir case NP_PARAMETER: 507cdf0e10cSrcweir if( xCommand.is() ) 508cdf0e10cSrcweir xCommand->setParameter( aValue ); 509cdf0e10cSrcweir break; 510cdf0e10cSrcweir case NP_ITERATETYPE: 511cdf0e10cSrcweir if( xIterateContainer.is() ) 512cdf0e10cSrcweir { 513cdf0e10cSrcweir if( aValue >>= nInt16 ) 514cdf0e10cSrcweir xIterateContainer->setIterateType( nInt16 ); 515cdf0e10cSrcweir else 516cdf0e10cSrcweir { 517cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 518cdf0e10cSrcweir } 519cdf0e10cSrcweir } 520cdf0e10cSrcweir break; 521cdf0e10cSrcweir case NP_ITERATEINTERVAL: 522cdf0e10cSrcweir if( xIterateContainer.is() ) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir if( aValue >>= fDouble ) 525cdf0e10cSrcweir xIterateContainer->setIterateInterval( fDouble ); 526cdf0e10cSrcweir else 527cdf0e10cSrcweir { 528cdf0e10cSrcweir OSL_TRACE( "any >>= failed %d", __LINE__ ); 529cdf0e10cSrcweir } 530cdf0e10cSrcweir } 531cdf0e10cSrcweir break; 532cdf0e10cSrcweir default: 533cdf0e10cSrcweir OSL_TRACE( "ERR-OOX: unknown prop index %d", i ); 534cdf0e10cSrcweir break; 535cdf0e10cSrcweir } 536cdf0e10cSrcweir } 537cdf0e10cSrcweir } 538cdf0e10cSrcweir 539cdf0e10cSrcweir if( mnNodeType == AnimationNodeType::TRANSITIONFILTER ) 540cdf0e10cSrcweir { 541cdf0e10cSrcweir 542cdf0e10cSrcweir Reference< XTransitionFilter > xFilter( xNode, UNO_QUERY ); 543cdf0e10cSrcweir maTransitionFilter.setTransitionFilterProperties( xFilter ); 544cdf0e10cSrcweir } 545cdf0e10cSrcweir 546cdf0e10cSrcweir std::for_each( maChildren.begin(), maChildren.end(), 547cdf0e10cSrcweir boost::bind(&TimeNode::addNode, _1, boost::cref(rFilter), boost::ref(xNode), 548cdf0e10cSrcweir boost::ref(pSlide) ) ); 549cdf0e10cSrcweir 550cdf0e10cSrcweir switch( mnNodeType ) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir case AnimationNodeType::SEQ: 553cdf0e10cSrcweir { 554cdf0e10cSrcweir sal_Int16 nEnum = 0; 555cdf0e10cSrcweir if( maUserData[ CREATE_OUSTRING( "node-type" ) ] >>= nEnum ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir if( nEnum == EffectNodeType::MAIN_SEQUENCE ) 558cdf0e10cSrcweir { 559cdf0e10cSrcweir fixMainSequenceTiming( xNode ); 560cdf0e10cSrcweir } 561cdf0e10cSrcweir else if( nEnum == EffectNodeType::INTERACTIVE_SEQUENCE ) 562cdf0e10cSrcweir { 563cdf0e10cSrcweir fixInteractiveSequenceTiming( xNode ); 564cdf0e10cSrcweir } 565cdf0e10cSrcweir } 566cdf0e10cSrcweir break; 567cdf0e10cSrcweir } 568cdf0e10cSrcweir case AnimationNodeType::PAR: 569cdf0e10cSrcweir // some other cut&paste... from AnimationImporter::importAnimationContainer() 570cdf0e10cSrcweir break; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir } 573cdf0e10cSrcweir catch( const Exception& e ) 574cdf0e10cSrcweir { 575cdf0e10cSrcweir OSL_TRACE( "OOX: exception raised in TimeNode::setNode() - %s", 576cdf0e10cSrcweir OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); 577cdf0e10cSrcweir } 578cdf0e10cSrcweir } 579cdf0e10cSrcweir 580cdf0e10cSrcweir createAndInsert(const XmlFilterBase & rFilter,const OUString & rServiceName,const Reference<XAnimationNode> & rxNode)581cdf0e10cSrcweir Reference< XAnimationNode > TimeNode::createAndInsert( 582cdf0e10cSrcweir const XmlFilterBase& rFilter, 583cdf0e10cSrcweir const OUString& rServiceName, 584cdf0e10cSrcweir const Reference< XAnimationNode >& rxNode ) 585cdf0e10cSrcweir { 586cdf0e10cSrcweir try { 587cdf0e10cSrcweir Reference< XAnimationNode > xNode ( rFilter.getServiceFactory()->createInstance( rServiceName ), UNO_QUERY_THROW ); 588cdf0e10cSrcweir Reference< XTimeContainer > xParentContainer( rxNode, UNO_QUERY_THROW ); 589cdf0e10cSrcweir 590cdf0e10cSrcweir xParentContainer->appendChild( xNode ); 591cdf0e10cSrcweir return xNode; 592cdf0e10cSrcweir } 593cdf0e10cSrcweir catch( const Exception& e ) 594cdf0e10cSrcweir { 595cdf0e10cSrcweir OSL_TRACE( "OOX: exception raised in TimeNode::createAndInsert() trying to create a service %s = %s", 596cdf0e10cSrcweir OUStringToOString( rServiceName, RTL_TEXTENCODING_ASCII_US ).getStr(), 597cdf0e10cSrcweir OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() ); 598cdf0e10cSrcweir } 599cdf0e10cSrcweir 600cdf0e10cSrcweir return Reference< XAnimationNode >(); 601cdf0e10cSrcweir } 602cdf0e10cSrcweir 603cdf0e10cSrcweir setId(sal_Int32 nId)604cdf0e10cSrcweir void TimeNode::setId( sal_Int32 nId ) 605cdf0e10cSrcweir { 606cdf0e10cSrcweir msId = OUString::valueOf(nId); 607cdf0e10cSrcweir } 608cdf0e10cSrcweir setTo(const Any & aTo)609cdf0e10cSrcweir void TimeNode::setTo( const Any & aTo ) 610cdf0e10cSrcweir { 611cdf0e10cSrcweir maNodeProperties[ NP_TO ] = aTo; 612cdf0e10cSrcweir } 613cdf0e10cSrcweir 614cdf0e10cSrcweir setFrom(const Any & aFrom)615cdf0e10cSrcweir void TimeNode::setFrom( const Any & aFrom ) 616cdf0e10cSrcweir { 617cdf0e10cSrcweir maNodeProperties[ NP_FROM ] = aFrom; 618cdf0e10cSrcweir } 619cdf0e10cSrcweir setBy(const Any & aBy)620cdf0e10cSrcweir void TimeNode::setBy( const Any & aBy ) 621cdf0e10cSrcweir { 622cdf0e10cSrcweir maNodeProperties[ NP_BY ] = aBy; 623cdf0e10cSrcweir } 624cdf0e10cSrcweir 625cdf0e10cSrcweir 626cdf0e10cSrcweir } } 627