diff options
author | Henry Castro <hcastro@collabora.com> | 2015-09-07 17:17:22 -0400 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2016-06-12 22:42:57 +0200 |
commit | 074a0b78b14c69f713e6d1840ea1e62c4ce38906 (patch) | |
tree | 4a659250da07bde9ac2f4fce30ff5cb7a2704601 /cppuhelper | |
parent | bcfef8da178cbb4bd1015ca34e4a25612090b4d6 (diff) |
cppuhelper: add preInitBootstrap symbol
In the preinit stage, the preInitBootstrap is called to load
implementations for each service registered by the service manager.
All service requests are: initial Component Context and the process
service factory is set.
However, some services require that VCL is properly initialized.
(cherry picked from commit 78df8373b6442ee3d3b09101988817cf621c189b)
Change-Id: Ib116e3da172b860f2df4d672f6181b5de0b7e6b2
Diffstat (limited to 'cppuhelper')
-rw-r--r-- | cppuhelper/source/defaultbootstrap.cxx | 33 | ||||
-rw-r--r-- | cppuhelper/source/gcc3.map | 2 |
2 files changed, 19 insertions, 16 deletions
diff --git a/cppuhelper/source/defaultbootstrap.cxx b/cppuhelper/source/defaultbootstrap.cxx index 6720434d3fb0..5a46ed4363ab 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 3d7a5c66cdf0..6344bc2e87be 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 |