1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_DOM_ELEMENT_HXX
21 #define INCLUDED_UNOXML_SOURCE_DOM_ELEMENT_HXX
23 #include <libxml/tree.h>
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>
31 #include <cppuhelper/implbase.hxx>
36 typedef ::cppu::ImplInheritanceHelper
<CNode
, css::xml::dom::XElement
> CElement_Base
;
39 : public CElement_Base
42 friend class CDocument
;
44 css::uno::Reference
< css::xml::dom::XAttr
> setAttributeNode_Impl_Lock(
45 css::uno::Reference
< css::xml::dom::XAttr
> const& xNewAttr
, bool const bNS
);
48 CElement(CDocument
const& rDocument
, ::osl::Mutex
const& rMutex
,
49 xmlNodePtr
const pNode
);
53 virtual void saxify(const css::uno::Reference
< css::xml::sax::XDocumentHandler
>& i_xHandler
) override
;
55 virtual void fastSaxify( Context
& i_rContext
) override
;
57 virtual bool IsChildTypeAllowed(css::xml::dom::NodeType
const nodeType
) override
;
60 Retrieves an attribute value by name.
62 virtual OUString SAL_CALL
getAttribute(const OUString
& name
) override
;
65 Retrieves an attribute node by name.
67 virtual css::uno::Reference
< css::xml::dom::XAttr
> SAL_CALL
getAttributeNode(const OUString
& name
) override
;
70 Retrieves an Attr node by local name and namespace URI.
72 virtual css::uno::Reference
< css::xml::dom::XAttr
> SAL_CALL
getAttributeNodeNS(const OUString
& namespaceURI
, const OUString
& localName
) override
;
75 Retrieves an attribute value by local name and namespace URI.
77 virtual OUString SAL_CALL
getAttributeNS(const OUString
& namespaceURI
, const OUString
& localName
) override
;
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.
84 virtual css::uno::Reference
< css::xml::dom::XNodeList
> SAL_CALL
getElementsByTagName(const OUString
& name
) override
;
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.
91 virtual css::uno::Reference
< css::xml::dom::XNodeList
> SAL_CALL
getElementsByTagNameNS(const OUString
& namespaceURI
,
92 const OUString
& localName
) override
;
95 The name of the element.
97 virtual OUString SAL_CALL
getTagName() override
;
100 Returns true when an attribute with a given name is specified on this
101 element or has a default value, false otherwise.
103 virtual sal_Bool SAL_CALL
hasAttribute(const OUString
& name
) override
;
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.
109 virtual sal_Bool SAL_CALL
hasAttributeNS(const OUString
& namespaceURI
, const OUString
& localName
) override
;
112 Removes an attribute by name.
114 virtual void SAL_CALL
removeAttribute(const OUString
& name
) override
;
117 Removes the specified attribute node.
119 virtual css::uno::Reference
< css::xml::dom::XAttr
> SAL_CALL
removeAttributeNode(const css::uno::Reference
< css::xml::dom::XAttr
>& oldAttr
) override
;
122 Removes an attribute by local name and namespace URI.
124 virtual void SAL_CALL
removeAttributeNS(const OUString
& namespaceURI
, const OUString
& localName
) override
;
127 Adds a new attribute.
129 virtual void SAL_CALL
setAttribute(const OUString
& name
, const OUString
& value
) override
;
132 Adds a new attribute node.
134 virtual css::uno::Reference
< css::xml::dom::XAttr
> SAL_CALL
setAttributeNode(const css::uno::Reference
< css::xml::dom::XAttr
>& newAttr
) override
;
137 Adds a new attribute.
139 virtual css::uno::Reference
< css::xml::dom::XAttr
> SAL_CALL
setAttributeNodeNS(const css::uno::Reference
< css::xml::dom::XAttr
>& newAttr
) override
;
142 Adds a new attribute.
144 virtual void SAL_CALL
setAttributeNS(
145 const OUString
& namespaceURI
, const OUString
& qualifiedName
, const OUString
& value
) override
;
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
;
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
157 return CNode::appendChild(newChild
);
159 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
cloneNode(sal_Bool deep
) override
161 return CNode::cloneNode(deep
);
163 virtual css::uno::Reference
< css::xml::dom::XNodeList
> SAL_CALL
getChildNodes() override
165 return CNode::getChildNodes();
167 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getFirstChild() override
169 return CNode::getFirstChild();
171 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getLastChild() override
173 return CNode::getLastChild();
175 virtual OUString SAL_CALL
getNamespaceURI() override
177 return CNode::getNamespaceURI();
179 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getNextSibling() override
181 return CNode::getNextSibling();
183 virtual css::xml::dom::NodeType SAL_CALL
getNodeType() override
185 return CNode::getNodeType();
187 virtual css::uno::Reference
< css::xml::dom::XDocument
> SAL_CALL
getOwnerDocument() override
189 return CNode::getOwnerDocument();
191 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getParentNode() override
193 return CNode::getParentNode();
195 virtual OUString SAL_CALL
getPrefix() override
197 return CNode::getPrefix();
199 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getPreviousSibling() override
201 return CNode::getPreviousSibling();
203 virtual sal_Bool SAL_CALL
hasAttributes() override
205 return CNode::hasAttributes();
207 virtual sal_Bool SAL_CALL
hasChildNodes() override
209 return CNode::hasChildNodes();
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
214 return CNode::insertBefore(newChild
, refChild
);
216 virtual sal_Bool SAL_CALL
isSupported(const OUString
& feature
, const OUString
& ver
) override
218 return CNode::isSupported(feature
, ver
);
220 virtual void SAL_CALL
normalize() override
224 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
removeChild(const css::uno::Reference
< css::xml::dom::XNode
>& oldChild
) override
226 return CNode::removeChild(oldChild
);
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
231 return CNode::replaceChild(newChild
, oldChild
);
233 virtual void SAL_CALL
setNodeValue(const OUString
& nodeValue
) override
235 return CNode::setNodeValue(nodeValue
);
237 virtual void SAL_CALL
setPrefix(const OUString
& prefix
) override
239 return CNode::setPrefix(prefix
);
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */