Simplify Sequence iterations in UnoControls
Use range-based loops Change-Id: I4d3be75bb83c74267b9dec6f1dcdc105c292be9d Reviewed-on: https://gerrit.libreoffice.org/72011 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
committed by
Noel Grandin
parent
e0382c3ad7
commit
a11572dc2e
@@ -117,11 +117,10 @@ void SAL_CALL BaseContainerControl::createPeer( const Reference< XToolkit >&
|
||||
|
||||
// create peers at all children
|
||||
Sequence< Reference< XControl > > seqControlList = getControls();
|
||||
sal_uInt32 nControls = seqControlList.getLength();
|
||||
|
||||
for ( sal_uInt32 n=0; n<nControls; n++ )
|
||||
for ( auto& rxControl : seqControlList )
|
||||
{
|
||||
seqControlList.getArray()[n]->createPeer( xToolkit, getPeer() );
|
||||
rxControl->createPeer( xToolkit, getPeer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,22 +156,18 @@ void OMRCListenerMultiplexerHelper::setPeer( const Reference< XWindow >& xPeer )
|
||||
{
|
||||
// get all types from the listener added to the peer
|
||||
Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
|
||||
const Type* pArray = aContainedTypes.getConstArray();
|
||||
sal_Int32 nCount = aContainedTypes.getLength();
|
||||
// loop over all listener types and remove the listeners from the peer
|
||||
for( sal_Int32 i=0; i<nCount; i++ )
|
||||
impl_unadviseFromPeer( m_xPeer, pArray[i] );
|
||||
for( const auto& rContainedType : aContainedTypes )
|
||||
impl_unadviseFromPeer( m_xPeer, rContainedType );
|
||||
}
|
||||
m_xPeer = xPeer;
|
||||
if( m_xPeer.is() )
|
||||
{
|
||||
// get all types from the listener added to the peer
|
||||
Sequence< Type > aContainedTypes = m_aListenerHolder.getContainedTypes();
|
||||
const Type* pArray = aContainedTypes.getConstArray();
|
||||
sal_Int32 nCount = aContainedTypes.getLength();
|
||||
// loop over all listener types and add the listeners to the peer
|
||||
for( sal_Int32 i = 0; i < nCount; i++ )
|
||||
impl_adviseToPeer( m_xPeer, pArray[i] );
|
||||
for( const auto& rContainedType : aContainedTypes )
|
||||
impl_adviseToPeer( m_xPeer, rContainedType );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user