LCOV - code coverage report
Current view: top level - libreoffice/oox/source/drawingml - clrschemecontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 33 34 97.1 %
Date: 2012-12-27 Functions: 9 9 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 "oox/drawingml/clrschemecontext.hxx"
      21             : #include "oox/core/xmlfilterbase.hxx"
      22             : 
      23             : using namespace ::oox::core;
      24             : using namespace ::com::sun::star::uno;
      25             : using namespace ::com::sun::star::xml::sax;
      26             : 
      27             : namespace oox { namespace drawingml {
      28             : 
      29          60 : static void setClrMap( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes,
      30             :             ClrMap& rClrMap, sal_Int32 nToken )
      31             : {
      32          60 :     if ( xAttributes->hasAttribute( nToken ) )
      33             :     {
      34          60 :         sal_Int32 nMappedToken = xAttributes->getOptionalValueToken( nToken, 0 );
      35          60 :         rClrMap.setColorMap( nToken, nMappedToken );
      36             :     }
      37          60 : }
      38             : 
      39           5 : clrMapContext::clrMapContext( ContextHandler& rParent,
      40             :     const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, ClrMap& rClrMap )
      41           5 : : ContextHandler( rParent )
      42             : {
      43           5 :     setClrMap( xAttributes, rClrMap, XML_bg1 );
      44           5 :     setClrMap( xAttributes, rClrMap, XML_tx1 );
      45           5 :     setClrMap( xAttributes, rClrMap, XML_bg2 );
      46           5 :     setClrMap( xAttributes, rClrMap, XML_tx2 );
      47           5 :     setClrMap( xAttributes, rClrMap, XML_accent1 );
      48           5 :     setClrMap( xAttributes, rClrMap, XML_accent2 );
      49           5 :     setClrMap( xAttributes, rClrMap, XML_accent3 );
      50           5 :     setClrMap( xAttributes, rClrMap, XML_accent4 );
      51           5 :     setClrMap( xAttributes, rClrMap, XML_accent5 );
      52           5 :     setClrMap( xAttributes, rClrMap, XML_accent6 );
      53           5 :     setClrMap( xAttributes, rClrMap, XML_hlink );
      54           5 :     setClrMap( xAttributes, rClrMap, XML_folHlink );
      55           5 : }
      56             : 
      57         108 : clrSchemeColorContext::clrSchemeColorContext( ContextHandler& rParent, ClrScheme& rClrScheme, sal_Int32 nColorToken ) :
      58             :     ColorContext( rParent, *this ),
      59             :     mrClrScheme( rClrScheme ),
      60         108 :     mnColorToken( nColorToken )
      61             : {
      62         108 : }
      63             : 
      64         324 : clrSchemeColorContext::~clrSchemeColorContext()
      65             : {
      66         108 :     mrClrScheme.setColor( mnColorToken, getColor( getFilter().getGraphicHelper() ) );
      67         216 : }
      68             : 
      69           9 : clrSchemeContext::clrSchemeContext( ContextHandler& rParent, ClrScheme& rClrScheme ) :
      70             :     ContextHandler( rParent ),
      71           9 :     mrClrScheme( rClrScheme )
      72             : {
      73           9 : }
      74             : 
      75         108 : Reference< XFastContextHandler > clrSchemeContext::createFastChildContext(
      76             :         sal_Int32 nElement, const Reference< XFastAttributeList >& ) throw (SAXException, RuntimeException)
      77             : {
      78         108 :     switch( nElement )
      79             :     {
      80             :         case A_TOKEN( dk1 ):
      81             :         case A_TOKEN( lt1 ):
      82             :         case A_TOKEN( dk2 ):
      83             :         case A_TOKEN( lt2 ):
      84             :         case A_TOKEN( accent1 ):
      85             :         case A_TOKEN( accent2 ):
      86             :         case A_TOKEN( accent3 ):
      87             :         case A_TOKEN( accent4 ):
      88             :         case A_TOKEN( accent5 ):
      89             :         case A_TOKEN( accent6 ):
      90             :         case A_TOKEN( hlink ):
      91             :         case A_TOKEN( folHlink ):
      92         108 :             return new clrSchemeColorContext( *this, mrClrScheme, getBaseToken( nElement ) );
      93             :     }
      94           0 :     return 0;
      95             : }
      96             : 
      97          51 : } }
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10