LibreOffice Module oox (master)  1
timeanimvaluecontext.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include "timeanimvaluecontext.hxx"
21 
22 #include "animvariantcontext.hxx"
23 
25 #include <oox/token/namespaces.hxx>
26 #include <oox/token/tokens.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::ppt {
33 
34  TimeAnimValueListContext::TimeAnimValueListContext( FragmentHandler2 const & rParent,
35  TimeAnimationValueList & aTavList )
36  : FragmentHandler2( rParent )
37  , maTavList( aTavList )
38  , mbInValue( false )
39  {
40  }
41 
43  {
44  }
45 
47  {
48  if( isCurrentElement( PPT_TOKEN( tav ) ) )
49  {
50  mbInValue = false;
51  }
52  }
53 
55  {
56 
57  switch ( aElementToken )
58  {
59  case PPT_TOKEN( tav ):
60  {
61  mbInValue = true;
63  val.msFormula = rAttribs.getString( XML_fmla, OUString() );
64  val.msTime = rAttribs.getString( XML_tm, OUString() );
65  maTavList.push_back( val );
66  return this;
67  }
68  case PPT_TOKEN( val ):
69  if( mbInValue )
70  {
71  // CT_TLAnimVariant
72  return new AnimVariantContext( *this, aElementToken, maTavList.back().maValue );
73  }
74  break;
75  default:
76  break;
77  }
78 
79  return this;
80  }
81 
82 }
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
TimeAnimValueListContext(::oox::core::FragmentHandler2 const &rParent, TimeAnimationValueList &aTavList)
bool isCurrentElement(sal_Int32 nElement) const
Returns true, if nElement contains the identifier of the currently processed element.
virtual ::oox::core::ContextHandlerRef onCreateContext(sal_Int32 aElementToken, const AttributeList &rAttribs) override
Will be called to create a context handler for the passed element.
OptValue< OUString > getString(sal_Int32 nAttrToken) const
Returns the string value of the specified attribute.
TimeAnimationValueList maTavList
::std::vector< TimeAnimationValue > TimeAnimationValueList
Provides access to attribute values of an element.
virtual void onEndElement() override
Will be called when the current element is about to be left.
context CT_TLAnimVariant