LCOV - code coverage report
Current view: top level - unoxml/source/dom - element.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 44 44 100.0 %
Date: 2014-11-03 Functions: 23 23 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef INCLUDED_UNOXML_SOURCE_DOM_ELEMENT_HXX
      21             : #define INCLUDED_UNOXML_SOURCE_DOM_ELEMENT_HXX
      22             : 
      23             : #include <libxml/tree.h>
      24             : 
      25             : #include <com/sun/star/uno/Reference.h>
      26             : #include <com/sun/star/xml/dom/XNode.hpp>
      27             : #include <com/sun/star/xml/dom/XNodeList.hpp>
      28             : #include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
      29             : #include <com/sun/star/xml/dom/NodeType.hpp>
      30             : 
      31             : #include <node.hxx>
      32             : 
      33             : namespace DOM
      34             : {
      35             :     typedef ::cppu::ImplInheritanceHelper1<CNode, css::xml::dom::XElement > CElement_Base;
      36             : 
      37     2178388 :     class CElement
      38             :         : public CElement_Base
      39             :     {
      40             :     private:
      41             :         friend class CDocument;
      42             : 
      43             :         css::uno::Reference< css::xml::dom::XAttr > setAttributeNode_Impl_Lock(
      44             :                 css::uno::Reference< css::xml::dom::XAttr > const& xNewAttr, bool const bNS);
      45             : 
      46             :     protected:
      47             :         CElement(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) SAL_OVERRIDE;
      53             : 
      54             :         virtual void fastSaxify( Context& i_rContext ) SAL_OVERRIDE;
      55             : 
      56             :         virtual bool IsChildTypeAllowed(css::xml::dom::NodeType const nodeType) SAL_OVERRIDE;
      57             : 
      58             :         /**
      59             :         Retrieves an attribute value by name.
      60             :         */
      61             :         virtual OUString  SAL_CALL getAttribute(const OUString& name)
      62             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      63             : 
      64             :         /**
      65             :         Retrieves an attribute node by name.
      66             :         */
      67             :         virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNode(const OUString& name)
      68             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      69             : 
      70             :         /**
      71             :         Retrieves an Attr node by local name and namespace URI.
      72             :         */
      73             :         virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL getAttributeNodeNS(const OUString& namespaceURI, const OUString& localName)
      74             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      75             : 
      76             :         /**
      77             :         Retrieves an attribute value by local name and namespace URI.
      78             :         */
      79             :         virtual OUString SAL_CALL getAttributeNS(const OUString& namespaceURI, const OUString& localName)
      80             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      81             : 
      82             :         /**
      83             :         Returns a NodeList of all descendant Elements with a given tag name,
      84             :         in the order in which they are
      85             :         encountered in a preorder traversal of this Element tree.
      86             :         */
      87             :         virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagName(const OUString& name)
      88             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      89             : 
      90             :         /**
      91             :         Returns a NodeList of all the descendant Elements with a given local
      92             :         name and namespace URI in the order in which they are encountered in
      93             :         a preorder traversal of this Element tree.
      94             :         */
      95             :         virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getElementsByTagNameNS(const OUString& namespaceURI,
      96             :                 const OUString& localName)
      97             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
      98             : 
      99             :         /**
     100             :         The name of the element.
     101             :         */
     102             :         virtual OUString SAL_CALL getTagName()
     103             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     104             : 
     105             :         /**
     106             :         Returns true when an attribute with a given name is specified on this
     107             :         element or has a default value, false otherwise.
     108             :         */
     109             :         virtual sal_Bool SAL_CALL hasAttribute(const OUString& name)
     110             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     111             : 
     112             :         /**
     113             :         Returns true when an attribute with a given local name and namespace
     114             :         URI is specified on this element or has a default value, false otherwise.
     115             :         */
     116             :         virtual sal_Bool SAL_CALL hasAttributeNS(const OUString& namespaceURI, const OUString& localName)
     117             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     118             : 
     119             :         /**
     120             :         Removes an attribute by name.
     121             :         */
     122             :         virtual void SAL_CALL removeAttribute(const OUString& name)
     123             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     124             : 
     125             :         /**
     126             :         Removes the specified attribute node.
     127             :         */
     128             :         virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL removeAttributeNode(const css::uno::Reference< css::xml::dom::XAttr >& oldAttr)
     129             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     130             : 
     131             :         /**
     132             :         Removes an attribute by local name and namespace URI.
     133             :         */
     134             :         virtual void SAL_CALL removeAttributeNS(const OUString& namespaceURI, const OUString& localName)
     135             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     136             : 
     137             :         /**
     138             :         Adds a new attribute.
     139             :         */
     140             :         virtual void SAL_CALL setAttribute(const OUString& name, const OUString& value)
     141             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     142             : 
     143             :         /**
     144             :         Adds a new attribute node.
     145             :         */
     146             :         virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNode(const css::uno::Reference< css::xml::dom::XAttr >& newAttr)
     147             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     148             : 
     149             :         /**
     150             :         Adds a new attribute.
     151             :         */
     152             :         virtual css::uno::Reference< css::xml::dom::XAttr > SAL_CALL setAttributeNodeNS(const css::uno::Reference< css::xml::dom::XAttr >& newAttr)
     153             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     154             : 
     155             :         /**
     156             :         Adds a new attribute.
     157             :         */
     158             :         virtual void SAL_CALL setAttributeNS(
     159             :                 const OUString& namespaceURI, const OUString& qualifiedName, const OUString& value)
     160             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE;
     161             : 
     162             :         /**
     163             :         sets the element name
     164             :         */
     165             :         virtual void SAL_CALL setElementName(const OUString& elementName)
     166             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException);
     167             : 
     168             :         // overrides for XNode base
     169             :         virtual OUString SAL_CALL getNodeName()
     170             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     171             :         virtual OUString SAL_CALL getNodeValue()
     172             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     173             :         virtual css::uno::Reference< css::xml::dom::XNamedNodeMap > SAL_CALL getAttributes()
     174             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     175             :         virtual OUString SAL_CALL getLocalName()
     176             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     177             : 
     178             :         // resolve uno inheritance problems...
     179             :         // --- delegation for XNode base.
     180      124523 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL appendChild(const css::uno::Reference< css::xml::dom::XNode >& newChild)
     181             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     182             :         {
     183      124523 :             return CNode::appendChild(newChild);
     184             :         }
     185           4 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL cloneNode(sal_Bool deep)
     186             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     187             :         {
     188           4 :             return CNode::cloneNode(deep);
     189             :         }
     190        4764 :         virtual css::uno::Reference< css::xml::dom::XNodeList > SAL_CALL getChildNodes()
     191             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     192             :         {
     193        4764 :             return CNode::getChildNodes();
     194             :         }
     195       38504 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getFirstChild()
     196             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     197             :         {
     198       38504 :             return CNode::getFirstChild();
     199             :         }
     200           8 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getLastChild()
     201             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     202             :         {
     203           8 :             return CNode::getLastChild();
     204             :         }
     205       15912 :         virtual OUString SAL_CALL getNamespaceURI()
     206             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     207             :         {
     208       15912 :             return CNode::getNamespaceURI();
     209             :         }
     210       14578 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getNextSibling()
     211             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     212             :         {
     213       14578 :             return CNode::getNextSibling();
     214             :         }
     215       23096 :         virtual css::xml::dom::NodeType SAL_CALL getNodeType()
     216             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     217             :         {
     218       23096 :             return CNode::getNodeType();
     219             :         }
     220      790112 :         virtual css::uno::Reference< css::xml::dom::XDocument > SAL_CALL getOwnerDocument()
     221             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     222             :         {
     223      790112 :             return CNode::getOwnerDocument();
     224             :         }
     225        6275 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getParentNode()
     226             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     227             :         {
     228        6275 :             return CNode::getParentNode();
     229             :         }
     230      228964 :         virtual OUString SAL_CALL getPrefix()
     231             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     232             :         {
     233      228964 :             return CNode::getPrefix();
     234             :         }
     235           2 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL getPreviousSibling()
     236             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     237             :         {
     238           2 :             return CNode::getPreviousSibling();
     239             :         }
     240       15680 :         virtual sal_Bool SAL_CALL hasAttributes()
     241             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     242             :         {
     243       15680 :             return CNode::hasAttributes();
     244             :         }
     245          18 :         virtual sal_Bool SAL_CALL hasChildNodes()
     246             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     247             :         {
     248          18 :             return CNode::hasChildNodes();
     249             :         }
     250           8 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL insertBefore(
     251             :                 const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& refChild)
     252             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     253             :         {
     254           8 :             return CNode::insertBefore(newChild, refChild);
     255             :         }
     256           2 :         virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
     257             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     258             :         {
     259           2 :             return CNode::isSupported(feature, ver);
     260             :         }
     261           2 :         virtual void SAL_CALL normalize()
     262             :             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
     263             :         {
     264           2 :             CNode::normalize();
     265           2 :         }
     266        6255 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL removeChild(const css::uno::Reference< css::xml::dom::XNode >& oldChild)
     267             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     268             :         {
     269        6255 :             return CNode::removeChild(oldChild);
     270             :         }
     271          10 :         virtual css::uno::Reference< css::xml::dom::XNode > SAL_CALL replaceChild(
     272             :                 const css::uno::Reference< css::xml::dom::XNode >& newChild, const css::uno::Reference< css::xml::dom::XNode >& oldChild)
     273             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     274             :         {
     275          10 :             return CNode::replaceChild(newChild, oldChild);
     276             :         }
     277           2 :         virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
     278             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     279             :         {
     280           2 :             return CNode::setNodeValue(nodeValue);
     281             :         }
     282           2 :         virtual void SAL_CALL setPrefix(const OUString& prefix)
     283             :             throw (css::uno::RuntimeException, css::xml::dom::DOMException, std::exception) SAL_OVERRIDE
     284             :         {
     285           2 :             return CNode::setPrefix(prefix);
     286             :         }
     287             : 
     288             :     };
     289             : 
     290             : }
     291             : 
     292             : #endif
     293             : 
     294             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10