diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-08 09:50:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-07-08 20:26:28 +0200 |
commit | f4fc5dc31eeb728777104c9ece2788bcc4bdea89 (patch) | |
tree | 3d2be4743ac960bd6c5677e85e44b2e4ef284a07 | |
parent | d29a314300d523d29ed894f1822227497fcb68f8 (diff) |
unoxml: create instances with uno constructors
See tdf#74608 for motivation
Change-Id: I636d92faa3b26ac06c044c0485e632967daa709c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98313
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rwxr-xr-x | solenv/bin/native-code.py | 11 | ||||
-rw-r--r-- | unoxml/Library_unordf.mk | 1 | ||||
-rw-r--r-- | unoxml/Library_unoxml.mk | 1 | ||||
-rw-r--r-- | unoxml/source/dom/documentbuilder.cxx | 25 | ||||
-rw-r--r-- | unoxml/source/dom/documentbuilder.hxx | 7 | ||||
-rw-r--r-- | unoxml/source/dom/saxbuilder.cxx | 31 | ||||
-rw-r--r-- | unoxml/source/dom/saxbuilder.hxx | 11 | ||||
-rw-r--r-- | unoxml/source/rdf/CBlankNode.cxx | 29 | ||||
-rw-r--r-- | unoxml/source/rdf/CLiteral.cxx | 29 | ||||
-rw-r--r-- | unoxml/source/rdf/CNodes.hxx | 61 | ||||
-rw-r--r-- | unoxml/source/rdf/CURI.cxx | 30 | ||||
-rw-r--r-- | unoxml/source/rdf/librdf_repository.cxx | 27 | ||||
-rw-r--r-- | unoxml/source/rdf/librdf_repository.hxx | 39 | ||||
-rw-r--r-- | unoxml/source/rdf/librdf_services.cxx | 62 | ||||
-rw-r--r-- | unoxml/source/rdf/unordf.component | 11 | ||||
-rw-r--r-- | unoxml/source/service/services.cxx | 85 | ||||
-rw-r--r-- | unoxml/source/service/unoxml.component | 11 | ||||
-rw-r--r-- | unoxml/source/xpath/xpathapi.cxx | 34 | ||||
-rw-r--r-- | unoxml/source/xpath/xpathapi.hxx | 15 |
19 files changed, 88 insertions, 432 deletions
diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index b1bfc8903107..32972c8a7fae 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -40,8 +40,6 @@ core_factory_list = [ ("libucpfile1.a", "ucpfile_component_getFactory"), ("libucphier1.a", "ucphier1_component_getFactory"), ("libucptdoc1lo.a", "ucptdoc1_component_getFactory"), - ("libunordflo.a", "unordf_component_getFactory"), - ("libunoxmllo.a", "unoxml_component_getFactory"), ("libutllo.a", "utl_component_getFactory"), ("libxstor.a", "xstor_component_getFactory"), ("libxmlfdlo.a", "xmlfd_component_getFactory"), @@ -308,6 +306,15 @@ core_constructor_list = [ "stardiv_Toolkit_VCLXPointer_get_implementation", "stardiv_Toolkit_VCLXPopupMenu_get_implementation", "stardiv_Toolkit_VCLXToolkit_get_implementation", +# unoxml/source/rdf/unordf.component + "unoxml_rdfRepository_get_implementation", + "unoxml_CURI_get_implementation", + "unoxml_CLiteral_get_implementation", + "unoxml_CBlankNode_get_implementation", +# unoxml/source/service/unoxml.component + "unoxml_CXPathAPI_get_implementation", + "unoxml_CSAXDocumentBuilder_get_implementation", + "unoxml_CDocumentBuilder_get_implementation", # uui/util/uui.component "com_sun_star_comp_uui_UUIInteractionHandler_get_implementation", "com_sun_star_comp_uui_UUIInteractionRequestStringResolver_get_implementation", diff --git a/unoxml/Library_unordf.mk b/unoxml/Library_unordf.mk index 27640e70f0e4..8998c6aac73b 100644 --- a/unoxml/Library_unordf.mk +++ b/unoxml/Library_unordf.mk @@ -45,7 +45,6 @@ $(eval $(call gb_Library_add_exception_objects,unordf,\ unoxml/source/rdf/CURI \ unoxml/source/rdf/CLiteral \ unoxml/source/rdf/librdf_repository \ - unoxml/source/rdf/librdf_services \ )) # vim: set noet sw=4 ts=4: diff --git a/unoxml/Library_unoxml.mk b/unoxml/Library_unoxml.mk index 1d2202aa8839..34d9fe555e63 100644 --- a/unoxml/Library_unoxml.mk +++ b/unoxml/Library_unoxml.mk @@ -72,7 +72,6 @@ $(eval $(call gb_Library_add_exception_objects,unoxml,\ unoxml/source/events/mutationevent \ unoxml/source/events/uievent \ unoxml/source/events/mouseevent \ - unoxml/source/service/services \ )) $(eval $(call gb_Library_set_include,unoxml,\ diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx index 03f4b2a79e91..7eaa8095511f 100644 --- a/unoxml/source/dom/documentbuilder.cxx +++ b/unoxml/source/dom/documentbuilder.cxx @@ -96,28 +96,14 @@ namespace DOM xmlInitParser(); } - Reference< XInterface > CDocumentBuilder::_getInstance(const Reference< XMultiServiceFactory >& ) - { - return static_cast< XDocumentBuilder* >(new CDocumentBuilder); - } - - OUString CDocumentBuilder::_getImplementationName() - { - return "com.sun.star.comp.xml.dom.DocumentBuilder"; - } - Sequence<OUString> CDocumentBuilder::_getSupportedServiceNames() - { - return { "com.sun.star.xml.dom.DocumentBuilder" }; - } - Sequence< OUString > SAL_CALL CDocumentBuilder::getSupportedServiceNames() { - return CDocumentBuilder::_getSupportedServiceNames(); + return { "com.sun.star.xml.dom.DocumentBuilder" }; } OUString SAL_CALL CDocumentBuilder::getImplementationName() { - return CDocumentBuilder::_getImplementationName(); + return "com.sun.star.comp.xml.dom.DocumentBuilder"; } sal_Bool SAL_CALL CDocumentBuilder::supportsService(const OUString& aServiceName) @@ -442,4 +428,11 @@ namespace DOM } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +unoxml_CDocumentBuilder_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new DOM::CDocumentBuilder()); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/dom/documentbuilder.hxx b/unoxml/source/dom/documentbuilder.hxx index ee8b4044aae7..4c9af65b2b8a 100644 --- a/unoxml/source/dom/documentbuilder.hxx +++ b/unoxml/source/dom/documentbuilder.hxx @@ -57,13 +57,6 @@ namespace DOM // ctor explicit CDocumentBuilder(); - // static helpers for service info and component management - static OUString _getImplementationName(); - static css::uno::Sequence< OUString > _getSupportedServiceNames(); - static css::uno::Reference< XInterface > _getInstance( - css::uno::Reference< css::lang::XMultiServiceFactory > const& - rSMgr); - // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; diff --git a/unoxml/source/dom/saxbuilder.cxx b/unoxml/source/dom/saxbuilder.cxx index 6eda29124ba7..25686b21c4de 100644 --- a/unoxml/source/dom/saxbuilder.cxx +++ b/unoxml/source/dom/saxbuilder.cxx @@ -33,33 +33,19 @@ using namespace css::xml::sax; namespace DOM { - Reference< XInterface > CSAXDocumentBuilder::_getInstance(const Reference< XMultiServiceFactory >& rSMgr) - { - return static_cast< XSAXDocumentBuilder* >(new CSAXDocumentBuilder(rSMgr)); - } - - CSAXDocumentBuilder::CSAXDocumentBuilder(const Reference< XMultiServiceFactory >& mgr) - : m_aServiceManager(mgr) + CSAXDocumentBuilder::CSAXDocumentBuilder(const Reference< XComponentContext >& ctx) + : m_xContext(ctx) , m_aState( SAXDocumentBuilderState_READY) {} - OUString CSAXDocumentBuilder::_getImplementationName() - { - return "com.sun.star.comp.xml.dom.SAXDocumentBuilder"; - } - Sequence<OUString> CSAXDocumentBuilder::_getSupportedServiceNames() - { - return { "com.sun.star.xml.dom.SAXDocumentBuilder" }; - } - Sequence< OUString > SAL_CALL CSAXDocumentBuilder::getSupportedServiceNames() { - return CSAXDocumentBuilder::_getSupportedServiceNames(); + return { "com.sun.star.xml.dom.SAXDocumentBuilder" }; } OUString SAL_CALL CSAXDocumentBuilder::getImplementationName() { - return CSAXDocumentBuilder::_getImplementationName(); + return "com.sun.star.comp.xml.dom.SAXDocumentBuilder"; } sal_Bool SAL_CALL CSAXDocumentBuilder::supportsService(const OUString& aServiceName) @@ -144,7 +130,7 @@ namespace DOM if (m_aState != SAXDocumentBuilderState_READY) throw SAXException(); - Reference< XDocumentBuilder > aBuilder(DocumentBuilder::create(comphelper::getComponentContext(m_aServiceManager))); + Reference< XDocumentBuilder > aBuilder(DocumentBuilder::create(m_xContext)); Reference< XDocument > aDocument = aBuilder->newDocument(); m_aNodeStack.push(aDocument); m_aDocument = aDocument; @@ -349,4 +335,11 @@ namespace DOM } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +unoxml_CSAXDocumentBuilder_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new DOM::CSAXDocumentBuilder(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/dom/saxbuilder.hxx b/unoxml/source/dom/saxbuilder.hxx index c8ea4d9dc60a..2aa702787bf2 100644 --- a/unoxml/source/dom/saxbuilder.hxx +++ b/unoxml/source/dom/saxbuilder.hxx @@ -35,7 +35,7 @@ #include <com/sun/star/xml/dom/XDocumentFragment.hpp> #include <com/sun/star/xml/sax/XLocator.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> namespace DOM { @@ -45,7 +45,7 @@ namespace DOM private: ::osl::Mutex m_Mutex; - const css::uno::Reference< css::lang::XMultiServiceFactory > m_aServiceManager; + const css::uno::Reference< css::uno::XComponentContext> m_xContext; css::xml::dom::SAXDocumentBuilderState m_aState; std::stack< css::uno::Reference< css::xml::dom::XNode > > m_aNodeStack; @@ -55,12 +55,7 @@ namespace DOM public: - // static helpers for service info and component management - static OUString _getImplementationName(); - static css::uno::Sequence< OUString > _getSupportedServiceNames(); - static css::uno::Reference< XInterface > _getInstance(const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr); - - explicit CSAXDocumentBuilder(const css::uno::Reference< css::lang::XMultiServiceFactory >& mgr); + explicit CSAXDocumentBuilder(const css::uno::Reference< css::uno::XComponentContext >& ); static void setElementFastAttributes(const css::uno::Reference< css::xml::dom::XElement >& aElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttribs); diff --git a/unoxml/source/rdf/CBlankNode.cxx b/unoxml/source/rdf/CBlankNode.cxx index 44d0017bbe44..368102e511ab 100644 --- a/unoxml/source/rdf/CBlankNode.cxx +++ b/unoxml/source/rdf/CBlankNode.cxx @@ -17,13 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "CNodes.hxx" - #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/rdf/XBlankNode.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -65,7 +64,7 @@ CBlankNode::CBlankNode() : // com.sun.star.uno.XServiceInfo: OUString SAL_CALL CBlankNode::getImplementationName() { - return comp_CBlankNode::_getImplementationName(); + return "CBlankNode"; } sal_Bool SAL_CALL CBlankNode::supportsService(OUString const & serviceName) @@ -75,7 +74,7 @@ sal_Bool SAL_CALL CBlankNode::supportsService(OUString const & serviceName) css::uno::Sequence< OUString > SAL_CALL CBlankNode::getSupportedServiceNames() { - return comp_CBlankNode::_getSupportedServiceNames(); + return { "com.sun.star.rdf.BlankNode" }; } // css::lang::XInitialization: @@ -109,25 +108,11 @@ OUString SAL_CALL CBlankNode::getStringValue() } // closing anonymous implementation namespace -// component helper namespace -namespace comp_CBlankNode { - -OUString _getImplementationName() { - return "CBlankNode"; -} - -css::uno::Sequence< OUString > _getSupportedServiceNames() -{ - css::uno::Sequence< OUString > s { "com.sun.star.rdf.BlankNode" }; - return s; -} - -css::uno::Reference< css::uno::XInterface > _create( - const css::uno::Reference< css::uno::XComponentContext > & ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +unoxml_CBlankNode_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return static_cast< ::cppu::OWeakObject * >(new CBlankNode); + return cppu::acquire(new CBlankNode()); } -} // closing component helper namespace - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/rdf/CLiteral.cxx b/unoxml/source/rdf/CLiteral.cxx index 3c8672a64593..1b7297169cee 100644 --- a/unoxml/source/rdf/CLiteral.cxx +++ b/unoxml/source/rdf/CLiteral.cxx @@ -17,13 +17,12 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "CNodes.hxx" - #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/rdf/XLiteral.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -72,7 +71,7 @@ CLiteral::CLiteral() : // com.sun.star.uno.XServiceInfo: OUString SAL_CALL CLiteral::getImplementationName() { - return comp_CLiteral::_getImplementationName(); + return "CLiteral"; } sal_Bool SAL_CALL CLiteral::supportsService(OUString const & serviceName) @@ -82,7 +81,7 @@ sal_Bool SAL_CALL CLiteral::supportsService(OUString const & serviceName) css::uno::Sequence< OUString > SAL_CALL CLiteral::getSupportedServiceNames() { - return comp_CLiteral::_getSupportedServiceNames(); + return { "com.sun.star.rdf.Literal" }; } // css::lang::XInitialization: @@ -158,25 +157,11 @@ css::uno::Reference< css::rdf::XURI > SAL_CALL CLiteral::getDatatype() } // closing anonymous implementation namespace - -// component helper namespace -namespace comp_CLiteral { - -OUString _getImplementationName() { - return "CLiteral"; -} - -css::uno::Sequence< OUString > _getSupportedServiceNames() -{ - return { "com.sun.star.rdf.Literal" }; -} - -css::uno::Reference< css::uno::XInterface > _create( - const css::uno::Reference< css::uno::XComponentContext > & ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +unoxml_CLiteral_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return static_cast< ::cppu::OWeakObject * >(new CLiteral); + return cppu::acquire(new CLiteral()); } -} // closing component helper namespace - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/rdf/CNodes.hxx b/unoxml/source/rdf/CNodes.hxx deleted file mode 100644 index 3ee915697c75..000000000000 --- a/unoxml/source/rdf/CNodes.hxx +++ /dev/null @@ -1,61 +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_UNOXML_SOURCE_RDF_CNODES_HXX -#define INCLUDED_UNOXML_SOURCE_RDF_CNODES_HXX - -#include <sal/config.h> -#include <cppuhelper/factory.hxx> - - -// component helper namespace -namespace comp_CBlankNode { - -// component and service helper functions: -OUString _getImplementationName(); -css::uno::Sequence< OUString > _getSupportedServiceNames(); -css::uno::Reference< css::uno::XInterface > _create( css::uno::Reference< css::uno::XComponentContext > const & context ); - -} // closing component helper namespace - - -// component helper namespace -namespace comp_CURI { - -// component and service helper functions: -OUString _getImplementationName(); -css::uno::Sequence< OUString > _getSupportedServiceNames(); -css::uno::Reference< css::uno::XInterface > _create( css::uno::Reference< css::uno::XComponentContext > const & context ); - -} // closing component helper namespace - - -// component helper namespace -namespace comp_CLiteral { - -// component and service helper functions: -OUString _getImplementationName(); -css::uno::Sequence< OUString > _getSupportedServiceNames(); -css::uno::Reference< css::uno::XInterface > _create( css::uno::Reference< css::uno::XComponentContext > const & context ); - -} // closing component helper namespace - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/rdf/CURI.cxx b/unoxml/source/rdf/CURI.cxx index bacc42697e1a..0a154d037f8e 100644 --- a/unoxml/source/rdf/CURI.cxx +++ b/unoxml/source/rdf/CURI.cxx @@ -17,14 +17,13 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "CNodes.hxx" - #include <cppuhelper/implbase.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> #include <com/sun/star/rdf/XURI.hpp> #include <com/sun/star/rdf/URIs.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> @@ -74,7 +73,7 @@ CURI::CURI() : // com.sun.star.uno.XServiceInfo: OUString SAL_CALL CURI::getImplementationName() { - return comp_CURI::_getImplementationName(); + return "CURI"; } sal_Bool SAL_CALL CURI::supportsService(OUString const & serviceName) @@ -84,7 +83,7 @@ sal_Bool SAL_CALL CURI::supportsService(OUString const & serviceName) css::uno::Sequence< OUString > SAL_CALL CURI::getSupportedServiceNames() { - return comp_CURI::_getSupportedServiceNames(); + return { "com.sun.star.rdf.URI" }; } const char s_nsXSD [] = "http://www.w3.org/2001/XMLSchema-datatypes#"; @@ -792,26 +791,11 @@ OUString SAL_CALL CURI::getLocalName() } // closing anonymous implementation namespace -// component helper namespace -namespace comp_CURI { - -OUString _getImplementationName() { - return - "CURI"; -} - -css::uno::Sequence< OUString > _getSupportedServiceNames() -{ - css::uno::Sequence< OUString > s { "com.sun.star.rdf.URI" }; - return s; -} - -css::uno::Reference< css::uno::XInterface > _create( - const css::uno::Reference< css::uno::XComponentContext > & ) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +unoxml_CURI_get_implementation( + css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&) { - return static_cast< ::cppu::OWeakObject * >(new CURI); + return cppu::acquire(new CURI()); } -} // closing component helper namespace - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 3c14bb4056ee..519ec4a5fd26 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -17,8 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "librdf_repository.hxx" - #include <string.h> #include <map> @@ -911,7 +909,7 @@ librdf_Repository::~librdf_Repository() // com.sun.star.uno.XServiceInfo: OUString SAL_CALL librdf_Repository::getImplementationName() { - return comp_librdf_Repository::_getImplementationName(); + return "librdf_Repository"; } sal_Bool SAL_CALL librdf_Repository::supportsService( @@ -923,7 +921,7 @@ sal_Bool SAL_CALL librdf_Repository::supportsService( uno::Sequence< OUString > SAL_CALL librdf_Repository::getSupportedServiceNames() { - return comp_librdf_Repository::_getSupportedServiceNames(); + return { "com.sun.star.rdf.Repository" }; } // css::rdf::XRepository: @@ -2455,24 +2453,11 @@ librdf_TypeConverter::convertToStatement(librdf_statement* i_pStmt, } // closing anonymous implementation namespace -// component helper namespace -namespace comp_librdf_Repository { - -OUString _getImplementationName() { - return "librdf_Repository"; -} - -uno::Sequence< OUString > _getSupportedServiceNames() -{ - return { "com.sun.star.rdf.Repository" }; -} - -uno::Reference< uno::XInterface > _create( - const uno::Reference< uno::XComponentContext > & context) +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +unoxml_rdfRepository_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) { - return static_cast< ::cppu::OWeakObject * >(new librdf_Repository(context)); + return cppu::acquire(new librdf_Repository(context)); } -} // closing component helper namespace - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/rdf/librdf_repository.hxx b/unoxml/source/rdf/librdf_repository.hxx deleted file mode 100644 index 2f67490d495b..000000000000 --- a/unoxml/source/rdf/librdf_repository.hxx +++ /dev/null @@ -1,39 +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_UNOXML_SOURCE_RDF_LIBRDF_REPOSITORY_HXX -#define INCLUDED_UNOXML_SOURCE_RDF_LIBRDF_REPOSITORY_HXX - -#include <sal/config.h> -#include <cppuhelper/factory.hxx> - - -// component helper namespace -namespace comp_librdf_Repository { - -// component and service helper functions: -OUString _getImplementationName(); -css::uno::Sequence< OUString > _getSupportedServiceNames(); -css::uno::Reference< css::uno::XInterface > _create( css::uno::Reference< css::uno::XComponentContext > const & context ); - -} // closing component helper namespace - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/rdf/librdf_services.cxx b/unoxml/source/rdf/librdf_services.cxx deleted file mode 100644 index 318bc9b8fb3a..000000000000 --- a/unoxml/source/rdf/librdf_services.cxx +++ /dev/null @@ -1,62 +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 <cppuhelper/implementationentry.hxx> - -#include "CNodes.hxx" -#include "librdf_repository.hxx" - - -using namespace ::com::sun::star; - - -extern "C" -{ - -::cppu::ImplementationEntry const entries[] = { - { &comp_CBlankNode::_create, - &comp_CBlankNode::_getImplementationName, - &comp_CBlankNode::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, nullptr, 0 }, - { &comp_CURI::_create, - &comp_CURI::_getImplementationName, - &comp_CURI::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, nullptr, 0 }, - { &comp_CLiteral::_create, - &comp_CLiteral::_getImplementationName, - &comp_CLiteral::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, nullptr, 0 }, - { &comp_librdf_Repository::_create, - &comp_librdf_Repository::_getImplementationName, - &comp_librdf_Repository::_getSupportedServiceNames, - &::cppu::createSingleComponentFactory, nullptr, 0 }, - { nullptr, nullptr, nullptr, nullptr, nullptr, 0 } -}; - -SAL_DLLPUBLIC_EXPORT void * unordf_component_getFactory( - const char * implName, void * serviceManager, void * registryKey) -{ - return ::cppu::component_getFactoryHelper( - implName, serviceManager, registryKey, entries); -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/rdf/unordf.component b/unoxml/source/rdf/unordf.component index 094534153924..1b99b5786c09 100644 --- a/unoxml/source/rdf/unordf.component +++ b/unoxml/source/rdf/unordf.component @@ -18,17 +18,18 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="unordf" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="CBlankNode"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="CBlankNode" constructor="unoxml_CBlankNode_get_implementation"> <service name="com.sun.star.rdf.BlankNode"/> </implementation> - <implementation name="CLiteral"> + <implementation name="CLiteral" constructor="unoxml_CLiteral_get_implementation"> <service name="com.sun.star.rdf.Literal"/> </implementation> - <implementation name="CURI"> + <implementation name="CURI" constructor="unoxml_CURI_get_implementation"> <service name="com.sun.star.rdf.URI"/> </implementation> - <implementation name="librdf_Repository"> + <implementation name="librdf_Repository" + constructor="unoxml_rdfRepository_get_implementation"> <service name="com.sun.star.rdf.Repository"/> </implementation> </component> diff --git a/unoxml/source/service/services.cxx b/unoxml/source/service/services.cxx deleted file mode 100644 index 8863b634346b..000000000000 --- a/unoxml/source/service/services.cxx +++ /dev/null @@ -1,85 +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 <rtl/ustring.hxx> -#include <com/sun/star/uno/Reference.h> -#include <com/sun/star/uno/Reference.hxx> -#include <cppuhelper/factory.hxx> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> - -#include "../dom/documentbuilder.hxx" -#include "../dom/saxbuilder.hxx" -#include "../xpath/xpathapi.hxx" - -using namespace ::DOM; -using namespace ::XPath; -using namespace css::uno; -using namespace css::lang; -using namespace css::registry; - -extern "C" -{ - -SAL_DLLPUBLIC_EXPORT void* unoxml_component_getFactory(const char *pImplementationName, void *pServiceManager, void * /*pRegistryKey*/) -{ - void* pReturn = nullptr ; - if ( pImplementationName && pServiceManager ) - { - // Define variables which are used in following macros. - Reference< XSingleServiceFactory > xFactory; - Reference< XMultiServiceFactory > xServiceManager( - static_cast< XMultiServiceFactory* >(pServiceManager)); - - if (CDocumentBuilder::_getImplementationName().equalsAscii( pImplementationName ) ) - { - xFactory.set( - cppu::createOneInstanceFactory( - xServiceManager, CDocumentBuilder::_getImplementationName(), - CDocumentBuilder::_getInstance, CDocumentBuilder::_getSupportedServiceNames())); - } - else if (CSAXDocumentBuilder::_getImplementationName().equalsAscii( pImplementationName ) ) - { - xFactory.set( - cppu::createSingleFactory( - xServiceManager, CSAXDocumentBuilder::_getImplementationName(), - CSAXDocumentBuilder::_getInstance, CSAXDocumentBuilder::_getSupportedServiceNames())); - } - else if (CXPathAPI::_getImplementationName().equalsAscii( pImplementationName ) ) - { - xFactory.set( - cppu::createSingleFactory( - xServiceManager, CXPathAPI::_getImplementationName(), - CXPathAPI::_getInstance, CXPathAPI::_getSupportedServiceNames())); - } - - // Factory is valid - service was found. - if ( xFactory.is() ) - { - xFactory->acquire(); - pReturn = xFactory.get(); - } - } - - // Return with result of this operation. - return pReturn ; -} - -} // extern "C" - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/service/unoxml.component b/unoxml/source/service/unoxml.component index 17d9c5203a6a..6591bde6a70e 100644 --- a/unoxml/source/service/unoxml.component +++ b/unoxml/source/service/unoxml.component @@ -18,14 +18,17 @@ --> <component loader="com.sun.star.loader.SharedLibrary" environment="@CPPU_ENV@" - prefix="unoxml" xmlns="http://openoffice.org/2010/uno-components"> - <implementation name="com.sun.star.comp.xml.dom.DocumentBuilder"> + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="com.sun.star.comp.xml.dom.DocumentBuilder" + constructor="unoxml_CDocumentBuilder_get_implementation"> <service name="com.sun.star.xml.dom.DocumentBuilder"/> </implementation> - <implementation name="com.sun.star.comp.xml.dom.SAXDocumentBuilder"> + <implementation name="com.sun.star.comp.xml.dom.SAXDocumentBuilder" + constructor="unoxml_CSAXDocumentBuilder_get_implementation"> <service name="com.sun.star.xml.dom.SAXDocumentBuilder"/> </implementation> - <implementation name="com.sun.star.comp.xml.xpath.XPathAPI"> + <implementation name="com.sun.star.comp.xml.xpath.XPathAPI" + constructor="unoxml_CXPathAPI_get_implementation"> <service name="com.sun.star.xml.xpath.XPathAPI"/> </implementation> </component> diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx index d36aa1164437..d6698c98a117 100644 --- a/unoxml/source/xpath/xpathapi.cxx +++ b/unoxml/source/xpath/xpathapi.cxx @@ -44,40 +44,23 @@ using namespace css::io; using namespace css::uno; using namespace css::xml::dom; using namespace css::xml::xpath; -using css::lang::XMultiServiceFactory; namespace XPath { - // factory - Reference< XInterface > CXPathAPI::_getInstance(const Reference< XMultiServiceFactory >& rSMgr) - { - return static_cast<XXPathAPI*>(new CXPathAPI(rSMgr)); - } - // ctor - CXPathAPI::CXPathAPI(const Reference< XMultiServiceFactory >& rSMgr) - : m_aFactory(rSMgr) - { - } - - OUString CXPathAPI::_getImplementationName() - { - return "com.sun.star.comp.xml.xpath.XPathAPI"; - } - - Sequence<OUString> CXPathAPI::_getSupportedServiceNames() + CXPathAPI::CXPathAPI(const Reference< XComponentContext >& rxContext) + : m_xContext(rxContext) { - return { "com.sun.star.xml.xpath.XPathAPI" }; } Sequence< OUString > SAL_CALL CXPathAPI::getSupportedServiceNames() { - return CXPathAPI::_getSupportedServiceNames(); + return { "com.sun.star.xml.xpath.XPathAPI" }; } OUString SAL_CALL CXPathAPI::getImplementationName() { - return CXPathAPI::_getImplementationName(); + return "com.sun.star.comp.xml.xpath.XPathAPI"; } sal_Bool SAL_CALL CXPathAPI::supportsService(const OUString& aServiceName) @@ -386,7 +369,7 @@ namespace XPath // get extension from service manager Reference< XXPathExtension > const xExtension( - m_aFactory->createInstance(aName), UNO_QUERY_THROW); + m_xContext->getServiceManager()->createInstanceWithContext(aName, m_xContext), UNO_QUERY_THROW); m_extensions.push_back(xExtension); } @@ -405,4 +388,11 @@ namespace XPath } } +extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* +unoxml_CXPathAPI_get_implementation( + css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&) +{ + return cppu::acquire(new XPath::CXPathAPI(context)); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/unoxml/source/xpath/xpathapi.hxx b/unoxml/source/xpath/xpathapi.hxx index 77cf0dba7660..91d5c4b78750 100644 --- a/unoxml/source/xpath/xpathapi.hxx +++ b/unoxml/source/xpath/xpathapi.hxx @@ -37,7 +37,7 @@ #include <com/sun/star/xml/xpath/XXPathObject.hpp> #include <com/sun/star/xml/xpath/XXPathExtension.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> namespace XPath { @@ -56,21 +56,12 @@ namespace XPath private: ::osl::Mutex m_Mutex; nsmap_t m_nsmap; - const css::uno::Reference< css::lang::XMultiServiceFactory > m_aFactory; + const css::uno::Reference< css::uno::XComponentContext > m_xContext; extensions_t m_extensions; public: // ctor - explicit CXPathAPI( - const css::uno::Reference< css::lang::XMultiServiceFactory >& - rSMgr); - - // static helpers for service info and component management - static OUString _getImplementationName(); - static css::uno::Sequence< OUString > _getSupportedServiceNames(); - static css::uno::Reference< XInterface > _getInstance( - const css::uno::Reference< css::lang::XMultiServiceFactory >& - rSMgr); + explicit CXPathAPI( const css::uno::Reference< css::uno::XComponentContext >& ); // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; |