[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Thu Oct 1 08:34:21 UTC 2020
sw/qa/extras/ooxmlexport/data/tdf134784.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 11 +++++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 7 ++++++-
3 files changed, 17 insertions(+), 1 deletion(-)
New commits:
commit 2f40b190b22213a80aa11021f69619f1b72838be
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Tue Sep 15 16:13:34 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Thu Oct 1 10:33:46 2020 +0200
tdf#134784 DOCX import: fix shape paragraph margins
based on bad style inheritance.
Regression from commit dc0300eac3b755bc207cd1fe87217f4ebaeb9f58
(tdf#118521 DOCX import: fix paragraph margin from paragraph style),
revealing the problematic m_sCurrentParaStyleName, see also
commit 8920d865ee148518bf71f71ce1866b24cc17c07e for more information.
Change-Id: Icc7f70452d946d56dc840d39545d850f74f97ebc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102774
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit c04ee66c7cfeb725d637b0f9ec3e3b1f8776bfe9)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103585
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf134784.docx b/sw/qa/extras/ooxmlexport/data/tdf134784.docx
new file mode 100644
index 000000000000..2099db66e0f6
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf134784.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 087373aaf7e4..984564415989 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -790,6 +790,17 @@ DECLARE_OOXMLEXPORT_TEST(testMarginsFromStyle, "margins_from_style.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(600), getProperty<sal_Int32>(getParagraph(3), "ParaBottomMargin"));
}
+DECLARE_OOXMLEXPORT_TEST(testTdf134784, "tdf134784.docx")
+{
+ uno::Reference<text::XText> textbox(getShape(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(3, getParagraphs(textbox));
+ uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, textbox);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(212), getProperty<sal_Int32>(xParagraph, "ParaBottomMargin"));
+
+ // This wasn't zero (it was inherited from style of the previous paragraph in the main text)
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xParagraph, "ParaTopMargin"));
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf104348_contextMargin, "tdf104348_contextMargin.docx")
{
// tdf#104348 shows that ContextMargin belongs with Top/Bottom handling
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 0e9e87f6df46..dc45aabdb27d 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -772,8 +772,13 @@ uno::Sequence< style::TabStop > DomainMapper_Impl::GetCurrentTabStopAndClear()
OUString DomainMapper_Impl::GetCurrentParaStyleName()
{
+ OUString sName;
// use saved currParaStyleName as a fallback, in case no particular para style name applied.
- OUString sName = m_sCurrentParaStyleName;
+ // tdf#134784 except in the case of first paragraph of shapes to avoid bad fallback.
+ // TODO fix this "highly inaccurate" m_sCurrentParaStyleName
+ if ( !m_bIsFirstParaInShape )
+ sName = m_sCurrentParaStyleName;
+
PropertyMapPtr pParaContext = GetTopContextOfType(CONTEXT_PARAGRAPH);
if ( pParaContext && pParaContext->isSet(PROP_PARA_STYLE_NAME) )
pParaContext->getProperty(PROP_PARA_STYLE_NAME)->second >>= sName;
More information about the Libreoffice-commits
mailing list