diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-06 10:04:59 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-06 20:17:26 +0200 |
commit | 67f4ece34ffae7404eaefc0286dfbe3ad64289ea (patch) | |
tree | 31bdbf273548d311cd566a83e16326c9458cd35d /xmlscript | |
parent | 08f6f7e90b0914867a0678e782f26cbed2d80fa7 (diff) |
xmlscript: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: I648835e938746ff4f89b05d73d8960f9f8953070
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98191
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmlscript')
-rw-r--r-- | xmlscript/Library_xmlscript.mk | 1 | ||||
-rw-r--r-- | xmlscript/source/inc/unoservices.hxx | 45 | ||||
-rw-r--r-- | xmlscript/source/misc/unoservices.cxx | 49 | ||||
-rw-r--r-- | xmlscript/source/xml_helper/xml_impctx.cxx | 27 | ||||
-rw-r--r-- | xmlscript/util/xmlscript.component | 5 |
5 files changed, 11 insertions, 116 deletions
diff --git a/xmlscript/Library_xmlscript.mk b/xmlscript/Library_xmlscript.mk index 1f9387e150d2..40852a12bb70 100644 --- a/xmlscript/Library_xmlscript.mk +++ b/xmlscript/Library_xmlscript.mk @@ -36,7 +36,6 @@ $(eval $(call gb_Library_add_defs,xmlscript,\ $(eval $(call gb_Library_set_precompiled_header,xmlscript,xmlscript/inc/pch/precompiled_xmlscript)) $(eval $(call gb_Library_add_exception_objects,xmlscript,\ - xmlscript/source/misc/unoservices \ xmlscript/source/xml_helper/xml_byteseq \ xmlscript/source/xml_helper/xml_element \ xmlscript/source/xml_helper/xml_impctx \ diff --git a/xmlscript/source/inc/unoservices.hxx b/xmlscript/source/inc/unoservices.hxx deleted file mode 100644 index aecdcea30427..000000000000 --- a/xmlscript/source/inc/unoservices.hxx +++ /dev/null @@ -1,45 +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 . - */ - -#pragma once - -#include <sal/config.h> - -#include <com/sun/star/uno/Sequence.hxx> -#include <rtl/ustring.hxx> - -namespace com::sun::star::uno { - class XComponentContext; - class XInterface; -} - -namespace xmlscript { - -css::uno::Sequence<OUString> -getSupportedServiceNames_DocumentHandlerImpl(); - -OUString getImplementationName_DocumentHandlerImpl(); - -css::uno::Reference<css::uno::XInterface> create_DocumentHandlerImpl( - css::uno::Reference<css::uno::XComponentContext> const & xContext); - -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/misc/unoservices.cxx b/xmlscript/source/misc/unoservices.cxx deleted file mode 100644 index 31c5e7593a26..000000000000 --- a/xmlscript/source/misc/unoservices.cxx +++ /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 . - */ - -#include <cppuhelper/implementationentry.hxx> - -#include <unoservices.hxx> - -using namespace ::com::sun::star::uno; - -namespace xmlscript -{ - const struct ::cppu::ImplementationEntry s_entries [] = - { - { - create_DocumentHandlerImpl, getImplementationName_DocumentHandlerImpl, - getSupportedServiceNames_DocumentHandlerImpl, ::cppu::createSingleComponentFactory, - nullptr, 0 - }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } - }; -} - -extern "C" -{ - SAL_DLLPUBLIC_EXPORT void * xmlscript_component_getFactory( - const char * pImplName, void * pServiceManager, void * pRegistryKey ) - { - return ::cppu::component_getFactoryHelper( - pImplName, pServiceManager, pRegistryKey, ::xmlscript::s_entries ); - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index 5bb2f59f50d6..53a24429c0de 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -19,7 +19,6 @@ #include <sal/config.h> -#include <unoservices.hxx> #include <xml_import.hxx> #include <cppuhelper/implbase.hxx> @@ -44,16 +43,6 @@ namespace xmlscript const sal_Int32 UID_UNKNOWN = -1; -Sequence< OUString > getSupportedServiceNames_DocumentHandlerImpl() -{ - return Sequence< OUString > { "com.sun.star.xml.input.SaxDocumentHandler" }; -} - -OUString getImplementationName_DocumentHandlerImpl() -{ - return "com.sun.star.comp.xml.input.SaxDocumentHandler"; -} - typedef std::unordered_map< OUString, sal_Int32 > t_OUString2LongMap; namespace { @@ -363,7 +352,7 @@ inline ExtendedAttributes::ExtendedAttributes( OUString DocumentHandlerImpl::getImplementationName() { - return getImplementationName_DocumentHandlerImpl(); + return "com.sun.star.comp.xml.input.SaxDocumentHandler"; } sal_Bool DocumentHandlerImpl::supportsService( OUString const & servicename ) @@ -373,7 +362,7 @@ sal_Bool DocumentHandlerImpl::supportsService( OUString const & servicename ) Sequence< OUString > DocumentHandlerImpl::getSupportedServiceNames() { - return getSupportedServiceNames_DocumentHandlerImpl(); + return { "com.sun.star.xml.input.SaxDocumentHandler" }; } // XInitialization @@ -716,14 +705,14 @@ Reference< xml::sax::XDocumentHandler > createDocumentHandler( return Reference< xml::sax::XDocumentHandler >(); } -Reference< XInterface > create_DocumentHandlerImpl( - SAL_UNUSED_PARAMETER Reference< XComponentContext > const & ) -{ - return static_cast< ::cppu::OWeakObject * >( - new DocumentHandlerImpl( - Reference< xml::input::XRoot >(), false /* mt use */ ) ); } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +com_sun_star_comp_xml_input_SaxDocumentHandler_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const& ) +{ + return cppu::acquire(static_cast<cppu::OWeakObject*>(new xmlscript::DocumentHandlerImpl( + Reference< xml::input::XRoot >(), false /* mt use */ ))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlscript/util/xmlscript.component b/xmlscript/util/xmlscript.component index 4f96ec83c6ef..305e917108ba 100644 --- a/xmlscript/util/xmlscript.component +++ b/xmlscript/util/xmlscript.component @@ -18,8 +18,9 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="xmlscript" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.xml.input.SaxDocumentHandler"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.xml.input.SaxDocumentHandler" + constructor="com_sun_star_comp_xml_input_SaxDocumentHandler_get_implementation"> <service name="com.sun.star.xml.input.SaxDocumentHandler"/> </implementation> <implementation name="com.sun.star.comp.xmlscript.XMLBasicExporter" |