From afa35742a4633db31b6d6c72cf45741506e9edfb Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sat, 11 Dec 2021 21:09:39 +0000 Subject: prefer more css::awt::XPopupMenu api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib008281d63071ea79935af83cbe434be66155455 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126692 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sfx2/source/view/viewsh.cxx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 03cd1fe842d0..8fdf33487a56 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -1850,7 +1849,8 @@ void SfxViewShell::RemoveContextMenuInterceptor_Impl( const uno::Reference< ui:: pImpl->aInterceptorContainer.removeInterface( xInterceptor ); } -bool SfxViewShell::TryContextMenuInterception(const Menu& rIn, const OUString& rMenuIdentifier, +bool SfxViewShell::TryContextMenuInterception(const css::uno::Reference& rIn, + const OUString& rMenuIdentifier, css::uno::Reference& rOut, ui::ContextMenuExecuteEvent aEvent) { @@ -1859,7 +1859,7 @@ bool SfxViewShell::TryContextMenuInterception(const Menu& rIn, const OUString& r // create container from menu aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu( - &rIn, &rMenuIdentifier ); + rIn, &rMenuIdentifier); // get selection from controller aEvent.Selection.set( GetController(), uno::UNO_QUERY ); @@ -1920,15 +1920,11 @@ bool SfxViewShell::TryContextMenuInterception(const Menu& rIn, const OUString& r bool SfxViewShell::TryContextMenuInterception(const css::uno::Reference& rPopupMenu, const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent) { - VCLXMenu* pAwtMenu = comphelper::getFromUnoTunnel(rPopupMenu); - PopupMenu* pVCLMenu = static_cast(pAwtMenu->GetMenu()); - if (!pVCLMenu) - return false; - bool bModified = false; // create container from menu - aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu(pVCLMenu, &rMenuIdentifier); + aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu( + rPopupMenu, &rMenuIdentifier); // get selection from controller aEvent.Selection = css::uno::Reference< css::view::XSelectionSupplier >( GetController(), css::uno::UNO_QUERY ); -- cgit