1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef COLUMNSETTINGS_HXX
25cdf0e10cSrcweir #define COLUMNSETTINGS_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir /** === begin UNO includes === **/
28cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
29cdf0e10cSrcweir /** === end UNO includes === **/
30cdf0e10cSrcweir 
31cdf0e10cSrcweir //........................................................................
32cdf0e10cSrcweir namespace dbaccess
33cdf0e10cSrcweir {
34cdf0e10cSrcweir //........................................................................
35cdf0e10cSrcweir 
36cdf0e10cSrcweir     // TODO: move the following to comphelper/propertycontainerhelper.hxx
37cdf0e10cSrcweir     class IPropertyContainer
38cdf0e10cSrcweir     {
39cdf0e10cSrcweir     public:
40cdf0e10cSrcweir 	    virtual void registerProperty(
41cdf0e10cSrcweir                     const ::rtl::OUString& _rName,
42cdf0e10cSrcweir                     sal_Int32 _nHandle,
43cdf0e10cSrcweir                     sal_Int32 _nAttributes,
44cdf0e10cSrcweir                     void* _pPointerToMember,
45cdf0e10cSrcweir                     const ::com::sun::star::uno::Type& _rMemberType
46cdf0e10cSrcweir                 ) = 0;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 	    virtual void registerMayBeVoidProperty(
49cdf0e10cSrcweir                     const ::rtl::OUString& _rName,
50cdf0e10cSrcweir                     sal_Int32 _nHandle,
51cdf0e10cSrcweir                     sal_Int32 _nAttributes,
52cdf0e10cSrcweir                     ::com::sun::star::uno::Any* _pPointerToMember,
53cdf0e10cSrcweir                     const ::com::sun::star::uno::Type& _rExpectedType
54cdf0e10cSrcweir                 ) = 0;
55cdf0e10cSrcweir 
56cdf0e10cSrcweir 	    virtual void registerPropertyNoMember(
57cdf0e10cSrcweir                     const ::rtl::OUString& _rName,
58cdf0e10cSrcweir                     sal_Int32 _nHandle,
59cdf0e10cSrcweir                     sal_Int32 _nAttributes,
60cdf0e10cSrcweir                     const ::com::sun::star::uno::Type& _rType,
61cdf0e10cSrcweir                     const void* _pInitialValue
62cdf0e10cSrcweir                 ) = 0;
63cdf0e10cSrcweir     };
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     //====================================================================
66cdf0e10cSrcweir     //= OColumnSettings
67cdf0e10cSrcweir     //====================================================================
68cdf0e10cSrcweir 	class OColumnSettings
69cdf0e10cSrcweir 	{
70cdf0e10cSrcweir 	    //	<properties>
71cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_aWidth;				// sal_Int32 or void
72cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_aFormatKey;			// sal_Int32 or void
73cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_aRelativePosition;	// sal_Int32 or void
74cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_aAlignment;			// sal_Int32 (::com::sun::star::awt::TextAlign) or void
75cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_aHelpText;			// the description of the column which is visible in the helptext of the column
76cdf0e10cSrcweir 		::com::sun::star::uno::Any	m_aControlDefault;		// the default value which should be displayed as by a control when moving to a new row
77cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
78cdf0e10cSrcweir 									m_xControlModel;
79cdf0e10cSrcweir 		sal_Bool					m_bHidden;
80cdf0e10cSrcweir 	    //	</properties>
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     protected:
83cdf0e10cSrcweir 		virtual ~OColumnSettings();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	public:
86cdf0e10cSrcweir 		OColumnSettings();
87cdf0e10cSrcweir 
88cdf0e10cSrcweir     protected:
89cdf0e10cSrcweir         void registerProperties( IPropertyContainer& _rPropertyContainer );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         /** determines whether the property with the given handle is handled by the class
92cdf0e10cSrcweir         */
93cdf0e10cSrcweir         static bool isColumnSettingProperty( const sal_Int32 _nPropertyHandle );
94cdf0e10cSrcweir         static bool isDefaulted( const sal_Int32 _nPropertyHandle, const ::com::sun::star::uno::Any& _rPropertyValue );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir     public:
97cdf0e10cSrcweir 		/** check if the persistent settings have their default value
98cdf0e10cSrcweir 		*/
99cdf0e10cSrcweir         static bool hasDefaultSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn );
100cdf0e10cSrcweir 	};
101cdf0e10cSrcweir 
102cdf0e10cSrcweir //........................................................................
103cdf0e10cSrcweir } // namespace dbaccess
104cdf0e10cSrcweir //........................................................................
105cdf0e10cSrcweir 
106cdf0e10cSrcweir #endif // COLUMNSETTINGS_HXX
107