[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 4 commits - sw/qa sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri May 15 08:23:52 UTC 2020


 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx            |   29 +++
 sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf |   14 +
 sw/qa/extras/rtfexport/rtfexport3.cxx                 |   13 +
 sw/qa/extras/ww8export/data/arabic-zero-numbering.doc |binary
 sw/qa/extras/ww8export/ww8export3.cxx                 |   44 +++++
 sw/source/filter/ww8/docxattributeoutput.cxx          |    3 
 sw/source/filter/ww8/rtfattributeoutput.cxx           |    3 
 sw/source/filter/ww8/wrtw8num.cxx                     |    9 +
 sw/source/filter/ww8/wrtw8sty.cxx                     |    8 
 sw/source/filter/ww8/wrtww8.hxx                       |    6 
 sw/source/filter/ww8/ww8atr.cxx                       |    4 
 sw/source/filter/ww8/ww8par.cxx                       |   18 --
 sw/source/filter/ww8/ww8par.hxx                       |    2 
 sw/source/filter/ww8/ww8par3.cxx                      |  156 +++++++++++-------
 14 files changed, 238 insertions(+), 71 deletions(-)

New commits:
commit d22c0aa1bd6435e84f21f509b014209985c3c83b
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Mar 5 15:57:33 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 15 10:13:18 2020 +0200

    sw padded numbering: add DOC footnote filter
    
    Import side: remove the duplication between SwWW8ImplReader::CoreLoad()
    and WW8ListManager::ReadLVL(). The CoreLoad() version did not support
    reading 0x16 as it did a "& 0xf" on the value before parsing.
    
    Export side: Writer supports footnote numbering type per-document, Word
    supports it per-section. So next to the per-document export add a
    per-section one, that's what Word actually reads. Similar code was there
    already for DOCX.
    
    (cherry picked from commit 5c7d0c5bafd244f1bfb3930e0229f1f3f2371c82)
    
    Conflicts:
            sw/source/filter/ww8/ww8par.cxx
    
    Change-Id: Ic94e953cfee4514aabe507a8bcf75445bf05f401

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 925af30ba55e..84677fb3403c 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -19,6 +19,7 @@
 #include <com/sun/star/text/XTextTable.hpp>
 #include <com/sun/star/text/XTextTablesSupplier.hpp>
 #include <com/sun/star/text/WritingMode2.hpp>
+#include <com/sun/star/text/XTextContentAppend.hpp>
 
 class Test : public SwModelTestBase
 {
@@ -51,7 +52,7 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d
     CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
 }
 
-DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
+DECLARE_WW8EXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
 {
     auto xNumberingRules
         = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules");
@@ -64,6 +65,36 @@ DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote)
+{
+    // Create a document, set footnote numbering type to ARABIC_ZERO.
+    loadURL("private:factory/swriter", nullptr);
+    uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xFootnoteSettings
+        = xFootnotesSupplier->getFootnoteSettings();
+    sal_uInt16 nNumberingType = style::NumberingType::ARABIC_ZERO;
+    xFootnoteSettings->setPropertyValue("NumberingType", uno::makeAny(nNumberingType));
+
+    // Insert a footnote.
+    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextContent> xFootnote(
+        xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY);
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(),
+                                                                uno::UNO_QUERY);
+    xTextContentAppend->appendTextContent(xFootnote, {});
+
+    reload("MS Word 97", "");
+    xFootnotesSupplier.set(mxComponent, uno::UNO_QUERY);
+    sal_uInt16 nExpected = style::NumberingType::ARABIC_ZERO;
+    auto nActual = getProperty<sal_uInt16>(xFootnotesSupplier->getFootnoteSettings(), "NumberingType");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 64
+    // - Actual  : 4
+    // i.e. the numbering type was ARABIC, not ARABIC_ZERO.
+    CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
+}
+
 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 7300afca81e9..3864b09bf681 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -241,6 +241,11 @@ void MSWordExportBase::NumberingDefinitions()
     }
 }
 
+/**
+ * Converts the SVX numbering type to MSONFC.
+ *
+ * This is used for paragraph numbering purposes.
+ */
 static sal_uInt8 GetLevelNFC(  sal_uInt16 eNumType, const SfxItemSet *pOutSet)
 {
     sal_uInt8 nRet = 0;
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index bfe6483b7f41..d43c96f8f3c8 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1330,6 +1330,7 @@ void WW8AttributeOutput::StartSection()
 void WW8AttributeOutput::SectFootnoteEndnotePr()
 {
     const SwFootnoteInfo& rInfo = m_rWW8Export.m_pDoc->GetFootnoteInfo();
+    const SwEndNoteInfo& rEndNoteInfo = m_rWW8Export.m_pDoc->GetEndNoteInfo();
     m_rWW8Export.InsUInt16( NS_sprm::sprmSRncFtn );
     switch( rInfo.eNum )
     {
@@ -1337,6 +1338,13 @@ void WW8AttributeOutput::SectFootnoteEndnotePr()
     case FTNNUM_CHAPTER:  m_rWW8Export.pO->push_back( sal_uInt8/*rncRstSect*/ (1) ); break;
     default:              m_rWW8Export.pO->push_back( sal_uInt8/*rncCont*/ (0) ); break;
     }
+
+    m_rWW8Export.InsUInt16(NS_sprm::sprmSNfcFtnRef);
+    sal_uInt8 nId = WW8Export::GetNumId(rInfo.aFormat.GetNumberingType());
+    SwWW8Writer::InsUInt16(*m_rWW8Export.pO, nId);
+    m_rWW8Export.InsUInt16(NS_sprm::sprmSNfcEdnRef);
+    nId = WW8Export::GetNumId(rEndNoteInfo.aFormat.GetNumberingType());
+    SwWW8Writer::InsUInt16(*m_rWW8Export.pO, nId);
 }
 
 void WW8AttributeOutput::SectionFormProtection( bool bProtected )
diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx
index 45c444c1f0b3..ccfb0a7caed1 100644
--- a/sw/source/filter/ww8/wrtww8.hxx
+++ b/sw/source/filter/ww8/wrtww8.hxx
@@ -1144,7 +1144,11 @@ public:
     void SetHdFtIndex(unsigned int nHdFtIndex) { m_nHdFtIndex = nHdFtIndex; }
     void IncrementHdFtIndex() { ++m_nHdFtIndex; }
 
-    /// Convert the SVX numbering type to id
+    /**
+     * Converts the SVX numbering type to MSONFC.
+     *
+     * This is used for section, footnote and endnote numbering purposes.
+     */
     static sal_uInt8 GetNumId( sal_uInt16 eNumType );
 
     /// Guess the script (asian/western).
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 3b9bff97bde3..18a9da4e8d50 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -740,6 +740,10 @@ sal_uInt8 WW8Export::GetNumId( sal_uInt16 eNumType )
 
     // nothing, WW does the same (undocumented)
     case SVX_NUM_NUMBER_NONE:           nRet = 0xff;    break;
+    case SVX_NUM_ARABIC_ZERO:
+        // 0x16, msonfcArabicLZ
+        nRet = 22;
+        break;
     }
     return nRet;
 }
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 5839bf219039..22877ca19ea3 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5119,16 +5119,6 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
 
     m_xSBase.reset(new WW8ScannerBase(m_pStrm,m_pTableStream,m_pDataStream, m_xWwFib.get()));
 
-    static const SvxNumType eNumTA[16] =
-    {
-        SVX_NUM_ARABIC, SVX_NUM_ROMAN_UPPER, SVX_NUM_ROMAN_LOWER,
-        SVX_NUM_CHARS_UPPER_LETTER_N, SVX_NUM_CHARS_LOWER_LETTER_N,
-        SVX_NUM_ARABIC, SVX_NUM_ARABIC, SVX_NUM_ARABIC,
-        SVX_NUM_ARABIC, SVX_NUM_ARABIC, SVX_NUM_ARABIC,
-        SVX_NUM_ARABIC, SVX_NUM_ARABIC, SVX_NUM_ARABIC,
-        SVX_NUM_ARABIC, SVX_NUM_ARABIC
-    };
-
     if (m_xSBase->AreThereFootnotes())
     {
         static const SwFootnoteNum eNumA[4] =
@@ -5140,8 +5130,8 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
 
         aInfo.ePos = FTNPOS_PAGE;
         aInfo.eNum = eNumA[m_xWDop->rncFootnote];
-        sal_uInt16 nfcFootnoteRef = m_xWDop->nfcFootnoteRef & 0xF;
-        aInfo.aFormat.SetNumberingType( eNumTA[nfcFootnoteRef] );
+        sal_uInt16 nfcFootnoteRef = m_xWDop->nfcFootnoteRef;
+        aInfo.aFormat.SetNumberingType(WW8ListManager::GetSvxNumTypeFromMSONFC(nfcFootnoteRef));
         if( m_xWDop->nFootnote )
             aInfo.nFootnoteOffset = m_xWDop->nFootnote - 1;
         m_rDoc.SetFootnoteInfo( aInfo );
@@ -5149,8 +5139,8 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss)
     if (m_xSBase->AreThereEndnotes())
     {
         SwEndNoteInfo aInfo = m_rDoc.GetEndNoteInfo(); // Same as for Footnote
-        sal_uInt16 nfcEdnRef = m_xWDop->nfcEdnRef & 0xF;
-        aInfo.aFormat.SetNumberingType( eNumTA[nfcEdnRef] );
+        sal_uInt16 nfcEdnRef = m_xWDop->nfcEdnRef;
+        aInfo.aFormat.SetNumberingType(WW8ListManager::GetSvxNumTypeFromMSONFC(nfcEdnRef));
         if( m_xWDop->nEdn )
             aInfo.nFootnoteOffset = m_xWDop->nEdn - 1;
         m_rDoc.SetEndNoteInfo( aInfo );
diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx
index 4221eb3b454c..bdd625364f09 100644
--- a/sw/source/filter/ww8/ww8par.hxx
+++ b/sw/source/filter/ww8/ww8par.hxx
@@ -156,6 +156,8 @@ public:
     ~WW8ListManager() COVERITY_NOEXCEPT_FALSE;
     SwNumRule* GetNumRule(size_t i);
     size_t GetWW8LSTInfoNum() const{return maLSTInfos.size();}
+    static SvxNumType GetSvxNumTypeFromMSONFC(sal_uInt16 nMSONFC);
+
 private:
     wwSprmParser const maSprmParser;
     SwWW8ImplReader& rReader;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index f0c1ab4e0c3b..966fb66fb121 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -515,6 +515,102 @@ static OUString sanitizeString(const OUString& rString)
     return rString;
 }
 
+SvxNumType WW8ListManager::GetSvxNumTypeFromMSONFC(sal_uInt16 nNFC)
+{
+    SvxNumType nType(SVX_NUM_ARABIC);
+
+    switch (nNFC)
+    {
+        case 0:
+            nType = SVX_NUM_ARABIC;
+            break;
+        case 1:
+            nType = SVX_NUM_ROMAN_UPPER;
+            break;
+        case 2:
+            nType = SVX_NUM_ROMAN_LOWER;
+            break;
+        case 3:
+            nType = SVX_NUM_CHARS_UPPER_LETTER_N;
+            break;
+        case 4:
+            nType = SVX_NUM_CHARS_LOWER_LETTER_N;
+            break;
+        case 5:
+            // actually: ORDINAL
+            nType = SVX_NUM_ARABIC;
+            break;
+        case 22:
+            // 0x16, msonfcArabicLZ
+            nType = SVX_NUM_ARABIC_ZERO;
+            break;
+        case 23:
+            nType = SVX_NUM_CHAR_SPECIAL;
+
+            break;
+        case 255:
+            nType = SVX_NUM_NUMBER_NONE;
+            break;
+        case 14:
+        case 19:
+            nType = SVX_NUM_FULL_WIDTH_ARABIC;
+            break;
+        case 30:
+            nType = SVX_NUM_TIAN_GAN_ZH;
+            break;
+        case 31:
+            nType = SVX_NUM_DI_ZI_ZH;
+            break;
+        case 35:
+        case 36:
+        case 37:
+        case 11:
+        case 39:
+            nType = SVX_NUM_NUMBER_LOWER_ZH;
+            break;
+        case 34:
+            nType = SVX_NUM_NUMBER_UPPER_ZH_TW;
+            break;
+        case 38:
+            nType = SVX_NUM_NUMBER_UPPER_ZH;
+            break;
+        case 10:
+            nType = SVX_NUM_NUMBER_TRADITIONAL_JA;
+            break;
+        case 20:
+            nType = SVX_NUM_AIU_FULLWIDTH_JA;
+            break;
+        case 12:
+            nType = SVX_NUM_AIU_HALFWIDTH_JA;
+            break;
+        case 21:
+            nType = SVX_NUM_IROHA_FULLWIDTH_JA;
+            break;
+        case 13:
+            nType = SVX_NUM_IROHA_HALFWIDTH_JA;
+            break;
+        case 24:
+            nType = SVX_NUM_HANGUL_SYLLABLE_KO;
+            break;
+        case 25:
+            nType = SVX_NUM_HANGUL_JAMO_KO;
+            break;
+        case 41:
+            nType = SVX_NUM_NUMBER_HANGUL_KO;
+            break;
+        //case 42:
+        //case 43:
+        case 44:
+            nType = SVX_NUM_NUMBER_UPPER_KO;
+            break;
+        default:
+            nType = SVX_NUM_ARABIC;
+            break;
+    }
+
+    return nType;
+}
+
 bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet>& rpItemSet,
     sal_uInt16 nLevelStyle, bool bSetStartNo,
     std::deque<bool> &rNotReallyThere, sal_uInt16 nLevel,
@@ -730,67 +826,11 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet
     if( 0 <= aLVL.nStartAt )
         nStartNo = static_cast<sal_uInt16>(aLVL.nStartAt);
 
-    switch( aLVL.nNFC )
+    nType = GetSvxNumTypeFromMSONFC(aLVL.nNFC);
+    //For i120928,type info
+    if (bIsPicBullet)
     {
-        case 0:
-            nType = SVX_NUM_ARABIC;
-            break;
-        case 1:
-            nType = SVX_NUM_ROMAN_UPPER;
-            break;
-        case 2:
-            nType = SVX_NUM_ROMAN_LOWER;
-            break;
-        case 3:
-            nType = SVX_NUM_CHARS_UPPER_LETTER_N;
-            break;
-        case 4:
-            nType = SVX_NUM_CHARS_LOWER_LETTER_N;
-            break;
-        case 5:
-            // actually: ORDINAL
-            nType = SVX_NUM_ARABIC;
-            break;
-        case 22:
-            // 0x16, msonfcArabicLZ
-            nType = SVX_NUM_ARABIC_ZERO;
-            break;
-        case 23:
-            nType = SVX_NUM_CHAR_SPECIAL;
-            //For i120928,type info
-            if (bIsPicBullet)
-            {
-                nType = SVX_NUM_BITMAP;
-            }
-
-            break;
-        case 255:
-            nType = SVX_NUM_NUMBER_NONE;
-            break;
-        case 14:
-        case 19:nType = SVX_NUM_FULL_WIDTH_ARABIC; break;
-        case 30:nType = SVX_NUM_TIAN_GAN_ZH; break;
-        case 31:nType = SVX_NUM_DI_ZI_ZH; break;
-        case 35:
-        case 36:
-        case 37:
-        case 11:
-        case 39:nType = SVX_NUM_NUMBER_LOWER_ZH; break;
-        case 34:nType = SVX_NUM_NUMBER_UPPER_ZH_TW; break;
-        case 38:nType = SVX_NUM_NUMBER_UPPER_ZH; break;
-        case 10:nType = SVX_NUM_NUMBER_TRADITIONAL_JA; break;
-        case 20:nType = SVX_NUM_AIU_FULLWIDTH_JA; break;
-        case 12:nType = SVX_NUM_AIU_HALFWIDTH_JA; break;
-        case 21:nType = SVX_NUM_IROHA_FULLWIDTH_JA; break;
-        case 13:nType = SVX_NUM_IROHA_HALFWIDTH_JA; break;
-        case 24:nType = SVX_NUM_HANGUL_SYLLABLE_KO; break;
-        case 25:nType = SVX_NUM_HANGUL_JAMO_KO; break;
-        case 41:nType = SVX_NUM_NUMBER_HANGUL_KO; break;
-        //case 42:
-        //case 43:
-        case 44:nType = SVX_NUM_NUMBER_UPPER_KO; break;
-        default:
-                nType= SVX_NUM_ARABIC; break;
+        nType = SVX_NUM_BITMAP;
     }
 
     //If a number level is not going to be used, then record this fact
commit e2a27e1eff3d9f003842f58eb4f7085f3a3eab29
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Mar 5 13:12:27 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 15 10:07:59 2020 +0200

    sw padded numbering: add DOCX footnote export
    
    This is mapping separate from paragraph numbering. I'm not exactly why;
    perhaps because this is modeled after DOC, where certain numbering types
    are not allowed for paragraph numbering (but are allowed for other
    numbering types).
    
    (cherry picked from commit 3ea32f2b6cbe515353218bc1f3d5746ca66f6a5a)
    
    Change-Id: I06503389da520bd3bfd39252c4dcef39bac03eee

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index fb272a618cb2..fd8910058f0e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/style/LineSpacing.hpp>
 #include <com/sun/star/style/LineSpacingMode.hpp>
 #include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XTextContentAppend.hpp>
 
 char const DATA_DIRECTORY[] = "/sw/qa/extras/ooxmlexport/data/";
 
@@ -120,6 +121,34 @@ DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.docx")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote)
+{
+    // Create a document, set footnote numbering type to ARABIC_ZERO.
+    loadURL("private:factory/swriter", nullptr);
+    uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xFootnoteSettings
+        = xFootnotesSupplier->getFootnoteSettings();
+    sal_uInt16 nNumberingType = style::NumberingType::ARABIC_ZERO;
+    xFootnoteSettings->setPropertyValue("NumberingType", uno::makeAny(nNumberingType));
+
+    // Insert a footnote.
+    uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextContent> xFootnote(
+        xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY);
+    uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+    uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(),
+                                                                uno::UNO_QUERY);
+    xTextContentAppend->appendTextContent(xFootnote, {});
+
+    reload("Office Open XML Text", "");
+
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    // Without the accompanying fix in place, this test would have failed with:
+    // XPath '/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt' number of nodes is incorrect
+    // because the exporter had no idea what markup to use for ARABIC_ZERO.
+    assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "decimalZero");
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf87569d, "tdf87569_drawingml.docx")
 {
     //if the original tdf87569 sample is upgraded it will have drawingml shapes...
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 36ee2c7fb4da..39a0d5b2fcd9 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7815,6 +7815,9 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr
         case SVX_NUM_CHAR_SPECIAL:
             fmt = "bullet";
             break;
+        case SVX_NUM_ARABIC_ZERO:
+            fmt = "decimalZero";
+            break;
         case SVX_NUM_PAGEDESC:
         case SVX_NUM_BITMAP:
         default:
commit 4023b2c2cae83478e73191d55e59254b03f26cbd
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Mar 4 13:33:40 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 15 10:01:52 2020 +0200

    sw padded numbering: add RTF export
    
    RTF import was working already.
    
    (cherry picked from commit dc05428405fb96f28b2d7c7bcfa9033f3f5248a3)
    
    Change-Id: Ifa71035645d4738138790e72c3f9dee640833d0c

diff --git a/sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf b/sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf
new file mode 100644
index 000000000000..0969ba9088ca
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/arabic-zero-numbering.rtf
@@ -0,0 +1,14 @@
+{\rtf1
+{\*\listtable
+{\list
+{\listlevel\levelnfc22\levelstartat1
+{\leveltext\'02\'00.;}
+{\levelnumbers\'01;}
+}
+\listid0}
+}
+{\*\listoverridetable
+{\listoverride\listid0\ls1}
+}
+\pard\plain\ls1 A\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx
index 901b7b5a4f7b..04c1a0680a1e 100644
--- a/sw/qa/extras/rtfexport/rtfexport3.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport3.cxx
@@ -123,6 +123,19 @@ DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx")
     CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width >= 218 && cell2Width <= 220);
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.rtf")
+{
+    auto xNumberingRules
+        = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules");
+    comphelper::SequenceAsHashMap aMap(xNumberingRules->getByIndex(0));
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 64
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 DECLARE_RTFEXPORT_TEST(testTdf116841, "tdf116841.rtf")
 {
     // This was 0, left margin was ignored as we assumed the default is already
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 6313472bf728..f3d05263385b 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1488,6 +1488,9 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, sal_uInt16 nStart,
         case SVX_NUM_NUMBER_NONE:
             nVal = 255;
             break;
+        case SVX_NUM_ARABIC_ZERO:
+            nVal = 22;
+            break;
     }
     m_rExport.Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_LEVELNFC);
     m_rExport.OutULong(nVal);
commit 0172f58071be13178a9fd5d6a7e1143d5a2edf23
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Mar 4 11:22:09 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri May 15 10:00:48 2020 +0200

    sw padded numbering: add DOC filter
    
    [MS-OSHARED] 2.2.1.3 MSONFC says msonfcArabicLZ / 0x16 should be used
    for this.
    
    (cherry picked from commit a8a5fc175a8af2bf3750497d7ebe2c8ea9176981)
    
    Change-Id: I6bdf460d77acabf54cecc2ec2d2bca91bc814518

diff --git a/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc
new file mode 100644
index 000000000000..c198c4aa44d0
Binary files /dev/null and b/sw/qa/extras/ww8export/data/arabic-zero-numbering.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index d4a65e685f4a..925af30ba55e 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -51,6 +51,19 @@ DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.d
     CPPUNIT_ASSERT(drawing::FillStyle_NONE != getProperty<drawing::FillStyle>(xStyle, "FillStyle"));
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.doc")
+{
+    auto xNumberingRules
+        = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules");
+    comphelper::SequenceAsHashMap aMap(xNumberingRules->getByIndex(0));
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 64
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 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 afe0204a48cd..7300afca81e9 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -283,6 +283,10 @@ static sal_uInt8 GetLevelNFC(  sal_uInt16 eNumType, const SfxItemSet *pOutSet)
     case style::NumberingType::NUMBER_HANGUL_KO: nRet = 41; break;
     case style::NumberingType::NUMBER_UPPER_KO: nRet = 44; break;
     case SVX_NUM_NUMBER_NONE:           nRet = 0xff;    break;
+    case SVX_NUM_ARABIC_ZERO:
+        // 0x16, msonfcArabicLZ
+        nRet = 22;
+        break;
     }
     return nRet;
 }
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index c07da7e81efb..f0c1ab4e0c3b 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -751,6 +751,10 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet
             // actually: ORDINAL
             nType = SVX_NUM_ARABIC;
             break;
+        case 22:
+            // 0x16, msonfcArabicLZ
+            nType = SVX_NUM_ARABIC_ZERO;
+            break;
         case 23:
             nType = SVX_NUM_CHAR_SPECIAL;
             //For i120928,type info


More information about the Libreoffice-commits mailing list