summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsw/qa/extras/uiwriter/data/tdf58604.odtbin0 -> 9780 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx12
-rw-r--r--sw/source/core/text/guess.cxx5
3 files changed, 17 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf58604.odt
Binary files 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;
}