summaryrefslogtreecommitdiff
path: root/dbaccess/source
diff options
context:
space:
mode:
Diffstat (limited to 'dbaccess/source')
-rw-r--r--dbaccess/source/ui/app/AppController.cxx5
-rw-r--r--dbaccess/source/ui/app/AppController.hxx3
-rw-r--r--dbaccess/source/ui/browser/dsEntriesNoExp.cxx4
-rw-r--r--dbaccess/source/ui/browser/sbabrw.src38
-rw-r--r--dbaccess/source/ui/browser/unodatbr.cxx13
-rw-r--r--dbaccess/source/ui/control/dbtreelistbox.cxx150
-rw-r--r--dbaccess/source/ui/inc/callbacks.hxx11
-rw-r--r--dbaccess/source/ui/inc/dbu_resource.hrc1
-rw-r--r--dbaccess/source/ui/inc/unodatbr.hxx1
9 files changed, 27 insertions, 199 deletions
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 8496e7d1f11d..9b58b9a8d0f9 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -2281,11 +2281,6 @@ OUString OApplicationController::getContextMenuResourceName( Control& /*_rContro
return OUString("edit");
}
-VclPtr<PopupMenu> OApplicationController::getContextMenu( Control& /*_rControl*/ ) const
-{
- return nullptr;
-}
-
IController& OApplicationController::getCommandController()
{
return *this;
diff --git a/dbaccess/source/ui/app/AppController.hxx b/dbaccess/source/ui/app/AppController.hxx
index d552e812f154..4557ef0e408a 100644
--- a/dbaccess/source/ui/app/AppController.hxx
+++ b/dbaccess/source/ui/app/AppController.hxx
@@ -497,8 +497,7 @@ namespace dbaui
// IContextMenuProvider
virtual OUString getContextMenuResourceName( Control& _rControl ) const override;
- virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
- virtual IController& getCommandController() override;
+ virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;
virtual css::uno::Any
diff --git a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
index 76629da8f0ad..367023fa4be6 100644
--- a/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
+++ b/dbaccess/source/ui/browser/dsEntriesNoExp.cxx
@@ -156,6 +156,10 @@ void SbaTableQueryBrowser::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:Title", ID_BROWSER_TITLE );
if ( !m_bShowMenu )
{
+ implDescribeSupportedFeature( ".uno:DSBEditDB", ID_TREE_EDIT_DATABASE );
+ implDescribeSupportedFeature( ".uno:DSBCloseConnection", ID_TREE_CLOSE_CONN );
+ implDescribeSupportedFeature( ".uno:DSBAdministrate", ID_TREE_ADMINISTRATE );
+
implDescribeSupportedFeature( ".uno:DSBrowserExplorer", ID_BROWSER_EXPLORER, CommandGroup::VIEW );
implDescribeSupportedFeature( ".uno:DSBFormLetter", ID_BROWSER_FORMLETTER, CommandGroup::DOCUMENT );
diff --git a/dbaccess/source/ui/browser/sbabrw.src b/dbaccess/source/ui/browser/sbabrw.src
index e5fdae7abe53..c42634c748b7 100644
--- a/dbaccess/source/ui/browser/sbabrw.src
+++ b/dbaccess/source/ui/browser/sbabrw.src
@@ -55,44 +55,6 @@ String RID_STR_TABLES_CONTAINER
Text [ en-US ] = "Tables";
};
-Menu MENU_BROWSER_DEFAULTCONTEXT
-{
- ItemList =
- {
- MenuItem
- {
- Identifier = ID_TREE_EDIT_DATABASE ;
- HelpId = HID_BROWSER_EDIT_DATABASE ;
- Text [ en-US ] = "Edit ~Database File..." ;
- };
- MenuItem
- {
- Identifier = ID_TREE_CLOSE_CONN ;
- HelpId = HID_BROWSER_CLOSECONN ;
- Text [ en-US ] = "Disco~nnect" ;
- };
- MenuItem
- {
- Separator = TRUE;
- };
- MenuItem {
- Identifier = SID_COPY ;
- Command = ".uno:Copy" ;
- Text [ en-US ] = "~Copy" ;
- };
- MenuItem
- {
- Separator = TRUE;
- };
- MenuItem
- {
- Identifier = ID_TREE_ADMINISTRATE ;
- HelpId = HID_BROWSER_ADMINISTRATE;
- Text [ en-US ] = "Registered databases ..." ;
- };
- };
-};
-
String STR_TITLE_CONFIRM_DELETION
{
Text [ en-US ] = "Confirm Deletion" ;
diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx
index 2ab8bf61b140..ade9d757dee0 100644
--- a/dbaccess/source/ui/browser/unodatbr.cxx
+++ b/dbaccess/source/ui/browser/unodatbr.cxx
@@ -3468,19 +3468,14 @@ bool SbaTableQueryBrowser::requestQuickHelp( const SvTreeListEntry* _pEntry, OUS
return false;
}
-OUString SbaTableQueryBrowser::getContextMenuResourceName( Control& ) const
-{
- return OUString();
-}
-
-VclPtr<PopupMenu> SbaTableQueryBrowser::getContextMenu( Control& _rControl ) const
+OUString SbaTableQueryBrowser::getContextMenuResourceName( Control& _rControl ) const
{
OSL_PRECOND( &m_pTreeView->getListBox() == &_rControl,
- "SbaTableQueryBrowser::getContextMenu: where does this come from?" );
+ "SbaTableQueryBrowser::getContextMenuResourceName: where does this come from?" );
if ( &m_pTreeView->getListBox() != &_rControl )
- return nullptr;
+ return OUString();
- return VclPtr<PopupMenu>::Create( ModuleRes( MENU_BROWSER_DEFAULTCONTEXT ) );
+ return OUString("explorer");
}
IController& SbaTableQueryBrowser::getCommandController()
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx
index 0cab1f0b695b..1eac063f9dc3 100644
--- a/dbaccess/source/ui/control/dbtreelistbox.cxx
+++ b/dbaccess/source/ui/control/dbtreelistbox.cxx
@@ -33,7 +33,6 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/propertyvalue.hxx>
#include <vcl/help.hxx>
-#include <vcl/commandinfoprovider.hxx>
#include <dbaccess/IController.hxx>
#include <framework/actiontriggerhelper.hxx>
#include <toolkit/awt/vclxmenu.hxx>
@@ -411,98 +410,6 @@ IMPL_LINK_NOARG( DBTreeListBox, ScrollDownHdl, LinkParamNone*, void )
namespace
{
- void lcl_enableEntries( PopupMenu* _pPopup, IController& _rController )
- {
- if ( !_pPopup )
- return;
-
- sal_uInt16 nCount = _pPopup->GetItemCount();
- for (sal_uInt16 i=0; i < nCount; ++i)
- {
- if ( _pPopup->GetItemType(i) != MenuItemType::SEPARATOR )
- {
- sal_uInt16 nId = _pPopup->GetItemId(i);
- PopupMenu* pSubPopUp = _pPopup->GetPopupMenu(nId);
- if ( pSubPopUp )
- {
- lcl_enableEntries( pSubPopUp, _rController );
- _pPopup->EnableItem(nId,pSubPopUp->HasValidEntries());
- }
- else
- {
- OUString sCommandURL( _pPopup->GetItemCommand( nId ) );
- bool bEnabled = sCommandURL.isEmpty()
- ? _rController.isCommandEnabled( nId )
- : _rController.isCommandEnabled( sCommandURL );
- _pPopup->EnableItem( nId, bEnabled );
- }
- }
- }
-
- _pPopup->RemoveDisabledEntries();
- }
-}
-
-namespace
-{
- void lcl_adjustMenuItemIDs( Menu& _rMenu, IController& _rCommandController )
- {
- sal_uInt16 nCount = _rMenu.GetItemCount();
- for ( sal_uInt16 pos = 0; pos < nCount; ++pos )
- {
- // do not adjust separators
- if ( _rMenu.GetItemType( pos ) == MenuItemType::SEPARATOR )
- continue;
-
- sal_uInt16 nId = _rMenu.GetItemId(pos);
- OUString aCommand = _rMenu.GetItemCommand( nId );
- PopupMenu* pPopup = _rMenu.GetPopupMenu( nId );
- if ( pPopup )
- {
- lcl_adjustMenuItemIDs( *pPopup, _rCommandController );
- continue;
- }
-
- const sal_uInt16 nCommandId = _rCommandController.registerCommandURL( aCommand );
- _rMenu.InsertItem( nCommandId, _rMenu.GetItemText( nId ), _rMenu.GetItemImage( nId ),
- _rMenu.GetItemBits( nId ), OString(), pos );
-
- // more things to preserve:
- // - the help command
- OUString sHelpURL = _rMenu.GetHelpCommand( nId );
- if ( !sHelpURL.isEmpty() )
- _rMenu.SetHelpCommand( nCommandId, sHelpURL );
-
- // remove the "old" item
- _rMenu.RemoveItem( pos+1 );
- }
- }
- void lcl_insertMenuItemImages( Menu& _rMenu, IController& _rCommandController )
- {
- uno::Reference< frame::XController > xController = _rCommandController.getXController();
- uno::Reference< frame::XFrame> xFrame;
- if ( xController.is() )
- xFrame = xController->getFrame();
- sal_uInt16 nCount = _rMenu.GetItemCount();
- for ( sal_uInt16 pos = 0; pos < nCount; ++pos )
- {
- // do not adjust separators
- if ( _rMenu.GetItemType( pos ) == MenuItemType::SEPARATOR )
- continue;
-
- sal_uInt16 nId = _rMenu.GetItemId(pos);
- OUString aCommand = _rMenu.GetItemCommand( nId );
- PopupMenu* pPopup = _rMenu.GetPopupMenu( nId );
- if ( pPopup )
- {
- lcl_insertMenuItemImages( *pPopup, _rCommandController );
- continue;
- }
-
- if ( xFrame.is() )
- _rMenu.SetItemImage(nId, vcl::CommandInfoProvider::Instance().GetImageForCommand(aCommand, xFrame));
- }
- }
// SelectionSupplier
typedef ::cppu::WeakImplHelper< XSelectionSupplier
> SelectionSupplier_Base;
@@ -554,51 +461,37 @@ namespace
VclPtr<PopupMenu> DBTreeListBox::CreateContextMenu()
{
- VclPtr< PopupMenu > pContextMenu;
-
if ( !m_pContextMenuProvider )
- return pContextMenu;
+ return nullptr;
OUString aResourceName( m_pContextMenuProvider->getContextMenuResourceName( *this ) );
- OUString aMenuIdentifier;
-
if ( aResourceName.isEmpty() )
- {
- // the basic context menu
- pContextMenu.reset( m_pContextMenuProvider->getContextMenu( *this ) );
- // disable what is not available currently
- lcl_enableEntries( pContextMenu.get(), m_pContextMenuProvider->getCommandController() );
- // set images
- lcl_insertMenuItemImages( *pContextMenu, m_pContextMenuProvider->getCommandController() );
- }
- else
- {
- css::uno::Sequence< css::uno::Any > aArgs( 3 );
- aArgs[0] <<= comphelper::makePropertyValue( "Value", aResourceName );
- aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_pContextMenuProvider->getCommandController().getXController()->getFrame() );
- aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true );
+ return nullptr;
- css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
- m_xMenuController.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
- "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext ), css::uno::UNO_QUERY );
+ css::uno::Sequence< css::uno::Any > aArgs( 3 );
+ aArgs[0] <<= comphelper::makePropertyValue( "Value", aResourceName );
+ aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_pContextMenuProvider->getCommandController().getXController()->getFrame() );
+ aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true );
- css::uno::Reference< css::awt::XPopupMenu > xPopupMenu( xContext->getServiceManager()->createInstanceWithContext(
- "com.sun.star.awt.PopupMenu", xContext ), css::uno::UNO_QUERY );
+ css::uno::Reference< css::uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ m_xMenuController.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext ), css::uno::UNO_QUERY );
- if ( !m_xMenuController.is() || !xPopupMenu.is() )
- return pContextMenu;
+ if ( !m_xMenuController.is() )
+ return nullptr;
- m_xMenuController->setPopupMenu( xPopupMenu );
- pContextMenu.reset( static_cast< PopupMenu* >( VCLXMenu::GetImplementation( xPopupMenu )->GetMenu() ) );
- pContextMenu->AddEventListener( LINK( this, DBTreeListBox, MenuEventListener ) );
- aMenuIdentifier = "private:resource/popupmenu/" + aResourceName;
- }
+ rtl::Reference<VCLXPopupMenu> xPopupMenu( new VCLXPopupMenu );
+ m_xMenuController->setPopupMenu( xPopupMenu.get() );
+ VclPtr<PopupMenu> pContextMenu( static_cast< PopupMenu* >( xPopupMenu->GetMenu() ) );
+ pContextMenu->AddEventListener( LINK( this, DBTreeListBox, MenuEventListener ) );
// allow context menu interception
::comphelper::OInterfaceContainerHelper2* pInterceptors = m_pContextMenuProvider->getContextMenuInterceptors();
if ( !pInterceptors || !pInterceptors->getLength() )
return pContextMenu;
+ OUString aMenuIdentifier( "private:resource/popupmenu/" + aResourceName );
+
ContextMenuExecuteEvent aEvent;
aEvent.SourceWindow = VCLUnoHelper::GetInterface( this );
aEvent.ExecutePosition.X = -1;
@@ -654,20 +547,13 @@ VclPtr<PopupMenu> DBTreeListBox::CreateContextMenu()
::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer(
pContextMenu, aEvent.ActionTriggerContainer );
aEvent.ActionTriggerContainer.clear();
-
- // the interceptors only know command URLs, but our menus primarily work
- // with IDs -> we need to translate the commands to IDs
- if ( aResourceName.isEmpty() )
- lcl_adjustMenuItemIDs( *pContextMenu, m_pContextMenuProvider->getCommandController() );
}
return pContextMenu;
}
-void DBTreeListBox::ExecuteContextMenuAction( sal_uInt16 _nSelectedPopupEntry )
+void DBTreeListBox::ExecuteContextMenuAction( sal_uInt16 )
{
- if ( !m_xMenuController.is() && m_pContextMenuProvider && _nSelectedPopupEntry )
- m_pContextMenuProvider->getCommandController().executeChecked( _nSelectedPopupEntry, Sequence< PropertyValue >() );
}
IMPL_LINK( DBTreeListBox, MenuEventListener, VclMenuEvent&, rMenuEvent, void )
diff --git a/dbaccess/source/ui/inc/callbacks.hxx b/dbaccess/source/ui/inc/callbacks.hxx
index 9d1c95e65019..bd4498dc5175 100644
--- a/dbaccess/source/ui/inc/callbacks.hxx
+++ b/dbaccess/source/ui/inc/callbacks.hxx
@@ -71,20 +71,9 @@ namespace dbaui
/** 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
-
- Note that the menu does not need to care for the controls selection, or its
- state in general.
- The control itself will, using the controller provided by getCommandController,
- disable menu entries as needed.
- */
- virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const = 0;
-
/** returns the controller which is responsible for providing states of certain features,
and executing them.
*/
diff --git a/dbaccess/source/ui/inc/dbu_resource.hrc b/dbaccess/source/ui/inc/dbu_resource.hrc
index a9d1f5853364..169e026779d6 100644
--- a/dbaccess/source/ui/inc/dbu_resource.hrc
+++ b/dbaccess/source/ui/inc/dbu_resource.hrc
@@ -129,7 +129,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 MENU_BROWSER_DEFAULTCONTEXT RID_MENU_START + 14
#define RID_MENU_JOINVIEW_CONNECTION RID_MENU_START + 16
#define RID_MENU_JOINVIEW_TABLE RID_MENU_START + 17
diff --git a/dbaccess/source/ui/inc/unodatbr.hxx b/dbaccess/source/ui/inc/unodatbr.hxx
index e633c9a6d980..178af0838ad3 100644
--- a/dbaccess/source/ui/inc/unodatbr.hxx
+++ b/dbaccess/source/ui/inc/unodatbr.hxx
@@ -233,7 +233,6 @@ namespace dbaui
// IContextMenuProvider
virtual OUString getContextMenuResourceName( Control& _rControl ) const override;
- virtual VclPtr<PopupMenu> getContextMenu( Control& _rControl ) const override;
virtual IController& getCommandController() override;
virtual ::comphelper::OInterfaceContainerHelper2*
getContextMenuInterceptors() override;