summaryrefslogtreecommitdiff
path: root/writerperfect/qa/unit/WpftLoader.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-06-12 11:21:20 +0300
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-06-13 19:43:13 +0200
commit54afdbd1b442d93313a01e58dba8fe3b84f596d1 (patch)
tree4564dd8bf6443521622b96b52e22caf65bb87d4d /writerperfect/qa/unit/WpftLoader.cxx
parent8b3c861c46ae12d21b7b3a550e2daa21d2006b77 (diff)
Simplify Sequence iterations in writerfilter, writerperfect, xmlhelp
Use range-based loops or replace with comphelper or STL functions Change-Id: I9113e04d15ad84d0abac087afc627969e8ebc354 Reviewed-on: https://gerrit.libreoffice.org/73867 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerperfect/qa/unit/WpftLoader.cxx')
-rw-r--r--writerperfect/qa/unit/WpftLoader.cxx17
1 files changed, 8 insertions, 9 deletions
diff --git a/writerperfect/qa/unit/WpftLoader.cxx b/writerperfect/qa/unit/WpftLoader.cxx
index 79fc2a05dc68..4c5696c18067 100644
--- a/writerperfect/qa/unit/WpftLoader.cxx
+++ b/writerperfect/qa/unit/WpftLoader.cxx
@@ -181,22 +181,21 @@ void WpftLoader::impl_dispose()
void WpftLoader::impl_detectFilterName(uno::Sequence<beans::PropertyValue>& rDescriptor,
const OUString& rTypeName)
{
- const sal_Int32 nDescriptorLen = rDescriptor.getLength();
-
- for (sal_Int32 n = 0; nDescriptorLen != n; ++n)
- {
- if ("FilterName" == rDescriptor[n].Name)
- return;
- }
+ bool bHasFilterName
+ = std::any_of(rDescriptor.begin(), rDescriptor.end(),
+ [](const beans::PropertyValue& rProp) { return "FilterName" == rProp.Name; });
+ if (bHasFilterName)
+ return;
uno::Sequence<beans::PropertyValue> aTypes;
if (m_xTypeMap->getByName(rTypeName) >>= aTypes)
{
- for (sal_Int32 n = 0; aTypes.getLength() != n; ++n)
+ for (const auto& rType : aTypes)
{
OUString aFilterName;
- if (("PreferredFilter" == aTypes[n].Name) && (aTypes[n].Value >>= aFilterName))
+ if (("PreferredFilter" == rType.Name) && (rType.Value >>= aFilterName))
{
+ const sal_Int32 nDescriptorLen = rDescriptor.getLength();
rDescriptor.realloc(nDescriptorLen + 1);
rDescriptor[nDescriptorLen].Name = "FilterName";
rDescriptor[nDescriptorLen].Value <<= aFilterName;