Add resource name method to IContextMenuProvider

Change-Id: I218fd18101f8f7039052fe8a065096e4c9809adb
This commit is contained in:
Maxim Monastirsky
2016-10-30 18:01:21 +02:00
parent d1dd9269f1
commit 96febd383c
6 changed files with 21 additions and 2 deletions

View File

@@ -2281,9 +2281,14 @@ void OApplicationController::onDeleteEntry()
executeChecked(nId,Sequence<PropertyValue>()); executeChecked(nId,Sequence<PropertyValue>());
} }
OUString OApplicationController::getContextMenuResourceName( Control& /*_rControl*/ ) const
{
return OUString("edit");
}
VclPtr<PopupMenu> OApplicationController::getContextMenu( Control& /*_rControl*/ ) const VclPtr<PopupMenu> OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
{ {
return VclPtr<PopupMenu>::Create( ModuleRes( RID_MENU_APP_EDIT ) ); return nullptr;
} }
IController& OApplicationController::getCommandController() IController& OApplicationController::getCommandController()

View File

@@ -521,6 +521,7 @@ namespace dbaui
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override; virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider // IContextMenuProvider
virtual OUString getContextMenuResourceName( Control& _rControl ) const override;
virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override; virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
virtual IController& getCommandController() override; virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2* virtual ::comphelper::OInterfaceContainerHelper2*

View File

@@ -3469,6 +3469,11 @@ bool SbaTableQueryBrowser::requestQuickHelp( const SvTreeListEntry* _pEntry, OUS
return false; return false;
} }
OUString SbaTableQueryBrowser::getContextMenuResourceName( Control& ) const
{
return OUString();
}
VclPtr<PopupMenu> SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const VclPtr<PopupMenu> SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
{ {
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl, OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,

View File

@@ -68,6 +68,14 @@ namespace dbaui
class SAL_NO_VTABLE IContextMenuProvider class SAL_NO_VTABLE IContextMenuProvider
{ {
public: public:
/** returns the context menu resource name for the control
Supposed to be a valid name from uiconfig/<module>/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 /** returns the context menu for the control
Note that the menu does not need to care for the controls selection, or its Note that the menu does not need to care for the controls selection, or its

View File

@@ -133,7 +133,6 @@
#define RID_QUERYFUNCTION_POPUPMENU RID_MENU_START + 6 #define RID_QUERYFUNCTION_POPUPMENU RID_MENU_START + 6
#define RID_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7 #define RID_TABLEDESIGNROWPOPUPMENU RID_MENU_START + 7
#define RID_SBA_RTF_PKEYPOPUP RID_MENU_START + 9 #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 RID_MENU_APP_PREVIEW RID_MENU_START + 12
#define MENU_BROWSER_DEFAULTCONTEXT RID_MENU_START + 14 #define MENU_BROWSER_DEFAULTCONTEXT RID_MENU_START + 14
#define RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16 #define RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16

View File

@@ -230,6 +230,7 @@ namespace dbaui
virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override; virtual sal_Int8 executeDrop( const ExecuteDropEvent& _rEvt ) override;
// IContextMenuProvider // IContextMenuProvider
virtual OUString getContextMenuResourceName( Control& _rControl ) const override;
virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override; virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
virtual IController& getCommandController() override; virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2* virtual ::comphelper::OInterfaceContainerHelper2*