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