xref: /trunk/main/unoxml/source/dom/characterdata.hxx (revision 7f654276)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef DOM_CHARACTERDATA_HXX
25 #define DOM_CHARACTERDATA_HXX
26 
27 #include <libxml/tree.h>
28 
29 #include <sal/types.h>
30 
31 #include <cppuhelper/implbase1.hxx>
32 
33 #include <com/sun/star/uno/Reference.h>
34 #include <com/sun/star/xml/dom/XNode.hpp>
35 #include <com/sun/star/xml/dom/XCharacterData.hpp>
36 
37 #include <node.hxx>
38 
39 
40 using ::rtl::OUString;
41 using namespace com::sun::star::uno;
42 using namespace com::sun::star::xml::dom;
43 
44 namespace DOM
45 {
46     typedef ::cppu::ImplInheritanceHelper1< CNode, XCharacterData >
47         CCharacterData_Base;
48 
49     class CCharacterData
50         : public CCharacterData_Base
51     {
52 
53     protected:
54         CCharacterData(CDocument const& rDocument, ::osl::Mutex const& rMutex,
55                 NodeType const& reNodeType, xmlNodePtr const& rpNode);
56 
57         void dispatchEvent_Impl(
58                 OUString const& prevValue, OUString const& newValue);
59 
60     public:
61         /**
62         Append the string to the end of the character data of the node.
63         */
64         virtual void SAL_CALL appendData(const OUString& arg)
65             throw (RuntimeException, DOMException);
66 
67         /**
68         Remove a range of 16-bit units from the node.
69         */
70         virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
71             throw (RuntimeException, DOMException);
72 
73         /**
74         Return the character data of the node that implements this interface.
75         */
76         virtual OUString SAL_CALL getData() throw (RuntimeException);
77 
78         /**
79         The number of 16-bit units that are available through data and the
80         substringData method below.
81         */
82         virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
83 
84         /**
85         Insert a string at the specified 16-bit unit offset.
86         */
87         virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
88             throw (RuntimeException, DOMException);
89 
90         /**
91         Replace the characters starting at the specified 16-bit unit offset
92         with the specified string.
93         */
94         virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
95             throw (RuntimeException, DOMException);
96 
97         /**
98         Set the character data of the node that implements this interface.
99         */
100         virtual void SAL_CALL setData(const OUString& data)
101             throw (RuntimeException, DOMException);
102 
103         /**
104         Extracts a range of data from the node.
105         */
106         virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
107             throw (RuntimeException, DOMException);
108 
109         // --- delegation for XNode base.
appendChild(const Reference<XNode> & newChild)110         virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
111             throw (RuntimeException, DOMException)
112         {
113             return CNode::appendChild(newChild);
114         }
cloneNode(sal_Bool deep)115         virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
116             throw (RuntimeException)
117         {
118             return CNode::cloneNode(deep);
119         }
getAttributes()120         virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
121             throw (RuntimeException)
122         {
123             return CNode::getAttributes();
124         }
getChildNodes()125         virtual Reference< XNodeList > SAL_CALL getChildNodes()
126             throw (RuntimeException)
127         {
128             return CNode::getChildNodes();
129         }
getFirstChild()130         virtual Reference< XNode > SAL_CALL getFirstChild()
131             throw (RuntimeException)
132         {
133             return CNode::getFirstChild();
134         }
getLastChild()135         virtual Reference< XNode > SAL_CALL getLastChild()
136             throw (RuntimeException)
137         {
138             return CNode::getLastChild();
139         }
getLocalName()140         virtual OUString SAL_CALL getLocalName()
141             throw (RuntimeException)
142         {
143             return CNode::getLocalName();
144         }
getNamespaceURI()145         virtual OUString SAL_CALL getNamespaceURI()
146             throw (RuntimeException)
147         {
148             return CNode::getNamespaceURI();
149         }
getNextSibling()150         virtual Reference< XNode > SAL_CALL getNextSibling()
151             throw (RuntimeException)
152         {
153             return CNode::getNextSibling();
154         }
getNodeName()155         virtual OUString SAL_CALL getNodeName()
156             throw (RuntimeException)
157         {
158             return CNode::getNodeName();
159         }
getNodeType()160         virtual NodeType SAL_CALL getNodeType()
161             throw (RuntimeException)
162         {
163             return CNode::getNodeType();
164         }
getNodeValue()165         virtual OUString SAL_CALL getNodeValue()
166             throw (RuntimeException)
167         {
168             return getData();
169         }
getOwnerDocument()170         virtual Reference< XDocument > SAL_CALL getOwnerDocument()
171             throw (RuntimeException)
172         {
173             return CNode::getOwnerDocument();
174         }
getParentNode()175         virtual Reference< XNode > SAL_CALL getParentNode()
176             throw (RuntimeException)
177         {
178             return CNode::getParentNode();
179         }
getPrefix()180         virtual OUString SAL_CALL getPrefix()
181             throw (RuntimeException)
182         {
183             return CNode::getPrefix();
184         }
getPreviousSibling()185         virtual Reference< XNode > SAL_CALL getPreviousSibling()
186             throw (RuntimeException)
187         {
188             return CNode::getPreviousSibling();
189         }
hasAttributes()190         virtual sal_Bool SAL_CALL hasAttributes()
191             throw (RuntimeException)
192         {
193             return CNode::hasAttributes();
194         }
hasChildNodes()195         virtual sal_Bool SAL_CALL hasChildNodes()
196             throw (RuntimeException)
197         {
198             return CNode::hasChildNodes();
199         }
insertBefore(const Reference<XNode> & newChild,const Reference<XNode> & refChild)200         virtual Reference< XNode > SAL_CALL insertBefore(
201                 const Reference< XNode >& newChild, const Reference< XNode >& refChild)
202             throw (RuntimeException, DOMException)
203         {
204             return CNode::insertBefore(newChild, refChild);
205         }
isSupported(const OUString & feature,const OUString & ver)206         virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
207             throw (RuntimeException)
208         {
209             return CNode::isSupported(feature, ver);
210         }
normalize()211         virtual void SAL_CALL normalize()
212             throw (RuntimeException)
213         {
214             CNode::normalize();
215         }
removeChild(const Reference<XNode> & oldChild)216         virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
217             throw (RuntimeException, DOMException)
218         {
219             return CNode::removeChild(oldChild);
220         }
replaceChild(const Reference<XNode> & newChild,const Reference<XNode> & oldChild)221         virtual Reference< XNode > SAL_CALL replaceChild(
222                 const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
223             throw (RuntimeException, DOMException)
224         {
225             return CNode::replaceChild(newChild, oldChild);
226         }
setNodeValue(const OUString & nodeValue)227         virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
228             throw (RuntimeException, DOMException)
229         {
230             return setData(nodeValue);
231         }
setPrefix(const OUString & prefix)232         virtual void SAL_CALL setPrefix(const OUString& prefix)
233             throw (RuntimeException, DOMException)
234         {
235             return CNode::setPrefix(prefix);
236         }
237 
238 
239     };
240 }
241 
242 #endif
243