Kaydet (Commit) 63311c2d authored tarafından Szymon Kłos's avatar Szymon Kłos

tdf#116101 Correct bullet position for linespacing > 100%

Change-Id: Ia900636d4013ab2a9c893c8246391db867fe1543
Reviewed-on: https://gerrit.libreoffice.org/51017Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarSzymon Kłos <szymon.klos@collabora.com>
üst 70a768e2
......@@ -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)));
}
......
......@@ -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 );
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment