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

112 lines
4.9 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2012-06-12 22:04:38 +01:00
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 15:18:56 +00:00
#include "connectivity/sdbcx/VIndexColumn.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;
2000-11-03 12:36:27 +00:00
// -----------------------------------------------------------------------------
::rtl::OUString SAL_CALL OIndexColumn::getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
{
if(isNew())
return ::rtl::OUString("com.sun.star.sdbcx.VIndexColumnDescription");
return ::rtl::OUString("com.sun.star.sdbcx.VIndex");
2000-11-03 12:36:27 +00:00
}
// -----------------------------------------------------------------------------
::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OIndexColumn::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException)
{
::com::sun::star::uno::Sequence< ::rtl::OUString > aSupported(1);
if(isNew())
aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.IndexDescription");
2000-11-03 12:36:27 +00:00
else
aSupported[0] = ::rtl::OUString("com.sun.star.sdbcx.Index");
2000-11-03 12:36:27 +00:00
return aSupported;
}
// -----------------------------------------------------------------------------
sal_Bool SAL_CALL OIndexColumn::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
}
// -----------------------------------------------------------------------------
OIndexColumn::OIndexColumn(sal_Bool _bCase) : OColumn(_bCase), m_IsAscending(sal_True)
{
construct();
2000-11-03 12:36:27 +00:00
}
2000-09-18 15:18:56 +00:00
// -------------------------------------------------------------------------
OIndexColumn::OIndexColumn( sal_Bool _IsAscending,
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_IsAscending(_IsAscending)
{
construct();
}
2001-03-02 14:26:27 +00:00
// -----------------------------------------------------------------------------
::cppu::IPropertyArrayHelper* OIndexColumn::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 OIndexColumn::getInfoHelper()
{
return *OIndexColumn_PROP::getArrayHelper(isNew() ? 1 : 0);
}
2000-09-18 15:18:56 +00:00
// -------------------------------------------------------------------------
void OIndexColumn::construct()
{
2000-10-30 06:55:15 +00:00
sal_Int32 nAttrib = isNew() ? 0 : PropertyAttribute::READONLY;
2001-05-14 10:42:44 +00:00
registerProperty(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_ISASCENDING), PROPERTY_ID_ISASCENDING, nAttrib,&m_IsAscending, ::getBooleanCppuType());
2000-09-18 15:18:56 +00:00
}
2001-03-02 14:26:27 +00:00
// -----------------------------------------------------------------------------
2000-09-18 15:18:56 +00:00
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */