summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-04 13:01:46 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-05 12:35:37 +0200
commit3d31d8157208e9300a6bf7d102a413b9c181b4fd (patch)
tree7909a0a0867e1122353ad80460ca3e07064cc571
parent16983f05df5abe6c79f6b1b09bc5c0bdffb837b7 (diff)
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>
-rw-r--r--comphelper/Library_comphelper.mk1
-rw-r--r--comphelper/source/container/enumerablemap.cxx40
-rw-r--r--comphelper/source/inc/comphelper_services.hxx29
-rw-r--r--comphelper/source/misc/comphelper_services.cxx62
-rw-r--r--comphelper/util/comphelp.component5
-rwxr-xr-xsolenv/bin/native-code.py2
6 files changed, 12 insertions, 127 deletions
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 7a8d5bd6f3a6..9a814e17d5bf 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -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 \
diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx
index f5c7069a17a7..55c2b9e28077 100644
--- a/comphelper/source/container/enumerablemap.cxx
+++ b/comphelper/source/container/enumerablemap.cxx
@@ -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();
- }
-
-
- 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;
+ return { "com.sun.star.container.EnumerableMap" };
}
-
- 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: */
diff --git a/comphelper/source/inc/comphelper_services.hxx b/comphelper/source/inc/comphelper_services.hxx
deleted file mode 100644
index cfb720119d89..000000000000
--- a/comphelper/source/inc/comphelper_services.hxx
+++ /dev/null
@@ -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: */
diff --git a/comphelper/source/misc/comphelper_services.cxx b/comphelper/source/misc/comphelper_services.cxx
deleted file mode 100644
index 4fe3269efcfc..000000000000
--- a/comphelper/source/misc/comphelper_services.cxx
+++ /dev/null
@@ -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: */
diff --git a/comphelper/util/comphelp.component b/comphelper/util/comphelp.component
index 5310f04b783a..705e870eb5e0 100644
--- a/comphelper/util/comphelp.component
+++ b/comphelper/util/comphelp.component
@@ -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>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 0a2c3c7285cd..6fa5b6d73f8b 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -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