[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - editeng/qa editeng/source

Szymon Kłos szymon.klos at collabora.com
Tue Mar 13 13:09:53 UTC 2018


 editeng/qa/unit/core-test.cxx       |    4 ++--
 editeng/source/editeng/impedit3.cxx |   13 ++++++-------
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 2845f350064f9999a52fa08b752490c3ef7e98c4
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Fri Mar 9 14:48:49 2018 +0100

    tdf#116101 Correct bullet position for linespacing > 100%
    
    Change-Id: Ia900636d4013ab2a9c893c8246391db867fe1543
    Reviewed-on: https://gerrit.libreoffice.org/51017
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/51085
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index 7736db426c0a..65be718d67bc 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -198,8 +198,8 @@ void Test::testLineSpacing()
 
     // Check the first line
     ParagraphInfos aInfo2 = aEditEngine.GetParagraphInfos(0);
-    CPPUNIT_ASSERT_EQUAL((sal_uInt16)269, aInfo2.nFirstLineMaxAscent);
-    CPPUNIT_ASSERT_EQUAL((sal_uInt16)382, (sal_uInt16)aEditEngine.GetLineHeight(0));
+    CPPUNIT_ASSERT_EQUAL(sal_uInt16(311), aInfo2.nFirstLineMaxAscent);
+    CPPUNIT_ASSERT_EQUAL(sal_uInt16(382), static_cast<sal_uInt16>(aEditEngine.GetLineHeight(0)));
 }
 
 void Test::testConstruction()
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 3dd322789fd1..b1cc81eeafe0 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1415,15 +1415,14 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY )
                 else if ( rLSItem.GetPropLineSpace() && ( rLSItem.GetPropLineSpace() != 100 ) )
                 {
                     sal_uInt16 nTxtHeight = pLine->GetHeight();
-                    sal_Int32 nH = nTxtHeight;
-                    nH *= rLSItem.GetPropLineSpace();
-                    nH /= 100;
+                    sal_Int32 nTxtHeightProp = nTxtHeight * rLSItem.GetPropLineSpace() / 100;
+                    sal_Int32 nHeightProp = pLine->GetHeight() * rLSItem.GetPropLineSpace() / 100;
                     // The Ascent has to be adjusted for the difference:
-                    long nDiff = pLine->GetHeight() - nH;
+                    long nDiff = ( pLine->GetHeight() - nTxtHeightProp ) * 4 / 5;
                     if ( nDiff > pLine->GetMaxAscent() )
-                        nDiff = pLine->GetMaxAscent();
-                    pLine->SetMaxAscent( (sal_uInt16)( pLine->GetMaxAscent() - nDiff ) * 4 / 5 ); // 80%
-                    pLine->SetHeight( (sal_uInt16)nH, nTxtHeight );
+                        nDiff = pLine->GetMaxAscent() * 4 / 5;
+                    pLine->SetMaxAscent( static_cast<sal_uInt16>( pLine->GetMaxAscent() - nDiff ) ); // 80%
+                    pLine->SetHeight( static_cast<sal_uInt16>( nHeightProp ), nTxtHeightProp );
                 }
             }
         }


More information about the Libreoffice-commits mailing list