diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2020-07-06 18:26:43 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-06 22:15:23 +0200 |
commit | 72e4674aad60d17aef66020dd9ca6ec778508ac2 (patch) | |
tree | eda387a6fbbcc40d25ab10de47a3393270ed7b78 /emfio | |
parent | a7ffe4026a2f4fcc77d297c9bc671ded158efc46 (diff) |
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>
Diffstat (limited to 'emfio')
-rw-r--r-- | emfio/Library_emfio.mk | 1 | ||||
-rw-r--r-- | emfio/emfio.component | 5 | ||||
-rw-r--r-- | emfio/source/emfuno/emfuno.cxx | 46 | ||||
-rw-r--r-- | emfio/source/emfuno/xemfparser.cxx | 38 | ||||
-rw-r--r-- | emfio/source/emfuno/xemfparser.hxx | 49 |
5 files changed, 14 insertions, 125 deletions
diff --git a/emfio/Library_emfio.mk b/emfio/Library_emfio.mk index 52fde14885b3..281f077130f1 100644 --- a/emfio/Library_emfio.mk +++ b/emfio/Library_emfio.mk @@ -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 \ diff --git a/emfio/emfio.component b/emfio/emfio.component index a0ea552950cd..80e242792bee 100644 --- a/emfio/emfio.component +++ b/emfio/emfio.component @@ -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> diff --git a/emfio/source/emfuno/emfuno.cxx b/emfio/source/emfuno/emfuno.cxx deleted file mode 100644 index 4b55eb6c54fb..000000000000 --- a/emfio/source/emfuno/emfuno.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 <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: */ diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx index 3297dea8f30a..717f2dad7cfb 100644 --- a/emfio/source/emfuno/xemfparser.cxx +++ b/emfio/source/emfuno/xemfparser.cxx @@ -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: */ diff --git a/emfio/source/emfuno/xemfparser.hxx b/emfio/source/emfuno/xemfparser.hxx deleted file mode 100644 index 426231d362fc..000000000000 --- a/emfio/source/emfuno/xemfparser.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_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: */ |