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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 22 12:34:47 UTC 2018


 sw/source/core/access/accpara.cxx            |   76 ++------
 sw/source/core/doc/DocumentTimerManager.cxx  |    4 
 sw/source/core/doc/dbgoutsw.cxx              |  253 +++++++++++++--------------
 sw/source/core/doc/notxtfrm.cxx              |   24 +-
 sw/source/core/doc/tblafmt.cxx               |   42 ++--
 sw/source/core/layout/paintfrm.cxx           |   28 +-
 sw/source/core/text/inftxt.cxx               |   36 +--
 sw/source/core/unocore/unoobj.cxx            |    7 
 sw/source/core/unocore/unostyle.cxx          |   48 ++---
 sw/source/core/unocore/unotbl.cxx            |   18 -
 sw/source/filter/ww8/docxattributeoutput.cxx |   27 +-
 sw/source/ui/dbui/dbinsdlg.cxx               |   10 -
 sw/source/ui/dialog/swuiexp.cxx              |   10 -
 sw/source/ui/envelp/envfmt.cxx               |    5 
 sw/source/ui/fldui/fldedt.cxx                |    5 
 sw/source/ui/inc/swuiexp.hxx                 |    2 
 sw/source/ui/misc/bookmark.cxx               |    5 
 sw/source/ui/table/convert.cxx               |    5 
 sw/source/ui/vba/vbaaddin.cxx                |    8 
 sw/source/ui/vba/vbaaddins.cxx               |    8 
 sw/source/ui/vba/vbaapplication.cxx          |    8 
 sw/source/ui/vba/vbaautotextentry.cxx        |   16 -
 sw/source/ui/vba/vbabookmark.cxx             |    8 
 sw/source/ui/vba/vbabookmarks.cxx            |    8 
 sw/source/ui/vba/vbaborders.cxx              |   16 -
 sw/source/ui/vba/vbacell.cxx                 |    8 
 sw/source/ui/vba/vbacells.cxx                |    8 
 sw/source/ui/vba/vbacolumn.cxx               |    8 
 sw/source/ui/vba/vbacolumns.cxx              |    8 
 sw/source/ui/vba/vbadialog.cxx               |    8 
 sw/source/ui/vba/vbadialogs.cxx              |    8 
 sw/source/ui/vba/vbadocument.cxx             |    8 
 sw/source/ui/vba/vbadocumentproperties.cxx   |   16 -
 sw/source/ui/vba/vbadocuments.cxx            |    8 
 sw/source/ui/vba/vbafield.cxx                |   16 -
 sw/source/ui/vba/vbafind.cxx                 |    8 
 sw/source/ui/vba/vbafont.cxx                 |    8 
 sw/source/ui/vba/vbaframe.cxx                |    8 
 sw/source/ui/vba/vbaframes.cxx               |    8 
 sw/source/ui/vba/vbaglobals.cxx              |   27 --
 sw/source/ui/vba/vbaheaderfooter.cxx         |    8 
 sw/source/ui/vba/vbaheadersfooters.cxx       |    8 
 sw/source/ui/vba/vbalistformat.cxx           |    8 
 sw/source/ui/vba/vbalistgalleries.cxx        |    8 
 sw/source/ui/vba/vbalistgallery.cxx          |    8 
 sw/source/ui/vba/vbalistlevel.cxx            |    8 
 sw/source/ui/vba/vbalistlevels.cxx           |    8 
 sw/source/ui/vba/vbalisttemplate.cxx         |    8 
 sw/source/ui/vba/vbalisttemplates.cxx        |    8 
 sw/source/ui/vba/vbamailmerge.cxx            |    7 
 sw/source/ui/vba/vbaoptions.cxx              |    8 
 sw/source/ui/vba/vbapagesetup.cxx            |    8 
 sw/source/ui/vba/vbapane.cxx                 |    8 
 sw/source/ui/vba/vbapanes.cxx                |    8 
 sw/source/ui/vba/vbaparagraph.cxx            |   16 -
 sw/source/ui/vba/vbaparagraphformat.cxx      |    8 
 sw/source/ui/vba/vbarange.cxx                |    8 
 sw/source/ui/vba/vbareplacement.cxx          |    8 
 sw/source/ui/vba/vbarevision.cxx             |    8 
 sw/source/ui/vba/vbarevisions.cxx            |    8 
 sw/source/ui/vba/vbarow.cxx                  |    8 
 sw/source/ui/vba/vbarows.cxx                 |    8 
 sw/source/ui/vba/vbasection.cxx              |    8 
 sw/source/ui/vba/vbasections.cxx             |    8 
 sw/source/ui/vba/vbaselection.cxx            |    8 
 sw/source/ui/vba/vbastyle.cxx                |    8 
 sw/source/ui/vba/vbastyles.cxx               |    8 
 sw/source/ui/vba/vbasystem.cxx               |    8 
 sw/source/ui/vba/vbatable.cxx                |    8 
 sw/source/ui/vba/vbatableofcontents.cxx      |    8 
 sw/source/ui/vba/vbatables.cxx               |    8 
 sw/source/ui/vba/vbatablesofcontents.cxx     |    8 
 sw/source/ui/vba/vbatabstop.cxx              |    8 
 sw/source/ui/vba/vbatabstops.cxx             |    8 
 sw/source/ui/vba/vbatemplate.cxx             |    8 
 sw/source/ui/vba/vbavariable.cxx             |    8 
 sw/source/ui/vba/vbavariables.cxx            |    8 
 sw/source/ui/vba/vbaview.cxx                 |    8 
 sw/source/ui/vba/vbawindow.cxx               |    8 
 sw/source/ui/vba/vbawrapformat.cxx           |    8 
 sw/source/uibase/config/modcfg.cxx           |   67 +------
 sw/source/uibase/config/viewopt.cxx          |    4 
 82 files changed, 496 insertions(+), 734 deletions(-)

New commits:
commit 0d653000a6c07327d6db1f95be3d21d50d505423
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Nov 22 13:11:47 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 22 13:34:17 2018 +0100

    improve function-local statics in sw
    
    Change-Id: I36b0e9b2819a442f01182f551dbc2bf7d5c878f4
    Reviewed-on: https://gerrit.libreoffice.org/63788
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index cc8d2af04491..a00a8d04d465 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -897,63 +897,43 @@ uno::Sequence< OUString > SAL_CALL SwAccessibleParagraph::getSupportedServiceNam
 
 static uno::Sequence< OUString > const & getAttributeNames()
 {
-    static uno::Sequence< OUString >* pNames = nullptr;
-
-    if( pNames == nullptr )
+    static uno::Sequence< OUString > const aNames
     {
         // Add the font name to attribute list
-        uno::Sequence< OUString >* pSeq = new uno::Sequence< OUString >( 13 );
-
-        OUString* pStrings = pSeq->getArray();
-
         // sorted list of strings
-        sal_Int32 i = 0;
-
-        pStrings[i++] = UNO_NAME_CHAR_BACK_COLOR;
-        pStrings[i++] = UNO_NAME_CHAR_COLOR;
-        pStrings[i++] = UNO_NAME_CHAR_CONTOURED;
-        pStrings[i++] = UNO_NAME_CHAR_EMPHASIS;
-        pStrings[i++] = UNO_NAME_CHAR_ESCAPEMENT;
-        pStrings[i++] = UNO_NAME_CHAR_FONT_NAME;
-        pStrings[i++] = UNO_NAME_CHAR_HEIGHT;
-        pStrings[i++] = UNO_NAME_CHAR_POSTURE;
-        pStrings[i++] = UNO_NAME_CHAR_SHADOWED;
-        pStrings[i++] = UNO_NAME_CHAR_STRIKEOUT;
-        pStrings[i++] = UNO_NAME_CHAR_UNDERLINE;
-        pStrings[i++] = UNO_NAME_CHAR_UNDERLINE_COLOR;
-        pStrings[i++] = UNO_NAME_CHAR_WEIGHT;
-        assert(i == pSeq->getLength());
-        pNames = pSeq;
-    }
-    return *pNames;
+        UNO_NAME_CHAR_BACK_COLOR,
+        UNO_NAME_CHAR_COLOR,
+        UNO_NAME_CHAR_CONTOURED,
+        UNO_NAME_CHAR_EMPHASIS,
+        UNO_NAME_CHAR_ESCAPEMENT,
+        UNO_NAME_CHAR_FONT_NAME,
+        UNO_NAME_CHAR_HEIGHT,
+        UNO_NAME_CHAR_POSTURE,
+        UNO_NAME_CHAR_SHADOWED,
+        UNO_NAME_CHAR_STRIKEOUT,
+        UNO_NAME_CHAR_UNDERLINE,
+        UNO_NAME_CHAR_UNDERLINE_COLOR,
+        UNO_NAME_CHAR_WEIGHT,
+    };
+    return aNames;
 }
 
 static uno::Sequence< OUString > const & getSupplementalAttributeNames()
 {
-    static uno::Sequence< OUString >* pNames = nullptr;
-
-    if( pNames == nullptr )
+    static uno::Sequence< OUString > const aNames
     {
-        uno::Sequence< OUString >* pSeq = new uno::Sequence< OUString >( 9 );
-
-        OUString* pStrings = pSeq->getArray();
-
         // sorted list of strings
-        sal_Int32 i = 0;
-
-        pStrings[i++] = UNO_NAME_NUMBERING_LEVEL;
-        pStrings[i++] = UNO_NAME_NUMBERING_RULES;
-        pStrings[i++] = UNO_NAME_PARA_ADJUST;
-        pStrings[i++] = UNO_NAME_PARA_BOTTOM_MARGIN;
-        pStrings[i++] = UNO_NAME_PARA_FIRST_LINE_INDENT;
-        pStrings[i++] = UNO_NAME_PARA_LEFT_MARGIN;
-        pStrings[i++] = UNO_NAME_PARA_LINE_SPACING;
-        pStrings[i++] = UNO_NAME_PARA_RIGHT_MARGIN;
-        pStrings[i++] = UNO_NAME_TABSTOPS;
-        assert(i == pSeq->getLength());
-        pNames = pSeq;
-    }
-    return *pNames;
+        UNO_NAME_NUMBERING_LEVEL,
+        UNO_NAME_NUMBERING_RULES,
+        UNO_NAME_PARA_ADJUST,
+        UNO_NAME_PARA_BOTTOM_MARGIN,
+        UNO_NAME_PARA_FIRST_LINE_INDENT,
+        UNO_NAME_PARA_LEFT_MARGIN,
+        UNO_NAME_PARA_LINE_SPACING,
+        UNO_NAME_PARA_RIGHT_MARGIN,
+        UNO_NAME_TABSTOPS,
+    };
+    return aNames;
 }
 
 // XInterface
diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx
index 7bd2e505a3a4..d2be24104920 100644
--- a/sw/source/core/doc/DocumentTimerManager.cxx
+++ b/sw/source/core/doc/DocumentTimerManager.cxx
@@ -132,9 +132,7 @@ DocumentTimerManager::IdleJob DocumentTimerManager::GetNextIdleJob() const
 IMPL_LINK_NOARG( DocumentTimerManager, DoIdleJobs, Timer*, void )
 {
 #ifdef TIMELOG
-    static ::rtl::Logfile* pModLogFile = 0;
-    if( !pModLogFile )
-        pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" );
+    static ::rtl::Logfile* pModLogFile = new ::rtl::Logfile( "First DoIdleJobs" );
 #endif
     BlockIdling();
     StopIdling();
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index f1e912b5b1ab..d69e1cb0308d 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -95,136 +95,131 @@ const char * dbg_out(const OUString & aStr)
 
 static map<sal_uInt16,OUString> & GetItemWhichMap()
 {
-    static map<sal_uInt16,OUString> aItemWhichMap;
-    static bool bInitialized = false;
-
-    if (! bInitialized)
+    static map<sal_uInt16,OUString> aItemWhichMap
     {
-        aItemWhichMap[RES_CHRATR_CASEMAP] = "CHRATR_CASEMAP";
-        aItemWhichMap[RES_CHRATR_CHARSETCOLOR] = "CHRATR_CHARSETCOLOR";
-        aItemWhichMap[RES_CHRATR_COLOR] = "CHRATR_COLOR";
-        aItemWhichMap[RES_CHRATR_CONTOUR] = "CHRATR_CONTOUR";
-        aItemWhichMap[RES_CHRATR_CROSSEDOUT] = "CHRATR_CROSSEDOUT";
-        aItemWhichMap[RES_CHRATR_ESCAPEMENT] = "CHRATR_ESCAPEMENT";
-        aItemWhichMap[RES_CHRATR_FONT] = "CHRATR_FONT";
-        aItemWhichMap[RES_CHRATR_FONTSIZE] = "CHRATR_FONTSIZE";
-        aItemWhichMap[RES_CHRATR_KERNING] = "CHRATR_KERNING";
-        aItemWhichMap[RES_CHRATR_LANGUAGE] = "CHRATR_LANGUAGE";
-        aItemWhichMap[RES_CHRATR_POSTURE] = "CHRATR_POSTURE";
-        aItemWhichMap[RES_CHRATR_SHADOWED] = "CHRATR_SHADOWED";
-        aItemWhichMap[RES_CHRATR_UNDERLINE] = "CHRATR_UNDERLINE";
-        aItemWhichMap[RES_CHRATR_OVERLINE] = "CHRATR_OVERLINE";
-        aItemWhichMap[RES_CHRATR_WEIGHT] = "CHRATR_WEIGHT";
-        aItemWhichMap[RES_CHRATR_WORDLINEMODE] = "CHRATR_WORDLINEMODE";
-        aItemWhichMap[RES_CHRATR_AUTOKERN] = "CHRATR_AUTOKERN";
-        aItemWhichMap[RES_CHRATR_BLINK] = "CHRATR_BLINK";
-        aItemWhichMap[RES_CHRATR_NOHYPHEN] = "CHRATR_NOHYPHEN";
-        aItemWhichMap[RES_CHRATR_BACKGROUND] = "CHRATR_BACKGROUND";
-        aItemWhichMap[RES_CHRATR_HIGHLIGHT] = "CHRATR_HIGHLIGHT";
-        aItemWhichMap[RES_CHRATR_CJK_FONT] = "CHRATR_CJK_FONT";
-        aItemWhichMap[RES_CHRATR_CJK_FONTSIZE] = "CHRATR_CJK_FONTSIZE";
-        aItemWhichMap[RES_CHRATR_CJK_LANGUAGE] = "CHRATR_CJK_LANGUAGE";
-        aItemWhichMap[RES_CHRATR_CJK_POSTURE] = "CHRATR_CJK_POSTURE";
-        aItemWhichMap[RES_CHRATR_CJK_WEIGHT] = "CHRATR_CJK_WEIGHT";
-        aItemWhichMap[RES_CHRATR_CTL_FONT] = "CHRATR_CTL_FONT";
-        aItemWhichMap[RES_CHRATR_CTL_FONTSIZE] = "CHRATR_CTL_FONTSIZE";
-        aItemWhichMap[RES_CHRATR_CTL_LANGUAGE] = "CHRATR_CTL_LANGUAGE";
-        aItemWhichMap[RES_CHRATR_CTL_POSTURE] = "CHRATR_CTL_POSTURE";
-        aItemWhichMap[RES_CHRATR_CTL_WEIGHT] = "CHRATR_CTL_WEIGHT";
-        aItemWhichMap[RES_CHRATR_ROTATE] = "CHRATR_ROTATE";
-        aItemWhichMap[RES_CHRATR_EMPHASIS_MARK] = "CHRATR_EMPHASIS_MARK";
-        aItemWhichMap[RES_CHRATR_TWO_LINES] = "CHRATR_TWO_LINES";
-        aItemWhichMap[RES_CHRATR_SCALEW] = "CHRATR_SCALEW";
-        aItemWhichMap[RES_CHRATR_RELIEF] = "CHRATR_RELIEF";
-        aItemWhichMap[RES_CHRATR_HIDDEN] = "CHRATR_HIDDEN";
-        aItemWhichMap[RES_CHRATR_BOX] = "CHRATR_BOX";
-        aItemWhichMap[RES_CHRATR_SHADOW] = "CHRATR_SHADOW";
-        aItemWhichMap[RES_TXTATR_AUTOFMT] = "TXTATR_AUTOFMT";
-        aItemWhichMap[RES_TXTATR_INETFMT] = "TXTATR_INETFMT";
-        aItemWhichMap[RES_TXTATR_REFMARK] = "TXTATR_REFMARK";
-        aItemWhichMap[RES_TXTATR_TOXMARK] = "TXTATR_TOXMARK";
-        aItemWhichMap[RES_TXTATR_CHARFMT] = "TXTATR_CHARFMT";
-        aItemWhichMap[RES_TXTATR_INPUTFIELD] = "RES_TXTATR_INPUTFIELD";
-        aItemWhichMap[RES_TXTATR_CJK_RUBY] = "TXTATR_CJK_RUBY";
-        aItemWhichMap[RES_TXTATR_UNKNOWN_CONTAINER] = "TXTATR_UNKNOWN_CONTAINER";
-        aItemWhichMap[RES_TXTATR_META] = "TXTATR_META";
-        aItemWhichMap[RES_TXTATR_METAFIELD] = "TXTATR_METAFIELD";
-        aItemWhichMap[RES_TXTATR_FIELD] = "TXTATR_FIELD";
-        aItemWhichMap[RES_TXTATR_FLYCNT] = "TXTATR_FLYCNT";
-        aItemWhichMap[RES_TXTATR_FTN] = "TXTATR_FTN";
-        aItemWhichMap[RES_TXTATR_ANNOTATION] = "TXTATR_ANNOTATION";
-        aItemWhichMap[RES_TXTATR_DUMMY3] = "TXTATR_DUMMY3";
-        aItemWhichMap[RES_TXTATR_DUMMY1] = "TXTATR_DUMMY1";
-        aItemWhichMap[RES_TXTATR_DUMMY2] = "TXTATR_DUMMY2";
-        aItemWhichMap[RES_PARATR_LINESPACING] = "PARATR_LINESPACING";
-        aItemWhichMap[RES_PARATR_ADJUST] = "PARATR_ADJUST";
-        aItemWhichMap[RES_PARATR_SPLIT] = "PARATR_SPLIT";
-        aItemWhichMap[RES_PARATR_ORPHANS] = "PARATR_ORPHANS";
-        aItemWhichMap[RES_PARATR_WIDOWS] = "PARATR_WIDOWS";
-        aItemWhichMap[RES_PARATR_TABSTOP] = "PARATR_TABSTOP";
-        aItemWhichMap[RES_PARATR_HYPHENZONE] = "PARATR_HYPHENZONE";
-        aItemWhichMap[RES_PARATR_DROP] = "PARATR_DROP";
-        aItemWhichMap[RES_PARATR_REGISTER] = "PARATR_REGISTER";
-        aItemWhichMap[RES_PARATR_NUMRULE] = "PARATR_NUMRULE";
-        aItemWhichMap[RES_PARATR_SCRIPTSPACE] = "PARATR_SCRIPTSPACE";
-        aItemWhichMap[RES_PARATR_HANGINGPUNCTUATION] = "PARATR_HANGINGPUNCTUATION";
-        aItemWhichMap[RES_PARATR_FORBIDDEN_RULES] = "PARATR_FORBIDDEN_RULES";
-        aItemWhichMap[RES_PARATR_VERTALIGN] = "PARATR_VERTALIGN";
-        aItemWhichMap[RES_PARATR_SNAPTOGRID] = "PARATR_SNAPTOGRID";
-        aItemWhichMap[RES_PARATR_CONNECT_BORDER] = "PARATR_CONNECT_BORDER";
-        aItemWhichMap[RES_FILL_ORDER] = "FILL_ORDER";
-        aItemWhichMap[RES_FRM_SIZE] = "FRM_SIZE";
-        aItemWhichMap[RES_PAPER_BIN] = "PAPER_BIN";
-        aItemWhichMap[RES_LR_SPACE] = "LR_SPACE";
-        aItemWhichMap[RES_UL_SPACE] = "UL_SPACE";
-        aItemWhichMap[RES_PAGEDESC] = "PAGEDESC";
-        aItemWhichMap[RES_BREAK] = "BREAK";
-        aItemWhichMap[RES_CNTNT] = "CNTNT";
-        aItemWhichMap[RES_HEADER] = "HEADER";
-        aItemWhichMap[RES_FOOTER] = "FOOTER";
-        aItemWhichMap[RES_PRINT] = "PRINT";
-        aItemWhichMap[RES_OPAQUE] = "OPAQUE";
-        aItemWhichMap[RES_PROTECT] = "PROTECT";
-        aItemWhichMap[RES_SURROUND] = "SURROUND";
-        aItemWhichMap[RES_VERT_ORIENT] = "VERT_ORIENT";
-        aItemWhichMap[RES_HORI_ORIENT] = "HORI_ORIENT";
-        aItemWhichMap[RES_ANCHOR] = "ANCHOR";
-        aItemWhichMap[RES_BACKGROUND] = "BACKGROUND";
-        aItemWhichMap[RES_BOX] = "BOX";
-        aItemWhichMap[RES_SHADOW] = "SHADOW";
-        aItemWhichMap[RES_FRMMACRO] = "FRMMACRO";
-        aItemWhichMap[RES_COL] = "COL";
-        aItemWhichMap[RES_KEEP] = "KEEP";
-        aItemWhichMap[RES_URL] = "URL";
-        aItemWhichMap[RES_EDIT_IN_READONLY] = "EDIT_IN_READONLY";
-        aItemWhichMap[RES_LAYOUT_SPLIT] = "LAYOUT_SPLIT";
-        aItemWhichMap[RES_CHAIN] = "CHAIN";
-        aItemWhichMap[RES_TEXTGRID] = "TEXTGRID";
-        aItemWhichMap[RES_LINENUMBER  ] = "LINENUMBER";
-        aItemWhichMap[RES_FTN_AT_TXTEND] = "FTN_AT_TXTEND";
-        aItemWhichMap[RES_END_AT_TXTEND] = "END_AT_TXTEND";
-        aItemWhichMap[RES_COLUMNBALANCE] = "COLUMNBALANCE";
-        aItemWhichMap[RES_FRAMEDIR] = "FRAMEDIR";
-        aItemWhichMap[RES_HEADER_FOOTER_EAT_SPACING] = "HEADER_FOOTER_EAT_SPACING";
-        aItemWhichMap[RES_ROW_SPLIT] = "ROW_SPLIT";
-        aItemWhichMap[RES_GRFATR_MIRRORGRF] = "GRFATR_MIRRORGRF";
-        aItemWhichMap[RES_GRFATR_CROPGRF] = "GRFATR_CROPGRF";
-        aItemWhichMap[RES_GRFATR_ROTATION] = "GRFATR_ROTATION";
-        aItemWhichMap[RES_GRFATR_LUMINANCE] = "GRFATR_LUMINANCE";
-        aItemWhichMap[RES_GRFATR_CONTRAST] = "GRFATR_CONTRAST";
-        aItemWhichMap[RES_GRFATR_CHANNELR] = "GRFATR_CHANNELR";
-        aItemWhichMap[RES_GRFATR_CHANNELG] = "GRFATR_CHANNELG";
-        aItemWhichMap[RES_GRFATR_CHANNELB] = "GRFATR_CHANNELB";
-        aItemWhichMap[RES_GRFATR_GAMMA] = "GRFATR_GAMMA";
-        aItemWhichMap[RES_GRFATR_INVERT] = "GRFATR_INVERT";
-        aItemWhichMap[RES_GRFATR_TRANSPARENCY] = "GRFATR_TRANSPARENCY";
-        aItemWhichMap[RES_GRFATR_DRAWMODE] = "GRFATR_DRAWMODE";
-        aItemWhichMap[RES_BOXATR_FORMAT] = "BOXATR_FORMAT";
-        aItemWhichMap[RES_BOXATR_FORMULA] = "BOXATR_FORMULA";
-        aItemWhichMap[RES_BOXATR_VALUE] = "BOXATR_VALUE";
-
-        bInitialized = true;
-    }
+        { RES_CHRATR_CASEMAP , "CHRATR_CASEMAP" },
+        { RES_CHRATR_CHARSETCOLOR , "CHRATR_CHARSETCOLOR" },
+        { RES_CHRATR_COLOR , "CHRATR_COLOR" },
+        { RES_CHRATR_CONTOUR , "CHRATR_CONTOUR" },
+        { RES_CHRATR_CROSSEDOUT , "CHRATR_CROSSEDOUT" },
+        { RES_CHRATR_ESCAPEMENT , "CHRATR_ESCAPEMENT" },
+        { RES_CHRATR_FONT , "CHRATR_FONT" },
+        { RES_CHRATR_FONTSIZE , "CHRATR_FONTSIZE" },
+        { RES_CHRATR_KERNING , "CHRATR_KERNING" },
+        { RES_CHRATR_LANGUAGE , "CHRATR_LANGUAGE" },
+        { RES_CHRATR_POSTURE , "CHRATR_POSTURE" },
+        { RES_CHRATR_SHADOWED , "CHRATR_SHADOWED" },
+        { RES_CHRATR_UNDERLINE , "CHRATR_UNDERLINE" },
+        { RES_CHRATR_OVERLINE , "CHRATR_OVERLINE" },
+        { RES_CHRATR_WEIGHT , "CHRATR_WEIGHT" },
+        { RES_CHRATR_WORDLINEMODE , "CHRATR_WORDLINEMODE" },
+        { RES_CHRATR_AUTOKERN , "CHRATR_AUTOKERN" },
+        { RES_CHRATR_BLINK , "CHRATR_BLINK" },
+        { RES_CHRATR_NOHYPHEN , "CHRATR_NOHYPHEN" },
+        { RES_CHRATR_BACKGROUND , "CHRATR_BACKGROUND" },
+        { RES_CHRATR_HIGHLIGHT , "CHRATR_HIGHLIGHT" },
+        { RES_CHRATR_CJK_FONT , "CHRATR_CJK_FONT" },
+        { RES_CHRATR_CJK_FONTSIZE , "CHRATR_CJK_FONTSIZE" },
+        { RES_CHRATR_CJK_LANGUAGE , "CHRATR_CJK_LANGUAGE" },
+        { RES_CHRATR_CJK_POSTURE , "CHRATR_CJK_POSTURE" },
+        { RES_CHRATR_CJK_WEIGHT , "CHRATR_CJK_WEIGHT" },
+        { RES_CHRATR_CTL_FONT , "CHRATR_CTL_FONT" },
+        { RES_CHRATR_CTL_FONTSIZE , "CHRATR_CTL_FONTSIZE" },
+        { RES_CHRATR_CTL_LANGUAGE , "CHRATR_CTL_LANGUAGE" },
+        { RES_CHRATR_CTL_POSTURE , "CHRATR_CTL_POSTURE" },
+        { RES_CHRATR_CTL_WEIGHT , "CHRATR_CTL_WEIGHT" },
+        { RES_CHRATR_ROTATE , "CHRATR_ROTATE" },
+        { RES_CHRATR_EMPHASIS_MARK , "CHRATR_EMPHASIS_MARK" },
+        { RES_CHRATR_TWO_LINES , "CHRATR_TWO_LINES" },
+        { RES_CHRATR_SCALEW , "CHRATR_SCALEW" },
+        { RES_CHRATR_RELIEF , "CHRATR_RELIEF" },
+        { RES_CHRATR_HIDDEN , "CHRATR_HIDDEN" },
+        { RES_CHRATR_BOX , "CHRATR_BOX" },
+        { RES_CHRATR_SHADOW , "CHRATR_SHADOW" },
+        { RES_TXTATR_AUTOFMT , "TXTATR_AUTOFMT" },
+        { RES_TXTATR_INETFMT , "TXTATR_INETFMT" },
+        { RES_TXTATR_REFMARK , "TXTATR_REFMARK" },
+        { RES_TXTATR_TOXMARK , "TXTATR_TOXMARK" },
+        { RES_TXTATR_CHARFMT , "TXTATR_CHARFMT" },
+        { RES_TXTATR_INPUTFIELD , "RES_TXTATR_INPUTFIELD" },
+        { RES_TXTATR_CJK_RUBY , "TXTATR_CJK_RUBY" },
+        { RES_TXTATR_UNKNOWN_CONTAINER , "TXTATR_UNKNOWN_CONTAINER" },
+        { RES_TXTATR_META , "TXTATR_META" },
+        { RES_TXTATR_METAFIELD , "TXTATR_METAFIELD" },
+        { RES_TXTATR_FIELD , "TXTATR_FIELD" },
+        { RES_TXTATR_FLYCNT , "TXTATR_FLYCNT" },
+        { RES_TXTATR_FTN , "TXTATR_FTN" },
+        { RES_TXTATR_ANNOTATION , "TXTATR_ANNOTATION" },
+        { RES_TXTATR_DUMMY3 , "TXTATR_DUMMY3" },
+        { RES_TXTATR_DUMMY1 , "TXTATR_DUMMY1" },
+        { RES_TXTATR_DUMMY2 , "TXTATR_DUMMY2" },
+        { RES_PARATR_LINESPACING , "PARATR_LINESPACING" },
+        { RES_PARATR_ADJUST , "PARATR_ADJUST" },
+        { RES_PARATR_SPLIT , "PARATR_SPLIT" },
+        { RES_PARATR_ORPHANS , "PARATR_ORPHANS" },
+        { RES_PARATR_WIDOWS , "PARATR_WIDOWS" },
+        { RES_PARATR_TABSTOP , "PARATR_TABSTOP" },
+        { RES_PARATR_HYPHENZONE , "PARATR_HYPHENZONE" },
+        { RES_PARATR_DROP , "PARATR_DROP" },
+        { RES_PARATR_REGISTER , "PARATR_REGISTER" },
+        { RES_PARATR_NUMRULE , "PARATR_NUMRULE" },
+        { RES_PARATR_SCRIPTSPACE , "PARATR_SCRIPTSPACE" },
+        { RES_PARATR_HANGINGPUNCTUATION , "PARATR_HANGINGPUNCTUATION" },
+        { RES_PARATR_FORBIDDEN_RULES , "PARATR_FORBIDDEN_RULES" },
+        { RES_PARATR_VERTALIGN , "PARATR_VERTALIGN" },
+        { RES_PARATR_SNAPTOGRID , "PARATR_SNAPTOGRID" },
+        { RES_PARATR_CONNECT_BORDER , "PARATR_CONNECT_BORDER" },
+        { RES_FILL_ORDER , "FILL_ORDER" },
+        { RES_FRM_SIZE , "FRM_SIZE" },
+        { RES_PAPER_BIN , "PAPER_BIN" },
+        { RES_LR_SPACE , "LR_SPACE" },
+        { RES_UL_SPACE , "UL_SPACE" },
+        { RES_PAGEDESC , "PAGEDESC" },
+        { RES_BREAK , "BREAK" },
+        { RES_CNTNT , "CNTNT" },
+        { RES_HEADER , "HEADER" },
+        { RES_FOOTER , "FOOTER" },
+        { RES_PRINT , "PRINT" },
+        { RES_OPAQUE , "OPAQUE" },
+        { RES_PROTECT , "PROTECT" },
+        { RES_SURROUND , "SURROUND" },
+        { RES_VERT_ORIENT , "VERT_ORIENT" },
+        { RES_HORI_ORIENT , "HORI_ORIENT" },
+        { RES_ANCHOR , "ANCHOR" },
+        { RES_BACKGROUND , "BACKGROUND" },
+        { RES_BOX , "BOX" },
+        { RES_SHADOW , "SHADOW" },
+        { RES_FRMMACRO , "FRMMACRO" },
+        { RES_COL , "COL" },
+        { RES_KEEP , "KEEP" },
+        { RES_URL , "URL" },
+        { RES_EDIT_IN_READONLY , "EDIT_IN_READONLY" },
+        { RES_LAYOUT_SPLIT , "LAYOUT_SPLIT" },
+        { RES_CHAIN , "CHAIN" },
+        { RES_TEXTGRID , "TEXTGRID" },
+        { RES_LINENUMBER   , "LINENUMBER" },
+        { RES_FTN_AT_TXTEND , "FTN_AT_TXTEND" },
+        { RES_END_AT_TXTEND , "END_AT_TXTEND" },
+        { RES_COLUMNBALANCE , "COLUMNBALANCE" },
+        { RES_FRAMEDIR , "FRAMEDIR" },
+        { RES_HEADER_FOOTER_EAT_SPACING , "HEADER_FOOTER_EAT_SPACING" },
+        { RES_ROW_SPLIT , "ROW_SPLIT" },
+        { RES_GRFATR_MIRRORGRF , "GRFATR_MIRRORGRF" },
+        { RES_GRFATR_CROPGRF , "GRFATR_CROPGRF" },
+        { RES_GRFATR_ROTATION , "GRFATR_ROTATION" },
+        { RES_GRFATR_LUMINANCE , "GRFATR_LUMINANCE" },
+        { RES_GRFATR_CONTRAST , "GRFATR_CONTRAST" },
+        { RES_GRFATR_CHANNELR , "GRFATR_CHANNELR" },
+        { RES_GRFATR_CHANNELG , "GRFATR_CHANNELG" },
+        { RES_GRFATR_CHANNELB , "GRFATR_CHANNELB" },
+        { RES_GRFATR_GAMMA , "GRFATR_GAMMA" },
+        { RES_GRFATR_INVERT , "GRFATR_INVERT" },
+        { RES_GRFATR_TRANSPARENCY , "GRFATR_TRANSPARENCY" },
+        { RES_GRFATR_DRAWMODE , "GRFATR_DRAWMODE" },
+        { RES_BOXATR_FORMAT , "BOXATR_FORMAT" },
+        { RES_BOXATR_FORMULA , "BOXATR_FORMULA" },
+        { RES_BOXATR_VALUE , "BOXATR_VALUE" },
+    };
 
     return aItemWhichMap;
 }
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 51c43fa0e2a1..650adb6d7840 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -99,16 +99,16 @@ static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText,
                            const SwViewShell &rSh, const SwNoTextFrame *pFrame,
                            bool bDefect )
 {
-    static vcl::Font *pFont = nullptr;
-    if ( !pFont )
+    static vcl::Font aFont = [&]()
     {
-        pFont = new vcl::Font();
-        pFont->SetWeight( WEIGHT_BOLD );
-        pFont->SetStyleName( OUString() );
-        pFont->SetFamilyName("Arial Unicode");
-        pFont->SetFamily( FAMILY_SWISS );
-        pFont->SetTransparent( true );
-    }
+        vcl::Font tmp;
+        tmp.SetWeight( WEIGHT_BOLD );
+        tmp.SetStyleName( OUString() );
+        tmp.SetFamilyName("Arial Unicode");
+        tmp.SetFamily( FAMILY_SWISS );
+        tmp.SetTransparent( true );
+        return tmp;
+    }();
 
     Color aCol( COL_RED );
     FontLineStyle eUnderline = LINESTYLE_NONE;
@@ -138,11 +138,11 @@ static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText,
         eUnderline = pFormat->GetUnderline().GetLineStyle();
     }
 
-    pFont->SetUnderline( eUnderline );
-    pFont->SetColor( aCol );
+    aFont.SetUnderline( eUnderline );
+    aFont.SetColor( aCol );
 
     const BitmapEx& rBmp = const_cast<SwViewShell&>(rSh).GetReplacementBitmap(bDefect);
-    Graphic::DrawEx( rSh.GetOut(), rText, *pFont, rBmp, rRect.Pos(), rRect.SSize() );
+    Graphic::DrawEx( rSh.GetOut(), rText, aFont, rBmp, rRect.Pos(), rRect.SSize() );
 }
 
 SwNoTextFrame::SwNoTextFrame(SwNoTextNode * const pNode, SwFrame* pSib )
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 7c9cd3e37781..ddd9144e6c06 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -1110,30 +1110,28 @@ OUString SwTableAutoFormat::GetTableTemplateCellSubName(const SwBoxAutoFormat& r
  * ODD  = 1, 3, 5, ...
  * EVEN = 2, 4, 6, ...
  */
-const std::vector<sal_Int32>& SwTableAutoFormat::GetTableTemplateMap()
+const std::vector<sal_Int32> & SwTableAutoFormat::GetTableTemplateMap()
 {
-    static std::vector<sal_Int32>* pTableTemplateMap;
-    if (!pTableTemplateMap)
+    static std::vector<sal_Int32> const aTableTemplateMap
     {
-        pTableTemplateMap = new std::vector<sal_Int32>;
-        pTableTemplateMap->push_back(1 ); // FIRST_ROW              // FR
-        pTableTemplateMap->push_back(13); // LAST_ROW               // LR
-        pTableTemplateMap->push_back(4 ); // FIRST_COLUMN           // FC
-        pTableTemplateMap->push_back(7 ); // LAST_COLUMN            // LC
-        pTableTemplateMap->push_back(5 ); // EVEN_ROWS              // ER
-        pTableTemplateMap->push_back(8 ); // ODD_ROWS               // OR
-        pTableTemplateMap->push_back(6 ); // EVEN_COLUMNS           // EC
-        pTableTemplateMap->push_back(9 ); // ODD_COLUMNS            // OC
-        pTableTemplateMap->push_back(10); // BODY
-        pTableTemplateMap->push_back(11); // BACKGROUND             // BCKG
-        pTableTemplateMap->push_back(0 ); // FIRST_ROW_START_COLUMN // FRSC
-        pTableTemplateMap->push_back(3 ); // FIRST_ROW_END_COLUMN   // FRENC
-        pTableTemplateMap->push_back(12); // LAST_ROW_START_COLUMN  // LRSC
-        pTableTemplateMap->push_back(15); // LAST_ROW_END_COLUMN    // LRENC
-        pTableTemplateMap->push_back(2 ); // FIRST_ROW_EVEN_COLUMN  // FREC
-        pTableTemplateMap->push_back(14); // LAST_ROW_EVEN_COLUMN   // LREC
-    }
-    return *pTableTemplateMap;
+        1 , // FIRST_ROW              // FR
+        13, // LAST_ROW               // LR
+        4 , // FIRST_COLUMN           // FC
+        7 , // LAST_COLUMN            // LC
+        5 , // EVEN_ROWS              // ER
+        8 , // ODD_ROWS               // OR
+        6 , // EVEN_COLUMNS           // EC
+        9 , // ODD_COLUMNS            // OC
+        10, // BODY
+        11, // BACKGROUND             // BCKG
+        0 , // FIRST_ROW_START_COLUMN // FRSC
+        3 , // FIRST_ROW_END_COLUMN   // FRENC
+        12, // LAST_ROW_START_COLUMN  // LRSC
+        15, // LAST_ROW_END_COLUMN    // LRENC
+        2 , // FIRST_ROW_EVEN_COLUMN  // FREC
+        14, // LAST_ROW_EVEN_COLUMN   // LREC
+    };
+    return aTableTemplateMap;
 }
 
 sal_uInt8 SwTableAutoFormat::CountPos(sal_uInt32 nCol, sal_uInt32 nCols, sal_uInt32 nRow,
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index dfa37544339e..04bce461ed05 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -6965,20 +6965,20 @@ const Color SwPageFrame::GetDrawBackgrdColor() const
 /// create/return font used to paint the "empty page" string
 const vcl::Font& SwPageFrame::GetEmptyPageFont()
 {
-    static vcl::Font* pEmptyPgFont = nullptr;
-    if ( nullptr == pEmptyPgFont )
-    {
-        pEmptyPgFont = new vcl::Font;
-        pEmptyPgFont->SetFontSize( Size( 0, 80 * 20 )); // == 80 pt
-        pEmptyPgFont->SetWeight( WEIGHT_BOLD );
-        pEmptyPgFont->SetStyleName( aEmptyOUStr );
-        pEmptyPgFont->SetFamilyName("Helvetica");
-        pEmptyPgFont->SetFamily( FAMILY_SWISS );
-        pEmptyPgFont->SetTransparent( true );
-        pEmptyPgFont->SetColor( COL_GRAY );
-    }
-
-    return *pEmptyPgFont;
+    static vcl::Font aEmptyPgFont = [&]()
+    {
+        vcl::Font tmp;
+        tmp.SetFontSize( Size( 0, 80 * 20 )); // == 80 pt
+        tmp.SetWeight( WEIGHT_BOLD );
+        tmp.SetStyleName( aEmptyOUStr );
+        tmp.SetFamilyName("Helvetica");
+        tmp.SetFamily( FAMILY_SWISS );
+        tmp.SetTransparent( true );
+        tmp.SetColor( COL_GRAY );
+        return tmp;
+    }();
+
+    return aEmptyPgFont;
 }
 
 /**
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 3bee295c6bd9..310b9f045595 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -827,31 +827,31 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rInf, const SwLinePortion& r
     const SwFont* pOldFnt = rInf.GetFont();
 
     // Font is generated only once:
-    static SwFont* s_pFnt = nullptr;
-    if ( ! s_pFnt )
+    static SwFont s_aFnt = [&]()
     {
-        s_pFnt = new SwFont( *pOldFnt );
-        s_pFnt->SetFamily( FAMILY_DONTKNOW, s_pFnt->GetActual() );
-        s_pFnt->SetName( numfunc::GetDefBulletFontname(), s_pFnt->GetActual() );
-        s_pFnt->SetStyleName( aEmptyOUStr, s_pFnt->GetActual() );
-        s_pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, s_pFnt->GetActual() );
-    }
+        SwFont tmp( *pOldFnt );
+        tmp.SetFamily( FAMILY_DONTKNOW, tmp.GetActual() );
+        tmp.SetName( numfunc::GetDefBulletFontname(), tmp.GetActual() );
+        tmp.SetStyleName( aEmptyOUStr, tmp.GetActual() );
+        tmp.SetCharSet( RTL_TEXTENCODING_SYMBOL, tmp.GetActual() );
+        return tmp;
+    }();
 
     // Some of the current values are set at the font:
     if ( ! bRotate )
-        s_pFnt->SetVertical( 0, rInf.GetTextFrame()->IsVertical() );
+        s_aFnt.SetVertical( 0, rInf.GetTextFrame()->IsVertical() );
     else
-        s_pFnt->SetVertical( pOldFnt->GetOrientation() );
+        s_aFnt.SetVertical( pOldFnt->GetOrientation() );
 
-    s_pFnt->SetColor(rCol);
+    s_aFnt.SetColor(rCol);
 
     Size aFontSize( 0, SPECIAL_FONT_HEIGHT );
-    s_pFnt->SetSize( aFontSize, s_pFnt->GetActual() );
+    s_aFnt.SetSize( aFontSize, s_aFnt.GetActual() );
 
-    const_cast<SwTextPaintInfo&>(rInf).SetFont( s_pFnt );
+    const_cast<SwTextPaintInfo&>(rInf).SetFont( &s_aFnt );
 
     // The maximum width depends on the current orientation
-    const sal_uInt16 nDir = s_pFnt->GetOrientation( rInf.GetTextFrame()->IsVertical() );
+    const sal_uInt16 nDir = s_aFnt.GetOrientation( rInf.GetTextFrame()->IsVertical() );
     SwTwips nMaxWidth;
     if (nDir == 900 || nDir == 2700)
         nMaxWidth = rRect.Height();
@@ -870,14 +870,14 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rInf, const SwLinePortion& r
         const SwTwips nOldWidth = aFontSize.Width();
 
         // new height for font
-        const SwFontScript nAct = s_pFnt->GetActual();
-        aFontSize.setHeight( ( 100 * s_pFnt->GetSize( nAct ).Height() ) / nFactor );
-        aFontSize.setWidth( ( 100 * s_pFnt->GetSize( nAct).Width() ) / nFactor );
+        const SwFontScript nAct = s_aFnt.GetActual();
+        aFontSize.setHeight( ( 100 * s_aFnt.GetSize( nAct ).Height() ) / nFactor );
+        aFontSize.setWidth( ( 100 * s_aFnt.GetSize( nAct).Width() ) / nFactor );
 
         if ( !aFontSize.Width() && !aFontSize.Height() )
             break;
 
-        s_pFnt->SetSize( aFontSize, nAct );
+        s_aFnt.SetSize( aFontSize, nAct );
 
         aFontSize = rInf.GetTextSize( aTmp ).SvLSize();
 
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index da9601045cca..c8d45a1b8757 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2068,8 +2068,7 @@ SwXTextCursor::getPropertySetInfo()
 {
     SolarMutexGuard g;
 
-    static uno::Reference< beans::XPropertySetInfo >  xRef;
-    if(!xRef.is())
+    static uno::Reference< beans::XPropertySetInfo >  xRef = [&]()
     {
         static SfxItemPropertyMapEntry const aCursorExtMap_Impl[] =
         {
@@ -2081,10 +2080,10 @@ SwXTextCursor::getPropertySetInfo()
             m_pImpl->m_rPropSet.getPropertySetInfo();
         // extend PropertySetInfo!
         const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
-        xRef = new SfxExtItemPropertySetInfo(
+        return new SfxExtItemPropertySetInfo(
             aCursorExtMap_Impl,
             aPropSeq );
-    }
+    }();
     return xRef;
 }
 
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 1fc47bd59ce7..8ce993467596 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -4331,30 +4331,26 @@ void SwXTextTableStyle::UpdateCellStylesMapping()
 
 const CellStyleNameMap& SwXTextTableStyle::GetCellStyleNameMap()
 {
-    static CellStyleNameMap aMap;
-    if(aMap.empty())
-    {
-        CellStyleNameMap aNewMap;
-        aNewMap[ "first-row"    ] = FIRST_ROW_STYLE;
-        aNewMap[ "last-row"     ] = LAST_ROW_STYLE;
-        aNewMap[ "first-column" ] = FIRST_COLUMN_STYLE;
-        aNewMap[ "last-column"  ] = LAST_COLUMN_STYLE;
-        aNewMap[ "body"         ] = BODY_STYLE;
-        aNewMap[ "even-rows"    ] = EVEN_ROWS_STYLE;
-        aNewMap[ "odd-rows"     ] = ODD_ROWS_STYLE;
-        aNewMap[ "even-columns" ] = EVEN_COLUMNS_STYLE;
-        aNewMap[ "odd-columns"  ] = ODD_COLUMNS_STYLE;
-        aNewMap[ "background"   ] = BACKGROUND_STYLE;
+    static CellStyleNameMap const aMap
+    {
+        { "first-row"     , FIRST_ROW_STYLE },
+        { "last-row"      , LAST_ROW_STYLE },
+        { "first-column"  , FIRST_COLUMN_STYLE },
+        { "last-column"   , LAST_COLUMN_STYLE },
+        { "body"          , BODY_STYLE },
+        { "even-rows"     , EVEN_ROWS_STYLE },
+        { "odd-rows"      , ODD_ROWS_STYLE },
+        { "even-columns"  , EVEN_COLUMNS_STYLE },
+        { "odd-columns"   , ODD_COLUMNS_STYLE },
+        { "background"    , BACKGROUND_STYLE },
         // loext namespace
-        aNewMap[ "first-row-start-column" ] = FIRST_ROW_START_COLUMN_STYLE;
-        aNewMap[ "first-row-end-column"   ] = FIRST_ROW_END_COLUMN_STYLE;
-        aNewMap[ "last-row-start-column"  ] = LAST_ROW_START_COLUMN_STYLE;
-        aNewMap[ "last-row-end-column"    ] = LAST_ROW_END_COLUMN_STYLE;
-        aNewMap[ "first-row-even-column"  ] = FIRST_ROW_EVEN_COLUMN_STYLE;
-        aNewMap[ "last-row-even-column"   ] = LAST_ROW_EVEN_COLUMN_STYLE;
-
-        aMap.swap(aNewMap);
-    }
+        { "first-row-start-column"  , FIRST_ROW_START_COLUMN_STYLE },
+        { "first-row-end-column"    , FIRST_ROW_END_COLUMN_STYLE },
+        { "last-row-start-column"   , LAST_ROW_START_COLUMN_STYLE },
+        { "last-row-end-column"     , LAST_ROW_END_COLUMN_STYLE },
+        { "first-row-even-column"   , FIRST_ROW_EVEN_COLUMN_STYLE },
+        { "last-row-even-column"    , LAST_ROW_EVEN_COLUMN_STYLE },
+    };
     return aMap;
 }
 
@@ -4731,10 +4727,8 @@ css::uno::Reference<css::style::XStyle> SwXTextCellStyle::CreateXTextCellStyle(S
         if (!pBoxFormat)
         {
             // return a default-dummy style to prevent crash
-            static SwBoxAutoFormat* pDefaultBoxFormat;
-            if (!pDefaultBoxFormat)
-                pDefaultBoxFormat = new SwBoxAutoFormat();
-            pBoxFormat = pDefaultBoxFormat;
+            static SwBoxAutoFormat aDefaultBoxFormat;
+            pBoxFormat = &aDefaultBoxFormat;
         }
 
         xTextCellStyle.set(pBoxFormat->GetXObject(), uno::UNO_QUERY);
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index a66ee1d8631e..f88e1389bcf8 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -807,15 +807,15 @@ sal_Int64 SAL_CALL SwXCell::getSomething( const uno::Sequence< sal_Int8 >& rId )
 
 uno::Sequence< uno::Type > SAL_CALL SwXCell::getTypes(  )
 {
-    static uno::Sequence< uno::Type > aRetTypes;
-
-    if(aRetTypes.getLength())
-        return aRetTypes;
-    const auto& rCellTypes = SwXCellBaseClass::getTypes();
-    const auto& rTextTypes = SwXText::getTypes();
-    aRetTypes = uno::Sequence<uno::Type>(rCellTypes.getLength() + rTextTypes.getLength());
-    std::copy_n(rCellTypes.begin(), rCellTypes.getLength(), aRetTypes.begin());
-    std::copy_n(rTextTypes.begin(), rTextTypes.getLength(), aRetTypes.begin()+rCellTypes.getLength());
+    static uno::Sequence< uno::Type > aRetTypes = [&]()
+    {
+        const auto& rCellTypes = SwXCellBaseClass::getTypes();
+        const auto& rTextTypes = SwXText::getTypes();
+        auto tmp = uno::Sequence<uno::Type>(rCellTypes.getLength() + rTextTypes.getLength());
+        std::copy_n(rCellTypes.begin(), rCellTypes.getLength(), tmp.begin());
+        std::copy_n(rTextTypes.begin(), rTextTypes.getLength(), tmp.begin()+rCellTypes.getLength());
+        return tmp;
+    }();
     return aRetTypes;
 }
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c576fec3ec09..016851c4d892 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5686,20 +5686,19 @@ static bool lcl_guessQFormat(const OUString& rName, sal_uInt16 nWwId)
             nWwId == ww::stiEmphasis )
         return true;
 
-    static std::set<OUString, OUStringIgnoreCase> aWhitelist;
-    if (aWhitelist.empty())
-    {
-        aWhitelist.insert("No Spacing");
-        aWhitelist.insert("List Paragraph");
-        aWhitelist.insert("Quote");
-        aWhitelist.insert("Intense Quote");
-        aWhitelist.insert("Subtle Emphasis,");
-        aWhitelist.insert("Intense Emphasis");
-        aWhitelist.insert("Subtle Reference");
-        aWhitelist.insert("Intense Reference");
-        aWhitelist.insert("Book Title");
-        aWhitelist.insert("TOC Heading");
-    }
+    static std::set<OUString, OUStringIgnoreCase> const aWhitelist
+    {
+        "No Spacing",
+        "List Paragraph",
+        "Quote",
+        "Intense Quote",
+        "Subtle Emphasis,",
+        "Intense Emphasis",
+        "Subtle Reference",
+        "Intense Reference",
+        "Book Title",
+        "TOC Heading",
+    };
     // Not custom style? Then we have a list of standard styles which should be qFormat.
     return aWhitelist.find(rName) != aWhitelist.end();
 }
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 278f0d7178ec..4b804ebee59e 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -756,10 +756,9 @@ IMPL_LINK_NOARG(SwInsertDBColAutoPilot, TableFormatHdl, Button*, void)
         pTableSet->Put( SwPtrItem( FN_TABLE_REP, pRep.get() ));
     }
 
-    SwAbstractDialogFactory* pFact = swui::GetFactory();
-    OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+    SwAbstractDialogFactory& rFact = swui::GetFactory();
 
-    ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwTableTabDlg(GetFrameWeld(), pTableSet.get(), &rSh));
+    ScopedVclPtr<SfxAbstractTabDialog> pDlg(rFact.CreateSwTableTabDlg(GetFrameWeld(), pTableSet.get(), &rSh));
     if( RET_OK == pDlg->Execute() )
         pTableSet->Put( *pDlg->GetOutputItemSet() );
     else if( bNewSet )
@@ -771,10 +770,9 @@ IMPL_LINK_NOARG(SwInsertDBColAutoPilot, TableFormatHdl, Button*, void)
 
 IMPL_LINK( SwInsertDBColAutoPilot, AutoFormatHdl, Button*, pButton, void )
 {
-    SwAbstractDialogFactory* pFact = swui::GetFactory();
-    OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+    SwAbstractDialogFactory& rFact = swui::GetFactory();
 
-    ScopedVclPtr<AbstractSwAutoFormatDlg> pDlg(pFact->CreateSwAutoFormatDlg(pButton->GetFrameWeld(), pView->GetWrtShellPtr(), false, m_xTAutoFormat.get()));
+    ScopedVclPtr<AbstractSwAutoFormatDlg> pDlg(rFact.CreateSwAutoFormatDlg(pButton->GetFrameWeld(), pView->GetWrtShellPtr(), false, m_xTAutoFormat.get()));
     if( RET_OK == pDlg->Execute())
         m_xTAutoFormat.reset(pDlg->FillAutoFormatOfIndex());
 }
diff --git a/sw/source/ui/dialog/swuiexp.cxx b/sw/source/ui/dialog/swuiexp.cxx
index ba351e57ced5..c016cc6189a4 100644
--- a/sw/source/ui/dialog/swuiexp.cxx
+++ b/sw/source/ui/dialog/swuiexp.cxx
@@ -52,12 +52,10 @@
 
 namespace swui
 {
-    static SwAbstractDialogFactory_Impl* pFactory=nullptr;
-    SwAbstractDialogFactory * GetFactory()
+    SwAbstractDialogFactory& GetFactory()
     {
-        if ( !pFactory )
-            pFactory = new SwAbstractDialogFactory_Impl;
-        return pFactory;
+        static SwAbstractDialogFactory_Impl aFactory;
+        return aFactory;
     }
 }
 
@@ -65,7 +63,7 @@ extern "C"
 {
     SAL_DLLPUBLIC_EXPORT SwAbstractDialogFactory* SwCreateDialogFactory()
     {
-        return ::swui::GetFactory();
+        return &::swui::GetFactory();
     }
 }
 
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 7c2ca553fc69..061a778b8780 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -250,11 +250,10 @@ void SwEnvFormatPage::Edit(const OString& rIdent, bool bSender)
         SfxAllItemSet aTmpSet(*pCollSet);
         ::ConvertAttrCharToGen(aTmpSet);
 
-        SwAbstractDialogFactory* pFact = swui::GetFactory();
-        OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+        SwAbstractDialogFactory& rFact = swui::GetFactory();
 
         const OUString sFormatStr = pColl->GetName();
-        ScopedVclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSwCharDlg(GetDialogFrameWeld(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr));
+        ScopedVclPtr<SfxAbstractTabDialog> pDlg(rFact.CreateSwCharDlg(GetDialogFrameWeld(), pSh->GetView(), aTmpSet, SwCharDlgMode::Env, &sFormatStr));
         if (pDlg->Execute() == RET_OK)
         {
             SfxItemSet aOutputSet( *pDlg->GetOutputItemSet() );
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
index 2f4dfe8020bb..dfbb9e08183e 100644
--- a/sw/source/ui/fldui/fldedt.cxx
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -328,10 +328,9 @@ IMPL_LINK_NOARG(SwFieldEditDlg, AddressHdl, Button*, void)
 
     }
     aSet.Put(SfxUInt16Item(SID_FIELD_GRABFOCUS, static_cast<sal_uInt16>(nEditPos)));
-    SwAbstractDialogFactory* pFact = swui::GetFactory();
-    OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+    SwAbstractDialogFactory& rFact = swui::GetFactory();
 
-    ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateSwAddressAbstractDlg(this, aSet));
+    ScopedVclPtr<SfxAbstractDialog> pDlg(rFact.CreateSwAddressAbstractDlg(this, aSet));
     if (RET_OK == pDlg->Execute())
     {
         pSh->UpdateFields( *pCurField );
diff --git a/sw/source/ui/inc/swuiexp.hxx b/sw/source/ui/inc/swuiexp.hxx
index 6e9993b0717f..226127c5e595 100644
--- a/sw/source/ui/inc/swuiexp.hxx
+++ b/sw/source/ui/inc/swuiexp.hxx
@@ -21,7 +21,7 @@
 
 namespace swui
 {
-    SwAbstractDialogFactory * GetFactory();
+    SwAbstractDialogFactory& GetFactory();
 }
 
 #endif
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 37eac609f416..fabcae7a521e 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -190,9 +190,8 @@ IMPL_LINK_NOARG(SwInsertBookmarkDlg, RenameHdl, Button*, void)
     uno::Reference<uno::XInterface> xTmp;
     aObj >>= xTmp;
     uno::Reference<container::XNamed> xNamed(xTmp, uno::UNO_QUERY);
-    SwAbstractDialogFactory* pFact = swui::GetFactory();
-    OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
-    ScopedVclPtr<AbstractSwRenameXNamedDlg> pDlg(pFact->CreateSwRenameXNamedDlg(GetFrameWeld(), xNamed, xNameAccess));
+    SwAbstractDialogFactory& rFact = swui::GetFactory();
+    ScopedVclPtr<AbstractSwRenameXNamedDlg> pDlg(rFact.CreateSwRenameXNamedDlg(GetFrameWeld(), xNamed, xNameAccess));
     pDlg->SetForbiddenChars(BookmarkTable::aForbiddenChars + OUStringLiteral1(BookmarkTable::cSeparator));
 
     if (pDlg->Execute())
diff --git a/sw/source/ui/table/convert.cxx b/sw/source/ui/table/convert.cxx
index 3fff72fbd012..6ac46df8eaae 100644
--- a/sw/source/ui/table/convert.cxx
+++ b/sw/source/ui/table/convert.cxx
@@ -171,10 +171,9 @@ SwConvertTableDlg::SwConvertTableDlg(SwView& rView, bool bToTable)
 
 IMPL_LINK_NOARG(SwConvertTableDlg, AutoFormatHdl, weld::Button&, void)
 {
-    SwAbstractDialogFactory* pFact = swui::GetFactory();
-    OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
+    SwAbstractDialogFactory& rFact = swui::GetFactory();
 
-    ScopedVclPtr<AbstractSwAutoFormatDlg> pDlg(pFact->CreateSwAutoFormatDlg(m_xDialog.get(), pShell, false, mxTAutoFormat.get()));
+    ScopedVclPtr<AbstractSwAutoFormatDlg> pDlg(rFact.CreateSwAutoFormatDlg(m_xDialog.get(), pShell, false, mxTAutoFormat.get()));
     if (RET_OK == pDlg->Execute())
         mxTAutoFormat.reset(pDlg->FillAutoFormatOfIndex());
 }
diff --git a/sw/source/ui/vba/vbaaddin.cxx b/sw/source/ui/vba/vbaaddin.cxx
index deb7734d3a6d..263619fbf539 100644
--- a/sw/source/ui/vba/vbaaddin.cxx
+++ b/sw/source/ui/vba/vbaaddin.cxx
@@ -83,12 +83,10 @@ SwVbaAddin::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaAddin::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Addin";
-    }
+        "ooo.vba.word.Addin"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbaaddins.cxx b/sw/source/ui/vba/vbaaddins.cxx
index a9c5e355bfc2..dc7e032a0563 100644
--- a/sw/source/ui/vba/vbaaddins.cxx
+++ b/sw/source/ui/vba/vbaaddins.cxx
@@ -88,12 +88,10 @@ SwVbaAddins::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaAddins::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Addins";
-    }
+        "ooo.vba.word.Addins"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx
index 8eacf19b6ae2..578a2b3d6c35 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -415,12 +415,10 @@ SwVbaApplication::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaApplication::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Application";
-    }
+        "ooo.vba.word.Application"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbaautotextentry.cxx b/sw/source/ui/vba/vbaautotextentry.cxx
index e6bd1fd457f3..c4207b826fa3 100644
--- a/sw/source/ui/vba/vbaautotextentry.cxx
+++ b/sw/source/ui/vba/vbaautotextentry.cxx
@@ -84,12 +84,10 @@ SwVbaAutoTextEntry::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaAutoTextEntry::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.AutoTextEntry";
-    }
+        "ooo.vba.word.AutoTextEntry"
+    };
     return aServiceNames;
 }
 
@@ -125,12 +123,10 @@ SwVbaAutoTextEntries::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaAutoTextEntries::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.AutoTextEntries";
-    }
+        "ooo.vba.word.AutoTextEntries"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbabookmark.cxx b/sw/source/ui/vba/vbabookmark.cxx
index 02a806413e7d..b3334ea57e7d 100644
--- a/sw/source/ui/vba/vbabookmark.cxx
+++ b/sw/source/ui/vba/vbabookmark.cxx
@@ -92,12 +92,10 @@ SwVbaBookmark::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaBookmark::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Bookmark";
-    }
+        "ooo.vba.word.Bookmark"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbabookmarks.cxx b/sw/source/ui/vba/vbabookmarks.cxx
index ca1cbe14ed01..82b813f43bba 100644
--- a/sw/source/ui/vba/vbabookmarks.cxx
+++ b/sw/source/ui/vba/vbabookmarks.cxx
@@ -215,12 +215,10 @@ SwVbaBookmarks::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaBookmarks::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Bookmarks";
-    }
+        "ooo.vba.word.Bookmarks"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbaborders.cxx b/sw/source/ui/vba/vbaborders.cxx
index 2b0d276a9138..f60dfc7152d6 100644
--- a/sw/source/ui/vba/vbaborders.cxx
+++ b/sw/source/ui/vba/vbaborders.cxx
@@ -139,12 +139,10 @@ protected:
 
     virtual css::uno::Sequence<OUString> getServiceNames() override
     {
-        static uno::Sequence< OUString > aServiceNames;
-        if ( aServiceNames.getLength() == 0 )
+        static uno::Sequence< OUString > const aServiceNames
         {
-            aServiceNames.realloc( 1 );
-            aServiceNames[ 0 ] = "ooo.vba.word.Border";
-        }
+            "ooo.vba.word.Border"
+        };
         return aServiceNames;
     }
 public:
@@ -351,12 +349,10 @@ SwVbaBorders::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaBorders::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Borders";
-    }
+        "ooo.vba.word.Borders"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbacell.cxx b/sw/source/ui/vba/vbacell.cxx
index 21b257b3cb48..2040e0b82d8d 100644
--- a/sw/source/ui/vba/vbacell.cxx
+++ b/sw/source/ui/vba/vbacell.cxx
@@ -97,12 +97,10 @@ SwVbaCell::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaCell::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Cell";
-    }
+        "ooo.vba.word.Cell"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbacells.cxx b/sw/source/ui/vba/vbacells.cxx
index cddf9c2fe2c1..6cc969d492e7 100644
--- a/sw/source/ui/vba/vbacells.cxx
+++ b/sw/source/ui/vba/vbacells.cxx
@@ -201,12 +201,10 @@ SwVbaCells::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaCells::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Cells";
-    }
+        "ooo.vba.word.Cells"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbacolumn.cxx b/sw/source/ui/vba/vbacolumn.cxx
index 676d93e1712f..5e6c4abe21df 100644
--- a/sw/source/ui/vba/vbacolumn.cxx
+++ b/sw/source/ui/vba/vbacolumn.cxx
@@ -84,12 +84,10 @@ SwVbaColumn::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaColumn::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Column";
-    }
+        "ooo.vba.word.Column"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbacolumns.cxx b/sw/source/ui/vba/vbacolumns.cxx
index 41a87cf6463e..e2049400efa6 100644
--- a/sw/source/ui/vba/vbacolumns.cxx
+++ b/sw/source/ui/vba/vbacolumns.cxx
@@ -138,12 +138,10 @@ SwVbaColumns::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaColumns::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Columns";
-    }
+        "ooo.vba.word.Columns"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbadialog.cxx b/sw/source/ui/vba/vbadialog.cxx
index 1a91e28cd50a..dae23e63f353 100644
--- a/sw/source/ui/vba/vbadialog.cxx
+++ b/sw/source/ui/vba/vbadialog.cxx
@@ -59,12 +59,10 @@ SwVbaDialog::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaDialog::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Dialog";
-    }
+        "ooo.vba.word.Dialog"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbadialogs.cxx b/sw/source/ui/vba/vbadialogs.cxx
index f4de6d75f8af..22c2c48c6a1d 100644
--- a/sw/source/ui/vba/vbadialogs.cxx
+++ b/sw/source/ui/vba/vbadialogs.cxx
@@ -41,12 +41,10 @@ SwVbaDialogs::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaDialogs::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Dialogs";
-    }
+        "ooo.vba.word.Dialogs"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx
index 557b5bb9ca1c..1fd1b3253b90 100644
--- a/sw/source/ui/vba/vbadocument.cxx
+++ b/sw/source/ui/vba/vbadocument.cxx
@@ -609,12 +609,10 @@ SwVbaDocumentOutgoingConnectionPoint::Unadvise( sal_uInt32 Cookie )
 uno::Sequence< OUString >
 SwVbaDocument::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Document";
-    }
+        "ooo.vba.word.Document"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx
index 130471a35d12..f9997f9f9a9c 100644
--- a/sw/source/ui/vba/vbadocumentproperties.cxx
+++ b/sw/source/ui/vba/vbadocumentproperties.cxx
@@ -625,12 +625,10 @@ SwVbaBuiltInDocumentProperty::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaBuiltInDocumentProperty::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.DocumentProperty";
-    }
+        "ooo.vba.word.DocumentProperty"
+    };
     return aServiceNames;
 }
 typedef ::cppu::WeakImplHelper< css::container::XIndexAccess
@@ -777,12 +775,10 @@ SwVbaBuiltinDocumentProperties::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaBuiltinDocumentProperties::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.DocumentProperties";
-    }
+        "ooo.vba.word.DocumentProperties"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx
index 968c0b7904df..4424a890cdfd 100644
--- a/sw/source/ui/vba/vbadocuments.cxx
+++ b/sw/source/ui/vba/vbadocuments.cxx
@@ -150,12 +150,10 @@ SwVbaDocuments::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaDocuments::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Documents";
-    }
+        "ooo.vba.word.Documents"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx
index 5b9f8802ecbd..14d5e5769a57 100644
--- a/sw/source/ui/vba/vbafield.cxx
+++ b/sw/source/ui/vba/vbafield.cxx
@@ -60,12 +60,10 @@ SwVbaField::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaField::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Field";
-    }
+        "ooo.vba.word.Field"
+    };
     return aServiceNames;
 }
 
@@ -518,12 +516,10 @@ SwVbaFields::getElementType()
 uno::Sequence<OUString>
 SwVbaFields::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Fields";
-    }
+        "ooo.vba.word.Fields"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbafind.cxx b/sw/source/ui/vba/vbafind.cxx
index 2620b441f365..c866c7c64774 100644
--- a/sw/source/ui/vba/vbafind.cxx
+++ b/sw/source/ui/vba/vbafind.cxx
@@ -398,12 +398,10 @@ SwVbaFind::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaFind::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Find";
-    }
+        "ooo.vba.word.Find"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbafont.cxx b/sw/source/ui/vba/vbafont.cxx
index 848dbc292f9e..a4748c8ce218 100644
--- a/sw/source/ui/vba/vbafont.cxx
+++ b/sw/source/ui/vba/vbafont.cxx
@@ -224,12 +224,10 @@ SwVbaFont::getShadow()
 uno::Sequence< OUString >
 SwVbaFont::getServiceNames()
 {
-        static uno::Sequence< OUString > aServiceNames;
-        if ( aServiceNames.getLength() == 0 )
+        static uno::Sequence< OUString > const aServiceNames
         {
-                aServiceNames.realloc( 1 );
-                aServiceNames[ 0 ] = "ooo.vba.word.Font";
-        }
+            "ooo.vba.word.Font"
+        };
         return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbaframe.cxx b/sw/source/ui/vba/vbaframe.cxx
index 656fc9a6f699..c59994faed16 100644
--- a/sw/source/ui/vba/vbaframe.cxx
+++ b/sw/source/ui/vba/vbaframe.cxx
@@ -52,12 +52,10 @@ SwVbaFrame::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaFrame::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Frame";
-    }
+        "ooo.vba.word.Frame"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbaframes.cxx b/sw/source/ui/vba/vbaframes.cxx
index 7951b83ccb56..f414fdb8ee5d 100644
--- a/sw/source/ui/vba/vbaframes.cxx
+++ b/sw/source/ui/vba/vbaframes.cxx
@@ -88,12 +88,10 @@ SwVbaFrames::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaFrames::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Frames";
-    }
+        "ooo.vba.word.Frames"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbaglobals.cxx b/sw/source/ui/vba/vbaglobals.cxx
index 40e95e467dbe..a85f0c767cff 100644
--- a/sw/source/ui/vba/vbaglobals.cxx
+++ b/sw/source/ui/vba/vbaglobals.cxx
@@ -144,34 +144,25 @@ SwVbaGlobals::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaGlobals::getServiceNames()
 {
-        static uno::Sequence< OUString > aServiceNames;
-        if ( aServiceNames.getLength() == 0 )
+        static uno::Sequence< OUString > const aServiceNames
         {
-                aServiceNames.realloc( 1 );
-                aServiceNames[ 0 ] = "ooo.vba.word.Globals";
-        }
+            "ooo.vba.word.Globals"
+        };
         return aServiceNames;
 }
 
 uno::Sequence< OUString >
 SwVbaGlobals::getAvailableServiceNames(  )
 {
-    static bool bInit = false;
-    static uno::Sequence< OUString > serviceNames( SwVbaGlobals_BASE::getAvailableServiceNames() );
-    if ( !bInit )
+    static uno::Sequence< OUString > const serviceNames = [&]()
     {
-         OUString names[] = {
-            OUString( "ooo.vba.word.Document" ),
+        uno::Sequence< OUString > tmp = SwVbaGlobals_BASE::getAvailableServiceNames();
+        tmp.realloc( tmp.getLength() + 1 );
+        tmp[ tmp.getLength() - 1 ] = "ooo.vba.word.Document";
 //            #FIXME #TODO make Application a proper service
 //            OUString( "ooo.vba.word.Application" ),
-        };
-        sal_Int32 nWordServices = SAL_N_ELEMENTS( names );
-        sal_Int32 startIndex = serviceNames.getLength();
-        serviceNames.realloc( serviceNames.getLength() + nWordServices );
-        for ( sal_Int32 index = 0; index < nWordServices; ++index )
-             serviceNames[ startIndex + index ] = names[ index ];
-        bInit = true;
-    }
+        return tmp;
+    }();
     return serviceNames;
 }
 
diff --git a/sw/source/ui/vba/vbaheaderfooter.cxx b/sw/source/ui/vba/vbaheaderfooter.cxx
index 21bd2debe849..e5feadede78f 100644
--- a/sw/source/ui/vba/vbaheaderfooter.cxx
+++ b/sw/source/ui/vba/vbaheaderfooter.cxx
@@ -92,12 +92,10 @@ SwVbaHeaderFooter::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaHeaderFooter::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Pane";
-    }
+        "ooo.vba.word.Pane"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbaheadersfooters.cxx b/sw/source/ui/vba/vbaheadersfooters.cxx
index 1d8a10563273..e3b67babd090 100644
--- a/sw/source/ui/vba/vbaheadersfooters.cxx
+++ b/sw/source/ui/vba/vbaheadersfooters.cxx
@@ -127,12 +127,10 @@ SwVbaHeadersFooters::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaHeadersFooters::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.HeadersFooters";
-    }
+        "ooo.vba.word.HeadersFooters"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbalistformat.cxx b/sw/source/ui/vba/vbalistformat.cxx
index 25c8a8ab0426..8fb67d9dda76 100644
--- a/sw/source/ui/vba/vbalistformat.cxx
+++ b/sw/source/ui/vba/vbalistformat.cxx
@@ -101,12 +101,10 @@ SwVbaListFormat::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaListFormat::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.ListFormat";
-    }
+        "ooo.vba.word.ListFormat"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbalistgalleries.cxx b/sw/source/ui/vba/vbalistgalleries.cxx
index 1627631ec39d..6a2895417a85 100644
--- a/sw/source/ui/vba/vbalistgalleries.cxx
+++ b/sw/source/ui/vba/vbalistgalleries.cxx
@@ -93,12 +93,10 @@ SwVbaListGalleries::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaListGalleries::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.ListGalleries";
-    }
+        "ooo.vba.word.ListGalleries"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbalistgallery.cxx b/sw/source/ui/vba/vbalistgallery.cxx
index f41dcbd639d3..0312755f5b04 100644
--- a/sw/source/ui/vba/vbalistgallery.cxx
+++ b/sw/source/ui/vba/vbalistgallery.cxx
@@ -50,12 +50,10 @@ SwVbaListGallery::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaListGallery::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.ListGallery";
-    }
+        "ooo.vba.word.ListGallery"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbalistlevel.cxx b/sw/source/ui/vba/vbalistlevel.cxx
index b7ef212d2864..5754566b7a5f 100644
--- a/sw/source/ui/vba/vbalistlevel.cxx
+++ b/sw/source/ui/vba/vbalistlevel.cxx
@@ -377,12 +377,10 @@ SwVbaListLevel::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaListLevel::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.ListLevel";
-    }
+        "ooo.vba.word.ListLevel"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbalistlevels.cxx b/sw/source/ui/vba/vbalistlevels.cxx
index b92fdd29cfb7..d6cefff1385f 100644
--- a/sw/source/ui/vba/vbalistlevels.cxx
+++ b/sw/source/ui/vba/vbalistlevels.cxx
@@ -96,12 +96,10 @@ SwVbaListLevels::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaListLevels::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.ListLevels";
-    }
+        "ooo.vba.word.ListLevels"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbalisttemplate.cxx b/sw/source/ui/vba/vbalisttemplate.cxx
index 97ea48983fc3..b94a24d43e01 100644
--- a/sw/source/ui/vba/vbalisttemplate.cxx
+++ b/sw/source/ui/vba/vbalisttemplate.cxx
@@ -58,12 +58,10 @@ SwVbaListTemplate::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaListTemplate::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.ListTemplate";
-    }
+        "ooo.vba.word.ListTemplate"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbalisttemplates.cxx b/sw/source/ui/vba/vbalisttemplates.cxx
index 84a979301901..2983a987b798 100644
--- a/sw/source/ui/vba/vbalisttemplates.cxx
+++ b/sw/source/ui/vba/vbalisttemplates.cxx
@@ -90,12 +90,10 @@ SwVbaListTemplates::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaListTemplates::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.ListTemplates";
-    }
+        "ooo.vba.word.ListTemplates"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbamailmerge.cxx b/sw/source/ui/vba/vbamailmerge.cxx
index 48973f80963f..dfcbad372f76 100644
--- a/sw/source/ui/vba/vbamailmerge.cxx
+++ b/sw/source/ui/vba/vbamailmerge.cxx
@@ -49,12 +49,7 @@ OUString SwVbaMailMerge::getServiceImplName() { return OUString("SwVbaMailMerge"
 
 css::uno::Sequence<OUString> SwVbaMailMerge::getServiceNames()
 {
-    static css::uno::Sequence<OUString> aServiceNames;
-    if (aServiceNames.getLength() == 0)
-    {
-        aServiceNames.realloc(1);
-        aServiceNames[0] = "ooo.vba.word.MailMerge";
-    }
+    static css::uno::Sequence<OUString> const aServiceNames{ "ooo.vba.word.MailMerge" };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbaoptions.cxx b/sw/source/ui/vba/vbaoptions.cxx
index dcf505a8adb7..3c5ec99192ff 100644
--- a/sw/source/ui/vba/vbaoptions.cxx
+++ b/sw/source/ui/vba/vbaoptions.cxx
@@ -266,12 +266,10 @@ SwVbaOptions::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaOptions::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Options";
-    }
+        "ooo.vba.word.Options"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbapagesetup.cxx b/sw/source/ui/vba/vbapagesetup.cxx
index e8f7bbbd8e70..f859180a2c28 100644
--- a/sw/source/ui/vba/vbapagesetup.cxx
+++ b/sw/source/ui/vba/vbapagesetup.cxx
@@ -253,12 +253,10 @@ SwVbaPageSetup::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaPageSetup::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.PageSetup";
-    }
+        "ooo.vba.word.PageSetup"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbapane.cxx b/sw/source/ui/vba/vbapane.cxx
index 118538da3263..48b0bb2b16ac 100644
--- a/sw/source/ui/vba/vbapane.cxx
+++ b/sw/source/ui/vba/vbapane.cxx
@@ -56,12 +56,10 @@ SwVbaPane::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaPane::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Pane";
-    }
+        "ooo.vba.word.Pane"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbapanes.cxx b/sw/source/ui/vba/vbapanes.cxx
index 28edd7be2985..3124049890ef 100644
--- a/sw/source/ui/vba/vbapanes.cxx
+++ b/sw/source/ui/vba/vbapanes.cxx
@@ -104,12 +104,10 @@ SwVbaPanes::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaPanes::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Panes";
-    }
+        "ooo.vba.word.Panes"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbaparagraph.cxx b/sw/source/ui/vba/vbaparagraph.cxx
index 42db168edb41..ff81be8bb37c 100644
--- a/sw/source/ui/vba/vbaparagraph.cxx
+++ b/sw/source/ui/vba/vbaparagraph.cxx
@@ -64,12 +64,10 @@ SwVbaParagraph::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaParagraph::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Paragraph";
-    }
+        "ooo.vba.word.Paragraph"
+    };
     return aServiceNames;
 }
 
@@ -168,12 +166,10 @@ SwVbaParagraphs::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaParagraphs::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Paragraphs";
-    }
+        "ooo.vba.word.Paragraphs"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbaparagraphformat.cxx b/sw/source/ui/vba/vbaparagraphformat.cxx
index 33f16d6f9d55..6c87d194bb13 100644
--- a/sw/source/ui/vba/vbaparagraphformat.cxx
+++ b/sw/source/ui/vba/vbaparagraphformat.cxx
@@ -556,12 +556,10 @@ SwVbaParagraphFormat::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaParagraphFormat::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.ParagraphFormat";
-    }
+        "ooo.vba.word.ParagraphFormat"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbarange.cxx b/sw/source/ui/vba/vbarange.cxx
index bb1a9fde7fbc..a187c78813c0 100644
--- a/sw/source/ui/vba/vbarange.cxx
+++ b/sw/source/ui/vba/vbarange.cxx
@@ -418,12 +418,10 @@ SwVbaRange::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaRange::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Range";
-    }
+        "ooo.vba.word.Range"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbareplacement.cxx b/sw/source/ui/vba/vbareplacement.cxx
index c0de490dc483..4bc8ce98bb9c 100644
--- a/sw/source/ui/vba/vbareplacement.cxx
+++ b/sw/source/ui/vba/vbareplacement.cxx
@@ -57,12 +57,10 @@ SwVbaReplacement::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaReplacement::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Replacement";
-    }
+        "ooo.vba.word.Replacement"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbarevision.cxx b/sw/source/ui/vba/vbarevision.cxx
index a82c5a5f59db..dc2fc81b0b4d 100644
--- a/sw/source/ui/vba/vbarevision.cxx
+++ b/sw/source/ui/vba/vbarevision.cxx
@@ -84,12 +84,10 @@ SwVbaRevision::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaRevision::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Revision";
-    }
+        "ooo.vba.word.Revision"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbarevisions.cxx b/sw/source/ui/vba/vbarevisions.cxx
index 223e523c1c56..10ddb2c3f90f 100644
--- a/sw/source/ui/vba/vbarevisions.cxx
+++ b/sw/source/ui/vba/vbarevisions.cxx
@@ -164,12 +164,10 @@ SwVbaRevisions::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaRevisions::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Revisions";
-    }
+        "ooo.vba.word.Revisions"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbarow.cxx b/sw/source/ui/vba/vbarow.cxx
index dac431539e3c..2a0cd0fd8054 100644
--- a/sw/source/ui/vba/vbarow.cxx
+++ b/sw/source/ui/vba/vbarow.cxx
@@ -112,12 +112,10 @@ SwVbaRow::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaRow::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Row";
-    }
+        "ooo.vba.word.Row"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx
index 4b9b98ce66f1..839a5021e870 100644
--- a/sw/source/ui/vba/vbarows.cxx
+++ b/sw/source/ui/vba/vbarows.cxx
@@ -355,12 +355,10 @@ SwVbaRows::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaRows::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Rows";
-    }
+        "ooo.vba.word.Rows"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbasection.cxx b/sw/source/ui/vba/vbasection.cxx
index bce9b3769dc1..024c51023509 100644
--- a/sw/source/ui/vba/vbasection.cxx
+++ b/sw/source/ui/vba/vbasection.cxx
@@ -74,12 +74,10 @@ SwVbaSection::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaSection::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Section";
-    }
+        "ooo.vba.word.Section"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbasections.cxx b/sw/source/ui/vba/vbasections.cxx
index 74f5b7bb05a0..a134af69ed0f 100644
--- a/sw/source/ui/vba/vbasections.cxx
+++ b/sw/source/ui/vba/vbasections.cxx
@@ -181,12 +181,10 @@ SwVbaSections::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaSections::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Sections";
-    }
+        "ooo.vba.word.Sections"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx
index 55e16e70490b..f8b5206866db 100644
--- a/sw/source/ui/vba/vbaselection.cxx
+++ b/sw/source/ui/vba/vbaselection.cxx
@@ -1159,12 +1159,10 @@ SwVbaSelection::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaSelection::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Selection";
-    }
+        "ooo.vba.word.Selection"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbastyle.cxx b/sw/source/ui/vba/vbastyle.cxx
index 103a9b15d7f3..6f0c88f7a0a7 100644
--- a/sw/source/ui/vba/vbastyle.cxx
+++ b/sw/source/ui/vba/vbastyle.cxx
@@ -218,12 +218,10 @@ SwVbaStyle::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaStyle::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.XStyle";
-    }
+        "ooo.vba.word.XStyle"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbastyles.cxx b/sw/source/ui/vba/vbastyles.cxx
index 9f7de35ddf57..e247f0128116 100644
--- a/sw/source/ui/vba/vbastyles.cxx
+++ b/sw/source/ui/vba/vbastyles.cxx
@@ -358,12 +358,10 @@ SwVbaStyles::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaStyles::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.XStyles";
-    }
+        "ooo.vba.word.XStyles"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbasystem.cxx b/sw/source/ui/vba/vbasystem.cxx
index 035628818564..2ee7a68d8a1d 100644
--- a/sw/source/ui/vba/vbasystem.cxx
+++ b/sw/source/ui/vba/vbasystem.cxx
@@ -268,12 +268,10 @@ SwVbaSystem::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaSystem::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.System";
-    }
+        "ooo.vba.word.System"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbatable.cxx b/sw/source/ui/vba/vbatable.cxx
index 488ba6583a1d..5629a848edbd 100644
--- a/sw/source/ui/vba/vbatable.cxx
+++ b/sw/source/ui/vba/vbatable.cxx
@@ -118,12 +118,10 @@ SwVbaTable::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaTable::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Table";
-    }
+        "ooo.vba.word.Table"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbatableofcontents.cxx b/sw/source/ui/vba/vbatableofcontents.cxx
index 778c8cfdf5d6..1c1e7ff2a9fb 100644
--- a/sw/source/ui/vba/vbatableofcontents.cxx
+++ b/sw/source/ui/vba/vbatableofcontents.cxx
@@ -102,12 +102,10 @@ SwVbaTableOfContents::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaTableOfContents::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.TableOfContents";
-    }
+        "ooo.vba.word.TableOfContents"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbatables.cxx b/sw/source/ui/vba/vbatables.cxx
index eb9b4441de89..3c431a1fa928 100644
--- a/sw/source/ui/vba/vbatables.cxx
+++ b/sw/source/ui/vba/vbatables.cxx
@@ -221,12 +221,10 @@ SwVbaTables::getElementType()
 uno::Sequence<OUString>
 SwVbaTables::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Tables";
-    }
+        "ooo.vba.word.Tables"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbatablesofcontents.cxx b/sw/source/ui/vba/vbatablesofcontents.cxx
index 13b171337481..5c0616f8212b 100644
--- a/sw/source/ui/vba/vbatablesofcontents.cxx
+++ b/sw/source/ui/vba/vbatablesofcontents.cxx
@@ -170,12 +170,10 @@ SwVbaTablesOfContents::getServiceImplName()
 uno::Sequence<OUString>
 SwVbaTablesOfContents::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.TablesOfContents";
-    }
+        "ooo.vba.word.TablesOfContents"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbatabstop.cxx b/sw/source/ui/vba/vbatabstop.cxx
index bce16115a332..38d4cfdba583 100644
--- a/sw/source/ui/vba/vbatabstop.cxx
+++ b/sw/source/ui/vba/vbatabstop.cxx
@@ -40,12 +40,10 @@ SwVbaTabStop::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaTabStop::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.TabStop";
-    }
+        "ooo.vba.word.TabStop"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbatabstops.cxx b/sw/source/ui/vba/vbatabstops.cxx
index fbcddca22ba6..0c2ee09dea33 100644
--- a/sw/source/ui/vba/vbatabstops.cxx
+++ b/sw/source/ui/vba/vbatabstops.cxx
@@ -258,12 +258,10 @@ SwVbaTabStops::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaTabStops::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.TabStops";
-    }
+        "ooo.vba.word.TabStops"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbatemplate.cxx b/sw/source/ui/vba/vbatemplate.cxx
index c33cdb000b8d..60eb84befbce 100644
--- a/sw/source/ui/vba/vbatemplate.cxx
+++ b/sw/source/ui/vba/vbatemplate.cxx
@@ -121,12 +121,10 @@ SwVbaTemplate::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaTemplate::getServiceNames()
 {
-        static uno::Sequence< OUString > aServiceNames;
-        if ( aServiceNames.getLength() == 0 )
+        static uno::Sequence< OUString > const aServiceNames
         {
-                aServiceNames.realloc( 1 );
-                aServiceNames[ 0 ] = "ooo.vba.word.Template";
-        }
+            "ooo.vba.word.Template"
+        };
         return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbavariable.cxx b/sw/source/ui/vba/vbavariable.cxx
index 01cacf146851..e28e959790d9 100644
--- a/sw/source/ui/vba/vbavariable.cxx
+++ b/sw/source/ui/vba/vbavariable.cxx
@@ -84,12 +84,10 @@ SwVbaVariable::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaVariable::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Variable";
-    }
+        "ooo.vba.word.Variable"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbavariables.cxx b/sw/source/ui/vba/vbavariables.cxx
index eac1278452b6..919b5d07c268 100644
--- a/sw/source/ui/vba/vbavariables.cxx
+++ b/sw/source/ui/vba/vbavariables.cxx
@@ -84,12 +84,10 @@ SwVbaVariables::getServiceImplName()
 css::uno::Sequence<OUString>
 SwVbaVariables::getServiceNames()
 {
-    static uno::Sequence< OUString > sNames;
-    if ( sNames.getLength() == 0 )
+    static uno::Sequence< OUString > const sNames
     {
-        sNames.realloc( 1 );
-        sNames[0] = "ooo.vba.word.Variables";
-    }
+        "ooo.vba.word.Variables"
+    };
     return sNames;
 }
 
diff --git a/sw/source/ui/vba/vbaview.cxx b/sw/source/ui/vba/vbaview.cxx
index 49e5076c89f3..372f8e614118 100644
--- a/sw/source/ui/vba/vbaview.cxx
+++ b/sw/source/ui/vba/vbaview.cxx
@@ -380,12 +380,10 @@ SwVbaView::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaView::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.View";
-    }
+        "ooo.vba.word.View"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbawindow.cxx b/sw/source/ui/vba/vbawindow.cxx
index aba495a199b8..fc914cc5769b 100644
--- a/sw/source/ui/vba/vbawindow.cxx
+++ b/sw/source/ui/vba/vbawindow.cxx
@@ -169,12 +169,10 @@ SwVbaWindow::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaWindow::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.Window";
-    }
+        "ooo.vba.word.Window"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/ui/vba/vbawrapformat.cxx b/sw/source/ui/vba/vbawrapformat.cxx
index 0d161b2ab4b2..a0e63b325657 100644
--- a/sw/source/ui/vba/vbawrapformat.cxx
+++ b/sw/source/ui/vba/vbawrapformat.cxx
@@ -227,12 +227,10 @@ SwVbaWrapFormat::getServiceImplName()
 uno::Sequence< OUString >
 SwVbaWrapFormat::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.word.WrapFormat";
-    }
+        "ooo.vba.word.WrapFormat"
+    };
     return aServiceNames;
 }
 
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 350f25f87b9e..20f7d59ad734 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -218,13 +218,8 @@ OUString SwModuleOptions::ConvertWordDelimiter(const OUString& rDelim, bool bFro
 
 const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
 {
-    static Sequence<OUString> aNames;
-    if(!aNames.getLength())
+    static Sequence<OUString> const aNames
     {
-        const int nCount = 8;
-        aNames.realloc(nCount);
-        static const char* aPropNames[] =
-        {
             "TextDisplay/Insert/Attribute",             // 0
             "TextDisplay/Insert/Color",                 // 1
             "TextDisplay/Delete/Attribute",             // 2
@@ -233,11 +228,7 @@ const Sequence<OUString>& SwRevisionConfig::GetPropertyNames()
             "TextDisplay/ChangedAttribute/Color",       // 5
             "LinesChanged/Mark",                        // 6
             "LinesChanged/Color"                        // 7
-        };
-        OUString* pNames = aNames.getArray();
-        for(int i = 0; i < nCount; i++)
-            pNames[i] = OUString::createFromAscii(aPropNames[i]);
-    }
+    };
     return aNames;
 }
 
@@ -466,12 +457,8 @@ enum InsertConfigProp
 };
 const Sequence<OUString>& SwInsertConfig::GetPropertyNames()
 {
-    static Sequence<OUString> aNames;
-    static Sequence<OUString> aWebNames;
-    if(!aNames.getLength())
+    static Sequence<OUString> aNames
     {
-        static const char* aPropNames[] =
-        {
             "Table/Header",                                                 // 0
             "Table/RepeatHeader",                                           // 1
             "Table/Border",                                                 // 2
@@ -566,19 +553,8 @@ const Sequence<OUString>& SwInsertConfig::GetPropertyNames()
             "Caption/OfficeObject/OLEMisc/Settings/Position",               //91
             "Caption/OfficeObject/OLEMisc/Settings/CharacterStyle",         //92
             "Caption/OfficeObject/OLEMisc/Settings/ApplyAttributes"         //93
-        };
-        const int nCount = INS_PROP_CAP_OBJECT_OLEMISC_APPLYATTRIBUTES + 1;
-        const int nWebCount = INS_PROP_TABLE_BORDER + 1;
-        aNames.realloc(nCount);
-        aWebNames.realloc(nWebCount);
-        OUString* pNames = aNames.getArray();
-        OUString* pWebNames = aWebNames.getArray();
-        int i;
-        for(i = 0; i < nCount; i++)
-            pNames[i] = OUString::createFromAscii(aPropNames[i]);
-        for(i = 0; i < nWebCount; i++)
-            pWebNames[i] = OUString::createFromAscii(aPropNames[i]);
-    }
+    };
+    static Sequence<OUString> const aWebNames(aNames.getArray(), INS_PROP_TABLE_BORDER + 1);
     return m_bIsWeb ? aWebNames : aNames;
 }
 
@@ -1089,9 +1065,7 @@ void SwInsertConfig::Load()
 
 const Sequence<OUString>& SwTableConfig::GetPropertyNames()
 {
-    const int nCount = 8;
-    static Sequence<OUString> aNames(nCount);
-    static const char* aPropNames[] =
+    static Sequence<OUString> const aNames
     {
         "Shift/Row",                    //  0
         "Shift/Column",                 //  1
@@ -1102,9 +1076,6 @@ const Sequence<OUString>& SwTableConfig::GetPropertyNames()
         "Input/NumberFormatRecognition",//  6
         "Input/Alignment"               //  7
     };
-    OUString* pNames = aNames.getArray();
-    for(int i = 0; i < nCount; i++)
-        pNames[i] = OUString::createFromAscii(aPropNames[i]);
     return aNames;
 }
 
@@ -1199,13 +1170,8 @@ SwMiscConfig::~SwMiscConfig()
 
 const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
 {
-    static Sequence<OUString> aNames;
-    if(!aNames.getLength())
+    static Sequence<OUString> const aNames
     {
-        const int nCount = 12;
-        aNames.realloc(nCount);
-        static const char* aPropNames[] =
-        {
             "Statistics/WordNumber/Delimiter",          // 0
             "DefaultFont/Document",                     // 1
             "Index/ShowPreview",                        // 2
@@ -1218,11 +1184,7 @@ const Sequence<OUString>& SwMiscConfig::GetPropertyNames()
             "FormLetter/FileOutput/FileName/FromManualSetting",   // 9
             "FormLetter/FileOutput/FileName/Generation",//10
             "FormLetter/PrintOutput/AskForMerge"        //11
-        };
-        OUString* pNames = aNames.getArray();
-        for(int i = 0; i < nCount; i++)
-            pNames[i] = OUString::createFromAscii(aPropNames[i]);
-    }
+    };
     return aNames;
 }
 
@@ -1292,23 +1254,14 @@ void SwMiscConfig::Load()
 
 const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
 {
-    static Sequence<OUString> aNames;
-    if(!aNames.getLength())
+    static Sequence<OUString> const aNames
     {
-        const int nCount = 5;
-        aNames.realloc(nCount);
-        static const char* aPropNames[] =
-        {
             "Mode",                         // 0
             "UseRSID",                      // 1
             "IgnorePieces",             // 2
             "IgnoreLength", // 3
             "StoreRSID" // 4
-        };
-        OUString* pNames = aNames.getArray();
-        for(int i = 0; i < nCount; i++)
-            pNames[i] = OUString::createFromAscii(aPropNames[i]);
-    }
+    };
     return aNames;
 }
 
diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx
index 970816c3e3ce..ad2f1d870645 100644
--- a/sw/source/uibase/config/viewopt.cxx
+++ b/sw/source/uibase/config/viewopt.cxx
@@ -573,9 +573,7 @@ bool SwViewOption::IsAppearanceFlag(ViewOptFlags nFlag)
 namespace{
 rtl::Reference<comphelper::ConfigurationListener> const & getWCOptionListener()
 {
-    static rtl::Reference<comphelper::ConfigurationListener> xListener;
-    if (!xListener.is())
-        xListener.set(new comphelper::ConfigurationListener("/org.openoffice.Office.Writer/Cursor/Option"));
+    static rtl::Reference<comphelper::ConfigurationListener> xListener(new comphelper::ConfigurationListener("/org.openoffice.Office.Writer/Cursor/Option"));
     return xListener;
 }
 }


More information about the Libreoffice-commits mailing list