LCOV - code coverage report
Current view: top level - libreoffice/oox/source/drawingml - linepropertiescontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 26 30 86.7 %
Date: 2012-12-27 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          46 : LinePropertiesContext::LinePropertiesContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs,
      36             :     LineProperties& rLineProperties ) throw()
      37             : : ContextHandler( rParent )
      38          46 : , mrLineProperties( rLineProperties )
      39             : {
      40          46 :     AttributeList aAttribs( xAttribs );
      41          46 :     mrLineProperties.moLineWidth = aAttribs.getInteger( XML_w );
      42          46 :     mrLineProperties.moLineCompound = aAttribs.getToken( XML_cmpd );
      43          46 :     mrLineProperties.moLineCap = aAttribs.getToken( XML_cap );
      44          46 : }
      45             : 
      46          92 : LinePropertiesContext::~LinePropertiesContext()
      47             : {
      48          92 : }
      49             : 
      50         114 : Reference< XFastContextHandler > LinePropertiesContext::createFastChildContext( sal_Int32 nElement, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
      51             : {
      52         114 :     Reference< XFastContextHandler > xRet;
      53         114 :     AttributeList aAttribs( xAttribs );
      54         114 :     switch( nElement )
      55             :     {
      56             :         // LineFillPropertiesGroup
      57             :         case A_TOKEN( noFill ):
      58             :         case A_TOKEN( solidFill ):
      59             :         case A_TOKEN( gradFill ):
      60             :         case A_TOKEN( pattFill ):
      61          42 :             xRet = FillPropertiesContext::createFillContext( *this, nElement, xAttribs, mrLineProperties.maLineFill );
      62          42 :         break;
      63             : 
      64             :         // LineDashPropertiesGroup
      65             :         case A_TOKEN( prstDash ):  // CT_PresetLineDashProperties
      66          32 :             mrLineProperties.moPresetDash = aAttribs.getToken( XML_val );
      67          32 :         break;
      68             :         case A_TOKEN( custDash ):  // CT_DashStopList
      69           0 :             xRet = this;
      70           0 :         break;
      71             :         case A_TOKEN( ds ):
      72             :             mrLineProperties.maCustomDash.push_back( LineProperties::DashStop(
      73           0 :                 aAttribs.getInteger( XML_d, 0 ), aAttribs.getInteger( XML_sp, 0 ) ) );
      74           0 :         break;
      75             : 
      76             :         // LineJoinPropertiesGroup
      77             :         case A_TOKEN( round ):
      78             :         case A_TOKEN( bevel ):
      79             :         case A_TOKEN( miter ):
      80          16 :             mrLineProperties.moLineJoint = getBaseToken( nElement );
      81          16 :         break;
      82             : 
      83             :         case A_TOKEN( headEnd ):  // CT_LineEndProperties
      84             :         case A_TOKEN( tailEnd ):  // CT_LineEndProperties
      85             :         {                         // ST_LineEndType
      86          24 :             bool bTailEnd = nElement == A_TOKEN( tailEnd );
      87          24 :             LineArrowProperties& rArrowProps = bTailEnd ? mrLineProperties.maEndArrow : mrLineProperties.maStartArrow;
      88          24 :             rArrowProps.moArrowType = aAttribs.getToken( XML_type );
      89          24 :             rArrowProps.moArrowWidth = aAttribs.getToken( XML_w );
      90          24 :             rArrowProps.moArrowLength = aAttribs.getToken( XML_len );
      91             :         }
      92          24 :         break;
      93             :     }
      94         114 :     return xRet;
      95             : }
      96             : 
      97             : } }
      98             : 
      99             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10