LCOV - code coverage report
Current view: top level - oox/source/drawingml - textcharacterpropertiescontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 78 0.0 %
Date: 2014-04-14 Functions: 0 4 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/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/texteffectscontext.hxx"
      26             : #include "oox/drawingml/lineproperties.hxx"
      27             : #include "oox/drawingml/textparagraphproperties.hxx"
      28             : #include "oox/core/relations.hxx"
      29             : #include "hyperlinkcontext.hxx"
      30             : 
      31             : using namespace ::oox::core;
      32             : using namespace ::com::sun::star::uno;
      33             : using namespace ::com::sun::star::xml::sax;
      34             : using namespace ::com::sun::star::awt;
      35             : 
      36             : namespace oox { namespace drawingml {
      37             : 
      38             : // CT_TextCharacterProperties
      39           0 : TextCharacterPropertiesContext::TextCharacterPropertiesContext(
      40             :         ContextHandler2Helper& rParent,
      41             :         const AttributeList& rAttribs,
      42             :         TextCharacterProperties& rTextCharacterProperties )
      43             : : ContextHandler2( rParent )
      44           0 : , mrTextCharacterProperties( rTextCharacterProperties )
      45             : {
      46           0 :     if ( rAttribs.hasAttribute( XML_lang ) )
      47           0 :         mrTextCharacterProperties.moLang = rAttribs.getString( XML_lang );
      48           0 :     if ( rAttribs.hasAttribute( XML_sz ) )
      49           0 :         mrTextCharacterProperties.moHeight = rAttribs.getInteger( XML_sz );
      50           0 :     if ( rAttribs.hasAttribute( XML_spc ) )
      51           0 :         mrTextCharacterProperties.moSpacing = rAttribs.getInteger( XML_spc );
      52           0 :     if ( rAttribs.hasAttribute( XML_u ) )
      53           0 :         mrTextCharacterProperties.moUnderline = rAttribs.getToken( XML_u );
      54           0 :     if ( rAttribs.hasAttribute( XML_strike ) )
      55           0 :         mrTextCharacterProperties.moStrikeout = rAttribs.getToken( XML_strike );
      56           0 :     if ( rAttribs.hasAttribute( XML_baseline ) && rAttribs.getInteger( XML_baseline ).get() != 0 )
      57           0 :         mrTextCharacterProperties.moBaseline = rAttribs.getInteger( XML_baseline );
      58             : 
      59           0 :     if ( rAttribs.hasAttribute( XML_b ) )
      60           0 :         mrTextCharacterProperties.moBold = rAttribs.getBool( XML_b );
      61           0 :     if ( rAttribs.hasAttribute( XML_i ) )
      62           0 :         mrTextCharacterProperties.moItalic = rAttribs.getBool( XML_i );
      63           0 :     if( rAttribs.hasAttribute( XML_cap ) )
      64           0 :         mrTextCharacterProperties.moCaseMap = rAttribs.getToken( XML_cap );
      65             : 
      66             :     /* TODO / unhandled so far:
      67             :        A_TOKEN( kern )
      68             :        XML_altLang
      69             :        A_TOKEN( kumimoji )
      70             :        A_TOKEN( spc )
      71             :        A_TOKEN( normalizeH )
      72             :        A_TOKEN( noProof )
      73             :        A_TOKEN( dirty )
      74             :        A_TOKEN( err )
      75             :        A_TOKEN( smtClean )
      76             :        A_TOKEN( smtId )
      77             :     */
      78           0 : }
      79             : 
      80           0 : TextCharacterPropertiesContext::~TextCharacterPropertiesContext()
      81             : {
      82           0 : }
      83             : 
      84           0 : ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      85             : {
      86           0 :     switch( aElementToken )
      87             :     {
      88             : // TODO unsupported yet
      89             : //        case A_TOKEN( ln ):         // CT_LineProperties
      90             : //            return new LinePropertiesContext( getHandler(), rAttribs, maTextOutlineProperties );
      91             : 
      92             :         case A_TOKEN( solidFill ):  // EG_FillProperties
      93           0 :             return new ColorContext( *this, mrTextCharacterProperties.maCharColor );
      94             : 
      95             :         // EG_EffectProperties
      96             :         case A_TOKEN( effectDag ):  // CT_EffectContainer 5.1.10.25
      97             :         case A_TOKEN( effectLst ):  // CT_EffectList 5.1.10.26
      98           0 :         break;
      99             : 
     100             :         case A_TOKEN( highlight ):  // CT_Color
     101           0 :             return new ColorContext( *this, mrTextCharacterProperties.maHighlightColor );
     102             : 
     103             :         // EG_TextUnderlineLine
     104             :         case A_TOKEN( uLnTx ):      // CT_TextUnderlineLineFollowText
     105           0 :             mrTextCharacterProperties.moUnderlineLineFollowText = true;
     106           0 :         break;
     107             : // TODO unsupported yet
     108             : //        case A_TOKEN( uLn ):        // CT_LineProperties
     109             : //            return new LinePropertiesContext( getHandler(), rAttribs, maUnderlineProperties );
     110             : 
     111             :         // EG_TextUnderlineFill
     112             :         case A_TOKEN( uFillTx ):    // CT_TextUnderlineFillFollowText
     113           0 :             mrTextCharacterProperties.moUnderlineFillFollowText = true;
     114           0 :         break;
     115             :         case A_TOKEN( uFill ):      // CT_TextUnderlineFillGroupWrapper->EG_FillProperties (not supported)
     116           0 :             return new SimpleFillPropertiesContext( *this, mrTextCharacterProperties.maUnderlineColor );
     117             : 
     118             :         // CT_FontCollection
     119             :         case A_TOKEN( latin ):      // CT_TextFont
     120           0 :             mrTextCharacterProperties.maLatinFont.setAttributes( rAttribs );
     121           0 :         break;
     122             :         case A_TOKEN( ea ):         // CT_TextFont
     123           0 :             mrTextCharacterProperties.maAsianFont.setAttributes( rAttribs );
     124           0 :         break;
     125             :         case A_TOKEN( cs ):         // CT_TextFont
     126           0 :             mrTextCharacterProperties.maComplexFont.setAttributes( rAttribs );
     127           0 :         break;
     128             :         case A_TOKEN( sym ):        // CT_TextFont
     129           0 :             mrTextCharacterProperties.maSymbolFont.setAttributes( rAttribs );
     130           0 :         break;
     131             : 
     132             :         case A_TOKEN( hlinkClick ):     // CT_Hyperlink
     133             :         case A_TOKEN( hlinkMouseOver ): // CT_Hyperlink
     134           0 :             return new HyperLinkContext( *this, rAttribs,  mrTextCharacterProperties.maHyperlinkPropertyMap );
     135             : 
     136             :         case A_TOKEN( gradFill ):
     137           0 :             return new GradientFillContext( *this, rAttribs, mrTextCharacterProperties.maGradientProps );
     138             : 
     139             :         case OOX_TOKEN( doc, rFonts ):
     140           0 :             if( rAttribs.hasAttribute(OOX_TOKEN(doc, ascii)) )
     141             :             {
     142           0 :                 mrTextCharacterProperties.maLatinFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, ascii), OUString()));
     143             :             }
     144           0 :             if (rAttribs.hasAttribute(OOX_TOKEN(doc, asciiTheme)))
     145             :             {
     146           0 :                 mrTextCharacterProperties.maLatinThemeFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, asciiTheme), OUString()));
     147             :             }
     148           0 :             if( rAttribs.hasAttribute(OOX_TOKEN(doc, cs)) )
     149             :             {
     150           0 :                 mrTextCharacterProperties.maComplexFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, cs), OUString()));
     151             :             }
     152           0 :             if (rAttribs.hasAttribute(OOX_TOKEN(doc, cstheme)))
     153             :             {
     154           0 :                 mrTextCharacterProperties.maComplexThemeFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, cstheme), OUString()));
     155             :             }
     156           0 :             if( rAttribs.hasAttribute(OOX_TOKEN(doc, eastAsia)) )
     157             :             {
     158           0 :                 mrTextCharacterProperties.maAsianFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, eastAsia), OUString()));
     159             :             }
     160           0 :             if (rAttribs.hasAttribute(OOX_TOKEN(doc, eastAsiaTheme)))
     161             :             {
     162           0 :                 mrTextCharacterProperties.maAsianThemeFont.setAttributes(rAttribs.getString(OOX_TOKEN(doc, eastAsiaTheme), OUString()));
     163             :             }
     164           0 :             break;
     165             :         case OOX_TOKEN( doc, b ):
     166           0 :             mrTextCharacterProperties.moBold = rAttribs.getBool(OOX_TOKEN( doc, val ), true);
     167           0 :             break;
     168             :         case OOX_TOKEN( doc, bCs ):
     169           0 :             break;
     170             :         case OOX_TOKEN( doc, color ):
     171           0 :             if (rAttribs.getInteger(OOX_TOKEN(doc, val)).has())
     172             :             {
     173           0 :                 mrTextCharacterProperties.maCharColor.setSrgbClr(rAttribs.getIntegerHex(OOX_TOKEN(doc, val)).get());
     174             :             }
     175           0 :             break;
     176             :         case OOX_TOKEN( doc, sz ):
     177           0 :             if (rAttribs.getInteger(OOX_TOKEN(doc, val)).has())
     178             :             {
     179           0 :                 sal_Int32 nVal = rAttribs.getInteger(OOX_TOKEN(doc, val)).get();
     180             :                 // wml has half points, dml has hundred points
     181           0 :                 mrTextCharacterProperties.moHeight = nVal * 50;
     182             :             }
     183           0 :             break;
     184             :         case OOX_TOKEN( doc, szCs ):
     185           0 :             break;
     186             :         case OOX_TOKEN( doc, caps ):
     187             :             {
     188           0 :                 if( rAttribs.getBool(OOX_TOKEN( doc, val ), true) )
     189           0 :                     mrTextCharacterProperties.moCaseMap = XML_all;
     190             :                 else
     191           0 :                     mrTextCharacterProperties.moCaseMap = XML_none;
     192             :             }
     193           0 :             break;
     194             :         case OOX_TOKEN( doc, smallCaps ):
     195             :             {
     196           0 :                 if( rAttribs.getBool(OOX_TOKEN( doc, val ), true) )
     197           0 :                     mrTextCharacterProperties.moCaseMap = XML_small;
     198             :                 else
     199           0 :                     mrTextCharacterProperties.moCaseMap = XML_none;
     200             :             }
     201           0 :             break;
     202             :         case OOX_TOKEN(w14, glow):
     203             :         case OOX_TOKEN(w14, shadow):
     204             :         case OOX_TOKEN(w14, reflection):
     205             :         case OOX_TOKEN(w14, textOutline):
     206             :         case OOX_TOKEN(w14, textFill):
     207             :         case OOX_TOKEN(w14, scene3d):
     208             :         case OOX_TOKEN(w14, props3d):
     209             :         case OOX_TOKEN(w14, ligatures):
     210             :         case OOX_TOKEN(w14, numForm):
     211             :         case OOX_TOKEN(w14, numSpacing):
     212             :         case OOX_TOKEN(w14, stylisticSets):
     213             :         case OOX_TOKEN(w14, cntxtAlts):
     214             :             {
     215           0 :                 return new TextEffectsContext( *this, aElementToken, mrTextCharacterProperties.maTextEffectsProperties );
     216             :             }
     217             :             break;
     218             :         default:
     219             :             SAL_WARN("oox", "TextCharacterPropertiesContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
     220           0 :             break;
     221             :     }
     222             : 
     223           0 :     return this;
     224             : }
     225             : 
     226             : } }
     227             : 
     228             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10