diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2023-03-31 19:15:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-04-01 14:42:17 +0200 |
commit | bfdf5d290be3fccb631d50cfea52fbe43fff4dce (patch) | |
tree | 7b89956506092aa6ee68cc559a83b158170439e6 /toolkit | |
parent | cd013e66711c056c52ffd0839e782f6ee9c2dabd (diff) |
use more XVclWindowPeer
Rather than using it's superclass XWindowPeer and implicitly relying on it being XVclWindowPeer and casting it everywhere.
Change-Id: Icfb46f3b920d00f4a167a31803a71bbb0368d05c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149894
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
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/controls/unocontrolcontainer.hxx | 2 | ||||
-rw-r--r-- | toolkit/inc/helper/unowrapper.hxx | 6 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/controls/svmedit.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrol.cxx | 27 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolcontainer.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 8 |
8 files changed, 31 insertions, 24 deletions
diff --git a/toolkit/inc/controls/svmedit.hxx b/toolkit/inc/controls/svmedit.hxx index 77295cdd5851..61befc981514 100644 --- a/toolkit/inc/controls/svmedit.hxx +++ b/toolkit/inc/controls/svmedit.hxx @@ -26,7 +26,7 @@ class MultiLineEdit final : public VclMultiLineEdit public: MultiLineEdit( vcl::Window* pParent, WinBits nWinStyle ); - virtual css::uno::Reference< css::awt::XWindowPeer > GetComponentInterface(bool bCreate = true) override; + virtual css::uno::Reference< css::awt::XVclWindowPeer > GetComponentInterface(bool bCreate = true) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/inc/controls/unocontrolcontainer.hxx b/toolkit/inc/controls/unocontrolcontainer.hxx index f8e9d10855aa..ac4e01816024 100644 --- a/toolkit/inc/controls/unocontrolcontainer.hxx +++ b/toolkit/inc/controls/unocontrolcontainer.hxx @@ -53,7 +53,7 @@ protected: public: UnoControlContainer(); - UnoControlContainer( const css::uno::Reference< css::awt::XWindowPeer >& xPeer ); + UnoControlContainer( const css::uno::Reference< css::awt::XVclWindowPeer >& xPeer ); virtual ~UnoControlContainer() override; diff --git a/toolkit/inc/helper/unowrapper.hxx b/toolkit/inc/helper/unowrapper.hxx index 03a9b525cc18..dfed1b1215f1 100644 --- a/toolkit/inc/helper/unowrapper.hxx +++ b/toolkit/inc/helper/unowrapper.hxx @@ -22,7 +22,7 @@ #include <com/sun/star/awt/XToolkit.hpp> #include <com/sun/star/awt/XGraphics.hpp> -#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <vcl/toolkit/unowrap.hxx> @@ -51,8 +51,8 @@ public: virtual void ReleaseAllGraphics( OutputDevice* pOutDev ) override; // Window - virtual css::uno::Reference< css::awt::XWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override; - virtual void SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XWindowPeer> & xIFace ) override; + virtual css::uno::Reference< css::awt::XVclWindowPeer> GetWindowInterface( vcl::Window* pWindow ) override; + virtual void SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XVclWindowPeer> & xIFace ) override; virtual VclPtr<vcl::Window> GetWindow(const css::uno::Reference<css::awt::XWindow>& rxWindow) override; // Menu diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index e890e24a6bdc..476bcf71da5c 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1843,7 +1843,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( SolarMutexGuard aSolarGuard; - css::uno::Reference< css::awt::XWindowPeer > xRef; + css::uno::Reference< css::awt::XVclWindowPeer > xRef; VclPtr<vcl::Window> pParent; if ( rDescriptor.Parent.is() ) @@ -1991,7 +1991,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::createSystemChild( con pChildWindow.reset(VclPtr<WorkWindow>::Create(nullptr, Parent)); } - css::uno::Reference< css::awt::XWindowPeer > xPeer; + css::uno::Reference< css::awt::XVclWindowPeer > xPeer; if ( pChildWindow ) { rtl::Reference<VCLXTopWindow> pPeer = new VCLXTopWindow; diff --git a/toolkit/source/controls/svmedit.cxx b/toolkit/source/controls/svmedit.cxx index 383f2280412e..1bc51155f7bf 100644 --- a/toolkit/source/controls/svmedit.cxx +++ b/toolkit/source/controls/svmedit.cxx @@ -26,9 +26,9 @@ MultiLineEdit::MultiLineEdit(vcl::Window* pParent, WinBits nWinStyle) } // virtual -css::uno::Reference<css::awt::XWindowPeer> MultiLineEdit::GetComponentInterface(bool bCreate) +css::uno::Reference<css::awt::XVclWindowPeer> MultiLineEdit::GetComponentInterface(bool bCreate) { - css::uno::Reference<css::awt::XWindowPeer> xPeer( + css::uno::Reference<css::awt::XVclWindowPeer> xPeer( VclMultiLineEdit::GetComponentInterface(false)); if (!xPeer.is() && bCreate) { diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index a3d0a251c382..217d8f94185d 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -157,13 +157,13 @@ OUString UnoControl::GetComponentServiceName() const return OUString(); } -Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer() +Reference< XVclWindowPeer > UnoControl::ImplGetCompatiblePeer() { DBG_ASSERT( !mbCreatingCompatiblePeer, "ImplGetCompatiblePeer - recursive?" ); mbCreatingCompatiblePeer = true; - Reference< XWindowPeer > xCompatiblePeer = getPeer(); + Reference< XVclWindowPeer > xCompatiblePeer = getVclWindowPeer(); if ( !xCompatiblePeer.is() ) { @@ -172,7 +172,7 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer() if( bVis ) maComponentInfos.bVisible = false; - Reference< XWindowPeer > xCurrentPeer = getPeer(); + Reference< XVclWindowPeer > xCurrentPeer = getVclWindowPeer(); setPeer( nullptr ); // queryInterface ourself, to allow aggregation @@ -196,7 +196,7 @@ Reference< XWindowPeer > UnoControl::ImplGetCompatiblePeer() mbCreatingCompatiblePeer = false; throw; } - xCompatiblePeer = getPeer(); + xCompatiblePeer = getVclWindowPeer(); setPeer( xCurrentPeer ); if ( xCompatiblePeer.is() && mxGraphics.is() ) @@ -345,13 +345,13 @@ UnoControl::DisposeAccessibleContext(Reference<XComponent> const& xContextComp) void UnoControl::dispose( ) { - Reference< XWindowPeer > xPeer; + Reference< XVclWindowPeer > xPeer; Reference<XComponent> xAccessibleComp; { ::osl::MutexGuard aGuard( GetMutex() ); if( mbDisposePeer ) { - xPeer = mxPeer; + xPeer = mxVclWindowPeer; } setPeer( nullptr ); xAccessibleComp.set(maAccessibleContext, UNO_QUERY); @@ -619,8 +619,7 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent // Doesn't work for Container! getPeer()->dispose(); - mxPeer.clear(); - mxVclWindowPeer = nullptr; + mxVclWindowPeer.clear(); mbRefreshingPeer = true; Reference< XWindowPeer > xP( xParent, UNO_QUERY ); xThis->createPeer( Reference< XToolkit > (), xP ); @@ -1278,7 +1277,9 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer PrepareWindowDescriptor(aDescr); // create the peer - setPeer( xToolkit->createWindow( aDescr ) ); + Reference<XWindowPeer> xTemp = xToolkit->createWindow( aDescr ); + mxVclWindowPeer.set(xTemp, UNO_QUERY); + assert(mxVclWindowPeer); // release the mutex guard (and work with copies of our members) // this is necessary as our peer may lock the SolarMutex (actually, all currently known peers do), so calling @@ -1344,7 +1345,13 @@ void UnoControl::createPeer( const Reference< XToolkit >& rxToolkit, const Refer Reference< XWindowPeer > UnoControl::getPeer() { ::osl::MutexGuard aGuard( GetMutex() ); - return mxPeer; + return mxVclWindowPeer; +} + +Reference< XVclWindowPeer > UnoControl::getVclWindowPeer() +{ + ::osl::MutexGuard aGuard( GetMutex() ); + return mxVclWindowPeer; } sal_Bool UnoControl::setModel( const Reference< XControlModel >& rxModel ) diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx index feb117b4cd3c..1610f36629e1 100644 --- a/toolkit/source/controls/unocontrolcontainer.cxx +++ b/toolkit/source/controls/unocontrolcontainer.cxx @@ -369,7 +369,7 @@ UnoControlContainer::UnoControlContainer() mpControls.reset(new UnoControlHolderList); } -UnoControlContainer::UnoControlContainer(const uno::Reference< awt::XWindowPeer >& xP ) +UnoControlContainer::UnoControlContainer(const uno::Reference< awt::XVclWindowPeer >& xP ) :maCListeners( *this ) { setPeer( xP ); diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 0fa36e82cab4..e2aaa55dbe63 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -144,9 +144,9 @@ css::uno::Reference< css::awt::XToolkit> UnoWrapper::GetVCLToolkit() return mxToolkit; } -css::uno::Reference< css::awt::XWindowPeer> UnoWrapper::GetWindowInterface( vcl::Window* pWindow ) +css::uno::Reference< css::awt::XVclWindowPeer> UnoWrapper::GetWindowInterface( vcl::Window* pWindow ) { - css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); + css::uno::Reference< css::awt::XVclWindowPeer> xPeer = pWindow->GetWindowPeer(); if ( xPeer ) return xPeer; @@ -161,7 +161,7 @@ VclPtr<vcl::Window> UnoWrapper::GetWindow(const css::uno::Reference<css::awt::XW return VCLUnoHelper::GetWindow(rWindow); } -void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XWindowPeer> & xIFace ) +void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Reference< css::awt::XVclWindowPeer> & xIFace ) { VCLXWindow* pVCLXWindow = dynamic_cast<VCLXWindow*>( xIFace.get() ); @@ -176,7 +176,7 @@ void UnoWrapper::SetWindowInterface( vcl::Window* pWindow, const css::uno::Refer } else { - css::uno::Reference< css::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); + css::uno::Reference< css::awt::XVclWindowPeer> xPeer = pWindow->GetWindowPeer(); if( xPeer.is() ) { bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() )); |