diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-08 14:03:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-08 20:26:01 +0200 |
commit | cf389f2c242b82417c3c746b6a68e38d637b5101 (patch) | |
tree | ff7cfb6010f556598752a79aac68ea85ad9bb2b3 /svgio/source | |
parent | 10a5df7de19c86b362976b4bd8cee32da4413547 (diff) |
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>
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svguno/svguno.cxx | 46 | ||||
-rw-r--r-- | svgio/source/svguno/xsvgparser.cxx | 35 | ||||
-rw-r--r-- | svgio/source/svguno/xsvgparser.hxx | 49 |
3 files changed, 9 insertions, 121 deletions
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 <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: */ 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 <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: */ 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 <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: */ |