From 9df2821e61979dab32390d5c64dd49bee868adbb Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sat, 18 Apr 2020 14:08:51 +0200 Subject: loplugin:flatten in chart2 Change-Id: Iadc4da6515a7d82e7a92b33d74d589b61fa2c64f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92480 Tested-by: Jenkins Reviewed-by: Noel Grandin --- .../controller/accessibility/AccessibleBase.cxx | 80 +++++++++++----------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'chart2/source/controller/accessibility/AccessibleBase.cxx') diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index 91040ee70671..6f9192eba064 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -253,24 +253,24 @@ bool AccessibleBase::ImplUpdateChildren() void AccessibleBase::AddChild( AccessibleBase * pChild ) { OSL_ENSURE( pChild != nullptr, "Invalid Child" ); - if( pChild ) - { - ClearableMutexGuard aGuard( m_aMutex ); + if( !pChild ) + return; - Reference< XAccessible > xChild( pChild ); - m_aChildList.push_back( xChild ); + ClearableMutexGuard aGuard( m_aMutex ); - m_aChildOIDMap[ pChild->GetId() ] = xChild; + Reference< XAccessible > xChild( pChild ); + m_aChildList.push_back( xChild ); - // inform listeners of new child - if( m_bChildrenInitialized ) - { - Any aEmpty, aNew; - aNew <<= xChild; + m_aChildOIDMap[ pChild->GetId() ] = xChild; - aGuard.clear(); - BroadcastAccEvent( AccessibleEventId::CHILD, aNew, aEmpty ); - } + // inform listeners of new child + if( m_bChildrenInitialized ) + { + Any aEmpty, aNew; + aNew <<= xChild; + + aGuard.clear(); + BroadcastAccEvent( AccessibleEventId::CHILD, aNew, aEmpty ); } } @@ -282,41 +282,41 @@ void AccessibleBase::RemoveChildByOId( const ObjectIdentifier& rOId ) ClearableMutexGuard aGuard( m_aMutex ); ChildOIDMap::iterator aIt( m_aChildOIDMap.find( rOId )); - if( aIt != m_aChildOIDMap.end()) - { - Reference< XAccessible > xChild( aIt->second ); + if( aIt == m_aChildOIDMap.end()) + return; - // remove from map - m_aChildOIDMap.erase( aIt ); + Reference< XAccessible > xChild( aIt->second ); - // search child in vector - ChildListVectorType::iterator aVecIter = - std::find( m_aChildList.begin(), m_aChildList.end(), xChild ); + // remove from map + m_aChildOIDMap.erase( aIt ); - OSL_ENSURE( aVecIter != m_aChildList.end(), - "Inconsistent ChildMap" ); + // search child in vector + ChildListVectorType::iterator aVecIter = + std::find( m_aChildList.begin(), m_aChildList.end(), xChild ); - // remove child from vector - m_aChildList.erase( aVecIter ); - bool bInitialized = m_bChildrenInitialized; + OSL_ENSURE( aVecIter != m_aChildList.end(), + "Inconsistent ChildMap" ); - // call listeners unguarded - aGuard.clear(); + // remove child from vector + m_aChildList.erase( aVecIter ); + bool bInitialized = m_bChildrenInitialized; - // inform listeners of removed child - if( bInitialized ) - { - Any aEmpty, aOld; - aOld <<= xChild; + // call listeners unguarded + aGuard.clear(); - BroadcastAccEvent( AccessibleEventId::CHILD, aEmpty, aOld ); - } + // inform listeners of removed child + if( bInitialized ) + { + Any aEmpty, aOld; + aOld <<= xChild; - // dispose the child - Reference< lang::XComponent > xComp( xChild, UNO_QUERY ); - if( xComp.is()) - xComp->dispose(); + BroadcastAccEvent( AccessibleEventId::CHILD, aEmpty, aOld ); } + + // dispose the child + Reference< lang::XComponent > xComp( xChild, UNO_QUERY ); + if( xComp.is()) + xComp->dispose(); } awt::Point AccessibleBase::GetUpperLeftOnScreen() const -- cgit