27#include <com/sun/star/beans/PropertyAttribute.hpp>
28#include <com/sun/star/sdbcx/XTablesSupplier.hpp>
42using namespace ::
cppu;
49 const sal_Int32 HAS_DESCRIPTION = 0x00000001;
50 const sal_Int32 HAS_DEFAULTVALUE = 0x00000002;
51 const sal_Int32 HAS_ROWVERSION = 0x00000004;
52 const sal_Int32 HAS_AUTOINCREMENT_CREATION = 0x00000008;
53 const sal_Int32 HAS_CATALOGNAME = 0x00000010;
54 const sal_Int32 HAS_SCHEMANAME = 0x00000020;
55 const sal_Int32 HAS_TABLENAME = 0x00000040;
63 sal_Int32 nDefaultAttr = m_bActAsDescriptor ? 0 : PropertyAttribute::READONLY;
69 if ( m_bActAsDescriptor )
80 OColumnSettings::registerProperties( *
this );
88 return "com.sun.star.sdb.OTableColumnDescriptor";
91Sequence< OUString > OTableColumnDescriptor::getSupportedServiceNames( )
100 Sequence< Property > aProps;
101 describeProperties( aProps );
102 return new ::cppu::OPropertyArrayHelper( aProps );
113 OColumn::setFastPropertyValue_NoBroadcast(
nHandle, rValue );
145 return "com.sun.star.sdb.OTableColumn";
160OQueryColumn::OQueryColumn(
const Reference< XPropertySet >& _rxParserColumn,
const Reference< XConnection >& _rxConnection, OUString i_sLabel )
162 ,m_sLabel(
std::move(i_sLabel))
164 const sal_Int32 nPropAttr = PropertyAttribute::READONLY;
198 Reference< XPropertySetInfo > xPSI( _rxParserColumn->getPropertySetInfo(), UNO_SET_THROW );
204 struct PropertyDescriptor
209 const PropertyDescriptor aProps[] =
216 for (
const auto & aProp : aProps)
218 if ( xPSI->hasPropertyByName( aProp.sName ) )
223 osl_atomic_increment( &m_refCount );
227 osl_atomic_decrement( &m_refCount );
236 OSL_PRECOND( _rxConnection.is(),
"OQueryColumn::impl_determineOriginalTableColumn: illegal connection!" );
237 if ( !_rxConnection.is() )
240 Reference< XPropertySet > xOriginalTableColumn;
255 OUString sComposedTableName = ::dbtools::composeTableName(
256 _rxConnection->getMetaData(),
sCatalog,
sSchema, sTable,
false, ::dbtools::EComposeRule::Complete );
259 Reference< XTablesSupplier > xSuppTables( _rxConnection, UNO_QUERY_THROW );
260 Reference< XNameAccess > xTables( xSuppTables->getTables(), UNO_SET_THROW );
261 if ( !xTables->hasByName( sComposedTableName ) )
264 Reference< XColumnsSupplier > xSuppCols( xTables->getByName( sComposedTableName ), UNO_QUERY_THROW );
265 Reference< XNameAccess > xColumns( xSuppCols->getColumns(), UNO_SET_THROW );
270 if ( !xColumns->hasByName( sColumn ) )
273 xOriginalTableColumn.set( xColumns->getByName( sColumn ), UNO_QUERY );
279 return xOriginalTableColumn;
286 return "org.openoffice.comp.dbaccess.OQueryColumn";
301 OTableColumnDescriptor::getFastPropertyValue( _rValue, _nHandle );
321 OSL_ENSURE( !sPropName.isEmpty(),
"OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
344 Reference <XPropertySetInfo > xInfo(
m_xAggregate->getPropertySetInfo());
364 const_cast< OColumnWrapper*
>( this )->getInfoHelper().fillPropertyMembersByHandle( &sPropName, &
nAttributes, _nHandle );
365 OSL_ENSURE( !sPropName.isEmpty(),
"OColumnWrapper::impl_getPropertyNameFromHandle: property not found!" );
374 if ( OColumn::isRegisteredProperty(
nHandle ) )
376 OColumn::getFastPropertyValue( rValue,
nHandle );
387 bool bModified(
false );
388 if ( OColumn::isRegisteredProperty(
nHandle ) )
390 bModified = OColumn::convertFastPropertyValue( rConvertedValue, rOldValue,
nHandle, rValue );
395 if ( rOldValue != rValue )
397 rConvertedValue = rValue;
406 if ( OColumn::isRegisteredProperty(
nHandle ) )
408 OColumn::setFastPropertyValue_NoBroadcast(
nHandle, rValue );
419 ,m_bPureWrap( _bPureWrap )
420 ,m_bIsDescriptor( _bIsDescriptor )
432 return "com.sun.star.sdb.OTableColumnDescriptorWrapper";
443 const sal_Int32 nHaveAlways = 7;
446 const sal_Int32 nHaveOptionally (std::bitset<7>(
nId).
count());
448 css::uno::Sequence< css::beans::Property> aDescriptor(nHaveAlways + nHaveOptionally);
449 css::beans::Property* pDesc = aDescriptor.getArray();
460 if (
nId & HAS_AUTOINCREMENT_CREATION )
464 if (
nId & HAS_DEFAULTVALUE )
468 if (
nId & HAS_DESCRIPTION )
472 if (
nId & HAS_ROWVERSION )
476 if (
nId & HAS_CATALOGNAME )
480 if (
nId & HAS_SCHEMANAME )
484 if (
nId & HAS_TABLENAME )
489 OSL_ENSURE(
nPos == aDescriptor.getLength(),
"forgot to adjust the count ?");
493 for (
auto & prop : asNonConstRange(aDescriptor) )
495 prop.Attributes |= PropertyAttribute::READONLY;
500 Sequence< Property > aBaseProperties;
501 describeProperties( aBaseProperties );
503 Sequence< Property > aAllProperties( ::comphelper::concatSequences( aDescriptor, aBaseProperties ) );
504 return new ::cppu::OPropertyArrayHelper( aAllProperties,
false );
527 bool bModified(
false);
536 if ( rOldValue != rValue )
538 rConvertedValue = rValue;
566 const bool _bPureWrap )
570 if ( _xColDefinition.is() )
574 ::comphelper::copyProperties( _xColDefinition,
this );
592 return "com.sun.star.sdb.OTableColumnWrapper";
css::uno::Any m_aDefaultValue
::cppu::IPropertyArrayHelper * getArrayHelper(sal_Int32 nId)
::cppu::IPropertyArrayHelper * getArrayHelper()
virtual sal_Bool SAL_CALL fillPropertyMembersByHandle(::rtl::OUString *pPropName, sal_Int16 *pAttributes, sal_Int32 nHandle)=0
void registerProperties(IPropertyContainer &_rPropertyContainer)
static bool isDefaulted(const sal_Int32 _nPropertyHandle, const css::uno::Any &_rPropertyValue)
static bool isColumnSettingProperty(const sal_Int32 _nPropertyHandle)
determines whether the property with the given handle is handled by the class
describes all properties for a columns of a table.
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
css::uno::Reference< css::beans::XPropertySet > m_xAggregate
OColumnWrapper(const css::uno::Reference< css::beans::XPropertySet > &_rCol, const bool _bNameIsReadOnly)
virtual ~OColumnWrapper() override
OUString impl_getPropertyNameFromHandle(const sal_Int32 _nHandle) const
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
a column of a Query, with additional information obtained from parsing the query statement
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
OQueryColumn(const css::uno::Reference< css::beans::XPropertySet > &_rxParserColumn, const css::uno::Reference< css::sdbc::XConnection > &_rxConnection, OUString i_sLabel)
css::uno::Reference< css::beans::XPropertySet > impl_determineOriginalTableColumn(const css::uno::Reference< css::sdbc::XConnection > &_rxConnection)
virtual ~OQueryColumn() override
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
css::uno::Reference< css::beans::XPropertySet > m_xOriginalTableColumn
provides the properties for description.
virtual void SAL_CALL getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue) override
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
const bool m_bIsDescriptor
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
OTableColumnDescriptorWrapper(const css::uno::Reference< css::beans::XPropertySet > &rCol, const bool _bPureWrap, const bool _bIsDescriptor)
virtual ::cppu::IPropertyArrayHelper * createArrayHelper(sal_Int32 nId) const override
provides the properties for description.
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const css::uno::Any &rValue) override
const bool m_bActAsDescriptor
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
virtual void SAL_CALL setParent(const css::uno::Reference< css::uno::XInterface > &Parent) override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
css::uno::Reference< css::uno::XInterface > m_xParent
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getParent() override
describes all properties for a columns of a table.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
OTableColumnWrapper(const css::uno::Reference< css::beans::XPropertySet > &rCol, const css::uno::Reference< css::beans::XPropertySet > &rColDefinition, const bool _bPureWrap)
virtual ~OTableColumnWrapper() override
virtual ::cppu::IPropertyArrayHelper * createArrayHelper(sal_Int32 nId) const override
describes a column of a table
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
OTableColumn(const OUString &_rName)
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual ~OTableColumn() override
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_WARN(area, stream)
void notifyDataSourceModified(const css::uno::Reference< css::uno::XInterface > &_rxObject)
IMPLEMENT_GET_IMPLEMENTATION_ID(DrawController)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)
IMPLEMENT_FORWARD_XINTERFACE2(OStatement, OStatementBase, OStatement_IFACE)
#define PROPERTY_ID_AUTOINCREMENTCREATION
#define PROPERTY_ID_TABLENAME
#define PROPERTY_ID_DESCRIPTION
#define PROPERTY_ID_CATALOGNAME
#define PROPERTY_ID_ISROWVERSION
#define PROPERTY_ID_ISNULLABLE
#define PROPERTY_ID_PRECISION
#define PROPERTY_ID_LABEL
#define PROPERTY_ID_SCHEMANAME
#define PROPERTY_ID_ISAUTOINCREMENT
#define PROPERTY_ID_ISCURRENCY
#define PROPERTY_ID_TYPENAME
#define PROPERTY_ID_DEFAULTVALUE
#define PROPERTY_ID_REALNAME
#define PROPERTY_ID_SCALE
constexpr OUStringLiteral PROPERTY_ISAUTOINCREMENT(u"IsAutoIncrement")
constexpr OUStringLiteral PROPERTY_ISCURRENCY(u"IsCurrency")
constexpr OUStringLiteral SERVICE_SDBCX_COLUMNDESCRIPTOR
constexpr OUStringLiteral PROPERTY_PRECISION(u"Precision")
constexpr OUStringLiteral PROPERTY_TYPENAME(u"TypeName")
constexpr OUStringLiteral PROPERTY_LABEL(u"Label")
constexpr OUStringLiteral PROPERTY_ISROWVERSION(u"IsRowVersion")
constexpr OUStringLiteral PROPERTY_ISNULLABLE(u"IsNullable")
constexpr OUStringLiteral PROPERTY_SCHEMANAME(u"SchemaName")
constexpr OUStringLiteral PROPERTY_DESCRIPTION(u"Description")
constexpr OUStringLiteral PROPERTY_SCALE(u"Scale")
constexpr OUStringLiteral PROPERTY_REALNAME(u"RealName")
constexpr OUStringLiteral PROPERTY_TABLENAME(u"TableName")
constexpr OUStringLiteral SERVICE_SDB_COLUMNSETTINGS
constexpr OUStringLiteral PROPERTY_DEFAULTVALUE(u"DefaultValue")
constexpr OUStringLiteral SERVICE_SDBCX_COLUMN
constexpr OUStringLiteral PROPERTY_CATALOGNAME(u"CatalogName")
constexpr OUStringLiteral PROPERTY_TYPE(u"Type")
constexpr OUStringLiteral PROPERTY_NAME(u"Name")
constexpr OUStringLiteral PROPERTY_AUTOINCREMENTCREATION(u"AutoIncrementCreation")