LCOV - code coverage report
Current view: top level - oox/source/drawingml - shapepropertiescontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 20 21 95.2 %
Date: 2015-06-13 12:38:46 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 "drawingml/shapepropertiescontext.hxx"
      21             : 
      22             : #include <com/sun/star/xml/sax/FastToken.hpp>
      23             : #include <com/sun/star/drawing/LineStyle.hpp>
      24             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      25             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      26             : #include <com/sun/star/container/XNamed.hpp>
      27             : 
      28             : #include "drawingml/scene3dcontext.hxx"
      29             : #include "drawingml/linepropertiescontext.hxx"
      30             : #include "drawingml/fillpropertiesgroupcontext.hxx"
      31             : #include "drawingml/transform2dcontext.hxx"
      32             : #include "drawingml/customshapegeometry.hxx"
      33             : #include "effectpropertiescontext.hxx"
      34             : 
      35             : using namespace oox::core;
      36             : using namespace ::com::sun::star;
      37             : using namespace ::com::sun::star::uno;
      38             : using namespace ::com::sun::star::drawing;
      39             : using namespace ::com::sun::star::beans;
      40             : using namespace ::com::sun::star::xml::sax;
      41             : 
      42             : namespace oox { namespace drawingml {
      43             : 
      44             : // CT_ShapeProperties
      45        6292 : ShapePropertiesContext::ShapePropertiesContext( ContextHandler2Helper& rParent, Shape& rShape )
      46             : : ContextHandler2( rParent )
      47        6292 : , mrShape( rShape )
      48             : {
      49        6292 : }
      50             : 
      51       13195 : ContextHandlerRef ShapePropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      52             : {
      53       13195 :     switch( aElementToken )
      54             :     {
      55             :     // CT_Transform2D
      56             :     case A_TOKEN( xfrm ):
      57        3372 :         return new Transform2DContext( *this, rAttribs, mrShape );
      58             : 
      59             :     // GeometryGroup
      60             :     case A_TOKEN( custGeom ):   // custom geometry "CT_CustomGeometry2D"
      61         458 :         return new CustomShapeGeometryContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) );
      62             : 
      63             :     case A_TOKEN( prstGeom ):   // preset geometry "CT_PresetGeometry2D"
      64             :         {
      65        2404 :             sal_Int32 nToken = rAttribs.getToken( XML_prst, 0 );
      66             :             // TODO: Move the following checks to a separate place or as a separate function
      67        2404 :             if ( nToken == XML_line )
      68             :             {
      69          44 :                 mrShape.getServiceName() = "com.sun.star.drawing.LineShape";
      70             :             }
      71        2404 :             if( ( nToken >= XML_bentConnector2 && nToken <= XML_bentConnector5 ) ||
      72        2372 :                 ( nToken >= XML_curvedConnector2 && nToken <= XML_curvedConnector5 ) ||
      73             :                   nToken == XML_straightConnector1 )
      74             :             {
      75         114 :                 mrShape.getServiceName() = "com.sun.star.drawing.CustomShape";
      76             :             }
      77        2404 :             return new PresetShapeGeometryContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) );
      78             :         }
      79             : 
      80             :     case A_TOKEN( prstTxWarp ):
      81           0 :         return new PresetTextShapeContext( *this, rAttribs, *(mrShape.getCustomShapeProperties()) );
      82             : 
      83             :     // CT_LineProperties
      84             :     case A_TOKEN( ln ):
      85        2929 :         return new LinePropertiesContext( *this, rAttribs, mrShape.getLineProperties() );
      86             : 
      87             :     // EffectPropertiesGroup
      88             :     // todo not supported by core
      89             :     case A_TOKEN( effectLst ):  // CT_EffectList
      90             :     case A_TOKEN( effectDag ):  // CT_EffectContainer
      91         965 :         return new EffectPropertiesContext( *this, mrShape.getEffectProperties() );
      92             : 
      93             :     // todo not supported by core, only for preservation via grab bags
      94             :     case A_TOKEN( scene3d ):    // CT_Scene3D
      95          82 :         return new Scene3DPropertiesContext( *this, mrShape.get3DProperties() );
      96             :         break;
      97             : 
      98             :     // todo not supported by core, only for preservation via grab bags
      99             :     case A_TOKEN( sp3d ):       // CT_Shape3D
     100          87 :         return new Shape3DPropertiesContext( *this, rAttribs, mrShape.get3DProperties() );
     101             :         break;
     102             :     }
     103             : 
     104             :     // FillPropertiesGroupContext
     105        2898 :     return FillPropertiesContext::createFillContext( *this, aElementToken, rAttribs, mrShape.getFillProperties() );
     106             : }
     107             : 
     108         246 : } }
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11