diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-19 13:43:23 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-11-20 08:14:13 +0000 |
commit | fe3fd05966a668c1cdf53e8221b8614e9a07de65 (patch) | |
tree | 4c6c105b78d0cb9c45431c2fecd2583d6a2aa85c /sw | |
parent | 1d5c39192e81f950289dbdd7991a0e8a67c0aabc (diff) |
add mapKeysToSequence/mapValuesToSequence methods to comphelper
and use them
Change-Id: If4dc9df63db37185228aeaaab2979498d61304ec
Reviewed-on: https://gerrit.libreoffice.org/20055
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/accpara.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/unocore/unobkm.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/unocore/unocoll.cxx | 7 |
3 files changed, 4 insertions, 23 deletions
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index d18841e924eb..fdcf1ab6821f 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -2074,18 +2074,7 @@ uno::Sequence< PropertyValue > SwAccessibleParagraph::getRunAttributes( tAccParaPropValMap aRunAttrSeq; _getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq ); - uno::Sequence< PropertyValue > aValues( aRunAttrSeq.size() ); - PropertyValue* pValues = aValues.getArray(); - sal_Int32 i = 0; - for ( tAccParaPropValMap::const_iterator aIter = aRunAttrSeq.begin(); - aIter != aRunAttrSeq.end(); - ++aIter ) - { - pValues[i] = aIter->second; - ++i; - } - - return aValues; + return comphelper::mapValuesToSequence( aRunAttrSeq ); } void SwAccessibleParagraph::_getSupplementalAttributesImpl( diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 282502ca221c..dc049286e6d7 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -36,6 +36,7 @@ #include <docsh.hxx> #include <xmloff/odffields.hxx> #include <comphelper/servicehelper.hxx> +#include <comphelper/sequence.hxx> using namespace ::sw::mark; using namespace ::com::sun::star; @@ -532,11 +533,7 @@ uno::Sequence<OUString> SwXFieldmarkParameters::getElementNames() { SolarMutexGuard aGuard; IFieldmark::parameter_map_t* pParameters = getCoreParameters(); - uno::Sequence<OUString> vResult(pParameters->size()); - OUString* pOutEntry = vResult.getArray(); - for(IFieldmark::parameter_map_t::iterator pEntry = pParameters->begin(); pEntry!=pParameters->end(); ++pEntry, ++pOutEntry) - *pOutEntry = pEntry->first; - return vResult; + return comphelper::mapKeysToSequence(*pParameters); } sal_Bool SwXFieldmarkParameters::hasByName(const OUString& aName) diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 4cd09735e93f..51f1501a2900 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -194,12 +194,7 @@ public: } virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (css::uno::RuntimeException, std::exception) override { - uno::Sequence< OUString > aElements( mTemplateToProject.size() ); - StringHashMap::iterator it_end = mTemplateToProject.end(); - sal_Int32 index = 0; - for ( StringHashMap::iterator it = mTemplateToProject.begin(); it != it_end; ++it, ++index ) - aElements[ index ] = it->first; - return aElements; + return comphelper::mapKeysToSequence( mTemplateToProject ); } virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw ( css::lang::IllegalArgumentException, css::container::ElementExistException, css::lang::WrappedTargetException, std::exception ) override |