diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-12-11 14:35:22 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-12-11 21:22:39 +0100 |
commit | b31e525bc210c6e9168d67d5ea8c53206974f196 (patch) | |
tree | 97d8ac49d0771a0d46308db8c8c4666044219500 /dbaccess/source | |
parent | 41200eb5f542f5aa744f90cbd56d614b02e1ee47 (diff) |
prefer css::awt::XPopupMenu api
Change-Id: I1d930c1c7ea06d066f3ae35eb0535290a02a2f58
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126663
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess/source')
-rw-r--r-- | dbaccess/source/ui/control/dbtreelistbox.cxx | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index 2fd21fac1318..aab0f5efcc9f 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -21,6 +21,7 @@ #include <dbexchange.hxx> #include <callbacks.hxx> +#include <com/sun/star/awt/PopupMenuDirection.hpp> #include <com/sun/star/ui/XContextMenuInterceptor.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/XController.hpp> @@ -382,6 +383,8 @@ IMPL_LINK(TreeListBox, CommandHdl, const CommandEvent&, rCEvt, bool) VclPtr<vcl::Window> xMenuParent = m_pContextMenuProvider->getMenuParent(); + css::uno::Reference< css::awt::XWindow> xSourceWindow = VCLUnoHelper::GetInterface(xMenuParent); + rtl::Reference xPopupMenu( new VCLXPopupMenu ); xMenuController->setPopupMenu( xPopupMenu ); VclPtr<PopupMenu> pContextMenu( static_cast< PopupMenu* >( xPopupMenu->GetMenu() ) ); @@ -393,7 +396,7 @@ IMPL_LINK(TreeListBox, CommandHdl, const CommandEvent&, rCEvt, bool) OUString aMenuIdentifier( "private:resource/popupmenu/" + aResourceName ); ContextMenuExecuteEvent aEvent; - aEvent.SourceWindow = VCLUnoHelper::GetInterface(xMenuParent); + aEvent.SourceWindow = xSourceWindow; aEvent.ExecutePosition.X = -1; aEvent.ExecutePosition.Y = -1; aEvent.ActionTriggerContainer = ::framework::ActionTriggerHelper::CreateActionTriggerContainerFromMenu( @@ -443,7 +446,7 @@ IMPL_LINK(TreeListBox, CommandHdl, const CommandEvent&, rCEvt, bool) if ( bModifiedMenu ) { - pContextMenu->Clear(); + xPopupMenu->clear(); ::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer( pContextMenu, aEvent.ActionTriggerContainer ); aEvent.ActionTriggerContainer.clear(); @@ -454,7 +457,8 @@ IMPL_LINK(TreeListBox, CommandHdl, const CommandEvent&, rCEvt, bool) m_pContextMenuProvider->adjustMenuPosition(*m_xTreeView, aPos); // do action for selected entry in popup menu - pContextMenu->Execute(xMenuParent, aPos); + css::uno::Reference<css::awt::XWindowPeer> xParent(xSourceWindow, css::uno::UNO_QUERY); + xPopupMenu->execute(xParent, css::awt::Rectangle(aPos.X(), aPos.Y(), 1, 1), css::awt::PopupMenuDirection::EXECUTE_DOWN); pContextMenu.disposeAndClear(); css::uno::Reference<css::lang::XComponent> xComponent(xMenuController, css::uno::UNO_QUERY); |