diff options
-rw-r--r-- | dbaccess/UIConfig_dbbrowser.mk | 1 | ||||
-rw-r--r-- | dbaccess/inc/dbaccess_helpid.hrc | 20 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppController.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/dsEntriesNoExp.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/sbabrw.src | 38 | ||||
-rw-r--r-- | dbaccess/source/ui/browser/unodatbr.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/control/dbtreelistbox.cxx | 150 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/callbacks.hxx | 11 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/dbu_resource.hrc | 1 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/unodatbr.hxx | 1 | ||||
-rw-r--r-- | dbaccess/uiconfig/dbbrowser/popupmenu/explorer.xml | 17 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/DbBrowserWindowState.xcu | 5 | ||||
-rw-r--r-- | officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu | 15 |
14 files changed, 65 insertions, 219 deletions
diff --git a/dbaccess/UIConfig_dbbrowser.mk b/dbaccess/UIConfig_dbbrowser.mk index 421312d20c0b..eaab6cc2b43e 100644 --- a/dbaccess/UIConfig_dbbrowser.mk +++ b/dbaccess/UIConfig_dbbrowser.mk @@ -14,6 +14,7 @@ $(eval $(call gb_UIConfig_add_menubarfiles,modules/dbbrowser,\ )) $(eval $(call gb_UIConfig_add_popupmenufiles,modules/dbbrowser,\ + dbaccess/uiconfig/dbbrowser/popupmenu/explorer \ dbaccess/uiconfig/dbbrowser/popupmenu/refreshdata \ )) diff --git a/dbaccess/inc/dbaccess_helpid.hrc b/dbaccess/inc/dbaccess_helpid.hrc index 086bf7f4d40a..899e2d9497fd 100644 --- a/dbaccess/inc/dbaccess_helpid.hrc +++ b/dbaccess/inc/dbaccess_helpid.hrc @@ -32,8 +32,6 @@ #define HID_BROWSER_COLUMNWIDTH "DBACCESS_HID_BROWSER_COLUMNWIDTH" #define HID_BROWSER_TABLEFORMAT "DBACCESS_HID_BROWSER_TABLEFORMAT" #define HID_BROWSER_ROWHEIGHT "DBACCESS_HID_BROWSER_ROWHEIGHT" -#define HID_BROWSER_EDIT_DATABASE "DBACCESS_HID_BROWSER_EDIT_DATABASE" -#define HID_BROWSER_CLOSECONN "DBACCESS_HID_BROWSER_CLOSECONN" #define HID_CTL_QRYSQLEDIT "DBACCESS_HID_CTL_QRYSQLEDIT" @@ -124,24 +122,6 @@ #define HID_DBWIZ_CANCEL "DBACCESS_HID_DBWIZ_CANCEL" #define HID_DBWIZ_FINISH "DBACCESS_HID_DBWIZ_FINISH" -#define HID_BROWSER_ADMINISTRATE "DBACCESS_HID_BROWSER_ADMINISTRATE" - - - - - - - - - - - - - - - - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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; diff --git a/dbaccess/uiconfig/dbbrowser/popupmenu/explorer.xml b/dbaccess/uiconfig/dbbrowser/popupmenu/explorer.xml new file mode 100644 index 000000000000..3be0c047a310 --- /dev/null +++ b/dbaccess/uiconfig/dbbrowser/popupmenu/explorer.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> +<menu:menupopup xmlns:menu="http://openoffice.org/2001/menu"> + <menu:menuitem menu:id=".uno:DSBEditDB"/> + <menu:menuitem menu:id=".uno:DSBCloseConnection"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:Copy"/> + <menu:menuseparator/> + <menu:menuitem menu:id=".uno:DSBAdministrate"/> +</menu:menupopup> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DbBrowserWindowState.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DbBrowserWindowState.xcu index f84d8a26217c..d18a7485ef38 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DbBrowserWindowState.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DbBrowserWindowState.xcu @@ -3,6 +3,11 @@ <oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:install="http://openoffice.org/2004/installation" oor:name="DbBrowserWindowState" oor:package="org.openoffice.Office.UI"> <node oor:name="UIElements"> <node oor:name="States"> + <node oor:name="private:resource/popupmenu/explorer" oor:op="replace"> + <prop oor:name="UIName" oor:type="xs:string"> + <value xml:lang="en-US">Explorer</value> + </prop> + </node> <node oor:name="private:resource/toolbar/toolbar" oor:op="replace"> <prop oor:name="DockPos" oor:type="xs:string"> <value>0,1</value> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu index d6cdfc0c9fd6..da68adc9b240 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DbuCommands.xcu @@ -536,6 +536,21 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:DSBEditDB" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Edit ~Database File...</value> + </prop> + </node> + <node oor:name=".uno:DSBCloseConnection" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Disco~nnect</value> + </prop> + </node> + <node oor:name=".uno:DSBAdministrate" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Registered databases ...</value> + </prop> + </node> </node> <node oor:name="Popups"> <node oor:name=".uno:DBDatabasePropertiesMenu" oor:op="replace"> |