diff options
author | Seth Chaiklin <sdc.blanco@youmail.dk> | 2020-01-21 16:38:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-01-28 22:18:03 +0100 |
commit | 62821018c01674e75108898c0f5c9ddb3333cc66 (patch) | |
tree | 7531801cce771d8af48b8f3fc9558d5862a5cdee /cui | |
parent | 090cf1e3bbe0ffaf56f22b152b73578483be2f42 (diff) |
tdf#127112 repair "sticky" levels in Customize numbering style dialog
Change-Id: Ifa841e7b63b28d6e0f84f5cd6b1800481b36425b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87149
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/numpages.hxx | 3 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 29 |
2 files changed, 27 insertions, 5 deletions
diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index 11e8e1846219..3a3cf0692259 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -203,6 +203,8 @@ class SvxNumOptionsTabPage : public SfxTabPage Size aInitSize[SVX_MAX_NUM]; + ImplSVEvent* m_pLevelHdlEvent; + bool bLastWidthModified : 1; bool bModified : 1; bool bPreset : 1; @@ -262,6 +264,7 @@ class SvxNumOptionsTabPage : public SfxTabPage DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void); DECL_LINK(LevelHdl_Impl, weld::TreeView&, void); + DECL_LINK(LevelHdl, void *, void); DECL_LINK(PopupActivateHdl_Impl, weld::ToggleButton&, void); DECL_LINK(GraphicHdl_Impl, const OString&, void); DECL_LINK(BulletHdl_Impl, weld::Button&, void); diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 222349d0c583..96393cb8c26a 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -1013,6 +1013,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, ClickAddBrowseHdl_Impl, weld::Button&, voi SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) : SfxTabPage(pPage, pController, "cui/ui/numberingoptionspage.ui", "NumberingOptionsPage", &rSet) + , m_pLevelHdlEvent(nullptr) , bLastWidthModified(false) , bModified(false) , bPreset(false) @@ -1109,6 +1110,11 @@ SvxNumOptionsTabPage::~SvxNumOptionsTabPage() m_xBulColLB.reset(); pActNum.reset(); pSaveNum.reset(); + if (m_pLevelHdlEvent) + { + Application::RemoveUserEvent(m_pLevelHdlEvent); + m_pLevelHdlEvent = nullptr; + } } void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric) @@ -1151,6 +1157,7 @@ void SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet) { nActNumLvl = nTmpNumLvl; sal_uInt16 nMask = 1; + m_xLevelLB->unselect_all(); if (nActNumLvl == SAL_MAX_UINT16) m_xLevelLB->select(pActNum->GetLevelCount()); if(nActNumLvl != SAL_MAX_UINT16) @@ -1546,17 +1553,29 @@ void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType ) m_xOrientLB->set_sensitive(bEnableBitmap); } -IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void) +IMPL_LINK_NOARG(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, void) { + if (m_pLevelHdlEvent) + return; + // tdf#127112 (borrowing tdf#127120 solution) multiselection may be implemented by deselect follow by select so + // fire off the handler to happen on next event loop and only process the + // final state + m_pLevelHdlEvent = Application::PostUserEvent(LINK(this, SvxNumOptionsTabPage, LevelHdl)); +} + +IMPL_LINK_NOARG(SvxNumOptionsTabPage, LevelHdl, void*, void) +{ + m_pLevelHdlEvent = nullptr; + sal_uInt16 nSaveNumLvl = nActNumLvl; nActNumLvl = 0; - auto aSelectedRows = rBox.get_selected_rows(); + std::vector<int> aSelectedRows = m_xLevelLB->get_selected_rows(); if (std::find(aSelectedRows.begin(), aSelectedRows.end(), pActNum->GetLevelCount()) != aSelectedRows.end() && (aSelectedRows.size() == 1 || nSaveNumLvl != 0xffff)) { nActNumLvl = 0xFFFF; for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ ) - rBox.unselect(i); + m_xLevelLB->unselect(i); } else if (!aSelectedRows.empty()) { @@ -1567,7 +1586,7 @@ IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void) nActNumLvl |= nMask; nMask <<= 1; } - rBox.unselect(pActNum->GetLevelCount()); + m_xLevelLB->unselect(pActNum->GetLevelCount()); } else { @@ -1577,7 +1596,7 @@ IMPL_LINK(SvxNumOptionsTabPage, LevelHdl_Impl, weld::TreeView&, rBox, void) { if(nActNumLvl & nMask) { - rBox.select(i); + m_xLevelLB->select(i); break; } nMask <<=1; |