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_ATTRIBUTESMAP_HXX 25 #define DOM_ATTRIBUTESMAP_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 CElement; 44 45 class CAttributesMap 46 : public cppu::WeakImplHelper1< XNamedNodeMap > 47 { 48 private: 49 ::rtl::Reference<CElement> const m_pElement; 50 ::osl::Mutex & m_rMutex; 51 52 public: 53 CAttributesMap(::rtl::Reference<CElement> const& pElement, 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 getNamedItem(OUString const& name) 65 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 item(sal_Int32 index) 78 throw (RuntimeException); 79 80 /** 81 Removes a node specified by name. 82 */ 83 virtual Reference< XNode > SAL_CALL 84 removeNamedItem(OUString const& name) 85 throw (RuntimeException); 86 87 /** 88 // Removes a node specified by local name and namespace URI. 89 */ 90 virtual Reference< XNode > SAL_CALL removeNamedItemNS( 91 OUString const& namespaceURI, OUString const& localName) 92 throw (RuntimeException); 93 94 /** 95 // Adds a node using its nodeName attribute. 96 */ 97 virtual Reference< XNode > SAL_CALL 98 setNamedItem(Reference< XNode > const& arg) 99 throw (RuntimeException); 100 101 /** 102 Adds a node using its namespaceURI and localName. 103 */ 104 virtual Reference< XNode > SAL_CALL 105 setNamedItemNS(Reference< XNode > const& arg) 106 throw (RuntimeException); 107 }; 108 } 109 110 #endif 111