summaryrefslogtreecommitdiff
path: root/chart2/source/controller/main/ElementSelector.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-03-10 21:51:45 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-03-12 16:10:01 +0100
commit95a538180fd21c52b752cbef46acf2aa2b842ab8 (patch)
tree6b248190da44e68400fbd663dbb17d5fd6c4223d /chart2/source/controller/main/ElementSelector.cxx
parentf9b354784faf65ecc8024cf6d7d7aaf589f6d91f (diff)
Simplify containers iterations in chart2, cli_ure, comphelper, configmgr
Use range-based loop or replace with STL functions Change-Id: I7c229faa96e08b76cb4f182a1bd77c15bac4ba76 Reviewed-on: https://gerrit.libreoffice.org/69010 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller/main/ElementSelector.cxx')
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index d868365a19c1..03ae95147c27 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -107,26 +107,23 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ );
lcl_addObjectsToList( aHierarchy, ::chart::ObjectHierarchy::getRootNodeOID(), m_aEntries, 0, xChartDoc );
- std::vector< ListBoxEntryData >::iterator aIt( m_aEntries.begin() );
if( bAddSelectionToList )
{
if ( aSelectedOID.isAutoGeneratedObject() )
{
OUString aSeriesCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::getSeriesParticleFromCID( aSelectedCID ) );
- for( aIt = m_aEntries.begin(); aIt != m_aEntries.end(); ++aIt )
+ std::vector< ListBoxEntryData >::iterator aIt = std::find_if(m_aEntries.begin(), m_aEntries.end(),
+ [&aSeriesCID](const ListBoxEntryData& rEntry) { return rEntry.OID.getObjectCID().match(aSeriesCID); });
+ if (aIt != m_aEntries.end())
{
- if( aIt->OID.getObjectCID().match( aSeriesCID ) )
- {
- ListBoxEntryData aEntry;
- aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
- aEntry.OID = aSelectedOID;
- ++aIt;
- if( aIt != m_aEntries.end() )
- m_aEntries.insert(aIt, aEntry);
- else
- m_aEntries.push_back( aEntry );
- break;
- }
+ ListBoxEntryData aEntry;
+ aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
+ aEntry.OID = aSelectedOID;
+ ++aIt;
+ if( aIt != m_aEntries.end() )
+ m_aEntries.insert(aIt, aEntry);
+ else
+ m_aEntries.push_back( aEntry );
}
}
else if ( aSelectedOID.isAdditionalShape() )