diff options
Diffstat (limited to 'editeng/source/editeng/impedit2.cxx')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index d3f07cec65ed..da4d851b3315 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -4388,12 +4388,31 @@ tools::Long ImpEditEngine::GetXPos(ParaPortion const& rParaPortion, EditLine con return nX; } +/** Is true if paragraph is in the empty cluster of paragraphs at the end */ +bool ImpEditEngine::isInEmptyClusterAtTheEnd(ParaPortion& rPortion) +{ + sal_Int32 nPortion = GetParaPortions().GetPos(&rPortion); + + auto& rParagraphs = GetParaPortions(); + if (rParagraphs.Count() <= 0) + return false; + + sal_Int32 nCurrent = rParagraphs.lastIndex(); + while (nCurrent > 0 && rParagraphs.getRef(nCurrent).IsEmpty()) + { + if (nCurrent == nPortion) + return true; + nCurrent--; + } + return false; +} + void ImpEditEngine::CalcHeight(ParaPortion& rPortion) { rPortion.mnHeight = 0; rPortion.mnFirstLineOffset = 0; - if (!rPortion.IsVisible()) + if (!rPortion.IsVisible() || isInEmptyClusterAtTheEnd(rPortion)) return; OSL_ENSURE(rPortion.GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight"); @@ -4428,7 +4447,6 @@ void ImpEditEngine::CalcHeight(ParaPortion& rPortion) rPortion.mnHeight += scaleYSpacingValue(rULItem.GetLower()); // not in the last } - if ( !nPortion || maStatus.ULSpaceSummation() ) return; |