summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@collabora.com>2013-12-13 17:40:06 +0100
committerMatúš Kukan <matus.kukan@collabora.com>2013-12-18 07:15:46 +0100
commitb6cebf4a3e2997e6489bba77b358b306f8f435ce (patch)
tree1f8f2a63ce9f71c7002269fb7b879e1f3662d6ed
parent4c539fac018dfd44cd8db52161a8cb930c627da7 (diff)
Allow UNO component libraries to have each implementation in its own function.
Demonstrating on expwrap library. There is hope, this will bring code size savings for mobile platforms, where we don't need every implementation. Change-Id: I3519fb6148fd7a47ed9df092c73779ea6add552f
-rw-r--r--android/experimental/LibreOffice4Android/native-code.cxx2
-rw-r--r--android/experimental/desktop/native-code.cxx2
-rw-r--r--cppuhelper/source/shlib.cxx29
-rw-r--r--ios/experimental/LibreOffice/LibreOffice/lo.mm2
-rw-r--r--ios/shared/ios_sharedlo/cxx/mlo.mm2
-rw-r--r--sax/source/expatwrap/expwrap.component2
-rw-r--r--sax/source/expatwrap/sax_expat.cxx78
7 files changed, 65 insertions, 52 deletions
diff --git a/android/experimental/LibreOffice4Android/native-code.cxx b/android/experimental/LibreOffice4Android/native-code.cxx
index 9e65d8d9bd2a..1c3b5c3112a5 100644
--- a/android/experimental/LibreOffice4Android/native-code.cxx
+++ b/android/experimental/LibreOffice4Android/native-code.cxx
@@ -21,7 +21,6 @@ extern "C"
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 * expwrap_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 );
@@ -85,7 +84,6 @@ lo_get_libmap(void)
{ "libembobj.a", embobj_component_getFactory },
{ "libemboleobj.a", emboleobj_component_getFactory },
{ "libevtattlo.a", evtatt_component_getFactory },
- { "libexpwrap.uno.a", expwrap_component_getFactory },
{ "libfilterconfiglo.a", filterconfig1_component_getFactory },
{ "libfrmlo.a", frm_component_getFactory },
{ "libfsstoragelo.a", fsstorage_component_getFactory },
diff --git a/android/experimental/desktop/native-code.cxx b/android/experimental/desktop/native-code.cxx
index f16eab38637d..15b82f97e149 100644
--- a/android/experimental/desktop/native-code.cxx
+++ b/android/experimental/desktop/native-code.cxx
@@ -22,7 +22,6 @@ extern "C"
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 * expwrap_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 );
@@ -90,7 +89,6 @@ lo_get_libmap(void)
{ "libembobj.a", embobj_component_getFactory },
{ "libemboleobj.a", emboleobj_component_getFactory },
{ "libevtattlo.a", evtatt_component_getFactory },
- { "libexpwraplo.a", expwrap_component_getFactory },
{ "libfilterconfiglo.a", filterconfig1_component_getFactory },
{ "libfrmlo.a", frm_component_getFactory },
{ "libfsstoragelo.a", fsstorage_component_getFactory },
diff --git a/cppuhelper/source/shlib.cxx b/cppuhelper/source/shlib.cxx
index a6a048ff956d..7d30bb437388 100644
--- a/cppuhelper/source/shlib.cxx
+++ b/cppuhelper/source/shlib.cxx
@@ -245,7 +245,6 @@ extern "C"
extern void * configmgr_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * comphelp_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * deployment_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
- extern void * expwrap_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * filterconfig1_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * fwk_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * introspection_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
@@ -263,6 +262,10 @@ extern "C"
extern void * utl_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * vcl_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
extern void * xstor_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
+
+ extern void * com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory( const char * , void * , void * );
+ extern void * com_sun_star_extensions_xml_sax_Writer_component_getFactory( const char * , void * , void * );
+ extern void * com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory( const char * , void * , void * );
}
#endif
@@ -310,13 +313,15 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
aFullPrefix += "_";
}
OUString aGetFactoryName = aFullPrefix + COMPONENT_GETFACTORY;
+ if (rPrefix == "direct")
+ aGetFactoryName = rImplName.replace('.', '_') + "_" + COMPONENT_GETFACTORY;
oslGenericFunction pSym = NULL;
#ifdef DISABLE_DYNLOADING
// First test library names that aren't app-specific.
- static lib_to_component_mapping non_app_specific_map[] = {
+ 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.
@@ -330,7 +335,6 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
{ "libcomphelper.a", comphelp_component_getFactory },
{ "libconfigmgrlo.a", configmgr_component_getFactory },
{ "libdeployment.a", deployment_component_getFactory },
- { "libexpwraplo.a", expwrap_component_getFactory },
{ "libfilterconfiglo.a", filterconfig1_component_getFactory },
{ "libfwklo.a", fwk_component_getFactory },
{ "libi18npoollo.a", i18npool_component_getFactory },
@@ -347,9 +351,26 @@ css::uno::Reference<css::uno::XInterface> loadSharedLibComponentFactory(
{ "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.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 },
+ { NULL, NULL }
+ };
+ lib_to_component_mapping *non_app_specific_map = components_mapping;
+ OString sName;
+ if (rPrefix == "direct")
+ {
+ sName = OUStringToOString(rImplName, RTL_TEXTENCODING_ASCII_US);
+ non_app_specific_map = direct_components_mapping;
+ }
+ else
+ {
+ sName = OUStringToOString(uri, RTL_TEXTENCODING_ASCII_US);
+ }
for (int i = 0; pSym == NULL && non_app_specific_map[i].lib != NULL; ++i)
{
- if ( uri.equalsAscii( non_app_specific_map[i].lib ) )
+ if ( sName == non_app_specific_map[i].lib )
pSym = (oslGenericFunction) non_app_specific_map[i].component_getFactory_function;
}
diff --git a/ios/experimental/LibreOffice/LibreOffice/lo.mm b/ios/experimental/LibreOffice/LibreOffice/lo.mm
index 610eda9d0e76..54e2b424672e 100644
--- a/ios/experimental/LibreOffice/LibreOffice/lo.mm
+++ b/ios/experimental/LibreOffice/LibreOffice/lo.mm
@@ -28,7 +28,6 @@ extern "C" {
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 * expwrap_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 );
@@ -90,7 +89,6 @@ lo_get_libmap(void)
{ "libembobj.a", embobj_component_getFactory },
{ "libemboleobj.a", emboleobj_component_getFactory },
{ "libevtattlo.a", evtatt_component_getFactory },
- { "libexpwraplo.a", expwrap_component_getFactory },
{ "libfilterconfiglo.a", filterconfig1_component_getFactory },
{ "libfrmlo.a", frm_component_getFactory },
{ "libfsstoragelo.a", fsstorage_component_getFactory },
diff --git a/ios/shared/ios_sharedlo/cxx/mlo.mm b/ios/shared/ios_sharedlo/cxx/mlo.mm
index 50ffd44999ad..5b3ef7e4f4a3 100644
--- a/ios/shared/ios_sharedlo/cxx/mlo.mm
+++ b/ios/shared/ios_sharedlo/cxx/mlo.mm
@@ -155,7 +155,7 @@ lo_get_libmap(void)
//MAP_LIB(ucppkg1), //MAP_LIB_LO(vbaswobj), //MAP_LIB_LO(wpftwriter),
//MAP_LIB_LO(wpftdraw), //MAP_LIB_LO(svxcore), //MAP_LIB_LO(protocolhandler),
//MAP_LIB_LO_1(filterconfig), //MAP_LIB_LO(canvasfactory), //MAP_LIB_LO(mtfrenderer),
- MAP_LIB_LO(expwrap), MAP_LIB_LO(writerfilter),
+ MAP_LIB_LO(writerfilter),
MAP_LIB(embobj), MAP_LIB(emboleobj), MAP_LIB_LO(sot),
// ADDED for search
diff --git a/sax/source/expatwrap/expwrap.component b/sax/source/expatwrap/expwrap.component
index c2a6bf0f4e56..9365a6d7d4da 100644
--- a/sax/source/expatwrap/expwrap.component
+++ b/sax/source/expatwrap/expwrap.component
@@ -18,7 +18,7 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="expwrap" xmlns="http://openoffice.org/2010/uno-components">
+ prefix="direct" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.extensions.xml.sax.ParserExpat">
<service name="com.sun.star.xml.sax.Parser"/>
</implementation>
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx
index 8e066e85ee46..214d2625dbc5 100644
--- a/sax/source/expatwrap/sax_expat.cxx
+++ b/sax/source/expatwrap/sax_expat.cxx
@@ -51,8 +51,6 @@ using namespace ::com::sun::star::io;
#include "xml2utf.hxx"
#include <sax/fastparser.hxx>
-#define PARSER_IMPLEMENTATION_NAME "com.sun.star.comp.extensions.xml.sax.FastParser"
-
namespace sax_expatwrap {
// Useful macros for correct String conversion depending on the choosen expat-mode
@@ -1061,54 +1059,54 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis )
}
}
+
+static void * getSingleFactory(
+ void *pServiceManager,
+ const OUString& sImplementation,
+ ComponentInstantiation pCreateFunction,
+ const Sequence< OUString > & rServiceNames)
+{
+ 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 expwrap_component_getFactory(
- const sal_Char * pImplName, void * pServiceManager,
- SAL_UNUSED_PARAMETER void * /*pRegistryKey*/ )
+SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory(
+ const char * , void *pServiceManager, void * )
{
- void * pRet = 0;
-
- if (pServiceManager )
- {
- Reference< XSingleServiceFactory > xRet;
- Reference< XMultiServiceFactory > xSMgr =
- reinterpret_cast< XMultiServiceFactory * > ( pServiceManager );
-
- OUString aImplementationName = OUString::createFromAscii( pImplName );
-
- if ( aImplementationName == IMPLEMENTATION_NAME )
- {
- xRet = createSingleFactory( xSMgr, aImplementationName,
- SaxExpatParser_CreateInstance,
- SaxExpatParser::getSupportedServiceNames_Static() );
- }
- else if ( aImplementationName == SaxWriter_getImplementationName() )
- {
- xRet = createSingleFactory( xSMgr, aImplementationName,
- SaxWriter_CreateInstance,
- SaxWriter_getSupportedServiceNames() );
- }
- else if ( aImplementationName == PARSER_IMPLEMENTATION_NAME)
- {
- xRet = createSingleFactory( xSMgr, aImplementationName,
- FastSaxParser_CreateInstance,
- sax_fastparser::FastSaxParser::getSupportedServiceNames_Static() );
- }
+ return getSingleFactory( pServiceManager,
+ "com.sun.star.comp.extensions.xml.sax.ParserExpat",
+ SaxExpatParser_CreateInstance,
+ SaxExpatParser::getSupportedServiceNames_Static() );
+}
- if (xRet.is())
- {
- xRet->acquire();
- pRet = xRet.get();
- }
- }
- return pRet;
+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() );
+}
}