diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2015-11-20 21:12:27 +0100 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2015-12-03 21:07:35 +0100 |
commit | 81fa5340191baf8687f9c82f1f414f5afc86b529 (patch) | |
tree | 5e5f28e86b9a1eaf923be5f17dc05e125c14cf1d | |
parent | 04164c70f23ff49c308f62f36e45a589afa168d0 (diff) |
tdf#74608 dbaccess: Constructor feature for ODatabaseSource
Change-Id: I9ab9c0eaf463c93caf116c98e47564562af0af5d
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.cxx | 42 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/datasource.hxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/inc/services.hxx | 1 | ||||
-rw-r--r-- | dbaccess/source/core/misc/services.cxx | 1 | ||||
-rw-r--r-- | dbaccess/util/dba.component | 3 |
5 files changed, 11 insertions, 42 deletions
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 73bf3c8d3810..00e9d3fc551a 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -18,8 +18,6 @@ */ #include "datasource.hxx" -#include "module_dba.hxx" -#include "services.hxx" #include "userinformation.hxx" #include "commandcontainer.hxx" #include "dbastrings.hrc" @@ -472,17 +470,6 @@ namespace }; } -} // namespace dbaccess - -// ODatabaseContext - -extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource() -{ - static ::dba::OAutoRegistration< ::dbaccess::ODatabaseSource > aAutoRegistration; -} - -namespace dbaccess -{ ODatabaseSource::ODatabaseSource(const ::rtl::Reference<ODatabaseModelImpl>& _pImpl) :ModelDependentComponent( _pImpl ) @@ -560,31 +547,12 @@ void SAL_CALL ODatabaseSource::disposing( const css::lang::EventObject& Source ) // XServiceInfo OUString ODatabaseSource::getImplementationName( ) throw(RuntimeException, std::exception) { - return getImplementationName_static(); -} - -OUString ODatabaseSource::getImplementationName_static( ) throw(RuntimeException) -{ return OUString("com.sun.star.comp.dba.ODatabaseSource"); } Sequence< OUString > ODatabaseSource::getSupportedServiceNames( ) throw (RuntimeException, std::exception) { - return getSupportedServiceNames_static(); -} - -Reference< XInterface > ODatabaseSource::Create( const Reference< XComponentContext >& _rxContext ) -{ - Reference< XDatabaseContext > xDBContext( DatabaseContext::create(_rxContext) ); - return xDBContext->createInstance(); -} - -Sequence< OUString > ODatabaseSource::getSupportedServiceNames_static( ) throw (RuntimeException) -{ - Sequence< OUString > aSNS( 2 ); - aSNS[0] = SERVICE_SDB_DATASOURCE; - aSNS[1] = "com.sun.star.sdb.DocumentDataSource"; - return aSNS; + return { SERVICE_SDB_DATASOURCE, "com.sun.star.sdb.DocumentDataSource" }; } sal_Bool ODatabaseSource::supportsService( const OUString& _rServiceName ) throw (RuntimeException, std::exception) @@ -1355,4 +1323,12 @@ Reference< XInterface > ODatabaseSource::getThis() const } // namespace dbaccess +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* SAL_CALL +com_sun_star_comp_dba_ODatabaseSource(css::uno::XComponentContext* context, + css::uno::Sequence<css::uno::Any> const &) +{ + css::uno::Reference< XDatabaseContext > xDBContext( DatabaseContext::create(context) ); + return cppu::acquire(static_cast<OWeakObject*>(xDBContext->createInstance().get())); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx index 3c4caf29890d..446b846fbd7a 100644 --- a/dbaccess/source/core/dataaccess/datasource.hxx +++ b/dbaccess/source/core/dataaccess/datasource.hxx @@ -129,12 +129,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw(css::uno::RuntimeException, std::exception) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw(css::uno::RuntimeException, std::exception) override; -// css::lang::XServiceInfo - static methods - static css::uno::Sequence< OUString > getSupportedServiceNames_static() throw( css::uno::RuntimeException ); - static OUString getImplementationName_static() throw( css::uno::RuntimeException ); - static css::uno::Reference< css::uno::XInterface > - SAL_CALL Create(const css::uno::Reference< css::uno::XComponentContext >&); - // OComponentHelper virtual void SAL_CALL disposing() override; diff --git a/dbaccess/source/core/inc/services.hxx b/dbaccess/source/core/inc/services.hxx index d93b5057b5af..1919ff843269 100644 --- a/dbaccess/source/core/inc/services.hxx +++ b/dbaccess/source/core/inc/services.hxx @@ -28,7 +28,6 @@ extern "C" void SAL_CALL createRegistryInfo_DataAccessDescriptorFactory(); extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition(); extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition(); extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument(); -extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource(); #endif diff --git a/dbaccess/source/core/misc/services.cxx b/dbaccess/source/core/misc/services.cxx index a3b814307325..2118576dd1e4 100644 --- a/dbaccess/source/core/misc/services.cxx +++ b/dbaccess/source/core/misc/services.cxx @@ -61,7 +61,6 @@ extern "C" void SAL_CALL createRegistryInfo_DBA() createRegistryInfo_OCommandDefinition(); createRegistryInfo_OComponentDefinition(); createRegistryInfo_ODatabaseDocument(); - createRegistryInfo_ODatabaseSource(); createRegistryInfo_DataAccessDescriptorFactory(); bInit = true; } diff --git a/dbaccess/util/dba.component b/dbaccess/util/dba.component index 8c85a8d30d0e..4448f72d8a86 100644 --- a/dbaccess/util/dba.component +++ b/dbaccess/util/dba.component @@ -39,7 +39,8 @@ <service name="com.sun.star.document.OfficeDocument"/> <service name="com.sun.star.sdb.OfficeDatabaseDocument"/> </implementation> - <implementation name="com.sun.star.comp.dba.ODatabaseSource"> + <implementation name="com.sun.star.comp.dba.ODatabaseSource" + constructor="com_sun_star_comp_dba_ODatabaseSource"> <service name="com.sun.star.sdb.DataSource"/> <service name="com.sun.star.sdb.DocumentDataSource"/> </implementation> |