[Libreoffice-commits] core.git: include/editeng sw/source

Justin Luth (via logerrit) logerrit at kemper.freedesktop.org
Tue Jan 26 16:01:27 UTC 2021


 include/editeng/numitem.hxx   |    2 +-
 sw/source/ui/misc/outline.cxx |    9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

New commits:
commit 55933f49f5a04708d27dc69e8778ec126646e3a5
Author:     Justin Luth <justin_luth at sil.org>
AuthorDate: Sat Jan 23 12:01:48 2021 +0300
Commit:     Justin Luth <justin_luth at sil.org>
CommitDate: Tue Jan 26 17:00:48 2021 +0100

    tdf#139147 sw outline UI: allow clearing of custom list format
    
    Since LO 6.4.5, primarily for DOCX support, numbering can
    have a custom format that ignores the suffix, prefix etc.
    Well, the UI has no way to see or edit that. So allow the
    UI to throw that away and go back to the normal
    prefix/subLevels/suffix model.
    
    Change-Id: I84f93d37c95dabb18facf9140bf8f85b4bac5006
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109839
    Tested-by: Jenkins
    Reviewed-by: Vasily Melenchuk <vasily.melenchuk at cib.de>
    Reviewed-by: Justin Luth <justin_luth at sil.org>

diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 961b5301206f..992f07b08241 100644
--- a/include/editeng/numitem.hxx
+++ b/include/editeng/numitem.hxx
@@ -172,7 +172,7 @@ public:
     const OUString& GetPrefix() const { return sPrefix;}
     void            SetSuffix(const OUString& rSet) { sSuffix = rSet;}
     const OUString& GetSuffix() const { return sSuffix;}
-    void            SetListFormat(const OUString& rSet) { sListFormat = rSet; }
+    void            SetListFormat(std::optional<OUString> oSet = std::nullopt) { sListFormat = oSet; }
     bool            HasListFormat() const { return sListFormat.has_value(); }
     const OUString& GetListFormat() const { return *sListFormat; }
 
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index bdaa59f9015f..f5a10e35177c 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -510,11 +510,12 @@ void    SwOutlineSettingsTabPage::Update()
         else
             m_xCharFormatLB->set_active_text(SwViewShell::GetShellRes()->aStrNone);
 
-        if(nTmpLevel)
+        if (nTmpLevel || rFormat.HasListFormat())
         {
             m_xAllLevelFT->set_sensitive(true);
             m_xAllLevelNF->set_sensitive(true);
             m_xAllLevelNF->set_max(nTmpLevel + 1);
+            m_xAllLevelNF->set_min(rFormat.HasListFormat() ? 0 : 1);
             m_xAllLevelNF->set_value(rFormat.GetIncludeUpperLevels());
         }
         else
@@ -560,6 +561,11 @@ IMPL_LINK(SwOutlineSettingsTabPage, ToggleComplete, weld::SpinButton&, rEdit, vo
             SwNumFormat aNumFormat(pNumRule->Get(i));
             aNumFormat.SetIncludeUpperLevels( std::min( static_cast<sal_uInt8>(rEdit.get_value()),
                                                 static_cast<sal_uInt8>(i + 1)) );
+            if (aNumFormat.HasListFormat())
+            {
+                aNumFormat.SetListFormat();  // clear custom format
+                m_xAllLevelNF->set_min(1);
+            }
             pNumRule->Set(i, aNumFormat);
         }
         nMask <<= 1;
@@ -644,6 +650,7 @@ IMPL_LINK_NOARG(SwOutlineSettingsTabPage, DelimModify, weld::Entry&, void)
             SwNumFormat aNumFormat(pNumRule->Get(i));
             aNumFormat.SetPrefix( m_xPrefixED->get_text() );
             aNumFormat.SetSuffix( m_xSuffixED->get_text() );
+            aNumFormat.SetListFormat();  // clear custom format
             pNumRule->Set(i, aNumFormat);
         }
         nMask <<= 1;


More information about the Libreoffice-commits mailing list