xref: /AOO41X/main/oox/source/ppt/timeanimvaluecontext.cxx (revision ca5ec2004b000a7d9aaa8381be8ac2853e3b1dc7)
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 
TimeAnimValueListContext(ContextHandler & rParent,const Reference<XFastAttributeList> &,TimeAnimationValueList & aTavList)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 
~TimeAnimValueListContext()44     TimeAnimValueListContext::~TimeAnimValueListContext( )
45     {
46     }
47 
48 
endFastElement(sal_Int32 aElement)49     void SAL_CALL TimeAnimValueListContext::endFastElement( sal_Int32 aElement )
50         throw ( SAXException, RuntimeException)
51     {
52         if( aElement == PPT_TOKEN( tav ) )
53         {
54             mbInValue = false;
55         }
56     }
57 
58 
createFastChildContext(::sal_Int32 aElementToken,const Reference<XFastAttributeList> & xAttribs)59     Reference< XFastContextHandler > SAL_CALL TimeAnimValueListContext::createFastChildContext( ::sal_Int32 aElementToken,
60                                                                                                                                                                                             const Reference< XFastAttributeList >& xAttribs )
61         throw ( SAXException, RuntimeException )
62     {
63         Reference< XFastContextHandler > xRet;
64 
65         switch ( aElementToken )
66         {
67         case PPT_TOKEN( tav ):
68         {
69             mbInValue = true;
70             TimeAnimationValue val;
71             val.msFormula = xAttribs->getOptionalValue( XML_fmla );
72             val.msTime =  xAttribs->getOptionalValue( XML_tm );
73             maTavList.push_back( val );
74             break;
75         }
76         case PPT_TOKEN( val ):
77             if( mbInValue )
78             {
79                 // CT_TLAnimVariant
80                 xRet.set( new AnimVariantContext( *this, aElementToken, maTavList.back().maValue ) );
81             }
82             break;
83         default:
84             break;
85         }
86 
87         if( !xRet.is() )
88             xRet.set( this );
89 
90         return xRet;
91     }
92 
93 
94 } }
95