[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Thu May 16 14:17:47 UTC 2019
sw/qa/extras/layout/data/tab-over-margin.odt |binary
sw/qa/extras/layout/layout.cxx | 11 +++++++++++
sw/source/core/text/portxt.cxx | 3 ++-
3 files changed, 13 insertions(+), 1 deletion(-)
New commits:
commit 8fb0dbd50c32a2ac2b60730daa362a65589e194f
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu May 16 12:32:57 2019 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Thu May 16 16:17:03 2019 +0200
sw layout, TabOverMargin: fix nbsp character going to a new line
This is similar to what was fixed in commit
9ecc9e39112fdd2b55004a0c43eb8c3ceee2e540 (Related: tdf#120287 sw layout,
TabOverMargin: fix too wide tab portion, 2018-10-05), but here the
problem was that we decided to start a new line when there was still
enough space in the compat option case.
Change-Id: I61900044a175cd14b3cdc5d36d2fa50d45c304e3
Reviewed-on: https://gerrit.libreoffice.org/72405
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
Tested-by: Jenkins
diff --git a/sw/qa/extras/layout/data/tab-over-margin.odt b/sw/qa/extras/layout/data/tab-over-margin.odt
new file mode 100644
index 000000000000..1413f2f6dfa6
Binary files /dev/null and b/sw/qa/extras/layout/data/tab-over-margin.odt differ
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 69e9fc0da59b..9c3650e7107b 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2999,6 +2999,17 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf118719)
CPPUNIT_ASSERT_GREATER(nOther, nLast);
}
+CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTabOverMargin)
+{
+ createDoc("tab-over-margin.odt");
+ xmlDocPtr pXmlDoc = parseLayoutDump();
+
+ // 2nd paragraph has a tab over the right margin, and with the TabOverMargin compat option,
+ // there is enough space to have all content in a single line.
+ // Without the accompanying fix in place, this test would have failed, there were 2 lines.
+ assertXPath(pXmlDoc, "/root/page/body/txt[2]/LineBreak", 1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index fdf8925fb31f..f9e364c3ea74 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -441,7 +441,8 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf )
bool SwTextPortion::Format( SwTextFormatInfo &rInf )
{
- if( rInf.X() > rInf.Width() || (!GetLen() && !InExpGrp()) )
+ // GetLineWidth() takes care of DocumentSettingId::TAB_OVER_MARGIN.
+ if( rInf.GetLineWidth() < 0 || (!GetLen() && !InExpGrp()) )
{
Height( 0 );
Width( 0 );
More information about the Libreoffice-commits
mailing list