xref: /trunk/main/comphelper/inc/comphelper/propertysetinfo.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
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 _COMPHELPER_PROPERTSETINFO_HXX_
25 #define _COMPHELPER_PROPERTSETINFO_HXX_
26 
27 #include <com/sun/star/beans/XPropertySetInfo.hpp>
28 #include <cppuhelper/implbase1.hxx>
29 #include <comphelper/stl_types.hxx>
30 #include "comphelper/comphelperdllapi.h"
31 
32 //=========================================================================
33 //= property helper classes
34 //=========================================================================
35 
36 //... namespace comphelper .......................................................
37 namespace comphelper
38 {
39 //.........................................................................
40 
41 struct PropertyMapEntry
42 {
43     const sal_Char* mpName;
44     sal_uInt16 mnNameLen;
45     sal_Int32 mnHandle;
46     const com::sun::star::uno::Type* mpType;
47     sal_Int16 mnAttributes;
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 COMPHELPER_DLLPUBLIC PropertySetInfo : public ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo >
59 {
60 private:
61     PropertyMapImpl* mpMap;
62 public:
63     PropertySetInfo() throw();
64     PropertySetInfo( PropertyMapEntry* pMap ) throw();
65     virtual ~PropertySetInfo() throw();
66 
67     /** returns a stl map with all PropertyMapEntry pointer.<p>
68         The key is the property name.
69     */
70     const PropertyMap* getPropertyMap() const throw();
71 
72     /** adds an array of PropertyMapEntry to this instance.<p>
73         The end is marked with a PropertyMapEntry where mpName equals NULL</p>
74     */
75     void add( PropertyMapEntry* pMap ) throw();
76 
77     /** adds an array of PropertyMapEntry to this instance
78 
79         <p>At most the number of entries given will be added, if no terminating entry (<code>mpName == <NULL/></code>) is encountered.</p>
80 
81         <p>If <arg>nCount</arg> is less than 0, it is ignored and all entries (up to, but not including, the terminating
82         one) are added.</p>
83     */
84     void add( PropertyMapEntry* pMap, sal_Int32 nCount ) throw();
85 
86     /** removes an already added PropertyMapEntry which string in mpName equals to aName */
87     void remove( const rtl::OUString& aName ) throw();
88 
89     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getProperties() throw(::com::sun::star::uno::RuntimeException);
90     virtual ::com::sun::star::beans::Property SAL_CALL getPropertyByName( const ::rtl::OUString& aName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
91     virtual sal_Bool SAL_CALL hasPropertyByName( const ::rtl::OUString& Name ) throw(::com::sun::star::uno::RuntimeException);
92 };
93 
94 //.........................................................................
95 }
96 //... namespace comphelper .......................................................
97 
98 #endif // _UTL_PROPERTSETINFO_HXX_
99