LCOV - code coverage report
Current view: top level - libreoffice/oox/source/drawingml - textcharacterpropertiescontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 37 50 74.0 %
Date: 2012-12-27 Functions: 5 5 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/textcharacterpropertiescontext.hxx"
      21             : 
      22             : #include "oox/helper/attributelist.hxx"
      23             : #include "oox/drawingml/drawingmltypes.hxx"
      24             : #include "oox/drawingml/colorchoicecontext.hxx"
      25             : #include "oox/drawingml/lineproperties.hxx"
      26             : #include "oox/drawingml/textparagraphproperties.hxx"
      27             : #include "oox/core/relations.hxx"
      28             : #include "hyperlinkcontext.hxx"
      29             : 
      30             : using namespace ::oox::core;
      31             : using namespace ::com::sun::star::uno;
      32             : using namespace ::com::sun::star::xml::sax;
      33             : using namespace ::com::sun::star::awt;
      34             : 
      35             : namespace oox { namespace drawingml {
      36             : 
      37             : // --------------------------------------------------------------------
      38             : 
      39             : // CT_TextCharacterProperties
      40         271 : TextCharacterPropertiesContext::TextCharacterPropertiesContext(
      41             :         ContextHandler& rParent,
      42             :         const Reference< XFastAttributeList >& rXAttributes,
      43             :         TextCharacterProperties& rTextCharacterProperties )
      44             : : ContextHandler( rParent )
      45         271 : , mrTextCharacterProperties( rTextCharacterProperties )
      46             : {
      47         271 :     AttributeList aAttribs( rXAttributes );
      48         271 :     if ( aAttribs.hasAttribute( XML_lang ) )
      49         135 :         mrTextCharacterProperties.moLang = aAttribs.getString( XML_lang );
      50         271 :     if ( aAttribs.hasAttribute( XML_sz ) )
      51         129 :         mrTextCharacterProperties.moHeight = aAttribs.getInteger( XML_sz );
      52         271 :     if ( aAttribs.hasAttribute( XML_spc ) )
      53           0 :         mrTextCharacterProperties.moSpacing = aAttribs.getInteger( XML_spc );
      54         271 :     if ( aAttribs.hasAttribute( XML_u ) )
      55           5 :         mrTextCharacterProperties.moUnderline = aAttribs.getToken( XML_u );
      56         271 :     if ( aAttribs.hasAttribute( XML_strike ) )
      57           2 :         mrTextCharacterProperties.moStrikeout = aAttribs.getToken( XML_strike );
      58             : 
      59             : //  mrTextCharacterProperties.moCaseMap     = aAttribs.getToken( XML_cap );
      60         271 :     if ( aAttribs.hasAttribute( XML_b ) )
      61          17 :         mrTextCharacterProperties.moBold = aAttribs.getBool( XML_b );
      62         271 :     if ( aAttribs.hasAttribute( XML_i ) )
      63           2 :         mrTextCharacterProperties.moItalic = aAttribs.getBool( XML_i );
      64             : 
      65             : // TODO
      66             : /*   todo: we need to be able to iterate over the XFastAttributes
      67             : 
      68             :   // ST_TextNonNegativePoint
      69             :     const OUString sCharKerning( CREATE_OUSTRING( "CharKerning" ) );
      70             :     //case A_TOKEN( kern ):
      71             : 
      72             :   // ST_TextLanguageID
      73             :     OUString sAltLang = rXAttributes->getOptionalValue( XML_altLang );
      74             : 
      75             :         case A_TOKEN( kumimoji ):       // xsd:boolean
      76             :             break;
      77             :         case A_TOKEN( spc ):            // ST_TextPoint
      78             :         case A_TOKEN( normalizeH ):     // xsd:boolean
      79             :         case A_TOKEN( baseline ):       // ST_Percentage
      80             :         case A_TOKEN( noProof ):        // xsd:boolean
      81             :         case A_TOKEN( dirty ):          // xsd:boolean
      82             :         case A_TOKEN( err ):            // xsd:boolean
      83             :         case A_TOKEN( smtClean ):       // xsd:boolean
      84             :         case A_TOKEN( smtId ):          // xsd:unsignedInt
      85             :             break;
      86             : */
      87             : 
      88         271 : }
      89             : 
      90         542 : TextCharacterPropertiesContext::~TextCharacterPropertiesContext()
      91             : {
      92         542 : }
      93             : 
      94             : // --------------------------------------------------------------------
      95             : 
      96         542 : void TextCharacterPropertiesContext::endFastElement( sal_Int32 ) throw (SAXException, RuntimeException)
      97             : {
      98         542 : }
      99             : 
     100             : // --------------------------------------------------------------------
     101             : 
     102         384 : Reference< XFastContextHandler > TextCharacterPropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttributes ) throw (SAXException, RuntimeException)
     103             : {
     104         384 :     AttributeList aAttribs( xAttributes );
     105         384 :     Reference< XFastContextHandler > xRet;
     106         384 :     switch( aElementToken )
     107             :     {
     108             : // TODO unsupported yet
     109             : //        case A_TOKEN( ln ):         // CT_LineProperties
     110             : //            xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maTextOutlineProperties ) );
     111             : //        break;
     112             : 
     113             :         case A_TOKEN( solidFill ):  // EG_FillProperties
     114         113 :             xRet.set( new ColorContext( *this, mrTextCharacterProperties.maCharColor ) );
     115         113 :         break;
     116             : 
     117             :         // EG_EffectProperties
     118             :         case A_TOKEN( effectDag ):  // CT_EffectContainer 5.1.10.25
     119             :         case A_TOKEN( effectLst ):  // CT_EffectList 5.1.10.26
     120           2 :         break;
     121             : 
     122             :         case A_TOKEN( highlight ):  // CT_Color
     123           0 :             xRet.set( new ColorContext( *this, mrTextCharacterProperties.maHighlightColor ) );
     124           0 :         break;
     125             : 
     126             :         // EG_TextUnderlineLine
     127             :         case A_TOKEN( uLnTx ):      // CT_TextUnderlineLineFollowText
     128           0 :             mrTextCharacterProperties.moUnderlineLineFollowText = true;
     129           0 :         break;
     130             : // TODO unsupported yet
     131             : //        case A_TOKEN( uLn ):        // CT_LineProperties
     132             : //            xRet.set( new LinePropertiesContext( getHandler(), xAttributes, maUnderlineProperties ) );
     133             : //        break;
     134             : 
     135             :         // EG_TextUnderlineFill
     136             :         case A_TOKEN( uFillTx ):    // CT_TextUnderlineFillFollowText
     137           0 :             mrTextCharacterProperties.moUnderlineFillFollowText = true;
     138           0 :         break;
     139             :         case A_TOKEN( uFill ):      // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported)
     140           0 :             xRet.set( new SimpleFillPropertiesContext( *this, mrTextCharacterProperties.maUnderlineColor ) );
     141           0 :         break;
     142             : 
     143             :         // CT_FontCollection
     144             :         case A_TOKEN( latin ):      // CT_TextFont
     145         113 :             mrTextCharacterProperties.maLatinFont.setAttributes( aAttribs );
     146         113 :         break;
     147             :         case A_TOKEN( ea ):         // CT_TextFont
     148          76 :             mrTextCharacterProperties.maAsianFont.setAttributes( aAttribs );
     149          76 :         break;
     150             :         case A_TOKEN( cs ):         // CT_TextFont
     151          76 :             mrTextCharacterProperties.maComplexFont.setAttributes( aAttribs );
     152          76 :         break;
     153             :         case A_TOKEN( sym ):        // CT_TextFont
     154           0 :             mrTextCharacterProperties.maSymbolFont.setAttributes( aAttribs );
     155           0 :         break;
     156             : 
     157             :         case A_TOKEN( hlinkClick ):     // CT_Hyperlink
     158             :         case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink
     159           0 :             xRet.set( new HyperLinkContext( *this, xAttributes,  mrTextCharacterProperties.maHyperlinkPropertyMap ) );
     160           0 :         break;
     161             :     }
     162         384 :     if( !xRet.is() )
     163         271 :         xRet.set( this );
     164         384 :     return xRet;
     165             : }
     166             : 
     167             : // --------------------------------------------------------------------
     168             : 
     169             : } }
     170             : 
     171             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10