[Libreoffice-commits] .: sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Jun 8 04:13:02 PDT 2012


 sw/source/core/text/porlay.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit 563df5d0c3c696912f211e74dd4dbda1aa720ae7
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jun 8 12:50:59 2012 +0200

    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

diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 2ca71cf..feb7588 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();


More information about the Libreoffice-commits mailing list