[Libreoffice-commits] core.git: solenv/bin xmlscript/Library_xmlscript.mk xmlscript/source xmlscript/util

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Jul 6 18:18:05 UTC 2020


 solenv/bin/native-code.py                  |    2 -
 xmlscript/Library_xmlscript.mk             |    1 
 xmlscript/source/inc/unoservices.hxx       |   45 --------------------------
 xmlscript/source/misc/unoservices.cxx      |   49 -----------------------------
 xmlscript/source/xml_helper/xml_impctx.cxx |   27 ++++-----------
 xmlscript/util/xmlscript.component         |    5 +-
 6 files changed, 12 insertions(+), 117 deletions(-)

New commits:
commit 67f4ece34ffae7404eaefc0286dfbe3ad64289ea
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 6 10:04:59 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Jul 6 20:17:26 2020 +0200

    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 at collabora.co.uk>

diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 5f6b48e6daa2..93157dcec0e9 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -49,7 +49,6 @@ core_factory_list = [
     ("libxmlfdlo.a", "xmlfd_component_getFactory"),
     ("libxmlfalo.a", "xmlfa_component_getFactory"),
     ("libodfflatxmllo.a", "odfflatxml_component_getFactory"),
-    ("libxmlscriptlo.a", "xmlscript_component_getFactory"),
     ("libmcnttype.a", "mcnttype_component_getFactory"),
     ("libvcllo.a", "vcl_component_getFactory"),
     ("libspelllo.a", "spell_component_getFactory", "#ifndef IOS"),
@@ -383,6 +382,7 @@ core_constructor_list = [
     "com_sun_star_comp_Writer_XMLAutotextEventsExporter_get_implementation",
     "com_sun_star_comp_Writer_XMLOasisAutotextEventsImporter_get_implementation",
 # xmlscript/util/xmlscript.component
+    "com_sun_star_comp_xml_input_SaxDocumentHandler_get_implementation",
     "com_sun_star_comp_xmlscript_XMLBasicExporter",
     "com_sun_star_comp_xmlscript_XMLOasisBasicExporter",
 # xmlsecurity/util/xmlsecurity.component
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"


More information about the Libreoffice-commits mailing list