diff options
author | Frank Schönheit <fs@openoffice.org> | 2002-10-24 07:58:10 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2002-10-24 07:58:10 +0000 |
commit | d663c10ce8c0c3b47ba6f12ece5ceff915678e72 (patch) | |
tree | a7036a4d8366be5e076af086ce0272e64d0f9ebb | |
parent | 16d40a517b245eefc6105f7b3d01bc2aa8a13405 (diff) |
#100312# (on behalf of sleepybear@openoffice.org) added interception for the ConfirmDelete URL in the grid control
-rw-r--r-- | extensions/source/bibliography/bibload.cxx | 6 | ||||
-rw-r--r-- | extensions/source/bibliography/datman.cxx | 105 | ||||
-rw-r--r-- | extensions/source/bibliography/datman.hxx | 50 |
3 files changed, 155 insertions, 6 deletions
diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index 06205d6844b1..663ea69bc895 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bibload.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: gt $ $Date: 2002-04-25 09:27:20 $ + * last change: $Author: fs $ $Date: 2002-10-24 08:58:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -493,6 +493,8 @@ void BibliographyLoader::loadView(const Reference< XFrame > & rFrame, const rtl: pParentComponent->setVisible(sal_True); m_xDatMan->load(); + // #100312# ---------- + m_pDatMan->RegisterInterceptor(pBeamer); if ( rListener.is() ) rListener->loadFinished( this ); diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 0ffef3204ba2..c777260f66ce 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -2,9 +2,9 @@ * * $RCSfile: datman.cxx,v $ * - * $Revision: 1.27 $ + * $Revision: 1.28 $ * - * last change: $Author: os $ $Date: 2002-05-08 08:50:24 $ + * last change: $Author: fs $ $Date: 2002-10-24 08:54:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -202,6 +202,10 @@ #ifndef _BIB_VIEW_HXX #include "bibview.hxx" #endif +// #100312# --------- +#ifndef ADRBEAM_HXX +#include "bibbeam.hxx" +#endif #ifndef _BIB_FMPROP_HRC #include "bibprop.hrc" #endif @@ -839,6 +843,82 @@ String DBChangeDialog_Impl::GetCurrentURL()const return sRet; } +// #100312# -------------------------------------------------------------------- +// XDispatchProvider +BibInterceptorHelper::BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch) +{ + if( pBibBeamer ) + { + xInterception = pBibBeamer->getDispatchProviderInterception(); + if( xInterception.is() ) + xInterception->registerDispatchProviderInterceptor( this ); + } + if( xDispatch.is() ) + xFormDispatch = xDispatch; +} + +BibInterceptorHelper::~BibInterceptorHelper( ) +{ +} + +BibInterceptorHelper::ReleaseInterceptor() +{ + if ( xInterception.is() ) + xInterception->releaseDispatchProviderInterceptor( this ); + xInterception.clear(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL + BibInterceptorHelper::queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException) +{ + Reference< XDispatch > xReturn; + + String aCommand( aURL.Path ); + if ( aCommand.EqualsAscii("FormSlots/ConfirmDeletion") ) + xReturn = xFormDispatch; + else + if ( xSlaveDispatchProvider.is() ) + xReturn = xSlaveDispatchProvider->queryDispatch( aURL, aTargetFrameName, nSearchFlags); + + return xReturn; +} + +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL + BibInterceptorHelper::queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException) +{ + Sequence< Reference< XDispatch> > aReturn( aDescripts.getLength() ); + Reference< XDispatch >* pReturn = aReturn.getArray(); + const DispatchDescriptor* pDescripts = aDescripts.getConstArray(); + for ( sal_Int16 i=0; i<aDescripts.getLength(); ++i, ++pReturn, ++pDescripts ) + { + *pReturn = queryDispatch( pDescripts->FeatureURL, pDescripts->FrameName, pDescripts->SearchFlags ); + } + return aReturn; +} + +// XDispatchProviderInterceptor +::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL + BibInterceptorHelper::getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException) +{ + return xSlaveDispatchProvider; +} + +void SAL_CALL BibInterceptorHelper::setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException) +{ + xSlaveDispatchProvider = xNewSlaveDispatchProvider; +} + +::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL + BibInterceptorHelper::getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException) +{ + return xMasterDispatchProvider; +} + +void SAL_CALL BibInterceptorHelper::setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException) +{ + xMasterDispatchProvider = xNewMasterDispatchProvider; +} + //----------------------------------------------------------------------------- #define STR_UID "uid" rtl::OUString gGridName(C2U("theGrid")); @@ -852,6 +932,8 @@ BibDataManager::BibDataManager() ,pToolbar(0) ,pBibView( NULL ) ,m_aLoadListeners(m_aMutex) + // #100312# -------------- + ,m_pInterceptorHelper( NULL ) { } /* -------------------------------------------------- @@ -875,6 +957,13 @@ BibDataManager::~BibDataManager() xConnection->dispose(); m_xForm = NULL; } + // #100312# ---------------- + if( m_pInterceptorHelper ) + { + m_pInterceptorHelper->ReleaseInterceptor(); + m_pInterceptorHelper->release(); + m_pInterceptorHelper = NULL; + } } //------------------------------------------------------------------------ void BibDataManager::InsertFields(const Reference< XFormComponent > & _rxGrid) @@ -1858,7 +1947,19 @@ uno::Reference< form::XFormController > BibDataManager::GetFormController() m_xFormCtrl = uno::Reference< form::XFormController > ( xMgr->createInstance(C2U("com.sun.star.form.controller.FormController")), UNO_QUERY); m_xFormCtrl->setModel(uno::Reference< awt::XTabControllerModel > (getForm(), UNO_QUERY)); + // #100312# ------------- + m_xFormDispatch = uno::Reference< frame::XDispatch > ( m_xFormCtrl, UNO_QUERY); } return m_xFormCtrl; } +// #100312# ---------- +void BibDataManager::RegisterInterceptor( ::bib::BibBeamer* pBibBeamer) +{ + DBG_ASSERT( !m_pInterceptorHelper, "BibDataManager::RegisterInterceptor: called twice!" ); + + if( pBibBeamer ) + m_pInterceptorHelper = new BibInterceptorHelper( pBibBeamer, m_xFormDispatch); + if( m_pInterceptorHelper ) + m_pInterceptorHelper->acquire(); +} diff --git a/extensions/source/bibliography/datman.hxx b/extensions/source/bibliography/datman.hxx index fc29611ebe4a..a3e35a137b0a 100644 --- a/extensions/source/bibliography/datman.hxx +++ b/extensions/source/bibliography/datman.hxx @@ -2,9 +2,9 @@ * * $RCSfile: datman.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: os $ $Date: 2002-05-08 08:50:24 $ + * last change: $Author: fs $ $Date: 2002-10-24 08:54:38 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,6 +89,16 @@ #ifndef _COMPHELPER_BROADCASTHELPER_HXX_ #include <comphelper/broadcasthelper.hxx> #endif +// #100312# -------------------- +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTOR_HPP_ +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#endif +#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDERINTERCEPTION_HPP_ +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#endif +#ifndef _CPPUHELPER_IMPLBASE1_HXX_ +#include <cppuhelper/implbase1.hxx> +#endif class Window; @@ -96,11 +106,41 @@ class Window; namespace bib { class BibView; + // #100312# ----------- + class BibBeamer; } class BibToolBar; struct BibDBDescriptor; +// #100312# --------------------- +class BibInterceptorHelper + :public cppu::WeakImplHelper1< ::com::sun::star::frame::XDispatchProviderInterceptor > +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xMasterDispatchProvider; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > xSlaveDispatchProvider; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xFormDispatch; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterception > xInterception; + +protected: + ~BibInterceptorHelper( ); + +public: + BibInterceptorHelper( ::bib::BibBeamer* pBibBeamer, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch); + + ReleaseInterceptor(); + + // XDispatchProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL queryDispatch( const ::com::sun::star::util::URL& aURL, const ::rtl::OUString& aTargetFrameName, sal_Int32 nSearchFlags ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > > SAL_CALL queryDispatches( const ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) throw (::com::sun::star::uno::RuntimeException); + // XDispatchProviderInterceptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getSlaveDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewSlaveDispatchProvider ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL getMasterDispatchProvider( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xNewMasterDispatchProvider ) throw (::com::sun::star::uno::RuntimeException); +}; + typedef cppu::WeakComponentImplHelper2 < ::com::sun::star::beans::XPropertyChangeListener , ::com::sun::star::form::XLoadable > BibDataManager_Base; @@ -114,6 +154,10 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSourceProps; ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLQueryComposer > m_xParser; ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > m_xFormCtrl; + // #100312# ------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xFormDispatch; + BibInterceptorHelper* m_pInterceptorHelper; + ::rtl::OUString aActiveDataTable; ::rtl::OUString aDataSourceURL; ::rtl::OUString aQuoteChar; @@ -201,6 +245,8 @@ public: void ResetIdentifierMapping() {sIdentifierMapping = rtl::OUString();} ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormController > GetFormController(); + // #100312# ---------- + void RegisterInterceptor( ::bib::BibBeamer* pBibBeamer); }; |