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