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 _XMLOFF_MUTABLEATTRLIST_HXX
29 #define _XMLOFF_MUTABLEATTRLIST_HXX
30 
31 #include <com/sun/star/util/XCloneable.hpp>
32 #include <com/sun/star/xml/sax/XAttributeList.hpp>
33 #include <com/sun/star/lang/XUnoTunnel.hpp>
34 
35 #include <cppuhelper/implbase3.hxx>
36 
37 class SvXMLAttributeList;
38 
39 class XMLMutableAttributeList : public ::cppu::WeakImplHelper3<
40 		::com::sun::star::xml::sax::XAttributeList,
41 		::com::sun::star::util::XCloneable,
42 		::com::sun::star::lang::XUnoTunnel>
43 {
44 	::com::sun::star::uno::Reference<
45 		::com::sun::star::xml::sax::XAttributeList> m_xAttrList;
46 
47 	SvXMLAttributeList *m_pMutableAttrList;
48 
49 	SvXMLAttributeList *GetMutableAttrList();
50 
51 public:
52 	XMLMutableAttributeList();
53 	XMLMutableAttributeList( const ::com::sun::star::uno::Reference<
54 		::com::sun::star::xml::sax::XAttributeList> & rAttrList,
55 		   sal_Bool bClone=sal_False );
56 	~XMLMutableAttributeList();
57 
58 	static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw();
59 
60 	// XUnoTunnel
61     virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
62 
63 	// ::com::sun::star::xml::sax::XAttributeList
64 	virtual sal_Int16 SAL_CALL getLength(void) throw( ::com::sun::star::uno::RuntimeException );
65 	virtual ::rtl::OUString SAL_CALL getNameByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
66 	virtual ::rtl::OUString SAL_CALL getTypeByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
67 	virtual ::rtl::OUString SAL_CALL getTypeByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
68 	virtual ::rtl::OUString SAL_CALL getValueByIndex(sal_Int16 i) throw( ::com::sun::star::uno::RuntimeException );
69 	virtual ::rtl::OUString SAL_CALL getValueByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException );
70 
71 	// ::com::sun::star::util::XCloneable
72 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()	throw( ::com::sun::star::uno::RuntimeException );
73 
74 	// methods that are not contained in any interface
75 	void SetValueByIndex( sal_Int16 i, const ::rtl::OUString& rValue );
76 	void AddAttribute( const ::rtl::OUString &sName , const ::rtl::OUString &sValue );
77 //	void Clear();
78 	void RemoveAttributeByIndex( sal_Int16 i );
79 	void RenameAttributeByIndex( sal_Int16 i, const ::rtl::OUString& rNewName );
80 //	void SetAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & );
81 	void AppendAttributeList( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & );
82 
83 	sal_Int16 GetIndexByName( const ::rtl::OUString& rName ) const;
84 };
85 
86 
87 #endif	//  _XMLOFF_MUTABLEATTRLIST_HXX
88