cppuhelper/source/defaultbootstrap.cxx | 33 ++++++++++++++++++--------------- cppuhelper/source/gcc3.map | 2 +- include/cppuhelper/bootstrap.hxx | 11 +++++++++++ 3 files changed, 30 insertions(+), 16 deletions(-)
New commits: commit 991594a88f2225bf518604728f781a2c73dcf273 Author: Henry Castro <hcas...@collabora.com> Date: Mon Sep 7 17:17:22 2015 -0400 cppuhelper: add preInitBootstrap parameter ... component context. Change-Id: Ib116e3da172b860f2df4d672f6181b5de0b7e6b2 diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx index b135b2c..602fdfb 100644 --- a/cppuhelper/source/defaultbootstrap.cxx +++ b/cppuhelper/source/defaultbootstrap.cxx @@ -42,19 +42,6 @@ rtl::OUString getBootstrapVariable( } return v; } - -void default_preInitBootstrap(rtl::OUString const & aUri) -{ - rtl::Bootstrap bsUri(aUri); - if (bsUri.getHandle() == 0) - throw css::uno::DeploymentException("Cannot open uno ini " + aUri); - - // create the service manager - rtl::Reference< cppuhelper::ServiceManager > aManager(new cppuhelper::ServiceManager); - // read rdb files - aManager->init(getBootstrapVariable(bsUri, "UNO_SERVICES")); - aManager->loadImplementations(); -} } css::uno::Reference< css::uno::XComponentContext > @@ -120,8 +107,24 @@ cppu::defaultBootstrap_InitialComponentContext() } void -cppu::preInitBootstrap() +cppu::preInitBootstrap(css::uno::Reference< css::uno::XComponentContext > const & xContext) { - default_preInitBootstrap(getUnoIniUri()); + if (!xContext.is()) + throw css::uno::DeploymentException("preInit: XComponentContext is not created"); + + css::uno::Reference< css::uno::XInterface > xService; + xContext->getValueByName("/singletons/com.sun.star.lang.theServiceManager") >>= xService; + if (!xService.is()) + throw css::uno::DeploymentException("preInit: XMultiComponentFactory is not created"); + + rtl::Reference<cppuhelper::ServiceManager> aService(reinterpret_cast<cppuhelper::ServiceManager*>(xService.get())); + + // pre-requisites: + // In order to load implementations and invoke + // component factory it is required: + // 1) defaultBootstrap_InitialComponentContext() + // 2) comphelper::setProcessServiceFactory(xSFactory); + // 3) InitVCL() + aService->loadImplementations(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index 3d7a5c6..6344bc2 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -423,7 +423,7 @@ global: # enableChangeListenerNotification _ZN4cppu19OPropertySetHelper232enableChangeListenerNotificationEh; _ZThn*_N4cppu19OPropertySetHelper232enableChangeListenerNotificationEh; - _ZN4cppu16preInitBootstrapEv; + _ZN4cppu16preInitBootstrapERKN3com3sun4star3uno9ReferenceINS3_17XComponentContextEEE; } UDK_3.7; LIBO_UDK_3.9 { # LibO 3.7 diff --git a/include/cppuhelper/bootstrap.hxx b/include/cppuhelper/bootstrap.hxx index debddcf..1530f0a 100644 --- a/include/cppuhelper/bootstrap.hxx +++ b/include/cppuhelper/bootstrap.hxx @@ -57,6 +57,16 @@ CPPUHELPER_DLLPUBLIC sal_Bool SAL_CALL installTypeDescriptionManager( CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext(); +/** preload component shared library with service manager upon + information from bootstrap variables. + + This function tries to find its parameters via these bootstrap variables: + + - UNO_SERVICES -- a space separated list of file urls of service rdbs + +*/ +CPPUHELPER_DLLPUBLIC void SAL_CALL +preInitBootstrap(css::uno::Reference< css::uno::XComponentContext > const & xContext); /** Bootstraps an initial component context with service manager upon information from an ini file. @@ -72,6 +82,7 @@ defaultBootstrap_InitialComponentContext(); @param iniFile ini filename to get bootstrap variables @return component context */ + CPPUHELPER_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > SAL_CALL defaultBootstrap_InitialComponentContext(const ::rtl::OUString & iniFile); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits