summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-11-05 08:39:47 +0100
committerJulien Nabet <serval2412@yahoo.fr>2017-11-05 11:40:33 +0100
commite567694246d99a2a99c4079b04ed2ad8cd5ed785 (patch)
tree006797c2b3e74e1a3e37c4739b0b5e513041dd2f /cui
parentca2aaa2b9f4ce69d05d415e13451ae6a6030f032 (diff)
Remove GetNextSubset and create GetSubsetMap
To avoid to store an iterator and simplify loops Change-Id: I9b160714125176841961a56905d81dcb876c68b6 Reviewed-on: https://gerrit.libreoffice.org/44326 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/cuicharmap.cxx16
1 files changed, 5 insertions, 11 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index 1f039be57e85..1058b70a795d 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -609,12 +609,8 @@ void SvxCharacterMap::fillAllSubsets(ListBox &rListBox)
{
SubsetMap aAll(nullptr);
rListBox.Clear();
- bool bFirst = true;
- while (const Subset *s = aAll.GetNextSubset(bFirst))
- {
- rListBox.InsertEntry( s->GetName() );
- bFirst = false;
- }
+ for (auto & subset : aAll.GetSubsetMap())
+ rListBox.InsertEntry( subset.GetName() );
}
@@ -675,13 +671,11 @@ IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, ListBox&, void)
pSubsetMap = new SubsetMap( xFontCharMap );
// update subset listbox for new font's unicode subsets
- // TODO: is it worth to improve the stupid linear search?
bool bFirst = true;
- const Subset* s;
- while( nullptr != (s = pSubsetMap->GetNextSubset( bFirst )) )
+ for (auto const& subset : pSubsetMap->GetSubsetMap())
{
- const sal_Int32 nPos_ = m_pSubsetLB->InsertEntry( s->GetName() );
- m_pSubsetLB->SetEntryData( nPos_, const_cast<Subset *>(s) );
+ const sal_Int32 nPos_ = m_pSubsetLB->InsertEntry( subset.GetName() );
+ m_pSubsetLB->SetEntryData( nPos_, const_cast<Subset *>(&subset) );
// NOTE: subset must live at least as long as the selected font
if( bFirst )
m_pSubsetLB->SelectEntryPos( nPos_ );