diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 10:16:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 12:04:06 +0200 |
commit | 3fbadfa1ad41a3477804c592e06caec708c05218 (patch) | |
tree | e070ddf4fb572c16d07a0afcebffd28b8987c2e6 /lingucomponent/source/thesaurus/libnth/nthesimp.cxx | |
parent | c6642e6c2366741eba893f2e91a6bc2761df7c35 (diff) |
lingucomponent: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I11770c8873d14cfd0e438fb580d8d0ea9e99f594
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98709
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lingucomponent/source/thesaurus/libnth/nthesimp.cxx')
-rw-r--r-- | lingucomponent/source/thesaurus/libnth/nthesimp.cxx | 45 |
1 files changed, 8 insertions, 37 deletions
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index b24b8beb51f4..11f557cd1d54 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -452,14 +452,6 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM return noMeanings; } -/// @throws Exception -static Reference< XInterface > Thesaurus_CreateInstance( - const Reference< XMultiServiceFactory > & /*rSMgr*/ ) -{ - Reference< XInterface > xService = static_cast<cppu::OWeakObject*>(new Thesaurus); - return xService; -} - OUString SAL_CALL Thesaurus::getServiceDisplayName(const Locale& rLocale) { std::locale loc(Translate::Create("svt", LanguageTag(rLocale))); @@ -558,7 +550,7 @@ void SAL_CALL Thesaurus::removeEventListener( const Reference< XEventListener >& // Service specific part OUString SAL_CALL Thesaurus::getImplementationName() { - return getImplementationName_Static(); + return "org.openoffice.lingu.new.Thesaurus"; } sal_Bool SAL_CALL Thesaurus::supportsService( const OUString& ServiceName ) @@ -568,37 +560,16 @@ sal_Bool SAL_CALL Thesaurus::supportsService( const OUString& ServiceName ) Sequence< OUString > SAL_CALL Thesaurus::getSupportedServiceNames() { - return getSupportedServiceNames_Static(); -} - -Sequence< OUString > Thesaurus::getSupportedServiceNames_Static() - throw() -{ - Sequence< OUString > aSNS { SN_THESAURUS }; - return aSNS; + return { SN_THESAURUS }; } -extern "C" +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +lingucomponent_Thesaurus_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { -SAL_DLLPUBLIC_EXPORT void * lnth_component_getFactory( - const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = nullptr; - if ( Thesaurus::getImplementationName_Static().equalsAscii( pImplName ) ) - { - - Reference< XSingleServiceFactory > xFactory = - cppu::createOneInstanceFactory( - static_cast< XMultiServiceFactory * >( pServiceManager ), - Thesaurus::getImplementationName_Static(), - Thesaurus_CreateInstance, - Thesaurus::getSupportedServiceNames_Static()); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; -} + static rtl::Reference<Thesaurus> g_Instance(new Thesaurus()); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |