sw/qa/extras/layout/data/tdf158658a.rtf | 25 ++++++++++ sw/qa/extras/layout/data/tdf158658b.rtf | 27 +++++++++++ sw/qa/extras/layout/data/tdf158658c.rtf | 26 +++++++++++ sw/qa/extras/layout/layout2.cxx | 6 +- sw/qa/extras/layout/layout3.cxx | 74 ++++++++++++++++++++++++++++++-- sw/source/core/text/inftxt.cxx | 6 ++ sw/source/core/text/portab.hxx | 2 sw/source/core/text/txttab.cxx | 12 +++-- 8 files changed, 165 insertions(+), 13 deletions(-)
New commits: commit 072ee1a4573b6ab867a35114070650aec8faf9fd Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Jun 13 15:46:31 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon Jun 17 11:20:20 2024 +0200 tdf#158658 sw: text formatting: make TabOverMargin even more crazy ... to better match Word's formatting. The bugdoc has a special case where a right-aligned tab is positioned at the right margin exactly, which causes the bFull condition in SwTabPortion::PreFormat() to be true. An obvious change to replace rInf.Width() - rInf.X() with rInf.GetLineWidth() in the condition makes no difference because m_pLastTab was already reset previously; instead, pass in the last tab from Format(), which indicates that the right edge position of the previous text portion was found via that tab. Additionally, change the condition that checks for TabOverMargin to also allow equal positions, i.e., exactly at the end of the paragraph. Change-Id: I5d3b1c13eca0bffa640745d7c5f4113699f79cad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168823 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 69d873e1c46f3cc8c524e18ac5a307a8d32ddd0f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168864 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/qa/extras/layout/data/tdf158658c.rtf b/sw/qa/extras/layout/data/tdf158658c.rtf new file mode 100644 index 000000000000..4148eb6d9a51 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf158658c.rtf @@ -0,0 +1,26 @@ +{ tf1deflang1025nsinsicpg1250\uc1deff31507\deff0\stshfdbch31506\stshfloch31506\stshfhich31506\stshfbi31507\deflang1038\deflangfe1038 hemelang1038 hemelangfe0 hemelangcs0 +{onttbl{0bidi romancharset0prq2 Times New Roman;} +{himinor31506bidi swisscharset0prq2 Calibri;} +{biminor31507bidi romancharset0prq2 Times New Roman;} +} +{\*\defchp 31506s22\lang1038\langfe1033\langfenp1033 }{\*\defpap \ql \li0 i0\sa160\sl259\slmult1 +\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 } oqfpromote +{\stylesheet{\ql \li0 i0\sa160\sl259\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 tlchcs1 f31507fs22lang1025 +\ltrchcs0 31506s22\lang1038\langfe1033+{\s15\ql \li0 i0\widctlpar qc x4513 qr x9026\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 tlchcs1 f31507fs22lang1025 \ltrchcs0 31506 s22\lang1038\langfe1033+\sbasedon0 \snext15 \slink16 \sunhideused header;}} +\paperw11906\paperh16838\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect +\deftab708\widowctrltnbjenddoc\hyphhotz425 rackmoves0 rackformatting1\donotembedsysfont1 elyonvml0\donotembedlingdata0\grfdocevents0 alidatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0 +\showxmlerrors1 oxlattoyenxpshrtn oultrlspc\dntblnsbdb ospaceforul ormshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1 +\jexpandiewkind1iewscale100\pgbrdrhead\pgbrdrfoot\splytwnine tnlytwnine\htmautsp olnhtadjtbl\useltbalnlntblind\lytcalctblwd\lyttblrtgr\lnbrkrule obrkwrptbl\snaptogridincellllowfieldendsel\wrppunct +sianbrkrule ewtblstyruls ogrowautofit\usenormstyforlist oindnmbrtselnbrelev ocxsptable\indrlsweleven oafcnsttblfelev\utinl\hwelev\spltpgpar otcvasp otbrkcnstfrctbl otvatxbx\krnprsnet+ ofeaturethrottle1\ilfomacatclnup0 +\ltrpar \sectd \ltrsect\linex0\headery708ootery708+ qc x4513 qr x9026\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 tlchcs1 f31507fs22lang1025 \ltrchcs0 31506s22\lang1038\langfe1033+ ab World ab Here come some tabs: ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab ab +\par }} +\pard\plain \ltrpar\ql \li0 i0\sa160\sl259\slmult1 +\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 tlchcs1 f31507fs22lang1025 \ltrchcs0 31506s22\lang1038\langfe1033+ tlchcs1 f31507 \ltrchcs0 +\par } +} diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index 69a9458e90e0..0fe91ec43918 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -452,6 +452,28 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b) 0); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658c) +{ + createSwDoc("tdf158658c.rtf"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + // Word 2013 puts all tabs into one line, the last 17 of them are off the page + assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1); + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabCenter']"_ostr, + 1); + // the right tab is exactly at the margin of the paragraph + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr, + 1); + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']"_ostr, + 20); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155177) { createSwDoc("tdf155177-1-min.odt"); diff --git a/sw/source/core/text/portab.hxx b/sw/source/core/text/portab.hxx index 9ffe7be50651..42c21204c7b7 100644 --- a/sw/source/core/text/portab.hxx +++ b/sw/source/core/text/portab.hxx @@ -27,7 +27,7 @@ class SwTabPortion : public SwFixPortion const bool m_bAutoTabStop; // Format() branches either into PreFormat() or PostFormat() - bool PreFormat( SwTextFormatInfo &rInf ); + bool PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*); public: SwTabPortion( const sal_uInt16 nTabPos, const sal_Unicode cFill, const bool bAutoTab = true ); virtual void Paint( const SwTextPaintInfo &rInf ) const override; diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index 3f72f5375000..c34692e0024a 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -345,7 +345,7 @@ bool SwTabPortion::Format( SwTextFormatInfo &rInf ) return PostFormat( rInf ); if( pLastTab ) pLastTab->PostFormat( rInf ); - return PreFormat( rInf ); + return PreFormat(rInf, pLastTab); } void SwTabPortion::FormatEOL( SwTextFormatInfo &rInf ) @@ -354,7 +354,7 @@ void SwTabPortion::FormatEOL( SwTextFormatInfo &rInf ) PostFormat( rInf ); } -bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) +bool SwTabPortion::PreFormat(SwTextFormatInfo &rInf, SwTabPortion const*const pLastTab) { OSL_ENSURE( rInf.X() <= GetTabPos(), "SwTabPortion::PreFormat: rush hour" ); @@ -396,7 +396,8 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) // 1. Minimal width does not fit to line anymore. // 2. An underflow event was called for the tab portion. bool bFull = ( bTabCompat && rInf.IsUnderflow() ) || - ( rInf.Width() <= rInf.X() + PrtWidth() && rInf.X() <= rInf.Width() ) ; + (rInf.Width() <= rInf.X() + PrtWidth() && rInf.X() <= rInf.Width() + && (!bTabOverMargin || !pLastTab)); // #95477# Rotated tab stops get the width of one blank const Degree10 nDir = rInf.GetFont()->GetOrientation( rInf.GetTextFrame()->IsVertical() ); @@ -420,7 +421,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) { // handle this case in PostFormat if ((bTabOverMargin || bTabOverSpacing) && GetTabPos() > rInf.Width() - && (!m_bAutoTabStop || rInf.X() > rInf.Width())) + && (!m_bAutoTabStop || rInf.Width() <= rInf.X())) { if (bTabOverMargin || GetTabPos() < nTextFrameWidth) { commit b18c94c8e563f4dd3496f1bce89bf9d6ff43aa93 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Jun 13 12:59:19 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Mon Jun 17 11:20:19 2024 +0200 tdf#158658 sw: text formatting: try to make TabOverMargin more crazy ... to better match Word's formatting; this commit is not based on a complete diagnosis of Word's compatibility-mode tab-in-margin formatting disorders. 1. in SwTabPortion::PreFormat() allow a left aligned tab beyond the width of the paragraph, like already done for TabOverSpacing 2. in SwTextFormatInfo::GetLineWidth() add some extra width to the paragraph so text can be hidden in the right margin. (it's very unclear what Word does here exactly, in one case it puts 339 additional "a" characters in the margin but then the 340th "a" goes onto a new line...) 3. in SwTextFormatter::NewTabPortion() allow manual tab stops to be positioned beyond the width of the paragraph, like already done for TabOverSpacing testTdf118672, testTdf120287b, testTdf120287c fail but the files, converted to RTF, render in Word 2013 basically the same as in Writer with this change. Change-Id: I5f74ced09c704bfd9967df61351c8bac6540e714 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168819 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 10d753b8aadb50ec4309551b97d4cf2163ea3e3d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168863 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> diff --git a/sw/qa/extras/layout/data/tdf158658a.rtf b/sw/qa/extras/layout/data/tdf158658a.rtf new file mode 100644 index 000000000000..712fd5a7f733 --- /dev/null +++ b/sw/qa/extras/layout/data/tdf158658a.rtf @@ -0,0 +1,25 @@ +{ tf1deflang1025nsinsicpg1252\uc1deff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\deflang3079\deflangfe3079 hemelang3079 hemelangfe0 hemelangcs0 +{onttbl{0bidi romancharset0prq2 Times New Roman;} +{dbminor31505bidi romancharset0prq2 Times New Roman;}{himinor31506 bidi swisscharset0prq2 Calibri;} +} +{\*\defchp s22\lochf31506\hichf31506\dbchf31505 } +{\*\defpap \ql \li0 i0\sa160\sl259\slmult1\widctlpar\wrapdefaultspalphaspnum aautodjustright in0\lin0\itap0 } oqfpromote +{\stylesheet{ +\ql \li0 i0 owidctlpar\wrapdefaultaautodjustright in0\lin0\itap0 tlchcs1 f0fs26lang1025 \ltrchcs0 s26\lang1031\langfe3079\loch 0\hichf0\dbchf31505+{\s17\ql \li0 i0 owidctlpar qc x4252 qr x8504\wrapdefaultaautodjustright in0\lin0\itap0 tlchcs1 f0fs26lang1025 \ltrchcs0 +s26\lang1031\langfe3079\loch0\hichf0\dbchf31505+} + +\paperw11907\paperh16840\margl1418\margr851\margt1418\margb1134\gutter0\ltrsect +\deftab709\widowctrltnbjenddoc\hyphhotz425 rackmoves0 rackformatting1\donotembedsysfont0 elyonvml0\donotembedlingdata1\grfdocevents0 alidatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\hyphcaps0\horzdoc\dghspace120 +\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompressiewkind1 iewscale100et0{\*\wgrffmtfilter 013f}\ilfomacatclnup0 + +\ltrpar \sectd \ltrsect\linex0\headery703ootery709+ qc x4820 qr x9923\wrapdefaultaautodjustright in-285\lin0\itap0 tlchcs1 f0fs26lang1025 \ltrchcs0 s26\lang1031\langfe3079\lochf0\hichf0\dbchf31505+ s24\hichf0\dbchf31505\loch0 \hich0 Xx\loch0 Xx ab Xxxxxxxx Xxxx Xxxxxxxx ab XXXXXXXX ab ab ab ab ab ab ab ab ab }{ tlchcs1 bf0fs24 \ltrchcs0 s24\ul +\par }} + +\pard\plain \ltrpar\ql \li0 i-1701\widctlpar x3969\wrapdefault aautodjustright in-1701\lin0\itap0 tlchcs1 +f0fs26lang1025 \ltrchcs0 s26\lang1031\langfe3079\lochf0\hichf0\dbchf31505+\par } +} diff --git a/sw/qa/extras/layout/data/tdf158658b.rtf b/sw/qa/extras/layout/data/tdf158658b.rtf new file mode 100644 index 000000000000..f0e23903662f --- /dev/null +++ b/sw/qa/extras/layout/data/tdf158658b.rtf @@ -0,0 +1,27 @@ +{ tf1deflang1025nsinsicpg1252\uc1deff0\deff0\stshfdbch31505\stshfloch31506\stshfhich31506\stshfbi0\deflang3079\deflangfe3079 hemelang3079 hemelangfe0 hemelangcs0 +{onttbl{0bidi romancharset0prq2 Times New Roman{\*alt Arial};} +{dbminor31505bidi romancharset0prq2 Times New Roman{\*alt Arial};} +{himinor31506bidi swisscharset0prq2 Calibri;}} +{\*\defchp s22\lochf31506\hichf31506\dbchf31505 }{\*\defpap \ql \li0 i0\sa160\sl259\slmult1\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 } + oqfpromote +{\stylesheet{\ql \li0 i0\widctlpar\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 tlchcs1 f0fs26lang1025 \ltrchcs0 s26\lang3079\langfe3079\loch0\hichf0\dbchf31505+\snext0 \sqformat \spriority0 Normal;} +{\s18\ql \li0 i0\widctlpar qc x4536 qr x9072\wrapdefaultspalphaspnumaautodjustright in0\lin0\itap0 tlchcs1 f0fs18lang1025 \ltrchcs0 +s18\lang3079\langfe3079\loch0\hichf0\dbchf31505+} +\paperw4876\paperh3175\margl113\margr113\margt113\margb0\gutter0\ltrsect +\deftab708\widowctrltnbjenddoc\hyphhotz425 rackmoves0 rackformatting1\donotembedsysfont0 elyonvml0\donotembedlingdata1\grfdocevents0 alidatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0 +\showxmlerrors0 oxlattoyenxpshrtn oultrlspc\dntblnsbdb ospaceforul\hyphcaps0 ormshade\horzdoc\dgmargin\dghspace130\dgvspace180\dghorigin113\dgvorigin113\dghshow0\dgvshow0 +\jexpandiewkind1iewscale240\pgbrdrhead\pgbrdrfoot olnhtadjtbl ojkernpunctet0{\*\wgrffmtfilter 013f}\ilfomacatclnup0 +\ltrpar + +\sectd \ltrsect +\lndscpsxn\psz5\linex0ootery0ndnhere\sectlinegrid354\sectdefaultcl\sftnbj +{ooterr \ltrpar \pard\plain \ltrpar\s18\ql \li0 i0\widctlpar + qc x4536 qr x9072\wrapdefaultspalphaspnum aautodjustright in0\lin0\itap0 tlchcs1 f0fs18lang1025 \ltrchcs0 s18\lang3079\langfe3079\lochf0\hichf0\dbchf31505+\ltrchcs0 ab ab }{ ield{\*ldinst { tlchcs1 f0 \ltrchcs0 \hichf0\dbchf31505\loch0 PAGE \* MERGEFORMAT }}{ldrslt { tlchcs1 f0 \ltrchcs0 \lang1024\langfe1024 oproof +\hichf0\dbchf31505\loch0 4}}}\sectd \ltrsect\lndscpsxn\linex0ndnhere\sectdefaultcl\sftnbj { tlchcs1 f0 \ltrch cs0 +\par }} + +\par } +} diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index 800e5749fe2c..1ecdb6471052 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -2387,12 +2387,12 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf118672) return; // This ended as "fol*1 2 3 4 5 6 7 8 9", i.e. "10con-" was moved to the next line. + // Bizarrely, Word lets the text run into the right margin (loaded from .rtf) assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]"_ostr, "portion"_ostr, + "He heard quiet steps behind him. That didn't bode well. Who could be fol*1 2 " - "3 4 5 6 7 8 9 10con"); - assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[2]"_ostr, - "portion"_ostr, "setetur"); + "3 4 5 6 7 8 9 10consetetur"); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf150200) diff --git a/sw/qa/extras/layout/layout3.cxx b/sw/qa/extras/layout/layout3.cxx index ccc69ab1b2bc..69a9458e90e0 100644 --- a/sw/qa/extras/layout/layout3.cxx +++ b/sw/qa/extras/layout/layout3.cxx @@ -396,16 +396,60 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf120287b) assertXPath( pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr, - "width"_ostr, "18"); + "width"_ostr, "1"); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf120287c) { createSwDoc("tdf120287c.fodt"); xmlDocUniquePtr pXmlDoc = parseLayoutDump(); - // This was 2, the second line was not broken into a 2nd and a 3rd one, - // rendering text outside the paragraph frame. - assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout"_ostr, 3); + // This was 3, the second line was broken into a 2nd and a 3rd one, + // not rendering text outside the paragraph frame like Word 2013 does. + assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout"_ostr, 2); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658a) +{ + createSwDoc("tdf158658a.rtf"); + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + + // Word 2013 puts all tabs into one line, the last 8 of them are off the page + assertXPath(pXmlDoc, "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1); + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabCenter']"_ostr, + 1); + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabRight']"_ostr, + 1); + assertXPath( + pXmlDoc, + "/root/page[1]/header/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabLeft']"_ostr, + 9); +} + +CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf158658b) +{ + createSwDoc("tdf158658b.rtf"); + 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... + assertXPath(pXmlDoc, "/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout"_ostr, 1); + assertXPath( + pXmlDoc, + "/root/page[1]/footer/txt[1]/SwParaPortion/SwLineLayout/child::*[@type='PortionType::TabCenter']"_ostr, + 1); + assertXPath( + 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::TabLeft']"_ostr, + 0); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter3, testTdf155177) diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 8eced32e8990..66dae09b35c4 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1942,6 +1942,12 @@ SwTwips SwTextFormatInfo::GetLineWidth() if (pLastTab->GetWhichPor() == PortionType::TabLeft) nLineWidth = nTextFrameWidth - pLastTab->GetTabPos(); } + else if (GetLast() == pLastTab) + { // tdf#158658 Put content after tab into margin like Word. + // FIXME using Width() is entirely arbitrary here, Word adds even more + // width but not infinitely much. + nLineWidth = std::max<SwTwips>(Width(), nLineWidth); + } return nLineWidth; } diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx index e7141aaec538..3f72f5375000 100644 --- a/sw/source/core/text/txttab.cxx +++ b/sw/source/core/text/txttab.cxx @@ -70,6 +70,7 @@ sal_uInt16 SwLineInfo::NumberOfTabStops() const SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto ) const { IDocumentSettingAccess const& rIDSA(rInf.GetTextFrame()->GetDoc().getIDocumentSettingAccess()); + const bool bTabOverMargin = rIDSA.get(DocumentSettingId::TAB_OVER_MARGIN); const bool bTabOverSpacing = rIDSA.get(DocumentSettingId::TAB_OVER_SPACING); const bool bTabsRelativeToIndent = rIDSA.get(DocumentSettingId::TABS_RELATIVE_TO_INDENT); @@ -145,7 +146,7 @@ SwTabPortion *SwTextFormatter::NewTabPortion( SwTextFormatInfo &rInf, bool bAuto // default tab stop. const SwTwips nOldRight = nMyRight; // Accept left-tabstops beyond the paragraph margin for bTabOverSpacing - if (bTabOverSpacing) + if (bTabOverSpacing || bTabOverMargin) nMyRight = 0; const SvxTabStop* pTabStop = m_aLineInf.GetTabStop( nSearchPos, nMyRight ); if (!nMyRight) @@ -419,7 +420,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf ) { // handle this case in PostFormat if ((bTabOverMargin || bTabOverSpacing) && GetTabPos() > rInf.Width() - && (!m_bAutoTabStop || (!bTabOverMargin && rInf.X() > rInf.Width()))) + && (!m_bAutoTabStop || rInf.X() > rInf.Width())) { if (bTabOverMargin || GetTabPos() < nTextFrameWidth) {