[Libreoffice-commits] core.git: 6 commits - android/experimental cppuhelper/source include/osl include/sax ios/experimental ios/shared postprocess/CppunitTest_services.mk postprocess/Module_postprocess.mk postprocess/qa sax/source sax/test stoc/inc stoc/Library_bootstrap.mk stoc/source stoc/util

Matúš Kukan matus.kukan at collabora.com
Tue Dec 17 22:17:39 PST 2013


 android/experimental/DocumentLoader/native-code.cxx      |   58 +-----
 android/experimental/LibreOffice4Android/native-code.cxx |   77 +-------
 android/experimental/desktop/native-code.cxx             |   81 +-------
 cppuhelper/source/shlib.cxx                              |  103 ++---------
 include/osl/detail/component-declarations.h              |  121 +++++++++++++
 include/osl/detail/component-mapping.h                   |   43 ++++
 include/sax/fastparser.hxx                               |    3 
 ios/experimental/LibreOffice/LibreOffice/lo.mm           |   74 +-------
 ios/shared/ios_sharedlo/cxx/mlo.mm                       |  116 +-----------
 postprocess/CppunitTest_services.mk                      |   31 +++
 postprocess/Module_postprocess.mk                        |    4 
 postprocess/qa/services.cxx                              |   97 ++++++++++
 sax/source/expatwrap/expwrap.component                   |    2 
 sax/source/expatwrap/factory.hxx                         |   27 --
 sax/source/expatwrap/sax_expat.cxx                       |  130 +++-----------
 sax/source/expatwrap/saxwriter.cxx                       |   69 +++----
 sax/source/fastparser/fastparser.cxx                     |  138 +++++----------
 sax/test/sax/testsax.cxx                                 |    2 
 sax/test/sax/testwriter.cxx                              |    2 
 stoc/Library_bootstrap.mk                                |    1 
 stoc/inc/bootstrapservices.hxx                           |   89 ---------
 stoc/source/bootstrap/services.cxx                       |  102 -----------
 stoc/source/defaultregistry/defaultregistry.cxx          |   47 ++---
 stoc/source/implementationregistration/implreg.cxx       |   55 ++---
 stoc/source/loader/dllcomponentloader.cxx                |   41 ++--
 stoc/source/security/access_controller.cxx               |   58 +++---
 stoc/source/security/file_policy.cxx                     |   50 ++---
 stoc/source/servicemanager/servicemanager.cxx            |  104 +++++------
 stoc/source/simpleregistry/simpleregistry.cxx            |   37 ++--
 stoc/util/bootstrap.component                            |    2 
 30 files changed, 695 insertions(+), 1069 deletions(-)

New commits:
commit ff9614a744368f187422b98b40e90ee5231b045f
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Tue Dec 17 10:44:59 2013 +0100

    Add a unit test trying to create every available service with default ctor.
    
    Change-Id: I79e70aeabdb816eaf7a719d2094034d78d11c90b

diff --git a/postprocess/CppunitTest_services.mk b/postprocess/CppunitTest_services.mk
new file mode 100644
index 0000000..f6da8f6
--- /dev/null
+++ b/postprocess/CppunitTest_services.mk
@@ -0,0 +1,31 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,services))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,services, \
+    postprocess/qa/services \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,services, \
+	cppu \
+	sal \
+	test \
+	$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_sdk_api,services))
+
+$(eval $(call gb_CppunitTest_use_ure,services))
+
+$(eval $(call gb_CppunitTest_use_rdb,services,services))
+
+$(eval $(call gb_CppunitTest_use_configuration,services))
+
+# vim: set noet sw=4 ts=4:
diff --git a/postprocess/Module_postprocess.mk b/postprocess/Module_postprocess.mk
index d3d5a95..5775cfa 100644
--- a/postprocess/Module_postprocess.mk
+++ b/postprocess/Module_postprocess.mk
@@ -28,4 +28,8 @@ $(eval $(call gb_Module_add_targets,postprocess,\
 ))
 endif
 
+$(eval $(call gb_Module_add_check_targets,postprocess,\
+	CppunitTest_services \
+))
+
 # vim: set noet sw=4 ts=4:
diff --git a/postprocess/qa/services.cxx b/postprocess/qa/services.cxx
new file mode 100644
index 0000000..ea21ab5
--- /dev/null
+++ b/postprocess/qa/services.cxx
@@ -0,0 +1,97 @@
+/* -*- 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/.
+ */
+
+#include <sal/config.h>
+
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/reflection/XServiceConstructorDescription.hpp>
+#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
+#include <test/bootstrapfixture.hxx>
+
+using namespace css::container;
+using namespace css::reflection;
+using namespace css::uno;
+
+namespace {
+
+class ServicesTest: public test::BootstrapFixture
+{
+public:
+    virtual void setUp();
+    virtual void tearDown();
+
+    void test();
+
+    CPPUNIT_TEST_SUITE(ServicesTest);
+    CPPUNIT_TEST(test);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+void ServicesTest::setUp()
+{
+    test::BootstrapFixture::setUp();
+}
+
+void ServicesTest::tearDown()
+{
+    test::BootstrapFixture::tearDown();
+}
+
+void ServicesTest::test()
+{
+    Reference< XHierarchicalNameAccess > xTypeManager(
+            m_xContext->getValueByName(
+                "/singletons/com.sun.star.reflection.theTypeDescriptionManager"),
+            UNO_QUERY_THROW );
+    Sequence<OUString> seq = m_xContext->getServiceManager()->getAvailableServiceNames();
+    OUString *s = seq.getArray();
+    for (sal_Int32 i = 0; i < seq.getLength(); i++)
+    {
+        if (!xTypeManager->hasByHierarchicalName(s[i]))
+        {
+            continue;
+        }
+        Reference< XServiceTypeDescription2 > xDesc(
+                xTypeManager->getByHierarchicalName(s[i]), UNO_QUERY);
+        if (!xDesc.is())
+        {
+            // Does happen for singletons?
+            continue;
+        }
+        Sequence< Reference< XServiceConstructorDescription > > xseq = xDesc->getConstructors();
+        bool bHasDefault = false;
+        for (sal_Int32 c = 0; c < xseq.getLength(); c++)
+            if (xseq[c]->isDefaultConstructor())
+                bHasDefault = true;
+
+        try
+        {
+            if (bHasDefault
+                    && s[i] != "com.sun.star.deployment.test.SmoketestCommandEnvironment")
+                // TODO: com.sun.star.deployment.test.SmoketestCommandEnvironment throws
+                // "Can not activate the factory for org.libreoffice.smoketest.SmoketestCommandEnvironment
+                // because java.lang.NoClassDefFoundError: com/sun/star/ucb/XCommandEnvironment"
+                m_xContext->getServiceManager()->createInstanceWithContext(s[i], m_xContext);
+        }
+        catch(const Exception & e)
+        {
+            OString exc = "Exception thrown while creating " +
+                OUStringToOString(s[i] + ": " + e.Message, RTL_TEXTENCODING_UTF8);
+            CPPUNIT_FAIL(exc.getStr());
+        }
+    }
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ServicesTest);
+
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit d8bbae2fd6786c2647b7b59e54d9dabdd47603d7
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Mon Dec 16 17:26:34 2013 +0100

    Get more --disable-dynamic-loading code out of shlib.cxx.
    
    It's not terribly nice, but, hopefully, better.
    The hope is that one day, lo_get_library_map will be no more.
    In lo_get_implementation_map we can specify more precisely what to link
    into the binary.
    
    Change-Id: I99a1854fbae05be2f70302cc56bea88e522ec129

diff --git a/android/experimental/DocumentLoader/native-code.cxx b/android/experimental/DocumentLoader/native-code.cxx
index a444eb5..43949ef 100644
--- a/android/experimental/DocumentLoader/native-code.cxx
+++ b/android/experimental/DocumentLoader/native-code.cxx
@@ -12,9 +12,10 @@
 extern "C"
 __attribute__ ((visibility("default")))
 const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
 {
     static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_COMPONENT_MAP
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
         { "libdbalo.a", dba_component_getFactory },
@@ -59,4 +60,17 @@ lo_get_libmap(void)
     return map;
 }
 
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+    static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+        { NULL, NULL }
+    };
+
+    return map;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/LibreOffice4Android/native-code.cxx b/android/experimental/LibreOffice4Android/native-code.cxx
index af0f5b7..2ec8149 100644
--- a/android/experimental/LibreOffice4Android/native-code.cxx
+++ b/android/experimental/LibreOffice4Android/native-code.cxx
@@ -12,9 +12,10 @@
 extern "C"
 __attribute__ ((visibility("default")))
 const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
 {
     static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_COMPONENT_MAP
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
         { "libbasprov.uno.a", basprov_component_getFactory },
@@ -77,4 +78,17 @@ lo_get_libmap(void)
     return map;
 }
 
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+    static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+        { NULL, NULL }
+    };
+
+    return map;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx
index 8d961fb..b4f15aa 100644
--- a/android/experimental/desktop/native-code.cxx
+++ b/android/experimental/desktop/native-code.cxx
@@ -12,9 +12,10 @@
 extern "C"
 __attribute__ ((visibility("default")))
 const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
 {
     static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_COMPONENT_MAP
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
         { "libbasprovlo.a", basprov_component_getFactory },
@@ -89,4 +90,17 @@ lo_get_libmap(void)
     return map;
 }
 
+extern "C"
+__attribute__ ((visibility("default")))
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+    static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+        { NULL, NULL }
+    };
+
+    return map;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 44d647b..81e02d3 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -283,76 +283,27 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
 
 #ifdef DISABLE_DYNLOADING
 
-    // First test library names that aren't app-specific.
-    static lib_to_component_mapping components_mapping[] = {
-        { "libintrospectionlo.a", introspection_component_getFactory },
-        { "libreflectionlo.a", reflection_component_getFactory },
-        { "libstocserviceslo.a", stocservices_component_getFactory },
-        { "libcomphelper.a", comphelp_component_getFactory },
-        { "libconfigmgrlo.a", configmgr_component_getFactory },
-        { "libdeployment.a", deployment_component_getFactory },
-        { "libfilterconfiglo.a", filterconfig1_component_getFactory },
-        { "libfwklo.a", fwk_component_getFactory },
-        { "libi18npoollo.a", i18npool_component_getFactory },
-        { "liblocalebe1lo.a", localebe1_component_getFactory },
-        { "libpackage2.a", package2_component_getFactory },
-        { "libsfxlo.a", sfx_component_getFactory },
-        { "libsvllo.a", svl_component_getFactory },
-        { "libtklo.a", tk_component_getFactory },
-        { "libucb1.a", ucb_component_getFactory },
-        { "libucpexpand1lo.a", ucpexpand1_component_getFactory },
-        { "libucpfile1.a", ucpfile_component_getFactory },
-        { "libutllo.a", utl_component_getFactory },
-        { "libvcllo.a", vcl_component_getFactory },
-        { "libxstor.a", xstor_component_getFactory },
-        { NULL, NULL }
-    };
-    static lib_to_component_mapping direct_components_mapping[] = {
-        { "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory },
-        { "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory },
-        { "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory },
-        { "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory },
-        { "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory },
-        { "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory },
-        { "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory },
-        { "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory },
-        { "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory },
-        { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory },
-        { "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory },
-        { "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory },
-        { NULL, NULL }
-    };
-    lib_to_component_mapping *non_app_specific_map = components_mapping;
     OString sName;
+    const lib_to_component_mapping *map = NULL;
     if (rPrefix == "direct")
     {
         sName = OUStringToOString(rImplName, RTL_TEXTENCODING_ASCII_US);
-        non_app_specific_map = direct_components_mapping;
+        map = lo_get_implementation_map();
     }
     else
     {
         sName = OUStringToOString(uri, RTL_TEXTENCODING_ASCII_US);
+        map = lo_get_library_map();
     }
-    for (int i = 0; pSym == NULL && non_app_specific_map[i].lib != NULL; ++i)
+    for (int i = 0; pSym == NULL && map[i].name != NULL; ++i)
     {
-        if ( sName == non_app_specific_map[i].lib )
-            pSym = (oslGenericFunction) non_app_specific_map[i].component_getFactory_function;
+        if ( sName == map[i].name )
+            pSym = (oslGenericFunction) map[i].component_getFactory_function;
     }
-
-    if ( pSym == NULL)
+    if ( pSym == NULL )
     {
-        // The call the app-specific lo_get_libmap() to get a mapping for the rest
-        const lib_to_component_mapping *map = lo_get_libmap();
-        for (int i = 0; pSym == NULL && map[i].lib != NULL; ++i)
-        {
-            if ( uri.equalsAscii( map[i].lib ) )
-                pSym = (oslGenericFunction) map[i].component_getFactory_function;
-        }
-        if ( pSym == NULL )
-        {
-            fprintf( stderr, "attempting to load unknown library %s\n", OUStringToOString( uri, RTL_TEXTENCODING_ASCII_US ).getStr() );
-            assert( !"Attempt to load unknown library" );
-        }
+        fprintf( stderr, "attempting to load unknown library %s\n", OUStringToOString( uri, RTL_TEXTENCODING_ASCII_US ).getStr() );
+        assert( !"Attempt to load unknown library" );
     }
 #else
 
diff --git a/include/osl/detail/component-mapping.h b/include/osl/detail/component-mapping.h
index 0ee0b51..9feae70 100644
--- a/include/osl/detail/component-mapping.h
+++ b/include/osl/detail/component-mapping.h
@@ -27,16 +27,53 @@ extern "C" {
  */
 
 typedef struct {
-    const char *lib;
+    const char *name;
     void * (*component_getFactory_function)(const char *, void *, void *);
 } lib_to_component_mapping;
 
-const lib_to_component_mapping *lo_get_libmap(void);
+const lib_to_component_mapping *lo_get_library_map(void);
+const lib_to_component_mapping *lo_get_implementation_map(void);
 
 #ifdef __cplusplus
 }
 #endif
 
+#define NON_APP_SPECIFIC_COMPONENT_MAP \
+    { "libintrospectionlo.a", introspection_component_getFactory }, \
+    { "libreflectionlo.a", reflection_component_getFactory }, \
+    { "libstocserviceslo.a", stocservices_component_getFactory }, \
+    { "libcomphelper.a", comphelp_component_getFactory }, \
+    { "libconfigmgrlo.a", configmgr_component_getFactory }, \
+    { "libdeployment.a", deployment_component_getFactory }, \
+    { "libfilterconfiglo.a", filterconfig1_component_getFactory }, \
+    { "libfwklo.a", fwk_component_getFactory }, \
+    { "libi18npoollo.a", i18npool_component_getFactory }, \
+    { "liblocalebe1lo.a", localebe1_component_getFactory }, \
+    { "libpackage2.a", package2_component_getFactory }, \
+    { "libsfxlo.a", sfx_component_getFactory }, \
+    { "libsvllo.a", svl_component_getFactory }, \
+    { "libtklo.a", tk_component_getFactory }, \
+    { "libucb1.a", ucb_component_getFactory }, \
+    { "libucpexpand1lo.a", ucpexpand1_component_getFactory }, \
+    { "libucpfile1.a", ucpfile_component_getFactory }, \
+    { "libutllo.a", utl_component_getFactory }, \
+    { "libvcllo.a", vcl_component_getFactory }, \
+    { "libxstor.a", xstor_component_getFactory }, \
+
+#define NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP \
+    { "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory }, \
+    { "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory }, \
+    { "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory }, \
+    { "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory }, \
+    { "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory }, \
+    { "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory }, \
+    { "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory }, \
+    { "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory }, \
+    { "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory }, \
+    { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory }, \
+    { "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory }, \
+    { "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory }, \
+
 #endif /* DISABLE_DYNLOADING */
 
 #endif // INCLUDED_OSL_DETAIL_COMPONENT_MAPPING_H
diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm
index 18cf09f..5da9455 100644
--- a/ios/experimental/LibreOffice/LibreOffice/lo.mm
+++ b/ios/experimental/LibreOffice/LibreOffice/lo.mm
@@ -18,9 +18,10 @@
 
 extern "C"
 const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
 {
     static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_COMPONENT_MAP
         { "libanalysislo.a", analysis_component_getFactory },
         { "libanimcorelo.a", animcore_component_getFactory },
         { "libavmedialo.a", avmedia_component_getFactory },
@@ -81,6 +82,18 @@ lo_get_libmap(void)
 }
 
 extern "C"
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+    static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+        { NULL, NULL }
+    };
+
+    return map;
+}
+
+extern "C"
 void
 lo_initialize(void)
 {
diff --git a/ios/shared/ios_sharedlo/cxx/mlo.mm b/ios/shared/ios_sharedlo/cxx/mlo.mm
index 61f56b2..6dc4ad1 100644
--- a/ios/shared/ios_sharedlo/cxx/mlo.mm
+++ b/ios/shared/ios_sharedlo/cxx/mlo.mm
@@ -24,10 +24,11 @@
 
 extern "C"
 const lib_to_component_mapping *
-lo_get_libmap(void)
+lo_get_library_map(void)
 {
     static lib_to_component_mapping map[] = {
-        
+        NON_APP_SPECIFIC_COMPONENT_MAP
+
         //from IOS
         
         //MAP_LIB_LO(analysis), //MAP_LIB_LO(animcore), //MAP_LIB_LO(sm),
@@ -68,10 +69,21 @@ lo_get_libmap(void)
         
         { NULL, NULL }
     };
-    
+
     return map;
 }
 
+extern "C"
+const lib_to_component_mapping *
+lo_get_implementation_map(void)
+{
+    static lib_to_component_mapping map[] = {
+        NON_APP_SPECIFIC_DIRECT_COMPONENT_MAP
+        { NULL, NULL }
+    };
+
+    return map;
+}
 
 NSString * createPaths(NSString * base,NSString * appRootEscaped,NSArray * fileNames){
     NSString * prefix = @"file://";
commit e20f27f0a04a3c0c0ba38a2b78f5c2591e27bbc0
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Mon Dec 16 13:38:14 2013 +0100

    bootstrap component: Split into implementation functions.
    
    Change-Id: I91cb0177edd79485eab885e995e79b1a19a769d5

diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index 68abeaa..44d647b 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -247,12 +247,6 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
 {
 #ifndef DISABLE_DYNLOADING
     OUString moduleUri(uri);
-
-#ifdef ANDROID
-    if ( uri == "bootstrap.uno" SAL_DLLEXTENSION )
-        moduleUri = "libbootstrap.uno" SAL_DLLEXTENSION;
-#endif
-
     oslModule lib = osl_loadModule(
         moduleUri.pData, SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL );
     if (! lib)
@@ -291,13 +285,6 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
 
     // First test library names that aren't app-specific.
     static lib_to_component_mapping components_mapping[] = {
-        // Sigh, the name under which the bootstrap component is looked for
-        // varies a lot? Or then I just have been confused by some mixed-up
-        // incremental build.
-        { "bootstrap.uno" SAL_DLLEXTENSION, bootstrap_component_getFactory },
-        { "bootstrap.uno.a", bootstrap_component_getFactory },
-        { "libbootstraplo.a", bootstrap_component_getFactory },
-
         { "libintrospectionlo.a", introspection_component_getFactory },
         { "libreflectionlo.a", reflection_component_getFactory },
         { "libstocserviceslo.a", stocservices_component_getFactory },
@@ -322,8 +309,17 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
     };
     static lib_to_component_mapping direct_components_mapping[] = {
         { "com.sun.star.comp.extensions.xml.sax.ParserExpat", com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory },
-        { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory },
         { "com.sun.star.comp.extensions.xml.sax.FastParser", com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory },
+        { "com.sun.star.comp.stoc.DLLComponentLoader.component.getFactory", com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory },
+        { "com.sun.star.comp.stoc.ImplementationRegistration.component.getFactory", com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory },
+        { "com.sun.star.comp.stoc.NestedRegistry.component.getFactory", com_sun_star_comp_stoc_NestedRegistry_component_getFactory },
+        { "com.sun.star.comp.stoc.ORegistryServiceManager.component.getFactory", com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory },
+        { "com.sun.star.comp.stoc.OServiceManager.component.getFactory", com_sun_star_comp_stoc_OServiceManager_component_getFactory },
+        { "com.sun.star.comp.stoc.OServiceManagerWrapper.component.getFactory", com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory },
+        { "com.sun.star.comp.stoc.SimpleRegistry.component.getFactory", com_sun_star_comp_stoc_SimpleRegistry_component_getFactory },
+        { "com.sun.star.extensions.xml.sax.Writer", com_sun_star_extensions_xml_sax_Writer_component_getFactory },
+        { "com.sun.star.security.comp.stoc.AccessController.component.getFactory", com_sun_star_security_comp_stoc_AccessController_component_getFactory },
+        { "com.sun.star.security.comp.stoc.FilePolicy.component.getFactory", com_sun_star_security_comp_stoc_FilePolicy_component_getFactory },
         { NULL, NULL }
     };
     lib_to_component_mapping *non_app_specific_map = components_mapping;
diff --git a/include/osl/detail/component-declarations.h b/include/osl/detail/component-declarations.h
index b559792..8bcbda3 100644
--- a/include/osl/detail/component-declarations.h
+++ b/include/osl/detail/component-declarations.h
@@ -99,7 +99,16 @@ void * xstor_component_getFactory( const char * , void * , void * );
 
 void * com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory( const char * , void * , void * );
 void * com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory( const char * , void * , void * );
+void * com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory( const char * , void * , void * );
+void * com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory( const char * , void * , void * );
+void * com_sun_star_comp_stoc_NestedRegistry_component_getFactory( const char * , void * , void * );
+void * com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory( const char * , void * , void * );
+void * com_sun_star_comp_stoc_OServiceManager_component_getFactory( const char * , void * , void * );
+void * com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory( const char * , void * , void * );
+void * com_sun_star_comp_stoc_SimpleRegistry_component_getFactory( const char * , void * , void * );
 void * com_sun_star_extensions_xml_sax_Writer_component_getFactory( const char * , void * , void * );
+void * com_sun_star_security_comp_stoc_AccessController_component_getFactory( const char * , void * , void * );
+void * com_sun_star_security_comp_stoc_FilePolicy_component_getFactory( const char * , void * , void * );
 
 #ifdef __cplusplus
 }
diff --git a/stoc/Library_bootstrap.mk b/stoc/Library_bootstrap.mk
index a636917..6c68a7f 100644
--- a/stoc/Library_bootstrap.mk
+++ b/stoc/Library_bootstrap.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Library_use_libraries,bootstrap,\
 $(eval $(call gb_Library_set_componentfile,bootstrap,stoc/util/bootstrap))
 
 $(eval $(call gb_Library_add_exception_objects,bootstrap,\
-    stoc/source/bootstrap/services \
     stoc/source/defaultregistry/defaultregistry \
     stoc/source/implementationregistration/implreg \
     stoc/source/implementationregistration/mergekeys \
diff --git a/stoc/inc/bootstrapservices.hxx b/stoc/inc/bootstrapservices.hxx
deleted file mode 100644
index 43a10ba..0000000
--- a/stoc/inc/bootstrapservices.hxx
+++ /dev/null
@@ -1,89 +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 <rtl/ustring.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/RuntimeException.hpp>
-
-namespace com { namespace sun { namespace star { namespace uno {
-    class XInterface;
-    class XComponentContext;
-} } } }
-
-namespace stoc_bootstrap
-{
-    //servicemanager
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OServiceManager_CreateInstance(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext );
-    ::com::sun::star::uno::Sequence< OUString > smgr_wrapper_getSupportedServiceNames();
-    OUString smgr_wrapper_getImplementationName();
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OServiceManagerWrapper_CreateInstance(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext )
-    throw (::com::sun::star::uno::Exception);
-    ::com::sun::star::uno::Sequence< OUString > smgr_getSupportedServiceNames();
-    OUString smgr_getImplementationName();
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ORegistryServiceManager_CreateInstance(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & xContext )
-    throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-    ::com::sun::star::uno::Sequence< OUString > regsmgr_getSupportedServiceNames();
-    OUString regsmgr_getImplementationName();
-
-    //security
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ac_create(
-        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xComponentContext )
-    SAL_THROW( (::com::sun::star::uno::Exception) );
-    ::com::sun::star::uno::Sequence< OUString > ac_getSupportedServiceNames() SAL_THROW(());
-    OUString ac_getImplementationName() SAL_THROW(());
-
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL filepolicy_create(
-        ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xComponentContext )
-    SAL_THROW( (com::sun::star::uno::Exception) );
-    ::com::sun::star::uno::Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(());
-    OUString filepolicy_getImplementationName() SAL_THROW(());
-
-    //defaultregistry
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL NestedRegistry_CreateInstance(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& )
-    throw( ::com::sun::star::uno::Exception);
-    ::com::sun::star::uno::Sequence< OUString > defreg_getSupportedServiceNames();
-    OUString defreg_getImplementationName();
-
-    //simpleregistry
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SimpleRegistry_CreateInstance(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& );
-    ::com::sun::star::uno::Sequence< OUString > simreg_getSupportedServiceNames();
-    OUString simreg_getImplementationName();
-
-    //implementationregistry
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ImplementationRegistration_CreateInstance(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& ); // throw(Exception)
-    ::com::sun::star::uno::Sequence< OUString > impreg_getSupportedServiceNames();
-    OUString impreg_getImplementationName();
-
-    //loader
-    ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL DllComponentLoader_CreateInstance(
-        const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& )
-    throw(::com::sun::star::uno::Exception);
-    ::com::sun::star::uno::Sequence< OUString > loader_getSupportedServiceNames();
-    OUString loader_getImplementationName();
-} // namespace
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/bootstrap/services.cxx b/stoc/source/bootstrap/services.cxx
deleted file mode 100644
index 126558e..0000000
--- a/stoc/source/bootstrap/services.cxx
+++ /dev/null
@@ -1,102 +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 "bootstrapservices.hxx"
-
-#include "cppuhelper/factory.hxx"
-#include "cppuhelper/implementationentry.hxx"
-#include "sal/types.h"
-#include "uno/environment.h"
-
-#include <stdio.h>
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace cppu;
-using namespace osl;
-
-using namespace stoc_bootstrap;
-
-static const struct ImplementationEntry g_entries[] =
-{
-    //servicemanager
-    {
-    OServiceManager_CreateInstance, smgr_getImplementationName,
-    smgr_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    {
-    ORegistryServiceManager_CreateInstance, regsmgr_getImplementationName,
-    regsmgr_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    {
-    OServiceManagerWrapper_CreateInstance, smgr_wrapper_getImplementationName,
-    smgr_wrapper_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    //security
-    {
-    ac_create, ac_getImplementationName,
-    ac_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    {
-    filepolicy_create, filepolicy_getImplementationName,
-    filepolicy_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    //simpleregistry
-    {
-    SimpleRegistry_CreateInstance, simreg_getImplementationName,
-    simreg_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    //defaultregistry
-    {
-    NestedRegistry_CreateInstance, defreg_getImplementationName,
-    defreg_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    //implementationregistry
-    {
-    ImplementationRegistration_CreateInstance, impreg_getImplementationName,
-    impreg_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    //loader
-    {
-    DllComponentLoader_CreateInstance, loader_getImplementationName,
-    loader_getSupportedServiceNames, createSingleComponentFactory,
-    0, 0
-    },
-    //end
-    { 0, 0, 0, 0, 0, 0 }
-};
-
-#define component_getFactory bootstrap_component_getFactory
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
-    const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
-{
-    return component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , g_entries );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index cf41a8d..7074683 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -37,8 +37,6 @@
 #include <com/sun/star/lang/XInitialization.hpp>
 #include <com/sun/star/container/XEnumerationAccess.hpp>
 
-#include <bootstrapservices.hxx>
-
 using namespace com::sun::star::uno;
 using namespace com::sun::star::registry;
 using namespace com::sun::star::lang;
@@ -46,29 +44,15 @@ using namespace com::sun::star::container;
 using namespace cppu;
 using namespace osl;
 
-#define SERVICENAME "com.sun.star.registry.NestedRegistry"
-#define IMPLNAME       "com.sun.star.comp.stoc.NestedRegistry"
-
-namespace stoc_bootstrap
-{
-Sequence< OUString > defreg_getSupportedServiceNames()
+static Sequence< OUString > NestedRegistryImpl_getSupportedServiceNames()
 {
     Sequence< OUString > seqNames(1);
-    seqNames.getArray()[0] = OUString(SERVICENAME);
+    seqNames.getArray()[0] = OUString("com.sun.star.registry.NestedRegistry");
     return seqNames;
 }
 
-OUString defreg_getImplementationName()
-{
-    return OUString(IMPLNAME);
-}
-}
+namespace {
 
-namespace stoc_defreg
-{
-//*************************************************************************
-// NestedRegistryImpl
-//*************************************************************************
 class NestedKeyImpl;
 
 class NestedRegistryImpl    : public WeakAggImplHelper4 < XSimpleRegistry, XInitialization, XServiceInfo, XEnumerationAccess >
@@ -1211,7 +1195,7 @@ sal_Bool SAL_CALL NestedRegistryImpl::hasElements(  ) throw (RuntimeException)
 OUString SAL_CALL NestedRegistryImpl::getImplementationName(  )
     throw(RuntimeException)
 {
-    return stoc_bootstrap::defreg_getImplementationName();
+    return OUString("com.sun.star.comp.stoc.NestedRegistry");
 }
 
 sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceName )
@@ -1223,7 +1207,7 @@ sal_Bool SAL_CALL NestedRegistryImpl::supportsService( const OUString& ServiceNa
 Sequence<OUString> SAL_CALL NestedRegistryImpl::getSupportedServiceNames(  )
     throw(RuntimeException)
 {
-    return stoc_bootstrap::defreg_getSupportedServiceNames();
+    return NestedRegistryImpl_getSupportedServiceNames();
 }
 
 //*************************************************************************
@@ -1368,17 +1352,15 @@ void SAL_CALL NestedRegistryImpl::mergeKey( const OUString& aKeyName, const OUSt
         m_state++;
     }
 }
-} // namespace stco_defreg
 
-namespace stoc_bootstrap
-{
-//*************************************************************************
-Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance(
+} // namespace
+
+static Reference<XInterface> NestedRegistry_CreateInstance(
     SAL_UNUSED_PARAMETER const Reference<XComponentContext>& )
     throw(Exception)
 {
     Reference<XInterface>   xRet;
-    XSimpleRegistry *pRegistry = (XSimpleRegistry*) new stoc_defreg::NestedRegistryImpl;
+    XSimpleRegistry *pRegistry = (XSimpleRegistry*) new NestedRegistryImpl;
 
     if (pRegistry)
     {
@@ -1388,6 +1370,17 @@ Reference<XInterface> SAL_CALL NestedRegistry_CreateInstance(
     return xRet;
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_stoc_NestedRegistry_component_getFactory(
+    const char * , void * , void * )
+{
+    Reference< XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            NestedRegistry_CreateInstance,
+            "com.sun.star.comp.stoc.NestedRegistry",
+            NestedRegistryImpl_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 66626a8..4e8e697 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -65,14 +65,11 @@ using namespace osl;
 
 #define IMPLNAME "com.sun.star.comp.stoc.ImplementationRegistration"
 #define SERVICENAME         "com.sun.star.registry.ImplementationRegistration"
-namespace stoc_impreg
-{
+
+namespace {
+
 struct StringPool
 {
-    OUString sImplementationName;
-    OUString sServiceName;
-    OUString TMP;
-    OUString TEMP;
     OUString slash_UNO_slash_REGISTRY_LINKS;
     OUString slash_IMPLEMENTATIONS;
     OUString slash_UNO;
@@ -85,11 +82,7 @@ struct StringPool
     OUString com_sun_star_registry_SimpleRegistry;
     OUString Registry;
     StringPool()
-        : sImplementationName( IMPLNAME )
-        , sServiceName( SERVICENAME )
-        , TMP( "TMP" )
-        , TEMP( "TEMP" )
-        , slash_UNO_slash_REGISTRY_LINKS( "/UNO/REGISTRY_LINKS")
+        : slash_UNO_slash_REGISTRY_LINKS( "/UNO/REGISTRY_LINKS")
         , slash_IMPLEMENTATIONS( "/IMPLEMENTATIONS" )
         , slash_UNO( "/UNO")
         , slash_UNO_slash_SERVICES( "/UNO/SERVICES")
@@ -119,25 +112,14 @@ const StringPool &spool()
     }
     return *pPool;
 }
-}
 
-namespace stoc_bootstrap
-{
-Sequence< OUString > impreg_getSupportedServiceNames()
+static Sequence< OUString > ImplementationRegistration_getSupportedServiceNames()
 {
     Sequence< OUString > seqNames(1);
-    seqNames.getArray()[0] = stoc_impreg::spool().sServiceName;
+    seqNames.getArray()[0] = SERVICENAME;
     return seqNames;
 }
 
-OUString impreg_getImplementationName()
-{
-    return stoc_impreg::spool().sImplementationName;
-}
-}
-
-namespace stoc_impreg
-{
 //*************************************************************************
 //  static deleteAllLinkReferences()
 //
@@ -1327,7 +1309,7 @@ ImplementationRegistration::~ImplementationRegistration() {}
 // XServiceInfo
 OUString ImplementationRegistration::getImplementationName() throw(RuntimeException)
 {
-    return stoc_bootstrap::impreg_getImplementationName();
+    return OUString(IMPLNAME);
 }
 
 // XServiceInfo
@@ -1339,7 +1321,7 @@ sal_Bool ImplementationRegistration::supportsService(const OUString& ServiceName
 // XServiceInfo
 Sequence< OUString > ImplementationRegistration::getSupportedServiceNames(void) throw(RuntimeException)
 {
-    return stoc_bootstrap::impreg_getSupportedServiceNames();
+    return ImplementationRegistration_getSupportedServiceNames();
 }
 
 Reference< XSimpleRegistry > ImplementationRegistration::getRegistryFromServiceManager()
@@ -1801,7 +1783,7 @@ void ImplementationRegistration::doRegister(
 
                 xSourceKey = xReg->getRootKey();
                 Reference < XRegistryKey > xDestKey = xDest->getRootKey();
-                mergeKeys( xDestKey, xSourceKey );
+                stoc_impreg::mergeKeys( xDestKey, xSourceKey );
                 xDestKey->closeKey();
                 xSourceKey->closeKey();
             }
@@ -1840,17 +1822,26 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe
     OSL_ASSERT( xReg.is() );
     return xReg;
 }
+
 }
 
-namespace stoc_bootstrap
-{
-//*************************************************************************
-Reference<XInterface> SAL_CALL ImplementationRegistration_CreateInstance(
+static Reference<XInterface> ImplementationRegistration_CreateInstance(
     const Reference<XComponentContext> & xCtx ) // throw(Exception)
 {
-    return (XImplementationRegistration *)new stoc_impreg::ImplementationRegistration(xCtx);
+    return (XImplementationRegistration *)new ImplementationRegistration(xCtx);
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory(
+    const char * , void * , void * )
+{
+    Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            ImplementationRegistration_CreateInstance,
+            IMPLNAME,
+            ImplementationRegistration_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx
index c10d8b3..402ed4a 100644
--- a/stoc/source/loader/dllcomponentloader.cxx
+++ b/stoc/source/loader/dllcomponentloader.cxx
@@ -54,26 +54,15 @@ using namespace com::sun::star::registry;
 using namespace cppu;
 using namespace osl;
 
-namespace stoc_bootstrap
-{
-Sequence< OUString > loader_getSupportedServiceNames()
+namespace {
+
+static Sequence< OUString > DllComponentLoader_getSupportedServiceNames()
 {
     Sequence< OUString > seqNames(1);
     seqNames.getArray()[0] = OUString(SERVICENAME);
     return seqNames;
 }
 
-OUString loader_getImplementationName()
-{
-    return OUString(IMPLNAME);
-}
-}
-
-namespace stoc_loader
-{
-//*************************************************************************
-// DllComponentLoader
-//*************************************************************************
 class DllComponentLoader
     : public WeakImplHelper3< XImplementationLoader,
                               XInitialization,
@@ -112,7 +101,7 @@ DllComponentLoader::~DllComponentLoader() {}
 OUString SAL_CALL DllComponentLoader::getImplementationName(  )
     throw(::com::sun::star::uno::RuntimeException)
 {
-    return stoc_bootstrap::loader_getImplementationName();
+    return OUString(IMPLNAME);
 }
 
 sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceName )
@@ -124,7 +113,7 @@ sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceNa
 Sequence<OUString> SAL_CALL DllComponentLoader::getSupportedServiceNames(  )
     throw(::com::sun::star::uno::RuntimeException)
 {
-    return stoc_bootstrap::loader_getSupportedServiceNames();
+    return DllComponentLoader_getSupportedServiceNames();
 }
 
 //*************************************************************************
@@ -182,16 +171,15 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo(
     return sal_True;
 #endif
 }
+
 }
 
-namespace stoc_bootstrap
-{
-//*************************************************************************
-Reference<XInterface> SAL_CALL DllComponentLoader_CreateInstance( const Reference<XComponentContext> & xCtx ) throw(Exception)
+static Reference<XInterface> DllComponentLoader_CreateInstance(
+        const Reference<XComponentContext> & xCtx ) throw(Exception)
 {
     Reference<XInterface> xRet;
 
-    XImplementationLoader *pXLoader = (XImplementationLoader *)new stoc_loader::DllComponentLoader(xCtx);
+    XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(xCtx);
 
     if (pXLoader)
     {
@@ -201,6 +189,17 @@ Reference<XInterface> SAL_CALL DllComponentLoader_CreateInstance( const Referenc
     return xRet;
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory(
+    const char * , void * , void * )
+{
+    Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            DllComponentLoader_CreateInstance,
+            IMPLNAME,
+            DllComponentLoader_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index 30f4efb..6de5cce 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -49,7 +49,6 @@
 
 #include "lru_cache.h"
 #include "permissions.h"
-#include "bootstrapservices.hxx"
 
 
 #define SERVICE_NAME "com.sun.star.security.AccessController"
@@ -62,9 +61,10 @@ using namespace ::osl;
 using namespace ::cppu;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
+using namespace stoc_sec;
+
+namespace {
 
-namespace stoc_sec
-{
 // static stuff initialized when loading lib
 static OUString s_envType = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
 const char s_acRestriction[] = "access-control.restriction";
@@ -962,7 +962,7 @@ Reference< security::XAccessControlContext > AccessController::getContext()
 OUString AccessController::getImplementationName()
     throw (RuntimeException)
 {
-    return stoc_bootstrap::ac_getImplementationName();
+    return OUString(IMPL_NAME);
 }
 //__________________________________________________________________________________________________
 sal_Bool AccessController::supportsService( OUString const & serviceName )
@@ -971,41 +971,39 @@ sal_Bool AccessController::supportsService( OUString const & serviceName )
     return cppu::supportsService(this, serviceName);
 }
 //__________________________________________________________________________________________________
+static Sequence< OUString > AccessController_getSupportedServiceNames()
+{
+    Sequence< OUString > aSNS( 1 );
+    aSNS.getArray()[0] = OUString(SERVICE_NAME);
+    return aSNS;
+}
+
 Sequence< OUString > AccessController::getSupportedServiceNames()
     throw (RuntimeException)
 {
-    return stoc_bootstrap::ac_getSupportedServiceNames();
+    return AccessController_getSupportedServiceNames();
 }
+
 }
-//##################################################################################################
-namespace stoc_bootstrap {
-//--------------------------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL ac_create(
+
+static Reference< XInterface > SAL_CALL AccessController_create(
     Reference< XComponentContext > const & xComponentContext )
     SAL_THROW( (Exception) )
 {
-    return (OWeakObject *)new stoc_sec::AccessController( xComponentContext );
-}
-//--------------------------------------------------------------------------------------------------
-Sequence< OUString > ac_getSupportedServiceNames() SAL_THROW(())
-{
-    Sequence< OUString > aSNS( 1 );
-    aSNS.getArray()[0] = OUString(SERVICE_NAME);
-    return aSNS;
-}
-//--------------------------------------------------------------------------------------------------
-OUString ac_getImplementationName() SAL_THROW(())
-{
-    return OUString(IMPL_NAME);
+    return (OWeakObject *)new AccessController( xComponentContext );
 }
-//--------------------------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL filepolicy_create(
-    Reference< XComponentContext > const & xComponentContext )
-    SAL_THROW( (Exception) );
-//--------------------------------------------------------------------------------------------------
-Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(());
-//--------------------------------------------------------------------------------------------------
-OUString filepolicy_getImplementationName() SAL_THROW(());
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_security_comp_stoc_AccessController_component_getFactory(
+    const char * , void * , void * )
+{
+    Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            AccessController_create,
+            IMPL_NAME,
+            AccessController_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 36bb866..4d51240 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -39,8 +39,6 @@
 #include <com/sun/star/io/FilePermission.hpp>
 #include <com/sun/star/connection/SocketPermission.hpp>
 
-#include "bootstrapservices.hxx"
-
 #define SERVICE_NAME "com.sun.star.security.Policy"
 #define IMPL_NAME "com.sun.star.security.comp.stoc.FilePolicy"
 
@@ -50,8 +48,7 @@ using namespace ::cppu;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
-namespace stoc_sec
-{
+namespace {
 
 struct MutexHolder
 {
@@ -526,7 +523,7 @@ void FilePolicy::refresh()
 OUString FilePolicy::getImplementationName()
     throw (RuntimeException)
 {
-    return stoc_bootstrap::filepolicy_getImplementationName();
+    return OUString(IMPL_NAME);
 }
 //__________________________________________________________________________________________________
 sal_Bool FilePolicy::supportsService( OUString const & serviceName )
@@ -535,34 +532,39 @@ sal_Bool FilePolicy::supportsService( OUString const & serviceName )
     return cppu::supportsService(this, serviceName);
 }
 //__________________________________________________________________________________________________
+static Sequence< OUString > FilePolicy_getSupportedServiceNames() SAL_THROW(())
+{
+    Sequence< OUString > aSNS( 1 );
+    aSNS.getArray()[0] = OUString(SERVICE_NAME);
+    return aSNS;
+}
+
 Sequence< OUString > FilePolicy::getSupportedServiceNames()
     throw (RuntimeException)
 {
-    return stoc_bootstrap::filepolicy_getSupportedServiceNames();
+    return FilePolicy_getSupportedServiceNames();
 }
-}
-//##################################################################################################
-namespace stoc_bootstrap
-{
-//--------------------------------------------------------------------------------------------------
-Reference< XInterface > SAL_CALL filepolicy_create(
+
+} // namespace
+
+static Reference< XInterface > FilePolicy_CreateInstance(
     Reference< XComponentContext > const & xComponentContext )
     SAL_THROW( (Exception) )
 {
-    return (OWeakObject *)new stoc_sec::FilePolicy( xComponentContext );
-}
-//--------------------------------------------------------------------------------------------------
-Sequence< OUString > filepolicy_getSupportedServiceNames() SAL_THROW(())
-{
-    Sequence< OUString > aSNS( 1 );
-    aSNS.getArray()[0] = OUString(SERVICE_NAME);
-    return aSNS;
+    return (OWeakObject *)new FilePolicy( xComponentContext );
 }
-//--------------------------------------------------------------------------------------------------
-OUString filepolicy_getImplementationName() SAL_THROW(())
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_security_comp_stoc_FilePolicy_component_getFactory(
+    const char * , void * , void * )
 {
-    return OUString(IMPL_NAME);
-}
+    Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            FilePolicy_CreateInstance,
+            IMPL_NAME,
+            FilePolicy_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index 13d5725..97eda24 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -55,9 +55,6 @@
 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
 #include <com/sun/star/uno/XUnloadingPreference.hpp>
 
-#include <bootstrapservices.hxx>
-
-
 using namespace com::sun::star;
 using namespace com::sun::star::uno;
 using namespace com::sun::star::beans;
@@ -68,21 +65,9 @@ using namespace cppu;
 using namespace osl;
 using namespace std;
 
-namespace stoc_bootstrap
-{
-Sequence< OUString > smgr_wrapper_getSupportedServiceNames()
-{
-    Sequence< OUString > seqNames(1);
-    seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory";
-    return seqNames;
-}
-
-OUString smgr_wrapper_getImplementationName()
-{
-    return OUString("com.sun.star.comp.stoc.OServiceManagerWrapper");
-}
+namespace {
 
-Sequence< OUString > smgr_getSupportedServiceNames()
+Sequence< OUString > OServiceManager_getSupportedServiceNames()
 {
     Sequence< OUString > seqNames(2);
     seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory";
@@ -90,12 +75,7 @@ Sequence< OUString > smgr_getSupportedServiceNames()
     return seqNames;
 }
 
-OUString smgr_getImplementationName()
-{
-    return OUString("com.sun.star.comp.stoc.OServiceManager");
-}
-
-Sequence< OUString > regsmgr_getSupportedServiceNames()
+Sequence< OUString > ORegistryServiceManager_getSupportedServiceNames()
 {
     Sequence< OUString > seqNames(2);
     seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory";
@@ -103,15 +83,13 @@ Sequence< OUString > regsmgr_getSupportedServiceNames()
     return seqNames;
 }
 
-OUString regsmgr_getImplementationName()
+Sequence< OUString > OServiceManagerWrapper_getSupportedServiceNames()
 {
-    return OUString( "com.sun.star.comp.stoc.ORegistryServiceManager" );
-}
+    Sequence< OUString > seqNames(1);
+    seqNames.getArray()[0] = "com.sun.star.lang.MultiServiceFactory";
+    return seqNames;
 }
 
-namespace stoc_smgr
-{
-
 static Sequence< OUString > retrieveAsciiValueList(
     const Reference< XSimpleRegistry > &xReg, const OUString &keyName )
 {
@@ -437,8 +415,6 @@ public:
 
     // XServiceInfo
     virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
-    static OUString getImplementationName_Static() throw(::com::sun::star::uno::RuntimeException)
-        { return stoc_bootstrap::smgr_getImplementationName(); }
     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException);
     virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
 
@@ -1108,7 +1084,7 @@ OUString OServiceManager::getImplementationName()
     throw(::com::sun::star::uno::RuntimeException)
 {
     check_undisposed();
-    return getImplementationName_Static();
+    return OUString("com.sun.star.comp.stoc.OServiceManager");
 }
 
 // XServiceInfo
@@ -1123,7 +1099,7 @@ Sequence< OUString > OServiceManager::getSupportedServiceNames()
     throw(::com::sun::star::uno::RuntimeException)
 {
     check_undisposed();
-    return stoc_bootstrap::smgr_getSupportedServiceNames();
+    return  OServiceManager_getSupportedServiceNames();
 }
 
 
@@ -1387,7 +1363,7 @@ public:
 
     // XServiceInfo
     OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException)
-        { return stoc_bootstrap::regsmgr_getImplementationName(); }
+        { return OUString("com.sun.star.comp.stoc.ORegistryServiceManager"); }
 
     Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
 
@@ -1626,7 +1602,7 @@ Sequence< OUString > ORegistryServiceManager::getSupportedServiceNames()
     throw(::com::sun::star::uno::RuntimeException)
 {
     check_undisposed();
-    return stoc_bootstrap::regsmgr_getSupportedServiceNames();
+    return ORegistryServiceManager_getSupportedServiceNames();
 }
 
 
@@ -1715,37 +1691,67 @@ Any ORegistryServiceManager::getPropertyValue(const OUString& PropertyName)
 
 } // namespace
 
-namespace stoc_bootstrap
-{
-/**
- * Create the ServiceManager
- */
-Reference<XInterface > SAL_CALL OServiceManager_CreateInstance(
+static Reference<XInterface > OServiceManager_CreateInstance(
     const Reference< XComponentContext > & xContext )
 {
     return Reference<XInterface >(
         static_cast< XInterface * >(
-            static_cast< OWeakObject * >( new stoc_smgr::OServiceManager( xContext ) ) ) );
+            static_cast< OWeakObject * >( new OServiceManager( xContext ) ) ) );
 }
 
-/**
- * Create the ServiceManager
- */
-Reference<XInterface > SAL_CALL ORegistryServiceManager_CreateInstance(
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_stoc_OServiceManager_component_getFactory(
+    const char * , void * , void * )
+{
+    Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            OServiceManager_CreateInstance,
+            "com.sun.star.comp.stoc.OServiceManager",
+            OServiceManager_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
+}
+
+static Reference<XInterface > ORegistryServiceManager_CreateInstance(
     const Reference< XComponentContext > & xContext )
     throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
 {
     return Reference<XInterface >(
         static_cast< XInterface * >(
-            static_cast< OWeakObject * >( new stoc_smgr::ORegistryServiceManager( xContext ) ) ) );
+            static_cast< OWeakObject * >( new ORegistryServiceManager( xContext ) ) ) );
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_stoc_ORegistryServiceManager_component_getFactory(
+    const char * , void * , void * )
+{
+    Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            ORegistryServiceManager_CreateInstance,
+            "com.sun.star.comp.stoc.ORegistryServiceManager",
+            ORegistryServiceManager_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
-Reference<XInterface > SAL_CALL OServiceManagerWrapper_CreateInstance(
+static Reference<XInterface > OServiceManagerWrapper_CreateInstance(
     const Reference< XComponentContext > & xContext )
     throw (Exception)
 {
-    return (OWeakObject *)new stoc_smgr::OServiceManagerWrapper( xContext );
+    return (OWeakObject *)new OServiceManagerWrapper( xContext );
 }
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_stoc_OServiceManagerWrapper_component_getFactory(
+    const char * , void * , void * )
+{
+    Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = createSingleComponentFactory(
+            OServiceManagerWrapper_CreateInstance,
+            "com.sun.star.comp.stoc.OServiceManagerWrapper",
+            OServiceManagerWrapper_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index a3e517c..80e30da 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -34,6 +34,7 @@
 #include "com/sun/star/uno/XComponentContext.hpp"
 #include "com/sun/star/uno/XInterface.hpp"
 #include "com/sun/star/uno/Sequence.hxx"
+#include <cppuhelper/factory.hxx>
 #include "cppuhelper/implbase1.hxx"
 #include "cppuhelper/implbase2.hxx"
 #include "cppuhelper/weak.hxx"
@@ -49,10 +50,14 @@
 #include "rtl/ustring.hxx"
 #include "sal/types.h"
 
-#include "bootstrapservices.hxx"
-
 namespace {
 
+static css::uno::Sequence< OUString > SimpleRegistry_getSupportedServiceNames() {
+    css::uno::Sequence< OUString > names(1);
+    names[0] = "com.sun.star.registry.SimpleRegistry";
+    return names;
+}
+
 class SimpleRegistry:
     public cppu::WeakImplHelper2<
         css::registry::XSimpleRegistry, css::lang::XServiceInfo >
@@ -96,7 +101,7 @@ private:
 
     virtual OUString SAL_CALL getImplementationName()
         throw (css::uno::RuntimeException)
-    { return stoc_bootstrap::simreg_getImplementationName(); }
+    { return OUString("com.sun.star.comp.stoc.SimpleRegistry"); }
 
     virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
         throw (css::uno::RuntimeException)
@@ -104,7 +109,7 @@ private:
 
     virtual css::uno::Sequence< OUString > SAL_CALL
     getSupportedServiceNames() throw (css::uno::RuntimeException)
-    { return stoc_bootstrap::simreg_getSupportedServiceNames(); }
+    { return SimpleRegistry_getSupportedServiceNames(); }
 
     Registry registry_;
 };
@@ -1120,24 +1125,24 @@ void SimpleRegistry::mergeKey(
 
 }
 
-namespace stoc_bootstrap {
-
-css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
+static css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
     SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext >
         const &)
 {
     return static_cast< cppu::OWeakObject * >(new SimpleRegistry);
 }
 
-css::uno::Sequence< OUString > simreg_getSupportedServiceNames() {
-    css::uno::Sequence< OUString > names(1);
-    names[0] = "com.sun.star.registry.SimpleRegistry";
-    return names;
-}
-
-OUString simreg_getImplementationName() {
-    return OUString("com.sun.star.comp.stoc.SimpleRegistry");
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_stoc_SimpleRegistry_component_getFactory(
+    const char * , void * , void * )
+{
+    css::uno::Reference< css::lang::XSingleComponentFactory > xFactory;
+    xFactory = cppu::createSingleComponentFactory(
+            SimpleRegistry_CreateInstance,
+            "com.sun.star.comp.stoc.SimpleRegistry",
+            SimpleRegistry_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
-}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/stoc/util/bootstrap.component b/stoc/util/bootstrap.component
index ee62700..f06de74 100644
--- a/stoc/util/bootstrap.component
+++ b/stoc/util/bootstrap.component
@@ -18,7 +18,7 @@
  -->
 
 <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
-    prefix="bootstrap" xmlns="http://openoffice.org/2010/uno-components">
+    prefix="direct" xmlns="http://openoffice.org/2010/uno-components">
   <implementation name="com.sun.star.comp.stoc.DLLComponentLoader">
     <service name="com.sun.star.loader.SharedLibrary"/>
   </implementation>
commit 291e846db9840b9f82bc28e495b54ae5ac51d0fc
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Mon Dec 16 10:58:22 2013 +0100

    sax: various clean up. Move _getFactory next to the implementation.
    
    Use more anonymous namespaces, de-duplicate code, bin some comments.
    Makes the library smaller.
    
    Change-Id: Id0cefdcaa72a74741303fc27e36038488ef8b059

diff --git a/include/sax/fastparser.hxx b/include/sax/fastparser.hxx
index afd5add..83fbe9d 100644
--- a/include/sax/fastparser.hxx
+++ b/include/sax/fastparser.hxx
@@ -52,9 +52,6 @@ public:
     FastSaxParser();
     virtual ~FastSaxParser();
 
-    // The implementation details
-    static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void);
-
     // XFastParser
     virtual void SAL_CALL parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
     virtual void SAL_CALL setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
diff --git a/sax/source/expatwrap/factory.hxx b/sax/source/expatwrap/factory.hxx
deleted file mode 100644
index a3a94fb..0000000
--- a/sax/source/expatwrap/factory.hxx
+++ /dev/null
@@ -1,27 +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 .
- */
-namespace sax_expatwrap {
-Reference< XInterface > SAL_CALL SaxWriter_CreateInstance(
-    const Reference< XMultiServiceFactory > & rSMgr ) throw (Exception);
-OUString SaxWriter_getServiceName() throw();
-OUString SaxWriter_getImplementationName() throw();
-Sequence< OUString >    SaxWriter_getSupportedServiceNames(void) throw();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 214d262..83dff1a 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -46,12 +46,10 @@ using namespace ::com::sun::star::registry;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::io;
 
-#include "factory.hxx"
 #include "attrlistimpl.hxx"
 #include "xml2utf.hxx"
-#include <sax/fastparser.hxx>
 
-namespace sax_expatwrap {
+namespace {
 
 // Useful macros for correct String conversion depending on the choosen expat-mode
 #ifdef XML_UNICODE
@@ -128,11 +126,15 @@ OUString XmlChar2OUString( const XML_Char *p )
     }\
     ((void)0)
 
-#define IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.ParserExpat"
-#define SERVICE_NAME        "com.sun.star.xml.sax.Parser"
 
 class SaxExpatParser_Impl;
 
+static Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void)
+{
+    Sequence<OUString> seq(1);
+    seq[0] = OUString("com.sun.star.xml.sax.Parser");
+    return seq;
+}
 
 // This class implements the external Parser interface
 class SaxExpatParser
@@ -145,12 +147,6 @@ public:
     SaxExpatParser();
     ~SaxExpatParser();
 
-public:
-
-    // The implementation details
-    static Sequence< OUString >     getSupportedServiceNames_Static(void) throw ();
-
-public:
     // ::com::sun::star::lang::XInitialization:
     virtual void SAL_CALL initialize(Sequence<Any> const& rArguments)
         throw (RuntimeException, Exception);
@@ -183,45 +179,13 @@ private:
 
 };
 
-//--------------------------------------
-// the extern interface
-//---------------------------------------
-Reference< XInterface > SAL_CALL SaxExpatParser_CreateInstance(
-    SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
-    throw(Exception)
-{
-    SaxExpatParser *p = new SaxExpatParser;
-
-    return Reference< XInterface > ( (OWeakObject * ) p );
-}
-
-Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance(
-            SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
-        throw(Exception)
-{
-    ::sax_fastparser::FastSaxParser *p = new ::sax_fastparser::FastSaxParser;
-    return Reference< XInterface > ( (OWeakObject * ) p );
-}
-
-Sequence< OUString >    SaxExpatParser::getSupportedServiceNames_Static(void) throw ()
-{
-    Sequence<OUString> aRet(1);
-    aRet[0] = SERVICE_NAME;
-    return aRet;
-}
-
-
-//---------------------------------------------
-// the implementation part
-//---------------------------------------------
-
 
 // Entity binds all information neede for a single file
 struct Entity
 {
     InputSource         structSource;
     XML_Parser          pParser;
-    XMLFile2UTFConverter converter;
+    sax_expatwrap::XMLFile2UTFConverter converter;
 };
 
 
@@ -242,7 +206,7 @@ public: // module scope
 
 
     Reference < XAttributeList >    rAttrList;
-    AttributeList   *pAttrList;
+    sax_expatwrap::AttributeList   *pAttrList;
 
     // External entity stack
     vector<struct Entity>   vecEntity;
@@ -450,7 +414,7 @@ SaxExpatParser::SaxExpatParser(  )
 
     // performance-improvement. Reference is needed when calling the startTag callback.
     // Handing out the same object with every call is allowed (see sax-specification)
-    m_pImpl->pAttrList = new AttributeList;
+    m_pImpl->pAttrList = new sax_expatwrap::AttributeList;
     m_pImpl->rAttrList = Reference< XAttributeList > ( m_pImpl->pAttrList );
 
     m_pImpl->bExceptionWasThrown = false;
@@ -630,7 +594,7 @@ void SaxExpatParser::setLocale( const Locale & locale ) throw (RuntimeException)
 // XServiceInfo
 OUString SaxExpatParser::getImplementationName() throw ()
 {
-    return OUString( IMPLEMENTATION_NAME );
+    return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat");
 }
 
 // XServiceInfo
@@ -642,10 +606,7 @@ sal_Bool SaxExpatParser::supportsService(const OUString& ServiceName) throw ()
 // XServiceInfo
 Sequence< OUString > SaxExpatParser::getSupportedServiceNames(void) throw ()
 {
-
-    Sequence<OUString> seq(1);
-    seq[0] = SERVICE_NAME;
-    return seq;
+    return SaxExpatParser_getSupportedServiceNames();
 }
 
 
@@ -1058,56 +1019,29 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis )
     CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pImpl,rExtendedDocumentHandler->endCDATA() );
 }
 
+} // namespace
+
+static Reference< XInterface > SaxExpatParser_CreateInstance(
+    SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
+    throw(Exception)
+{
+    SaxExpatParser *p = new SaxExpatParser;
+    return Reference< XInterface > ( (OWeakObject * ) p );
 }
 
-static void * getSingleFactory(
-        void *pServiceManager,
-        const OUString& sImplementation,
-        ComponentInstantiation pCreateFunction,
-        const Sequence< OUString > & rServiceNames)
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory(
+    const char * , void *pServiceManager, void * )
 {
     Reference< XSingleServiceFactory > xFactory;
     Reference< XMultiServiceFactory > xSMgr =
         reinterpret_cast< XMultiServiceFactory * >( pServiceManager );
     xFactory = createSingleFactory( xSMgr,
-            sImplementation, pCreateFunction, rServiceNames );
-    xFactory->acquire();
-    return xFactory.get();
-}
-
-using namespace sax_expatwrap;
-
-extern "C"
-{
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory(
-    const char * , void *pServiceManager, void * )
-{
-    return getSingleFactory( pServiceManager,
             "com.sun.star.comp.extensions.xml.sax.ParserExpat",
             SaxExpatParser_CreateInstance,
-            SaxExpatParser::getSupportedServiceNames_Static() );
-}
-
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_extensions_xml_sax_Writer_component_getFactory(
-    const char * , void *pServiceManager, void * )
-{
-    return getSingleFactory( pServiceManager,
-            "com.sun.star.extensions.xml.sax.Writer",
-            SaxWriter_CreateInstance,
-            SaxWriter_getSupportedServiceNames() );
-}
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory(
-    const char * , void *pServiceManager, void * )
-{
-    return getSingleFactory( pServiceManager,
-            "com.sun.star.comp.extensions.xml.sax.FastParser",
-            FastSaxParser_CreateInstance,
-            sax_fastparser::FastSaxParser::getSupportedServiceNames_Static() );
-}
-
+            SaxExpatParser_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index 12e4674..a6b9a31 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -51,7 +51,6 @@ using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::util;
 using namespace ::com::sun::star::io;
 
-#include "factory.hxx"
 #include "xml2utf.hxx"
 
 #define LINEFEED 10
@@ -66,7 +65,7 @@ using namespace ::com::sun::star::io;
 *
 *****/
 
-namespace sax_expatwrap {
+namespace {
 
 enum SaxInvalidCharacterError
 {
@@ -868,6 +867,13 @@ static inline sal_Int32 getFirstLineBreak( const OUString & str ) throw ()
     return -1;
 }
 
+static Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw ()
+{
+    Sequence<OUString> seq(1);
+    seq.getArray()[0] = OUString("com.sun.star.xml.sax.Writer");
+    return seq;
+}
+
 class SAXWriter :
     public WeakImplHelper2<
             XWriter,
@@ -965,36 +971,6 @@ private:
     sal_Int32 m_nLevel;
 };
 
-
-//--------------------------------------
-// the extern interface
-//---------------------------------------
-Reference < XInterface > SAL_CALL SaxWriter_CreateInstance(
-    SAL_UNUSED_PARAMETER const Reference < XMultiServiceFactory > & )
-    throw (Exception)
-{
-    SAXWriter *p = new SAXWriter;
-    return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) );
-}
-
-OUString SaxWriter_getServiceName() throw()
-{
-    return OUString("com.sun.star.xml.sax.Writer");
-}
-
-OUString SaxWriter_getImplementationName() throw()
-{
-    return OUString("com.sun.star.extensions.xml.sax.Writer");
-}
-
-Sequence< OUString >    SaxWriter_getSupportedServiceNames(void) throw()
-{
-    Sequence<OUString> aRet(1);
-    aRet.getArray()[0] = SaxWriter_getServiceName();
-    return aRet;
-}
-
-
 sal_Int32 SAXWriter::getIndentPrefixLength( sal_Int32 nFirstLineBreakOccurrence ) throw()
 {
     sal_Int32 nLength =-1;
@@ -1018,7 +994,7 @@ static inline sal_Bool isFirstCharWhitespace( const sal_Unicode *p ) throw()
 // XServiceInfo
 OUString SAXWriter::getImplementationName() throw()
 {
-    return SaxWriter_getImplementationName();
+    return OUString("com.sun.star.extensions.xml.sax.Writer");
 }
 
 // XServiceInfo
@@ -1030,9 +1006,7 @@ sal_Bool SAXWriter::supportsService(const OUString& ServiceName) throw()
 // XServiceInfo
 Sequence< OUString > SAXWriter::getSupportedServiceNames(void) throw ()
 {
-    Sequence<OUString> seq(1);
-    seq.getArray()[0] = SaxWriter_getServiceName();
-    return seq;
+    return SAXWriter_getSupportedServiceNames();
 }
 
 void SAXWriter::startDocument()                     throw(SAXException, RuntimeException )
@@ -1398,6 +1372,29 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc
     }
 }
 
+} // namespace
+
+static Reference < XInterface > SAXWriter_CreateInstance(
+    SAL_UNUSED_PARAMETER const Reference < XMultiServiceFactory > & )
+    throw (Exception)
+{
+    SAXWriter *p = new SAXWriter;
+    return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) );
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_extensions_xml_sax_Writer_component_getFactory(
+    const char * , void *pServiceManager, void * )
+{
+    Reference< XSingleServiceFactory > xFactory;
+    Reference< XMultiServiceFactory > xSMgr =
+        reinterpret_cast< XMultiServiceFactory * >( pServiceManager );
+    xFactory = createSingleFactory( xSMgr,
+            "com.sun.star.extensions.xml.sax.Writer",
+            SAXWriter_CreateInstance,
+            SAXWriter_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx
index af73f23..5dd5c64 100644
--- a/sax/source/fastparser/fastparser.cxx
+++ b/sax/source/fastparser/fastparser.cxx
@@ -45,9 +45,6 @@
 #include <cstring>
 #include <expat.h>
 
-#define PARSER_IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastParser"
-#define PARSER_SERVICE_NAME        "com.sun.star.xml.sax.FastParser"
-
 using namespace ::std;
 using namespace ::osl;
 using namespace ::cppu;
@@ -56,8 +53,17 @@ using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::com::sun::star::io;
 using namespace com::sun::star;
+using namespace sax_fastparser;
 
-namespace sax_fastparser {
+static uno::Sequence<OUString> FastSaxParser_getSupportedServiceNames()
+    throw (uno::RuntimeException)
+{
+    Sequence<OUString> seq(1);
+    seq.getArray()[0] = OUString("com.sun.star.xml.sax.FastParser");
+    return seq;
+}
+
+namespace {
 
 struct Event;
 class FastLocatorImpl;
@@ -186,9 +192,9 @@ struct Entity : public ParserData
     Event& getEvent( CallbackType aType );
 };
 
-// --------------------------------------------------------------------
-// FastSaxParser implementation
-// --------------------------------------------------------------------
+} // namespace
+
+namespace sax_fastparser {
 
 class FastSaxParserImpl
 {
@@ -196,9 +202,6 @@ public:
     FastSaxParserImpl( FastSaxParser* pFront );
     ~FastSaxParserImpl();
 
-    // The implementation details
-    static ::com::sun::star::uno::Sequence< OUString > getSupportedServiceNames_Static(void);
-
     // XFastParser
     void parseStream( const ::com::sun::star::xml::sax::InputSource& aInputSource ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
     void setFastDocumentHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastDocumentHandler >& Handler ) throw (::com::sun::star::uno::RuntimeException);
@@ -209,11 +212,6 @@ public:
     void setEntityResolver( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XEntityResolver >& Resolver ) throw (::com::sun::star::uno::RuntimeException);
     void setLocale( const ::com::sun::star::lang::Locale& rLocale ) throw (::com::sun::star::uno::RuntimeException);
 
-    // XServiceInfo
-    OUString getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
-    sal_Bool supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
-    ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
-
     // called by the C callbacks of the expat parser
     void callbackStartElement( const XML_Char* name, const XML_Char** atts );
     void callbackEndElement( const XML_Char* name );
@@ -262,6 +260,10 @@ private:
     FastTokenLookup maTokenLookup;
 };
 
+} // namespace sax_fastparser
+
+namespace {
+
 class ParserThread: public salhelper::Thread
 {
     FastSaxParserImpl *mpParser;
@@ -282,25 +284,23 @@ private:
     }
 };
 
-}
-
 extern "C" {
 
 static void call_callbackStartElement(void *userData, const XML_Char *name , const XML_Char **atts)
 {
-    sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( userData );
+    FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( userData );
     pFastParser->callbackStartElement( name, atts );
 }
 
 static void call_callbackEndElement(void *userData, const XML_Char *name)
 {
-    sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( userData );
+    FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( userData );
     pFastParser->callbackEndElement( name );
 }
 
 static void call_callbackCharacters( void *userData , const XML_Char *s , int nLen )
 {
-    sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( userData );
+    FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( userData );
     pFastParser->callbackCharacters( s, nLen );
 }
 
@@ -309,7 +309,7 @@ static void call_callbackEntityDecl(void *userData, const XML_Char *entityName,
         const XML_Char *base, const XML_Char *systemId,
         const XML_Char *publicId, const XML_Char *notationName)
 {
-    sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>(userData);
+    FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>(userData);
     pFastParser->callbackEntityDecl(entityName, is_parameter_entity, value,
             value_length, base, systemId, publicId, notationName);
 }
@@ -317,18 +317,12 @@ static void call_callbackEntityDecl(void *userData, const XML_Char *entityName,
 static int call_callbackExternalEntityRef( XML_Parser parser,
         const XML_Char *openEntityNames, const XML_Char *base, const XML_Char *systemId, const XML_Char *publicId )
 {
-    sax_fastparser::FastSaxParserImpl* pFastParser = reinterpret_cast<sax_fastparser::FastSaxParserImpl*>( XML_GetUserData( parser ) );
+    FastSaxParserImpl* pFastParser = reinterpret_cast<FastSaxParserImpl*>( XML_GetUserData( parser ) );
     return pFastParser->callbackExternalEntityRef( parser, openEntityNames, base, systemId, publicId );
 }
 
 }
 
-namespace sax_fastparser {
-
-// --------------------------------------------------------------------
-// FastLocatorImpl
-// --------------------------------------------------------------------
-
 class FastLocatorImpl : public WeakImplHelper1< XLocator >
 {
 public:
@@ -347,19 +341,6 @@ private:
     FastSaxParserImpl *mpParser;
 };
 
-// --------------------------------------------------------------------
-// FastSaxParser
-// --------------------------------------------------------------------
-
-//---------------------------------------------
-// the implementation part
-//---------------------------------------------
-
-
-// --------------------------------------------------------------------
-// FastLocatorImpl implementation
-// --------------------------------------------------------------------
-
 sal_Int32 SAL_CALL FastLocatorImpl::getColumnNumber(void) throw (RuntimeException)
 {
     checkDispose();
@@ -546,6 +527,10 @@ Event& Entity::getEvent( CallbackType aType )
     return rEvent;
 }
 
+} // namespace
+
+namespace sax_fastparser {
+
 FastSaxParserImpl::FastSaxParserImpl( FastSaxParser* pFront ) : mpFront(pFront)
 {
     mxDocumentLocator.set( new FastLocatorImpl( this ) );
@@ -870,44 +855,7 @@ void FastSaxParserImpl::setLocale( const Locale & Locale ) throw (RuntimeExcepti
     maData.maLocale = Locale;
 }
 
-Sequence< OUString > FastSaxParserImpl::getSupportedServiceNames_Static(void)
-{
-    Sequence<OUString> aRet(1);
-    aRet.getArray()[0] = OUString( PARSER_SERVICE_NAME );
-    return aRet;
-}
-
-// XServiceInfo
-OUString FastSaxParserImpl::getImplementationName() throw (RuntimeException)
-{
-    return OUString( PARSER_IMPLEMENTATION_NAME );
-}
-
-// XServiceInfo
-sal_Bool FastSaxParserImpl::supportsService(const OUString& ServiceName) throw (RuntimeException)
-{
-    return cppu::supportsService(mpFront, ServiceName);
-}
-
-// XServiceInfo
-Sequence< OUString > FastSaxParserImpl::getSupportedServiceNames(void) throw (RuntimeException)
-{
-
-    Sequence<OUString> seq(1);
-    seq.getArray()[0] = OUString( PARSER_SERVICE_NAME );
-    return seq;
-}
-
-
-/*---------------------------------------
-*
-* Helper functions and classes
-*
-*-------------------------------------------*/
-
-namespace {
-
-OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine )
+static OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int32 nLine )
 {
     const sal_Char* pMessage = "";
     switch( xmlE )
@@ -948,8 +896,6 @@ OUString lclGetErrorMessage( XML_Error xmlE, const OUString& sSystemId, sal_Int3
     return aBuffer.makeStringAndClear();
 }
 
-} // namespace
-
 void FastSaxParserImpl::deleteUsedEvents()
 {
     Entity& rEntity = getEntity();
@@ -1404,11 +1350,6 @@ FastSaxParser::~FastSaxParser()
     delete mpImpl;
 }
 
-uno::Sequence<OUString> FastSaxParser::getSupportedServiceNames_Static()
-{
-    return FastSaxParserImpl::getSupportedServiceNames_Static();
-}
-
 void FastSaxParser::parseStream( const xml::sax::InputSource& aInputSource )
     throw (xml::sax::SAXException, io::IOException, uno::RuntimeException)
 {
@@ -1460,19 +1401,19 @@ void FastSaxParser::setLocale( const lang::Locale& rLocale )
 OUString FastSaxParser::getImplementationName()
     throw (uno::RuntimeException)
 {
-    return mpImpl->getImplementationName();
+    return OUString("com.sun.star.comp.extensions.xml.sax.FastParser");
 }
 
 sal_Bool FastSaxParser::supportsService( const OUString& ServiceName )
     throw (uno::RuntimeException)
 {
-    return mpImpl->supportsService(ServiceName);
+    return cppu::supportsService(this, ServiceName);
 }
 
 uno::Sequence<OUString> FastSaxParser::getSupportedServiceNames()
     throw (uno::RuntimeException)
 {
-    return mpImpl->getSupportedServiceNames();
+    return FastSaxParser_getSupportedServiceNames();
 }
 
 bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
@@ -1482,12 +1423,27 @@ bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const
 
 } // namespace sax_fastparser
 
-Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance(
+static Reference< XInterface > FastSaxParser_CreateInstance(
     SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
     throw(Exception)
 {
-    sax_fastparser::FastSaxParser *p = new sax_fastparser::FastSaxParser;
+    FastSaxParser *p = new FastSaxParser;
     return Reference< XInterface > ( (OWeakObject * ) p );
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
+com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory(
+    const char * , void *pServiceManager, void * )
+{
+    Reference< XSingleServiceFactory > xFactory;
+    Reference< XMultiServiceFactory > xSMgr =
+        reinterpret_cast< XMultiServiceFactory * >( pServiceManager );
+    xFactory = createSingleFactory( xSMgr,
+            "com.sun.star.comp.extensions.xml.sax.FastParser",
+            FastSaxParser_CreateInstance,
+            FastSaxParser_getSupportedServiceNames() );
+    xFactory->acquire();
+    return xFactory.get();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sax/test/sax/testsax.cxx b/sax/test/sax/testsax.cxx
index fff579f..bfcf4ee 100644
--- a/sax/test/sax/testsax.cxx
+++ b/sax/test/sax/testsax.cxx
@@ -42,8 +42,6 @@ using namespace ::com::sun::star::registry;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::xml::sax;
 
-#include "factory.hxx"
-
 // test szenarios
 
 namespace sax_test {
diff --git a/sax/test/sax/testwriter.cxx b/sax/test/sax/testwriter.cxx
index a6a2986..24c9258 100644
--- a/sax/test/sax/testwriter.cxx
+++ b/sax/test/sax/testwriter.cxx
@@ -45,8 +45,6 @@ using namespace ::com::sun::star::registry;
 using namespace ::com::sun::star::io;
 using namespace ::com::sun::star::xml::sax;
 
-#include "factory.hxx"
-
 namespace sax_test {
 
 class OFileWriter :
commit 562b21949f4ed986d11270bd6203741487795343
Author: Matúš Kukan <matus.kukan at collabora.com>
Date:   Mon Dec 16 08:51:20 2013 +0100

    Deduplicate some foo_component_getFactory declarations.
    
    Change-Id: I9304b62134bab375b721399ae078bf66e01191d8

diff --git a/android/experimental/DocumentLoader/native-code.cxx b/android/experimental/DocumentLoader/native-code.cxx
index 0697ed6..a444eb5 100644
--- a/android/experimental/DocumentLoader/native-code.cxx
+++ b/android/experimental/DocumentLoader/native-code.cxx
@@ -10,48 +10,6 @@
 #include "osl/detail/android-bootstrap.h"
 
 extern "C"
-{
-    extern void * animcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * avmedia_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * dba_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * dbaxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * evtatt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * frm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fsstorage_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fwk_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fwl_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fwm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * hwp_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * hyphen_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * lng_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * lnth_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * oox_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * protocolhandler_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sb_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sc_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * scd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * scfilt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sdd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * smd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * spell_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * svgfilter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * swd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * t602filter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * wpftdraw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * wpftwriter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * xmlfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * xmlsecurity_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * xo_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * xof_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-}
-
-extern "C"
 __attribute__ ((visibility("default")))
 const lib_to_component_mapping *
 lo_get_libmap(void)
diff --git a/android/experimental/LibreOffice4Android/native-code.cxx b/android/experimental/LibreOffice4Android/native-code.cxx
index 1c3b5c3..af0f5b7 100644
--- a/android/experimental/LibreOffice4Android/native-code.cxx
+++ b/android/experimental/LibreOffice4Android/native-code.cxx
@@ -10,65 +10,6 @@
 #include "osl/detail/android-bootstrap.h"
 
 extern "C"
-{
-    extern void * animcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * avmedia_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * basprov_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * chartcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * dba_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * dbaxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * dlgprov_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * embobj_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * emboleobj_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * evtatt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * filterconfig1_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * frm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fsstorage_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fwk_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fwl_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * fwm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * hwp_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * hyphen_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * lng_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * lnth_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * oox_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * protocolhandler_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sb_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sc_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * scd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * scfilt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * scriptframe_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sot_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * svt_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * svx_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * svxcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sdd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sm_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * smd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * spell_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * stringresource_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * svgfilter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * sw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * swd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * t602filter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * textfd_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * tk_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * ucppkg1_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * unoxml_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * unordf_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * vbaswobj_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * vbaevents_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * wpftdraw_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * wpftwriter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
-    extern void * writerfilter_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list