diff options
46 files changed, 105 insertions, 98 deletions
diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index f450bfc526f0..218ed1cab071 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -458,7 +458,7 @@ namespace accessibility Reference< awt::XFont > xFont; if ( m_pTabBar ) { - auto xDev = m_pTabBar->GetComponentInterfaceAs<awt::XDevice>(); + Reference< awt::XDevice > xDev( m_pTabBar->GetComponentInterface(), UNO_QUERY ); if ( xDev.is() ) { vcl::Font aFont; diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx index e004c2b1942b..be9b1e6f453e 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/accessibility/source/standard/accessiblemenucomponent.cxx @@ -301,7 +301,7 @@ Reference< awt::XFont > OAccessibleMenuComponent::getFont( ) vcl::Window* pWindow = m_pMenu->GetWindow(); if ( pWindow ) { - auto xDev = pWindow->GetComponentInterfaceAs<awt::XDevice>(); + Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY ); if ( xDev.is() ) { const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index b61385f6671a..f885ff4bda1b 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -495,7 +495,7 @@ Reference< awt::XFont > AccessibleDialogControlShape::getFont( ) vcl::Window* pWindow = GetWindow(); if ( pWindow ) { - auto xDev = pWindow->GetComponentInterfaceAs<awt::XDevice>(); + Reference< awt::XDevice > xDev( pWindow->GetComponentInterface(), UNO_QUERY ); if ( xDev.is() ) { vcl::Font aFont; diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index b91e48262a73..0b641c8aca5e 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -790,7 +790,7 @@ Reference< awt::XFont > AccessibleDialogWindow::getFont( ) Reference< awt::XFont > xFont; if ( m_pDialogWindow ) { - auto xDev = m_pDialogWindow->GetComponentInterfaceAs<awt::XDevice>(); + Reference< awt::XDevice > xDev( m_pDialogWindow->GetComponentInterface(), UNO_QUERY ); if ( xDev.is() ) { vcl::Font aFont; diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx index fd17b340ca54..06045356bccb 100644 --- a/basctl/source/basicide/baside2.hxx +++ b/basctl/source/basicide/baside2.hxx @@ -100,7 +100,7 @@ private: bool bDoSyntaxHighlight; bool bDelayHighlight; - virtual VCLXWindow* GetComponentInterface(bool bCreate = true) override; + virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override; CodeCompleteDataCache aCodeCompleteCache; VclPtr<CodeCompleteWindow> pCodeCompleteWnd; OUString GetActualSubName( sal_uLong nLine ); // gets the actual subroutine name according to line number diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 3168f5090532..ecba2d5fa873 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -2040,10 +2040,11 @@ void ComplexEditorWindow::SetLineNumberDisplay(bool b) Resize(); } -VCLXWindow* +uno::Reference< awt::XWindowPeer > EditorWindow::GetComponentInterface(bool bCreate) { - rtl::Reference< VCLXWindow > xPeer = Window::GetComponentInterface(false); + uno::Reference< awt::XWindowPeer > xPeer( + Window::GetComponentInterface(false)); if (!xPeer.is() && bCreate) { // Make sure edit engine and view are available: @@ -2051,9 +2052,9 @@ EditorWindow::GetComponentInterface(bool bCreate) CreateEditEngine(); xPeer = createTextWindowPeer(*GetEditView()); - SetComponentInterface(xPeer.get()); + SetComponentInterface(xPeer); } - return xPeer.get(); + return xPeer; } static sal_uInt32 getCorrectedPropCount(SbxArray* p) diff --git a/basctl/source/basicide/textwindowpeer.cxx b/basctl/source/basicide/textwindowpeer.cxx index cbe9781fce90..fc458453778b 100644 --- a/basctl/source/basicide/textwindowpeer.cxx +++ b/basctl/source/basicide/textwindowpeer.cxx @@ -62,7 +62,7 @@ TextWindowPeer::CreateAccessibleContext() { } -rtl::Reference<VCLXWindow> basctl::createTextWindowPeer( +css::uno::Reference<css::awt::XWindowPeer> basctl::createTextWindowPeer( TextView & view) { return new TextWindowPeer(view); diff --git a/basctl/source/basicide/textwindowpeer.hxx b/basctl/source/basicide/textwindowpeer.hxx index 701c134c3a5f..077ad32cd79f 100644 --- a/basctl/source/basicide/textwindowpeer.hxx +++ b/basctl/source/basicide/textwindowpeer.hxx @@ -21,14 +21,17 @@ #include <sal/config.h> -#include <rtl/ref.hxx> +#include <com/sun/star/uno/Reference.hxx> -class VCLXWindow; +namespace com::sun::star::awt +{ +class XWindowPeer; +} class TextView; namespace basctl { -rtl::Reference<VCLXWindow> createTextWindowPeer(TextView& view); +css::uno::Reference<css::awt::XWindowPeer> createTextWindowPeer(TextView& view); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx index 544084306fdf..08b8c65c31f7 100644 --- a/chart2/source/controller/main/ChartController.cxx +++ b/chart2/source/controller/main/ChartController.cxx @@ -436,7 +436,7 @@ void SAL_CALL ChartController::attachFrame( SolarMutexGuard aSolarGuard; auto pChartWindow = VclPtr<ChartWindow>::Create(this,pParent,pParent?pParent->GetStyle():0); pChartWindow->SetBackground();//no Background - m_xViewWindow = pChartWindow->GetComponentInterfaceAs<css::awt::XWindow>(); + m_xViewWindow.set( pChartWindow->GetComponentInterface(), uno::UNO_QUERY ); pChartWindow->Show(); m_apDropTargetHelper.reset( new ChartDropTargetHelper( pChartWindow->GetDropTarget(), diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx index 8681775233d4..763e53990276 100644 --- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx +++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx @@ -36,7 +36,7 @@ namespace dbaui using namespace ::com::sun::star; OConnectionLineAccess::OConnectionLineAccess(OTableConnection* _pLine) - : VCLXAccessibleComponent(_pLine->GetComponentInterface() ? _pLine->GetWindowPeer() : nullptr) + : VCLXAccessibleComponent(_pLine->GetComponentInterface().is() ? _pLine->GetWindowPeer() : nullptr) ,m_pLine(_pLine) { } diff --git a/dbaccess/source/ui/querydesign/JAccess.cxx b/dbaccess/source/ui/querydesign/JAccess.cxx index 9785708fe9da..8068f0fa7f21 100644 --- a/dbaccess/source/ui/querydesign/JAccess.cxx +++ b/dbaccess/source/ui/querydesign/JAccess.cxx @@ -33,7 +33,7 @@ namespace dbaui using namespace ::com::sun::star::lang; OJoinDesignViewAccess::OJoinDesignViewAccess(OJoinTableView* _pTableView) - :VCLXAccessibleComponent(_pTableView->GetComponentInterface() ? _pTableView->GetWindowPeer() : nullptr) + :VCLXAccessibleComponent(_pTableView->GetComponentInterface().is() ? _pTableView->GetWindowPeer() : nullptr) ,m_pTableView(_pTableView) { } diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx index d0201d8f6230..1dc69e763d5d 100644 --- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx @@ -36,7 +36,7 @@ namespace dbaui using namespace ::com::sun::star; OTableWindowAccess::OTableWindowAccess(OTableWindow* _pTable) - :VCLXAccessibleComponent(_pTable->GetComponentInterface() ? _pTable->GetWindowPeer() : nullptr) + :VCLXAccessibleComponent(_pTable->GetComponentInterface().is() ? _pTable->GetWindowPeer() : nullptr) ,m_pTable(_pTable) { } diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 4d170744b687..cb1edd54fef4 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -227,7 +227,7 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, pMyWindow->createBottomFrame(pView); - auto xWin = pMyWindow->GetComponentInterfaceAs<awt::XWindow>(); + Reference< awt::XWindow > xWin ( pMyWindow->GetComponentInterface(), UNO_QUERY ); Reference< XController > xCtrRef( new BibFrameController_Impl( xWin, m_xDatMan.get() ) ); diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 8915012c4c71..e83580689435 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -661,7 +661,7 @@ void BibFrameController_Impl::addStatusListener( m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) ); if (m_xLastQueriedFocusWin) { - Reference<css::awt::XTextComponent> xEdit = m_xLastQueriedFocusWin->GetComponentInterfaceAs<css::awt::XTextComponent>(); + Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY); aEvent.IsEnabled = xEdit && xEdit->isEditable() && !xEdit->getSelectedText().isEmpty(); } } @@ -670,7 +670,7 @@ void BibFrameController_Impl::addStatusListener( m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) ); if (m_xLastQueriedFocusWin) { - auto xEdit = m_xLastQueriedFocusWin->GetComponentInterfaceAs<css::awt::XTextComponent>(); + Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY); aEvent.IsEnabled = xEdit && !xEdit->getSelectedText().isEmpty(); } } @@ -680,7 +680,7 @@ void BibFrameController_Impl::addStatusListener( m_xLastQueriedFocusWin = lcl_GetFocusChild( VCLUnoHelper::GetWindow( m_xWindow ) ); if (m_xLastQueriedFocusWin) { - auto xEdit = m_xLastQueriedFocusWin->GetComponentInterfaceAs<css::awt::XTextComponent>(); + Reference<css::awt::XTextComponent> xEdit(m_xLastQueriedFocusWin->GetComponentInterface(), css::uno::UNO_QUERY); if (xEdit && !xEdit->isEditable()) { uno::Reference< datatransfer::clipboard::XClipboard > xClip = m_xLastQueriedFocusWin->GetClipboard(); diff --git a/forms/source/richtext/richtextcontrol.cxx b/forms/source/richtext/richtextcontrol.cxx index def1ea106bbf..45e898b8ed13 100644 --- a/forms/source/richtext/richtextcontrol.cxx +++ b/forms/source/richtext/richtextcontrol.cxx @@ -272,7 +272,7 @@ namespace frm VclPtrInstance<RichTextControl> pRichTextControl( pEngine, _pParentWindow, _nStyle, nullptr, pPeer.get() ); // some knittings - pRichTextControl->SetComponentInterface( pPeer.get() ); + pRichTextControl->SetComponentInterface( pPeer ); // outta here return pPeer; diff --git a/forms/source/solar/component/navbarcontrol.cxx b/forms/source/solar/component/navbarcontrol.cxx index 5853ae148956..14e9c27ce74f 100644 --- a/forms/source/solar/component/navbarcontrol.cxx +++ b/forms/source/solar/component/navbarcontrol.cxx @@ -216,7 +216,7 @@ namespace frm // some knittings pNavBar->setDispatcher( pPeer.get() ); - pNavBar->SetComponentInterface( pPeer.get() ); + pNavBar->SetComponentInterface( pPeer ); // we want a faster repeating rate for the slots in this // toolbox diff --git a/include/vcl/toolkit/unowrap.hxx b/include/vcl/toolkit/unowrap.hxx index 66fc099819aa..46f1e0845cc0 100644 --- a/include/vcl/toolkit/unowrap.hxx +++ b/include/vcl/toolkit/unowrap.hxx @@ -27,7 +27,6 @@ #include <com/sun/star/uno/Reference.h> #include <vcl/dllapi.h> #include <vcl/vclptr.hxx> -#include <toolkit/awt/vclxwindow.hxx> namespace vcl { class Window; } class Menu; @@ -57,8 +56,8 @@ public: virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) = 0; // Window - virtual rtl::Reference<VCLXWindow> GetWindowInterface( vcl::Window* pWindow ) = 0; - virtual void SetWindowInterface( vcl::Window* pWindow, VCLXWindow* pIFace ) = 0; + virtual css::uno::Reference<css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) = 0; + virtual void SetWindowInterface( vcl::Window* pWindow, css::uno::Reference< css::awt::XWindowPeer > xIFace ) = 0; virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) = 0; // PopupMenu diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 5d3aed7c3ea3..17fbf4d876ed 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -22,7 +22,6 @@ #include <vcl/dllapi.h> #include <vcl/outdev.hxx> -#include <toolkit/awt/vclxwindow.hxx> #include <tools/link.hxx> #include <tools/wintypes.hxx> #include <vcl/vclenum.hxx> @@ -1130,13 +1129,10 @@ public: virtual const SystemEnvData* GetSystemData() const; // API to set/query the component interfaces - virtual VCLXWindow* GetComponentInterface( bool bCreate = true ); - void SetComponentInterface( VCLXWindow* pIFace ); - // Utility method to make the GetComponentInterface call sites less verbose - template<typename T> - css::uno::Reference<T> GetComponentInterfaceAs() - { return css::uno::Reference<T>(static_cast<cppu::OWeakObject*>(GetComponentInterface()), css::uno::UNO_QUERY); } + virtual css::uno::Reference< css::awt::XWindowPeer > + GetComponentInterface( bool bCreate = true ); + void SetComponentInterface( css::uno::Reference< css::awt::XWindowPeer > const & xIFace ); /// Interface to register for dialog / window tunneling. void SetLOKNotifier(const vcl::ILibreOfficeKitNotifier* pNotifier, bool bParent = false); @@ -1262,7 +1258,7 @@ public: // set and retrieve for Toolkit VCLXWindow* GetWindowPeer() const; - void SetWindowPeer( VCLXWindow* pVCLXWindow ); + void SetWindowPeer( css::uno::Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow ); // remember if it was generated by Toolkit bool IsCreatedWithToolkit() const; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 36e7c7fe134b..c6c1f5250bf3 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2660,7 +2660,7 @@ bool ScGridWindow::PreNotify( NotifyEvent& rNEvt ) css::awt::MouseEvent aEvent; lcl_InitMouseEvent( aEvent, *rNEvt.GetMouseEvent() ); if ( rNEvt.GetWindow() ) - aEvent.Source = static_cast<cppu::OWeakObject*>(rNEvt.GetWindow()->GetComponentInterface()); + aEvent.Source = rNEvt.GetWindow()->GetComponentInterface(); if ( nType == MouseNotifyEvent::MOUSEBUTTONDOWN) bDone = pImp->MousePressed( aEvent ); else diff --git a/sd/source/ui/presenter/PresenterHelper.cxx b/sd/source/ui/presenter/PresenterHelper.cxx index a319b9682847..7504e914e475 100644 --- a/sd/source/ui/presenter/PresenterHelper.cxx +++ b/sd/source/ui/presenter/PresenterHelper.cxx @@ -76,7 +76,7 @@ Reference<awt::XWindow> SAL_CALL PresenterHelper::createWindow ( { pWindow = VclPtr<vcl::Window>::Create(pParentWindow); } - auto xWindow = pWindow->GetComponentInterfaceAs<awt::XWindow>(); + Reference<awt::XWindow> xWindow (pWindow->GetComponentInterface(), UNO_QUERY); if (bEnableChildTransparentMode) { diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 578c6a071336..eff4588b3b5f 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(); - auto xWindow = pWin->GetComponentInterfaceAs<awt::XWindow>(); + uno::Reference < awt::XWindow > xWindow( pWin->GetComponentInterface(), uno::UNO_QUERY ); 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 ); - auto xWin = pWin->GetComponentInterfaceAs<awt::XWindow>(); + uno::Reference < awt::XWindow > xWin( pWin->GetComponentInterface(), uno::UNO_QUERY ); mxFrame->initialize( xWin ); mxFrame->setName( maFrmDescr.GetName() ); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index d92771872fe8..3c40c7bdf4a6 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -567,7 +567,8 @@ uno::Reference< awt::XWindow > SAL_CALL SfxInPlaceClient_Impl::getWindow() if ( !m_pClient || !m_pClient->GetEditWin() ) throw uno::RuntimeException(); - return m_pClient->GetEditWin()->GetComponentInterfaceAs<awt::XWindow>(); + uno::Reference< awt::XWindow > xWin( m_pClient->GetEditWin()->GetComponentInterface(), uno::UNO_QUERY ); + return xWin; } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 98462d587722..8f5bfddba32d 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 GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterfaceAs<XWindow>(); + return Reference< XWindow >( GetViewFrame_Impl().GetFrame().GetWindow().GetComponentInterface(), UNO_QUERY_THROW ); } OUString SAL_CALL SfxBaseController::getViewControllerName() diff --git a/sfx2/source/view/userinputinterception.cxx b/sfx2/source/view/userinputinterception.cxx index 0f669fac7d66..ca1a1fd3f622 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 = static_cast<cppu::OWeakObject*>(_rEvent.GetWindow()->GetComponentInterface()); + aEvent.Source = _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 = static_cast<cppu::OWeakObject*>(_rEvent.GetWindow()->GetComponentInterface()); + aEvent.Source = _rEvent.GetWindow()->GetComponentInterface(); ::comphelper::OInterfaceIteratorHelper2 aIterator( m_pData->m_aMouseClickHandlers ); while ( aIterator.hasMoreElements() ) diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index 7cd9dbf09b80..f463bf7597f1 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1392,7 +1392,7 @@ css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAc rtl::Reference<SidebarWinAccessible> pAcc( new SidebarWinAccessible( *this, mrView.GetWrtShell(), mrSidebarItem ) ); - SetWindowPeer( pAcc.get() ); + SetWindowPeer( pAcc, pAcc.get() ); return pAcc; } 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(); diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 815586162202..6ca9b9a37031 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -270,11 +270,12 @@ public: OUString maQuickHelpText; OUString maID; InputContext maInputContext; + css::uno::Reference< css::awt::XWindowPeer > mxWindowPeer; css::uno::Reference< css::accessibility::XAccessible > mxAccessible; std::shared_ptr< VclSizeGroup > m_xSizeGroup; std::vector<VclPtr<FixedText>> m_aMnemonicLabels; std::unique_ptr<ImplAccessibleInfos> mpAccessibleInfos; - rtl::Reference<VCLXWindow> mxVCLXWindow; // peer window object from toolkit + VCLXWindow* mpVCLXWindow; vcl::Region maWinRegion; //< region to 'shape' the VCL window (frame coordinates) vcl::Region maWinClipRegion; //< the (clipping) region that finally corresponds to the VCL window (frame coordinates) vcl::Region maInvalidateRegion; //< region that has to be redrawn (frame coordinates) diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index 412ce1006fe9..ee706178bad2 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -288,7 +288,7 @@ void LifecycleTest::testLeakage() void LifecycleTest::testToolkit() { LeakTestObject *pVclWin = LeakTestObject::Create<WorkWindow>(nullptr, WB_APP|WB_STDWORK); - auto xWindow = pVclWin->getRef()->GetComponentInterfaceAs<css::awt::XWindow>(); + css::uno::Reference<css::awt::XWindow> xWindow(pVclWin->getRef()->GetComponentInterface(), css::uno::UNO_QUERY); CPPUNIT_ASSERT(xWindow.is()); // test UNO dispose diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index d31ea0f74b70..4d4a418408c1 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1236,7 +1236,8 @@ css::uno::Reference<css::awt::XWindow> SalInstanceContainer::CreateChildFrame() auto xPage = VclPtr<VclBin>::Create(m_xContainer.get()); xPage->set_expand(true); xPage->Show(); - return xPage->GetComponentInterfaceAs<css::awt::XWindow>(); + return css::uno::Reference<css::awt::XWindow>(xPage->GetComponentInterface(), + css::uno::UNO_QUERY); } std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const @@ -1406,7 +1407,9 @@ OUString SalInstanceWindow::get_title() const { return m_xWindow->GetText(); } css::uno::Reference<css::awt::XWindow> SalInstanceWindow::GetXWindow() { - return m_xWindow->GetComponentInterfaceAs<css::awt::XWindow>(); + css::uno::Reference<css::awt::XWindow> xWindow(m_xWindow->GetComponentInterface(), + css::uno::UNO_QUERY); + return xWindow; } void SalInstanceWindow::resize_to_request() diff --git a/vcl/source/control/fmtfield.cxx b/vcl/source/control/fmtfield.cxx index 2895636122f0..cb55d2ce158a 100644 --- a/vcl/source/control/fmtfield.cxx +++ b/vcl/source/control/fmtfield.cxx @@ -910,7 +910,7 @@ namespace m_rSpinButton.SpinField::SetText(rText, rSel); } - virtual void SetEntryTextColor(const ::Color* pColor) override + virtual void SetEntryTextColor(const Color* pColor) override { if (pColor) m_rSpinButton.SetControlForeground(*pColor); diff --git a/vcl/source/control/ivctrl.cxx b/vcl/source/control/ivctrl.cxx index 1a06d68fe48e..c96e133a506f 100644 --- a/vcl/source/control/ivctrl.cxx +++ b/vcl/source/control/ivctrl.cxx @@ -18,7 +18,6 @@ */ -#include <toolkit/awt/vclxwindow.hxx> #include <vcl/toolkit/ivctrl.hxx> #include "imivctl.hxx" #include <vcl/accessiblefactory.hxx> @@ -422,7 +421,7 @@ css::uno::Reference< XAccessible > SvtIconChoiceCtrl::CreateAccessible() css::uno::Reference< XAccessible > xAccParent = pParent->GetAccessible(); if ( xAccParent.is() ) { - rtl::Reference<VCLXWindow> xHoldAlive(GetComponentInterface()); + css::uno::Reference< css::awt::XWindowPeer > xHoldAlive(GetComponentInterface()); xAccessible = _pImpl->GetAccessibleFactory().createAccessibleIconChoiceCtrl( *this, xAccParent ); } } diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index a21e41969df0..1fc5feaf21fc 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -23,7 +23,6 @@ - SelectAll( false ) => only repaint the deselected entries */ -#include <toolkit/awt/vclxwindow.hxx> #include <vcl/toolkit/treelistbox.hxx> #include <vcl/accessiblefactory.hxx> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -3474,7 +3473,7 @@ css::uno::Reference< XAccessible > SvTreeListBox::CreateAccessible() if ( xAccParent.is() ) { // need to be done here to get the vclxwindow later on in the accessible - rtl::Reference< VCLXWindow > xHoldAlive(GetComponentInterface()); + css::uno::Reference< css::awt::XWindowPeer > xHoldAlive(GetComponentInterface()); xAccessible = pImpl->m_aFactoryAccess.getFactory().createAccessibleTreeListBox( *this, xAccParent ); } } diff --git a/vcl/source/window/accessibility.cxx b/vcl/source/window/accessibility.cxx index 18e4ce23dac6..4e3768286554 100644 --- a/vcl/source/window/accessibility.cxx +++ b/vcl/source/window/accessibility.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <toolkit/awt/vclxwindow.hxx> #include <vcl/layout.hxx> #include <vcl/toolkit/fixed.hxx> #include <vcl/window.hxx> @@ -78,7 +77,8 @@ css::uno::Reference< css::accessibility::XAccessible > Window::GetAccessible( bo css::uno::Reference< css::accessibility::XAccessible > Window::CreateAccessible() { - return GetComponentInterfaceAs<css::accessibility::XAccessible>(); + css::uno::Reference< css::accessibility::XAccessible > xAcc( GetComponentInterface(), css::uno::UNO_QUERY ); + return xAcc; } void Window::SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& x ) diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 7efb43b43aff..882d6c0e985b 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -846,7 +846,7 @@ bool Dialog::Close() if ( xWindow->IsDisposed() ) return false; - if ( mpWindowImpl->mxVCLXWindow.is() && IsCreatedWithToolkit() && !IsInExecute() ) + if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() && !IsInExecute() ) return false; // If there's a cancel button with a custom handler, then always give it a chance to diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 803ce85e8fc3..3b622cf1cd73 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -625,7 +625,7 @@ bool DockingWindow::Close() if ( xWindow->IsDisposed() ) return false; - if ( mpWindowImpl->mxVCLXWindow.is() && IsCreatedWithToolkit() ) + if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() ) return false; Show( false, ShowFlags::NoFocusChange ); diff --git a/vcl/source/window/stacking.cxx b/vcl/source/window/stacking.cxx index a8d58a086cbc..60f7303f33bc 100644 --- a/vcl/source/window/stacking.cxx +++ b/vcl/source/window/stacking.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <toolkit/awt/vclxwindow.hxx> #include <vcl/syswin.hxx> #include <vcl/window.hxx> #include <vcl/taskpanelist.hxx> @@ -620,7 +619,7 @@ bool Window::IsTopWindow() const { // #113722#, cache result of expensive queryInterface call vcl::Window *pThisWin = const_cast<vcl::Window*>(this); - auto xTopWindow = pThisWin->GetComponentInterfaceAs<XTopWindow>(); + uno::Reference< XTopWindow > xTopWindow( pThisWin->GetComponentInterface(), UNO_QUERY ); pThisWin->mpWindowImpl->mpWinData->mnIsTopWindow = xTopWindow.is() ? 1 : 0; } return mpWindowImpl->mpWinData->mnIsTopWindow == 1; diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx index 18d664844402..ecba89c0aac1 100644 --- a/vcl/source/window/syswin.cxx +++ b/vcl/source/window/syswin.cxx @@ -270,7 +270,7 @@ bool SystemWindow::Close() if ( xWindow->IsDisposed() ) return false; - if ( mpWindowImpl->mxVCLXWindow.is() && IsCreatedWithToolkit() ) + if ( mpWindowImpl->mxWindowPeer.is() && IsCreatedWithToolkit() ) return false; // Is Window not closeable, ignore close diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 6422d4add39c..c0a9bf8b141b 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -547,8 +547,8 @@ void Window::dispose() mpWindowImpl->mpFrameData = nullptr; } - if (mpWindowImpl->mxVCLXWindow) - mpWindowImpl->mxVCLXWindow->dispose(); + if (mpWindowImpl->mxWindowPeer) + mpWindowImpl->mxWindowPeer->dispose(); // should be the last statements mpWindowImpl.reset(); @@ -612,7 +612,7 @@ WindowImpl::WindowImpl( WindowType nType ) mnChildEventListenersIteratingCount = 0; mpCursor = nullptr; // cursor maPointer = PointerStyle::Arrow; - mxVCLXWindow = nullptr; + mpVCLXWindow = nullptr; mpAccessibleInfos = nullptr; maControlForeground = COL_TRANSPARENT; // no foreground set maControlBackground = COL_TRANSPARENT; // no background set @@ -3105,37 +3105,39 @@ const OUString& Window::GetHelpText() const return mpWindowImpl->maHelpText; } -void Window::SetWindowPeer( VCLXWindow* pVCLXWindow ) +void Window::SetWindowPeer( Reference< css::awt::XWindowPeer > const & xPeer, VCLXWindow* pVCLXWindow ) { if (!mpWindowImpl || mpWindowImpl->mbInDispose) return; // be safe against re-entrance: first clear the old ref, then assign the new one - if (mpWindowImpl->mxVCLXWindow) + if (mpWindowImpl->mxWindowPeer) { - mpWindowImpl->mxVCLXWindow->dispose(); - mpWindowImpl->mxVCLXWindow.clear(); + mpWindowImpl->mxWindowPeer->dispose(); + mpWindowImpl->mxWindowPeer.clear(); } - mpWindowImpl->mxVCLXWindow = pVCLXWindow; + mpWindowImpl->mxWindowPeer = xPeer; + + mpWindowImpl->mpVCLXWindow = pVCLXWindow; } -VCLXWindow* Window::GetComponentInterface( bool bCreate ) +Reference< css::awt::XWindowPeer > Window::GetComponentInterface( bool bCreate ) { - if ( !mpWindowImpl->mxVCLXWindow.is() && bCreate ) + if ( !mpWindowImpl->mxWindowPeer.is() && bCreate ) { UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper(); if ( pWrapper ) - mpWindowImpl->mxVCLXWindow = pWrapper->GetWindowInterface( this ); + mpWindowImpl->mxWindowPeer = pWrapper->GetWindowInterface( this ); } - return mpWindowImpl->mxVCLXWindow.get(); + return mpWindowImpl->mxWindowPeer; } -void Window::SetComponentInterface( VCLXWindow* pIFace ) +void Window::SetComponentInterface( Reference< css::awt::XWindowPeer > const & xIFace ) { UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper(); SAL_WARN_IF( !pWrapper, "vcl.window", "SetComponentInterface: No Wrapper!" ); if ( pWrapper ) - pWrapper->SetWindowInterface( this, pIFace ); + pWrapper->SetWindowInterface( this, xIFace ); } typedef std::map<vcl::LOKWindowId, VclPtr<vcl::Window>> LOKWindowsMap; @@ -3687,7 +3689,9 @@ Reference< css::rendering::XCanvas > Window::ImplGetCanvas( bool bSpriteCanvas ) aArg[ 0 ] <<= reinterpret_cast<sal_Int64>(this); aArg[ 1 ] <<= css::awt::Rectangle( mnOutOffX, mnOutOffY, mnOutWidth, mnOutHeight ); aArg[ 2 ] <<= mpWindowImpl->mbAlwaysOnTop; - aArg[ 3 ] <<= const_cast<vcl::Window*>(this)->GetComponentInterfaceAs<css::awt::XWindow>(); + aArg[ 3 ] <<= Reference< css::awt::XWindow >( + const_cast<vcl::Window*>(this)->GetComponentInterface(), + UNO_QUERY ); aArg[ 4 ] = GetSystemGfxDataAny(); Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index a0addf688e48..f52478299a9b 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1250,7 +1250,7 @@ PointerStyle Window::GetPointer() const VCLXWindow* Window::GetWindowPeer() const { - return mpWindowImpl ? mpWindowImpl->mxVCLXWindow.get() : nullptr; + return mpWindowImpl ? mpWindowImpl->mpVCLXWindow : nullptr; } void Window::SetPosPixel( const Point& rNewPos ) diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index ef313aaab927..d76344d7c64d 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -15,7 +15,6 @@ #include <string_view> #include <osl/process.h> -#include <toolkit/awt/vclxwindow.hxx> #include <unx/gtk/gtkdata.hxx> #include <unx/gtk/gtkinst.hxx> #include <unx/genprn.h> @@ -4260,7 +4259,7 @@ public: // NoActivate otherwise Show grab focus to this widget xEmbedWindow->Show(true, ShowFlags::NoActivate); - auto xWindow = xEmbedWindow->GetComponentInterfaceAs<css::awt::XWindow>(); + css::uno::Reference<css::awt::XWindow> xWindow(xEmbedWindow->GetComponentInterface(), css::uno::UNO_QUERY); return xWindow; #else return nullptr; |