[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - editeng/source

Szymon Kłos szymon.klos at collabora.com
Wed Jan 10 10:41:40 UTC 2018


 editeng/source/editeng/impedit2.cxx |    7 +++---
 editeng/source/editeng/impedit3.cxx |   38 ++++++++++++++++++++++--------------
 2 files changed, 28 insertions(+), 17 deletions(-)

New commits:
commit 81827ab543d27af82dd7b432f860bf1c473508dc
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Thu Dec 21 18:02:13 2017 +0100

    tdf#114628 correct line spacing for impress
    
    * use line spacing also for the first line
    * correct spacing in case of > 100% proportional spacing
    
    * impedit2.cxx only code readability change
    
    Change-Id: I24832e7dc2fa8cfbb2f9cdfe7062eaaaa63f1729
    Reviewed-on: https://gerrit.libreoffice.org/46925
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Tested-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/47574
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 0b24721a93c7..0ba0a04e53af 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -3643,11 +3643,12 @@ Range ImpEditEngine::GetInvalidYOffsets( ParaPortion* pPortion )
                 aRange.Max() += rL.GetHeight();
             }
 
-            if( ( rLSItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop ) && rLSItem.GetPropLineSpace() &&
-                ( rLSItem.GetPropLineSpace() < 100 ) )
+            sal_uInt16 nPropLineSpace = rLSItem.GetPropLineSpace();
+            if ( ( rLSItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop )
+                && nPropLineSpace && ( nPropLineSpace < 100 ) )
             {
                 const EditLine& rL = pPortion->GetLines()[nFirstInvalid];
-                long n = rL.GetTxtHeight() * ( 100L - rLSItem.GetPropLineSpace() );
+                long n = rL.GetTxtHeight() * ( 100L - nPropLineSpace );
                 n /= 100;
                 aRange.Min() -= n;
                 aRange.Max() += n;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 6953b98df9fa..f1afb90ea0b8 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1442,24 +1442,34 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
             }
             else if ( rLSItem.GetInterLineSpaceRule() == SvxInterLineSpaceRule::Prop )
             {
-                if ( nPara || pLine->GetStartPortion() ) // Not the very first line
+                // There are documents with PropLineSpace 0, why?
+                // (cmc: re above question :-) such documents can be seen by importing a .ppt
+                if ( rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() < 100 ) )
                 {
-                    // There are documents with PropLineSpace 0, why?
-                    // (cmc: re above question :-) such documents can be seen by importing a .ppt
-                    if ( rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() != 100 ) )
+                    // Adapted code from sw/source/core/text/itrform2.cxx
+                    sal_uInt16 nPropLineSpace = rLSItem.GetPropLineSpace();
+                    sal_uInt16 nAscent = pLine->GetMaxAscent();
+                    sal_uInt16 nNewAscent = pLine->GetTxtHeight() * nPropLineSpace / 100 * 4 / 5; // 80%
+                    if ( !nAscent || nAscent > nNewAscent )
                     {
-                        sal_uInt16 nTxtHeight = pLine->GetHeight();
-                        sal_Int32 nH = nTxtHeight;
-                        nH *= rLSItem.GetPropLineSpace();
-                        nH /= 100;
-                        // The Ascent has to be adjusted for the difference:
-                        long nDiff = pLine->GetHeight() - nH;
-                        if ( nDiff > pLine->GetMaxAscent() )
-                            nDiff = pLine->GetMaxAscent();
-                        pLine->SetMaxAscent( (sal_uInt16)(pLine->GetMaxAscent() - nDiff) );
-                        pLine->SetHeight( (sal_uInt16)nH, nTxtHeight );
+                        sal_uInt16 nHeight = pLine->GetHeight() * nPropLineSpace / 100;
+                        pLine->SetHeight( nHeight, pLine->GetTxtHeight() );
+                        pLine->SetMaxAscent( nNewAscent );
                     }
                 }
+                else if ( rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() != 100 ) )
+                {
+                    sal_uInt16 nTxtHeight = pLine->GetHeight();
+                    sal_Int32 nH = nTxtHeight;
+                    nH *= rLSItem.GetPropLineSpace();
+                    nH /= 100;
+                    // The Ascent has to be adjusted for the difference:
+                    long nDiff = pLine->GetHeight() - nH;
+                    if ( nDiff > pLine->GetMaxAscent() )
+                        nDiff = pLine->GetMaxAscent();
+                    pLine->SetMaxAscent( (sal_uInt16)( pLine->GetMaxAscent() - nDiff ) * 4 / 5 ); // 80%
+                    pLine->SetHeight( (sal_uInt16)nH, nTxtHeight );
+                }
             }
         }
 


More information about the Libreoffice-commits mailing list