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@cib.de>
Reviewed-by: Justin Luth <justin_luth@sil.org>
diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx
index 961b530..992f07b 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 bdaa59f9..f5a10e3 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;