diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-11 18:57:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-11 19:54:57 +0200 |
commit | 255d96a3e1f4e77ed6444a21c1c9c24b3dc9d194 (patch) | |
tree | 5c96470d188c3611bca008ce3810f4df872dc091 /connectivity/source/drivers | |
parent | 4c12a78b003bf0587be9edd96d538b7f5ee2a3f5 (diff) |
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@collabora.co.uk>
Diffstat (limited to 'connectivity/source/drivers')
-rw-r--r-- | connectivity/source/drivers/calc/CDriver.cxx | 27 | ||||
-rw-r--r-- | connectivity/source/drivers/calc/Cservices.cxx | 106 | ||||
-rw-r--r-- | connectivity/source/drivers/calc/calc.component | 4 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/DDriver.cxx | 22 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/Dservices.cxx | 106 | ||||
-rw-r--r-- | connectivity/source/drivers/dbase/dbase.component | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/file/FDriver.cxx | 17 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/EDriver.cxx | 23 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/Eservices.cxx | 106 | ||||
-rw-r--r-- | connectivity/source/drivers/flat/flat.component | 5 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/WDriver.cxx | 24 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/Wservices.cxx | 90 | ||||
-rw-r--r-- | connectivity/source/drivers/writer/writer.component | 4 |
13 files changed, 72 insertions, 467 deletions
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> |