[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-4+backports' - sw/qa sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 1 18:40:10 UTC 2021


 sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt |binary
 sw/qa/extras/ww8export/ww8export3.cxx                      |    6 ++++++
 sw/source/filter/ww8/wrtw8num.cxx                          |   11 +++++++++++
 sw/source/filter/ww8/wrtww8.hxx                            |    1 +
 sw/source/filter/ww8/ww8atr.cxx                            |    7 +++++++
 5 files changed, 25 insertions(+)

New commits:
commit 1933b321c928acfc84f18f8b7167eb74fee9a49d
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Fri May 28 16:03:52 2021 +0200
Commit:     Thorsten Behrens <thorsten.behrens at allotropia.de>
CommitDate: Tue Jun 1 20:39:31 2021 +0200

    tdf#138302 partial revert tdf#108496: DOCX: redesign of override in lists
    
    LO 6.4.5 commit cf13fe3e6f6a40f6db064d65d4514d13a23a31f0
    was only concerned about DOCX, but just elinated shared code.
    So restore the shared code and just don't execute it for DOCX.
    
    It doesn't look like RTF was working before this,
    but this does fix DOC format.
    I looked for existing unit tests in rtf and doc,
    but none were found that hit this code.
    
    Change-Id: Id624f73181384f38e1ef9f27575e0fb82eea19c7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116349
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116433
    Tested-by: Thorsten Behrens <thorsten.behrens at allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behrens at allotropia.de>

diff --git a/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt b/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt
new file mode 100644
index 000000000000..8c99963616a7
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf138302_restartNumbering.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 9c83b6f62fa9..6b39ac200c3b 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -56,6 +56,12 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d
     CPPUNIT_ASSERT_EQUAL_MESSAGE("Last printed date", sal_Int16(2009), xDPS->getDocumentProperties()->getPrintDate().Year);
 }
 
+DECLARE_WW8EXPORT_TEST(tesTdf138302_restartNumbering, "tdf138302_restartNumbering.odt")
+{
+    uno::Reference<beans::XPropertySet> xPara(getParagraph(8), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("1."), getProperty<OUString>(xPara, "ListLabelString"));
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc")
 {
     uno::Reference<container::XNameAccess> pageStyles = getStyles("PageStyles");
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index d0514482e5e1..05e860caec74 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -61,6 +61,17 @@ SwNumRule* MSWordExportBase::DuplicateNumRuleImpl(const SwNumRule *pRule)
     return pMyNumRule;
 }
 
+sal_uInt16 MSWordExportBase::DuplicateNumRule(const SwNumRule* pRule, sal_uInt8 nLevel, sal_uInt16 nVal)
+{
+    SwNumRule* const pMyNumRule = DuplicateNumRuleImpl(pRule);
+
+    SwNumFormat aNumFormat(pMyNumRule->Get(nLevel));
+    aNumFormat.SetStart(nVal);
+    pMyNumRule->Set(nLevel, aNumFormat);
+
+    return GetNumberingId(*pMyNumRule);
+}
+
 // multiple SwList can be based on the same SwNumRule; ensure one w:abstractNum
 // per SwList
 sal_uInt16 MSWordExportBase::DuplicateAbsNum(OUString const& rListId,
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 9356b87bd86f..104770c698be 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -657,6 +657,7 @@ public:
     /// List is set to restart at a particular value so for export make a
     /// completely new list based on this one and export that instead,
     /// which duplicates words behaviour in this respect.
+    sal_uInt16 DuplicateNumRule(const SwNumRule* pRule, sal_uInt8 nLevel, sal_uInt16 nVal);
     SwNumRule * DuplicateNumRuleImpl(const SwNumRule *pRule);
 
     /// check if a new abstractNum is needed for this list
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 0b2c6527c0ea..5868928c5bf6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3649,6 +3649,13 @@ void AttributeOutputBase::ParaNumRule( const SwNumRuleItem& rNumRule )
                     }
                 }
             }
+            else if (pTextNd->IsListRestart())
+            {
+                sal_uInt16 nStartWith = static_cast<sal_uInt16>(pTextNd->GetActualListStartValue());
+                nNumId = GetExport().DuplicateNumRule(pRule, nLvl, nStartWith);
+                if (USHRT_MAX != nNumId)
+                    ++nNumId;
+            }
         }
         else
         {


More information about the Libreoffice-commits mailing list