1*96de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*96de5490SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*96de5490SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*96de5490SAndrew Rist * distributed with this work for additional information
6*96de5490SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*96de5490SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*96de5490SAndrew Rist * "License"); you may not use this file except in compliance
9*96de5490SAndrew Rist * with the License. You may obtain a copy of the License at
10*96de5490SAndrew Rist *
11*96de5490SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*96de5490SAndrew Rist *
13*96de5490SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*96de5490SAndrew Rist * software distributed under the License is distributed on an
15*96de5490SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*96de5490SAndrew Rist * KIND, either express or implied. See the License for the
17*96de5490SAndrew Rist * specific language governing permissions and limitations
18*96de5490SAndrew Rist * under the License.
19*96de5490SAndrew Rist *
20*96de5490SAndrew Rist *************************************************************/
21*96de5490SAndrew Rist
22*96de5490SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dbaccess.hxx"
26cdf0e10cSrcweir #ifndef DBAUI_FIELDDESCRIPTIONS_HXX
27cdf0e10cSrcweir #include "FieldDescriptions.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX
30cdf0e10cSrcweir #include <tools/debug.hxx>
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H
33cdf0e10cSrcweir #include <tools/diagnose_ex.h>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _DBU_TBL_HRC_
36cdf0e10cSrcweir #include "dbu_tbl.hrc"
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
39cdf0e10cSrcweir #include <com/sun/star/sdbc/ColumnValue.hpp>
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
42cdf0e10cSrcweir #include "dbustrings.hrc"
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
45cdf0e10cSrcweir #include <comphelper/types.hxx>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir #ifndef _COMPHELPER_EXTRACT_HXX_
48cdf0e10cSrcweir #include <comphelper/extract.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX
51cdf0e10cSrcweir #include "UITools.hxx"
52cdf0e10cSrcweir #endif
53cdf0e10cSrcweir #ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_
54cdf0e10cSrcweir #include <com/sun/star/util/NumberFormat.hpp>
55cdf0e10cSrcweir #endif
56cdf0e10cSrcweir
57cdf0e10cSrcweir #define DEFAULT_VARCHAR_PRECSION 50
58cdf0e10cSrcweir #define DEFAULT_OTHER_PRECSION 16
59cdf0e10cSrcweir #define DEFAULT_NUMERIC_PRECSION 5
60cdf0e10cSrcweir #define DEFAULT_NUMERIC_SCALE 0
61cdf0e10cSrcweir
62cdf0e10cSrcweir
63cdf0e10cSrcweir using namespace dbaui;
64cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
65cdf0e10cSrcweir using namespace ::com::sun::star::uno;
66cdf0e10cSrcweir using namespace ::com::sun::star::beans;
67cdf0e10cSrcweir using namespace ::com::sun::star::util;
68cdf0e10cSrcweir
69cdf0e10cSrcweir //========================================================================
70cdf0e10cSrcweir // class OFieldDescription
71cdf0e10cSrcweir //========================================================================
DBG_NAME(OFieldDescription)72cdf0e10cSrcweir DBG_NAME(OFieldDescription)
73cdf0e10cSrcweir //------------------------------------------------------------------------------
74cdf0e10cSrcweir OFieldDescription::OFieldDescription()
75cdf0e10cSrcweir :m_pType()
76cdf0e10cSrcweir ,m_nType(DataType::VARCHAR)
77cdf0e10cSrcweir ,m_nPrecision(0)
78cdf0e10cSrcweir ,m_nScale(0)
79cdf0e10cSrcweir ,m_nIsNullable(ColumnValue::NULLABLE)
80cdf0e10cSrcweir ,m_nFormatKey(0)
81cdf0e10cSrcweir ,m_eHorJustify(SVX_HOR_JUSTIFY_STANDARD)
82cdf0e10cSrcweir ,m_bIsAutoIncrement(sal_False)
83cdf0e10cSrcweir ,m_bIsPrimaryKey(sal_False)
84cdf0e10cSrcweir ,m_bIsCurrency(sal_False)
85cdf0e10cSrcweir ,m_bHidden(sal_False)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir DBG_CTOR(OFieldDescription,NULL);
88cdf0e10cSrcweir }
89cdf0e10cSrcweir //------------------------------------------------------------------------------
OFieldDescription(const OFieldDescription & rDescr)90cdf0e10cSrcweir OFieldDescription::OFieldDescription( const OFieldDescription& rDescr )
91cdf0e10cSrcweir :m_aDefaultValue(rDescr.m_aDefaultValue)
92cdf0e10cSrcweir ,m_aControlDefault(rDescr.m_aControlDefault)
93cdf0e10cSrcweir ,m_aWidth(rDescr.m_aWidth)
94cdf0e10cSrcweir ,m_aRelativePosition(rDescr.m_aRelativePosition)
95cdf0e10cSrcweir ,m_pType(rDescr.m_pType)
96cdf0e10cSrcweir ,m_xDest(rDescr.m_xDest)
97cdf0e10cSrcweir ,m_xDestInfo(rDescr.m_xDestInfo)
98cdf0e10cSrcweir ,m_sName(rDescr.m_sName)
99cdf0e10cSrcweir ,m_sTypeName(rDescr.m_sTypeName)
100cdf0e10cSrcweir ,m_sDescription(rDescr.m_sDescription)
101cdf0e10cSrcweir ,m_sAutoIncrementValue(rDescr.m_sAutoIncrementValue)
102cdf0e10cSrcweir ,m_nType(rDescr.m_nType)
103cdf0e10cSrcweir ,m_nPrecision(rDescr.m_nPrecision)
104cdf0e10cSrcweir ,m_nScale(rDescr.m_nScale)
105cdf0e10cSrcweir ,m_nIsNullable(rDescr.m_nIsNullable)
106cdf0e10cSrcweir ,m_nFormatKey(rDescr.m_nFormatKey)
107cdf0e10cSrcweir ,m_eHorJustify(rDescr.m_eHorJustify)
108cdf0e10cSrcweir ,m_bIsAutoIncrement(rDescr.m_bIsAutoIncrement)
109cdf0e10cSrcweir ,m_bIsPrimaryKey(rDescr.m_bIsPrimaryKey)
110cdf0e10cSrcweir ,m_bIsCurrency(rDescr.m_bIsCurrency)
111cdf0e10cSrcweir ,m_bHidden(rDescr.m_bHidden)
112cdf0e10cSrcweir {
113cdf0e10cSrcweir DBG_CTOR(OFieldDescription,NULL);
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
116cdf0e10cSrcweir //------------------------------------------------------------------------------
~OFieldDescription()117cdf0e10cSrcweir OFieldDescription::~OFieldDescription()
118cdf0e10cSrcweir {
119cdf0e10cSrcweir DBG_DTOR(OFieldDescription,NULL);
120cdf0e10cSrcweir }
121cdf0e10cSrcweir //------------------------------------------------------------------------------
OFieldDescription(const Reference<XPropertySet> & xAffectedCol,sal_Bool _bUseAsDest)122cdf0e10cSrcweir OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedCol,sal_Bool _bUseAsDest)
123cdf0e10cSrcweir :m_pType()
124cdf0e10cSrcweir ,m_nType(DataType::VARCHAR)
125cdf0e10cSrcweir ,m_nPrecision(0)
126cdf0e10cSrcweir ,m_nScale(0)
127cdf0e10cSrcweir ,m_nIsNullable(ColumnValue::NULLABLE)
128cdf0e10cSrcweir ,m_nFormatKey(0)
129cdf0e10cSrcweir ,m_eHorJustify(SVX_HOR_JUSTIFY_STANDARD)
130cdf0e10cSrcweir ,m_bIsAutoIncrement(sal_False)
131cdf0e10cSrcweir ,m_bIsPrimaryKey(sal_False)
132cdf0e10cSrcweir ,m_bIsCurrency(sal_False)
133cdf0e10cSrcweir ,m_bHidden(sal_False)
134cdf0e10cSrcweir {
135cdf0e10cSrcweir DBG_CTOR(OFieldDescription,NULL);
136cdf0e10cSrcweir OSL_ENSURE(xAffectedCol.is(),"PropetySet can notbe null!");
137cdf0e10cSrcweir if ( xAffectedCol.is() )
138cdf0e10cSrcweir {
139cdf0e10cSrcweir if ( _bUseAsDest )
140cdf0e10cSrcweir {
141cdf0e10cSrcweir m_xDest = xAffectedCol;
142cdf0e10cSrcweir m_xDestInfo = xAffectedCol->getPropertySetInfo();;
143cdf0e10cSrcweir }
144cdf0e10cSrcweir else
145cdf0e10cSrcweir {
146cdf0e10cSrcweir try
147cdf0e10cSrcweir {
148cdf0e10cSrcweir Reference<XPropertySetInfo> xPropSetInfo = xAffectedCol->getPropertySetInfo();
149cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_NAME))
150cdf0e10cSrcweir SetName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_NAME)));
151cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
152cdf0e10cSrcweir SetDescription(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DESCRIPTION)));
153cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_HELPTEXT))
154cdf0e10cSrcweir {
155cdf0e10cSrcweir ::rtl::OUString sHelpText;
156cdf0e10cSrcweir xAffectedCol->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText;
157cdf0e10cSrcweir SetHelpText(sHelpText);
158cdf0e10cSrcweir }
159cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE))
160cdf0e10cSrcweir SetDefaultValue( xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE) );
161cdf0e10cSrcweir
162cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
163cdf0e10cSrcweir SetControlDefault( xAffectedCol->getPropertyValue(PROPERTY_CONTROLDEFAULT) );
164cdf0e10cSrcweir
165cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION))
166cdf0e10cSrcweir SetAutoIncrementValue(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_AUTOINCREMENTCREATION)));
167cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_TYPE))
168cdf0e10cSrcweir SetTypeValue(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_TYPE)));
169cdf0e10cSrcweir if (xPropSetInfo->hasPropertyByName(PROPERTY_TYPENAME))
170cdf0e10cSrcweir SetTypeName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_TYPENAME)));
171cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_PRECISION))
172cdf0e10cSrcweir SetPrecision(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_PRECISION)));
173cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_SCALE))
174cdf0e10cSrcweir SetScale(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_SCALE)));
175cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_ISNULLABLE))
176cdf0e10cSrcweir SetIsNullable(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ISNULLABLE)));
177cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_FORMATKEY))
178cdf0e10cSrcweir {
179cdf0e10cSrcweir const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY);
180cdf0e10cSrcweir if ( aValue.hasValue() )
181cdf0e10cSrcweir SetFormatKey(::comphelper::getINT32(aValue));
182cdf0e10cSrcweir }
183cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
184cdf0e10cSrcweir m_aRelativePosition = xAffectedCol->getPropertyValue(PROPERTY_RELATIVEPOSITION);
185cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_WIDTH))
186cdf0e10cSrcweir m_aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
187cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_HIDDEN))
188cdf0e10cSrcweir xAffectedCol->getPropertyValue(PROPERTY_HIDDEN) >>= m_bHidden;
189cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_ALIGN))
190cdf0e10cSrcweir {
191cdf0e10cSrcweir const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
192cdf0e10cSrcweir if ( aValue.hasValue() )
193cdf0e10cSrcweir SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(aValue)));
194cdf0e10cSrcweir }
195cdf0e10cSrcweir if(xPropSetInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT))
196cdf0e10cSrcweir SetAutoIncrement(::cppu::any2bool(xAffectedCol->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
197cdf0e10cSrcweir }
198cdf0e10cSrcweir catch(const Exception&)
199cdf0e10cSrcweir {
200cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
201cdf0e10cSrcweir }
202cdf0e10cSrcweir }
203cdf0e10cSrcweir }
204cdf0e10cSrcweir }
205cdf0e10cSrcweir // -----------------------------------------------------------------------------
FillFromTypeInfo(const TOTypeInfoSP & _pType,sal_Bool _bForce,sal_Bool _bReset)206cdf0e10cSrcweir void OFieldDescription::FillFromTypeInfo(const TOTypeInfoSP& _pType,sal_Bool _bForce,sal_Bool _bReset)
207cdf0e10cSrcweir {
208cdf0e10cSrcweir TOTypeInfoSP pOldType = getTypeInfo();
209cdf0e10cSrcweir if ( _pType != pOldType )
210cdf0e10cSrcweir {
211cdf0e10cSrcweir // reset type depending information
212cdf0e10cSrcweir if ( _bReset )
213cdf0e10cSrcweir {
214cdf0e10cSrcweir SetFormatKey(0);
215cdf0e10cSrcweir SetControlDefault(Any());
216cdf0e10cSrcweir }
217cdf0e10cSrcweir
218cdf0e10cSrcweir sal_Bool bForce = _bForce || pOldType.get() == NULL || pOldType->nType != _pType->nType;
219cdf0e10cSrcweir switch ( _pType->nType )
220cdf0e10cSrcweir {
221cdf0e10cSrcweir case DataType::CHAR:
222cdf0e10cSrcweir case DataType::VARCHAR:
223cdf0e10cSrcweir if ( bForce )
224cdf0e10cSrcweir {
225cdf0e10cSrcweir sal_Int32 nPrec = DEFAULT_VARCHAR_PRECSION;
226cdf0e10cSrcweir if ( GetPrecision() )
227cdf0e10cSrcweir nPrec = GetPrecision();
228cdf0e10cSrcweir SetPrecision(::std::min<sal_Int32>(nPrec,_pType->nPrecision));
229cdf0e10cSrcweir }
230cdf0e10cSrcweir break;
231cdf0e10cSrcweir case DataType::TIMESTAMP:
232cdf0e10cSrcweir if ( bForce && _pType->nMaximumScale)
233cdf0e10cSrcweir {
234cdf0e10cSrcweir SetScale(::std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
235cdf0e10cSrcweir }
236cdf0e10cSrcweir break;
237cdf0e10cSrcweir default:
238cdf0e10cSrcweir if ( bForce )
239cdf0e10cSrcweir {
240cdf0e10cSrcweir sal_Int32 nPrec = DEFAULT_OTHER_PRECSION;
241cdf0e10cSrcweir switch ( _pType->nType )
242cdf0e10cSrcweir {
243cdf0e10cSrcweir case DataType::BIT:
244cdf0e10cSrcweir case DataType::BLOB:
245cdf0e10cSrcweir case DataType::CLOB:
246cdf0e10cSrcweir nPrec = _pType->nPrecision;
247cdf0e10cSrcweir break;
248cdf0e10cSrcweir default:
249cdf0e10cSrcweir if ( GetPrecision() )
250cdf0e10cSrcweir nPrec = GetPrecision();
251cdf0e10cSrcweir break;
252cdf0e10cSrcweir }
253cdf0e10cSrcweir
254cdf0e10cSrcweir if ( _pType->nPrecision )
255cdf0e10cSrcweir SetPrecision(::std::min<sal_Int32>(nPrec ? nPrec : DEFAULT_NUMERIC_PRECSION,_pType->nPrecision));
256cdf0e10cSrcweir if ( _pType->nMaximumScale )
257cdf0e10cSrcweir SetScale(::std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
258cdf0e10cSrcweir }
259cdf0e10cSrcweir }
260cdf0e10cSrcweir if ( !_pType->aCreateParams.getLength() )
261cdf0e10cSrcweir {
262cdf0e10cSrcweir SetPrecision(_pType->nPrecision);
263cdf0e10cSrcweir SetScale(_pType->nMinimumScale);
264cdf0e10cSrcweir }
265cdf0e10cSrcweir if ( !_pType->bNullable && IsNullable() )
266cdf0e10cSrcweir SetIsNullable(ColumnValue::NO_NULLS);
267cdf0e10cSrcweir if ( !_pType->bAutoIncrement && IsAutoIncrement() )
268cdf0e10cSrcweir SetAutoIncrement(sal_False);
269cdf0e10cSrcweir SetCurrency( _pType->bCurrency );
270cdf0e10cSrcweir SetType(_pType);
271cdf0e10cSrcweir SetTypeName(_pType->aTypeName);
272cdf0e10cSrcweir }
273cdf0e10cSrcweir }
274cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetName(const::rtl::OUString & _rName)275cdf0e10cSrcweir void OFieldDescription::SetName(const ::rtl::OUString& _rName)
276cdf0e10cSrcweir {
277cdf0e10cSrcweir try
278cdf0e10cSrcweir {
279cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_NAME) )
280cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_NAME,makeAny(_rName));
281cdf0e10cSrcweir else
282cdf0e10cSrcweir m_sName = _rName;
283cdf0e10cSrcweir }
284cdf0e10cSrcweir catch(const Exception& )
285cdf0e10cSrcweir {
286cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
287cdf0e10cSrcweir }
288cdf0e10cSrcweir }
289cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetHelpText(const::rtl::OUString & _sHelpText)290cdf0e10cSrcweir void OFieldDescription::SetHelpText(const ::rtl::OUString& _sHelpText)
291cdf0e10cSrcweir {
292cdf0e10cSrcweir try
293cdf0e10cSrcweir {
294cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
295cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_HELPTEXT,makeAny(_sHelpText));
296cdf0e10cSrcweir else
297cdf0e10cSrcweir m_sHelpText = _sHelpText;
298cdf0e10cSrcweir }
299cdf0e10cSrcweir catch(const Exception& )
300cdf0e10cSrcweir {
301cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
302cdf0e10cSrcweir }
303cdf0e10cSrcweir }
304cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetDescription(const::rtl::OUString & _rDescription)305cdf0e10cSrcweir void OFieldDescription::SetDescription(const ::rtl::OUString& _rDescription)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir try
308cdf0e10cSrcweir {
309cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DESCRIPTION) )
310cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_DESCRIPTION,makeAny(_rDescription));
311cdf0e10cSrcweir else
312cdf0e10cSrcweir m_sDescription = _rDescription;
313cdf0e10cSrcweir }
314cdf0e10cSrcweir catch(const Exception& )
315cdf0e10cSrcweir {
316cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
317cdf0e10cSrcweir }
318cdf0e10cSrcweir }
319cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetDefaultValue(const Any & _rDefaultValue)320cdf0e10cSrcweir void OFieldDescription::SetDefaultValue(const Any& _rDefaultValue)
321cdf0e10cSrcweir {
322cdf0e10cSrcweir try
323cdf0e10cSrcweir {
324cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) )
325cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_DEFAULTVALUE,makeAny(_rDefaultValue));
326cdf0e10cSrcweir else
327cdf0e10cSrcweir m_aDefaultValue = _rDefaultValue;
328cdf0e10cSrcweir }
329cdf0e10cSrcweir catch( const Exception& )
330cdf0e10cSrcweir {
331cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
332cdf0e10cSrcweir }
333cdf0e10cSrcweir }
334cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetControlDefault(const Any & _rControlDefault)335cdf0e10cSrcweir void OFieldDescription::SetControlDefault(const Any& _rControlDefault)
336cdf0e10cSrcweir {
337cdf0e10cSrcweir try
338cdf0e10cSrcweir {
339cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
340cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_CONTROLDEFAULT,makeAny(_rControlDefault));
341cdf0e10cSrcweir else
342cdf0e10cSrcweir m_aControlDefault = _rControlDefault;
343cdf0e10cSrcweir }
344cdf0e10cSrcweir catch( const Exception& )
345cdf0e10cSrcweir {
346cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
347cdf0e10cSrcweir }
348cdf0e10cSrcweir }
349cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetAutoIncrementValue(const::rtl::OUString & _sAutoIncValue)350cdf0e10cSrcweir void OFieldDescription::SetAutoIncrementValue(const ::rtl::OUString& _sAutoIncValue)
351cdf0e10cSrcweir {
352cdf0e10cSrcweir try
353cdf0e10cSrcweir {
354cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
355cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,makeAny(_sAutoIncValue));
356cdf0e10cSrcweir else
357cdf0e10cSrcweir m_sAutoIncrementValue = _sAutoIncValue;
358cdf0e10cSrcweir }
359cdf0e10cSrcweir catch( const Exception& )
360cdf0e10cSrcweir {
361cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
362cdf0e10cSrcweir }
363cdf0e10cSrcweir }
364cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetType(TOTypeInfoSP _pType)365cdf0e10cSrcweir void OFieldDescription::SetType(TOTypeInfoSP _pType)
366cdf0e10cSrcweir {
367cdf0e10cSrcweir m_pType = _pType;
368cdf0e10cSrcweir if ( m_pType.get() )
369cdf0e10cSrcweir {
370cdf0e10cSrcweir try
371cdf0e10cSrcweir {
372cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
373cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_TYPE,makeAny(m_pType->nType));
374cdf0e10cSrcweir else
375cdf0e10cSrcweir m_nType = m_pType->nType;
376cdf0e10cSrcweir }
377cdf0e10cSrcweir catch( const Exception& )
378cdf0e10cSrcweir {
379cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
380cdf0e10cSrcweir }
381cdf0e10cSrcweir }
382cdf0e10cSrcweir }
383cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetTypeValue(sal_Int32 _nType)384cdf0e10cSrcweir void OFieldDescription::SetTypeValue(sal_Int32 _nType)
385cdf0e10cSrcweir {
386cdf0e10cSrcweir try
387cdf0e10cSrcweir {
388cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
389cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_TYPE,makeAny(_nType));
390cdf0e10cSrcweir else
391cdf0e10cSrcweir {
392cdf0e10cSrcweir m_nType = _nType;
393cdf0e10cSrcweir OSL_ENSURE(!m_pType.get(),"Invalid call here!");
394cdf0e10cSrcweir }
395cdf0e10cSrcweir }
396cdf0e10cSrcweir catch( const Exception& )
397cdf0e10cSrcweir {
398cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
399cdf0e10cSrcweir }
400cdf0e10cSrcweir }
401cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetPrecision(const sal_Int32 & _rPrecision)402cdf0e10cSrcweir void OFieldDescription::SetPrecision(const sal_Int32& _rPrecision)
403cdf0e10cSrcweir {
404cdf0e10cSrcweir try
405cdf0e10cSrcweir {
406cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_PRECISION) )
407cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_PRECISION,makeAny(_rPrecision));
408cdf0e10cSrcweir else
409cdf0e10cSrcweir m_nPrecision = _rPrecision;
410cdf0e10cSrcweir }
411cdf0e10cSrcweir catch( const Exception& )
412cdf0e10cSrcweir {
413cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
414cdf0e10cSrcweir }
415cdf0e10cSrcweir }
416cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetScale(const sal_Int32 & _rScale)417cdf0e10cSrcweir void OFieldDescription::SetScale(const sal_Int32& _rScale)
418cdf0e10cSrcweir {
419cdf0e10cSrcweir try
420cdf0e10cSrcweir {
421cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_SCALE) )
422cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_SCALE,makeAny(_rScale));
423cdf0e10cSrcweir else
424cdf0e10cSrcweir m_nScale = _rScale;
425cdf0e10cSrcweir }
426cdf0e10cSrcweir catch( const Exception& )
427cdf0e10cSrcweir {
428cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
429cdf0e10cSrcweir }
430cdf0e10cSrcweir }
431cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetIsNullable(const sal_Int32 & _rIsNullable)432cdf0e10cSrcweir void OFieldDescription::SetIsNullable(const sal_Int32& _rIsNullable)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir try
435cdf0e10cSrcweir {
436cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) )
437cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_ISNULLABLE,makeAny(_rIsNullable));
438cdf0e10cSrcweir else
439cdf0e10cSrcweir m_nIsNullable = _rIsNullable;
440cdf0e10cSrcweir }
441cdf0e10cSrcweir catch( const Exception& )
442cdf0e10cSrcweir {
443cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
444cdf0e10cSrcweir }
445cdf0e10cSrcweir }
446cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetFormatKey(const sal_Int32 & _rFormatKey)447cdf0e10cSrcweir void OFieldDescription::SetFormatKey(const sal_Int32& _rFormatKey)
448cdf0e10cSrcweir {
449cdf0e10cSrcweir try
450cdf0e10cSrcweir {
451cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
452cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_FORMATKEY,makeAny(_rFormatKey));
453cdf0e10cSrcweir else
454cdf0e10cSrcweir m_nFormatKey = _rFormatKey;
455cdf0e10cSrcweir }
456cdf0e10cSrcweir catch( const Exception& )
457cdf0e10cSrcweir {
458cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
459cdf0e10cSrcweir }
460cdf0e10cSrcweir }
461cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetHorJustify(const SvxCellHorJustify & _rHorJustify)462cdf0e10cSrcweir void OFieldDescription::SetHorJustify(const SvxCellHorJustify& _rHorJustify)
463cdf0e10cSrcweir {
464cdf0e10cSrcweir try
465cdf0e10cSrcweir {
466cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ALIGN) )
467cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_ALIGN,makeAny( dbaui::mapTextAllign(_rHorJustify)));
468cdf0e10cSrcweir else
469cdf0e10cSrcweir m_eHorJustify = _rHorJustify;
470cdf0e10cSrcweir }
471cdf0e10cSrcweir catch( const Exception& )
472cdf0e10cSrcweir {
473cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
474cdf0e10cSrcweir }
475cdf0e10cSrcweir }
476cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetAutoIncrement(sal_Bool _bAuto)477cdf0e10cSrcweir void OFieldDescription::SetAutoIncrement(sal_Bool _bAuto)
478cdf0e10cSrcweir {
479cdf0e10cSrcweir try
480cdf0e10cSrcweir {
481cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT) )
482cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_ISAUTOINCREMENT,makeAny(_bAuto));
483cdf0e10cSrcweir else
484cdf0e10cSrcweir m_bIsAutoIncrement = _bAuto;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir catch( const Exception& )
487cdf0e10cSrcweir {
488cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
489cdf0e10cSrcweir }
490cdf0e10cSrcweir }
491cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetPrimaryKey(sal_Bool _bPKey)492cdf0e10cSrcweir void OFieldDescription::SetPrimaryKey(sal_Bool _bPKey)
493cdf0e10cSrcweir {
494cdf0e10cSrcweir m_bIsPrimaryKey = _bPKey;
495cdf0e10cSrcweir if ( _bPKey )
496cdf0e10cSrcweir SetIsNullable(::com::sun::star::sdbc::ColumnValue::NO_NULLS);
497cdf0e10cSrcweir }
498cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetCurrency(sal_Bool _bIsCurrency)499cdf0e10cSrcweir void OFieldDescription::SetCurrency(sal_Bool _bIsCurrency)
500cdf0e10cSrcweir {
501cdf0e10cSrcweir m_bIsCurrency = _bIsCurrency;
502cdf0e10cSrcweir }
503cdf0e10cSrcweir // -----------------------------------------------------------------------------
504cdf0e10cSrcweir
GetName() const505cdf0e10cSrcweir ::rtl::OUString OFieldDescription::GetName() const
506cdf0e10cSrcweir {
507cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_NAME) )
508cdf0e10cSrcweir return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_NAME));
509cdf0e10cSrcweir else
510cdf0e10cSrcweir return m_sName;
511cdf0e10cSrcweir }
512cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetDescription() const513cdf0e10cSrcweir ::rtl::OUString OFieldDescription::GetDescription() const
514cdf0e10cSrcweir {
515cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DESCRIPTION) )
516cdf0e10cSrcweir return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_DESCRIPTION));
517cdf0e10cSrcweir else
518cdf0e10cSrcweir return m_sDescription;
519cdf0e10cSrcweir }
520cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetHelpText() const521cdf0e10cSrcweir ::rtl::OUString OFieldDescription::GetHelpText() const
522cdf0e10cSrcweir {
523cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
524cdf0e10cSrcweir return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_HELPTEXT));
525cdf0e10cSrcweir else
526cdf0e10cSrcweir return m_sHelpText;
527cdf0e10cSrcweir }
528cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetControlDefault() const529cdf0e10cSrcweir ::com::sun::star::uno::Any OFieldDescription::GetControlDefault() const
530cdf0e10cSrcweir {
531cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
532cdf0e10cSrcweir return m_xDest->getPropertyValue(PROPERTY_CONTROLDEFAULT);
533cdf0e10cSrcweir else
534cdf0e10cSrcweir return m_aControlDefault;
535cdf0e10cSrcweir }
536cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetAutoIncrementValue() const537cdf0e10cSrcweir ::rtl::OUString OFieldDescription::GetAutoIncrementValue() const
538cdf0e10cSrcweir {
539cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
540cdf0e10cSrcweir return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_AUTOINCREMENTCREATION));
541cdf0e10cSrcweir else
542cdf0e10cSrcweir return m_sAutoIncrementValue;
543cdf0e10cSrcweir }
544cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetType() const545cdf0e10cSrcweir sal_Int32 OFieldDescription::GetType() const
546cdf0e10cSrcweir {
547cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
548cdf0e10cSrcweir return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_TYPE));
549cdf0e10cSrcweir else
550cdf0e10cSrcweir return m_pType.get() ? m_pType->nType : m_nType;
551cdf0e10cSrcweir }
552cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetTypeName() const553cdf0e10cSrcweir ::rtl::OUString OFieldDescription::GetTypeName() const
554cdf0e10cSrcweir {
555cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPENAME) )
556cdf0e10cSrcweir return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_TYPENAME));
557cdf0e10cSrcweir else
558cdf0e10cSrcweir return m_pType.get() ? m_pType->aTypeName : m_sTypeName;
559cdf0e10cSrcweir }
560cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetPrecision() const561cdf0e10cSrcweir sal_Int32 OFieldDescription::GetPrecision() const
562cdf0e10cSrcweir {
563cdf0e10cSrcweir sal_Int32 nPrec = m_nPrecision;
564cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_PRECISION) )
565cdf0e10cSrcweir nPrec = ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_PRECISION));
566cdf0e10cSrcweir
567cdf0e10cSrcweir TOTypeInfoSP pTypeInfo = getTypeInfo();
568cdf0e10cSrcweir if ( pTypeInfo )
569cdf0e10cSrcweir {
570cdf0e10cSrcweir switch ( pTypeInfo->nType )
571cdf0e10cSrcweir {
572cdf0e10cSrcweir case DataType::TINYINT:
573cdf0e10cSrcweir case DataType::SMALLINT:
574cdf0e10cSrcweir case DataType::INTEGER:
575cdf0e10cSrcweir case DataType::BIGINT:
576cdf0e10cSrcweir if ( !nPrec )
577cdf0e10cSrcweir nPrec = pTypeInfo->nPrecision;
578cdf0e10cSrcweir break;
579cdf0e10cSrcweir } // switch ( pTypeInfo->nType )
580cdf0e10cSrcweir }
581cdf0e10cSrcweir
582cdf0e10cSrcweir return nPrec;
583cdf0e10cSrcweir }
584cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetScale() const585cdf0e10cSrcweir sal_Int32 OFieldDescription::GetScale() const
586cdf0e10cSrcweir {
587cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_SCALE) )
588cdf0e10cSrcweir return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_SCALE));
589cdf0e10cSrcweir else
590cdf0e10cSrcweir return m_nScale;
591cdf0e10cSrcweir }
592cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetIsNullable() const593cdf0e10cSrcweir sal_Int32 OFieldDescription::GetIsNullable() const
594cdf0e10cSrcweir {
595cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) )
596cdf0e10cSrcweir return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_ISNULLABLE));
597cdf0e10cSrcweir else
598cdf0e10cSrcweir return m_nIsNullable;
599cdf0e10cSrcweir }
600cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetFormatKey() const601cdf0e10cSrcweir sal_Int32 OFieldDescription::GetFormatKey() const
602cdf0e10cSrcweir {
603cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
604cdf0e10cSrcweir return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_FORMATKEY));
605cdf0e10cSrcweir else
606cdf0e10cSrcweir return m_nFormatKey;
607cdf0e10cSrcweir }
608cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetHorJustify() const609cdf0e10cSrcweir SvxCellHorJustify OFieldDescription::GetHorJustify() const
610cdf0e10cSrcweir {
611cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ALIGN) )
612cdf0e10cSrcweir return ::dbaui::mapTextJustify(::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_ALIGN)));
613cdf0e10cSrcweir else
614cdf0e10cSrcweir return m_eHorJustify;
615cdf0e10cSrcweir }
616cdf0e10cSrcweir // -----------------------------------------------------------------------------
getTypeInfo() const617cdf0e10cSrcweir TOTypeInfoSP OFieldDescription::getTypeInfo() const
618cdf0e10cSrcweir {
619cdf0e10cSrcweir return m_pType;
620cdf0e10cSrcweir }
621cdf0e10cSrcweir // -----------------------------------------------------------------------------
getSpecialTypeInfo() const622cdf0e10cSrcweir TOTypeInfoSP OFieldDescription::getSpecialTypeInfo() const
623cdf0e10cSrcweir {
624cdf0e10cSrcweir TOTypeInfoSP pSpecialType( new OTypeInfo() );
625cdf0e10cSrcweir *pSpecialType = *m_pType;
626cdf0e10cSrcweir pSpecialType->nPrecision = GetPrecision();
627cdf0e10cSrcweir pSpecialType->nMaximumScale = static_cast<sal_Int16>(GetScale());
628cdf0e10cSrcweir pSpecialType->bAutoIncrement = IsAutoIncrement(); // http://dba.openoffice.org/issues/show_bug.cgi?id=115398 fixed by ludob
629cdf0e10cSrcweir return pSpecialType;
630cdf0e10cSrcweir }
631cdf0e10cSrcweir // -----------------------------------------------------------------------------
IsAutoIncrement() const632cdf0e10cSrcweir sal_Bool OFieldDescription::IsAutoIncrement() const
633cdf0e10cSrcweir {
634cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT) )
635cdf0e10cSrcweir return ::cppu::any2bool(m_xDest->getPropertyValue(PROPERTY_ISAUTOINCREMENT));
636cdf0e10cSrcweir else
637cdf0e10cSrcweir return m_bIsAutoIncrement;
638cdf0e10cSrcweir }
639cdf0e10cSrcweir // -----------------------------------------------------------------------------
IsPrimaryKey() const640cdf0e10cSrcweir sal_Bool OFieldDescription::IsPrimaryKey() const
641cdf0e10cSrcweir {
642cdf0e10cSrcweir return m_bIsPrimaryKey;
643cdf0e10cSrcweir }
644cdf0e10cSrcweir // -----------------------------------------------------------------------------
IsCurrency() const645cdf0e10cSrcweir sal_Bool OFieldDescription::IsCurrency() const
646cdf0e10cSrcweir {
647cdf0e10cSrcweir return m_bIsCurrency;
648cdf0e10cSrcweir }
649cdf0e10cSrcweir // -----------------------------------------------------------------------------
IsNullable() const650cdf0e10cSrcweir sal_Bool OFieldDescription::IsNullable() const
651cdf0e10cSrcweir {
652cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) )
653cdf0e10cSrcweir return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_ISNULLABLE)) == ::com::sun::star::sdbc::ColumnValue::NULLABLE;
654cdf0e10cSrcweir else
655cdf0e10cSrcweir return m_nIsNullable == ::com::sun::star::sdbc::ColumnValue::NULLABLE;
656cdf0e10cSrcweir }
657cdf0e10cSrcweir // -----------------------------------------------------------------------------
SetTypeName(const::rtl::OUString & _sTypeName)658cdf0e10cSrcweir void OFieldDescription::SetTypeName(const ::rtl::OUString& _sTypeName)
659cdf0e10cSrcweir {
660cdf0e10cSrcweir try
661cdf0e10cSrcweir {
662cdf0e10cSrcweir if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPENAME) )
663cdf0e10cSrcweir m_xDest->setPropertyValue(PROPERTY_TYPENAME,makeAny(_sTypeName));
664cdf0e10cSrcweir else
665cdf0e10cSrcweir m_sTypeName = _sTypeName;
666cdf0e10cSrcweir }
667cdf0e10cSrcweir catch( const Exception& )
668cdf0e10cSrcweir {
669cdf0e10cSrcweir DBG_UNHANDLED_EXCEPTION();
670cdf0e10cSrcweir }
671cdf0e10cSrcweir }
672cdf0e10cSrcweir // -----------------------------------------------------------------------------
copyColumnSettingsTo(const Reference<XPropertySet> & _rxColumn)673cdf0e10cSrcweir void OFieldDescription::copyColumnSettingsTo(const Reference< XPropertySet >& _rxColumn)
674cdf0e10cSrcweir {
675cdf0e10cSrcweir if ( _rxColumn.is() )
676cdf0e10cSrcweir {
677cdf0e10cSrcweir Reference<XPropertySetInfo> xInfo = _rxColumn->getPropertySetInfo();
678cdf0e10cSrcweir
679cdf0e10cSrcweir if ( GetFormatKey() != NumberFormat::ALL && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
680cdf0e10cSrcweir _rxColumn->setPropertyValue(PROPERTY_FORMATKEY,makeAny(GetFormatKey()));
681cdf0e10cSrcweir if ( GetHorJustify() != SVX_HOR_JUSTIFY_STANDARD && xInfo->hasPropertyByName(PROPERTY_ALIGN) )
682cdf0e10cSrcweir _rxColumn->setPropertyValue(PROPERTY_ALIGN,makeAny(dbaui::mapTextAllign(GetHorJustify())));
683cdf0e10cSrcweir if ( GetHelpText().getLength() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
684cdf0e10cSrcweir _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,makeAny(GetHelpText()));
685cdf0e10cSrcweir if ( GetControlDefault().hasValue() && xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
686cdf0e10cSrcweir _rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,GetControlDefault());
687cdf0e10cSrcweir
688cdf0e10cSrcweir if(xInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
689cdf0e10cSrcweir _rxColumn->setPropertyValue(PROPERTY_RELATIVEPOSITION,m_aRelativePosition);
690cdf0e10cSrcweir if(xInfo->hasPropertyByName(PROPERTY_WIDTH))
691cdf0e10cSrcweir _rxColumn->setPropertyValue(PROPERTY_WIDTH,m_aWidth);
692cdf0e10cSrcweir if(xInfo->hasPropertyByName(PROPERTY_HIDDEN))
693cdf0e10cSrcweir _rxColumn->setPropertyValue(PROPERTY_HIDDEN,makeAny(m_bHidden));
694cdf0e10cSrcweir }
695cdf0e10cSrcweir }
696cdf0e10cSrcweir // -----------------------------------------------------------------------------
697