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_DOCUMENTTYPE_HXX
25 #define DOM_DOCUMENTTYPE_HXX
26 
27 #include <libxml/tree.h>
28 
29 #include <sal/types.h>
30 
31 #include <com/sun/star/uno/Reference.h>
32 #include <com/sun/star/xml/dom/XDocumentType.hpp>
33 #include <com/sun/star/xml/dom/XNodeList.hpp>
34 #include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
35 
36 #include <node.hxx>
37 
38 
39 using ::rtl::OUString;
40 using namespace com::sun::star::uno;
41 using namespace com::sun::star::xml::dom;
42 
43 namespace DOM
44 {
45     typedef ::cppu::ImplInheritanceHelper1< CNode, XDocumentType >
46         CDocumentType_Base;
47 
48     class CDocumentType
49         : public CDocumentType_Base
50     {
51     private:
52         friend class CDocument;
53 
54     private:
55         xmlDtdPtr m_aDtdPtr;
56 
57     protected:
58         CDocumentType(CDocument const& rDocument, ::osl::Mutex const& rMutex,
59                 xmlDtdPtr const pDtd);
60 
61     public:
62         /**
63         A NamedNodeMap containing the general entities, both external and
64         internal, declared in the DTD.
65         */
66         virtual Reference< XNamedNodeMap > SAL_CALL getEntities() throw (RuntimeException);
67 
68         /**
69         The internal subset as a string, or null if there is none.
70         */
71         virtual OUString SAL_CALL getInternalSubset() throw (RuntimeException);
72 
73         /**
74         The name of DTD; i.e., the name immediately following the DOCTYPE
75         keyword.
76         */
77         virtual OUString SAL_CALL getName() throw (RuntimeException);
78 
79         /**
80         A NamedNodeMap containing the notations declared in the DTD.
81         */
82         virtual Reference< XNamedNodeMap > SAL_CALL getNotations() throw (RuntimeException);
83 
84         /**
85         The public identifier of the external subset.
86         */
87         virtual OUString SAL_CALL getPublicId() throw (RuntimeException);
88 
89         /**
90         The system identifier of the external subset.
91         */
92         virtual OUString SAL_CALL getSystemId() throw (RuntimeException);
93 
94         // ---- resolve uno inheritance problems...
95         // overrides for XNode base
96         virtual OUString SAL_CALL getNodeName()
97             throw (RuntimeException);
98         virtual OUString SAL_CALL getNodeValue()
99             throw (RuntimeException);
100     // --- delegation for XNde base.
appendChild(const Reference<XNode> & newChild)101     virtual Reference< XNode > SAL_CALL appendChild(const Reference< XNode >& newChild)
102         throw (RuntimeException, DOMException)
103     {
104         return CNode::appendChild(newChild);
105     }
cloneNode(sal_Bool deep)106     virtual Reference< XNode > SAL_CALL cloneNode(sal_Bool deep)
107         throw (RuntimeException)
108     {
109         return CNode::cloneNode(deep);
110     }
getAttributes()111     virtual Reference< XNamedNodeMap > SAL_CALL getAttributes()
112         throw (RuntimeException)
113     {
114         return CNode::getAttributes();
115     }
getChildNodes()116     virtual Reference< XNodeList > SAL_CALL getChildNodes()
117         throw (RuntimeException)
118     {
119         return CNode::getChildNodes();
120     }
getFirstChild()121     virtual Reference< XNode > SAL_CALL getFirstChild()
122         throw (RuntimeException)
123     {
124         return CNode::getFirstChild();
125     }
getLastChild()126     virtual Reference< XNode > SAL_CALL getLastChild()
127         throw (RuntimeException)
128     {
129         return CNode::getLastChild();
130     }
getLocalName()131     virtual OUString SAL_CALL getLocalName()
132         throw (RuntimeException)
133     {
134         return CNode::getLocalName();
135     }
getNamespaceURI()136     virtual OUString SAL_CALL getNamespaceURI()
137         throw (RuntimeException)
138     {
139         return CNode::getNamespaceURI();
140     }
getNextSibling()141     virtual Reference< XNode > SAL_CALL getNextSibling()
142         throw (RuntimeException)
143     {
144         return CNode::getNextSibling();
145     }
getNodeType()146     virtual NodeType SAL_CALL getNodeType()
147         throw (RuntimeException)
148     {
149         return CNode::getNodeType();
150     }
getOwnerDocument()151     virtual Reference< XDocument > SAL_CALL getOwnerDocument()
152         throw (RuntimeException)
153     {
154         return CNode::getOwnerDocument();
155     }
getParentNode()156     virtual Reference< XNode > SAL_CALL getParentNode()
157         throw (RuntimeException)
158     {
159         return CNode::getParentNode();
160     }
getPrefix()161     virtual OUString SAL_CALL getPrefix()
162         throw (RuntimeException)
163     {
164         return CNode::getPrefix();
165     }
getPreviousSibling()166     virtual Reference< XNode > SAL_CALL getPreviousSibling()
167         throw (RuntimeException)
168     {
169         return CNode::getPreviousSibling();
170     }
hasAttributes()171     virtual sal_Bool SAL_CALL hasAttributes()
172         throw (RuntimeException)
173     {
174         return CNode::hasAttributes();
175     }
hasChildNodes()176     virtual sal_Bool SAL_CALL hasChildNodes()
177         throw (RuntimeException)
178     {
179         return CNode::hasChildNodes();
180     }
insertBefore(const Reference<XNode> & newChild,const Reference<XNode> & refChild)181     virtual Reference< XNode > SAL_CALL insertBefore(
182             const Reference< XNode >& newChild, const Reference< XNode >& refChild)
183         throw (RuntimeException, DOMException)
184     {
185         return CNode::insertBefore(newChild, refChild);
186     }
isSupported(const OUString & feature,const OUString & ver)187     virtual sal_Bool SAL_CALL isSupported(const OUString& feature, const OUString& ver)
188         throw (RuntimeException)
189     {
190         return CNode::isSupported(feature, ver);
191     }
normalize()192     virtual void SAL_CALL normalize()
193         throw (RuntimeException)
194     {
195         CNode::normalize();
196     }
removeChild(const Reference<XNode> & oldChild)197     virtual Reference< XNode > SAL_CALL removeChild(const Reference< XNode >& oldChild)
198         throw (RuntimeException, DOMException)
199     {
200         return CNode::removeChild(oldChild);
201     }
replaceChild(const Reference<XNode> & newChild,const Reference<XNode> & oldChild)202     virtual Reference< XNode > SAL_CALL replaceChild(
203             const Reference< XNode >& newChild, const Reference< XNode >& oldChild)
204         throw (RuntimeException, DOMException)
205     {
206         return CNode::replaceChild(newChild, oldChild);
207     }
setNodeValue(const OUString & nodeValue)208     virtual void SAL_CALL setNodeValue(const OUString& nodeValue)
209         throw (RuntimeException, DOMException)
210     {
211         return CNode::setNodeValue(nodeValue);
212     }
setPrefix(const OUString & prefix)213     virtual void SAL_CALL setPrefix(const OUString& prefix)
214         throw (RuntimeException, DOMException)
215     {
216         return CNode::setPrefix(prefix);
217     }
218 
219     };
220 }
221 #endif
222