diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-06-09 14:29:45 +0300 |
---|---|---|
committer | Maxim Monastirsky <momonasmon@gmail.com> | 2016-06-09 12:53:43 +0000 |
commit | bdd67652b6b60164220c259b5c4dbef1aba85102 (patch) | |
tree | 2675c938dfc5ffdf5a48d0f7cd88dc2f1c576b1d /chart2 | |
parent | 2c08ec226e771de10c8863b7f1cda016fea442d2 (diff) |
Try to get rid of svt::ContextMenuHelper
Change-Id: I7b43e417607b20c300e3c18e7da76a6173a18b7d
Reviewed-on: https://gerrit.libreoffice.org/26098
Reviewed-by: Maxim Monastirsky <momonasmon@gmail.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 639dfa8d0fd9..40f196f5935a 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -58,7 +58,6 @@ #include <comphelper/propertysequence.hxx> #include <comphelper/propertyvalue.hxx> -#include <svtools/contextmenuhelper.hxx> #include <toolkit/awt/vclxmenu.hxx> #include <svx/svxids.hrc> @@ -962,31 +961,10 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) aPos = m_pChartWindow->GetPointerState().maPos; } + OUString aMenuName; if ( isShapeContext() ) - { // #i12587# support for shapes in chart - OUString aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUString( "drawtext" ) : OUString( "draw" ); - css::uno::Sequence< css::uno::Any > aArgs( 3 ); - aArgs[0] <<= comphelper::makePropertyValue( "Value", aMenuName ); - aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_xFrame ); - aArgs[2] <<= comphelper::makePropertyValue( "IsContextMenu", true ); - - css::uno::Reference< css::frame::XPopupMenuController > xPopupController( - m_xCC->getServiceManager()->createInstanceWithArgumentsAndContext( - "com.sun.star.comp.framework.ResourceMenuController", aArgs, m_xCC ), css::uno::UNO_QUERY ); - - if ( !xPopupController.is() || !xPopupMenu.is() ) - return; - - xPopupController->setPopupMenu( xPopupMenu ); - xPopupMenu->execute( css::uno::Reference< css::awt::XWindowPeer >( m_xFrame->getContainerWindow(), css::uno::UNO_QUERY ), - css::awt::Rectangle( aPos.X(), aPos.Y(), 0, 0 ), - css::awt::PopupMenuDirection::EXECUTE_DEFAULT ); - - css::uno::Reference< css::lang::XComponent > xComponent( xPopupController, css::uno::UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } + aMenuName = m_pDrawViewWrapper->IsTextEdit() ? OUString( "drawtext" ) : OUString( "draw" ); else { // todo: the context menu should be specified by an xml file in uiconfig @@ -1236,11 +1214,30 @@ void ChartController::execute_Command( const CommandEvent& rCEvt ) lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DataRanges" ); lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:DiagramData" ); lcl_insertMenuCommand( xPopupMenu, nUniqueId++, ".uno:View3D" ); - - ::svt::ContextMenuHelper aContextMenuHelper( m_xFrame ); - aContextMenuHelper.completeAndExecute( aPos, xPopupMenu ); } } + + css::uno::Sequence< css::uno::Any > aArgs( aMenuName.isEmpty() ? 2 : 3 ); + aArgs[0] <<= comphelper::makePropertyValue( "IsContextMenu", true ); + aArgs[1] <<= comphelper::makePropertyValue( "Frame", m_xFrame ); + if ( !aMenuName.isEmpty() ) + aArgs[2] <<= comphelper::makePropertyValue( "Value", aMenuName ); + + css::uno::Reference< css::frame::XPopupMenuController > xPopupController( + m_xCC->getServiceManager()->createInstanceWithArgumentsAndContext( + "com.sun.star.comp.framework.ResourceMenuController", aArgs, m_xCC ), css::uno::UNO_QUERY ); + + if ( !xPopupController.is() || !xPopupMenu.is() ) + return; + + xPopupController->setPopupMenu( xPopupMenu ); + xPopupMenu->execute( css::uno::Reference< css::awt::XWindowPeer >( m_xFrame->getContainerWindow(), css::uno::UNO_QUERY ), + css::awt::Rectangle( aPos.X(), aPos.Y(), 0, 0 ), + css::awt::PopupMenuDirection::EXECUTE_DEFAULT ); + + css::uno::Reference< css::lang::XComponent > xComponent( xPopupController, css::uno::UNO_QUERY ); + if ( xComponent.is() ) + xComponent->dispose(); } else if( ( rCEvt.GetCommand() == CommandEventId::StartExtTextInput ) || ( rCEvt.GetCommand() == CommandEventId::ExtTextInput ) || |