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 #ifndef DBAUI_FIELDDESCRIPTIONS_HXX
24cdf0e10cSrcweir #define DBAUI_FIELDDESCRIPTIONS_HXX
25cdf0e10cSrcweir 
26cdf0e10cSrcweir #ifndef DBAUI_ENUMTYPES_HXX
27cdf0e10cSrcweir #include "QEnumTypes.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _SVX_SVXENUM_HXX
30cdf0e10cSrcweir #include <editeng/svxenum.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef DBAUI_TYPEINFO_HXX
33cdf0e10cSrcweir #include "TypeInfo.hxx"
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _OSL_DIAGNOSE_H_
36cdf0e10cSrcweir #include <osl/diagnose.h>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
39cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HPP_
42cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySetInfo.hpp>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir 
45cdf0e10cSrcweir namespace dbaui
46cdf0e10cSrcweir {
47cdf0e10cSrcweir 	class OFieldDescription
48cdf0e10cSrcweir 	{
49cdf0e10cSrcweir 	private:
50cdf0e10cSrcweir 		::com::sun::star::uno::Any		m_aDefaultValue;	// the default value from the database
51cdf0e10cSrcweir 		::com::sun::star::uno::Any		m_aControlDefault;	// the value which the control inserts as default
52cdf0e10cSrcweir 		::com::sun::star::uno::Any		m_aWidth;				// sal_Int32 or void
53cdf0e10cSrcweir 		::com::sun::star::uno::Any		m_aRelativePosition;	// sal_Int32 or void
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 		TOTypeInfoSP	m_pType;
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >		m_xDest;
58cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo >	m_xDestInfo;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 		::rtl::OUString		m_sName;
61cdf0e10cSrcweir 		::rtl::OUString		m_sTypeName;
62cdf0e10cSrcweir 		::rtl::OUString		m_sDescription;
63cdf0e10cSrcweir         ::rtl::OUString		m_sHelpText;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir 		::rtl::OUString		m_sAutoIncrementValue;
66cdf0e10cSrcweir 		sal_Int32			m_nType;	// only used when m_pType is null
67cdf0e10cSrcweir 		sal_Int32			m_nPrecision;
68cdf0e10cSrcweir 		sal_Int32			m_nScale;
69cdf0e10cSrcweir 		sal_Int32			m_nIsNullable;
70cdf0e10cSrcweir 		sal_Int32			m_nFormatKey;
71cdf0e10cSrcweir 		SvxCellHorJustify	m_eHorJustify;
72cdf0e10cSrcweir 		sal_Bool			m_bIsAutoIncrement;
73cdf0e10cSrcweir 		sal_Bool			m_bIsPrimaryKey;
74cdf0e10cSrcweir 		sal_Bool			m_bIsCurrency;
75cdf0e10cSrcweir 		sal_Bool			m_bHidden;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir 	public:
78cdf0e10cSrcweir 		OFieldDescription();
79cdf0e10cSrcweir 		OFieldDescription( const OFieldDescription& rDescr );
80cdf0e10cSrcweir 		OFieldDescription(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xAffectedCol
81cdf0e10cSrcweir 						 ,sal_Bool _bUseAsDest = sal_False);
82cdf0e10cSrcweir 		~OFieldDescription();
83cdf0e10cSrcweir 
84cdf0e10cSrcweir 		void SetName(const ::rtl::OUString& _rName);
85cdf0e10cSrcweir 		void SetDescription(const ::rtl::OUString& _rDescription);
86cdf0e10cSrcweir         void SetHelpText(const ::rtl::OUString& _sHelptext);
87cdf0e10cSrcweir 		void SetDefaultValue(const ::com::sun::star::uno::Any& _rDefaultValue);
88cdf0e10cSrcweir 		void SetControlDefault(const ::com::sun::star::uno::Any& _rControlDefault);
89cdf0e10cSrcweir 		void SetAutoIncrementValue(const ::rtl::OUString& _sAutoIncValue);
90cdf0e10cSrcweir 		void SetType(TOTypeInfoSP _pType);
91cdf0e10cSrcweir 		void SetTypeValue(sal_Int32 _nType);
92cdf0e10cSrcweir 		void SetTypeName(const ::rtl::OUString& _sTypeName);
93cdf0e10cSrcweir 		void SetPrecision(const sal_Int32& _rPrecision);
94cdf0e10cSrcweir 		void SetScale(const sal_Int32& _rScale);
95cdf0e10cSrcweir 		void SetIsNullable(const sal_Int32& _rIsNullable);
96cdf0e10cSrcweir 		void SetFormatKey(const sal_Int32& _rFormatKey);
97cdf0e10cSrcweir 		void SetHorJustify(const SvxCellHorJustify& _rHorJustify);
98cdf0e10cSrcweir 		void SetAutoIncrement(sal_Bool _bAuto);
99cdf0e10cSrcweir 		void SetPrimaryKey(sal_Bool _bPKey);
100cdf0e10cSrcweir 		void SetCurrency(sal_Bool _bIsCurrency);
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 		/** copies the content of the field eescription into the column
103cdf0e10cSrcweir 			@param	_rxColumn the dest
104cdf0e10cSrcweir 		*/
105cdf0e10cSrcweir 		void copyColumnSettingsTo(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn);
106cdf0e10cSrcweir 
107cdf0e10cSrcweir 		void FillFromTypeInfo(const TOTypeInfoSP& _pType,sal_Bool _bForce,sal_Bool _bReset);
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 		::rtl::OUString				GetName()				const;
110cdf0e10cSrcweir 		::rtl::OUString				GetDescription()		const;
111cdf0e10cSrcweir         ::rtl::OUString				GetHelpText()		    const;
112cdf0e10cSrcweir 		::com::sun::star::uno::Any	GetControlDefault()		const;
113cdf0e10cSrcweir 		::rtl::OUString				GetAutoIncrementValue()	const;
114cdf0e10cSrcweir 		sal_Int32					GetType()				const;
115cdf0e10cSrcweir 		::rtl::OUString				GetTypeName()			const;
116cdf0e10cSrcweir 		sal_Int32					GetPrecision()			const;
117cdf0e10cSrcweir 		sal_Int32					GetScale()				const;
118cdf0e10cSrcweir 		sal_Int32					GetIsNullable()			const;
119cdf0e10cSrcweir 		sal_Int32					GetFormatKey()			const;
120cdf0e10cSrcweir 		SvxCellHorJustify			GetHorJustify()			const;
121cdf0e10cSrcweir 		TOTypeInfoSP				getTypeInfo()			const;
122cdf0e10cSrcweir         TOTypeInfoSP				getSpecialTypeInfo()	const;
123cdf0e10cSrcweir 		sal_Bool					IsAutoIncrement()		const;
124cdf0e10cSrcweir 		sal_Bool					IsPrimaryKey()			const;
125cdf0e10cSrcweir 		sal_Bool					IsCurrency()			const;
126cdf0e10cSrcweir 		sal_Bool					IsNullable()			const;
127cdf0e10cSrcweir 	};
128cdf0e10cSrcweir }
129cdf0e10cSrcweir #endif // DBAUI_FIELDDESCRIPTIONS_HXX
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 
132