From f05f92f09d99c48a96a3ef18943c265a803e3820 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 21 Jan 2022 16:26:38 +0000 Subject: tdf#146891 there is a case where "chapter numbering" can be changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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/+/128737 Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara --- sw/source/ui/chrdlg/numpara.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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); -- cgit