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>
This commit is contained in:
@@ -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();
|
||||
return Sequence<OUString>{ "com.sun.star.sdbc.ResultSet" };
|
||||
}
|
||||
|
||||
namespace connectivity
|
||||
{
|
||||
/// @throws Exception
|
||||
static Reference< XInterface > ODatabaseMetaDataResultSet_CreateInstance(const Reference< XComponentContext >& )
|
||||
{
|
||||
return *(new ODatabaseMetaDataResultSet());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
connectivity_dbtools_ODatabaseMetaDataResultSet_get_implementation(
|
||||
css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return cppu::component_getFactoryHelper(implName, serviceManager, registryKey, entries);
|
||||
}
|
||||
|
||||
return cppu::acquire(new ODatabaseMetaDataResultSet());
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -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 )
|
||||
@@ -56,21 +51,11 @@ 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: */
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user