diff options
author | Mathias Bauer <mba@openoffice.org> | 2001-10-11 08:12:09 +0000 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2001-10-11 08:12:09 +0000 |
commit | ff0cc6ade96d94f5a80719947e88fd01764a572a (patch) | |
tree | 0d6716e130efa774d36a939ce1481d4a9cb32e18 /sfx2 | |
parent | 2e4d24c980c17c1653f5cb84d8e79bdf4622e151 (diff) |
#92355#: execute slot dispatches using some bindings support
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/bindings.cxx | 45 | ||||
-rw-r--r-- | sfx2/source/control/unoctitm.cxx | 34 |
2 files changed, 50 insertions, 29 deletions
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 2740421e1461..895f8bb6f688 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bindings.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: mba $ $Date: 2001-09-06 13:56:35 $ + * last change: $Author: mba $ $Date: 2001-10-11 09:12:08 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1559,15 +1559,33 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* aReq.SetInternalArgs_Impl( aSet ); } + Execute_Impl( aReq, pSlot, pShell ); + + const SfxPoolItem* pRet = aReq.GetReturnValue(); + if ( !pRet ) + { + SfxPoolItem *pVoid = new SfxVoidItem( nId ); + DeleteItemOnIdle( pVoid ); + pRet = pVoid; + } + + if ( bDeleteCache ) + delete pCache; + + return pRet; +} + +void SfxBindings::Execute_Impl( SfxRequest& aReq, const SfxSlot* pSlot, SfxShell* pShell ) +{ + SfxItemPool &rPool = pShell->GetPool(); if ( SFX_KIND_ENUM == pSlot->GetKind() ) { // bei Enum-Slots muss der Master mit dem Wert des Enums executet werden const SfxSlot *pRealSlot = pShell->GetInterface()->GetRealSlot(pSlot); const sal_uInt16 nSlotId = pRealSlot->GetSlotId(); aReq.SetSlot( nSlotId ); - aReq.AppendItem( SfxAllEnumItem( rPool.GetWhich(nSlotId), - pSlot->GetValue() ) ); - rDispatcher._Execute( *pShell, *pRealSlot, aReq, nCallMode | SFX_CALLMODE_RECORD ); + aReq.AppendItem( SfxAllEnumItem( rPool.GetWhich(nSlotId), pSlot->GetValue() ) ); + pDispatcher->_Execute( *pShell, *pRealSlot, aReq, aReq.GetCallMode() ); } else if ( SFX_KIND_ATTR == pSlot->GetKind() ) { @@ -1638,23 +1656,10 @@ const SfxPoolItem* SfxBindings::Execute_Impl( sal_uInt16 nId, const SfxPoolItem* DBG_ERROR( "suspicious Toggle-Slot" ); } - rDispatcher._Execute( *pShell, *pSlot, aReq, nCallMode | SFX_CALLMODE_RECORD ); + pDispatcher->_Execute( *pShell, *pSlot, aReq, aReq.GetCallMode() ); } else - rDispatcher._Execute( *pShell, *pSlot, aReq, nCallMode | SFX_CALLMODE_RECORD ); - - const SfxPoolItem* pRet = aReq.GetReturnValue(); - if ( !pRet ) - { - SfxPoolItem *pVoid = new SfxVoidItem( nId ); - DeleteItemOnIdle( pVoid ); - pRet = pVoid; - } - - if ( bDeleteCache ) - delete pCache; - - return pRet; + pDispatcher->_Execute( *pShell, *pSlot, aReq, aReq.GetCallMode() ); } //-------------------------------------------------------------------- diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 83251be56c17..28c2b34aeebe 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoctitm.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: mba $ $Date: 2001-09-07 14:16:03 $ + * last change: $Author: mba $ $Date: 2001-10-11 09:12:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,6 +101,7 @@ #include "bindings.hxx" #include "dispatch.hxx" #include "sfxsids.hrc" +#include "request.hxx" using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; @@ -485,15 +486,30 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util } } - if ( aSet.Count() ) - pDispatcher->Execute( GetId(), nCall, aSet ); + if ( pDispatcher->GetBindings() ) + { + // execute using bindings, enables support for toggle/enum etc. + if ( pDispatcher->IsLocked( GetId() ) ) + return; + + SfxShell *pShell = 0; + const SfxSlot *pSlot = 0; + if ( pDispatcher->GetShellAndSlot_Impl( GetId(), &pShell, &pSlot, sal_False, + SFX_CALLMODE_MODAL==(nCall&SFX_CALLMODE_MODAL) ) ) + { + SfxRequest aReq( GetId(), nCall, aSet ); + pDispatcher->GetBindings()->Execute_Impl( aReq, pSlot, pShell ); + } + } else - // SfxRequests take empty sets as argument sets, GetArgs() returning non-zero! - pDispatcher->Execute( GetId(), nCall ); - - if ( !pDispatcher->GetBindings() ) { - // no bindings, no invalidate! + if ( aSet.Count() ) + pDispatcher->Execute( GetId(), nCall, aSet ); + else + // SfxRequests take empty sets as argument sets, GetArgs() returning non-zero! + pDispatcher->Execute( GetId(), nCall ); + + // no bindings, no invalidate ( usually done in SfxDispatcher::Call_Impl()! ) const SfxPoolItem* pState=0; SfxItemState eState = pDispatcher->QueryState( GetId(), pState ); StateChanged( GetId(), eState, pState ); |