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

Justin Luth justin_luth at sil.org
Wed Jan 18 09:05:53 UTC 2017


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

New commits:
commit 441d7e046df36900bbf14b37277b15d615f67641
Author: Justin Luth <justin_luth at sil.org>
Date:   Sat Dec 31 17:45:50 2016 +0300

    tdf#35021 TabOverMargin: support LEFT tabs also
    
    Change-Id: Ifea8c7fcde82c9d45ce1d67a829555f5499feeb0
    Reviewed-on: https://gerrit.libreoffice.org/32539
    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 6b4d5bb..b2dfd6f 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -312,7 +312,7 @@ bool SwTabPortion::Format( SwTextFormatInfo &rInf )
 
 void SwTabPortion::FormatEOL( SwTextFormatInfo &rInf )
 {
-    if( rInf.GetLastTab() == this && !IsTabLeftPortion() )
+    if( rInf.GetLastTab() == this )
         PostFormat( rInf );
 }
 
@@ -325,6 +325,7 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
 
     const bool bTabCompat = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT);
     const bool bTabOverflow = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVERFLOW);
+    const bool bTabOverMargin = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_OVER_MARGIN);
 
     // The minimal width of a tab is one blank at least.
     // #i37686# In compatibility mode, the minimum width
@@ -376,6 +377,13 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
             }
             case POR_TABLEFT:
             {
+                // handle this case in PostFormat
+                if( bTabOverMargin && GetTabPos() > rInf.Width() )
+                {
+                    rInf.SetLastTab( this );
+                    break;
+                }
+
                 PrtWidth( static_cast<sal_uInt16>(GetTabPos() - rInf.X()) );
                 bFull = rInf.Width() <= rInf.X() + PrtWidth();
 
@@ -444,9 +452,13 @@ bool SwTabPortion::PostFormat( SwTextFormatInfo &rInf )
     }
 
     const sal_uInt16 nWhich = GetWhichPor();
-    OSL_ENSURE( POR_TABLEFT != nWhich, "SwTabPortion::PostFormat: already formatted" );
     const bool bTabCompat = rInf.GetTextFrame()->GetTextNode()->getIDocumentSettingAccess()->get(DocumentSettingId::TAB_COMPAT);
 
+    if ( bTabOverMargin && POR_TABLEFT == nWhich )
+    {
+        nPorWidth = 0;
+    }
+
     // #127428# Abandon dec. tab position if line is full
     if ( bTabCompat && POR_TABDECIMAL == nWhich )
     {


More information about the Libreoffice-commits mailing list