/src/libreoffice/unoxml/source/dom/element.hxx
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #pragma once |
21 | | |
22 | | #include <libxml/tree.h> |
23 | | |
24 | | #include <com/sun/star/uno/Reference.h> |
25 | | #include <com/sun/star/xml/dom/XNode.hpp> |
26 | | #include <com/sun/star/xml/dom/XNodeList.hpp> |
27 | | #include <com/sun/star/xml/dom/XNamedNodeMap.hpp> |
28 | | #include <com/sun/star/xml/dom/NodeType.hpp> |
29 | | |
30 | | #include <cppuhelper/implbase.hxx> |
31 | | #include <node.hxx> |
32 | | |
33 | | namespace DOM |
34 | | { |
35 | | typedef ::cppu::ImplInheritanceHelper<CNode, css::xml::dom::XElement > CElement_Base; |
36 | | |
37 | | class CElement |
38 | | : public CElement_Base |
39 | | { |
40 | | private: |
41 | | friend class CDocument; |
42 | | |
43 | | css::uno::Reference< css::xml::dom::XAttr > setAttributeNode_Impl_Lock( |
44 | | css::uno::Reference< css::xml::dom::XAttr > const& xNewAttr, bool const bNS); |
45 | | |
46 | | protected: |
47 | | CElement(CDocument const& rDocument, ::osl::Mutex const& rMutex, |
48 | | xmlNodePtr const pNode); |
49 | | |
50 | | public: |
51 | | |
52 | | virtual void saxify(const css::uno::Reference< css::xml::sax::XDocumentHandler >& i_xHandler) override; |
53 | | |
54 | | virtual void fastSaxify( Context& i_rContext ) override; |
55 | | |
56 | | virtual bool IsChildTypeAllowed(css::xml::dom::NodeType const nodeType, |
57 | | css::xml::dom::NodeType const*) override; |
58 | | |
59 | | /** |
60 | | Retrieves an attribute value by name. |
61 | | */ |
62 | | virtual OUString SAL_CALL getAttribute(const OUString& name) override; |
63 | | |
64 | | /** |
65 | | Retrieves an attribute node by name. |
66 | | */ |
67 | | virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNode(const OUString& name) override; |
68 | | |
69 | | /** |
70 | | Retrieves an Attr node by local name and namespace URI. |
71 | | */ |
72 | | virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNodeNS(const OUString& namespaceURI, const OUString& localName) override; |
73 | | |
74 | | /** |
75 | | Retrieves an attribute value by local name and namespace URI. |
76 | | */ |
77 | | virtual OUString SAL_CALL getAttributeNS(const OUString& namespaceURI, const OUString& localName) override; |
78 | | |
79 | | /** |
80 | | Returns a NodeList of all descendant Elements with a given tag name, |
81 | | in the order in which they are |
82 | | encountered in a preorder traversal of this Element tree. |
83 | | */ |
84 | | virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagName(const OUString& name) override; |
85 | | |
86 | | /** |
87 | | Returns a NodeList of all the descendant Elements with a given local |
88 | | name and namespace URI in the order in which they are encountered in |
89 | | a preorder traversal of this Element tree. |
90 | | */ |
91 | | virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagNameNS(const OUString& namespaceURI, |
92 | | const OUString& localName) override; |
93 | | |
94 | | /** |
95 | | The name of the element. |
96 | | */ |
97 | | virtual OUString SAL_CALL getTagName() override; |
98 | | |
99 | | /** |
100 | | Returns true when an attribute with a given name is specified on this |
101 | | element or has a default value, false otherwise. |
102 | | */ |
103 | | virtual sal_Bool SAL_CALL hasAttribute(const OUString& name) override; |
104 | | |
105 | | /** |
106 | | Returns true when an attribute with a given local name and namespace |
107 | | URI is specified on this element or has a default value, false otherwise. |
108 | | */ |
109 | | virtual sal_Bool SAL_CALL hasAttributeNS(const OUString& namespaceURI, const OUString& localName) override; |
110 | | |
111 | | /** |
112 | | Removes an attribute by name. |
113 | | */ |
114 | | virtual void SAL_CALL removeAttribute(const OUString& name) override; |
115 | | |
116 | | /** |
117 | | Removes the specified attribute node. |
118 | | */ |
119 | | virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL removeAttributeNode(const css::uno::Reference< css::xml::dom::XAttr >& oldAttr) override; |
120 | | |
121 | | /** |
122 | | Removes an attribute by local name and namespace URI. |
123 | | */ |
124 | | virtual void SAL_CALL removeAttributeNS(const OUString& namespaceURI, const OUString& localName) override; |
125 | | |
126 | | /** |
127 | | Adds a new attribute. |
128 | | */ |
129 | | virtual void SAL_CALL setAttribute(const OUString& name, const OUString& value) override; |
130 | | |
131 | | /** |
132 | | Adds a new attribute node. |
133 | | */ |
134 | | virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNode(const css::uno::Reference< css::xml::dom::XAttr >& newAttr) override; |
135 | | |
136 | | /** |
137 | | Adds a new attribute. |
138 | | */ |
139 | | virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNodeNS(const css::uno::Reference< css::xml::dom::XAttr >& newAttr) override; |
140 | | |
141 | | /** |
142 | | Adds a new attribute. |
143 | | */ |
144 | | virtual void SAL_CALL setAttributeNS( |
145 | | const OUString& namespaceURI, const OUString& qualifiedName, const OUString& value) override; |
146 | | |
147 | | // overrides for XNode base |
148 | | virtual OUString SAL_CALL getNodeName() override; |
149 | | virtual OUString SAL_CALL getNodeValue() override; |
150 | | virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes() override; |
151 | | virtual OUString SAL_CALL getLocalName() override; |
152 | | |
153 | | // resolve uno inheritance problems... |
154 | | // --- delegation for XNode base. |
155 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL appendChild(const css::uno::Reference< css::xml::dom::XNode >& newChild) override |
156 | 3.31M | { |
157 | 3.31M | return CNode::appendChild(newChild); |
158 | 3.31M | } |
159 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep) override |
160 | 0 | { |
161 | 0 | return CNode::cloneNode(deep); |
162 | 0 | } |
163 | | virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes() override |
164 | 6.69M | { |
165 | 6.69M | return CNode::getChildNodes(); |
166 | 6.69M | } |
167 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild() override |
168 | 86.7k | { |
169 | 86.7k | return CNode::getFirstChild(); |
170 | 86.7k | } |
171 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild() override |
172 | 0 | { |
173 | 0 | return CNode::getLastChild(); |
174 | 0 | } |
175 | | virtual OUString SAL_CALL getNamespaceURI() override |
176 | 143k | { |
177 | 143k | return CNode::getNamespaceURI(); |
178 | 143k | } |
179 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling() override |
180 | 0 | { |
181 | 0 | return CNode::getNextSibling(); |
182 | 0 | } |
183 | | virtual css::xml::dom::NodeType SAL_CALL getNodeType() override |
184 | 431k | { |
185 | 431k | return CNode::getNodeType(); |
186 | 431k | } |
187 | | virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument() override |
188 | 36.9k | { |
189 | 36.9k | return CNode::getOwnerDocument(); |
190 | 36.9k | } |
191 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode() override |
192 | 18.4k | { |
193 | 18.4k | return CNode::getParentNode(); |
194 | 18.4k | } |
195 | | virtual OUString SAL_CALL getPrefix() override |
196 | 431k | { |
197 | 431k | return CNode::getPrefix(); |
198 | 431k | } |
199 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling() override |
200 | 0 | { |
201 | 0 | return CNode::getPreviousSibling(); |
202 | 0 | } |
203 | | virtual sal_Bool SAL_CALL hasAttributes() override |
204 | 0 | { |
205 | 0 | return CNode::hasAttributes(); |
206 | 0 | } |
207 | | virtual sal_Bool SAL_CALL hasChildNodes() override |
208 | 0 | { |
209 | 0 | return CNode::hasChildNodes(); |
210 | 0 | } |
211 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore( |
212 | | const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& refChild) override |
213 | 0 | { |
214 | 0 | return CNode::insertBefore(newChild, refChild); |
215 | 0 | } |
216 | | virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver) override |
217 | 0 | { |
218 | 0 | return CNode::isSupported(feature, ver); |
219 | 0 | } |
220 | | virtual void SAL_CALL normalize() override |
221 | 0 | { |
222 | 0 | CNode::normalize(); |
223 | 0 | } |
224 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode >& oldChild) override |
225 | 18.4k | { |
226 | 18.4k | return CNode::removeChild(oldChild); |
227 | 18.4k | } |
228 | | virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild( |
229 | | const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& oldChild) override |
230 | 0 | { |
231 | 0 | return CNode::replaceChild(newChild, oldChild); |
232 | 0 | } |
233 | | virtual void SAL_CALL setNodeValue(const OUString& nodeValue) override |
234 | 0 | { |
235 | 0 | return CNode::setNodeValue(nodeValue); |
236 | 0 | } |
237 | | virtual void SAL_CALL setPrefix(const OUString& prefix) override |
238 | 0 | { |
239 | 0 | return CNode::setPrefix(prefix); |
240 | 0 | } |
241 | | |
242 | | }; |
243 | | |
244 | | } |
245 | | |
246 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |