diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-12 15:07:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-12 19:57:24 +0200 |
commit | f7a86c5cdf4323c99d26512bf78de7f7c380667d (patch) | |
tree | f299cbf4ca27b5db0e81a90cc6551469fa280e63 /sfx2 | |
parent | c5e5467f6a13aba68b4706a4d7feb130e824bcc6 (diff) |
simplify the vcl<->toolkit connection
No need to store two different pointers and hide the
underlying class behind an UNO interface
Change-Id: I72c55e912caa9eae1cffa6c9d1b1d480e5668d40
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115496
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/iframe.cxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/ipclient.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/view/sfxbasecontroller.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/userinputinterception.cxx | 4 |
4 files changed, 6 insertions, 7 deletions
diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index eff4588b3b5f..578c6a071336 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -164,14 +164,14 @@ sal_Bool SAL_CALL IFrameObject::load( pWin->SetBackground(); pWin->Show(); - uno::Reference < awt::XWindow > xWindow( pWin->GetComponentInterface(), uno::UNO_QUERY ); + auto xWindow = pWin->GetComponentInterfaceAs<awt::XWindow>(); xFrame->setComponent( xWindow, uno::Reference < frame::XController >() ); // we must destroy the IFrame before the parent is destroyed xWindow->addEventListener( this ); mxFrame = frame::Frame::create( mxContext ); - uno::Reference < awt::XWindow > xWin( pWin->GetComponentInterface(), uno::UNO_QUERY ); + auto xWin = pWin->GetComponentInterfaceAs<awt::XWindow>(); mxFrame->initialize( xWin ); mxFrame->setName( maFrmDescr.GetName() ); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 3c40c7bdf4a6..d92771872fe8 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -567,8 +567,7 @@ uno::Reference< awt::XWindow > SAL_CALL SfxInPlaceClient_Impl::getWindow() if ( !m_pClient || !m_pClient->GetEditWin() ) throw uno::RuntimeException(); - uno::Reference< awt::XWindow > xWin( m_pClient->GetEditWin()->GetComponentInterface(), uno::UNO_QUERY ); - return xWin; + return m_pClient->GetEditWin()->GetComponentInterfaceAs<awt::XWindow>(); } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 8f5bfddba32d..98462d587722 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -445,7 +445,7 @@ Reference< XWindow > SAL_CALL SfxBaseController::getComponentWindow() if ( !m_pData->m_pViewShell ) throw DisposedException(); - return Reference< XWindow >( GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); + return GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterfaceAs<XWindow>(); } OUString SAL_CALL SfxBaseController::getViewControllerName() diff --git a/sfx2/source/view/userinputinterception.cxx b/sfx2/source/view/userinputinterception.cxx index ca1a1fd3f622..0f669fac7d66 100644 --- a/sfx2/source/view/userinputinterception.cxx +++ b/sfx2/source/view/userinputinterception.cxx @@ -184,7 +184,7 @@ namespace sfx2 KeyEvent aEvent; lcl_initKeyEvent( aEvent, *_rEvent.GetKeyEvent() ); if ( _rEvent.GetWindow() ) - aEvent.Source = _rEvent.GetWindow()->GetComponentInterface(); + aEvent.Source = static_cast<cppu::OWeakObject*>(_rEvent.GetWindow()->GetComponentInterface()); ::comphelper::OInterfaceIteratorHelper2 aIterator( m_pData->m_aKeyHandlers ); while ( aIterator.hasMoreElements() ) @@ -222,7 +222,7 @@ namespace sfx2 MouseEvent aEvent; lcl_initMouseEvent( aEvent, *_rEvent.GetMouseEvent() ); if ( _rEvent.GetWindow() ) - aEvent.Source = _rEvent.GetWindow()->GetComponentInterface(); + aEvent.Source = static_cast<cppu::OWeakObject*>(_rEvent.GetWindow()->GetComponentInterface()); ::comphelper::OInterfaceIteratorHelper2 aIterator( m_pData->m_aMouseClickHandlers ); while ( aIterator.hasMoreElements() ) |