sw/qa/extras/ooxmlexport/ooxmlexport16.cxx |    4 ++++
 sw/source/core/text/txttab.cxx             |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 3f5311271ea6e41583c581b8a0172e322f5a179a
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Wed Jun 16 15:33:06 2021 +0200
Commit:     Justin Luth <justin_l...@sil.org>
CommitDate: Thu Jun 17 06:21:47 2021 +0200

    tdf#142404 DOCX c15: fix centering when TabOverSpacing
    
    I didn't notice the need for making the same
    exclusion that TabOverMargin made for centering
    when 7.2 got the new TabOverSpacing compat flag.
    But now I see it is still needed.
    
    Change-Id: Ia8069b5566eaf6dcdac6ff10ee0c60b849c5fa2e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117339
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index 8ab528c6307c..408f0e608da0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -249,6 +249,10 @@ 
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf142404_tabOverSpacingC15, "tdf142404_
     nHeight = parseDump("//page[1]/body/txt[7]/infos/bounds", 
"height").toInt32();
     CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("2 lines high (but 3 in Word)", 
242*2.5, nHeight, 242);
 
+    CPPUNIT_ASSERT_EQUAL(OUString("A centered tab positioned at"), 
parseDump("//page[1]/body/txt[3]/Text[1]", "Portion"));
+    sal_Int32 nLineWidth = parseDump("//page[1]/body/txt[3]/Text[2]", 
"nWidth").toInt32();
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("Big tab: full paragraph area used", 
737, nLineWidth, 100);
+
     // Pages 2/3 are TabOverMargin - in this particular case tabs should not 
go over margin.
     CPPUNIT_ASSERT_EQUAL(OUString("TabOverflow does what?"), 
parseDump("//page[3]/body/txt[2]/Text[1]", "Portion"));
     // Not 1 line high (Word 2010 DOCX and ODT), or 4 lines high (prev LO 
DOCX),
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index 565c660b23be..4039509dd4ae 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -525,7 +525,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( !bTabOverMargin && nNewWidth > rInf.Width() - nRight )
+        if (!bTabOverMargin && !bTabOverSpacing && nNewWidth > rInf.Width() - 
nRight)
             nNewWidth = nPorWidth - (rInf.Width() - nRight);
         nPorWidth = nNewWidth;
     }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to