Branch data Line data Source code
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 : : #ifndef DOM_ELEMENT_HXX
21 : : #define DOM_ELEMENT_HXX
22 : :
23 : : #include <libxml/tree.h>
24 : :
25 : : #include <com/sun/star/uno/Reference.h>
26 : : #include <com/sun/star/xml/dom/XNode.hpp>
27 : : #include <com/sun/star/xml/dom/XNodeList.hpp>
28 : : #include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
29 : : #include <com/sun/star/xml/dom/NodeType.hpp>
30 : :
31 : : #include <node.hxx>
32 : :
33 : :
34 : : using ::rtl::OUString;
35 : : using namespace com::sun::star::uno;
36 : : using namespace com::sun::star::xml::dom;
37 : :
38 : : namespace DOM
39 : : {
40 : : typedef ::cppu::ImplInheritanceHelper1<CNode, XElement > CElement_Base;
41 : :
42 [ - + ]: 215486 : class CElement
43 : : : public CElement_Base
44 : : {
45 : : private:
46 : : friend class CDocument;
47 : :
48 : : Reference< XAttr > setAttributeNode_Impl_Lock(
49 : : Reference< XAttr > const& xNewAttr, bool const bNS);
50 : :
51 : : protected:
52 : : CElement(CDocument const& rDocument, ::osl::Mutex const& rMutex,
53 : : xmlNodePtr const pNode);
54 : :
55 : : public:
56 : :
57 : : virtual void saxify(const Reference< XDocumentHandler >& i_xHandler);
58 : :
59 : : virtual void fastSaxify( Context& i_rContext );
60 : :
61 : : virtual bool IsChildTypeAllowed(NodeType const nodeType);
62 : :
63 : : /**
64 : : Retrieves an attribute value by name.
65 : : */
66 : : virtual OUString SAL_CALL getAttribute(const OUString& name)
67 : : throw (RuntimeException);
68 : :
69 : : /**
70 : : Retrieves an attribute node by name.
71 : : */
72 : : virtual Reference< XAttr > SAL_CALL getAttributeNode(const OUString& name)
73 : : throw (RuntimeException);
74 : :
75 : : /**
76 : : Retrieves an Attr node by local name and namespace URI.
77 : : */
78 : : virtual Reference< XAttr > SAL_CALL getAttributeNodeNS(const OUString& namespaceURI, const OUString& localName)
79 : : throw (RuntimeException);
80 : :
81 : : /**
82 : : Retrieves an attribute value by local name and namespace URI.
83 : : */
84 : : virtual OUString SAL_CALL getAttributeNS(const OUString& namespaceURI, const OUString& localName)
85 : : throw (RuntimeException);
86 : :
87 : : /**
88 : : Returns a NodeList of all descendant Elements with a given tag name,
89 : : in the order in which they are
90 : : encountered in a preorder traversal of this Element tree.
91 : : */
92 : : virtual Reference< XNodeList > SAL_CALL getElementsByTagName(const OUString& name)
93 : : throw (RuntimeException);
94 : :
95 : : /**
96 : : Returns a NodeList of all the descendant Elements with a given local
97 : : name and namespace URI in the order in which they are encountered in
98 : : a preorder traversal of this Element tree.
99 : : */
100 : : virtual Reference< XNodeList > SAL_CALL getElementsByTagNameNS(const OUString& namespaceURI,
101 : : const OUString& localName)
102 : : throw (RuntimeException);
103 : :
104 : : /**
105 : : The name of the element.
106 : : */
107 : : virtual OUString SAL_CALL getTagName()
108 : : throw (RuntimeException);
109 : :
110 : : /**
111 : : Returns true when an attribute with a given name is specified on this
112 : : element or has a default value, false otherwise.
113 : : */
114 : : virtual sal_Bool SAL_CALL hasAttribute(const OUString& name)
115 : : throw (RuntimeException);
116 : :
117 : : /**
118 : : Returns true when an attribute with a given local name and namespace
119 : : URI is specified on this element or has a default value, false otherwise.
120 : : */
121 : : virtual sal_Bool SAL_CALL hasAttributeNS(const OUString& namespaceURI, const OUString& localName)
122 : : throw (RuntimeException);
123 : :
124 : : /**
125 : : Removes an attribute by name.
126 : : */
127 : : virtual void SAL_CALL removeAttribute(const OUString& name)
128 : : throw (RuntimeException, DOMException);
129 : :
130 : : /**
131 : : Removes the specified attribute node.
132 : : */
133 : : virtual Reference< XAttr > SAL_CALL removeAttributeNode(const Reference< XAttr >& oldAttr)
134 : : throw (RuntimeException, DOMException);
135 : :
136 : : /**
137 : : Removes an attribute by local name and namespace URI.
138 : : */
139 : : virtual void SAL_CALL removeAttributeNS(const OUString& namespaceURI, const OUString& localName)
140 : : throw (RuntimeException, DOMException);
141 : :
142 : : /**
143 : : Adds a new attribute.
144 : : */
145 : : virtual void SAL_CALL setAttribute(const OUString& name, const OUString& value)
146 : : throw (RuntimeException, DOMException);
147 : :
148 : : /**
149 : : Adds a new attribute node.
150 : : */
151 : : virtual Reference< XAttr > SAL_CALL setAttributeNode(const Reference< XAttr >& newAttr)
152 : : throw (RuntimeException, DOMException);
153 : :
154 : : /**
155 : : Adds a new attribute.
156 : : */
157 : : virtual Reference< XAttr > SAL_CALL setAttributeNodeNS(const Reference< XAttr >& newAttr)
158 : : throw (RuntimeException, DOMException);
159 : :
160 : : /**
161 : : Adds a new attribute.
162 : : */
163 : : virtual void SAL_CALL setAttributeNS(
164 : : const OUString& namespaceURI, const OUString& qualifiedName, const OUString& value)
165 : : throw (RuntimeException, DOMException);
166 : :
167 : : /**
168 : : sets the element name
169 : : */
170 : : virtual void SAL_CALL setElementName(const OUString& elementName)
171 : : throw (RuntimeException, DOMException);
172 : :
173 : : // overrides for XNode base
174 : : virtual OUString SAL_CALL getNodeName()
175 : : throw (RuntimeException);
176 : : virtual OUString SAL_CALL getNodeValue()
177 : : throw (RuntimeException);
178 : : virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
179 : : throw (RuntimeException);
180 : : virtual OUString SAL_CALL getLocalName()
181 : : throw (RuntimeException);
182 : :
183 : : // resolve uno inheritance problems...
184 : : // --- delegation for XNde base.
185 : 37271 : virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
186 : : throw (RuntimeException, DOMException)
187 : : {
188 : 37271 : return CNode::appendChild(newChild);
189 : : }
190 : 4 : virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
191 : : throw (RuntimeException)
192 : : {
193 : 4 : return CNode::cloneNode(deep);
194 : : }
195 : 4 : virtual Reference< XNodeList > SAL_CALL getChildNodes()
196 : : throw (RuntimeException)
197 : : {
198 : 4 : return CNode::getChildNodes();
199 : : }
200 : 2778 : virtual Reference< XNode > SAL_CALL getFirstChild()
201 : : throw (RuntimeException)
202 : : {
203 : 2778 : return CNode::getFirstChild();
204 : : }
205 : 8 : virtual Reference< XNode > SAL_CALL getLastChild()
206 : : throw (RuntimeException)
207 : : {
208 : 8 : return CNode::getLastChild();
209 : : }
210 : 17745 : virtual OUString SAL_CALL getNamespaceURI()
211 : : throw (RuntimeException)
212 : : {
213 : 17745 : return CNode::getNamespaceURI();
214 : : }
215 : 720 : virtual Reference< XNode > SAL_CALL getNextSibling()
216 : : throw (RuntimeException)
217 : : {
218 : 720 : return CNode::getNextSibling();
219 : : }
220 : 2811 : virtual NodeType SAL_CALL getNodeType()
221 : : throw (RuntimeException)
222 : : {
223 : 2811 : return CNode::getNodeType();
224 : : }
225 : 215259 : virtual Reference< XDocument > SAL_CALL getOwnerDocument()
226 : : throw (RuntimeException)
227 : : {
228 : 215259 : return CNode::getOwnerDocument();
229 : : }
230 : 1110 : virtual Reference< XNode > SAL_CALL getParentNode()
231 : : throw (RuntimeException)
232 : : {
233 : 1110 : return CNode::getParentNode();
234 : : }
235 : 3219 : virtual OUString SAL_CALL getPrefix()
236 : : throw (RuntimeException)
237 : : {
238 : 3219 : return CNode::getPrefix();
239 : : }
240 : 2 : virtual Reference< XNode > SAL_CALL getPreviousSibling()
241 : : throw (RuntimeException)
242 : : {
243 : 2 : return CNode::getPreviousSibling();
244 : : }
245 : 885 : virtual sal_Bool SAL_CALL hasAttributes()
246 : : throw (RuntimeException)
247 : : {
248 : 885 : return CNode::hasAttributes();
249 : : }
250 : 18 : virtual sal_Bool SAL_CALL hasChildNodes()
251 : : throw (RuntimeException)
252 : : {
253 : 18 : return CNode::hasChildNodes();
254 : : }
255 : 8 : virtual Reference< XNode > SAL_CALL insertBefore(
256 : : const Reference< XNode >& newChild, const Reference< XNode >& refChild)
257 : : throw (RuntimeException, DOMException)
258 : : {
259 : 8 : return CNode::insertBefore(newChild, refChild);
260 : : }
261 : 2 : virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
262 : : throw (RuntimeException)
263 : : {
264 : 2 : return CNode::isSupported(feature, ver);
265 : : }
266 : 2 : virtual void SAL_CALL normalize()
267 : : throw (RuntimeException)
268 : : {
269 : 2 : CNode::normalize();
270 : 2 : }
271 : 1090 : virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
272 : : throw (RuntimeException, DOMException)
273 : : {
274 : 1090 : return CNode::removeChild(oldChild);
275 : : }
276 : 10 : virtual Reference< XNode > SAL_CALL replaceChild(
277 : : const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
278 : : throw (RuntimeException, DOMException)
279 : : {
280 : 10 : return CNode::replaceChild(newChild, oldChild);
281 : : }
282 : 2 : virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
283 : : throw (RuntimeException, DOMException)
284 : : {
285 : 2 : return CNode::setNodeValue(nodeValue);
286 : : }
287 : 2 : virtual void SAL_CALL setPrefix(const OUString& prefix)
288 : : throw (RuntimeException, DOMException)
289 : : {
290 : 2 : return CNode::setPrefix(prefix);
291 : : }
292 : :
293 : : };
294 : :
295 : : }
296 : :
297 : : #endif
298 : :
299 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|