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 _EXTENSIONS_FORMSCTRLR_FORMBROWSERTOOLS_HXX_
25 #define _EXTENSIONS_FORMSCTRLR_FORMBROWSERTOOLS_HXX_
26 
27 #include <com/sun/star/uno/Any.hxx>
28 #include <com/sun/star/beans/Property.hpp>
29 #include <rtl/ustring.hxx>
30 
31 #include <functional>
32 #include <set>
33 
34 //............................................................................
35 namespace pcr
36 {
37 //............................................................................
38 
39 	::rtl::OUString GetUIHeadlineName(sal_Int16 _nClassId, const ::com::sun::star::uno::Any& _rUnoObject);
40     sal_Int16 classifyComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent );
41 
42 	//========================================================================
43     struct FindPropertyByHandle : public ::std::unary_function< ::com::sun::star::beans::Property, bool >
44     {
45     private:
46         sal_Int32 m_nId;
47 
48     public:
FindPropertyByHandlepcr::FindPropertyByHandle49         FindPropertyByHandle( sal_Int32 _nId ) : m_nId ( _nId ) { }
operator ()pcr::FindPropertyByHandle50         bool operator()( const ::com::sun::star::beans::Property& _rProp ) const
51         {
52             return m_nId == _rProp.Handle;
53         }
54     };
55 
56 	//========================================================================
57     struct FindPropertyByName : public ::std::unary_function< ::com::sun::star::beans::Property, bool >
58     {
59     private:
60         ::rtl::OUString m_sName;
61 
62     public:
FindPropertyByNamepcr::FindPropertyByName63         FindPropertyByName( const ::rtl::OUString& _rName ) : m_sName( _rName ) { }
operator ()pcr::FindPropertyByName64         bool operator()( const ::com::sun::star::beans::Property& _rProp ) const
65         {
66             return m_sName == _rProp.Name;
67         }
68     };
69 
70 	//========================================================================
71 	struct PropertyLessByName
72 				:public ::std::binary_function	<	::com::sun::star::beans::Property,
73 													::com::sun::star::beans::Property,
74 													bool
75 												>
76 	{
operator ()pcr::PropertyLessByName77 		bool operator() (::com::sun::star::beans::Property _rLhs, ::com::sun::star::beans::Property _rRhs) const
78 		{
79 			return _rLhs.Name < _rRhs.Name ? true : false;
80 		}
81 	};
82 
83 	//========================================================================
84 	struct TypeLessByName
85 				:public ::std::binary_function	<	::com::sun::star::uno::Type,
86 													::com::sun::star::uno::Type,
87 													bool
88 												>
89 	{
operator ()pcr::TypeLessByName90 		bool operator() (::com::sun::star::uno::Type _rLhs, ::com::sun::star::uno::Type _rRhs) const
91 		{
92 			return _rLhs.getTypeName() < _rRhs.getTypeName() ? true : false;
93 		}
94 	};
95 
96 	//========================================================================
97     typedef ::std::set< ::com::sun::star::beans::Property, PropertyLessByName > PropertyBag;
98 
99 //............................................................................
100 } // namespace pcr
101 //............................................................................
102 
103 #endif // _EXTENSIONS_FORMSCTRLR_FORMBROWSERTOOLS_HXX_
104 
105