From 753063dd78603cc5d82bb7858bd57f4ed89164e5 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 7 Jul 2011 12:43:14 +0200 Subject: [PATCH] implement line shape --- .../source/rtftok/rtfdocumentimpl.cxx | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 45b0dcc4355a..37e401d55086 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2442,21 +2442,32 @@ void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pair xShape; uno::Reference xPropertySet; + // Create this early, as custom shapes may have properties before the type arrives. createShape(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.CustomShape")), xShape, xPropertySet); - - // Defaults uno::Any aAny; - aAny <<= (sal_uInt32)0xffffff; // White in Word, kind of blue in Writer. - xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aAny); for (std::vector< std::pair >::iterator i = rShapeProperties.begin(); i != rShapeProperties.end(); ++i) { if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("shapeType"))) { nType = i->second.toInt32(); + switch (nType) + { + case 20: // Line + createShape(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.LineShape")), xShape, xPropertySet); + break; + default: + bCustom = true; + break; + } + + // Defaults + aAny <<= (sal_uInt32)0xffffff; // White in Word, kind of blue in Writer. + xPropertySet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("FillColor")), aAny); } else if (i->first.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("wzName"))) { @@ -2513,10 +2524,12 @@ void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pairadd(xShape); - uno::Reference xDefaulter(xShape, uno::UNO_QUERY); - xDefaulter->createCustomShapeDefaults(OUString::valueOf(sal_Int32(nType))); + if (bCustom) + { + uno::Reference xDefaulter(xShape, uno::UNO_QUERY); + xDefaulter->createCustomShapeDefaults(OUString::valueOf(sal_Int32(nType))); + } xShape->setPosition(awt::Point(m_aStates.top().aShape.nLeft, m_aStates.top().aShape.nTop)); xShape->setSize(awt::Size(m_aStates.top().aShape.nRight - m_aStates.top().aShape.nLeft,