sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport16.cxx                    |   13 ++++++++++
 sw/source/core/text/txttab.cxx                                |    3 +-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 39251e461bfe628da875bb17e91dc374f137eec5
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Mon Jun 7 13:13:50 2021 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jun 15 16:05:22 2021 +0200

    tdf#142404 DOCX c15: allow autoTabStop after TabOverSpacing
    
    I said I wasn't going to do anything about tab-after-tab,
    but this time around I'm not seeing any problems,
    and some minor benefit, so lets go ahead anyway...
    
    Obviously we do not want an autoTabStop by itself to go
    over the margins. However, if we are ALREADY over the margin,
    then MS Word 2013+ (compatibilityMode 15) does allow them.
    [This already happened with TabOverMargin for the most part,
    but I don't know what TabOverflow accomplishes,
    so to be safe and cautious and mysterious, I limit it to
    only benefit the new TabOverSpacing.]
    
    The only unit test that had this condition was ooxmlexport13's
    tdf121374_sectionHF2.doc, but I don't see any impact there.
    
    Change-Id: I67fb35b9ae4a6cfc50ccf76aa082d2b2f9683c57
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116877
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt 
b/sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt
index 9760fd253988..971a0a3a6ef8 100644
Binary files a/sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt 
and b/sw/qa/extras/ooxmlexport/data/tdf142404_tabOverSpacingC15.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
index a2217f3ab845..f75faf8bbe04 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport16.cxx
@@ -242,6 +242,19 @@ 
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf142404_tabOverSpacingC15, "tdf142404_
     sal_Int32 nHeight = parseDump("//page[1]/body/txt[2]/infos/bounds", 
"height").toInt32();
     CPPUNIT_ASSERT_MESSAGE("4 lines high", 1100 < nHeight);
     CPPUNIT_ASSERT_MESSAGE("4 lines high", nHeight < 1300);
+
+    CPPUNIT_ASSERT_EQUAL(OUString("TabOverflow does what?"), 
parseDump("//page[1]/body/txt[7]/Text[1]", "Portion"));
+    // Not 1 line high (Word 2010 DOCX), or 4 lines high (prev LO DOCX) or 8 
lines high (ODT).
+    // but two lines high. (3 in Word 2016 because it pulls down "what?" to 
the second line - weird)
+    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);
+
+    // 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),
+    // but 3 lines high (8 lines high in Word 2016 because of the same 
weirdness as previous test).
+    nHeight = parseDump("//page[3]/body/txt[2]/infos/bounds", 
"height").toInt32();
+    CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("3 lines high (but 8 in Word)", 
242*3, nHeight, 121);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf139580, "tdf139580.odt")
diff --git a/sw/source/core/text/txttab.cxx b/sw/source/core/text/txttab.cxx
index e12d31c64251..101c63cde87e 100644
--- a/sw/source/core/text/txttab.cxx
+++ b/sw/source/core/text/txttab.cxx
@@ -382,7 +382,8 @@ bool SwTabPortion::PreFormat( SwTextFormatInfo &rInf )
             case PortionType::TabLeft:
             {
                 // handle this case in PostFormat
-                if ((bTabOverMargin || bTabOverSpacing) && !m_bAutoTabStop && 
GetTabPos() > rInf.Width())
+                if ((bTabOverMargin || bTabOverSpacing) && GetTabPos() > 
rInf.Width()
+                    && (!m_bAutoTabStop || (!bTabOverMargin && rInf.X() > 
rInf.Width())))
                 {
                     if (bTabOverMargin || GetTabPos() < 
rInf.GetTextFrame()->getFrameArea().Width())
                     {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to