summaryrefslogtreecommitdiff
path: root/framework/inc
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2020-09-01 23:25:41 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2020-09-07 00:18:43 +0200
commit34f37ce6b9feef6091e0f27a2618e3f812f42008 (patch)
tree06b9bcdead210943e96e30c398d6d1c47cc90bb7 /framework/inc
parent49e00818c6c77ecb5e09008a7379ce4e4e54c60f (diff)
MenuBarManager: Simplify addon menu creation
Addon menus were created with a different ctor, which called Init instead of FillMenuManager. But the former is just a subset of the latter, and I don't see in the latter anything particularly harmful for addon menus. There was however the bool _bHandlePopUp parameter, which controlled whether to create popup menus to be used by popup menu controllers, but: (a) it doesn't make any sense to me to allow controllers in some addon menus but not in others, and (b) the Activate method creates controllers unconditionally, which means that a controller might still be created, but then get nullptr for the popup menu, and crash. There was also m_bIsBookmarkMenu, which was set to true for addon menus, and used in the Select method to add Referer argument to the executed command. As a matter of fact, this argument is useless, as the referer is never evaluated for any command or macro execution. Only affected case might be when content URLs used directly as menu commands. But such usage isn't common, and even then an empty referer is similarly accepted by SvtSecurityOptions::isUntrustedReferer. However seeing the message of f0a9ca24fd4bf79cac908bf0d6fdb8905dc504db ("rhbz#887420 Implement "block untrusted referer links" feature") it appears that it's better to have the explicit referer anyway (but with a different check, as m_bIsBookmarkMenu is now gone). (Historically, the referer argument wasn't even introduced for addon menus, but for the new document and wizards menus, which used to be managed by the menu manager back then. This can be seen in commit 40fefd8e0d5937666129278fe2b27c36cb58033c ("support for images and target frames"). Only later this code path was reused for addon menus. That's why the member was called m_bIsBookmarkMenu, as "bookmark menu" was the term used for the new and wizard menus, and there was also a related BmkMenu class.) Change-Id: Idd48a0416f8703ef1a5c91e949345537ec9a5ec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102136 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Diffstat (limited to 'framework/inc')
-rw-r--r--framework/inc/menuconfiguration.hxx2
-rw-r--r--framework/inc/uielement/menubarmanager.hxx9
2 files changed, 0 insertions, 11 deletions
diff --git a/framework/inc/menuconfiguration.hxx b/framework/inc/menuconfiguration.hxx
index 84943f5326a6..ea3acc41a2f0 100644
--- a/framework/inc/menuconfiguration.hxx
+++ b/framework/inc/menuconfiguration.hxx
@@ -29,8 +29,6 @@ namespace com::sun::star::io { class XInputStream; }
namespace com::sun::star::io { class XOutputStream; }
namespace com::sun::star::uno { class XComponentContext; }
-const sal_uInt16 ITEMID_ADDONLIST = 6678; // used to be a SID in sfx2, now just a unique id...
-
namespace framework
{
diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx
index eb2cb24a85b2..c688994313b8 100644
--- a/framework/inc/uielement/menubarmanager.hxx
+++ b/framework/inc/uielement/menubarmanager.hxx
@@ -65,13 +65,6 @@ class MenuBarManager final :
css::ui::XUIConfigurationListener,
css::awt::XSystemDependentMenuPeer>
{
- MenuBarManager(
- const css::uno::Reference< css::uno::XComponentContext >& xContext,
- const css::uno::Reference< css::frame::XFrame >& rFrame,
- const css::uno::Reference< css::util::XURLTransformer >& _xURLTransformer,
- Menu* pAddonMenu,
- bool popup);
-
public:
MenuBarManager(
const css::uno::Reference< css::uno::XComponentContext >& xContext,
@@ -172,12 +165,10 @@ class MenuBarManager final :
bool CreatePopupMenuController( MenuItemHandler* pMenuItemHandler );
void AddMenu(MenuBarManager* pSubMenuManager,const OUString& _sItemCommand,sal_uInt16 _nItemId);
sal_uInt16 FillItemCommand(OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const;
- void Init(const css::uno::Reference< css::frame::XFrame >& rFrame,Menu* pAddonMenu,bool _bHandlePopUp);
void SetHdl();
bool m_bDeleteMenu;
bool m_bActive;
- bool m_bIsBookmarkMenu;
bool m_bShowMenuImages;
bool m_bRetrieveImages;
bool m_bAcceleratorCfg;