diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-12-19 08:48:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-19 08:48:56 +0100 |
commit | ae3a0c8da50b36db395984637f5ad74d3b4887bc (patch) | |
tree | c4936b9fba1f24d412d41474ebef44a5f094dbc8 /stoc/source/loader | |
parent | 80d977b896904a0261d32857469c1b3e7516ca1e (diff) |
Add .component <implementation constructor="..." feature
...to directly call constructor functions of ComponentContext-based C++
implementations of (non-single-instance) UNO services. The case where these
calls would need to be bridged across different environments (e.g., from gcc3
to gcc3:affine) is not yet implemented.
bootstrap.component and expwrap.component are adapted accordingly as a proof-of-
concept (which had previously been adapted to use the prefix="direct" feature,
which may become unnecessary again in the end, depending on how to handle
single-instance services/singletons). More to follow.
Change-Id: I18682d75bcd29d3d427e31331b4ce8161dbb846d
Diffstat (limited to 'stoc/source/loader')
-rw-r--r-- | stoc/source/loader/dllcomponentloader.cxx | 51 |
1 files changed, 12 insertions, 39 deletions
diff --git a/stoc/source/loader/dllcomponentloader.cxx b/stoc/source/loader/dllcomponentloader.cxx index 402ed4a110af..d4ab87f1e05e 100644 --- a/stoc/source/loader/dllcomponentloader.cxx +++ b/stoc/source/loader/dllcomponentloader.cxx @@ -29,7 +29,6 @@ #include <uno/mapping.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/weak.hxx> -#include <cppuhelper/factory.hxx> #include <cppuhelper/shlib.hxx> #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implementationentry.hxx> @@ -42,10 +41,6 @@ #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/registry/XRegistryKey.hpp> -#define SERVICENAME "com.sun.star.loader.SharedLibrary" -#define IMPLNAME "com.sun.star.comp.stoc.DLLComponentLoader" - - using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::loader; @@ -56,13 +51,6 @@ using namespace osl; namespace { -static Sequence< OUString > DllComponentLoader_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = OUString(SERVICENAME); - return seqNames; -} - class DllComponentLoader : public WeakImplHelper3< XImplementationLoader, XInitialization, @@ -101,7 +89,7 @@ DllComponentLoader::~DllComponentLoader() {} OUString SAL_CALL DllComponentLoader::getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) { - return OUString(IMPLNAME); + return OUString("com.sun.star.comp.stoc.DLLComponentLoader"); } sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceName ) @@ -113,7 +101,9 @@ sal_Bool SAL_CALL DllComponentLoader::supportsService( const OUString& ServiceNa Sequence<OUString> SAL_CALL DllComponentLoader::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) { - return DllComponentLoader_getSupportedServiceNames(); + Sequence< OUString > seqNames(1); + seqNames[0] = "com.sun.star.loader.SharedLibrary"; + return seqNames; } //************************************************************************* @@ -174,32 +164,15 @@ sal_Bool SAL_CALL DllComponentLoader::writeRegistryInfo( } -static Reference<XInterface> DllComponentLoader_CreateInstance( - const Reference<XComponentContext> & xCtx ) throw(Exception) -{ - Reference<XInterface> xRet; - - XImplementationLoader *pXLoader = (XImplementationLoader *)new DllComponentLoader(xCtx); - - if (pXLoader) - { - xRet = Reference<XInterface>::query(pXLoader); - } - - return xRet; -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_DLLComponentLoader_component_getFactory( - const char * , void * , void * ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_DLLComponentLoader( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - DllComponentLoader_CreateInstance, - IMPLNAME, - DllComponentLoader_getSupportedServiceNames() ); - xFactory->acquire(); - return xFactory.get(); + assert(arguments != 0 && arguments->nElements == 0); (void) arguments; + css::uno::Reference<css::uno::XInterface> x( + static_cast<cppu::OWeakObject *>(new DllComponentLoader(context))); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |