[Libreoffice-commits] core.git: sw/inc sw/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 4 05:26:14 UTC 2019


 sw/inc/SwStyleNameMapper.hxx                    |   45 -
 sw/source/core/bastyp/init.cxx                  |   38 -
 sw/source/core/doc/DocumentStylePoolManager.cxx |  101 +-
 sw/source/core/doc/SwStyleNameMapper.cxx        |  820 ++++++++++--------------
 4 files changed, 395 insertions(+), 609 deletions(-)

New commits:
commit 02bfb5e22eb55679e10d66e246218ea5adec65e1
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Oct 4 03:20:02 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Oct 4 07:25:34 2019 +0200

    Use function-local statics for SwStyleNameMapper lists/maps
    
    Simplifies memory management; makes code clearer; in case of
    SwStyleNameMapper::getHashTable, avoids unnecessary filling
    of vIndexes at each call.
    
    Change-Id: I789bc0695d39dddcccac6cbc43fb48ab94f1321b
    Reviewed-on: https://gerrit.libreoffice.org/80174
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Tested-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/inc/SwStyleNameMapper.hxx b/sw/inc/SwStyleNameMapper.hxx
index 79d4f1011238..139f09c974db 100644
--- a/sw/inc/SwStyleNameMapper.hxx
+++ b/sw/inc/SwStyleNameMapper.hxx
@@ -78,51 +78,6 @@ class SwStyleNameMapper final
     friend void InitCore();
     friend void FinitCore();
 
-    // UI Name tables
-    static std::vector<OUString> *s_pTextUINameArray,
-                            *s_pListsUINameArray,
-                            *s_pExtraUINameArray,
-                            *s_pRegisterUINameArray,
-                            *s_pDocUINameArray,
-                            *s_pHTMLUINameArray,
-                            *s_pFrameFormatUINameArray,
-                            *s_pChrFormatUINameArray,
-                            *s_pHTMLChrFormatUINameArray,
-                            *s_pPageDescUINameArray,
-                            *s_pNumRuleUINameArray,
-                            *s_pTableStyleUINameArray,
-                            *s_pCellStyleUINameArray,
-    // Programmatic Name tables
-                            *s_pTextProgNameArray,
-                            *s_pListsProgNameArray,
-                            *s_pExtraProgNameArray,
-                            *s_pRegisterProgNameArray,
-                            *s_pDocProgNameArray,
-                            *s_pHTMLProgNameArray,
-                            *s_pFrameFormatProgNameArray,
-                            *s_pChrFormatProgNameArray,
-                            *s_pHTMLChrFormatProgNameArray,
-                            *s_pPageDescProgNameArray,
-                            *s_pNumRuleProgNameArray,
-                            *s_pTableStyleProgNameArray,
-                            *s_pCellStyleProgNameArray;
-
-    static NameToIdHash     *s_pParaUIMap,
-                            *s_pCharUIMap,
-                            *s_pPageUIMap,
-                            *s_pFrameUIMap,
-                            *s_pNumRuleUIMap,
-                            *s_pTableStyleUIMap,
-                            *s_pCellStyleUIMap,
-
-                            *s_pParaProgMap,
-                            *s_pCharProgMap,
-                            *s_pPageProgMap,
-                            *s_pFrameProgMap,
-                            *s_pNumRuleProgMap,
-                            *s_pTableStyleProgMap,
-                            *s_pCellStyleProgMap;
-
     static void fillNameFromId(sal_uInt16 nId, OUString &rName, bool bProgName);
     static const OUString& getNameFromId(sal_uInt16 nId, const OUString &rName,
                                          bool bProgName);
diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx
index b27dfdabb2d7..c3a8d48b07fb 100644
--- a/sw/source/core/bastyp/init.cxx
+++ b/sw/source/core/bastyp/init.cxx
@@ -696,44 +696,6 @@ void FinitCore()
 #endif
     delete SwDoc::s_pAutoCompleteWords;
 
-    delete SwStyleNameMapper::s_pTextUINameArray;
-    delete SwStyleNameMapper::s_pListsUINameArray;
-    delete SwStyleNameMapper::s_pExtraUINameArray;
-    delete SwStyleNameMapper::s_pRegisterUINameArray;
-    delete SwStyleNameMapper::s_pDocUINameArray;
-    delete SwStyleNameMapper::s_pHTMLUINameArray;
-    delete SwStyleNameMapper::s_pFrameFormatUINameArray;
-    delete SwStyleNameMapper::s_pChrFormatUINameArray;
-    delete SwStyleNameMapper::s_pHTMLChrFormatUINameArray;
-    delete SwStyleNameMapper::s_pPageDescUINameArray;
-    delete SwStyleNameMapper::s_pNumRuleUINameArray;
-
-    // Delete programmatic name arrays also
-    delete SwStyleNameMapper::s_pTextProgNameArray;
-    delete SwStyleNameMapper::s_pListsProgNameArray;
-    delete SwStyleNameMapper::s_pExtraProgNameArray;
-    delete SwStyleNameMapper::s_pRegisterProgNameArray;
-    delete SwStyleNameMapper::s_pDocProgNameArray;
-    delete SwStyleNameMapper::s_pHTMLProgNameArray;
-    delete SwStyleNameMapper::s_pFrameFormatProgNameArray;
-    delete SwStyleNameMapper::s_pChrFormatProgNameArray;
-    delete SwStyleNameMapper::s_pHTMLChrFormatProgNameArray;
-    delete SwStyleNameMapper::s_pPageDescProgNameArray;
-    delete SwStyleNameMapper::s_pNumRuleProgNameArray;
-
-    // And finally, any hash tables that we used
-    delete SwStyleNameMapper::s_pParaUIMap;
-    delete SwStyleNameMapper::s_pCharUIMap;
-    delete SwStyleNameMapper::s_pPageUIMap;
-    delete SwStyleNameMapper::s_pFrameUIMap;
-    delete SwStyleNameMapper::s_pNumRuleUIMap;
-
-    delete SwStyleNameMapper::s_pParaProgMap;
-    delete SwStyleNameMapper::s_pCharProgMap;
-    delete SwStyleNameMapper::s_pPageProgMap;
-    delete SwStyleNameMapper::s_pFrameProgMap;
-    delete SwStyleNameMapper::s_pNumRuleProgMap;
-
     // delete all default attributes
     for(SfxPoolItem* pHt : aAttrTab)
     {
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index 8b4c1ba85393..8cf107ffcf16 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -2530,119 +2530,104 @@ DocumentStylePoolManager::~DocumentStylePoolManager()
 
 }
 
-// Initialise UI names to 0
-std::vector<OUString> *SwStyleNameMapper::s_pTextUINameArray = nullptr,
-                *SwStyleNameMapper::s_pListsUINameArray = nullptr,
-                *SwStyleNameMapper::s_pExtraUINameArray = nullptr,
-                *SwStyleNameMapper::s_pRegisterUINameArray = nullptr,
-                *SwStyleNameMapper::s_pDocUINameArray = nullptr,
-                *SwStyleNameMapper::s_pHTMLUINameArray = nullptr,
-                *SwStyleNameMapper::s_pFrameFormatUINameArray = nullptr,
-                *SwStyleNameMapper::s_pChrFormatUINameArray = nullptr,
-                *SwStyleNameMapper::s_pHTMLChrFormatUINameArray = nullptr,
-                *SwStyleNameMapper::s_pPageDescUINameArray = nullptr,
-                *SwStyleNameMapper::s_pNumRuleUINameArray = nullptr,
-                *SwStyleNameMapper::s_pTableStyleUINameArray = nullptr,
-                *SwStyleNameMapper::s_pCellStyleUINameArray = nullptr;
-
-static std::vector<OUString>*
+static std::vector<OUString>
 lcl_NewUINameArray(const char** pIds, const size_t nLen, const size_t nSvxIds = 0)
 {
     assert(nSvxIds <= nLen);
     const size_t nWriterIds = nLen - nSvxIds;
-    std::vector<OUString> *const pNameArray = new std::vector<OUString>;
-    pNameArray->reserve(nLen);
+    std::vector<OUString> aNameArray;
+    aNameArray.reserve(nLen);
     for (size_t i = 0; i < nWriterIds; ++i)
-        pNameArray->push_back(SwResId(pIds[i]));
+        aNameArray.push_back(SwResId(pIds[i]));
     for (size_t i = nWriterIds; i < nLen; ++i)
-        pNameArray->push_back(SvxResId(pIds[i]));
-    return pNameArray;
+        aNameArray.push_back(SvxResId(pIds[i]));
+    return aNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetTextUINameArray()
 {
-    if (!s_pTextUINameArray)
-        s_pTextUINameArray = lcl_NewUINameArray(STR_POOLCOLL_TEXT_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_TEXT_ARY));
-    return *s_pTextUINameArray;
+    static const std::vector<OUString> s_aTextUINameArray(
+        lcl_NewUINameArray(STR_POOLCOLL_TEXT_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_TEXT_ARY)));
+    return s_aTextUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetListsUINameArray()
 {
-    if (!s_pListsUINameArray)
-        s_pListsUINameArray = lcl_NewUINameArray(STR_POOLCOLL_LISTS_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_LISTS_ARY));
-    return *s_pListsUINameArray;
+    static const std::vector<OUString> s_aListsUINameArray(
+        lcl_NewUINameArray(STR_POOLCOLL_LISTS_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_LISTS_ARY)));
+    return s_aListsUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetExtraUINameArray()
 {
-    if (!s_pExtraUINameArray)
-        s_pExtraUINameArray = lcl_NewUINameArray(STR_POOLCOLL_EXTRA_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_EXTRA_ARY));
-    return *s_pExtraUINameArray;
+    static const std::vector<OUString> s_aExtraUINameArray(
+        lcl_NewUINameArray(STR_POOLCOLL_EXTRA_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_EXTRA_ARY)));
+    return s_aExtraUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetRegisterUINameArray()
 {
-    if (!s_pRegisterUINameArray)
-        s_pRegisterUINameArray = lcl_NewUINameArray(STR_POOLCOLL_REGISTER_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_REGISTER_ARY));
-    return *s_pRegisterUINameArray;
+    static const std::vector<OUString> s_aRegisterUINameArray(
+        lcl_NewUINameArray(STR_POOLCOLL_REGISTER_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_REGISTER_ARY)));
+    return s_aRegisterUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetDocUINameArray()
 {
-    if (!s_pDocUINameArray)
-        s_pDocUINameArray = lcl_NewUINameArray(STR_POOLCOLL_DOC_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_DOC_ARY));
-    return *s_pDocUINameArray;
+    static const std::vector<OUString> s_aDocUINameArray(
+        lcl_NewUINameArray(STR_POOLCOLL_DOC_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_DOC_ARY)));
+    return s_aDocUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetHTMLUINameArray()
 {
-    if (!s_pHTMLUINameArray)
-        s_pHTMLUINameArray = lcl_NewUINameArray(STR_POOLCOLL_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_HTML_ARY));
-    return *s_pHTMLUINameArray;
+    static const std::vector<OUString> s_aHTMLUINameArray(
+        lcl_NewUINameArray(STR_POOLCOLL_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCOLL_HTML_ARY)));
+    return s_aHTMLUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetFrameFormatUINameArray()
 {
-    if (!s_pFrameFormatUINameArray)
-        s_pFrameFormatUINameArray = lcl_NewUINameArray(STR_POOLFRM_ARY, SAL_N_ELEMENTS(STR_POOLFRM_ARY));
-    return *s_pFrameFormatUINameArray;
+    static const std::vector<OUString> s_aFrameFormatUINameArray(
+        lcl_NewUINameArray(STR_POOLFRM_ARY, SAL_N_ELEMENTS(STR_POOLFRM_ARY)));
+    return s_aFrameFormatUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetChrFormatUINameArray()
 {
-    if (!s_pChrFormatUINameArray)
-        s_pChrFormatUINameArray = lcl_NewUINameArray(STR_POOLCHR_ARY, SAL_N_ELEMENTS(STR_POOLCHR_ARY));
-    return *s_pChrFormatUINameArray;
+    static const std::vector<OUString> s_aChrFormatUINameArray(
+        lcl_NewUINameArray(STR_POOLCHR_ARY, SAL_N_ELEMENTS(STR_POOLCHR_ARY)));
+    return s_aChrFormatUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetHTMLChrFormatUINameArray()
 {
-    if (!s_pHTMLChrFormatUINameArray)
-        s_pHTMLChrFormatUINameArray = lcl_NewUINameArray(STR_POOLCHR_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCHR_HTML_ARY));
-    return *s_pHTMLChrFormatUINameArray;
+    static const std::vector<OUString> s_aHTMLChrFormatUINameArray(
+        lcl_NewUINameArray(STR_POOLCHR_HTML_ARY, SAL_N_ELEMENTS(STR_POOLCHR_HTML_ARY)));
+    return s_aHTMLChrFormatUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetPageDescUINameArray()
 {
-    if (!s_pPageDescUINameArray)
-        s_pPageDescUINameArray = lcl_NewUINameArray(STR_POOLPAGE_ARY, SAL_N_ELEMENTS(STR_POOLPAGE_ARY));
-    return *s_pPageDescUINameArray;
+    static const std::vector<OUString> s_aPageDescUINameArray(
+        lcl_NewUINameArray(STR_POOLPAGE_ARY, SAL_N_ELEMENTS(STR_POOLPAGE_ARY)));
+    return s_aPageDescUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetNumRuleUINameArray()
 {
-    if (!s_pNumRuleUINameArray)
-        s_pNumRuleUINameArray = lcl_NewUINameArray(STR_POOLNUMRULE_NUM_ARY, SAL_N_ELEMENTS(STR_POOLNUMRULE_NUM_ARY));
-    return *s_pNumRuleUINameArray;
+    static const std::vector<OUString> s_aNumRuleUINameArray(
+        lcl_NewUINameArray(STR_POOLNUMRULE_NUM_ARY, SAL_N_ELEMENTS(STR_POOLNUMRULE_NUM_ARY)));
+    return s_aNumRuleUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetTableStyleUINameArray()
 {
-    if (!s_pTableStyleUINameArray)
+    static const std::vector<OUString> s_aTableStyleUINameArray(
         // 1 Writer resource string (XXX if this ever changes rather use offset math)
-        s_pTableStyleUINameArray = lcl_NewUINameArray(STR_TABSTYLE_ARY, SAL_N_ELEMENTS(STR_TABSTYLE_ARY),
-                static_cast<size_t>(SAL_N_ELEMENTS(STR_TABSTYLE_ARY) - 1));
-    return *s_pTableStyleUINameArray;
+        lcl_NewUINameArray(STR_TABSTYLE_ARY, SAL_N_ELEMENTS(STR_TABSTYLE_ARY),
+                static_cast<size_t>(SAL_N_ELEMENTS(STR_TABSTYLE_ARY) - 1)));
+    return s_aTableStyleUINameArray;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/SwStyleNameMapper.cxx b/sw/source/core/doc/SwStyleNameMapper.cxx
index 14d89e59418f..39b285a5a968 100644
--- a/sw/source/core/doc/SwStyleNameMapper.cxx
+++ b/sw/source/core/doc/SwStyleNameMapper.cxx
@@ -29,333 +29,9 @@
 #include <stdlib.h>
 #endif
 
-// Initialise programmatic names to 0
-std::vector<OUString>
-                *SwStyleNameMapper::s_pTextProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pListsProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pExtraProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pRegisterProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pDocProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pHTMLProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pFrameFormatProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pChrFormatProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pHTMLChrFormatProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pPageDescProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pNumRuleProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pTableStyleProgNameArray = nullptr,
-                *SwStyleNameMapper::s_pCellStyleProgNameArray = nullptr;
-
-NameToIdHash    *SwStyleNameMapper::s_pParaUIMap = nullptr,
-                *SwStyleNameMapper::s_pCharUIMap = nullptr,
-                *SwStyleNameMapper::s_pPageUIMap = nullptr,
-                *SwStyleNameMapper::s_pFrameUIMap = nullptr,
-                *SwStyleNameMapper::s_pNumRuleUIMap = nullptr,
-                *SwStyleNameMapper::s_pTableStyleUIMap = nullptr,
-                *SwStyleNameMapper::s_pCellStyleUIMap = nullptr,
-
-                *SwStyleNameMapper::s_pParaProgMap = nullptr,
-                *SwStyleNameMapper::s_pCharProgMap = nullptr,
-                *SwStyleNameMapper::s_pPageProgMap = nullptr,
-                *SwStyleNameMapper::s_pFrameProgMap = nullptr,
-                *SwStyleNameMapper::s_pNumRuleProgMap = nullptr,
-                *SwStyleNameMapper::s_pTableStyleProgMap = nullptr,
-                *SwStyleNameMapper::s_pCellStyleProgMap = nullptr;
-
-// SwTableEntry so we can pass the length to the String CTOR
-struct SwTableEntry
-{
-    sal_uInt8 const nLength;
-    const sal_Char *pChar;
-};
-
 namespace
 {
 
-#define ENTRY( s ) { sizeof (s)-1, s }
-
-// Hard coded Programmatic Name tables
-const struct SwTableEntry TextProgNameTable [] =
-{
-    ENTRY( "Standard" ), // RES_POOLCOLL_STANDARD
-    ENTRY( "Text body" ),
-    ENTRY( "First line indent" ),
-    ENTRY( "Hanging indent" ),
-    ENTRY( "Text body indent" ),
-    ENTRY( "Salutation" ),
-    ENTRY( "Signature" ),
-    ENTRY( "List Indent" ), // RES_POOLCOLL_CONFRONTATION
-    ENTRY( "Marginalia" ),
-    ENTRY( "Heading" ),
-    ENTRY( "Heading 1" ),
-    ENTRY( "Heading 2" ),
-    ENTRY( "Heading 3" ),
-    ENTRY( "Heading 4" ),
-    ENTRY( "Heading 5" ),
-    ENTRY( "Heading 6" ),
-    ENTRY( "Heading 7" ),
-    ENTRY( "Heading 8" ),
-    ENTRY( "Heading 9" ),
-    ENTRY( "Heading 10" ), // RES_POOLCOLL_TEXT_END
-    { 0, nullptr }
-};
-
-const struct SwTableEntry ListsProgNameTable [] =
-{
-    ENTRY( "List" ), // STR_POCO_PRGM_NUMBUL_BASE
-    ENTRY( "Numbering 1 Start" ), // STR_POCO_PRGM_NUM_LEVEL1S
-    ENTRY( "Numbering 1" ),
-    ENTRY( "Numbering 1 End" ),
-    ENTRY( "Numbering 1 Cont." ),
-    ENTRY( "Numbering 2 Start" ),
-    ENTRY( "Numbering 2" ),
-    ENTRY( "Numbering 2 End" ),
-    ENTRY( "Numbering 2 Cont." ),
-    ENTRY( "Numbering 3 Start" ),
-    ENTRY( "Numbering 3" ),
-    ENTRY( "Numbering 3 End" ),
-    ENTRY( "Numbering 3 Cont." ),
-    ENTRY( "Numbering 4 Start" ),
-    ENTRY( "Numbering 4" ),
-    ENTRY( "Numbering 4 End" ),
-    ENTRY( "Numbering 4 Cont." ),
-    ENTRY( "Numbering 5 Start" ),
-    ENTRY( "Numbering 5" ),
-    ENTRY( "Numbering 5 End" ),
-    ENTRY( "Numbering 5 Cont." ),
-    ENTRY( "List 1 Start" ),
-    ENTRY( "List 1" ),
-    ENTRY( "List 1 End" ),
-    ENTRY( "List 1 Cont." ),
-    ENTRY( "List 2 Start" ),
-    ENTRY( "List 2" ),
-    ENTRY( "List 2 End" ),
-    ENTRY( "List 2 Cont." ),
-    ENTRY( "List 3 Start" ),
-    ENTRY( "List 3" ),
-    ENTRY( "List 3 End" ),
-    ENTRY( "List 3 Cont." ),
-    ENTRY( "List 4 Start" ),
-    ENTRY( "List 4" ),
-    ENTRY( "List 4 End" ),
-    ENTRY( "List 4 Cont." ),
-    ENTRY( "List 5 Start" ),
-    ENTRY( "List 5" ),
-    ENTRY( "List 5 End" ),
-    ENTRY( "List 5 Cont." ), // STR_POCO_PRGM_BUL_NONUM5
-    { 0, nullptr }
-};
-
-const struct SwTableEntry ExtraProgNameTable [] =
-{
-    ENTRY( "Header and Footer" ), // RES_POOLCOLL_EXTRA_BEGIN
-    ENTRY( "Header" ),
-    ENTRY( "Header left" ),
-    ENTRY( "Header right" ),
-    ENTRY( "Footer" ),
-    ENTRY( "Footer left" ),
-    ENTRY( "Footer right" ),
-    ENTRY( "Table Contents" ),
-    ENTRY( "Table Heading" ),
-    ENTRY( "Caption" ),
-    ENTRY( "Illustration" ),
-    ENTRY( "Table" ),
-    ENTRY( "Text" ),
-    ENTRY( "Figure" ),//RES_POOLCOLL_LABEL_FIGURE
-    ENTRY( "Frame contents" ),
-    ENTRY( "Footnote" ),
-    ENTRY( "Addressee" ),
-    ENTRY( "Sender" ),
-    ENTRY( "Endnote" ),
-    ENTRY( "Drawing" ), // RES_POOLCOLL_LABEL_DRAWING
-    { 0, nullptr }
-};
-
-const struct SwTableEntry RegisterProgNameTable [] =
-{
-    ENTRY( "Index" ), // STR_POCO_PRGM_REGISTER_BASE
-    ENTRY( "Index Heading" ), // STR_POCO_PRGM_TOX_IDXH
-    ENTRY( "Index 1" ),
-    ENTRY( "Index 2" ),
-    ENTRY( "Index 3" ),
-    ENTRY( "Index Separator" ),
-    ENTRY( "Contents Heading" ),
-    ENTRY( "Contents 1" ),
-    ENTRY( "Contents 2" ),
-    ENTRY( "Contents 3" ),
-    ENTRY( "Contents 4" ),
-    ENTRY( "Contents 5" ),
-    ENTRY( "User Index Heading" ),
-    ENTRY( "User Index 1" ),
-    ENTRY( "User Index 2" ),
-    ENTRY( "User Index 3" ),
-    ENTRY( "User Index 4" ),
-    ENTRY( "User Index 5" ),
-    ENTRY( "Contents 6" ),
-    ENTRY( "Contents 7" ),
-    ENTRY( "Contents 8" ),
-    ENTRY( "Contents 9" ),
-    ENTRY( "Contents 10" ),
-    ENTRY( "Figure Index Heading" ),
-    ENTRY( "Figure Index 1" ),
-    ENTRY( "Object index heading" ),
-    ENTRY( "Object index 1" ),
-    ENTRY( "Table index heading" ),
-    ENTRY( "Table index 1" ),
-    ENTRY( "Bibliography Heading" ),
-    ENTRY( "Bibliography 1" ),
-    ENTRY( "User Index 6" ),
-    ENTRY( "User Index 7" ),
-    ENTRY( "User Index 8" ),
-    ENTRY( "User Index 9" ),
-    ENTRY( "User Index 10" ), // STR_POCO_PRGM_TOX_USER10
-    { 0, nullptr }
-};
-
-const struct SwTableEntry DocProgNameTable [] =
-{
-    ENTRY( "Title" ), // STR_POCO_PRGM_DOC_TITEL
-    ENTRY( "Subtitle" ),
-    { 0, nullptr }
-};
-
-const struct SwTableEntry HTMLProgNameTable [] =
-{
-    ENTRY( "Quotations" ),
-    ENTRY( "Preformatted Text" ),
-    ENTRY( "Horizontal Line" ),
-    ENTRY( "List Contents" ),
-    ENTRY( "List Heading" ), // STR_POCO_PRGM_HTML_DT
-    { 0, nullptr }
-};
-
-const struct SwTableEntry FrameFormatProgNameTable [] =
-{
-    ENTRY( "Frame" ), // RES_POOLFRM_FRAME
-    ENTRY( "Graphics" ),
-    ENTRY( "OLE" ),
-    ENTRY( "Formula" ),
-    ENTRY( "Marginalia" ),
-    ENTRY( "Watermark" ),
-    ENTRY( "Labels" ), // RES_POOLFRM_LABEL
-    { 0, nullptr }
-};
-
-const struct SwTableEntry ChrFormatProgNameTable [] =
-{
-    ENTRY( "Footnote Symbol" ), // RES_POOLCHR_FOOTNOTE
-    ENTRY( "Page Number" ),
-    ENTRY( "Caption characters" ),
-    ENTRY( "Drop Caps" ),
-    ENTRY( "Numbering Symbols" ),
-    ENTRY( "Bullet Symbols" ),
-    ENTRY( "Internet link" ),
-    ENTRY( "Visited Internet Link" ),
-    ENTRY( "Placeholder" ),
-    ENTRY( "Index Link" ),
-    ENTRY( "Endnote Symbol" ),
-    ENTRY( "Line numbering" ),
-    ENTRY( "Main index entry" ),
-    ENTRY( "Footnote anchor" ),
-    ENTRY( "Endnote anchor" ),
-    ENTRY( "Rubies" ), // RES_POOLCHR_RUBYTEXT
-    ENTRY( "Vertical Numbering Symbols" ), // RES_POOLCHR_VERT_NUMBER
-    { 0, nullptr }
-};
-
-const struct SwTableEntry HTMLChrFormatProgNameTable [] =
-{
-    ENTRY( "Emphasis" ), // RES_POOLCHR_HTML_EMPHASIS
-    ENTRY( "Citation" ),
-    ENTRY( "Strong Emphasis" ),
-    ENTRY( "Source Text" ),
-    ENTRY( "Example" ),
-    ENTRY( "User Entry" ),
-    ENTRY( "Variable" ),
-    ENTRY( "Definition" ),
-    ENTRY( "Teletype" ), // RES_POOLCHR_HTML_TELETYPE
-    { 0, nullptr }
-};
-
-const struct SwTableEntry PageDescProgNameTable [] =
-{
-    ENTRY( "Standard" ), // STR_POOLPAGE_PRGM_STANDARD
-    ENTRY( "First Page" ),
-    ENTRY( "Left Page" ),
-    ENTRY( "Right Page" ),
-    ENTRY( "Envelope" ),
-    ENTRY( "Index" ),
-    ENTRY( "HTML" ),
-    ENTRY( "Footnote" ),
-    ENTRY( "Endnote" ), // STR_POOLPAGE_PRGM_ENDNOTE
-    ENTRY( "Landscape" ),
-    { 0, nullptr }
-};
-
-const struct SwTableEntry NumRuleProgNameTable [] =
-{
-    ENTRY( "Numbering 123" ), // STR_POOLNUMRULE_PRGM_NUM1
-    ENTRY( "Numbering ABC" ),
-    ENTRY( "Numbering abc" ),
-    ENTRY( "Numbering IVX" ),
-    ENTRY( "Numbering ivx" ),
-    ENTRY( "List 1" ),
-    ENTRY( "List 2" ),
-    ENTRY( "List 3" ),
-    ENTRY( "List 4" ),
-    ENTRY( "List 5" ), // STR_POOLNUMRULE_PRGM_BUL5
-    { 0, nullptr }
-};
-
-// XXX MUST match the entries of STR_TABSTYLE_ARY in
-// sw/source/core/doc/DocumentStylePoolManager.cxx and MUST match the order of
-// RES_POOL_TABSTYLE_TYPE in sw/inc/poolfmt.hxx
-const struct SwTableEntry TableStyleProgNameTable [] =
-{
-    ENTRY( "Default Style" ),     // RES_POOLTABLESTYLE_DEFAULT
-    ENTRY( "3D" ),                // RES_POOLTABLESTYLE_3D
-    ENTRY( "Black 1" ),           // RES_POOLTABLESTYLE_BLACK1
-    ENTRY( "Black 2" ),           // RES_POOLTABLESTYLE_BLACK2
-    ENTRY( "Blue" ),              // RES_POOLTABLESTYLE_BLUE
-    ENTRY( "Brown" ),             // RES_POOLTABLESTYLE_BROWN
-    ENTRY( "Currency" ),          // RES_POOLTABLESTYLE_CURRENCY
-    ENTRY( "Currency 3D" ),       // RES_POOLTABLESTYLE_CURRENCY_3D
-    ENTRY( "Currency Gray" ),     // RES_POOLTABLESTYLE_CURRENCY_GRAY
-    ENTRY( "Currency Lavender" ), // RES_POOLTABLESTYLE_CURRENCY_LAVENDER
-    ENTRY( "Currency Turquoise" ),// RES_POOLTABLESTYLE_CURRENCY_TURQUOISE
-    ENTRY( "Gray" ),              // RES_POOLTABLESTYLE_GRAY
-    ENTRY( "Green" ),             // RES_POOLTABLESTYLE_GREEN
-    ENTRY( "Lavender" ),          // RES_POOLTABLESTYLE_LAVENDER
-    ENTRY( "Red" ),               // RES_POOLTABLESTYLE_RED
-    ENTRY( "Turquoise" ),         // RES_POOLTABLESTYLE_TURQUOISE
-    ENTRY( "Yellow" ),            // RES_POOLTABLESTYLE_YELLOW
-    ENTRY( "Academic" ),          // RES_POOLTABLESTYLE_LO6_ACADEMIC
-    ENTRY( "Box List Blue" ),     // RES_POOLTABLESTYLE_LO6_BOX_LIST_BLUE
-    ENTRY( "Box List Green" ),    // RES_POOLTABLESTYLE_LO6_BOX_LIST_GREEN
-    ENTRY( "Box List Red" ),      // RES_POOLTABLESTYLE_LO6_BOX_LIST_RED
-    ENTRY( "Box List Yellow" ),   // RES_POOLTABLESTYLE_LO6_BOX_LIST_YELLOW
-    ENTRY( "Elegant" ),           // RES_POOLTABLESTYLE_LO6_ELEGANT
-    ENTRY( "Financial" ),         // RES_POOLTABLESTYLE_LO6_FINANCIAL
-    ENTRY( "Simple Grid Columns" ), // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_COLUMNS
-    ENTRY( "Simple Grid Rows" ),  // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_ROWS
-    ENTRY( "Simple List Shaded" ),// RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED
-    { 0, nullptr }
-};
-#undef ENTRY
-
-std::vector<OUString>*
-lcl_NewProgNameArray(const SwTableEntry *pTable, sal_uInt8 const nCount)
-{
-    std::vector<OUString> *const pProgNameArray = new std::vector<OUString>;
-    pProgNameArray->reserve(nCount);
-    while (pTable->nLength)
-    {
-        pProgNameArray->push_back(OUString(
-                pTable->pChar, pTable->nLength, RTL_TEXTENCODING_ASCII_US));
-        pTable++;
-    }
-    return pProgNameArray;
-}
-
 const OUString &
 lcl_GetSpecialExtraName(const OUString& rExtraName, const bool bIsUIName )
 {
@@ -409,14 +85,90 @@ void lcl_CheckSuffixAndDelete(OUString & rString)
     }
 }
 
-typedef std::tuple<sal_uInt16, sal_uInt16, const std::vector<OUString>& (*)() > NameArrayIndexTuple_t;
-
-sal_uInt16 lcl_AccumulateIndexCount( sal_uInt16 nSum, const NameArrayIndexTuple_t& tuple ){
-    // Return running sum + (index end) - (index start)
-    return nSum + std::get<1>( tuple ) - std::get<0>( tuple );
-}
+NameToIdHash HashFromRange(sal_uInt16 nAcc) { return NameToIdHash(nAcc); }
+template <typename... Rest>
+NameToIdHash HashFromRange(sal_uInt16 nAcc, sal_uInt16 nBegin, sal_uInt16 nEnd,
+                           const std::vector<OUString>& (*pFunc)(), Rest... rest)
+{
+    NameToIdHash hash(HashFromRange(nAcc + nEnd - nBegin, rest...));
+    sal_uInt16 nIndex, nId;
+    const std::vector<OUString>& rStrings = pFunc();
+    for (nIndex = 0, nId = nBegin; nId < nEnd; nId++, nIndex++)
+        hash[rStrings[nIndex]] = nId;
+    return hash;
 }
 
+template <auto initFunc> struct TablePair
+{
+    static const NameToIdHash& getMap(bool bProgName)
+    {
+        if (bProgName)
+        {
+            static const NameToIdHash s_aProgMap(initFunc(true));
+            return s_aProgMap;
+        }
+        static const NameToIdHash s_aUIMap(initFunc(false));
+        return s_aUIMap;
+    }
+};
+
+NameToIdHash GetParaMap (bool bProgName)
+{
+    return HashFromRange(0,
+        RES_POOLCOLL_TEXT_BEGIN, RES_POOLCOLL_TEXT_END, bProgName ? &SwStyleNameMapper::GetTextProgNameArray : &SwStyleNameMapper::GetTextUINameArray,
+        RES_POOLCOLL_LISTS_BEGIN, RES_POOLCOLL_LISTS_END, bProgName ? &SwStyleNameMapper::GetListsProgNameArray : &SwStyleNameMapper::GetListsUINameArray,
+        RES_POOLCOLL_EXTRA_BEGIN, RES_POOLCOLL_EXTRA_END, bProgName ? &SwStyleNameMapper::GetExtraProgNameArray : &SwStyleNameMapper::GetExtraUINameArray,
+        RES_POOLCOLL_REGISTER_BEGIN, RES_POOLCOLL_REGISTER_END, bProgName ? &SwStyleNameMapper::GetRegisterProgNameArray : &SwStyleNameMapper::GetRegisterUINameArray,
+        RES_POOLCOLL_DOC_BEGIN, RES_POOLCOLL_DOC_END, bProgName ? &SwStyleNameMapper::GetDocProgNameArray : &SwStyleNameMapper::GetDocUINameArray,
+        RES_POOLCOLL_HTML_BEGIN, RES_POOLCOLL_HTML_END, bProgName ? &SwStyleNameMapper::GetHTMLProgNameArray : &SwStyleNameMapper::GetHTMLUINameArray
+    );
+};
+
+NameToIdHash GetCharMap(bool bProgName)
+{
+    return HashFromRange(0,
+        RES_POOLCHR_NORMAL_BEGIN, RES_POOLCHR_NORMAL_END, bProgName ? &SwStyleNameMapper::GetChrFormatProgNameArray : &SwStyleNameMapper::GetChrFormatUINameArray,
+        RES_POOLCHR_HTML_BEGIN, RES_POOLCHR_HTML_END, bProgName ? &SwStyleNameMapper::GetHTMLChrFormatProgNameArray : &SwStyleNameMapper::GetHTMLChrFormatUINameArray
+    );
+};
+
+NameToIdHash GetFrameMap(bool bProgName)
+{
+    return HashFromRange(0,
+        RES_POOLFRM_BEGIN, RES_POOLFRM_END, bProgName ? &SwStyleNameMapper::GetFrameFormatProgNameArray : &SwStyleNameMapper::GetFrameFormatUINameArray
+    );
+};
+
+NameToIdHash GetPageMap(bool bProgName)
+{
+    return HashFromRange(0,
+        RES_POOLPAGE_BEGIN, RES_POOLPAGE_END, bProgName ? &SwStyleNameMapper::GetPageDescProgNameArray : &SwStyleNameMapper::GetPageDescUINameArray
+    );
+};
+
+NameToIdHash GetNumRuleMap(bool bProgName)
+{
+    return HashFromRange(0,
+        RES_POOLNUMRULE_BEGIN, RES_POOLNUMRULE_END, bProgName ? &SwStyleNameMapper::GetNumRuleProgNameArray : &SwStyleNameMapper::GetNumRuleUINameArray
+    );
+};
+
+NameToIdHash GetTableStyleMap(bool bProgName)
+{
+    return HashFromRange(0,
+        RES_POOLTABSTYLE_BEGIN, RES_POOLTABSTYLE_END, bProgName ? &SwStyleNameMapper::GetTableStyleProgNameArray : &SwStyleNameMapper::GetTableStyleUINameArray
+    );
+};
+
+NameToIdHash GetCellStyleMap(bool bProgName)
+{
+    return HashFromRange(0,
+        RES_POOLCELLSTYLE_BEGIN, RES_POOLCELLSTYLE_END, bProgName ? &SwStyleNameMapper::GetCellStyleProgNameArray : &SwStyleNameMapper::GetCellStyleUINameArray
+    );
+};
+
+} // namespace
+
 #ifdef _NEED_TO_DEBUG_MAPPING
 void SwStyleNameMapper::testNameTable( SwGetPoolIdFromName const nFamily, sal_uInt16 const nStartIndex, sal_uInt16 const nEndIndex )
 {
@@ -440,89 +192,6 @@ void SwStyleNameMapper::testNameTable( SwGetPoolIdFromName const nFamily, sal_uI
 
 const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlags, bool bProgName )
 {
-    // pHashPointer is a pointer to a pointer which stores the UI/prog name array
-    NameToIdHash **pHashPointer = nullptr;
-    // Stores tuples representing (index start, index end, pointer to function which returns ref to name array)
-    std::vector<NameArrayIndexTuple_t> vIndexes;
-
-    switch ( eFlags )
-    {
-        case SwGetPoolIdFromName::TxtColl:
-        {
-            pHashPointer = bProgName ? &s_pParaProgMap : &s_pParaUIMap;
-            vIndexes.emplace_back(RES_POOLCOLL_TEXT_BEGIN, RES_POOLCOLL_TEXT_END, bProgName ? &GetTextProgNameArray : &GetTextUINameArray );
-            vIndexes.emplace_back(RES_POOLCOLL_LISTS_BEGIN, RES_POOLCOLL_LISTS_END, bProgName ? &GetListsProgNameArray : &GetListsUINameArray );
-            vIndexes.emplace_back(RES_POOLCOLL_EXTRA_BEGIN, RES_POOLCOLL_EXTRA_END, bProgName ? &GetExtraProgNameArray : &GetExtraUINameArray );
-            vIndexes.emplace_back(RES_POOLCOLL_REGISTER_BEGIN, RES_POOLCOLL_REGISTER_END, bProgName ? &GetRegisterProgNameArray : &GetRegisterUINameArray );
-            vIndexes.emplace_back(RES_POOLCOLL_DOC_BEGIN, RES_POOLCOLL_DOC_END, bProgName ? &GetDocProgNameArray : &GetDocUINameArray );
-            vIndexes.emplace_back(RES_POOLCOLL_HTML_BEGIN, RES_POOLCOLL_HTML_END, bProgName ? &GetHTMLProgNameArray : &GetHTMLUINameArray );
-        }
-        break;
-        case SwGetPoolIdFromName::ChrFmt:
-        {
-            pHashPointer = bProgName ? &s_pCharProgMap : &s_pCharUIMap;
-            vIndexes.emplace_back(RES_POOLCHR_NORMAL_BEGIN, RES_POOLCHR_NORMAL_END, bProgName ? &GetChrFormatProgNameArray : &GetChrFormatUINameArray );
-            vIndexes.emplace_back(RES_POOLCHR_HTML_BEGIN, RES_POOLCHR_HTML_END, bProgName ? &GetHTMLChrFormatProgNameArray : &GetHTMLChrFormatUINameArray );
-        }
-        break;
-        case SwGetPoolIdFromName::FrmFmt:
-        {
-            pHashPointer = bProgName ? &s_pFrameProgMap : &s_pFrameUIMap;
-            vIndexes.emplace_back(RES_POOLFRM_BEGIN, RES_POOLFRM_END, bProgName ? &GetFrameFormatProgNameArray : &GetFrameFormatUINameArray );
-        }
-        break;
-        case SwGetPoolIdFromName::PageDesc:
-        {
-            pHashPointer = bProgName ? &s_pPageProgMap : &s_pPageUIMap;
-            vIndexes.emplace_back(RES_POOLPAGE_BEGIN, RES_POOLPAGE_END, bProgName ? &GetPageDescProgNameArray : &GetPageDescUINameArray );
-        }
-        break;
-        case SwGetPoolIdFromName::NumRule:
-        {
-            pHashPointer = bProgName ? &s_pNumRuleProgMap : &s_pNumRuleUIMap;
-            vIndexes.emplace_back(RES_POOLNUMRULE_BEGIN, RES_POOLNUMRULE_END, bProgName ? &GetNumRuleProgNameArray : &GetNumRuleUINameArray );
-        }
-        break;
-        case SwGetPoolIdFromName::TabStyle:
-        {
-            pHashPointer = bProgName ? &s_pTableStyleProgMap : &s_pTableStyleUIMap;
-            vIndexes.emplace_back(RES_POOLTABSTYLE_BEGIN, RES_POOLTABSTYLE_END, bProgName ? &GetTableStyleProgNameArray : &GetTableStyleUINameArray );
-        }
-        break;
-        case SwGetPoolIdFromName::CellStyle:
-        {
-            pHashPointer = bProgName ? &s_pCellStyleProgMap : &s_pCellStyleUIMap;
-            vIndexes.emplace_back(RES_POOLCELLSTYLE_BEGIN, RES_POOLCELLSTYLE_END, bProgName ? &GetCellStyleProgNameArray : &GetCellStyleUINameArray );
-        }
-        break;
-        default:
-            assert(false && "unknown pool family");
-    }
-
-    // Proceed if we have a pointer to a hash, and the hash hasn't already been populated
-    assert(pHashPointer && "null hash pointer");
-    if (!*pHashPointer )
-    {
-        // Compute the size of the hash we need to build
-        sal_uInt16 nSize = std::accumulate( vIndexes.begin(), vIndexes.end(), 0, lcl_AccumulateIndexCount );
-
-        NameToIdHash *pHash = new NameToIdHash( nSize );
-        for ( const auto& rEntry : vIndexes )
-        {
-            // Get a pointer to the function which will populate pStrings
-            const std::vector<OUString>& (*pStringsFetchFunc)() = std::get<2>( rEntry );
-            if ( pStringsFetchFunc )
-            {
-                const std::vector<OUString>& rStrings = pStringsFetchFunc();
-                sal_uInt16 nIndex, nId;
-                for ( nIndex = 0, nId = std::get<0>( rEntry ) ; nId < std::get<1>( rEntry ) ; nId++, nIndex++ )
-                    (*pHash)[rStrings[nIndex]] = nId;
-            }
-        }
-
-        *pHashPointer = pHash;
-    }
-
 #ifdef _NEED_TO_DEBUG_MAPPING
     static bool bTested = false;
     if ( !bTested )
@@ -542,7 +211,27 @@ const NameToIdHash & SwStyleNameMapper::getHashTable ( SwGetPoolIdFromName eFlag
         testNameTable( SwGetPoolIdFromName::NumRule, RES_POOLNUMRULE_BEGIN, RES_POOLNUMRULE_END );
     }
 #endif
-    return **pHashPointer;
+
+    switch ( eFlags )
+    {
+        case SwGetPoolIdFromName::TxtColl:
+            return TablePair<GetParaMap>::getMap(bProgName);
+        case SwGetPoolIdFromName::ChrFmt:
+            return TablePair<GetCharMap>::getMap(bProgName);
+        case SwGetPoolIdFromName::FrmFmt:
+            return TablePair<GetFrameMap>::getMap(bProgName);
+        case SwGetPoolIdFromName::PageDesc:
+            return TablePair<GetPageMap>::getMap(bProgName);
+        case SwGetPoolIdFromName::NumRule:
+            return TablePair<GetNumRuleMap>::getMap(bProgName);
+        case SwGetPoolIdFromName::TabStyle:
+            return TablePair<GetTableStyleMap>::getMap(bProgName);
+        case SwGetPoolIdFromName::CellStyle:
+            return TablePair<GetCellStyleMap>::getMap(bProgName);
+    }
+
+    assert(false); // must not reach here
+    abort();
 }
 
 // This gets the UI name from the programmatic name
@@ -763,116 +452,311 @@ sal_uInt16 SwStyleNameMapper::GetPoolIdFromProgName(
     return aIter != rHashMap.end() ? (*aIter).second : USHRT_MAX;
 }
 
+// Hard coded Programmatic Name tables
+
 /// returns an empty array because Cell Names aren't translated
 const std::vector<OUString>& SwStyleNameMapper::GetCellStyleUINameArray()
 {
-    if (!s_pCellStyleUINameArray)
-        s_pCellStyleUINameArray = new std::vector<OUString>;
-    return *s_pCellStyleUINameArray;
+    static const std::vector<OUString> s_aCellStyleUINameArray;
+    return s_aCellStyleUINameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetTextProgNameArray()
 {
-    if (!s_pTextProgNameArray)
-        s_pTextProgNameArray = lcl_NewProgNameArray(TextProgNameTable,
-            SAL_N_ELEMENTS ( TextProgNameTable ) );
-    return *s_pTextProgNameArray;
+    static const std::vector<OUString> s_aTextProgNameArray = {
+        "Standard", // RES_POOLCOLL_STANDARD
+        "Text body",
+        "First line indent",
+        "Hanging indent",
+        "Text body indent",
+        "Salutation",
+        "Signature",
+        "List Indent", // RES_POOLCOLL_CONFRONTATION
+        "Marginalia",
+        "Heading",
+        "Heading 1",
+        "Heading 2",
+        "Heading 3",
+        "Heading 4",
+        "Heading 5",
+        "Heading 6",
+        "Heading 7",
+        "Heading 8",
+        "Heading 9",
+        "Heading 10", // RES_POOLCOLL_TEXT_END
+    };
+    return s_aTextProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetListsProgNameArray()
 {
-    if (!s_pListsProgNameArray)
-        s_pListsProgNameArray = lcl_NewProgNameArray( ListsProgNameTable,
-            SAL_N_ELEMENTS ( ListsProgNameTable ) );
-    return *s_pListsProgNameArray;
+    static const std::vector<OUString> s_aListsProgNameArray = {
+        "List", // STR_POCO_PRGM_NUMBUL_BASE
+        "Numbering 1 Start", // STR_POCO_PRGM_NUM_LEVEL1S
+        "Numbering 1",
+        "Numbering 1 End",
+        "Numbering 1 Cont.",
+        "Numbering 2 Start",
+        "Numbering 2",
+        "Numbering 2 End",
+        "Numbering 2 Cont.",
+        "Numbering 3 Start",
+        "Numbering 3",
+        "Numbering 3 End",
+        "Numbering 3 Cont.",
+        "Numbering 4 Start",
+        "Numbering 4",
+        "Numbering 4 End",
+        "Numbering 4 Cont.",
+        "Numbering 5 Start",
+        "Numbering 5",
+        "Numbering 5 End",
+        "Numbering 5 Cont.",
+        "List 1 Start",
+        "List 1",
+        "List 1 End",
+        "List 1 Cont.",
+        "List 2 Start",
+        "List 2",
+        "List 2 End",
+        "List 2 Cont.",
+        "List 3 Start",
+        "List 3",
+        "List 3 End",
+        "List 3 Cont.",
+        "List 4 Start",
+        "List 4",
+        "List 4 End",
+        "List 4 Cont.",
+        "List 5 Start",
+        "List 5",
+        "List 5 End",
+        "List 5 Cont.", // STR_POCO_PRGM_BUL_NONUM5
+    };
+    return s_aListsProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetExtraProgNameArray()
 {
-    if (!s_pExtraProgNameArray)
-        s_pExtraProgNameArray = lcl_NewProgNameArray( ExtraProgNameTable,
-            SAL_N_ELEMENTS ( ExtraProgNameTable ) );
-    return *s_pExtraProgNameArray;
+    static const std::vector<OUString> s_aExtraProgNameArray = {
+        "Header and Footer", // RES_POOLCOLL_EXTRA_BEGIN
+        "Header",
+        "Header left",
+        "Header right",
+        "Footer",
+        "Footer left",
+        "Footer right",
+        "Table Contents",
+        "Table Heading",
+        "Caption",
+        "Illustration",
+        "Table",
+        "Text",
+        "Figure", // RES_POOLCOLL_LABEL_FIGURE
+        "Frame contents",
+        "Footnote",
+        "Addressee",
+        "Sender",
+        "Endnote",
+        "Drawing", // RES_POOLCOLL_LABEL_DRAWING
+    };
+    return s_aExtraProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetRegisterProgNameArray()
 {
-    if (!s_pRegisterProgNameArray)
-        s_pRegisterProgNameArray = lcl_NewProgNameArray( RegisterProgNameTable,
-            SAL_N_ELEMENTS ( RegisterProgNameTable ) );
-    return *s_pRegisterProgNameArray;
+    static const std::vector<OUString> s_aRegisterProgNameArray = {
+        "Index", // STR_POCO_PRGM_REGISTER_BASE
+        "Index Heading", // STR_POCO_PRGM_TOX_IDXH
+        "Index 1",
+        "Index 2",
+        "Index 3",
+        "Index Separator",
+        "Contents Heading",
+        "Contents 1",
+        "Contents 2",
+        "Contents 3",
+        "Contents 4",
+        "Contents 5",
+        "User Index Heading",
+        "User Index 1",
+        "User Index 2",
+        "User Index 3",
+        "User Index 4",
+        "User Index 5",
+        "Contents 6",
+        "Contents 7",
+        "Contents 8",
+        "Contents 9",
+        "Contents 10",
+        "Figure Index Heading",
+        "Figure Index 1",
+        "Object index heading",
+        "Object index 1",
+        "Table index heading",
+        "Table index 1",
+        "Bibliography Heading",
+        "Bibliography 1",
+        "User Index 6",
+        "User Index 7",
+        "User Index 8",
+        "User Index 9",
+        "User Index 10", // STR_POCO_PRGM_TOX_USER10
+    };
+    return s_aRegisterProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetDocProgNameArray()
 {
-    if (!s_pDocProgNameArray)
-        s_pDocProgNameArray = lcl_NewProgNameArray( DocProgNameTable,
-            SAL_N_ELEMENTS ( DocProgNameTable ) );
-    return *s_pDocProgNameArray;
+    static const std::vector<OUString> s_aDocProgNameArray = {
+        "Title", // STR_POCO_PRGM_DOC_TITEL
+        "Subtitle",
+    };
+    return s_aDocProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetHTMLProgNameArray()
 {
-    if (!s_pHTMLProgNameArray)
-        s_pHTMLProgNameArray = lcl_NewProgNameArray( HTMLProgNameTable,
-            SAL_N_ELEMENTS ( HTMLProgNameTable ) );
-    return *s_pHTMLProgNameArray;
+    static const std::vector<OUString> s_aHTMLProgNameArray = {
+        "Quotations",
+        "Preformatted Text",
+        "Horizontal Line",
+        "List Contents",
+        "List Heading", // STR_POCO_PRGM_HTML_DT
+    };
+    return s_aHTMLProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetFrameFormatProgNameArray()
 {
-    if (!s_pFrameFormatProgNameArray)
-        s_pFrameFormatProgNameArray = lcl_NewProgNameArray( FrameFormatProgNameTable,
-            SAL_N_ELEMENTS ( FrameFormatProgNameTable ) );
-    return *s_pFrameFormatProgNameArray;
+    static const std::vector<OUString> s_aFrameFormatProgNameArray = {
+        "Frame", // RES_POOLFRM_FRAME
+        "Graphics",
+        "OLE",
+        "Formula",
+        "Marginalia",
+        "Watermark",
+        "Labels", // RES_POOLFRM_LABEL
+    };
+    return s_aFrameFormatProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetChrFormatProgNameArray()
 {
-    if (!s_pChrFormatProgNameArray)
-        s_pChrFormatProgNameArray = lcl_NewProgNameArray( ChrFormatProgNameTable,
-            SAL_N_ELEMENTS ( ChrFormatProgNameTable ) );
-    return *s_pChrFormatProgNameArray;
+    static const std::vector<OUString> s_aChrFormatProgNameArray = {
+        "Footnote Symbol", // RES_POOLCHR_FOOTNOTE
+        "Page Number",
+        "Caption characters",
+        "Drop Caps",
+        "Numbering Symbols",
+        "Bullet Symbols",
+        "Internet link",
+        "Visited Internet Link",
+        "Placeholder",
+        "Index Link",
+        "Endnote Symbol",
+        "Line numbering",
+        "Main index entry",
+        "Footnote anchor",
+        "Endnote anchor",
+        "Rubies", // RES_POOLCHR_RUBYTEXT
+        "Vertical Numbering Symbols", // RES_POOLCHR_VERT_NUMBER
+    };
+    return s_aChrFormatProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetHTMLChrFormatProgNameArray()
 {
-    if (!s_pHTMLChrFormatProgNameArray)
-        s_pHTMLChrFormatProgNameArray = lcl_NewProgNameArray( HTMLChrFormatProgNameTable,
-            SAL_N_ELEMENTS ( HTMLChrFormatProgNameTable ) );
-    return *s_pHTMLChrFormatProgNameArray;
+    static const std::vector<OUString> s_aHTMLChrFormatProgNameArray = {
+        "Emphasis", // RES_POOLCHR_HTML_EMPHASIS
+        "Citation",
+        "Strong Emphasis",
+        "Source Text",
+        "Example",
+        "User Entry",
+        "Variable",
+        "Definition",
+        "Teletype", // RES_POOLCHR_HTML_TELETYPE
+    };
+    return s_aHTMLChrFormatProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetPageDescProgNameArray()
 {
-    if (!s_pPageDescProgNameArray)
-        s_pPageDescProgNameArray = lcl_NewProgNameArray( PageDescProgNameTable,
-            SAL_N_ELEMENTS ( PageDescProgNameTable ) );
-    return *s_pPageDescProgNameArray;
+    static const std::vector<OUString> s_aPageDescProgNameArray = {
+        "Standard", // STR_POOLPAGE_PRGM_STANDARD
+        "First Page",
+        "Left Page",
+        "Right Page",
+        "Envelope",
+        "Index",
+        "HTML",
+        "Footnote",
+        "Endnote", // STR_POOLPAGE_PRGM_ENDNOTE
+        "Landscape",
+    };
+    return s_aPageDescProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetNumRuleProgNameArray()
 {
-    if (!s_pNumRuleProgNameArray)
-        s_pNumRuleProgNameArray = lcl_NewProgNameArray( NumRuleProgNameTable,
-            SAL_N_ELEMENTS ( NumRuleProgNameTable ) );
-    return *s_pNumRuleProgNameArray;
+    static const std::vector<OUString> s_aNumRuleProgNameArray = {
+        "Numbering 123", // STR_POOLNUMRULE_PRGM_NUM1
+        "Numbering ABC",
+        "Numbering abc",
+        "Numbering IVX",
+        "Numbering ivx",
+        "List 1",
+        "List 2",
+        "List 3",
+        "List 4",
+        "List 5", // STR_POOLNUMRULE_PRGM_BUL5
+    };
+    return s_aNumRuleProgNameArray;
 }
 
 const std::vector<OUString>& SwStyleNameMapper::GetTableStyleProgNameArray()
 {
-    if (!s_pTableStyleProgNameArray)
-        s_pTableStyleProgNameArray = lcl_NewProgNameArray( TableStyleProgNameTable,
-            SAL_N_ELEMENTS ( TableStyleProgNameTable ) );
-    return *s_pTableStyleProgNameArray;
+    // XXX MUST match the entries of STR_TABSTYLE_ARY in
+    // sw/source/core/doc/DocumentStylePoolManager.cxx and MUST match the order of
+    // RES_POOL_TABSTYLE_TYPE in sw/inc/poolfmt.hxx
+    static const std::vector<OUString> s_aTableStyleProgNameArray = {
+        "Default Style",       // RES_POOLTABLESTYLE_DEFAULT
+        "3D",                  // RES_POOLTABLESTYLE_3D
+        "Black 1",             // RES_POOLTABLESTYLE_BLACK1
+        "Black 2",             // RES_POOLTABLESTYLE_BLACK2
+        "Blue",                // RES_POOLTABLESTYLE_BLUE
+        "Brown",               // RES_POOLTABLESTYLE_BROWN
+        "Currency",            // RES_POOLTABLESTYLE_CURRENCY
+        "Currency 3D",         // RES_POOLTABLESTYLE_CURRENCY_3D
+        "Currency Gray",       // RES_POOLTABLESTYLE_CURRENCY_GRAY
+        "Currency Lavender",   // RES_POOLTABLESTYLE_CURRENCY_LAVENDER
+        "Currency Turquoise",  // RES_POOLTABLESTYLE_CURRENCY_TURQUOISE
+        "Gray",                // RES_POOLTABLESTYLE_GRAY
+        "Green",               // RES_POOLTABLESTYLE_GREEN
+        "Lavender",            // RES_POOLTABLESTYLE_LAVENDER
+        "Red",                 // RES_POOLTABLESTYLE_RED
+        "Turquoise",           // RES_POOLTABLESTYLE_TURQUOISE
+        "Yellow",              // RES_POOLTABLESTYLE_YELLOW
+        "Academic",            // RES_POOLTABLESTYLE_LO6_ACADEMIC
+        "Box List Blue",       // RES_POOLTABLESTYLE_LO6_BOX_LIST_BLUE
+        "Box List Green",      // RES_POOLTABLESTYLE_LO6_BOX_LIST_GREEN
+        "Box List Red",        // RES_POOLTABLESTYLE_LO6_BOX_LIST_RED
+        "Box List Yellow",     // RES_POOLTABLESTYLE_LO6_BOX_LIST_YELLOW
+        "Elegant",             // RES_POOLTABLESTYLE_LO6_ELEGANT
+        "Financial",           // RES_POOLTABLESTYLE_LO6_FINANCIAL
+        "Simple Grid Columns", // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_COLUMNS
+        "Simple Grid Rows",    // RES_POOLTABLESTYLE_LO6_SIMPLE_GRID_ROWS
+        "Simple List Shaded",  // RES_POOLTABLESTYLE_LO6_SIMPLE_LIST_SHADED
+    };
+    return s_aTableStyleProgNameArray;
 }
 
 /// returns an empty array because Cell Names aren't translated
 const std::vector<OUString>& SwStyleNameMapper::GetCellStyleProgNameArray()
 {
-    if (!s_pCellStyleProgNameArray)
-        s_pCellStyleProgNameArray = new std::vector<OUString>;
-    return *s_pCellStyleProgNameArray;
+    static const std::vector<OUString> s_aCellStyleProgNameArray;
+    return s_aCellStyleProgNameArray;
 }
 
 const OUString &


More information about the Libreoffice-commits mailing list