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