From 57be17df8f9d69761e648cd1ccd6d6f0084e569a Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 7 May 2012 09:30:12 +0200 Subject: rtftok: implement RTF_DPRECT Change-Id: Iffc00526bd780e19daccea226735b4c4e28bf9c6 --- writerfilter/source/rtftok/rtfdocumentimpl.cxx | 37 ++++++++++++++++++++------ 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index fa59904ec44e..f23408ab5bcb 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -46,6 +47,7 @@ #include #include #include +#include #include // NS_sprm namespace #include // NS_rtf namespace @@ -2071,8 +2073,34 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) case RTF_POSXR: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right); break; case RTF_DPLINE: + case RTF_DPRECT: { - m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), uno::UNO_QUERY); + sal_Int32 nType = 0; + switch (nKeyword) + { + case RTF_DPLINE: + m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), uno::UNO_QUERY); + break; + case RTF_DPRECT: + nType = ESCHER_ShpInst_Rectangle; + break; + default: + break; + } + if (nType) + m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY); + uno::Reference xDrawSupplier( m_xDstDoc, uno::UNO_QUERY); + if (xDrawSupplier.is()) + { + uno::Reference xShapes(xDrawSupplier->getDrawPage(), uno::UNO_QUERY); + if (xShapes.is()) + xShapes->add(m_aStates.top().aDrawingObject.xShape); + } + if (nType) + { + uno::Reference xDefaulter(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY); + xDefaulter->createCustomShapeDefaults(OUString::valueOf(nType)); + } m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY); std::vector& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties; for (std::vector::iterator i = rPendingProperties.begin(); i != rPendingProperties.end(); ++i) @@ -3302,13 +3330,6 @@ int RTFDocumentImpl::popState() uno::Reference xShape(rDrawing.xShape); xShape->setPosition(awt::Point(rDrawing.nLeft, rDrawing.nTop)); xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom)); - uno::Reference xDrawSupplier( m_xDstDoc, uno::UNO_QUERY); - if ( xDrawSupplier.is() ) - { - uno::Reference< drawing::XShapes > xShapes( xDrawSupplier->getDrawPage(), uno::UNO_QUERY ); - if ( xShapes.is() ) - xShapes->add( xShape ); - } Mapper().startShape(xShape); Mapper().endShape(); } -- cgit