summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-11 20:01:32 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-12 13:20:37 +0200
commitd4ff75676920b6d1c6decdfc9906a3efdf68cf69 (patch)
tree43fb1cf24e2b73c4163fccb23801a0cb1bd25d73
parenttdf#118148 Extended tips in editmodulesdialog.ui (diff)
downloadcore-d4ff75676920b6d1c6decdfc9906a3efdf68cf69.tar.gz
core-d4ff75676920b6d1c6decdfc9906a3efdf68cf69.zip
filter/xmlfilteradaptor: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I44392add5b0ed6d3184e4ecdd2e8da729a78169c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98569 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--filter/Library_xmlfa.mk1
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx25
-rw-r--r--filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx12
-rw-r--r--filter/source/xmlfilteradaptor/genericfilter.cxx53
-rw-r--r--filter/source/xmlfilteradaptor/xmlfa.component5
-rwxr-xr-xsolenv/bin/native-code.py2
6 files changed, 14 insertions, 84 deletions
diff --git a/filter/Library_xmlfa.mk b/filter/Library_xmlfa.mk
index 4f81d7f51b67..425cebc691f1 100644
--- a/filter/Library_xmlfa.mk
+++ b/filter/Library_xmlfa.mk
@@ -36,7 +36,6 @@ $(eval $(call gb_Library_use_libraries,xmlfa,\
$(eval $(call gb_Library_add_exception_objects,xmlfa,\
filter/source/xmlfilteradaptor/XmlFilterAdaptor \
- filter/source/xmlfilteradaptor/genericfilter \
))
# vim: set noet sw=4 ts=4:
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
index 8a1b2c96ade2..452eaebaf1c8 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.cxx
@@ -338,25 +338,11 @@ void SAL_CALL XmlFilterAdaptor::initialize( const Sequence< Any >& aArguments )
"TemplateName", OUString());
}
}
-OUString XmlFilterAdaptor_getImplementationName ()
-{
- return "com.sun.star.comp.Writer.XmlFilterAdaptor";
-}
-
-Sequence< OUString > XmlFilterAdaptor_getSupportedServiceNames( )
-{
- return { "com.sun.star.document.ExportFilter", "com.sun.star.document.ImportFilter" };
-}
-
-Reference< XInterface > XmlFilterAdaptor_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
-{
- return static_cast<cppu::OWeakObject*>(new XmlFilterAdaptor( comphelper::getComponentContext(rSMgr) ));
-}
// XServiceInfo
OUString SAL_CALL XmlFilterAdaptor::getImplementationName( )
{
- return XmlFilterAdaptor_getImplementationName();
+ return "com.sun.star.comp.Writer.XmlFilterAdaptor";
}
sal_Bool SAL_CALL XmlFilterAdaptor::supportsService( const OUString& rServiceName )
@@ -366,7 +352,14 @@ sal_Bool SAL_CALL XmlFilterAdaptor::supportsService( const OUString& rServiceNam
Sequence< OUString > SAL_CALL XmlFilterAdaptor::getSupportedServiceNames( )
{
- return XmlFilterAdaptor_getSupportedServiceNames();
+ return { "com.sun.star.document.ExportFilter", "com.sun.star.document.ImportFilter" };
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
+filter_XmlFilterAdaptor_get_implementation(
+ css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
+{
+ return cppu::acquire(new XmlFilterAdaptor(context));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
index 78a4fbad6369..c00a46e6211b 100644
--- a/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
+++ b/filter/source/xmlfilteradaptor/XmlFilterAdaptor.hxx
@@ -104,18 +104,6 @@ public:
};
-/// @throws css::uno::RuntimeException
-OUString XmlFilterAdaptor_getImplementationName();
-
-/// @throws css::uno::RuntimeException
-css::uno::Sequence< OUString > XmlFilterAdaptor_getSupportedServiceNames( );
-
-/// @throws css::uno::Exception
-css::uno::Reference< css::uno::XInterface >
-
-XmlFilterAdaptor_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr);
-
-
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilteradaptor/genericfilter.cxx b/filter/source/xmlfilteradaptor/genericfilter.cxx
deleted file mode 100644
index 6472accc2c43..000000000000
--- a/filter/source/xmlfilteradaptor/genericfilter.cxx
+++ /dev/null
@@ -1,53 +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/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include "XmlFilterAdaptor.hxx"
-
-using namespace ::cppu;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-extern "C"
-{
-SAL_DLLPUBLIC_EXPORT void * xmlfa_component_getFactory(
- const char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
-{
- void * pRet = nullptr;
- OUString implName = OUString::createFromAscii( pImplName );
- if ( pServiceManager && implName == XmlFilterAdaptor_getImplementationName() )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- static_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- XmlFilterAdaptor_createInstance, XmlFilterAdaptor_getSupportedServiceNames() ) );
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
- return pRet;
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/filter/source/xmlfilteradaptor/xmlfa.component b/filter/source/xmlfilteradaptor/xmlfa.component
index 7ef62b7b79dc..7e6c316dbcf9 100644
--- a/filter/source/xmlfilteradaptor/xmlfa.component
+++ b/filter/source/xmlfilteradaptor/xmlfa.component
@@ -18,8 +18,9 @@
-->
<component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@"
- prefix="xmlfa" xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.Writer.XmlFilterAdaptor">
+ xmlns="http://openoffice.org/2010/uno-components">
+ <implementation name="com.sun.star.comp.Writer.XmlFilterAdaptor"
+ constructor="filter_XmlFilterAdaptor_get_implementation">
<service name="com.sun.star.document.ExportFilter"/>
<service name="com.sun.star.document.ImportFilter"/>
</implementation>
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py
index 504b334b6530..344a5083c6bf 100755
--- a/solenv/bin/native-code.py
+++ b/solenv/bin/native-code.py
@@ -159,6 +159,8 @@ core_constructor_list = [
("com_sun_star_comp_extensions_SimpleTextFormatter", "#ifdef ANDROID"),
# filter/source/xmlfilterdetect/xmlfd.component
"filter_XMLFilterDetect_get_implementation",
+# filter/source/xmlfilteradaptor/xmlfa.component
+ "filter_XmlFilterAdaptor_get_implementation
# forms/util/frm.component
("com_sun_star_comp_forms_FormOperations_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),
("com_sun_star_comp_forms_ODatabaseForm_get_implementation", "#if HAVE_FEATURE_DBCONNECTIVITY"),