sw/qa/extras/odfimport/data/tdf75221.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 9 +++++++++ sw/source/core/layout/flowfrm.cxx | 21 ++++++++------------- 3 files changed, 17 insertions(+), 13 deletions(-)
New commits: commit ba18832ceeda21f047a664b71a4333a54737e6c8 Author: Mike Kaganski <mike.kagan...@collabora.com> Date: Thu Sep 8 07:20:18 2016 +0300 tdf#75221: make margin collapsing implementation conform OASIS proposal Since the margin collapsing (aka contextual spacing, implemented for LO 3.6 by Miklos Vajna, commits 6f04bf5e90ff75288dcf75c43843edf798641e3d, 0662778b0b4b9958ee5e5bd3bac69f9e290f9495, 11059331718fb8faab483c75633b4e80d8028b7d, 03f9b6bebc0ca77021be46664c7bcbe4cb297503, 8631dbf85fb5ed56d225e32ea5a9c36c96b0d649, 9f4bb5bd4f55b4a80544413efde26391849b1d7f, f722299e133568fe75f7cf9ce0c103a1553474c4) is only meant to suppress fo:margin-top and fo:margin-bottom, as seen in https://issues.oasis-open.org/browse/OFFICE-3767, current implementation is inconsistent: it nullifies all spacing, including normal line spacing. This patch makes sure that collapsing conforms to specification. Change-Id: I413f6469d7891dd85f1f7a2c666f219187ddaec4 Reviewed-on: https://gerrit.libreoffice.org/28692 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/odfimport/data/tdf75221.odt b/sw/qa/extras/odfimport/data/tdf75221.odt new file mode 100644 index 0000000..6ef117c Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf75221.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 02fb8b1..ceb5572 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -658,5 +658,14 @@ DECLARE_ODFIMPORT_TEST(testFdo47267, "fdo47267-3.odt") // This was a Style Families getByName() crash } +DECLARE_ODFIMPORT_TEST(testTdf75221, "tdf75221.odt") +{ + // When "Don't add space between paragraphs of the same style" setting set, + // spacing between same-style paragraphs must be equal to their line spacing. + // It used to be 0. + OUString top = parseDump("/root/page/body/txt[2]/infos/prtBounds", "top"); + CPPUNIT_ASSERT(top.toInt32() > 0); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 874733a..0ab2319 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1391,6 +1391,10 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, const bool bUseFormerLineSpacing = rIDSA.get(DocumentSettingId::OLD_LINE_SPACING); if( pPrevFrame ) { + const bool bContextualSpacing = pAttrs->GetULSpace().GetContext() + && lcl_getContextualSpacing(pPrevFrame) + && lcl_IdenticalStyles(pPrevFrame, &m_rThis); + // OD 2004-03-10 #i11860# - use new method to determine needed spacing // values of found previous frame and use these values. SwTwips nPrevLowerSpace = 0; @@ -1402,7 +1406,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, bPrevLineSpacingPorportional ); if( rIDSA.get(DocumentSettingId::PARA_SPACE_MAX) ) { - nUpper = nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); + nUpper = (bContextualSpacing) ? 0 : nPrevLowerSpace + pAttrs->GetULSpace().GetUpper(); SwTwips nAdd = nPrevLineSpacing; // OD 07.01.2004 #i11859# - consideration of the line spacing // for the upper spacing of a text frame @@ -1445,8 +1449,8 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nUpper = std::max( static_cast<long>(nPrevLowerSpace), - static_cast<long>(pAttrs->GetULSpace().GetUpper()) ); + 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 // for the upper spacing of a text frame if ( bUseFormerLineSpacing ) @@ -1510,16 +1514,7 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, { nUpper += GetUpperSpaceAmountConsideredForPageGrid_( nUpper ); } - - const bool bContextualSpacing = pAttrs->GetULSpace().GetContext(); - - if (bContextualSpacing && pPrevFrame && lcl_getContextualSpacing(pPrevFrame) - && lcl_IdenticalStyles(pPrevFrame, &m_rThis)) - { - return 0; - } - else - return nUpper; + return nUpper; } /** method to detemine the upper space amount, which is considered for _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits