sw/qa/extras/layout/layout3.cxx | 7 +++++-- sw/source/core/text/txttab.cxx | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-)
New commits: commit 5a12313e422eac9b3203284399cb0d9fe3222f9c Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Jun 25 13:28:12 2024 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jun 27 17:02:06 2024 +0200 tdf#161721 sw: text formatting: TabOverMargin not crazy enough Word will use a center or right tab position in the margin without limiting it, and even put text after it. Change-Id: Ibae5758467620f355544963acb7941689fae2602 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169517 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit 78705c3b977aaeb0608538e63df3b78ec67bcae6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169501 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 521d08057c68..997a63f9a831 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -453,8 +453,7 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b) xmlDocUniquePtr pXmlDoc = parseLayoutDump(); // Word 2013 puts all tabs and the field following into one line - // but also puts the field off the page, while in Writer it's - // aligned to the right margin; should be good enough for now... + // and also puts the field off the page assertXPath(pXmlDoc, "/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1); assertXPath( pXmlDoc, @@ -464,6 +463,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b) pXmlDoc, "/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr, 1); + assertXPath( + pXmlDoc, + "/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr, + "width"_ostr, u"4446"_ustr); // was very small: 24 assertXPath( pXmlDoc, "/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']"_ostr, diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index c34692e0024a..b37511cbec33 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -175,7 +175,12 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto // since up till now these were just treated as automatic tabstops. eAdj = SvxTabAdjust::Right; bAbsoluteNextPos = true; - nNextPos = rInf.Width(); + // TODO: unclear if old Word has an upper limit for center/right + // tabs, UI allows setting 55.87cm max which is still one line + if (!bTabOverMargin || o3tl::toTwips(558, o3tl::Length::mm) < nNextPos) + { + nNextPos = rInf.Width(); + } } bAutoTabStop = false; }