summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-07 17:57:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-07 22:01:33 +0200
commit9ff8a1173a72b9ebea54ef3b00b1d632bf953e37 (patch)
treec452f98284d8e6f07aec0b7ba9f4ec859aab1fbf /formula
parent0dffc65236fbacf98047d6dbfc82b4efe7dd959b (diff)
formula: create instances with uno constructors
See tdf#74608 for motivation Change-Id: I5983c837977e40b91df02605c1012640ffd5c650 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98291 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'formula')
-rw-r--r--formula/Library_for.mk1
-rw-r--r--formula/source/core/api/FormulaOpCodeMapperObj.cxx24
-rw-r--r--formula/source/core/api/services.cxx53
-rw-r--r--formula/util/for.component5
4 files changed, 11 insertions, 72 deletions
diff --git a/formula/Library_for.mk b/formula/Library_for.mk
index d3d86a4494b5..a646b4a9598a 100644
--- a/formula/Library_for.mk
+++ b/formula/Library_for.mk
@@ -41,7 +41,6 @@ $(eval $(call gb_Library_add_exception_objects,for,\
formula/source/core/api/FormulaCompiler \
formula/source/core/api/FormulaOpCodeMapperObj \
formula/source/core/api/grammar \
- formula/source/core/api/services \
formula/source/core/api/token \
formula/source/core/api/vectortoken \
formula/source/core/resource/core_resource \
diff --git a/formula/source/core/api/FormulaOpCodeMapperObj.cxx b/formula/source/core/api/FormulaOpCodeMapperObj.cxx
index a22a1ff3d43d..a3ffe56cc8c9 100644
--- a/formula/source/core/api/FormulaOpCodeMapperObj.cxx
+++ b/formula/source/core/api/FormulaOpCodeMapperObj.cxx
@@ -82,31 +82,23 @@ SAL_CALL FormulaOpCodeMapperObj::getAvailableMappings(
OUString SAL_CALL FormulaOpCodeMapperObj::getImplementationName( )
{
- return getImplementationName_Static();
-}
-
-OUString FormulaOpCodeMapperObj::getImplementationName_Static()
-{
return "simple.formula.FormulaOpCodeMapperObj";
}
uno::Sequence< OUString > SAL_CALL FormulaOpCodeMapperObj::getSupportedServiceNames( )
{
- return getSupportedServiceNames_Static();
-}
-uno::Sequence< OUString > FormulaOpCodeMapperObj::getSupportedServiceNames_Static()
-{
- uno::Sequence<OUString> aSeq { "com.sun.star.sheet.FormulaOpCodeMapper" };
- return aSeq;
+ return { "com.sun.star.sheet.FormulaOpCodeMapper" };
}
-uno::Reference< uno::XInterface > FormulaOpCodeMapperObj::create(
- uno::Reference< uno::XComponentContext > const & /*_xContext*/)
+} // formula
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+simple_formula_FormulaOpCodeMapperObj(
+ css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& )
{
- return static_cast<sheet::XFormulaOpCodeMapper*>(new FormulaOpCodeMapperObj(std::make_unique<FormulaCompiler>()));
+ return cppu::acquire(
+ new formula::FormulaOpCodeMapperObj(std::make_unique<formula::FormulaCompiler>()));
}
-} // formula
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/source/core/api/services.cxx b/formula/source/core/api/services.cxx
deleted file mode 100644
index 2e885fea41cd..000000000000
--- a/formula/source/core/api/services.cxx
+++ /dev/null
@@ -1,53 +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 <sal/types.h>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implementationentry.hxx>
-#include <formula/FormulaOpCodeMapperObj.hxx>
-
-/********************************************************************************************/
-
-using namespace ::formula;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-
-// registry functions
-namespace
-{
-
-cppu::ImplementationEntry const entries[] = {
- { &FormulaOpCodeMapperObj::create, &FormulaOpCodeMapperObj::getImplementationName_Static, &FormulaOpCodeMapperObj::getSupportedServiceNames_Static,
- &cppu::createSingleComponentFactory, nullptr, 0 },
- { nullptr, nullptr, nullptr, nullptr, nullptr, 0 }
-};
-}
-
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void * for_component_getFactory(
- char const * implName, void * serviceManager, void * registryKey)
-{
- return cppu::component_getFactoryHelper(
- implName, serviceManager, registryKey, entries);
-}
-} // extern "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/formula/util/for.component b/formula/util/for.component
index 5b6ecef20538..f906d5174eb6 100644
--- a/formula/util/for.component
+++ b/formula/util/for.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="for" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="simple.formula.FormulaOpCodeMapperObj">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="simple.formula.FormulaOpCodeMapperObj"
+ constructor="simple_formula_FormulaOpCodeMapperObj">
<service name="com.sun.star.sheet.FormulaOpCodeMapper"/>
</implementation>
</component>