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/implementationregistration | |
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/implementationregistration')
-rw-r--r-- | stoc/source/implementationregistration/implreg.cxx | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx index 4e8e6970fff5..3490320f9aa8 100644 --- a/stoc/source/implementationregistration/implreg.cxx +++ b/stoc/source/implementationregistration/implreg.cxx @@ -22,7 +22,6 @@ #include <list> #include <cppuhelper/queryinterface.hxx> -#include <cppuhelper/factory.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/implbase3.hxx> #include <cppuhelper/implementationentry.hxx> @@ -63,9 +62,6 @@ using namespace com::sun::star::registry; using namespace cppu; using namespace osl; -#define IMPLNAME "com.sun.star.comp.stoc.ImplementationRegistration" -#define SERVICENAME "com.sun.star.registry.ImplementationRegistration" - namespace { struct StringPool @@ -113,13 +109,6 @@ const StringPool &spool() return *pPool; } -static Sequence< OUString > ImplementationRegistration_getSupportedServiceNames() -{ - Sequence< OUString > seqNames(1); - seqNames.getArray()[0] = SERVICENAME; - return seqNames; -} - //************************************************************************* // static deleteAllLinkReferences() // @@ -1309,7 +1298,7 @@ ImplementationRegistration::~ImplementationRegistration() {} // XServiceInfo OUString ImplementationRegistration::getImplementationName() throw(RuntimeException) { - return OUString(IMPLNAME); + return OUString("com.sun.star.comp.stoc.ImplementationRegistration"); } // XServiceInfo @@ -1321,7 +1310,9 @@ sal_Bool ImplementationRegistration::supportsService(const OUString& ServiceName // XServiceInfo Sequence< OUString > ImplementationRegistration::getSupportedServiceNames(void) throw(RuntimeException) { - return ImplementationRegistration_getSupportedServiceNames(); + Sequence< OUString > seqNames(1); + seqNames[0] = "com.sun.star.registry.ImplementationRegistration"; + return seqNames; } Reference< XSimpleRegistry > ImplementationRegistration::getRegistryFromServiceManager() @@ -1825,23 +1816,16 @@ Reference< XSimpleRegistry > ImplementationRegistration::createTemporarySimpleRe } -static Reference<XInterface> ImplementationRegistration_CreateInstance( - const Reference<XComponentContext> & xCtx ) // throw(Exception) -{ - return (XImplementationRegistration *)new ImplementationRegistration(xCtx); -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL -com_sun_star_comp_stoc_ImplementationRegistration_component_getFactory( - const char * , void * , void * ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL +com_sun_star_comp_stoc_ImplementationRegistration( + css::uno::XComponentContext * context, uno_Sequence * arguments) { - Reference< css::lang::XSingleComponentFactory > xFactory; - xFactory = createSingleComponentFactory( - ImplementationRegistration_CreateInstance, - IMPLNAME, - ImplementationRegistration_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 ImplementationRegistration(context))); + x->acquire(); + return x.get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |