sw/qa/extras/layout/layout3.cxx | 7 +++++-- sw/source/core/text/txttab.cxx | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-)
New commits: commit 78705c3b977aaeb0608538e63df3b78ec67bcae6 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Jun 25 13:28:12 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Tue Jun 25 15:57:52 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 diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index c5885be4c6ca..a07e7e6cd037 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -567,8 +567,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, @@ -578,6 +577,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 19ec92c6425b..14d8b9072693 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; }