diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-08-07 10:47:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-07 17:17:25 +0200 |
commit | 773a7b57fa99bdda9cde59937cd1987384ae533a (patch) | |
tree | 9909d560e9c14ccd9963ee4eb58a74f4f3ea6288 | |
parent | e20d997eb3eb5c81af907718989aba4a6f9fc950 (diff) |
no need to use UNO_QUERY here
Change-Id: I1bfe8238d7c08f27d2b21f9fe79712aba045c812
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120152
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | avmedia/source/win/window.cxx | 8 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 4 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 4 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel_Persistence.cxx | 9 | ||||
-rw-r--r-- | chart2/source/tools/LifeTime.cxx | 9 | ||||
-rw-r--r-- | chart2/source/tools/RangeHighlighter.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/ChartView.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/ContentHelper.cxx | 4 | ||||
-rw-r--r-- | fpicker/source/win32/VistaFilePickerEventHandler.cxx | 3 | ||||
-rw-r--r-- | framework/source/services/autorecovery.cxx | 3 | ||||
-rw-r--r-- | framework/source/services/desktop.cxx | 15 | ||||
-rw-r--r-- | linguistic/source/lngopt.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomailmerge.cxx | 8 | ||||
-rw-r--r-- | ucb/source/cacher/contentresultsetwrapper.cxx | 20 | ||||
-rw-r--r-- | ucb/source/core/ucbstore.cxx | 10 | ||||
-rw-r--r-- | ucb/source/sorter/sortresult.cxx | 10 | ||||
-rw-r--r-- | ucbhelper/source/provider/contenthelper.cxx | 6 | ||||
-rw-r--r-- | ucbhelper/source/provider/resultset.cxx | 6 | ||||
-rw-r--r-- | vcl/win/dtrans/generic_clipboard.cxx | 4 |
19 files changed, 39 insertions, 96 deletions
diff --git a/avmedia/source/win/window.cxx b/avmedia/source/win/window.cxx index a3fb5abca52c..b7aa28ba26d5 100644 --- a/avmedia/source/win/window.cxx +++ b/avmedia/source/win/window.cxx @@ -430,7 +430,7 @@ void Window::fireMousePressedEvent( const css::awt::MouseEvent& rEvt ) ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) - uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY_THROW )->mousePressed( rEvt ); + static_cast< awt::XMouseListener* >( aIter.next() )->mousePressed( rEvt ); } } @@ -443,7 +443,7 @@ void Window::fireMouseReleasedEvent( const css::awt::MouseEvent& rEvt ) ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) - uno::Reference< awt::XMouseListener >( aIter.next(), uno::UNO_QUERY_THROW )->mouseReleased( rEvt ); + static_cast< awt::XMouseListener* >( aIter.next() )->mouseReleased( rEvt ); } } @@ -456,7 +456,7 @@ void Window::fireMouseMovedEvent( const css::awt::MouseEvent& rEvt ) ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) - uno::Reference< awt::XMouseMotionListener >( aIter.next(), uno::UNO_QUERY_THROW )->mouseMoved( rEvt ); + static_cast< awt::XMouseMotionListener* >( aIter.next() )->mouseMoved( rEvt ); } } @@ -469,7 +469,7 @@ void Window::fireSetFocusEvent( const css::awt::FocusEvent& rEvt ) ::cppu::OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) - uno::Reference< awt::XFocusListener >( aIter.next(), uno::UNO_QUERY_THROW )->focusGained( rEvt ); + static_cast< awt::XFocusListener* >( aIter.next() )->focusGained( rEvt ); } } diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index a63da0791c30..024cbe5bf589 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1760,9 +1760,7 @@ void ChartController::impl_notifySelectionChangeListeners() ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< view::XSelectionChangeListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->selectionChanged( aEvent ); + static_cast< view::XSelectionChangeListener* >( aIt.next() )->selectionChanged( aEvent ); } } } diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 01bf592f7f34..b36d2becb6f3 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -251,9 +251,7 @@ void ChartModel::impl_notifyCloseListeners() ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< util::XCloseListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->notifyClosing( aEvent ); + static_cast< util::XCloseListener* >( aIt.next() )->notifyClosing( aEvent ); } } } diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index b0bf0d1050a4..b3166c32bd9b 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -654,9 +654,7 @@ void ChartModel::impl_notifyModifiedListeners() ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< util::XModifyListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->modified( aEvent ); + static_cast< util::XModifyListener* >( aIt.next() )->modified( aEvent ); } } } @@ -790,9 +788,8 @@ void ChartModel::impl_notifyStorageChangeListeners() ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< document::XStorageChangeListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->notifyStorageChange( static_cast< ::cppu::OWeakObject* >( this ), m_xStorage ); + static_cast< document::XStorageChangeListener* >( aIt.next() ) + ->notifyStorageChange( static_cast< ::cppu::OWeakObject* >( this ), m_xStorage ); } } } diff --git a/chart2/source/tools/LifeTime.cxx b/chart2/source/tools/LifeTime.cxx index 5817db73a2e1..c705405c8913 100644 --- a/chart2/source/tools/LifeTime.cxx +++ b/chart2/source/tools/LifeTime.cxx @@ -226,9 +226,8 @@ bool CloseableLifeTimeManager::g_close_startTryClose(bool bDeliverOwnership) ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< util::XCloseListener > xCloseListener( aIt.next(), uno::UNO_QUERY ); - if(xCloseListener.is()) - xCloseListener->queryClosing( aEvent, bDeliverOwnership ); + static_cast< util::XCloseListener* >( aIt.next() ) + ->queryClosing( aEvent, bDeliverOwnership ); } } } @@ -336,9 +335,7 @@ void CloseableLifeTimeManager::impl_doClose() ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< util::XCloseListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->notifyClosing( aEvent ); + static_cast< util::XCloseListener* >( aIt.next() )->notifyClosing( aEvent ); } } } diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx index b326d0bacce9..fb0e75f4b738 100644 --- a/chart2/source/tools/RangeHighlighter.cxx +++ b/chart2/source/tools/RangeHighlighter.cxx @@ -341,9 +341,7 @@ void RangeHighlighter::fireSelectionEvent() ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< view::XSelectionChangeListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->selectionChanged( aEvent ); + static_cast< view::XSelectionChangeListener* >( aIt.next() )->selectionChanged( aEvent ); } } } diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 4d393fde9725..a5db1f26b69d 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -2622,9 +2622,7 @@ void ChartView::impl_notifyModeChangeListener( const OUString& rNewMode ) ::cppu::OInterfaceIteratorHelper aIt( *pIC ); while( aIt.hasMoreElements() ) { - uno::Reference< util::XModeChangeListener > xListener( aIt.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->modeChanged( aEvent ); + static_cast< util::XModeChangeListener* >( aIt.next() )->modeChanged( aEvent ); } } } diff --git a/dbaccess/source/core/dataaccess/ContentHelper.cxx b/dbaccess/source/core/dataaccess/ContentHelper.cxx index 94cb7168d037..7de159b2d095 100644 --- a/dbaccess/source/core/dataaccess/ContentHelper.cxx +++ b/dbaccess/source/core/dataaccess/ContentHelper.cxx @@ -493,9 +493,7 @@ void OContentHelper::notifyPropertiesChange( const Sequence< PropertyChangeEvent while ( aIter.hasMoreElements() ) { // Propagate event. - Reference< XPropertiesChangeListener > xListener( aIter.next(), UNO_QUERY ); - if ( xListener.is() ) - xListener->propertiesChange( evt ); + static_cast< XPropertiesChangeListener* >( aIter.next() )->propertiesChange( evt ); } } diff --git a/fpicker/source/win32/VistaFilePickerEventHandler.cxx b/fpicker/source/win32/VistaFilePickerEventHandler.cxx index 1c0650fb9efb..c7946b0216bc 100644 --- a/fpicker/source/win32/VistaFilePickerEventHandler.cxx +++ b/fpicker/source/win32/VistaFilePickerEventHandler.cxx @@ -288,7 +288,8 @@ void VistaFilePickerEventHandler::impl_sendEvent( EEventType eEventType, { try { - css::uno::Reference< css::ui::dialogs::XFilePickerListener > xListener (pIterator.next(), css::uno::UNO_QUERY); + css::uno::Reference< css::ui::dialogs::XFilePickerListener > xListener ( + static_cast< css::ui::dialogs::XFilePickerListener* >(pIterator.next())); Request rRequest; rRequest.setRequest (eEventType); diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 495d22cee201..0c79cd4c97e9 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -3502,8 +3502,7 @@ void AutoRecovery::implts_informListener( Job eJob , { try { - css::uno::Reference< css::frame::XStatusListener > xListener(static_cast<css::frame::XStatusListener*>(pIt.next()), css::uno::UNO_QUERY); - xListener->statusChanged(aEvent); + static_cast<css::frame::XStatusListener*>(pIt.next())->statusChanged(aEvent); } catch(const css::uno::RuntimeException&) { diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index a9cb105ad8e4..0315ab1bae70 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -1621,19 +1621,17 @@ void Desktop::impl_sendTerminateToClipboard() { try { - css::uno::Reference< css::lang::XServiceInfo > xInfo( aIterator.next(), css::uno::UNO_QUERY ); + css::frame::XTerminateListener* pTerminateListener = + static_cast< css::frame::XTerminateListener* >(aIterator.next()); + css::uno::Reference< css::lang::XServiceInfo > xInfo( pTerminateListener, css::uno::UNO_QUERY ); if ( !xInfo.is() ) continue; if ( xInfo->getImplementationName() != "com.sun.star.comp.svt.TransferableHelperTerminateListener" ) continue; - css::uno::Reference< css::frame::XTerminateListener > xListener(xInfo, css::uno::UNO_QUERY); - if ( ! xListener.is() ) - continue; - css::lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >(this) ); - xListener->notifyTermination( aEvent ); + pTerminateListener->notifyTermination( aEvent ); // don't notify twice aIterator.remove(); @@ -1663,10 +1661,7 @@ void Desktop::impl_sendNotifyTerminationEvent() { try { - css::uno::Reference< css::frame::XTerminateListener > xListener(aIterator.next(), css::uno::UNO_QUERY); - if ( ! xListener.is() ) - continue; - xListener->notifyTermination( aEvent ); + static_cast< css::frame::XTerminateListener* >(aIterator.next())->notifyTermination( aEvent ); } catch( const css::uno::Exception& ) { diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index ac9f0678ffaf..304675fd413c 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -199,9 +199,7 @@ void LinguProps::launchEvent( const PropertyChangeEvent &rEvt ) const cppu::OInterfaceIteratorHelper aIt( *pContainer ); while (aIt.hasMoreElements()) { - Reference< XPropertyChangeListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->propertyChange( rEvt ); + static_cast< XPropertyChangeListener* >( aIt.next() )->propertyChange( rEvt ); } } } diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index 8a15448d8598..b3b674f72422 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -833,9 +833,7 @@ void SwXMailMerge::LaunchMailMergeEvent( const MailMergeEvent &rEvt ) const comphelper::OInterfaceIteratorHelper2 aIt( const_cast<SwXMailMerge *>(this)->m_aMergeListeners ); while (aIt.hasMoreElements()) { - Reference< XMailMergeListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->notifyMailMergeEvent( rEvt ); + static_cast< XMailMergeListener* >( aIt.next() )->notifyMailMergeEvent( rEvt ); } } @@ -848,9 +846,7 @@ void SwXMailMerge::launchEvent( const PropertyChangeEvent &rEvt ) const cppu::OInterfaceIteratorHelper aIt( *pContainer ); while (aIt.hasMoreElements()) { - Reference< XPropertyChangeListener > xRef( aIt.next(), UNO_QUERY ); - if (xRef.is()) - xRef->propertyChange( rEvt ); + static_cast< XPropertyChangeListener* >( aIt.next() )->propertyChange( rEvt ); } } } diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx index 55aaab35c97e..c680cbc68080 100644 --- a/ucb/source/cacher/contentresultsetwrapper.cxx +++ b/ucb/source/cacher/contentresultsetwrapper.cxx @@ -188,10 +188,7 @@ void ContentResultSetWrapper::impl_notifyPropertyChangeListeners( const Property OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) { - Reference< XPropertyChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if( xListener.is() ) - xListener->propertyChange( rEvt ); + static_cast< XPropertyChangeListener* >( aIter.next() )->propertyChange( rEvt ); } } @@ -202,10 +199,7 @@ void ContentResultSetWrapper::impl_notifyPropertyChangeListeners( const Property OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) { - Reference< XPropertyChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if( xListener.is() ) - xListener->propertyChange( rEvt ); + static_cast< XPropertyChangeListener* >( aIter.next() )->propertyChange( rEvt ); } } } @@ -226,10 +220,7 @@ void ContentResultSetWrapper::impl_notifyVetoableChangeListeners( const Property OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) { - Reference< XVetoableChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if( xListener.is() ) - xListener->vetoableChange( rEvt ); + static_cast< XVetoableChangeListener* >( aIter.next() )->vetoableChange( rEvt ); } } @@ -240,10 +231,7 @@ void ContentResultSetWrapper::impl_notifyVetoableChangeListeners( const Property OInterfaceIteratorHelper aIter( *pContainer ); while( aIter.hasMoreElements() ) { - Reference< XVetoableChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if( xListener.is() ) - xListener->vetoableChange( rEvt ); + static_cast< XVetoableChangeListener* >( aIter.next() )->vetoableChange( rEvt ); } } } diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index a038ff27222f..924892beb8ca 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -1910,10 +1910,7 @@ void PersistentPropertySet::notifyPropertyChangeEvent( while ( aIter.hasMoreElements() ) { // Propagate event. - Reference< XPropertyChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if ( xListener.is() ) - xListener->propertyChange( rEvent ); + static_cast< XPropertyChangeListener* >( aIter.next() )->propertyChange( rEvent ); } } @@ -1926,10 +1923,7 @@ void PersistentPropertySet::notifyPropertyChangeEvent( while ( aIter.hasMoreElements() ) { // Propagate event. - Reference< XPropertyChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if ( xListener.is() ) - xListener->propertyChange( rEvent ); + static_cast< XPropertyChangeListener* >( aIter.next() )->propertyChange( rEvent ); } } } diff --git a/ucb/source/sorter/sortresult.cxx b/ucb/source/sorter/sortresult.cxx index b32844368c38..94e6570cb864 100644 --- a/ucb/source/sorter/sortresult.cxx +++ b/ucb/source/sorter/sortresult.cxx @@ -1200,10 +1200,7 @@ void SortedResultSet::PropertyChanged( const PropertyChangeEvent& rEvt ) OInterfaceIteratorHelper aIter( *pPropsContainer ); while ( aIter.hasMoreElements() ) { - Reference< XPropertyChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if ( xListener.is() ) - xListener->propertyChange( rEvt ); + static_cast< XPropertyChangeListener* >( aIter.next() )->propertyChange( rEvt ); } } @@ -1214,10 +1211,7 @@ void SortedResultSet::PropertyChanged( const PropertyChangeEvent& rEvt ) OInterfaceIteratorHelper aIter( *pPropsContainer ); while ( aIter.hasMoreElements() ) { - Reference< XPropertyChangeListener > xListener( - aIter.next(), UNO_QUERY ); - if ( xListener.is() ) - xListener->propertyChange( rEvt ); + static_cast< XPropertyChangeListener* >( aIter.next() )->propertyChange( rEvt ); } } } diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx index 8ca2bfddec6a..2c64dc1968a6 100644 --- a/ucbhelper/source/provider/contenthelper.cxx +++ b/ucbhelper/source/provider/contenthelper.cxx @@ -657,10 +657,8 @@ void ContentImplHelper::notifyPropertiesChange( while ( aIter.hasMoreElements() ) { // Propagate event. - uno::Reference< beans::XPropertiesChangeListener > xListener( - aIter.next(), uno::UNO_QUERY ); - if ( xListener.is() ) - xListener->propertiesChange( evt ); + static_cast< beans::XPropertiesChangeListener* >( + aIter.next())->propertiesChange( evt ); } } diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx index 3bca0b0349ea..ac9aa42556a5 100644 --- a/ucbhelper/source/provider/resultset.cxx +++ b/ucbhelper/source/provider/resultset.cxx @@ -1335,10 +1335,8 @@ void ResultSet::propertyChanged( const beans::PropertyChangeEvent& rEvt ) const cppu::OInterfaceIteratorHelper aIter( *pPropsContainer ); while ( aIter.hasMoreElements() ) { - uno::Reference< beans::XPropertyChangeListener > xListener( - aIter.next(), uno::UNO_QUERY ); - if ( xListener.is() ) - xListener->propertyChange( rEvt ); + static_cast< beans::XPropertyChangeListener* >( aIter.next() ) + ->propertyChange( rEvt ); } } } diff --git a/vcl/win/dtrans/generic_clipboard.cxx b/vcl/win/dtrans/generic_clipboard.cxx index 23c26415d697..a614a6808c37 100644 --- a/vcl/win/dtrans/generic_clipboard.cxx +++ b/vcl/win/dtrans/generic_clipboard.cxx @@ -104,9 +104,7 @@ void SAL_CALL GenericClipboard::setContents(const Reference< XTransferable >& xT while (aIterator.hasMoreElements()) { - Reference < XClipboardListener > xListener(aIterator.next(), UNO_QUERY); - if (xListener.is()) - xListener->changedContents(aEvent); + static_cast<XClipboardListener*>(aIterator.next())->changedContents(aEvent); } } } |