summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-01-21 16:26:38 +0000
committerCaolán McNamara <caolanm@redhat.com>2022-01-21 20:53:22 +0100
commitf05f92f09d99c48a96a3ef18943c265a803e3820 (patch)
tree4fccb616ce0e871cb8ff3f8e0bce968b775dede0
parentab234f749cc4a213711e389d29ced9a169bfa090 (diff)
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/+/128737 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/source/ui/chrdlg/numpara.cxx14
1 files 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);