comphelper: create instances with uno constructors

See tdf#74608 for motivation

Change-Id: Ib7aa69cdf62992cea38a60aac9169c2f1779c1cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98094
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2020-07-05 12:35:37 +02:00
committed by Noel Grandin
parent 16983f05df
commit 3d31d81572
6 changed files with 12 additions and 127 deletions
-1
View File
@@ -97,7 +97,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/backupfilehelper \
comphelper/source/misc/base64 \
comphelper/source/misc/comphelper_module \
comphelper/source/misc/comphelper_services \
comphelper/source/misc/componentbase \
comphelper/source/misc/componentmodule \
comphelper/source/misc/configuration \
+8 -32
View File
@@ -19,7 +19,6 @@
#include <comphelper_module.hxx>
#include <comphelper_services.hxx>
#include <comphelper/anytostring.hxx>
#include <comphelper/anycompare.hxx>
#include <comphelper/componentbase.hxx>
@@ -153,8 +152,9 @@ namespace comphelper
class EnumerableMap: public Map_IFace, public ComponentBase
{
protected:
public:
EnumerableMap();
protected:
virtual ~EnumerableMap() override;
// XInitialization
@@ -184,12 +184,6 @@ namespace comphelper
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
public:
// XServiceInfo, static version (used for component registration)
static OUString getImplementationName_static( );
static Sequence< OUString > getSupportedServiceNames_static( );
static Reference< XInterface > Create( const Reference< XComponentContext >& );
private:
void impl_initValues_throw( const Sequence< Pair< Any, Any > >& _initialValues );
@@ -645,7 +639,7 @@ namespace comphelper
OUString SAL_CALL EnumerableMap::getImplementationName( )
{
return getImplementationName_static();
return "org.openoffice.comp.comphelper.EnumerableMap";
}
sal_Bool SAL_CALL EnumerableMap::supportsService( const OUString& _serviceName )
@@ -656,29 +650,9 @@ namespace comphelper
Sequence< OUString > SAL_CALL EnumerableMap::getSupportedServiceNames( )
{
return getSupportedServiceNames_static();
return { "com.sun.star.container.EnumerableMap" };
}
OUString EnumerableMap::getImplementationName_static( )
{
return "org.openoffice.comp.comphelper.EnumerableMap";
}
Sequence< OUString > EnumerableMap::getSupportedServiceNames_static( )
{
Sequence< OUString > aServiceNames { "com.sun.star.container.EnumerableMap" };
return aServiceNames;
}
Reference< XInterface > EnumerableMap::Create( SAL_UNUSED_PARAMETER const Reference< XComponentContext >& )
{
return *new EnumerableMap;
}
bool MapEnumerator::hasMoreElements()
{
if ( m_disposed )
@@ -729,9 +703,11 @@ namespace comphelper
} // namespace comphelper
void createRegistryInfo_Map()
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
org_openoffice_comp_comphelper_EnumerableMap(
css::uno::XComponentContext*, css::uno::Sequence<css::uno::Any> const&)
{
::comphelper::module::OAutoRegistration< ::comphelper::EnumerableMap > aAutoRegistration;
return cppu::acquire(new comphelper::EnumerableMap());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,29 +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 .
*/
#ifndef INCLUDED_COMPHELPER_SOURCE_INC_COMPHELPER_SERVICES_HXX
#define INCLUDED_COMPHELPER_SOURCE_INC_COMPHELPER_SERVICES_HXX
#include <sal/config.h>
void createRegistryInfo_Map();
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
@@ -1,62 +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 <comphelper_module.hxx>
#include <comphelper_services.hxx>
#include <rtl/instance.hxx>
namespace comphelper::module
{
namespace
{
class doInitialize
{
public:
doInitialize()
{
createRegistryInfo_Map();
}
};
struct theInitializer : public rtl::Static< doInitialize, theInitializer > {};
}
static void initializeModule()
{
// coverity[side_effect_free : FALSE] - not actually side-effect-free
theInitializer::get();
}
} // namespace comphelper::module
extern "C" SAL_DLLPUBLIC_EXPORT void* comphelp_component_getFactory(
const char* pImplementationName, SAL_UNUSED_PARAMETER void*,
SAL_UNUSED_PARAMETER void* )
{
::comphelper::module::initializeModule();
return ::comphelper::module::ComphelperModule::getInstance().getComponentFactory( pImplementationName );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+3 -2
View File
@@ -18,7 +18,7 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="comphelp" xmlns="http://openoffice.org/2010/uno-components">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="AnyCompareFactory"
constructor="AnyCompareFactory_get_implementation">
<service name="com.sun.star.ucb.AnyCompareFactory"/>
@@ -61,7 +61,8 @@
<service name="com.sun.star.util.OfficeInstallationDirectories"/>
<singleton name="com.sun.star.util.theOfficeInstallationDirectories"/>
</implementation>
<implementation name="org.openoffice.comp.comphelper.EnumerableMap">
<implementation name="org.openoffice.comp.comphelper.EnumerableMap"
constructor="org_openoffice_comp_comphelper_EnumerableMap">
<service name="com.sun.star.container.EnumerableMap"/>
</implementation>
</component>
+1 -1
View File
@@ -22,7 +22,6 @@ import xml.etree.ElementTree as ET
core_factory_list = [
("libembobj.a", "embobj_component_getFactory"),
("libevtattlo.a", "evtatt_component_getFactory"),
("libcomphelper.a", "comphelp_component_getFactory"),
("libconfigmgrlo.a", "configmgr_component_getFactory"),
("libdrawinglayerlo.a", "drawinglayer_component_getFactory"),
("libemfiolo.a", "emfio_component_getFactory"),
@@ -141,6 +140,7 @@ core_constructor_list = [
"com_sun_star_comp_SequenceInputStreamService",
"com_sun_star_comp_SequenceOutputStreamService",
"com_sun_star_comp_util_OfficeInstallationDirectories",
"org_openoffice_comp_comphelper_EnumerableMap",
# dbaccess/util/dba.component
"com_sun_star_comp_dba_ORowSet_get_implementation",
# extensions/source/logging/log.component