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_ATTR_HXX
21 #define INCLUDED_UNOXML_SOURCE_DOM_ATTR_HXX
25 #include <libxml/tree.h>
27 #include <cppuhelper/implbase.hxx>
29 #include <com/sun/star/uno/Reference.h>
30 #include <com/sun/star/xml/dom/XNode.hpp>
31 #include <com/sun/star/xml/dom/XAttr.hpp>
37 typedef ::std::pair
< OString
, OString
> stringpair_t
;
39 typedef ::cppu::ImplInheritanceHelper
< CNode
, css::xml::dom::XAttr
> CAttr_Base
;
44 friend class CDocument
;
46 xmlAttrPtr m_aAttrPtr
;
47 ::std::unique_ptr
< stringpair_t
> m_pNamespace
;
49 CAttr(CDocument
const& rDocument
, ::osl::Mutex
const& rMutex
,
50 xmlAttrPtr
const pAttr
);
53 /// return the libxml namespace corresponding to m_pNamespace on pNode
54 xmlNsPtr
GetNamespace(xmlNodePtr
const pNode
);
56 virtual bool IsChildTypeAllowed(css::xml::dom::NodeType
const nodeType
) override
;
59 Returns the name of this attribute.
61 virtual OUString SAL_CALL
getName() override
;
64 The Element node this attribute is attached to or null if this
65 attribute is not in use.
67 virtual css::uno::Reference
< css::xml::dom::XElement
> SAL_CALL
getOwnerElement() override
;
70 If this attribute was explicitly given a value in the original
71 document, this is true; otherwise, it is false.
73 virtual sal_Bool SAL_CALL
getSpecified() override
;
76 On retrieval, the value of the attribute is returned as a string.
78 virtual OUString SAL_CALL
getValue() override
;
81 Sets the value of the attribute from a string.
84 virtual void SAL_CALL
setValue(const OUString
& value
) override
;
86 // resolve uno inheritance problems...
87 // overrides for XNode base
88 virtual OUString SAL_CALL
getNodeName() override
;
89 virtual OUString SAL_CALL
getNodeValue() override
;
90 virtual OUString SAL_CALL
getLocalName() override
;
92 // --- delegation for XNode base.
93 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
appendChild(const css::uno::Reference
< css::xml::dom::XNode
>& newChild
) override
95 return CNode::appendChild(newChild
);
97 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
cloneNode(sal_Bool deep
) override
99 return CNode::cloneNode(deep
);
101 virtual css::uno::Reference
< css::xml::dom::XNamedNodeMap
> SAL_CALL
getAttributes() override
103 return CNode::getAttributes();
105 virtual css::uno::Reference
< css::xml::dom::XNodeList
> SAL_CALL
getChildNodes() override
107 return CNode::getChildNodes();
109 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getFirstChild() override
111 return CNode::getFirstChild();
113 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getLastChild() override
115 return CNode::getLastChild();
117 virtual OUString SAL_CALL
getNamespaceURI() override
;
118 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getNextSibling() override
120 return CNode::getNextSibling();
122 virtual css::xml::dom::NodeType SAL_CALL
getNodeType() override
124 return CNode::getNodeType();
126 virtual css::uno::Reference
< css::xml::dom::XDocument
> SAL_CALL
getOwnerDocument() override
128 return CNode::getOwnerDocument();
130 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getParentNode() override
132 return CNode::getParentNode();
134 virtual OUString SAL_CALL
getPrefix() override
;
135 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getPreviousSibling() override
137 return CNode::getPreviousSibling();
139 virtual sal_Bool SAL_CALL
hasAttributes() override
141 return CNode::hasAttributes();
143 virtual sal_Bool SAL_CALL
hasChildNodes() override
145 return CNode::hasChildNodes();
147 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
insertBefore(
148 const css::uno::Reference
< css::xml::dom::XNode
>& newChild
, const css::uno::Reference
< css::xml::dom::XNode
>& refChild
) override
150 return CNode::insertBefore(newChild
, refChild
);
152 virtual sal_Bool SAL_CALL
isSupported(const OUString
& feature
, const OUString
& ver
) override
154 return CNode::isSupported(feature
, ver
);
156 virtual void SAL_CALL
normalize() override
160 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
removeChild(const css::uno::Reference
< css::xml::dom::XNode
>& oldChild
) override
162 return CNode::removeChild(oldChild
);
164 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
replaceChild(
165 const css::uno::Reference
< css::xml::dom::XNode
>& newChild
, const css::uno::Reference
< css::xml::dom::XNode
>& oldChild
) override
167 return CNode::replaceChild(newChild
, oldChild
);
169 virtual void SAL_CALL
setNodeValue(const OUString
& nodeValue
) override
171 return setValue(nodeValue
);
173 virtual void SAL_CALL
setPrefix(const OUString
& prefix
) override
;
180 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */