LCOV - code coverage report
Current view: top level - oox/source/drawingml - shapecontext.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 39 40 97.5 %
Date: 2014-04-11 Functions: 7 7 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 "oox/drawingml/shapestylecontext.hxx"
      29             : #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
      30             : #include "oox/drawingml/lineproperties.hxx"
      31             : #include "oox/drawingml/drawingmltypes.hxx"
      32             : #include "oox/drawingml/customshapegeometry.hxx"
      33             : #include "oox/drawingml/textbodycontext.hxx"
      34             : #include "oox/drawingml/textbodypropertiescontext.hxx"
      35             : #include "hyperlinkcontext.hxx"
      36             : 
      37             : using namespace oox::core;
      38             : using namespace ::com::sun::star;
      39             : using namespace ::com::sun::star::uno;
      40             : using namespace ::com::sun::star::drawing;
      41             : using namespace ::com::sun::star::beans;
      42             : using namespace ::com::sun::star::text;
      43             : using namespace ::com::sun::star::xml::sax;
      44             : 
      45             : namespace oox { namespace drawingml {
      46             : 
      47             : // CT_Shape
      48        1382 : ShapeContext::ShapeContext( ContextHandler2Helper& rParent, ShapePtr pMasterShapePtr, ShapePtr pShapePtr )
      49             : : ContextHandler2( rParent )
      50             : , mpMasterShapePtr( pMasterShapePtr )
      51        1382 : , mpShapePtr( pShapePtr )
      52             : {
      53        1382 : }
      54             : 
      55        3222 : ShapeContext::~ShapeContext()
      56             : {
      57        1382 :     if ( mpMasterShapePtr.get() && mpShapePtr.get() )
      58        1109 :         mpMasterShapePtr->addChild( mpShapePtr );
      59        1840 : }
      60             : 
      61          53 : ShapePtr ShapeContext::getShape()
      62             : {
      63          53 :     return mpShapePtr;
      64             : }
      65             : 
      66        3455 : ContextHandlerRef ShapeContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      67             : {
      68        3455 :     switch( getBaseToken( aElementToken ) )
      69             :     {
      70             :     // nvSpPr CT_ShapeNonVisual begin
      71             : //  case XML_drElemPr:
      72             : //      break;
      73             :     case XML_cNvPr:
      74             :     {
      75         421 :         mpShapePtr->setHidden( rAttribs.getBool( XML_hidden, false ) );
      76         421 :         mpShapePtr->setId( rAttribs.getString( XML_id ).get() );
      77         421 :         mpShapePtr->setName( rAttribs.getString( XML_name ).get() );
      78         421 :         break;
      79             :     }
      80             :     case XML_hlinkMouseOver:
      81             :     case XML_hlinkClick:
      82           0 :         return new HyperLinkContext( *this, rAttribs,  getShape()->getShapeProperties() );
      83             :     case XML_ph:
      84           3 :         mpShapePtr->setSubType( rAttribs.getToken( XML_type, XML_obj ) );
      85           3 :         if( rAttribs.hasAttribute( XML_idx ) )
      86           2 :             mpShapePtr->setSubTypeIndex( rAttribs.getString( XML_idx ).get().toInt32() );
      87           3 :         break;
      88             :     // nvSpPr CT_ShapeNonVisual end
      89             : 
      90             :     case XML_spPr:
      91         627 :         return new ShapePropertiesContext( *this, *mpShapePtr );
      92             : 
      93             :     case XML_style:
      94         301 :         return new ShapeStyleContext( *this, *mpShapePtr );
      95             : 
      96             :     case XML_txBody:
      97             :     case XML_txbxContent:
      98             :     {
      99         220 :         if (!mpShapePtr->getTextBody())
     100         220 :             mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
     101         220 :         return new TextBodyContext( *this, *mpShapePtr->getTextBody() );
     102             :     }
     103             :     case XML_txXfrm:
     104             :     {
     105          83 :         mpShapePtr->getTextBody()->getTextProperties().moRotation = rAttribs.getInteger( XML_rot );
     106          83 :         return 0;
     107             :         break;
     108             :     }
     109             :     case XML_cNvSpPr:
     110         468 :         break;
     111             :     case XML_spLocks:
     112          34 :         break;
     113             :     case XML_bodyPr:
     114         312 :         if (!mpShapePtr->getTextBody())
     115         182 :             mpShapePtr->setTextBody( TextBodyPtr(new TextBody) );
     116         312 :         return new TextBodyPropertiesContext( *this, rAttribs, mpShapePtr->getTextBody()->getTextProperties() );
     117             :         break;
     118             :     case XML_txbx:
     119         130 :         break;
     120             :     case XML_cNvPicPr:
     121         167 :         break;
     122             :     case XML_nvPicPr:
     123         167 :         break;
     124             :     case XML_relIds:
     125          20 :         break;
     126             :     case XML_nvSpPr:
     127         168 :         break;
     128             :     default:
     129             :         SAL_WARN("oox", "ShapeContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
     130         334 :         break;
     131             :     }
     132             : 
     133        1912 :     return this;
     134             : }
     135             : 
     136             : 
     137         177 : } }
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10