1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef INCLUDED_PDFI_SAXATTRLIST_HXX 29 #define INCLUDED_PDFI_SAXATTRLIST_HXX 30 31 #include <rtl/ustring.hxx> 32 #include <vector> 33 #include <hash_map> 34 #include <cppuhelper/implbase2.hxx> 35 36 #include <com/sun/star/util/XCloneable.hpp> 37 #include <com/sun/star/xml/sax/XAttributeList.hpp> 38 39 namespace pdfi 40 { 41 class SaxAttrList : public ::cppu::WeakImplHelper2< 42 com::sun::star::xml::sax::XAttributeList, 43 com::sun::star::util::XCloneable 44 > 45 { 46 struct AttrEntry 47 { 48 rtl::OUString m_aName; 49 rtl::OUString m_aValue; 50 51 AttrEntry( const rtl::OUString& i_rName, const rtl::OUString& i_rValue ) 52 : m_aName( i_rName ), m_aValue( i_rValue ) {} 53 }; 54 std::vector< AttrEntry > m_aAttributes; 55 std::hash_map< rtl::OUString, size_t, rtl::OUStringHash > m_aIndexMap; 56 57 public: 58 SaxAttrList() {} 59 SaxAttrList( const std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >& ); 60 SaxAttrList( const SaxAttrList& ); 61 virtual ~SaxAttrList(); 62 63 // ::com::sun::star::xml::sax::XAttributeList 64 virtual sal_Int16 SAL_CALL getLength() throw(); 65 virtual rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw(); 66 virtual rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw(); 67 virtual rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw(); 68 virtual rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw(); 69 virtual rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw(); 70 71 // ::com::sun::star::util::XCloneable 72 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw(); 73 }; 74 } 75 76 #endif 77