1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: definitioncolumn.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dbaccess.hxx"
34 #ifndef _DBA_COREAPI_DEFINITIONSETTINGS_HXX_
35 #include "definitioncolumn.hxx"
37 #ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
38 #include <cppuhelper/typeprovider.hxx>
40 #ifndef _COMPHELPER_PROPERTY_HXX_
41 #include <comphelper/property.hxx>
43 #ifndef _COMPHELPER_TYPES_HXX_
44 #include <comphelper/types.hxx>
46 #ifndef DBACCESS_SHARED_DBASTRINGS_HRC
47 #include "dbastrings.hrc"
49 #ifndef _DBASHARED_APITOOLS_HXX_
50 #include "apitools.hxx"
52 #ifndef _TOOLS_DEBUG_HXX
53 #include <tools/debug.hxx>
55 #ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
56 #include <com/sun/star/beans/PropertyAttribute.hpp>
58 #ifndef DBACORE_SDBCORETOOLS_HXX
59 #include "sdbcoretools.hxx"
63 using namespace ::com::sun::star::sdbc
;
64 using namespace ::com::sun::star::beans
;
65 using namespace ::com::sun::star::uno
;
66 using namespace ::com::sun::star::lang
;
67 using namespace ::cppu
;
68 using namespace ::comphelper
;
69 using namespace ::osl
;
70 using namespace dbaccess
;
72 #define HAS_DESCRIPTION 0x00000001
73 #define HAS_DEFAULTVALUE 0x00000002
74 #define HAS_ROWVERSION 0x00000004
75 #define HAS_AUTOINCREMENT_CREATION 0x00000008
77 //============================================================
78 //= OTableColumnDescriptor
79 //============================================================
80 IMPLEMENT_FORWARD_XINTERFACE2(OTableColumnDescriptor
,OColumn
,TXChild
)
82 // com::sun::star::lang::XTypeProvider
83 //--------------------------------------------------------------------------
84 Sequence
< sal_Int8
> OTableColumnDescriptor::getImplementationId() throw (RuntimeException
)
86 static OImplementationId
* pId
= 0;
89 MutexGuard
aGuard( Mutex::getGlobalMutex() );
92 static OImplementationId aId
;
96 return pId
->getImplementationId();
99 // ::com::sun::star::lang::XServiceInfo
100 //------------------------------------------------------------------------------
101 rtl::OUString
OTableColumnDescriptor::getImplementationName( ) throw (RuntimeException
)
103 return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumnDescriptor");
106 //------------------------------------------------------------------------------
107 Sequence
< ::rtl::OUString
> OTableColumnDescriptor::getSupportedServiceNames( ) throw (RuntimeException
)
109 Sequence
< ::rtl::OUString
> aSNS( 2 );
110 aSNS
[0] = SERVICE_SDBCX_COLUMNDESCRIPTOR
;
111 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
115 // comphelper::OPropertyArrayUsageHelper
116 //------------------------------------------------------------------------------
117 ::cppu::IPropertyArrayHelper
* OTableColumnDescriptor::createArrayHelper( ) const
119 BEGIN_PROPERTY_HELPER(20)
120 DECL_PROP2(ALIGN
, sal_Int32
, BOUND
,MAYBEVOID
);
121 DECL_PROP1(AUTOINCREMENTCREATION
,::rtl::OUString
, MAYBEVOID
);
122 DECL_PROP2(CONTROLDEFAULT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
123 DECL_PROP1_IFACE(CONTROLMODEL
, XPropertySet
, BOUND
);
124 DECL_PROP0(DEFAULTVALUE
, ::rtl::OUString
);
125 DECL_PROP0(DESCRIPTION
, ::rtl::OUString
);
126 DECL_PROP2(NUMBERFORMAT
, sal_Int32
, BOUND
,MAYBEVOID
);
127 DECL_PROP2(HELPTEXT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
128 DECL_PROP1_BOOL(HIDDEN
, BOUND
);
129 DECL_PROP0_BOOL(ISAUTOINCREMENT
);
130 DECL_PROP0_BOOL(ISCURRENCY
);
131 DECL_PROP0(ISNULLABLE
, sal_Int32
);
132 DECL_PROP0_BOOL(ISROWVERSION
);
133 DECL_PROP0(NAME
, ::rtl::OUString
);
134 DECL_PROP0(PRECISION
, sal_Int32
);
135 DECL_PROP2(RELATIVEPOSITION
, sal_Int32
, BOUND
, MAYBEVOID
);
136 DECL_PROP0(SCALE
, sal_Int32
);
137 DECL_PROP0(TYPE
, sal_Int32
);
138 DECL_PROP0(TYPENAME
, ::rtl::OUString
);
139 DECL_PROP2(WIDTH
, sal_Int32
, BOUND
, MAYBEVOID
);
140 END_PROPERTY_HELPER();
143 // cppu::OPropertySetHelper
144 //------------------------------------------------------------------------------
145 ::cppu::IPropertyArrayHelper
& OTableColumnDescriptor::getInfoHelper()
147 return *static_cast< ::comphelper::OPropertyArrayUsageHelper
< OTableColumnDescriptor
>* >(this)->getArrayHelper();
150 //------------------------------------------------------------------------------
151 void OTableColumnDescriptor::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
155 case PROPERTY_ID_TYPE
:
158 case PROPERTY_ID_PRECISION
:
159 rValue
<<= m_nPrecision
;
161 case PROPERTY_ID_SCALE
:
164 case PROPERTY_ID_ISNULLABLE
:
165 rValue
<<= m_nIsNullable
;
167 case PROPERTY_ID_TYPENAME
:
168 rValue
<<= m_aTypeName
;
170 case PROPERTY_ID_DESCRIPTION
:
171 rValue
<<= m_aDescription
;
173 case PROPERTY_ID_DEFAULTVALUE
:
174 rValue
<<= m_aDefaultValue
;
176 case PROPERTY_ID_AUTOINCREMENTCREATION
:
177 rValue
<<= m_aAutoIncrementValue
;
179 case PROPERTY_ID_ISAUTOINCREMENT
:
181 sal_Bool bVal
= m_bAutoIncrement
;
182 rValue
.setValue(&bVal
, getBooleanCppuType());
184 case PROPERTY_ID_ISCURRENCY
:
186 sal_Bool bVal
= m_bCurrency
;
187 rValue
.setValue(&bVal
, getBooleanCppuType());
189 case PROPERTY_ID_ISROWVERSION
:
191 sal_Bool bVal
= m_bRowVersion
;
192 rValue
.setValue(&bVal
, getBooleanCppuType());
194 case PROPERTY_ID_NAME
:
195 OColumn::getFastPropertyValue( rValue
, nHandle
);
198 OColumnSettings::getFastPropertyValue( rValue
, nHandle
);
202 //------------------------------------------------------------------------------
203 sal_Bool
OTableColumnDescriptor::convertFastPropertyValue(
204 Any
& rConvertedValue
,
208 throw (IllegalArgumentException
)
210 sal_Bool bModified
= sal_False
;
213 case PROPERTY_ID_TYPE
:
214 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_nType
);
216 case PROPERTY_ID_PRECISION
:
217 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_nPrecision
);
219 case PROPERTY_ID_SCALE
:
220 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_nScale
);
222 case PROPERTY_ID_ISNULLABLE
:
223 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_nIsNullable
);
225 case PROPERTY_ID_TYPENAME
:
226 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_aTypeName
);
228 case PROPERTY_ID_DESCRIPTION
:
229 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_aDescription
);
231 case PROPERTY_ID_DEFAULTVALUE
:
232 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_aDefaultValue
);
234 case PROPERTY_ID_AUTOINCREMENTCREATION
:
235 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_aAutoIncrementValue
);
237 case PROPERTY_ID_ISAUTOINCREMENT
:
238 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_bAutoIncrement
);
240 case PROPERTY_ID_ISCURRENCY
:
241 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_bCurrency
);
243 case PROPERTY_ID_ISROWVERSION
:
244 bModified
= ::comphelper::tryPropertyValue(rConvertedValue
, rOldValue
, rValue
, m_bRowVersion
);
246 case PROPERTY_ID_NAME
:
247 bModified
= OColumn::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
250 bModified
= OColumnSettings::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
255 //------------------------------------------------------------------------------
256 void OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(
264 case PROPERTY_ID_TYPE
:
265 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< sal_Int32
* >(NULL
))),
266 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(TYPE) : invalid value !");
269 case PROPERTY_ID_PRECISION
:
270 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< sal_Int32
* >(NULL
))),
271 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(PRECISION) : invalid value !");
272 rValue
>>= m_nPrecision
;
274 case PROPERTY_ID_SCALE
:
275 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< sal_Int32
* >(NULL
))),
276 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(SCALE) : invalid value !");
279 case PROPERTY_ID_ISNULLABLE
:
280 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< sal_Int32
* >(NULL
))),
281 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISNULLABLE) : invalid value !");
282 rValue
>>= m_nIsNullable
;
284 case PROPERTY_ID_TYPENAME
:
285 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< rtl::OUString
* >(NULL
))),
286 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(TYPENAME) : invalid value !");
287 rValue
>>= m_aTypeName
;
289 case PROPERTY_ID_DESCRIPTION
:
290 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< rtl::OUString
* >(NULL
))),
291 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(DESCRIPTION) : invalid value !");
292 rValue
>>= m_aDescription
;
294 case PROPERTY_ID_DEFAULTVALUE
:
295 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< rtl::OUString
* >(NULL
))),
296 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(DEFAULTVALUE) : invalid value !");
297 rValue
>>= m_aDefaultValue
;
299 case PROPERTY_ID_AUTOINCREMENTCREATION
:
300 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< rtl::OUString
* >(NULL
))),
301 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(AUTOINCREMENTVALUE) : invalid value !");
302 rValue
>>= m_aAutoIncrementValue
;
304 case PROPERTY_ID_ISAUTOINCREMENT
:
305 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< sal_Bool
* >(NULL
))),
306 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISAUTOINCREMENT) : invalid value !");
307 m_bAutoIncrement
= ::comphelper::getBOOL(rValue
);
309 case PROPERTY_ID_ISCURRENCY
:
310 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< sal_Bool
* >(NULL
))),
311 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISCURRENCY) : invalid value !");
312 m_bCurrency
= ::comphelper::getBOOL(rValue
);
314 case PROPERTY_ID_ISROWVERSION
:
315 OSL_ENSURE(rValue
.getValueType().equals(::getCppuType(static_cast< sal_Bool
* >(NULL
))),
316 "OTableColumnDescriptor::setFastPropertyValue_NoBroadcast(ISROWVERSION) : invalid value !");
317 m_bRowVersion
= ::comphelper::getBOOL(rValue
);
319 case PROPERTY_ID_NAME
:
320 OColumn::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
323 OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
325 ::dbaccess::notifyDataSourceModified(m_xParent
,sal_True
);
328 // -----------------------------------------------------------------------------
329 sal_Int64 SAL_CALL
OTableColumnDescriptor::getSomething( const Sequence
< sal_Int8
>& aIdentifier
) throw(RuntimeException
)
331 sal_Int64 nReturn
= OColumn::getSomething( aIdentifier
);
333 nReturn
= OColumnSettings::getSomething( aIdentifier
);
337 // -----------------------------------------------------------------------------
338 Reference
< XInterface
> SAL_CALL
OTableColumnDescriptor::getParent( ) throw (RuntimeException
)
340 ::osl::MutexGuard
aGuard(m_aMutex
);
343 // -----------------------------------------------------------------------------
344 void SAL_CALL
OTableColumnDescriptor::setParent( const Reference
< XInterface
>& _xParent
) throw (NoSupportException
, RuntimeException
)
346 ::osl::MutexGuard
aGuard(m_aMutex
);
347 m_xParent
= _xParent
;
349 //============================================================
351 //============================================================
352 DBG_NAME(OTableColumn
);
353 OTableColumn::OTableColumn(const ::rtl::OUString
& _rName
)
355 DBG_CTOR(OTableColumn
,NULL
);
358 // -------------------------------------------------------------------------
359 OTableColumn::OTableColumn(const Reference
<XPropertySet
>& _xColumn
)
361 DBG_CTOR(OTableColumn
,NULL
);
363 m_aTypeName
= (::comphelper::getString(_xColumn
->getPropertyValue(PROPERTY_TYPENAME
)));
364 if(_xColumn
->getPropertySetInfo()->hasPropertyByName(PROPERTY_DEFAULTVALUE
))
365 m_aDefaultValue
= (::comphelper::getString(_xColumn
->getPropertyValue(PROPERTY_DEFAULTVALUE
)));
366 m_nIsNullable
= (::comphelper::getINT32(_xColumn
->getPropertyValue(PROPERTY_ISNULLABLE
)));
367 m_nPrecision
= (::comphelper::getINT32(_xColumn
->getPropertyValue(PROPERTY_PRECISION
)));
368 m_nScale
= (::comphelper::getINT32(_xColumn
->getPropertyValue(PROPERTY_SCALE
)));
369 m_nType
= (::comphelper::getINT32(_xColumn
->getPropertyValue(PROPERTY_TYPE
)));
370 m_bAutoIncrement
= (::comphelper::getBOOL(_xColumn
->getPropertyValue(PROPERTY_ISAUTOINCREMENT
)));
371 m_bRowVersion
= (sal_False
);
372 m_bCurrency
= (::comphelper::getBOOL(_xColumn
->getPropertyValue(PROPERTY_ISCURRENCY
)));
373 _xColumn
->getPropertyValue(PROPERTY_NAME
) >>= m_sName
;
375 // -----------------------------------------------------------------------------
376 OTableColumn::~OTableColumn()
378 DBG_DTOR(OTableColumn
,NULL
);
380 // com::sun::star::lang::XTypeProvider
381 //--------------------------------------------------------------------------
382 Sequence
< sal_Int8
> OTableColumn::getImplementationId() throw (RuntimeException
)
384 static OImplementationId
* pId
= 0;
387 MutexGuard
aGuard( Mutex::getGlobalMutex() );
390 static OImplementationId aId
;
394 return pId
->getImplementationId();
397 // ::com::sun::star::lang::XServiceInfo
398 //------------------------------------------------------------------------------
399 rtl::OUString
OTableColumn::getImplementationName( ) throw (RuntimeException
)
401 return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumn");
404 //------------------------------------------------------------------------------
405 Sequence
< ::rtl::OUString
> OTableColumn::getSupportedServiceNames( ) throw (RuntimeException
)
407 Sequence
< ::rtl::OUString
> aSNS( 2 );
408 aSNS
[0] = SERVICE_SDBCX_COLUMN
;
409 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
413 //------------------------------------------------------------------------------
414 ::cppu::IPropertyArrayHelper
& OTableColumn::getInfoHelper()
416 return *static_cast< ::comphelper::OPropertyArrayUsageHelper
< OTableColumn
>* >(this)->getArrayHelper();
419 // comphelper::OPropertyArrayUsageHelper
420 //------------------------------------------------------------------------------
421 ::cppu::IPropertyArrayHelper
* OTableColumn::createArrayHelper( ) const
423 BEGIN_PROPERTY_HELPER(19)
424 DECL_PROP2(ALIGN
, sal_Int32
, BOUND
, MAYBEVOID
);
425 DECL_PROP2(CONTROLDEFAULT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
426 DECL_PROP1_IFACE(CONTROLMODEL
, XPropertySet
, BOUND
);
427 DECL_PROP1(DEFAULTVALUE
, ::rtl::OUString
, READONLY
);
428 DECL_PROP1(DESCRIPTION
, ::rtl::OUString
, READONLY
);
429 DECL_PROP2(NUMBERFORMAT
, sal_Int32
, BOUND
, MAYBEVOID
);
430 DECL_PROP2(HELPTEXT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
431 DECL_PROP1_BOOL(HIDDEN
, BOUND
);
432 DECL_PROP1_BOOL(ISAUTOINCREMENT
, READONLY
);
433 DECL_PROP1_BOOL(ISCURRENCY
, READONLY
);
434 DECL_PROP1(ISNULLABLE
, sal_Int32
, READONLY
);
435 DECL_PROP1_BOOL(ISROWVERSION
, READONLY
);
436 DECL_PROP1(NAME
, ::rtl::OUString
, READONLY
);
437 DECL_PROP1(PRECISION
, sal_Int32
, READONLY
);
438 DECL_PROP2(RELATIVEPOSITION
, sal_Int32
, BOUND
, MAYBEVOID
);
439 DECL_PROP1(SCALE
, sal_Int32
, READONLY
);
440 DECL_PROP1(TYPE
, sal_Int32
, READONLY
);
441 DECL_PROP1(TYPENAME
, ::rtl::OUString
, READONLY
);
442 DECL_PROP2(WIDTH
, sal_Int32
, BOUND
, MAYBEVOID
);
443 END_PROPERTY_HELPER();
446 //============================================================
448 //============================================================
449 DBG_NAME(OColumnWrapper
);
450 //--------------------------------------------------------------------------
451 OColumnWrapper::OColumnWrapper(const Reference
< XPropertySet
> & rCol
)
455 DBG_CTOR(OColumnWrapper
,NULL
);
456 // which type of aggregate property do we have
457 if (m_nColTypeID
== -1)
459 // we distingish the properties by the containment of optional properties, these are:
460 // Description 0x0001
462 // IsRowVersion 0x0004
464 if ( m_xAggregate
.is() )
466 Reference
<XPropertySetInfo
> xInfo(m_xAggregate
->getPropertySetInfo());
467 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_DESCRIPTION
) ? HAS_DESCRIPTION
: 0;
468 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_DEFAULTVALUE
) ? HAS_DEFAULTVALUE
: 0;
469 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_ISROWVERSION
) ? HAS_ROWVERSION
: 0;
470 m_nColTypeID
|= xInfo
->hasPropertyByName(PROPERTY_AUTOINCREMENTCREATION
) ? HAS_AUTOINCREMENT_CREATION
: 0;
472 m_xAggregate
->getPropertyValue(PROPERTY_NAME
) >>= m_sName
;
476 // -----------------------------------------------------------------------------
477 OColumnWrapper::~OColumnWrapper()
479 DBG_DTOR(OColumnWrapper
,NULL
);
482 //------------------------------------------------------------------------------
483 void OColumnWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
487 case PROPERTY_ID_NAME
:
492 // get the property name
493 ::rtl::OUString aPropName
;
494 sal_Int16 nAttributes
;
495 const_cast<OColumnWrapper
*>(this)->getInfoHelper().
496 fillPropertyMembersByHandle(&aPropName
, &nAttributes
, nHandle
);
497 OSL_ENSURE(aPropName
.getLength(), "property not found?");
499 // now read the value
500 rValue
= m_xAggregate
->getPropertyValue(aPropName
);
505 //------------------------------------------------------------------------------
506 sal_Bool
OColumnWrapper::convertFastPropertyValue(
507 Any
& rConvertedValue
,
511 throw (IllegalArgumentException
)
514 sal_Bool bModified
= OColumn::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
516 // get the property name
517 ::rtl::OUString aPropName
;
518 sal_Int16 nAttributes
;
519 getInfoHelper().fillPropertyMembersByHandle(&aPropName
, &nAttributes
, nHandle
);
520 OSL_ENSURE(aPropName
.getLength(), "property not found?");
522 // now read the value
523 m_xAggregate
->setPropertyValue(aPropName
, rValue
);
527 //------------------------------------------------------------------------------
528 void OColumnWrapper::setFastPropertyValue_NoBroadcast(
534 OColumn::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
536 // -----------------------------------------------------------------------------
537 sal_Int64 SAL_CALL
OColumnWrapper::getSomething( const Sequence
< sal_Int8
>& aIdentifier
) throw(RuntimeException
)
539 sal_Int64 nRet
= OColumn::getSomething(aIdentifier
);
542 Reference
<XUnoTunnel
> xTunnel(m_xAggregate
,UNO_QUERY
);
544 nRet
= xTunnel
->getSomething(aIdentifier
);
548 //============================================================
549 //= OTableColumnDescriptorWrapper
550 //============================================================
551 // com::sun::star::lang::XTypeProvider
552 //--------------------------------------------------------------------------
553 Sequence
< sal_Int8
> OTableColumnDescriptorWrapper::getImplementationId() throw (RuntimeException
)
555 static OImplementationId
* pId
= 0;
558 MutexGuard
aGuard( Mutex::getGlobalMutex() );
561 static OImplementationId aId
;
565 return pId
->getImplementationId();
568 // ::com::sun::star::lang::XServiceInfo
569 //------------------------------------------------------------------------------
570 rtl::OUString
OTableColumnDescriptorWrapper::getImplementationName( ) throw (RuntimeException
)
572 return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumnDescriptorWrapper");
575 //------------------------------------------------------------------------------
576 Sequence
< ::rtl::OUString
> OTableColumnDescriptorWrapper::getSupportedServiceNames( ) throw (RuntimeException
)
578 Sequence
< ::rtl::OUString
> aSNS( 2 );
579 aSNS
[0] = SERVICE_SDBCX_COLUMNDESCRIPTOR
;
580 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
584 // -----------------------------------------------------------------------------
585 sal_Int64 SAL_CALL
OTableColumnDescriptorWrapper::getSomething( const Sequence
< sal_Int8
>& aIdentifier
) throw(RuntimeException
)
587 sal_Int64 nReturn
= OColumnWrapper::getSomething( aIdentifier
);
589 nReturn
= OColumnSettings::getSomething( aIdentifier
);
593 // comphelper::OPropertyArrayUsageHelper
594 //------------------------------------------------------------------------------
595 ::cppu::IPropertyArrayHelper
* OTableColumnDescriptorWrapper::createArrayHelper( sal_Int32 nId
) const
597 // BEGIN_PROPERTY_HELPER(17)
598 sal_Int32 nPropertyCount
= 16;
599 // How many properties do we have?
600 // Which optional properties are contained?
601 if (nId
& HAS_DESCRIPTION
)
603 if (nId
& HAS_DEFAULTVALUE
)
605 if (nId
& HAS_ROWVERSION
)
607 if ( nId
& HAS_AUTOINCREMENT_CREATION
)
610 Sequence
< Property
> aDescriptor(nPropertyCount
);
611 Property
* pDesc
= aDescriptor
.getArray();
614 // Description, Defaultvalue, IsRowVersion
615 DECL_PROP2(ALIGN
, sal_Int32
, BOUND
,MAYBEVOID
);
616 if ( nId
& HAS_AUTOINCREMENT_CREATION
)
618 DECL_PROP1(AUTOINCREMENTCREATION
,::rtl::OUString
, MAYBEVOID
);
620 DECL_PROP2(CONTROLDEFAULT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
621 DECL_PROP1_IFACE(CONTROLMODEL
, XPropertySet
, BOUND
);
622 if (nId
& HAS_DEFAULTVALUE
)
624 DECL_PROP0(DEFAULTVALUE
, ::rtl::OUString
);
627 if (nId
& HAS_DESCRIPTION
)
629 DECL_PROP0(DESCRIPTION
, ::rtl::OUString
);
632 DECL_PROP2(NUMBERFORMAT
, sal_Int32
, BOUND
,MAYBEVOID
);
633 DECL_PROP2(HELPTEXT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
634 DECL_PROP1_BOOL(HIDDEN
, BOUND
);
635 DECL_PROP0_BOOL(ISAUTOINCREMENT
);
636 DECL_PROP0_BOOL(ISCURRENCY
);
637 DECL_PROP0(ISNULLABLE
, sal_Int32
);
639 if (nId
& HAS_ROWVERSION
)
641 DECL_PROP0_BOOL(ISROWVERSION
);
644 DECL_PROP0(NAME
, ::rtl::OUString
);
645 DECL_PROP0(PRECISION
, sal_Int32
);
646 DECL_PROP2(RELATIVEPOSITION
, sal_Int32
, BOUND
, MAYBEVOID
);
647 DECL_PROP0(SCALE
, sal_Int32
);
648 DECL_PROP0(TYPE
, sal_Int32
);
649 DECL_PROP0(TYPENAME
, ::rtl::OUString
);
650 DECL_PROP1(WIDTH
, sal_Int32
, MAYBEVOID
);
651 END_PROPERTY_HELPER();
654 // cppu::OPropertySetHelper
655 //------------------------------------------------------------------------------
656 ::cppu::IPropertyArrayHelper
& OTableColumnDescriptorWrapper::getInfoHelper()
658 return *static_cast< OIdPropertyArrayUsageHelper
< OTableColumnDescriptorWrapper
>* >(this)->getArrayHelper(m_nColTypeID
);
661 //------------------------------------------------------------------------------
662 void OTableColumnDescriptorWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
666 // get the property name
667 ::rtl::OUString aPropName
;
668 sal_Int16 nAttributes
;
669 const_cast<OTableColumnDescriptorWrapper
*>(this)->getInfoHelper().
670 fillPropertyMembersByHandle(&aPropName
, &nAttributes
, nHandle
);
671 OSL_ENSURE(aPropName
.getLength(), "property not found?");
673 // now read the value
674 rValue
= m_xAggregate
->getPropertyValue(aPropName
);
680 case PROPERTY_ID_ALIGN
:
681 case PROPERTY_ID_NUMBERFORMAT
:
682 case PROPERTY_ID_RELATIVEPOSITION
:
683 case PROPERTY_ID_WIDTH
:
684 case PROPERTY_ID_HIDDEN
:
685 case PROPERTY_ID_CONTROLMODEL
:
686 case PROPERTY_ID_HELPTEXT
:
687 case PROPERTY_ID_CONTROLDEFAULT
:
688 OColumnSettings::getFastPropertyValue( rValue
, nHandle
);
692 // get the property name
693 ::rtl::OUString aPropName
;
694 sal_Int16 nAttributes
;
695 const_cast<OTableColumnDescriptorWrapper
*>(this)->getInfoHelper().
696 fillPropertyMembersByHandle(&aPropName
, &nAttributes
, nHandle
);
697 OSL_ENSURE(aPropName
.getLength(), "property not found?");
699 // now read the value
700 rValue
= m_xAggregate
->getPropertyValue(aPropName
);
706 //------------------------------------------------------------------------------
707 sal_Bool
OTableColumnDescriptorWrapper::convertFastPropertyValue(
708 Any
& rConvertedValue
,
712 throw (IllegalArgumentException
)
714 sal_Bool
bModified(sal_False
);
716 bModified
= OColumnWrapper::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
721 case PROPERTY_ID_ALIGN
:
722 case PROPERTY_ID_NUMBERFORMAT
:
723 case PROPERTY_ID_RELATIVEPOSITION
:
724 case PROPERTY_ID_WIDTH
:
725 case PROPERTY_ID_HIDDEN
:
726 case PROPERTY_ID_CONTROLMODEL
:
727 case PROPERTY_ID_HELPTEXT
:
728 case PROPERTY_ID_CONTROLDEFAULT
:
729 bModified
= OColumnSettings::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
732 bModified
= OColumnWrapper::convertFastPropertyValue( rConvertedValue
, rOldValue
, nHandle
, rValue
);
738 //------------------------------------------------------------------------------
739 void OTableColumnDescriptorWrapper::setFastPropertyValue_NoBroadcast(
746 OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
751 case PROPERTY_ID_ALIGN
:
752 case PROPERTY_ID_NUMBERFORMAT
:
753 case PROPERTY_ID_RELATIVEPOSITION
:
754 case PROPERTY_ID_WIDTH
:
755 case PROPERTY_ID_HIDDEN
:
756 case PROPERTY_ID_CONTROLMODEL
:
757 case PROPERTY_ID_HELPTEXT
:
758 case PROPERTY_ID_CONTROLDEFAULT
:
759 OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
762 OColumnWrapper::setFastPropertyValue_NoBroadcast( nHandle
, rValue
);
767 //============================================================
768 //= OTableColumnWrapper
769 //============================================================
770 //--------------------------------------------------------------------------
771 OTableColumnWrapper::OTableColumnWrapper(const Reference
< XPropertySet
>& rCol
772 ,const Reference
< XPropertySet
>& _xColDefintion
773 ,sal_Bool _bPureWrap
)
774 :OTableColumnDescriptorWrapper(rCol
,_bPureWrap
)
776 osl_incrementInterlockedCount(&m_refCount
);
777 if ( _xColDefintion
.is() )
781 ::comphelper::copyProperties(_xColDefintion
,this);
785 OSL_ENSURE(sal_False
, "OTableColumnWrapper::OTableColumnWrapper: caught an exception!");
788 osl_decrementInterlockedCount(&m_refCount
);
791 //--------------------------------------------------------------------------
792 OTableColumnWrapper::~OTableColumnWrapper()
796 // com::sun::star::lang::XTypeProvider
797 //--------------------------------------------------------------------------
798 Sequence
< sal_Int8
> OTableColumnWrapper::getImplementationId() throw (RuntimeException
)
800 static OImplementationId
* pId
= 0;
803 MutexGuard
aGuard( Mutex::getGlobalMutex() );
806 static OImplementationId aId
;
810 return pId
->getImplementationId();
812 // ::com::sun::star::lang::XServiceInfo
813 //------------------------------------------------------------------------------
814 rtl::OUString
OTableColumnWrapper::getImplementationName( ) throw (RuntimeException
)
816 return rtl::OUString::createFromAscii("com.sun.star.sdb.OTableColumnWrapper");
819 //------------------------------------------------------------------------------
820 Sequence
< ::rtl::OUString
> OTableColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException
)
822 Sequence
< ::rtl::OUString
> aSNS( 2 );
823 aSNS
[0] = SERVICE_SDBCX_COLUMN
;
824 aSNS
[1] = SERVICE_SDB_COLUMNSETTINGS
;
828 //------------------------------------------------------------------------------
829 ::cppu::IPropertyArrayHelper
& OTableColumnWrapper::getInfoHelper()
831 return *static_cast< OIdPropertyArrayUsageHelper
< OTableColumnWrapper
>* >(this)->getArrayHelper(m_nColTypeID
);
834 // comphelper::OPropertyArrayUsageHelper
835 //------------------------------------------------------------------------------
836 ::cppu::IPropertyArrayHelper
* OTableColumnWrapper::createArrayHelper( sal_Int32 nId
) const
838 // BEGIN_PROPERTY_HELPER(17)
839 sal_Int32 nPropertyCount
= 16;
840 // How many properties do we have?
841 // Which optional properties are contained?
842 if (nId
& HAS_DESCRIPTION
)
844 if (nId
& HAS_DEFAULTVALUE
)
846 if (nId
& HAS_ROWVERSION
)
848 if ( nId
& HAS_AUTOINCREMENT_CREATION
)
851 Sequence
< Property
> aDescriptor(nPropertyCount
);
852 Property
* pDesc
= aDescriptor
.getArray();
855 // Description, Defaultvalue, IsRowVersion
856 DECL_PROP2(ALIGN
, sal_Int32
, BOUND
, MAYBEVOID
);
857 if ( nId
& HAS_AUTOINCREMENT_CREATION
)
859 DECL_PROP1(AUTOINCREMENTCREATION
,::rtl::OUString
, MAYBEVOID
);
861 DECL_PROP2(CONTROLDEFAULT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
862 DECL_PROP1_IFACE(CONTROLMODEL
, XPropertySet
, BOUND
);
863 if (nId
& HAS_DEFAULTVALUE
)
865 DECL_PROP1(DEFAULTVALUE
, ::rtl::OUString
, READONLY
);
868 if (nId
& HAS_DESCRIPTION
)
870 DECL_PROP1(DESCRIPTION
, ::rtl::OUString
, READONLY
);
873 DECL_PROP2(NUMBERFORMAT
, sal_Int32
, BOUND
, MAYBEVOID
);
874 DECL_PROP2(HELPTEXT
, ::rtl::OUString
, BOUND
,MAYBEVOID
);
875 DECL_PROP1_BOOL(HIDDEN
, BOUND
);
876 DECL_PROP1_BOOL(ISAUTOINCREMENT
, READONLY
);
877 DECL_PROP1_BOOL(ISCURRENCY
, READONLY
);
879 DECL_PROP1(ISNULLABLE
, sal_Int32
, READONLY
);
881 if (nId
& HAS_ROWVERSION
)
883 DECL_PROP1_BOOL(ISROWVERSION
, READONLY
);
886 DECL_PROP1(NAME
, ::rtl::OUString
, READONLY
);
887 DECL_PROP1(PRECISION
, sal_Int32
, READONLY
);
888 DECL_PROP2(RELATIVEPOSITION
, sal_Int32
, BOUND
, MAYBEVOID
);
889 DECL_PROP1(SCALE
, sal_Int32
, READONLY
);
890 DECL_PROP1(TYPE
, sal_Int32
, READONLY
);
891 DECL_PROP1(TYPENAME
, ::rtl::OUString
, READONLY
);
892 DECL_PROP2(WIDTH
, sal_Int32
, BOUND
, MAYBEVOID
);
893 END_PROPERTY_HELPER();
896 //============================================================
897 //= OIndexColumnWrapper
898 //============================================================
899 // com::sun::star::lang::XTypeProvider
900 //--------------------------------------------------------------------------
901 Sequence
< sal_Int8
> OIndexColumnWrapper::getImplementationId() throw (RuntimeException
)
903 static OImplementationId
* pId
= 0;
906 MutexGuard
aGuard( Mutex::getGlobalMutex() );
909 static OImplementationId aId
;
913 return pId
->getImplementationId();
915 // ::com::sun::star::lang::XServiceInfo
916 //------------------------------------------------------------------------------
917 rtl::OUString
OIndexColumnWrapper::getImplementationName( ) throw (RuntimeException
)
919 return rtl::OUString::createFromAscii("com.sun.star.sdb.OIndexColumnWrapper");
922 //------------------------------------------------------------------------------
923 Sequence
< ::rtl::OUString
> OIndexColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException
)
925 Sequence
< ::rtl::OUString
> aSNS( 2 );
926 aSNS
[0] = SERVICE_SDBCX_COLUMN
;
927 aSNS
[1] = SERVICE_SDBCX_INDEXCOLUMN
;
931 //------------------------------------------------------------------------------
932 ::cppu::IPropertyArrayHelper
& OIndexColumnWrapper::getInfoHelper()
934 return *static_cast< OPropertyArrayUsageHelper
< OIndexColumnWrapper
>* >(this)->getArrayHelper();
937 // comphelper::OPropertyArrayUsageHelper
938 //------------------------------------------------------------------------------
939 ::cppu::IPropertyArrayHelper
* OIndexColumnWrapper::createArrayHelper() const
941 BEGIN_PROPERTY_HELPER(9)
942 DECL_PROP1_BOOL(ISASCENDING
, READONLY
);
943 DECL_PROP1_BOOL(ISAUTOINCREMENT
, READONLY
);
944 DECL_PROP1_BOOL(ISCURRENCY
, READONLY
);
945 DECL_PROP1(ISNULLABLE
, sal_Int32
, READONLY
);
946 DECL_PROP1(NAME
, ::rtl::OUString
, READONLY
);
947 DECL_PROP1(PRECISION
, sal_Int32
, READONLY
);
948 DECL_PROP1(SCALE
, sal_Int32
, READONLY
);
949 DECL_PROP1(TYPE
, sal_Int32
, READONLY
);
950 DECL_PROP1(TYPENAME
, ::rtl::OUString
, READONLY
);
951 END_PROPERTY_HELPER();
954 //------------------------------------------------------------------------------
955 void OIndexColumnWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
959 case PROPERTY_ID_ISASCENDING
:
961 sal_Bool bVal
= m_bAscending
;
962 rValue
.setValue(&bVal
, getBooleanCppuType());
965 OColumnWrapper::getFastPropertyValue( rValue
, nHandle
);
969 //============================================================
970 //= OKeyColumnWrapper
971 //============================================================
972 // com::sun::star::lang::XTypeProvider
973 //--------------------------------------------------------------------------
974 Sequence
< sal_Int8
> OKeyColumnWrapper::getImplementationId() throw (RuntimeException
)
976 static OImplementationId
* pId
= 0;
979 MutexGuard
aGuard( Mutex::getGlobalMutex() );
982 static OImplementationId aId
;
986 return pId
->getImplementationId();
988 // ::com::sun::star::lang::XServiceInfo
989 //------------------------------------------------------------------------------
990 rtl::OUString
OKeyColumnWrapper::getImplementationName( ) throw (RuntimeException
)
992 return rtl::OUString::createFromAscii("com.sun.star.sdb.OIndexColumnWrapper");
995 //------------------------------------------------------------------------------
996 Sequence
< ::rtl::OUString
> OKeyColumnWrapper::getSupportedServiceNames( ) throw (RuntimeException
)
998 Sequence
< ::rtl::OUString
> aSNS( 2 );
999 aSNS
[0] = SERVICE_SDBCX_COLUMN
;
1000 aSNS
[1] = SERVICE_SDBCX_KEYCOLUMN
;
1004 //------------------------------------------------------------------------------
1005 ::cppu::IPropertyArrayHelper
& OKeyColumnWrapper::getInfoHelper()
1007 return *static_cast< OPropertyArrayUsageHelper
< OKeyColumnWrapper
>* >(this)->getArrayHelper();
1010 // comphelper::OPropertyArrayUsageHelper
1011 //------------------------------------------------------------------------------
1012 ::cppu::IPropertyArrayHelper
* OKeyColumnWrapper::createArrayHelper() const
1014 BEGIN_PROPERTY_HELPER(9)
1015 DECL_PROP1_BOOL(ISAUTOINCREMENT
, READONLY
);
1016 DECL_PROP1_BOOL(ISCURRENCY
, READONLY
);
1017 DECL_PROP1(ISNULLABLE
, sal_Int32
, READONLY
);
1018 DECL_PROP1(NAME
, ::rtl::OUString
, READONLY
);
1019 DECL_PROP1(PRECISION
, sal_Int32
, READONLY
);
1020 DECL_PROP1(RELATEDCOLUMN
, ::rtl::OUString
, READONLY
);
1021 DECL_PROP1(SCALE
, sal_Int32
, READONLY
);
1022 DECL_PROP1(TYPE
, sal_Int32
, READONLY
);
1023 DECL_PROP1(TYPENAME
, ::rtl::OUString
, READONLY
);
1024 END_PROPERTY_HELPER();
1027 //------------------------------------------------------------------------------
1028 void OKeyColumnWrapper::getFastPropertyValue( Any
& rValue
, sal_Int32 nHandle
) const
1032 case PROPERTY_ID_RELATEDCOLUMN
:
1033 rValue
<<= m_aRelatedColumn
;
1036 OColumnWrapper::getFastPropertyValue( rValue
, nHandle
);