[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - include/sfx2 sfx2/source sw/inc sw/source

Tamás Zolnai tamas.zolnai at collabora.com
Fri Apr 20 16:51:28 UTC 2018


 include/sfx2/shell.hxx               |    8 ++++++++
 sfx2/source/control/dispatch.cxx     |   18 +-----------------
 sfx2/source/control/shell.cxx        |   15 +++++++++++++++
 sw/inc/view.hxx                      |    2 ++
 sw/source/uibase/uiview/view2.cxx    |   15 +++++++++++++++
 sw/source/uibase/uiview/viewstat.cxx |    2 +-
 6 files changed, 42 insertions(+), 18 deletions(-)

New commits:
commit eded8ebec2961de705a0177b7422a4c8d2513ac8
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Thu Apr 19 12:10:52 2018 +0200

    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 at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit 67919621cb0b95074c4401bdfced9d87b230cc2f)
    Reviewed-on: https://gerrit.libreoffice.org/53180
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/include/sfx2/shell.hxx b/include/sfx2/shell.hxx
index 41d65d3e134b..597e3cd56b4c 100644
--- a/include/sfx2/shell.hxx
+++ b/include/sfx2/shell.hxx
@@ -482,6 +482,14 @@ public:
 
     /**
 
+        This method determines whether we need to execute without checking
+        the disabled state of the slot. This is used for dynamic conditions
+        while you can use SfxSlotMode::FASTCALL for a specific slotid in general.
+        */
+    virtual bool IsConditionalFastCall( const SfxRequest &rReq );
+
+    /**
+
         This method controls the activation of SfxShell instance. First, by calling
         the virtual method <SfxShell::Activate(sal_Bool)> which gives the subclass the
         opportunity to respond to the event.
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) );
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index a1dc5bcf9359..0e0f57fe10b2 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -501,6 +501,8 @@ public:
     void            ExecSearch(SfxRequest&);
     void            ExecViewOptions(SfxRequest &);
 
+    virtual bool    IsConditionalFastCall( const SfxRequest &rReq ) override;
+
     void            StateViewOptions(SfxItemSet &);
     void            StateSearch(SfxItemSet &);
     void            GetState(SfxItemSet&);
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 4cb021a90f3c..add13e4312c2 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -116,6 +116,7 @@
 #include <dbconfig.hxx>
 #include <dbmgr.hxx>
 #include <reffld.hxx>
+#include <comphelper/lok.hxx>
 
 #include <PostItMgr.hxx>
 
@@ -1216,6 +1217,20 @@ void SwView::Execute(SfxRequest &rReq)
         rReq.Done();
 }
 
+bool SwView::IsConditionalFastCall( const SfxRequest &rReq )
+{
+    sal_uInt16 nId = rReq.GetSlot();
+    bool bRet = false;
+
+    if (nId == FN_REDLINE_ACCEPT_DIRECT || nId == FN_REDLINE_REJECT_DIRECT)
+    {
+        if (comphelper::LibreOfficeKit::isActive())
+            bRet = true;
+    }
+    return bRet || SfxShell::IsConditionalFastCall(rReq);
+
+}
+
 /// invalidate page numbering field
 void SwView::UpdatePageNums(sal_uInt16 nPhyNum, sal_uInt16 nVirtNum, const OUString& rPgStr)
 {
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index e5387497133d..8fd1b2752fe7 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -326,7 +326,7 @@ void SwView::GetState(SfxItemSet &rSet)
                 }
 
                 // LibreOfficeKit wants to handle changes by index, so always allow here.
-                if (bDisable && !comphelper::LibreOfficeKit::isActive())
+                if (bDisable)
                     rSet.DisableItem(nWhich);
                 if (comphelper::LibreOfficeKit::isActive())
                 {


More information about the Libreoffice-commits mailing list