diff options
author | Matúš Kukan <matus.kukan@collabora.com> | 2014-06-11 16:59:59 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-06-17 12:15:35 +0200 |
commit | 339e5d44a2afa0f5309a970f1ff11968103e336a (patch) | |
tree | 3f11f8fdd4678ceea81960d302ccebe2d2320100 /editeng/source | |
parent | 440e2031ce8cffc8dc573e359a330236f9c11dfb (diff) |
bnc#882631: keep line visible if proportional line spacing is < 100%.
If line height is smaller than text height, we still want to see whole first
line, so add the difference where necessary.
This also helps to see paragraphs as separate to each other.
Change-Id: I51a87edf0cc03d5b5e130290c90347099a581d4e
(cherry picked from commit e42c05c1f96832572e525d85d89590f56f5a29dd)
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 6 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 764d4fa97210..9e9790bccbd6 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -4032,7 +4032,9 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion ) { OSL_ENSURE( pPortion->GetLines().Count(), "Paragraph with no lines in ParaPortion::CalcHeight" ); for (sal_Int32 nLine = 0; nLine < pPortion->GetLines().Count(); ++nLine) - pPortion->nHeight += pPortion->GetLines()[nLine]->GetHeight(); + // Use GetTxtHeight() for first line, otherwise height is small + // if the paragraph has proportional line spacing less than 100%. + pPortion->nHeight += nLine ? pPortion->GetLines()[nLine]->GetHeight() : pPortion->GetLines()[nLine]->GetTxtHeight(); if ( !aStatus.IsOutliner() ) { @@ -4175,7 +4177,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* pPortion, sal_Int32 nIndex, Rectangle aEditCursor; aEditCursor.Top() = nY; - nY += pLine->GetHeight(); + nY += pLine->GetTxtHeight(); aEditCursor.Bottom() = nY-1; // Search within the line... diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 2881a81cae52..7678ef1ff89b 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -2924,6 +2924,13 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, Rectangle aClipRect, Point aSt aTmpPos.X() += pLine->GetStartPosX(); aTmpPos.Y() += pLine->GetMaxAscent(); aStartPos.Y() += pLine->GetHeight(); + if (nLine == 0) + { + // First line needs to be visible, so add more space if text height is bigger. + const sal_Int32 nDiff = pLine->GetTxtHeight() - pLine->GetHeight(); + aTmpPos.Y() += nDiff; + aStartPos.Y() += nDiff; + } if (nLine != nLastLine) aStartPos.Y() += nVertLineSpacing; } |