summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-08 12:50:59 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-08 13:12:57 +0200
commit563df5d0c3c696912f211e74dd4dbda1aa720ae7 (patch)
tree23d88d6cea7fdaf04e0b105da5c67923f0e4d6e2 /sw
parent32e59f91d0c716a28e428ae382d6fed983b5a19d (diff)
n#757905 SwLineLayout::CalcLine: improve line height calculation
Word vs. Writer difference: if the only portion in a line is a fly (as-character shape) and the height of the fly is smaller than the height of the line, then Writer sets the height to the height of the fly. Word takes the max of the two values. We already have IgnoreTabsAndBlanksForLineCalculation for Word compat wrt. line height calculation, use that here as well. Change-Id: Iebe1bc697d6f19a03d15a1e5fd25ab4d5f4898fd
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/text/porlay.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 2ca71cf561c3..feb758836f0e 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -330,6 +330,7 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
}
else
{
+ KSHORT nLineHeight = Height();
Init( GetPortion() );
SwLinePortion *pPos = pPortion;
SwLinePortion *pLast = this;
@@ -436,7 +437,15 @@ void SwLineLayout::CalcLine( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf )
else if( !pPos->IsFlyPortion() )
{
if( Height() < nPosHeight )
- Height( nPosHeight );
+ {
+ // Height is set to 0 when Init() is called.
+ if (bIgnoreBlanksAndTabsForLineHeightCalculation)
+ // Compat flag set: take the line height, if it's larger.
+ Height(std::max(nPosHeight, nLineHeight));
+ else
+ // Just care about the portion height.
+ Height(nPosHeight);
+ }
if( pPos->IsFlyCntPortion() || ( pPos->IsMultiPortion()
&& ((SwMultiPortion*)pPos)->HasFlyInCntnt() ) )
rLine.SetFlyInCntBase();