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 <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-07-08 14:03:00 +02:00
parent 10a5df7de1
commit cf389f2c24
6 changed files with 14 additions and 125 deletions

View file

@ -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",

View file

@ -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 \
))

View file

@ -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 <sal/config.h>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <sal/types.h>
#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: */

View file

@ -33,8 +33,6 @@
#include <svgvisitor.hxx>
#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<css::uno::Any> const&)
{
return cppu::acquire(new svgio::svgreader::XSvgParser(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -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 <sal/config.h>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
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: */

View file

@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="svgio" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="svgio::svgreader::XSvgParser">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="svgio::svgreader::XSvgParser"
constructor="svgio_XSvgParser_get_implementation">
<service name="com.sun.star.graphic.SvgTools"/>
</implementation>
</component>