Bump version to 6.4-15
[LibreOffice.git] / unoxml / source / xpath / xpathapi.hxx
blob1bc99b50a762518b982896270946b6cb843114a4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_UNOXML_SOURCE_XPATH_XPATHAPI_HXX
21 #define INCLUDED_UNOXML_SOURCE_XPATH_XPATHAPI_HXX
23 #include <map>
24 #include <vector>
26 #include <sal/types.h>
28 #include <cppuhelper/implbase.hxx>
30 #include <com/sun/star/uno/Reference.h>
31 #include <com/sun/star/uno/Sequence.h>
33 #include <com/sun/star/uno/XInterface.hpp>
34 #include <com/sun/star/uno/Exception.hpp>
35 #include <com/sun/star/xml/xpath/XXPathAPI.hpp>
36 #include <com/sun/star/xml/dom/XNode.hpp>
37 #include <com/sun/star/xml/dom/XNodeList.hpp>
38 #include <com/sun/star/xml/xpath/XXPathObject.hpp>
39 #include <com/sun/star/xml/xpath/XXPathExtension.hpp>
40 #include <com/sun/star/xml/xpath/Libxml2ExtensionHandle.hpp>
41 #include <com/sun/star/xml/xpath/XPathException.hpp>
42 #include <com/sun/star/lang/XServiceInfo.hpp>
43 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
44 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 namespace XPath
48 typedef std::map<OUString, OUString> nsmap_t;
49 typedef std::vector< css::uno::Reference<css::xml::xpath::XXPathExtension> > extensions_t;
51 typedef ::cppu::WeakImplHelper
52 < css::xml::xpath::XXPathAPI
53 , css::lang::XServiceInfo
54 > CXPathAPI_Base;
56 class CXPathAPI
57 : public CXPathAPI_Base
60 private:
61 ::osl::Mutex m_Mutex;
62 nsmap_t m_nsmap;
63 const css::uno::Reference< css::lang::XMultiServiceFactory > m_aFactory;
64 extensions_t m_extensions;
66 public:
67 // ctor
68 explicit CXPathAPI(
69 const css::uno::Reference< css::lang::XMultiServiceFactory >&
70 rSMgr);
72 // static helpers for service info and component management
73 static OUString _getImplementationName();
74 static css::uno::Sequence< OUString > _getSupportedServiceNames();
75 static css::uno::Reference< XInterface > _getInstance(
76 const css::uno::Reference< css::lang::XMultiServiceFactory >&
77 rSMgr);
79 // XServiceInfo
80 virtual OUString SAL_CALL getImplementationName() override;
81 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
85 // --- XXPathAPI ---
87 virtual void SAL_CALL registerNS(const OUString& aPrefix, const OUString& aURI) override;
89 virtual void SAL_CALL unregisterNS(const OUString& aPrefix, const OUString& aURI) override;
91 /**
92 Use an XPath string to select a nodelist.
94 virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL selectNodeList(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str) override;
96 /**
97 Use an XPath string to select a nodelist.
99 virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL selectNodeListNS(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str, const css::uno::Reference< css::xml::dom::XNode >& namespaceNode) override;
102 Use an XPath string to select a single node.
104 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL selectSingleNode(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str) override;
107 Use an XPath string to select a single node.
109 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL selectSingleNodeNS(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str, const css::uno::Reference< css::xml::dom::XNode >& namespaceNode) override;
111 virtual css::uno::Reference< css::xml::xpath::XXPathObject > SAL_CALL eval(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str) override;
113 virtual css::uno::Reference< css::xml::xpath::XXPathObject > SAL_CALL evalNS(const css::uno::Reference< css::xml::dom::XNode >& contextNode, const OUString& str, const css::uno::Reference< css::xml::dom::XNode >& namespaceNode) override;
115 virtual void SAL_CALL registerExtension(const OUString& aName) override;
116 virtual void SAL_CALL registerExtensionInstance(const css::uno::Reference< css::xml::xpath::XXPathExtension>& aExtension) override;
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */