[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 4 commits - i18npool/qa i18npool/source include/editeng offapi/com sw/qa sw/source writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Wed May 20 10:30:07 UTC 2020


 i18npool/qa/cppunit/test_defaultnumberingprovider.cxx                 |   29 ++++++++++
 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |    6 ++
 include/editeng/svxenum.hxx                                           |    1 
 offapi/com/sun/star/style/NumberingType.idl                           |    7 ++
 sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt                |binary
 sw/qa/extras/odfexport/data/arabic-zero5-numbering.odt                |binary
 sw/qa/extras/odfexport/odfexport.cxx                                  |   26 ++++++++
 sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx             |binary
 sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx             |binary
 sw/qa/extras/ooxmlexport/ooxmlexport14.cxx                            |   26 ++++++++
 sw/qa/extras/tiledrendering/data/fieldmark.docx                       |binary
 sw/qa/extras/tiledrendering/tiledrendering.cxx                        |    8 ++
 sw/source/core/crsr/viscrs.cxx                                        |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx                          |    8 ++
 writerfilter/source/dmapper/ConversionHelper.cxx                      |    8 ++
 15 files changed, 120 insertions(+), 1 deletion(-)

New commits:
commit 76854c4fc4496b784c5cbbd2ac8b8209341508b7
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Wed Apr 15 12:27:55 2020 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 20 12:29:33 2020 +0200

    sw: avoid calling SwView::GetWrtShell() unconditionally from the SwView ctor
    
    Regression from commit dfcfdf47b5da6a11b2c3118a0f63cc48c10c2cd7 (lok:
    get spelling context menu on long press, 2019-10-20), the problem was
    that GetWrtShell() returns a reference, and the underlying pointer can
    be nullptr till the SwView ctor is in progress.
    
    Fix the problem by not caring about spelling till the initial view is
    ready, that still provides the cursor position.
    
    (cherry picked from commit ae3342857350c805f536c1af2f560a117be12da8)
    
    Change-Id: I5580a1b36b83e0a4cb8495f41e7087c784f6c83c

diff --git a/sw/qa/extras/tiledrendering/data/fieldmark.docx b/sw/qa/extras/tiledrendering/data/fieldmark.docx
new file mode 100644
index 000000000000..02748bb7e182
Binary files /dev/null and b/sw/qa/extras/tiledrendering/data/fieldmark.docx differ
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index bf1aaa9e3e98..4dd2a681d42f 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -124,6 +124,7 @@ public:
     void testLanguageStatus();
     void testRedlineNotificationDuringSave();
     void testHyperlink();
+    void testFieldmark();
 
     CPPUNIT_TEST_SUITE(SwTiledRenderingTest);
     CPPUNIT_TEST(testRegisterCallback);
@@ -187,6 +188,7 @@ public:
     CPPUNIT_TEST(testLanguageStatus);
     CPPUNIT_TEST(testRedlineNotificationDuringSave);
     CPPUNIT_TEST(testHyperlink);
+    CPPUNIT_TEST(testFieldmark);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2512,6 +2514,12 @@ void SwTiledRenderingTest::testHyperlink()
     CPPUNIT_ASSERT_EQUAL(OString("http://example.com/"), m_sHyperlinkLink);
 }
 
+void SwTiledRenderingTest::testFieldmark()
+{
+    // Without the accompanying fix in place, this crashed on load.
+    createDoc("fieldmark.docx");
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 1c835725c2c9..d759598abff3 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -212,7 +212,7 @@ void SwVisibleCursor::SetPosAndShow(SfxViewShell const * pViewShell)
 
         // is cursor at a mispelled word ?
         bool bIsWrong = false;
-        if (pView)
+        if (pView && pView->GetWrtShellPtr())
         {
             const SwViewOption* pVOpt = pView->GetWrtShell().GetViewOptions();
             if(pVOpt && pVOpt->IsOnlineSpell())
commit 0606e372e7db305fe8e59ce04cefe270d866be9c
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Mar 23 13:37:25 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 20 12:29:33 2020 +0200

    sw: add pad-to-5 numbering
    
    This is the last padded numbering type that is supported by Word but was
    not supported by Writer.
    
    (cherry picked from commit 8540c7b18bae9c9b46e6feb7658198a7fc62e811)
    
    Change-Id: Ica1a0843897c61a4b569105fd21e5bfe7b5012cb

diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx
index e5991ee6461d..b3d3b42963a8 100644
--- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx
+++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx
@@ -110,6 +110,35 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4)
     CPPUNIT_ASSERT_EQUAL(OUString("1000"), aActual);
 }
 
+CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5)
+{
+    uno::Reference<uno::XComponentContext> xComponentContext
+        = comphelper::getComponentContext(getMultiServiceFactory());
+
+    // 1000 -> "01000"
+    uno::Reference<text::XNumberingFormatter> xFormatter(
+        text::DefaultNumberingProvider::create(xComponentContext), uno::UNO_QUERY);
+    uno::Sequence<beans::PropertyValue> aProperties = {
+        comphelper::makePropertyValue("NumberingType",
+                                      static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5)),
+        comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1000)),
+    };
+    lang::Locale aLocale;
+    OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+    // Without the accompanying fix in place, this test would have failed with a
+    // lang.IllegalArgumentException, support for ARABIC_ZERO5 was missing.
+    CPPUNIT_ASSERT_EQUAL(OUString("01000"), aActual);
+
+    // 10000 -> "10000"
+    aProperties = {
+        comphelper::makePropertyValue("NumberingType",
+                                      static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5)),
+        comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10000)),
+    };
+    aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+    CPPUNIT_ASSERT_EQUAL(OUString("10000"), aActual);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index d65c700ad278..43d5848b8dec 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -949,6 +949,10 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
                result += lcl_formatArabicZero(number, 4);
                break;
 
+          case ARABIC_ZERO5:
+               result += lcl_formatArabicZero(number, 5);
+               break;
+
           default:
                OSL_ASSERT(false);
                throw IllegalArgumentException();
@@ -1050,6 +1054,7 @@ static const Supported_NumberingType aSupportedTypes[] =
         {style::NumberingType::ARABIC_ZERO, "01, 02, 03, ...", LANG_ALL},
         {style::NumberingType::ARABIC_ZERO3, "001, 002, 003, ...", LANG_ALL},
         {style::NumberingType::ARABIC_ZERO4, "0001, 0002, 0003, ...", LANG_ALL},
+        {style::NumberingType::ARABIC_ZERO5, "00001, 00002, 00003, ...", LANG_ALL},
 };
 static const sal_Int32 nSupported_NumberingTypes = SAL_N_ELEMENTS(aSupportedTypes);
 
diff --git a/include/editeng/svxenum.hxx b/include/editeng/svxenum.hxx
index b020ebd26e50..fb614738366e 100644
--- a/include/editeng/svxenum.hxx
+++ b/include/editeng/svxenum.hxx
@@ -209,6 +209,7 @@ enum SvxNumType : sal_Int16
     SVX_NUM_ARABIC_ZERO           = css::style::NumberingType::ARABIC_ZERO,
     SVX_NUM_ARABIC_ZERO3          = css::style::NumberingType::ARABIC_ZERO3,
     SVX_NUM_ARABIC_ZERO4          = css::style::NumberingType::ARABIC_ZERO4,
+    SVX_NUM_ARABIC_ZERO5          = css::style::NumberingType::ARABIC_ZERO5,
 };
 
 #endif
diff --git a/offapi/com/sun/star/style/NumberingType.idl b/offapi/com/sun/star/style/NumberingType.idl
index e19bd25aecd3..be00efc3cfd0 100644
--- a/offapi/com/sun/star/style/NumberingType.idl
+++ b/offapi/com/sun/star/style/NumberingType.idl
@@ -513,6 +513,13 @@ published constants NumberingType
         @since LibreOffice 7.0
      */
     const short ARABIC_ZERO4 = 66;
+
+    /** Numbering is in Arabic numbers, padded with zero to have a length of at least five, as
+        "00001, 00002, ..., 10000, 10001, ...".
+
+        @since LibreOffice 7.0
+     */
+    const short ARABIC_ZERO5 = 67;
 };
 
 
diff --git a/sw/qa/extras/odfexport/data/arabic-zero5-numbering.odt b/sw/qa/extras/odfexport/data/arabic-zero5-numbering.odt
new file mode 100644
index 000000000000..3526ee8d7086
Binary files /dev/null and b/sw/qa/extras/odfexport/data/arabic-zero5-numbering.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index cdee2ebb7c81..b727bcf4fecf 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2374,5 +2374,18 @@ DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering, "arabic-zero4-numbering.odt")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering, "arabic-zero5-numbering.odt")
+{
+    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: 67
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO5.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx b/sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx
new file mode 100644
index 000000000000..f7df2c5267fe
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 564511acc3d1..894cd869672d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -147,6 +147,19 @@ DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering, "arabic-zero4-numbering.docx")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering, "arabic-zero5-numbering.docx")
+{
+    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: 67
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO5.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO5),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote)
 {
     // Create a document, set footnote numbering type to ARABIC_ZERO.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 569a62fc2fd2..a467a3cfc069 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6382,6 +6382,10 @@ static OString impl_LevelNFC(sal_uInt16 nNumberingType, const SfxItemSet* pOutSe
             aType = "custom";
             rFormat = "0001, 0002, 0003, ...";
             break;
+        case style::NumberingType::ARABIC_ZERO5:
+            aType = "custom";
+            rFormat = "00001, 00002, 00003, ...";
+            break;
 /*
         Fallback the rest to decimal.
         case style::NumberingType::NATIVE_NUMBERING:
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index 6758c58b284a..3809e2b7dae0 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -626,6 +626,10 @@ sal_Int16 ConvertCustomNumberFormat(const OUString& rFormat)
     {
         nRet = style::NumberingType::ARABIC_ZERO4;
     }
+    else if (rFormat == "00001, 00002, 00003, ...")
+    {
+        nRet = style::NumberingType::ARABIC_ZERO5;
+    }
 
     return nRet;
 }
commit 208137141990c4d56eaa492f1b4d84de614cae5a
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 20 17:54:02 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 20 12:29:33 2020 +0200

    sw pad-to-4 numbering: add DOCX filter
    
    Now that style::NumberingType::ARABIC_ZERO3 is already handled, this is
    much easier.
    
    (cherry picked from commit d7b6269bd5414ca0aa502a2fef7a838bcfbc1161)
    
    Change-Id: Ibe76d90253a5bfad84560395502590a380d559d2

diff --git a/sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx b/sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx
new file mode 100644
index 000000000000..6779d85989a9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/arabic-zero4-numbering.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 379ae540bb46..564511acc3d1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -134,6 +134,19 @@ DECLARE_ODFEXPORT_TEST(testArabicZero3Numbering, "arabic-zero3-numbering.docx")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering, "arabic-zero4-numbering.docx")
+{
+    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: 66
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO4.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testArabicZeroNumberingFootnote)
 {
     // Create a document, set footnote numbering type to ARABIC_ZERO.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index fafd5c5d189b..569a62fc2fd2 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6378,6 +6378,10 @@ static OString impl_LevelNFC(sal_uInt16 nNumberingType, const SfxItemSet* pOutSe
             aType = "custom";
             rFormat = "001, 002, 003, ...";
             break;
+        case style::NumberingType::ARABIC_ZERO4:
+            aType = "custom";
+            rFormat = "0001, 0002, 0003, ...";
+            break;
 /*
         Fallback the rest to decimal.
         case style::NumberingType::NATIVE_NUMBERING:
diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx
index d8ca06e5ed34..6758c58b284a 100644
--- a/writerfilter/source/dmapper/ConversionHelper.cxx
+++ b/writerfilter/source/dmapper/ConversionHelper.cxx
@@ -622,6 +622,10 @@ sal_Int16 ConvertCustomNumberFormat(const OUString& rFormat)
     {
         nRet = style::NumberingType::ARABIC_ZERO3;
     }
+    else if (rFormat == "0001, 0002, 0003, ...")
+    {
+        nRet = style::NumberingType::ARABIC_ZERO4;
+    }
 
     return nRet;
 }
commit 018df1ad348660e2e90d79ea70b3c40c98298bf8
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri Mar 20 17:27:21 2020 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed May 20 12:29:33 2020 +0200

    sw pad-to-4 numbering: add ODF filter
    
    This makes the UI work as well.
    
    (cherry picked from commit 5b071c10d36371d1f9ce14ab13230bfd703d0245)
    
    Change-Id: I4e94b85097cc359b257b07ba7517edfab3011093

diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 5f79508a6766..d65c700ad278 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -1049,6 +1049,7 @@ static const Supported_NumberingType aSupportedTypes[] =
         {style::NumberingType::CHARS_GREEK_LOWER_LETTER,   S_GR_A ", " S_GR_B ", ... (gr)", LANG_ALL},
         {style::NumberingType::ARABIC_ZERO, "01, 02, 03, ...", LANG_ALL},
         {style::NumberingType::ARABIC_ZERO3, "001, 002, 003, ...", LANG_ALL},
+        {style::NumberingType::ARABIC_ZERO4, "0001, 0002, 0003, ...", LANG_ALL},
 };
 static const sal_Int32 nSupported_NumberingTypes = SAL_N_ELEMENTS(aSupportedTypes);
 
diff --git a/sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt b/sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt
new file mode 100644
index 000000000000..2eb9b49cedaa
Binary files /dev/null and b/sw/qa/extras/odfexport/data/arabic-zero4-numbering.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 550d7079a089..cdee2ebb7c81 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2361,5 +2361,18 @@ DECLARE_ODFEXPORT_TEST(testArabicZero3Numbering, "arabic-zero3-numbering.odt")
                          aMap["NumberingType"].get<sal_uInt16>());
 }
 
+DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering, "arabic-zero4-numbering.odt")
+{
+    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: 66
+    // - Actual  : 4
+    // i.e. numbering type was ARABIC, not ARABIC_ZERO4.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(style::NumberingType::ARABIC_ZERO4),
+                         aMap["NumberingType"].get<sal_uInt16>());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list