From 825d4da651aa9712dbf7bdfb13e27cea7a617443 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Thu, 24 Sep 2026 13:20:41 +0200 Subject: [PATCH] tdf#130857 cui: Create graphics bullet submenu when menu button is shown Trying to create and populate the submenu for the "Gallery" menu entry in the bullets and numbering dialog only when its menu button is clicked is too late, as the toggle handler isn't guaranteed to be called before the menu gets shown. Therefore, instead do this as soon as the menu button gets shown. This is similar to what commit 94564497514c4419062d13abad057255df9f369d Author: Michael Weghorn Date: Fri Jun 20 18:20:42 2025 +0200 tdf#167034 sd: Populate graphics bullet menu when creating dlg did for the Impress-specific bullets and numbering dialog, but now for the dialog used in other modules. Steps to reproduce: * start Writer * "Format" -> "Bullets and Numbering..." * go to "Customize" tab * select "Graphics" in the "Type" combobox * Press the "Select..." menu button * hover over the "Gallery" menu item to open its submenu Without this commit in place, the menu would not be shown unless using the gtk3 vcl plugin. For the vcl implementation (SalInstanceMenuButton), the submenu would be present after the menu button got clicked for the second time. For the implementation using native Qt widgets (QtInstanceMenuButton, enabled via SAL_VCL_QT_USE_WELDED_WIDGETS=1) the submen would even not be shown then. With this commit in place, the menu is now shown as expected already the first time for all 3 weld::MenuButton implementations. Change-Id: I9076efe1375360554701d76c5330494eceba1391 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211423 Reviewed-by: Michael Weghorn Tested-by: Jenkins --- cui/source/inc/numpages.hxx | 3 ++- cui/source/tabpages/numpages.cxx | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cui/source/inc/numpages.hxx b/cui/source/inc/numpages.hxx index b10aa07255af..a2af733f6d23 100644 --- a/cui/source/inc/numpages.hxx +++ b/cui/source/inc/numpages.hxx @@ -289,7 +289,6 @@ class SvxNumOptionsTabPage : public SfxTabPage DECL_LINK(NumberTypeSelectHdl_Impl, weld::ComboBox&, void); DECL_LINK(LevelHdl_Impl, weld::ItemView&, void); DECL_LINK(LevelHdl, void *, void); - DECL_LINK(PopupActivateHdl_Impl, weld::Toggleable&, void); DECL_LINK(GraphicHdl_Impl, const OUString&, void); DECL_LINK(BulletHdl_Impl, weld::Button&, void); DECL_LINK(SizeHdl_Impl, weld::MetricSpinButton&, void); @@ -306,6 +305,8 @@ class SvxNumOptionsTabPage : public SfxTabPage DECL_LINK(PreviewInvalidateHdl_Impl, Timer*, void); void EditModifyHdl_Impl(const weld::TextWidget*); + void CreateGalleryMenu(); + public: SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet); virtual ~SvxNumOptionsTabPage() override; diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 965eaa7a85be..99e2fc54110a 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -1197,7 +1197,6 @@ SvxNumOptionsTabPage::SvxNumOptionsTabPage(weld::Container* pPage, weld::DialogC m_xBulletPB->connect_clicked(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl)); m_xFmtLB->connect_changed(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl)); m_xBitmapMB->connect_selected(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl)); - m_xBitmapMB->connect_toggled(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl)); m_xLevelLB->set_selection_mode(SelectionMode::Multiple); m_xLevelLB->connect_selection_changed(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl)); m_xCharFmtLB->connect_changed(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl)); @@ -1690,6 +1689,8 @@ void SvxNumOptionsTabPage::SwitchNumberType( NumberType nType ) m_xBitmapFT->set_visible(bBitmap); m_xBitmapMB->set_visible(bBitmap); + if (bBitmap) + CreateGalleryMenu(); m_xWidthFT->set_visible(bBitmap); m_xWidthMF->set_visible(bBitmap); @@ -2050,7 +2051,7 @@ IMPL_LINK(SvxNumOptionsTabPage, GraphicHdl_Impl, const OUString&, rIdent, void) m_aInvalidateTimer.Start(); } -IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl, weld::Toggleable&, void) +void SvxNumOptionsTabPage::CreateGalleryMenu() { if (m_xGalleryMenu) return;