1 /*************************************************************************
2  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3  *
4  * Copyright 2000, 2010 Oracle and/or its affiliates.
5  *
6  * OpenOffice.org - a multi-platform office productivity suite
7  *
8  * This file is part of OpenOffice.org.
9  *
10  * OpenOffice.org is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License version 3
12  * only, as published by the Free Software Foundation.
13  *
14  * OpenOffice.org is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU Lesser General Public License version 3 for more details
18  * (a copy is included in the LICENSE file that accompanied this code).
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with OpenOffice.org.  If not, see
22  * <http://www.openoffice.org/license.html>
23  * for a copy of the LGPLv3 License.
24  *
25 ************************************************************************/
26 
27 #ifndef COLUMNSETTINGS_HXX
28 #define COLUMNSETTINGS_HXX
29 
30 /** === begin UNO includes === **/
31 #include <com/sun/star/beans/XPropertySet.hpp>
32 /** === end UNO includes === **/
33 
34 //........................................................................
35 namespace dbaccess
36 {
37 //........................................................................
38 
39     // TODO: move the following to comphelper/propertycontainerhelper.hxx
40     class IPropertyContainer
41     {
42     public:
43 	    virtual void registerProperty(
44                     const ::rtl::OUString& _rName,
45                     sal_Int32 _nHandle,
46                     sal_Int32 _nAttributes,
47                     void* _pPointerToMember,
48                     const ::com::sun::star::uno::Type& _rMemberType
49                 ) = 0;
50 
51 	    virtual void registerMayBeVoidProperty(
52                     const ::rtl::OUString& _rName,
53                     sal_Int32 _nHandle,
54                     sal_Int32 _nAttributes,
55                     ::com::sun::star::uno::Any* _pPointerToMember,
56                     const ::com::sun::star::uno::Type& _rExpectedType
57                 ) = 0;
58 
59 	    virtual void registerPropertyNoMember(
60                     const ::rtl::OUString& _rName,
61                     sal_Int32 _nHandle,
62                     sal_Int32 _nAttributes,
63                     const ::com::sun::star::uno::Type& _rType,
64                     const void* _pInitialValue
65                 ) = 0;
66     };
67 
68     //====================================================================
69     //= OColumnSettings
70     //====================================================================
71 	class OColumnSettings
72 	{
73 	    //	<properties>
74 		::com::sun::star::uno::Any	m_aWidth;				// sal_Int32 or void
75 		::com::sun::star::uno::Any	m_aFormatKey;			// sal_Int32 or void
76 		::com::sun::star::uno::Any	m_aRelativePosition;	// sal_Int32 or void
77 		::com::sun::star::uno::Any	m_aAlignment;			// sal_Int32 (::com::sun::star::awt::TextAlign) or void
78 		::com::sun::star::uno::Any	m_aHelpText;			// the description of the column which is visible in the helptext of the column
79 		::com::sun::star::uno::Any	m_aControlDefault;		// the default value which should be displayed as by a control when moving to a new row
80 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
81 									m_xControlModel;
82 		sal_Bool					m_bHidden;
83 	    //	</properties>
84 
85     protected:
86 		virtual ~OColumnSettings();
87 
88 	public:
89 		OColumnSettings();
90 
91     protected:
92         void registerProperties( IPropertyContainer& _rPropertyContainer );
93 
94         /** determines whether the property with the given handle is handled by the class
95         */
96         static bool isColumnSettingProperty( const sal_Int32 _nPropertyHandle );
97         static bool isDefaulted( const sal_Int32 _nPropertyHandle, const ::com::sun::star::uno::Any& _rPropertyValue );
98 
99     public:
100 		/** check if the persistent settings have their default value
101 		*/
102         static bool hasDefaultSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn );
103 	};
104 
105 //........................................................................
106 } // namespace dbaccess
107 //........................................................................
108 
109 #endif // COLUMNSETTINGS_HXX
110