LCOV - code coverage report
Current view: top level - oox/source/ppt - pptshapegroupcontext.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 43 0.0 %
Date: 2014-04-14 Functions: 0 6 0.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/ppt/pptshape.hxx"
      26             : #include "oox/ppt/pptgraphicshapecontext.hxx"
      27             : #include "oox/ppt/pptshapecontext.hxx"
      28             : #include "oox/ppt/pptshapegroupcontext.hxx"
      29             : #include "oox/drawingml/graphicshapecontext.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/connectorshapecontext.hxx"
      35             : #include "oox/drawingml/fillproperties.hxx"
      36             : #include "extdrawingfragmenthandler.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 ppt {
      47             : 
      48           0 : PPTShapeGroupContext::PPTShapeGroupContext(
      49             :         ContextHandler2Helper& rParent,
      50             :         const oox::ppt::SlidePersistPtr pSlidePersistPtr,
      51             :         const ShapeLocation eShapeLocation,
      52             :         oox::drawingml::ShapePtr pMasterShapePtr,
      53             :         oox::drawingml::ShapePtr pGroupShapePtr )
      54             : : ShapeGroupContext( rParent, pMasterShapePtr, pGroupShapePtr )
      55             : , mpSlidePersistPtr( pSlidePersistPtr )
      56             : , meShapeLocation( eShapeLocation )
      57           0 : , pGraphicShape( (PPTShape *)NULL )
      58             : {
      59           0 : }
      60             : 
      61           0 : ContextHandlerRef PPTShapeGroupContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
      62             : {
      63           0 :     if( getNamespace( aElementToken ) == NMSP_dsp )
      64           0 :         aElementToken = NMSP_ppt | getBaseToken( aElementToken );
      65             : 
      66           0 :     switch( aElementToken )
      67             :     {
      68             :     case PPT_TOKEN( cNvPr ):
      69             :     {
      70           0 :         mpGroupShapePtr->setHidden( rAttribs.getBool( XML_hidden, false ) );
      71           0 :         mpGroupShapePtr->setId( rAttribs.getString( XML_id ).get() );
      72           0 :         mpGroupShapePtr->setName( rAttribs.getString( XML_name ).get() );
      73           0 :         break;
      74             :     }
      75             :     case PPT_TOKEN( ph ):
      76           0 :         mpGroupShapePtr->setSubType( rAttribs.getToken( XML_type, FastToken::DONTKNOW ) );
      77           0 :         if( rAttribs.hasAttribute( XML_idx ) )
      78           0 :             mpGroupShapePtr->setSubTypeIndex( rAttribs.getString( XML_idx ).get().toInt32() );
      79           0 :         break;
      80             :     // nvSpPr CT_ShapeNonVisual end
      81             : 
      82             :     case PPT_TOKEN( grpSpPr ):
      83           0 :         return new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr );
      84             :     case PPT_TOKEN( spPr ):
      85           0 :         return new oox::drawingml::ShapePropertiesContext( *this, *mpGroupShapePtr );
      86             : /*
      87             :     case PPT_TOKEN( style ):
      88             :         return new ShapeStyleContext( getParser() );
      89             : */
      90             :     case PPT_TOKEN( cxnSp ):        // connector shape
      91           0 :         return new oox::drawingml::ConnectorShapeContext( *this, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.ConnectorShape" ) ) );
      92             :     case PPT_TOKEN( grpSp ):        // group shape
      93           0 :         return new PPTShapeGroupContext( *this, mpSlidePersistPtr, meShapeLocation, mpGroupShapePtr, oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GroupShape" ) ) );
      94             :     case PPT_TOKEN( sp ):           // Shape
      95             :         {
      96           0 :             boost::shared_ptr<PPTShape> pShape( new PPTShape( meShapeLocation, "com.sun.star.drawing.CustomShape" ) );
      97           0 :             if( rAttribs.getBool( XML_useBgFill, false ) )
      98             :             {
      99           0 :                 ::oox::drawingml::FillProperties &aFill = pShape->getFillProperties();
     100           0 :                 aFill.moFillType = XML_solidFill;
     101             :                 // This is supposed to fill with slide (background) color, but
     102             :                 // TODO: We are using white here, because thats the closest we can assume (?)
     103           0 :                 aFill.maFillColor.setSrgbClr( API_RGB_WHITE );
     104             :             }
     105           0 :             pShape->setModelId(rAttribs.getString( XML_modelId ).get());
     106           0 :             return new PPTShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr, pShape );
     107             :         }
     108             :     case PPT_TOKEN( pic ):          // CT_Picture
     109           0 :         return new PPTGraphicShapeContext( *this, mpSlidePersistPtr, mpGroupShapePtr,  oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.GraphicObjectShape" ) ) );
     110             :     case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame
     111             :         {
     112           0 :             if( pGraphicShape )
     113           0 :                 importExtDrawings();
     114           0 :             pGraphicShape = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) );
     115           0 :             return new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, pGraphicShape, true );
     116             :         }
     117             :     }
     118             : 
     119           0 :     return this;
     120             : }
     121             : 
     122           0 : void PPTShapeGroupContext::importExtDrawings( )
     123             : {
     124           0 :     if( pGraphicShape )
     125             :     {
     126           0 :         for( ::std::vector<OUString>::const_iterator aIt = pGraphicShape->getExtDrawings().begin(), aEnd = pGraphicShape->getExtDrawings().end();
     127             :                     aIt != aEnd; ++aIt )
     128             :             {
     129           0 :                 getFilter().importFragment( new ExtDrawingFragmentHandler( getFilter(), getFragmentPathFromRelId( *aIt ),
     130             :                                                                            mpSlidePersistPtr,
     131             :                                                                            meShapeLocation,
     132             :                                                                            mpMasterShapePtr,
     133             :                                                                            mpGroupShapePtr,
     134           0 :                                                                            pGraphicShape ) );
     135             :             }
     136           0 :             pGraphicShape = oox::drawingml::ShapePtr( (PPTShape *)NULL );
     137             :     }
     138           0 : }
     139             : 
     140           0 : void PPTShapeGroupContext::onEndElement()
     141             : {
     142           0 :     importExtDrawings();
     143           0 : }
     144             : 
     145           0 : } }
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10