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