Files
libreoffice/dbaccess/source/core/api/CIndexes.cxx

127 lines
4.0 KiB
C++
Raw Normal View History

2000-11-15 14:58:11 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-11-15 14:58:11 +00:00
*
* $RCSfile: CIndexes.cxx,v $
2000-11-15 14:58:11 +00:00
*
* $Revision: 1.14 $
2000-11-15 14:58:11 +00:00
*
* last change: $Author: rt $ $Date: 2005-09-08 09:52:19 $
2000-11-15 14:58:11 +00:00
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
2000-11-15 14:58:11 +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
2000-11-15 14:58:11 +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.
2000-11-15 14:58:11 +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.
2000-11-15 14:58:11 +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
2000-11-15 14:58:11 +00:00
*
************************************************************************/
#ifndef DBACCESS_INDEXES_HXX_
#include "CIndexes.hxx"
#endif
#ifndef _CONNECTIVITY_SDBCX_INDEX_HXX_
#include "connectivity/sdbcx/VIndex.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBC_XROW_HPP_
#include <com/sun/star/sdbc/XRow.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XRESULTSET_HPP_
#include <com/sun/star/sdbc/XResultSet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_INDEXTYPE_HPP_
#include <com/sun/star/sdbc/IndexType.hpp>
#endif
#ifndef DBACCESS_SHARED_DBASTRINGS_HRC
#include "dbastrings.hrc"
#endif
#ifndef _CONNECTIVITY_DBTOOLS_HXX_
#include <connectivity/dbtools.hxx>
#endif
#ifndef _COMPHELPER_EXTRACT_HXX_
#include <comphelper/extract.hxx>
2000-11-15 14:58:11 +00:00
#endif
using namespace connectivity;
2000-11-15 14:58:11 +00:00
using namespace connectivity::sdbcx;
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::container;
using namespace ::com::sun::star::lang;
using namespace dbaccess;
using namespace cppu;
ObjectType OIndexes::createObject(const ::rtl::OUString& _rName)
2000-11-15 14:58:11 +00:00
{
ObjectType xRet;
if ( m_xIndexes.is() && m_xIndexes->hasByName(_rName) )
xRet.set(m_xIndexes->getByName(_rName),UNO_QUERY);
2000-11-15 14:58:11 +00:00
else
xRet = OIndexesHelper::createObject(_rName);
2000-11-15 14:58:11 +00:00
return xRet;
}
// -------------------------------------------------------------------------
Reference< XPropertySet > OIndexes::createEmptyObject()
{
2001-11-06 11:48:49 +00:00
Reference<XDataDescriptorFactory> xData( m_xIndexes,UNO_QUERY);
if(xData.is())
2000-11-15 14:58:11 +00:00
return xData->createDataDescriptor();
else
return OIndexesHelper::createEmptyObject();
2000-11-15 14:58:11 +00:00
}
// -------------------------------------------------------------------------
// XAppend
2001-10-12 11:02:56 +00:00
void OIndexes::appendObject( const Reference< XPropertySet >& descriptor )
2000-11-15 14:58:11 +00:00
{
2001-11-06 11:48:49 +00:00
Reference<XAppend> xData( m_xIndexes,UNO_QUERY);
if ( xData.is() )
2000-11-15 14:58:11 +00:00
xData->appendByDescriptor(descriptor);
else
OIndexesHelper::appendObject(descriptor);
2000-11-15 14:58:11 +00:00
}
// -------------------------------------------------------------------------
// XDrop
2001-10-12 11:02:56 +00:00
void OIndexes::dropObject(sal_Int32 _nPos,const ::rtl::OUString _sElementName)
2000-11-15 14:58:11 +00:00
{
if ( m_xIndexes.is() )
2000-11-15 14:58:11 +00:00
{
Reference<XDrop> xData( m_xIndexes,UNO_QUERY);
if ( xData.is() )
2001-10-12 11:02:56 +00:00
xData->dropByName(_sElementName);
2000-11-15 14:58:11 +00:00
}
else
OIndexesHelper::dropObject(_nPos,_sElementName);
2000-11-15 14:58:11 +00:00
}
// -------------------------------------------------------------------------
2000-11-15 15:07:40 +00:00
void SAL_CALL OIndexes::disposing(void)
{
if ( m_xIndexes.is() )
2000-11-15 15:07:40 +00:00
clear_NoDispose();
else
OIndexesHelper::disposing();
2001-10-12 11:02:56 +00:00
}
// -----------------------------------------------------------------------------
2000-11-15 14:58:11 +00:00