sw/qa/extras/uiwriter/data/tdf58604.odt |binary sw/qa/extras/uiwriter/uiwriter.cxx | 12 ++++++++++++ sw/source/core/text/guess.cxx | 5 +++++ 3 files changed, 17 insertions(+)
New commits: commit 89f038765a36a938961863efea2e0e07515f44d6 Author: Mark Hung <mark...@gmail.com> Date: Tue May 30 19:57:53 2017 +0800 tdf#58604 keep line break follows hanging punctuation. Do not treat the line as full if the chacracter following the hanging punctuation is a line break, so that the line break is placed after the hanging punctuation instead of at the beginning of the next line. Change-Id: Ia6e07cf457b3e1ba39700eb6d6dc74e4b57b64de Reviewed-on: https://gerrit.libreoffice.org/38216 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Mark Hung <mark...@gmail.com> diff --git a/sw/qa/extras/uiwriter/data/tdf58604.odt b/sw/qa/extras/uiwriter/data/tdf58604.odt new file mode 100755 index 000000000000..34c51c518325 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf58604.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 2452ad422c21..3239e1b2184d 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -250,6 +250,7 @@ public: void testTdf105417(); void testTdf105625(); void testTdf106736(); + void testTdf58604(); void testMsWordCompTrailingBlanks(); void testCreateDocxAnnotation(); void testTdf107976(); @@ -390,6 +391,7 @@ public: CPPUNIT_TEST(testTdf105417); CPPUNIT_TEST(testTdf105625); CPPUNIT_TEST(testTdf106736); + CPPUNIT_TEST(testTdf58604); CPPUNIT_TEST(testMsWordCompTrailingBlanks); CPPUNIT_TEST(testCreateDocxAnnotation); CPPUNIT_TEST(testTdf107976); @@ -4942,6 +4944,16 @@ void SwUiWriterTest::testTdf107976() CPPUNIT_ASSERT(!pTransferable2->GetShell()); } +void SwUiWriterTest::testTdf58604() +{ +#ifdef WNT + // Allow linebreak character follows hanging punctuation immediately instead of + // breaking at the start of the next line. + load(DATA_DIRECTORY, "tdf58604.odt"); + CPPUNIT_ASSERT_EQUAL( OUString("POR_BRK"), parseDump( "(/root/page/body/txt/LineBreak[1]/preceding::Text)[last()]", "nType" ) ); +#endif +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx index 066d45a5a2fa..ca432b1b5f68 100644 --- a/sw/source/core/text/guess.cxx +++ b/sw/source/core/text/guess.cxx @@ -533,7 +533,12 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, nBreakWidth = 0; if( pHanging ) + { nBreakPos = nCutPos; + // Keep following SwBreakPortion in the same line. + if ( CH_BREAK == rInf.GetChar( nBreakPos + pHanging->GetLen() ) ) + return true; + } return false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits