diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2018-03-09 20:26:35 +0100 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2018-03-09 21:21:32 +0100 |
commit | 63311c2d512f69bff9a2e3c012a4f36a91f23e19 (patch) | |
tree | 1944d25aa0e11eca75037642ea901ddaa0ac1bd8 | |
parent | 70a768e2b66cdb0f7a68a47cd9a6be16f317eeeb (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>
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 7e1ccef61824..57efc39b4d97 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -226,7 +226,7 @@ void Test::testLineSpacing() // Check the first line ParagraphInfos aInfo2 = aEditEngine.GetParagraphInfos(0); - CPPUNIT_ASSERT_EQUAL(sal_uInt16(295), aInfo2.nFirstLineMaxAscent); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(311), aInfo2.nFirstLineMaxAscent); CPPUNIT_ASSERT_EQUAL(sal_uInt16(382), static_cast<sal_uInt16>(aEditEngine.GetLineHeight(0))); } diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 01eb56b577fd..79880497619f 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( static_cast<sal_uInt16>( pLine->GetMaxAscent() * 4 / 5 - nDiff ) ); // 80% - pLine->SetHeight( static_cast<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 ); } } } |