[Libreoffice-commits] core.git: embeddedobj/source embeddedobj/util

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 2 18:44:44 UTC 2020


 embeddedobj/source/commonembedding/xfactory.cxx      |    9 +++------
 embeddedobj/source/general/xcreator.cxx              |    6 ++----
 embeddedobj/source/msole/emboleobj.component         |    3 ++-
 embeddedobj/source/msole/emboleobj.windows.component |    6 ++++--
 embeddedobj/source/msole/xdialogcreator.cxx          |    5 ++---
 embeddedobj/source/msole/xolefactory.cxx             |    5 ++---
 embeddedobj/util/embobj.component                    |    9 ++++++---
 7 files changed, 21 insertions(+), 22 deletions(-)

New commits:
commit a2b256df787e76c90c110f363cf7a3b84b54947f
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Oct 2 14:26:51 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Oct 2 20:43:58 2020 +0200

    Use the new single-instance="true" attribute in embeddedobj
    
    Change-Id: Icead3bb5715a08bc2a2dfbb16c074d1b19e316a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103855
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx
index a4ef74d08ee4..3f7cb8fde98f 100644
--- a/embeddedobj/source/commonembedding/xfactory.cxx
+++ b/embeddedobj/source/commonembedding/xfactory.cxx
@@ -24,6 +24,7 @@
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/io/IOException.hpp>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <comphelper/documentconstants.hxx>
 
 #include "xfactory.hxx"
@@ -367,9 +368,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_OOoEmbeddedObjectFactory_get_implementation(
     css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<OOoEmbeddedObjectFactory> g_Instance(new OOoEmbeddedObjectFactory(context));
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new OOoEmbeddedObjectFactory(context)));
 }
 
 
@@ -413,8 +412,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_OOoSpecialEmbeddedObjectFactory_get_implementation(
     css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<OOoSpecialEmbeddedObjectFactory> g_Instance(new OOoSpecialEmbeddedObjectFactory(context));
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new OOoSpecialEmbeddedObjectFactory(context)));
 }
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx
index 9e9bb0934603..a54295895190 100644
--- a/embeddedobj/source/general/xcreator.cxx
+++ b/embeddedobj/source/general/xcreator.cxx
@@ -28,9 +28,9 @@
 #include <com/sun/star/lang/XComponent.hpp>
 
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 #include <comphelper/documentconstants.hxx>
 #include <officecfg/Office/Common.hxx>
-#include <rtl/ref.hxx>
 
 #include <xcreator.hxx>
 #include <dummyobject.hxx>
@@ -410,9 +410,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_UNOEmbeddedObjectCreator_get_implementation(
     css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<UNOEmbeddedObjectCreator> g_Instance(new UNOEmbeddedObjectCreator(context));
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new UNOEmbeddedObjectCreator(context)));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/emboleobj.component b/embeddedobj/source/msole/emboleobj.component
index bf7e128f04e5..ac09d3a6d32d 100644
--- a/embeddedobj/source/msole/emboleobj.component
+++ b/embeddedobj/source/msole/emboleobj.component
@@ -20,7 +20,8 @@
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory"
-  	constructor="embeddedobj_OleEmbeddedObjectFactory_get_implementation">
+  	constructor="embeddedobj_OleEmbeddedObjectFactory_get_implementation"
+	single-instance="true">
     <service name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory"/>
     <service name="com.sun.star.embed.OLEEmbeddedObjectFactory"/>
   </implementation>
diff --git a/embeddedobj/source/msole/emboleobj.windows.component b/embeddedobj/source/msole/emboleobj.windows.component
index e41c81d33048..89b644fc79b0 100644
--- a/embeddedobj/source/msole/emboleobj.windows.component
+++ b/embeddedobj/source/msole/emboleobj.windows.component
@@ -20,12 +20,14 @@
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="com.sun.star.comp.embed.MSOLEObjectSystemCreator"
-	constructor="embeddedobj_MSOLEDialogObjectCreator_get_implementation">
+	constructor="embeddedobj_MSOLEDialogObjectCreator_get_implementation"
+	single-instance="true">
     <service name="com.sun.star.comp.embed.MSOLEObjectSystemCreator"/>
     <service name="com.sun.star.embed.MSOLEObjectSystemCreator"/>
   </implementation>
   <implementation name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory"
-	constructor="embeddedobj_OleEmbeddedObjectFactory_get_implementation">
+	constructor="embeddedobj_OleEmbeddedObjectFactory_get_implementation"
+	single-instance="true">
     <service name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory"/>
     <service name="com.sun.star.embed.OLEEmbeddedObjectFactory"/>
   </implementation>
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
index 49e9c0c925e4..415039c3f1fc 100644
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ b/embeddedobj/source/msole/xdialogcreator.cxx
@@ -35,6 +35,7 @@
 #include <comphelper/mimeconfighelper.hxx>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 
 #include "xdialogcreator.hxx"
 #include <oleembobj.hxx>
@@ -323,9 +324,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_MSOLEDialogObjectCreator_get_implementation(
     css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<MSOLEDialogObjectCreator> g_Instance(new MSOLEDialogObjectCreator(context));
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new MSOLEDialogObjectCreator(context)));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/xolefactory.cxx b/embeddedobj/source/msole/xolefactory.cxx
index 9ecd2c690bf5..b18ba1153498 100644
--- a/embeddedobj/source/msole/xolefactory.cxx
+++ b/embeddedobj/source/msole/xolefactory.cxx
@@ -28,6 +28,7 @@
 #include <oleembobj.hxx>
 
 #include <cppuhelper/supportsservice.hxx>
+#include <cppuhelper/weak.hxx>
 
 using namespace ::com::sun::star;
 
@@ -244,9 +245,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
 embeddedobj_OleEmbeddedObjectFactory_get_implementation(
     css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    static rtl::Reference<OleEmbeddedObjectFactory> g_Instance(new OleEmbeddedObjectFactory(context));
-    g_Instance->acquire();
-    return static_cast<cppu::OWeakObject*>(g_Instance.get());
+    return cppu::acquire(static_cast<cppu::OWeakObject*>(new OleEmbeddedObjectFactory(context)));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/util/embobj.component b/embeddedobj/util/embobj.component
index e3cbe3a5fa79..0e68c26b3bac 100644
--- a/embeddedobj/util/embobj.component
+++ b/embeddedobj/util/embobj.component
@@ -20,17 +20,20 @@
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
     xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="com.sun.star.comp.embed.EmbeddedObjectCreator"
-	constructor="embeddedobj_UNOEmbeddedObjectCreator_get_implementation">
+	constructor="embeddedobj_UNOEmbeddedObjectCreator_get_implementation"
+	single-instance="true">
     <service name="com.sun.star.comp.embed.EmbeddedObjectCreator"/>
     <service name="com.sun.star.embed.EmbeddedObjectCreator"/>
   </implementation>
   <implementation name="com.sun.star.comp.embed.OOoEmbeddedObjectFactory"
-	constructor="embeddedobj_OOoEmbeddedObjectFactory_get_implementation">
+	constructor="embeddedobj_OOoEmbeddedObjectFactory_get_implementation"
+	single-instance="true">
     <service name="com.sun.star.comp.embed.OOoEmbeddedObjectFactory"/>
     <service name="com.sun.star.embed.OOoEmbeddedObjectFactory"/>
   </implementation>
   <implementation name="com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory"
-	constructor="embeddedobj_OOoSpecialEmbeddedObjectFactory_get_implementation">
+	constructor="embeddedobj_OOoSpecialEmbeddedObjectFactory_get_implementation"
+	single-instance="true">
     <service name="com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory"/>
     <service name="com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"/>
   </implementation>


More information about the Libreoffice-commits mailing list