1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <libxml/tree.h>
24 #include <sal/types.h>
26 #include <cppuhelper/implbase.hxx>
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>
32 #include "characterdata.hxx"
36 typedef ::cppu::ImplInheritanceHelper
< CCharacterData
, css::xml::dom::XText
> CText_Base
;
42 friend class CDocument
;
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
);
52 virtual void saxify(const css::uno::Reference
< css::xml::sax::XDocumentHandler
>& i_xHandler
) override
;
54 virtual void fastSaxify( Context
& io_rContext
) override
;
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
;
61 // --- delegations for XCharacterData
62 virtual void SAL_CALL
appendData(const OUString
& arg
) override
64 CCharacterData::appendData(arg
);
66 virtual void SAL_CALL
deleteData(sal_Int32 offset
, sal_Int32 count
) override
68 CCharacterData::deleteData(offset
, count
);
70 virtual OUString SAL_CALL
getData() override
72 return CCharacterData::getData();
74 virtual sal_Int32 SAL_CALL
getLength() override
76 return CCharacterData::getLength();
78 virtual void SAL_CALL
insertData(sal_Int32 offset
, const OUString
& arg
) override
80 CCharacterData::insertData(offset
, arg
);
82 virtual void SAL_CALL
replaceData(sal_Int32 offset
, sal_Int32 count
, const OUString
& arg
) override
84 CCharacterData::replaceData(offset
, count
, arg
);
86 virtual void SAL_CALL
setData(const OUString
& data
) override
88 CCharacterData::setData(data
);
90 virtual OUString SAL_CALL
subStringData(sal_Int32 offset
, sal_Int32 count
) override
92 return CCharacterData::subStringData(offset
, count
);
96 // --- overrides for XNode base
97 virtual OUString SAL_CALL
getNodeName() override
;
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
103 return CCharacterData::appendChild(newChild
);
105 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
cloneNode(sal_Bool deep
) override
107 return CCharacterData::cloneNode(deep
);
109 virtual css::uno::Reference
< css::xml::dom::XNamedNodeMap
> SAL_CALL
getAttributes() override
111 return CCharacterData::getAttributes();
113 virtual css::uno::Reference
< css::xml::dom::XNodeList
> SAL_CALL
getChildNodes() override
115 return CCharacterData::getChildNodes();
117 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getFirstChild() override
119 return CCharacterData::getFirstChild();
121 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getLastChild() override
123 return CCharacterData::getLastChild();
125 virtual OUString SAL_CALL
getLocalName() override
127 return CCharacterData::getLocalName();
129 virtual OUString SAL_CALL
getNamespaceURI() override
131 return CCharacterData::getNamespaceURI();
133 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getNextSibling() override
135 return CCharacterData::getNextSibling();
137 virtual css::xml::dom::NodeType SAL_CALL
getNodeType() override
139 return CCharacterData::getNodeType();
141 virtual OUString SAL_CALL
getNodeValue() override
143 return CCharacterData::getNodeValue();
145 virtual css::uno::Reference
< css::xml::dom::XDocument
> SAL_CALL
getOwnerDocument() override
147 return CCharacterData::getOwnerDocument();
149 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getParentNode() override
151 return CCharacterData::getParentNode();
153 virtual OUString SAL_CALL
getPrefix() override
155 return CCharacterData::getPrefix();
157 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
getPreviousSibling() override
159 return CCharacterData::getPreviousSibling();
161 virtual sal_Bool SAL_CALL
hasAttributes() override
163 return CCharacterData::hasAttributes();
165 virtual sal_Bool SAL_CALL
hasChildNodes() override
167 return CCharacterData::hasChildNodes();
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
172 return CCharacterData::insertBefore(newChild
, refChild
);
174 virtual sal_Bool SAL_CALL
isSupported(const OUString
& feature
, const OUString
& ver
) override
176 return CCharacterData::isSupported(feature
, ver
);
178 virtual void SAL_CALL
normalize() override
180 CCharacterData::normalize();
182 virtual css::uno::Reference
< css::xml::dom::XNode
> SAL_CALL
removeChild(const css::uno::Reference
< css::xml::dom::XNode
>& oldChild
) override
184 return CCharacterData::removeChild(oldChild
);
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
189 return CCharacterData::replaceChild(newChild
, oldChild
);
191 virtual void SAL_CALL
setNodeValue(const OUString
& nodeValue
) override
193 return CCharacterData::setNodeValue(nodeValue
);
195 virtual void SAL_CALL
setPrefix(const OUString
& prefix
) override
197 return CCharacterData::setPrefix(prefix
);
203 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */