diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-04-19 12:10:52 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-04-20 18:49:53 +0200 |
commit | eded8ebec2961de705a0177b7422a4c8d2513ac8 (patch) | |
tree | b0040f13e3d0c7a30a8d8b2e338e821ea60637d1 /sfx2 | |
parent | 6008269b9bcc6e1d6de01a5205e4884a076ff4ee (diff) |
sw lok: Accept / reject change is always enabled in the context menu
Use conditional fastcall for allow executing these two uno commands
even if there is no tracked changes at the cursor position instead of
enable the menu slots unconditionally.
See also:
b6011f07254f8003929320ad842d8d09daca0e09
Change-Id: Iaf8a8082961cd174c038fc021d2c41fb7cb97bff
Reviewed-on: https://gerrit.libreoffice.org/53148
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit 67919621cb0b95074c4401bdfced9d87b230cc2f)
Reviewed-on: https://gerrit.libreoffice.org/53180
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/control/shell.cxx | 15 |
2 files changed, 16 insertions, 17 deletions
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index b4606a7401ca..5ea2ca744ea9 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -312,22 +312,6 @@ bool SfxDispatcher::IsAppDispatcher() const return !xImp->pFrame; } -/// Decides if the request is FASTCALL or not, depending on arguments. -bool lcl_IsConditionalFastCall(SfxRequest const &rReq) -{ - sal_uInt16 nId = rReq.GetSlot(); - bool bRet = false; - - if (nId == SID_UNDO || nId == SID_REDO) - { - const SfxItemSet* pArgs = rReq.GetArgs(); - if (pArgs && pArgs->HasItem(SID_REPAIRPACKAGE)) - bRet = true; - } - - return bRet; -} - /** Helper function to check whether a slot can be executed and check the execution itself */ @@ -336,7 +320,7 @@ void SfxDispatcher::Call_Impl(SfxShell& rShell, const SfxSlot &rSlot, SfxRequest SFX_STACK(SfxDispatcher::Call_Impl); // The slot may be called (meaning enabled) - if ( rSlot.IsMode(SfxSlotMode::FASTCALL) || rShell.CanExecuteSlot_Impl(rSlot) || lcl_IsConditionalFastCall(rReq)) + if ( rSlot.IsMode(SfxSlotMode::FASTCALL) || rShell.CanExecuteSlot_Impl(rSlot) || rShell.IsConditionalFastCall(rReq)) { if ( GetFrame() ) { diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index c6c34ca14667..91d0685da5ca 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -388,6 +388,21 @@ bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot ) return aSet.GetItemState(nId) != SfxItemState::DISABLED; } +bool SfxShell::IsConditionalFastCall( const SfxRequest &rReq ) +{ + sal_uInt16 nId = rReq.GetSlot(); + bool bRet = false; + + if (nId == SID_UNDO || nId == SID_REDO) + { + const SfxItemSet* pArgs = rReq.GetArgs(); + if (pArgs && pArgs->HasItem(SID_REPAIRPACKAGE)) + bRet = true; + } + return bRet; +} + + void ShellCall_Impl( void* pObj, void* pArg ) { static_cast<SfxShell*>(pObj)->ExecuteSlot( *static_cast<SfxRequest*>(pArg) ); |