1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef DOM_TEXT_HXX 25 #define DOM_TEXT_HXX 26 27 #include <libxml/tree.h> 28 29 #include <sal/types.h> 30 31 #include <cppuhelper/implbase1.hxx> 32 33 #include <com/sun/star/uno/Reference.h> 34 #include <com/sun/star/xml/dom/XNode.hpp> 35 #include <com/sun/star/xml/dom/XText.hpp> 36 37 #include <characterdata.hxx> 38 39 40 using ::rtl::OUString; 41 using namespace com::sun::star::uno; 42 using namespace com::sun::star::xml::dom; 43 44 namespace DOM 45 { 46 typedef ::cppu::ImplInheritanceHelper1< CCharacterData, XText > CText_Base; 47 48 class CText 49 : public CText_Base 50 { 51 private: 52 friend class CDocument; 53 54 protected: 55 CText(CDocument const& rDocument, ::osl::Mutex const& rMutex, 56 NodeType const& reNodeType, xmlNodePtr const& rpNode); 57 CText(CDocument const& rDocument, ::osl::Mutex const& rMutex, 58 xmlNodePtr const pNode); 59 60 public: 61 62 virtual void saxify(const Reference< XDocumentHandler >& i_xHandler); 63 64 virtual void fastSaxify( Context& io_rContext ); 65 66 // Breaks this node into two nodes at the specified offset, keeping 67 // both in the tree as siblings. 68 virtual Reference< XText > SAL_CALL splitText(sal_Int32 offset) 69 throw (RuntimeException); 70 71 72 // --- delegations for XCharacterData appendData(const OUString & arg)73 virtual void SAL_CALL appendData(const OUString& arg) 74 throw (RuntimeException, DOMException) 75 { 76 CCharacterData::appendData(arg); 77 } deleteData(sal_Int32 offset,sal_Int32 count)78 virtual void SAL_CALL deleteData(sal_Int32 offset, sal_Int32 count) 79 throw (RuntimeException, DOMException) 80 { 81 CCharacterData::deleteData(offset, count); 82 } getData()83 virtual OUString SAL_CALL getData() throw (RuntimeException) 84 { 85 return CCharacterData::getData(); 86 } getLength()87 virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException) 88 { 89 return CCharacterData::getLength(); 90 } insertData(sal_Int32 offset,const OUString & arg)91 virtual void SAL_CALL insertData(sal_Int32 offset, const OUString& arg) 92 throw (RuntimeException, DOMException) 93 { 94 CCharacterData::insertData(offset, arg); 95 } replaceData(sal_Int32 offset,sal_Int32 count,const OUString & arg)96 virtual void SAL_CALL replaceData(sal_Int32 offset, sal_Int32 count, const OUString& arg) 97 throw (RuntimeException, DOMException) 98 { 99 CCharacterData::replaceData(offset, count, arg); 100 } setData(const OUString & data)101 virtual void SAL_CALL setData(const OUString& data) 102 throw (RuntimeException, DOMException) 103 { 104 CCharacterData::setData(data); 105 } subStringData(sal_Int32 offset,sal_Int32 count)106 virtual OUString SAL_CALL subStringData(sal_Int32 offset, sal_Int32 count) 107 throw (RuntimeException, DOMException) 108 { 109 return CCharacterData::subStringData(offset, count); 110 } 111 112 113 // --- overrides for XNode base 114 virtual OUString SAL_CALL getNodeName() 115 throw (RuntimeException); 116 117 // --- resolve uno inheritance problems... 118 // --- delegation for XNde base. appendChild(const Reference<XNode> & newChild)119 virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild) 120 throw (RuntimeException, DOMException) 121 { 122 return CCharacterData::appendChild(newChild); 123 } cloneNode(sal_Bool deep)124 virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep) 125 throw (RuntimeException) 126 { 127 return CCharacterData::cloneNode(deep); 128 } getAttributes()129 virtual Reference< XNamedNodeMap > SAL_CALL getAttributes() 130 throw (RuntimeException) 131 { 132 return CCharacterData::getAttributes(); 133 } getChildNodes()134 virtual Reference< XNodeList > SAL_CALL getChildNodes() 135 throw (RuntimeException) 136 { 137 return CCharacterData::getChildNodes(); 138 } getFirstChild()139 virtual Reference< XNode > SAL_CALL getFirstChild() 140 throw (RuntimeException) 141 { 142 return CCharacterData::getFirstChild(); 143 } getLastChild()144 virtual Reference< XNode > SAL_CALL getLastChild() 145 throw (RuntimeException) 146 { 147 return CCharacterData::getLastChild(); 148 } getLocalName()149 virtual OUString SAL_CALL getLocalName() 150 throw (RuntimeException) 151 { 152 return CCharacterData::getLocalName(); 153 } getNamespaceURI()154 virtual OUString SAL_CALL getNamespaceURI() 155 throw (RuntimeException) 156 { 157 return CCharacterData::getNamespaceURI(); 158 } getNextSibling()159 virtual Reference< XNode > SAL_CALL getNextSibling() 160 throw (RuntimeException) 161 { 162 return CCharacterData::getNextSibling(); 163 } getNodeType()164 virtual NodeType SAL_CALL getNodeType() 165 throw (RuntimeException) 166 { 167 return CCharacterData::getNodeType(); 168 } getNodeValue()169 virtual OUString SAL_CALL getNodeValue() throw (RuntimeException) 170 { 171 return CCharacterData::getNodeValue(); 172 } getOwnerDocument()173 virtual Reference< XDocument > SAL_CALL getOwnerDocument() 174 throw (RuntimeException) 175 { 176 return CCharacterData::getOwnerDocument(); 177 } getParentNode()178 virtual Reference< XNode > SAL_CALL getParentNode() 179 throw (RuntimeException) 180 { 181 return CCharacterData::getParentNode(); 182 } getPrefix()183 virtual OUString SAL_CALL getPrefix() 184 throw (RuntimeException) 185 { 186 return CCharacterData::getPrefix(); 187 } getPreviousSibling()188 virtual Reference< XNode > SAL_CALL getPreviousSibling() 189 throw (RuntimeException) 190 { 191 return CCharacterData::getPreviousSibling(); 192 } hasAttributes()193 virtual sal_Bool SAL_CALL hasAttributes() 194 throw (RuntimeException) 195 { 196 return CCharacterData::hasAttributes(); 197 } hasChildNodes()198 virtual sal_Bool SAL_CALL hasChildNodes() 199 throw (RuntimeException) 200 { 201 return CCharacterData::hasChildNodes(); 202 } insertBefore(const Reference<XNode> & newChild,const Reference<XNode> & refChild)203 virtual Reference< XNode > SAL_CALL insertBefore( 204 const Reference< XNode >& newChild, const Reference< XNode >& refChild) 205 throw (RuntimeException, DOMException) 206 { 207 return CCharacterData::insertBefore(newChild, refChild); 208 } isSupported(const OUString & feature,const OUString & ver)209 virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver) 210 throw (RuntimeException) 211 { 212 return CCharacterData::isSupported(feature, ver); 213 } normalize()214 virtual void SAL_CALL normalize() 215 throw (RuntimeException) 216 { 217 CCharacterData::normalize(); 218 } removeChild(const Reference<XNode> & oldChild)219 virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild) 220 throw (RuntimeException, DOMException) 221 { 222 return CCharacterData::removeChild(oldChild); 223 } replaceChild(const Reference<XNode> & newChild,const Reference<XNode> & oldChild)224 virtual Reference< XNode > SAL_CALL replaceChild( 225 const Reference< XNode >& newChild, const Reference< XNode >& oldChild) 226 throw (RuntimeException, DOMException) 227 { 228 return CCharacterData::replaceChild(newChild, oldChild); 229 } setNodeValue(const OUString & nodeValue)230 virtual void SAL_CALL setNodeValue(const OUString& nodeValue) 231 throw (RuntimeException, DOMException) 232 { 233 return CCharacterData::setNodeValue(nodeValue); 234 } setPrefix(const OUString & prefix)235 virtual void SAL_CALL setPrefix(const OUString& prefix) 236 throw (RuntimeException, DOMException) 237 { 238 return CCharacterData::setPrefix(prefix); 239 } 240 241 }; 242 } 243 #endif 244