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

New commits:
commit 89516b2be525a01862eacdef2276f0699ed87e3d
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Sat Jan 23 12:01:48 2021 +0300
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jan 27 11:35:34 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.melenc...@cib.de>
    Reviewed-by: Justin Luth <justin_l...@sil.org>
    (cherry picked from commit 55933f49f5a04708d27dc69e8778ec126646e3a5)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109975
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

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 bef52a28777c..4553025946ea 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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to