2004-08-02 14:14:14 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-08 12:36:39 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
2005-09-08 12:36:39 +00:00
|
|
|
* $RCSfile: definitioncolumn.hxx,v $
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
2006-07-10 14:13:37 +00:00
|
|
|
* $Revision: 1.6 $
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
2006-07-10 14:13:37 +00:00
|
|
|
* last change: $Author: obo $ $Date: 2006-07-10 15:13:37 $
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
2005-09-08 12:36:39 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-08 12:36:39 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
2005-09-08 12:36:39 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
2005-09-08 12:36:39 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
2005-09-08 12:36:39 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2004-08-02 14:14:14 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#ifndef _DBACORE_DEFINITIONCOLUMN_HXX_
|
|
|
|
#define _DBACORE_DEFINITIONCOLUMN_HXX_
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
|
|
|
|
#include <com/sun/star/sdbc/DataType.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_SDBC_COLUMNVALUE_HPP_
|
|
|
|
#include <com/sun/star/sdbc/ColumnValue.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
|
|
|
|
#include <com/sun/star/container/XChild.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _DBASHARED_APITOOLS_HXX_
|
|
|
|
#include "apitools.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _DBA_COREAPI_COLUMN_HXX_
|
|
|
|
#include "column.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef COMPHELPER_IDPROPERTYARRAYUSAGEHELPER_HXX
|
|
|
|
#include <comphelper/IdPropArrayHelper.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _COMPHELPER_UNO3_HXX_
|
|
|
|
#include <comphelper/uno3.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
namespace dbaccess
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef ::cppu::ImplHelper1< ::com::sun::star::container::XChild > TXChild;
|
|
|
|
/**
|
|
|
|
* provides the properties for description. A descriptor could be used to create a new table column.
|
|
|
|
*/
|
|
|
|
class OTableColumnDescriptor : public OColumn
|
|
|
|
,public OColumnSettings
|
|
|
|
,public ::comphelper::OPropertyArrayUsageHelper < OTableColumnDescriptor >
|
|
|
|
,public TXChild
|
|
|
|
{
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
|
|
|
|
protected:
|
|
|
|
// <properties>
|
|
|
|
rtl::OUString m_aTypeName;
|
|
|
|
rtl::OUString m_aDescription;
|
|
|
|
rtl::OUString m_aDefaultValue;
|
|
|
|
rtl::OUString m_aAutoIncrementValue;
|
|
|
|
sal_Int32 m_nType;
|
|
|
|
sal_Int32 m_nPrecision;
|
|
|
|
sal_Int32 m_nScale;
|
|
|
|
sal_Int32 m_nIsNullable;
|
|
|
|
sal_Bool m_bAutoIncrement : 1;
|
|
|
|
sal_Bool m_bRowVersion : 1;
|
|
|
|
sal_Bool m_bCurrency : 1;
|
|
|
|
// </properties>
|
|
|
|
public:
|
|
|
|
OTableColumnDescriptor():m_nType(::com::sun::star::sdbc::DataType::SQLNULL)
|
|
|
|
,m_nPrecision(0)
|
|
|
|
,m_nScale(0)
|
|
|
|
,m_nIsNullable(::com::sun::star::sdbc::ColumnValue::NULLABLE_UNKNOWN)
|
|
|
|
,m_bAutoIncrement(sal_False)
|
|
|
|
,m_bRowVersion(sal_False)
|
|
|
|
,m_bCurrency(sal_False){}
|
|
|
|
|
|
|
|
DECLARE_XINTERFACE( )
|
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::com::sun::star::container::XChild
|
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::comphelper::OPropertyArrayUsageHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
|
|
|
|
|
|
|
|
// ::cppu::OPropertySetHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
|
|
|
virtual void SAL_CALL getFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any& rValue,
|
|
|
|
sal_Int32 nHandle
|
|
|
|
) const;
|
|
|
|
virtual sal_Bool SAL_CALL convertFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any & rConvertedValue,
|
|
|
|
::com::sun::star::uno::Any & rOldValue,
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const ::com::sun::star::uno::Any& rValue )
|
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException);
|
|
|
|
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const ::com::sun::star::uno::Any& rValue
|
|
|
|
)
|
|
|
|
throw (::com::sun::star::uno::Exception);
|
2004-10-22 08:00:43 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// XUnoTunnel
|
|
|
|
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
|
2006-06-20 01:47:02 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
using OColumn::getFastPropertyValue;
|
2004-08-02 14:14:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* describes a column of an existing table. The informations for the column are
|
|
|
|
* retrieved in a generic way using the meta data of a connection.
|
|
|
|
*/
|
|
|
|
class OTableColumn : public OTableColumnDescriptor,
|
|
|
|
public ::comphelper::OPropertyArrayUsageHelper < OTableColumn >
|
|
|
|
{
|
|
|
|
friend class ODBTable;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~OTableColumn();
|
|
|
|
public:
|
|
|
|
OTableColumn(const ::rtl::OUString& _rName);
|
|
|
|
OTableColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xColumn);
|
|
|
|
|
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::comphelper::OPropertyArrayUsageHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
|
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* describes all properties for a columns of a table. Only the view parts are provided
|
|
|
|
* directly, all the other parts are derived from a driver implementation
|
|
|
|
*/
|
|
|
|
class OColumnWrapper : public OColumn
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
// definition which is provided by a driver!
|
|
|
|
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
|
|
|
|
m_xAggregate;
|
|
|
|
|
|
|
|
sal_Int32 m_nColTypeID;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
OColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol);
|
|
|
|
virtual ~OColumnWrapper();
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual void SAL_CALL getFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any& rValue,
|
|
|
|
sal_Int32 nHandle
|
|
|
|
) const;
|
|
|
|
virtual sal_Bool SAL_CALL convertFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any & rConvertedValue,
|
|
|
|
::com::sun::star::uno::Any & rOldValue,
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const ::com::sun::star::uno::Any& rValue )
|
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException);
|
|
|
|
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const ::com::sun::star::uno::Any& rValue
|
|
|
|
)
|
|
|
|
throw (::com::sun::star::uno::Exception);
|
|
|
|
|
|
|
|
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
// Helper
|
|
|
|
// sal_Int32 getColumnTypeID() const {return m_nColTypeID;}
|
2006-06-20 01:47:02 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
using OColumn::getFastPropertyValue;
|
2004-08-02 14:14:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* provides the properties for description. A descriptor could be used to create a new table column.
|
|
|
|
*/
|
|
|
|
class OTableColumnDescriptorWrapper : public OColumnWrapper,
|
|
|
|
public OColumnSettings,
|
|
|
|
public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnDescriptorWrapper >
|
|
|
|
{
|
|
|
|
sal_Bool m_bPureWrap;
|
|
|
|
public:
|
|
|
|
OTableColumnDescriptorWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol,sal_Bool _bPureWrap = sal_False)
|
|
|
|
:OColumnWrapper(rCol),m_bPureWrap(_bPureWrap){}
|
|
|
|
|
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// OIdPropertyArrayUsageHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
|
|
|
|
|
|
|
|
// cppu::OPropertySetHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
|
|
|
virtual void SAL_CALL getFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any& rValue,
|
|
|
|
sal_Int32 nHandle
|
|
|
|
) const;
|
|
|
|
virtual sal_Bool SAL_CALL convertFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any & rConvertedValue,
|
|
|
|
::com::sun::star::uno::Any & rOldValue,
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const ::com::sun::star::uno::Any& rValue )
|
|
|
|
throw (::com::sun::star::lang::IllegalArgumentException);
|
|
|
|
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const ::com::sun::star::uno::Any& rValue
|
|
|
|
)
|
|
|
|
throw (::com::sun::star::uno::Exception);
|
2004-10-22 08:00:43 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// XUnoTunnel
|
|
|
|
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
|
2006-06-20 01:47:02 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
using OColumnWrapper::getFastPropertyValue;
|
2004-08-02 14:14:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* describes all properties for a columns of a table. Only the view parts are provided
|
|
|
|
* directly, all the other parts are derived from a driver implementation
|
|
|
|
*/
|
|
|
|
class OTableColumnWrapper : public OTableColumnDescriptorWrapper,
|
|
|
|
public ::comphelper::OIdPropertyArrayUsageHelper < OTableColumnWrapper >
|
|
|
|
{
|
2006-07-10 14:13:37 +00:00
|
|
|
protected:
|
|
|
|
~OTableColumnWrapper();
|
2004-08-02 14:14:14 +00:00
|
|
|
public:
|
|
|
|
OTableColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol
|
|
|
|
,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rColDefintion
|
|
|
|
,sal_Bool _bPureWrap = sal_False);
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XTypeProvider
|
|
|
|
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// OIdPropertyArrayUsageHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper(sal_Int32 nId) const;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* describes all properties for a columns of an index.
|
|
|
|
*/
|
|
|
|
class OIndexColumnWrapper : public OColumnWrapper,
|
2006-06-20 01:47:02 +00:00
|
|
|
public ::comphelper::OPropertyArrayUsageHelper < OIndexColumnWrapper >
|
2004-08-02 14:14:14 +00:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
// <properties>
|
|
|
|
sal_Bool m_bAscending;
|
|
|
|
// </properties>
|
|
|
|
|
|
|
|
public:
|
|
|
|
OIndexColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol )
|
|
|
|
:OColumnWrapper(rCol) {}
|
|
|
|
|
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2006-06-20 01:47:02 +00:00
|
|
|
// OPropertyArrayUsageHelper
|
2004-08-02 14:14:14 +00:00
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
2006-06-20 01:47:02 +00:00
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
|
2004-08-02 14:14:14 +00:00
|
|
|
|
|
|
|
virtual void SAL_CALL getFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any& rValue,
|
|
|
|
sal_Int32 nHandle
|
|
|
|
) const;
|
2006-06-20 01:47:02 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
using OColumnWrapper::getFastPropertyValue;
|
2004-08-02 14:14:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* describes all properties for a columns of an key column.
|
|
|
|
*/
|
|
|
|
class OKeyColumnWrapper : public OColumnWrapper,
|
2006-06-20 01:47:02 +00:00
|
|
|
public ::comphelper::OPropertyArrayUsageHelper < OKeyColumnWrapper >
|
2004-08-02 14:14:14 +00:00
|
|
|
{
|
|
|
|
protected:
|
|
|
|
// <properties>
|
|
|
|
rtl::OUString m_aRelatedColumn;
|
|
|
|
// </properties>
|
|
|
|
|
|
|
|
public:
|
|
|
|
OKeyColumnWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rCol)
|
|
|
|
:OColumnWrapper(rCol) {}
|
|
|
|
|
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2006-06-20 01:47:02 +00:00
|
|
|
// OPropertyArrayUsageHelper
|
2004-08-02 14:14:14 +00:00
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
2006-06-20 01:47:02 +00:00
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const;
|
2004-08-02 14:14:14 +00:00
|
|
|
|
|
|
|
virtual void SAL_CALL getFastPropertyValue(
|
|
|
|
::com::sun::star::uno::Any& rValue,
|
|
|
|
sal_Int32 nHandle
|
|
|
|
) const;
|
2006-06-20 01:47:02 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
using OColumnWrapper::getFastPropertyValue;
|
2004-08-02 14:14:14 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // _DBACORE_DEFINITIONCOLUMN_HXX_
|
|
|
|
|