[Libreoffice-commits] core.git: lingucomponent/source solenv/bin

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Sat Jul 18 17:08:35 UTC 2020


 lingucomponent/source/spellcheck/macosxspell/MacOSXSpell.component |    5 -
 lingucomponent/source/spellcheck/macosxspell/macspellimp.hxx       |    8 -
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm        |   50 +---------
 solenv/bin/native-code.py                                          |    3 
 4 files changed, 13 insertions(+), 53 deletions(-)

New commits:
commit d9b7ddd24d379909f9cd2d83ce28fa619953d841
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Thu Jul 16 18:58:25 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Jul 18 19:07:53 2020 +0200

    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 at collabora.co.uk>

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: */
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 2f1255248d44..4aa156eb4bf4 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -32,7 +32,6 @@ core_factory_list = [
     ("libodfflatxmllo.a", "odfflatxml_component_getFactory"),
     ("libvcllo.a", "vcl_component_getFactory"),
     ("libsvtlo.a", "svt_component_getFactory"),
-    ("libMacOSXSpelllo.a", "MacOSXSpell_component_getFactory", "#ifdef IOS"),
     ]
 
 core_constructor_list = [
@@ -238,6 +237,8 @@ core_constructor_list = [
     "linguistic_LinguProps_get_implementation",
     "linguistic_LngSvcMgr_get_implementation",
     "linguistic_GrammarCheckingIterator_get_implementation",
+# linguistic/source/spellcheck/MacOSXSpellMacOSXSpell.component
+    ("lingucomponent_MacSpellChecker_get_implementation", "#ifdef IOS"),
 # lingucomponent/source/thesaurus/libnth/lnth.component
     ("lingucomponent_Thesaurus_get_implementation", "#ifndef IOS"),
     ("lingucomponent_SpellChecker_get_implementation", "#ifndef IOS"),


More information about the Libreoffice-commits mailing list