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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon May 18 15:39:46 UTC 2020


 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx   |   28 +++++++++++++++++++++++++
 sw/qa/extras/ww8export/ww8export3.cxx        |   30 +++++++++++++++++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    3 ++
 sw/source/filter/ww8/wrtw8num.cxx            |    1 
 sw/source/filter/ww8/ww8atr.cxx              |    4 +++
 sw/source/filter/ww8/ww8par3.cxx             |    4 +++
 6 files changed, 70 insertions(+)

New commits:
commit 68fc9688f36f420e16f87de4da3b3ce75288b76c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 6 10:44:19 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon May 18 17:39:10 2020 +0200

    sw chicago numbering: add DOC footnote export
    
    Note that chicago numbering can't be used for paragraph numbering. It
    would be possible technically, but the spec && bffvalidator && Word
    agrees on forbidding that.
    
    Change-Id: Ic3de51f9724d399542f4fe6ac48e70e94c6ea4ba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90080
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 9a1dd2e242794b4f26d207efc80a2f5bc088ab7c)

diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx
index 84677fb3403c..38e79fed25e5 100644
--- a/sw/qa/extras/ww8export/ww8export3.cxx
+++ b/sw/qa/extras/ww8export/ww8export3.cxx
@@ -95,6 +95,36 @@ CPPUNIT_TEST_FIXTURE(SwModelTestBase, testArabicZeroNumberingFootnote)
     CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
 }
 
+CPPUNIT_TEST_FIXTURE(SwModelTestBase, testChicagoNumberingFootnote)
+{
+    // Create a document, set footnote numbering type to SYMBOL_CHICAGO.
+    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::SYMBOL_CHICAGO;
+    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::SYMBOL_CHICAGO;
+    auto nActual = getProperty<sal_uInt16>(xFootnotesSupplier->getFootnoteSettings(), "NumberingType");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 63
+    // - Actual  : 4
+    // i.e. the numbering type was ARABIC, not SYMBOL_CHICAGO.
+    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 59f69e506686..b89d40445e50 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -288,6 +288,7 @@ 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;
+    // No SVX_NUM_SYMBOL_CHICAGO here: LVLF can't contain 0x09, msonfcChiManSty.
     case SVX_NUM_ARABIC_ZERO:
         // 0x16, msonfcArabicLZ
         nRet = 22;
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 18a9da4e8d50..2f487133997d 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_SYMBOL_CHICAGO:
+        // 0x09, msonfcChiManSty
+        nRet = 9;
+        break;
     case SVX_NUM_ARABIC_ZERO:
         // 0x16, msonfcArabicLZ
         nRet = 22;
diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx
index 966fb66fb121..0158c950db31 100644
--- a/sw/source/filter/ww8/ww8par3.cxx
+++ b/sw/source/filter/ww8/ww8par3.cxx
@@ -540,6 +540,10 @@ SvxNumType WW8ListManager::GetSvxNumTypeFromMSONFC(sal_uInt16 nNFC)
             // actually: ORDINAL
             nType = SVX_NUM_ARABIC;
             break;
+        case 9:
+            // 0x09, msonfcChiManSty
+            nType = SVX_NUM_SYMBOL_CHICAGO;
+            break;
         case 22:
             // 0x16, msonfcArabicLZ
             nType = SVX_NUM_ARABIC_ZERO;
commit 2d327742d99799c543ad579fc0a570231e870595
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 6 09:05:07 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon May 18 17:39:10 2020 +0200

    sw chicago numbering: add DOCX footnote export
    
    Only this was missing, paragraph numbering import/export and footnote
    numbering import was already working.
    
    Change-Id: Ia5966cc7f1308ba81bebc1bf628d8efb17acb713
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90075
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit ddbad5612e4322665bc70f4a026e5b052bcaf344)

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 100deecef305..71e17ec25964 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -149,6 +149,34 @@ CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote)
     assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "decimalZero");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testChicagoNumberingFootnote)
+{
+    // Create a document, set footnote numbering type to SYMBOL_CHICAGO.
+    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::SYMBOL_CHICAGO;
+    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 SYMBOL_CHICAGO.
+    assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:footnotePr/w:numFmt", "val", "chicago");
+}
+
 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 a2e8bebfd6e4..c4f01bbcb804 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -7818,6 +7818,9 @@ void DocxAttributeOutput::WriteFootnoteEndnotePr( ::sax_fastparser::FSHelperPtr
         case SVX_NUM_CHAR_SPECIAL:
             fmt = "bullet";
             break;
+        case SVX_NUM_SYMBOL_CHICAGO:
+            fmt = "chicago";
+            break;
         case SVX_NUM_ARABIC_ZERO:
             fmt = "decimalZero";
             break;


More information about the Libreoffice-commits mailing list