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 | |
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')
-rw-r--r-- | toolkit/inc/controls/svmedit.hxx | 2 | ||||
-rw-r--r-- | toolkit/inc/helper/unowrapper.hxx | 4 | ||||
-rw-r--r-- | toolkit/source/awt/vclxaccessiblecomponent.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindow.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/svmedit.cxx | 7 | ||||
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 22 |
7 files changed, 24 insertions, 21 deletions
diff --git a/toolkit/inc/controls/svmedit.hxx b/toolkit/inc/controls/svmedit.hxx index 4b7f155dcc3c..33586c84f064 100644 --- a/toolkit/inc/controls/svmedit.hxx +++ b/toolkit/inc/controls/svmedit.hxx @@ -26,7 +26,7 @@ class MultiLineEdit : public VclMultiLineEdit public: MultiLineEdit( vcl::Window* pParent, WinBits nWinStyle ); - virtual VCLXWindow* GetComponentInterface(bool bCreate = true) override; + virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/helper/unowrapper.hxx b/toolkit/inc/helper/unowrapper.hxx index b606a7df70c5..6e10e870506d 100644 --- a/toolkit/inc/helper/unowrapper.hxx +++ b/toolkit/inc/helper/unowrapper.hxx @@ -51,8 +51,8 @@ public: virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) override; // Window - virtual rtl::Reference<VCLXWindow> GetWindowInterface( vcl::Window* pWindow ) override; - virtual void SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pIFace ) override; + virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override; + virtual void SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer> xIFace ) override; virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) override; // Menu diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 46fad7979c9d..101307bf1d96 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -780,7 +780,7 @@ uno::Reference< awt::XFont > SAL_CALL VCLXAccessibleComponent::getFont( ) VclPtr<vcl::Window> pWindow = GetWindow(); if ( pWindow ) { - auto xDev = pWindow->GetComponentInterfaceAs<awt::XDevice>(); + uno::Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), uno::UNO_QUERY ); if ( xDev.is() ) { vcl::Font aFont; diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 287dc93f9676..10eb7f8019e2 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1946,9 +1946,9 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( else { xRef = pNewComp; - pNewWindow->SetComponentInterface( pNewComp.get() ); + pNewWindow->SetComponentInterface( xRef ); } - DBG_ASSERT( pNewWindow->GetComponentInterface( false ) == pNewComp.get(), + DBG_ASSERT( pNewWindow->GetComponentInterface( false ) == xRef, "VCLXToolkit::createWindow: did #133706# resurge?" ); if ( rDescriptor.WindowAttributes & css::awt::WindowAttribute::SHOW ) @@ -2502,7 +2502,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, break; } if (pFocus != nullptr) - xNext = static_cast<cppu::OWeakObject*>(pFocus->GetComponentInterface()); + xNext = pFocus->GetComponentInterface(); css::awt::FocusEvent aAwtEvent( static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()), static_cast<sal_Int16>(pWindow->GetGetFocusFlags()), diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index d770b8570234..dfc6ba8f7c00 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -912,7 +912,7 @@ void VCLXWindow::dispose( ) if ( auto pWindow = GetWindow() ) { pWindow->RemoveEventListener( LINK( this, VCLXWindow, WindowEventListener ) ); - pWindow->SetWindowPeer( nullptr ); + pWindow->SetWindowPeer( nullptr, nullptr ); pWindow->SetAccessible( nullptr ); VclPtr<OutputDevice> pOutDev = GetOutputDevice(); diff --git a/toolkit/source/controls/svmedit.cxx b/toolkit/source/controls/svmedit.cxx index 2abd5e4ebed2..383f2280412e 100644 --- a/toolkit/source/controls/svmedit.cxx +++ b/toolkit/source/controls/svmedit.cxx @@ -26,10 +26,11 @@ MultiLineEdit::MultiLineEdit(vcl::Window* pParent, WinBits nWinStyle) } // virtual -VCLXWindow* MultiLineEdit::GetComponentInterface(bool bCreate) +css::uno::Reference<css::awt::XWindowPeer> MultiLineEdit::GetComponentInterface(bool bCreate) { - VCLXWindow* xPeer = VclMultiLineEdit::GetComponentInterface(false); - if (!xPeer && bCreate) + css::uno::Reference<css::awt::XWindowPeer> xPeer( + VclMultiLineEdit::GetComponentInterface(false)); + if (!xPeer.is() && bCreate) { rtl::Reference<VCLXMultiLineEdit> xVCLMEdit(new VCLXMultiLineEdit); xVCLMEdit->SetWindow(this); 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(); |