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