diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-13 16:45:58 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 09:03:30 +0200 |
commit | 27ae032f793ecae63ff231339cb18c4b2ec64206 (patch) | |
tree | c0e3f19fb4995110bb98599cb2f5918ecb566d91 /connectivity | |
parent | 9c8aa11ee7ddbae34afcce2cbfc4d521122a527b (diff) |
connectivity/dbtools: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I281475b9fe5eff0d462f575e8434b9511b292e85
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98688
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'connectivity')
5 files changed, 19 insertions, 72 deletions
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx index 7bc060ad174c..969a1f1e1f4f 100644 --- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx +++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx @@ -833,19 +833,9 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA // XServiceInfo - OUString ODatabaseMetaDataResultSet::getImplementationName_Static( ) - { - return "org.openoffice.comp.helper.DatabaseMetaDataResultSet"; - } - - Sequence< OUString > ODatabaseMetaDataResultSet::getSupportedServiceNames_Static( ) - { - return Sequence<OUString>{ "com.sun.star.sdbc.ResultSet" }; - } - OUString SAL_CALL ODatabaseMetaDataResultSet::getImplementationName( ) { - return getImplementationName_Static(); + return "org.openoffice.comp.helper.DatabaseMetaDataResultSet"; } sal_Bool SAL_CALL ODatabaseMetaDataResultSet::supportsService( const OUString& _rServiceName ) @@ -855,39 +845,14 @@ void SAL_CALL ODatabaseMetaDataResultSet::initialize( const Sequence< Any >& _aA Sequence< OUString > SAL_CALL ODatabaseMetaDataResultSet::getSupportedServiceNames( ) { - return getSupportedServiceNames_Static(); - } - - namespace connectivity - { - /// @throws Exception - static Reference< XInterface > ODatabaseMetaDataResultSet_CreateInstance(const Reference< XComponentContext >& ) - { - return *(new ODatabaseMetaDataResultSet()); - } + return Sequence<OUString>{ "com.sun.star.sdbc.ResultSet" }; } - -namespace -{ - cppu::ImplementationEntry const entries[] = { - { &ODatabaseMetaDataResultSet_CreateInstance, &ODatabaseMetaDataResultSet::getImplementationName_Static, &ODatabaseMetaDataResultSet::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, nullptr, 0 }, - { &ParameterSubstitution::create, &ParameterSubstitution::getImplementationName_Static, &ParameterSubstitution::getSupportedServiceNames_Static, - &cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } - }; -} - -extern "C" -{ - - -SAL_DLLPUBLIC_EXPORT void* dbtools_component_getFactory(const char* implName, void* serviceManager, void* registryKey) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +connectivity_dbtools_ODatabaseMetaDataResultSet_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries); -} - + return cppu::acquire(new ODatabaseMetaDataResultSet()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/commontools/ParameterSubstitution.cxx b/connectivity/source/commontools/ParameterSubstitution.cxx index 9adf63a93a73..3a58fed70b09 100644 --- a/connectivity/source/commontools/ParameterSubstitution.cxx +++ b/connectivity/source/commontools/ParameterSubstitution.cxx @@ -40,14 +40,9 @@ namespace connectivity m_xConnection = xConnection; } - OUString ParameterSubstitution::getImplementationName_Static( ) - { - return "org.openoffice.comp.helper.ParameterSubstitution"; - } - OUString SAL_CALL ParameterSubstitution::getImplementationName( ) { - return getImplementationName_Static(); + return "org.openoffice.comp.helper.ParameterSubstitution"; } sal_Bool SAL_CALL ParameterSubstitution::supportsService( const OUString& _rServiceName ) @@ -57,20 +52,10 @@ namespace connectivity Sequence< OUString > SAL_CALL ParameterSubstitution::getSupportedServiceNames( ) { - return getSupportedServiceNames_Static(); - } - - Sequence< OUString > ParameterSubstitution::getSupportedServiceNames_Static( ) - { return { "com.sun.star.sdb.ParameterSubstitution" }; } - Reference< XInterface > ParameterSubstitution::create(const Reference< XComponentContext >& _xContext) - { - return *(new ParameterSubstitution(_xContext)); - } - OUString SAL_CALL ParameterSubstitution::substituteVariables( const OUString& _sText, sal_Bool /*bSubstRequired*/ ) { OUString sRet = _sText; @@ -110,5 +95,11 @@ namespace connectivity } // connectivity +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +connectivity_dbtools_ParameterSubstitution_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new connectivity::ParameterSubstitution(context)); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/dbtools/dbtools.component b/connectivity/source/dbtools/dbtools.component index 424b26625ad5..76dadcc033ac 100644 --- a/connectivity/source/dbtools/dbtools.component +++ b/connectivity/source/dbtools/dbtools.component @@ -18,11 +18,13 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="dbtools" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="org.openoffice.comp.helper.DatabaseMetaDataResultSet"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="org.openoffice.comp.helper.DatabaseMetaDataResultSet" + constructor="connectivity_dbtools_ODatabaseMetaDataResultSet_get_implementation"> <service name="com.sun.star.sdbc.ResultSet"/> </implementation> - <implementation name="org.openoffice.comp.helper.ParameterSubstitution"> + <implementation name="org.openoffice.comp.helper.ParameterSubstitution" + constructor="connectivity_dbtools_ParameterSubstitution_get_implementation"> <service name="com.sun.star.sdb.ParameterSubstitution"/> </implementation> </component> diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx index d5d9fc8ce9df..de20771f9787 100644 --- a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx +++ b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx @@ -150,11 +150,6 @@ namespace connectivity // XServiceInfo - /// @throws css::uno::RuntimeException - static OUString getImplementationName_Static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ); - protected: virtual OUString SAL_CALL getImplementationName( ) override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; diff --git a/connectivity/source/inc/ParameterSubstitution.hxx b/connectivity/source/inc/ParameterSubstitution.hxx index 59d9b1a91ece..e0a540332ff3 100644 --- a/connectivity/source/inc/ParameterSubstitution.hxx +++ b/connectivity/source/inc/ParameterSubstitution.hxx @@ -42,14 +42,8 @@ namespace connectivity ParameterSubstitution( const ParameterSubstitution& ) = delete; ParameterSubstitution& operator=( const ParameterSubstitution& ) = delete; public: - /// @throws css::uno::RuntimeException - static OUString getImplementationName_Static( ); - /// @throws css::uno::RuntimeException - static css::uno::Sequence< OUString > getSupportedServiceNames_Static( ); - static css::uno::Reference< css::uno::XInterface > create( const css::uno::Reference< css::uno::XComponentContext > & xContext); - private: ParameterSubstitution(const css::uno::Reference< css::uno::XComponentContext >& _rxContext ); - virtual ~ParameterSubstitution() override {} + private: // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) override; |