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 _UTL_PROPERTSETINFO_HXX_
25 #define _UTL_PROPERTSETINFO_HXX_
26 
27 #include <com/sun/star/uno/Type.h>
28 #include <com/sun/star/beans/XPropertySetInfo.hpp>
29 #include <cppuhelper/implbase1.hxx>
30 #include <comphelper/stl_types.hxx>
31 
32 //=========================================================================
33 //= property helper classes
34 //=========================================================================
35 
36 //... namespace utl .......................................................
37 namespace utl
38 {
39 //.........................................................................
40 
41 struct PropertyMapEntry
42 {
43 	const sal_Char* mpName;
44 	sal_uInt16 mnNameLen;
45 	sal_uInt16 mnWhich;
46 	const com::sun::star::uno::Type* mpType;
47 	sal_Int16 mnFlags;
48 	sal_uInt8 mnMemberId;
49 };
50 
51 DECLARE_STL_USTRINGACCESS_MAP( PropertyMapEntry*, PropertyMap );
52 
53 class PropertyMapImpl;
54 
55 /** this class implements a XPropertySetInfo that is initialized with arrays of PropertyMapEntry.
56 	It is used by the class PropertySetHelper.
57 */
58 class PropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
59 {
60 private:
61 	PropertyMapImpl* mpMap;
62 public:
63 	PropertySetInfo() throw();
64 	virtual ~PropertySetInfo() throw();
65 
66 	/** returns a stl map with all PropertyMapEntry pointer.<p>
67 		The key is the property name.
68 	*/
69 	const PropertyMap* getPropertyMap() const throw();
70 
71 	/** adds an array of PropertyMapEntry to this instance.<p>
72 		The end is marked with a PropertyMapEntry where mpName equals NULL
73 	*/
74 	void add( PropertyMapEntry* pMap ) throw();
75 
76 	/** removes an already added PropertyMapEntry which string in mpName equals to aName */
77 	void remove( const rtl::OUString& aName ) throw();
78 
79     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties() throw(::com::sun::star::uno::RuntimeException);
80     virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
81     virtual sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
82 };
83 
84 //.........................................................................
85 }
86 //... namespace utl .......................................................
87 
88 #endif // _UTL_PROPERTSETINFO_HXX_
89 
90