diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-06 14:10:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-07 11:34:25 +0200 |
commit | 439c9460408bb379cf2d37f3831461cf6879fb74 (patch) | |
tree | 80e3c92623023ea60dcb5134639e03ef18baf9c3 /vcl/source/components | |
parent | 859e4dd6b5680e15a454fd0f8c0eae67459fe177 (diff) |
vcl: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: I7f03e024eef5413d84d98f3fa9bd45ecaf413a72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98233
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl/source/components')
-rw-r--r-- | vcl/source/components/factory.cxx | 14 | ||||
-rw-r--r-- | vcl/source/components/fontident.cxx | 28 |
2 files changed, 11 insertions, 31 deletions
diff --git a/vcl/source/components/factory.cxx b/vcl/source/components/factory.cxx index a82c71435453..6c1cfe2ec872 100644 --- a/vcl/source/components/factory.cxx +++ b/vcl/source/components/factory.cxx @@ -43,19 +43,7 @@ extern "C" { static_cast< css::lang::XMultiServiceFactory* >( pXUnoSMgr ) ); Reference< css::lang::XSingleServiceFactory > xFactory; - if( vcl_session_getImplementationName().equalsAscii( pImplementationName ) ) - { - xFactory = ::cppu::createOneInstanceFactory( - xMgr, vcl_session_getImplementationName(), vcl_session_createInstance, - vcl_session_getSupportedServiceNames() ); - } - else if( vcl::FontIdentificator_getImplementationName().equalsAscii( pImplementationName ) ) - { - xFactory = ::cppu::createSingleFactory( - xMgr, vcl::FontIdentificator_getImplementationName(), vcl::FontIdentificator_createInstance, - vcl::FontIdentificator_getSupportedServiceNames() ); - } - else if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) ) + if( vcl::Clipboard_getImplementationName().equalsAscii( pImplementationName ) ) { xFactory = vcl::Clipboard_createFactory(); } diff --git a/vcl/source/components/fontident.cxx b/vcl/source/components/fontident.cxx index b5ad54e5d612..fd4cbb2d2b59 100644 --- a/vcl/source/components/fontident.cxx +++ b/vcl/source/components/fontident.cxx @@ -50,7 +50,7 @@ class FontIdentificator : public ::cppu::WeakAggImplHelper3< XMaterialHolder, XI { Font m_aFont; public: -FontIdentificator() {} + FontIdentificator() {} // XServiceInfo virtual OUString SAL_CALL getImplementationName( ) override; @@ -148,25 +148,10 @@ Any SAL_CALL FontIdentificator::getMaterial() return makeAny( aFD ); } -Sequence< OUString > FontIdentificator_getSupportedServiceNames() -{ - return Sequence< OUString >{ "com.sun.star.awt.FontIdentificator" }; -} - -OUString FontIdentificator_getImplementationName() -{ - return "vcl::FontIdentificator"; -} - -Reference< XInterface > FontIdentificator_createInstance( const Reference< XMultiServiceFactory >& ) -{ - return static_cast< ::cppu::OWeakObject * >( new FontIdentificator ); -} - // XServiceInfo OUString SAL_CALL FontIdentificator::getImplementationName() { - return FontIdentificator_getImplementationName(); + return "vcl::FontIdentificator"; } sal_Bool SAL_CALL FontIdentificator::supportsService( const OUString& i_rServiceName ) @@ -176,9 +161,16 @@ sal_Bool SAL_CALL FontIdentificator::supportsService( const OUString& i_rService Sequence< OUString > SAL_CALL FontIdentificator::getSupportedServiceNames() { - return FontIdentificator_getSupportedServiceNames(); + return { "com.sun.star.awt.FontIdentificator" }; } } // namespace vcl +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +vcl_FontIdentificator_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new vcl::FontIdentificator()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |