[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-1' - sw/qa writerfilter/source
László Németh (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 28 14:17:29 UTC 2021
sw/qa/extras/ooxmlexport/data/tdf137655.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 8 ++++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 18 +++++++++++++++---
3 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit 9a7aba939bf6c3e72844d3913106eeca4ac0ef3e
Author: László Németh <nemeth at numbertext.org>
AuthorDate: Mon Jan 25 15:48:46 2021 +0100
Commit: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Mon Jun 28 16:16:53 2021 +0200
tdf#137655 DOCX table import: fix zero para top margin
when only w:beforeAutospacing=0 was specified, but not
PARA_TOP_MARGIN (see default_spacing = -1 in processing
of LN_CT_Spacing_beforeAutospacing).
Follow-up of commit 61821277ed4974debd05af89cb7284602512088f
(tdf#104354 writerfilter: rewrite Autospacing).
Change-Id: I5fff7a8b62450ebaf8ef6b552ecbb2b1cfb24381
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109914
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 9e21215d45b2eea31019711282445580fad0d753)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117980
Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf137655.docx b/sw/qa/extras/ooxmlexport/data/tdf137655.docx
new file mode 100644
index 000000000000..d87d434b324d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137655.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index aa29afd218e0..39485377a683 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -546,6 +546,14 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113258_noBeforeAutospacing, "tdf113258_noBeforeA
getProperty<sal_Int32>(xShape->getStart(), "ParaTopMargin"));
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf137655, "tdf137655.docx")
+{
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ // These were 280.
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:p[1]/w:pPr/w:spacing", "before", "0");
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[2]/w:p[1]/w:pPr/w:spacing", "before", "0");
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf120511_eatenSection, "tdf120511_eatenSection.docx")
{
xmlDocUniquePtr pXmlDoc = parseLayoutDump();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 7cda0e0df1dc..291924abce81 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1544,12 +1544,23 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
const bool bAllowAdjustments = !GetSettingsTable()->GetDoNotUseHTMLParagraphAutoSpacing();
sal_Int32 nBeforeAutospacing = -1;
bool bIsAutoSet = pParaContext && pParaContext->isSet(PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING);
+ bool bIsZeroAutospacingWithoutTopmargin = false;
+ const bool bNoTopmargin = pParaContext && !pParaContext->isSet(PROP_PARA_TOP_MARGIN);
// apply INHERITED autospacing only if top margin is not set
- if ( bIsAutoSet || (pParaContext && !pParaContext->isSet(PROP_PARA_TOP_MARGIN)) )
+ if ( bIsAutoSet || bNoTopmargin )
+ {
GetAnyProperty(PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, pPropertyMap) >>= nBeforeAutospacing;
+ // tdf#137655 only w:beforeAutospacing=0 was specified, but not PARA_TOP_MARGIN
+ // (see default_spacing = -1 in processing of LN_CT_Spacing_beforeAutospacing)
+ if ( bNoTopmargin && nBeforeAutospacing == ConversionHelper::convertTwipToMM100(-1) )
+ {
+ nBeforeAutospacing = 0;
+ bIsZeroAutospacingWithoutTopmargin = true;
+ }
+ }
if ( nBeforeAutospacing > -1 && pParaContext )
{
- if ( bAllowAdjustments )
+ if ( bAllowAdjustments && !bIsZeroAutospacingWithoutTopmargin )
{
if ( GetIsFirstParagraphInShape() ||
(GetIsFirstParagraphInSection() && GetSectionContext() && GetSectionContext()->IsFirstSection()) ||
@@ -1561,7 +1572,8 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con
pParaContext->Insert( PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, uno::makeAny( sal_Int32(0) ),true, PARA_GRAB_BAG );
}
}
- pParaContext->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny(nBeforeAutospacing));
+ if ( !bIsZeroAutospacingWithoutTopmargin || (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth) )
+ pParaContext->Insert(PROP_PARA_TOP_MARGIN, uno::makeAny(nBeforeAutospacing));
}
sal_Int32 nAfterAutospacing = -1;
More information about the Libreoffice-commits
mailing list