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 INCLUDED_PDFI_SAXATTRLIST_HXX
25 #define INCLUDED_PDFI_SAXATTRLIST_HXX
26 
27 #include <rtl/ustring.hxx>
28 #include <vector>
29 #include <hash_map>
30 #include <cppuhelper/implbase2.hxx>
31 
32 #include <com/sun/star/util/XCloneable.hpp>
33 #include <com/sun/star/xml/sax/XAttributeList.hpp>
34 
35 namespace pdfi
36 {
37     class SaxAttrList : public ::cppu::WeakImplHelper2<
38 		    com::sun::star::xml::sax::XAttributeList,
39             com::sun::star::util::XCloneable
40             >
41     {
42         struct AttrEntry
43         {
44             rtl::OUString m_aName;
45             rtl::OUString m_aValue;
46 
AttrEntrypdfi::SaxAttrList::AttrEntry47             AttrEntry( const rtl::OUString& i_rName, const rtl::OUString& i_rValue )
48             : m_aName( i_rName ), m_aValue( i_rValue ) {}
49         };
50         std::vector< AttrEntry >                                    m_aAttributes;
51         std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >   m_aIndexMap;
52 
53     public:
SaxAttrList()54         SaxAttrList() {}
55         SaxAttrList( const std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >& );
56         SaxAttrList( const SaxAttrList& );
57         virtual ~SaxAttrList();
58 
59         // ::com::sun::star::xml::sax::XAttributeList
60         virtual sal_Int16 SAL_CALL getLength() throw();
61         virtual rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw();
62         virtual rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw();
63         virtual rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw();
64         virtual rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw();
65         virtual rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw();
66 
67         // ::com::sun::star::util::XCloneable
68         virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw();
69     };
70 }
71 
72 #endif
73