diff options
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/layout/data/tdf125893.docx | bin | 0 -> 23032 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 14 |
3 files changed, 20 insertions, 2 deletions
diff --git a/sw/qa/extras/layout/data/tdf125893.docx b/sw/qa/extras/layout/data/tdf125893.docx Binary files differnew file mode 100644 index 000000000000..f46f9af05ac3 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf125893.docx diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 139252721b52..50ba98b146b9 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3016,6 +3016,14 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf128611) assertXPath(pXmlDoc, "//tab/row/cell[1]/txt/Text", "Portion", "Abcd efghijkl"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf125893) +{ + createDoc("tdf125893.docx"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // This was 400. The paragraph must have zero top border. + assertXPath(pXmlDoc, "/root/page/body/txt[4]/infos/prtBounds", "top", "0"); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf117188) { createDoc("tdf117188.docx"); diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index 967fdb1662fc..a110be7b8081 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -1425,6 +1425,14 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, && lcl_getContextualSpacing(pPrevFrame) && lcl_IdenticalStyles(pPrevFrame, &m_rThis); + // 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; @@ -1436,6 +1444,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; // i#11859 - consideration of the line spacing @@ -1479,8 +1488,9 @@ SwTwips SwFlowFrame::CalcUpperSpace( const SwBorderAttrs *pAttrs, } else { - nUpper = bContextualSpacing ? 0 : std::max(static_cast<long>(nPrevLowerSpace), - static_cast<long>(pAttrs->GetULSpace().GetUpper()) ); + 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 ) |