diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-20 18:24:37 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-21 08:49:13 +0200 |
commit | bda438ecedaa86ca44228a193d3acd37eef4f818 (patch) | |
tree | f6110764cc27675d114cef5142bd739dfa793e62 /toolkit | |
parent | 17db60eb46b31b6e4b7e664b01e6f7bb6a3016ab (diff) |
loplugin:referencecasting in test..toolkit
Change-Id: Ib1e6ba9c3849256b81fa5fa395e891226a044f7c
Reviewed-on: https://gerrit.libreoffice.org/76029
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/qa/cppunit/Dialog.cxx | 3 | ||||
-rw-r--r-- | toolkit/source/awt/animatedimagespeer.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/controls/controlmodelcontainerbase.cxx | 24 | ||||
-rw-r--r-- | toolkit/source/controls/roadmapcontrol.cxx | 2 | ||||
-rw-r--r-- | toolkit/source/controls/stdtabcontroller.cxx | 6 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrol.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/helper/unowrapper.cxx | 6 |
7 files changed, 20 insertions, 29 deletions
diff --git a/toolkit/qa/cppunit/Dialog.cxx b/toolkit/qa/cppunit/Dialog.cxx index 9e832a8c9175..0918b9e8d115 100644 --- a/toolkit/qa/cppunit/Dialog.cxx +++ b/toolkit/qa/cppunit/Dialog.cxx @@ -59,8 +59,7 @@ CPPUNIT_TEST_FIXTURE(DialogTest, testDialogSizeable) uno::Reference<awt::XUnoControlDialog> xControl = awt::UnoControlDialog::create(mxContext); xControl->setModel(xControlModel); - uno::Reference<awt::XWindow> xWindow(xControl, uno::UNO_QUERY); - xWindow->setVisible(true); + xControl->setVisible(true); xDialog.set(xControl, uno::UNO_QUERY_THROW); xDialog->execute(); diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx index 5277841af3e6..f065c8efaebe 100644 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ b/toolkit/source/awt/animatedimagespeer.cxx @@ -133,12 +133,12 @@ namespace toolkit { // try (to find) the high-contrast version of the graphic first aMediaProperties.put( "URL", lcl_getHighContrastURL( i_cachedImage.sImageURL ) ); - i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); + i_cachedImage.xGraphic = i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ); } if ( !i_cachedImage.xGraphic.is() ) { aMediaProperties.put( "URL", i_cachedImage.sImageURL ); - i_cachedImage.xGraphic.set( i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ), UNO_QUERY ); + i_cachedImage.xGraphic = i_graphicProvider->queryGraphic( aMediaProperties.getPropertyValues() ); } } return i_cachedImage.xGraphic.is(); diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 64472d39ea18..278cbf894711 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -1104,8 +1104,6 @@ void SAL_CALL ResourceListener::release() throw () void ResourceListener::startListening( const Reference< resource::XStringResourceResolver >& rResource ) { - Reference< util::XModifyBroadcaster > xModifyBroadcaster( rResource, UNO_QUERY ); - { // --- SAFE --- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex ); @@ -1124,12 +1122,11 @@ void ResourceListener::startListening( // --- SAFE --- } - Reference< util::XModifyListener > xThis( static_cast<OWeakObject*>( this ), UNO_QUERY ); - if ( xModifyBroadcaster.is() ) + if ( rResource.is() ) { try { - xModifyBroadcaster->addModifyListener( xThis ); + rResource->addModifyListener( this ); // --- SAFE --- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex ); @@ -1153,11 +1150,10 @@ void ResourceListener::stopListening() // --- SAFE --- ::osl::ResettableGuard < ::osl::Mutex > aGuard( m_aMutex ); if ( m_bListening && m_xResource.is() ) - xModifyBroadcaster.set( m_xResource, UNO_QUERY ); + xModifyBroadcaster = m_xResource; aGuard.clear(); // --- SAFE --- - Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); if ( xModifyBroadcaster.is() ) { try @@ -1169,7 +1165,7 @@ void ResourceListener::stopListening() aGuard.clear(); // --- SAFE --- - xModifyBroadcaster->removeModifyListener( xThis ); + xModifyBroadcaster->removeModifyListener( this ); } catch (const RuntimeException&) { @@ -1229,7 +1225,7 @@ void SAL_CALL ResourceListener::disposing( aGuard.reset(); m_bListening = false; xResource = m_xResource; - xListener.set( m_xListener, UNO_QUERY ); + xListener = m_xListener; m_xResource.clear(); aGuard.clear(); // --- SAFE --- @@ -1254,7 +1250,7 @@ void SAL_CALL ResourceListener::disposing( // --- SAFE --- aGuard.reset(); m_bListening = false; - xListener.set( m_xListener, UNO_QUERY ); + xListener = m_xListener; xResource = m_xResource; m_xResource.clear(); m_xListener.clear(); @@ -1262,13 +1258,11 @@ void SAL_CALL ResourceListener::disposing( // --- SAFE --- // Remove ourself as listener from resource resolver - Reference< util::XModifyBroadcaster > xModifyBroadcaster( xResource, UNO_QUERY ); - Reference< util::XModifyListener > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); - if ( xModifyBroadcaster.is() ) + if ( xResource.is() ) { try { - xModifyBroadcaster->removeModifyListener( xThis ); + xResource->removeModifyListener( this ); } catch (const RuntimeException&) { @@ -1411,7 +1405,7 @@ void ControlContainerBase::dispose() // --- SAFE --- SolarMutexClearableGuard aGuard; - Reference< XEventListener > xListener( mxListener, UNO_QUERY ); + Reference< XEventListener > xListener = mxListener; mxListener.clear(); aGuard.clear(); // --- SAFE --- diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx index 230980f46e31..54dbb3e20683 100644 --- a/toolkit/source/controls/roadmapcontrol.cxx +++ b/toolkit/source/controls/roadmapcontrol.cxx @@ -441,7 +441,7 @@ void UnoRoadmapControl::elementReplaced( const ContainerEvent& rEvent ) void SAL_CALL UnoRoadmapControl::itemStateChanged( const ItemEvent& rEvent ) { sal_Int16 CurItemIndex = sal::static_int_cast< sal_Int16 >(rEvent.ItemId); - Reference< XControlModel > xModel( getModel( ), UNO_QUERY ); + Reference< XControlModel > xModel = getModel( ); Reference< XPropertySet > xPropertySet( xModel, UNO_QUERY ); xPropertySet->setPropertyValue( GetPropertyName( BASEPROPERTY_CURRENTITEMID ), Any(CurItemIndex) ); if ( maItemListeners.getLength() ) diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx index 61900b4d76ce..0bfdc6302ad7 100644 --- a/toolkit/source/controls/stdtabcontroller.cxx +++ b/toolkit/source/controls/stdtabcontroller.cxx @@ -133,8 +133,7 @@ bool StdTabController::ImplCreateComponentSequence( void StdTabController::ImplActivateControl( bool bFirst ) const { // HACK due to bug #53688#, map controls onto an interface if remote controls may occur - Reference< XTabController > xTabController(const_cast< ::cppu::OWeakObject* >(static_cast< const ::cppu::OWeakObject* >(this)), UNO_QUERY); - Sequence< Reference< XControl > > aCtrls = xTabController->getControls(); + Sequence< Reference< XControl > > aCtrls = const_cast<StdTabController*>(this)->getControls(); const Reference< XControl > * pControls = aCtrls.getConstArray(); sal_uInt32 nCount = aCtrls.getLength(); @@ -248,8 +247,7 @@ void StdTabController::autoTabOrder( ) Sequence< Reference< XWindow > > aCompSeq; // This may return a TabController, which returns desired list of controls faster - Reference< XTabController > xTabController(static_cast< ::cppu::OWeakObject* >(this), UNO_QUERY); - Sequence< Reference< XControl > > aControls = xTabController->getControls(); + Sequence< Reference< XControl > > aControls = getControls(); // #58317# Some Models may be missing from the Container. Plus there is a // autoTabOrder call later on. diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 038a615cc228..2359ed44981b 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -470,10 +470,10 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent bool bNeedNewPeer = false; // some properties require a re-creation of the peer, 'cause they can't be changed on the fly - Reference< XControlModel > xOwnModel( getModel(), UNO_QUERY ); + Reference< XControlModel > xOwnModel = getModel(); // our own model for comparison Reference< XPropertySet > xPS( xOwnModel, UNO_QUERY ); - Reference< XPropertySetInfo > xPSI( xPS->getPropertySetInfo(), UNO_QUERY ); + Reference< XPropertySetInfo > xPSI = xPS->getPropertySetInfo(); OSL_ENSURE( xPSI.is(), "UnoControl::ImplModelPropertiesChanged: should have property set meta data!" ); sal_Int32 nLen = rEvents.getLength(); diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index c5184b295425..fb425f7bced8 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -231,7 +231,7 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) VclPtr< vcl::Window > pClient = pChild->GetWindow( GetWindowType::Client ); if ( pClient && pClient->GetWindowPeer() ) { - css::uno::Reference< css::lang::XComponent > xComp( pClient->GetComponentInterface( false ), css::uno::UNO_QUERY ); + css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( false ); xComp->dispose(); } @@ -250,7 +250,7 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) if ( pClient && pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) ) { - css::uno::Reference< css::lang::XComponent > xComp( pClient->GetComponentInterface( false ), css::uno::UNO_QUERY ); + css::uno::Reference< css::lang::XComponent > xComp = pClient->GetComponentInterface( false ); xComp->dispose(); } @@ -265,7 +265,7 @@ void UnoWrapper::WindowDestroyed( vcl::Window* pWindow ) } VCLXWindow* pWindowPeer = pWindow->GetWindowPeer(); - uno::Reference< lang::XComponent > xWindowPeerComp( pWindow->GetComponentInterface( false ), uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xWindowPeerComp = pWindow->GetComponentInterface( false ); OSL_ENSURE( ( pWindowPeer != nullptr ) == xWindowPeerComp.is(), "UnoWrapper::WindowDestroyed: inconsistency in the window's peers!" ); if ( pWindowPeer ) |