diff options
Diffstat (limited to 'scripting/source/provider/ProviderCache.cxx')
-rw-r--r-- | scripting/source/provider/ProviderCache.cxx | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx index cf54ea0aee22..e97be35acb6f 100644 --- a/scripting/source/provider/ProviderCache.cxx +++ b/scripting/source/provider/ProviderCache.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <comphelper/sequence.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/factory.hxx> #include <tools/diagnose_ex.h> @@ -150,17 +151,17 @@ ProviderCache::populateCache() if ( serviceNames.hasElements() ) { - for ( sal_Int32 index = 0; index < serviceNames.getLength(); index++ ) + auto pName = std::find_if(serviceNames.begin(), serviceNames.end(), + [this](const OUString& rName) { + return rName.startsWith("com.sun.star.script.provider.ScriptProviderFor") + && !isInBlackList(rName); + }); + if (pName != serviceNames.end()) { - if ( serviceNames[ index ].startsWith( "com.sun.star.script.provider.ScriptProviderFor" ) - && !isInBlackList( serviceNames[ index ] ) ) - { - serviceName = serviceNames[ index ]; - ProviderDetails details; - details.factory = factory; - m_hProviderDetailsCache[ serviceName ] = details; - break; - } + serviceName = *pName; + ProviderDetails details; + details.factory = factory; + m_hProviderDetailsCache[ serviceName ] = details; } } } @@ -193,6 +194,12 @@ ProviderCache::createProvider( ProviderDetails& details ) return details.provider; } + +bool +ProviderCache::isInBlackList( const OUString& serviceName ) +{ + return comphelper::findValue(m_sBlackList, serviceName) != -1; +} } //end namespace /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |