Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_UNOXML_SOURCE_DOM_CHARACTERDATA_HXX
21 : #define INCLUDED_UNOXML_SOURCE_DOM_CHARACTERDATA_HXX
22 :
23 : #include <libxml/tree.h>
24 :
25 : #include <sal/types.h>
26 :
27 : #include <cppuhelper/implbase1.hxx>
28 :
29 : #include <com/sun/star/uno/Reference.h>
30 : #include <com/sun/star/xml/dom/XNode.hpp>
31 : #include <com/sun/star/xml/dom/XCharacterData.hpp>
32 :
33 : #include <node.hxx>
34 :
35 :
36 : using namespace com::sun::star::uno;
37 : using namespace com::sun::star::xml::dom;
38 :
39 : namespace DOM
40 : {
41 : typedef ::cppu::ImplInheritanceHelper1< CNode, XCharacterData >
42 : CCharacterData_Base;
43 :
44 0 : class CCharacterData
45 : : public CCharacterData_Base
46 : {
47 :
48 : protected:
49 : CCharacterData(CDocument const& rDocument, ::osl::Mutex const& rMutex,
50 : NodeType const& reNodeType, xmlNodePtr const& rpNode);
51 :
52 : void dispatchEvent_Impl(
53 : OUString const& prevValue, OUString const& newValue);
54 :
55 : public:
56 : /**
57 : Append the string to the end of the character data of the node.
58 : */
59 : virtual void SAL_CALL appendData(const OUString& arg)
60 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE;
61 :
62 : /**
63 : Remove a range of 16-bit units from the node.
64 : */
65 : virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
66 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE;
67 :
68 : /**
69 : Return the character data of the node that implements this interface.
70 : */
71 : virtual OUString SAL_CALL getData() throw (RuntimeException, std::exception) SAL_OVERRIDE;
72 :
73 : /**
74 : The number of 16-bit units that are available through data and the
75 : substringData method below.
76 : */
77 : virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException, std::exception) SAL_OVERRIDE;
78 :
79 : /**
80 : Insert a string at the specified 16-bit unit offset.
81 : */
82 : virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
83 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE;
84 :
85 : /**
86 : Replace the characters starting at the specified 16-bit unit offset
87 : with the specified string.
88 : */
89 : virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
90 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE;
91 :
92 : /**
93 : Set the character data of the node that implements this interface.
94 : */
95 : virtual void SAL_CALL setData(const OUString& data)
96 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE;
97 :
98 : /**
99 : Extracts a range of data from the node.
100 : */
101 : virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
102 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE;
103 :
104 : // --- delegation for XNode base.
105 0 : virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
106 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE
107 : {
108 0 : return CNode::appendChild(newChild);
109 : }
110 0 : virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
111 : throw (RuntimeException, std::exception) SAL_OVERRIDE
112 : {
113 0 : return CNode::cloneNode(deep);
114 : }
115 0 : virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
116 : throw (RuntimeException, std::exception) SAL_OVERRIDE
117 : {
118 0 : return CNode::getAttributes();
119 : }
120 0 : virtual Reference< XNodeList > SAL_CALL getChildNodes()
121 : throw (RuntimeException, std::exception) SAL_OVERRIDE
122 : {
123 0 : return CNode::getChildNodes();
124 : }
125 0 : virtual Reference< XNode > SAL_CALL getFirstChild()
126 : throw (RuntimeException, std::exception) SAL_OVERRIDE
127 : {
128 0 : return CNode::getFirstChild();
129 : }
130 0 : virtual Reference< XNode > SAL_CALL getLastChild()
131 : throw (RuntimeException, std::exception) SAL_OVERRIDE
132 : {
133 0 : return CNode::getLastChild();
134 : }
135 0 : virtual OUString SAL_CALL getLocalName()
136 : throw (RuntimeException, std::exception) SAL_OVERRIDE
137 : {
138 0 : return CNode::getLocalName();
139 : }
140 0 : virtual OUString SAL_CALL getNamespaceURI()
141 : throw (RuntimeException, std::exception) SAL_OVERRIDE
142 : {
143 0 : return CNode::getNamespaceURI();
144 : }
145 0 : virtual Reference< XNode > SAL_CALL getNextSibling()
146 : throw (RuntimeException, std::exception) SAL_OVERRIDE
147 : {
148 0 : return CNode::getNextSibling();
149 : }
150 0 : virtual OUString SAL_CALL getNodeName()
151 : throw (RuntimeException, std::exception) SAL_OVERRIDE
152 : {
153 0 : return CNode::getNodeName();
154 : }
155 0 : virtual NodeType SAL_CALL getNodeType()
156 : throw (RuntimeException, std::exception) SAL_OVERRIDE
157 : {
158 0 : return CNode::getNodeType();
159 : }
160 0 : virtual OUString SAL_CALL getNodeValue()
161 : throw (RuntimeException, std::exception) SAL_OVERRIDE
162 : {
163 0 : return getData();
164 : }
165 0 : virtual Reference< XDocument > SAL_CALL getOwnerDocument()
166 : throw (RuntimeException, std::exception) SAL_OVERRIDE
167 : {
168 0 : return CNode::getOwnerDocument();
169 : }
170 0 : virtual Reference< XNode > SAL_CALL getParentNode()
171 : throw (RuntimeException, std::exception) SAL_OVERRIDE
172 : {
173 0 : return CNode::getParentNode();
174 : }
175 0 : virtual OUString SAL_CALL getPrefix()
176 : throw (RuntimeException, std::exception) SAL_OVERRIDE
177 : {
178 0 : return CNode::getPrefix();
179 : }
180 0 : virtual Reference< XNode > SAL_CALL getPreviousSibling()
181 : throw (RuntimeException, std::exception) SAL_OVERRIDE
182 : {
183 0 : return CNode::getPreviousSibling();
184 : }
185 0 : virtual sal_Bool SAL_CALL hasAttributes()
186 : throw (RuntimeException, std::exception) SAL_OVERRIDE
187 : {
188 0 : return CNode::hasAttributes();
189 : }
190 0 : virtual sal_Bool SAL_CALL hasChildNodes()
191 : throw (RuntimeException, std::exception) SAL_OVERRIDE
192 : {
193 0 : return CNode::hasChildNodes();
194 : }
195 0 : virtual Reference< XNode > SAL_CALL insertBefore(
196 : const Reference< XNode >& newChild, const Reference< XNode >& refChild)
197 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE
198 : {
199 0 : return CNode::insertBefore(newChild, refChild);
200 : }
201 0 : virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
202 : throw (RuntimeException, std::exception) SAL_OVERRIDE
203 : {
204 0 : return CNode::isSupported(feature, ver);
205 : }
206 0 : virtual void SAL_CALL normalize()
207 : throw (RuntimeException, std::exception) SAL_OVERRIDE
208 : {
209 0 : CNode::normalize();
210 0 : }
211 0 : virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
212 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE
213 : {
214 0 : return CNode::removeChild(oldChild);
215 : }
216 0 : virtual Reference< XNode > SAL_CALL replaceChild(
217 : const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
218 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE
219 : {
220 0 : return CNode::replaceChild(newChild, oldChild);
221 : }
222 0 : virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
223 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE
224 : {
225 0 : return setData(nodeValue);
226 : }
227 0 : virtual void SAL_CALL setPrefix(const OUString& prefix)
228 : throw (RuntimeException, DOMException, std::exception) SAL_OVERRIDE
229 : {
230 0 : return CNode::setPrefix(prefix);
231 : }
232 :
233 :
234 : };
235 : }
236 :
237 : #endif
238 :
239 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|