LCOV - code coverage report
Current view: top level - oox/source/drawingml - shapecontext.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 38 38 100.0 %
Date: 2014-11-03 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        4084 : ShapeContext::ShapeContext( ContextHandler2Helper& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr )
      50             : : ContextHandler2( rParent )
      51             : , mpMasterShapePtr( pMasterShapePtr )
      52        4084 : , mpShapePtr( pShapePtr )
      53             : {
      54        4084 : }
      55             : 
      56        9490 : ShapeContext::~ShapeContext()
      57             : {
      58        4084 :     if ( mpMasterShapePtr.get() && mpShapePtr.get() )
      59        3060 :         mpMasterShapePtr->addChild( mpShapePtr );
      60        5406 : }
      61             : 
      62       10196 : ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      63             : {
      64       10196 :     switch( getBaseToken( aElementToken ) )
      65             :     {
      66             :     // nvSpPr CT_ShapeNonVisual begin
      67             : //  case XML_drElemPr:
      68             : //      break;
      69             :     case XML_cNvPr:
      70             :     {
      71        1342 :         mpShapePtr->setHidden( rAttribs.getBool( XML_hidden, false ) );
      72        1342 :         mpShapePtr->setId( rAttribs.getString( XML_id ).get() );
      73        1342 :         mpShapePtr->setName( rAttribs.getString( XML_name ).get() );
      74        1342 :         break;
      75             :     }
      76             :     case XML_hlinkMouseOver:
      77             :     case XML_hlinkClick:
      78           4 :         return new HyperLinkContext( *this, rAttribs,  getShape()->getShapeProperties() );
      79             :     case XML_ph:
      80           8 :         mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) );
      81           8 :         if( rAttribs.hasAttribute( XML_idx ) )
      82           4 :             mpShapePtr->setSubTypeIndex( rAttribs.getString( XML_idx ).get().toInt32() );
      83           8 :         break;
      84             :     // nvSpPr CT_ShapeNonVisual end
      85             : 
      86             :     case XML_spPr:
      87        1728 :         return new ShapePropertiesContext( *this, *mpShapePtr );
      88             : 
      89             :     case XML_style:
      90         772 :         return new ShapeStyleContext( *this, *mpShapePtr );
      91             : 
      92             :     case XML_txBody:
      93             :     case XML_txbxContent:
      94             :     {
      95         616 :         if (!mpShapePtr->getTextBody())
      96         616 :             mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
      97         616 :         return new TextBodyContext( *this, *mpShapePtr->getTextBody() );
      98             :     }
      99             :     case XML_txXfrm:
     100             :     {
     101         220 :         mpShapePtr->getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot );
     102         220 :         return 0;
     103             :     }
     104             :     case XML_cNvSpPr:
     105        1228 :         break;
     106             :     case XML_spLocks:
     107         172 :         break;
     108             :     case XML_bodyPr:
     109         738 :         if (!mpShapePtr->getTextBody())
     110         442 :             mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
     111         738 :         return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr->getTextBody()->getTextProperties() );
     112             :         break;
     113             :     case XML_txbx:
     114         296 :         break;
     115             :     case XML_cNvPicPr:
     116         516 :         break;
     117             :     case XML_nvPicPr:
     118         516 :         break;
     119             :     case XML_relIds:
     120          88 :         break;
     121             :     case XML_nvSpPr:
     122         554 :         break;
     123             :     default:
     124             :         SAL_WARN("oox", "ShapeContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
     125        1398 :         break;
     126             :     }
     127             : 
     128        6118 :     return this;
     129             : }
     130             : 
     131         408 : } }
     132             : 
     133             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10