diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-13 10:40:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-13 14:48:24 +0200 |
commit | 32b09faca508ae4aac7e100c98a2fe56d3302eef (patch) | |
tree | df4c3f089cd83b361c3f5133344397d9d888e9b5 /toolkit/source/helper | |
parent | 013a4f1f5c9ea5fb511568c53a7e76d1b365a65d (diff) |
Revert "simplify the vcl<->toolkit connection"
because it introduces a link-time dependency of vcl on toolkit,
and toolkit already depends on vcl
This reverts commit f7a86c5cdf4323c99d26512bf78de7f7c380667d.
Change-Id: Ibdd4f3e8221d70e2abd8fcbda67f85af3ac0396e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115547
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit/source/helper')
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 19b0822534a9..ab7d28493c62 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -35,7 +35,7 @@ using namespace ::com::sun::star; -static rtl::Reference<VCLXWindow> CreateXWindow( vcl::Window const * pWindow ) +static css::uno::Reference< css::awt::XWindowPeer > CreateXWindow( vcl::Window const * pWindow ) { switch ( pWindow->GetType() ) { @@ -145,13 +145,13 @@ css::uno::Reference< css::awt::XToolkit> UnoWrapper::GetVCLToolkit() return mxToolkit; } -rtl::Reference<VCLXWindow> UnoWrapper::GetWindowInterface( vcl::Window* pWindow ) +css::uno::Reference< css::awt::XWindowPeer> UnoWrapper::GetWindowInterface( vcl::Window* pWindow ) { - rtl::Reference<VCLXWindow> xPeer = pWindow->GetWindowPeer(); + css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); if ( !xPeer.is() ) { xPeer = CreateXWindow( pWindow ); - SetWindowInterface( pWindow, xPeer.get() ); + SetWindowInterface( pWindow, xPeer ); } return xPeer; } @@ -161,8 +161,10 @@ VclPtr<vcl::Window> UnoWrapper::GetWindow(const css::uno::Reference<css::awt::XW return VCLUnoHelper::GetWindow(rWindow); } -void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pVCLXWindow ) +void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer> xIFace ) { + VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( xIFace ); + DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" ); if ( !pVCLXWindow ) return; @@ -176,7 +178,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pVCLXWind return; } pVCLXWindow->SetWindow( pWindow ); - pWindow->SetWindowPeer( pVCLXWindow ); + pWindow->SetWindowPeer( xIFace, pVCLXWindow ); } css::uno::Reference<css::awt::XPopupMenu> UnoWrapper::CreateMenuInterface( PopupMenu* pPopupMenu ) @@ -225,7 +227,7 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) VclPtr< vcl::Window > pClient = pChild->GetWindow( GetWindowType::Client ); if ( pClient && pClient->GetWindowPeer() ) { - rtl::Reference<VCLXWindow> xComp = pClient->GetComponentInterface( false ); + css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( false ); xComp->dispose(); } @@ -244,7 +246,7 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) if ( pClient && pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) ) { - rtl::Reference<VCLXWindow> xComp = pClient->GetComponentInterface( false ); + css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( false ); xComp->dispose(); } @@ -259,13 +261,13 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) } VCLXWindow* pWindowPeer = pWindow->GetWindowPeer(); - rtl::Reference<VCLXWindow> xWindowPeerComp = pWindow->GetComponentInterface( false ); + uno::Reference< lang::XComponent > xWindowPeerComp = pWindow->GetComponentInterface( false ); OSL_ENSURE( ( pWindowPeer != nullptr ) == xWindowPeerComp.is(), "UnoWrapper::WindowDestroyed: inconsistency in the window's peers!" ); if ( pWindowPeer ) { pWindowPeer->SetWindow( nullptr ); - pWindow->SetWindowPeer( nullptr ); + pWindow->SetWindowPeer( nullptr, nullptr ); } if ( xWindowPeerComp.is() ) xWindowPeerComp->dispose(); |