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: characterdata.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 ************************************************************************/
31 #ifndef _CHARACTERDATA_HXX
32 #define _CHARACTERDATA_HXX
34 #include <sal/types.h>
35 #include <cppuhelper/implbase1.hxx>
36 #include <com/sun/star/uno/Reference.h>
37 #include <com/sun/star/uno/Exception.hpp>
38 #include <com/sun/star/xml/dom/XNode.hpp>
39 #include <com/sun/star/xml/dom/XCharacterData.hpp>
40 #include <com/sun/star/xml/dom/XElement.hpp>
41 #include <com/sun/star/xml/dom/XDOMImplementation.hpp>
42 #include <libxml/tree.h>
45 using ::rtl::OUString
;
46 using namespace com::sun::star::uno
;
47 using namespace com::sun::star::xml::dom
;
51 class CCharacterData
: public cppu::ImplInheritanceHelper1
< CNode
, XCharacterData
>
57 void init_characterdata(const xmlNodePtr aNodePtr
);
58 void _dispatchEvent(const OUString
& prevValue
, const OUString
& newValue
);
62 Append the string to the end of the character data of the node.
64 virtual void SAL_CALL
appendData(const OUString
& arg
)
65 throw (RuntimeException
, DOMException
);
68 Remove a range of 16-bit units from the node.
70 virtual void SAL_CALL
deleteData(sal_Int32 offset
, sal_Int32 count
)
71 throw (RuntimeException
, DOMException
);
74 Return the character data of the node that implements this interface.
76 virtual OUString SAL_CALL
getData() throw (RuntimeException
);
79 The number of 16-bit units that are available through data and the
80 substringData method below.
82 virtual sal_Int32 SAL_CALL
getLength() throw (RuntimeException
);
85 Insert a string at the specified 16-bit unit offset.
87 virtual void SAL_CALL
insertData(sal_Int32 offset
, const OUString
& arg
)
88 throw (RuntimeException
, DOMException
);
91 Replace the characters starting at the specified 16-bit unit offset
92 with the specified string.
94 virtual void SAL_CALL
replaceData(sal_Int32 offset
, sal_Int32 count
, const OUString
& arg
)
95 throw (RuntimeException
, DOMException
);
98 Set the character data of the node that implements this interface.
100 virtual void SAL_CALL
setData(const OUString
& data
)
101 throw (RuntimeException
, DOMException
);
104 Extracts a range of data from the node.
106 virtual OUString SAL_CALL
subStringData(sal_Int32 offset
, sal_Int32 count
)
107 throw (RuntimeException
, DOMException
);
109 // --- delegation for XNode base.
110 virtual Reference
< XNode
> SAL_CALL
appendChild(const Reference
< XNode
>& newChild
)
111 throw (RuntimeException
, DOMException
)
113 return CNode::appendChild(newChild
);
115 virtual Reference
< XNode
> SAL_CALL
cloneNode(sal_Bool deep
)
116 throw (RuntimeException
)
118 return CNode::cloneNode(deep
);
120 virtual Reference
< XNamedNodeMap
> SAL_CALL
getAttributes()
121 throw (RuntimeException
)
123 return CNode::getAttributes();
125 virtual Reference
< XNodeList
> SAL_CALL
getChildNodes()
126 throw (RuntimeException
)
128 return CNode::getChildNodes();
130 virtual Reference
< XNode
> SAL_CALL
getFirstChild()
131 throw (RuntimeException
)
133 return CNode::getFirstChild();
135 virtual Reference
< XNode
> SAL_CALL
getLastChild()
136 throw (RuntimeException
)
138 return CNode::getLastChild();
140 virtual OUString SAL_CALL
getLocalName()
141 throw (RuntimeException
)
143 return CNode::getLocalName();
145 virtual OUString SAL_CALL
getNamespaceURI()
146 throw (RuntimeException
)
148 return CNode::getNamespaceURI();
150 virtual Reference
< XNode
> SAL_CALL
getNextSibling()
151 throw (RuntimeException
)
153 return CNode::getNextSibling();
155 virtual OUString SAL_CALL
getNodeName()
156 throw (RuntimeException
)
158 return CNode::getNodeName();
160 virtual NodeType SAL_CALL
getNodeType()
161 throw (RuntimeException
)
163 return CNode::getNodeType();
165 virtual OUString SAL_CALL
getNodeValue()
166 throw (RuntimeException
)
170 virtual Reference
< XDocument
> SAL_CALL
getOwnerDocument()
171 throw (RuntimeException
)
173 return CNode::getOwnerDocument();
175 virtual Reference
< XNode
> SAL_CALL
getParentNode()
176 throw (RuntimeException
)
178 return CNode::getParentNode();
180 virtual OUString SAL_CALL
getPrefix()
181 throw (RuntimeException
)
183 return CNode::getPrefix();
185 virtual Reference
< XNode
> SAL_CALL
getPreviousSibling()
186 throw (RuntimeException
)
188 return CNode::getPreviousSibling();
190 virtual sal_Bool SAL_CALL
hasAttributes()
191 throw (RuntimeException
)
193 return CNode::hasAttributes();
195 virtual sal_Bool SAL_CALL
hasChildNodes()
196 throw (RuntimeException
)
198 return CNode::hasChildNodes();
200 virtual Reference
< XNode
> SAL_CALL
insertBefore(
201 const Reference
< XNode
>& newChild
, const Reference
< XNode
>& refChild
)
202 throw (RuntimeException
, DOMException
)
204 return CNode::insertBefore(newChild
, refChild
);
206 virtual sal_Bool SAL_CALL
isSupported(const OUString
& feature
, const OUString
& ver
)
207 throw (RuntimeException
)
209 return CNode::isSupported(feature
, ver
);
211 virtual void SAL_CALL
normalize()
212 throw (RuntimeException
)
216 virtual Reference
< XNode
> SAL_CALL
removeChild(const Reference
< XNode
>& oldChild
)
217 throw (RuntimeException
, DOMException
)
219 return CNode::removeChild(oldChild
);
221 virtual Reference
< XNode
> SAL_CALL
replaceChild(
222 const Reference
< XNode
>& newChild
, const Reference
< XNode
>& oldChild
)
223 throw (RuntimeException
, DOMException
)
225 return CNode::replaceChild(newChild
, oldChild
);
227 virtual void SAL_CALL
setNodeValue(const OUString
& nodeValue
)
228 throw (RuntimeException
, DOMException
)
230 return setData(nodeValue
);
232 virtual void SAL_CALL
setPrefix(const OUString
& prefix
)
233 throw (RuntimeException
, DOMException
)
235 return CNode::setPrefix(prefix
);