1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: attr.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <cppuhelper/implbase1.hxx>
35 #include <com/sun/star/uno/Reference.h>
36 #include <com/sun/star/uno/Exception.hpp>
37 #include <com/sun/star/xml/dom/XNode.hpp>
38 #include <com/sun/star/xml/dom/XAttr.hpp>
40 #include <libxml/tree.h>
42 using ::rtl::OUString
;
43 using namespace com::sun::star::uno
;
44 using namespace com::sun::star::xml::dom
;
48 class CAttr
: public cppu::ImplInheritanceHelper1
< CNode
, XAttr
>
51 friend class CElement
;
53 xmlAttrPtr m_aAttrPtr
;
56 CAttr(const xmlAttrPtr aAttrPtr
);
60 Returns the name of this attribute.
62 virtual OUString SAL_CALL
getName() throw (RuntimeException
);
65 The Element node this attribute is attached to or null if this
66 attribute is not in use.
68 virtual Reference
< XElement
> SAL_CALL
getOwnerElement() throw (RuntimeException
);
71 If this attribute was explicitly given a value in the original
72 document, this is true; otherwise, it is false.
74 virtual sal_Bool SAL_CALL
getSpecified()throw (RuntimeException
);
77 On retrieval, the value of the attribute is returned as a string.
79 virtual OUString SAL_CALL
getValue() throw (RuntimeException
);
82 Sets the value of the attribute from a string.
85 virtual void SAL_CALL
setValue(const OUString
& value
) throw (RuntimeException
, DOMException
);
87 // resolve uno inheritance problems...
88 // overrides for XNode base
89 virtual OUString SAL_CALL
getNodeName()
90 throw (RuntimeException
);
91 virtual OUString SAL_CALL
getNodeValue()
92 throw (RuntimeException
);
93 virtual OUString SAL_CALL
getLocalName()
94 throw (RuntimeException
);
96 // --- delegation for XNde base.
97 virtual Reference
< XNode
> SAL_CALL
appendChild(const Reference
< XNode
>& newChild
)
98 throw (RuntimeException
, DOMException
)
100 return CNode::appendChild(newChild
);
102 virtual Reference
< XNode
> SAL_CALL
cloneNode(sal_Bool deep
)
103 throw (RuntimeException
)
105 return CNode::cloneNode(deep
);
107 virtual Reference
< XNamedNodeMap
> SAL_CALL
getAttributes()
108 throw (RuntimeException
)
110 return CNode::getAttributes();
112 virtual Reference
< XNodeList
> SAL_CALL
getChildNodes()
113 throw (RuntimeException
)
115 return CNode::getChildNodes();
117 virtual Reference
< XNode
> SAL_CALL
getFirstChild()
118 throw (RuntimeException
)
120 return CNode::getFirstChild();
122 virtual Reference
< XNode
> SAL_CALL
getLastChild()
123 throw (RuntimeException
)
125 return CNode::getLastChild();
127 virtual OUString SAL_CALL
getNamespaceURI()
128 throw (RuntimeException
)
130 return CNode::getNamespaceURI();
132 virtual Reference
< XNode
> SAL_CALL
getNextSibling()
133 throw (RuntimeException
)
135 return CNode::getNextSibling();
137 virtual NodeType SAL_CALL
getNodeType()
138 throw (RuntimeException
)
140 return CNode::getNodeType();
142 virtual Reference
< XDocument
> SAL_CALL
getOwnerDocument()
143 throw (RuntimeException
)
145 return CNode::getOwnerDocument();
147 virtual Reference
< XNode
> SAL_CALL
getParentNode()
148 throw (RuntimeException
)
150 return CNode::getParentNode();
152 virtual OUString SAL_CALL
getPrefix()
153 throw (RuntimeException
)
155 return CNode::getPrefix();
157 virtual Reference
< XNode
> SAL_CALL
getPreviousSibling()
158 throw (RuntimeException
)
160 return CNode::getPreviousSibling();
162 virtual sal_Bool SAL_CALL
hasAttributes()
163 throw (RuntimeException
)
165 return CNode::hasAttributes();
167 virtual sal_Bool SAL_CALL
hasChildNodes()
168 throw (RuntimeException
)
170 return CNode::hasChildNodes();
172 virtual Reference
< XNode
> SAL_CALL
insertBefore(
173 const Reference
< XNode
>& newChild
, const Reference
< XNode
>& refChild
)
174 throw (RuntimeException
, DOMException
)
176 return CNode::insertBefore(newChild
, refChild
);
178 virtual sal_Bool SAL_CALL
isSupported(const OUString
& feature
, const OUString
& ver
)
179 throw (RuntimeException
)
181 return CNode::isSupported(feature
, ver
);
183 virtual void SAL_CALL
normalize()
184 throw (RuntimeException
)
188 virtual Reference
< XNode
> SAL_CALL
removeChild(const Reference
< XNode
>& oldChild
)
189 throw (RuntimeException
, DOMException
)
191 return CNode::removeChild(oldChild
);
193 virtual Reference
< XNode
> SAL_CALL
replaceChild(
194 const Reference
< XNode
>& newChild
, const Reference
< XNode
>& oldChild
)
195 throw (RuntimeException
, DOMException
)
197 return CNode::replaceChild(newChild
, oldChild
);
199 virtual void SAL_CALL
setNodeValue(const OUString
& nodeValue
)
200 throw (RuntimeException
, DOMException
)
202 return setValue(nodeValue
);
204 virtual void SAL_CALL
setPrefix(const OUString
& prefix
)
205 throw (RuntimeException
, DOMException
)
207 return CNode::setPrefix(prefix
);