diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 09:45:14 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-14 11:51:32 +0200 |
commit | 4cc40d5fbf88588220f7ae80d8122f9218fafeec (patch) | |
tree | 94a1dcb17c822847ecd466dfe09c367c2eeb629c /linguistic | |
parent | c70e400b193f752647d31b73f484852bf1c728cb (diff) |
linguistic: create instances with uno constructors
See tdf#74608 for motivation.
Change-Id: I1ee71beb89d778213fa4bb22fb7d350ed77879c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98707
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'linguistic')
-rw-r--r-- | linguistic/Library_lng.mk | 1 | ||||
-rw-r--r-- | linguistic/source/convdiclist.cxx | 47 | ||||
-rw-r--r-- | linguistic/source/convdiclist.hxx | 12 | ||||
-rw-r--r-- | linguistic/source/dlistimp.cxx | 43 | ||||
-rw-r--r-- | linguistic/source/dlistimp.hxx | 10 | ||||
-rw-r--r-- | linguistic/source/gciterator.cxx | 49 | ||||
-rw-r--r-- | linguistic/source/lng.component | 17 | ||||
-rw-r--r-- | linguistic/source/lngopt.cxx | 41 | ||||
-rw-r--r-- | linguistic/source/lngopt.hxx | 10 | ||||
-rw-r--r-- | linguistic/source/lngreg.cxx | 63 | ||||
-rw-r--r-- | linguistic/source/lngreg.hxx | 63 | ||||
-rw-r--r-- | linguistic/source/lngsvcmgr.cxx | 41 | ||||
-rw-r--r-- | linguistic/source/lngsvcmgr.hxx | 9 |
13 files changed, 53 insertions, 353 deletions
diff --git a/linguistic/Library_lng.mk b/linguistic/Library_lng.mk index 39a908f7bd69..517177ec393d 100644 --- a/linguistic/Library_lng.mk +++ b/linguistic/Library_lng.mk @@ -66,7 +66,6 @@ $(eval $(call gb_Library_add_exception_objects,lng,\ linguistic/source/iprcache \ linguistic/source/lngopt \ linguistic/source/lngprophelp \ - linguistic/source/lngreg \ linguistic/source/lngsvcmgr \ linguistic/source/misc \ linguistic/source/misc2 \ diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx index 60ba0e0d2cf5..9efd7e9151d3 100644 --- a/linguistic/source/convdiclist.cxx +++ b/linguistic/source/convdiclist.cxx @@ -43,7 +43,6 @@ #include "convdic.hxx" #include "convdiclist.hxx" #include "hhconvdic.hxx" -#include "lngreg.hxx" #include <linguistic/misc.hxx> using namespace osl; @@ -54,8 +53,6 @@ using namespace com::sun::star::container; using namespace com::sun::star::linguistic2; using namespace linguistic; -#define SN_CONV_DICTIONARY_LIST "com.sun.star.linguistic2.ConversionDictionaryList" - static OUString GetConvDicMainURL( const OUString &rDicName, const OUString &rDirectoryURL ) { // build URL to use for new (persistent) dictionaries @@ -315,9 +312,9 @@ void ConvDicNameContainer::AddConvDics( namespace { struct StaticConvDicList : public rtl::StaticWithInit< - uno::Reference<XInterface>, StaticConvDicList> { - uno::Reference<XInterface> operator () () { - return static_cast<cppu::OWeakObject *>(new ConvDicList); + rtl::Reference<ConvDicList>, StaticConvDicList> { + rtl::Reference<ConvDicList> operator () () { + return new ConvDicList; } }; } @@ -520,7 +517,7 @@ void SAL_CALL ConvDicList::removeEventListener( OUString SAL_CALL ConvDicList::getImplementationName() { - return getImplementationName_Static(); + return "com.sun.star.lingu2.ConvDicList"; } sal_Bool SAL_CALL ConvDicList::supportsService( const OUString& rServiceName ) @@ -530,41 +527,15 @@ sal_Bool SAL_CALL ConvDicList::supportsService( const OUString& rServiceName ) uno::Sequence< OUString > SAL_CALL ConvDicList::getSupportedServiceNames() { - return getSupportedServiceNames_Static(); -} - -uno::Sequence< OUString > ConvDicList::getSupportedServiceNames_Static() - throw() -{ - uno::Sequence<OUString> aSNS { SN_CONV_DICTIONARY_LIST }; - return aSNS; + return { "com.sun.star.linguistic2.ConversionDictionaryList" }; } -/// @throws css::uno::Exception -static uno::Reference< uno::XInterface > ConvDicList_CreateInstance( - const uno::Reference< XMultiServiceFactory > & /*rSMgr*/ ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +linguistic_ConvDicList_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return StaticConvDicList::get(); + return cppu::acquire(StaticConvDicList::get().get()); } -void * ConvDicList_getFactory( - const char * pImplName, - XMultiServiceFactory * pServiceManager ) -{ - void * pRet = nullptr; - if ( ConvDicList::getImplementationName_Static().equalsAscii( pImplName ) ) - { - uno::Reference< XSingleServiceFactory > xFactory = - cppu::createOneInstanceFactory( - pServiceManager, - ConvDicList::getImplementationName_Static(), - ConvDicList_CreateInstance, - ConvDicList::getSupportedServiceNames_Static()); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/convdiclist.hxx b/linguistic/source/convdiclist.hxx index 52ebbd4285a1..907f53fa242e 100644 --- a/linguistic/source/convdiclist.hxx +++ b/linguistic/source/convdiclist.hxx @@ -81,22 +81,10 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; - - static inline OUString - getImplementationName_Static() throw(); - static css::uno::Sequence< OUString > - getSupportedServiceNames_Static() throw(); - // non UNO-specific void FlushDics(); }; -inline OUString ConvDicList::getImplementationName_Static() throw() -{ - return "com.sun.star.lingu2.ConvDicList"; -} - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index 26e4e48868e9..31f0a20c4230 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -44,7 +44,6 @@ #include "dlistimp.hxx" #include "dicimp.hxx" #include "lngopt.hxx" -#include "lngreg.hxx" using namespace osl; using namespace com::sun::star; @@ -345,14 +344,6 @@ sal_Int32 DicList::GetDicPos(const uno::Reference< XDictionary > &xDic) return -1; } -/// @throws Exception -static uno::Reference< XInterface > - DicList_CreateInstance( const uno::Reference< XMultiServiceFactory > & /*rSMgr*/ ) -{ - uno::Reference< XInterface > xService = static_cast<cppu::OWeakObject *>(new DicList); - return xService; -} - sal_Int16 SAL_CALL DicList::getCount() { osl::MutexGuard aGuard( GetLinguMutex() ); @@ -668,7 +659,7 @@ void DicList::SaveDics() OUString SAL_CALL DicList::getImplementationName( ) { - return getImplementationName_Static(); + return "com.sun.star.lingu2.DicList"; } @@ -679,33 +670,9 @@ sal_Bool SAL_CALL DicList::supportsService( const OUString& ServiceName ) uno::Sequence< OUString > SAL_CALL DicList::getSupportedServiceNames( ) { - return getSupportedServiceNames_Static(); -} - - -uno::Sequence< OUString > DicList::getSupportedServiceNames_Static() throw() -{ return { "com.sun.star.linguistic2.DictionaryList" }; } -void * DicList_getFactory( const char * pImplName, - XMultiServiceFactory * pServiceManager ) -{ - void * pRet = nullptr; - if ( DicList::getImplementationName_Static().equalsAscii( pImplName ) ) - { - uno::Reference< XSingleServiceFactory > xFactory = - cppu::createOneInstanceFactory( - pServiceManager, - DicList::getImplementationName_Static(), - DicList_CreateInstance, - DicList::getSupportedServiceNames_Static()); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; -} static sal_Int32 lcl_GetToken( OUString &rToken, @@ -815,5 +782,13 @@ static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& return 2 == nDicVersion || nDicVersion >= 5; } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +linguistic_DicList_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + static rtl::Reference<DicList> g_Instance(new DicList()); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/dlistimp.hxx b/linguistic/source/dlistimp.hxx index 3039f6e32448..df594cccdb68 100644 --- a/linguistic/source/dlistimp.hxx +++ b/linguistic/source/dlistimp.hxx @@ -111,20 +111,10 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - static inline OUString getImplementationName_Static() throw(); - static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); - // non UNO-specific void SaveDics(); }; -inline OUString DicList::getImplementationName_Static() throw() -{ - return "com.sun.star.lingu2.DicList"; -} - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx index 6e1a5ea0602f..45c13b1cfe72 100644 --- a/linguistic/source/gciterator.cxx +++ b/linguistic/source/gciterator.cxx @@ -53,20 +53,17 @@ #include <comphelper/propertysequence.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> +#include <rtl/ref.hxx> #include <map> #include <linguistic/misc.hxx> -#include "lngreg.hxx" #include "gciterator.hxx" using namespace linguistic; using namespace ::com::sun::star; -static OUString GrammarCheckingIterator_getImplementationName() throw(); -static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceNames() throw(); - // white space list: obtained from the fonts.config.txt of a Linux system. const sal_Unicode aWhiteSpaces[] = { @@ -1120,13 +1117,13 @@ sal_Bool SAL_CALL GrammarCheckingIterator::supportsService( OUString SAL_CALL GrammarCheckingIterator::getImplementationName( ) { - return GrammarCheckingIterator_getImplementationName(); + return "com.sun.star.lingu2.ProofreadingIterator"; } uno::Sequence< OUString > SAL_CALL GrammarCheckingIterator::getSupportedServiceNames( ) { - return GrammarCheckingIterator_getSupportedServiceNames(); + return { "com.sun.star.linguistic2.ProofreadingIterator" }; } @@ -1173,43 +1170,15 @@ uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList( } -static OUString GrammarCheckingIterator_getImplementationName() throw() -{ - return "com.sun.star.lingu2.ProofreadingIterator"; -} - - -static uno::Sequence< OUString > GrammarCheckingIterator_getSupportedServiceNames() throw() +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +linguistic_GrammarCheckingIterator_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return { "com.sun.star.linguistic2.ProofreadingIterator" }; + static rtl::Reference<GrammarCheckingIterator> g_Instance(new GrammarCheckingIterator()); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } -/// @throws uno::Exception -static uno::Reference< uno::XInterface > GrammarCheckingIterator_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & /*rxSMgr*/ ) -{ - return static_cast< ::cppu::OWeakObject * >(new GrammarCheckingIterator()); -} -void * GrammarCheckingIterator_getFactory( - const char *pImplName, - lang::XMultiServiceFactory *pServiceManager ) -{ - void * pRet = nullptr; - if ( GrammarCheckingIterator_getImplementationName().equalsAscii( pImplName ) ) - { - uno::Reference< lang::XSingleServiceFactory > xFactory = - cppu::createOneInstanceFactory( - pServiceManager, - GrammarCheckingIterator_getImplementationName(), - GrammarCheckingIterator_createInstance, - GrammarCheckingIterator_getSupportedServiceNames()); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/lng.component b/linguistic/source/lng.component index a8602150e774..525e02cd93e7 100644 --- a/linguistic/source/lng.component +++ b/linguistic/source/lng.component @@ -18,20 +18,25 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="lng" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.lingu2.ConvDicList"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.lingu2.ConvDicList" + constructor="linguistic_ConvDicList_get_implementation"> <service name="com.sun.star.linguistic2.ConversionDictionaryList"/> </implementation> - <implementation name="com.sun.star.lingu2.DicList"> + <implementation name="com.sun.star.lingu2.DicList" + constructor="linguistic_DicList_get_implementation"> <service name="com.sun.star.linguistic2.DictionaryList"/> </implementation> - <implementation name="com.sun.star.lingu2.LinguProps"> + <implementation name="com.sun.star.lingu2.LinguProps" + constructor="linguistic_LinguProps_get_implementation"> <service name="com.sun.star.linguistic2.LinguProperties"/> </implementation> - <implementation name="com.sun.star.lingu2.LngSvcMgr"> + <implementation name="com.sun.star.lingu2.LngSvcMgr" + constructor="linguistic_LngSvcMgr_get_implementation"> <service name="com.sun.star.linguistic2.LinguServiceManager"/> </implementation> - <implementation name="com.sun.star.lingu2.ProofreadingIterator"> + <implementation name="com.sun.star.lingu2.ProofreadingIterator" + constructor="linguistic_GrammarCheckingIterator_get_implementation"> <service name="com.sun.star.linguistic2.ProofreadingIterator"/> </implementation> </component> diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index dfe620504d6d..f23dc71a15e5 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -20,10 +20,10 @@ #include <sal/macros.h> #include "lngopt.hxx" -#include "lngreg.hxx" #include <linguistic/misc.hxx> #include <tools/debug.hxx> #include <unotools/lingucfg.hxx> +#include <rtl/ref.hxx> #include <comphelper/sequence.hxx> #include <cppuhelper/factory.hxx> @@ -207,14 +207,6 @@ void LinguProps::launchEvent( const PropertyChangeEvent &rEvt ) const } } -/// @throws Exception -static Reference< XInterface > LinguProps_CreateInstance( - const Reference< XMultiServiceFactory > & /*rSMgr*/ ) -{ - Reference< XInterface > xService = static_cast<cppu::OWeakObject*>(new LinguProps); - return xService; -} - Reference< XPropertySetInfo > SAL_CALL LinguProps::getPropertySetInfo() { MutexGuard aGuard( GetLinguMutex() ); @@ -392,7 +384,7 @@ void SAL_CALL // XServiceInfo OUString SAL_CALL LinguProps::getImplementationName() { - return getImplementationName_Static(); + return "com.sun.star.lingu2.LinguProps"; } // XServiceInfo @@ -404,13 +396,6 @@ sal_Bool SAL_CALL LinguProps::supportsService( const OUString& ServiceName ) // XServiceInfo uno::Sequence< OUString > SAL_CALL LinguProps::getSupportedServiceNames() { - return getSupportedServiceNames_Static(); -} - -// ORegistryServiceManager_Static -uno::Sequence< OUString > LinguProps::getSupportedServiceNames_Static() - throw() -{ return { "com.sun.star.linguistic2.LinguProperties" }; } @@ -438,23 +423,13 @@ Locale LinguProps::getPropertyLocale(const OUString& aPropertyName) return b; } -void * LinguProps_getFactory( const char * pImplName, - XMultiServiceFactory *pServiceManager ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +linguistic_LinguProps_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - void * pRet = nullptr; - if ( LinguProps::getImplementationName_Static().equalsAscii( pImplName ) ) - { - Reference< XSingleServiceFactory > xFactory = - cppu::createOneInstanceFactory( - pServiceManager, - LinguProps::getImplementationName_Static(), - LinguProps_CreateInstance, - LinguProps::getSupportedServiceNames_Static()); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; + static rtl::Reference<LinguProps> g_Instance(new LinguProps()); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } diff --git a/linguistic/source/lngopt.hxx b/linguistic/source/lngopt.hxx index 85faed923922..bdb173c22da0 100644 --- a/linguistic/source/lngopt.hxx +++ b/linguistic/source/lngopt.hxx @@ -195,18 +195,8 @@ public: virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - - static inline OUString getImplementationName_Static() throw(); - static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); }; -inline OUString LinguProps::getImplementationName_Static() throw() -{ - return "com.sun.star.lingu2.LinguProps"; -} - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/lngreg.cxx b/linguistic/source/lngreg.cxx deleted file mode 100644 index f5de3599e6d1..000000000000 --- a/linguistic/source/lngreg.cxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <cppuhelper/factory.hxx> - -#include "lngreg.hxx" - -using namespace com::sun::star::lang; - -using namespace com::sun::star::registry; - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void * lng_component_getFactory( - const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) -{ - void * pRet = - LngSvcMgr_getFactory( - pImplName, - static_cast< XMultiServiceFactory * >( pServiceManager ) ); - - if(!pRet) - pRet = LinguProps_getFactory( - pImplName, - static_cast< XMultiServiceFactory * >( pServiceManager ) ); - - if(!pRet) - pRet = DicList_getFactory( - pImplName, - static_cast< XMultiServiceFactory * >( pServiceManager ) ); - - if(!pRet) - pRet = ConvDicList_getFactory( - pImplName, - static_cast< XMultiServiceFactory * >( pServiceManager ) ); - - if(!pRet) - pRet = GrammarCheckingIterator_getFactory( - pImplName, - static_cast< XMultiServiceFactory * >( pServiceManager ) ); - return pRet; -} -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/lngreg.hxx b/linguistic/source/lngreg.hxx deleted file mode 100644 index a127af751b3e..000000000000 --- a/linguistic/source/lngreg.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_LINGUISTIC_SOURCE_LNGREG_HXX -#define INCLUDED_LINGUISTIC_SOURCE_LNGREG_HXX - -#include <sal/config.h> - -#include <sal/types.h> - -namespace com::sun::star::lang { - class XMultiServiceFactory; -} - -extern void * LngSvcMgr_getFactory -( - const char * pImplName, - css::lang::XMultiServiceFactory * pServiceManager -); - -extern void * DicList_getFactory -( - const char * pImplName, - css::lang::XMultiServiceFactory * pServiceManager -); - -void * LinguProps_getFactory -( - const char * pImplName, - css::lang::XMultiServiceFactory * pServiceManager -); - -extern void * ConvDicList_getFactory -( - const char * pImplName, - css::lang::XMultiServiceFactory * pServiceManager -); - -extern void * GrammarCheckingIterator_getFactory -( - const char * pImplName, - css::lang::XMultiServiceFactory * pServiceManager -); - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index e5f6fd3aa4e9..5c741fdd05e2 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -44,7 +44,6 @@ #include <cppuhelper/supportsservice.hxx> #include "lngsvcmgr.hxx" -#include "lngreg.hxx" #include <linguistic/misc.hxx> #include "spelldsp.hxx" #include "hyphdsp.hxx" @@ -1818,7 +1817,7 @@ bool LngSvcMgr::AddLngSvcEvtBroadcaster( OUString SAL_CALL LngSvcMgr::getImplementationName() { - return getImplementationName_Static(); + return "com.sun.star.lingu2.LngSvcMgr"; } @@ -1832,43 +1831,17 @@ sal_Bool SAL_CALL uno::Sequence< OUString > SAL_CALL LngSvcMgr::getSupportedServiceNames() { - return getSupportedServiceNames_Static(); -} - - -uno::Sequence< OUString > LngSvcMgr::getSupportedServiceNames_Static() - throw() -{ return { "com.sun.star.linguistic2.LinguServiceManager" }; } -/// @throws uno::Exception -static uno::Reference< uno::XInterface > LngSvcMgr_CreateInstance( - const uno::Reference< lang::XMultiServiceFactory > & /*rSMgr*/ ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +linguistic_LngSvcMgr_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - uno::Reference< uno::XInterface > xService = static_cast<cppu::OWeakObject*>(new LngSvcMgr); - return xService; + static rtl::Reference<LngSvcMgr> g_Instance(new LngSvcMgr()); + g_Instance->acquire(); + return static_cast<cppu::OWeakObject*>(g_Instance.get()); } -void * LngSvcMgr_getFactory( - const char * pImplName, - lang::XMultiServiceFactory * pServiceManager ) -{ - - void * pRet = nullptr; - if ( LngSvcMgr::getImplementationName_Static().equalsAscii( pImplName ) ) - { - uno::Reference< lang::XSingleServiceFactory > xFactory = - cppu::createOneInstanceFactory( - pServiceManager, - LngSvcMgr::getImplementationName_Static(), - LngSvcMgr_CreateInstance, - LngSvcMgr::getSupportedServiceNames_Static()); - // acquire, because we return an interface pointer instead of a reference - xFactory->acquire(); - pRet = xFactory.get(); - } - return pRet; -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx index 2eda39ab4753..dfd2ede52d38 100644 --- a/linguistic/source/lngsvcmgr.hxx +++ b/linguistic/source/lngsvcmgr.hxx @@ -157,20 +157,11 @@ public: // XModifyListener virtual void SAL_CALL modified( const css::lang::EventObject& rEvent ) override; - static inline OUString getImplementationName_Static(); - static css::uno::Sequence< OUString > getSupportedServiceNames_Static() throw(); - bool AddLngSvcEvtBroadcaster( const css::uno::Reference< css::linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster ); }; -inline OUString LngSvcMgr::getImplementationName_Static() -{ - return "com.sun.star.lingu2.LngSvcMgr"; -} - - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |