Kaydet (Commit) 9e5e9dd1 authored tarafından Michael Meeks's avatar Michael Meeks

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.

Change-Id: Id603fb4e717dc7130468465493edccfe51d384c7
üst 78378af1
......@@ -70,6 +70,7 @@
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequenceasvector.hxx>
//UUUU
#include <unobrushitemhelper.hxx>
......@@ -788,23 +789,22 @@ uno::Any SwXStyleFamily::getByName(const OUString& rName)
uno::Sequence< OUString > SwXStyleFamily::getElementNames(void) throw( uno::RuntimeException, std::exception )
{
SolarMutexGuard aGuard;
uno::Sequence< OUString > aRet;
comphelper::SequenceAsVector< OUString > aRet;
if(pBasePool)
{
SfxStyleSheetIteratorPtr pIterator = pBasePool->CreateIterator(eFamily, SFXSTYLEBIT_ALL);
const 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, std::exception )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment