From 9052caae53ef6ec7eeab20f1ac56bd6310b4451b Mon Sep 17 00:00:00 2001 From: Ariel Constenla-Haile Date: Sun, 23 Dec 2012 11:29:21 +0000 Subject: Resolves: #i121542# Unify the Menu API (cherry picked from commit 399946b82f5efec19cd82d1c320d5aa9295d235d) Conflicts: chart2/source/controller/main/ChartController_Window.cxx framework/source/uielement/langselectionmenucontroller.cxx framework/source/uielement/popupmenucontroller.cxx framework/source/uielement/recentfilesmenucontroller.cxx framework/source/uielement/toolbarsmenucontroller.cxx odk/examples/DevelopersGuide/GUI/UnoMenu.java odk/examples/DevelopersGuide/GUI/UnoMenu2.java odk/examples/cpp/StatusbarController/SelectionModeStatusbarController/SelectionModeStatusbarController.cxx offapi/com/sun/star/awt/MenuBar.idl offapi/com/sun/star/awt/MenuEvent.idl offapi/com/sun/star/awt/MenuItemStyle.idl offapi/com/sun/star/awt/MenuItemType.idl offapi/com/sun/star/awt/MenuLogo.idl offapi/com/sun/star/awt/PopupMenu.idl offapi/com/sun/star/awt/PopupMenuDirection.idl offapi/com/sun/star/awt/XMenu.idl offapi/com/sun/star/awt/XMenuBar.idl offapi/com/sun/star/awt/XMenuBarExtended.idl offapi/com/sun/star/awt/XMenuExtended.idl offapi/com/sun/star/awt/XMenuExtended2.idl offapi/com/sun/star/awt/XMenuListener.idl offapi/com/sun/star/awt/XPopupMenu.idl offapi/com/sun/star/awt/XPopupMenuExtended.idl offapi/com/sun/star/awt/makefile.mk offapi/type_reference/types.rdb svtools/inc/svtools/popupmenucontrollerbase.hxx svtools/source/uno/popupmenucontrollerbase.cxx svx/source/tbxctrls/extrusioncontrols.cxx toolkit/inc/pch/precompiled_toolkit.hxx toolkit/inc/toolkit/awt/vclxmenu.hxx toolkit/inc/toolkit/helper/listenermultiplexer.hxx toolkit/source/awt/vclxmenu.cxx Change-Id: I3d9a1e109b9ff35901a3075b44a4c27e7c12b5c7 Related: #i121542# css::awt::XPopupMenu::execute() needs a Rectangle (cherry picked from commit c01a6f4f370b72f0751cf4f5c11310682e2b3248) Conflicts: odk/examples/DevelopersGuide/GUI/UnoMenu2.java offapi/type_reference/types.rdb toolkit/inc/toolkit/awt/vclxmenu.hxx Change-Id: I2cccc95086fe3d1522d03346e3c577fb2f21f621 --- framework/source/uielement/controlmenucontroller.cxx | 2 +- framework/source/uielement/fontmenucontroller.cxx | 2 +- .../source/uielement/langselectionmenucontroller.cxx | 1 - .../uielement/langselectionstatusbarcontroller.cxx | 6 ++---- framework/source/uielement/newmenucontroller.cxx | 4 ++-- framework/source/uielement/popupmenucontroller.cxx | 2 +- framework/source/uielement/recentfilesmenucontroller.cxx | 16 +++++++--------- framework/source/uielement/toolbarsmenucontroller.cxx | 14 ++++++-------- 8 files changed, 20 insertions(+), 27 deletions(-) (limited to 'framework/source') diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index bda92e0932a9..a861194babd4 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -317,7 +317,7 @@ void ControlMenuController::impl_select(const Reference< XDispatch >& /*_xDispat } } -void SAL_CALL ControlMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL ControlMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { osl::ResettableMutexGuard aLock( m_aMutex ); diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index 47e35095bde2..fd5186c42047 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -157,7 +157,7 @@ void FontMenuController::impl_select(const Reference< XDispatch >& _xDispatch,co _xDispatch->dispatch( aTargetURL, aArgs ); } -void SAL_CALL FontMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL FontMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { osl::MutexGuard aLock( m_aMutex ); diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index db94d8f8ea65..38a4def0d0bb 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index 8773c819bb0f..903da76e7326 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -184,10 +184,8 @@ throw (::com::sun::star::uno::RuntimeException) // now display the popup menu and execute every command ... Reference< awt::XWindowPeer > xParent( m_xParentWindow, UNO_QUERY ); - com::sun::star::awt::Rectangle aRectangle; - aRectangle.X = aPos.X; - aRectangle.Y = aPos.Y; - sal_Int16 nId = xPopupMenu->execute( xParent, aRectangle, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); + com::sun::star::awt::Rectangle aRect( aPos.X, aPos.Y, 0, 0 ); + sal_Int16 nId = xPopupMenu->execute( xParent, aRect, com::sun::star::awt::PopupMenuDirection::EXECUTE_UP+16 ); //click "More..." if ( nId && m_xFrame.is() ) { diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index dea64a4a1489..156979ccf2ce 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -388,7 +388,7 @@ void SAL_CALL NewMenuController::statusChanged( const FeatureStateEvent& ) throw } // XMenuListener -void SAL_CALL NewMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) +void SAL_CALL NewMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) { Reference< css::awt::XPopupMenu > xPopupMenu; Reference< XDispatch > xDispatch; @@ -444,7 +444,7 @@ void SAL_CALL NewMenuController::select( const css::awt::MenuEvent& rEvent ) thr } } -void SAL_CALL NewMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL NewMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { SolarMutexGuard aSolarMutexGuard; if ( m_xFrame.is() && m_xPopupMenu.is() ) diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx index d980f6e68cd2..759bad1c63ee 100644 --- a/framework/source/uielement/popupmenucontroller.cxx +++ b/framework/source/uielement/popupmenucontroller.cxx @@ -59,7 +59,7 @@ class PopupMenuControllerImpl }; //======================================================================== -// class PopupMenuController +// class PopupMenuController REMOVE REMOVE REMOVE //======================================================================== PopupMenuController::PopupMenuController( const Reference< uno::XComponentContext >& rxContext ) diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 62197dab0aeb..47f08687d9cd 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -267,20 +267,18 @@ void SAL_CALL RecentFilesMenuController::statusChanged( const FeatureStateEvent& m_bDisabled = !Event.IsEnabled; } -void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) +void SAL_CALL RecentFilesMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) { - Reference< css::awt::XPopupMenu > xPopupMenu; - Reference< css::awt::XMenuExtended > xMenuExt; + Reference< css::awt::XPopupMenu > xPopupMenu; osl::ClearableMutexGuard aLock( m_aMutex ); - xPopupMenu = m_xPopupMenu; - xMenuExt = Reference< css::awt::XMenuExtended >( m_xPopupMenu, UNO_QUERY ); + xPopupMenu = m_xPopupMenu; aLock.clear(); - if ( xMenuExt.is() ) + if ( xPopupMenu.is() ) { - const OUString aCommand( xMenuExt->getCommand( rEvent.MenuId ) ); - OSL_TRACE( "RecentFilesMenuController::select() - Command : %s", + const OUString aCommand( xPopupMenu->getCommand( rEvent.MenuId ) ); + OSL_TRACE( "RecentFilesMenuController::itemSelected() - Command : %s", OUStringToOString( aCommand, RTL_TEXTENCODING_UTF8 ).getStr() ); if ( aCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( CMD_CLEAR_LIST ) ) ) @@ -290,7 +288,7 @@ void SAL_CALL RecentFilesMenuController::select( const css::awt::MenuEvent& rEve } } -void SAL_CALL RecentFilesMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL RecentFilesMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { osl::MutexGuard aLock( m_aMutex ); impl_setPopupMenu(); diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index a93c96591aa9..a1d8cd78ae1a 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -163,8 +163,7 @@ void ToolbarsMenuController::addCommand( aLabel = rLabel; rPopupMenu->insertItem( nItemId, aLabel, 0, nItemId ); - Reference< awt::XMenuExtended > xMenuExtended( m_xPopupMenu, UNO_QUERY ); - xMenuExtended->setCommand( nItemId, rCommandURL ); + rPopupMenu->setCommand( nItemId, rCommandURL ); bool bInternal = ( rCommandURL.indexOf( STATIC_INTERNAL_CMD_PART ) == 0); if ( !bInternal ) @@ -354,9 +353,8 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r m_aCommandVector.clear(); // Retrieve layout manager for additional information - OUString aEmptyString; - Reference< awt::XMenuExtended > xMenuExtended( rPopupMenu, UNO_QUERY ); - Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( m_xFrame )); + OUString aEmptyString; + Reference< XLayoutManager > xLayoutManager( getLayoutManagerFromFrame( m_xFrame )); m_bResetActive = sal_False; if ( xLayoutManager.is() ) @@ -467,7 +465,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu >& r // Store complete uno-command so it can also be dispatched. This is necessary to support // the test tool! - xMenuExtended->setCommand( nIndex, aCmd ); + rPopupMenu->setCommand( nIndex, aCmd ); ++nIndex; } @@ -595,7 +593,7 @@ void SAL_CALL ToolbarsMenuController::statusChanged( const FeatureStateEvent& Ev } // XMenuListener -void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) +void SAL_CALL ToolbarsMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) throw (RuntimeException) { Reference< css::awt::XPopupMenu > xPopupMenu; Reference< XComponentContext > xContext; @@ -754,7 +752,7 @@ void SAL_CALL ToolbarsMenuController::select( const css::awt::MenuEvent& rEvent } } -void SAL_CALL ToolbarsMenuController::activate( const css::awt::MenuEvent& ) throw (RuntimeException) +void SAL_CALL ToolbarsMenuController::itemActivated( const css::awt::MenuEvent& ) throw (RuntimeException) { std::vector< OUString > aCmdVector; Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); -- cgit