LCOV - code coverage report
Current view: top level - oox/source/drawingml - colorchoicecontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 35 0.0 %
Date: 2014-04-14 Functions: 0 5 0.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 "oox/drawingml/drawingmltypes.hxx"
      21             : #include "oox/drawingml/colorchoicecontext.hxx"
      22             : #include "oox/helper/attributelist.hxx"
      23             : #include "oox/drawingml/color.hxx"
      24             : 
      25             : using ::com::sun::star::uno::Reference;
      26             : using ::com::sun::star::uno::RuntimeException;
      27             : using ::com::sun::star::xml::sax::SAXException;
      28             : using ::com::sun::star::xml::sax::XFastAttributeList;
      29             : using ::com::sun::star::xml::sax::XFastContextHandler;
      30             : using ::oox::core::ContextHandler;
      31             : 
      32             : namespace oox {
      33             : namespace drawingml {
      34             : 
      35             : 
      36             : 
      37           0 : ColorValueContext::ColorValueContext( ContextHandler2Helper& rParent, Color& rColor ) :
      38             :     ContextHandler2( rParent ),
      39           0 :     mrColor( rColor )
      40             : {
      41           0 : }
      42             : 
      43           0 : void ColorValueContext::onStartElement( const AttributeList& rAttribs )
      44             : {
      45           0 :     switch( getCurrentElement() )
      46             :     {
      47             :         case A_TOKEN( scrgbClr ):
      48             :             mrColor.setScrgbClr(
      49             :                 rAttribs.getInteger( XML_r, 0 ),
      50             :                 rAttribs.getInteger( XML_g, 0 ),
      51           0 :                 rAttribs.getInteger( XML_b, 0 ) );
      52           0 :         break;
      53             : 
      54             :         case A_TOKEN( srgbClr ):
      55           0 :             mrColor.setSrgbClr( rAttribs.getIntegerHex( XML_val, 0 ) );
      56           0 :         break;
      57             : 
      58             :         case A_TOKEN( hslClr ):
      59             :             mrColor.setHslClr(
      60             :                 rAttribs.getInteger( XML_hue, 0 ),
      61             :                 rAttribs.getInteger( XML_sat, 0 ),
      62           0 :                 rAttribs.getInteger( XML_lum, 0 ) );
      63           0 :         break;
      64             : 
      65             :         case A_TOKEN( sysClr ):
      66             :             mrColor.setSysClr(
      67             :                 rAttribs.getToken( XML_val, XML_TOKEN_INVALID ),
      68           0 :                 rAttribs.getIntegerHex( XML_lastClr, -1 ) );
      69           0 :         break;
      70             : 
      71             :         case A_TOKEN( schemeClr ):
      72             :         {
      73           0 :             mrColor.setSchemeClr( rAttribs.getToken( XML_val, XML_TOKEN_INVALID ) );
      74           0 :             oox::OptValue<rtl::OUString> sSchemeName = rAttribs.getString( XML_val );
      75           0 :             if( sSchemeName.has() )
      76           0 :                 mrColor.setSchemeName( sSchemeName.use() );
      77             :         }
      78           0 :         break;
      79             : 
      80             :         case A_TOKEN( prstClr ):
      81           0 :             mrColor.setPrstClr( rAttribs.getToken( XML_val, XML_TOKEN_INVALID ) );
      82           0 :         break;
      83             :     }
      84           0 : }
      85             : 
      86           0 : ::oox::core::ContextHandlerRef ColorValueContext::onCreateContext(
      87             :         sal_Int32 nElement, const AttributeList& rAttribs )
      88             : {
      89           0 :     switch( nElement )
      90             :     {
      91             :         case A_TOKEN( alpha ):
      92             :         case A_TOKEN( alphaMod ):
      93             :         case A_TOKEN( alphaOff ):
      94             :         case A_TOKEN( blue ):
      95             :         case A_TOKEN( blueMod ):
      96             :         case A_TOKEN( blueOff ):
      97             :         case A_TOKEN( hue ):
      98             :         case A_TOKEN( hueMod ):
      99             :         case A_TOKEN( hueOff ):
     100             :         case A_TOKEN( lum ):
     101             :         case A_TOKEN( lumMod ):
     102             :         case A_TOKEN( lumOff ):
     103             :         case A_TOKEN( green ):
     104             :         case A_TOKEN( greenMod ):
     105             :         case A_TOKEN( greenOff ):
     106             :         case A_TOKEN( red ):
     107             :         case A_TOKEN( redMod ):
     108             :         case A_TOKEN( redOff ):
     109             :         case A_TOKEN( sat ):
     110             :         case A_TOKEN( satMod ):
     111             :         case A_TOKEN( satOff ):
     112             :         case A_TOKEN( shade ):
     113             :         case A_TOKEN( tint ):
     114           0 :             mrColor.addTransformation( nElement, rAttribs.getInteger( XML_val, 0 ) );
     115           0 :         break;
     116             :         case A_TOKEN( comp ):
     117             :         case A_TOKEN( gamma ):
     118             :         case A_TOKEN( gray ):
     119             :         case A_TOKEN( inv ):
     120             :         case A_TOKEN( invGamma ):
     121           0 :             mrColor.addTransformation( nElement );
     122           0 :         break;
     123             :     }
     124           0 :     return 0;
     125             : }
     126             : 
     127             : 
     128             : 
     129           0 : ColorContext::ColorContext( ContextHandler2Helper& rParent, Color& rColor ) :
     130             :     ContextHandler2( rParent ),
     131           0 :     mrColor( rColor )
     132             : {
     133           0 : }
     134             : 
     135           0 : ::oox::core::ContextHandlerRef ColorContext::onCreateContext(
     136             :         sal_Int32 nElement, const AttributeList& )
     137             : {
     138           0 :     switch( nElement )
     139             :     {
     140             :         case A_TOKEN( scrgbClr ):
     141             :         case A_TOKEN( srgbClr ):
     142             :         case A_TOKEN( hslClr ):
     143             :         case A_TOKEN( sysClr ):
     144             :         case A_TOKEN( schemeClr ):
     145             :         case A_TOKEN( prstClr ):
     146           0 :             return new ColorValueContext( *this, mrColor );
     147             :     }
     148           0 :     return 0;
     149             : }
     150             : 
     151             : 
     152             : 
     153             : } // namespace drawingml
     154             : } // namespace oox
     155             : 
     156             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10