diff options
author | Serge Krot <Serge.Krot@cib.de> | 2018-03-15 11:17:42 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2018-03-23 23:56:06 +0100 |
commit | 169fe61fe32587897188ed5b3619af34f394731d (patch) | |
tree | 77fb97848d51e9f71ac4a78cdffd0fb3cf549d5f | |
parent | 133821d1526800a93bb395a91f87dc77d29f0b8d (diff) |
tdf#112448: Fix: take correct line height
When line metrics is not calculated we need to call CalcRealHeight()
before usage of the Height() and GetRealHeight().
Change-Id: I104bbb81ea9d7130dfd728f7114d02e3672afbc3
Reviewed-on: https://gerrit.libreoffice.org/51319
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit 3c3f10da500967fc6ffecc2f3e076d8ff43e7503)
Reviewed-on: https://gerrit.libreoffice.org/51350
Reviewed-by: Serge Krot (CIB) <Serge.Krot@cib.de>
-rwxr-xr-x | sw/qa/extras/uiwriter/data/tdf112448.odt | bin | 0 -> 10574 bytes | |||
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter.cxx | 15 | ||||
-rw-r--r-- | sw/source/core/text/itrform2.cxx | 6 |
3 files changed, 18 insertions, 3 deletions
diff --git a/sw/qa/extras/uiwriter/data/tdf112448.odt b/sw/qa/extras/uiwriter/data/tdf112448.odt Binary files differnew file mode 100755 index 000000000000..ffb1ef6b6860 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/tdf112448.odt diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index a1380685553d..75f2c19bdd71 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -288,6 +288,7 @@ public: void testTdf99689TableOfContents(); void testTdf99689TableOfFigures(); void testTdf99689TableOfTables(); + void testTdf112448(); void testTdf113790(); void testTdf114306(); void testTdf114306_2(); @@ -462,6 +463,7 @@ public: CPPUNIT_TEST(testTdf99689TableOfContents); CPPUNIT_TEST(testTdf99689TableOfFigures); CPPUNIT_TEST(testTdf99689TableOfTables); + CPPUNIT_TEST(testTdf112448); CPPUNIT_TEST(testTdf113790); CPPUNIT_TEST(testTdf114306); CPPUNIT_TEST(testTdf114306_2); @@ -5629,6 +5631,19 @@ void SwUiWriterTest::testParagraphOfTextRange() CPPUNIT_ASSERT_EQUAL(OUString("In section"), xParagraph->getString()); } +// tdf#112448: Fix: take correct line height +// +// When line metrics is not calculated we need to call CalcRealHeight() +// before usage of the Height() and GetRealHeight(). +void SwUiWriterTest::testTdf112448() +{ + createDoc("tdf112448.odt"); + + // check actual number of line breaks in the paragraph + xmlDocPtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page/body/txt/LineBreak", 2); +} + void SwUiWriterTest::testTdf113790() { SwDoc* pDoc = createDoc("tdf113790.docx"); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 730237e3b4d3..6421eedca0be 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -2294,13 +2294,13 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf ) } else { - nAscent = pLast->GetAscent(); - nHeight = pLast->Height(); - // We make a first guess for the lines real height if ( ! m_pCurr->GetRealHeight() ) CalcRealHeight(); + nAscent = pLast->GetAscent(); + nHeight = pLast->Height(); + if ( m_pCurr->GetRealHeight() > nHeight ) nTop += m_pCurr->GetRealHeight() - nHeight; else |