summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-22 13:40:39 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-22 15:41:34 +0200
commit06d64d7900aeb5be315b340ec855b978dbc66410 (patch)
treeabefc496a5acc4eed36159dddcdfb98ef1e7f100
parent1266a4ab9f9c1d6d1ae0678fbbc3746e4407cd34 (diff)
ucb/ext: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: Ie2e0958e181db002d747bffd05ead02bebd96956 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99220 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--ucb/Library_ucpext.mk1
-rw-r--r--ucb/source/ucp/ext/ucpext.component5
-rw-r--r--ucb/source/ucp/ext/ucpext_provider.cxx31
-rw-r--r--ucb/source/ucp/ext/ucpext_provider.hxx7
-rw-r--r--ucb/source/ucp/ext/ucpext_services.cxx57
5 files changed, 14 insertions, 87 deletions
diff --git a/ucb/Library_ucpext.mk b/ucb/Library_ucpext.mk
index baa87714b6e0..55722b058693 100644
--- a/ucb/Library_ucpext.mk
+++ b/ucb/Library_ucpext.mk
@@ -31,7 +31,6 @@ $(eval $(call gb_Library_add_exception_objects,ucpext,\
ucb/source/ucp/ext/ucpext_datasupplier \
ucb/source/ucp/ext/ucpext_provider \
ucb/source/ucp/ext/ucpext_resultset \
- ucb/source/ucp/ext/ucpext_services \
))
# vim: set noet sw=4 ts=4:
diff --git a/ucb/source/ucp/ext/ucpext.component b/ucb/source/ucp/ext/ucpext.component
index 56d223146ab5..0f1b96555baf 100644
--- a/ucb/source/ucp/ext/ucpext.component
+++ b/ucb/source/ucp/ext/ucpext.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="ucpext" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="org.openoffice.comp.ucp.ext.ContentProvider">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="org.openoffice.comp.ucp.ext.ContentProvider"
+ constructor="ucb_ext_ContentProvider_get_implementation">
<service name="com.sun.star.ucb.ExtensionContentProvider"/>
</implementation>
</component>
diff --git a/ucb/source/ucp/ext/ucpext_provider.cxx b/ucb/source/ucp/ext/ucpext_provider.cxx
index de1bb15e4a46..717077bc8dbc 100644
--- a/ucb/source/ucp/ext/ucpext_provider.cxx
+++ b/ucb/source/ucp/ext/ucpext_provider.cxx
@@ -53,33 +53,15 @@ namespace ucb::ucp::ext
}
- OUString ContentProvider::getImplementationName_static()
- {
- return "org.openoffice.comp.ucp.ext.ContentProvider";
- }
-
-
OUString SAL_CALL ContentProvider::getImplementationName()
{
- return getImplementationName_static();
- }
-
-
- Sequence< OUString > ContentProvider::getSupportedServiceNames_static( )
- {
- return { "com.sun.star.ucb.ContentProvider", "com.sun.star.ucb.ExtensionContentProvider" };
+ return "org.openoffice.comp.ucp.ext.ContentProvider";
}
Sequence< OUString > SAL_CALL ContentProvider::getSupportedServiceNames( )
{
- return getSupportedServiceNames_static();
- }
-
-
- Reference< XInterface > ContentProvider::Create( const Reference< XComponentContext >& i_rContext )
- {
- return *( new ContentProvider( i_rContext ) );
+ return { "com.sun.star.ucb.ContentProvider", "com.sun.star.ucb.ExtensionContentProvider" };
}
@@ -178,4 +160,13 @@ namespace ucb::ucp::ext
} // namespace ucb::ucp::ext
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+ucb_ext_ContentProvider_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
+{
+ static rtl::Reference<ucb::ucp::ext::ContentProvider> g_Instance(new ucb::ucp::ext::ContentProvider(context));
+ g_Instance->acquire();
+ return static_cast<cppu::OWeakObject*>(g_Instance.get());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/ucb/source/ucp/ext/ucpext_provider.hxx b/ucb/source/ucp/ext/ucpext_provider.hxx
index 1f64e3733826..8424b970a97c 100644
--- a/ucb/source/ucp/ext/ucpext_provider.hxx
+++ b/ucb/source/ucp/ext/ucpext_provider.hxx
@@ -40,13 +40,6 @@ namespace ucb::ucp::ext
virtual OUString SAL_CALL getImplementationName( ) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
- // XServiceInfo - static versions
- /// @throws css::uno::RuntimeException
- static OUString getImplementationName_static( );
- /// @throws css::uno::RuntimeException
- static css::uno::Sequence< OUString > getSupportedServiceNames_static();
- static css::uno::Reference< css::uno::XInterface > Create( const css::uno::Reference< css::uno::XComponentContext >& i_rContext );
-
// XContentProvider
virtual css::uno::Reference< css::ucb::XContent > SAL_CALL queryContent( const css::uno::Reference< css::ucb::XContentIdentifier >& Identifier ) override;
diff --git a/ucb/source/ucp/ext/ucpext_services.cxx b/ucb/source/ucp/ext/ucpext_services.cxx
deleted file mode 100644
index 0bce79e0d4ca..000000000000
--- a/ucb/source/ucp/ext/ucpext_services.cxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "ucpext_provider.hxx"
-
-#include <cppuhelper/implementationentry.hxx>
-
-
-namespace ucb::ucp::ext
-{
-
-
-
-
- //= descriptors for the services implemented in this component
-
- struct ::cppu::ImplementationEntry const s_aServiceEntries[] =
- {
- {
- ContentProvider::Create,
- ContentProvider::getImplementationName_static,
- ContentProvider::getSupportedServiceNames_static,
- ::cppu::createOneInstanceComponentFactory, nullptr, 0
- },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
- };
-
-
-} // namespace ucb::ucp::ext
-
-
-extern "C"
-{
-
- SAL_DLLPUBLIC_EXPORT void * ucpext_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey )
- {
- return ::cppu::component_getFactoryHelper( pImplName, pServiceManager, pRegistryKey , ::ucb::ucp::ext::s_aServiceEntries );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */