From 8c73b16f5f18f3bc1dbf9ff6c1475db56b44d304 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 5 Dec 2013 14:00:52 +0100 Subject: DOCX import: declare wpg as a supported feature This is the same as wps, just for group shapes. Change-Id: I321b19ed538a6cb8f9068c7de6fbe9a8eb0bd82f --- sw/qa/extras/inc/swmodeltestbase.hxx | 4 +++- sw/qa/extras/ooxmlimport/data/mce-wpg.docx | Bin 0 -> 17404 bytes sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 9 +++++++++ writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 sw/qa/extras/ooxmlimport/data/mce-wpg.docx diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx index 57d40c6cb101..0a5418ad84b7 100644 --- a/sw/qa/extras/inc/swmodeltestbase.hxx +++ b/sw/qa/extras/inc/swmodeltestbase.hxx @@ -351,9 +351,11 @@ protected: return xParagraph; } - uno::Reference getParagraphOfText(int number, uno::Reference xText) const + uno::Reference getParagraphOfText(int number, uno::Reference xText, OUString content = OUString()) const { uno::Reference const xParagraph(getParagraphOrTable(number, xText), uno::UNO_QUERY_THROW); + if (!content.isEmpty()) + CPPUNIT_ASSERT_EQUAL(content, xParagraph->getString()); return xParagraph; } diff --git a/sw/qa/extras/ooxmlimport/data/mce-wpg.docx b/sw/qa/extras/ooxmlimport/data/mce-wpg.docx new file mode 100755 index 000000000000..bd0d84681317 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/mce-wpg.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 6d9837eaee47..bd7b1800cad0 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1574,6 +1574,15 @@ DECLARE_OOXMLIMPORT_TEST(textboxWpgOnly, "textbox-wpg-only.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty(getRun(getParagraphOfText(1, xText), 1), "CharEscapementHeight")); } +DECLARE_OOXMLIMPORT_TEST(testMceWpg, "mce-wpg.docx") +{ + // Make sure that we read the primary branch, if wpg is requested as a feature. + uno::Reference xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference xText = uno::Reference(xGroup->getByIndex(0), uno::UNO_QUERY)->getText(); + // This was VML1. + getParagraphOfText(1, xText, "DML1"); +} + DECLARE_OOXMLIMPORT_TEST(testFdo70457, "fdo70457.docx") { // The document contains a rotated bitmap diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 78a446075d95..ed1ae178a0e5 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -198,6 +198,7 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref OUString aRequires = rAttribs->getOptionalValue(OOXML_Requires); static const char* aFeatures[] = { "wps", + "wpg", }; for (size_t i = 0; i < SAL_N_ELEMENTS(aFeatures); ++i) { -- cgit v1.2.3