From ed4b306d95895ae1a3a179f3a8ce15ff940f52e6 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 27 Aug 2024 16:51:04 +0200 Subject: tdf#161805 cui: Populate line tab menus when page gets created Since commit f075fa01cb4f74185f13eb0a8d7f84cf1f47af49 Author: Michael Weghorn Date: Tue Aug 22 10:26:32 2023 +0200 tdf#141101 tdf#101886 a11y: Restore previous focus on col/line popup close , the menu button toggled handler is no more called before the menu shows. `SvxLineTabPage` was relying on the old behavior and only populating the menu entries in the handler, resulting in them not being present any more the first time the menu gets opened after the above commit. Populate the menu items when the tab page gets created instead, by changing the handler to a regular method `SvxLineTabPage::PopulateMenus` that gets called from `SvxLineTabPage::Construct` (which already takes care of updating the list boxes in the tab page). Move the call to `SvxLineTabPage::Construct` to the end of `SvxLineTabPage::PageCreated`, as `SvxLineTabPage::PopulateMenus` makes use of `m_pSymbolList` and `m_xSymbolAttr` that were previously only set after the call to `SvxLineTabPage::Construct`. Change-Id: I521a50f3a3695f20f789add89ffd88749e3b5cd2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172472 Tested-by: Jenkins Reviewed-by: Michael Weghorn (cherry picked from commit de1c7a2f54117202d91b1d2d693fa4c1a761aa87) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172487 Reviewed-by: Adolfo Jayme Barrientos --- cui/source/inc/cuitabline.hxx | 2 +- cui/source/tabpages/tpline.cxx | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'cui') diff --git a/cui/source/inc/cuitabline.hxx b/cui/source/inc/cuitabline.hxx index 1122a2017f00..5cd3b0fdb044 100644 --- a/cui/source/inc/cuitabline.hxx +++ b/cui/source/inc/cuitabline.hxx @@ -172,7 +172,6 @@ private: // handler for gallery popup menu button + size DECL_LINK(GraphicHdl_Impl, const OUString&, void); DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void); - DECL_LINK(MenuCreateHdl_Impl, weld::Toggleable&, void); DECL_LINK(RatioHdl_Impl, weld::Toggleable&, void); DECL_LINK(ClickInvisibleHdl_Impl, weld::ComboBox&, void); @@ -196,6 +195,7 @@ private: void FillXLSet_Impl(); void FillListboxes(); + void PopulateMenus(); public: void ShowSymbolControls(bool bOn); diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx index f07ca7a3497c..de9ee3b8c80a 100644 --- a/cui/source/tabpages/tpline.cxx +++ b/cui/source/tabpages/tpline.cxx @@ -181,7 +181,6 @@ SvxLineTabPage::SvxLineTabPage(weld::Container* pPage, weld::DialogController* p // Symbols on a line (eg star charts), MB-handler set m_xSymbolMB->connect_selected(LINK(this, SvxLineTabPage, GraphicHdl_Impl)); - m_xSymbolMB->connect_toggled(LINK(this, SvxLineTabPage, MenuCreateHdl_Impl)); m_xSymbolWidthMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl)); m_xSymbolHeightMF->connect_value_changed(LINK(this, SvxLineTabPage, SizeHdl_Impl)); m_xSymbolRatioCB->connect_toggled(LINK(this, SvxLineTabPage, RatioHdl_Impl)); @@ -215,6 +214,7 @@ SvxLineTabPage::~SvxLineTabPage() void SvxLineTabPage::Construct() { FillListboxes(); + PopulateMenus(); } void SvxLineTabPage::FillListboxes() @@ -1376,9 +1376,7 @@ void SvxLineTabPage::FillUserData() } // #58425# Symbols on a list (e.g. StarChart) -// Handler for the symbol selection's popup menu (NumMenueButton) -// The following link originates from SvxNumOptionsTabPage -IMPL_LINK_NOARG(SvxLineTabPage, MenuCreateHdl_Impl, weld::Toggleable&, void) +void SvxLineTabPage::PopulateMenus() { ScopedVclPtrInstance< VirtualDevice > pVD; @@ -1681,7 +1679,6 @@ void SvxLineTabPage::PageCreated(const SfxAllItemSet& aSet) SetPageType(static_cast(pPageTypeItem->GetValue())); if (pDlgTypeItem) SetDlgType(pDlgTypeItem->GetValue()); - Construct(); if(pSdrObjListItem) //symbols { @@ -1692,6 +1689,8 @@ void SvxLineTabPage::PageCreated(const SfxAllItemSet& aSet) if(pGraphicItem) m_aAutoSymbolGraphic = pGraphicItem->GetGraphic(); } + + Construct(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit