Tag: cws_dev300_dba30d User: fs Date: 2008-05-29 11:27:42+0000 Modified: dba/dbaccess/source/ui/control/dbtreelistbox.cxx
Log: during #i80943#: refactoring: ContextMenuActionListener not needed anymore, superseded by IContextMenuProvider File Changes: Directory: /dba/dbaccess/source/ui/control/ =========================================== File [changed]: dbtreelistbox.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/control/dbtreelistbox.cxx?r1=1.19&r2=1.19.30.1 Delta lines: +21 -31 --------------------- --- dbtreelistbox.cxx 2008-04-10 14:18:17+0000 1.19 +++ dbtreelistbox.cxx 2008-05-29 11:27:40+0000 1.19.30.1 @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: dbtreelistbox.cxx,v $ - * $Revision: 1.19 $ + * $Revision: 1.19.30.1 $ * * This file is part of OpenOffice.org. * @@ -92,7 +92,7 @@ ,m_pSelectedEntry(NULL) ,m_pDragedEntry(NULL) ,m_pActionListener(NULL) - ,m_pContextMenuActionListener(NULL) + ,m_pContextMenuProvider( NULL ) ,m_nSelectLock(0) ,m_bHandleEnterKey(_bHandleEnterKey) ,m_xORB(_rxORB) @@ -106,7 +106,7 @@ ,m_pSelectedEntry(NULL) ,m_pDragedEntry(NULL) ,m_pActionListener(NULL) - ,m_pContextMenuActionListener(NULL) + ,m_pContextMenuProvider( NULL ) ,m_nSelectLock(0) ,m_bHandleEnterKey(_bHandleEnterKey) ,m_xORB(_rxORB) @@ -387,24 +387,6 @@ SvTreeListBox::RequestHelp( rHEvt ); } -// ------------------------------------------------------------------------- -void DBTreeListBox::Command( const CommandEvent& _rCEvt ) -{ - SvTreeListBox::Command(_rCEvt); - switch (_rCEvt.GetCommand()) - { - case COMMAND_CONTEXTMENU: - { - if (m_pActionListener) - { - CancelPendingEdit(); - m_pActionListener->requestContextMenu( _rCEvt ); - } - } - break; - } -} - // ----------------------------------------------------------------------------- void DBTreeListBox::KeyInput( const KeyEvent& rKEvt ) { @@ -525,7 +507,7 @@ // ----------------------------------------------------------------------------- namespace { - void lcl_enableEntries(PopupMenu* _pPopup,IController* _pController) + void lcl_enableEntries( PopupMenu* _pPopup, IController& _rController ) { if ( !_pPopup ) return; @@ -539,35 +521,43 @@ PopupMenu* pSubPopUp = _pPopup->GetPopupMenu(nId); if ( pSubPopUp ) { - lcl_enableEntries(pSubPopUp,_pController); + lcl_enableEntries( pSubPopUp, _rController ); _pPopup->EnableItem(nId,pSubPopUp->HasValidEntries()); } else - _pPopup->EnableItem( nId, _pController->isCommandEnabled( _pPopup->GetItemCommand( nId ) ) ); + { + ::rtl::OUString sCommandURL( _pPopup->GetItemCommand( nId ) ); + bool bEnabled = ( sCommandURL.getLength() ) + ? _rController.isCommandEnabled( sCommandURL ) + : _rController.isCommandEnabled( nId ); + _pPopup->EnableItem( nId, bEnabled ); + } } } _pPopup->RemoveDisabledEntries(); } } + // ----------------------------------------------------------------------------- PopupMenu* DBTreeListBox::CreateContextMenu( void ) { PopupMenu* pContextMenu = NULL; - if ( m_pContextMenuActionListener ) + if ( m_pContextMenuProvider ) { - PopupMenu aMain(ModuleRes(RID_MENU_APP_EDIT)); - pContextMenu = new PopupMenu(aMain); - lcl_enableEntries(pContextMenu,m_pContextMenuActionListener); + pContextMenu = m_pContextMenuProvider->getContextMenu( *this ); + lcl_enableEntries( pContextMenu, m_pContextMenuProvider->getCommandController() ); } return pContextMenu; } + // ----------------------------------------------------------------------------- void DBTreeListBox::ExcecuteContextMenuAction( USHORT _nSelectedPopupEntry ) { - if ( m_pContextMenuActionListener ) - m_pContextMenuActionListener->executeChecked(_nSelectedPopupEntry,Sequence<PropertyValue>()); + if ( m_pContextMenuProvider ) + m_pContextMenuProvider->getCommandController().executeChecked( _nSelectedPopupEntry, Sequence< PropertyValue >() ); } + // ----------------------------------------------------------------------------- IMPL_LINK(DBTreeListBox, OnTimeOut, void*, /*EMPTY_ARG*/) { --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
