1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include "apitools.hxx"
23 #include "dbastrings.hrc"
24 #include "definitioncolumn.hxx"
25 #include "sdbcoretools.hxx"
27 #include <com/sun/star/beans/PropertyAttribute.hpp>
28 #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
30 #include <comphelper/property.hxx>
31 #include <comphelper/types.hxx>
32 #include <connectivity/dbtools.hxx>
33 #include <cppuhelper/typeprovider.hxx>
34 #include <tools/debug.hxx>
35 #include <tools/diagnose_ex.h>
37 using namespace ::com::sun::star::sdbc
;
38 using namespace ::com::sun::star::sdbcx
;
39 using namespace ::com::sun::star::beans
;
40 using namespace ::com::sun::star::uno
;
41 using namespace ::com::sun::star::lang
;
42 using namespace ::com::sun::star::container
;
43 using namespace ::cppu
;
44 using namespace ::comphelper
;
45 using namespace ::osl
;
46 using namespace dbaccess
;
50 const sal_Int32 HAS_DESCRIPTION
= 0x00000001;
51 const sal_Int32 HAS_DEFAULTVALUE
= 0x00000002;
52 const sal_Int32 HAS_ROWVERSION
= 0x00000004;
53 const sal_Int32 HAS_AUTOINCREMENT_CREATION
= 0x00000008;
54 const sal_Int32 HAS_CATALOGNAME
= 0x00000010;
55 const sal_Int32 HAS_SCHEMANAME
= 0x00000020;
56 const sal_Int32 HAS_TABLENAME
= 0x00000040;
59 // OTableColumnDescriptor
60 IMPLEMENT_FORWARD_XINTERFACE2(OTableColumnDescriptor
,OColumn
,TXChild
)
62 void OTableColumnDescriptor::impl_registerProperties()
64 sal_Int32 nDefaultAttr
= m_bActAsDescriptor
? 0 : PropertyAttribute::READONLY
;
66 registerProperty( PROPERTY_TYPENAME
, PROPERTY_ID_TYPENAME
, nDefaultAttr
, &m_aTypeName
, cppu::UnoType
<decltype(m_aTypeName
)>::get() );
67 registerProperty( PROPERTY_DESCRIPTION
, PROPERTY_ID_DESCRIPTION
, nDefaultAttr
, &m_aDescription
, cppu::UnoType
<decltype(m_aDescription
)>::get() );
68 registerProperty( PROPERTY_DEFAULTVALUE
, PROPERTY_ID_DEFAULTVALUE
, nDefaultAttr
, &m_aDefaultValue
, cppu::UnoType
<decltype(m_aDefaultValue
)>::get() );
70 if ( m_bActAsDescriptor
)
71 registerProperty( PROPERTY_AUTOINCREMENTCREATION
, PROPERTY_ID_AUTOINCREMENTCREATION
, nDefaultAttr
, &m_aAutoIncrementValue
, cppu::UnoType
<decltype(m_aAutoIncrementValue
)>::get() );
73 registerProperty( PROPERTY_TYPE
, PROPERTY_ID_TYPE
, nDefaultAttr
, &m_nType
, cppu::UnoType
<decltype(m_nType
)>::get() );
74 registerProperty( PROPERTY_PRECISION
, PROPERTY_ID_PRECISION
, nDefaultAttr
, &m_nPrecision
, cppu::UnoType
<decltype(m_nPrecision
)>::get() );
75 registerProperty( PROPERTY_SCALE
, PROPERTY_ID_SCALE
, nDefaultAttr
, &m_nScale
, cppu::UnoType
<decltype(m_nScale
)>::get() );
76 registerProperty( PROPERTY_ISNULLABLE
, PROPERTY_ID_ISNULLABLE
, nDefaultAttr
, &m_nIsNullable
, cppu::UnoType
<decltype(m_nIsNullable
)>::get() );
77 registerProperty( PROPERTY_ISAUTOINCREMENT
, PROPERTY_ID_ISAUTOINCREMENT
, nDefaultAttr
, &m_bAutoIncrement
, cppu::UnoType
<decltype(m_bAutoIncrement
)>::get() );
78 registerProperty( PROPERTY_ISROWVERSION
, PROPERTY_ID_ISROWVERSION
, nDefaultAttr
, &m_bRowVersion
, cppu::UnoType
<decltype(m_bRowVersion
)>::get() );
79 registerProperty( PROPERTY_ISCURRENCY
, PROPERTY_ID_ISCURRENCY
, nDefaultAttr
, &m_bCurrency
, cppu::UnoType
<decltype(m_bCurrency
)>::get() );
81 OColumnSettings::registerProperties( *this );
84 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptor
)
86 // ::com::sun::star::lang::XServiceInfo
87 OUString
OTableColumnDescriptor::getImplementationName( ) throw (RuntimeException
, std::exception
)
89 return OUString("com.sun.star.sdb.OTableColumnDescriptor");
92 Sequence
< OUString
> OTableColumnDescriptor::getSupportedServiceNames( ) throw (RuntimeException
, std::exception
)
94 Sequence
< OUString
> aSNS( 2 );
95 aSNS
[0] = m_bActAsDescriptor
? OUString(SERVICE_SDBCX_COLUMNDESCRIPTOR
) : OUString(SERVICE_SDBCX_COLUMN
);
96 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
100 // comphelper::OPropertyArrayUsageHelper
101 ::cppu::IPropertyArrayHelper
* OTableColumnDescriptor::createArrayHelper( ) const
103 Sequence
< Property
> aProps
;
104 describeProperties( aProps
);
105 return new ::cppu::OPropertyArrayHelper( aProps
);
108 // cppu::OPropertySetHelper
109 ::cppu::IPropertyArrayHelper
& OTableColumnDescriptor::getInfoHelper()
111 return *static_cast< ::comphelper::OPropertyArrayUsageHelper
< OTableColumnDescriptor
>* >(this)->getArrayHelper();
114 void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const Any
& rValue
) throw (Exception
, std::exception
)
116 OColumn::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
117 ::dbaccess::notifyDataSourceModified( m_xParent
, true );
120 Reference
< XInterface
> SAL_CALL
OTableColumnDescriptor::getParent( ) throw (RuntimeException
, std::exception
)
122 ::osl::MutexGuard
aGuard(m_aMutex
);
126 void SAL_CALL
OTableColumnDescriptor::setParent( const Reference
< XInterface
>& _xParent
) throw (NoSupportException
, RuntimeException
, std::exception
)
128 ::osl::MutexGuard
aGuard(m_aMutex
);
129 m_xParent
= _xParent
;
134 OTableColumn::OTableColumn( const OUString
& _rName
)
135 :OTableColumnDescriptor( false /* do not act as descriptor */ )
140 OTableColumn::~OTableColumn()
144 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumn
)
146 OUString
OTableColumn::getImplementationName( ) throw (RuntimeException
, std::exception
)
148 return OUString("com.sun.star.sdb.OTableColumn");
151 ::cppu::IPropertyArrayHelper
& SAL_CALL
OTableColumn::getInfoHelper()
153 return *OTableColumn_PBase::getArrayHelper();
156 ::cppu::IPropertyArrayHelper
* OTableColumn::createArrayHelper( ) const
158 return OTableColumnDescriptor::createArrayHelper();
163 OQueryColumn::OQueryColumn( const Reference
< XPropertySet
>& _rxParserColumn
, const Reference
< XConnection
>& _rxConnection
, const OUString
&i_sLabel
)
164 :OTableColumnDescriptor( false /* do not act as descriptor */ )
167 const sal_Int32 nPropAttr
= PropertyAttribute::READONLY
;
168 registerProperty( PROPERTY_CATALOGNAME
, PROPERTY_ID_CATALOGNAME
, nPropAttr
, &m_sCatalogName
, cppu::UnoType
<decltype(m_sCatalogName
)>::get() );
169 registerProperty( PROPERTY_SCHEMANAME
, PROPERTY_ID_SCHEMANAME
, nPropAttr
, &m_sSchemaName
, cppu::UnoType
<decltype(m_sSchemaName
)>::get() );
170 registerProperty( PROPERTY_TABLENAME
, PROPERTY_ID_TABLENAME
, nPropAttr
, &m_sTableName
, cppu::UnoType
<decltype(m_sTableName
)>::get() );
171 registerProperty( PROPERTY_REALNAME
, PROPERTY_ID_REALNAME
, nPropAttr
, &m_sRealName
, cppu::UnoType
<decltype(m_sRealName
)>::get() );
172 registerProperty( PROPERTY_LABEL
, PROPERTY_ID_LABEL
, nPropAttr
, &m_sLabel
, cppu::UnoType
<decltype(m_sLabel
)>::get() );
175 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_TYPENAME
) >>= m_aTypeName
);
176 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_ISNULLABLE
) >>= m_nIsNullable
);
177 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_PRECISION
) >>= m_nPrecision
);
178 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_SCALE
) >>= m_nScale
);
179 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_TYPE
) >>= m_nType
);
180 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_ISAUTOINCREMENT
) >>= m_bAutoIncrement
);
181 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_ISCURRENCY
) >>= m_bCurrency
);
182 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_NAME
) >>= m_sName
);
184 m_bRowVersion
= false;
186 Reference
< XPropertySetInfo
> xPSI( _rxParserColumn
->getPropertySetInfo(), UNO_SET_THROW
);
187 if ( xPSI
->hasPropertyByName( PROPERTY_DEFAULTVALUE
) )
188 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_DEFAULTVALUE
) >>= m_aDefaultValue
);
190 // copy some optional properties from the parser column
191 struct PropertyDescriptor
196 PropertyDescriptor aProps
[] =
198 { OUString(PROPERTY_CATALOGNAME
), PROPERTY_ID_CATALOGNAME
},
199 { OUString(PROPERTY_SCHEMANAME
), PROPERTY_ID_SCHEMANAME
},
200 { OUString(PROPERTY_TABLENAME
), PROPERTY_ID_TABLENAME
},
201 { OUString(PROPERTY_REALNAME
), PROPERTY_ID_REALNAME
}
203 for ( size_t i
=0; i
< sizeof( aProps
) / sizeof( aProps
[0] ); ++i
)
205 if ( xPSI
->hasPropertyByName( aProps
[i
].sName
) )
206 setFastPropertyValue_NoBroadcast( aProps
[i
].nHandle
, _rxParserColumn
->getPropertyValue( aProps
[i
].sName
) );
209 // determine the table column we're based on
210 osl_atomic_increment( &m_refCount
);
212 m_xOriginalTableColumn
= impl_determineOriginalTableColumn( _rxConnection
);
214 osl_atomic_decrement( &m_refCount
);
217 OQueryColumn::~OQueryColumn()
221 Reference
< XPropertySet
> OQueryColumn::impl_determineOriginalTableColumn( const Reference
< XConnection
>& _rxConnection
)
223 OSL_PRECOND( _rxConnection
.is(), "OQueryColumn::impl_determineOriginalTableColumn: illegal connection!" );
224 if ( !_rxConnection
.is() )
227 Reference
< XPropertySet
> xOriginalTableColumn
;
230 // determine the composed table name, plus the column name, as indicated by the
231 // respective properties
232 OUString sCatalog
, sSchema
, sTable
;
233 OSL_VERIFY( getPropertyValue( PROPERTY_CATALOGNAME
) >>= sCatalog
);
234 OSL_VERIFY( getPropertyValue( PROPERTY_SCHEMANAME
) >>= sSchema
);
235 OSL_VERIFY( getPropertyValue( PROPERTY_TABLENAME
) >>= sTable
);
236 if ( sCatalog
.isEmpty() && sSchema
.isEmpty() && sTable
.isEmpty() )
239 OUString sComposedTableName
= ::dbtools::composeTableName(
240 _rxConnection
->getMetaData(), sCatalog
, sSchema
, sTable
, false, ::dbtools::eComplete
);
242 // retrieve the table in question
243 Reference
< XTablesSupplier
> xSuppTables( _rxConnection
, UNO_QUERY_THROW
);
244 Reference
< XNameAccess
> xTables( xSuppTables
->getTables(), UNO_QUERY_THROW
);
245 if ( !xTables
->hasByName( sComposedTableName
) )
248 Reference
< XColumnsSupplier
> xSuppCols( xTables
->getByName( sComposedTableName
), UNO_QUERY_THROW
);
249 Reference
< XNameAccess
> xColumns( xSuppCols
->getColumns(), UNO_QUERY_THROW
);
252 OSL_VERIFY( getPropertyValue( PROPERTY_REALNAME
) >>= sColumn
);
253 if ( !xColumns
->hasByName( sColumn
) )
256 xOriginalTableColumn
.set( xColumns
->getByName( sColumn
), UNO_QUERY
);
258 catch( const Exception
& )
260 DBG_UNHANDLED_EXCEPTION();
262 return xOriginalTableColumn
;
265 IMPLEMENT_GET_IMPLEMENTATION_ID( OQueryColumn
)
267 OUString SAL_CALL
OQueryColumn::getImplementationName( ) throw(RuntimeException
, std::exception
)
269 return OUString( "org.openoffice.comp.dbaccess.OQueryColumn" );
272 ::cppu::IPropertyArrayHelper
& SAL_CALL
OQueryColumn::getInfoHelper()
274 return *OQueryColumn_PBase::getArrayHelper();
277 ::cppu::IPropertyArrayHelper
* OQueryColumn::createArrayHelper() const
279 return OTableColumnDescriptor::createArrayHelper();
282 void SAL_CALL
OQueryColumn::getFastPropertyValue( Any
& _rValue
, sal_Int32 _nHandle
) const
284 OTableColumnDescriptor::getFastPropertyValue( _rValue
, _nHandle
);
286 // special treatment for column settings:
287 if ( !OColumnSettings::isColumnSettingProperty( _nHandle
) )
290 // If the setting has its default value, then try to obtain the value from the table column which
291 // this query column is based on
292 if ( !OColumnSettings::isDefaulted( _nHandle
, _rValue
) )
295 if ( !m_xOriginalTableColumn
.is() )
300 // determine original property name
302 sal_Int16
nAttributes( 0 );
303 const_cast< OQueryColumn
* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName
, &nAttributes
, _nHandle
);
304 OSL_ENSURE( !sPropName
.isEmpty(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
306 _rValue
= m_xOriginalTableColumn
->getPropertyValue( sPropName
);
308 catch( const Exception
& )
310 DBG_UNHANDLED_EXCEPTION();
316 OColumnWrapper::OColumnWrapper( const Reference
< XPropertySet
> & rCol
, const bool _bNameIsReadOnly
)
317 :OColumn( _bNameIsReadOnly
)
321 // which type of aggregate property do we have?
322 // we distinguish the properties by the containment of optional properties
324 if ( m_xAggregate
.is() )
326 Reference
<XPropertySetInfo
> xInfo(m_xAggregate
->getPropertySetInfo());
327 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_DESCRIPTION
) ? HAS_DESCRIPTION
: 0;
328 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_DEFAULTVALUE
) ? HAS_DEFAULTVALUE
: 0;
329 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_ISROWVERSION
) ? HAS_ROWVERSION
: 0;
330 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION
) ? HAS_AUTOINCREMENT_CREATION
: 0;
331 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_CATALOGNAME
) ? HAS_CATALOGNAME
: 0;
332 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_SCHEMANAME
) ? HAS_SCHEMANAME
: 0;
333 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_TABLENAME
) ? HAS_TABLENAME
: 0;
335 m_xAggregate
->getPropertyValue(PROPERTY_NAME
) >>= m_sName
;
339 OColumnWrapper::~OColumnWrapper()
343 OUString
OColumnWrapper::impl_getPropertyNameFromHandle( const sal_Int32 _nHandle
) const
346 sal_Int16
nAttributes( 0 );
347 const_cast< OColumnWrapper
* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName
, &nAttributes
, _nHandle
);
348 OSL_ENSURE( !sPropName
.isEmpty(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
352 void OColumnWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
354 // derived classes are free to either use the OPropertyContainer(Helper) mechanisms for properties,
355 // or to declare additional properties which are to be forwarded to the wrapped object. So we need
356 // to distinguish those cases.
357 if ( OColumn::isRegisteredProperty( nHandle
) )
359 OColumn::getFastPropertyValue( rValue
, nHandle
);
363 rValue
= m_xAggregate
->getPropertyValue( impl_getPropertyNameFromHandle( nHandle
) );
367 sal_Bool
OColumnWrapper::convertFastPropertyValue( Any
& rConvertedValue
, Any
& rOldValue
, sal_Int32 nHandle
,
368 const Any
& rValue
) throw (IllegalArgumentException
)
370 bool bModified( false );
371 if ( OColumn::isRegisteredProperty( nHandle
) )
373 bModified
= OColumn::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
377 getFastPropertyValue( rOldValue
, nHandle
);
378 if ( rOldValue
!= rValue
)
380 rConvertedValue
= rValue
;
387 void OColumnWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const Any
& rValue
) throw (Exception
, std::exception
)
389 if ( OColumn::isRegisteredProperty( nHandle
) )
391 OColumn::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
395 m_xAggregate
->setPropertyValue( impl_getPropertyNameFromHandle( nHandle
), rValue
);
399 sal_Int64 SAL_CALL
OColumnWrapper::getSomething( const Sequence
< sal_Int8
>& aIdentifier
) throw(RuntimeException
)
401 Reference
< XUnoTunnel
> xTunnel( m_xAggregate
, UNO_QUERY
);
403 return xTunnel
->getSomething( aIdentifier
);
407 // OTableColumnDescriptorWrapper
408 OTableColumnDescriptorWrapper::OTableColumnDescriptorWrapper( const Reference
< XPropertySet
>& _rCol
, const bool _bPureWrap
, const bool _bIsDescriptor
)
409 :OColumnWrapper( _rCol
, !_bIsDescriptor
)
410 ,m_bPureWrap( _bPureWrap
)
411 ,m_bIsDescriptor( _bIsDescriptor
)
413 // let the ColumnSettings register its properties
414 OColumnSettings::registerProperties( *this );
417 // com::sun::star::lang::XTypeProvider
418 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptorWrapper
)
420 // ::com::sun::star::lang::XServiceInfo
421 OUString
OTableColumnDescriptorWrapper::getImplementationName( ) throw (RuntimeException
, std::exception
)
423 return OUString("com.sun.star.sdb.OTableColumnDescriptorWrapper");
426 Sequence
< OUString
> OTableColumnDescriptorWrapper::getSupportedServiceNames( ) throw (RuntimeException
, std::exception
)
428 Sequence
< OUString
> aSNS( 2 );
429 aSNS
[0] = SERVICE_SDBCX_COLUMNDESCRIPTOR
;
430 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
434 // comphelper::OPropertyArrayUsageHelper
435 ::cppu::IPropertyArrayHelper
* OTableColumnDescriptorWrapper::createArrayHelper( sal_Int32 nId
) const
437 const sal_Int32 nHaveAlways
= 7;
439 // Which optional properties are contained?
440 const sal_Int32
nHaveOptionally (::std::bitset
<7>(nId
).count());
442 BEGIN_PROPERTY_SEQUENCE( nHaveAlways
+ nHaveOptionally
)
444 DECL_PROP0_BOOL( ISAUTOINCREMENT
);
445 DECL_PROP0_BOOL( ISCURRENCY
);
446 DECL_PROP0( ISNULLABLE
, sal_Int32
);
447 DECL_PROP0( PRECISION
, sal_Int32
);
448 DECL_PROP0( SCALE
, sal_Int32
);
449 DECL_PROP0( TYPE
, sal_Int32
);
450 DECL_PROP0( TYPENAME
, OUString
);
452 if ( nId
& HAS_AUTOINCREMENT_CREATION
)
454 DECL_PROP1( AUTOINCREMENTCREATION
, OUString
, MAYBEVOID
);
456 if ( nId
& HAS_DEFAULTVALUE
)
458 DECL_PROP0( DEFAULTVALUE
, OUString
);
460 if ( nId
& HAS_DESCRIPTION
)
462 DECL_PROP0( DESCRIPTION
, OUString
);
464 if ( nId
& HAS_ROWVERSION
)
466 DECL_PROP0_BOOL( ISROWVERSION
);
468 if ( nId
& HAS_CATALOGNAME
)
470 DECL_PROP0( CATALOGNAME
, OUString
);
472 if ( nId
& HAS_SCHEMANAME
)
474 DECL_PROP0( SCHEMANAME
, OUString
);
476 if ( nId
& HAS_TABLENAME
)
478 DECL_PROP0( TABLENAME
, OUString
);
481 END_PROPERTY_SEQUENCE()
483 if ( !m_bIsDescriptor
)
485 for ( Property
* prop
= aDescriptor
.getArray();
486 prop
!= aDescriptor
.getArray() + aDescriptor
.getLength();
490 prop
->Attributes
|= PropertyAttribute::READONLY
;
494 // finally also describe the properties which are maintained by our base class, in particular the OPropertyContainerHelper
495 Sequence
< Property
> aBaseProperties
;
496 describeProperties( aBaseProperties
);
498 Sequence
< Property
> aAllProperties( ::comphelper::concatSequences( aDescriptor
, aBaseProperties
) );
499 return new ::cppu::OPropertyArrayHelper( aAllProperties
, sal_False
);
502 // cppu::OPropertySetHelper
503 ::cppu::IPropertyArrayHelper
& OTableColumnDescriptorWrapper::getInfoHelper()
505 return *static_cast< OIdPropertyArrayUsageHelper
< OTableColumnDescriptorWrapper
>* >(this)->getArrayHelper(m_nColTypeID
);
508 void OTableColumnDescriptorWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
512 rValue
= m_xAggregate
->getPropertyValue( impl_getPropertyNameFromHandle( nHandle
) );
516 OColumnWrapper::getFastPropertyValue( rValue
, nHandle
);
520 sal_Bool
OTableColumnDescriptorWrapper::convertFastPropertyValue( Any
& rConvertedValue
, Any
& rOldValue
, sal_Int32 nHandle
, const Any
& rValue
) throw (IllegalArgumentException
)
522 bool bModified(false);
525 // do not delegate to OColumnWrapper: It would, for the properties which were registered with registerProperty,
526 // ask the OPropertyContainer base class, which is not what we want here.
527 // TODO: the whole "m_bPureWrap"-thingie is strange. We should have a dedicated class doing this wrapping,
528 // not a class which normally serves other purposes, and only sometimes does a "pure wrap". It makes the
529 // code unnecessarily hard to maintain, and error prone.
530 rOldValue
= m_xAggregate
->getPropertyValue( impl_getPropertyNameFromHandle( nHandle
) );
531 if ( rOldValue
!= rValue
)
533 rConvertedValue
= rValue
;
539 bModified
= OColumnWrapper::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
544 void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
548 throw (Exception
, std::exception
)
552 m_xAggregate
->setPropertyValue( impl_getPropertyNameFromHandle( nHandle
), rValue
);
556 OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
560 // OTableColumnWrapper
561 OTableColumnWrapper::OTableColumnWrapper( const Reference
< XPropertySet
>& rCol
, const Reference
< XPropertySet
>& _xColDefintion
,
562 const bool _bPureWrap
)
563 :OTableColumnDescriptorWrapper( rCol
, _bPureWrap
, false )
565 osl_atomic_increment( &m_refCount
);
566 if ( _xColDefintion
.is() )
570 ::comphelper::copyProperties( _xColDefintion
, this );
572 catch( const Exception
& )
574 DBG_UNHANDLED_EXCEPTION();
577 osl_atomic_decrement( &m_refCount
);
580 OTableColumnWrapper::~OTableColumnWrapper()
584 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnWrapper
)
586 OUString
OTableColumnWrapper::getImplementationName( ) throw (RuntimeException
, std::exception
)
588 return OUString("com.sun.star.sdb.OTableColumnWrapper" );
591 Sequence
< OUString
> OTableColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException
, std::exception
)
593 Sequence
< OUString
> aSNS( 2 );
594 aSNS
[0] = SERVICE_SDBCX_COLUMN
;
595 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
599 ::cppu::IPropertyArrayHelper
& OTableColumnWrapper::getInfoHelper()
601 return *static_cast< OIdPropertyArrayUsageHelper
< OTableColumnWrapper
>* >(this)->getArrayHelper(m_nColTypeID
);
604 // comphelper::OPropertyArrayUsageHelper
605 ::cppu::IPropertyArrayHelper
* OTableColumnWrapper::createArrayHelper( sal_Int32 nId
) const
607 return OTableColumnDescriptorWrapper::createArrayHelper( nId
);
610 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */