Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / oox / source / ppt / animvariantcontext.cxx
blob81a70acfe26ec87489c4fccab642ac6039e437f3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "animvariantcontext.hxx"
22 #include <cppuhelper/exc_hlp.hxx>
24 #include <com/sun/star/uno/Any.hxx>
25 #include <com/sun/star/drawing/FillStyle.hpp>
26 #include <rtl/ustring.hxx>
28 #include <oox/helper/attributelist.hxx>
29 #include <oox/core/fragmenthandler.hxx>
30 #include <oox/core/xmlfilterbase.hxx>
31 #include <drawingml/colorchoicecontext.hxx>
32 #include <oox/token/namespaces.hxx>
33 #include <oox/token/tokens.hxx>
34 #include <oox/ppt/pptfilterhelpers.hxx>
36 using namespace ::oox::core;
37 using namespace ::com::sun::star::uno;
38 using namespace ::com::sun::star::xml::sax;
40 namespace oox { namespace ppt {
41 AnimVariantContext::AnimVariantContext( FragmentHandler2 const & rParent, sal_Int32 aElement, Any & aValue )
42 : FragmentHandler2( rParent )
43 , mnElement( aElement )
44 , maValue( aValue )
48 AnimVariantContext::~AnimVariantContext( ) throw( )
52 void AnimVariantContext::onEndElement()
54 if( isCurrentElement( mnElement ) && maColor.isUsed() )
56 maValue <<= maColor.getColor( getFilter().getGraphicHelper() );
60 ContextHandlerRef AnimVariantContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
62 switch( aElementToken )
64 case PPT_TOKEN( boolVal ):
66 bool val = rAttribs.getBool( XML_val, false );
67 maValue <<= val;
68 return this;
70 case PPT_TOKEN( clrVal ):
71 return new ::oox::drawingml::ColorContext( *this, maColor );
72 // we'll defer setting the Any until the end.
73 case PPT_TOKEN( fltVal ):
75 double val = rAttribs.getDouble( XML_val, 0.0 );
76 maValue <<= val;
77 return this;
79 case PPT_TOKEN( intVal ):
81 sal_Int32 val = rAttribs.getInteger( XML_val, 0 );
82 maValue <<= val;
83 return this;
85 case PPT_TOKEN( strVal ):
87 OUString val = rAttribs.getString( XML_val, OUString() );
88 maValue <<= val;
89 return this;
91 default:
92 break;
95 return this;
98 } }
100 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */