xref: /trunk/main/unoxml/source/dom/characterdata.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef DOM_CHARACTERDATA_HXX
29 #define DOM_CHARACTERDATA_HXX
30 
31 #include <libxml/tree.h>
32 
33 #include <sal/types.h>
34 
35 #include <cppuhelper/implbase1.hxx>
36 
37 #include <com/sun/star/uno/Reference.h>
38 #include <com/sun/star/xml/dom/XNode.hpp>
39 #include <com/sun/star/xml/dom/XCharacterData.hpp>
40 
41 #include <node.hxx>
42 
43 
44 using ::rtl::OUString;
45 using namespace com::sun::star::uno;
46 using namespace com::sun::star::xml::dom;
47 
48 namespace DOM
49 {
50     typedef ::cppu::ImplInheritanceHelper1< CNode, XCharacterData >
51         CCharacterData_Base;
52 
53     class CCharacterData
54         : public CCharacterData_Base
55     {
56 
57     protected:
58         CCharacterData(CDocument const& rDocument, ::osl::Mutex const& rMutex,
59                 NodeType const& reNodeType, xmlNodePtr const& rpNode);
60 
61         void dispatchEvent_Impl(
62                 OUString const& prevValue, OUString const& newValue);
63 
64     public:
65         /**
66         Append the string to the end of the character data of the node.
67         */
68         virtual void SAL_CALL appendData(const OUString& arg)
69             throw (RuntimeException, DOMException);
70 
71         /**
72         Remove a range of 16-bit units from the node.
73         */
74         virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
75             throw (RuntimeException, DOMException);
76 
77         /**
78         Return the character data of the node that implements this interface.
79         */
80         virtual OUString SAL_CALL getData() throw (RuntimeException);
81 
82         /**
83         The number of 16-bit units that are available through data and the
84         substringData method below.
85         */
86         virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
87 
88         /**
89         Insert a string at the specified 16-bit unit offset.
90         */
91         virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
92             throw (RuntimeException, DOMException);
93 
94         /**
95         Replace the characters starting at the specified 16-bit unit offset
96         with the specified string.
97         */
98         virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
99             throw (RuntimeException, DOMException);
100 
101         /**
102         Set the character data of the node that implements this interface.
103         */
104         virtual void SAL_CALL setData(const OUString& data)
105             throw (RuntimeException, DOMException);
106 
107         /**
108         Extracts a range of data from the node.
109         */
110         virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
111             throw (RuntimeException, DOMException);
112 
113         // --- delegation for XNode base.
114         virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
115             throw (RuntimeException, DOMException)
116         {
117             return CNode::appendChild(newChild);
118         }
119         virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
120             throw (RuntimeException)
121         {
122             return CNode::cloneNode(deep);
123         }
124         virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
125             throw (RuntimeException)
126         {
127             return CNode::getAttributes();
128         }
129         virtual Reference< XNodeList > SAL_CALL getChildNodes()
130             throw (RuntimeException)
131         {
132             return CNode::getChildNodes();
133         }
134         virtual Reference< XNode > SAL_CALL getFirstChild()
135             throw (RuntimeException)
136         {
137             return CNode::getFirstChild();
138         }
139         virtual Reference< XNode > SAL_CALL getLastChild()
140             throw (RuntimeException)
141         {
142             return CNode::getLastChild();
143         }
144         virtual OUString SAL_CALL getLocalName()
145             throw (RuntimeException)
146         {
147             return CNode::getLocalName();
148         }
149         virtual OUString SAL_CALL getNamespaceURI()
150             throw (RuntimeException)
151         {
152             return CNode::getNamespaceURI();
153         }
154         virtual Reference< XNode > SAL_CALL getNextSibling()
155             throw (RuntimeException)
156         {
157             return CNode::getNextSibling();
158         }
159         virtual OUString SAL_CALL getNodeName()
160             throw (RuntimeException)
161         {
162             return CNode::getNodeName();
163         }
164         virtual NodeType SAL_CALL getNodeType()
165             throw (RuntimeException)
166         {
167             return CNode::getNodeType();
168         }
169         virtual OUString SAL_CALL getNodeValue()
170             throw (RuntimeException)
171         {
172             return getData();
173         }
174         virtual Reference< XDocument > SAL_CALL getOwnerDocument()
175             throw (RuntimeException)
176         {
177             return CNode::getOwnerDocument();
178         }
179         virtual Reference< XNode > SAL_CALL getParentNode()
180             throw (RuntimeException)
181         {
182             return CNode::getParentNode();
183         }
184         virtual OUString SAL_CALL getPrefix()
185             throw (RuntimeException)
186         {
187             return CNode::getPrefix();
188         }
189         virtual Reference< XNode > SAL_CALL getPreviousSibling()
190             throw (RuntimeException)
191         {
192             return CNode::getPreviousSibling();
193         }
194         virtual sal_Bool SAL_CALL hasAttributes()
195             throw (RuntimeException)
196         {
197             return CNode::hasAttributes();
198         }
199         virtual sal_Bool SAL_CALL hasChildNodes()
200             throw (RuntimeException)
201         {
202             return CNode::hasChildNodes();
203         }
204         virtual Reference< XNode > SAL_CALL insertBefore(
205                 const Reference< XNode >& newChild, const Reference< XNode >& refChild)
206             throw (RuntimeException, DOMException)
207         {
208             return CNode::insertBefore(newChild, refChild);
209         }
210         virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
211             throw (RuntimeException)
212         {
213             return CNode::isSupported(feature, ver);
214         }
215         virtual void SAL_CALL normalize()
216             throw (RuntimeException)
217         {
218             CNode::normalize();
219         }
220         virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
221             throw (RuntimeException, DOMException)
222         {
223             return CNode::removeChild(oldChild);
224         }
225         virtual Reference< XNode > SAL_CALL replaceChild(
226                 const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
227             throw (RuntimeException, DOMException)
228         {
229             return CNode::replaceChild(newChild, oldChild);
230         }
231         virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
232             throw (RuntimeException, DOMException)
233         {
234             return setData(nodeValue);
235         }
236         virtual void SAL_CALL setPrefix(const OUString& prefix)
237             throw (RuntimeException, DOMException)
238         {
239             return CNode::setPrefix(prefix);
240         }
241 
242 
243     };
244 }
245 
246 #endif
247