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>
This commit is contained in:
Noel Grandin
2020-07-22 15:41:34 +02:00
committed by Noel Grandin
parent 1266a4ab9f
commit 06d64d7900
5 changed files with 14 additions and 87 deletions
-1
View File
@@ -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:
+3 -2
View File
@@ -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>
+11 -20
View File
@@ -53,33 +53,15 @@ namespace ucb::ucp::ext
}
OUString ContentProvider::getImplementationName_static()
OUString SAL_CALL ContentProvider::getImplementationName()
{
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" };
}
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: */
-7
View File
@@ -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;
-57
View File
@@ -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: */