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 _SVX_UNONAMEITEMTABLE_HXX_
25 #define _SVX_UNONAMEITEMTABLE_HXX_
26 
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/container/XNameContainer.hpp>
29 
30 #include <cppuhelper/implbase2.hxx>
31 
32 #include <vector>
33 #include <svl/lstner.hxx>
34 #include <svx/xit.hxx>
35 
36 #include <svx/xdef.hxx>
37 
38 class SdrModel;
39 class SfxItemPool;
40 class SfxItemSet;
41 
42 typedef std::vector< SfxItemSet* > ItemPoolVector;
43 class SvxUnoNameItemTable : public cppu::WeakImplHelper2< com::sun::star::container::XNameContainer, com::sun::star::lang::XServiceInfo >,
44 							public SfxListener
45 {
46 private:
47 	SdrModel*		mpModel;
48 	SfxItemPool*	mpModelPool;
49 	sal_uInt16			mnWhich;
50 	sal_uInt8			mnMemberId;
51 
52 	ItemPoolVector maItemSetVector;
53 
54 	void SAL_CALL ImplInsertByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement );
55 
56 public:
57 	SvxUnoNameItemTable( SdrModel* pModel, sal_uInt16 nWhich, sal_uInt8 nMemberId ) throw();
58 	virtual	~SvxUnoNameItemTable() throw();
59 
60 	virtual NameOrIndex* createItem() const throw() = 0;
61 	virtual bool isValid( const NameOrIndex* pItem ) const;
62 
63 	void dispose();
64 
65 	// SfxListener
66 	virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) throw ();
67 
68     // XServiceInfo
69     virtual sal_Bool SAL_CALL supportsService( const  rtl::OUString& ServiceName ) throw( com::sun::star::uno::RuntimeException);
70 
71 	// XNameContainer
72 	virtual void SAL_CALL insertByName( const  rtl::OUString& aName, const  com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
73 	virtual void SAL_CALL removeByName( const  rtl::OUString& Name ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
74 
75 	// XNameReplace
76     virtual void SAL_CALL replaceByName( const  rtl::OUString& aName, const  com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
77 
78 	// XNameAccess
79     virtual com::sun::star::uno::Any SAL_CALL getByName( const  rtl::OUString& aName ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException);
80     virtual com::sun::star::uno::Sequence<  rtl::OUString > SAL_CALL getElementNames(  ) throw( com::sun::star::uno::RuntimeException);
81     virtual sal_Bool SAL_CALL hasByName( const  rtl::OUString& aName ) throw( com::sun::star::uno::RuntimeException);
82 
83 	// XElementAccess
84     virtual sal_Bool SAL_CALL hasElements(  ) throw( com::sun::star::uno::RuntimeException);
85 };
86 
87 #endif // _SVX_UNONAMEITEMTABLE_HXX_
88