diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-13 14:50:36 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-14 06:36:24 +0000 |
commit | 793904ff3a7d8cceafab3d83a562261c4c17fd14 (patch) | |
tree | 66678c358588a687d56e8d1df221f13f24806b18 /sfx2 | |
parent | 2ec4a66b6d049f5d11f4ceb993ed907c790ed592 (diff) |
use more VCLXPopupMenu instead of XPopupMenu
which avoids a bunch of casting and makes the dependency explicit
instead of implicit
Change-Id: I754da72916fbbc51e7edc3c806155da34d347bd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145472
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 8 | ||||
-rw-r--r-- | sfx2/source/notebookbar/NotebookbarTabControl.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 10 |
3 files changed, 10 insertions, 12 deletions
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 17edf97cc16d..e72f4706dd8e 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1801,10 +1801,9 @@ boost::property_tree::ptree fillPopupMenu(Menu* pMenu) } -boost::property_tree::ptree SfxDispatcher::fillPopupMenu(const css::uno::Reference<css::awt::XPopupMenu>& rPopupMenu) +boost::property_tree::ptree SfxDispatcher::fillPopupMenu(const rtl::Reference<VCLXPopupMenu>& rPopupMenu) { - VCLXMenu* pAwtMenu = comphelper::getFromUnoTunnel<VCLXMenu>(rPopupMenu); - PopupMenu* pVCLMenu = static_cast<PopupMenu*>(pAwtMenu->GetMenu()); + PopupMenu* pVCLMenu = static_cast<PopupMenu*>(rPopupMenu->GetMenu()); return ::fillPopupMenu(pVCLMenu); } @@ -1821,8 +1820,7 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window* pWin, c xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext ), css::uno::UNO_QUERY ); - css::uno::Reference< css::awt::XPopupMenu > xPopupMenu( xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.awt.PopupMenu", xContext ), css::uno::UNO_QUERY ); + rtl::Reference< VCLXPopupMenu > xPopupMenu = new VCLXPopupMenu(); if ( !xPopupController.is() || !xPopupMenu.is() ) return; diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx index 706add207855..f64e16e2a42c 100644 --- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx +++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx @@ -34,6 +34,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/propertyvalue.hxx> #include <sidebar/SidebarToolBox.hxx> +#include <toolkit/awt/vclxmenu.hxx> #include <cppuhelper/implbase.hxx> #define ICON_SIZE 25 @@ -341,8 +342,7 @@ IMPL_LINK(NotebookbarTabControl, OpenNotebookbarPopupMenu, NotebookBar*, pNotebo xContext->getServiceManager()->createInstanceWithArgumentsAndContext( "com.sun.star.comp.framework.ResourceMenuController", aArgs, xContext), UNO_QUERY); - Reference<css::awt::XPopupMenu> xPopupMenu(xContext->getServiceManager()->createInstanceWithContext( - "com.sun.star.awt.PopupMenu", xContext), UNO_QUERY); + rtl::Reference<VCLXPopupMenu> xPopupMenu = new VCLXPopupMenu(); if (!xPopupController.is() || !xPopupMenu.is()) return; diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 108574d410e2..1d494878a0a2 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -89,6 +89,7 @@ #include <iostream> #include <vector> #include <libxml/xmlwriter.h> +#include <toolkit/awt/vclxmenu.hxx> using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -1877,9 +1878,9 @@ void SfxViewShell::RemoveContextMenuInterceptor_Impl( const uno::Reference< ui:: pImpl->aInterceptorContainer.removeInterface( g, xInterceptor ); } -bool SfxViewShell::TryContextMenuInterception(const css::uno::Reference<css::awt::XPopupMenu>& rIn, +bool SfxViewShell::TryContextMenuInterception(const rtl::Reference<VCLXPopupMenu>& rIn, const OUString& rMenuIdentifier, - css::uno::Reference<css::awt::XPopupMenu>& rOut, + rtl::Reference<VCLXPopupMenu>& rOut, ui::ContextMenuExecuteEvent aEvent) { rOut.clear(); @@ -1940,15 +1941,14 @@ bool SfxViewShell::TryContextMenuInterception(const css::uno::Reference<css::awt if (bModified) { // container was modified, create a new menu out of it - css::uno::Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext(), css::uno::UNO_SET_THROW); - rOut.set(xContext->getServiceManager()->createInstanceWithContext("com.sun.star.awt.PopupMenu", xContext), css::uno::UNO_QUERY_THROW); + rOut = new VCLXPopupMenu(); ::framework::ActionTriggerHelper::CreateMenuFromActionTriggerContainer(rOut, aEvent.ActionTriggerContainer); } return true; } -bool SfxViewShell::TryContextMenuInterception(const css::uno::Reference<css::awt::XPopupMenu>& rPopupMenu, +bool SfxViewShell::TryContextMenuInterception(const rtl::Reference<VCLXPopupMenu>& rPopupMenu, const OUString& rMenuIdentifier, css::ui::ContextMenuExecuteEvent aEvent) { bool bModified = false; |