LibreOffice Module unoxml (master) 1
text.hxx
Go to the documentation of this file.
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#pragma once
21
22#include <libxml/tree.h>
23
24#include <sal/types.h>
25
27
28#include <com/sun/star/uno/Reference.h>
29#include <com/sun/star/xml/dom/XNode.hpp>
30#include <com/sun/star/xml/dom/XText.hpp>
31
32#include "characterdata.hxx"
33
34namespace DOM
35{
36 typedef ::cppu::ImplInheritanceHelper< CCharacterData, css::xml::dom::XText > CText_Base;
37
38 class CText
39 : public CText_Base
40 {
41 private:
42 friend class CDocument;
43
44 protected:
45 CText(CDocument const& rDocument, ::osl::Mutex const& rMutex,
46 css::xml::dom::NodeType const& reNodeType, xmlNodePtr const& rpNode);
47 CText(CDocument const& rDocument, ::osl::Mutex const& rMutex,
48 xmlNodePtr const pNode);
49
50 public:
51
52 virtual void saxify(const css::uno::Reference< css::xml::sax::XDocumentHandler >& i_xHandler) override;
53
54 virtual void fastSaxify( Context& io_rContext ) override;
55
56 // Breaks this node into two nodes at the specified offset, keeping
57 // both in the tree as siblings.
58 virtual css::uno::Reference< css::xml::dom::XText > SAL_CALL splitText(sal_Int32 offset) override;
59
60
61 // --- delegations for XCharacterData
62 virtual void SAL_CALL appendData(const OUString& arg) override
63 {
65 }
66 virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count) override
67 {
69 }
70 virtual OUString SAL_CALL getData() override
71 {
73 }
74 virtual sal_Int32 SAL_CALL getLength() override
75 {
77 }
78 virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg) override
79 {
80 CCharacterData::insertData(offset, arg);
81 }
82 virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg) override
83 {
85 }
86 virtual void SAL_CALL setData(const OUString& data) override
87 {
89 }
90 virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count) override
91 {
93 }
94
95
96 // --- overrides for XNode base
97 virtual OUString SAL_CALL getNodeName() override;
98
99 // --- resolve uno inheritance problems...
100 // --- delegation for XNode base.
101 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL appendChild(const css::uno::Reference< css::xml::dom::XNode >& newChild) override
102 {
103 return CCharacterData::appendChild(newChild);
104 }
105 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep) override
106 {
107 return CCharacterData::cloneNode(deep);
108 }
109 virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes() override
110 {
112 }
113 virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes() override
114 {
116 }
117 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild() override
118 {
120 }
121 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild() override
122 {
124 }
125 virtual OUString SAL_CALL getLocalName() override
126 {
128 }
129 virtual OUString SAL_CALL getNamespaceURI() override
130 {
132 }
133 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling() override
134 {
136 }
137 virtual css::xml::dom::NodeType SAL_CALL getNodeType() override
138 {
140 }
141 virtual OUString SAL_CALL getNodeValue() override
142 {
144 }
145 virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument() override
146 {
148 }
149 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode() override
150 {
152 }
153 virtual OUString SAL_CALL getPrefix() override
154 {
156 }
157 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling() override
158 {
160 }
161 virtual sal_Bool SAL_CALL hasAttributes() override
162 {
164 }
165 virtual sal_Bool SAL_CALL hasChildNodes() override
166 {
168 }
169 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore(
170 const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& refChild) override
171 {
172 return CCharacterData::insertBefore(newChild, refChild);
173 }
174 virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver) override
175 {
176 return CCharacterData::isSupported(feature, ver);
177 }
178 virtual void SAL_CALL normalize() override
179 {
181 }
182 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode >& oldChild) override
183 {
184 return CCharacterData::removeChild(oldChild);
185 }
186 virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild(
187 const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& oldChild) override
188 {
189 return CCharacterData::replaceChild(newChild, oldChild);
190 }
191 virtual void SAL_CALL setNodeValue(const OUString& nodeValue) override
192 {
193 return CCharacterData::setNodeValue(nodeValue);
194 }
195 virtual void SAL_CALL setPrefix(const OUString& prefix) override
196 {
198 }
199
200 };
201}
202
203/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString SAL_CALL getData() override
Return the character data of the node that implements this interface.
virtual OUString SAL_CALL getNodeValue() override
virtual OUString SAL_CALL getLocalName() override
virtual OUString SAL_CALL getNamespaceURI() override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling() override
virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes() override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore(const css::uno::Reference< css::xml::dom::XNode > &newChild, const css::uno::Reference< css::xml::dom::XNode > &refChild) override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL appendChild(const css::uno::Reference< css::xml::dom::XNode > &newChild) override
virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString &arg) override
Replace the characters starting at the specified 16-bit unit offset with the specified string.
virtual void SAL_CALL setPrefix(const OUString &prefix) override
virtual sal_Int32 SAL_CALL getLength() override
The number of 16-bit units that are available through data and the substringData method below.
virtual void SAL_CALL setData(const OUString &data) override
Set the character data of the node that implements this interface.
virtual void SAL_CALL normalize() override
virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes() override
virtual void SAL_CALL insertData(sal_Int32 offset, const OUString &arg) override
Insert a string at the specified 16-bit unit offset.
virtual sal_Bool SAL_CALL isSupported(const OUString &feature, const OUString &ver) override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild() override
virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count) override
Extracts a range of data from the node.
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild() override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode() override
virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument() override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild(const css::uno::Reference< css::xml::dom::XNode > &newChild, const css::uno::Reference< css::xml::dom::XNode > &oldChild) override
virtual void SAL_CALL setNodeValue(const OUString &nodeValue) override
virtual void SAL_CALL appendData(const OUString &arg) override
Append the string to the end of the character data of the node.
virtual sal_Bool SAL_CALL hasChildNodes() override
virtual sal_Bool SAL_CALL hasAttributes() override
virtual OUString SAL_CALL getPrefix() override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode > &oldChild) override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep) override
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling() override
virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count) override
Remove a range of 16-bit units from the node.
virtual css::xml::dom::NodeType SAL_CALL getNodeType() override
virtual void SAL_CALL setNodeValue(const OUString &nodeValue) override
Definition: text.hxx:191
CText(CDocument const &rDocument, ::osl::Mutex const &rMutex, css::xml::dom::NodeType const &reNodeType, xmlNodePtr const &rpNode)
virtual void SAL_CALL normalize() override
Definition: text.hxx:178
virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count) override
Definition: text.hxx:66
virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument() override
Definition: text.hxx:145
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild() override
Definition: text.hxx:121
virtual sal_Bool SAL_CALL hasAttributes() override
Definition: text.hxx:161
virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString &arg) override
Definition: text.hxx:82
virtual void fastSaxify(Context &io_rContext) override
Definition: text.cxx:48
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild(const css::uno::Reference< css::xml::dom::XNode > &newChild, const css::uno::Reference< css::xml::dom::XNode > &oldChild) override
Definition: text.hxx:186
virtual void SAL_CALL insertData(sal_Int32 offset, const OUString &arg) override
Definition: text.hxx:78
virtual void SAL_CALL setData(const OUString &data) override
Definition: text.hxx:86
virtual void SAL_CALL appendData(const OUString &arg) override
Definition: text.hxx:62
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore(const css::uno::Reference< css::xml::dom::XNode > &newChild, const css::uno::Reference< css::xml::dom::XNode > &refChild) override
Definition: text.hxx:169
virtual void saxify(const css::uno::Reference< css::xml::sax::XDocumentHandler > &i_xHandler) override
Definition: text.cxx:42
virtual OUString SAL_CALL getNamespaceURI() override
Definition: text.hxx:129
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode > &oldChild) override
Definition: text.hxx:182
virtual OUString SAL_CALL getPrefix() override
Definition: text.hxx:153
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL appendChild(const css::uno::Reference< css::xml::dom::XNode > &newChild) override
Definition: text.hxx:101
virtual OUString SAL_CALL getData() override
Definition: text.hxx:70
virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes() override
Definition: text.hxx:109
virtual css::xml::dom::NodeType SAL_CALL getNodeType() override
Definition: text.hxx:137
virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count) override
Definition: text.hxx:90
virtual OUString SAL_CALL getLocalName() override
Definition: text.hxx:125
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep) override
Definition: text.hxx:105
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode() override
Definition: text.hxx:149
virtual OUString SAL_CALL getNodeValue() override
Definition: text.hxx:141
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling() override
Definition: text.hxx:133
virtual sal_Bool SAL_CALL hasChildNodes() override
Definition: text.hxx:165
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild() override
Definition: text.hxx:117
virtual sal_Int32 SAL_CALL getLength() override
Definition: text.hxx:74
virtual void SAL_CALL setPrefix(const OUString &prefix) override
Definition: text.hxx:195
virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling() override
Definition: text.hxx:157
virtual css::uno::Reference< css::xml::dom::XText > SAL_CALL splitText(sal_Int32 offset) override
Definition: text.cxx:66
virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes() override
Definition: text.hxx:113
virtual sal_Bool SAL_CALL isSupported(const OUString &feature, const OUString &ver) override
Definition: text.hxx:174
virtual OUString SAL_CALL getNodeName() override
Definition: text.cxx:61
Definition: attr.cxx:38
::cppu::ImplInheritanceHelper< CCharacterData, css::xml::dom::XText > CText_Base
Definition: text.hxx:36
unsigned char sal_Bool