summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2018-10-24 00:49:27 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-24 14:45:19 +0200
commit86192438d16ec160d6b59d08735e770ee05ac113 (patch)
tree25dbb9dde6631d49b0ea8483c8f3018def3ddd0d /toolkit
parent6f50961e69406a17d6ec998956a6b33208b1001b (diff)
Simplify containers iterations in test..tools
Use range-based loop or replace with STL functions. Change-Id: If8fac9236a4696c8e56c0e81c60c429782581b96 Reviewed-on: https://gerrit.libreoffice.org/62262 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/animatedimagespeer.cxx9
-rw-r--r--toolkit/source/awt/vclxgraphics.cxx10
-rw-r--r--toolkit/source/awt/vclxregion.cxx4
-rw-r--r--toolkit/source/awt/vclxtabpagecontainer.cxx8
-rw-r--r--toolkit/source/awt/vclxwindow.cxx31
-rw-r--r--toolkit/source/controls/controlmodelcontainerbase.cxx5
-rw-r--r--toolkit/source/controls/grid/defaultgridcolumnmodel.cxx21
-rw-r--r--toolkit/source/controls/grid/defaultgriddatamodel.cxx4
-rw-r--r--toolkit/source/controls/grid/sortablegriddatamodel.cxx9
-rw-r--r--toolkit/source/controls/roadmapcontrol.cxx4
-rw-r--r--toolkit/source/controls/tree/treedatamodel.cxx8
-rw-r--r--toolkit/source/controls/unocontrol.cxx8
-rw-r--r--toolkit/source/controls/unocontrolcontainer.cxx51
-rw-r--r--toolkit/source/controls/unocontrolmodel.cxx27
-rw-r--r--toolkit/source/helper/btndlg.cxx22
-rw-r--r--toolkit/source/helper/unopropertyarrayhelper.cxx16
16 files changed, 94 insertions, 143 deletions
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx
index a0fa5cc71567..8221d5a21082 100644
--- a/toolkit/source/awt/animatedimagespeer.cxx
+++ b/toolkit/source/awt/animatedimagespeer.cxx
@@ -247,13 +247,10 @@ namespace toolkit
::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nPreferredSet ] );
aImages.resize( rImageSet.size() );
sal_Int32 imageIndex = 0;
- for ( ::std::vector< CachedImage >::const_iterator cachedImage = rImageSet.begin();
- cachedImage != rImageSet.end();
- ++cachedImage, ++imageIndex
- )
+ for ( const auto& rCachedImage : rImageSet )
{
- lcl_ensureImage_throw( xGraphicProvider, isHighContrast, *cachedImage );
- aImages[ imageIndex ] = Image(cachedImage->xGraphic);
+ lcl_ensureImage_throw( xGraphicProvider, isHighContrast, rCachedImage );
+ aImages[ imageIndex++ ] = Image(rCachedImage.xGraphic);
}
}
pThrobber->setImageList( aImages );
diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx
index 533e03449e0c..65386f1fba48 100644
--- a/toolkit/source/awt/vclxgraphics.cxx
+++ b/toolkit/source/awt/vclxgraphics.cxx
@@ -69,13 +69,9 @@ VCLXGraphics::~VCLXGraphics()
std::vector< VCLXGraphics* > *pLst = mpOutputDevice ? mpOutputDevice->GetUnoGraphicsList() : nullptr;
if ( pLst )
{
- for( std::vector< VCLXGraphics* >::iterator it = pLst->begin(); it != pLst->end(); ++it )
- {
- if( *it == this ) {
- pLst->erase( it );
- break;
- }
- }
+ auto it = std::find(pLst->begin(), pLst->end(), this);
+ if (it != pLst->end())
+ pLst->erase( it );
}
mpClipRegion.reset();
diff --git a/toolkit/source/awt/vclxregion.cxx b/toolkit/source/awt/vclxregion.cxx
index 3922483ee9a9..a7ebd722debf 100644
--- a/toolkit/source/awt/vclxregion.cxx
+++ b/toolkit/source/awt/vclxregion.cxx
@@ -148,9 +148,9 @@ css::uno::Sequence< css::awt::Rectangle > VCLXRegion::getRectangles()
css::uno::Sequence< css::awt::Rectangle > aRects(aRectangles.size());
sal_uInt32 a(0);
- for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); ++aRectIter)
+ for(const auto& rRect : aRectangles)
{
- aRects.getArray()[a++] = AWTRectangle(*aRectIter);
+ aRects.getArray()[a++] = AWTRectangle(rRect);
}
//Rectangle aRect;
diff --git a/toolkit/source/awt/vclxtabpagecontainer.cxx b/toolkit/source/awt/vclxtabpagecontainer.cxx
index 391072f1cd47..5ef02d4e2919 100644
--- a/toolkit/source/awt/vclxtabpagecontainer.cxx
+++ b/toolkit/source/awt/vclxtabpagecontainer.cxx
@@ -125,15 +125,13 @@ Reference< css::awt::tab::XTabPage > SAL_CALL VCLXTabPageContainer::getTabPageBy
{
SolarMutexGuard aGuard;
Reference< css::awt::tab::XTabPage > xTabPage;
- ::std::vector< Reference< css::awt::tab::XTabPage > >::iterator aIter = m_aTabPages.begin();
- ::std::vector< Reference< css::awt::tab::XTabPage > >::iterator aEnd = m_aTabPages.end();
- for(;aIter != aEnd;++aIter)
+ for(const auto& rTabPage : m_aTabPages)
{
- Reference< awt::XControl > xControl(*aIter,UNO_QUERY );
+ Reference< awt::XControl > xControl(rTabPage,UNO_QUERY );
Reference< awt::tab::XTabPageModel > xP( xControl->getModel(), UNO_QUERY );
if ( tabPageID == xP->getTabPageID() )
{
- xTabPage = *aIter;
+ xTabPage = rTabPage;
break;
}
}
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index eb3df832c972..9843cd863cd2 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -291,12 +291,9 @@ IMPL_LINK_NOARG(VCLXWindowImpl, OnProcessCallbacks, void*, void)
{
SAL_INFO("toolkit.controls", "OnProcessCallbacks relinquished solarmutex");
SolarMutexReleaser aReleaseSolar;
- for ( CallbackArray::const_iterator loop = aCallbacksCopy.begin();
- loop != aCallbacksCopy.end();
- ++loop
- )
+ for (const auto& rCallback : aCallbacksCopy)
{
- (*loop)();
+ rCallback();
}
}
}
@@ -1330,20 +1327,16 @@ void VCLXWindow::ImplGetPropertyIds( std::vector< sal_uInt16 > &rIds, bool bWith
// lovely hack from:
// void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
- std::vector< sal_uInt16 >::const_iterator iter;
- for( iter = rIds.begin(); iter != rIds.end(); ++iter) {
- if( *iter == BASEPROPERTY_FONTDESCRIPTOR )
- {
- // some properties are not included in the FontDescriptor, but every time
- // when we have a FontDescriptor we want to have these properties too.
- // => Easier to register the here, instead everywhere where I register the FontDescriptor...
-
- rIds.push_back( BASEPROPERTY_TEXTCOLOR );
- rIds.push_back( BASEPROPERTY_TEXTLINECOLOR );
- rIds.push_back( BASEPROPERTY_FONTRELIEF );
- rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK );
- break;
- }
+ if( std::find(rIds.begin(), rIds.end(), BASEPROPERTY_FONTDESCRIPTOR) != rIds.end() )
+ {
+ // some properties are not included in the FontDescriptor, but every time
+ // when we have a FontDescriptor we want to have these properties too.
+ // => Easier to register the here, instead everywhere where I register the FontDescriptor...
+
+ rIds.push_back( BASEPROPERTY_TEXTCOLOR );
+ rIds.push_back( BASEPROPERTY_TEXTLINECOLOR );
+ rIds.push_back( BASEPROPERTY_FONTRELIEF );
+ rIds.push_back( BASEPROPERTY_FONTEMPHASISMARK );
}
}
diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 69bc6b94fb48..1235e6c09889 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -707,10 +707,9 @@ Sequence< Reference< XControlModel > > SAL_CALL ControlModelContainerBase::getCo
::std::vector< Reference< XControlModel > > aUnindexedModels;
// will be the container of all models which do not have a tab index property
- UnoControlModelHolderVector::const_iterator aLoop = maModels.begin();
- for ( ; aLoop != maModels.end(); ++aLoop )
+ for ( const auto& rModel : maModels )
{
- Reference< XControlModel > xModel( aLoop->first );
+ Reference< XControlModel > xModel( rModel.first );
// see if the model has a TabIndex property
Reference< XPropertySet > xControlProps( xModel, UNO_QUERY );
diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
index d6eb98d3b0bd..00a34fc696c2 100644
--- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
+++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx
@@ -287,32 +287,23 @@ private:
}
// fire removal notifications
- for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
- event != aRemovedColumns.end();
- ++event
- )
+ for (const auto& rEvent : aRemovedColumns)
{
- m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, *event );
+ m_aContainerListeners.notifyEach( &XContainerListener::elementRemoved, rEvent );
}
// fire insertion notifications
- for ( ::std::vector< ContainerEvent >::const_iterator event = aInsertedColumns.begin();
- event != aInsertedColumns.end();
- ++event
- )
+ for (const auto& rEvent : aInsertedColumns)
{
- m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, *event );
+ m_aContainerListeners.notifyEach( &XContainerListener::elementInserted, rEvent );
}
// dispose removed columns
- for ( ::std::vector< ContainerEvent >::const_iterator event = aRemovedColumns.begin();
- event != aRemovedColumns.end();
- ++event
- )
+ for (const auto& rEvent : aRemovedColumns)
{
try
{
- const Reference< XComponent > xColComp( event->Element, UNO_QUERY_THROW );
+ const Reference< XComponent > xColComp( rEvent.Element, UNO_QUERY_THROW );
xColComp->dispose();
}
catch( const Exception& )
diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
index e613878a3166..35252453c2cc 100644
--- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx
+++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx
@@ -444,8 +444,8 @@ private:
::comphelper::ComponentGuard aGuard( *this, rBHelper );
RowData& rRowData = impl_getRowDataAccess_throw( i_rowIndex, m_nColumnCount );
- for ( RowData::iterator cell = rRowData.begin(); cell != rRowData.end(); ++cell )
- cell->second = i_value;
+ for ( auto& rCell : rRowData )
+ rCell.second = i_value;
}
diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
index 9f7edd97a369..f17ae53c14c0 100644
--- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx
+++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx
@@ -375,13 +375,10 @@ void lcl_clear( STLCONTAINER& i_container )
void lcl_decrementValuesGreaterThan( ::std::vector< ::sal_Int32 > & io_indexMap, sal_Int32 const i_threshold )
{
- for ( ::std::vector< ::sal_Int32 >::iterator loop = io_indexMap.begin();
- loop != io_indexMap.end();
- ++loop
- )
+ for ( auto& rIndex : io_indexMap )
{
- if ( *loop >= i_threshold )
- --*loop;
+ if ( rIndex >= i_threshold )
+ --rIndex;
}
}
diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx
index 48e7902b2a93..1807c2200394 100644
--- a/toolkit/source/controls/roadmapcontrol.cxx
+++ b/toolkit/source/controls/roadmapcontrol.cxx
@@ -232,9 +232,9 @@ static void lcl_throwIndexOutOfBoundsException( )
while ( bIncrement )
{
bIncrement = false;
- for ( RoadmapItemHolderList::iterator i = maRoadmapItems.begin(); i < maRoadmapItems.end(); ++i )
+ for ( const auto& rRoadmapItem : maRoadmapItems )
{
- CurRoadmapItem = *i;
+ CurRoadmapItem = rRoadmapItem;
Reference< XPropertySet > xPropertySet( CurRoadmapItem, UNO_QUERY );
aAny = xPropertySet->getPropertyValue("ID");
aAny >>= n_CurItemID;
diff --git a/toolkit/source/controls/tree/treedatamodel.cxx b/toolkit/source/controls/tree/treedatamodel.cxx
index 0c5cd4347b6b..84838061cbdd 100644
--- a/toolkit/source/controls/tree/treedatamodel.cxx
+++ b/toolkit/source/controls/tree/treedatamodel.cxx
@@ -264,9 +264,8 @@ MutableTreeNode::MutableTreeNode( const MutableTreeDataModelRef& xModel, const A
MutableTreeNode::~MutableTreeNode()
{
- TreeNodeVector::iterator aIter( maChildren.begin() );
- while( aIter != maChildren.end() )
- (*aIter++)->setParent(nullptr);
+ for( auto& rChild : maChildren )
+ rChild->setParent(nullptr);
}
void MutableTreeNode::setParent( MutableTreeNode* pParent )
@@ -336,8 +335,7 @@ void SAL_CALL MutableTreeNode::insertChildByIndex( sal_Int32 nChildIndex, const
xImpl->mbIsInserted = true;
TreeNodeVector::iterator aIter( maChildren.begin() );
- while( (nChildIndex-- > 0) && (aIter != maChildren.end()) )
- ++aIter;
+ std::advance(aIter, nChildIndex);
maChildren.insert( aIter, xImpl );
xImpl->setParent( this );
diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx
index 28dac1716889..a52eaf80e6fc 100644
--- a/toolkit/source/controls/unocontrol.cxx
+++ b/toolkit/source/controls/unocontrol.cxx
@@ -644,13 +644,9 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent
// setting peer properties may result in an attempt to acquire the solar mutex, 'cause the peers
// usually don't have an own mutex but use the SolarMutex instead.
// To prevent deadlocks resulting from this, we do this without our own mutex locked
- std::vector< PropertyValue >::iterator aEnd = aPeerPropertiesToSet.end();
- for ( std::vector< PropertyValue >::iterator aLoop = aPeerPropertiesToSet.begin();
- aLoop != aEnd;
- ++aLoop
- )
+ for (const auto& rProp : aPeerPropertiesToSet)
{
- ImplSetPeerProperty( aLoop->Name, aLoop->Value );
+ ImplSetPeerProperty( rProp.Name, rProp.Value );
}
}
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index 7311a184ed48..86ad983ff8e1 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -175,11 +175,11 @@ void UnoControlHolderList::getControls( uno::Sequence< uno::Reference< awt::XCon
{
_out_rControls.realloc( maControls.size() );
uno::Reference< awt::XControl >* pControls = _out_rControls.getArray();
- for ( ControlMap::const_iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop, ++pControls
- )
- *pControls = loop->second->getControl();
+ for (const auto& rEntry : maControls)
+ {
+ *pControls = rEntry.second->getControl();
+ ++pControls;
+ }
}
@@ -187,36 +187,30 @@ void UnoControlHolderList::getIdentifiers( uno::Sequence< sal_Int32 >& _out_rIde
{
_out_rIdentifiers.realloc( maControls.size() );
sal_Int32* pIndentifiers = _out_rIdentifiers.getArray();
- for ( ControlMap::const_iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop, ++pIndentifiers
- )
- *pIndentifiers = loop->first;
+ for (const auto& rEntry : maControls)
+ {
+ *pIndentifiers = rEntry.first;
+ ++pIndentifiers;
+ }
}
uno::Reference< awt::XControl > UnoControlHolderList::getControlForName( const OUString& _rName ) const
{
- for ( ControlMap::const_iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop
- )
- if ( loop->second->getName() == _rName )
- return loop->second->getControl();
+ auto loop = std::find_if(maControls.begin(), maControls.end(),
+ [&_rName](const ControlMap::value_type& rEntry) { return rEntry.second->getName() == _rName; });
+ if (loop != maControls.end())
+ return loop->second->getControl();
return uno::Reference< awt::XControl >();
}
UnoControlHolderList::ControlIdentifier UnoControlHolderList::getControlIdentifier( const uno::Reference< awt::XControl >& _rxControl )
{
- for ( ControlMap::iterator loop = maControls.begin();
- loop != maControls.end();
- ++loop
- )
- {
- if ( loop->second->getControl().get() == _rxControl.get() )
- return loop->first;
- }
+ auto loop = std::find_if(maControls.begin(), maControls.end(),
+ [&_rxControl](const ControlMap::value_type& rEntry) { return rEntry.second->getControl().get() == _rxControl.get(); });
+ if (loop != maControls.end())
+ return loop->first;
return -1;
}
@@ -284,13 +278,8 @@ OUString UnoControlHolderList::impl_getFreeName_throw()
for ( ControlIdentifier candidateId = 0; candidateId < ::std::numeric_limits< ControlIdentifier >::max(); ++candidateId )
{
OUString candidateName( "control_" + OUString::number( candidateId ) );
- ControlMap::const_iterator loop = maControls.begin();
- for ( ; loop != maControls.end(); ++loop )
- {
- if ( loop->second->getName() == candidateName )
- break;
- }
- if ( loop == maControls.end() )
+ if ( std::none_of(maControls.begin(), maControls.end(),
+ [&candidateName](const ControlMap::value_type& rEntry) { return rEntry.second->getName() == candidateName; }) )
return candidateName;
}
throw uno::RuntimeException("out of identifiers" );
diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx
index e27ec6da790e..b59d4ce0e22d 100644
--- a/toolkit/source/controls/unocontrolmodel.cxx
+++ b/toolkit/source/controls/unocontrolmodel.cxx
@@ -140,8 +140,8 @@ css::uno::Sequence<sal_Int32> UnoControlModel::ImplGetPropertyIds() const
css::uno::Sequence<sal_Int32> aIDs( nIDs );
sal_Int32* pIDs = aIDs.getArray();
sal_uInt32 n = 0;
- for ( ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it )
- pIDs[n++] = it->first;
+ for ( const auto& rData : maData )
+ pIDs[n++] = rData.first;
return aIDs;
}
@@ -408,11 +408,10 @@ void UnoControlModel::ImplRegisterProperty( sal_uInt16 nPropId )
void UnoControlModel::ImplRegisterProperties( const std::vector< sal_uInt16 > &rIds )
{
- std::vector< sal_uInt16 >::const_iterator iter;
- for( iter = rIds.begin(); iter != rIds.end(); ++iter)
+ for (const auto& rId : rIds)
{
- if( !ImplHasProperty( *iter ) )
- ImplRegisterProperty( *iter, ImplGetDefaultValue( *iter ) );
+ if( !ImplHasProperty( rId ) )
+ ImplRegisterProperty( rId, ImplGetDefaultValue( rId ) );
}
}
@@ -538,12 +537,12 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt
std::set<sal_uInt16> aProps;
- for (ImplPropertyTable::const_iterator it = maData.begin(); it != maData.end(); ++it )
+ for (const auto& rData : maData)
{
- if ( ( ( GetPropertyAttribs( it->first ) & css::beans::PropertyAttribute::TRANSIENT ) == 0 )
- && ( getPropertyState( GetPropertyName( it->first ) ) != css::beans::PropertyState_DEFAULT_VALUE ) )
+ if ( ( ( GetPropertyAttribs( rData.first ) & css::beans::PropertyAttribute::TRANSIENT ) == 0 )
+ && ( getPropertyState( GetPropertyName( rData.first ) ) != css::beans::PropertyState_DEFAULT_VALUE ) )
{
- aProps.insert( it->first );
+ aProps.insert( rData.first );
}
}
@@ -552,13 +551,13 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt
// Save FontProperty always in the old format (due to missing distinction
// between 5.0 and 5.1)
OutStream->writeLong( ( aProps.find( BASEPROPERTY_FONTDESCRIPTOR ) != aProps.end() ) ? ( nProps + 3 ) : nProps );
- for ( std::set<sal_uInt16>::const_iterator it = aProps.begin(); it != aProps.end(); ++it )
+ for ( const auto& rProp : aProps )
{
sal_Int32 nPropDataBeginMark = xMark->createMark();
OutStream->writeLong( 0 ); // DataLen
- const css::uno::Any* pProp = &(maData[*it]);
- OutStream->writeShort( *it );
+ const css::uno::Any* pProp = &(maData[rProp]);
+ OutStream->writeShort( rProp );
bool bVoid = pProp->getValueType().getTypeClass() == css::uno::TypeClass_VOID;
@@ -687,7 +686,7 @@ void UnoControlModel::write( const css::uno::Reference< css::io::XObjectOutputSt
SAL_WARN( "toolkit", "UnoControlModel::write: don't know how to handle a property of type '"
<< rType.getTypeName()
<< "'.\n(Currently handling property '"
- << GetPropertyName( *it )
+ << GetPropertyName( rProp )
<< "'.)");
}
#endif
diff --git a/toolkit/source/helper/btndlg.cxx b/toolkit/source/helper/btndlg.cxx
index 5b7683c9da86..8a19c6041506 100644
--- a/toolkit/source/helper/btndlg.cxx
+++ b/toolkit/source/helper/btndlg.cxx
@@ -292,19 +292,17 @@ void ButtonDialog::AddButton( StandardButtonType eType, sal_uInt16 nId,
void ButtonDialog::RemoveButton( sal_uInt16 nId )
{
- for (std::vector<std::unique_ptr<ImplBtnDlgItem>>::iterator it
- = m_ItemList.begin(); it != m_ItemList.end(); ++it)
+ auto it = std::find_if(m_ItemList.begin(), m_ItemList.end(),
+ [&nId](const std::unique_ptr<ImplBtnDlgItem>& rItem) { return rItem->mnId == nId; });
+ if (it != m_ItemList.end())
{
- if ((*it)->mnId == nId)
- {
- (*it)->mpPushButton->Hide();
- if ((*it)->mbOwnButton)
- (*it)->mpPushButton.disposeAndClear();
- else
- (*it)->mpPushButton.clear();
- m_ItemList.erase(it);
- return;
- }
+ (*it)->mpPushButton->Hide();
+ if ((*it)->mbOwnButton)
+ (*it)->mpPushButton.disposeAndClear();
+ else
+ (*it)->mpPushButton.clear();
+ m_ItemList.erase(it);
+ return;
}
SAL_WARN( "vcl.window", "ButtonDialog::RemoveButton(): ButtonId invalid" );
diff --git a/toolkit/source/helper/unopropertyarrayhelper.cxx b/toolkit/source/helper/unopropertyarrayhelper.cxx
index 8ac6f95103c8..704f797d11b1 100644
--- a/toolkit/source/helper/unopropertyarrayhelper.cxx
+++ b/toolkit/source/helper/unopropertyarrayhelper.cxx
@@ -36,9 +36,8 @@ UnoPropertyArrayHelper::UnoPropertyArrayHelper( const css::uno::Sequence<sal_Int
UnoPropertyArrayHelper::UnoPropertyArrayHelper( const std::vector< sal_uInt16 > &rIDs )
{
- std::vector< sal_uInt16 >::const_iterator iter;
- for( iter = rIDs.begin(); iter != rIDs.end(); ++iter)
- maIDs.insert( *iter );
+ for (const auto& rId : rIDs)
+ maIDs.insert( rId );
}
bool UnoPropertyArrayHelper::ImplHasProperty( sal_uInt16 nPropId ) const
@@ -69,9 +68,9 @@ css::uno::Sequence< css::beans::Property > UnoPropertyArrayHelper::getProperties
// Sort by names ...
std::map<sal_Int32, sal_uInt16> aSortedPropsIds;
- for( std::set<sal_Int32>::const_iterator it = maIDs.begin(); it != maIDs.end(); ++it)
+ for (const auto& rId : maIDs)
{
- sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(*it);
+ sal_uInt16 nId = sal::static_int_cast< sal_uInt16 >(rId);
aSortedPropsIds[ 1+GetPropertyOrderNr( nId ) ] = nId;
if ( nId == BASEPROPERTY_FONTDESCRIPTOR )
@@ -86,14 +85,15 @@ css::uno::Sequence< css::beans::Property > UnoPropertyArrayHelper::getProperties
css::uno::Sequence< css::beans::Property> aProps( nProps );
css::beans::Property* pProps = aProps.getArray();
- std::map<sal_Int32, sal_uInt16>::const_iterator it = aSortedPropsIds.begin();
- for ( sal_uInt32 n = 0; n < nProps; n++, ++it )
+ sal_uInt32 n = 0;
+ for ( const auto& rPropIds : aSortedPropsIds )
{
- sal_uInt16 nId = it->second;
+ sal_uInt16 nId = rPropIds.second;
pProps[n].Name = GetPropertyName( nId );
pProps[n].Handle = nId;
pProps[n].Type = *GetPropertyType( nId );
pProps[n].Attributes = GetPropertyAttribs( nId );
+ ++n;
}
return aProps;