[Libreoffice-commits] core.git: sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Thu Dec 5 09:35:18 PST 2013
sw/qa/extras/ooxmlimport/data/mce-nested.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 10 ++++++++++
writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
New commits:
commit 31c65a129afb3c1bf14a1acd88c60b64d4f555d1
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Thu Dec 5 18:20:51 2013 +0100
DOCX import: never call lcl_start/endElement if handling mce elements
The problem was that after handling the mce elements
(AlternativeContent, Choice, Fallback) we still invoked the lcl version
of these methods and this resulted in duplicated properties in the
dmapper, finally resulting in incorrect position of the textbox.
Change-Id: Ib581162cba703fc1e2e44c1a9e63358891d6f78c
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 0000000..c110f63
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 bd7b180..d7ce137 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 ed1ae17..a50f449 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
More information about the Libreoffice-commits
mailing list