diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/excimp8.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/vba/vbawindow.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/vba/vbawindows.cxx | 9 |
3 files changed, 5 insertions, 21 deletions
diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 8fcfcd359e68..d14e1f608e88 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -25,6 +25,7 @@ #include <scitems.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <unotools/fltrcfg.hxx> #include <vcl/wmf.hxx> @@ -137,13 +138,7 @@ public: virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) override { ::osl::MutexGuard aGuard( m_aMutex ); - uno::Sequence< OUString > aResult( IdToOleNameHash.size() ); - NamedIndexToOleName::iterator it = IdToOleNameHash.begin(); - NamedIndexToOleName::iterator it_end = IdToOleNameHash.end(); - OUString* pName = aResult.getArray(); - for (; it != it_end; ++it, ++pName ) - *pName = it->first; - return aResult; + return comphelper::mapKeysToSequence( IdToOleNameHash); } virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) override { diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index b18184d78398..ec58bc901a3f 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -167,13 +167,7 @@ public: virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) override { - uno::Sequence< OUString > names( namesToIndices.size() ); - OUString* pString = names.getArray(); - NameIndexHash::const_iterator it = namesToIndices.begin(); - NameIndexHash::const_iterator it_end = namesToIndices.end(); - for ( ; it != it_end; ++it, ++pString ) - *pString = it->first; - return names; + return comphelper::mapKeysToSequence( namesToIndices ); } virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) override diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index ede740dd69e0..1f90d035c3df 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/frame/Desktop.hpp> #include <cppuhelper/implbase.hxx> +#include <comphelper/sequence.hxx> #include "vbawindow.hxx" #include "vbaglobals.hxx" @@ -178,13 +179,7 @@ public: virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw (uno::RuntimeException, std::exception) override { - uno::Sequence< OUString > names( namesToIndices.size() ); - OUString* pString = names.getArray(); - NameIndexHash::const_iterator it = namesToIndices.begin(); - NameIndexHash::const_iterator it_end = namesToIndices.end(); - for ( ; it != it_end; ++it, ++pString ) - *pString = it->first; - return names; + return comphelper::mapKeysToSequence( namesToIndices ); } virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw (uno::RuntimeException, std::exception) override |