binaryurp: create instances with uno constructors

See tdf#74608 for motivation

Change-Id: Ide39715f83b0183f560e16fa69fcb3112496936d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97933
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
diff --git a/binaryurp/source/binaryurp.component b/binaryurp/source/binaryurp.component
index 1eff0c2..e2581c7 100644
--- a/binaryurp/source/binaryurp.component
+++ b/binaryurp/source/binaryurp.component
@@ -18,8 +18,9 @@
 -->

<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
    prefix="binaryurp" xmlns="http://openoffice.org/2010/uno-components">
  <implementation name="com.sun.star.comp.bridge.BridgeFactory">
    xmlns="http://openoffice.org/2010/uno-components">
  <implementation name="com.sun.star.comp.bridge.BridgeFactory"
        constructor="com_sun_star_comp_bridge_BridgeFactory_get_implementation">
    <service name="com.sun.star.bridge.BridgeFactory"/>
  </implementation>
</component>
diff --git a/binaryurp/source/bridgefactory.cxx b/binaryurp/source/bridgefactory.cxx
index ff8eff8..fc1f8b0 100644
--- a/binaryurp/source/bridgefactory.cxx
+++ b/binaryurp/source/bridgefactory.cxx
@@ -43,21 +43,6 @@

namespace binaryurp {

css::uno::Reference< css::uno::XInterface > BridgeFactory::static_create(
    css::uno::Reference< css::uno::XComponentContext > const & /*xContext*/)
{
    return static_cast< cppu::OWeakObject * >(new BridgeFactory);
}

OUString BridgeFactory::static_getImplementationName() {
    return "com.sun.star.comp.bridge.BridgeFactory";
}

css::uno::Sequence< OUString >
BridgeFactory::static_getSupportedServiceNames() {
    return css::uno::Sequence<OUString>{ "com.sun.star.bridge.BridgeFactory" };
}

void BridgeFactory::removeBridge(
    css::uno::Reference< css::bridge::XBridge > const & bridge)
{
@@ -85,7 +70,7 @@ BridgeFactory::~BridgeFactory() {}

OUString BridgeFactory::getImplementationName()
{
    return static_getImplementationName();
    return "com.sun.star.comp.bridge.BridgeFactory";
}

sal_Bool BridgeFactory::supportsService(OUString const & ServiceName)
@@ -95,7 +80,7 @@ sal_Bool BridgeFactory::supportsService(OUString const & ServiceName)

css::uno::Sequence< OUString > BridgeFactory::getSupportedServiceNames()
{
    return static_getSupportedServiceNames();
    return { "com.sun.star.bridge.BridgeFactory" };
}

css::uno::Reference< css::bridge::XBridge > BridgeFactory::createBridge(
@@ -198,23 +183,11 @@ void BridgeFactory::disposing() {

}

namespace {

cppu::ImplementationEntry const services[] = {
    { &binaryurp::BridgeFactory::static_create,
      &binaryurp::BridgeFactory::static_getImplementationName,
      &binaryurp::BridgeFactory::static_getSupportedServiceNames,
      &cppu::createOneInstanceComponentFactory, nullptr, 0 },
    { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
};

}

extern "C" SAL_DLLPUBLIC_EXPORT void * binaryurp_component_getFactory(
    char const * pImplName, void * pServiceManager, void * pRegistryKey)
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
com_sun_star_comp_bridge_BridgeFactory_get_implementation(
    css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
{
    return cppu::component_getFactoryHelper(
        pImplName, pServiceManager, pRegistryKey, services);
    return cppu::acquire(static_cast< cppu::OWeakObject * >(new binaryurp::BridgeFactory));
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binaryurp/source/bridgefactory.hxx b/binaryurp/source/bridgefactory.hxx
index 5e49610..1470dc2 100644
--- a/binaryurp/source/bridgefactory.hxx
+++ b/binaryurp/source/bridgefactory.hxx
@@ -54,16 +54,6 @@ typedef
class BridgeFactory : private cppu::BaseMutex, public BridgeFactoryBase
{
public:
    static com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
    SAL_CALL static_create(
        com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
            const & xContext);

    static OUString SAL_CALL static_getImplementationName();

    static com::sun::star::uno::Sequence< OUString > SAL_CALL
    static_getSupportedServiceNames();

    void removeBridge(
        com::sun::star::uno::Reference< com::sun::star::bridge::XBridge >
            const & bridge);
@@ -71,7 +61,6 @@ public:
    using BridgeFactoryBase::acquire;
    using BridgeFactoryBase::release;

private:
    BridgeFactory(const BridgeFactory&) = delete;
    BridgeFactory& operator=(const BridgeFactory&) = delete;

@@ -79,6 +68,7 @@ private:

    virtual ~BridgeFactory() override;

private:
    virtual OUString SAL_CALL getImplementationName() override;

    virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;