LCOV - code coverage report
Current view: top level - oox/source/drawingml - shapegroupcontext.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 27 34 79.4 %
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/beans/XMultiPropertySet.hpp>
      22             : #include <com/sun/star/container/XNamed.hpp>
      23             : 
      24             : #include "oox/helper/attributelist.hxx"
      25             : #include "oox/drawingml/shapegroupcontext.hxx"
      26             : #include "oox/drawingml/connectorshapecontext.hxx"
      27             : #include "oox/drawingml/graphicshapecontext.hxx"
      28             : #include "oox/drawingml/lineproperties.hxx"
      29             : #include "oox/drawingml/drawingmltypes.hxx"
      30             : #include "drawingml/customshapegeometry.hxx"
      31             : #include <drawingml/shapepropertiescontext.hxx>
      32             : #include "drawingml/textbodycontext.hxx"
      33             : 
      34             : using namespace oox::core;
      35             : using namespace ::com::sun::star;
      36             : using namespace ::com::sun::star::uno;
      37             : using namespace ::com::sun::star::drawing;
      38             : using namespace ::com::sun::star::beans;
      39             : using namespace ::com::sun::star::text;
      40             : using namespace ::com::sun::star::xml::sax;
      41             : 
      42             : namespace oox { namespace drawingml {
      43             : 
      44         357 : ShapeGroupContext::ShapeGroupContext( ContextHandler2Helper& rParent, ShapePtr pMasterShapePtr, ShapePtr pGroupShapePtr )
      45             : : ContextHandler2( rParent )
      46             : , mpGroupShapePtr( pGroupShapePtr )
      47         357 : , mpMasterShapePtr( pMasterShapePtr )
      48             : {
      49         357 :     if( pMasterShapePtr )
      50         326 :         mpGroupShapePtr->setWps(pMasterShapePtr->getWps());
      51         357 : }
      52             : 
      53         766 : ShapeGroupContext::~ShapeGroupContext()
      54             : {
      55         357 :     if ( mpMasterShapePtr.get() && mpGroupShapePtr.get() )
      56         326 :         mpMasterShapePtr->addChild( mpGroupShapePtr );
      57         409 : }
      58             : 
      59         471 : ContextHandlerRef ShapeGroupContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      60             : {
      61         471 :     switch( getBaseToken( aElementToken ) )
      62             :     {
      63             :     case XML_cNvPr:
      64             :     {
      65           4 :         mpGroupShapePtr->setHidden( rAttribs.getBool( XML_hidden, false ) );
      66           4 :         mpGroupShapePtr->setId( rAttribs.getString( XML_id ).get() );
      67           4 :         mpGroupShapePtr->setName( rAttribs.getString( XML_name ).get() );
      68           4 :         break;
      69             :     }
      70             :     case XML_ph:
      71           0 :         mpGroupShapePtr->setSubType( rAttribs.getToken( XML_type, FastToken::DONTKNOW ) );
      72           0 :         if( rAttribs.hasAttribute( XML_idx ) )
      73           0 :             mpGroupShapePtr->setSubTypeIndex( rAttribs.getString( XML_idx ).get().toInt32() );
      74           0 :         break;
      75             :     // nvSpPr CT_ShapeNonVisual end
      76             : 
      77             :     case XML_grpSpPr:
      78          52 :         return new ShapePropertiesContext( *this, *mpGroupShapePtr );
      79             :     case XML_nvGrpSpPr:
      80          31 :         return 0;
      81             :     case XML_spPr:
      82           0 :         return new ShapePropertiesContext( *this, *mpGroupShapePtr );
      83             : /*
      84             :     case XML_style:
      85             :         return new ShapeStyleContext( getParser() );
      86             : */
      87             :     case XML_cxnSp:         // connector shape
      88             :         {
      89           1 :             ShapePtr pShape(new Shape("com.sun.star.drawing.ConnectorShape"));
      90           1 :             pShape->setLockedCanvas(mpGroupShapePtr->getLockedCanvas());
      91           1 :             return new ConnectorShapeContext( *this, mpGroupShapePtr, pShape );
      92             :         }
      93             :     case XML_grpSp:         // group shape
      94           6 :         return new ShapeGroupContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) ) );
      95             :     case XML_sp:            // shape
      96             :     case XML_wsp:
      97             :         // Don't set default character height for WPS shapes, Writer has its
      98             :         // own way to set the default, and if we don't set it here, editing
      99             :         // properly inherits it.
     100         352 :         return new ShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.CustomShape", getBaseToken(aElementToken) == XML_sp ) ) );
     101             :     case XML_pic:           // CT_Picture
     102           2 :         return new GraphicShapeContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ) );
     103             :     case XML_graphicFrame:  // CT_GraphicalObjectFrame
     104           0 :         return new GraphicalObjectFrameContext( *this, mpGroupShapePtr, ShapePtr( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) ), true );
     105             :     case XML_cNvGrpSpPr:
     106          21 :         break;
     107             :     case XML_grpSpLocks:
     108           2 :         break;
     109             :     default:
     110             :         SAL_WARN("oox", "ShapeGroupContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
     111           0 :         break;
     112             :     }
     113             : 
     114          27 :     return this;
     115             : }
     116             : 
     117         246 : } }
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11