diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-14 15:48:35 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-14 20:39:00 +0200 |
commit | 1c3929a0a1645e802ee18f9c3d3d380375500c72 (patch) | |
tree | 842d6867a8c67837b15d2ff666e1ad1dd694b401 /embeddedobj/source/msole | |
parent | 9693b491295336955f7ce8359284b67a82ecf28f (diff) |
loplugin:flatten in embeddedobj,emfio
Change-Id: Ibaf5e1a4db1088322cf8c5e127d328b140406197
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92196
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'embeddedobj/source/msole')
-rw-r--r-- | embeddedobj/source/msole/oleembed.cxx | 96 | ||||
-rw-r--r-- | embeddedobj/source/msole/olemisc.cxx | 34 | ||||
-rw-r--r-- | embeddedobj/source/msole/ownview.cxx | 34 |
3 files changed, 82 insertions, 82 deletions
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx index c84b0e72d073..faf23cf585c9 100644 --- a/embeddedobj/source/msole/oleembed.cxx +++ b/embeddedobj/source/msole/oleembed.cxx @@ -119,82 +119,82 @@ uno::Sequence< sal_Int32 > OleEmbeddedObject::GetIntermediateVerbsSequence_Impl( void OleEmbeddedObject::MoveListeners() { - if ( m_pInterfaceContainer ) + if ( !m_pInterfaceContainer ) + return; + + // move state change listeners { - // move state change listeners + ::cppu::OInterfaceContainerHelper* pStateChangeContainer = + m_pInterfaceContainer->getContainer( cppu::UnoType<embed::XStateChangeListener>::get()); + if ( pStateChangeContainer != nullptr ) { - ::cppu::OInterfaceContainerHelper* pStateChangeContainer = - m_pInterfaceContainer->getContainer( cppu::UnoType<embed::XStateChangeListener>::get()); - if ( pStateChangeContainer != nullptr ) + if ( m_xWrappedObject.is() ) { - if ( m_xWrappedObject.is() ) + ::cppu::OInterfaceIteratorHelper pIterator( *pStateChangeContainer ); + while ( pIterator.hasMoreElements() ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pStateChangeContainer ); - while ( pIterator.hasMoreElements() ) + try { - try - { - m_xWrappedObject->addStateChangeListener( static_cast<embed::XStateChangeListener*>(pIterator.next()) ); - } - catch( const uno::RuntimeException& ) - { - pIterator.remove(); - } + m_xWrappedObject->addStateChangeListener( static_cast<embed::XStateChangeListener*>(pIterator.next()) ); + } + catch( const uno::RuntimeException& ) + { + pIterator.remove(); } } } } + } - // move event listeners + // move event listeners + { + ::cppu::OInterfaceContainerHelper* pEventContainer = + m_pInterfaceContainer->getContainer( cppu::UnoType<document::XEventListener>::get()); + if ( pEventContainer != nullptr ) { - ::cppu::OInterfaceContainerHelper* pEventContainer = - m_pInterfaceContainer->getContainer( cppu::UnoType<document::XEventListener>::get()); - if ( pEventContainer != nullptr ) + if ( m_xWrappedObject.is() ) { - if ( m_xWrappedObject.is() ) + ::cppu::OInterfaceIteratorHelper pIterator( *pEventContainer ); + while ( pIterator.hasMoreElements() ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pEventContainer ); - while ( pIterator.hasMoreElements() ) + try { - try - { - m_xWrappedObject->addEventListener( static_cast<document::XEventListener*>(pIterator.next()) ); - } - catch( const uno::RuntimeException& ) - { - pIterator.remove(); - } + m_xWrappedObject->addEventListener( static_cast<document::XEventListener*>(pIterator.next()) ); + } + catch( const uno::RuntimeException& ) + { + pIterator.remove(); } } } } + } - // move close listeners + // move close listeners + { + ::cppu::OInterfaceContainerHelper* pCloseContainer = + m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get()); + if ( pCloseContainer != nullptr ) { - ::cppu::OInterfaceContainerHelper* pCloseContainer = - m_pInterfaceContainer->getContainer( cppu::UnoType<util::XCloseListener>::get()); - if ( pCloseContainer != nullptr ) + if ( m_xWrappedObject.is() ) { - if ( m_xWrappedObject.is() ) + ::cppu::OInterfaceIteratorHelper pIterator( *pCloseContainer ); + while ( pIterator.hasMoreElements() ) { - ::cppu::OInterfaceIteratorHelper pIterator( *pCloseContainer ); - while ( pIterator.hasMoreElements() ) + try { - try - { - m_xWrappedObject->addCloseListener( static_cast<util::XCloseListener*>(pIterator.next()) ); - } - catch( const uno::RuntimeException& ) - { - pIterator.remove(); - } + m_xWrappedObject->addCloseListener( static_cast<util::XCloseListener*>(pIterator.next()) ); + } + catch( const uno::RuntimeException& ) + { + pIterator.remove(); } } } } - - m_pInterfaceContainer.reset(); } + + m_pInterfaceContainer.reset(); } diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx index 66572c40be4d..6de6a9cdca75 100644 --- a/embeddedobj/source/msole/olemisc.cxx +++ b/embeddedobj/source/msole/olemisc.cxx @@ -158,25 +158,25 @@ OleEmbeddedObject::~OleEmbeddedObject() void OleEmbeddedObject::MakeEventListenerNotification_Impl( const OUString& aEventName ) { - if ( m_pInterfaceContainer ) + if ( !m_pInterfaceContainer ) + return; + + ::cppu::OInterfaceContainerHelper* pContainer = + m_pInterfaceContainer->getContainer( + cppu::UnoType<document::XEventListener>::get()); + if ( pContainer == nullptr ) + return; + + document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName ); + ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); + while (pIterator.hasMoreElements()) { - ::cppu::OInterfaceContainerHelper* pContainer = - m_pInterfaceContainer->getContainer( - cppu::UnoType<document::XEventListener>::get()); - if ( pContainer != nullptr ) + try + { + static_cast<document::XEventListener*>(pIterator.next())->notifyEvent( aEvent ); + } + catch( const uno::RuntimeException& ) { - document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName ); - ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); - while (pIterator.hasMoreElements()) - { - try - { - static_cast<document::XEventListener*>(pIterator.next())->notifyEvent( aEvent ); - } - catch( const uno::RuntimeException& ) - { - } - } } } } diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 3344bc6804ed..9750798c6388 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -580,24 +580,24 @@ void SAL_CALL OwnView_Impl::notifyEvent( const document::EventObject& aEvent ) } } - if ( xModel.is() ) - { - try { - uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY ); - if ( xBroadCaster.is() ) - xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); - - uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); - if ( xCloseable.is() ) - xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); - } - catch( uno::Exception& ) - {} + if ( !xModel.is() ) + return; + + try { + uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY ); + if ( xBroadCaster.is() ) + xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >( + static_cast< ::cppu::OWeakObject* >( this ), + uno::UNO_QUERY ) ); + + uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); + if ( xCloseable.is() ) + xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >( + static_cast< ::cppu::OWeakObject* >( this ), + uno::UNO_QUERY ) ); } + catch( uno::Exception& ) + {} } |