summaryrefslogtreecommitdiff
path: root/lingucomponent
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-16 18:58:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-18 19:07:53 +0200
commitd9b7ddd24d379909f9cd2d83ce28fa619953d841 (patch)
tree8993de5e55d8277d2440c70ae2be881853b2d831 /lingucomponent
parent7473452c22197b7a44a53b61f91c210ef573a1b4 (diff)
lingucomponent/spell: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I850e5b243750cbe168136907523d1ada7050c453 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98924 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'lingucomponent')
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component5
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx8
-rw-r--r--lingucomponent/source/spellcheck/macosxspell/macspellimp.mm50
3 files changed, 11 insertions, 52 deletions
diff --git a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
index 92807d4b3dfc..f318df2abfec 100644
--- a/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
+++ b/lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="MacOSXSpell" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="org.openoffice.lingu.MacOSXSpellChecker">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.lingu.MacOSXSpellChecker"
+ constructor="lingucomponent_MacSpellChecker_get_implementation">
<service name="com.sun.star.linguistic2.SpellChecker"/>
</implementation>
</component>
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
index 0adc1a1cbf2f..dc9ad055d3bc 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx
@@ -116,16 +116,8 @@ public:
virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
-
- static inline OUString getImplementationName_Static() throw();
- static Sequence< OUString > getSupportedServiceNames_Static() throw();
};
-inline OUString MacSpellChecker::getImplementationName_Static() throw()
-{
- return "org.openoffice.lingu.MacOSXSpellChecker";
-}
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index 1d6f84fcce78..c3f64635e071 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -514,16 +514,6 @@ Reference< XSpellAlternatives > SAL_CALL
return xAlt;
}
-/// @throws Exception
-static Reference< XInterface > MacSpellChecker_CreateInstance(
- const Reference< XMultiServiceFactory > & /*rSMgr*/ )
-{
-
- Reference< XInterface > xService = static_cast<cppu::OWeakObject*>(new MacSpellChecker);
- return xService;
-}
-
-
sal_Bool SAL_CALL
MacSpellChecker::addLinguServiceEventListener(
const Reference< XLinguServiceEventListener >& rxLstnr )
@@ -627,7 +617,7 @@ void SAL_CALL
// Service specific part
OUString SAL_CALL MacSpellChecker::getImplementationName()
{
- return getImplementationName_Static();
+ return "org.openoffice.lingu.MacOSXSpellChecker";
}
sal_Bool SAL_CALL MacSpellChecker::supportsService( const OUString& ServiceName )
@@ -637,40 +627,16 @@ sal_Bool SAL_CALL MacSpellChecker::supportsService( const OUString& ServiceName
Sequence< OUString > SAL_CALL MacSpellChecker::getSupportedServiceNames()
{
- return getSupportedServiceNames_Static();
-}
-
-Sequence< OUString > MacSpellChecker::getSupportedServiceNames_Static()
- throw()
-{
- Sequence< OUString > aSNS { SN_SPELLCHECKER };
- return aSNS;
+ return { SN_SPELLCHECKER };
}
-extern "C"
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+lingucomponent_MacSpellChecker_get_implementation(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
-
-SAL_DLLPUBLIC_EXPORT void * MacOSXSpell_component_getFactory(
- const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
-{
- void * pRet = nullptr;
- if ( MacSpellChecker::getImplementationName_Static().equalsAscii( pImplName ) )
- {
- Reference< XSingleServiceFactory > xFactory =
- cppu::createOneInstanceFactory(
- static_cast< XMultiServiceFactory * >( pServiceManager ),
- MacSpellChecker::getImplementationName_Static(),
- MacSpellChecker_CreateInstance,
- MacSpellChecker::getSupportedServiceNames_Static());
- // acquire, because we return an interface pointer instead of a reference
- xFactory->acquire();
- pRet = xFactory.get();
- }
- return pRet;
+ static rtl::Reference<MacSpellChecker> g_Instance(new MacSpellChecker());
+ g_Instance->acquire();
+ return static_cast<cppu::OWeakObject*>(g_Instance.get());
}
-}
-
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */