[Libreoffice-commits] core.git: sw/source

Justin Luth justin_luth at sil.org
Tue Jan 17 08:31:12 UTC 2017


 sw/source/core/text/txttab.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit a9367c1b39600d5a5e2d0067113f06ad59cc37a1
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Dec 31 16:08:54 2016 +0300

    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/32534
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 3592bc2..6b4d5bb 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -455,7 +455,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
         // no value was set => no decimal character was found
         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 );
             }
@@ -469,7 +469,7 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
         // centered tabs are problematic:
         // We have to detect how much fits into the line.
         sal_uInt16 nNewWidth = nPorWidth /2;
-        if( nNewWidth > rInf.Width() - nRight )
+        if( !bTabOverMargin && nNewWidth > rInf.Width() - nRight )
             nNewWidth = nPorWidth - (rInf.Width() - nRight);
         nPorWidth = nNewWidth;
     }


More information about the Libreoffice-commits mailing list