2010-10-27 12:33:13 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-08-02 14:05:49 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 11:37:07 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-08-02 14:05:49 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-08-02 14:05:49 +00:00
|
|
|
*
|
2008-04-10 11:37:07 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-08-02 14:05:49 +00:00
|
|
|
*
|
2008-04-10 11:37:07 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-08-02 14:05:49 +00:00
|
|
|
*
|
2008-04-10 11:37:07 +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.
|
2004-08-02 14:05:49 +00:00
|
|
|
*
|
2008-04-10 11:37:07 +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).
|
2004-08-02 14:05:49 +00:00
|
|
|
*
|
2008-04-10 11:37:07 +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.
|
2004-08-02 14:05:49 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef DBA_COREDATAACESS_COMPONENTDEFINITION_HXX
|
|
|
|
#define DBA_COREDATAACESS_COMPONENTDEFINITION_HXX
|
|
|
|
|
|
|
|
#include "commandbase.hxx"
|
|
|
|
#include <comphelper/propertycontainer.hxx>
|
|
|
|
#include <com/sun/star/sdbcx/XRename.hpp>
|
|
|
|
#include <cppuhelper/implbase1.hxx>
|
|
|
|
#include <comphelper/proparrhlp.hxx>
|
|
|
|
#include "datasettings.hxx"
|
|
|
|
#include <com/sun/star/container/XNameAccess.hpp>
|
|
|
|
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
|
2007-09-26 13:39:40 +00:00
|
|
|
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
|
2008-01-30 07:31:21 +00:00
|
|
|
#include <com/sun/star/uno/XComponentContext.hpp>
|
2004-08-02 14:05:49 +00:00
|
|
|
#include "ContentHelper.hxx"
|
2007-07-06 06:53:00 +00:00
|
|
|
#include "apitools.hxx"
|
2004-08-02 14:05:49 +00:00
|
|
|
#include <column.hxx>
|
2008-06-06 13:00:33 +00:00
|
|
|
#include <comphelper/implementationreference.hxx>
|
2006-07-13 14:20:27 +00:00
|
|
|
|
2004-08-02 14:05:49 +00:00
|
|
|
#include <memory>
|
|
|
|
//........................................................................
|
|
|
|
namespace dbaccess
|
|
|
|
{
|
|
|
|
//........................................................................
|
|
|
|
|
|
|
|
typedef ::cppu::ImplHelper1< ::com::sun::star::sdbcx::XColumnsSupplier > OComponentDefinition_BASE;
|
|
|
|
|
|
|
|
class OComponentDefinition_Impl : public OContentHelper_Impl
|
|
|
|
,public ODataSettings_Base
|
|
|
|
{
|
|
|
|
public:
|
2006-07-10 14:08:03 +00:00
|
|
|
typedef ::std::map < ::rtl::OUString
|
|
|
|
, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
|
|
|
|
> Columns;
|
|
|
|
typedef Columns::iterator iterator;
|
|
|
|
typedef Columns::const_iterator const_iterator;
|
2004-08-02 14:05:49 +00:00
|
|
|
|
2006-07-10 14:08:03 +00:00
|
|
|
private:
|
|
|
|
Columns m_aColumns;
|
|
|
|
|
|
|
|
public:
|
2004-08-02 14:05:49 +00:00
|
|
|
::rtl::OUString m_sSchemaName;
|
|
|
|
::rtl::OUString m_sCatalogName;
|
2006-07-10 14:08:03 +00:00
|
|
|
|
|
|
|
public:
|
2006-07-13 14:20:27 +00:00
|
|
|
OComponentDefinition_Impl();
|
|
|
|
virtual ~OComponentDefinition_Impl();
|
|
|
|
|
2006-07-10 14:08:03 +00:00
|
|
|
inline size_t size() const { return m_aColumns.size(); }
|
|
|
|
|
|
|
|
inline const_iterator begin() const { return m_aColumns.begin(); }
|
|
|
|
inline const_iterator end() const { return m_aColumns.end(); }
|
|
|
|
|
|
|
|
inline const_iterator find( const ::rtl::OUString& _rName ) const { return m_aColumns.find( _rName ); }
|
|
|
|
|
|
|
|
inline void erase( const ::rtl::OUString& _rName ) { m_aColumns.erase( _rName ); }
|
|
|
|
|
|
|
|
inline void insert( const ::rtl::OUString& _rName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn )
|
|
|
|
{
|
2006-07-13 14:20:27 +00:00
|
|
|
OSL_PRECOND( m_aColumns.find( _rName ) == m_aColumns.end(), "OComponentDefinition_Impl::insert: there's already an element with this name!" );
|
2006-07-10 14:08:03 +00:00
|
|
|
m_aColumns.insert( Columns::value_type( _rName, _rxColumn ) );
|
|
|
|
}
|
2004-08-02 14:05:49 +00:00
|
|
|
};
|
|
|
|
|
2008-06-06 13:00:33 +00:00
|
|
|
class OColumnPropertyListener;
|
2004-08-02 14:05:49 +00:00
|
|
|
//=========================================================================
|
|
|
|
//= OComponentDefinition - a database "document" which describes a query
|
|
|
|
//=========================================================================
|
|
|
|
class OComponentDefinition :public OContentHelper
|
|
|
|
,public ODataSettings
|
|
|
|
,public IColumnFactory
|
|
|
|
,public OComponentDefinition_BASE
|
|
|
|
,public ::comphelper::OPropertyArrayUsageHelper< OComponentDefinition >
|
|
|
|
{
|
|
|
|
OComponentDefinition();
|
|
|
|
|
|
|
|
protected:
|
2007-09-26 13:39:40 +00:00
|
|
|
::std::auto_ptr< OColumns > m_pColumns;
|
2008-06-06 13:00:33 +00:00
|
|
|
::comphelper::ImplementationReference< OColumnPropertyListener,::com::sun::star::beans::XPropertyChangeListener>
|
2007-09-26 13:39:40 +00:00
|
|
|
m_xColumnPropertyListener;
|
|
|
|
sal_Bool m_bTable;
|
2004-08-02 14:05:49 +00:00
|
|
|
|
|
|
|
virtual ~OComponentDefinition();
|
|
|
|
virtual void SAL_CALL disposing();
|
2006-07-10 14:08:03 +00:00
|
|
|
|
|
|
|
|
2004-08-02 14:05:49 +00:00
|
|
|
protected:
|
|
|
|
OComponentDefinition(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
|
|
|
|
,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xParentContainer
|
|
|
|
,const TContentPtr& _pImpl
|
|
|
|
,sal_Bool _bTable = sal_True);
|
|
|
|
|
2006-07-10 14:08:03 +00:00
|
|
|
const OComponentDefinition_Impl& getDefinition() const { return dynamic_cast< const OComponentDefinition_Impl& >( *m_pImpl.get() ); }
|
|
|
|
OComponentDefinition_Impl& getDefinition() { return dynamic_cast< OComponentDefinition_Impl& >( *m_pImpl.get() ); }
|
2004-08-02 14:05:49 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
OComponentDefinition(
|
|
|
|
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContainer
|
|
|
|
,const ::rtl::OUString& _rElementName
|
|
|
|
,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&
|
|
|
|
,const TContentPtr& _pImpl
|
|
|
|
,sal_Bool _bTable = sal_True
|
|
|
|
);
|
|
|
|
|
|
|
|
// com::sun::star::lang::XTypeProvider
|
|
|
|
DECLARE_TYPEPROVIDER( );
|
|
|
|
|
|
|
|
// ::com::sun::star::uno::XInterface
|
|
|
|
DECLARE_XINTERFACE( )
|
|
|
|
|
|
|
|
// ::com::sun::star::lang::XServiceInfo
|
|
|
|
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException);
|
|
|
|
|
2008-01-30 07:31:21 +00:00
|
|
|
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static(void) throw( ::com::sun::star::uno::RuntimeException );
|
|
|
|
static ::rtl::OUString getImplementationName_static(void) throw( ::com::sun::star::uno::RuntimeException );
|
2004-08-02 14:05:49 +00:00
|
|
|
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
|
2008-01-30 07:31:21 +00:00
|
|
|
Create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&);
|
2004-08-02 14:05:49 +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);
|
|
|
|
|
|
|
|
// XColumnsSupplier
|
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getColumns( ) throw (::com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
// OPropertySetHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
|
|
|
|
|
|
|
|
// IColumnFactory
|
|
|
|
virtual OColumn* createColumn(const ::rtl::OUString& _rName) const;
|
2006-07-10 14:08:03 +00:00
|
|
|
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createColumnDescriptor();
|
|
|
|
virtual void columnAppended( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxSourceDescriptor );
|
2004-08-02 14:05:49 +00:00
|
|
|
virtual void columnDropped(const ::rtl::OUString& _sName);
|
2007-09-26 13:39:40 +00:00
|
|
|
virtual void notifyDataSourceModified() { OContentHelper::notifyDataSourceModified(); }
|
2004-08-02 14:05:49 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
// OPropertyArrayUsageHelper
|
|
|
|
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
|
|
|
|
|
|
|
|
virtual void SAL_CALL setFastPropertyValue_NoBroadcast(
|
|
|
|
sal_Int32 nHandle,
|
|
|
|
const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception);
|
2008-12-09 07:25:38 +00:00
|
|
|
|
|
|
|
// OContentHelper overridables
|
|
|
|
virtual ::rtl::OUString determineContentType() const;
|
|
|
|
|
2004-08-02 14:05:49 +00:00
|
|
|
private:
|
|
|
|
void registerProperties();
|
|
|
|
};
|
|
|
|
|
|
|
|
//........................................................................
|
|
|
|
} // namespace dbaccess
|
|
|
|
//........................................................................
|
|
|
|
|
|
|
|
#endif // DBA_COREDATAACESS_COMPONENTDEFINITION_HXX
|
2010-10-27 12:33:13 +01:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|