Files
libreoffice/dbaccess/source/core/api/query.hxx

197 lines
7.6 KiB
C++
Raw Normal View History

2000-09-18 23:16:46 +00:00
/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 23:16:46 +00:00
*
* $RCSfile: query.hxx,v $
2000-09-18 23:16:46 +00:00
*
* $Revision: 1.16 $
2000-09-18 23:16:46 +00:00
*
* last change: $Author: rt $ $Date: 2005-09-08 10:07:46 $
2000-09-18 23:16:46 +00: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 23:16:46 +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-09-18 23:16:46 +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-09-18 23:16:46 +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-09-18 23:16:46 +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-09-18 23:16:46 +00:00
*
************************************************************************/
#ifndef _DBA_COREAPI_QUERY_HXX_
#define _DBA_COREAPI_QUERY_HXX_
#ifndef _DBA_COREAPI_QUERYDESCRIPTOR_HXX_
#include "querydescriptor.hxx"
#endif
#ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase3.hxx>
2000-09-18 23:16:46 +00:00
#endif
#ifndef _COM_SUN_STAR_SDBCX_XDATADESCRIPTORFACTORY_HPP_
#include <com/sun/star/sdbcx/XDataDescriptorFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBCX_XRENAME_HPP_
#include <com/sun/star/sdbcx/XRename.hpp>
#endif
#ifndef DBA_CONTENTHELPER_HXX
#include "ContentHelper.hxx"
2001-02-23 14:22:32 +00:00
#endif
2000-09-18 23:16:46 +00:00
#include <map>
//........................................................................
namespace dbaccess
{
//........................................................................
class IWarningsContainer;
2000-09-18 23:16:46 +00:00
//==========================================================================
2001-08-30 07:07:36 +00:00
//= OQuery - an object implementing the sdb.Query service
2000-09-18 23:16:46 +00:00
//==========================================================================
typedef ::cppu::ImplHelper3 < ::com::sun::star::sdbcx::XDataDescriptorFactory,
::com::sun::star::beans::XPropertyChangeListener,
::com::sun::star::sdbcx::XRename
2000-09-18 23:16:46 +00:00
> OQuery_Base;
class OQuery;
2001-02-23 14:22:32 +00:00
class OColumn;
2000-10-11 10:21:40 +00:00
typedef ::comphelper::OPropertyArrayUsageHelper< OQuery > OQuery_ArrayHelperBase;
2001-08-15 12:05:15 +00:00
class OQuery :public OContentHelper
,public OQueryDescriptor_Base
2000-09-18 23:16:46 +00:00
,public OQuery_Base
2001-08-30 07:07:36 +00:00
,public OQuery_ArrayHelperBase
,public ODataSettings
2000-09-18 23:16:46 +00:00
{
2001-08-15 12:05:15 +00:00
friend struct TRelease;
2001-08-30 07:07:36 +00:00
2001-08-16 13:02:31 +00:00
public:
2001-08-15 12:05:15 +00:00
typedef ::std::map< ::rtl::OUString,OColumn*,::comphelper::UStringMixLess> TNameColumnMap;
2001-08-30 07:07:36 +00:00
2001-08-16 13:02:31 +00:00
protected:
2001-08-30 07:07:36 +00:00
// TNameColumnMap m_aColumnMap; // contains all columnnames to columns
2000-09-18 23:16:46 +00:00
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
m_xCommandDefinition;
::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >
m_xConnection;
2001-03-02 09:24:52 +00:00
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xCommandPropInfo;
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xColumnMediator;
OContainerMediator* m_pMediator;
IWarningsContainer* m_pWarnings;
2000-09-18 23:16:46 +00:00
sal_Bool m_bCaseSensitiv : 1; // assume case sensitivity of the column names ?
// possible actions on our "aggregate"
enum AGGREGATE_ACTION { NONE, SETTING_PROPERTIES, FLUSHING };
AGGREGATE_ACTION m_eDoingCurrently;
// ------------------------------------------------------------------------
/** a class which automatically resets m_eDoingCurrently in it's destructor
*/
class OAutoActionReset; // just for the following friend declaration
friend class OAutoActionReset;
class OAutoActionReset
{
2001-08-30 07:07:36 +00:00
OQuery* m_pActor;
2000-09-18 23:16:46 +00:00
public:
2001-08-30 07:07:36 +00:00
OAutoActionReset(OQuery* _pActor) : m_pActor(_pActor) { }
2000-09-18 23:16:46 +00:00
~OAutoActionReset() { m_pActor->m_eDoingCurrently = NONE; }
};
protected:
virtual ~OQuery();
// OPropertyArrayUsageHelper
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
::cppu::IPropertyArrayHelper* getArrayHelper() { return OQuery_ArrayHelperBase::getArrayHelper(); }
2000-09-18 23:16:46 +00:00
public:
2001-08-30 07:07:36 +00:00
OQuery(
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxCommandDefinition,
const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn,
const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB
);
2000-09-18 23:16:46 +00:00
// com::sun::star::lang::XTypeProvider
DECLARE_TYPEPROVIDER( );
2001-08-30 07:07:36 +00:00
// ::com::sun::star::uno::XInterface
DECLARE_XINTERFACE( )
2000-09-18 23:16:46 +00:00
// ::com::sun::star::beans::XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException);
// OPropertySetHelper
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// ::com::sun::star::lang::XServiceInfo
DECLARE_SERVICE_INFO();
// ::com::sun::star::sdbcx::XDataDescriptorFactory
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL createDataDescriptor( ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::beans::XPropertyChangeListener
virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException);
// ::com::sun::star::lang::XEventListener
2001-09-24 13:03:49 +00:00
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException);
2000-09-18 23:16:46 +00:00
// OPropertySetHelper
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
sal_Int32 nHandle,
const ::com::sun::star::uno::Any& rValue )
throw (::com::sun::star::uno::Exception);
2001-08-30 07:07:36 +00:00
public:
// the caller is responsible for the lifetime!
void setWarningsContainer( IWarningsContainer* _pWarnings ) { m_pWarnings = _pWarnings; }
IWarningsContainer* getWarningsContainer( ) const { return m_pWarnings; }
// XRename
virtual void SAL_CALL rename( const ::rtl::OUString& newName ) throw (::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException);
2000-09-18 23:16:46 +00:00
protected:
virtual void SAL_CALL disposing();
2001-02-23 14:22:32 +00:00
virtual OColumn* createColumn(const ::rtl::OUString& _rName) const;
2000-09-18 23:16:46 +00:00
2001-08-30 07:07:36 +00:00
virtual void rebuildColumns( );
private:
/** creates column objects for all columns which are necessary when executing our command
@param _bOnlyTemporary
if <TRUE/>, the resulting columns are inserted into m_aColumnMap only, else they're really appended to m_pColumns
*/
void implCollectColumns( );
void registerProperties();
2000-09-18 23:16:46 +00:00
};
//........................................................................
} // namespace dbaccess
//........................................................................
2000-09-18 23:16:46 +00:00
#endif // _DBA_COREAPI_QUERY_HXX_