LCOV - code coverage report
Current view: top level - oox/source/ppt - animvariantcontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 15 28 53.6 %
Date: 2015-06-13 12:38:46 Functions: 7 7 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 "animvariantcontext.hxx"
      21             : 
      22             : #include "comphelper/anytostring.hxx"
      23             : #include "cppuhelper/exc_hlp.hxx"
      24             : #include <osl/diagnose.h>
      25             : 
      26             : #include <com/sun/star/uno/Any.hxx>
      27             : #include <rtl/ustring.hxx>
      28             : 
      29             : #include "oox/helper/attributelist.hxx"
      30             : #include "oox/core/fragmenthandler.hxx"
      31             : #include "oox/core/xmlfilterbase.hxx"
      32             : #include "drawingml/colorchoicecontext.hxx"
      33             : #include "pptfilterhelpers.hxx"
      34             : 
      35             : using namespace ::oox::core;
      36             : using namespace ::com::sun::star::uno;
      37             : using namespace ::com::sun::star::xml::sax;
      38             : 
      39             : namespace oox { namespace ppt {
      40             : 
      41           7 :     AnimVariantContext::AnimVariantContext( FragmentHandler2& rParent, sal_Int32 aElement, Any & aValue )
      42             :         : FragmentHandler2( rParent )
      43             :             , mnElement( aElement )
      44           7 :             , maValue( aValue )
      45             :     {
      46           7 :     }
      47             : 
      48          14 :     AnimVariantContext::~AnimVariantContext( ) throw( )
      49             :     {
      50          14 :     }
      51             : 
      52          14 :     void AnimVariantContext::onEndElement()
      53             :     {
      54          14 :         if( isCurrentElement( mnElement ) && maColor.isUsed() )
      55             :         {
      56           0 :             maValue = makeAny( maColor.getColor( getFilter().getGraphicHelper() ) );
      57             :         }
      58          14 :     }
      59             : 
      60           7 :     ContextHandlerRef AnimVariantContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      61             :     {
      62           7 :         switch( aElementToken )
      63             :         {
      64             :         case PPT_TOKEN( boolVal ):
      65             :         {
      66           0 :             bool val = rAttribs.getBool( XML_val, false );
      67           0 :             maValue = makeAny( val );
      68           0 :             return this;
      69             :         }
      70             :         case PPT_TOKEN( clrVal ):
      71           0 :             return new ::oox::drawingml::ColorContext( *this, maColor );
      72             :             // we'll defer setting the Any until the end.
      73             :         case PPT_TOKEN( fltVal ):
      74             :         {
      75           0 :             double val = rAttribs.getDouble( XML_val, 0.0 );
      76           0 :             maValue = makeAny( val );
      77           0 :             return this;
      78             :         }
      79             :         case PPT_TOKEN( intVal ):
      80             :         {
      81           0 :             sal_Int32 val = rAttribs.getInteger( XML_val, 0 );
      82           0 :             maValue = makeAny( val );
      83           0 :             return this;
      84             :         }
      85             :         case PPT_TOKEN( strVal ):
      86             :         {
      87           7 :             OUString val = rAttribs.getString( XML_val, OUString() );
      88           7 :             convertMeasure( val ); // ignore success or failure if it fails, use as is
      89           7 :             maValue = makeAny( val );
      90           7 :             return this;
      91             :         }
      92             :         default:
      93           0 :             break;
      94             :         }
      95             : 
      96           0 :         return this;
      97             :     }
      98             : 
      99         246 : } }
     100             : 
     101             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11