[Libreoffice-commits] core.git: connectivity/Library_calc.mk connectivity/Library_dbase.mk connectivity/Library_flat.mk connectivity/Library_writer.mk connectivity/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jul 11 17:55:22 UTC 2020
connectivity/Library_calc.mk | 1
connectivity/Library_dbase.mk | 1
connectivity/Library_flat.mk | 1
connectivity/Library_writer.mk | 1
connectivity/source/drivers/calc/CDriver.cxx | 27 ++---
connectivity/source/drivers/calc/Cservices.cxx | 106 --------------------
connectivity/source/drivers/calc/calc.component | 4
connectivity/source/drivers/dbase/DDriver.cxx | 22 ++--
connectivity/source/drivers/dbase/Dservices.cxx | 106 --------------------
connectivity/source/drivers/dbase/dbase.component | 5
connectivity/source/drivers/file/FDriver.cxx | 17 ---
connectivity/source/drivers/flat/EDriver.cxx | 23 ++--
connectivity/source/drivers/flat/Eservices.cxx | 106 --------------------
connectivity/source/drivers/flat/flat.component | 5
connectivity/source/drivers/writer/WDriver.cxx | 24 +++-
connectivity/source/drivers/writer/Wservices.cxx | 90 ----------------
connectivity/source/drivers/writer/writer.component | 4
connectivity/source/inc/file/FDriver.hxx | 5
connectivity/source/inc/writer/WDriver.hxx | 5
19 files changed, 72 insertions(+), 481 deletions(-)
New commits:
commit 255d96a3e1f4e77ed6444a21c1c9c24b3dc9d194
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sat Jul 11 18:57:16 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 11 19:54:57 2020 +0200
connectivity: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: Id678e4c51459429dd3953c0e54558d2c36e85eee
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98562
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/connectivity/Library_calc.mk b/connectivity/Library_calc.mk
index 1741d01ee519..b751ce16bfe3 100644
--- a/connectivity/Library_calc.mk
+++ b/connectivity/Library_calc.mk
@@ -44,7 +44,6 @@ $(eval $(call gb_Library_add_exception_objects,calc,\
connectivity/source/drivers/calc/CTable \
connectivity/source/drivers/calc/CTables \
connectivity/source/drivers/calc/CConnection \
- connectivity/source/drivers/calc/Cservices \
connectivity/source/drivers/calc/CDriver \
))
diff --git a/connectivity/Library_dbase.mk b/connectivity/Library_dbase.mk
index 6f897391ebf9..ff1d703e520a 100644
--- a/connectivity/Library_dbase.mk
+++ b/connectivity/Library_dbase.mk
@@ -54,7 +54,6 @@ $(eval $(call gb_Library_add_exception_objects,dbase,\
connectivity/source/drivers/dbase/DIndexes \
connectivity/source/drivers/dbase/DTables \
connectivity/source/drivers/dbase/DConnection \
- connectivity/source/drivers/dbase/Dservices \
connectivity/source/drivers/dbase/DDriver \
connectivity/source/drivers/dbase/DTable \
))
diff --git a/connectivity/Library_flat.mk b/connectivity/Library_flat.mk
index c37b6ae5ed37..77e2dee405e2 100644
--- a/connectivity/Library_flat.mk
+++ b/connectivity/Library_flat.mk
@@ -49,7 +49,6 @@ $(eval $(call gb_Library_add_exception_objects,flat,\
connectivity/source/drivers/flat/EColumns \
connectivity/source/drivers/flat/ETables \
connectivity/source/drivers/flat/EConnection \
- connectivity/source/drivers/flat/Eservices \
connectivity/source/drivers/flat/EDriver \
))
diff --git a/connectivity/Library_writer.mk b/connectivity/Library_writer.mk
index d07f572a3227..242d684c9de0 100644
--- a/connectivity/Library_writer.mk
+++ b/connectivity/Library_writer.mk
@@ -43,7 +43,6 @@ $(eval $(call gb_Library_add_exception_objects,writer,\
connectivity/source/drivers/writer/WDriver \
connectivity/source/drivers/writer/WTable \
connectivity/source/drivers/writer/WTables \
- connectivity/source/drivers/writer/Wservices \
))
# vim: set noet sw=4 ts=4:
diff --git a/connectivity/source/drivers/calc/CDriver.cxx b/connectivity/source/drivers/calc/CDriver.cxx
index 3b53ebccd0b8..5a59515bb2d6 100644
--- a/connectivity/source/drivers/calc/CDriver.cxx
+++ b/connectivity/source/drivers/calc/CDriver.cxx
@@ -34,28 +34,31 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
-// static ServiceInfo
-
-OUString ODriver::getImplementationName_Static( )
-{
- return "com.sun.star.comp.sdbc.calc.ODriver";
-}
+// ServiceInfo
OUString SAL_CALL ODriver::getImplementationName( )
{
- return getImplementationName_Static();
+ return "com.sun.star.comp.sdbc.calc.ODriver";
}
// service names from file::OFileDriver
-
-css::uno::Reference< css::uno::XInterface >
- connectivity::calc::ODriver_CreateInstance(const css::uno::Reference<
- css::lang::XMultiServiceFactory >& _rxFactory)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_calc_ODriver(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
+ rtl::Reference<ODriver> ret;
+ try {
+ ret = new ODriver(context);
+ } catch (...) {
+ }
+ if (ret)
+ ret->acquire();
+ return static_cast<cppu::OWeakObject*>(ret.get());
}
+
+
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url,
const Sequence< PropertyValue >& info )
{
diff --git a/connectivity/source/drivers/calc/Cservices.cxx b/connectivity/source/drivers/calc/Cservices.cxx
deleted file mode 100644
index 06a516ddc119..000000000000
--- a/connectivity/source/drivers/calc/Cservices.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <calc/CDriver.hxx>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace connectivity::calc;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (*createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount*
- );
-
-namespace {
-
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- char const* pImplementationName
- )
- : xServiceManager(static_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- {
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,nullptr);
- }
- catch(...)
- {
- }
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* connectivity_calc_component_getFactory(
- const char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = nullptr;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/calc/calc.component b/connectivity/source/drivers/calc/calc.component
index ffbddfa34c6d..a4fc7d8f119f 100644
--- a/connectivity/source/drivers/calc/calc.component
+++ b/connectivity/source/drivers/calc/calc.component
@@ -18,9 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="connectivity_calc"
xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.calc.ODriver">
+ <implementation name="com.sun.star.comp.sdbc.calc.ODriver"
+ constructor="connectivity_calc_ODriver">
<service name="com.sun.star.sdbc.Driver"/>
<service name="com.sun.star.sdbcx.Driver"/>
</implementation>
diff --git a/connectivity/source/drivers/dbase/DDriver.cxx b/connectivity/source/drivers/dbase/DDriver.cxx
index ab2d52413e06..6d3af175241b 100644
--- a/connectivity/source/drivers/dbase/DDriver.cxx
+++ b/connectivity/source/drivers/dbase/DDriver.cxx
@@ -33,25 +33,29 @@ using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::lang;
-// static ServiceInfo
+// XServiceInfo
-OUString ODriver::getImplementationName_Static( )
+OUString SAL_CALL ODriver::getImplementationName( )
{
return "com.sun.star.comp.sdbc.dbase.ODriver";
}
-OUString SAL_CALL ODriver::getImplementationName( )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_dbase_ODriver(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- return getImplementationName_Static();
+ rtl::Reference<ODriver> ret;
+ try {
+ ret = new ODriver(context);
+ } catch (...) {
+ }
+ if (ret)
+ ret->acquire();
+ return static_cast<cppu::OWeakObject*>(ret.get());
}
-css::uno::Reference< css::uno::XInterface > connectivity::dbase::ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory)
-{
- return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
-}
-
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info )
{
::osl::MutexGuard aGuard( m_aMutex );
diff --git a/connectivity/source/drivers/dbase/Dservices.cxx b/connectivity/source/drivers/dbase/Dservices.cxx
deleted file mode 100644
index e2d09d6c0478..000000000000
--- a/connectivity/source/drivers/dbase/Dservices.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <dbase/DDriver.hxx>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace connectivity::dbase;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (*createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount*
- );
-
-namespace {
-
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- char const* pImplementationName
- )
- : xServiceManager(static_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- {
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,nullptr);
- }
- catch(...)
- {
- }
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* dbase_component_getFactory(
- const char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = nullptr;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/dbase/dbase.component b/connectivity/source/drivers/dbase/dbase.component
index 3f2cea66b783..b078a765d80c 100644
--- a/connectivity/source/drivers/dbase/dbase.component
+++ b/connectivity/source/drivers/dbase/dbase.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="dbase" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.dbase.ODriver">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.sdbc.dbase.ODriver"
+ constructor="connectivity_dbase_ODriver">
<service name="com.sun.star.sdbc.Driver"/>
<service name="com.sun.star.sdbcx.Driver"/>
</implementation>
diff --git a/connectivity/source/drivers/file/FDriver.cxx b/connectivity/source/drivers/file/FDriver.cxx
index c2956adc279b..16cf60e02cb4 100644
--- a/connectivity/source/drivers/file/FDriver.cxx
+++ b/connectivity/source/drivers/file/FDriver.cxx
@@ -57,22 +57,11 @@ void OFileDriver::disposing()
ODriver_BASE::disposing();
}
-// static ServiceInfo
-
-OUString OFileDriver::getImplementationName_Static( )
-{
- return "com.sun.star.sdbc.driver.file.Driver";
-}
-
-Sequence< OUString > OFileDriver::getSupportedServiceNames_Static( )
-{
- return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" };
-}
-
+// XServiceInfo
OUString SAL_CALL OFileDriver::getImplementationName( )
{
- return getImplementationName_Static();
+ return "com.sun.star.sdbc.driver.file.Driver";
}
sal_Bool SAL_CALL OFileDriver::supportsService( const OUString& _rServiceName )
@@ -83,7 +72,7 @@ sal_Bool SAL_CALL OFileDriver::supportsService( const OUString& _rServiceName )
Sequence< OUString > SAL_CALL OFileDriver::getSupportedServiceNames( )
{
- return getSupportedServiceNames_Static();
+ return { "com.sun.star.sdbc.Driver", "com.sun.star.sdbcx.Driver" };
}
diff --git a/connectivity/source/drivers/flat/EDriver.cxx b/connectivity/source/drivers/flat/EDriver.cxx
index e10f29da7f6d..0e1767870859 100644
--- a/connectivity/source/drivers/flat/EDriver.cxx
+++ b/connectivity/source/drivers/flat/EDriver.cxx
@@ -36,23 +36,26 @@ using namespace css::sdbc;
using namespace css::lang;
-// static ServiceInfo
-
-OUString ODriver::getImplementationName_Static( )
-{
- return "com.sun.star.comp.sdbc.flat.ODriver";
-}
-
+// XServiceInfo
OUString SAL_CALL ODriver::getImplementationName( )
{
- return getImplementationName_Static();
+ return "com.sun.star.comp.sdbc.flat.ODriver";
}
-css::uno::Reference< css::uno::XInterface > connectivity::flat::ODriver_CreateInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_flat_ODriver(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
- return *(new ODriver( comphelper::getComponentContext(_rxFactory) ));
+ rtl::Reference<ODriver> ret;
+ try {
+ ret = new ODriver(context);
+ } catch (...) {
+ }
+ if (ret)
+ ret->acquire();
+ return static_cast<cppu::OWeakObject*>(ret.get());
}
Reference< XConnection > SAL_CALL ODriver::connect( const OUString& url, const Sequence< PropertyValue >& info )
diff --git a/connectivity/source/drivers/flat/Eservices.cxx b/connectivity/source/drivers/flat/Eservices.cxx
deleted file mode 100644
index e74db8791843..000000000000
--- a/connectivity/source/drivers/flat/Eservices.cxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <flat/EDriver.hxx>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace connectivity::flat;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::lang::XSingleServiceFactory;
-using ::com::sun::star::lang::XMultiServiceFactory;
-
-typedef Reference< XSingleServiceFactory > (*createFactoryFunc)
- (
- const Reference< XMultiServiceFactory > & rServiceManager,
- const OUString & rComponentName,
- ::cppu::ComponentInstantiation pCreateFunction,
- const Sequence< OUString > & rServiceNames,
- rtl_ModuleCount*
- );
-
-namespace {
-
-struct ProviderRequest
-{
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > const xServiceManager;
- OUString const sImplementationName;
-
- ProviderRequest(
- void* pServiceManager,
- char const* pImplementationName
- )
- : xServiceManager(static_cast<XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- bool CREATE_PROVIDER(
- const OUString& Implname,
- const Sequence< OUString > & Services,
- ::cppu::ComponentInstantiation Factory,
- createFactoryFunc creator
- )
- {
- if (!xRet.is() && (Implname == sImplementationName))
- {
- try
- {
- xRet = creator( xServiceManager, sImplementationName,Factory, Services,nullptr);
- }
- catch(...)
- {
- }
- }
- return xRet.is();
- }
-
- void* getProvider() const { return xRet.get(); }
-};
-
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void* flat_component_getFactory(
- const char* pImplementationName,
- void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = nullptr;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager,pImplementationName);
-
- aReq.CREATE_PROVIDER(
- ODriver::getImplementationName_Static(),
- ODriver::getSupportedServiceNames_Static(),
- ODriver_CreateInstance, ::cppu::createSingleFactory)
- ;
-
- if(aReq.xRet.is())
- aReq.xRet->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/flat/flat.component b/connectivity/source/drivers/flat/flat.component
index 6fa7fb8e6262..715fbecd89dc 100644
--- a/connectivity/source/drivers/flat/flat.component
+++ b/connectivity/source/drivers/flat/flat.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="flat" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.flat.ODriver">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.sdbc.flat.ODriver"
+ constructor="connectivity_flat_ODriver">
<service name="com.sun.star.sdbc.Driver"/>
<service name="com.sun.star.sdbcx.Driver"/>
</implementation>
diff --git a/connectivity/source/drivers/writer/WDriver.cxx b/connectivity/source/drivers/writer/WDriver.cxx
index 63dc1f3f483d..3d30c00fb571 100644
--- a/connectivity/source/drivers/writer/WDriver.cxx
+++ b/connectivity/source/drivers/writer/WDriver.cxx
@@ -30,14 +30,26 @@ using namespace ::com::sun::star;
namespace connectivity::writer
{
-OUString ODriver::getImplementationName_Static() { return "com.sun.star.comp.sdbc.writer.ODriver"; }
-
-OUString SAL_CALL ODriver::getImplementationName() { return getImplementationName_Static(); }
+OUString SAL_CALL ODriver::getImplementationName()
+{
+ return "com.sun.star.comp.sdbc.writer.ODriver";
+}
-uno::Reference<css::uno::XInterface>
-ODriver_CreateInstance(const uno::Reference<lang::XMultiServiceFactory>& _rxFactory)
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+connectivity_writer_ODriver(css::uno::XComponentContext* context,
+ css::uno::Sequence<css::uno::Any> const&)
{
- return *(new ODriver(comphelper::getComponentContext(_rxFactory)));
+ rtl::Reference<ODriver> ret;
+ try
+ {
+ ret = new ODriver(context);
+ }
+ catch (...)
+ {
+ }
+ if (ret)
+ ret->acquire();
+ return static_cast<cppu::OWeakObject*>(ret.get());
}
uno::Reference<sdbc::XConnection>
diff --git a/connectivity/source/drivers/writer/Wservices.cxx b/connectivity/source/drivers/writer/Wservices.cxx
deleted file mode 100644
index 7f997d7d110d..000000000000
--- a/connectivity/source/drivers/writer/Wservices.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <writer/WDriver.hxx>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-using namespace com::sun::star;
-
-using createFactoryFunc = uno::Reference<lang::XSingleServiceFactory> (*)(
- const uno::Reference<lang::XMultiServiceFactory>& rServiceManager,
- const OUString& rComponentName, ::cppu::ComponentInstantiation pCreateFunction,
- const uno::Sequence<OUString>& rServiceNames, rtl_ModuleCount*);
-
-namespace
-{
-struct ProviderRequest
-{
-private:
- uno::Reference<lang::XSingleServiceFactory> xRet;
- uno::Reference<lang::XMultiServiceFactory> const xServiceManager;
- OUString const sImplementationName;
-
-public:
- ProviderRequest(void* pServiceManager, char const* pImplementationName)
- : xServiceManager(static_cast<lang::XMultiServiceFactory*>(pServiceManager))
- , sImplementationName(OUString::createFromAscii(pImplementationName))
- {
- }
-
- bool CREATE_PROVIDER(const OUString& Implname, const uno::Sequence<OUString>& Services,
- ::cppu::ComponentInstantiation Factory, createFactoryFunc creator)
- {
- if (!xRet.is() && (Implname == sImplementationName))
- {
- try
- {
- xRet = creator(xServiceManager, sImplementationName, Factory, Services, nullptr);
- }
- catch (...)
- {
- }
- }
- return xRet.is();
- }
-
- uno::XInterface* getProvider() const { return xRet.get(); }
-};
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void*
-connectivity_writer_component_getFactory(const char* pImplementationName, void* pServiceManager,
- void* /*pRegistryKey*/)
-{
- void* pRet = nullptr;
- if (pServiceManager)
- {
- ProviderRequest aReq(pServiceManager, pImplementationName);
-
- aReq.CREATE_PROVIDER(connectivity::writer::ODriver::getImplementationName_Static(),
- connectivity::writer::ODriver::getSupportedServiceNames_Static(),
- connectivity::writer::ODriver_CreateInstance,
- ::cppu::createSingleFactory);
-
- if (aReq.getProvider())
- aReq.getProvider()->acquire();
-
- pRet = aReq.getProvider();
- }
-
- return pRet;
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/writer.component b/connectivity/source/drivers/writer/writer.component
index 3bf9d6e79292..3a0432412b54 100644
--- a/connectivity/source/drivers/writer/writer.component
+++ b/connectivity/source/drivers/writer/writer.component
@@ -8,9 +8,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="connectivity_writer"
xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.sdbc.writer.ODriver">
+ <implementation name="com.sun.star.comp.sdbc.writer.ODriver"
+ constructor="connectivity_writer_ODriver">
<service name="com.sun.star.sdbc.Driver"/>
<service name="com.sun.star.sdbcx.Driver"/>
</implementation>
diff --git a/connectivity/source/inc/file/FDriver.hxx b/connectivity/source/inc/file/FDriver.hxx
index efff202743b6..61037352071e 100644
--- a/connectivity/source/inc/file/FDriver.hxx
+++ b/connectivity/source/inc/file/FDriver.hxx
@@ -49,11 +49,6 @@ namespace connectivity
// OComponentHelper
virtual void SAL_CALL disposing() override;
- // XInterface
- /// @throws css::uno::DeploymentException
- static OUString getImplementationName_Static( );
- /// @throws css::uno::DeploymentException
- static css::uno::Sequence< OUString > getSupportedServiceNames_Static( );
// XServiceInfo
virtual OUString SAL_CALL getImplementationName( ) override;
diff --git a/connectivity/source/inc/writer/WDriver.hxx b/connectivity/source/inc/writer/WDriver.hxx
index aa164df930da..d719111b2cbf 100644
--- a/connectivity/source/inc/writer/WDriver.hxx
+++ b/connectivity/source/inc/writer/WDriver.hxx
@@ -40,10 +40,6 @@ namespace connectivity
{
namespace writer
{
-/// @throws css::uno::Exception
-css::uno::Reference<css::uno::XInterface>
-ODriver_CreateInstance(const css::uno::Reference<css::lang::XMultiServiceFactory>& _rxFactory);
-
class ODriver : public file::OFileDriver
{
public:
@@ -53,7 +49,6 @@ public:
}
/// @throws css::uno::RuntimeException
- static OUString getImplementationName_Static();
OUString SAL_CALL getImplementationName() override;
// XDriver
More information about the Libreoffice-commits
mailing list