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

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Jul 14 10:04:29 UTC 2020


 i18npool/source/search/i18nsearch.component |    5 +-
 i18npool/source/search/textsearch.cxx       |   66 ++--------------------------
 solenv/bin/native-code.py                   |    3 -
 3 files changed, 11 insertions(+), 63 deletions(-)

New commits:
commit c6642e6c2366741eba893f2e91a6bc2761df7c35
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Jul 14 09:52:39 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 14 12:03:46 2020 +0200

    i18npool/i18nsearch: create instances with uno constructors
    
    See tdf#74608 for motivation.
    
    Change-Id: I5f8113393120fdad192f7347109a2186db141acb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98708
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/i18npool/source/search/i18nsearch.component b/i18npool/source/search/i18nsearch.component
index ddb591f98b5f..fe7f48c26587 100644
--- a/i18npool/source/search/i18nsearch.component
+++ b/i18npool/source/search/i18nsearch.component
@@ -18,8 +18,9 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="i18nsearch" xmlns="http://openoffice.org/2010/uno-components">
-  <implementation name="com.sun.star.util.TextSearch_i18n">
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.util.TextSearch_i18n"
+    constructor="i18npool_TextSearch_get_implementation">
     <service name="com.sun.star.util.TextSearch"/>
     <service name="com.sun.star.util.TextSearch2"/>
   </implementation>
diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx
index 2bbd11ac0acb..abeceb993b06 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -1540,25 +1540,10 @@ SearchResult TextSearch::WildcardSrchBkwrd( const OUString& searchStr, sal_Int32
 }
 
 
-const char cSearchImpl[] = "com.sun.star.util.TextSearch_i18n";
-
-static uno::Sequence< OUString > getServiceName_Static()
-{
-    uno::Sequence< OUString > aRet(2);
-    aRet[0] = "com.sun.star.util.TextSearch";
-    aRet[1] = "com.sun.star.util.TextSearch2";
-    return aRet;
-}
-
-static OUString getImplementationName_Static()
-{
-    return cSearchImpl;
-}
-
 OUString SAL_CALL
 TextSearch::getImplementationName()
 {
-    return getImplementationName_Static();
+    return "com.sun.star.util.TextSearch_i18n";
 }
 
 sal_Bool SAL_CALL TextSearch::supportsService(const OUString& rServiceName)
@@ -1569,53 +1554,14 @@ sal_Bool SAL_CALL TextSearch::supportsService(const OUString& rServiceName)
 Sequence< OUString > SAL_CALL
 TextSearch::getSupportedServiceNames()
 {
-    Sequence< OUString > aRet { getServiceName_Static() };
-    return aRet;
-}
-
-static css::uno::Reference< css::uno::XInterface >
-TextSearch_CreateInstance(
-        const css::uno::Reference<
-        css::lang::XMultiServiceFactory >& rxMSF )
-{
-    return css::uno::Reference<
-        css::uno::XInterface >(
-                static_cast<cppu::OWeakObject*>(new TextSearch(
-                        comphelper::getComponentContext( rxMSF ) )) );
+    return { "com.sun.star.util.TextSearch", "com.sun.star.util.TextSearch2" };
 }
 
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void*
-i18nsearch_component_getFactory( const char* sImplementationName,
-                                 void* _pServiceManager,
-                                 SAL_UNUSED_PARAMETER void* )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+i18npool_TextSearch_get_implementation(
+    css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
 {
-    void* pRet = nullptr;
-
-    css::lang::XMultiServiceFactory* pServiceManager =
-        static_cast< css::lang::XMultiServiceFactory* >
-            ( _pServiceManager );
-    css::uno::Reference<
-            css::lang::XSingleServiceFactory > xFactory;
-
-    if ( 0 == rtl_str_compare( sImplementationName, cSearchImpl) )
-    {
-        css::uno::Sequence< OUString > aServiceNames { getServiceName_Static() };
-        xFactory = ::cppu::createSingleFactory(
-                pServiceManager, getImplementationName_Static(),
-                &TextSearch_CreateInstance, aServiceNames );
-    }
-
-    if ( xFactory.is() )
-    {
-        xFactory->acquire();
-        pRet = xFactory.get();
-    }
-
-    return pRet;
+    return cppu::acquire(new TextSearch(context));
 }
 
-} // extern "C"
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 11705d74e644..d310cbdb2811 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -25,7 +25,6 @@ core_factory_list = [
     ("libfsstoragelo.a", "fsstorage_component_getFactory"),
     ("libhyphenlo.a", "hyphen_component_getFactory"),
     ("libi18npoollo.a", "i18npool_component_getFactory"),
-    ("libi18nsearchlo.a", "i18nsearch_component_getFactory"),
     ("libinvocadaptlo.a", "invocadapt_component_getFactory"),
     ("liblnthlo.a", "lnth_component_getFactory", "#ifndef IOS"),
     ("liblocalebe1lo.a", "localebe1_component_getFactory"),
@@ -240,6 +239,8 @@ core_constructor_list = [
     "com_sun_star_i18n_Transliteration_IGNORE_KANA_get_implementation",
     "com_sun_star_i18n_Transliteration_IGNORE_WIDTH_get_implementation",
     "com_sun_star_text_DefaultNumberingProvider_get_implementation",
+# i18nsearch/sourceh/search/i18nsearch.component
+    "i18npool_TextSearch_get_implementation",
 # linguistc/source/lng.component
     "linguistic_ConvDicList_get_implementation",
     "linguistic_DicList_get_implementation",


More information about the Libreoffice-commits mailing list