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 9456449751
  Author: Michael Weghorn <m.weghorn@posteo.de>
  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 <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn
2026-09-24 15:01:29 +02:00
parent 6761f30360
commit 825d4da651
2 changed files with 5 additions and 3 deletions
+2 -1
View File
@@ -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;
+3 -2
View File
@@ -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;