summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2014-06-19 22:34:55 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-25 11:21:19 +0200
commitcbb5b0e93444bd0b42a22bbef01dd8599c9d4483 (patch)
tree88f94f45194971c53c4b0c9e32e274ae8a12c4d5 /sw/source
parentedd98c9428e7ac15e16f28503ae831d895ce2a8c (diff)
fdo#76260 - a better approach for getting element names.
Don't do lots more work than we need to to build the list of names. It appears that the [] operator does a lot of apparently un-necessary work. Conflicts: sw/source/core/unocore/unostyle.cxx Change-Id: Id603fb4e717dc7130468465493edccfe51d384c7
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/unocore/unostyle.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 4963b68267ad..d5589ec3d0c9 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -69,6 +69,7 @@
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequenceasvector.hxx>
#include <boost/shared_ptr.hpp>
@@ -783,23 +784,22 @@ uno::Any SwXStyleFamily::getByName(const OUString& rName)
uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::RuntimeException )
{
SolarMutexGuard aGuard;
- uno::Sequence< OUString > aRet;
+ comphelper::SequenceAsVector< OUString > aRet;
if(pBasePool)
{
- SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
- sal_uInt16 nCount = pIterator->Count();
- aRet.realloc(nCount);
- OUString* pArray = aRet.getArray();
+ SfxStyleSheetIteratorPtr pIt = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
OUString aString;
- for(sal_uInt16 i = 0; i < nCount; i++)
+ for (SfxStyleSheetBase* pStyle = pIt->First(); pStyle; pStyle = pIt->Next())
{
- SwStyleNameMapper::FillProgName((*pIterator)[i]->GetName(), aString, lcl_GetSwEnumFromSfxEnum ( eFamily ), true );
- pArray[i] = aString;
+ SwStyleNameMapper::FillProgName(pStyle->GetName(), aString,
+ lcl_GetSwEnumFromSfxEnum ( eFamily ), true);
+ aRet.push_back(aString);
}
}
else
throw uno::RuntimeException();
- return aRet;
+
+ return aRet.getAsConstList();
}
sal_Bool SwXStyleFamily::hasByName(const OUString& rName) throw( uno::RuntimeException )