LibreOffice Module dbaccess (master) 1
FieldDescriptions.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <FieldDescriptions.hxx>
22#include <strings.hxx>
23#include <com/sun/star/sdbc/ColumnValue.hpp>
24#include <comphelper/types.hxx>
26#include <UITools.hxx>
27#include <com/sun/star/util/NumberFormat.hpp>
28
29#define DEFAULT_VARCHAR_PRECISION 100
30#define DEFAULT_OTHER_PRECISION 16
31#define DEFAULT_NUMERIC_PRECISION 5
32#define DEFAULT_NUMERIC_SCALE 0
33
34using namespace dbaui;
35using namespace ::com::sun::star::sdbc;
36using namespace ::com::sun::star::uno;
37using namespace ::com::sun::star::beans;
38using namespace ::com::sun::star::util;
39
40OFieldDescription::OFieldDescription()
41 :m_nType(DataType::VARCHAR)
42 ,m_nPrecision(0)
43 ,m_nScale(0)
44 ,m_nIsNullable(ColumnValue::NULLABLE)
45 ,m_nFormatKey(0)
46 ,m_eHorJustify(SvxCellHorJustify::Standard)
47 ,m_bIsAutoIncrement(false)
48 ,m_bIsPrimaryKey(false)
49 ,m_bIsCurrency(false)
50 ,m_bHidden(false)
51{
52}
53
55 :m_aControlDefault(rDescr.m_aControlDefault)
56 ,m_aWidth(rDescr.m_aWidth)
57 ,m_aRelativePosition(rDescr.m_aRelativePosition)
58 ,m_pType(rDescr.m_pType)
59 ,m_xDest(rDescr.m_xDest)
60 ,m_xDestInfo(rDescr.m_xDestInfo)
61 ,m_sName(rDescr.m_sName)
62 ,m_sTypeName(rDescr.m_sTypeName)
64 ,m_sAutoIncrementValue(rDescr.m_sAutoIncrementValue)
65 ,m_nType(rDescr.m_nType)
66 ,m_nPrecision(rDescr.m_nPrecision)
67 ,m_nScale(rDescr.m_nScale)
68 ,m_nIsNullable(rDescr.m_nIsNullable)
69 ,m_nFormatKey(rDescr.m_nFormatKey)
70 ,m_eHorJustify(rDescr.m_eHorJustify)
71 ,m_bIsAutoIncrement(rDescr.m_bIsAutoIncrement)
72 ,m_bIsPrimaryKey(rDescr.m_bIsPrimaryKey)
73 ,m_bIsCurrency(rDescr.m_bIsCurrency)
74 ,m_bHidden(rDescr.m_bHidden)
75{
76}
77
79{
80}
81
82OFieldDescription::OFieldDescription(const Reference< XPropertySet >& xAffectedCol,bool _bUseAsDest)
83 :m_nType(DataType::VARCHAR)
84 ,m_nPrecision(0)
85 ,m_nScale(0)
86 ,m_nIsNullable(ColumnValue::NULLABLE)
87 ,m_nFormatKey(0)
88 ,m_eHorJustify(SvxCellHorJustify::Standard)
89 ,m_bIsAutoIncrement(false)
90 ,m_bIsPrimaryKey(false)
91 ,m_bIsCurrency(false)
92 ,m_bHidden(false)
93{
94 OSL_ENSURE(xAffectedCol.is(),"PropertySet can not be null!");
95 if ( !xAffectedCol.is() )
96 return;
97
98 if ( _bUseAsDest )
99 {
100 m_xDest = xAffectedCol;
101 m_xDestInfo = xAffectedCol->getPropertySetInfo();
102 }
103 else
104 {
105 try
106 {
107 Reference<XPropertySetInfo> xPropSetInfo = xAffectedCol->getPropertySetInfo();
108 if(xPropSetInfo->hasPropertyByName(PROPERTY_NAME))
109 SetName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_NAME)));
110 if(xPropSetInfo->hasPropertyByName(PROPERTY_DESCRIPTION))
111 SetDescription(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_DESCRIPTION)));
112 if(xPropSetInfo->hasPropertyByName(PROPERTY_HELPTEXT))
113 {
114 OUString sHelpText;
115 xAffectedCol->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText;
116 SetHelpText(sHelpText);
117 }
118 if(xPropSetInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE))
119 SetDefaultValue( xAffectedCol->getPropertyValue(PROPERTY_DEFAULTVALUE) );
120
121 if(xPropSetInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT))
122 SetControlDefault( xAffectedCol->getPropertyValue(PROPERTY_CONTROLDEFAULT) );
123
124 if(xPropSetInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION))
125 SetAutoIncrementValue(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_AUTOINCREMENTCREATION)));
126 if(xPropSetInfo->hasPropertyByName(PROPERTY_TYPE))
127 SetTypeValue(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_TYPE)));
128 if (xPropSetInfo->hasPropertyByName(PROPERTY_TYPENAME))
129 SetTypeName(::comphelper::getString(xAffectedCol->getPropertyValue(PROPERTY_TYPENAME)));
130 if(xPropSetInfo->hasPropertyByName(PROPERTY_PRECISION))
131 SetPrecision(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_PRECISION)));
132 if(xPropSetInfo->hasPropertyByName(PROPERTY_SCALE))
133 SetScale(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_SCALE)));
134 if(xPropSetInfo->hasPropertyByName(PROPERTY_ISNULLABLE))
135 SetIsNullable(::comphelper::getINT32(xAffectedCol->getPropertyValue(PROPERTY_ISNULLABLE)));
136 if(xPropSetInfo->hasPropertyByName(PROPERTY_FORMATKEY))
137 {
138 const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_FORMATKEY);
139 if ( aValue.hasValue() )
140 SetFormatKey(::comphelper::getINT32(aValue));
141 }
142 if(xPropSetInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
143 m_aRelativePosition = xAffectedCol->getPropertyValue(PROPERTY_RELATIVEPOSITION);
144 if(xPropSetInfo->hasPropertyByName(PROPERTY_WIDTH))
145 m_aWidth = xAffectedCol->getPropertyValue(PROPERTY_WIDTH);
146 if(xPropSetInfo->hasPropertyByName(PROPERTY_HIDDEN))
147 xAffectedCol->getPropertyValue(PROPERTY_HIDDEN) >>= m_bHidden;
148 if(xPropSetInfo->hasPropertyByName(PROPERTY_ALIGN))
149 {
150 const Any aValue = xAffectedCol->getPropertyValue(PROPERTY_ALIGN);
151 if ( aValue.hasValue() )
152 SetHorJustify( ::dbaui::mapTextJustify(::comphelper::getINT32(aValue)));
153 }
154 if(xPropSetInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT))
155 SetAutoIncrement(::cppu::any2bool(xAffectedCol->getPropertyValue(PROPERTY_ISAUTOINCREMENT)));
156 }
157 catch(const Exception&)
158 {
159 DBG_UNHANDLED_EXCEPTION("dbaccess");
160 }
161 }
162}
163
164void OFieldDescription::FillFromTypeInfo(const TOTypeInfoSP& _pType,bool _bForce,bool _bReset)
165{
166 TOTypeInfoSP pOldType = getTypeInfo();
167 if ( _pType == pOldType )
168 return;
169
170 // reset type depending information
171 if ( _bReset )
172 {
173 SetFormatKey(0);
175 }
176
177 bool bForce = _bForce || !pOldType || pOldType->nType != _pType->nType;
178 switch ( _pType->nType )
179 {
180 case DataType::CHAR:
181 case DataType::VARCHAR:
182 if ( bForce )
183 {
184 sal_Int32 nPrec = DEFAULT_VARCHAR_PRECISION;
185 if ( GetPrecision() )
186 nPrec = GetPrecision();
187 SetPrecision(std::min<sal_Int32>(nPrec,_pType->nPrecision));
188 }
189 break;
190 case DataType::TIMESTAMP:
191 if ( bForce && _pType->nMaximumScale)
192 {
193 SetScale(std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
194 }
195 break;
196 default:
197 if ( bForce )
198 {
199 sal_Int32 nPrec = DEFAULT_OTHER_PRECISION;
200 switch ( _pType->nType )
201 {
202 case DataType::BIT:
203 case DataType::BLOB:
204 case DataType::CLOB:
205 nPrec = _pType->nPrecision;
206 break;
207 default:
208 if ( GetPrecision() )
209 nPrec = GetPrecision();
210 break;
211 }
212
213 if ( _pType->nPrecision )
214 SetPrecision(std::min<sal_Int32>(nPrec ? nPrec : DEFAULT_NUMERIC_PRECISION,_pType->nPrecision));
215 if ( _pType->nMaximumScale )
216 SetScale(std::min<sal_Int32>(GetScale() ? GetScale() : DEFAULT_NUMERIC_SCALE,_pType->nMaximumScale));
217 }
218 }
219 if ( _pType->aCreateParams.isEmpty() )
220 {
221 SetPrecision(_pType->nPrecision);
222 SetScale(_pType->nMinimumScale);
223 }
224 if ( !_pType->bNullable && IsNullable() )
225 SetIsNullable(ColumnValue::NO_NULLS);
226 if ( !_pType->bAutoIncrement && IsAutoIncrement() )
227 SetAutoIncrement(false);
228 SetCurrency( _pType->bCurrency );
229 SetType(_pType);
230 SetTypeName(_pType->aTypeName);
231}
232
233void OFieldDescription::SetName(const OUString& _rName)
234{
235 try
236 {
237 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_NAME) )
238 m_xDest->setPropertyValue(PROPERTY_NAME,Any(_rName));
239 else
240 m_sName = _rName;
241 }
242 catch(const Exception& )
243 {
244 DBG_UNHANDLED_EXCEPTION("dbaccess");
245 }
246}
247
248void OFieldDescription::SetHelpText(const OUString& _sHelpText)
249{
250 try
251 {
252 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
253 m_xDest->setPropertyValue(PROPERTY_HELPTEXT,Any(_sHelpText));
254 else
255 m_sHelpText = _sHelpText;
256 }
257 catch(const Exception& )
258 {
259 DBG_UNHANDLED_EXCEPTION("dbaccess");
260 }
261}
262
263void OFieldDescription::SetDescription(const OUString& _rDescription)
264{
265 try
266 {
267 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DESCRIPTION) )
268 m_xDest->setPropertyValue(PROPERTY_DESCRIPTION,Any(_rDescription));
269 else
270 m_sDescription = _rDescription;
271 }
272 catch(const Exception& )
273 {
274 DBG_UNHANDLED_EXCEPTION("dbaccess");
275 }
276}
277
278void OFieldDescription::SetDefaultValue(const Any& _rDefaultValue)
279{
280 try
281 {
282 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) )
283 m_xDest->setPropertyValue(PROPERTY_DEFAULTVALUE, _rDefaultValue);
284 }
285 catch( const Exception& )
286 {
287 DBG_UNHANDLED_EXCEPTION("dbaccess");
288 }
289}
290
291void OFieldDescription::SetControlDefault(const Any& _rControlDefault)
292{
293 try
294 {
295 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
296 m_xDest->setPropertyValue(PROPERTY_CONTROLDEFAULT, _rControlDefault);
297 else
298 m_aControlDefault = _rControlDefault;
299 }
300 catch( const Exception& )
301 {
302 DBG_UNHANDLED_EXCEPTION("dbaccess");
303 }
304}
305
306void OFieldDescription::SetAutoIncrementValue(const OUString& _sAutoIncValue)
307{
308 try
309 {
310 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
311 m_xDest->setPropertyValue(PROPERTY_AUTOINCREMENTCREATION,Any(_sAutoIncValue));
312 else
313 m_sAutoIncrementValue = _sAutoIncValue;
314 }
315 catch( const Exception& )
316 {
317 DBG_UNHANDLED_EXCEPTION("dbaccess");
318 }
319}
320
322{
323 m_pType = _pType;
324 if ( !m_pType )
325 return;
326
327 try
328 {
329 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
330 m_xDest->setPropertyValue(PROPERTY_TYPE,Any(m_pType->nType));
331 else
332 m_nType = m_pType->nType;
333 }
334 catch( const Exception& )
335 {
336 DBG_UNHANDLED_EXCEPTION("dbaccess");
337 }
338}
339
341{
342 try
343 {
344 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
345 m_xDest->setPropertyValue(PROPERTY_TYPE,Any(_nType));
346 else
347 {
348 m_nType = _nType;
349 OSL_ENSURE(!m_pType,"Invalid call here!");
350 }
351 }
352 catch( const Exception& )
353 {
354 DBG_UNHANDLED_EXCEPTION("dbaccess");
355 }
356}
357
358void OFieldDescription::SetPrecision(sal_Int32 _rPrecision)
359{
360 try
361 {
362 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_PRECISION) )
363 m_xDest->setPropertyValue(PROPERTY_PRECISION,Any(_rPrecision));
364 else
365 m_nPrecision = _rPrecision;
366 }
367 catch( const Exception& )
368 {
369 DBG_UNHANDLED_EXCEPTION("dbaccess");
370 }
371}
372
373void OFieldDescription::SetScale(sal_Int32 _rScale)
374{
375 try
376 {
377 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_SCALE) )
378 m_xDest->setPropertyValue(PROPERTY_SCALE,Any(_rScale));
379 else
380 m_nScale = _rScale;
381 }
382 catch( const Exception& )
383 {
384 DBG_UNHANDLED_EXCEPTION("dbaccess");
385 }
386}
387
388void OFieldDescription::SetIsNullable(sal_Int32 _rIsNullable)
389{
390 try
391 {
392 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) )
393 m_xDest->setPropertyValue(PROPERTY_ISNULLABLE,Any(_rIsNullable));
394 else
395 m_nIsNullable = _rIsNullable;
396 }
397 catch( const Exception& )
398 {
399 DBG_UNHANDLED_EXCEPTION("dbaccess");
400 }
401}
402
403void OFieldDescription::SetFormatKey(sal_Int32 _rFormatKey)
404{
405 try
406 {
407 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
408 m_xDest->setPropertyValue(PROPERTY_FORMATKEY,Any(_rFormatKey));
409 else
410 m_nFormatKey = _rFormatKey;
411 }
412 catch( const Exception& )
413 {
414 DBG_UNHANDLED_EXCEPTION("dbaccess");
415 }
416}
417
419{
420 try
421 {
422 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ALIGN) )
423 m_xDest->setPropertyValue(PROPERTY_ALIGN,Any( dbaui::mapTextAlign(_rHorJustify)));
424 else
425 m_eHorJustify = _rHorJustify;
426 }
427 catch( const Exception& )
428 {
429 DBG_UNHANDLED_EXCEPTION("dbaccess");
430 }
431}
432
434{
435 try
436 {
437 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT) )
438 m_xDest->setPropertyValue(PROPERTY_ISAUTOINCREMENT,Any(_bAuto));
439 else
440 m_bIsAutoIncrement = _bAuto;
441 }
442 catch( const Exception& )
443 {
444 DBG_UNHANDLED_EXCEPTION("dbaccess");
445 }
446}
447
449{
450 m_bIsPrimaryKey = _bPKey;
451 if ( _bPKey )
452 SetIsNullable(css::sdbc::ColumnValue::NO_NULLS);
453}
454
455void OFieldDescription::SetCurrency(bool _bIsCurrency)
456{
457 m_bIsCurrency = _bIsCurrency;
458}
459
461{
462 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_NAME) )
463 return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_NAME));
464 else
465 return m_sName;
466}
467
469{
470 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DESCRIPTION) )
471 return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_DESCRIPTION));
472 else
473 return m_sDescription;
474}
475
477{
478 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
479 return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_HELPTEXT));
480 else
481 return m_sHelpText;
482}
483
485{
486 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
487 return m_xDest->getPropertyValue(PROPERTY_CONTROLDEFAULT);
488 else
489 return m_aControlDefault;
490}
491
493{
494 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION) )
495 return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_AUTOINCREMENTCREATION));
496 else
498}
499
501{
502 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPE) )
503 return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_TYPE));
504 else
505 return m_pType ? m_pType->nType : m_nType;
506}
507
509{
510 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPENAME) )
511 return ::comphelper::getString(m_xDest->getPropertyValue(PROPERTY_TYPENAME));
512 else
513 return m_pType ? m_pType->aTypeName : m_sTypeName;
514}
515
517{
518 sal_Int32 nPrec = m_nPrecision;
519 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_PRECISION) )
520 nPrec = ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_PRECISION));
521
522 TOTypeInfoSP pTypeInfo = getTypeInfo();
523 if ( pTypeInfo )
524 {
525 switch ( pTypeInfo->nType )
526 {
527 case DataType::TINYINT:
528 case DataType::SMALLINT:
529 case DataType::INTEGER:
530 case DataType::BIGINT:
531 if ( !nPrec )
532 nPrec = pTypeInfo->nPrecision;
533 break;
534 }
535 }
536
537 return nPrec;
538}
539
541{
542 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_SCALE) )
543 return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_SCALE));
544 else
545 return m_nScale;
546}
547
549{
550 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) )
551 return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_ISNULLABLE));
552 else
553 return m_nIsNullable;
554}
555
557{
558 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
559 return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_FORMATKEY));
560 else
561 return m_nFormatKey;
562}
563
565{
566 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ALIGN) )
567 return ::dbaui::mapTextJustify(::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_ALIGN)));
568 else
569 return m_eHorJustify;
570}
571
572
574{
575 TOTypeInfoSP pSpecialType = std::make_shared<OTypeInfo>();
576 *pSpecialType = *m_pType;
577 pSpecialType->nPrecision = GetPrecision();
578 pSpecialType->nMaximumScale = static_cast<sal_Int16>(GetScale());
579 pSpecialType->bAutoIncrement = IsAutoIncrement(); // http://dba.openoffice.org/issues/show_bug.cgi?id=115398 fixed by ludob
580 return pSpecialType;
581}
582
584{
585 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISAUTOINCREMENT) )
586 return ::cppu::any2bool(m_xDest->getPropertyValue(PROPERTY_ISAUTOINCREMENT));
587 else
588 return m_bIsAutoIncrement;
589}
590
591
593{
594 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_ISNULLABLE) )
595 return ::comphelper::getINT32(m_xDest->getPropertyValue(PROPERTY_ISNULLABLE)) == css::sdbc::ColumnValue::NULLABLE;
596 else
597 return m_nIsNullable == css::sdbc::ColumnValue::NULLABLE;
598}
599
600void OFieldDescription::SetTypeName(const OUString& _sTypeName)
601{
602 try
603 {
604 if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_TYPENAME) )
605 m_xDest->setPropertyValue(PROPERTY_TYPENAME,Any(_sTypeName));
606 else
607 m_sTypeName = _sTypeName;
608 }
609 catch( const Exception& )
610 {
611 DBG_UNHANDLED_EXCEPTION("dbaccess");
612 }
613}
614
616{
617 if ( !_rxColumn.is() )
618 return;
619
620 Reference<XPropertySetInfo> xInfo = _rxColumn->getPropertySetInfo();
621
622 if ( GetFormatKey() != NumberFormat::ALL && xInfo->hasPropertyByName(PROPERTY_FORMATKEY) )
623 _rxColumn->setPropertyValue(PROPERTY_FORMATKEY,Any(GetFormatKey()));
624 if ( GetHorJustify() != SvxCellHorJustify::Standard && xInfo->hasPropertyByName(PROPERTY_ALIGN) )
625 _rxColumn->setPropertyValue(PROPERTY_ALIGN,Any(dbaui::mapTextAlign(GetHorJustify())));
626 if ( !GetHelpText().isEmpty() && xInfo->hasPropertyByName(PROPERTY_HELPTEXT) )
627 _rxColumn->setPropertyValue(PROPERTY_HELPTEXT,Any(GetHelpText()));
628 if ( GetControlDefault().hasValue() && xInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) )
629 _rxColumn->setPropertyValue(PROPERTY_CONTROLDEFAULT,GetControlDefault());
630
631 if(xInfo->hasPropertyByName(PROPERTY_RELATIVEPOSITION))
632 _rxColumn->setPropertyValue(PROPERTY_RELATIVEPOSITION,m_aRelativePosition);
633 if(xInfo->hasPropertyByName(PROPERTY_WIDTH))
634 _rxColumn->setPropertyValue(PROPERTY_WIDTH,m_aWidth);
635 if(xInfo->hasPropertyByName(PROPERTY_HIDDEN))
636 _rxColumn->setPropertyValue(PROPERTY_HIDDEN,Any(m_bHidden));
637}
638
639/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define DEFAULT_NUMERIC_SCALE
#define DEFAULT_VARCHAR_PRECISION
#define DEFAULT_NUMERIC_PRECISION
#define DEFAULT_OTHER_PRECISION
OUString m_sDescription
void SetTypeValue(sal_Int32 _nType)
void SetHelpText(const OUString &_sHelptext)
void SetControlDefault(const css::uno::Any &_rControlDefault)
void SetTypeName(const OUString &_sTypeName)
void SetPrecision(sal_Int32 _rPrecision)
void SetIsNullable(sal_Int32 _rIsNullable)
const TOTypeInfoSP & getTypeInfo() const
void SetPrimaryKey(bool _bPKey)
void SetType(const TOTypeInfoSP &_pType)
css::uno::Reference< css::beans::XPropertySet > m_xDest
void SetAutoIncrementValue(const OUString &_sAutoIncValue)
void SetAutoIncrement(bool _bAuto)
void SetName(const OUString &_rName)
sal_Int32 GetFormatKey() const
void SetDescription(const OUString &_rDescription)
OUString GetAutoIncrementValue() const
void FillFromTypeInfo(const TOTypeInfoSP &_pType, bool _bForce, bool _bReset)
css::uno::Any GetControlDefault() const
SvxCellHorJustify GetHorJustify() const
sal_Int32 GetPrecision() const
void SetDefaultValue(const css::uno::Any &_rDefaultValue)
TOTypeInfoSP getSpecialTypeInfo() const
void SetCurrency(bool _bIsCurrency)
SvxCellHorJustify m_eHorJustify
sal_Int32 GetIsNullable() const
void SetScale(sal_Int32 _rScale)
void SetFormatKey(sal_Int32 _rFormatKey)
void copyColumnSettingsTo(const css::uno::Reference< css::beans::XPropertySet > &_rxColumn)
copies the content of the field description into the column
css::uno::Reference< css::beans::XPropertySetInfo > m_xDestInfo
void SetHorJustify(const SvxCellHorJustify &_rHorJustify)
const Reference< XParameters > m_xDest
#define DBG_UNHANDLED_EXCEPTION(...)
OUString m_sName
@ Exception
SvxCellHorJustify mapTextJustify(sal_Int32 _nAlignment)
maps css::awt::TextAlign to SvxCellHorJustify
Definition: UITools.cxx:704
std::shared_ptr< OTypeInfo > TOTypeInfoSP
Definition: TypeInfo.hxx:99
sal_Int32 mapTextAlign(const SvxCellHorJustify &_eAlignment)
maps SvxCellHorJustify to css::awt::TextAlign
Definition: UITools.cxx:689
DataType
constexpr OUStringLiteral PROPERTY_WIDTH(u"Width")
constexpr OUStringLiteral PROPERTY_ISAUTOINCREMENT(u"IsAutoIncrement")
constexpr OUStringLiteral PROPERTY_CONTROLDEFAULT(u"ControlDefault")
constexpr OUStringLiteral PROPERTY_PRECISION(u"Precision")
constexpr OUStringLiteral PROPERTY_RELATIVEPOSITION(u"RelativePosition")
constexpr OUStringLiteral PROPERTY_TYPENAME(u"TypeName")
constexpr OUStringLiteral PROPERTY_ISNULLABLE(u"IsNullable")
constexpr OUStringLiteral PROPERTY_DESCRIPTION(u"Description")
constexpr OUStringLiteral PROPERTY_FORMATKEY(u"FormatKey")
constexpr OUStringLiteral PROPERTY_SCALE(u"Scale")
constexpr OUStringLiteral PROPERTY_DEFAULTVALUE(u"DefaultValue")
constexpr OUStringLiteral PROPERTY_HELPTEXT(u"HelpText")
constexpr OUStringLiteral PROPERTY_TYPE(u"Type")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_HIDDEN(u"Hidden")
constexpr OUStringLiteral PROPERTY_ALIGN(u"Align")
constexpr OUStringLiteral PROPERTY_AUTOINCREMENTCREATION(u"AutoIncrementCreation")
SvxCellHorJustify