diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 12:45:52 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 20:25:08 +0200 |
commit | b4f1f2dc427cad5829911de01e00a4c7d4e7dd50 (patch) | |
tree | 5104ae2fea040fe49e1ce3c94489937b30e029e1 | |
parent | fb6a74e850a402ceaee7c26dce1ffc48c0798ede (diff) |
scripting/dlgprov: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: Ia135b0696a52dd414b5187f33195e8b86d552c2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98741
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | scripting/source/dlgprov/DialogModelProvider.cxx | 11 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.component | 8 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.cxx | 74 | ||||
-rw-r--r-- | scripting/source/dlgprov/dlgprov.hxx | 10 |
4 files changed, 22 insertions, 81 deletions
diff --git a/scripting/source/dlgprov/DialogModelProvider.cxx b/scripting/source/dlgprov/DialogModelProvider.cxx index 5f9e4e15a032..e49ed058d475 100644 --- a/scripting/source/dlgprov/DialogModelProvider.cxx +++ b/scripting/source/dlgprov/DialogModelProvider.cxx @@ -141,7 +141,7 @@ void SAL_CALL DialogModelProvider::removeVetoableChangeListener( const OUString& // com.sun.star.uno.XServiceInfo: OUString SAL_CALL DialogModelProvider::getImplementationName() { - return comp_DialogModelProvider::_getImplementationName(); + return "com.sun.star.comp.scripting.DialogModelProvider"; } sal_Bool SAL_CALL DialogModelProvider::supportsService(OUString const & serviceName) @@ -151,9 +151,16 @@ sal_Bool SAL_CALL DialogModelProvider::supportsService(OUString const & serviceN css::uno::Sequence< OUString > SAL_CALL DialogModelProvider::getSupportedServiceNames() { - return comp_DialogModelProvider::_getSupportedServiceNames(); + return { "com.sun.star.awt.UnoControlDialogModelProvider" }; } } // closing anonymous implementation namespace +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +scripting_DialogModelProvider_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new dlgprov::DialogModelProvider(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/dlgprov/dlgprov.component b/scripting/source/dlgprov/dlgprov.component index f93b25dc6585..35203afb831c 100644 --- a/scripting/source/dlgprov/dlgprov.component +++ b/scripting/source/dlgprov/dlgprov.component @@ -18,13 +18,15 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="dlgprov" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.scripting.DialogProvider"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.scripting.DialogProvider" + constructor="scripting_DialogProviderImpl_get_implementation"> <service name="com.sun.star.awt.ContainerWindowProvider"/> <service name="com.sun.star.awt.DialogProvider"/> <service name="com.sun.star.awt.DialogProvider2"/> </implementation> - <implementation name="com.sun.star.comp.scripting.DialogModelProvider"> + <implementation name="com.sun.star.comp.scripting.DialogModelProvider" + constructor="scripting_DialogModelProvider_get_implementation"> <service name="com.sun.star.awt.UnoControlDialogModelProvider"/> </implementation> </component> diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx index 2117982e7c39..22a2839b4042 100644 --- a/scripting/source/dlgprov/dlgprov.cxx +++ b/scripting/source/dlgprov/dlgprov.cxx @@ -62,27 +62,6 @@ using namespace beans; using namespace document; using namespace ::sf_misc; -// component helper namespace -namespace comp_DialogModelProvider -{ - - OUString _getImplementationName() - { - return "com.sun.star.comp.scripting.DialogModelProvider"; - } - - uno::Sequence< OUString > _getSupportedServiceNames() - { - uno::Sequence< OUString > s { "com.sun.star.awt.UnoControlDialogModelProvider" }; - return s; - } - - static uno::Reference< uno::XInterface > _create(const uno::Reference< uno::XComponentContext > & context) - { - return static_cast< ::cppu::OWeakObject * >(new dlgprov::DialogModelProvider(context)); - } -} // closing component helper namespace - namespace dlgprov { @@ -154,23 +133,6 @@ namespace dlgprov return xDialogModel; } - // component operations - - - static OUString getImplementationName_DialogProviderImpl() - { - return "com.sun.star.comp.scripting.DialogProvider"; - } - - - static Sequence< OUString > getSupportedServiceNames_DialogProviderImpl() - { - return { "com.sun.star.awt.DialogProvider", - "com.sun.star.awt.DialogProvider2", - "com.sun.star.awt.ContainerWindowProvider" }; - } - - // mutex @@ -538,7 +500,7 @@ namespace dlgprov OUString DialogProviderImpl::getImplementationName( ) { - return getImplementationName_DialogProviderImpl(); + return "com.sun.star.comp.scripting.DialogProvider"; } sal_Bool DialogProviderImpl::supportsService( const OUString& rServiceName ) @@ -548,7 +510,9 @@ namespace dlgprov Sequence< OUString > DialogProviderImpl::getSupportedServiceNames( ) { - return getSupportedServiceNames_DialogProviderImpl(); + return { "com.sun.star.awt.DialogProvider", + "com.sun.star.awt.DialogProvider2", + "com.sun.star.awt.ContainerWindowProvider" }; } @@ -728,36 +692,14 @@ namespace dlgprov // component operations - static Reference< XInterface > create_DialogProviderImpl( - Reference< XComponentContext > const & xContext ) + extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* + scripting_DialogProviderImpl_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&) { - return static_cast< lang::XTypeProvider * >( new DialogProviderImpl( xContext ) ); + return cppu::acquire(new DialogProviderImpl(context)); } - - struct ::cppu::ImplementationEntry const s_component_entries [] = - { - {create_DialogProviderImpl, getImplementationName_DialogProviderImpl,getSupportedServiceNames_DialogProviderImpl, ::cppu::createSingleComponentFactory,nullptr, 0}, - { &comp_DialogModelProvider::_create,&comp_DialogModelProvider::_getImplementationName,&comp_DialogModelProvider::_getSupportedServiceNames,&::cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } - }; - - } // namespace dlgprov -// component exports - - -extern "C" -{ - SAL_DLLPUBLIC_EXPORT void * dlgprov_component_getFactory( - const char * pImplName, void * pServiceManager, - void * pRegistryKey ) - { - return ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, ::dlgprov::s_component_entries ); - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx index fb5957619e08..cfd48fd3cd6d 100644 --- a/scripting/source/dlgprov/dlgprov.hxx +++ b/scripting/source/dlgprov/dlgprov.hxx @@ -145,14 +145,4 @@ namespace dlgprov } // namespace dlgprov - -// component helper namespace -namespace comp_DialogModelProvider { - -// component and service helper functions: -OUString _getImplementationName(); -css::uno::Sequence< OUString > _getSupportedServiceNames(); - -} // namespace comp_DialogModelProvider - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |