diff --git a/sw/inc/shellres.hxx b/sw/inc/shellres.hxx index 0b7d14c..60ec022 100644 --- a/sw/inc/shellres.hxx +++ b/sw/inc/shellres.hxx @@ -104,8 +104,6 @@ private: inline const std::vector& ShellResource::GetAutoFmtNameLst() const { - if( !pAutoFmtNameLst ) - _GetAutoFmtNameLst(); return *pAutoFmtNameLst; } diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx index 75f787a..e886102 100644 --- a/sw/source/ui/utlui/initui.cxx +++ b/sw/source/ui/utlui/initui.cxx @@ -164,7 +164,7 @@ ShellResource::ShellResource() aTOXTablesName( SW_RES(STR_TOX_TBL)), aTOXAuthoritiesName( SW_RES(STR_TOX_AUTH)), aHyperlinkClick( SW_RES( STR_HYPERLINK_CLICK)), - pAutoFmtNameLst(0), + pAutoFmtNameLst(new std::vector), sPageDescFirstName( SW_RES(STR_PAGEDESC_FIRSTNAME)), sPageDescFollowName( SW_RES(STR_PAGEDESC_FOLLOWNAME)), sPageDescName( SW_RES(STR_PAGEDESC_NAME)) @@ -180,6 +180,7 @@ ShellResource::ShellResource() for(sal_uInt16 i = 0; i < nCount; ++i) aDocInfoLst.push_back(String(SW_RESSTR(FLD_DOCINFO_BEGIN + i))); + _GetAutoFmtNameLst(); FreeResource(); } @@ -231,22 +232,10 @@ SwGlossaryList* GetGlossaryList() return pGlossaryList; } -struct ImpAutoFmtNameListLoader : public Resource -{ - ImpAutoFmtNameListLoader( std::vector& rLst ); -}; - void ShellResource::_GetAutoFmtNameLst() const { - std::vector* pLst(pAutoFmtNameLst); - pLst = new std::vector; - pLst->reserve(STR_AUTOFMTREDL_END); - ImpAutoFmtNameListLoader aTmp( *pLst ); -} + pAutoFmtNameLst->reserve(STR_AUTOFMTREDL_END); -ImpAutoFmtNameListLoader::ImpAutoFmtNameListLoader( std::vector& rLst ) - : Resource( ResId(RID_SHELLRES_AUTOFMTSTRS, *pSwResMgr) ) -{ for( sal_uInt16 n = 0; n < STR_AUTOFMTREDL_END; ++n ) { String p(ResId(n + 1, *pSwResMgr)); @@ -264,9 +253,8 @@ ImpAutoFmtNameListLoader::ImpAutoFmtNameListLoader( std::vector& rLst ) p.SearchAndReplace(rtl::OUString("%2"), rLclD.getDoubleQuotationMarkEnd()); #endif } - rLst.insert(rLst.begin() + n, p); + pAutoFmtNameLst->insert(pAutoFmtNameLst->begin() + n, p); } - FreeResource(); } const String& SwAuthorityFieldType::GetAuthFieldName(ToxAuthorityField eType)