[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - include/editeng sw/source

Vasily Melenchuk (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 23:13:10 UTC 2020


 include/editeng/numitem.hxx        |    8 ++++++--
 sw/source/core/doc/number.cxx      |    4 ++--
 sw/source/core/unocore/unosett.cxx |    7 ++++---
 sw/source/filter/ww8/wrtw8num.cxx  |    2 +-
 4 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit cdcbf109c47d366539b98c6e379874ae08de08e1
Author:     Vasily Melenchuk <vasily.melenchuk at cib.de>
AuthorDate: Fri May 15 18:17:34 2020 +0300
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Jun 5 01:12:37 2020 +0200

    tdf#120394: list format string can be empty
    
    We need to distunguish when we have list format string, but it
    is empty (no level text will be diplayed) or it does not exist
    at all, so we need to fallback to old prefix-suffix syntax.
    
    Change-Id: Ifd4ccd5a676db86c39d2ef48e91d191d92b9b2a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94322
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit d8329149394e4e5758a9e293b0162db050379a4e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95413

diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 52cb14858c1f..b1fa7c66b039 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -31,6 +31,7 @@
 #include <editeng/editengdllapi.h>
 #include <o3tl/typed_flags_set.hxx>
 #include <memory>
+#include <optional>
 #include <algorithm>
 
 class SvxBrushItem;
@@ -102,7 +103,9 @@ public:
 private:
     OUString            sPrefix;
     OUString            sSuffix;
-    OUString            sListFormat;        // Format string ">%1.%2<" can be used instead of prefix/suffix
+    std::optional<OUString> sListFormat;        // Format string ">%1.%2<" can be used instead of prefix/suffix
+                                                // Right now it is optional value to dostinguish empty list format
+                                                // and not set list format when we need to fallback to prefix/suffix.
 
     SvxAdjust           eNumAdjust;
 
@@ -168,7 +171,8 @@ public:
     void            SetSuffix(const OUString& rSet) { sSuffix = rSet;}
     const OUString& GetSuffix() const { return sSuffix;}
     void            SetListFormat(const OUString& rSet) { sListFormat = rSet; }
-    const OUString& GetListFormat() const { return sListFormat; }
+    bool            HasListFormat() const { return sListFormat.has_value(); }
+    const OUString& GetListFormat() const { return *sListFormat; }
 
     void                    SetCharFormatName(const OUString& rSet){ sCharStyleName = rSet; }
     virtual OUString        GetCharFormatName()const;
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index df3dcf76bfff..481ebfada8eb 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -641,9 +641,9 @@ OUString SwNumRule::MakeNumString( const SwNumberTree::tNumberVector & rNumVecto
         {
             css::lang::Locale aLocale( LanguageTag::convertToLocale(nLang));
 
-            OUString sLevelFormat = rMyNFormat.GetListFormat();
-            if (!sLevelFormat.isEmpty())
+            if (rMyNFormat.HasListFormat())
             {
+                OUString sLevelFormat = rMyNFormat.GetListFormat();
                 // In this case we are ignoring GetIncludeUpperLevels: we put all
                 // level nubers requested by level format
                 for (SwNumberTree::tNumberVector::size_type i=0; i <= nLevel; ++i)
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 8f0d95005a2a..1f68135f7a4a 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -1343,11 +1343,12 @@ uno::Sequence<beans::PropertyValue> SwXNumberingRules::GetPropertiesForNumFormat
     aPropertyValues.push_back(comphelper::makePropertyValue("Suffix", aUString));
 
     //listformat
-    aUString = rFormat.GetListFormat();
-    aPropertyValues.push_back(comphelper::makePropertyValue("ListFormat", aUString));
+    if (rFormat.HasListFormat())
+    {
+        aPropertyValues.push_back(comphelper::makePropertyValue("ListFormat", rFormat.GetListFormat()));
+    }
 
     //char style name
-
     aUString.clear();
     SwStyleNameMapper::FillProgName( rCharFormatName, aUString, SwGetPoolIdFromName::ChrFmt);
     aPropertyValues.push_back(comphelper::makePropertyValue("CharStyleName", aUString));
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index ffd793d6db79..d08a7703ce50 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -493,7 +493,7 @@ void MSWordExportBase::NumberingLevel(
     const vcl::Font* pBulletFont=nullptr;
     rtl_TextEncoding eChrSet=0;
     FontFamily eFamily=FAMILY_DECORATIVE;
-    if (!rRule.Get(nLvl).GetListFormat().isEmpty())
+    if (rRule.Get(nLvl).HasListFormat())
     {
         // Nothing to construct: we have it already
         sNumStr = rRule.Get(nLvl).GetListFormat();


More information about the Libreoffice-commits mailing list