diff options
-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); |