diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-01-25 20:25:51 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-01-25 20:21:48 +0100 |
commit | 1aa31294b2d3fb562ba33d5d873da62439944f07 (patch) | |
tree | 79a604d51b0c54768c07ed8c4643cf43b29d8fca /toolkit | |
parent | 2dbc9266ec2207c2719c0104168cfcad9f6948da (diff) |
avoid some ref-counting
can just return a pointer here, instead of VclPtr.
Change-Id: I9ab8962cbbe84ed4dfcfd658a6d758112914cb89
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109923
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/controls/accessiblecontrolcontext.hxx | 2 | ||||
-rw-r--r-- | toolkit/source/awt/vclxaccessiblecomponent.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtopwindow.cxx | 18 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/accessiblecontrolcontext.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/helper/vclunohelper.cxx | 12 |
6 files changed, 21 insertions, 21 deletions
diff --git a/toolkit/inc/controls/accessiblecontrolcontext.hxx b/toolkit/inc/controls/accessiblecontrolcontext.hxx index e12a77c5ab3d..6a07e3e89865 100644 --- a/toolkit/inc/controls/accessiblecontrolcontext.hxx +++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx @@ -95,7 +95,7 @@ namespace toolkit // stops listening at the control model void stopModelListening( ); - VclPtr< vcl::Window > implGetWindow( css::uno::Reference< css::awt::XWindow >* _pxUNOWindow = nullptr ) const; + vcl::Window* implGetWindow( css::uno::Reference< css::awt::XWindow >* _pxUNOWindow = nullptr ) const; /// ctor. @see Init OAccessibleControlContext(); diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index e1ba158f6930..9ce8f6a61d7c 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -343,10 +343,10 @@ void VCLXAccessibleComponent::disposing() m_xVCLXWindow.clear(); } -VclPtr<vcl::Window> VCLXAccessibleComponent::GetWindow() const +vcl::Window* VCLXAccessibleComponent::GetWindow() const { return GetVCLXWindow() ? GetVCLXWindow()->GetWindow() - : VclPtr<vcl::Window>(); + : nullptr; } void VCLXAccessibleComponent::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) diff --git a/toolkit/source/awt/vclxtopwindow.cxx b/toolkit/source/awt/vclxtopwindow.cxx index e9fcd2450904..40aab75a480a 100644 --- a/toolkit/source/awt/vclxtopwindow.cxx +++ b/toolkit/source/awt/vclxtopwindow.cxx @@ -52,7 +52,7 @@ css::uno::Any VCLXTopWindow::getWindowHandle( const css::uno::Sequence< sal_Int8 // TODO, check the process id css::uno::Any aRet; - vcl::Window* pWindow = VCLXContainer::GetWindow().get(); + vcl::Window* pWindow = VCLXContainer::GetWindow(); if ( pWindow ) { const SystemEnvData* pSysData = static_cast<SystemWindow *>(pWindow)->GetSystemData(); @@ -106,7 +106,7 @@ void VCLXTopWindow::toFront( ) { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLXContainer::GetWindow().get(); + vcl::Window* pWindow = VCLXContainer::GetWindow(); if ( pWindow ) static_cast<WorkWindow*>(pWindow)->ToTop( ToTopFlags::RestoreWhenMin ); } @@ -119,7 +119,7 @@ void VCLXTopWindow::setMenuBar( const css::uno::Reference< css::awt::XMenuBar >& { SolarMutexGuard aGuard; - vcl::Window* pWindow = VCLXContainer::GetWindow().get(); + vcl::Window* pWindow = VCLXContainer::GetWindow(); if ( pWindow ) { SystemWindow* pSystemWindow = static_cast<SystemWindow*>( pWindow ); @@ -138,7 +138,7 @@ sal_Bool SAL_CALL VCLXTopWindow::getIsMaximized() { SolarMutexGuard aGuard; - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( VCLXContainer::GetWindow().get() ); + const WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return false; @@ -150,7 +150,7 @@ void SAL_CALL VCLXTopWindow::setIsMaximized( sal_Bool _ismaximized ) { SolarMutexGuard aGuard; - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( VCLXContainer::GetWindow().get() ); + WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return; @@ -162,7 +162,7 @@ sal_Bool SAL_CALL VCLXTopWindow::getIsMinimized() { SolarMutexGuard aGuard; - const WorkWindow* pWindow = dynamic_cast< const WorkWindow* >( VCLXContainer::GetWindow().get() ); + const WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return false; @@ -174,7 +174,7 @@ void SAL_CALL VCLXTopWindow::setIsMinimized( sal_Bool _isMinimized ) { SolarMutexGuard aGuard; - WorkWindow* pWindow = dynamic_cast< WorkWindow* >( VCLXContainer::GetWindow().get() ); + WorkWindow* pWindow = VCLXContainer::GetAsDynamic<WorkWindow>(); if ( !pWindow ) return; @@ -186,7 +186,7 @@ void SAL_CALL VCLXTopWindow::setIsMinimized( sal_Bool _isMinimized ) { SolarMutexGuard aGuard; - const SystemWindow* pWindow = dynamic_cast< const SystemWindow* >( VCLXContainer::GetWindow().get() ); + const SystemWindow* pWindow = VCLXContainer::GetAsDynamic<SystemWindow>(); if ( !pWindow ) return 0; @@ -201,7 +201,7 @@ void SAL_CALL VCLXTopWindow::setDisplay( ::sal_Int32 _display ) if ( ( _display < 0 ) || ( _display >= static_cast<sal_Int32>(Application::GetScreenCount()) ) ) throw IndexOutOfBoundsException(); - SystemWindow* pWindow = dynamic_cast< SystemWindow* >( VCLXContainer::GetWindow().get() ); + SystemWindow* pWindow = VCLXContainer::GetAsDynamic<SystemWindow>(); if ( !pWindow ) return; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index a589db2cd3a1..8b9c247190c3 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -7820,7 +7820,7 @@ void SAL_CALL SVTXDateField::setProperty( const OUString& PropertyName, const cs // some properties need to be forwarded to the sub edit, too SolarMutexGuard g; - VclPtr< Edit > pSubEdit = GetWindow() ? static_cast< Edit* >( GetWindow().get() )->GetSubEdit() : nullptr; + VclPtr< Edit > pSubEdit = GetWindow() ? GetAs<Edit>()->GetSubEdit() : nullptr; if ( !pSubEdit ) return; diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx index 36b6287d65ec..cf4cf7207749 100644 --- a/toolkit/source/controls/accessiblecontrolcontext.cxx +++ b/toolkit/source/controls/accessiblecontrolcontext.cxx @@ -218,14 +218,14 @@ namespace toolkit } - VclPtr< vcl::Window > OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const + vcl::Window* OAccessibleControlContext::implGetWindow( Reference< awt::XWindow >* _pxUNOWindow ) const { Reference< awt::XControl > xControl( getAccessibleCreator(), UNO_QUERY ); Reference< awt::XWindow > xWindow; if ( xControl.is() ) xWindow.set(xControl->getPeer(), css::uno::UNO_QUERY); - VclPtr< vcl::Window > pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : VclPtr< vcl::Window >(); + vcl::Window* pWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : nullptr; if ( _pxUNOWindow ) *_pxUNOWindow = xWindow; diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 20554df69812..62ad182d38af 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -106,22 +106,22 @@ css::uno::Reference< css::awt::XBitmap> VCLUnoHelper::CreateVCLXBitmap( const Bi return css::uno::Reference< css::awt::XBitmap >(new VCLXBitmap(rBitmap)); } -VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ) +vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ) { VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( rxWindow ); - return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >(); + return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr; } -VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow ) +vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow2>& rxWindow ) { VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( rxWindow ); - return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >(); + return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr; } -VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindow ) +vcl::Window* VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindowPeer>& rxWindow ) { VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( rxWindow ); - return pVCLXWindow ? pVCLXWindow->GetWindow() : VclPtr< vcl::Window >(); + return pVCLXWindow ? pVCLXWindow->GetWindow() : nullptr; } vcl::Region VCLUnoHelper::GetRegion( const css::uno::Reference< css::awt::XRegion >& rxRegion ) |