LCOV - code coverage report
Current view: top level - oox/source/drawingml - shapecontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 38 38 100.0 %
Date: 2015-06-13 12:38:46 Functions: 6 6 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 <com/sun/star/xml/sax/FastToken.hpp>
      21             : #include <com/sun/star/drawing/LineStyle.hpp>
      22             : #include <com/sun/star/beans/XMultiPropertySet.hpp>
      23             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      24             : #include <com/sun/star/container/XNamed.hpp>
      25             : 
      26             : #include "oox/helper/attributelist.hxx"
      27             : #include "oox/drawingml/shapecontext.hxx"
      28             : #include <drawingml/shapepropertiescontext.hxx>
      29             : #include "drawingml/shapestylecontext.hxx"
      30             : #include "drawingml/fillpropertiesgroupcontext.hxx"
      31             : #include "oox/drawingml/lineproperties.hxx"
      32             : #include "oox/drawingml/drawingmltypes.hxx"
      33             : #include "drawingml/customshapegeometry.hxx"
      34             : #include "drawingml/textbodycontext.hxx"
      35             : #include "drawingml/textbodypropertiescontext.hxx"
      36             : #include "hyperlinkcontext.hxx"
      37             : 
      38             : using namespace oox::core;
      39             : using namespace ::com::sun::star;
      40             : using namespace ::com::sun::star::uno;
      41             : using namespace ::com::sun::star::drawing;
      42             : using namespace ::com::sun::star::beans;
      43             : using namespace ::com::sun::star::text;
      44             : using namespace ::com::sun::star::xml::sax;
      45             : 
      46             : namespace oox { namespace drawingml {
      47             : 
      48             : // CT_Shape
      49        2643 : ShapeContext::ShapeContext( ContextHandler2Helper& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr )
      50             : : ContextHandler2( rParent )
      51             : , mpMasterShapePtr( pMasterShapePtr )
      52        2643 : , mpShapePtr( pShapePtr )
      53             : {
      54        2643 : }
      55             : 
      56        6016 : ShapeContext::~ShapeContext()
      57             : {
      58        2643 :     if ( mpMasterShapePtr.get() && mpShapePtr.get() )
      59        1944 :         mpMasterShapePtr->addChild( mpShapePtr );
      60        3373 : }
      61             : 
      62        6037 : ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      63             : {
      64        6037 :     switch( getBaseToken( aElementToken ) )
      65             :     {
      66             :     // nvSpPr CT_ShapeNonVisual begin
      67             : //  case XML_drElemPr:
      68             : //      break;
      69             :     case XML_cNvPr:
      70             :     {
      71         837 :         mpShapePtr->setHidden( rAttribs.getBool( XML_hidden, false ) );
      72         837 :         mpShapePtr->setId( rAttribs.getString( XML_id ).get() );
      73         837 :         mpShapePtr->setName( rAttribs.getString( XML_name ).get() );
      74         837 :         break;
      75             :     }
      76             :     case XML_hlinkMouseOver:
      77             :     case XML_hlinkClick:
      78           5 :         return new HyperLinkContext( *this, rAttribs,  getShape()->getShapeProperties() );
      79             :     case XML_ph:
      80           4 :         mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) );
      81           4 :         if( rAttribs.hasAttribute( XML_idx ) )
      82           2 :             mpShapePtr->setSubTypeIndex( rAttribs.getString( XML_idx ).get().toInt32() );
      83           4 :         break;
      84             :     // nvSpPr CT_ShapeNonVisual end
      85             : 
      86             :     case XML_spPr:
      87         994 :         return new ShapePropertiesContext( *this, *mpShapePtr );
      88             : 
      89             :     case XML_style:
      90         426 :         return new ShapeStyleContext( *this, *mpShapePtr );
      91             : 
      92             :     case XML_txBody:
      93             :     case XML_txbxContent:
      94             :     {
      95         328 :         if (!mpShapePtr->getTextBody())
      96         328 :             mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
      97         328 :         return new TextBodyContext( *this, *mpShapePtr->getTextBody() );
      98             :     }
      99             :     case XML_txXfrm:
     100             :     {
     101         112 :         mpShapePtr->getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot );
     102         112 :         return 0;
     103             :     }
     104             :     case XML_cNvSpPr:
     105         702 :         break;
     106             :     case XML_spLocks:
     107          87 :         break;
     108             :     case XML_bodyPr:
     109         429 :         if (!mpShapePtr->getTextBody())
     110         273 :             mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
     111         429 :         return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr->getTextBody()->getTextProperties() );
     112             :         break;
     113             :     case XML_txbx:
     114         156 :         break;
     115             :     case XML_cNvPicPr:
     116         326 :         break;
     117             :     case XML_nvPicPr:
     118         326 :         break;
     119             :     case XML_relIds:
     120          47 :         break;
     121             :     case XML_nvSpPr:
     122         309 :         break;
     123             :     default:
     124             :         SAL_WARN("oox", "ShapeContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
     125         949 :         break;
     126             :     }
     127             : 
     128        3743 :     return this;
     129             : }
     130             : 
     131         246 : } }
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11