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 //============================================================
60 //= OTableColumnDescriptor
61 //============================================================
62 IMPLEMENT_FORWARD_XINTERFACE2(OTableColumnDescriptor
,OColumn
,TXChild
)
64 void OTableColumnDescriptor::impl_registerProperties()
66 sal_Int32 nDefaultAttr
= m_bActAsDescriptor
? 0 : PropertyAttribute::READONLY
;
68 registerProperty( PROPERTY_TYPENAME
, PROPERTY_ID_TYPENAME
, nDefaultAttr
, &m_aTypeName
, ::getCppuType( &m_aTypeName
) );
69 registerProperty( PROPERTY_DESCRIPTION
, PROPERTY_ID_DESCRIPTION
, nDefaultAttr
, &m_aDescription
, ::getCppuType( &m_aDescription
) );
70 registerProperty( PROPERTY_DEFAULTVALUE
, PROPERTY_ID_DEFAULTVALUE
, nDefaultAttr
, &m_aDefaultValue
, ::getCppuType( &m_aDefaultValue
) );
72 if ( m_bActAsDescriptor
)
73 registerProperty( PROPERTY_AUTOINCREMENTCREATION
, PROPERTY_ID_AUTOINCREMENTCREATION
, nDefaultAttr
, &m_aAutoIncrementValue
, ::getCppuType( &m_aAutoIncrementValue
) );
75 registerProperty( PROPERTY_TYPE
, PROPERTY_ID_TYPE
, nDefaultAttr
, &m_nType
, ::getCppuType( &m_nType
) );
76 registerProperty( PROPERTY_PRECISION
, PROPERTY_ID_PRECISION
, nDefaultAttr
, &m_nPrecision
, ::getCppuType( &m_nPrecision
) );
77 registerProperty( PROPERTY_SCALE
, PROPERTY_ID_SCALE
, nDefaultAttr
, &m_nScale
, ::getCppuType( &m_nScale
) );
78 registerProperty( PROPERTY_ISNULLABLE
, PROPERTY_ID_ISNULLABLE
, nDefaultAttr
, &m_nIsNullable
, ::getCppuType( &m_nIsNullable
) );
79 registerProperty( PROPERTY_ISAUTOINCREMENT
, PROPERTY_ID_ISAUTOINCREMENT
, nDefaultAttr
, &m_bAutoIncrement
, ::getCppuType( &m_bAutoIncrement
) );
80 registerProperty( PROPERTY_ISROWVERSION
, PROPERTY_ID_ISROWVERSION
, nDefaultAttr
, &m_bRowVersion
, ::getCppuType( &m_bRowVersion
) );
81 registerProperty( PROPERTY_ISCURRENCY
, PROPERTY_ID_ISCURRENCY
, nDefaultAttr
, &m_bCurrency
, ::getCppuType( &m_bCurrency
) );
83 OColumnSettings::registerProperties( *this );
86 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptor
)
88 // ::com::sun::star::lang::XServiceInfo
89 rtl::OUString
OTableColumnDescriptor::getImplementationName( ) throw (RuntimeException
)
91 return rtl::OUString("com.sun.star.sdb.OTableColumnDescriptor");
94 Sequence
< ::rtl::OUString
> OTableColumnDescriptor::getSupportedServiceNames( ) throw (RuntimeException
)
96 Sequence
< ::rtl::OUString
> aSNS( 2 );
97 aSNS
[0] = m_bActAsDescriptor
? SERVICE_SDBCX_COLUMNDESCRIPTOR
: SERVICE_SDBCX_COLUMN
;
98 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
102 // comphelper::OPropertyArrayUsageHelper
103 ::cppu::IPropertyArrayHelper
* OTableColumnDescriptor::createArrayHelper( ) const
105 Sequence
< Property
> aProps
;
106 describeProperties( aProps
);
107 return new ::cppu::OPropertyArrayHelper( aProps
);
110 // cppu::OPropertySetHelper
111 ::cppu::IPropertyArrayHelper
& OTableColumnDescriptor::getInfoHelper()
113 return *static_cast< ::comphelper::OPropertyArrayUsageHelper
< OTableColumnDescriptor
>* >(this)->getArrayHelper();
116 void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const Any
& rValue
) throw (Exception
)
118 OColumn::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
119 ::dbaccess::notifyDataSourceModified( m_xParent
, sal_True
);
122 Reference
< XInterface
> SAL_CALL
OTableColumnDescriptor::getParent( ) throw (RuntimeException
)
124 ::osl::MutexGuard
aGuard(m_aMutex
);
128 void SAL_CALL
OTableColumnDescriptor::setParent( const Reference
< XInterface
>& _xParent
) throw (NoSupportException
, RuntimeException
)
130 ::osl::MutexGuard
aGuard(m_aMutex
);
131 m_xParent
= _xParent
;
133 //============================================================
135 //============================================================
136 DBG_NAME(OTableColumn
);
138 OTableColumn::OTableColumn( const ::rtl::OUString
& _rName
)
139 :OTableColumnDescriptor( false /* do not act as descriptor */ )
141 DBG_CTOR(OTableColumn
,NULL
);
145 OTableColumn::~OTableColumn()
147 DBG_DTOR(OTableColumn
,NULL
);
150 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumn
)
152 rtl::OUString
OTableColumn::getImplementationName( ) throw (RuntimeException
)
154 return rtl::OUString("com.sun.star.sdb.OTableColumn");
157 ::cppu::IPropertyArrayHelper
& SAL_CALL
OTableColumn::getInfoHelper()
159 return *OTableColumn_PBase::getArrayHelper();
162 ::cppu::IPropertyArrayHelper
* OTableColumn::createArrayHelper( ) const
164 return OTableColumnDescriptor::createArrayHelper();
167 // =========================================================================
169 // =========================================================================
170 DBG_NAME( OQueryColumn
);
172 OQueryColumn::OQueryColumn( const Reference
< XPropertySet
>& _rxParserColumn
, const Reference
< XConnection
>& _rxConnection
, const ::rtl::OUString
&i_sLabel
)
173 :OTableColumnDescriptor( false /* do not act as descriptor */ )
176 const sal_Int32 nPropAttr
= PropertyAttribute::READONLY
;
177 registerProperty( PROPERTY_CATALOGNAME
, PROPERTY_ID_CATALOGNAME
, nPropAttr
, &m_sCatalogName
, ::getCppuType( &m_sCatalogName
) );
178 registerProperty( PROPERTY_SCHEMANAME
, PROPERTY_ID_SCHEMANAME
, nPropAttr
, &m_sSchemaName
, ::getCppuType( &m_sSchemaName
) );
179 registerProperty( PROPERTY_TABLENAME
, PROPERTY_ID_TABLENAME
, nPropAttr
, &m_sTableName
, ::getCppuType( &m_sTableName
) );
180 registerProperty( PROPERTY_REALNAME
, PROPERTY_ID_REALNAME
, nPropAttr
, &m_sRealName
, ::getCppuType( &m_sRealName
) );
181 registerProperty( PROPERTY_LABEL
, PROPERTY_ID_LABEL
, nPropAttr
, &m_sLabel
, ::getCppuType( &m_sLabel
) );
183 DBG_CTOR( OQueryColumn
, NULL
);
185 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_TYPENAME
) >>= m_aTypeName
);
186 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_ISNULLABLE
) >>= m_nIsNullable
);
187 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_PRECISION
) >>= m_nPrecision
);
188 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_SCALE
) >>= m_nScale
);
189 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_TYPE
) >>= m_nType
);
190 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_ISAUTOINCREMENT
) >>= m_bAutoIncrement
);
191 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_ISCURRENCY
) >>= m_bCurrency
);
192 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_NAME
) >>= m_sName
);
194 m_bRowVersion
= sal_False
;
196 Reference
< XPropertySetInfo
> xPSI( _rxParserColumn
->getPropertySetInfo(), UNO_SET_THROW
);
197 if ( xPSI
->hasPropertyByName( PROPERTY_DEFAULTVALUE
) )
198 OSL_VERIFY( _rxParserColumn
->getPropertyValue( PROPERTY_DEFAULTVALUE
) >>= m_aDefaultValue
);
200 // copy some optional properties from the parser column
201 struct PropertyDescriptor
203 ::rtl::OUString sName
;
206 PropertyDescriptor aProps
[] =
208 { PROPERTY_CATALOGNAME
, PROPERTY_ID_CATALOGNAME
},
209 { PROPERTY_SCHEMANAME
, PROPERTY_ID_SCHEMANAME
},
210 { PROPERTY_TABLENAME
, PROPERTY_ID_TABLENAME
},
211 { PROPERTY_REALNAME
, PROPERTY_ID_REALNAME
}
213 for ( size_t i
=0; i
< sizeof( aProps
) / sizeof( aProps
[0] ); ++i
)
215 if ( xPSI
->hasPropertyByName( aProps
[i
].sName
) )
216 setFastPropertyValue_NoBroadcast( aProps
[i
].nHandle
, _rxParserColumn
->getPropertyValue( aProps
[i
].sName
) );
219 // determine the table column we're based on
220 osl_atomic_increment( &m_refCount
);
222 m_xOriginalTableColumn
= impl_determineOriginalTableColumn( _rxConnection
);
224 osl_atomic_decrement( &m_refCount
);
227 OQueryColumn::~OQueryColumn()
229 DBG_DTOR( OQueryColumn
, NULL
);
232 Reference
< XPropertySet
> OQueryColumn::impl_determineOriginalTableColumn( const Reference
< XConnection
>& _rxConnection
)
234 OSL_PRECOND( _rxConnection
.is(), "OQueryColumn::impl_determineOriginalTableColumn: illegal connection!" );
235 if ( !_rxConnection
.is() )
238 Reference
< XPropertySet
> xOriginalTableColumn
;
241 // determine the composed table name, plus the column name, as indicated by the
242 // respective properties
243 ::rtl::OUString sCatalog
, sSchema
, sTable
;
244 OSL_VERIFY( getPropertyValue( PROPERTY_CATALOGNAME
) >>= sCatalog
);
245 OSL_VERIFY( getPropertyValue( PROPERTY_SCHEMANAME
) >>= sSchema
);
246 OSL_VERIFY( getPropertyValue( PROPERTY_TABLENAME
) >>= sTable
);
247 if ( sCatalog
.isEmpty() && sSchema
.isEmpty() && sTable
.isEmpty() )
250 ::rtl::OUString sComposedTableName
= ::dbtools::composeTableName(
251 _rxConnection
->getMetaData(), sCatalog
, sSchema
, sTable
, sal_False
, ::dbtools::eComplete
);
253 // retrieve the table in question
254 Reference
< XTablesSupplier
> xSuppTables( _rxConnection
, UNO_QUERY_THROW
);
255 Reference
< XNameAccess
> xTables( xSuppTables
->getTables(), UNO_QUERY_THROW
);
256 if ( !xTables
->hasByName( sComposedTableName
) )
259 Reference
< XColumnsSupplier
> xSuppCols( xTables
->getByName( sComposedTableName
), UNO_QUERY_THROW
);
260 Reference
< XNameAccess
> xColumns( xSuppCols
->getColumns(), UNO_QUERY_THROW
);
262 ::rtl::OUString sColumn
;
263 OSL_VERIFY( getPropertyValue( PROPERTY_REALNAME
) >>= sColumn
);
264 if ( !xColumns
->hasByName( sColumn
) )
267 xOriginalTableColumn
.set( xColumns
->getByName( sColumn
), UNO_QUERY
);
269 catch( const Exception
& )
271 DBG_UNHANDLED_EXCEPTION();
273 return xOriginalTableColumn
;
276 IMPLEMENT_GET_IMPLEMENTATION_ID( OQueryColumn
)
278 ::rtl::OUString SAL_CALL
OQueryColumn::getImplementationName( ) throw(RuntimeException
)
280 return ::rtl::OUString( "org.openoffice.comp.dbaccess.OQueryColumn" );
283 ::cppu::IPropertyArrayHelper
& SAL_CALL
OQueryColumn::getInfoHelper()
285 return *OQueryColumn_PBase::getArrayHelper();
288 ::cppu::IPropertyArrayHelper
* OQueryColumn::createArrayHelper() const
290 return OTableColumnDescriptor::createArrayHelper();
293 void SAL_CALL
OQueryColumn::getFastPropertyValue( Any
& _rValue
, sal_Int32 _nHandle
) const
295 OTableColumnDescriptor::getFastPropertyValue( _rValue
, _nHandle
);
297 // special treatment for column settings:
298 if ( !OColumnSettings::isColumnSettingProperty( _nHandle
) )
301 // If the setting has its default value, then try to obtain the value from the table column which
302 // this query column is based on
303 if ( !OColumnSettings::isDefaulted( _nHandle
, _rValue
) )
306 if ( !m_xOriginalTableColumn
.is() )
311 // determine original property name
312 ::rtl::OUString sPropName
;
313 sal_Int16
nAttributes( 0 );
314 const_cast< OQueryColumn
* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName
, &nAttributes
, _nHandle
);
315 OSL_ENSURE( !sPropName
.isEmpty(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
317 _rValue
= m_xOriginalTableColumn
->getPropertyValue( sPropName
);
319 catch( const Exception
& )
321 DBG_UNHANDLED_EXCEPTION();
325 //==========================================================================
327 //==========================================================================
328 DBG_NAME(OColumnWrapper
);
330 OColumnWrapper::OColumnWrapper( const Reference
< XPropertySet
> & rCol
, const bool _bNameIsReadOnly
)
331 :OColumn( _bNameIsReadOnly
)
335 DBG_CTOR(OColumnWrapper
,NULL
);
336 // which type of aggregate property do we have?
337 // we distingish the properties by the containment of optional properties
339 if ( m_xAggregate
.is() )
341 Reference
<XPropertySetInfo
> xInfo(m_xAggregate
->getPropertySetInfo());
342 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_DESCRIPTION
) ? HAS_DESCRIPTION
: 0;
343 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_DEFAULTVALUE
) ? HAS_DEFAULTVALUE
: 0;
344 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_ISROWVERSION
) ? HAS_ROWVERSION
: 0;
345 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION
) ? HAS_AUTOINCREMENT_CREATION
: 0;
346 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_CATALOGNAME
) ? HAS_CATALOGNAME
: 0;
347 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_SCHEMANAME
) ? HAS_SCHEMANAME
: 0;
348 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_TABLENAME
) ? HAS_TABLENAME
: 0;
350 m_xAggregate
->getPropertyValue(PROPERTY_NAME
) >>= m_sName
;
354 OColumnWrapper::~OColumnWrapper()
356 DBG_DTOR(OColumnWrapper
,NULL
);
359 ::rtl::OUString
OColumnWrapper::impl_getPropertyNameFromHandle( const sal_Int32 _nHandle
) const
361 ::rtl::OUString sPropName
;
362 sal_Int16
nAttributes( 0 );
363 const_cast< OColumnWrapper
* >( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName
, &nAttributes
, _nHandle
);
364 OSL_ENSURE( !sPropName
.isEmpty(), "OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
368 void OColumnWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
370 // derived classes are free to either use the OPropertyContainer(Helper) mechanisms for properties,
371 // or to declare additional properties which are to be forwarded to the wrapped object. So we need
372 // to distinguish those cases.
373 if ( OColumn::isRegisteredProperty( nHandle
) )
375 OColumn::getFastPropertyValue( rValue
, nHandle
);
379 rValue
= m_xAggregate
->getPropertyValue( impl_getPropertyNameFromHandle( nHandle
) );
383 sal_Bool
OColumnWrapper::convertFastPropertyValue( Any
& rConvertedValue
, Any
& rOldValue
, sal_Int32 nHandle
,
384 const Any
& rValue
) throw (IllegalArgumentException
)
386 sal_Bool
bModified( sal_False
);
387 if ( OColumn::isRegisteredProperty( nHandle
) )
389 bModified
= OColumn::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
393 getFastPropertyValue( rOldValue
, nHandle
);
394 if ( rOldValue
!= rValue
)
396 rConvertedValue
= rValue
;
397 bModified
= sal_True
;
403 void OColumnWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle
, const Any
& rValue
) throw (Exception
)
405 if ( OColumn::isRegisteredProperty( nHandle
) )
407 OColumn::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
411 m_xAggregate
->setPropertyValue( impl_getPropertyNameFromHandle( nHandle
), rValue
);
415 sal_Int64 SAL_CALL
OColumnWrapper::getSomething( const Sequence
< sal_Int8
>& aIdentifier
) throw(RuntimeException
)
417 Reference
< XUnoTunnel
> xTunnel( m_xAggregate
, UNO_QUERY
);
419 return xTunnel
->getSomething( aIdentifier
);
423 //============================================================
424 //= OTableColumnDescriptorWrapper
425 //============================================================
426 OTableColumnDescriptorWrapper::OTableColumnDescriptorWrapper( const Reference
< XPropertySet
>& _rCol
, const bool _bPureWrap
, const bool _bIsDescriptor
)
427 :OColumnWrapper( _rCol
, !_bIsDescriptor
)
428 ,m_bPureWrap( _bPureWrap
)
429 ,m_bIsDescriptor( _bIsDescriptor
)
431 // let the ColumnSettings register its properties
432 OColumnSettings::registerProperties( *this );
435 // com::sun::star::lang::XTypeProvider
436 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnDescriptorWrapper
)
438 // ::com::sun::star::lang::XServiceInfo
439 rtl::OUString
OTableColumnDescriptorWrapper::getImplementationName( ) throw (RuntimeException
)
441 return rtl::OUString("com.sun.star.sdb.OTableColumnDescriptorWrapper");
444 Sequence
< ::rtl::OUString
> OTableColumnDescriptorWrapper::getSupportedServiceNames( ) throw (RuntimeException
)
446 Sequence
< ::rtl::OUString
> aSNS( 2 );
447 aSNS
[0] = SERVICE_SDBCX_COLUMNDESCRIPTOR
;
448 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
452 // comphelper::OPropertyArrayUsageHelper
453 ::cppu::IPropertyArrayHelper
* OTableColumnDescriptorWrapper::createArrayHelper( sal_Int32 nId
) const
455 const sal_Int32 nHaveAlways
= 7;
457 // Which optional properties are contained?
458 const sal_Int32
nHaveOptionally (::std::bitset
<7>(nId
).count());
460 BEGIN_PROPERTY_SEQUENCE( nHaveAlways
+ nHaveOptionally
)
462 DECL_PROP0_BOOL( ISAUTOINCREMENT
);
463 DECL_PROP0_BOOL( ISCURRENCY
);
464 DECL_PROP0( ISNULLABLE
, sal_Int32
);
465 DECL_PROP0( PRECISION
, sal_Int32
);
466 DECL_PROP0( SCALE
, sal_Int32
);
467 DECL_PROP0( TYPE
, sal_Int32
);
468 DECL_PROP0( TYPENAME
, ::rtl::OUString
);
470 if ( nId
& HAS_AUTOINCREMENT_CREATION
)
472 DECL_PROP1( AUTOINCREMENTCREATION
, ::rtl::OUString
, MAYBEVOID
);
474 if ( nId
& HAS_DEFAULTVALUE
)
476 DECL_PROP0( DEFAULTVALUE
, ::rtl::OUString
);
478 if ( nId
& HAS_DESCRIPTION
)
480 DECL_PROP0( DESCRIPTION
, ::rtl::OUString
);
482 if ( nId
& HAS_ROWVERSION
)
484 DECL_PROP0_BOOL( ISROWVERSION
);
486 if ( nId
& HAS_CATALOGNAME
)
488 DECL_PROP0( CATALOGNAME
, ::rtl::OUString
);
490 if ( nId
& HAS_SCHEMANAME
)
492 DECL_PROP0( SCHEMANAME
, ::rtl::OUString
);
494 if ( nId
& HAS_TABLENAME
)
496 DECL_PROP0( TABLENAME
, ::rtl::OUString
);
499 END_PROPERTY_SEQUENCE()
501 if ( !m_bIsDescriptor
)
503 for ( Property
* prop
= aDescriptor
.getArray();
504 prop
!= aDescriptor
.getArray() + aDescriptor
.getLength();
508 prop
->Attributes
|= PropertyAttribute::READONLY
;
512 // finally also describe the properties which are maintained by our base class, in particular the OPropertyContainerHelper
513 Sequence
< Property
> aBaseProperties
;
514 describeProperties( aBaseProperties
);
516 Sequence
< Property
> aAllProperties( ::comphelper::concatSequences( aDescriptor
, aBaseProperties
) );
517 return new ::cppu::OPropertyArrayHelper( aAllProperties
, sal_False
);
520 // cppu::OPropertySetHelper
521 ::cppu::IPropertyArrayHelper
& OTableColumnDescriptorWrapper::getInfoHelper()
523 return *static_cast< OIdPropertyArrayUsageHelper
< OTableColumnDescriptorWrapper
>* >(this)->getArrayHelper(m_nColTypeID
);
526 void OTableColumnDescriptorWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
530 rValue
= m_xAggregate
->getPropertyValue( impl_getPropertyNameFromHandle( nHandle
) );
534 OColumnWrapper::getFastPropertyValue( rValue
, nHandle
);
538 sal_Bool
OTableColumnDescriptorWrapper::convertFastPropertyValue( Any
& rConvertedValue
, Any
& rOldValue
, sal_Int32 nHandle
, const Any
& rValue
) throw (IllegalArgumentException
)
540 sal_Bool
bModified(sal_False
);
543 // do not delegate to OColumnWrapper: It would, for the properties which were registered with registerProperty,
544 // ask the OPropertyContainer base class, which is not what we want here.
545 // TODO: the whole "m_bPureWrap"-thingie is strange. We should have a dedicated class doing this wrapping,
546 // not a class which normally serves other purposes, and only sometimes does a "pure wrap". It makes the
547 // code unnecessarily hard to maintain, and error prone.
548 rOldValue
= m_xAggregate
->getPropertyValue( impl_getPropertyNameFromHandle( nHandle
) );
549 if ( rOldValue
!= rValue
)
551 rConvertedValue
= rValue
;
552 bModified
= sal_True
;
557 bModified
= OColumnWrapper::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
562 void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
570 m_xAggregate
->setPropertyValue( impl_getPropertyNameFromHandle( nHandle
), rValue
);
574 OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
578 //============================================================
579 //= OTableColumnWrapper
580 //============================================================
581 OTableColumnWrapper::OTableColumnWrapper( const Reference
< XPropertySet
>& rCol
, const Reference
< XPropertySet
>& _xColDefintion
,
582 const bool _bPureWrap
)
583 :OTableColumnDescriptorWrapper( rCol
, _bPureWrap
, false )
585 osl_atomic_increment( &m_refCount
);
586 if ( _xColDefintion
.is() )
590 ::comphelper::copyProperties( _xColDefintion
, this );
592 catch( const Exception
& )
594 DBG_UNHANDLED_EXCEPTION();
597 osl_atomic_decrement( &m_refCount
);
600 OTableColumnWrapper::~OTableColumnWrapper()
604 IMPLEMENT_GET_IMPLEMENTATION_ID( OTableColumnWrapper
)
606 rtl::OUString
OTableColumnWrapper::getImplementationName( ) throw (RuntimeException
)
608 return rtl::OUString("com.sun.star.sdb.OTableColumnWrapper" );
611 Sequence
< ::rtl::OUString
> OTableColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException
)
613 Sequence
< ::rtl::OUString
> aSNS( 2 );
614 aSNS
[0] = SERVICE_SDBCX_COLUMN
;
615 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
619 ::cppu::IPropertyArrayHelper
& OTableColumnWrapper::getInfoHelper()
621 return *static_cast< OIdPropertyArrayUsageHelper
< OTableColumnWrapper
>* >(this)->getArrayHelper(m_nColTypeID
);
624 // comphelper::OPropertyArrayUsageHelper
625 ::cppu::IPropertyArrayHelper
* OTableColumnWrapper::createArrayHelper( sal_Int32 nId
) const
627 return OTableColumnDescriptorWrapper::createArrayHelper( nId
);
629 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */