1ca5ec200SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3ca5ec200SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4ca5ec200SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5ca5ec200SAndrew Rist  * distributed with this work for additional information
6ca5ec200SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7ca5ec200SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8ca5ec200SAndrew Rist  * "License"); you may not use this file except in compliance
9ca5ec200SAndrew Rist  * with the License.  You may obtain a copy of the License at
10ca5ec200SAndrew Rist  *
11ca5ec200SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12ca5ec200SAndrew Rist  *
13ca5ec200SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14ca5ec200SAndrew Rist  * software distributed under the License is distributed on an
15ca5ec200SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ca5ec200SAndrew Rist  * KIND, either express or implied.  See the License for the
17ca5ec200SAndrew Rist  * specific language governing permissions and limitations
18ca5ec200SAndrew Rist  * under the License.
19ca5ec200SAndrew Rist  *
20ca5ec200SAndrew Rist  *************************************************************/
21ca5ec200SAndrew Rist 
22ca5ec200SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "oox/ppt/timenodelistcontext.hxx"
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #include "comphelper/anytostring.hxx"
27cdf0e10cSrcweir #include "cppuhelper/exc_hlp.hxx"
28cdf0e10cSrcweir #include <osl/diagnose.h>
29cdf0e10cSrcweir #include <rtl/math.hxx>
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <com/sun/star/animations/XTimeContainer.hpp>
32cdf0e10cSrcweir #include <com/sun/star/animations/XAnimationNode.hpp>
33cdf0e10cSrcweir #include <com/sun/star/animations/XAnimateColor.hpp>
34cdf0e10cSrcweir #include <com/sun/star/animations/XAnimateSet.hpp>
35cdf0e10cSrcweir #include <com/sun/star/animations/XAnimateTransform.hpp>
36cdf0e10cSrcweir #include <com/sun/star/animations/AnimationTransformType.hpp>
37cdf0e10cSrcweir #include <com/sun/star/animations/AnimationCalcMode.hpp>
38cdf0e10cSrcweir #include <com/sun/star/animations/AnimationColorSpace.hpp>
39cdf0e10cSrcweir #include <com/sun/star/animations/AnimationNodeType.hpp>
40cdf0e10cSrcweir #include <com/sun/star/animations/XCommand.hpp>
41cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
42cdf0e10cSrcweir #include <com/sun/star/presentation/EffectCommands.hpp>
43cdf0e10cSrcweir #include <com/sun/star/beans/NamedValue.hpp>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir #include "oox/helper/attributelist.hxx"
46cdf0e10cSrcweir #include "oox/core/xmlfilterbase.hxx"
47cdf0e10cSrcweir #include "oox/drawingml/drawingmltypes.hxx"
48cdf0e10cSrcweir #include "oox/drawingml/colorchoicecontext.hxx"
49cdf0e10cSrcweir #include "oox/ppt/slidetransition.hxx"
50cdf0e10cSrcweir 
51cdf0e10cSrcweir #include "animvariantcontext.hxx"
52cdf0e10cSrcweir #include "commonbehaviorcontext.hxx"
53cdf0e10cSrcweir #include "conditioncontext.hxx"
54cdf0e10cSrcweir #include "commontimenodecontext.hxx"
55cdf0e10cSrcweir #include "timeanimvaluecontext.hxx"
56cdf0e10cSrcweir #include "animationtypes.hxx"
57cdf0e10cSrcweir 
58cdf0e10cSrcweir using namespace ::oox::core;
59cdf0e10cSrcweir using namespace ::oox::drawingml;
60cdf0e10cSrcweir using namespace ::com::sun::star::uno;
61cdf0e10cSrcweir using namespace ::com::sun::star::lang;
62cdf0e10cSrcweir using namespace ::com::sun::star::animations;
63cdf0e10cSrcweir using namespace ::com::sun::star::presentation;
64cdf0e10cSrcweir using namespace ::com::sun::star::xml::sax;
65cdf0e10cSrcweir using namespace ::com::sun::star::awt;
66cdf0e10cSrcweir using ::com::sun::star::beans::NamedValue;
67cdf0e10cSrcweir 
68cdf0e10cSrcweir using ::rtl::OUString;
69cdf0e10cSrcweir 
70cdf0e10cSrcweir namespace oox { namespace ppt {
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	struct AnimColor
73cdf0e10cSrcweir 	{
AnimColoroox::ppt::AnimColor74cdf0e10cSrcweir 		AnimColor(sal_Int16 cs, sal_Int32 o, sal_Int32 t, sal_Int32 th )
75cdf0e10cSrcweir 			: colorSpace( cs ), one( o ), two( t ), three( th )
76cdf0e10cSrcweir 			{
77cdf0e10cSrcweir 			}
78cdf0e10cSrcweir 
getoox::ppt::AnimColor79*374e2ad8SSteve Yin 		Any get()
80cdf0e10cSrcweir 			{
81cdf0e10cSrcweir 				sal_Int32 nColor;
82*374e2ad8SSteve Yin 				Sequence< double > aHSL( 3 );
83*374e2ad8SSteve Yin 				Any aColor;
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 				switch( colorSpace )
86cdf0e10cSrcweir 				{
87cdf0e10cSrcweir 				case AnimationColorSpace::HSL:
88*374e2ad8SSteve Yin 					aHSL[ 0 ] = double(one) / 100000;
89*374e2ad8SSteve Yin 					aHSL[ 1 ] = double(two) / 100000;
90*374e2ad8SSteve Yin 					aHSL[ 2 ] = double(three) / 100000;
91*374e2ad8SSteve Yin 					aColor = Any(aHSL);
92cdf0e10cSrcweir 					break;
93cdf0e10cSrcweir 				case AnimationColorSpace::RGB:
94cdf0e10cSrcweir 					nColor = ( ( ( one * 128 ) / 1000 ) & 0xff ) << 16
95cdf0e10cSrcweir 						| ( ( ( two * 128 ) / 1000 ) & 0xff ) << 8
96cdf0e10cSrcweir 						| ( ( ( three * 128 ) / 1000 )  & 0xff );
97*374e2ad8SSteve Yin 					aColor = Any(nColor);
98cdf0e10cSrcweir 					break;
99cdf0e10cSrcweir 				default:
100cdf0e10cSrcweir 					nColor = 0;
101*374e2ad8SSteve Yin 					aColor = Any( nColor );
102cdf0e10cSrcweir 					break;
103cdf0e10cSrcweir 				}
104*374e2ad8SSteve Yin 				return  aColor;
105cdf0e10cSrcweir 			}
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 		sal_Int16 colorSpace;
108cdf0e10cSrcweir 		sal_Int32 one;
109cdf0e10cSrcweir 		sal_Int32 two;
110cdf0e10cSrcweir 		sal_Int32 three;
111cdf0e10cSrcweir 	};
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	/** CT_TLMediaNodeAudio
115cdf0e10cSrcweir 			CT_TLMediaNodeVideo */
116cdf0e10cSrcweir 	class MediaNodeContext
117cdf0e10cSrcweir 		: public TimeNodeContext
118cdf0e10cSrcweir 	{
119cdf0e10cSrcweir 	public:
MediaNodeContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)120cdf0e10cSrcweir         MediaNodeContext( ContextHandler& rParent, sal_Int32  aElement,
121cdf0e10cSrcweir                             const Reference< XFastAttributeList >& xAttribs,
122cdf0e10cSrcweir                             const TimeNodePtr & pNode )
123cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
124cdf0e10cSrcweir 				, mbIsNarration( false )
125cdf0e10cSrcweir 				, mbFullScrn( false )
126cdf0e10cSrcweir 			{
127cdf0e10cSrcweir 				AttributeList attribs( xAttribs );
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 				switch( aElement )
130cdf0e10cSrcweir 				{
131cdf0e10cSrcweir 				case PPT_TOKEN( audio ):
132cdf0e10cSrcweir 					mbIsNarration = attribs.getBool( XML_isNarration, false );
133cdf0e10cSrcweir 					break;
134cdf0e10cSrcweir 				case PPT_TOKEN( video ):
135cdf0e10cSrcweir 					mbFullScrn = attribs.getBool( XML_fullScrn, false );
136cdf0e10cSrcweir 					break;
137cdf0e10cSrcweir 				default:
138cdf0e10cSrcweir 					break;
139cdf0e10cSrcweir 				}
140cdf0e10cSrcweir 			}
141cdf0e10cSrcweir 
endFastElement(sal_Int32 aElement)142cdf0e10cSrcweir 		virtual void SAL_CALL endFastElement( sal_Int32 aElement )
143cdf0e10cSrcweir 			throw ( SAXException, RuntimeException)
144cdf0e10cSrcweir 			{
145cdf0e10cSrcweir 				if( aElement == PPT_TOKEN( audio ) )
146cdf0e10cSrcweir 				{
147cdf0e10cSrcweir 					// TODO deal with mbIsNarration
148cdf0e10cSrcweir 				}
149cdf0e10cSrcweir 				else if( aElement == PPT_TOKEN( video ) )
150cdf0e10cSrcweir 				{
151cdf0e10cSrcweir 					// TODO deal with mbFullScrn
152cdf0e10cSrcweir 				}
153cdf0e10cSrcweir 			}
154cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)155cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken,
156cdf0e10cSrcweir 																																							const Reference< XFastAttributeList >& xAttribs )
157cdf0e10cSrcweir 			throw ( SAXException, RuntimeException )
158cdf0e10cSrcweir 			{
159cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 				switch ( aElementToken )
162cdf0e10cSrcweir 				{
163cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
164cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
165cdf0e10cSrcweir 					break;
166cdf0e10cSrcweir 				default:
167cdf0e10cSrcweir 					break;
168cdf0e10cSrcweir 				}
169cdf0e10cSrcweir 
170cdf0e10cSrcweir 				if( !xRet.is() )
171cdf0e10cSrcweir 					xRet.set( this );
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 				return xRet;
174cdf0e10cSrcweir 			}
175cdf0e10cSrcweir 
176cdf0e10cSrcweir 	private:
177cdf0e10cSrcweir 		bool mbIsNarration;
178cdf0e10cSrcweir 		bool mbFullScrn;
179cdf0e10cSrcweir 	};
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	/** CT_TLSetBehavior
183cdf0e10cSrcweir 	 */
184cdf0e10cSrcweir 	class SetTimeNodeContext
185cdf0e10cSrcweir 		: public TimeNodeContext
186cdf0e10cSrcweir 	{
187cdf0e10cSrcweir 	public:
SetTimeNodeContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)188cdf0e10cSrcweir         SetTimeNodeContext( ContextHandler& rParent, sal_Int32  aElement,
189cdf0e10cSrcweir                             const Reference< XFastAttributeList >& xAttribs,
190cdf0e10cSrcweir                             const TimeNodePtr & pNode )
191cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
192cdf0e10cSrcweir 			{
193cdf0e10cSrcweir 
194cdf0e10cSrcweir 			}
195cdf0e10cSrcweir 
~SetTimeNodeContext()196cdf0e10cSrcweir 		~SetTimeNodeContext() throw ()
197cdf0e10cSrcweir 			{
198cdf0e10cSrcweir 				if( maTo.hasValue() )
199cdf0e10cSrcweir 				{
200cdf0e10cSrcweir 					// TODO
201cdf0e10cSrcweir 					// HACK !!! discard and refactor
202cdf0e10cSrcweir 					OUString aString;
203cdf0e10cSrcweir 					if( maTo >>= aString )
204cdf0e10cSrcweir 					{
205cdf0e10cSrcweir 						OSL_TRACE( "Magic conversion %s", OUSTRING_TO_CSTR( aString ) );
206cdf0e10cSrcweir 						maTo = makeAny( aString.equalsAscii( "visible" ) ? sal_True : sal_False );
207cdf0e10cSrcweir 						if( !maTo.has<sal_Bool>() )
208cdf0e10cSrcweir 							OSL_TRACE( "conversion failed" );
209cdf0e10cSrcweir 					}
210cdf0e10cSrcweir 					mpNode->setTo( maTo );
211cdf0e10cSrcweir 				}
212cdf0e10cSrcweir 
213cdf0e10cSrcweir 			}
214cdf0e10cSrcweir 
endFastElement(sal_Int32)215cdf0e10cSrcweir 		virtual void SAL_CALL endFastElement( sal_Int32 /*aElement*/ )
216cdf0e10cSrcweir 			throw ( SAXException, RuntimeException)
217cdf0e10cSrcweir 			{
218cdf0e10cSrcweir 			}
219cdf0e10cSrcweir 
220cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)221cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken,
222cdf0e10cSrcweir 																																							const Reference< XFastAttributeList >& xAttribs )
223cdf0e10cSrcweir 			throw ( SAXException, RuntimeException )
224cdf0e10cSrcweir 			{
225cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 				switch ( aElementToken )
228cdf0e10cSrcweir 				{
229cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
230cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
231cdf0e10cSrcweir 					break;
232cdf0e10cSrcweir 				case PPT_TOKEN( to ):
233cdf0e10cSrcweir 					// CT_TLAnimVariant
234cdf0e10cSrcweir                     xRet.set( new AnimVariantContext( *this, aElementToken, maTo ) );
235cdf0e10cSrcweir 					break;
236cdf0e10cSrcweir 				default:
237cdf0e10cSrcweir 					break;
238cdf0e10cSrcweir 				}
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 				if( !xRet.is() )
241cdf0e10cSrcweir 					xRet.set( this );
242cdf0e10cSrcweir 
243cdf0e10cSrcweir 				return xRet;
244cdf0e10cSrcweir 			}
245cdf0e10cSrcweir 	private:
246cdf0e10cSrcweir 		Any  maTo;
247cdf0e10cSrcweir 	};
248cdf0e10cSrcweir 
249cdf0e10cSrcweir 	/** CT_TLCommandBehavior
250cdf0e10cSrcweir 	 */
251cdf0e10cSrcweir 	class CmdTimeNodeContext
252cdf0e10cSrcweir 		: public TimeNodeContext
253cdf0e10cSrcweir 	{
254cdf0e10cSrcweir 	public:
CmdTimeNodeContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)255cdf0e10cSrcweir         CmdTimeNodeContext( ContextHandler& rParent, sal_Int32  aElement,
256cdf0e10cSrcweir                             const Reference< XFastAttributeList >& xAttribs,
257cdf0e10cSrcweir                             const TimeNodePtr & pNode )
258cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
259cdf0e10cSrcweir 				, maType(0)
260cdf0e10cSrcweir 			{
261cdf0e10cSrcweir 				switch ( aElement )
262cdf0e10cSrcweir 				{
263cdf0e10cSrcweir 				case PPT_TOKEN( cmd ):
264cdf0e10cSrcweir 					msCommand = xAttribs->getOptionalValue( XML_cmd );
265cdf0e10cSrcweir 					maType = xAttribs->getOptionalValueToken( XML_type, 0 );
266cdf0e10cSrcweir 					break;
267cdf0e10cSrcweir 				default:
268cdf0e10cSrcweir 					break;
269cdf0e10cSrcweir 				}
270cdf0e10cSrcweir 			}
271cdf0e10cSrcweir 
~CmdTimeNodeContext()272cdf0e10cSrcweir 		~CmdTimeNodeContext() throw ()
273cdf0e10cSrcweir 			{
274cdf0e10cSrcweir 			}
275cdf0e10cSrcweir 
endFastElement(sal_Int32 aElement)276cdf0e10cSrcweir 		virtual void SAL_CALL endFastElement( sal_Int32 aElement )
277cdf0e10cSrcweir 			throw ( SAXException, RuntimeException)
278cdf0e10cSrcweir 			{
279cdf0e10cSrcweir 				if( aElement == PPT_TOKEN( cmd ) )
280cdf0e10cSrcweir 				{
281cdf0e10cSrcweir 					try {
282cdf0e10cSrcweir 						// see sd/source/filter/ppt/pptinanimations.cxx
283cdf0e10cSrcweir 						// in AnimationImporter::importCommandContainer()
284cdf0e10cSrcweir 						// REFACTOR?
285cdf0e10cSrcweir 						// a good chunk of this code has been copied verbatim *sigh*
286cdf0e10cSrcweir 						sal_Int16 nCommand = EffectCommands::CUSTOM;
287cdf0e10cSrcweir 						NamedValue aParamValue;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 						switch( maType )
290cdf0e10cSrcweir 						{
291cdf0e10cSrcweir 						case XML_verb:
292cdf0e10cSrcweir 							aParamValue.Name = OUString(RTL_CONSTASCII_USTRINGPARAM("Verb"));
293cdf0e10cSrcweir 							// TODO make sure msCommand has what we want
294cdf0e10cSrcweir 							aParamValue.Value <<= msCommand.toInt32();
295cdf0e10cSrcweir 							nCommand = EffectCommands::VERB;
296cdf0e10cSrcweir 							break;
297cdf0e10cSrcweir 						case XML_evt:
298cdf0e10cSrcweir 						case XML_call:
299cdf0e10cSrcweir 							if( msCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "onstopaudio" ) ) )
300cdf0e10cSrcweir 							{
301cdf0e10cSrcweir 								nCommand = EffectCommands::STOPAUDIO;
302cdf0e10cSrcweir 							}
303cdf0e10cSrcweir 							else if( msCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("play") ) )
304cdf0e10cSrcweir 							{
305cdf0e10cSrcweir 								nCommand = EffectCommands::PLAY;
306cdf0e10cSrcweir 							}
307cdf0e10cSrcweir 							else if( msCommand.compareToAscii( RTL_CONSTASCII_STRINGPARAM("playFrom") ) == 0 )
308cdf0e10cSrcweir 							{
309cdf0e10cSrcweir 								const OUString aMediaTime( msCommand.copy( 9, msCommand.getLength() - 10 ) );
310cdf0e10cSrcweir 								rtl_math_ConversionStatus eStatus;
311cdf0e10cSrcweir 								double fMediaTime = ::rtl::math::stringToDouble( aMediaTime, (sal_Unicode)('.'), (sal_Unicode)(','), &eStatus, NULL );
312cdf0e10cSrcweir 								if( eStatus == rtl_math_ConversionStatus_Ok )
313cdf0e10cSrcweir 								{
314cdf0e10cSrcweir 									aParamValue.Name = CREATE_OUSTRING("MediaTime");
315cdf0e10cSrcweir 									aParamValue.Value <<= fMediaTime;
316cdf0e10cSrcweir 								}
317cdf0e10cSrcweir 								nCommand = EffectCommands::PLAY;
318cdf0e10cSrcweir 							}
319cdf0e10cSrcweir 							else if( msCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("togglePause") ) )
320cdf0e10cSrcweir 							{
321cdf0e10cSrcweir 								nCommand = EffectCommands::TOGGLEPAUSE;
322cdf0e10cSrcweir 							}
323cdf0e10cSrcweir 							else if( msCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("stop") ) )
324cdf0e10cSrcweir 							{
325cdf0e10cSrcweir 								nCommand = EffectCommands::STOP;
326cdf0e10cSrcweir 							}
327cdf0e10cSrcweir 							break;
328cdf0e10cSrcweir 						}
329cdf0e10cSrcweir 						mpNode->getNodeProperties()[ NP_COMMAND ] = makeAny((sal_Int16)nCommand);
330cdf0e10cSrcweir 						if( nCommand == EffectCommands::CUSTOM )
331cdf0e10cSrcweir 						{
332cdf0e10cSrcweir 							OSL_TRACE("OOX: CmdTimeNodeContext::endFastElement(), unknown command!");
333cdf0e10cSrcweir 							aParamValue.Name = CREATE_OUSTRING("UserDefined");
334cdf0e10cSrcweir 							aParamValue.Value <<= msCommand;
335cdf0e10cSrcweir 						}
336cdf0e10cSrcweir 						if( aParamValue.Value.hasValue() )
337cdf0e10cSrcweir 						{
338cdf0e10cSrcweir 							Sequence< NamedValue > aParamSeq( &aParamValue, 1 );
339cdf0e10cSrcweir 							mpNode->getNodeProperties()[ NP_PARAMETER ] = makeAny( aParamSeq );
340cdf0e10cSrcweir 						}
341cdf0e10cSrcweir 					}
342cdf0e10cSrcweir 					catch( RuntimeException& )
343cdf0e10cSrcweir 					{
344cdf0e10cSrcweir 						OSL_TRACE( "OOX: Exception in CmdTimeNodeContext::endFastElement()" );
345cdf0e10cSrcweir 					}
346cdf0e10cSrcweir 				}
347cdf0e10cSrcweir 			}
348cdf0e10cSrcweir 
349cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)350cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken,
351cdf0e10cSrcweir 																																							const Reference< XFastAttributeList >& xAttribs )
352cdf0e10cSrcweir 			throw ( SAXException, RuntimeException )
353cdf0e10cSrcweir 			{
354cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 				switch ( aElementToken )
357cdf0e10cSrcweir 				{
358cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
359cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
360cdf0e10cSrcweir 					break;
361cdf0e10cSrcweir 				default:
362cdf0e10cSrcweir 					break;
363cdf0e10cSrcweir 				}
364cdf0e10cSrcweir 
365cdf0e10cSrcweir 				if( !xRet.is() )
366cdf0e10cSrcweir 					xRet.set( this );
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 				return xRet;
369cdf0e10cSrcweir 			}
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 	private:
372cdf0e10cSrcweir 		OUString msCommand;
373cdf0e10cSrcweir 		sal_Int32 maType;
374cdf0e10cSrcweir 	};
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 
377cdf0e10cSrcweir 	/** CT_TLTimeNodeSequence
378cdf0e10cSrcweir 	 */
379cdf0e10cSrcweir 	class SequenceTimeNodeContext
380cdf0e10cSrcweir 		: public TimeNodeContext
381cdf0e10cSrcweir 	{
382cdf0e10cSrcweir 	public:
SequenceTimeNodeContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)383cdf0e10cSrcweir         SequenceTimeNodeContext( ContextHandler& rParent, sal_Int32  aElement,
384cdf0e10cSrcweir                                  const Reference< XFastAttributeList >& xAttribs,
385cdf0e10cSrcweir                                  const TimeNodePtr & pNode )
386cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
387cdf0e10cSrcweir 				, mnNextAc(0)
388cdf0e10cSrcweir 				, mnPrevAc(0)
389cdf0e10cSrcweir 			{
390cdf0e10cSrcweir 				AttributeList attribs(xAttribs);
391cdf0e10cSrcweir 				mbConcurrent = attribs.getBool( XML_concurrent, false );
392cdf0e10cSrcweir 				// ST_TLNextActionType { none, seek }
393cdf0e10cSrcweir 				mnNextAc = xAttribs->getOptionalValueToken( XML_nextAc, 0 );
394cdf0e10cSrcweir 				// ST_TLPreviousActionType { none, skipTimed }
395cdf0e10cSrcweir 				mnPrevAc = xAttribs->getOptionalValueToken( XML_prevAc, 0 );
396cdf0e10cSrcweir 			}
397cdf0e10cSrcweir 
~SequenceTimeNodeContext()398cdf0e10cSrcweir 		~SequenceTimeNodeContext() throw()
399cdf0e10cSrcweir 			{
400cdf0e10cSrcweir 			}
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)403cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken,
404cdf0e10cSrcweir 																																							const Reference< XFastAttributeList >& xAttribs )
405cdf0e10cSrcweir 			throw ( SAXException, RuntimeException )
406cdf0e10cSrcweir 			{
407cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
408cdf0e10cSrcweir 
409cdf0e10cSrcweir 				switch ( aElementToken )
410cdf0e10cSrcweir 				{
411cdf0e10cSrcweir 				case PPT_TOKEN( cTn ):
412cdf0e10cSrcweir                     xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) );
413cdf0e10cSrcweir 					break;
414cdf0e10cSrcweir 				case PPT_TOKEN( nextCondLst ):
415cdf0e10cSrcweir                     xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode,
416cdf0e10cSrcweir 												   mpNode->getNextCondition() ) );
417cdf0e10cSrcweir 					break;
418cdf0e10cSrcweir 				case PPT_TOKEN( prevCondLst ):
419cdf0e10cSrcweir                     xRet.set( new CondListContext( *this, aElementToken, xAttribs, mpNode,
420cdf0e10cSrcweir 												   mpNode->getPrevCondition() ) );
421cdf0e10cSrcweir 					break;
422cdf0e10cSrcweir 				default:
423cdf0e10cSrcweir 					break;
424cdf0e10cSrcweir 				}
425cdf0e10cSrcweir 
426cdf0e10cSrcweir 				if( !xRet.is() )
427cdf0e10cSrcweir 					xRet.set( this );
428cdf0e10cSrcweir 
429cdf0e10cSrcweir 				return xRet;
430cdf0e10cSrcweir 			}
431cdf0e10cSrcweir 	private:
432cdf0e10cSrcweir 		bool mbConcurrent;
433cdf0e10cSrcweir 		sal_Int32 mnNextAc, mnPrevAc;
434cdf0e10cSrcweir 	};
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 	/** CT_TLTimeNodeParallel
438cdf0e10cSrcweir 	 *  CT_TLTimeNodeExclusive
439cdf0e10cSrcweir 	 */
440cdf0e10cSrcweir 	class ParallelExclTimeNodeContext
441cdf0e10cSrcweir 		: public TimeNodeContext
442cdf0e10cSrcweir 	{
443cdf0e10cSrcweir 	public:
ParallelExclTimeNodeContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)444cdf0e10cSrcweir         ParallelExclTimeNodeContext( ContextHandler& rParent, sal_Int32  aElement,
445cdf0e10cSrcweir                                      const Reference< XFastAttributeList >& xAttribs,
446cdf0e10cSrcweir                                      const TimeNodePtr & pNode )
447cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
448cdf0e10cSrcweir 			{
449cdf0e10cSrcweir 			}
450cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)451cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken,
452cdf0e10cSrcweir 																																							const Reference< XFastAttributeList >& xAttribs )
453cdf0e10cSrcweir 			throw ( SAXException, RuntimeException )
454cdf0e10cSrcweir 			{
455cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
456cdf0e10cSrcweir 
457cdf0e10cSrcweir 				switch ( aElementToken )
458cdf0e10cSrcweir 				{
459cdf0e10cSrcweir 				case PPT_TOKEN( cTn ):
460cdf0e10cSrcweir                     xRet.set( new CommonTimeNodeContext( *this, aElementToken, xAttribs, mpNode ) );
461cdf0e10cSrcweir 					break;
462cdf0e10cSrcweir 				default:
463cdf0e10cSrcweir 					break;
464cdf0e10cSrcweir 				}
465cdf0e10cSrcweir 
466cdf0e10cSrcweir 				if( !xRet.is() )
467cdf0e10cSrcweir 					xRet.set( this );
468cdf0e10cSrcweir 
469cdf0e10cSrcweir 				return xRet;
470cdf0e10cSrcweir 			}
471cdf0e10cSrcweir 
472cdf0e10cSrcweir 	protected:
473cdf0e10cSrcweir 
474cdf0e10cSrcweir 	};
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 	/** CT_TLAnimateColorBehavior */
478cdf0e10cSrcweir 	class AnimColorContext
479cdf0e10cSrcweir 		: public TimeNodeContext
480cdf0e10cSrcweir 	{
481cdf0e10cSrcweir 	public:
AnimColorContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)482cdf0e10cSrcweir         AnimColorContext( ContextHandler& rParent, sal_Int32  aElement,
483cdf0e10cSrcweir                             const Reference< XFastAttributeList >& xAttribs,
484cdf0e10cSrcweir                             const TimeNodePtr & pNode ) throw()
485cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
486cdf0e10cSrcweir 				// ST_TLAnimateColorSpace ( XML_rgb, XML_hsl }
487cdf0e10cSrcweir 			, mnColorSpace( xAttribs->getOptionalValueToken( XML_clrSpc, 0 ) )
488cdf0e10cSrcweir 				// ST_TLAnimateColorDirection { XML_cw, XML_ccw }
489cdf0e10cSrcweir 			, mnDir( xAttribs->getOptionalValueToken( XML_dir, 0 ) )
490cdf0e10cSrcweir 			, mbHasByColor( false )
491cdf0e10cSrcweir 			, m_byColor( AnimationColorSpace::RGB, 0, 0, 0)
492cdf0e10cSrcweir 			{
493cdf0e10cSrcweir 			}
~AnimColorContext()494cdf0e10cSrcweir 		~AnimColorContext() throw()
495cdf0e10cSrcweir 			{
496cdf0e10cSrcweir 			}
497cdf0e10cSrcweir 
endFastElement(sal_Int32 aElement)498cdf0e10cSrcweir 		virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException)
499cdf0e10cSrcweir 			{
500cdf0e10cSrcweir 				//xParentNode
501cdf0e10cSrcweir 				if( aElement == mnElement )
502cdf0e10cSrcweir 				{
503cdf0e10cSrcweir 					NodePropertyMap & pProps(mpNode->getNodeProperties());
504cdf0e10cSrcweir 					pProps[ NP_DIRECTION ] = makeAny( mnDir == XML_cw );
505cdf0e10cSrcweir 					pProps[ NP_COLORINTERPOLATION ] = makeAny( mnColorSpace == XML_hsl ? AnimationColorSpace::HSL : AnimationColorSpace::RGB );
506cdf0e10cSrcweir                     const GraphicHelper& rGraphicHelper = getFilter().getGraphicHelper();
507cdf0e10cSrcweir 					if( maToClr.isUsed() )
508cdf0e10cSrcweir                         mpNode->setTo( Any( maToClr.getColor( rGraphicHelper ) ) );
509cdf0e10cSrcweir 					if( maFromClr.isUsed() )
510cdf0e10cSrcweir                         mpNode->setFrom( Any( maFromClr.getColor( rGraphicHelper ) ) );
511cdf0e10cSrcweir 					if( mbHasByColor )
512*374e2ad8SSteve Yin 						mpNode->setBy( m_byColor.get() );
513cdf0e10cSrcweir 				}
514cdf0e10cSrcweir 			}
515cdf0e10cSrcweir 
516cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)517cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException )
518cdf0e10cSrcweir 			{
519cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
520cdf0e10cSrcweir 
521cdf0e10cSrcweir 				switch ( aElementToken )
522cdf0e10cSrcweir 				{
523cdf0e10cSrcweir 				case PPT_TOKEN( hsl ):
524cdf0e10cSrcweir 					// CT_TLByHslColorTransform
525cdf0e10cSrcweir 				{
526cdf0e10cSrcweir 					if( mbHasByColor )
527cdf0e10cSrcweir 					{
528cdf0e10cSrcweir 						m_byColor.colorSpace = AnimationColorSpace::HSL;
529cdf0e10cSrcweir 						m_byColor.one = xAttribs->getOptionalValue( XML_h ).toInt32( );
530cdf0e10cSrcweir 						m_byColor.two = xAttribs->getOptionalValue( XML_s ).toInt32( );
531cdf0e10cSrcweir 						m_byColor.three = xAttribs->getOptionalValue( XML_l ).toInt32( );
532cdf0e10cSrcweir 					}
533cdf0e10cSrcweir 					xRet.set(this);
534cdf0e10cSrcweir 					break;
535cdf0e10cSrcweir 				}
536cdf0e10cSrcweir 				case PPT_TOKEN( rgb ):
537cdf0e10cSrcweir 				{
538cdf0e10cSrcweir 					if( mbHasByColor )
539cdf0e10cSrcweir 					{
540cdf0e10cSrcweir 						// CT_TLByRgbColorTransform
541cdf0e10cSrcweir 						m_byColor.colorSpace = AnimationColorSpace::RGB;
542cdf0e10cSrcweir 						m_byColor.one = xAttribs->getOptionalValue( XML_r ).toInt32();
543cdf0e10cSrcweir 						m_byColor.two = xAttribs->getOptionalValue( XML_g ).toInt32();
544cdf0e10cSrcweir 						m_byColor.three = xAttribs->getOptionalValue( XML_b ).toInt32();
545cdf0e10cSrcweir 					}
546cdf0e10cSrcweir 					xRet.set(this);
547cdf0e10cSrcweir 					break;
548cdf0e10cSrcweir 				}
549cdf0e10cSrcweir 				case PPT_TOKEN( by ):
550cdf0e10cSrcweir 					// CT_TLByAnimateColorTransform
551cdf0e10cSrcweir 					mbHasByColor = true;
552cdf0e10cSrcweir 					xRet.set(this);
553cdf0e10cSrcweir 					break;
554cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
555cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
556cdf0e10cSrcweir 					break;
557cdf0e10cSrcweir 				case PPT_TOKEN( to ):
558cdf0e10cSrcweir 					// CT_Color
559cdf0e10cSrcweir                     xRet.set( new ColorContext( *this, maToClr ) );
560cdf0e10cSrcweir 					break;
561cdf0e10cSrcweir 				case PPT_TOKEN( from ):
562cdf0e10cSrcweir 					// CT_Color
563cdf0e10cSrcweir                     xRet.set( new ColorContext( *this, maFromClr ) );
564cdf0e10cSrcweir 					break;
565cdf0e10cSrcweir 
566cdf0e10cSrcweir 				default:
567cdf0e10cSrcweir 					break;
568cdf0e10cSrcweir 				}
569cdf0e10cSrcweir 
570cdf0e10cSrcweir 				if( !xRet.is() )
571cdf0e10cSrcweir 					xRet.set( this );
572cdf0e10cSrcweir 
573cdf0e10cSrcweir 				return xRet;
574cdf0e10cSrcweir 			}
575cdf0e10cSrcweir 
576cdf0e10cSrcweir 
577cdf0e10cSrcweir 	private:
578cdf0e10cSrcweir 		sal_Int32 mnColorSpace;
579cdf0e10cSrcweir 		sal_Int32 mnDir;
580cdf0e10cSrcweir 		bool mbHasByColor;
581cdf0e10cSrcweir 		AnimColor m_byColor;
582cdf0e10cSrcweir 		oox::drawingml::Color maToClr;
583cdf0e10cSrcweir 		oox::drawingml::Color maFromClr;
584cdf0e10cSrcweir 	};
585cdf0e10cSrcweir 
586cdf0e10cSrcweir 
587cdf0e10cSrcweir 	/** CT_TLAnimateBehavior */
588cdf0e10cSrcweir 	class AnimContext
589cdf0e10cSrcweir 		: public TimeNodeContext
590cdf0e10cSrcweir 	{
591cdf0e10cSrcweir 	public:
AnimContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)592cdf0e10cSrcweir         AnimContext( ContextHandler& rParent, sal_Int32  aElement,
593cdf0e10cSrcweir                      const Reference< XFastAttributeList >& xAttribs,
594cdf0e10cSrcweir                       const TimeNodePtr & pNode ) throw()
595cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
596cdf0e10cSrcweir 			{
597cdf0e10cSrcweir 				NodePropertyMap & aProps( pNode->getNodeProperties() );
598cdf0e10cSrcweir 				sal_Int32 nCalcMode = xAttribs->getOptionalValueToken( XML_calcmode, 0 );
599cdf0e10cSrcweir 				if(nCalcMode)
600cdf0e10cSrcweir 				{
601cdf0e10cSrcweir 					sal_Int16 nEnum = 0;
602cdf0e10cSrcweir 					switch(nCalcMode)
603cdf0e10cSrcweir 					{
604cdf0e10cSrcweir 					case XML_discrete:
605cdf0e10cSrcweir 						nEnum = AnimationCalcMode::DISCRETE;
606cdf0e10cSrcweir 						break;
607cdf0e10cSrcweir 					case XML_lin:
608cdf0e10cSrcweir 						nEnum = AnimationCalcMode::LINEAR;
609cdf0e10cSrcweir 						break;
610cdf0e10cSrcweir 					case XML_fmla:
611cdf0e10cSrcweir 					default:
612cdf0e10cSrcweir 						// TODO what value is good ?
613cdf0e10cSrcweir 						nEnum = AnimationCalcMode::DISCRETE;
614cdf0e10cSrcweir 						break;
615cdf0e10cSrcweir 					}
616cdf0e10cSrcweir 					aProps[ NP_CALCMODE ] = makeAny(nEnum);
617cdf0e10cSrcweir 				}
618cdf0e10cSrcweir 				OUString aStr;
619cdf0e10cSrcweir 				aStr = xAttribs->getOptionalValue( XML_from );
620cdf0e10cSrcweir 				if( aStr.getLength() )
621cdf0e10cSrcweir 				{
622cdf0e10cSrcweir 					pNode->setFrom( makeAny( aStr ) );
623cdf0e10cSrcweir 				}
624cdf0e10cSrcweir 				aStr = xAttribs->getOptionalValue( XML_by );
625cdf0e10cSrcweir 				if( aStr.getLength() )
626cdf0e10cSrcweir 				{
627cdf0e10cSrcweir 					pNode->setBy( makeAny( aStr ) );
628cdf0e10cSrcweir 				}
629cdf0e10cSrcweir 				aStr = xAttribs->getOptionalValue( XML_to );
630cdf0e10cSrcweir 				if( aStr.getLength() )
631cdf0e10cSrcweir 				{
632cdf0e10cSrcweir 					pNode->setTo( makeAny( aStr ) );
633cdf0e10cSrcweir 				}
634cdf0e10cSrcweir 				mnValueType = xAttribs->getOptionalValueToken( XML_valueType, 0 );
635cdf0e10cSrcweir 			}
636cdf0e10cSrcweir 
637cdf0e10cSrcweir 
~AnimContext()638cdf0e10cSrcweir 		~AnimContext() throw ()
639cdf0e10cSrcweir 			{
640cdf0e10cSrcweir 				::std::list< TimeAnimationValue >::iterator iter, end;
641cdf0e10cSrcweir 				int nKeyTimes = maTavList.size();
642cdf0e10cSrcweir 				if( nKeyTimes > 0)
643cdf0e10cSrcweir 				{
644cdf0e10cSrcweir 					int i;
645cdf0e10cSrcweir 					Sequence< double > aKeyTimes( nKeyTimes );
646cdf0e10cSrcweir 					Sequence< Any > aValues( nKeyTimes );
647cdf0e10cSrcweir 
648cdf0e10cSrcweir 					NodePropertyMap & aProps( mpNode->getNodeProperties() );
649cdf0e10cSrcweir 					end = maTavList.end();
650cdf0e10cSrcweir 					for(iter = maTavList.begin(), i=0; iter != end; iter++,i++)
651cdf0e10cSrcweir 					{
652cdf0e10cSrcweir 						// TODO what to do if it is Timing_INFINITE ?
653cdf0e10cSrcweir 						Any aTime = GetTimeAnimateValueTime( iter->msTime );
654cdf0e10cSrcweir 						aTime >>= aKeyTimes[i];
655cdf0e10cSrcweir 						aValues[i] = iter->maValue;
656cdf0e10cSrcweir 
657cdf0e10cSrcweir 						OUString aTest;
658cdf0e10cSrcweir 						iter->maValue >>= aTest;
659cdf0e10cSrcweir 						if( aTest.getLength() != 0 )
660cdf0e10cSrcweir 						{
661cdf0e10cSrcweir 							aValues[i] = iter->maValue;
662cdf0e10cSrcweir 						}
663cdf0e10cSrcweir 						else
664cdf0e10cSrcweir 						{
665cdf0e10cSrcweir 							aProps[ NP_FORMULA ] <<= iter->msFormula;
666cdf0e10cSrcweir 						}
667cdf0e10cSrcweir 					}
668cdf0e10cSrcweir 					aProps[ NP_VALUES ] <<= aValues;
669cdf0e10cSrcweir 					aProps[ NP_KEYTIMES ] <<= aKeyTimes;
670cdf0e10cSrcweir 				}
671cdf0e10cSrcweir 			}
672cdf0e10cSrcweir 
673cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)674cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException )
675cdf0e10cSrcweir 			{
676cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 				switch ( aElementToken )
679cdf0e10cSrcweir 				{
680cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
681cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
682cdf0e10cSrcweir 					break;
683cdf0e10cSrcweir 				case PPT_TOKEN( tavLst ):
684cdf0e10cSrcweir                     xRet.set( new TimeAnimValueListContext ( *this, xAttribs, maTavList ) );
685cdf0e10cSrcweir 					break;
686cdf0e10cSrcweir 				default:
687cdf0e10cSrcweir 					break;
688cdf0e10cSrcweir 				}
689cdf0e10cSrcweir 
690cdf0e10cSrcweir 				if( !xRet.is() )
691cdf0e10cSrcweir 					xRet.set( this );
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 				return xRet;
694cdf0e10cSrcweir 			}
695cdf0e10cSrcweir 	private:
696cdf0e10cSrcweir 		sal_Int32              mnValueType;
697cdf0e10cSrcweir 		TimeAnimationValueList maTavList;
698cdf0e10cSrcweir 	};
699cdf0e10cSrcweir 
700cdf0e10cSrcweir 
701cdf0e10cSrcweir 	/** CT_TLAnimateScaleBehavior */
702cdf0e10cSrcweir 	class AnimScaleContext
703cdf0e10cSrcweir 		: public TimeNodeContext
704cdf0e10cSrcweir 	{
705cdf0e10cSrcweir 	public:
AnimScaleContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)706cdf0e10cSrcweir         AnimScaleContext( ContextHandler& rParent, sal_Int32  aElement,
707cdf0e10cSrcweir                             const Reference< XFastAttributeList >& xAttribs,
708cdf0e10cSrcweir                             const TimeNodePtr & pNode ) throw()
709cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
710cdf0e10cSrcweir 				, mbZoomContents( false )
711cdf0e10cSrcweir 			{
712cdf0e10cSrcweir 				AttributeList attribs( xAttribs );
713cdf0e10cSrcweir 				// TODO what to do with mbZoomContents
714cdf0e10cSrcweir 				mbZoomContents = attribs.getBool( XML_zoomContents, false );
715cdf0e10cSrcweir 				pNode->getNodeProperties()[ NP_TRANSFORMTYPE ]
716cdf0e10cSrcweir 					= makeAny((sal_Int16)AnimationTransformType::SCALE);
717cdf0e10cSrcweir 			}
718cdf0e10cSrcweir 
~AnimScaleContext()719cdf0e10cSrcweir 		~AnimScaleContext( ) throw( )
720cdf0e10cSrcweir 			{
721cdf0e10cSrcweir 			}
722cdf0e10cSrcweir 
endFastElement(sal_Int32 aElement)723cdf0e10cSrcweir 		virtual void SAL_CALL endFastElement( sal_Int32 aElement ) throw ( SAXException, RuntimeException)
724cdf0e10cSrcweir 			{
725cdf0e10cSrcweir 				if( aElement == mnElement )
726cdf0e10cSrcweir 				{
727cdf0e10cSrcweir 					if( maTo.hasValue() )
728cdf0e10cSrcweir 					{
729cdf0e10cSrcweir 						mpNode->setTo( maTo );
730cdf0e10cSrcweir 					}
731cdf0e10cSrcweir 					if( maBy.hasValue() )
732cdf0e10cSrcweir 					{
733cdf0e10cSrcweir 						mpNode->setBy( maBy );
734cdf0e10cSrcweir 					}
735cdf0e10cSrcweir 					if( maFrom.hasValue() )
736cdf0e10cSrcweir 					{
737cdf0e10cSrcweir 						mpNode->setFrom( maFrom );
738cdf0e10cSrcweir 					}
739cdf0e10cSrcweir 				}
740cdf0e10cSrcweir 			}
741cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)742cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken,
743cdf0e10cSrcweir 																																							const Reference< XFastAttributeList >& xAttribs )
744cdf0e10cSrcweir 			throw ( SAXException, RuntimeException )
745cdf0e10cSrcweir 			{
746cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
747cdf0e10cSrcweir 
748cdf0e10cSrcweir 				switch ( aElementToken )
749cdf0e10cSrcweir 				{
750cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
751cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
752cdf0e10cSrcweir 					break;
753cdf0e10cSrcweir 				case PPT_TOKEN( to ):
754cdf0e10cSrcweir 				{
755cdf0e10cSrcweir 					// CT_TLPoint
756cdf0e10cSrcweir 					Point p = GetPointPercent( xAttribs );
757cdf0e10cSrcweir 					maTo <<= p.X;
758cdf0e10cSrcweir 					maTo <<= p.Y;
759cdf0e10cSrcweir 					break;
760cdf0e10cSrcweir 				}
761cdf0e10cSrcweir 				case PPT_TOKEN( from ):
762cdf0e10cSrcweir 				{
763cdf0e10cSrcweir 					// CT_TLPoint
764cdf0e10cSrcweir 					Point p = GetPointPercent( xAttribs );
765cdf0e10cSrcweir 					maFrom <<= p.X;
766cdf0e10cSrcweir 					maFrom <<= p.Y;
767cdf0e10cSrcweir 					break;
768cdf0e10cSrcweir 				}
769cdf0e10cSrcweir 				case PPT_TOKEN( by ):
770cdf0e10cSrcweir 				{
771cdf0e10cSrcweir 					// CT_TLPoint
772cdf0e10cSrcweir 					Point p = GetPointPercent( xAttribs );
773cdf0e10cSrcweir 					maBy <<= p.X;
774cdf0e10cSrcweir 					maBy <<= p.Y;
775cdf0e10cSrcweir 					break;
776cdf0e10cSrcweir 				}
777cdf0e10cSrcweir 				default:
778cdf0e10cSrcweir 					break;
779cdf0e10cSrcweir 				}
780cdf0e10cSrcweir 
781cdf0e10cSrcweir 				if( !xRet.is() )
782cdf0e10cSrcweir 					xRet.set( this );
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 				return xRet;
785cdf0e10cSrcweir 			}
786cdf0e10cSrcweir 	private:
787cdf0e10cSrcweir 		Any maBy;
788cdf0e10cSrcweir 		Any maFrom;
789cdf0e10cSrcweir 		Any maTo;
790cdf0e10cSrcweir 		bool mbZoomContents;
791cdf0e10cSrcweir 	};
792cdf0e10cSrcweir 
793cdf0e10cSrcweir 
794cdf0e10cSrcweir 	/** CT_TLAnimateRotationBehavior */
795cdf0e10cSrcweir 	class AnimRotContext
796cdf0e10cSrcweir 		: public TimeNodeContext
797cdf0e10cSrcweir 	{
798cdf0e10cSrcweir 	public:
AnimRotContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)799cdf0e10cSrcweir         AnimRotContext( ContextHandler& rParent, sal_Int32  aElement,
800cdf0e10cSrcweir                         const Reference< XFastAttributeList >& xAttribs,
801cdf0e10cSrcweir                          const TimeNodePtr & pNode ) throw()
802cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
803cdf0e10cSrcweir 			{
804cdf0e10cSrcweir 				AttributeList attribs( xAttribs );
805cdf0e10cSrcweir 
806cdf0e10cSrcweir 				pNode->getNodeProperties()[ NP_TRANSFORMTYPE ]
807cdf0e10cSrcweir 					= makeAny((sal_Int16)AnimationTransformType::ROTATE);
808cdf0e10cSrcweir 				// TODO make sure the units are OK
809cdf0e10cSrcweir 				if(attribs.hasAttribute( XML_by ) )
810cdf0e10cSrcweir 				{
811cdf0e10cSrcweir 					sal_Int32 nBy = attribs.getInteger( XML_by, 0 );
8129af1d490SSteve Yin 					pNode->setBy( makeAny( (double)nBy ) );
813cdf0e10cSrcweir 				}
814cdf0e10cSrcweir 				if(attribs.hasAttribute( XML_from ) )
815cdf0e10cSrcweir 				{
816cdf0e10cSrcweir 					sal_Int32 nFrom = attribs.getInteger( XML_from, 0 );
817cdf0e10cSrcweir 					pNode->setFrom( makeAny( nFrom ) );
818cdf0e10cSrcweir 				}
819cdf0e10cSrcweir 				if(attribs.hasAttribute( XML_to ) )
820cdf0e10cSrcweir 				{
821cdf0e10cSrcweir 					sal_Int32 nTo = attribs.getInteger( XML_to, 0 );
822cdf0e10cSrcweir 					pNode->setTo( makeAny( nTo ) );
823cdf0e10cSrcweir 				}
824cdf0e10cSrcweir 			}
825cdf0e10cSrcweir 
~AnimRotContext()826cdf0e10cSrcweir 		~AnimRotContext( ) throw( )
827cdf0e10cSrcweir 			{
828cdf0e10cSrcweir 			}
829cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)830cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException )
831cdf0e10cSrcweir 			{
832cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
833cdf0e10cSrcweir 
834cdf0e10cSrcweir 				switch ( aElementToken )
835cdf0e10cSrcweir 				{
836cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
837cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
838cdf0e10cSrcweir 					break;
839cdf0e10cSrcweir 				default:
840cdf0e10cSrcweir 					break;
841cdf0e10cSrcweir 				}
842cdf0e10cSrcweir 
843cdf0e10cSrcweir 				if( !xRet.is() )
844cdf0e10cSrcweir 					xRet.set( this );
845cdf0e10cSrcweir 
846cdf0e10cSrcweir 				return xRet;
847cdf0e10cSrcweir 			}
848cdf0e10cSrcweir 	};
849cdf0e10cSrcweir 
850cdf0e10cSrcweir 
851cdf0e10cSrcweir 
852cdf0e10cSrcweir 	/** CT_TLAnimateMotionBehavior */
853cdf0e10cSrcweir 	class AnimMotionContext
854cdf0e10cSrcweir 		: public TimeNodeContext
855cdf0e10cSrcweir 	{
856cdf0e10cSrcweir 	public:
AnimMotionContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)857cdf0e10cSrcweir         AnimMotionContext( ContextHandler& rParent, sal_Int32  aElement,
858cdf0e10cSrcweir                          const Reference< XFastAttributeList >& xAttribs,
859cdf0e10cSrcweir                           const TimeNodePtr & pNode ) throw()
860cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
861cdf0e10cSrcweir 			{
862cdf0e10cSrcweir 				pNode->getNodeProperties()[ NP_TRANSFORMTYPE ]
863cdf0e10cSrcweir 					= makeAny((sal_Int16)AnimationTransformType::TRANSLATE);
864cdf0e10cSrcweir 
865cdf0e10cSrcweir 				AttributeList attribs( xAttribs );
866cdf0e10cSrcweir 				// ST_TLAnimateMotionBehaviorOrigin { parent, layour }
867cdf0e10cSrcweir 				sal_Int32 nOrigin = xAttribs->getOptionalValueToken( XML_origin, 0 );
868cdf0e10cSrcweir 				if( nOrigin != 0 )
869cdf0e10cSrcweir 				{
870cdf0e10cSrcweir 					switch(nOrigin)
871cdf0e10cSrcweir 					{
872cdf0e10cSrcweir 					case XML_layout:
873cdf0e10cSrcweir 					case XML_parent:
874cdf0e10cSrcweir 						break;
875cdf0e10cSrcweir 					}
876cdf0e10cSrcweir 					// TODO
877cdf0e10cSrcweir 				}
878cdf0e10cSrcweir 
879cdf0e10cSrcweir 				OUString aStr = xAttribs->getOptionalValue( XML_path );
880cdf0e10cSrcweir 				aStr = aStr.replace( 'E', ' ' );
881cdf0e10cSrcweir 				aStr = aStr.trim();
882cdf0e10cSrcweir 				pNode->getNodeProperties()[ NP_PATH ] = makeAny(aStr);
883cdf0e10cSrcweir 
884cdf0e10cSrcweir 				// ST_TLAnimateMotionPathEditMode{ fixed, relative }
885cdf0e10cSrcweir 				mnPathEditMode = xAttribs->getOptionalValueToken( XML_pathEditMode, 0 );
886cdf0e10cSrcweir 				msPtsTypes = xAttribs->getOptionalValue( XML_ptsTypes );
887cdf0e10cSrcweir 				mnAngle = attribs.getInteger( XML_rAng, 0 );
888cdf0e10cSrcweir 				// TODO make sure the units are right. Likely not.
889cdf0e10cSrcweir 			}
890cdf0e10cSrcweir 
~AnimMotionContext()891cdf0e10cSrcweir 		~AnimMotionContext( ) throw()
892cdf0e10cSrcweir 			{
893cdf0e10cSrcweir 			}
894cdf0e10cSrcweir 
895cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)896cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken,
897cdf0e10cSrcweir 																																							const Reference< XFastAttributeList >& xAttribs )
898cdf0e10cSrcweir 			throw ( SAXException, RuntimeException )
899cdf0e10cSrcweir 			{
900cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
901cdf0e10cSrcweir 
902cdf0e10cSrcweir 				switch ( aElementToken )
903cdf0e10cSrcweir 				{
904cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
905cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
906cdf0e10cSrcweir 					break;
907cdf0e10cSrcweir 				case PPT_TOKEN( to ):
908cdf0e10cSrcweir 				{
909cdf0e10cSrcweir 					// CT_TLPoint
910cdf0e10cSrcweir 					Point p = GetPointPercent( xAttribs );
911cdf0e10cSrcweir 					Any rAny;
912cdf0e10cSrcweir 					rAny <<= p.X;
913cdf0e10cSrcweir 					rAny <<= p.Y;
914cdf0e10cSrcweir 					mpNode->setTo( rAny );
915cdf0e10cSrcweir 					break;
916cdf0e10cSrcweir 				}
917cdf0e10cSrcweir 				case PPT_TOKEN( from ):
918cdf0e10cSrcweir 				{
919cdf0e10cSrcweir 					// CT_TLPoint
920cdf0e10cSrcweir 					Point p = GetPointPercent( xAttribs );
921cdf0e10cSrcweir 					Any rAny;
922cdf0e10cSrcweir 					rAny <<= p.X;
923cdf0e10cSrcweir 					rAny <<= p.Y;
924cdf0e10cSrcweir 					mpNode->setFrom( rAny );
925cdf0e10cSrcweir 					break;
926cdf0e10cSrcweir 				}
927cdf0e10cSrcweir 				case PPT_TOKEN( by ):
928cdf0e10cSrcweir 				{
929cdf0e10cSrcweir 					// CT_TLPoint
930cdf0e10cSrcweir 					Point p = GetPointPercent( xAttribs );
931cdf0e10cSrcweir 					Any rAny;
932cdf0e10cSrcweir 					rAny <<= p.X;
933cdf0e10cSrcweir 					rAny <<= p.Y;
934cdf0e10cSrcweir 					mpNode->setBy( rAny );
935cdf0e10cSrcweir 					break;
936cdf0e10cSrcweir 				}
937cdf0e10cSrcweir 				case PPT_TOKEN( rCtr ):
938cdf0e10cSrcweir 				{
939cdf0e10cSrcweir 					// CT_TLPoint
940cdf0e10cSrcweir 					Point p = GetPointPercent( xAttribs );
941cdf0e10cSrcweir 					// TODO push
942cdf0e10cSrcweir 					break;
943cdf0e10cSrcweir 				}
944cdf0e10cSrcweir 				default:
945cdf0e10cSrcweir 					break;
946cdf0e10cSrcweir 				}
947cdf0e10cSrcweir 
948cdf0e10cSrcweir 				if( !xRet.is() )
949cdf0e10cSrcweir 					xRet.set( this );
950cdf0e10cSrcweir 
951cdf0e10cSrcweir 				return xRet;
952cdf0e10cSrcweir 			}
953cdf0e10cSrcweir 	private:
954cdf0e10cSrcweir 		OUString msPtsTypes;
955cdf0e10cSrcweir 		sal_Int32 mnPathEditMode;
956cdf0e10cSrcweir 		sal_Int32 mnAngle;
957cdf0e10cSrcweir 	};
958cdf0e10cSrcweir 
959cdf0e10cSrcweir 
960cdf0e10cSrcweir 	/** CT_TLAnimateEffectBehavior */
961cdf0e10cSrcweir 	class AnimEffectContext
962cdf0e10cSrcweir 		: public TimeNodeContext
963cdf0e10cSrcweir 	{
964cdf0e10cSrcweir 	public:
AnimEffectContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)965cdf0e10cSrcweir         AnimEffectContext( ContextHandler& rParent, sal_Int32  aElement,
966cdf0e10cSrcweir                              const Reference< XFastAttributeList >& xAttribs,
967cdf0e10cSrcweir                              const TimeNodePtr & pNode ) throw()
968cdf0e10cSrcweir             : TimeNodeContext( rParent, aElement, xAttribs, pNode )
969cdf0e10cSrcweir 			{
970cdf0e10cSrcweir 				sal_Int32 nDir = xAttribs->getOptionalValueToken( XML_transition, 0 );
971cdf0e10cSrcweir 				OUString sFilter = xAttribs->getOptionalValue( XML_filter );
972cdf0e10cSrcweir 				// TODO
973cdf0e10cSrcweir //				OUString sPrList = xAttribs->getOptionalValue( XML_prLst );
974cdf0e10cSrcweir 
975cdf0e10cSrcweir 				if( sFilter.getLength() )
976cdf0e10cSrcweir 				{
977cdf0e10cSrcweir 					SlideTransition aFilter( sFilter );
978cdf0e10cSrcweir 					aFilter.setMode( nDir == XML_out ? false : true );
979cdf0e10cSrcweir 					pNode->setTransitionFilter( aFilter );
980cdf0e10cSrcweir 				}
981cdf0e10cSrcweir 			}
982cdf0e10cSrcweir 
983cdf0e10cSrcweir 
~AnimEffectContext()984cdf0e10cSrcweir 		~AnimEffectContext( ) throw()
985cdf0e10cSrcweir 			{
986cdf0e10cSrcweir 			}
987cdf0e10cSrcweir 
988cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)989cdf0e10cSrcweir 		virtual Reference< XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw ( SAXException, RuntimeException )
990cdf0e10cSrcweir 			{
991cdf0e10cSrcweir 				Reference< XFastContextHandler > xRet;
992cdf0e10cSrcweir 
993cdf0e10cSrcweir 				switch ( aElementToken )
994cdf0e10cSrcweir 				{
995cdf0e10cSrcweir 				case PPT_TOKEN( cBhvr ):
996cdf0e10cSrcweir                     xRet.set( new CommonBehaviorContext ( *this, xAttribs, mpNode ) );
997cdf0e10cSrcweir 					break;
998cdf0e10cSrcweir 				case PPT_TOKEN( progress ):
999cdf0e10cSrcweir                     xRet.set( new AnimVariantContext( *this, aElementToken, maProgress ) );
1000cdf0e10cSrcweir 					// TODO handle it.
1001cdf0e10cSrcweir 					break;
1002cdf0e10cSrcweir 				default:
1003cdf0e10cSrcweir 					break;
1004cdf0e10cSrcweir 				}
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 				if( !xRet.is() )
1007cdf0e10cSrcweir 					xRet.set( this );
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir 				return xRet;
1010cdf0e10cSrcweir 			}
1011cdf0e10cSrcweir 	private:
1012cdf0e10cSrcweir 		Any maProgress;
1013cdf0e10cSrcweir 		OUString msFilter;
1014cdf0e10cSrcweir 		OUString msPrList;
1015cdf0e10cSrcweir 	};
1016cdf0e10cSrcweir 
1017cdf0e10cSrcweir 
1018cdf0e10cSrcweir 
makeContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> & xAttribs,const TimeNodePtr & pNode)1019cdf0e10cSrcweir     TimeNodeContext * TimeNodeContext::makeContext(
1020cdf0e10cSrcweir             ContextHandler& rParent, sal_Int32  aElement,
1021cdf0e10cSrcweir             const Reference< XFastAttributeList >& xAttribs,
1022cdf0e10cSrcweir             const TimeNodePtr & pNode )
1023cdf0e10cSrcweir 	{
1024cdf0e10cSrcweir 		TimeNodeContext *pCtx = NULL;
1025cdf0e10cSrcweir 		switch( aElement )
1026cdf0e10cSrcweir 		{
1027cdf0e10cSrcweir 		case PPT_TOKEN( animClr ):
1028cdf0e10cSrcweir             pCtx = new AnimColorContext( rParent, aElement, xAttribs, pNode );
1029cdf0e10cSrcweir 			break;
1030cdf0e10cSrcweir 		case PPT_TOKEN( par ):
1031cdf0e10cSrcweir             pCtx = new ParallelExclTimeNodeContext( rParent, aElement, xAttribs, pNode );
1032cdf0e10cSrcweir 			break;
1033cdf0e10cSrcweir 		case PPT_TOKEN( seq ):
1034cdf0e10cSrcweir             pCtx = new SequenceTimeNodeContext( rParent, aElement, xAttribs, pNode );
1035cdf0e10cSrcweir 			break;
1036cdf0e10cSrcweir 		case PPT_TOKEN( excl ):
1037cdf0e10cSrcweir             pCtx = new ParallelExclTimeNodeContext( rParent, aElement, xAttribs, pNode );
1038cdf0e10cSrcweir 			break;
1039cdf0e10cSrcweir 		case PPT_TOKEN( anim ):
1040cdf0e10cSrcweir             pCtx = new AnimContext ( rParent, aElement, xAttribs, pNode );
1041cdf0e10cSrcweir 			break;
1042cdf0e10cSrcweir 		case PPT_TOKEN( animEffect ):
1043cdf0e10cSrcweir             pCtx = new AnimEffectContext( rParent, aElement, xAttribs, pNode );
1044cdf0e10cSrcweir 			break;
1045cdf0e10cSrcweir 		case PPT_TOKEN( animMotion ):
1046cdf0e10cSrcweir             pCtx = new AnimMotionContext( rParent, aElement, xAttribs, pNode );
1047cdf0e10cSrcweir 			break;
1048cdf0e10cSrcweir 		case PPT_TOKEN( animRot ):
1049cdf0e10cSrcweir             pCtx = new AnimRotContext( rParent, aElement, xAttribs, pNode );
1050cdf0e10cSrcweir 			break;
1051cdf0e10cSrcweir 		case PPT_TOKEN( animScale ):
1052cdf0e10cSrcweir             pCtx = new AnimScaleContext( rParent, aElement, xAttribs, pNode );
1053cdf0e10cSrcweir 			break;
1054cdf0e10cSrcweir 		case PPT_TOKEN( cmd ):
1055cdf0e10cSrcweir             pCtx = new CmdTimeNodeContext( rParent, aElement, xAttribs, pNode );
1056cdf0e10cSrcweir 			break;
1057cdf0e10cSrcweir 		case PPT_TOKEN( set ):
1058cdf0e10cSrcweir             pCtx = new SetTimeNodeContext( rParent, aElement, xAttribs, pNode );
1059cdf0e10cSrcweir 			break;
1060cdf0e10cSrcweir 		case PPT_TOKEN( audio ):
1061cdf0e10cSrcweir 		case PPT_TOKEN( video ):
1062cdf0e10cSrcweir             pCtx = new MediaNodeContext( rParent, aElement, xAttribs, pNode );
1063cdf0e10cSrcweir 			break;
1064cdf0e10cSrcweir 		default:
1065cdf0e10cSrcweir 			break;
1066cdf0e10cSrcweir 		}
1067cdf0e10cSrcweir 		return pCtx;
1068cdf0e10cSrcweir 	}
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir 
TimeNodeContext(ContextHandler & rParent,sal_Int32 aElement,const Reference<XFastAttributeList> &,const TimeNodePtr & pNode)1071cdf0e10cSrcweir     TimeNodeContext::TimeNodeContext( ContextHandler& rParent, sal_Int32 aElement,
1072cdf0e10cSrcweir             const Reference< XFastAttributeList >& /*xAttribs*/,
1073cdf0e10cSrcweir             const TimeNodePtr & pNode ) throw()
1074cdf0e10cSrcweir         : ContextHandler( rParent )
1075cdf0e10cSrcweir 		, mnElement( aElement )
1076cdf0e10cSrcweir 		, mpNode( pNode )
1077cdf0e10cSrcweir 	{
1078cdf0e10cSrcweir 	}
1079cdf0e10cSrcweir 
1080cdf0e10cSrcweir 
~TimeNodeContext()1081cdf0e10cSrcweir 	TimeNodeContext::~TimeNodeContext( ) throw()
1082cdf0e10cSrcweir 	{
1083cdf0e10cSrcweir 
1084cdf0e10cSrcweir 	}
1085cdf0e10cSrcweir 
1086cdf0e10cSrcweir 
TimeNodeListContext(ContextHandler & rParent,TimeNodePtrList & aList)1087cdf0e10cSrcweir     TimeNodeListContext::TimeNodeListContext( ContextHandler& rParent, TimeNodePtrList & aList )
1088cdf0e10cSrcweir 		throw()
1089cdf0e10cSrcweir         : ContextHandler( rParent )
1090cdf0e10cSrcweir 			, maList( aList )
1091cdf0e10cSrcweir 	{
1092cdf0e10cSrcweir 	}
1093cdf0e10cSrcweir 
1094cdf0e10cSrcweir 
~TimeNodeListContext()1095cdf0e10cSrcweir 	TimeNodeListContext::~TimeNodeListContext( ) throw()
1096cdf0e10cSrcweir 	{
1097cdf0e10cSrcweir 	}
1098cdf0e10cSrcweir 
1099cdf0e10cSrcweir 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)1100cdf0e10cSrcweir 	Reference< XFastContextHandler > SAL_CALL TimeNodeListContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
1101cdf0e10cSrcweir 	{
1102cdf0e10cSrcweir 		Reference< XFastContextHandler > xRet;
1103cdf0e10cSrcweir 
1104cdf0e10cSrcweir 		sal_Int16 nNodeType;
1105cdf0e10cSrcweir 
1106cdf0e10cSrcweir 		switch( aElementToken )
1107cdf0e10cSrcweir 		{
1108cdf0e10cSrcweir 		case PPT_TOKEN( par ):
1109cdf0e10cSrcweir 			nNodeType = AnimationNodeType::PAR;
1110cdf0e10cSrcweir 			break;
1111cdf0e10cSrcweir 		case PPT_TOKEN( seq ):
1112cdf0e10cSrcweir 			nNodeType = AnimationNodeType::SEQ;
1113cdf0e10cSrcweir 			break;
1114cdf0e10cSrcweir 		case PPT_TOKEN( excl ):
1115cdf0e10cSrcweir 			// TODO pick the right type. We choose parallel for now as
1116cdf0e10cSrcweir 			// there does not seem to be an "Exclusive"
1117cdf0e10cSrcweir 			nNodeType = AnimationNodeType::PAR;
1118cdf0e10cSrcweir 			break;
1119cdf0e10cSrcweir 		case PPT_TOKEN( anim ):
1120cdf0e10cSrcweir 			nNodeType = AnimationNodeType::ANIMATE;
1121cdf0e10cSrcweir 			break;
1122cdf0e10cSrcweir 		case PPT_TOKEN( animClr ):
1123cdf0e10cSrcweir 			nNodeType = AnimationNodeType::ANIMATECOLOR;
1124cdf0e10cSrcweir 			break;
1125cdf0e10cSrcweir 		case PPT_TOKEN( animEffect ):
1126cdf0e10cSrcweir 			nNodeType = AnimationNodeType::TRANSITIONFILTER;
1127cdf0e10cSrcweir 			break;
1128cdf0e10cSrcweir 		case PPT_TOKEN( animMotion ):
1129cdf0e10cSrcweir 			nNodeType = AnimationNodeType::ANIMATEMOTION;
1130cdf0e10cSrcweir 			break;
1131cdf0e10cSrcweir 		case PPT_TOKEN( animRot ):
1132cdf0e10cSrcweir 		case PPT_TOKEN( animScale ):
1133cdf0e10cSrcweir 			nNodeType = AnimationNodeType::ANIMATETRANSFORM;
1134cdf0e10cSrcweir 			break;
1135cdf0e10cSrcweir 		case PPT_TOKEN( cmd ):
1136cdf0e10cSrcweir 			nNodeType = AnimationNodeType::COMMAND;
1137cdf0e10cSrcweir 			break;
1138cdf0e10cSrcweir 		case PPT_TOKEN( set ):
1139cdf0e10cSrcweir 			nNodeType = AnimationNodeType::SET;
1140cdf0e10cSrcweir 			break;
1141cdf0e10cSrcweir 		case PPT_TOKEN( audio ):
1142cdf0e10cSrcweir 			nNodeType = AnimationNodeType::AUDIO;
1143cdf0e10cSrcweir 			break;
1144cdf0e10cSrcweir 		case PPT_TOKEN( video ):
1145cdf0e10cSrcweir 			nNodeType = AnimationNodeType::AUDIO;
1146cdf0e10cSrcweir 			OSL_TRACE( "OOX: video requested, gave Audio instead" );
1147cdf0e10cSrcweir 			break;
1148cdf0e10cSrcweir 
1149cdf0e10cSrcweir 		default:
1150cdf0e10cSrcweir 			nNodeType = AnimationNodeType::CUSTOM;
1151cdf0e10cSrcweir 			OSL_TRACE( "OOX: uhandled token %x", aElementToken );
1152cdf0e10cSrcweir 			break;
1153cdf0e10cSrcweir 		}
1154cdf0e10cSrcweir 
1155cdf0e10cSrcweir 		TimeNodePtr pNode(new TimeNode(nNodeType));
1156cdf0e10cSrcweir 		maList.push_back( pNode );
1157cdf0e10cSrcweir         ContextHandler * pContext = TimeNodeContext::makeContext( *this, aElementToken, xAttribs, pNode );
1158cdf0e10cSrcweir         xRet.set( pContext ? pContext : this );
1159cdf0e10cSrcweir 
1160cdf0e10cSrcweir 		return xRet;
1161cdf0e10cSrcweir 	}
1162cdf0e10cSrcweir 
1163cdf0e10cSrcweir 
1164cdf0e10cSrcweir } }
1165