summaryrefslogtreecommitdiff
path: root/stoc/source/simpleregistry/simpleregistry.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-12-19 08:48:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-12-19 08:48:56 +0100
commitae3a0c8da50b36db395984637f5ad74d3b4887bc (patch)
treec4936b9fba1f24d412d41474ebef44a5f094dbc8 /stoc/source/simpleregistry/simpleregistry.cxx
parent80d977b896904a0261d32857469c1b3e7516ca1e (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/simpleregistry/simpleregistry.cxx')
-rw-r--r--stoc/source/simpleregistry/simpleregistry.cxx42
1 files changed, 16 insertions, 26 deletions
diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx
index 80e30daeab0b..d1a761b46f63 100644
--- a/stoc/source/simpleregistry/simpleregistry.cxx
+++ b/stoc/source/simpleregistry/simpleregistry.cxx
@@ -34,9 +34,9 @@
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/uno/Sequence.hxx"
-#include <cppuhelper/factory.hxx>
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase2.hxx"
+#include "cppuhelper/supportsservice.hxx"
#include "cppuhelper/weak.hxx"
#include "osl/mutex.hxx"
#include "registry/registry.hxx"
@@ -52,12 +52,6 @@
namespace {
-static css::uno::Sequence< OUString > SimpleRegistry_getSupportedServiceNames() {
- css::uno::Sequence< OUString > names(1);
- names[0] = "com.sun.star.registry.SimpleRegistry";
- return names;
-}
-
class SimpleRegistry:
public cppu::WeakImplHelper2<
css::registry::XSimpleRegistry, css::lang::XServiceInfo >
@@ -105,11 +99,15 @@ private:
virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
throw (css::uno::RuntimeException)
- { return ServiceName == getSupportedServiceNames()[0]; }
+ { return cppu::supportsService(this, ServiceName); }
virtual css::uno::Sequence< OUString > SAL_CALL
getSupportedServiceNames() throw (css::uno::RuntimeException)
- { return SimpleRegistry_getSupportedServiceNames(); }
+ {
+ css::uno::Sequence< OUString > names(1);
+ names[0] = "com.sun.star.registry.SimpleRegistry";
+ return names;
+ }
Registry registry_;
};
@@ -1125,24 +1123,16 @@ void SimpleRegistry::mergeKey(
}
-static css::uno::Reference< css::uno::XInterface > SimpleRegistry_CreateInstance(
- SAL_UNUSED_PARAMETER css::uno::Reference< css::uno::XComponentContext >
- const &)
-{
- return static_cast< cppu::OWeakObject * >(new SimpleRegistry);
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL
-com_sun_star_comp_stoc_SimpleRegistry_component_getFactory(
- const char * , void * , void * )
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
+com_sun_star_comp_stoc_SimpleRegistry(
+ SAL_UNUSED_PARAMETER css::uno::XComponentContext *,
+ uno_Sequence * arguments)
{
- css::uno::Reference< css::lang::XSingleComponentFactory > xFactory;
- xFactory = cppu::createSingleComponentFactory(
- SimpleRegistry_CreateInstance,
- "com.sun.star.comp.stoc.SimpleRegistry",
- SimpleRegistry_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 SimpleRegistry));
+ x->acquire();
+ return x.get();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */