summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/filtergrouping.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sfx2/source/dialog/filtergrouping.cxx')
-rw-r--r--sfx2/source/dialog/filtergrouping.cxx14
1 files changed, 5 insertions, 9 deletions
diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx
index ec81a7bcf049..70630396cb3b 100644
--- a/sfx2/source/dialog/filtergrouping.cxx
+++ b/sfx2/source/dialog/filtergrouping.cxx
@@ -623,15 +623,11 @@ namespace sfx2
"sfx2::lcl_GroupAndClassify: invalid all-filters array here!" );
// the loop below will work on invalid objects else ...
++aGroupPos;
- auto aGlobalIter = aGlobalClassNames.begin();
- while ( ( aGroupPos != _rAllFilters.end() )
- && ( aGlobalIter != aGlobalClassNames.end() )
- && ( *aGlobalIter != aServiceName )
- )
- {
- ++aGlobalIter;
- ++aGroupPos;
- }
+ auto aGlobalIter = std::find(aGlobalClassNames.begin(), aGlobalClassNames.end(), aServiceName);
+ auto nGroupPosShift = std::min(
+ std::distance(aGlobalClassNames.begin(), aGlobalIter),
+ std::distance(aGroupPos, _rAllFilters.end()));
+ std::advance(aGroupPos, nGroupPosShift);
if ( aGroupPos != _rAllFilters.end() )
// we found a global class name which matches the doc service name -> fill the filters of this
// group in the respective prepared group