diff options
-rw-r--r-- | sw/qa/extras/odfimport/data/tdf75221.odt | bin | 0 -> 9131 bytes | |||
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 21 |
3 files changed, 17 insertions, 13 deletions
diff --git a/sw/qa/extras/odfimport/data/tdf75221.odt b/sw/qa/extras/odfimport/data/tdf75221.odt Binary files differnew file mode 100644 index 000000000000..6ef117c24e29 --- /dev/null +++ b/sw/qa/extras/odfimport/data/tdf75221.odt diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 02fb8b1ba361..ceb55723e01a 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 874733aae120..0ab2319afb3e 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 |