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

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 10 19:31:42 UTC 2020


 dev/null                                   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx |   25 +++++++++++++++++--------
 sw/qa/extras/ww8export/ww8export3.cxx      |   12 ------------
 sw/source/filter/ww8/wrtw8num.cxx          |   14 ++------------
 4 files changed, 19 insertions(+), 32 deletions(-)

New commits:
commit 23126db6e0ca3eb51748b6f579d066f20536d27b
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Thu Sep 10 18:32:49 2020 +0200
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Thu Sep 10 21:30:53 2020 +0200

    Revert "tdf#59674 Word export: set a tabstop at numbering IndentAt"
    
    This reverts commit 5ad17c85dc93973c0cbb1d633b9eed144f0677de
    for the benefit of all mankind, and specifically tdf#136644.
    
    Reason for revert: LO's UI for this is totally messed up,
    so I want to completely get out of anything to do with
    numbering/bullets.
    
    It is inconsistent with how it handles default tab stops
    (delete all when none are shown and things act different),
    it doesn't always increment levels properly,
    and does all kinds of weird things.
    
    Change-Id: Ifaf8c3a7c9ac30b7103b82dd119cb4629f0b2578
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102415
    Tested-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index fcbda86665cd..b8e7a3d27614 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -327,19 +327,28 @@ DECLARE_OOXMLEXPORT_TEST(testTdf134260, "tdf134260.docx")
     // - Expected: 0
     // - Actual  : 1270
 
-    auto xNumLevels
-        = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(3), "NumberingRules");
+    auto xNum1Levels
+        = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules");
+
+    CPPUNIT_ASSERT_EQUAL(
+        sal_Int32(0),
+        comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["ListtabStopPosition"]
+            .get<sal_Int32>());
+
+    auto xNum2Levels
+        = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(2), "NumberingRules");
 
-    sal_Int32 nTabPosExpected = mbExported ? 1270 : 0;
     CPPUNIT_ASSERT_EQUAL(
-        nTabPosExpected,
-        comphelper::SequenceAsHashMap(xNumLevels->getByIndex(0))["ListtabStopPosition"]
+        sal_Int32(0),
+        comphelper::SequenceAsHashMap(xNum2Levels->getByIndex(0))["ListtabStopPosition"]
             .get<sal_Int32>());
 
-    nTabPosExpected = mbExported ? 2598 : 0;
+    auto xNum3Levels
+        = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(3), "NumberingRules");
+
     CPPUNIT_ASSERT_EQUAL(
-        nTabPosExpected,
-        comphelper::SequenceAsHashMap(xNumLevels->getByIndex(1))["ListtabStopPosition"]
+        sal_Int32(0),
+        comphelper::SequenceAsHashMap(xNum3Levels->getByIndex(0))["ListtabStopPosition"]
             .get<sal_Int32>());
 }
 
diff --git a/sw/qa/extras/ww8export/data/tdf59674_numberingTabStop.odt b/sw/qa/extras/ww8export/data/tdf59674_numberingTabStop.odt
deleted file mode 100644
index 5edcbaebcf93..000000000000
Binary files a/sw/qa/extras/ww8export/data/tdf59674_numberingTabStop.odt and /dev/null differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 757e24b40555..b5a9d336cf74 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -147,18 +147,6 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote)
     CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
 }
 
-DECLARE_WW8EXPORT_TEST(testTdf59674_numberingTabStop, "tdf59674_numberingTabStop.odt")
-{
-    // This bug is mainly for MS Word. The round-trip looked fine in LO. Test exporting a non-useless value.
-    auto xNum1Levels = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(2), "NumberingRules");
-    sal_Int32 nTabPos2 = comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["ListtabStopPosition"].get<sal_Int32>();
-    xNum1Levels.set(getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(3), "NumberingRules"));
-    sal_Int32 nTabPos3 = comphelper::SequenceAsHashMap(xNum1Levels->getByIndex(0))["ListtabStopPosition"].get<sal_Int32>();
-
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(1281), nTabPos2);
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(5001), nTabPos3);  //previously 640
-}
-
 DECLARE_WW8EXPORT_TEST(testdf79553_lineNumbers, "tdf79553_lineNumbers.doc")
 {
     bool bValue = false;
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index 78722c9c7cfe..a7f4276fbdc6 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -581,18 +581,8 @@ void MSWordExportBase::NumberingLevel(
     {
         nIndentAt = static_cast<sal_Int16>(rFormat.GetIndentAt());
         nFirstLineIndex = static_cast<sal_Int16>(rFormat.GetFirstLineIndent());
-        nListTabPos = 0;
-        if ( rFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
-        {
-            nListTabPos = static_cast<sal_Int16>( rFormat.GetListtabPos() );
-
-            // Writer usually treats nIndentAt as a tabstop, but Word doesn't (at least for .doc and .rtf).
-            // NOTE: There will still be problems if the tabstop is only SLIGHTLY larger than the align-at position,
-            // i.e. if the tab position is not behind the numbering character. Oh well. Better design your document better.
-            const sal_Int32 nStart = nIndentAt + nFirstLineIndex; // nFirstLineIndex is a negative offset
-            if ( nListTabPos <= nStart )
-                nListTabPos = nIndentAt;
-        }
+        nListTabPos = rFormat.GetLabelFollowedBy() == SvxNumberFormat::LISTTAB?
+                      static_cast<sal_Int16>( rFormat.GetListtabPos() ) : 0;
     }
 
     AttrOutput().NumberingLevel( nLvl,


More information about the Libreoffice-commits mailing list