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_NOTATIONSMAP_HXX
25 #define DOM_NOTATIONSMAP_HXX
26 
27 #include <sal/types.h>
28 #include <rtl/ref.hxx>
29 
30 #include <com/sun/star/uno/Reference.h>
31 #include <com/sun/star/xml/dom/XNode.hpp>
32 #include <com/sun/star/xml/dom/XNamedNodeMap.hpp>
33 
34 #include <cppuhelper/implbase1.hxx>
35 
36 
37 using ::rtl::OUString;
38 using namespace com::sun::star::uno;
39 using namespace com::sun::star::xml::dom;
40 
41 namespace DOM
42 {
43     class CDocumentType;
44 
45     class CNotationsMap
46         : public cppu::WeakImplHelper1< XNamedNodeMap >
47     {
48     private:
49         ::rtl::Reference<CDocumentType> const m_pDocType;
50         ::osl::Mutex & m_rMutex;
51 
52     public:
53         CNotationsMap(::rtl::Reference<CDocumentType> const& pDocType,
54                 ::osl::Mutex & rMutex);
55 
56         /**
57         The number of nodes in this map.
58         */
59         virtual sal_Int32 SAL_CALL getLength() throw (RuntimeException);
60 
61         /**
62         Retrieves a node specified by local name
63         */
64         virtual Reference< XNode > SAL_CALL
65             getNamedItem(OUString const& name) throw (RuntimeException);
66 
67         /**
68         Retrieves a node specified by local name and namespace URI.
69         */
70         virtual Reference< XNode > SAL_CALL getNamedItemNS(
71                 OUString const& namespaceURI, OUString const& localName)
72             throw (RuntimeException);
73 
74         /**
75         Returns the indexth item in the map.
76         */
77         virtual Reference< XNode > SAL_CALL
78             item(sal_Int32 index) throw (RuntimeException);
79 
80         /**
81         Removes a node specified by name.
82         */
83         virtual Reference< XNode > SAL_CALL
84             removeNamedItem(OUString const& name) throw (RuntimeException);
85 
86         /**
87         // Removes a node specified by local name and namespace URI.
88         */
89         virtual Reference< XNode > SAL_CALL removeNamedItemNS(
90                 OUString const& namespaceURI, OUString const& localName)
91             throw (RuntimeException);
92 
93         /**
94         // Adds a node using its nodeName attribute.
95         */
96         virtual Reference< XNode > SAL_CALL
97             setNamedItem(Reference< XNode > const& arg)
98             throw (RuntimeException);
99 
100         /**
101         Adds a node using its namespaceURI and localName.
102         */
103         virtual Reference< XNode > SAL_CALL
104             setNamedItemNS(Reference< XNode > const& arg)
105             throw (RuntimeException);
106     };
107 }
108 
109 #endif
110