diff options
author | László Németh <nemeth@numbertext.org> | 2020-06-24 17:18:31 +0200 |
---|---|---|
committer | Gabor Kelemen <kelemen.gabor2@nisz.hu> | 2020-09-13 12:40:45 +0200 |
commit | 92116520d0dd157e4db43ce2fc2e1627b9c25948 (patch) | |
tree | 77ba113bba90e6f68addf0c76c9befd03c642a98 /sw/source/core/layout/flowfrm.cxx | |
parent | 383e1a859a51bc5b30644584d5101c8a81a31d96 (diff) |
tdf#125893 DOCX import: fix "half" contextual paragraph spacing
Always ignore own top margin setting of the actual paragraph
with contextual spacing, if the previous paragraph is identical.
I.e. in that case, too, when the previous paragraph has no
contextual spacing, like MSO does.
Note: PARA_SPACE_MAX mode hasn't included this modification,
yet, so only ODT documents converted from DOCX use it at the
default setting.
See also commit ba18832ceeda21f047a664b71a4333a54737e6c8
(tdf#75221: make margin collapsing implementation conform OASIS
proposal)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97081
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit e318d5d8146d18e2c76e23f2e3c39527f2af9f36)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97065
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
(cherry picked from commit 461634632d796fc719e941d925021ae48a210e59)
Change-Id: Ida9d12b2c511fcd5e38ade7eb5f4650387c65813
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102557
Tested-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
Reviewed-by: Gabor Kelemen <kelemen.gabor2@nisz.hu>
Diffstat (limited to 'sw/source/core/layout/flowfrm.cxx')
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 466e0e1855bc..85ae13a6dcf9 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1426,7 +1426,15 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, && lcl_getContextualSpacing(pPrevFrame) && lcl_IdenticalStyles(pPrevFrame, &m_rThis); - // OD 2004-03-10 #i11860# - use new method to determine needed spacing + // tdf#125893 always ignore own top margin setting of the actual paragraph + // with contextual spacing, if the previous paragraph is identical + const bool bHalfContextualSpacing = !bContextualSpacing + && pAttrs->GetULSpace().GetContext() + && !lcl_getContextualSpacing(pPrevFrame) + && lcl_getContextualSpacing(&m_rThis) + && lcl_IdenticalStyles(pPrevFrame, &m_rThis); + + // i#11860 - use new method to determine needed spacing // values of found previous frame and use these values. SwTwips nPrevLowerSpace = 0; SwTwips nPrevLineSpacing = 0; @@ -1437,6 +1445,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, bPrevLineSpacingPorportional ); if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) ) { + // FIXME: apply bHalfContextualSpacing for better portability? nUpper = bContextualSpacing ? 0 : nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); SwTwips nAdd = nPrevLineSpacing; // OD 07.01.2004 #i11859# - consideration of the line spacing @@ -1480,9 +1489,10 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nUpper = bContextualSpacing ? 0 : std::max(static_cast<long>(nPrevLowerSpace), - static_cast<long>(pAttrs->GetULSpace().GetUpper()) ); - // OD 07.01.2004 #i11859# - consideration of the line spacing + nUpper = bContextualSpacing ? 0 : std::max(static_cast<long>(nPrevLowerSpace), bHalfContextualSpacing + ? 0 : static_cast<long>(pAttrs->GetULSpace().GetUpper()) ); + + // i#11859 - consideration of the line spacing // for the upper spacing of a text frame if ( bUseFormerLineSpacing ) { |