LCOV - code coverage report
Current view: top level - oox/source/drawingml/table - tablestyletextstylecontext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 17 34 50.0 %
Date: 2014-11-03 Functions: 6 6 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 <osl/diagnose.h>
      21             : 
      22             : #include "drawingml/table/tablestyletextstylecontext.hxx"
      23             : #include "drawingml/colorchoicecontext.hxx"
      24             : #include "oox/helper/attributelist.hxx"
      25             : 
      26             : using namespace ::oox::core;
      27             : using namespace ::com::sun::star;
      28             : using namespace ::com::sun::star::uno;
      29             : using namespace ::com::sun::star::xml::sax;
      30             : 
      31             : namespace oox { namespace drawingml { namespace table {
      32             : 
      33          40 : TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler2Helper& rParent,
      34             :     const AttributeList& rAttribs, TableStylePart& rTableStylePart )
      35             : : ContextHandler2( rParent )
      36          40 : , mrTableStylePart( rTableStylePart )
      37             : {
      38          40 :     if( rAttribs.hasAttribute( XML_b ) ) {
      39          32 :         sal_Int32 nB = rAttribs.getToken( XML_b, XML_def );
      40          32 :         if ( nB == XML_on )
      41          32 :             mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_True );
      42           0 :         else if ( nB == XML_off )
      43           0 :             mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_False );
      44             :     }
      45             : 
      46          40 :     if( rAttribs.hasAttribute( XML_i ) ) {
      47           0 :         sal_Int32 nI = rAttribs.getToken( XML_i, XML_def );
      48           0 :         if ( nI == XML_on )
      49           0 :             mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_True );
      50           0 :         else if ( nI == XML_off )
      51           0 :             mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_False );
      52             :     }
      53          40 : }
      54             : 
      55          80 : TableStyleTextStyleContext::~TableStyleTextStyleContext()
      56             : {
      57          80 : }
      58             : 
      59             : // CT_TableStyleTextStyle
      60             : ContextHandlerRef
      61          52 : TableStyleTextStyleContext::onCreateContext( ::sal_Int32 aElementToken, const AttributeList& rAttribs )
      62             : {
      63          52 :     switch( aElementToken )
      64             :     {
      65             :         // EG_ThemeableFontStyles (choice)
      66             :         case A_TOKEN( font ):       // CT_FontCollection
      67           0 :             return this;
      68             :         case A_TOKEN( ea ):             // CT_TextFont
      69           0 :             mrTableStylePart.getAsianFont().setAttributes( rAttribs );
      70           0 :             return 0;
      71             :         case A_TOKEN( cs ):             // CT_TextFont
      72           0 :             mrTableStylePart.getComplexFont().setAttributes( rAttribs );
      73           0 :             return 0;
      74             :         case A_TOKEN( sym ):            // CT_TextFont
      75           0 :             mrTableStylePart.getSymbolFont().setAttributes( rAttribs );
      76           0 :             return 0;
      77             :         case A_TOKEN( latin ):          // CT_TextFont
      78           0 :             mrTableStylePart.getLatinFont().setAttributes( rAttribs );
      79           0 :             return 0;
      80             : 
      81             :         case A_TOKEN( fontRef ):    // CT_FontReference
      82             :             {
      83          26 :                 ShapeStyleRef& rFontStyle = mrTableStylePart.getStyleRefs()[ XML_fontRef ];
      84          26 :                 rFontStyle.mnThemedIdx = rAttribs.getToken( XML_idx, XML_none );
      85          26 :                 return new ColorContext( *this, rFontStyle.maPhClr );
      86             :             }
      87             : 
      88             :         case A_TOKEN( extLst ):     // CT_OfficeArtExtensionList
      89           0 :             break;
      90             :     }
      91             : 
      92          26 :     return new ColorValueContext( *this, mrTableStylePart.getTextColor() );
      93             : }
      94             : 
      95         408 : } } }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10