xref: /aoo41x/main/unoxml/source/dom/text.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_TEXT_HXX
29 #define DOM_TEXT_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/XText.hpp>
40 
41 #include <characterdata.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< CCharacterData, XText > CText_Base;
51 
52     class CText
53         : public CText_Base
54     {
55     private:
56         friend class CDocument;
57 
58     protected:
59         CText(CDocument const& rDocument, ::osl::Mutex const& rMutex,
60                 NodeType const& reNodeType, xmlNodePtr const& rpNode);
61         CText(CDocument const& rDocument, ::osl::Mutex const& rMutex,
62                 xmlNodePtr const pNode);
63 
64     public:
65 
66         virtual void saxify(const Reference< XDocumentHandler >& i_xHandler);
67 
68         virtual void fastSaxify( Context& io_rContext );
69 
70 	     // Breaks this node into two nodes at the specified offset, keeping
71 	     // both in the tree as siblings.
72 	     virtual Reference< XText > SAL_CALL splitText(sal_Int32 offset)
73              throw (RuntimeException);
74 
75 
76          // --- delegations for XCharacterData
77         virtual void SAL_CALL appendData(const OUString& arg)
78             throw (RuntimeException, DOMException)
79         {
80             CCharacterData::appendData(arg);
81         }
82         virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count)
83             throw (RuntimeException, DOMException)
84         {
85             CCharacterData::deleteData(offset, count);
86         }
87         virtual OUString SAL_CALL getData() throw (RuntimeException)
88         {
89             return CCharacterData::getData();
90         }
91         virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException)
92         {
93             return CCharacterData::getLength();
94         }
95         virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg)
96             throw (RuntimeException, DOMException)
97         {
98             CCharacterData::insertData(offset, arg);
99         }
100         virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg)
101             throw (RuntimeException, DOMException)
102         {
103             CCharacterData::replaceData(offset, count, arg);
104         }
105         virtual void SAL_CALL setData(const OUString& data)
106             throw (RuntimeException, DOMException)
107         {
108             CCharacterData::setData(data);
109         }
110         virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count)
111             throw (RuntimeException, DOMException)
112         {
113             return CCharacterData::subStringData(offset, count);
114         }
115 
116 
117          // --- overrides for XNode base
118         virtual OUString SAL_CALL getNodeName()
119             throw (RuntimeException);
120 
121         // --- resolve uno inheritance problems...
122         // --- delegation for XNde base.
123         virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
124             throw (RuntimeException, DOMException)
125         {
126             return CCharacterData::appendChild(newChild);
127         }
128         virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
129             throw (RuntimeException)
130         {
131             return CCharacterData::cloneNode(deep);
132         }
133         virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
134             throw (RuntimeException)
135         {
136             return CCharacterData::getAttributes();
137         }
138         virtual Reference< XNodeList > SAL_CALL getChildNodes()
139             throw (RuntimeException)
140         {
141             return CCharacterData::getChildNodes();
142         }
143         virtual Reference< XNode > SAL_CALL getFirstChild()
144             throw (RuntimeException)
145         {
146             return CCharacterData::getFirstChild();
147         }
148         virtual Reference< XNode > SAL_CALL getLastChild()
149             throw (RuntimeException)
150         {
151             return CCharacterData::getLastChild();
152         }
153         virtual OUString SAL_CALL getLocalName()
154             throw (RuntimeException)
155         {
156             return CCharacterData::getLocalName();
157         }
158         virtual OUString SAL_CALL getNamespaceURI()
159             throw (RuntimeException)
160         {
161             return CCharacterData::getNamespaceURI();
162         }
163         virtual Reference< XNode > SAL_CALL getNextSibling()
164             throw (RuntimeException)
165         {
166             return CCharacterData::getNextSibling();
167         }
168         virtual NodeType SAL_CALL getNodeType()
169             throw (RuntimeException)
170         {
171             return CCharacterData::getNodeType();
172         }
173         virtual OUString SAL_CALL getNodeValue() throw (RuntimeException)
174         {
175             return CCharacterData::getNodeValue();
176         }
177         virtual Reference< XDocument > SAL_CALL getOwnerDocument()
178             throw (RuntimeException)
179         {
180             return CCharacterData::getOwnerDocument();
181         }
182         virtual Reference< XNode > SAL_CALL getParentNode()
183             throw (RuntimeException)
184         {
185             return CCharacterData::getParentNode();
186         }
187         virtual OUString SAL_CALL getPrefix()
188             throw (RuntimeException)
189         {
190             return CCharacterData::getPrefix();
191         }
192         virtual Reference< XNode > SAL_CALL getPreviousSibling()
193             throw (RuntimeException)
194         {
195             return CCharacterData::getPreviousSibling();
196         }
197         virtual sal_Bool SAL_CALL hasAttributes()
198             throw (RuntimeException)
199         {
200             return CCharacterData::hasAttributes();
201         }
202         virtual sal_Bool SAL_CALL hasChildNodes()
203             throw (RuntimeException)
204         {
205             return CCharacterData::hasChildNodes();
206         }
207         virtual Reference< XNode > SAL_CALL insertBefore(
208                 const Reference< XNode >& newChild, const Reference< XNode >& refChild)
209             throw (RuntimeException, DOMException)
210         {
211             return CCharacterData::insertBefore(newChild, refChild);
212         }
213         virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
214             throw (RuntimeException)
215         {
216             return CCharacterData::isSupported(feature, ver);
217         }
218         virtual void SAL_CALL normalize()
219             throw (RuntimeException)
220         {
221             CCharacterData::normalize();
222         }
223         virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
224             throw (RuntimeException, DOMException)
225         {
226             return CCharacterData::removeChild(oldChild);
227         }
228         virtual Reference< XNode > SAL_CALL replaceChild(
229                 const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
230             throw (RuntimeException, DOMException)
231         {
232             return CCharacterData::replaceChild(newChild, oldChild);
233         }
234         virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
235             throw (RuntimeException, DOMException)
236         {
237             return CCharacterData::setNodeValue(nodeValue);
238         }
239         virtual void SAL_CALL setPrefix(const OUString& prefix)
240             throw (RuntimeException, DOMException)
241         {
242             return CCharacterData::setPrefix(prefix);
243         }
244 
245     };
246 }
247 #endif
248