diff --git a/sw/qa/extras/ooxmlimport/data/mce-nested.docx b/sw/qa/extras/ooxmlimport/data/mce-nested.docx new file mode 100644 index 000000000000..c110f63dae40 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/mce-nested.docx differ 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 xTextFramesSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); + uno::Reference 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(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(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