From 11c5699dad06fb0d7fc0e458550a1dac82f8ee5f Mon Sep 17 00:00:00 2001 From: Muthu Subramanian Date: Mon, 25 Jun 2012 19:25:52 +0530 Subject: n#759210: Certain smartart drawings weren't imported. SmartArt info was reset, when there was a chart (e.g.) in the same slide. --- oox/inc/oox/ppt/pptshapegroupcontext.hxx | 1 + oox/source/drawingml/diagram/diagram.cxx | 66 +++++++++++++++++--------------- oox/source/ppt/pptshapegroupcontext.cxx | 14 +++++-- 3 files changed, 46 insertions(+), 35 deletions(-) (limited to 'oox') diff --git a/oox/inc/oox/ppt/pptshapegroupcontext.hxx b/oox/inc/oox/ppt/pptshapegroupcontext.hxx index 7e2a6d3b5f67..841e741ec247 100644 --- a/oox/inc/oox/ppt/pptshapegroupcontext.hxx +++ b/oox/inc/oox/ppt/pptshapegroupcontext.hxx @@ -39,6 +39,7 @@ class PPTShapeGroupContext : public ::oox::drawingml::ShapeGroupContext SlidePersistPtr mpSlidePersistPtr; ShapeLocation meShapeLocation; oox::drawingml::ShapePtr pGraphicShape; + void importExtDrawings(); public: PPTShapeGroupContext( diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 8e6586d82e2b..002e20a4ab25 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -395,40 +395,44 @@ void loadDiagram( ShapePtr& pShape, pShape->addExtDrawingRelId( *aIt ); } - // layout - if( !rLayoutPath.isEmpty() ) + // extLst is present, lets bet on that and ignore the rest of the data from here + if( !pData->getExtDrawings().size() ) { - rtl::Reference< core::FragmentHandler > xRef( - new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout )); - importFragment(rFilter, - loadFragment(rFilter,xRef), - "DiagramLayout", - pShape, - xRef); - } + // layout + if( !rLayoutPath.isEmpty() ) + { + rtl::Reference< core::FragmentHandler > xRef( + new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout )); + importFragment(rFilter, + loadFragment(rFilter,xRef), + "DiagramLayout", + pShape, + xRef); + } - // style - if( !rQStylePath.isEmpty() ) - { - rtl::Reference< core::FragmentHandler > xRef( - new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() )); - importFragment(rFilter, - loadFragment(rFilter,xRef), - "DiagramQStyle", - pShape, - xRef); - } + // style + if( !rQStylePath.isEmpty() ) + { + rtl::Reference< core::FragmentHandler > xRef( + new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() )); + importFragment(rFilter, + loadFragment(rFilter,xRef), + "DiagramQStyle", + pShape, + xRef); + } - // colors - if( !rColorStylePath.isEmpty() ) - { - rtl::Reference< core::FragmentHandler > xRef( - new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() )); - importFragment(rFilter, - loadFragment(rFilter,xRef), - "DiagramColorStyle", - pShape, - xRef); + // colors + if( !rColorStylePath.isEmpty() ) + { + rtl::Reference< core::FragmentHandler > xRef( + new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() )); + importFragment(rFilter, + loadFragment(rFilter,xRef), + "DiagramColorStyle", + pShape, + xRef); + } } // diagram loaded. now lump together & attach to shape diff --git a/oox/source/ppt/pptshapegroupcontext.cxx b/oox/source/ppt/pptshapegroupcontext.cxx index 0529ec6c9c62..bf2a99f2c2fe 100644 --- a/oox/source/ppt/pptshapegroupcontext.cxx +++ b/oox/source/ppt/pptshapegroupcontext.cxx @@ -128,6 +128,8 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s break; case PPT_TOKEN( graphicFrame ): // CT_GraphicalObjectFrame { + if( pGraphicShape ) + importExtDrawings(); pGraphicShape = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, "com.sun.star.drawing.OLE2Shape" ) ); xRet.set( new oox::drawingml::GraphicalObjectFrameContext( *this, mpGroupShapePtr, pGraphicShape, true ) ); } @@ -141,9 +143,9 @@ Reference< XFastContextHandler > PPTShapeGroupContext::createFastChildContext( s return xRet; } -void PPTShapeGroupContext::endFastElement( sal_Int32 nElement ) throw (SAXException, RuntimeException) +void PPTShapeGroupContext::importExtDrawings( ) { - if( nElement == PPT_TOKEN( spTree ) && pGraphicShape ) + if( pGraphicShape ) { for( ::std::vector::const_iterator aIt = pGraphicShape->getExtDrawings().begin(), aEnd = pGraphicShape->getExtDrawings().end(); aIt != aEnd; ++aIt ) @@ -154,12 +156,16 @@ void PPTShapeGroupContext::endFastElement( sal_Int32 nElement ) throw (SAXExcept mpMasterShapePtr, mpGroupShapePtr, pGraphicShape ) ); - } - pGraphicShape = oox::drawingml::ShapePtr( (PPTShape *)NULL ); + pGraphicShape = oox::drawingml::ShapePtr( (PPTShape *)NULL ); } } +void PPTShapeGroupContext::endFastElement( sal_Int32 /*nElement*/ ) throw (SAXException, RuntimeException) +{ + importExtDrawings(); +} + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit