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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Nov 22 13:27:44 UTC 2018


 vbahelper/source/msforms/vbabutton.cxx               |    8 ++----
 vbahelper/source/msforms/vbacheckbox.cxx             |    8 ++----
 vbahelper/source/msforms/vbacombobox.cxx             |    8 ++----
 vbahelper/source/msforms/vbacontrol.cxx              |    8 ++----
 vbahelper/source/msforms/vbaimage.cxx                |    8 ++----
 vbahelper/source/msforms/vbalabel.cxx                |    8 ++----
 vbahelper/source/msforms/vbalistbox.cxx              |    8 ++----
 vbahelper/source/msforms/vbamultipage.cxx            |    8 ++----
 vbahelper/source/msforms/vbapages.cxx                |    8 ++----
 vbahelper/source/msforms/vbaprogressbar.cxx          |    8 ++----
 vbahelper/source/msforms/vbaradiobutton.cxx          |    8 ++----
 vbahelper/source/msforms/vbascrollbar.cxx            |    8 ++----
 vbahelper/source/msforms/vbaspinbutton.cxx           |    8 ++----
 vbahelper/source/msforms/vbasystemaxcontrol.cxx      |    8 ++----
 vbahelper/source/msforms/vbatextbox.cxx              |    8 ++----
 vbahelper/source/msforms/vbatogglebutton.cxx         |    8 ++----
 vbahelper/source/msforms/vbauserform.cxx             |    8 ++----
 vbahelper/source/vbahelper/vbaapplicationbase.cxx    |    8 ++----
 vbahelper/source/vbahelper/vbacolorformat.cxx        |    8 ++----
 vbahelper/source/vbahelper/vbacommandbar.cxx         |   16 ++++--------
 vbahelper/source/vbahelper/vbacommandbarcontrol.cxx  |   24 +++++++------------
 vbahelper/source/vbahelper/vbacommandbarcontrols.cxx |   16 ++++--------
 vbahelper/source/vbahelper/vbacommandbars.cxx        |    8 ++----
 vbahelper/source/vbahelper/vbadocumentbase.cxx       |    8 ++----
 vbahelper/source/vbahelper/vbafillformat.cxx         |    8 ++----
 vbahelper/source/vbahelper/vbahelper.cxx             |    7 -----
 vbahelper/source/vbahelper/vbalineformat.cxx         |    8 ++----
 vbahelper/source/vbahelper/vbapictureformat.cxx      |    8 ++----
 vbahelper/source/vbahelper/vbashape.cxx              |    8 ++----
 vbahelper/source/vbahelper/vbashaperange.cxx         |    8 ++----
 vbahelper/source/vbahelper/vbashapes.cxx             |    8 ++----
 vbahelper/source/vbahelper/vbatextframe.cxx          |    8 ++----
 vbahelper/source/vbahelper/vbawindowbase.cxx         |    8 ++----
 33 files changed, 109 insertions(+), 186 deletions(-)

New commits:
commit 28d82c33131f5f1a300c632acc06e027b04a5a4d
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Nov 22 13:12:52 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Nov 22 14:27:18 2018 +0100

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

diff --git a/vbahelper/source/msforms/vbabutton.cxx b/vbahelper/source/msforms/vbabutton.cxx
index 0951731d2c64..7c7e98143432 100644
--- a/vbahelper/source/msforms/vbabutton.cxx
+++ b/vbahelper/source/msforms/vbabutton.cxx
@@ -118,12 +118,10 @@ VbaButton::getServiceImplName()
 uno::Sequence< OUString >
 VbaButton::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.Button";
-    }
+        "ooo.vba.msforms.Button"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx
index 83928d8567c4..719fd3183696 100644
--- a/vbahelper/source/msforms/vbacheckbox.cxx
+++ b/vbahelper/source/msforms/vbacheckbox.cxx
@@ -92,12 +92,10 @@ ScVbaCheckbox::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaCheckbox::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.CheckBox";
-    }
+        "ooo.vba.msforms.CheckBox"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index 65e946e0516a..78ceafb5ea88 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -299,12 +299,10 @@ void SAL_CALL ScVbaComboBox::setLinkedCell( const OUString& _linkedcell )
 uno::Sequence< OUString >
 ScVbaComboBox::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.ComboBox";
-    }
+        "ooo.vba.msforms.ComboBox"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 65c2e9838519..8f60a67af807 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -703,12 +703,10 @@ ScVbaControl::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaControl::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.excel.Control";
-    }
+        "ooo.vba.excel.Control"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbaimage.cxx b/vbahelper/source/msforms/vbaimage.cxx
index 875fafeacea3..1deeaf249f31 100644
--- a/vbahelper/source/msforms/vbaimage.cxx
+++ b/vbahelper/source/msforms/vbaimage.cxx
@@ -36,12 +36,10 @@ ScVbaImage::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaImage::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.Image";
-    }
+        "ooo.vba.msforms.Image"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx
index 70d0ddaae01d..567cd6b79c4a 100644
--- a/vbahelper/source/msforms/vbalabel.cxx
+++ b/vbahelper/source/msforms/vbalabel.cxx
@@ -102,12 +102,10 @@ void SAL_CALL ScVbaLabel::setAutoSize( sal_Bool bAutoSize )
 uno::Sequence< OUString >
 ScVbaLabel::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.Label";
-    }
+        "ooo.vba.msforms.Label"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx
index d0e4856cf3a1..c91996c6d6f4 100644
--- a/vbahelper/source/msforms/vbalistbox.cxx
+++ b/vbahelper/source/msforms/vbalistbox.cxx
@@ -284,12 +284,10 @@ ScVbaListBox::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaListBox::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.ScVbaListBox";
-    }
+        "ooo.vba.msforms.ScVbaListBox"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx
index c3f73e88137f..0608c1d64bda 100644
--- a/vbahelper/source/msforms/vbamultipage.cxx
+++ b/vbahelper/source/msforms/vbamultipage.cxx
@@ -103,12 +103,10 @@ ScVbaMultiPage::Pages( const uno::Any& index )
 uno::Sequence< OUString >
 ScVbaMultiPage::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.MultiPage";
-    }
+        "ooo.vba.msforms.MultiPage"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbapages.cxx b/vbahelper/source/msforms/vbapages.cxx
index 6854ef68f82b..c40aaa8fdf90 100644
--- a/vbahelper/source/msforms/vbapages.cxx
+++ b/vbahelper/source/msforms/vbapages.cxx
@@ -54,12 +54,10 @@ ScVbaPages::createEnumeration()
 uno::Sequence< OUString >
 ScVbaPages::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msform.Pages";
-    }
+        "ooo.vba.msform.Pages"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbaprogressbar.cxx b/vbahelper/source/msforms/vbaprogressbar.cxx
index 92700ba65ebb..64b6726905ff 100644
--- a/vbahelper/source/msforms/vbaprogressbar.cxx
+++ b/vbahelper/source/msforms/vbaprogressbar.cxx
@@ -51,12 +51,10 @@ ScVbaProgressBar::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaProgressBar::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.Label";
-    }
+        "ooo.vba.msforms.Label"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx
index 50e9b4fb26bb..8328dff14d76 100644
--- a/vbahelper/source/msforms/vbaradiobutton.cxx
+++ b/vbahelper/source/msforms/vbaradiobutton.cxx
@@ -100,12 +100,10 @@ ScVbaRadioButton::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaRadioButton::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.RadioButton";
-    }
+        "ooo.vba.msforms.RadioButton"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbascrollbar.cxx b/vbahelper/source/msforms/vbascrollbar.cxx
index a10ecec11a68..10c49e79c16b 100644
--- a/vbahelper/source/msforms/vbascrollbar.cxx
+++ b/vbahelper/source/msforms/vbascrollbar.cxx
@@ -105,12 +105,10 @@ ScVbaScrollBar::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaScrollBar::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.Frame";
-    }
+        "ooo.vba.msforms.Frame"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbaspinbutton.cxx b/vbahelper/source/msforms/vbaspinbutton.cxx
index 45279ed94800..1da95fcedc55 100644
--- a/vbahelper/source/msforms/vbaspinbutton.cxx
+++ b/vbahelper/source/msforms/vbaspinbutton.cxx
@@ -77,12 +77,10 @@ ScVbaSpinButton::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaSpinButton::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.Frame";
-    }
+        "ooo.vba.msforms.Frame"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbasystemaxcontrol.cxx b/vbahelper/source/msforms/vbasystemaxcontrol.cxx
index 640326d42fae..d1c42c3746b2 100644
--- a/vbahelper/source/msforms/vbasystemaxcontrol.cxx
+++ b/vbahelper/source/msforms/vbasystemaxcontrol.cxx
@@ -75,12 +75,10 @@ VbaSystemAXControl::getServiceImplName()
 uno::Sequence< OUString >
 VbaSystemAXControl::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.Frame";
-    }
+        "ooo.vba.msforms.Frame"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx
index 87b3c8e0f22b..3f0eba580934 100644
--- a/vbahelper/source/msforms/vbatextbox.cxx
+++ b/vbahelper/source/msforms/vbatextbox.cxx
@@ -176,12 +176,10 @@ ScVbaTextBox::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaTextBox::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.TextBox";
-    }
+        "ooo.vba.msforms.TextBox"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index a81b1a8da536..66106e9266d8 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -154,12 +154,10 @@ ScVbaToggleButton::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaToggleButton::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.ToggleButton";
-    }
+        "ooo.vba.msforms.ToggleButton"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 03d803d44207..6f69f0435a9a 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -187,12 +187,10 @@ ScVbaUserForm::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaUserForm::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.excel.UserForm";
-    }
+        "ooo.vba.excel.UserForm"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index a441653551e4..fc3a05ebd57a 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -428,12 +428,10 @@ VbaApplicationBase::getServiceImplName()
 uno::Sequence<OUString>
 VbaApplicationBase::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.VbaApplicationBase";
-    }
+        "ooo.vba.VbaApplicationBase"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbacolorformat.cxx b/vbahelper/source/vbahelper/vbacolorformat.cxx
index a052f90c1385..fc4301a4490f 100644
--- a/vbahelper/source/vbahelper/vbacolorformat.cxx
+++ b/vbahelper/source/vbahelper/vbacolorformat.cxx
@@ -160,12 +160,10 @@ ScVbaColorFormat::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaColorFormat::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.ColorFormat";
-    }
+        "ooo.vba.msforms.ColorFormat"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbacommandbar.cxx b/vbahelper/source/vbahelper/vbacommandbar.cxx
index 41b325151492..c0316c1b51d7 100644
--- a/vbahelper/source/vbahelper/vbacommandbar.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbar.cxx
@@ -183,12 +183,10 @@ ScVbaCommandBar::getServiceImplName()
 uno::Sequence<OUString>
 ScVbaCommandBar::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBar";
-    }
+        "ooo.vba.CommandBar"
+    };
     return aServiceNames;
 }
 
@@ -266,12 +264,10 @@ OUString VbaDummyCommandBar::getServiceImplName()
 
 uno::Sequence< OUString > VbaDummyCommandBar::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBar";
-    }
+        "ooo.vba.CommandBar"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
index 97c62907b2f4..27d98cbd9241 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrol.cxx
@@ -185,12 +185,10 @@ ScVbaCommandBarControl::getServiceImplName()
 uno::Sequence<OUString>
 ScVbaCommandBarControl::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBarControl";
-    }
+        "ooo.vba.CommandBarControl"
+    };
     return aServiceNames;
 }
 
@@ -217,12 +215,10 @@ ScVbaCommandBarPopup::getServiceImplName()
 uno::Sequence<OUString>
 ScVbaCommandBarPopup::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBarPopup";
-    }
+        "ooo.vba.CommandBarPopup"
+    };
     return aServiceNames;
 }
 
@@ -249,12 +245,10 @@ ScVbaCommandBarButton::getServiceImplName()
 uno::Sequence<OUString>
 ScVbaCommandBarButton::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBarButton";
-    }
+        "ooo.vba.CommandBarButton"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
index cded9f7c309e..830a922c2d09 100644
--- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx
@@ -236,12 +236,10 @@ ScVbaCommandBarControls::getServiceImplName()
 uno::Sequence<OUString>
 ScVbaCommandBarControls::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBarControls";
-    }
+        "ooo.vba.CommandBarControls"
+    };
     return aServiceNames;
 }
 
@@ -306,12 +304,10 @@ OUString VbaDummyCommandBarControls::getServiceImplName()
 
 uno::Sequence<OUString> VbaDummyCommandBarControls::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBarControls";
-    }
+        "ooo.vba.CommandBarControls"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx
index 42ee3f6ee365..f8810e8ed359 100644
--- a/vbahelper/source/vbahelper/vbacommandbars.cxx
+++ b/vbahelper/source/vbahelper/vbacommandbars.cxx
@@ -233,12 +233,10 @@ ScVbaCommandBars::getServiceImplName()
 uno::Sequence<OUString>
 ScVbaCommandBars::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.CommandBars";
-    }
+        "ooo.vba.CommandBars"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index e187d3bfd603..39b3443b2cea 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -286,12 +286,10 @@ VbaDocumentBase::getServiceImplName()
 uno::Sequence< OUString >
 VbaDocumentBase::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.VbaDocumentBase";
-    }
+        "ooo.vba.VbaDocumentBase"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbafillformat.cxx b/vbahelper/source/vbahelper/vbafillformat.cxx
index 7ca9781af6aa..acc748de395d 100644
--- a/vbahelper/source/vbahelper/vbafillformat.cxx
+++ b/vbahelper/source/vbahelper/vbafillformat.cxx
@@ -177,12 +177,10 @@ ScVbaFillFormat::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaFillFormat::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.FillFormat";
-    }
+        "ooo.vba.msforms.FillFormat"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index e1a148274604..6a0a1c755010 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -100,12 +100,7 @@ nViewNo && !pView->GetObjectShell()->IsInPlaceActive() )
 uno::Reference< beans::XIntrospectionAccess >
 getIntrospectionAccess( const uno::Any& aObject )
 {
-    static uno::Reference< beans::XIntrospection > xIntrospection;
-    if( !xIntrospection.is() )
-    {
-        uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
-        xIntrospection.set( beans::theIntrospection::get( xContext ) );
-    }
+    static uno::Reference< beans::XIntrospection > xIntrospection( beans::theIntrospection::get( comphelper::getProcessComponentContext() ) );
     return xIntrospection->inspect( aObject );
 }
 
diff --git a/vbahelper/source/vbahelper/vbalineformat.cxx b/vbahelper/source/vbahelper/vbalineformat.cxx
index 0690206f671c..aa56903264f5 100644
--- a/vbahelper/source/vbahelper/vbalineformat.cxx
+++ b/vbahelper/source/vbahelper/vbalineformat.cxx
@@ -433,12 +433,10 @@ ScVbaLineFormat::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaLineFormat::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msform.LineFormat";
-    }
+        "ooo.vba.msform.LineFormat"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx
index 76b4cafe5f97..9ace2fb60a79 100644
--- a/vbahelper/source/vbahelper/vbapictureformat.cxx
+++ b/vbahelper/source/vbahelper/vbapictureformat.cxx
@@ -124,12 +124,10 @@ ScVbaPictureFormat::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaPictureFormat::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msform.PictureFormat";
-    }
+        "ooo.vba.msform.PictureFormat"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx
index fe5aaaa99d2a..8e7e2ab98560 100644
--- a/vbahelper/source/vbahelper/vbashape.cxx
+++ b/vbahelper/source/vbahelper/vbashape.cxx
@@ -749,12 +749,10 @@ ScVbaShape::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaShape::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msform.Shape";
-    }
+        "ooo.vba.msform.Shape"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx
index b6e98d0a3424..dd5954fb0284 100644
--- a/vbahelper/source/vbahelper/vbashaperange.cxx
+++ b/vbahelper/source/vbahelper/vbashaperange.cxx
@@ -406,12 +406,10 @@ ScVbaShapeRange::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaShapeRange::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msform.ShapeRange";
-    }
+        "ooo.vba.msform.ShapeRange"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx
index 3a0137bb0656..5c3bcbf304fe 100644
--- a/vbahelper/source/vbahelper/vbashapes.cxx
+++ b/vbahelper/source/vbahelper/vbashapes.cxx
@@ -125,12 +125,10 @@ ScVbaShapes::getServiceImplName()
 uno::Sequence< OUString >
 ScVbaShapes::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] =  "ooo.vba.msform.Shapes";
-    }
+        "ooo.vba.msform.Shapes"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbatextframe.cxx b/vbahelper/source/vbahelper/vbatextframe.cxx
index 9b4810e04b91..368e3ff3cd6b 100644
--- a/vbahelper/source/vbahelper/vbatextframe.cxx
+++ b/vbahelper/source/vbahelper/vbatextframe.cxx
@@ -147,12 +147,10 @@ VbaTextFrame::getServiceImplName()
 uno::Sequence< OUString >
 VbaTextFrame::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.msforms.TextFrame";
-    }
+        "ooo.vba.msforms.TextFrame"
+    };
     return aServiceNames;
 }
 
diff --git a/vbahelper/source/vbahelper/vbawindowbase.cxx b/vbahelper/source/vbahelper/vbawindowbase.cxx
index ebc67ef0c5d3..46b08bced666 100644
--- a/vbahelper/source/vbahelper/vbawindowbase.cxx
+++ b/vbahelper/source/vbahelper/vbawindowbase.cxx
@@ -138,12 +138,10 @@ VbaWindowBase::getServiceImplName()
 uno::Sequence< OUString >
 VbaWindowBase::getServiceNames()
 {
-    static uno::Sequence< OUString > aServiceNames;
-    if ( aServiceNames.getLength() == 0 )
+    static uno::Sequence< OUString > const aServiceNames
     {
-        aServiceNames.realloc( 1 );
-        aServiceNames[ 0 ] = "ooo.vba.VbaWindowBase";
-    }
+        "ooo.vba.VbaWindowBase"
+    };
     return aServiceNames;
 }
 


More information about the Libreoffice-commits mailing list