2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* $RCSfile: CRowSetColumn.cxx,v $
|
|
|
|
* $Revision: 1.16 $
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* OpenOffice.org 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 version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 11:21:55 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 05:30:36 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_dbaccess.hxx"
|
|
|
|
|
2000-10-25 06:32:52 +00:00
|
|
|
#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
|
|
|
|
#include "dbastrings.hrc"
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _DBASHARED_APITOOLS_HXX_
|
|
|
|
#include "apitools.hxx"
|
|
|
|
#endif
|
2000-10-11 10:21:40 +00:00
|
|
|
#ifndef _COMPHELPER_TYPES_HXX_
|
|
|
|
#include <comphelper/types.hxx>
|
2000-09-18 23:16:46 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
|
|
|
|
#include <cppuhelper/typeprovider.hxx>
|
|
|
|
#endif
|
|
|
|
#ifndef DBACCESS_CORE_API_CROWSETCOLUMN_HXX
|
|
|
|
#include "CRowSetColumn.hxx"
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_SDB_XCOLUMN_HPP_
|
|
|
|
#include <com/sun/star/sdb/XColumn.hpp>
|
|
|
|
#endif
|
2000-10-25 06:32:52 +00:00
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#endif
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
using namespace dbaccess;
|
|
|
|
// using namespace connectivity;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
// using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::sdb;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
// using namespace ::com::sun::star::util;
|
|
|
|
using namespace cppu;
|
|
|
|
using namespace osl;
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
//ORowSetColumn::ORowSetColumn( const Reference < XResultSetMetaData >& _xMetaData,
|
|
|
|
// const ::com::sun::star::uno::Reference < ::com::sun::star::sdbc::XRow >& _xRow,
|
|
|
|
// sal_Int32 _nPos,
|
|
|
|
// ORowSetMatrix::iterator& _rColumnValue,
|
|
|
|
// ORowSetMatrix::iterator& _rEnd)
|
|
|
|
// : ORowSetDataColumn(_xMetaData,_xRow,NULL,_nPos,_rColumnValue,_rEnd)
|
|
|
|
//{
|
|
|
|
//
|
|
|
|
//}
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
Any SAL_CALL ORowSetColumn::queryInterface( const Type & _rType ) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
Any aReturn = OResultColumn::queryInterface(_rType);
|
|
|
|
if (!aReturn.hasValue())
|
|
|
|
aReturn = ::cppu::queryInterface(_rType,static_cast< XColumn* >(this));
|
|
|
|
return aReturn;
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
2000-10-11 10:21:40 +00:00
|
|
|
// comphelper::OPropertyArrayUsageHelper
|
2000-09-18 23:16:46 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
::cppu::IPropertyArrayHelper* ORowSetColumn::createArrayHelper( ) const
|
|
|
|
{
|
2005-12-19 16:13:03 +00:00
|
|
|
BEGIN_PROPERTY_HELPER(30)
|
2004-08-02 13:58:48 +00:00
|
|
|
DECL_PROP2(ALIGN, sal_Int32, BOUND,MAYBEVOID);
|
2000-09-18 23:16:46 +00:00
|
|
|
DECL_PROP1(CATALOGNAME, ::rtl::OUString, READONLY);
|
2004-08-02 13:58:48 +00:00
|
|
|
DECL_PROP2(CONTROLDEFAULT, ::rtl::OUString, BOUND,MAYBEVOID);
|
|
|
|
DECL_PROP1_IFACE(CONTROLMODEL, XPropertySet, BOUND );
|
2000-09-18 23:16:46 +00:00
|
|
|
DECL_PROP1(DISPLAYSIZE, sal_Int32, READONLY);
|
2004-08-02 13:58:48 +00:00
|
|
|
DECL_PROP2(NUMBERFORMAT, sal_Int32, BOUND,MAYBEVOID);
|
|
|
|
DECL_PROP2(HELPTEXT, ::rtl::OUString, BOUND,MAYBEVOID);
|
|
|
|
DECL_PROP1_BOOL(HIDDEN, BOUND);
|
2000-09-18 23:16:46 +00:00
|
|
|
DECL_PROP1_BOOL(ISAUTOINCREMENT, READONLY);
|
|
|
|
DECL_PROP1_BOOL(ISCASESENSITIVE, READONLY);
|
|
|
|
DECL_PROP1_BOOL(ISCURRENCY, READONLY);
|
|
|
|
DECL_PROP1_BOOL(ISDEFINITELYWRITABLE, READONLY);
|
|
|
|
DECL_PROP1(ISNULLABLE, sal_Int32, READONLY);
|
|
|
|
DECL_PROP1_BOOL(ISREADONLY, READONLY);
|
2005-12-19 16:13:03 +00:00
|
|
|
DECL_PROP1_BOOL(ISROWVERSION, READONLY);
|
2000-09-18 23:16:46 +00:00
|
|
|
DECL_PROP1_BOOL(ISSEARCHABLE, READONLY);
|
|
|
|
DECL_PROP1_BOOL(ISSIGNED, READONLY);
|
|
|
|
DECL_PROP1_BOOL(ISWRITABLE, READONLY);
|
|
|
|
DECL_PROP1(LABEL, ::rtl::OUString, READONLY);
|
|
|
|
DECL_PROP1(NAME, ::rtl::OUString, READONLY);
|
|
|
|
DECL_PROP1(PRECISION, sal_Int32, READONLY);
|
2004-08-02 13:58:48 +00:00
|
|
|
DECL_PROP2(RELATIVEPOSITION, sal_Int32, BOUND, MAYBEVOID);
|
2000-09-18 23:16:46 +00:00
|
|
|
DECL_PROP1(SCALE, sal_Int32, READONLY);
|
|
|
|
DECL_PROP1(SCHEMANAME, ::rtl::OUString, READONLY);
|
|
|
|
DECL_PROP1(SERVICENAME, ::rtl::OUString, READONLY);
|
|
|
|
DECL_PROP1(TABLENAME, ::rtl::OUString, READONLY);
|
|
|
|
DECL_PROP1(TYPE, sal_Int32, READONLY);
|
|
|
|
DECL_PROP1(TYPENAME, ::rtl::OUString, READONLY);
|
|
|
|
DECL_PROP2(VALUE, Any, READONLY,BOUND);
|
|
|
|
DECL_PROP1(WIDTH, sal_Int32, MAYBEVOID);
|
|
|
|
END_PROPERTY_HELPER();
|
|
|
|
}
|
|
|
|
|
|
|
|
// cppu::OPropertySetHelper
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
::cppu::IPropertyArrayHelper& ORowSetColumn::getInfoHelper()
|
|
|
|
{
|
2000-10-11 10:21:40 +00:00
|
|
|
return *static_cast< ::comphelper::OPropertyArrayUsageHelper< ORowSetColumn >* >(this)->getArrayHelper();
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL ORowSetColumn::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const
|
|
|
|
{
|
|
|
|
switch(nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_ALIGN:
|
|
|
|
case PROPERTY_ID_NUMBERFORMAT:
|
|
|
|
case PROPERTY_ID_RELATIVEPOSITION:
|
|
|
|
case PROPERTY_ID_WIDTH:
|
|
|
|
case PROPERTY_ID_HIDDEN:
|
|
|
|
case PROPERTY_ID_CONTROLMODEL:
|
2001-09-20 11:59:25 +00:00
|
|
|
case PROPERTY_ID_HELPTEXT:
|
2001-10-19 11:52:27 +00:00
|
|
|
case PROPERTY_ID_CONTROLDEFAULT:
|
2000-09-18 23:16:46 +00:00
|
|
|
OColumnSettings::getFastPropertyValue( rValue, nHandle );
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_VALUE:
|
2006-01-25 12:41:57 +00:00
|
|
|
if ( !m_aColumnValue.isNull() && (*m_aColumnValue).isValid() )
|
2008-12-30 13:32:01 +00:00
|
|
|
rValue = ((*m_aColumnValue)->get())[m_nPos].makeAny();
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ORowSetDataColumn::getFastPropertyValue(rValue,nHandle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
void SAL_CALL ORowSetColumn::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& rValue )throw (Exception)
|
|
|
|
{
|
|
|
|
switch(nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_ALIGN:
|
|
|
|
case PROPERTY_ID_NUMBERFORMAT:
|
|
|
|
case PROPERTY_ID_RELATIVEPOSITION:
|
|
|
|
case PROPERTY_ID_WIDTH:
|
|
|
|
case PROPERTY_ID_HIDDEN:
|
|
|
|
case PROPERTY_ID_CONTROLMODEL:
|
2001-09-20 11:59:25 +00:00
|
|
|
case PROPERTY_ID_HELPTEXT:
|
2001-10-19 11:52:27 +00:00
|
|
|
case PROPERTY_ID_CONTROLDEFAULT:
|
2000-09-18 23:16:46 +00:00
|
|
|
OColumnSettings::setFastPropertyValue_NoBroadcast( nHandle, rValue );
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_VALUE:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ORowSetDataColumn::setFastPropertyValue_NoBroadcast(nHandle,rValue );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
sal_Bool SAL_CALL ORowSetColumn::convertFastPropertyValue( Any & rConvertedValue,
|
|
|
|
Any & rOldValue,
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const Any& rValue ) throw (IllegalArgumentException)
|
|
|
|
{
|
|
|
|
sal_Bool bModified = sal_False;
|
|
|
|
switch(nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_ALIGN:
|
|
|
|
case PROPERTY_ID_NUMBERFORMAT:
|
|
|
|
case PROPERTY_ID_RELATIVEPOSITION:
|
|
|
|
case PROPERTY_ID_WIDTH:
|
|
|
|
case PROPERTY_ID_HIDDEN:
|
|
|
|
case PROPERTY_ID_CONTROLMODEL:
|
2001-09-20 11:59:25 +00:00
|
|
|
case PROPERTY_ID_HELPTEXT:
|
2001-10-19 11:52:27 +00:00
|
|
|
case PROPERTY_ID_CONTROLDEFAULT:
|
2000-09-18 23:16:46 +00:00
|
|
|
bModified = OColumnSettings::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_VALUE:
|
|
|
|
rConvertedValue = rValue;
|
2001-06-26 08:30:20 +00:00
|
|
|
getFastPropertyValue(rOldValue, PROPERTY_ID_VALUE);
|
2000-10-11 10:21:40 +00:00
|
|
|
bModified = !::comphelper::compare(rConvertedValue, rOldValue);
|
2000-09-18 23:16:46 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bModified = ORowSetDataColumn::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return bModified;
|
|
|
|
}
|
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
Sequence< Type > ORowSetColumn::getTypes() throw (RuntimeException)
|
|
|
|
{
|
|
|
|
OTypeCollection aTypes(::getCppuType( (const Reference< XColumn > *)0 ),OColumn::getTypes());
|
|
|
|
return aTypes.getTypes();
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------------
|