scripting/provider: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: If5337702e4bdc583bbae34e90a89c20b7341937e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98738 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -612,46 +612,19 @@ BrowseNodeFactoryImpl::getOrganizerHierarchy() const
|
||||
return xRet;
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
|
||||
|
||||
// Namespace global methods for setting up BrowseNodeFactory service
|
||||
|
||||
|
||||
Sequence< OUString >
|
||||
bnf_getSupportedServiceNames( )
|
||||
{
|
||||
return { "com.sun.star.script.browse.BrowseNodeFactory" };
|
||||
}
|
||||
|
||||
OUString
|
||||
bnf_getImplementationName( )
|
||||
{
|
||||
return
|
||||
"com.sun.star.script.browse.BrowseNodeFactory";
|
||||
}
|
||||
|
||||
Reference< XInterface >
|
||||
bnf_create( Reference< XComponentContext > const & xComponentContext )
|
||||
{
|
||||
return static_cast< ::cppu::OWeakObject * >(
|
||||
new BrowseNodeFactoryImpl( xComponentContext ) );
|
||||
}
|
||||
|
||||
|
||||
// Implementation of XServiceInfo
|
||||
|
||||
|
||||
OUString SAL_CALL
|
||||
BrowseNodeFactoryImpl::getImplementationName()
|
||||
{
|
||||
return bnf_getImplementationName();
|
||||
return "com.sun.star.script.browse.BrowseNodeFactory";
|
||||
}
|
||||
|
||||
Sequence< OUString > SAL_CALL
|
||||
BrowseNodeFactoryImpl::getSupportedServiceNames()
|
||||
{
|
||||
return bnf_getSupportedServiceNames();
|
||||
return { "com.sun.star.script.browse.BrowseNodeFactory" };
|
||||
}
|
||||
|
||||
sal_Bool BrowseNodeFactoryImpl::supportsService(OUString const & serviceName )
|
||||
@@ -659,6 +632,13 @@ sal_Bool BrowseNodeFactoryImpl::supportsService(OUString const & serviceName )
|
||||
return cppu::supportsService(this, serviceName);
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
scripting_BrowseNodeFactoryImpl_get_implementation(
|
||||
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
return cppu::acquire(new BrowseNodeFactoryImpl(context));
|
||||
}
|
||||
|
||||
} // namespace browsenodefactory
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -665,101 +665,14 @@ Sequence< OUString > SAL_CALL MasterScriptProvider::getSupportedServiceNames( )
|
||||
"com.sun.star.script.provider.ScriptProvider" };
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
scripting_MasterScriptProvider_get_implementation(
|
||||
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
return cppu::acquire(new MasterScriptProvider(context));
|
||||
}
|
||||
|
||||
} // namespace func_provider
|
||||
|
||||
|
||||
namespace scripting_runtimemgr
|
||||
{
|
||||
|
||||
static Reference< XInterface > sp_create(
|
||||
const Reference< XComponentContext > & xCompC )
|
||||
{
|
||||
return static_cast<cppu::OWeakObject *>(new ::func_provider::MasterScriptProvider( xCompC ));
|
||||
}
|
||||
|
||||
|
||||
static Sequence< OUString > sp_getSupportedServiceNames( )
|
||||
{
|
||||
return { "com.sun.star.script.provider.MasterScriptProvider",
|
||||
"com.sun.star.script.browse.BrowseNode",
|
||||
"com.sun.star.script.provider.ScriptProvider" };
|
||||
}
|
||||
|
||||
|
||||
static OUString sp_getImplementationName( )
|
||||
{
|
||||
return "com.sun.star.script.provider.MasterScriptProvider";
|
||||
}
|
||||
|
||||
// ***** registration or ScriptingFrameworkURIHelper
|
||||
static Reference< XInterface > urihelper_create(
|
||||
const Reference< XComponentContext > & xCompC )
|
||||
{
|
||||
return static_cast<cppu::OWeakObject *>(
|
||||
new ::func_provider::ScriptingFrameworkURIHelper( xCompC ));
|
||||
}
|
||||
|
||||
static Sequence< OUString > urihelper_getSupportedServiceNames( )
|
||||
{
|
||||
return { "com.sun.star.script.provider.ScriptURIHelper" };
|
||||
}
|
||||
|
||||
static OUString urihelper_getImplementationName( )
|
||||
{
|
||||
return "com.sun.star.script.provider.ScriptURIHelper";
|
||||
}
|
||||
|
||||
const struct cppu::ImplementationEntry s_entries [] =
|
||||
{
|
||||
{
|
||||
sp_create, sp_getImplementationName,
|
||||
sp_getSupportedServiceNames, cppu::createSingleComponentFactory,
|
||||
nullptr, 0
|
||||
},
|
||||
{
|
||||
urihelper_create,
|
||||
urihelper_getImplementationName,
|
||||
urihelper_getSupportedServiceNames,
|
||||
cppu::createSingleComponentFactory,
|
||||
nullptr, 0
|
||||
},
|
||||
{
|
||||
func_provider::mspf_create, func_provider::mspf_getImplementationName,
|
||||
func_provider::mspf_getSupportedServiceNames, cppu::createSingleComponentFactory,
|
||||
nullptr, 0
|
||||
},
|
||||
{
|
||||
browsenodefactory::bnf_create, browsenodefactory::bnf_getImplementationName,
|
||||
browsenodefactory::bnf_getSupportedServiceNames, cppu::createSingleComponentFactory,
|
||||
nullptr, 0
|
||||
},
|
||||
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
//#### EXPORTED ##############################################################
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
/**
|
||||
* This function is called to get service factories for an implementation.
|
||||
*
|
||||
* @param pImplName name of implementation
|
||||
* @param pServiceManager a service manager, need for component creation
|
||||
* @param pRegistryKey the registry key for this component, need for persistent
|
||||
* data
|
||||
* @return a component factory
|
||||
*/
|
||||
SAL_DLLPUBLIC_EXPORT void * scriptframe_component_getFactory(
|
||||
const char * pImplName,
|
||||
void * pServiceManager,
|
||||
void * pRegistryKey )
|
||||
{
|
||||
return ::cppu::component_getFactoryHelper( pImplName, pServiceManager,
|
||||
pRegistryKey, ::scripting_runtimemgr::s_entries );
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -126,17 +126,6 @@ private:
|
||||
OUString m_sCtxString;
|
||||
};
|
||||
|
||||
OUString mspf_getImplementationName() ;
|
||||
css::uno::Reference< css::uno::XInterface > mspf_create( css::uno::Reference< css::uno::XComponentContext > const & xComponentContext );
|
||||
css::uno::Sequence< OUString > mspf_getSupportedServiceNames();
|
||||
|
||||
}
|
||||
|
||||
namespace browsenodefactory
|
||||
{
|
||||
OUString bnf_getImplementationName() ;
|
||||
css::uno::Reference< css::uno::XInterface > bnf_create( css::uno::Reference< css::uno::XComponentContext > const & xComponentContext );
|
||||
css::uno::Sequence< OUString > bnf_getSupportedServiceNames();
|
||||
}
|
||||
|
||||
#endif // INCLUDED_SCRIPTING_SOURCE_PROVIDER_MASTERSCRIPTPROVIDER_HXX
|
||||
|
||||
@@ -58,31 +58,14 @@ MasterScriptProviderFactory::getActiveMSPList() const
|
||||
return m_MSPList;
|
||||
}
|
||||
|
||||
Sequence< OUString > mspf_getSupportedServiceNames( )
|
||||
{
|
||||
return { "com.sun.star.script.provider.MasterScriptProviderFactory" };
|
||||
}
|
||||
|
||||
OUString mspf_getImplementationName( )
|
||||
OUString SAL_CALL MasterScriptProviderFactory::getImplementationName()
|
||||
{
|
||||
return "com.sun.star.script.provider.MasterScriptProviderFactory";
|
||||
}
|
||||
|
||||
Reference< XInterface >
|
||||
mspf_create( Reference< XComponentContext > const & xComponentContext )
|
||||
{
|
||||
return static_cast< ::cppu::OWeakObject * >(
|
||||
new MasterScriptProviderFactory( xComponentContext ) );
|
||||
}
|
||||
|
||||
OUString SAL_CALL MasterScriptProviderFactory::getImplementationName()
|
||||
{
|
||||
return mspf_getImplementationName();
|
||||
}
|
||||
|
||||
Sequence< OUString > SAL_CALL MasterScriptProviderFactory::getSupportedServiceNames()
|
||||
{
|
||||
return mspf_getSupportedServiceNames();
|
||||
return { "com.sun.star.script.provider.MasterScriptProviderFactory" };
|
||||
}
|
||||
|
||||
sal_Bool MasterScriptProviderFactory::supportsService(
|
||||
@@ -93,4 +76,11 @@ sal_Bool MasterScriptProviderFactory::supportsService(
|
||||
|
||||
} // namespace func_provider
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
scripting_MasterScriptProviderFactory_get_implementation(
|
||||
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
return cppu::acquire(new func_provider::MasterScriptProviderFactory(context));
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -253,6 +253,15 @@ ScriptingFrameworkURIHelper::getSupportedServiceNames()
|
||||
{
|
||||
return { "com.sun.star.script.provider.ScriptURIHelper" };
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
scripting_ScriptingFrameworkURIHelper_get_implementation(
|
||||
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
return cppu::acquire(new ScriptingFrameworkURIHelper(context));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||
|
||||
@@ -18,23 +18,25 @@
|
||||
-->
|
||||
|
||||
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
|
||||
prefix="scriptframe" xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.script.browse.BrowseNodeFactory">
|
||||
xmlns="http://openoffice.org/2010/uno-components">
|
||||
<implementation name="com.sun.star.script.browse.BrowseNodeFactory"
|
||||
constructor="scripting_BrowseNodeFactoryImpl_get_implementation">
|
||||
<service name="com.sun.star.script.browse.BrowseNodeFactory"/>
|
||||
<singleton name="com.sun.star.script.browse.theBrowseNodeFactory"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.script.provider.MasterScriptProvider">
|
||||
<implementation name="com.sun.star.script.provider.MasterScriptProvider"
|
||||
constructor="scripting_MasterScriptProvider_get_implementation">
|
||||
<service name="com.sun.star.script.browse.BrowseNode"/>
|
||||
<service name="com.sun.star.script.provider.MasterScriptProvider"/>
|
||||
<service name="com.sun.star.script.provider.ScriptProvider"/>
|
||||
</implementation>
|
||||
<implementation
|
||||
name="com.sun.star.script.provider.MasterScriptProviderFactory">
|
||||
<implementation name="com.sun.star.script.provider.MasterScriptProviderFactory"
|
||||
constructor="scripting_MasterScriptProviderFactory_get_implementation">
|
||||
<service name="com.sun.star.script.provider.MasterScriptProviderFactory"/>
|
||||
<singleton
|
||||
name="com.sun.star.script.provider.theMasterScriptProviderFactory"/>
|
||||
<singleton name="com.sun.star.script.provider.theMasterScriptProviderFactory"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.script.provider.ScriptURIHelper">
|
||||
<implementation name="com.sun.star.script.provider.ScriptURIHelper"
|
||||
constructor="scripting_ScriptingFrameworkURIHelper_get_implementation">
|
||||
<service name="com.sun.star.script.provider.ScriptURIHelper"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
||||
Reference in New Issue
Block a user