[Libreoffice-commits] core.git: solenv/bin svl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 15 06:45:59 UTC 2020


 solenv/bin/native-code.py             |    3 +
 svl/source/fsstor/fsfactory.cxx       |   56 ++++++----------------------------
 svl/source/fsstor/fsstorage.component |    5 +--
 svl/source/inc/fsfactory.hxx          |   10 ------
 4 files changed, 15 insertions(+), 59 deletions(-)

New commits:
commit 3e50a3023535d4e9e365db046442df1a758e70c4
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Jul 13 22:39:10 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Jul 15 08:45:06 2020 +0200

    svl/fsstorage: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: If5eec92f2c7707bd0c44b80d352d78a84962ff74
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98702
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index e219a11b8355..dc90b9bc4a6e 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -22,7 +22,6 @@ import xml.etree.ElementTree as ET
 core_factory_list = [
     ("libembobj.a", "embobj_component_getFactory"),
     ("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
-    ("libfsstoragelo.a", "fsstorage_component_getFactory"),
     ("libi18npoollo.a", "i18npool_component_getFactory"),
     ("libinvocadaptlo.a", "invocadapt_component_getFactory"),
     ("liblocalebe1lo.a", "localebe1_component_getFactory"),
@@ -271,6 +270,8 @@ core_constructor_list = [
     "com_sun_star_comp_uri_UriReferenceFactory_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTexpand_get_implementation",
     "com_sun_star_comp_uri_UriSchemeParser_vndDOTsunDOTstarDOTscript_get_implementation",
+# svl/source/fsstor/fsstorage.component
+    "svl_FSStorageFactory_get_implementation",
 # svtools/util/svt.component
     "com_sun_star_comp_embed_HatchWindowFactory_get_implementation",
 # vcl/vcl.android.component
diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx
index 0fec0cefefd6..2b596f1a7cc4 100644
--- a/svl/source/fsstor/fsfactory.cxx
+++ b/svl/source/fsstor/fsfactory.cxx
@@ -35,24 +35,6 @@
 
 using namespace ::com::sun::star;
 
-uno::Sequence< OUString > FSStorageFactory::impl_staticGetSupportedServiceNames()
-{
-    uno::Sequence< OUString > aRet(2);
-    aRet[0] = "com.sun.star.embed.FileSystemStorageFactory";
-    aRet[1] = "com.sun.star.comp.embed.FileSystemStorageFactory";
-    return aRet;
-}
-
-OUString FSStorageFactory::impl_staticGetImplementationName()
-{
-    return "com.sun.star.comp.embed.FileSystemStorageFactory";
-}
-
-uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::impl_staticCreateSelfInstance(
-            const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
-    return uno::Reference< uno::XInterface >( *new FSStorageFactory( comphelper::getComponentContext(xServiceManager) ) );
-}
 
 uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstance()
 {
@@ -153,7 +135,7 @@ uno::Reference< uno::XInterface > SAL_CALL FSStorageFactory::createInstanceWithA
 
 OUString SAL_CALL FSStorageFactory::getImplementationName()
 {
-    return impl_staticGetImplementationName();
+    return "com.sun.star.comp.embed.FileSystemStorageFactory";
 }
 
 sal_Bool SAL_CALL FSStorageFactory::supportsService( const OUString& ServiceName )
@@ -163,37 +145,19 @@ sal_Bool SAL_CALL FSStorageFactory::supportsService( const OUString& ServiceName
 
 uno::Sequence< OUString > SAL_CALL FSStorageFactory::getSupportedServiceNames()
 {
-    return impl_staticGetSupportedServiceNames();
+    return { "com.sun.star.embed.FileSystemStorageFactory",
+                "com.sun.star.comp.embed.FileSystemStorageFactory" };
 }
 
 
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void * fsstorage_component_getFactory (
-    const char * pImplementationName, void * pServiceManager,
-    SAL_UNUSED_PARAMETER void * /* pRegistryKey */)
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+svl_FSStorageFactory_get_implementation(
+    css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
 {
-    void * pResult = nullptr;
-    if (pServiceManager)
-    {
-        uno::Reference< lang::XSingleServiceFactory > xFactory;
-        if (FSStorageFactory::impl_staticGetImplementationName().equalsAscii(pImplementationName))
-        {
-            xFactory = cppu::createOneInstanceFactory (
-                static_cast< lang::XMultiServiceFactory* >(pServiceManager),
-                FSStorageFactory::impl_staticGetImplementationName(),
-                FSStorageFactory::impl_staticCreateSelfInstance,
-                FSStorageFactory::impl_staticGetSupportedServiceNames() );
-        }
-        if (xFactory.is())
-        {
-            xFactory->acquire();
-            pResult = xFactory.get();
-        }
-    }
-    return pResult;
+    static rtl::Reference<FSStorageFactory> g_Instance(new FSStorageFactory(context));
+    g_Instance->acquire();
+    return static_cast<cppu::OWeakObject*>(g_Instance.get());
 }
 
-} // extern "C"
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svl/source/fsstor/fsstorage.component b/svl/source/fsstor/fsstorage.component
index 6bbb59eade6e..915850bab86d 100644
--- a/svl/source/fsstor/fsstorage.component
+++ b/svl/source/fsstor/fsstorage.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="fsstorage" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.comp.embed.FileSystemStorageFactory">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.comp.embed.FileSystemStorageFactory"
+    constructor="svl_FSStorageFactory_get_implementation">
     <service name="com.sun.star.comp.embed.FileSystemStorageFactory"/>
     <service name="com.sun.star.embed.FileSystemStorageFactory"/>
   </implementation>
diff --git a/svl/source/inc/fsfactory.hxx b/svl/source/inc/fsfactory.hxx
index 579ab67ece54..5bec28898588 100644
--- a/svl/source/inc/fsfactory.hxx
+++ b/svl/source/inc/fsfactory.hxx
@@ -39,16 +39,6 @@ public:
         OSL_ENSURE( xContext.is(), "No service manager is provided!" );
     }
 
-    static css::uno::Sequence< OUString >
-            impl_staticGetSupportedServiceNames();
-
-    static OUString impl_staticGetImplementationName();
-
-    static css::uno::Reference< css::uno::XInterface > SAL_CALL
-        impl_staticCreateSelfInstance(
-            const css::uno::Reference< css::lang::XMultiServiceFactory >& xServiceManager );
-
-
     // XSingleServiceFactory
     virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance() override;
     virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const css::uno::Sequence< css::uno::Any >& aArguments ) override;


More information about the Libreoffice-commits mailing list