2000-09-18 18:16:46 -05:00
/*************************************************************************
*
2005-09-08 04:08:25 -05:00
* OpenOffice . org - a multi - platform office productivity suite
2000-09-18 18:16:46 -05:00
*
2005-09-08 04:08:25 -05:00
* $ RCSfile : querycontainer . cxx , v $
2000-09-18 18:16:46 -05:00
*
2005-09-08 04:08:25 -05:00
* $ Revision : 1.22 $
2000-09-18 18:16:46 -05:00
*
2005-09-08 04:08:25 -05:00
* last change : $ Author : rt $ $ Date : 2005 - 09 - 08 10 : 08 : 24 $
2000-09-18 18:16:46 -05:00
*
2005-09-08 04:08:25 -05:00
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1 .
2000-09-18 18:16:46 -05:00
*
*
2005-09-08 04:08:25 -05: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-09-18 18:16:46 -05:00
*
2005-09-08 04:08:25 -05: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-09-18 18:16:46 -05:00
*
2005-09-08 04:08:25 -05: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-09-18 18:16:46 -05:00
*
2005-09-08 04:08:25 -05: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-09-18 18:16:46 -05:00
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# ifndef _DBA_CORE_QUERYCONTAINER_HXX_
# include "querycontainer.hxx"
# endif
2000-10-25 01:32:52 -05:00
# ifndef DBACCESS_SHARED_DBASTRINGS_HRC
# include "dbastrings.hrc"
2000-09-18 18:16:46 -05:00
# endif
# ifndef _DBA_COREAPI_QUERY_HXX_
# include "query.hxx"
# endif
# ifndef _TOOLS_DEBUG_HXX
# include <tools/debug.hxx>
# endif
2000-10-11 05:21:40 -05:00
# ifndef _COMPHELPER_ENUMHELPER_HXX_
# include <comphelper/enumhelper.hxx>
2000-09-18 18:16:46 -05:00
# endif
2000-10-11 05:21:40 -05:00
# ifndef _COMPHELPER_UNO3_HXX_
# include <comphelper/uno3.hxx>
2000-09-18 18:16:46 -05:00
# endif
2000-10-11 05:21:40 -05:00
# ifndef _COMPHELPER_PROPERTY_HXX_
# include <comphelper/property.hxx>
2000-09-18 18:16:46 -05:00
# endif
2000-10-11 05:21:40 -05:00
# ifndef _COMPHELPER_SEQUENCE_HXX_
# include <comphelper/sequence.hxx>
2000-09-18 18:16:46 -05:00
# endif
2001-03-15 01:29:16 -06:00
# ifndef _COMPHELPER_EXTRACT_HXX_
# include <comphelper/extract.hxx>
2000-09-18 18:16:46 -05:00
# endif
# ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
# include <com/sun/star/beans/XPropertySet.hpp>
# endif
# ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
# include <com/sun/star/container/XContainer.hpp>
# endif
# ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
# include <com/sun/star/sdbc/XConnection.hpp>
# endif
2000-10-25 01:32:52 -05:00
# ifndef _DBHELPER_DBEXCEPTION_HXX_
# include <connectivity/dbexception.hxx>
# endif
2000-09-18 18:16:46 -05:00
2000-10-25 01:32:52 -05:00
using namespace dbtools ;
2000-09-18 18:16:46 -05:00
using namespace : : com : : sun : : star : : uno ;
2004-08-02 09:03:38 -05:00
using namespace : : com : : sun : : star : : ucb ;
2000-09-18 18:16:46 -05:00
using namespace : : com : : sun : : star : : lang ;
using namespace : : com : : sun : : star : : beans ;
using namespace : : com : : sun : : star : : sdbc ;
using namespace : : com : : sun : : star : : sdbcx ;
using namespace : : com : : sun : : star : : container ;
using namespace : : osl ;
2000-10-11 05:21:40 -05:00
using namespace : : comphelper ;
2000-09-18 18:16:46 -05:00
using namespace : : cppu ;
2000-10-18 10:16:39 -05:00
//........................................................................
namespace dbaccess
{
//........................................................................
2000-09-18 18:16:46 -05:00
//==========================================================================
//= OQueryContainer
//==========================================================================
DBG_NAME ( OQueryContainer )
//------------------------------------------------------------------------------
OQueryContainer : : OQueryContainer (
2004-08-02 09:03:38 -05:00
const Reference < XNameContainer > & _rxCommandDefinitions
, const Reference < XConnection > & _rxConn
, const Reference < XMultiServiceFactory > & _rxORB ,
2001-08-24 07:16:22 -05:00
IWarningsContainer * _pWarnings )
2004-08-02 09:03:38 -05:00
: ODefinitionContainer ( _rxORB , NULL , TContentPtr ( new ODefinitionContainer_Impl ) )
2001-08-24 07:16:22 -05:00
, m_pWarnings ( _pWarnings )
2000-09-18 18:16:46 -05:00
, m_xCommandDefinitions ( _rxCommandDefinitions )
2004-08-02 09:03:38 -05:00
, m_xConnection ( _rxConn )
2000-09-18 18:16:46 -05:00
{
DBG_CTOR ( OQueryContainer , NULL ) ;
2004-08-02 09:03:38 -05:00
increment ( m_refCount ) ;
2000-11-03 07:32:31 -06:00
m_pCommandsListener = new OCommandsListener ( this ) ;
m_pCommandsListener - > acquire ( ) ;
2000-09-18 18:16:46 -05:00
{
Reference < XContainer > xContainer ( m_xCommandDefinitions , UNO_QUERY ) ;
DBG_ASSERT ( xContainer . is ( ) , " OQueryContainer::OQueryContainer : the CommandDefinitions container is invalid ! " ) ;
2000-11-03 07:32:31 -06:00
xContainer - > addContainerListener ( m_pCommandsListener ) ;
2000-09-18 18:16:46 -05:00
2004-09-09 03:38:15 -05:00
// fill my structures
ODefinitionContainer_Impl * pItem = static_cast < ODefinitionContainer_Impl * > ( m_pImpl . get ( ) ) ;
Sequence < : : rtl : : OUString > sDefinitionNames = m_xCommandDefinitions - > getElementNames ( ) ;
const : : rtl : : OUString * pIter = sDefinitionNames . getConstArray ( ) ;
const : : rtl : : OUString * pEnd = pIter + sDefinitionNames . getLength ( ) ;
for ( ; pIter ! = pEnd ; + + pIter )
{
pItem - > m_aDocumentMap . insert ( ODefinitionContainer_Impl : : Documents : : value_type ( * pIter , TContentPtr ( ) ) ) ;
m_aDocuments . push_back ( m_aDocumentMap . insert ( Documents : : value_type ( * pIter , Documents : : mapped_type ( ) ) ) . first ) ;
}
2000-09-18 18:16:46 -05:00
}
decrement ( m_refCount ) ;
}
//------------------------------------------------------------------------------
OQueryContainer : : ~ OQueryContainer ( )
{
DBG_DTOR ( OQueryContainer , NULL ) ;
2000-11-03 07:32:31 -06:00
// dispose();
// maybe we're already disposed, but this should be uncritical
2000-09-18 18:16:46 -05:00
}
2004-08-02 09:03:38 -05:00
// -----------------------------------------------------------------------------
IMPLEMENT_FORWARD_XINTERFACE2 ( OQueryContainer , ODefinitionContainer , OQueryContainer_Base )
2000-09-18 18:16:46 -05:00
//------------------------------------------------------------------------------
2004-08-02 09:03:38 -05:00
void OQueryContainer : : disposing ( )
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
ODefinitionContainer : : disposing ( ) ;
MutexGuard aGuard ( m_aMutex ) ;
2000-09-18 18:16:46 -05:00
// say our listeners goobye
Reference < XContainer > xContainer ( m_xCommandDefinitions , UNO_QUERY ) ;
if ( xContainer . is ( ) )
2000-11-03 07:32:31 -06:00
xContainer - > removeContainerListener ( m_pCommandsListener ) ;
2000-11-14 06:28:20 -06:00
if ( m_pCommandsListener )
m_pCommandsListener - > release ( ) ;
m_pCommandsListener = NULL ;
m_xCommandDefinitions = NULL ;
2004-08-02 09:03:38 -05:00
m_xConnection = NULL ;
2000-09-18 18:16:46 -05:00
}
// XServiceInfo
//------------------------------------------------------------------------------
IMPLEMENT_SERVICE_INFO2 ( OQueryContainer , " com.sun.star.sdb.dbaccess.OQueryContainer " , SERVICE_SDBCX_CONTAINER , SERVICE_SDB_QUERIES )
// XDataDescriptorFactory
//--------------------------------------------------------------------------
Reference < XPropertySet > SAL_CALL OQueryContainer : : createDataDescriptor ( ) throw ( RuntimeException )
{
return new OQueryDescriptor ( ) ;
}
// XAppend
//------------------------------------------------------------------------------
void SAL_CALL OQueryContainer : : appendByDescriptor ( const Reference < XPropertySet > & _rxDesc ) throw ( SQLException , ElementExistException , RuntimeException )
{
2004-08-02 09:03:38 -05:00
Reference < XContent > xNewObject ;
2000-09-18 18:16:46 -05:00
: : rtl : : OUString sNewObjectName ;
{
2004-08-02 09:03:38 -05:00
MutexGuard aGuard ( m_aMutex ) ;
2000-09-18 18:16:46 -05:00
OQueryDescriptor * pImpl = NULL ;
2000-10-24 05:48:02 -05:00
comphelper : : getImplementation ( pImpl , Reference < XInterface > ( _rxDesc . get ( ) ) ) ;
2000-09-18 18:16:46 -05:00
DBG_ASSERT ( pImpl ! = NULL , " OQueryContainer::appendByDescriptor : can't fully handle this descriptor ! " ) ;
// first clone this object's CommandDefinition part
if ( ! m_xCommandDefinitions . is ( ) )
{
DBG_ERROR ( " OQueryContainer::appendByDescriptor : have no CommandDefinition container anymore ! " ) ;
// perhaps somebody modified the DataSource, so all connections were separated
throwGenericSQLException ( : : rtl : : OUString : : createFromAscii ( " Unable to insert objects into containers of standalone connections (not belonging to a data source). " ) , * this ) ;
// TODO : resource
}
2004-08-02 09:03:38 -05:00
Reference < XPropertySet > xCommandDefinitionPart ( m_xORB - > createInstance ( SERVICE_SDB_QUERYDEFINITION ) , UNO_QUERY ) ;
2000-09-18 18:16:46 -05:00
if ( ! xCommandDefinitionPart . is ( ) )
{
DBG_ERROR ( " OQueryContainer::appendByDescriptor : could not create a CommandDefinition object ! " ) ;
throwGenericSQLException ( : : rtl : : OUString : : createFromAscii ( " Unable to create an object supporting the com.sun.star.sdb.CommandDefinition service " ) , * this ) ;
// TODO : resource
}
2000-10-11 05:21:40 -05:00
: : comphelper : : copyProperties ( _rxDesc , xCommandDefinitionPart ) ;
2000-09-18 18:16:46 -05:00
// and insert it into the CommDef container
_rxDesc - > getPropertyValue ( PROPERTY_NAME ) > > = sNewObjectName ;
{
m_eDoingCurrently = INSERTING ;
OAutoActionReset aAutoReset ( this ) ;
m_xCommandDefinitions - > insertByName ( sNewObjectName , makeAny ( xCommandDefinitionPart ) ) ;
}
# if DBG_UTIL
// check if the object was really inserted
try
{
2004-08-02 09:03:38 -05:00
Reference < XPropertySet > xNewEl ( m_xCommandDefinitions - > getByName ( sNewObjectName ) , UNO_QUERY ) ;
2000-09-18 18:16:46 -05:00
DBG_ASSERT ( xNewEl . get ( ) = = xCommandDefinitionPart . get ( ) , " OQueryContainer::appendByDescriptor : the CommandDefinition container worked as it had a descriptor ! " ) ;
// normally should not have changed after inserting
}
catch ( Exception & )
{
DBG_ERROR ( " OQueryContainer::appendByDescriptor : could not find the just inserted CommandDefinition ! " ) ;
}
# endif
// TODO : the columns part of the descriptor has to be copied
2004-08-02 09:03:38 -05:00
xNewObject = implCreateWrapper ( Reference < XContent > ( xCommandDefinitionPart , UNO_QUERY ) ) ;
2000-09-18 18:16:46 -05:00
}
2004-08-02 09:03:38 -05:00
ClearableMutexGuard aGuard ( m_aMutex ) ;
implAppend ( sNewObjectName , xNewObject ) ;
notifyByName ( aGuard , sNewObjectName , xNewObject , NULL , E_INSERTED ) ;
2000-09-18 18:16:46 -05:00
}
// XDrop
//------------------------------------------------------------------------------
void SAL_CALL OQueryContainer : : dropByName ( const : : rtl : : OUString & _rName ) throw ( SQLException , NoSuchElementException , RuntimeException )
{
2004-08-02 09:03:38 -05:00
MutexGuard aGuard ( m_aMutex ) ;
if ( ! checkExistence ( _rName ) )
throw NoSuchElementException ( _rName , * this ) ;
2000-09-18 18:16:46 -05:00
2004-08-02 09:03:38 -05:00
if ( ! m_xCommandDefinitions . is ( ) )
2000-09-18 18:16:46 -05:00
{
DBG_ERROR ( " OQueryContainer::dropByIndex : have no CommandDefinition container anymore ! " ) ;
// perhaps somebody modified the DataSource, so all connections were separated
throwGenericSQLException ( : : rtl : : OUString : : createFromAscii ( " Unable to remove objects from containers of standalone connections (not belonging to a data source). " ) , * this ) ;
// TODO : resource
}
// now simply forward the remove request to the CommandDefinition container, we're a listener for the removal
// and thus we do everything neccessary in ::elementRemoved
2004-08-02 09:03:38 -05:00
m_xCommandDefinitions - > removeByName ( _rName ) ;
2000-09-18 18:16:46 -05:00
}
//------------------------------------------------------------------------------
2004-08-02 09:03:38 -05:00
void SAL_CALL OQueryContainer : : dropByIndex ( sal_Int32 _nIndex ) throw ( SQLException , IndexOutOfBoundsException , RuntimeException )
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
MutexGuard aGuard ( m_aMutex ) ;
if ( ( _nIndex < 0 ) | | ( _nIndex > getCount ( ) ) )
2000-09-18 18:16:46 -05:00
throw IndexOutOfBoundsException ( ) ;
2004-08-02 09:03:38 -05:00
: : rtl : : OUString sName ;
Reference < XPropertySet > xProp ( Reference < XIndexAccess > ( m_xCommandDefinitions , UNO_QUERY ) - > getByIndex ( _nIndex ) , UNO_QUERY ) ;
if ( xProp . is ( ) )
xProp - > getPropertyValue ( PROPERTY_NAME ) > > = sName ;
2000-09-18 18:16:46 -05:00
2004-08-02 09:03:38 -05:00
dropByName ( sName ) ;
2000-09-18 18:16:46 -05:00
}
//------------------------------------------------------------------------------
void SAL_CALL OQueryContainer : : elementInserted ( const : : com : : sun : : star : : container : : ContainerEvent & _rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException )
{
2004-08-02 09:03:38 -05:00
Reference < XContent > xNewElement ;
: : rtl : : OUString sElementName ;
_rEvent . Accessor > > = sElementName ;
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
MutexGuard aGuard ( m_aMutex ) ;
2000-09-18 18:16:46 -05:00
if ( INSERTING = = m_eDoingCurrently )
// nothing to do, we're inserting via an "appendByDescriptor"
return ;
DBG_ASSERT ( sElementName . getLength ( ) , " OQueryContainer::elementInserted : invalid name ! " ) ;
2004-10-22 02:57:07 -05:00
DBG_ASSERT ( m_aDocumentMap . find ( sElementName ) = = m_aDocumentMap . end ( ) , " OQueryContainer::elementInserted : oops .... we're inconsistent with our master container ! " ) ;
2000-09-18 18:16:46 -05:00
if ( ! sElementName . getLength ( ) | | hasByName ( sElementName ) )
return ;
// insert an own new element
2004-08-02 09:03:38 -05:00
xNewElement = implCreateWrapper ( sElementName ) ;
2000-09-18 18:16:46 -05:00
}
2004-08-02 09:03:38 -05:00
insertByName ( sElementName , makeAny ( xNewElement ) ) ;
2000-09-18 18:16:46 -05:00
}
//------------------------------------------------------------------------------
void SAL_CALL OQueryContainer : : elementRemoved ( const : : com : : sun : : star : : container : : ContainerEvent & _rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException )
{
: : rtl : : OUString sAccessor ;
2004-08-02 09:03:38 -05:00
_rEvent . Accessor > > = sAccessor ;
2000-09-18 18:16:46 -05:00
{
DBG_ASSERT ( sAccessor . getLength ( ) , " OQueryContainer::elementRemoved : invalid name ! " ) ;
2004-10-22 02:57:07 -05:00
DBG_ASSERT ( m_aDocumentMap . find ( sAccessor ) ! = m_aDocumentMap . end ( ) , " OQueryContainer::elementRemoved : oops .... we're inconsistent with our master container ! " ) ;
2004-08-02 09:03:38 -05:00
if ( ! sAccessor . getLength ( ) | | ! hasByName ( sAccessor ) )
2000-09-18 18:16:46 -05:00
return ;
}
2004-08-02 09:03:38 -05:00
removeByName ( sAccessor ) ;
2000-09-18 18:16:46 -05:00
}
//------------------------------------------------------------------------------
void SAL_CALL OQueryContainer : : elementReplaced ( const : : com : : sun : : star : : container : : ContainerEvent & _rEvent ) throw ( : : com : : sun : : star : : uno : : RuntimeException )
{
Reference < XPropertySet > xReplacedElement ;
2004-08-02 09:03:38 -05:00
Reference < XContent > xNewElement ;
2000-09-18 18:16:46 -05:00
: : rtl : : OUString sAccessor ;
2004-08-02 09:03:38 -05:00
_rEvent . Accessor > > = sAccessor ;
2000-09-18 18:16:46 -05:00
2004-08-02 09:03:38 -05:00
{
MutexGuard aGuard ( m_aMutex ) ;
2000-09-18 18:16:46 -05:00
DBG_ASSERT ( sAccessor . getLength ( ) , " OQueryContainer::elementReplaced : invalid name ! " ) ;
2004-10-22 02:57:07 -05:00
DBG_ASSERT ( m_aDocumentMap . find ( sAccessor ) ! = m_aDocumentMap . end ( ) , " OQueryContainer::elementReplaced : oops .... we're inconsistent with our master container ! " ) ;
2000-09-18 18:16:46 -05:00
if ( ! sAccessor . getLength ( ) | | ! hasByName ( sAccessor ) )
return ;
2004-08-02 09:03:38 -05:00
xNewElement = implCreateWrapper ( sAccessor ) ;
2000-09-18 18:16:46 -05:00
}
2004-08-02 09:03:38 -05:00
replaceByName ( sAccessor , makeAny ( xNewElement ) ) ;
2000-09-18 18:16:46 -05:00
}
//------------------------------------------------------------------------------
void SAL_CALL OQueryContainer : : disposing ( const : : com : : sun : : star : : lang : : EventObject & _rSource ) throw ( : : com : : sun : : star : : uno : : RuntimeException )
{
if ( _rSource . Source . get ( ) = = Reference < XInterface > ( m_xCommandDefinitions , UNO_QUERY ) . get ( ) )
{ // our "master container" (with the command definitions) is beeing disposed
DBG_ERROR ( " OQueryContainer::disposing : nobody should dispose the CommandDefinition container before disposing my connection ! " ) ;
dispose ( ) ;
}
2001-01-04 07:27:17 -06:00
else
{
2004-08-02 09:03:38 -05:00
Reference < XContent > xSource ( _rSource . Source , UNO_QUERY ) ;
// it's one of our documents ....
Documents : : iterator aIter = m_aDocumentMap . begin ( ) ;
Documents : : iterator aEnd = m_aDocumentMap . end ( ) ;
for ( ; aIter ! = aEnd ; + + aIter )
2001-01-04 07:27:17 -06:00
{
2004-08-02 09:03:38 -05:00
if ( xSource = = aIter - > second . get ( ) )
2001-01-04 07:27:17 -06:00
{
2004-08-02 09:03:38 -05:00
m_xCommandDefinitions - > removeByName ( aIter - > first ) ;
2001-01-04 07:27:17 -06:00
break ;
}
}
2004-08-02 09:03:38 -05:00
ODefinitionContainer : : disposing ( _rSource ) ;
2001-01-04 07:27:17 -06:00
}
2000-09-18 18:16:46 -05:00
}
2001-09-25 07:28:23 -05:00
// -----------------------------------------------------------------------------
2004-08-02 09:03:38 -05:00
Reference < XContent > OQueryContainer : : implCreateWrapper ( const : : rtl : : OUString & _rName )
2001-09-25 07:28:23 -05:00
{
2004-08-02 09:03:38 -05:00
Reference < XContent > xObject ( m_xCommandDefinitions - > getByName ( _rName ) , UNO_QUERY ) ;
return implCreateWrapper ( xObject ) ;
2001-09-25 07:28:23 -05:00
}
2004-08-02 09:03:38 -05:00
2000-09-18 18:16:46 -05:00
//--------------------------------------------------------------------------
2004-08-02 09:03:38 -05:00
Reference < XContent > OQueryContainer : : implCreateWrapper ( const Reference < XContent > & _rxCommandDesc )
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
Reference < XNameContainer > xContainer ( _rxCommandDesc , UNO_QUERY ) ;
Reference < XContent > xReturn ;
if ( xContainer . is ( ) )
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
xReturn = new OQueryContainer ( xContainer , m_xConnection , m_xORB , m_pWarnings ) ;
2000-09-18 18:16:46 -05:00
}
2004-08-02 09:03:38 -05:00
else
{
OQuery * pNewObject = new OQuery ( Reference < XPropertySet > ( _rxCommandDesc , UNO_QUERY ) , m_xConnection , m_xORB ) ;
xReturn = pNewObject ;
2001-08-24 07:16:22 -05:00
2004-08-02 09:03:38 -05:00
pNewObject - > setWarningsContainer ( m_pWarnings ) ;
pNewObject - > getColumns ( ) ;
}
2001-08-24 07:16:22 -05:00
2004-08-02 09:03:38 -05:00
return xReturn ;
2000-09-18 18:16:46 -05:00
}
//--------------------------------------------------------------------------
2004-08-02 09:03:38 -05:00
Reference < XContent > OQueryContainer : : createObject ( const : : rtl : : OUString & _rName )
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
return implCreateWrapper ( _rName ) ;
2000-09-18 18:16:46 -05:00
}
2004-08-02 09:03:38 -05:00
// -----------------------------------------------------------------------------
sal_Bool OQueryContainer : : checkExistence ( const : : rtl : : OUString & _rName )
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
sal_Bool bRet = sal_False ;
if ( ! m_bInPropertyChange )
2000-10-18 10:16:39 -05:00
{
2004-08-02 09:03:38 -05:00
bRet = m_xCommandDefinitions - > hasByName ( _rName ) ;
Documents : : iterator aFind = m_aDocumentMap . find ( _rName ) ;
if ( ! bRet & & aFind ! = m_aDocumentMap . end ( ) )
{
m_aDocuments . erase ( : : std : : find ( m_aDocuments . begin ( ) , m_aDocuments . end ( ) , aFind ) ) ;
m_aDocumentMap . erase ( aFind ) ;
}
else if ( bRet & & aFind = = m_aDocumentMap . end ( ) )
{
implAppend ( _rName , NULL ) ;
}
2000-09-18 18:16:46 -05:00
}
2004-08-02 09:03:38 -05:00
return bRet ;
2000-09-18 18:16:46 -05:00
}
//--------------------------------------------------------------------------
2004-08-02 09:03:38 -05:00
sal_Bool SAL_CALL OQueryContainer : : hasElements ( ) throw ( RuntimeException )
2000-09-18 18:16:46 -05:00
{
2004-08-02 09:03:38 -05:00
MutexGuard aGuard ( m_aMutex ) ;
return m_xCommandDefinitions - > hasElements ( ) ;
2000-09-18 18:16:46 -05:00
}
2001-07-18 02:45:32 -05:00
// -----------------------------------------------------------------------------
2004-08-02 09:03:38 -05:00
sal_Int32 SAL_CALL OQueryContainer : : getCount ( ) throw ( RuntimeException )
2001-07-18 02:45:32 -05:00
{
2004-08-02 09:03:38 -05:00
MutexGuard aGuard ( m_aMutex ) ;
return Reference < XIndexAccess > ( m_xCommandDefinitions , UNO_QUERY ) - > getCount ( ) ;
2001-07-18 02:45:32 -05:00
}
2004-08-02 09:03:38 -05:00
// -----------------------------------------------------------------------------
Sequence < : : rtl : : OUString > SAL_CALL OQueryContainer : : getElementNames ( ) throw ( RuntimeException )
{
MutexGuard aGuard ( m_aMutex ) ;
2000-09-18 18:16:46 -05:00
2004-08-02 09:03:38 -05:00
return m_xCommandDefinitions - > getElementNames ( ) ;
}
2000-10-18 10:16:39 -05:00
//........................................................................
} // namespace dbaccess
//........................................................................
2000-09-18 18:16:46 -05:00