diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-09-13 22:12:00 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-12-06 09:06:44 +0100 |
commit | 808359e4def4f9dd1318c7d0330a14eacda7d02c (patch) | |
tree | 19beaece11c5a9ed55ebc8402ebfeffb29f4c022 /sd/source | |
parent | e1143d75eea07bdcd1e13d99a6015c1fc32bfb60 (diff) |
sd: modernize some loops
Change-Id: Ic86960ce2f690bebc51c9120053bdd50232f0358
(cherry picked from commit beb738eb8688ddaf133a0832328073e3e2b78757)
Diffstat (limited to 'sd/source')
3 files changed, 13 insertions, 24 deletions
diff --git a/sd/source/ui/framework/configuration/Configuration.cxx b/sd/source/ui/framework/configuration/Configuration.cxx index cf08236f80b3..a1f08e7816ab 100644 --- a/sd/source/ui/framework/configuration/Configuration.cxx +++ b/sd/source/ui/framework/configuration/Configuration.cxx @@ -129,16 +129,13 @@ Sequence<Reference<XResourceId> > SAL_CALL Configuration::getResources ( ::osl::MutexGuard aGuard (maMutex); ThrowIfDisposed(); - bool bFilterResources (!rsResourceURLPrefix.isEmpty()); + const bool bFilterResources (!rsResourceURLPrefix.isEmpty()); // Collect the matching resources in a vector. ::std::vector<Reference<XResourceId> > aResources; - ResourceContainer::const_iterator iResource; - for (iResource=mpResourceContainer->begin(); - iResource!=mpResourceContainer->end(); - ++iResource) + for (const auto& resource : *mpResourceContainer) { - if ( ! (*iResource)->isBoundTo(rxAnchorId,eMode)) + if (!resource->isBoundTo(rxAnchorId, eMode)) continue; if (bFilterResources) @@ -147,19 +144,17 @@ Sequence<Reference<XResourceId> > SAL_CALL Configuration::getResources ( // Make sure that the resource is bound directly to the anchor. if (eMode != AnchorBindingMode_DIRECT - && ! (*iResource)->isBoundTo(rxAnchorId, AnchorBindingMode_DIRECT)) + && !resource->isBoundTo(rxAnchorId, AnchorBindingMode_DIRECT)) { continue; } // Make sure that the resource URL matches the given prefix. - if ( ! (*iResource)->getResourceURL().match(rsResourceURLPrefix)) - { + if (!resource->getResourceURL().match(rsResourceURLPrefix)) continue; - } } - aResources.push_back(*iResource); + aResources.emplace_back(resource); } return comphelper::containerToSequence(aResources); diff --git a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx index ae6aa3a466bc..4c6731c5e882 100644 --- a/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx +++ b/sd/source/ui/framework/configuration/ConfigurationControllerBroadcaster.cxx @@ -84,20 +84,19 @@ void ConfigurationControllerBroadcaster::NotifyListeners ( // for every listener. ConfigurationChangeEvent aEvent (rEvent); - ListenerList::const_iterator iListener; - for (iListener=rList.begin(); iListener!=rList.end(); ++iListener) + for (const ListenerDescriptor& listener : rList) { try { - aEvent.UserData = iListener->maUserData; - iListener->mxListener->notifyConfigurationChange(aEvent); + aEvent.UserData = listener.maUserData; + listener.mxListener->notifyConfigurationChange(aEvent); } catch (const lang::DisposedException& rException) { // When the exception comes from the listener itself then // unregister it. - if (rException.Context == iListener->mxListener) - RemoveListener(iListener->mxListener); + if (rException.Context == listener.mxListener) + RemoveListener(listener.mxListener); } catch (const RuntimeException&) { diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index c9ab07963cca..a625c148aed2 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -320,7 +320,6 @@ FrameworkHelper::InstanceMap FrameworkHelper::maInstanceMap; ::std::shared_ptr<FrameworkHelper> FrameworkHelper::Instance (ViewShellBase& rBase) { - ::std::shared_ptr<FrameworkHelper> pHelper; InstanceMap::const_iterator iHelper (maInstanceMap.find(&rBase)); @@ -756,12 +755,8 @@ OUString FrameworkHelper::ResourceIdToString (const Reference<XResourceId>& rxRe sString += rxResourceId->getResourceURL(); if (rxResourceId->hasAnchor()) { - Sequence<OUString> aAnchorURLs (rxResourceId->getAnchorURLs()); - for (sal_Int32 nIndex=0; nIndex < aAnchorURLs.getLength(); ++nIndex) - { - sString += " | "; - sString += aAnchorURLs[nIndex]; - } + for (const OUString& s : rxResourceId->getAnchorURLs()) + sString += " | " + s; } } return sString; |