Tag: cws_src680_hsqlcsv User: fs Date: 2006/10/19 03:16:40 Modified: dba/dbaccess/source/ext/hsqldb/linkedtableservice.cxx
Log: #i69526# item set support File Changes: Directory: /dba/dbaccess/source/ext/hsqldb/ =========================================== File [changed]: linkedtableservice.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ext/hsqldb/linkedtableservice.cxx?r1=1.1.2.1&r2=1.1.2.2 Delta lines: +60 -4 -------------------- --- linkedtableservice.cxx 14 Sep 2006 12:24:21 -0000 1.1.2.1 +++ linkedtableservice.cxx 19 Oct 2006 10:16:37 -0000 1.1.2.2 @@ -4,9 +4,9 @@ * * $RCSfile: linkedtableservice.cxx,v $ * - * $Revision: 1.1.2.1 $ + * $Revision: 1.1.2.2 $ * - * last change: $Author: fs $ $Date: 2006/09/14 12:24:21 $ + * last change: $Author: fs $ $Date: 2006/10/19 10:16:37 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -44,6 +44,15 @@ #ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HPP_ #include <com/sun/star/uno/XComponentContext.hpp> #endif +#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ +#include <com/sun/star/sdbc/XConnection.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_ +#include <com/sun/star/beans/PropertyAttribute.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_ +#include <com/sun/star/container/XNameAccess.hpp> +#endif /** === end UNO includes === **/ #ifndef _SVT_GENERICUNODIALOG_HXX_ @@ -74,7 +83,12 @@ using ::com::sun::star::uno::RuntimeException; using ::com::sun::star::beans::XPropertySetInfo; using ::com::sun::star::beans::Property; + using ::com::sun::star::lang::IllegalArgumentException; + using ::com::sun::star::sdbc::XConnection; + using ::com::sun::star::container::XNameAccess; + using ::com::sun::star::uno::Any; /** === end UNO using === **/ + namespace PropertyAttribute = ::com::sun::star::beans::PropertyAttribute; //==================================================================== //= LinkedTableDialogService @@ -91,6 +105,16 @@ private: ::comphelper::ComponentContext m_aContext; + // <properties> + ::rtl::OUString m_sTableName; + Reference< XConnection > m_xConnection; + Reference< XNameAccess > m_xTableContainer; + // <//properties> + + SfxItemSet* m_pItems; + SfxItemPool* m_pItemPool; + SfxPoolItem** m_pPoolDefaults; + public: LinkedTableDialogService( const Reference< XComponentContext >& _rxContext ); @@ -118,6 +142,7 @@ protected: virtual Dialog* createDialog( Window* _pParent ); + virtual void destroyDialog(); }; //==================================================================== @@ -127,12 +152,29 @@ LinkedTableDialogService::LinkedTableDialogService( const Reference< XComponentContext >& _rxContext ) :LinkedTableDialogService_Base( _rxContext ) ,m_aContext( _rxContext ) + ,m_pItems( NULL ) + ,m_pItemPool( NULL ) + ,m_pPoolDefaults( NULL ) { + registerProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TableName" ) ), 1000, PropertyAttribute::READONLY, + &m_sTableName, ::getCppuType( &m_sTableName ) ); + registerProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Connection" ) ), 1001, PropertyAttribute::READONLY, + &m_xConnection, ::getCppuType( &m_xConnection ) ); + registerProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TableContainer" ) ), 1002, PropertyAttribute::READONLY, + &m_xTableContainer, ::getCppuType( &m_xTableContainer ) ); } //-------------------------------------------------------------------- LinkedTableDialogService::~LinkedTableDialogService() { + // we do this here cause the base class' call to destroyDialog won't reach us anymore : we're within an dtor, + // so this virtual-method-call the base class does does not work, we're already dead then ... + if ( m_pDialog ) + { + ::osl::MutexGuard aGuard( m_aMutex ); + if ( m_pDialog ) + destroyDialog(); + } } //-------------------------------------------------------------------- @@ -144,7 +186,21 @@ //-------------------------------------------------------------------- Dialog* LinkedTableDialogService::createDialog( Window* _pParent ) { - return new LinkedTableEditor( _pParent ); + if ( !m_pItems ) + { + LinkedTableEditor::createItemSet( m_pItems, m_pItemPool, m_pPoolDefaults ); + OSL_POSTCOND( m_pItems, "LinkedTableDialogService::createDialog: createItemSet did not do what it's expected to do!" ); + } + + return new LinkedTableEditor( _pParent, m_xConnection, m_sTableName, *m_pItems ); + } + + //-------------------------------------------------------------------- + void LinkedTableDialogService::destroyDialog() + { + LinkedTableDialogService_Base::destroyDialog(); + if ( m_pItems ) + LinkedTableEditor::destroyItemSet( m_pItems, m_pItemPool, m_pPoolDefaults ); } //-------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
