summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2021-01-25 15:48:46 +0100
committerLászló Németh <nemeth@numbertext.org>2021-01-26 13:06:14 +0100
commit9e21215d45b2eea31019711282445580fad0d753 (patch)
treeccc2fc544bf1366f68e8a6d770bc8e80d57e9349 /writerfilter
parentd4d87c35e7e166cc6df92aa5be83eb3a65c2d02a (diff)
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@numbertext.org>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx18
1 files changed, 15 insertions, 3 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index a7d488b47a89..d0ed6bcb10b2 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1542,12 +1542,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()) ||
@@ -1559,7 +1570,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;