From 96febd383cf2b72e66f18ea2b7a8be09a102080b Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 30 Oct 2016 18:01:21 +0200 Subject: Add resource name method to IContextMenuProvider Change-Id: I218fd18101f8f7039052fe8a065096e4c9809adb --- dbaccess/source/ui/app/AppController.cxx | 7 ++++++- dbaccess/source/ui/app/AppController.hxx | 1 + dbaccess/source/ui/browser/unodatbr.cxx | 5 +++++ dbaccess/source/ui/inc/callbacks.hxx | 8 ++++++++ dbaccess/source/ui/inc/dbu_resource.hrc | 1 - dbaccess/source/ui/inc/unodatbr.hxx | 1 + 6 files changed, 21 insertions(+), 2 deletions(-) (limited to 'dbaccess/source') diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index 3c6860d37380..c414c6369922 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2281,9 +2281,14 @@ void OApplicationController::onDeleteEntry() executeChecked(nId,Sequence()); } +OUString OApplicationController::getContextMenuResourceName( Control& /*_rControl*/ ) const +{ + return OUString("edit"); +} + VclPtr OApplicationController::getContextMenu( Control& /*_rControl*/ ) const { - return VclPtr::Create( ModuleRes( RID_MENU_APP_EDIT ) ); + return nullptr; } IController& OApplicationController::getCommandController() diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx index ded00698318d..6c5bcfd0e6e3 100644 --- a/dbaccess/source/ui/app/AppController.hxx +++ b/dbaccess/source/ui/app/AppController.hxx @@ -521,6 +521,7 @@ namespace dbaui virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override; // IContextMenuProvider + virtual OUString getContextMenuResourceName( Control& _rControl ) const override; virtual VclPtr getContextMenu( Control& _rControl ) const override; virtual IController& getCommandController() override; virtual ::comphelper::OInterfaceContainerHelper2* diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index f42a38633b91..5aa5f4f38f7d 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -3469,6 +3469,11 @@ bool SbaTableQueryBrowser::requestQuickHelp( const SvTreeListEntry* _pEntry, OUS return false; } +OUString SbaTableQueryBrowser::getContextMenuResourceName( Control& ) const +{ + return OUString(); +} + VclPtr SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const { OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl, diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx index c9e98ea41e9a..9d1c95e65019 100644 --- a/dbaccess/source/ui/inc/callbacks.hxx +++ b/dbaccess/source/ui/inc/callbacks.hxx @@ -68,6 +68,14 @@ namespace dbaui class SAL_NO_VTABLE IContextMenuProvider { public: + /** returns the context menu resource name for the control + + Supposed to be a valid name from uiconfig//popupmenu folder. + Nevertheless, the getContextMenu method will not be evaluated, as long + as this method returns non-empty string. + */ + virtual OUString getContextMenuResourceName( Control& _rControl ) const = 0; + /** returns the context menu for the control Note that the menu does not need to care for the controls selection, or its diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc index 83ccc950c905..4c6cd0838c83 100644 --- a/dbaccess/source/ui/inc/dbu_resource.hrc +++ b/dbaccess/source/ui/inc/dbu_resource.hrc @@ -133,7 +133,6 @@ #define RID_QUERYFUNCTION_POPUPMENU RID_MENU_START + 6 #define RID_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7 #define RID_SBA_RTF_PKEYPOPUP RID_MENU_START + 9 -#define RID_MENU_APP_EDIT RID_MENU_START + 10 #define RID_MENU_APP_PREVIEW RID_MENU_START + 12 #define MENU_BROWSER_DEFAULTCONTEXT RID_MENU_START + 14 #define RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16 diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx index f8bd65a26267..93118a4225cd 100644 --- a/dbaccess/source/ui/inc/unodatbr.hxx +++ b/dbaccess/source/ui/inc/unodatbr.hxx @@ -230,6 +230,7 @@ namespace dbaui virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override; // IContextMenuProvider + virtual OUString getContextMenuResourceName( Control& _rControl ) const override; virtual VclPtr getContextMenu( Control& _rControl ) const override; virtual IController& getCommandController() override; virtual ::comphelper::OInterfaceContainerHelper2* -- cgit