Kaydet (Commit) a9367c1b authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Miklos Vajna

tdf#35021 TabOverMargin: support center and decimal tabs also

TabOverMargin compatibility setting allows tabs placed beyond
the right margin to function where they are instead of using
the right margin as a hard limit. So far this has only been
effective for right tabs (the most logical tab to use at the
far right.
This patch adds support for center and decimal tabs also.
Left tabs are trickier, so they will be attempted separately.

CAVEAT: Basically all of this stuff tricks the layout
engine, so the amount of text allowed on a single line is still
"controlled" by the right margin.  So, even though the extended
line could theoretically be very long, the amount of text still
must fit within the limits set by the right margin.
Thus large margins may cause wrapping in LibreOffice, instead of
disappearing off of the end of the paper as it does in MSWord,
and editing the text might get confusing - which matches the
experience in MSWord.

Change-Id: I1ff638eb3576ec221247e9a9823e7e082a1cba79
Reviewed-on: https://gerrit.libreoffice.org/32534Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst d74e3b5b
...@@ -455,7 +455,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf ) ...@@ -455,7 +455,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
// no value was set => no decimal character was found // no value was set => no decimal character was found
if ( USHRT_MAX != nPrePorWidth ) if ( USHRT_MAX != nPrePorWidth )
{ {
if ( nPrePorWidth && nPorWidth - nPrePorWidth > rInf.Width() - nRight ) if ( !bTabOverMargin && nPrePorWidth && nPorWidth - nPrePorWidth > rInf.Width() - nRight )
{ {
nPrePorWidth += nPorWidth - nPrePorWidth - ( rInf.Width() - nRight ); nPrePorWidth += nPorWidth - nPrePorWidth - ( rInf.Width() - nRight );
} }
...@@ -469,7 +469,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf ) ...@@ -469,7 +469,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
// centered tabs are problematic: // centered tabs are problematic:
// We have to detect how much fits into the line. // We have to detect how much fits into the line.
sal_uInt16 nNewWidth = nPorWidth /2; sal_uInt16 nNewWidth = nPorWidth /2;
if( nNewWidth > rInf.Width() - nRight ) if( !bTabOverMargin && nNewWidth > rInf.Width() - nRight )
nNewWidth = nPorWidth - (rInf.Width() - nRight); nNewWidth = nPorWidth - (rInf.Width() - nRight);
nPorWidth = nNewWidth; nPorWidth = nNewWidth;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment