[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source vcl/unx
include/vcl/weld.hxx |1 + sfx2/source/control/templatedlglocalview.cxx | 10 ++ sfx2/source/inc/helpids.h|8 vcl/inc/salvtables.hxx |1 + vcl/source/app/salvtables.cxx|7 +++ vcl/unx/gtk3/gtkinst.cxx |5 + 6 files changed, 32 insertions(+) New commits: commit 65c91bd5aa6f9b68390739a0e027d23c8a32da08 Author: Rafael Lima AuthorDate: Fri Jul 21 14:47:47 2023 +0200 Commit: Caolán McNamara CommitDate: Sun Jul 23 15:07:11 2023 +0200 tdf#147911 Implement set_item_help_id for context menu items This patch adds the method set_item_help_id for weld::Menu (similarly to what we already have for weld::Toolbar). This way, it is possible to define help IDs for each entry in context menus that are created during runtime. This is necessary to fix various bug tickets that request F1 to redirect to the corresponding help page when a context menu item has focus. This currently works for context menus created from XML files, but fails for context menus created during runtime. Besides implementing the new method, this patch fixes bug 147911 (see changes in file templatedlglocalview.cxx) to showcase how set_item_help_id can be used. NOTE: Pressing F1 in context menus only work with "gen" and "win"... unfortunately it does not work in kf5 and gtk3 due to a separate bug (see bug 156376). Change-Id: Ic9bb1bca3e646cb4d0b879d8672c5dcc9c19c4c9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154699 Tested-by: Jenkins Tested-by: Caolán McNamara Reviewed-by: Caolán McNamara diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 4c198b3ecc99..c03f78d6c0e1 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2419,6 +2419,7 @@ public: TriState eCheckRadioFalse) = 0; +virtual void set_item_help_id(const OUString& rIdent, const OUString& rHelpId) = 0; virtual void remove(const OUString& rId) = 0; virtual void clear() = 0; diff --git a/sfx2/source/control/templatedlglocalview.cxx b/sfx2/source/control/templatedlglocalview.cxx index b469ea716dc8..52a12b4ef965 100644 --- a/sfx2/source/control/templatedlglocalview.cxx +++ b/sfx2/source/control/templatedlglocalview.cxx @@ -19,6 +19,7 @@ #include #include #include +#include #include TemplateDlgLocalView::TemplateDlgLocalView(std::unique_ptr xWindow, @@ -113,6 +114,15 @@ void TemplateDlgLocalView::createContextMenu(const bool bIsDefault, const bool b mxContextMenu->append("move", SfxResId(STR_MOVE), BMP_MENU_MOVE); mxContextMenu->append("export", SfxResId(STR_EXPORT), BMP_MENU_EXPORT); +// Set the help IDs of all context menu entries +mxContextMenu->set_item_help_id("open", HID_TEMPLATEDLG_OPEN); +mxContextMenu->set_item_help_id("edit", HID_TEMPLATEDLG_EDIT); +mxContextMenu->set_item_help_id("default", HID_TEMPLATEDLG_DEFAULT); +mxContextMenu->set_item_help_id("rename", HID_TEMPLATEDLG_RENAME); +mxContextMenu->set_item_help_id("delete", HID_TEMPLATEDLG_DELETE); +mxContextMenu->set_item_help_id("move", HID_TEMPLATEDLG_MOVE); +mxContextMenu->set_item_help_id("export", HID_TEMPLATEDLG_EXPORT); + if (!bIsSingleSel) { mxContextMenu->set_sensitive("open", false); diff --git a/sfx2/source/inc/helpids.h b/sfx2/source/inc/helpids.h index 7dbce5235779..051cc5ada8a5 100644 --- a/sfx2/source/inc/helpids.h +++ b/sfx2/source/inc/helpids.h @@ -40,6 +40,14 @@ inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_PRINT = u"SFX2_HID_HELP_TO inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_BOOKMARKS = u"SFX2_HID_HELP_TOOLBOXITEM_BOOKMARKS"; inline constexpr OUStringLiteral HID_HELP_TOOLBOXITEM_SEARCHDIALOG = u"SFX2_HID_HELP_TOOLBOXITEM_SEARCHDIALOG"; +inline constexpr OUStringLiteral HID_TEMPLATEDLG_OPEN = u"SFX2_HID_TEMPLATEDLG_OPEN"; +inline constexpr OUStringLiteral HID_TEMPLATEDLG_EDIT = u"SFX2_HID_TEMPLATEDLG_EDIT"; +inline constexpr OUStringLiteral HID_TEMPLATEDLG_DEFAULT = u"SFX2_HID_TEMPLATEDLG_DEFAULT"; +inline constexpr OUStringLiteral HID_TEMPLATEDLG_RENAME = u"SFX2_HID_TEMPLATEDLG_RENAME"; +inline constexpr OUStringLiteral HID_TEMPLATEDLG_DELETE = u"SFX2_HID_TEMPLATEDLG_DELETE"; +inline constexpr OUStringLiteral HID_TEMPLATEDLG_MOVE = u"SFX2_HID_TEMPLATEDLG_MOVE"; +inline constexpr OUStringLiteral HID_TEMPLATEDLG_EXPORT = u"SFX2_HID_TEMPLATEDLG_EXPORT"; + inline constexpr OUStringLiteral HID_QUERY_LOAD_TEMPLATE = u"SFX2_HID_QUERY_LOAD_TEMPLATE"; inline constexpr OUStringLiteral HID_SIDEBAR_WINDOW = u"SFX2_HID_SIDEBAR_WINDOW"; diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 04a42c3a8929..4264de0cea6d 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -169,6 +169,7 @@ public: const css::uno::Reference& rImage,
[Libreoffice-commits] core.git: include/vcl sfx2/source vcl/inc vcl/source vcl/unx
include/vcl/weld.hxx | 11 ++- sfx2/source/sidebar/SidebarController.cxx |9 ++--- vcl/inc/salvtables.hxx|1 + vcl/source/app/salvtables.cxx | 13 ++--- vcl/unx/gtk3/gtk3gtkinst.cxx |9 + 5 files changed, 32 insertions(+), 11 deletions(-) New commits: commit 1a490b71feb2340ac4f58ff1bef983ef1115e2f3 Author: Caolán McNamara AuthorDate: Thu Feb 11 20:57:25 2021 + Commit: Caolán McNamara CommitDate: Fri Feb 12 10:10:23 2021 +0100 allow using css::graphic::XGraphic to set menu image Change-Id: Ice5062f26ea300aec73d5fd849484c8bc4fc43bd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110793 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 7921948027a3..c33bd97a098a 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2220,6 +2220,7 @@ public: virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pIconName, VirtualDevice* pImageSurface, +const css::uno::Reference* pImage, TriState eCheckRadioFalse) = 0; @@ -2232,23 +2233,23 @@ public: void append(const OUString& rId, const OUString& rStr) { -insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_INDET); +insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_INDET); } void append_check(const OUString& rId, const OUString& rStr) { -insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_TRUE); +insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_TRUE); } void append_radio(const OUString& rId, const OUString& rStr) { -insert(-1, rId, rStr, nullptr, nullptr, TRISTATE_FALSE); +insert(-1, rId, rStr, nullptr, nullptr, nullptr, TRISTATE_FALSE); } void append(const OUString& rId, const OUString& rStr, const OUString& rImage) { -insert(-1, rId, rStr, , nullptr, TRISTATE_INDET); +insert(-1, rId, rStr, , nullptr, nullptr, TRISTATE_INDET); } void append(const OUString& rId, const OUString& rStr, VirtualDevice& rImage) { -insert(-1, rId, rStr, nullptr, , TRISTATE_INDET); +insert(-1, rId, rStr, nullptr, , nullptr, TRISTATE_INDET); } // return the number of toplevel nodes diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx index 2af18b6d7558..ae12e361a6ba 100644 --- a/sfx2/source/sidebar/SidebarController.cxx +++ b/sfx2/source/sidebar/SidebarController.cxx @@ -1069,7 +1069,8 @@ void SidebarController::PopulatePopupMenus(weld::Menu& rMenu, weld::Menu& rCusto for (const auto& rItem : rMenuData) { OString sIdent("select" + OString::number(nIndex)); -rMenu.insert(nIndex, OUString::fromUtf8(sIdent), rItem.msDisplayName, nullptr, nullptr, TRISTATE_FALSE); +rMenu.insert(nIndex, OUString::fromUtf8(sIdent), rItem.msDisplayName, + nullptr, nullptr, nullptr, TRISTATE_FALSE); rMenu.set_active(sIdent, rItem.mbIsCurrentDeck); rMenu.set_sensitive(sIdent, rItem.mbIsEnabled && rItem.mbIsActive); @@ -1079,13 +1080,15 @@ void SidebarController::PopulatePopupMenus(weld::Menu& rMenu, weld::Menu& rCusto { // Don't allow the currently visible deck to be disabled. OString sSubIdent("nocustomize" + OString::number(nIndex)); -rCustomizationMenu.insert(nIndex, OUString::fromUtf8(sSubIdent), rItem.msDisplayName, nullptr, nullptr, TRISTATE_FALSE); +rCustomizationMenu.insert(nIndex, OUString::fromUtf8(sSubIdent), rItem.msDisplayName, + nullptr, nullptr, nullptr, TRISTATE_FALSE); rCustomizationMenu.set_active(sSubIdent, true); } else { OString sSubIdent("customize" + OString::number(nIndex)); -rCustomizationMenu.insert(nIndex, OUString::fromUtf8(sSubIdent), rItem.msDisplayName, nullptr, nullptr, TRISTATE_TRUE); +rCustomizationMenu.insert(nIndex, OUString::fromUtf8(sSubIdent), rItem.msDisplayName, + nullptr, nullptr, nullptr, TRISTATE_TRUE); rCustomizationMenu.set_active(sSubIdent, rItem.mbIsEnabled && rItem.mbIsActive); } } diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index a3941ff51e67..2416aa6ab696 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -153,6 +153,7 @@ public: virtual void clear() override; virtual void insert(int pos, const OUString& rId, const OUString& rStr, const OUString* pIconName, VirtualDevice* pImageSurface, +const css::uno::Reference* pImage,