scripting/basprov: create instances with uno constructors

See tdf#74608 for motivation.

Change-Id: Id4a312df7b3ed4c4c81f7f1b42b8e8697d4bb784
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98742
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-07-14 12:48:58 +02:00
parent b2835b2a65
commit e78b16632f
2 changed files with 13 additions and 56 deletions

View file

@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="basprov" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.scripting.ScriptProviderForBasic">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.scripting.ScriptProviderForBasic"
constructor="scripting_BasicProviderImpl_get_implementation">
<service name="com.sun.star.script.browse.BrowseNode"/>
<service name="com.sun.star.script.provider.LanguageScriptProvider"/>
<service name="com.sun.star.script.provider.ScriptProvider"/>

View file

@ -60,28 +60,6 @@ using namespace ::sf_misc;
namespace basprov
{
// component operations
static OUString getImplementationName_BasicProviderImpl()
{
return "com.sun.star.comp.scripting.ScriptProviderForBasic";
}
static Sequence< OUString > getSupportedServiceNames_BasicProviderImpl()
{
static Sequence< OUString > s_Names{
"com.sun.star.script.provider.ScriptProviderForBasic",
"com.sun.star.script.provider.LanguageScriptProvider",
"com.sun.star.script.provider.ScriptProvider",
"com.sun.star.script.browse.BrowseNode"};
return s_Names;
}
// BasicProviderImpl
@ -170,7 +148,7 @@ namespace basprov
// XServiceInfo
OUString BasicProviderImpl::getImplementationName( )
{
return getImplementationName_BasicProviderImpl();
return "com.sun.star.comp.scripting.ScriptProviderForBasic";
}
sal_Bool BasicProviderImpl::supportsService( const OUString& rServiceName )
@ -180,7 +158,11 @@ namespace basprov
Sequence< OUString > BasicProviderImpl::getSupportedServiceNames( )
{
return getSupportedServiceNames_BasicProviderImpl();
return {
"com.sun.star.script.provider.ScriptProviderForBasic",
"com.sun.star.script.provider.LanguageScriptProvider",
"com.sun.star.script.provider.ScriptProvider",
"com.sun.star.script.browse.BrowseNode"};
}
@ -484,40 +466,14 @@ namespace basprov
// component operations
static Reference< XInterface > create_BasicProviderImpl(
Reference< XComponentContext > const & xContext )
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
scripting_BasicProviderImpl_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{
return static_cast< lang::XTypeProvider * >( new BasicProviderImpl( xContext ) );
return cppu::acquire(new BasicProviderImpl(context));
}
struct ::cppu::ImplementationEntry const s_component_entries [] =
{
{
create_BasicProviderImpl, getImplementationName_BasicProviderImpl,
getSupportedServiceNames_BasicProviderImpl, ::cppu::createSingleComponentFactory,
nullptr, 0
},
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
};
} // namespace basprov
// component exports
extern "C"
{
SAL_DLLPUBLIC_EXPORT void * basprov_component_getFactory(
const char * pImplName, void * pServiceManager,
void * pRegistryKey )
{
return ::cppu::component_getFactoryHelper(
pImplName, pServiceManager, pRegistryKey, ::basprov::s_component_entries );
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */