1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #include "timeanimvaluecontext.hxx"
29 
30 #include "animvariantcontext.hxx"
31 
32 using namespace ::oox::core;
33 using namespace ::com::sun::star::uno;
34 using namespace ::com::sun::star::xml::sax;
35 
36 namespace oox { namespace ppt {
37 
38     TimeAnimValueListContext::TimeAnimValueListContext( ContextHandler& rParent,
39                 const Reference< XFastAttributeList >& /*xAttribs*/,
40                 TimeAnimationValueList & aTavList )
41         : ContextHandler( rParent )
42 			, maTavList( aTavList )
43 			, mbInValue( false )
44 	{
45 	}
46 
47 
48 	TimeAnimValueListContext::~TimeAnimValueListContext( )
49 	{
50 	}
51 
52 
53 	void SAL_CALL TimeAnimValueListContext::endFastElement( sal_Int32 aElement )
54 		throw ( SAXException, RuntimeException)
55 	{
56 		if( aElement == PPT_TOKEN( tav ) )
57 		{
58 			mbInValue = false;
59 		}
60 	}
61 
62 
63 	Reference< XFastContextHandler > SAL_CALL TimeAnimValueListContext::createFastChildContext( ::sal_Int32 aElementToken,
64 																																															const Reference< XFastAttributeList >& xAttribs )
65 		throw ( SAXException, RuntimeException )
66 	{
67 		Reference< XFastContextHandler > xRet;
68 
69 		switch ( aElementToken )
70 		{
71 		case PPT_TOKEN( tav ):
72 		{
73 			mbInValue = true;
74 			TimeAnimationValue val;
75 			val.msFormula = xAttribs->getOptionalValue( XML_fmla );
76 			val.msTime =  xAttribs->getOptionalValue( XML_tm );
77 			maTavList.push_back( val );
78 			break;
79 		}
80 		case PPT_TOKEN( val ):
81 			if( mbInValue )
82 			{
83 				// CT_TLAnimVariant
84                 xRet.set( new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ) );
85 			}
86 			break;
87 		default:
88 			break;
89 		}
90 
91 		if( !xRet.is() )
92 			xRet.set( this );
93 
94 		return xRet;
95 	}
96 
97 
98 } }
99