LCOV - code coverage report
Current view: top level - oox/source/drawingml - shapepropertiescontext.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 22 30 73.3 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 35 93 37.6 %

           Branch data     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/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 "oox/drawingml/scene3dcontext.hxx"
      29                 :            : #include "oox/drawingml/linepropertiescontext.hxx"
      30                 :            : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
      31                 :            : #include "oox/drawingml/transform2dcontext.hxx"
      32                 :            : #include "oox/drawingml/customshapegeometry.hxx"
      33                 :            : 
      34                 :            : using rtl::OUString;
      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                 :            : // ====================================================================
      45                 :            : 
      46                 :            : // CT_ShapeProperties
      47                 :        240 : ShapePropertiesContext::ShapePropertiesContext( ContextHandler& rParent, Shape& rShape )
      48                 :            : : ContextHandler( rParent )
      49                 :        240 : , mrShape( rShape )
      50                 :            : {
      51                 :        240 : }
      52                 :            : 
      53                 :            : // --------------------------------------------------------------------
      54                 :            : 
      55                 :        348 : Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs ) throw (SAXException, RuntimeException)
      56                 :            : {
      57                 :        348 :     Reference< XFastContextHandler > xRet;
      58                 :            : 
      59   [ +  -  +  -  :        348 :     switch( aElementToken )
             +  +  -  -  
                      + ]
      60                 :            :     {
      61                 :            :     // CT_Transform2D
      62                 :            :     case A_TOKEN( xfrm ):
      63 [ +  - ][ +  - ]:        159 :         xRet.set( new Transform2DContext( *this, xAttribs, mrShape ) );
      64                 :        159 :         break;
      65                 :            : 
      66                 :            :     // GeometryGroup
      67                 :            :     case A_TOKEN( custGeom ):   // custom geometry "CT_CustomGeometry2D"
      68 [ #  # ][ #  # ]:          0 :         xRet.set( new CustomShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
      69                 :          0 :         break;
      70                 :            : 
      71                 :            : 
      72                 :            :     case A_TOKEN( prstGeom ):   // preset geometry "CT_PresetGeometry2D"
      73                 :            :         {
      74 [ +  - ][ +  - ]:        114 :             sal_Int32 nToken = xAttribs->getOptionalValueToken( XML_prst, 0 );
      75                 :            :             // TODO: Move the following checks to a separate place or as a separate function
      76         [ -  + ]:        114 :             if ( nToken == XML_line )
      77                 :            :             {
      78 [ #  # ][ #  # ]:          0 :                 static const OUString sLineShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineShape" ) );
         [ #  # ][ #  # ]
      79                 :          0 :                 mrShape.getServiceName() = sLineShape;
      80                 :            :             }
      81 [ +  - ][ +  - ]:        114 :             if( ( nToken >= XML_bentConnector2 && nToken <= XML_bentConnector5 ) ||
         [ +  - ][ +  - ]
                 [ +  + ]
      82                 :            :                 ( nToken >= XML_curvedConnector2 && nToken <= XML_curvedConnector5 ) ||
      83                 :            :                   nToken == XML_straightConnector1 )
      84                 :            :             {
      85 [ +  + ][ +  - ]:         12 :                 static const OUString sCustomShape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.CustomShape" ) );
         [ +  - ][ #  # ]
      86                 :         12 :                 mrShape.getServiceName() = sCustomShape;
      87                 :            :             }
      88 [ +  - ][ +  - ]:        114 :             xRet.set( new PresetShapeGeometryContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
         [ +  - ][ +  - ]
                 [ +  - ]
      89                 :            :         }
      90                 :        114 :         break;
      91                 :            : 
      92                 :            :     case A_TOKEN( prstTxWarp ):
      93 [ #  # ][ #  # ]:          0 :         xRet.set( new PresetTextShapeContext( *this, xAttribs, *(mrShape.getCustomShapeProperties()) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
      94                 :          0 :         break;
      95                 :            : 
      96                 :            :     // CT_LineProperties
      97                 :            :     case A_TOKEN( ln ):
      98 [ +  - ][ +  - ]:         36 :         xRet.set( new LinePropertiesContext( *this, xAttribs, mrShape.getLineProperties() ) );
                 [ +  - ]
      99                 :         36 :         break;
     100                 :            : 
     101                 :            :     // EffectPropertiesGroup
     102                 :            :     // todo not supported by core
     103                 :            :     case A_TOKEN( effectLst ):  // CT_EffectList
     104                 :            :     case A_TOKEN( effectDag ):  // CT_EffectContainer
     105                 :         12 :         break;
     106                 :            : 
     107                 :            :     // todo
     108                 :            :     case A_TOKEN( scene3d ):    // CT_Scene3D
     109                 :            : //      xRet.set( new Scene3DContext( *this, xAttribs, *(mrShape.get3DShapeProperties()) ) );
     110                 :          0 :         break;
     111                 :            : 
     112                 :            :     // todo
     113                 :            :     case A_TOKEN( sp3d ):       // CT_Shape3D
     114                 :          0 :         break;
     115                 :            :     }
     116                 :            : 
     117                 :            :     // FillPropertiesGroupContext
     118         [ +  + ]:        348 :     if( !xRet.is() )
     119 [ +  - ][ +  - ]:         39 :         xRet.set( FillPropertiesContext::createFillContext( *this, aElementToken, xAttribs, mrShape.getFillProperties() ) );
                 [ +  - ]
     120                 :            : 
     121                 :        348 :     return xRet;
     122                 :            : }
     123                 :            : 
     124 [ +  - ][ +  - ]:        285 : } }
     125                 :            : 
     126                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10