From cf389f2c242b82417c3c746b6a68e38d637b5101 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 8 Jul 2020 14:03:00 +0200 Subject: [PATCH] svgio: create instances with uno constructors See tdf#74608 for motivation Change-Id: Iad7a6435482596dd3e955d3323aaf3d5e6984517 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98371 Tested-by: Jenkins Reviewed-by: Noel Grandin --- solenv/bin/native-code.py | 3 +- svgio/Library_svgio.mk | 1 - svgio/source/svguno/svguno.cxx | 46 ---------------------------- svgio/source/svguno/xsvgparser.cxx | 35 ++++++--------------- svgio/source/svguno/xsvgparser.hxx | 49 ------------------------------ svgio/svgio.component | 5 +-- 6 files changed, 14 insertions(+), 125 deletions(-) delete mode 100644 svgio/source/svguno/svguno.cxx delete mode 100644 svgio/source/svguno/xsvgparser.hxx diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 4f387be3186a..172176b9b2f9 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -51,7 +51,6 @@ core_factory_list = [ ("libvcllo.a", "vcl_component_getFactory"), ("libspelllo.a", "spell_component_getFactory", "#ifndef IOS"), ("libpdffilterlo.a", "pdffilter_component_getFactory"), - ("libsvgiolo.a", "svgio_component_getFactory"), ("libsvtlo.a", "svt_component_getFactory"), ("libMacOSXSpelllo.a", "MacOSXSpell_component_getFactory", "#ifdef IOS"), ("libproxyfaclo.a", "proxyfac_component_getFactory"), @@ -258,6 +257,8 @@ core_constructor_list = [ "com_sun_star_comp_graphic_GraphicProvider_get_implementation", "com_sun_star_frame_VCLSessionManagerClient_get_implementation", "vcl_FontIdentificator_get_implementation", +# svgio/svgio.component + "svgio_XSvgParser_get_implementation", # svx/util/svx.component "com_sun_star_comp_svx_NumberingToolBoxControl_get_implementation", "com_sun_star_comp_svx_SmartTagMenuController_get_implementation", diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk index 449c17f61196..83a8546bdc1a 100644 --- a/svgio/Library_svgio.mk +++ b/svgio/Library_svgio.mk @@ -79,7 +79,6 @@ $(eval $(call gb_Library_add_exception_objects,svgio,\ svgio/source/svgreader/svgtspannode \ svgio/source/svgreader/svgusenode \ svgio/source/svgreader/svgvisitor \ - svgio/source/svguno/svguno \ svgio/source/svguno/xsvgparser \ )) diff --git a/svgio/source/svguno/svguno.cxx b/svgio/source/svguno/svguno.cxx deleted file mode 100644 index be777b95bc0a..000000000000 --- a/svgio/source/svguno/svguno.cxx +++ /dev/null @@ -1,46 +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 - -#include -#include -#include - -#include "xsvgparser.hxx" - -namespace { - -cppu::ImplementationEntry const services[] = { - { &svgio::svgreader::XSvgParser_createInstance, - &svgio::svgreader::XSvgParser_getImplementationName, - &svgio::svgreader::XSvgParser_getSupportedServiceNames, - &cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } }; - -} - -extern "C" SAL_DLLPUBLIC_EXPORT void * svgio_component_getFactory( - char const * pImplName, void * pServiceManager, void * pRegistryKey) -{ - return cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, services); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx index f48d04cd1221..5abaea5e099d 100644 --- a/svgio/source/svguno/xsvgparser.cxx +++ b/svgio/source/svguno/xsvgparser.cxx @@ -33,8 +33,6 @@ #include -#include "xsvgparser.hxx" - using namespace ::com::sun::star; namespace svgio::svgreader @@ -71,29 +69,7 @@ namespace svgio::svgreader }; } -} // end of namespace svgio::svgreader -// uno functions -namespace svgio::svgreader -{ - uno::Sequence< OUString > XSvgParser_getSupportedServiceNames() - { - return uno::Sequence< OUString > { "com.sun.star.graphic.SvgTools" }; - } - - OUString XSvgParser_getImplementationName() - { - return "svgio::svgreader::XSvgParser"; - } - - uno::Reference< uno::XInterface > XSvgParser_createInstance(const uno::Reference< uno::XComponentContext >& context) - { - return static_cast< ::cppu::OWeakObject* >(new XSvgParser(context)); - } -} // end of namespace svgio::svgreader - -namespace svgio::svgreader -{ XSvgParser::XSvgParser( uno::Reference< uno::XComponentContext > const & context): context_(context) @@ -200,7 +176,7 @@ namespace svgio::svgreader OUString SAL_CALL XSvgParser::getImplementationName() { - return XSvgParser_getImplementationName(); + return "svgio::svgreader::XSvgParser"; } sal_Bool SAL_CALL XSvgParser::supportsService(const OUString& rServiceName) @@ -210,9 +186,16 @@ namespace svgio::svgreader uno::Sequence< OUString > SAL_CALL XSvgParser::getSupportedServiceNames() { - return XSvgParser_getSupportedServiceNames(); + return { "com.sun.star.graphic.SvgTools" }; } } // end of namespace svgio::svgreader +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +svgio_XSvgParser_get_implementation( + css::uno::XComponentContext* context, css::uno::Sequence const&) +{ + return cppu::acquire(new svgio::svgreader::XSvgParser(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/source/svguno/xsvgparser.hxx b/svgio/source/svguno/xsvgparser.hxx deleted file mode 100644 index 158b3dd137c6..000000000000 --- a/svgio/source/svguno/xsvgparser.hxx +++ /dev/null @@ -1,49 +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_SVGIO_SOURCE_SVGUNO_XSVGPARSER_HXX -#define INCLUDED_SVGIO_SOURCE_SVGUNO_XSVGPARSER_HXX - -#include - -#include -#include - -namespace com::sun::star { - namespace uno { - class XComponentContext; - class XInterface; - } -} - -namespace svgio::svgreader { - -css::uno::Reference< css::uno::XInterface > -XSvgParser_createInstance( css::uno::Reference< css::uno::XComponentContext > const &); - -OUString XSvgParser_getImplementationName(); - -css::uno::Sequence< OUString > -XSvgParser_getSupportedServiceNames(); - -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/svgio.component b/svgio/svgio.component index 96065c384276..cd4e407c7afa 100644 --- a/svgio/svgio.component +++ b/svgio/svgio.component @@ -18,8 +18,9 @@ --> - + xmlns="http://openoffice.org/2010/uno-components"> +