LibreOffice Module unoxml (master) 1
element.hxx
Go to the documentation of this file.
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
31#include <node.hxx>
32
33namespace DOM
34{
35 typedef ::cppu::ImplInheritanceHelper<CNode, css::xml::dom::XElement > CElement_Base;
36
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
62 virtual OUString SAL_CALL getAttribute(const OUString& name) override;
63
67 virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNode(const OUString& name) override;
68
72 virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNodeNS(const OUString& namespaceURI, const OUString& localName) override;
73
77 virtual OUString SAL_CALL getAttributeNS(const OUString& namespaceURI, const OUString& localName) override;
78
84 virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagName(const OUString& name) override;
85
91 virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagNameNS(const OUString& namespaceURI,
92 const OUString& localName) override;
93
97 virtual OUString SAL_CALL getTagName() override;
98
103 virtual sal_Bool SAL_CALL hasAttribute(const OUString& name) override;
104
109 virtual sal_Bool SAL_CALL hasAttributeNS(const OUString& namespaceURI, const OUString& localName) override;
110
114 virtual void SAL_CALL removeAttribute(const OUString& name) override;
115
119 virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL removeAttributeNode(const css::uno::Reference< css::xml::dom::XAttr >& oldAttr) override;
120
124 virtual void SAL_CALL removeAttributeNS(const OUString& namespaceURI, const OUString& localName) override;
125
129 virtual void SAL_CALL setAttribute(const OUString& name, const OUString& value) override;
130
134 virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNode(const css::uno::Reference< css::xml::dom::XAttr >& newAttr) override;
135
139 virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNodeNS(const css::uno::Reference< css::xml::dom::XAttr >& newAttr) override;
140
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 {
157 return CNode::appendChild(newChild);
158 }
159 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep) override
160 {
161 return CNode::cloneNode(deep);
162 }
163 virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes() override
164 {
165 return CNode::getChildNodes();
166 }
167 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild() override
168 {
169 return CNode::getFirstChild();
170 }
171 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild() override
172 {
173 return CNode::getLastChild();
174 }
175 virtual OUString SAL_CALL getNamespaceURI() override
176 {
177 return CNode::getNamespaceURI();
178 }
179 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling() override
180 {
181 return CNode::getNextSibling();
182 }
183 virtual css::xml::dom::NodeType SAL_CALL getNodeType() override
184 {
185 return CNode::getNodeType();
186 }
187 virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument() override
188 {
189 return CNode::getOwnerDocument();
190 }
191 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode() override
192 {
193 return CNode::getParentNode();
194 }
195 virtual OUString SAL_CALL getPrefix() override
196 {
197 return CNode::getPrefix();
198 }
199 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling() override
200 {
201 return CNode::getPreviousSibling();
202 }
203 virtual sal_Bool SAL_CALL hasAttributes() override
204 {
205 return CNode::hasAttributes();
206 }
207 virtual sal_Bool SAL_CALL hasChildNodes() override
208 {
209 return CNode::hasChildNodes();
210 }
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 {
214 return CNode::insertBefore(newChild, refChild);
215 }
216 virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver) override
217 {
218 return CNode::isSupported(feature, ver);
219 }
220 virtual void SAL_CALL normalize() override
221 {
222 CNode::normalize();
223 }
224 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode >& oldChild) override
225 {
226 return CNode::removeChild(oldChild);
227 }
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 {
231 return CNode::replaceChild(newChild, oldChild);
232 }
233 virtual void SAL_CALL setNodeValue(const OUString& nodeValue) override
234 {
235 return CNode::setNodeValue(nodeValue);
236 }
237 virtual void SAL_CALL setPrefix(const OUString& prefix) override
238 {
239 return CNode::setPrefix(prefix);
240 }
241
242 };
243
244}
245
246/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL removeAttributeNS(const OUString &namespaceURI, const OUString &localName) override
Removes an attribute by local name and namespace URI.
Definition: element.cxx:434
virtual sal_Bool SAL_CALL hasAttributes() override
Definition: element.hxx:203
virtual void fastSaxify(Context &i_rContext) override
Definition: element.cxx:104
virtual void SAL_CALL setNodeValue(const OUString &nodeValue) override
Definition: element.hxx:233
virtual void SAL_CALL normalize() override
Definition: element.hxx:220
virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL removeAttributeNode(const css::uno::Reference< css::xml::dom::XAttr > &oldAttr) override
Removes the specified attribute node.
Definition: element.cxx:464
virtual OUString SAL_CALL getAttribute(const OUString &name) override
Retrieves an attribute value by name.
Definition: element.cxx:231
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode() override
Definition: element.hxx:191
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild() override
Definition: element.hxx:171
virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagNameNS(const OUString &namespaceURI, const OUString &localName) override
Returns a NodeList of all the descendant Elements with a given local name and namespace URI in the or...
Definition: element.cxx:353
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild(const css::uno::Reference< css::xml::dom::XNode > &newChild, const css::uno::Reference< css::xml::dom::XNode > &oldChild) override
Definition: element.hxx:228
virtual OUString SAL_CALL getNodeValue() override
Definition: element.cxx:748
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling() override
Definition: element.hxx:179
virtual OUString SAL_CALL getNodeName() override
Definition: element.cxx:730
virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagName(const OUString &name) override
Returns a NodeList of all descendant Elements with a given tag name, in the order in which they are e...
Definition: element.cxx:338
virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNodeNS(const css::uno::Reference< css::xml::dom::XAttr > &newAttr) override
Adds a new attribute.
Definition: element.cxx:590
virtual void SAL_CALL setPrefix(const OUString &prefix) override
Definition: element.hxx:237
virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes() override
Definition: element.cxx:721
virtual bool IsChildTypeAllowed(css::xml::dom::NodeType const nodeType, css::xml::dom::NodeType const *) override
Definition: element.cxx:205
virtual void SAL_CALL removeAttribute(const OUString &name) override
Removes an attribute by name.
Definition: element.cxx:411
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild() override
Definition: element.hxx:167
virtual void SAL_CALL setAttribute(const OUString &name, const OUString &value) override
Adds a new attribute.
Definition: element.cxx:599
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep) override
Definition: element.hxx:159
virtual OUString SAL_CALL getLocalName() override
Definition: element.cxx:735
virtual OUString SAL_CALL getPrefix() override
Definition: element.hxx:195
CElement(CDocument const &rDocument, ::osl::Mutex const &rMutex, xmlNodePtr const pNode)
Definition: element.cxx:50
virtual OUString SAL_CALL getNamespaceURI() override
Definition: element.hxx:175
virtual void SAL_CALL setAttributeNS(const OUString &namespaceURI, const OUString &qualifiedName, const OUString &value) override
Adds a new attribute.
Definition: element.cxx:643
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL appendChild(const css::uno::Reference< css::xml::dom::XNode > &newChild) override
Definition: element.hxx:155
virtual sal_Bool SAL_CALL hasChildNodes() override
Definition: element.hxx:207
virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNode(const css::uno::Reference< css::xml::dom::XAttr > &newAttr) override
Adds a new attribute node.
Definition: element.cxx:581
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore(const css::uno::Reference< css::xml::dom::XNode > &newChild, const css::uno::Reference< css::xml::dom::XNode > &refChild) override
Definition: element.hxx:211
virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNodeNS(const OUString &namespaceURI, const OUString &localName) override
Retrieves an Attr node by local name and namespace URI.
Definition: element.cxx:277
virtual OUString SAL_CALL getAttributeNS(const OUString &namespaceURI, const OUString &localName) override
Retrieves an attribute value by local name and namespace URI.
Definition: element.cxx:307
virtual css::xml::dom::NodeType SAL_CALL getNodeType() override
Definition: element.hxx:183
virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes() override
Definition: element.hxx:163
virtual OUString SAL_CALL getTagName() override
The name of the element.
Definition: element.cxx:366
virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNode(const OUString &name) override
Retrieves an attribute node by name.
Definition: element.cxx:253
virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument() override
Definition: element.hxx:187
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling() override
Definition: element.hxx:199
virtual sal_Bool SAL_CALL isSupported(const OUString &feature, const OUString &ver) override
Definition: element.hxx:216
virtual sal_Bool SAL_CALL hasAttributeNS(const OUString &namespaceURI, const OUString &localName) override
Returns true when an attribute with a given local name and namespace URI is specified on this element...
Definition: element.cxx:396
virtual void saxify(const css::uno::Reference< css::xml::sax::XDocumentHandler > &i_xHandler) override
Definition: element.cxx:56
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode > &oldChild) override
Definition: element.hxx:224
css::uno::Reference< css::xml::dom::XAttr > setAttributeNode_Impl_Lock(css::uno::Reference< css::xml::dom::XAttr > const &xNewAttr, bool const bNS)
Adds a new attribute node.
Definition: element.cxx:516
virtual sal_Bool SAL_CALL hasAttribute(const OUString &name) override
Returns true when an attribute with a given name is specified on this element or has a default value,...
Definition: element.cxx:383
Definition: attr.cxx:38
::cppu::ImplInheritanceHelper< CNode, css::xml::dom::XElement > CElement_Base
Definition: element.hxx:35
unsigned char sal_Bool