emfio: create instances with uno constructors

See tdf#74608 for motivation

Change-Id: I1685fe05a2a6b1761e78359596c265ac6487f99b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98217
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2020-07-06 18:26:43 +02:00 committed by Noel Grandin
parent a7ffe4026a
commit 72e4674aad
6 changed files with 16 additions and 126 deletions

View file

@ -55,7 +55,6 @@ $(eval $(call gb_Library_use_libraries,emfio,\
))
$(eval $(call gb_Library_add_exception_objects,emfio,\
emfio/source/emfuno/emfuno \
emfio/source/emfuno/xemfparser \
emfio/source/reader/mtftools \
emfio/source/reader/wmfreader \

View file

@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
prefix="emfio" xmlns="http://openoffice.org/2010/uno-components">
<implementation name="emfio::emfreader::XEmfParser">
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="emfio::emfreader::XEmfParser"
constructor="emfio_emfreader_XEmfParser_get_implementation">
<service name="com.sun.star.graphic.EmfTools"/>
</implementation>
</component>

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 "xemfparser.hxx"
namespace {
cppu::ImplementationEntry const services[] = {
{ &emfio::emfreader::XEmfParser_createInstance,
&emfio::emfreader::XEmfParser_getImplementationName,
&emfio::emfreader::XEmfParser_getSupportedServiceNames,
&cppu::createSingleComponentFactory, nullptr, 0 },
{ nullptr, nullptr, nullptr, nullptr, nullptr, 0 } };
}
extern "C" SAL_DLLPUBLIC_EXPORT void * emfio_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

@ -36,8 +36,6 @@
#include <wmfreader.hxx>
#include <emfreader.hxx>
#include "xemfparser.hxx"
using namespace ::com::sun::star;
namespace emfio::emfreader
@ -49,7 +47,6 @@ namespace emfio::emfreader
private:
uno::Reference< uno::XComponentContext > context_;
protected:
public:
explicit XEmfParser(
uno::Reference< uno::XComponentContext > const & context);
@ -69,29 +66,7 @@ namespace emfio::emfreader
};
}
} // end of namespace emfio::emfreader
// uno functions
namespace emfio::emfreader
{
uno::Sequence< OUString > XEmfParser_getSupportedServiceNames()
{
return uno::Sequence< OUString > { "com.sun.star.graphic.EmfTools" };
}
OUString XEmfParser_getImplementationName()
{
return "emfio::emfreader::XEmfParser";
}
uno::Reference< uno::XInterface > XEmfParser_createInstance(const uno::Reference< uno::XComponentContext >& context)
{
return static_cast< ::cppu::OWeakObject* >(new XEmfParser(context));
}
} // end of namespace emfio::emfreader
namespace emfio::emfreader
{
XEmfParser::XEmfParser(
uno::Reference< uno::XComponentContext > const & context):
context_(context)
@ -208,7 +183,7 @@ namespace emfio::emfreader
OUString SAL_CALL XEmfParser::getImplementationName()
{
return XEmfParser_getImplementationName();
return "emfio::emfreader::XEmfParser";
}
sal_Bool SAL_CALL XEmfParser::supportsService(const OUString& rServiceName)
@ -218,9 +193,18 @@ namespace emfio::emfreader
uno::Sequence< OUString > SAL_CALL XEmfParser::getSupportedServiceNames()
{
return XEmfParser_getSupportedServiceNames();
return { "com.sun.star.graphic.EmfTools" };
}
} // end of namespace emfio::emfreader
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
emfio_emfreader_XEmfParser_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& )
{
return cppu::acquire(new emfio::emfreader::XEmfParser(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_EMFIO_SOURCE_EMFUNO_XEMFARSER_HXX
#define INCLUDED_EMFIO_SOURCE_EMFUNO_XEMFARSER_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 emfio::emfreader {
css::uno::Reference< css::uno::XInterface >
XEmfParser_createInstance( css::uno::Reference< css::uno::XComponentContext > const &);
OUString XEmfParser_getImplementationName();
css::uno::Sequence< OUString >
XEmfParser_getSupportedServiceNames();
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -23,7 +23,6 @@ core_factory_list = [
("libembobj.a", "embobj_component_getFactory"),
("libevtattlo.a", "evtatt_component_getFactory"),
("libdrawinglayerlo.a", "drawinglayer_component_getFactory"),
("libemfiolo.a", "emfio_component_getFactory"),
("libfilterconfiglo.a", "filterconfig1_component_getFactory"),
("libfsstoragelo.a", "fsstorage_component_getFactory"),
("libhyphenlo.a", "hyphen_component_getFactory"),
@ -149,6 +148,8 @@ core_constructor_list = [
"com_sun_star_cui_ColorPicker_get_implementation",
# dbaccess/util/dba.component
"com_sun_star_comp_dba_ORowSet_get_implementation",
# emfio/emfio.component
"emfio_emfreader_XEmfParser_get_implementation",
# extensions/source/logging/log.component
("com_sun_star_comp_extensions_FileHandler", "#ifdef ANDROID"),
("com_sun_star_comp_extensions_LoggerPool", "#ifdef ANDROID"),