summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2014-06-11 16:59:59 +0200
committerAndras Timar <andras.timar@collabora.com>2014-06-17 12:04:19 +0200
commite42c05c1f96832572e525d85d89590f56f5a29dd (patch)
tree113fbde171f3e88d7585047dbc6479bdc82b24a4 /editeng
parentb1d8df61b47e84bf0de64342556049673dd9c543 (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
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/impedit2.cxx6
-rw-r--r--editeng/source/editeng/impedit3.cxx7
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;
}