Files
libreoffice/connectivity/source/sdbcx/VKeyColumn.cxx

126 lines
5.4 KiB
C++
Raw Normal View History

2000-09-18 15:18:56 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 15:18:56 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 15:18:56 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 15:18:56 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 15:18:56 +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 15:18:56 +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 15:18:56 +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 15:18:56 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_connectivity.hxx"
2000-09-18 15:18:56 +00:00
#include "connectivity/sdbcx/VKeyColumn.hxx"
2001-05-14 10:42:44 +00:00
#include "TConnection.hxx"
2000-09-18 15:18:56 +00:00
2001-05-14 10:42:44 +00:00
using namespace connectivity;
2000-09-18 15:18:56 +00:00
using namespace connectivity::sdbcx;
using namespace ::com::sun::star::beans;
2000-10-30 06:55:15 +00:00
using namespace ::com::sun::star::uno;
using namespace cppu;
2000-11-03 12:36:27 +00:00
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL OKeyColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
{
if(isNew())
return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumnDescription");
return ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.VKeyColumn");
}
// -----------------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OKeyColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
if(isNew())
aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumnDescription");
else
aSupported[0] = ::rtl::OUString::createFromAscii("com.sun.star.sdbcx.KeyColumn");
return aSupported;
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OKeyColumn::supportsService( const ::rtl::OUString& _rServiceName ) throw(::com::sun::star::uno::RuntimeException)
{
2001-05-17 08:15:34 +00:00
Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
2000-11-03 12:36:27 +00:00
const ::rtl::OUString* pSupported = aSupported.getConstArray();
2001-05-17 08:15:34 +00:00
const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
;
2000-11-03 12:36:27 +00:00
2001-05-17 08:15:34 +00:00
return pSupported != pEnd;
2000-11-03 12:36:27 +00:00
}
// -------------------------------------------------------------------------
OKeyColumn::OKeyColumn(sal_Bool _bCase) : OColumn(_bCase)
{
construct();
}
2000-09-18 15:18:56 +00:00
// -------------------------------------------------------------------------
OKeyColumn::OKeyColumn( const ::rtl::OUString& _ReferencedColumn,
const ::rtl::OUString& _Name,
const ::rtl::OUString& _TypeName,
const ::rtl::OUString& _DefaultValue,
sal_Int32 _IsNullable,
sal_Int32 _Precision,
sal_Int32 _Scale,
sal_Int32 _Type,
sal_Bool _IsAutoIncrement,
sal_Bool _IsRowVersion,
sal_Bool _IsCurrency,
sal_Bool _bCase
) : OColumn(_Name,
_TypeName,
_DefaultValue,
::rtl::OUString(),
2000-09-18 15:18:56 +00:00
_IsNullable,
_Precision,
_Scale,
_Type,
_IsAutoIncrement,
_IsRowVersion,
_IsCurrency,
_bCase)
, m_ReferencedColumn(_ReferencedColumn)
{
construct();
}
// -------------------------------------------------------------------------
2000-10-19 10:47:14 +00:00
OKeyColumn::~OKeyColumn()
{
}
2001-03-02 14:26:27 +00:00
// -----------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OKeyColumn::createArrayHelper( sal_Int32 /*_nId*/ ) const
2001-03-02 14:26:27 +00:00
{
return doCreateArrayHelper();
2001-03-02 14:26:27 +00:00
}
// -----------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& SAL_CALL OKeyColumn::getInfoHelper()
{
return *OKeyColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
}
2000-10-19 10:47:14 +00:00
// -------------------------------------------------------------------------
2000-09-18 15:18:56 +00:00
void OKeyColumn::construct()
{
sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
2001-05-14 10:42:44 +00:00
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_RELATEDCOLUMN), PROPERTY_ID_RELATEDCOLUMN, nAttrib,&m_ReferencedColumn, ::getCppuType(reinterpret_cast< ::rtl::OUString*>(NULL)));
2000-09-18 15:18:56 +00:00
}
2001-03-02 14:26:27 +00:00
// -----------------------------------------------------------------------------
2000-09-18 15:18:56 +00:00
2000-10-30 06:55:15 +00:00