LCOV - code coverage report
Current view: top level - oox/source/drawingml - linepropertiescontext.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 25 25 100.0 %
Date: 2014-04-11 Functions: 4 4 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/linepropertiescontext.hxx"
      21             : #include "oox/drawingml/drawingmltypes.hxx"
      22             : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
      23             : #include "oox/drawingml/lineproperties.hxx"
      24             : #include "oox/helper/attributelist.hxx"
      25             : 
      26             : using namespace ::oox::core;
      27             : using namespace ::com::sun::star::uno;
      28             : using namespace ::com::sun::star::xml::sax;
      29             : 
      30             : // CT_LineProperties
      31             : 
      32             : namespace oox { namespace drawingml {
      33             : 
      34             : 
      35        4305 : LinePropertiesContext::LinePropertiesContext( ContextHandler2Helper& rParent, const AttributeList& rAttribs,
      36             :     LineProperties& rLineProperties ) throw()
      37             : : ContextHandler2( rParent )
      38        4305 : , mrLineProperties( rLineProperties )
      39             : {
      40        4305 :     mrLineProperties.moLineWidth = rAttribs.getInteger( XML_w );
      41        4305 :     mrLineProperties.moLineCompound = rAttribs.getToken( XML_cmpd );
      42        4305 :     mrLineProperties.moLineCap = rAttribs.getToken( XML_cap );
      43        4305 : }
      44             : 
      45        8610 : LinePropertiesContext::~LinePropertiesContext()
      46             : {
      47        8610 : }
      48             : 
      49        9080 : ContextHandlerRef LinePropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
      50             : {
      51        9080 :     switch( nElement )
      52             :     {
      53             :         // LineFillPropertiesGroup
      54             :         case A_TOKEN( noFill ):
      55             :         case A_TOKEN( solidFill ):
      56             :         case A_TOKEN( gradFill ):
      57             :         case A_TOKEN( pattFill ):
      58        4261 :             return FillPropertiesContext::createFillContext( *this, nElement, rAttribs, mrLineProperties.maLineFill );
      59             :         break;
      60             : 
      61             :         // LineDashPropertiesGroup
      62             :         case A_TOKEN( prstDash ):  // CT_PresetLineDashProperties
      63        2755 :             mrLineProperties.moPresetDash = rAttribs.getToken( XML_val );
      64        2755 :         break;
      65             :         case A_TOKEN( custDash ):  // CT_DashStopList
      66           5 :             return this;
      67             :         break;
      68             :         case A_TOKEN( ds ):
      69             :             mrLineProperties.maCustomDash.push_back( LineProperties::DashStop(
      70           5 :                 rAttribs.getInteger( XML_d, 0 ), rAttribs.getInteger( XML_sp, 0 ) ) );
      71           5 :         break;
      72             : 
      73             :         // LineJoinPropertiesGroup
      74             :         case A_TOKEN( round ):
      75             :         case A_TOKEN( bevel ):
      76             :         case A_TOKEN( miter ):
      77         970 :             mrLineProperties.moLineJoint = getBaseToken( nElement );
      78         970 :         break;
      79             : 
      80             :         case A_TOKEN( headEnd ):  // CT_LineEndProperties
      81             :         case A_TOKEN( tailEnd ):  // CT_LineEndProperties
      82             :         {                         // ST_LineEndType
      83        1084 :             bool bTailEnd = nElement == A_TOKEN( tailEnd );
      84        1084 :             LineArrowProperties& rArrowProps = bTailEnd ? mrLineProperties.maEndArrow : mrLineProperties.maStartArrow;
      85        1084 :             rArrowProps.moArrowType = rAttribs.getToken( XML_type );
      86        1084 :             rArrowProps.moArrowWidth = rAttribs.getToken( XML_w );
      87        1084 :             rArrowProps.moArrowLength = rAttribs.getToken( XML_len );
      88             :         }
      89        1084 :         break;
      90             :     }
      91        4814 :     return 0;
      92             : }
      93             : 
      94             : } }
      95             : 
      96             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10