diff options
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/mce-nested.docx | bin | 0 -> 28318 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 4 |
3 files changed, 12 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/mce-nested.docx b/sw/qa/extras/ooxmlimport/data/mce-nested.docx Binary files differnew file mode 100644 index 000000000000..c110f63dae40 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/mce-nested.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index bd7b1800cad0..d7ce137afe02 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1583,6 +1583,16 @@ DECLARE_OOXMLIMPORT_TEST(testMceWpg, "mce-wpg.docx") getParagraphOfText(1, xText, "DML1"); } +DECLARE_OOXMLIMPORT_TEST(testMceNested, "mce-nested.docx") +{ + // Vertical position of the textbox was incorrect due to incorrect nested mce handling. + uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY); + // positionV's posOffset from the bugdoc, was 0. + CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(2514600)), getProperty<sal_Int32>(xFrame, "VertOrientPosition")); +} + 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 ed1ae178a0e5..a50f449bd83c 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -242,7 +242,7 @@ void SAL_CALL OOXMLFastContextHandler::startFastElement if (oox::getNamespace(Element) == static_cast<sal_Int32>(NS_mce)) m_bDiscardChildren = prepareMceContext(Element, Attribs); - if (!m_bDiscardChildren) + else if (!m_bDiscardChildren) { attributes(Attribs); lcl_startFastElement(Element, Attribs); @@ -283,7 +283,7 @@ throw (uno::RuntimeException, xml::sax::SAXException) m_bTookChoice = aState.m_bTookChoice; } - if (!m_bDiscardChildren) + else if (!m_bDiscardChildren) lcl_endFastElement(Element); #ifdef DEBUG_CONTEXT_HANDLER |