Tag: cws_src680_oj14 User: oj Date: 2006/12/21 04:30:05 Modified: dba/dbaccess/source/ui/browser/genericcontroller.cxx dba/dbaccess/source/ui/inc/querycontroller.hxx dba/dbaccess/source/ui/misc/singledoccontroller.cxx dba/dbaccess/source/ui/querydesign/querycontroller.cxx
Log: impl selectionSupplier File Changes: Directory: /dba/dbaccess/source/ui/browser/ =========================================== File [changed]: genericcontroller.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/browser/genericcontroller.cxx?r1=1.66.4.6&r2=1.66.4.7 Delta lines: +51 -3 -------------------- --- genericcontroller.cxx 13 Nov 2006 13:23:56 -0000 1.66.4.6 +++ genericcontroller.cxx 21 Dec 2006 12:30:02 -0000 1.66.4.7 @@ -4,9 +4,9 @@ * * $RCSfile: genericcontroller.cxx,v $ * - * $Revision: 1.66.4.6 $ + * $Revision: 1.66.4.7 $ * - * last change: $Author: oj $ $Date: 2006/11/13 13:23:56 $ + * last change: $Author: oj $ $Date: 2006/12/21 12:30:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -168,6 +168,8 @@ #endif ,m_aAsyncInvalidateAll(LINK(this, OGenericUnoController, OnAsyncInvalidateAll)) ,m_aAsyncCloseTask(LINK(this, OGenericUnoController, OnAsyncCloseTask)) + ,m_aSelectionListeners(m_aMutex) + ,m_aSelectionListeners(m_aMutex) ,m_xServiceFactory(_rM) ,m_pView(NULL) ,m_bPreview(sal_False) @@ -824,7 +826,9 @@ { aIter->xListener->disposing(aDisposeEvent); } + m_aSelectionListeners.disposeAndClear( aDisposeEvent ); m_arrStatusListener.clear(); + m_aSelectionListeners.disposeAndClear( aDisposeEvent ); } m_xDatabaseContext = NULL; @@ -1319,7 +1323,9 @@ // ----------------------------------------------------------------------------- sal_Bool OGenericUnoController::isCommandChecked(sal_uInt16 _nCommandId) const { - return (sal_Bool)*GetState( _nCommandId ).bChecked; + FeatureState aState = GetState( _nCommandId ); + + return aState.bChecked && (sal_Bool)*aState.bChecked; } // ----------------------------------------------------------------------------- sal_Bool OGenericUnoController::isCommandEnabled(const ::com::sun::star::util::URL& _rCommand) const @@ -1388,7 +1394,49 @@ m_bDescribingSupportedFeatures = true; #endif describeSupportedFeatures(); +// ----------------------------------------------------------------------------- +::sal_Bool SAL_CALL OGenericUnoController::select( const Any& /*xSelection*/ ) throw (IllegalArgumentException, RuntimeException) +{ + return sal_False; +} +// ----------------------------------------------------------------------------- +Any SAL_CALL OGenericUnoController::getSelection( ) throw (RuntimeException) +{ + return Any(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OGenericUnoController::addSelectionChangeListener( const Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (RuntimeException) +{ + m_aSelectionListeners.addInterface(xListener); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OGenericUnoController::removeSelectionChangeListener( const Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (RuntimeException) +{ + m_aSelectionListeners.removeInterface(xListener); +} +// ----------------------------------------------------------------------------- #if DBG_UTIL m_bDescribingSupportedFeatures = false; #endif } +// ----------------------------------------------------------------------------- +::sal_Bool SAL_CALL OGenericUnoController::select( const Any& /*xSelection*/ ) throw (IllegalArgumentException, RuntimeException) +{ + return sal_False; +} +// ----------------------------------------------------------------------------- +Any SAL_CALL OGenericUnoController::getSelection( ) throw (RuntimeException) +{ + return Any(); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OGenericUnoController::addSelectionChangeListener( const Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (RuntimeException) +{ + m_aSelectionListeners.addInterface(xListener); +} +// ----------------------------------------------------------------------------- +void SAL_CALL OGenericUnoController::removeSelectionChangeListener( const Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (RuntimeException) +{ + m_aSelectionListeners.removeInterface(xListener); +} +// ----------------------------------------------------------------------------- Directory: /dba/dbaccess/source/ui/inc/ ======================================= File [changed]: querycontroller.hxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/inc/querycontroller.hxx?r1=1.32.8.2&r2=1.32.8.3 Delta lines: +36 -4 -------------------- --- querycontroller.hxx 7 Nov 2006 09:32:12 -0000 1.32.8.2 +++ querycontroller.hxx 21 Dec 2006 12:30:02 -0000 1.32.8.3 @@ -4,9 +4,9 @@ * * $RCSfile: querycontroller.hxx,v $ * - * $Revision: 1.32.8.2 $ + * $Revision: 1.32.8.3 $ * - * last change: $Author: oj $ $Date: 2006/11/07 09:32:12 $ + * last change: $Author: oj $ $Date: 2006/12/21 12:30:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -56,6 +56,12 @@ #ifndef _CONNECTIVITY_SQLPARSE_HXX #include <connectivity/sqlparse.hxx> #endif +#ifndef _COMPHELPER_UNO3_HXX_ +#include <comphelper/uno3.hxx> +#endif +#ifndef _COMPHELPER_UNO3_HXX_ +#include <comphelper/uno3.hxx> +#endif #ifndef _CONNECTIVITY_SQLNODE_HXX #include <connectivity/sqlnode.hxx> #endif @@ -86,10 +92,20 @@ class OTableConnectionData; class OTableWindowData; class OAddTableDlg; + typedef ::comphelper::OPropertyContainer OQueryController_PBASE; + typedef ::comphelper::OPropertyArrayUsageHelper < OQueryController + > OQueryController_PABASE; class OTableFieldDesc; + ,public OQueryController_PBASE + ,public OQueryController_PABASE class OQueryTableWindow; + typedef ::comphelper::OPropertyContainer OQueryController_PBASE; + typedef ::comphelper::OPropertyArrayUsageHelper < OQueryController + > OQueryController_PABASE; class OQueryController : public OJoinController + ,public OQueryController_PBASE + ,public OQueryController_PABASE { OTableFields m_vTableFieldDesc; OTableFields m_vUnUsedFieldsDesc; // contains fields which aren't visible and don't have any criteria @@ -148,7 +164,7 @@ public: OQueryController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rM); - ~OQueryController(); + virtual ~OQueryController(); OTableFields& getTableFieldDesc() { return m_vTableFieldDesc; } OTableFields& getUnUsedFields() { return m_vUnUsedFieldsDesc; } @@ -170,6 +186,12 @@ void setVisibleRows(sal_Int32 _nVisibleRows) { m_nVisibleRows = _nVisibleRows;} ::connectivity::OSQLParser& getParser() { return m_aSqlParser; } + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + // XPropertySet + virtual com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + ::connectivity::OSQLParseTreeIterator& getParseIterator() { return *m_pSqlIterator; } sal_uInt32 getColWidth(sal_uInt16 _nPos) const { @@ -178,9 +200,17 @@ virtual sal_Bool Construct(Window* pParent); + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + // XPropertySet + virtual com::sun::star::uno::Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + // XEventListener virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; // ::com::sun::star::lang::XComponent virtual void SAL_CALL disposing(); @@ -195,6 +225,8 @@ protected: virtual void onLoadedMenu(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager); + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; virtual OTableWindowData* createTableWindowData(); virtual OJoinDesignView* getJoinView(); Directory: /dba/dbaccess/source/ui/misc/ ======================================== File [changed]: singledoccontroller.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/misc/singledoccontroller.cxx?r1=1.16.4.7&r2=1.16.4.8 Delta lines: +3 -103 --------------------- --- singledoccontroller.cxx 13 Nov 2006 13:23:56 -0000 1.16.4.7 +++ singledoccontroller.cxx 21 Dec 2006 12:30:02 -0000 1.16.4.8 @@ -4,9 +4,9 @@ * * $RCSfile: singledoccontroller.cxx,v $ * - * $Revision: 1.16.4.7 $ + * $Revision: 1.16.4.8 $ * - * last change: $Author: oj $ $Date: 2006/11/13 13:23:56 $ + * last change: $Author: oj $ $Date: 2006/12/21 12:30:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -113,51 +113,6 @@ using namespace frame; using namespace util; - - //==================================================================== - //= OConnectionChangeBroadcaster - //==================================================================== - class OConnectionChangeBroadcaster - { - private: - OSingleDocumentController* m_pController; - Reference< XConnection > m_xOldConnection; - - public: - OConnectionChangeBroadcaster( OSingleDocumentController* _pController ); - ~OConnectionChangeBroadcaster(); - }; - - DBG_NAME(OConnectionChangeBroadcaster) - //-------------------------------------------------------------------- - OConnectionChangeBroadcaster::OConnectionChangeBroadcaster( OSingleDocumentController* _pController ) - :m_pController( _pController ) - { - DBG_CTOR(OConnectionChangeBroadcaster,NULL); - DBG_ASSERT( m_pController, "OConnectionChangeBroadcaster::OConnectionChangeBroadcaster: invalid controller!" ); - if ( m_pController ) - m_xOldConnection = m_pController->getConnection(); - } - - //-------------------------------------------------------------------- - OConnectionChangeBroadcaster::~OConnectionChangeBroadcaster() - { - DBG_DTOR(OConnectionChangeBroadcaster,NULL); - if ( m_pController ) - { - // has the connection change while we were constructed? - Reference< XConnection > xNewConnection = m_pController->getConnection(); - if ( m_xOldConnection.get() != xNewConnection.get() ) - { - // yes -> fire the property change - sal_Int32 mHandle = PROPERTY_ID_ACTIVECONNECTION; - Any aNewValue = makeAny( xNewConnection ); - Any aOldValue = makeAny( m_xOldConnection ); - m_pController->fire( &mHandle, &aNewValue, &aOldValue, 1, sal_False ); - } - } - } - struct OSingleDocumentControllerImpl { OModuleClient m_aModuleClient; @@ -192,39 +147,14 @@ //-------------------------------------------------------------------- OSingleDocumentController::OSingleDocumentController(const Reference< XMultiServiceFactory >& _rxORB) :OSingleDocumentController_CBASE( _rxORB ) - ,OSingleDocumentController_PBASE( getBroadcastHelper() ) ,m_pImpl(new OSingleDocumentControllerImpl()) { -// registerProperty( PROPERTY_ACTIVECONNECTION, PROPERTY_ID_ACTIVECONNECTION, PropertyAttribute::READONLY | PropertyAttribute::BOUND, -// &m_xConnection, ::getCppuType( &m_xConnection ) ); - // TODO: is this still needed? } //-------------------------------------------------------------------- OSingleDocumentController::~OSingleDocumentController() { } //-------------------------------------------------------------------- - Any SAL_CALL OSingleDocumentController::queryInterface( const Type& _rType ) throw (RuntimeException) - { - Any aReturn = OSingleDocumentController_CBASE::queryInterface( _rType ); - if ( !aReturn.hasValue() ) - aReturn = OSingleDocumentController_PBASE::queryInterface( _rType ); - return aReturn; - } - - //-------------------------------------------------------------------- - void SAL_CALL OSingleDocumentController::acquire( ) throw () - { - OSingleDocumentController_CBASE::acquire(); - } - - //-------------------------------------------------------------------- - void SAL_CALL OSingleDocumentController::release( ) throw () - { - OSingleDocumentController_CBASE::release(); - } - - //-------------------------------------------------------------------- Sequence<sal_Int8> SAL_CALL OSingleDocumentController::getImplementationId( ) throw(RuntimeException) { static ::cppu::OImplementationId * pId = 0; @@ -243,37 +173,11 @@ //-------------------------------------------------------------------- Sequence< Type > SAL_CALL OSingleDocumentController::getTypes( ) throw (RuntimeException) { - return ::comphelper::concatSequences( - OSingleDocumentController_CBASE::getTypes(), - OSingleDocumentController_PBASE::getTypes() - ); - } - - //------------------------------------------------------------------------- - Reference<XPropertySetInfo> SAL_CALL OSingleDocumentController::getPropertySetInfo() throw(RuntimeException) - { - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; - } - - //------------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper& OSingleDocumentController::getInfoHelper() - { - return *const_cast<OSingleDocumentController*>(this)->getArrayHelper(); - } - - //-------------------------------------------------------------------- - ::cppu::IPropertyArrayHelper* OSingleDocumentController::createArrayHelper( ) const - { - Sequence< Property > aProps; - describeProperties(aProps); - return new ::cppu::OPropertyArrayHelper(aProps); + return OSingleDocumentController_CBASE::getTypes(); } //-------------------------------------------------------------------- void OSingleDocumentController::initializeConnection( const Reference< XConnection >& _rxForeignConn ) { - OConnectionChangeBroadcaster( this ); - DBG_ASSERT( !isConnected(), "OSingleDocumentController::initializeConnection: not to be called when already connected!" ); // usually this gets called from within initialize of derived classes ... if ( isConnected() ) @@ -322,7 +226,6 @@ void OSingleDocumentController::reconnect( sal_Bool _bUI ) { OSL_ENSURE(!m_pImpl->m_bSuspended, "Cannot reconnect while suspended!"); - OConnectionChangeBroadcaster( this ); stopConnectionListening( m_pImpl->m_xConnection ); m_pImpl->m_aSdbMetaData.reset( NULL ); @@ -350,8 +253,6 @@ //-------------------------------------------------------------------- void OSingleDocumentController::disconnect() { - OConnectionChangeBroadcaster( this ); - stopConnectionListening(m_pImpl->m_xConnection); m_pImpl->m_aSdbMetaData.reset( NULL ); m_pImpl->m_xConnection.clear(); @@ -370,7 +271,6 @@ void SAL_CALL OSingleDocumentController::disposing() { OSingleDocumentController_CBASE::disposing(); - OSingleDocumentController_PBASE::disposing(); m_aUndoManager.Clear(); disconnect(); Directory: /dba/dbaccess/source/ui/querydesign/ =============================================== File [changed]: querycontroller.cxx Url: http://dba.openoffice.org/source/browse/dba/dbaccess/source/ui/querydesign/querycontroller.cxx?r1=1.102.4.4&r2=1.102.4.5 Delta lines: +28 -3 -------------------- --- querycontroller.cxx 18 Dec 2006 16:24:53 -0000 1.102.4.4 +++ querycontroller.cxx 21 Dec 2006 12:30:03 -0000 1.102.4.5 @@ -4,9 +4,9 @@ * * $RCSfile: querycontroller.cxx,v $ * - * $Revision: 1.102.4.4 $ + * $Revision: 1.102.4.5 $ * - * last change: $Author: oj $ $Date: 2006/12/18 16:24:53 $ + * last change: $Author: oj $ $Date: 2006/12/21 12:30:03 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -388,6 +388,7 @@ // ----------------------------------------------------------------------------- OQueryController::OQueryController(const Reference< XMultiServiceFactory >& _rM) :OJoinController(_rM) + ,OQueryController_PBASE( getBroadcastHelper() ) ,m_pParseContext( new svxform::OSystemParseContext ) ,m_aSqlParser( _rM, m_pParseContext ) ,m_pSqlIterator(NULL) @@ -422,6 +423,9 @@ } } // ----------------------------------------------------------------------------- +IMPLEMENT_FORWARD_XINTERFACE2(OQueryController,OSingleDocumentController,OQueryController_PBASE) +IMPLEMENT_FORWARD_XTYPEPROVIDER2(OQueryController,OSingleDocumentController,OQueryController_PBASE) +// ----------------------------------------------------------------------------- void OQueryController::deleteIterator() { if(m_pSqlIterator) @@ -435,6 +439,8 @@ // ----------------------------------------------------------------------------- void OQueryController::disposing() { + OQueryController_PBASE::disposing(); + deleteIterator(); delete m_pParseContext; @@ -1648,6 +1654,25 @@ } // ----------------------------------------------------------------------------- +Reference<XPropertySetInfo> SAL_CALL OQueryController::getPropertySetInfo() throw(RuntimeException) +{ + Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} +// ----------------------------------------------------------------------------- +//------------------------------------------------------------------------- +::cppu::IPropertyArrayHelper& OQueryController::getInfoHelper() +{ + return *const_cast<OQueryController*>(this)->getArrayHelper(); +} + +//-------------------------------------------------------------------- +::cppu::IPropertyArrayHelper* OQueryController::createArrayHelper( ) const +{ + Sequence< Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} } // namespace dbaui // ----------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
