From 467f335161d0d098c167612fb530f3abe3b2cef4 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 30 May 2012 09:56:58 +0200 Subject: oox: initial smartart text is imported into Writer, take two The original commit (8c6fb76c2cc24c336a28702b5f7f31cb5964129a) broke the sw_subsequent_ooxmltok test, as it threated getDiagramShapeContext() a const method, but that's not true. Check mxDiagramShapeContext directly instead. Change-Id: Idd730787be41cc11e6c1fc962da60f05e024ee84 --- oox/source/shape/ShapeContextHandler.cxx | 26 ++++++++++++++++++++++++++ oox/source/shape/ShapeContextHandler.hxx | 2 ++ 2 files changed, 28 insertions(+) (limited to 'oox') diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 32342380e2f6..064360303427 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -30,6 +30,7 @@ #include "oox/vml/vmldrawingfragment.hxx" #include "oox/vml/vmlshape.hxx" #include "oox/vml/vmlshapecontainer.hxx" +#include "oox/drawingml/diagram/diagram.hxx" namespace oox { namespace shape { @@ -119,6 +120,19 @@ ShapeContextHandler::getDrawingShapeContext() return mxDrawingFragmentHandler; } +uno::Reference +ShapeContextHandler::getDiagramShapeContext() +{ + if (!mxDiagramShapeContext.is()) + { + FragmentHandlerRef rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath)); + mpShape.reset(new Shape()); + mxDiagramShapeContext.set(new DiagramGraphicDataContext(*rFragmentHandler, mpShape)); + } + + return mxDiagramShapeContext; +} + uno::Reference ShapeContextHandler::getContextHandler() { @@ -130,6 +144,9 @@ ShapeContextHandler::getContextHandler() case NMSP_vml: xResult.set(getDrawingShapeContext()); break; + case NMSP_dmlDiagram: + xResult.set(getDiagramShapeContext()); + break; default: xResult.set(getGraphicShapeContext(mnStartToken)); break; @@ -154,6 +171,9 @@ void SAL_CALL ShapeContextHandler::startFastElement mpThemePtr.reset(new Theme()); + if (Element == DGM_TOKEN(relIds)) + createFastChildContext(Element, Attribs); + uno::Reference xContextHandler(getContextHandler()); if (xContextHandler.is()) @@ -247,6 +267,12 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException) if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().takeLastShape() ) xResult = pShape->convertAndInsert( xShapes ); } + else if (mxDiagramShapeContext.is()) + { + basegfx::B2DHomMatrix aMatrix; + mpShape->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix ); + xResult = mpShape->getXShape(); + } else if (mpShape.get() != NULL) { basegfx::B2DHomMatrix aTransformation; diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx index df9c3987a2c9..95aee66b0564 100644 --- a/oox/source/shape/ShapeContextHandler.hxx +++ b/oox/source/shape/ShapeContextHandler.hxx @@ -159,6 +159,7 @@ private: GraphicShapeContextPtr; css::uno::Reference mxDrawingFragmentHandler; css::uno::Reference mxGraphicShapeContext; + css::uno::Reference mxDiagramShapeContext; core::XmlFilterRef mxFilterBase; drawingml::ThemePtr mpThemePtr; @@ -168,6 +169,7 @@ private: css::uno::Reference getGraphicShapeContext(::sal_Int32 Element); css::uno::Reference getDrawingShapeContext(); + css::uno::Reference getDiagramShapeContext(); css::uno::Reference getContextHandler(); }; -- cgit