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 COLUMNSETTINGS_HXX
25 #define COLUMNSETTINGS_HXX
26 
27 /** === begin UNO includes === **/
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 /** === end UNO includes === **/
30 
31 //........................................................................
32 namespace dbaccess
33 {
34 //........................................................................
35 
36     // TODO: move the following to comphelper/propertycontainerhelper.hxx
37     class IPropertyContainer
38     {
39     public:
40 	    virtual void registerProperty(
41                     const ::rtl::OUString& _rName,
42                     sal_Int32 _nHandle,
43                     sal_Int32 _nAttributes,
44                     void* _pPointerToMember,
45                     const ::com::sun::star::uno::Type& _rMemberType
46                 ) = 0;
47 
48 	    virtual void registerMayBeVoidProperty(
49                     const ::rtl::OUString& _rName,
50                     sal_Int32 _nHandle,
51                     sal_Int32 _nAttributes,
52                     ::com::sun::star::uno::Any* _pPointerToMember,
53                     const ::com::sun::star::uno::Type& _rExpectedType
54                 ) = 0;
55 
56 	    virtual void registerPropertyNoMember(
57                     const ::rtl::OUString& _rName,
58                     sal_Int32 _nHandle,
59                     sal_Int32 _nAttributes,
60                     const ::com::sun::star::uno::Type& _rType,
61                     const void* _pInitialValue
62                 ) = 0;
63     };
64 
65     //====================================================================
66     //= OColumnSettings
67     //====================================================================
68 	class OColumnSettings
69 	{
70 	    //	<properties>
71 		::com::sun::star::uno::Any	m_aWidth;				// sal_Int32 or void
72 		::com::sun::star::uno::Any	m_aFormatKey;			// sal_Int32 or void
73 		::com::sun::star::uno::Any	m_aRelativePosition;	// sal_Int32 or void
74 		::com::sun::star::uno::Any	m_aAlignment;			// sal_Int32 (::com::sun::star::awt::TextAlign) or void
75 		::com::sun::star::uno::Any	m_aHelpText;			// the description of the column which is visible in the helptext of the column
76 		::com::sun::star::uno::Any	m_aControlDefault;		// the default value which should be displayed as by a control when moving to a new row
77 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
78 									m_xControlModel;
79 		sal_Bool					m_bHidden;
80 	    //	</properties>
81 
82     protected:
83 		virtual ~OColumnSettings();
84 
85 	public:
86 		OColumnSettings();
87 
88     protected:
89         void registerProperties( IPropertyContainer& _rPropertyContainer );
90 
91         /** determines whether the property with the given handle is handled by the class
92         */
93         static bool isColumnSettingProperty( const sal_Int32 _nPropertyHandle );
94         static bool isDefaulted( const sal_Int32 _nPropertyHandle, const ::com::sun::star::uno::Any& _rPropertyValue );
95 
96     public:
97 		/** check if the persistent settings have their default value
98 		*/
99         static bool hasDefaultSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn );
100 	};
101 
102 //........................................................................
103 } // namespace dbaccess
104 //........................................................................
105 
106 #endif // COLUMNSETTINGS_HXX
107