diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-03-09 14:48:49 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-19 10:18:58 +0100 |
commit | c55f277eb88a003a2b8b87bd4d231f50edf26aa8 (patch) | |
tree | c79346640bfb48bc74c10f23285cc3aa8aa6e524 /editeng | |
parent | 41cc69d7e78caabb886b94b48bd027dc0595cdad (diff) |
tdf#116101 Correct bullet position for linespacing > 100%
Change-Id: Ia900636d4013ab2a9c893c8246391db867fe1543
Reviewed-on: https://gerrit.libreoffice.org/51017
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/51086
Reviewed-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 97dd69362dc4924cf837843bc949ba8ffec0d063)
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 13 |
2 files changed, 8 insertions, 9 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index c65b1c2f391e..5e18be53aa17 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -218,8 +218,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 f1afb90ea0b8..7058233308ee 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1460,15 +1460,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 ); } } } |