Kaydet (Commit) e42c05c1 authored tarafından Matúš Kukan's avatar Matúš Kukan Kaydeden (comit) Andras Timar

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
üst b1d8df61
......@@ -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...
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment