sw/source/ui/chrdlg/numpara.cxx |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

New commits:
commit da3931fac6388716de4ac7cd402f635dc0b377e9
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri Jan 21 16:26:38 2022 +0000
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Sat Jan 22 04:48:09 2022 +0100

    tdf#146891 there is a case where "chapter numbering" can be changed
    
    where "Chapter Numbering" is present but the list is editable, so
    we can't be sure that just adding "Chapter Numbering" for display
    purposes is safe enough, so add a specific id for the "pseudo" list
    style and check for that id (instead of the name) to determine the
    additional case where "Edit" button cannot be enabled
    
    Related: tdf#145804 show "Chapter Numbering" as (uneditable) list style
    Change-Id: I35d852523314c985ea5b7217e9394ac3e9c6e331
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128679
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx
index 00e9a3b607bd..205bcacadb6f 100644
--- a/sw/source/ui/chrdlg/numpara.cxx
+++ b/sw/source/ui/chrdlg/numpara.cxx
@@ -184,10 +184,12 @@ void SwParagraphNumTabPage::Reset(const SfxItemSet* rSet)
 
         if( aStyle == "Outline")
         {
-            // tdf#145804 show "Chapter Numbering"
-            assert(!m_xNumberStyleBX->get_sensitive() && "pseudo entry 
shouldn't be editable");
-            m_xNumberStyleLB->append_text(msOutlineNumbering);
-            m_xNumberStyleLB->set_active_text(msOutlineNumbering);
+            if (m_xNumberStyleLB->find_id("pseudo") == -1)
+            {
+                // tdf#145804 show "Chapter Numbering"
+                m_xNumberStyleLB->append("pseudo", msOutlineNumbering);
+            }
+            m_xNumberStyleLB->set_active_id("pseudo");
             m_xNumberStyleLB->save_value();
         }
         else
@@ -291,8 +293,8 @@ IMPL_LINK_NOARG(SwParagraphNumTabPage, LineCountHdl_Impl, 
weld::Toggleable&, voi
 IMPL_LINK_NOARG(SwParagraphNumTabPage, EditNumStyleSelectHdl_Impl, 
weld::ComboBox&, void)
 {
     int numSelectPos = m_xNumberStyleLB->get_active();
-    // 0 is "None" and -1 is unselected state
-    if (numSelectPos == 0 || numSelectPos == -1)
+    // 0 is "None" and -1 is unselected state and a "pseudo" is uneditable 
"Chapter Numbering"
+    if (numSelectPos == 0 || numSelectPos == -1 || 
m_xNumberStyleLB->get_active_id() == "pseudo")
         m_xEditNumStyleBtn->set_sensitive(false);
     else
         m_xEditNumStyleBtn->set_sensitive(true);

Reply via email to