oox/source/drawingml/textcharacterpropertiescontext.cxx | 11 +++++++++ sw/qa/extras/ooxmlimport/data/tdf121804.docx |binary sw/qa/extras/ooxmlimport/ooxmlimport2.cxx | 18 ++++++++++++++++ 3 files changed, 29 insertions(+)
New commits: commit 248ecee4ea28a3873cdd0ef0c1ef501537be961d Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Dec 17 21:13:00 2018 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Dec 19 15:32:27 2018 +0100 tdf#121804 DOCX import: handle sub/superscript inside group shapes Regression from commit d5c934d150cb6cea5f96cbbee4fb5e8312bf027e (n#792778 DOCX import: parse group shapes in oox only, 2012-12-14), where where manual wordprocessingML -> drawingML translation did not handle this character property. Change-Id: I87481bc9c26651fd15dd39a58a92f467e8311256 Reviewed-on: https://gerrit.libreoffice.org/65289 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> (cherry picked from commit dafbc86037d63e938967c0f501bdfe3ae19fa992) Reviewed-on: https://gerrit.libreoffice.org/65413 Tested-by: Xisco FaulĂ <xiscofa...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx index 2b63f9f5237b..236219d844cf 100644 --- a/oox/source/drawingml/textcharacterpropertiescontext.cxx +++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx @@ -205,6 +205,17 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl mrTextCharacterProperties.moCaseMap = XML_none; } break; + case W_TOKEN(vertAlign): + { + // Map wordprocessingML <w:vertAlign w:val="..."/> to drawingML + // <a:rPr baseline="...">. + sal_Int32 nVal = rAttribs.getToken(W_TOKEN(val), 0); + if (nVal == XML_superscript) + mrTextCharacterProperties.moBaseline = 30000; + else if (nVal == XML_subscript) + mrTextCharacterProperties.moBaseline = -25000; + break; + } case OOX_TOKEN(w14, glow): case OOX_TOKEN(w14, shadow): case OOX_TOKEN(w14, reflection): diff --git a/sw/qa/extras/ooxmlimport/data/tdf121804.docx b/sw/qa/extras/ooxmlimport/data/tdf121804.docx new file mode 100644 index 000000000000..af3f0d247952 Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf121804.docx differ diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx index 877a645da288..c1e353a9243b 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx @@ -222,6 +222,24 @@ DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx") CPPUNIT_ASSERT_EQUAL(OUString("1695"), aTop); } +DECLARE_OOXMLIMPORT_TEST(testTdf121804, "tdf121804.docx") +{ + uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xShape(xGroup->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XTextRange> xFirstPara = getParagraphOfText(1, xShape->getText()); + uno::Reference<text::XTextRange> xFirstRun = getRun(xFirstPara, 1); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), + getProperty<sal_Int32>(xFirstRun, "CharEscapement")); + // This failed with a NoSuchElementException, super/subscript property was + // lost on import, so the whole paragraph was a single run. + uno::Reference<text::XTextRange> xSecondRun = getRun(xFirstPara, 2); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(30), + getProperty<sal_Int32>(xSecondRun, "CharEscapement")); + uno::Reference<text::XTextRange> xThirdRun = getRun(xFirstPara, 3); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-25), + getProperty<sal_Int32>(xThirdRun, "CharEscapement")); +} + DECLARE_OOXMLIMPORT_TEST(testTdf114217, "tdf114217.docx") { uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits