From 25d114eec4d451acdda1ddff4c8ed9d47ba6275f Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 20 Mar 2012 23:18:55 +0200 Subject: Initial experiments with static linking of (some) components / services Start with the first service needed when running sc's filters_test: the UniversalContentBroker. It might not be typical as ucb uses the deprecated XSingleServiceFactory. This commit is not at all a complete solution, far from it, just an initial hack. Naturally once I come up with some generic enough way to do the static linking the necessary macros etc will be added to some general header. The macro XSERVICEINFO_IMPL_1 (local to ucbhelper and ucb) is amended so that it in the disable-dynamic-linking case also emits a function whose assembler name equal contains the service name. This function returns the XSingleServiceFactory for the service. Where the service is instantiated we link directly to that function. But probably this will be reworked a couple of times... Maybe it would be better to simply have the service name specific entry point be a pointer to the component's component_getFactory() function? Those all have the same prototype. --- ios/qa/sc/Makefile | 2 +- ucb/source/cacher/cachedcontentresultset.cxx | 6 ++-- ucb/source/cacher/cachedcontentresultsetstub.cxx | 6 ++-- ucb/source/cacher/cacheddynamicresultset.cxx | 6 ++-- ucb/source/cacher/cacheddynamicresultsetstub.cxx | 6 ++-- ucb/source/core/provprox.cxx | 6 ++-- ucb/source/core/ucb.cxx | 6 ++-- ucb/source/core/ucbprops.cxx | 6 ++-- ucb/source/core/ucbstore.cxx | 6 ++-- ucb/source/sorter/sortdynres.cxx | 6 ++-- ucb/source/ucp/cmis/cmis_provider.cxx | 6 ++-- ucb/source/ucp/ftp/ftpcontent.cxx | 9 +++--- ucb/source/ucp/ftp/ftpcontentprovider.cxx | 4 +-- ucb/source/ucp/hierarchy/hierarchyprovider.cxx | 6 ++-- ucb/source/ucp/package/pkgprovider.cxx | 6 ++-- ucb/source/ucp/tdoc/tdoc_provider.cxx | 6 ++-- ucb/source/ucp/webdav/webdavprovider.cxx | 6 ++-- ucbhelper/inc/ucbhelper/macros.hxx | 39 ++++++++++++++++++------ ucbhelper/source/client/contentbroker.cxx | 34 ++++++++++++++++----- 19 files changed, 93 insertions(+), 79 deletions(-) diff --git a/ios/qa/sc/Makefile b/ios/qa/sc/Makefile index e8f1901a3bec..dacdf0c0f1e2 100644 --- a/ios/qa/sc/Makefile +++ b/ios/qa/sc/Makefile @@ -30,7 +30,7 @@ SRCS = filters-test.m CFLAGS = $(SOLARINC) -LIBS = -Wl,$(OUTDIR)/bin/cppunit/cppunittester.a -Wl,$(WORKDIR)/LinkTarget/CppunitTest/libtest_sc_filters_test.a -Wl,$(OUTDIR)/lib/bootstrap.uno.a -Wl,$(OUTDIR)/lib/unoexceptionprotector.a $(SOLARLIB) -lavmedialo -lbasegfxlo -lcanvastoolslo -lcomphelpgcc3 -lcppcanvaslo -lcppunit -ldrawinglayerlo -leditenglo -lforlo -lforuilo -lfwelo -lfwilo -lfwklo -lgcc3_uno -li18nisolang1gcc3 -li18npaperlo -li18nutilgcc3 -licuuc -ljpeg -ljvmfwk -llnglo -lreg -lsal_textenc -lsalcpprt -lsaxlo -lsclo -lsfxlo -lstore -lsvllo -lsvtlo -lsvxlo -lsvxcorelo -lsotlo -ltest -ltklo -ltllo -lucbhelper4gcc3 -luno_cppuhelpergcc3 -luno_cppu -luno_sal -luno_salhelpergcc3 -lunotest -lutllo -lvcllo -lxml2 -lxmlreader -lxolo -lz $(addprefix -framework , $(gb_Library__FRAMEWORKS)) -liconv -lobjc +LIBS = -Wl,$(OUTDIR)/bin/cppunit/cppunittester.a -Wl,$(WORKDIR)/LinkTarget/CppunitTest/libtest_sc_filters_test.a -Wl,$(OUTDIR)/lib/bootstrap.uno.a -Wl,$(OUTDIR)/lib/unoexceptionprotector.a $(SOLARLIB) -lavmedialo -lbasegfxlo -lcanvastoolslo -lcomphelpgcc3 -lcppcanvaslo -lcppunit -ldrawinglayerlo -leditenglo -lforlo -lforuilo -lfwelo -lfwilo -lfwklo -lgcc3_uno -li18nisolang1gcc3 -li18npaperlo -li18nutilgcc3 -licuuc -ljpeg -ljvmfwk -llnglo -lreg -lsal_textenc -lsalcpprt -lsaxlo -lsclo -lsfxlo -lstore -lsvllo -lsvtlo -lsvxlo -lsvxcorelo -lsotlo -ltest -ltklo -ltllo -lucb1 -lucbhelper4gcc3 -luno_cppuhelpergcc3 -luno_cppu -luno_sal -luno_salhelpergcc3 -lunotest -lutllo -lvcllo -lxml2 -lxmlreader -lxolo -lz $(addprefix -framework , $(gb_Library__FRAMEWORKS)) -liconv -lobjc all: $(APPDIR)/$(APP) stuff diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index 4c66b382dbe0..8c8654aa0c59 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -2200,10 +2200,8 @@ XTYPEPROVIDER_IMPL_3( CachedContentResultSetFactory, //-------------------------------------------------------------------------- XSERVICEINFO_IMPL_1( CachedContentResultSetFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.CachedContentResultSetFactory" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - CACHED_CONTENT_RESULTSET_FACTORY_NAME )) ); + "com.sun.star.comp.ucb.CachedContentResultSetFactory", + CACHED_CONTENT_RESULTSET_FACTORY_NAME ); //-------------------------------------------------------------------------- // Service factory implementation. diff --git a/ucb/source/cacher/cachedcontentresultsetstub.cxx b/ucb/source/cacher/cachedcontentresultsetstub.cxx index b32a8b6b11ef..0ccca050baf6 100644 --- a/ucb/source/cacher/cachedcontentresultsetstub.cxx +++ b/ucb/source/cacher/cachedcontentresultsetstub.cxx @@ -531,10 +531,8 @@ XTYPEPROVIDER_IMPL_3( CachedContentResultSetStubFactory, //-------------------------------------------------------------------------- XSERVICEINFO_IMPL_1( CachedContentResultSetStubFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.CachedContentResultSetStubFactory" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - CACHED_CRS_STUB_FACTORY_NAME )) ); + "com.sun.star.comp.ucb.CachedContentResultSetStubFactory", + CACHED_CRS_STUB_FACTORY_NAME ); //-------------------------------------------------------------------------- // Service factory implementation. diff --git a/ucb/source/cacher/cacheddynamicresultset.cxx b/ucb/source/cacher/cacheddynamicresultset.cxx index 506c96f2e6dc..7bc23a76fbe2 100644 --- a/ucb/source/cacher/cacheddynamicresultset.cxx +++ b/ucb/source/cacher/cacheddynamicresultset.cxx @@ -176,10 +176,8 @@ XTYPEPROVIDER_IMPL_3( CachedDynamicResultSetFactory, //-------------------------------------------------------------------------- XSERVICEINFO_IMPL_1( CachedDynamicResultSetFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.CachedDynamicResultSetFactory" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - CACHED_DRS_FACTORY_NAME )) ); + "com.sun.star.comp.ucb.CachedDynamicResultSetFactory", + CACHED_DRS_FACTORY_NAME ); //-------------------------------------------------------------------------- // Service factory implementation. diff --git a/ucb/source/cacher/cacheddynamicresultsetstub.cxx b/ucb/source/cacher/cacheddynamicresultsetstub.cxx index 4bc18400f98c..4dc9469c5199 100644 --- a/ucb/source/cacher/cacheddynamicresultsetstub.cxx +++ b/ucb/source/cacher/cacheddynamicresultsetstub.cxx @@ -166,10 +166,8 @@ XTYPEPROVIDER_IMPL_3( CachedDynamicResultSetStubFactory, //-------------------------------------------------------------------------- XSERVICEINFO_IMPL_1( CachedDynamicResultSetStubFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.CachedDynamicResultSetStubFactory" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - CACHED_DRS_STUB_FACTORY_NAME )) ); + "com.sun.star.comp.ucb.CachedDynamicResultSetStubFactory", + CACHED_DRS_STUB_FACTORY_NAME ); //-------------------------------------------------------------------------- // Service factory implementation. diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx index c73fe311e54b..1ba4384354fe 100644 --- a/ucb/source/core/provprox.cxx +++ b/ucb/source/core/provprox.cxx @@ -87,10 +87,8 @@ XTYPEPROVIDER_IMPL_3( UcbContentProviderProxyFactory, //========================================================================= XSERVICEINFO_IMPL_1( UcbContentProviderProxyFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.UcbContentProviderProxyFactory" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - PROVIDER_FACTORY_SERVICE_NAME )) ); + "com.sun.star.comp.ucb.UcbContentProviderProxyFactory", + PROVIDER_FACTORY_SERVICE_NAME ); //========================================================================= // diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index cbe7b2ba7669..e65322c660b7 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -347,10 +347,8 @@ void SAL_CALL UniversalContentBroker::removeEventListener( //========================================================================= XSERVICEINFO_IMPL_1( UniversalContentBroker, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.UniversalContentBroker" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - UCB_SERVICE_NAME )) ); + "com.sun.star.comp.ucb.UniversalContentBroker", + UCB_SERVICE_NAME ); //========================================================================= // diff --git a/ucb/source/core/ucbprops.cxx b/ucb/source/core/ucbprops.cxx index c778bf91b88a..0f4125974001 100644 --- a/ucb/source/core/ucbprops.cxx +++ b/ucb/source/core/ucbprops.cxx @@ -357,10 +357,8 @@ XTYPEPROVIDER_IMPL_3( UcbPropertiesManager, //========================================================================= XSERVICEINFO_IMPL_1( UcbPropertiesManager, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.UcbPropertiesManager" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - PROPERTIES_MANAGER_SERVICE_NAME )) ); + "com.sun.star.comp.ucb.UcbPropertiesManager", + PROPERTIES_MANAGER_SERVICE_NAME ); //========================================================================= // diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index 38b498095507..5b7e26095822 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -244,10 +244,8 @@ XTYPEPROVIDER_IMPL_4( UcbStore, //========================================================================= XSERVICEINFO_IMPL_1( UcbStore, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.UcbStore" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - STORE_SERVICE_NAME )) ); + "com.sun.star.comp.ucb.UcbStore", + STORE_SERVICE_NAME ); //========================================================================= // diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx index 1b6c57dea78e..3620688ae16f 100644 --- a/ucb/source/sorter/sortdynres.cxx +++ b/ucb/source/sorter/sortdynres.cxx @@ -511,10 +511,8 @@ XTYPEPROVIDER_IMPL_3( SortedDynamicResultSetFactory, //-------------------------------------------------------------------------- XSERVICEINFO_IMPL_1( SortedDynamicResultSetFactory, - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.SortedDynamicResultSetFactory" )), - OUString(RTL_CONSTASCII_USTRINGPARAM( - DYNAMIC_RESULTSET_FACTORY_NAME )) ); + "com.sun.star.comp.ucb.SortedDynamicResultSetFactory", + DYNAMIC_RESULTSET_FACTORY_NAME ); //-------------------------------------------------------------------------- // Service factory implementation. diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx index f733cf0ea22a..0e68e0473a79 100644 --- a/ucb/source/ucp/cmis/cmis_provider.cxx +++ b/ucb/source/ucp/cmis/cmis_provider.cxx @@ -94,10 +94,8 @@ XTYPEPROVIDER_IMPL_3( ContentProvider, com::sun::star::ucb::XContentProvider ); XSERVICEINFO_IMPL_1( ContentProvider, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.CmisContentProvider" )), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ucb.CmisContentProvider" )) ); + "com.sun.star.comp.CmisContentProvider", + "com.sun.star.ucb.CmisContentProvider" ); ONE_INSTANCE_SERVICE_FACTORY_IMPL( ContentProvider ); diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index 02da7ac7b859..67f118facc83 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -174,11 +174,12 @@ XTYPEPROVIDER_IMPL_6( FTPContent, #undef XSERVICEINFO_CREATE_INSTANCE_IMPL #define XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) +#undef STATICALLY_LINKED_SERVICE +#define STATICALLY_LINKED_SERVICE( Class, ImplName, Service, Num ) + XSERVICEINFO_IMPL_1( FTPContent, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.FTPContent")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ucb.FTPContent"))); + "com.sun.star.comp.FTPContent", + "com.sun.star.ucb.FTPContent" ); diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx index 427527937a52..5b50a41bfd7a 100644 --- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx +++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx @@ -103,8 +103,8 @@ XTYPEPROVIDER_IMPL_3(FTPContentProvider, XSERVICEINFO_IMPL_1( FTPContentProvider, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.FTPContentProvider")), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(FTP_CONTENT_PROVIDER_SERVICE_NAME))); + "com.sun.star.comp.FTPContentProvider", + FTP_CONTENT_PROVIDER_SERVICE_NAME); //========================================================================= // diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx index c5bf7c585968..f3a339e1e6f3 100644 --- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx +++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx @@ -100,10 +100,8 @@ XTYPEPROVIDER_IMPL_4( HierarchyContentProvider, //========================================================================= XSERVICEINFO_IMPL_1( HierarchyContentProvider, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.HierarchyContentProvider" )), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - HIERARCHY_CONTENT_PROVIDER_SERVICE_NAME )) ); + "com.sun.star.comp.ucb.HierarchyContentProvider", + HIERARCHY_CONTENT_PROVIDER_SERVICE_NAME ); //========================================================================= // diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx index fbaa9fdddb52..d9b6efde5523 100644 --- a/ucb/source/ucp/package/pkgprovider.cxx +++ b/ucb/source/ucp/package/pkgprovider.cxx @@ -181,10 +181,8 @@ XTYPEPROVIDER_IMPL_3( ContentProvider, //========================================================================= XSERVICEINFO_IMPL_1( ContentProvider, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.PackageContentProvider" )), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - PACKAGE_CONTENT_PROVIDER_SERVICE_NAME )) ); + "com.sun.star.comp.ucb.PackageContentProvider", + PACKAGE_CONTENT_PROVIDER_SERVICE_NAME ); //========================================================================= // diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx index be5a4f1920fb..fafea334e33b 100644 --- a/ucb/source/ucp/tdoc/tdoc_provider.cxx +++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx @@ -105,10 +105,8 @@ XTYPEPROVIDER_IMPL_4( ContentProvider, XSERVICEINFO_IMPL_1( ContentProvider, - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.ucb.TransientDocumentsContentProvider" ) ), - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - TDOC_CONTENT_PROVIDER_SERVICE_NAME ) ) ); + "com.sun.star.comp.ucb.TransientDocumentsContentProvider", + TDOC_CONTENT_PROVIDER_SERVICE_NAME ); //========================================================================= // diff --git a/ucb/source/ucp/webdav/webdavprovider.cxx b/ucb/source/ucp/webdav/webdavprovider.cxx index ba24d632c276..8dbca76ebb87 100644 --- a/ucb/source/ucp/webdav/webdavprovider.cxx +++ b/ucb/source/ucp/webdav/webdavprovider.cxx @@ -93,10 +93,8 @@ XTYPEPROVIDER_IMPL_3( ContentProvider, //========================================================================= XSERVICEINFO_IMPL_1( ContentProvider, - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.comp.WebDAVContentProvider" )), - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( - WEBDAV_CONTENT_PROVIDER_SERVICE_NAME )) ); + "com.sun.star.comp.WebDAVContentProvider", + WEBDAV_CONTENT_PROVIDER_SERVICE_NAME ); //========================================================================= // diff --git a/ucbhelper/inc/ucbhelper/macros.hxx b/ucbhelper/inc/ucbhelper/macros.hxx index 302be2132f05..445de8a05e26 100644 --- a/ucbhelper/inc/ucbhelper/macros.hxx +++ b/ucbhelper/inc/ucbhelper/macros.hxx @@ -732,19 +732,40 @@ XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \ com::sun::star::uno::Sequence< rtl::OUString > \ Class::getSupportedServiceNames_Static() -// 1 service name -#define XSERVICEINFO_IMPL_1( Class, ImplName, Service1 ) \ -XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \ -XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \ +#ifdef DISABLE_DYNLOADING + +#define STATICALLY_LINKED_SERVICE( Class, ImplName, Service, Num ) \ +extern com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > service##Num( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rSMgr ) \ + __asm("SSF:" Service); \ \ -com::sun::star::uno::Sequence< rtl::OUString > \ -Class::getSupportedServiceNames_Static() \ +com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > service##Num( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rSMgr ) \ { \ - com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \ - aSNS.getArray()[ 0 ] = Service1; \ - return aSNS; \ + com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory( Class::createServiceFactory( rSMgr ) ); \ + xFactory->acquire(); \ + return xFactory; \ } +#else + +#define STATICALLY_LINKED_SERVICE( Class, ImplName, Service, Num ) // empty + +#endif + +// 1 service name +#define XSERVICEINFO_IMPL_1( Class, ImplName, Service1 ) \ +XSERVICEINFO_COMMOM_IMPL( Class, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ImplName )) ) \ +XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \ + \ +com::sun::star::uno::Sequence< rtl::OUString > \ +Class::getSupportedServiceNames_Static() \ +{ \ + com::sun::star::uno::Sequence< rtl::OUString > aSNS( 1 ); \ + aSNS.getArray()[ 0 ] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( Service1 )); \ + return aSNS; \ +} \ + \ +STATICALLY_LINKED_SERVICE( Class, ImplName, Service1, 1 ) + #endif /* !_UCBHELPER_MACROS_HXX */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx index eb18dc75edb6..0d865478bd8a 100644 --- a/ucbhelper/source/client/contentbroker.cxx +++ b/ucbhelper/source/client/contentbroker.cxx @@ -34,6 +34,7 @@ *************************************************************************/ #include #include +#include #include #include #include @@ -42,6 +43,30 @@ #include #include +#ifdef DISABLE_DYNLOADING + +#define MSF_CREATEINSTANCE(Msf, Service) \ +({ \ + extern com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > service( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rSMgr ) __asm("SSF:" Service); \ + com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory( service( Msf ) ); \ + xFactory->createInstance(); \ +}) + +#define MSF_CREATEINSTANCE_WITHARGUMENTS(Msf, Service, Args) \ +({ \ + extern com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > service( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rSMgr ) __asm("SSF:" Service); \ + com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory( service( Msf ) ); \ + xFactory->createInstanceWithArguments( Args ); \ +}) + +#else + +#define MSF_CREATEINSTANCE(Msf, Service) Msf->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( Service )) ) + +#define MSF_CREATEINSTANCE_WITHARGUMENTS(Msf, Service, Args) Msf->createInstanceWithArguments( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( Service )), Args ) + +#endif + using namespace com::sun::star::lang; using namespace com::sun::star::ucb; using namespace com::sun::star::uno; @@ -248,9 +273,7 @@ bool ContentBroker_Impl::initialize() { try { - xIfc = m_xSMgr->createInstance( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ucb.UniversalContentBroker" )) ); + xIfc = MSF_CREATEINSTANCE( m_xSMgr, "com.sun.star.ucb.UniversalContentBroker" ); } catch ( Exception const & ) { @@ -282,10 +305,7 @@ bool ContentBroker_Impl::initialize() { try { - xIfc = m_xSMgr->createInstanceWithArguments( - OUString(RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.ucb.UniversalContentBroker" )), - m_aArguments ); + xIfc = MSF_CREATEINSTANCE_WITHARGUMENTS( m_xSMgr, "com.sun.star.ucb.UniversalContentBroker", m_aArguments ); } catch ( Exception const & ) { -- cgit