xref: /trunk/main/oox/source/ppt/timeanimvaluecontext.cxx (revision 45c5a00162811bd03b87fcb4fe9996782f2b59ec)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "timeanimvaluecontext.hxx"
25 
26 #include "animvariantcontext.hxx"
27 
28 using namespace ::oox::core;
29 using namespace ::com::sun::star::uno;
30 using namespace ::com::sun::star::xml::sax;
31 
32 namespace oox { namespace ppt {
33 
34     TimeAnimValueListContext::TimeAnimValueListContext( ContextHandler& rParent,
35                 const Reference< XFastAttributeList >& /*xAttribs*/,
36                 TimeAnimationValueList & aTavList )
37         : ContextHandler( rParent )
38             , maTavList( aTavList )
39             , mbInValue( false )
40     {
41     }
42 
43 
44     TimeAnimValueListContext::~TimeAnimValueListContext( )
45     {
46     }
47 
48 
49     void SAL_CALL TimeAnimValueListContext::endFastElement( sal_Int32 aElement )
50     {
51         if( aElement == PPT_TOKEN( tav ) )
52         {
53             mbInValue = false;
54         }
55     }
56 
57 
58     Reference< XFastContextHandler > SAL_CALL TimeAnimValueListContext::createFastChildContext( ::sal_Int32 aElementToken,
59                                                                                                                                                                                             const Reference< XFastAttributeList >& xAttribs )
60     {
61         Reference< XFastContextHandler > xRet;
62 
63         switch ( aElementToken )
64         {
65         case PPT_TOKEN( tav ):
66         {
67             mbInValue = true;
68             TimeAnimationValue val;
69             val.msFormula = xAttribs->getOptionalValue( XML_fmla );
70             val.msTime =  xAttribs->getOptionalValue( XML_tm );
71             maTavList.push_back( val );
72             break;
73         }
74         case PPT_TOKEN( val ):
75             if( mbInValue )
76             {
77                 // CT_TLAnimVariant
78                 xRet.set( new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ) );
79             }
80             break;
81         default:
82             break;
83         }
84 
85         if( !xRet.is() )
86             xRet.set( this );
87 
88         return xRet;
89     }
90 
91 
92 } }
93