summaryrefslogtreecommitdiff
path: root/framework/source/accelerators
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-02-16 18:39:23 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-18 07:41:05 +0100
commit44841a6778821be3e68ab15819b39064b20e968f (patch)
tree8e9119cf35764f18f5b008e7758c6f950306fb8c /framework/source/accelerators
parentbcfbd24be02d2de5d4d27c147dc58c4515a9a0f5 (diff)
Simplify containers iterations in [f-l]*
Use range-based loop or replace with STL functions Change-Id: Ib3fab47318d1bfbb4df8f886a8cd9596525a420f Reviewed-on: https://gerrit.libreoffice.org/67914 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/accelerators')
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx16
-rw-r--r--framework/source/accelerators/presethandler.cxx8
2 files changed, 3 insertions, 21 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index 559be7efbb1b..596e5e2937c6 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -668,20 +668,8 @@ css::uno::Sequence< css::awt::KeyEvent > SAL_CALL XCUBasedAcceleratorConfigurati
static AcceleratorCache::TKeyList::const_iterator lcl_getPreferredKey(const AcceleratorCache::TKeyList& lKeys)
{
- AcceleratorCache::TKeyList::const_iterator pIt;
- for ( pIt = lKeys.begin ();
- pIt != lKeys.end ();
- ++pIt )
- {
- const css::awt::KeyEvent& rAWTKey = *pIt;
- const vcl::KeyCode aVCLKey = ::svt::AcceleratorExecute::st_AWTKey2VCLKey(rAWTKey);
- const OUString sName = aVCLKey.GetName();
-
- if (!sName.isEmpty())
- return pIt;
- }
-
- return lKeys.end();
+ return std::find_if(lKeys.begin(), lKeys.end(), [](const css::awt::KeyEvent& rAWTKey) {
+ return !::svt::AcceleratorExecute::st_AWTKey2VCLKey(rAWTKey).GetName().isEmpty(); });
}
css::uno::Sequence< css::uno::Any > SAL_CALL XCUBasedAcceleratorConfiguration::getPreferredKeyEventsForCommandList(const css::uno::Sequence< OUString >& lCommandList)
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index 2c0b96f78f02..34c94719e6df 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -729,13 +729,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
}
else
{
- for ( pFound = lLocalizedValues.begin();
- pFound != lLocalizedValues.end();
- ++pFound )
- {
- if (*pFound == rLanguageTag)
- break;
- }
+ pFound = std::find(lLocalizedValues.begin(), lLocalizedValues.end(), rLanguageTag);
}
return pFound;