oox/source/drawingml/shape.cxx | 3 -- oox/source/shape/WpsContext.cxx | 2 - sw/qa/extras/ooxmlexport/data/textbox-rounded-corners.docx |binary sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 15 +++++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-)
New commits: commit d379d18666aa42031359ca8eb34b0021960347ae Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Jun 18 11:57:31 2014 +0200 oox: import WPS shape with text as shape with textbox This allows having real shapes (like having rounded corners) and complex content (like containing a table) at the same time. WPS shapes are wrappers around drawingML markup in DOCX files, so this only affects the DOCX import. Change-Id: Iad1c1c61233be1c17efa1821e680927aa9587215 diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 9d16c39..85b8b4d 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -816,8 +816,7 @@ Reference< XShape > Shape::createAndInsert( } else if (mbTextBox) { - //No such property yet - //aShapeProps.setProperty(PROP_TextBox, uno::makeAny(true)); + aShapeProps.setProperty(PROP_TextBox, uno::makeAny(true)); } if (aServiceName != "com.sun.star.text.TextFrame" && isLinkedTxbx()) diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index d7696f3..ec35295 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -131,7 +131,6 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken case XML_txbx: { mpShape->getCustomShapeProperties()->setShapeTypeOverride(true); - mpShape->setServiceName("com.sun.star.text.TextFrame"); mpShape->setTextBox(true); //in case if the textbox is linked, save the attributes //for further processing. @@ -153,7 +152,6 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken //in case if the textbox is linked, save the attributes //for further processing. mpShape->getCustomShapeProperties()->setShapeTypeOverride(true); - mpShape->setServiceName("com.sun.star.text.TextFrame"); mpShape->setTextBox(true); OptValue<OUString> id = rAttribs.getString(XML_id); OptValue<OUString> seq = rAttribs.getString(XML_seq); diff --git a/sw/qa/extras/ooxmlexport/data/textbox-rounded-corners.docx b/sw/qa/extras/ooxmlexport/data/textbox-rounded-corners.docx new file mode 100755 index 0000000..012e071 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/textbox-rounded-corners.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 0d9e0ea..25a6cf7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -1796,6 +1796,21 @@ DECLARE_OOXMLEXPORT_TEST(testDashedLine_CustDashPercentage, "dashed_line_custdas assertXPath(pXmlDoc,"/w:document/w:body/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/a:graphic[1]/a:graphicData[1]/wps:wsp[1]/wps:spPr[1]/a:ln[1]/a:custDash[1]/a:ds[3]", "sp", "300000"); } +DECLARE_OOXMLEXPORT_TEST(testTextboxRoundedCorners, "textbox-rounded-corners.docx") +{ + uno::Reference<drawing::XShape> xShape = getShape(1); + comphelper::SequenceAsHashMap aCustomShapeGeometry = comphelper::SequenceAsHashMap(getProperty< uno::Sequence<beans::PropertyValue> >(xShape, "CustomShapeGeometry")); + + // Test that the shape is a rounded rectangle. + CPPUNIT_ASSERT_EQUAL(OUString("ooxml-roundRect"), aCustomShapeGeometry["Type"].get<OUString>()); + + // The shape text should start with a table, with "a" in its A1 cell. + uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText(); + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1, xText), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("a"), xCell->getString()); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits