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