desktop/source/lib/init.cxx      |    1 +
 sc/inc/inputopt.hxx              |    3 +++
 sc/inc/sc.hrc                    |    1 +
 sc/sdi/cellsh.sdi                |    2 ++
 sc/sdi/scalc.sdi                 |   15 +++++++++++++++
 sc/source/core/tool/inputopt.cxx |    1 +
 sc/source/ui/app/inputhdl.cxx    |   14 ++++++++++++++
 sc/source/ui/inc/tabvwsh.hxx     |    5 +++++
 sc/source/ui/view/cellsh3.cxx    |   20 ++++++++++++++++++++
 sc/source/ui/view/tabvwsh4.cxx   |    1 +
 10 files changed, 63 insertions(+)

New commits:
commit c5681e8d4c8ab1570c9f67d17842321229fc18c0
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Jan 5 16:42:03 2024 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Jan 8 18:33:04 2024 +0100

    uninitialized class members
    
    since:
    
    commit 284f2759dedbc2375abdbaab5258efda4a52b8f5
    Date:   Mon Dec 4 14:08:09 2023 +0000
    
        calc: Add option to keep edit mode on enter/tab
    
    Change-Id: I47431f9096e12fe84ad13a139fba60ddd88793d1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161697
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/source/core/tool/inputopt.cxx b/sc/source/core/tool/inputopt.cxx
index 13781040ee22..08d4feff60dc 100644
--- a/sc/source/core/tool/inputopt.cxx
+++ b/sc/source/core/tool/inputopt.cxx
@@ -32,6 +32,7 @@ using namespace com::sun::star::uno;
 ScInputOptions::ScInputOptions()
     : nMoveDir(DIR_BOTTOM)
     , bMoveSelection(true)
+    , bMoveKeepEdit(false)
     , bEnterEdit(false)
     , bExtendFormat(false)
     , bRangeFinder(true)
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 4b849ee7637d..1082e0613526 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1770,6 +1770,7 @@ ScTabViewShell::ScTabViewShell( SfxViewFrame& rViewFrame,
     bForceFocusOnCurCell(false),
     bInPrepareClose(false),
     bInDispose(false),
+    bMoveKeepEdit(false),
     nCurRefDlgId(0),
     mbInSwitch(false),
     m_pDragData(new ScDragData)
commit 20502992b862e5a83140b6d2b19722cdc652eeab
Author:     Skyler Grey <[email protected]>
AuthorDate: Mon Dec 4 14:08:09 2023 +0000
Commit:     Caolán McNamara <[email protected]>
CommitDate: Mon Jan 8 18:32:56 2024 +0100

    calc: Add option to keep edit mode on enter/tab
    
    This change makes it so that, rather than leaving edit mode, enter and
    tab keep editing the new cell when they have moved. This is important on
    devices with an onscreen keyboard (e.g. iPads, Android tablets,
    Convertible Laptops, etc.), particularly in Collabora Online, as exiting
    edit mode hides the onscreen keyboard.
    
    It is not desirable to enable this by default, as arrow keys cannot move
    around the document when we are in edit mode (they move within the
    cell). Therefore, this commit also adds an .uno command so that we can
    activate or deactivate the option.
    
    In LibreOfficeKit we want to make sure not to share this setting among
    different users, so we also add this option in the view shell and switch
    which one we care about based on whether Kit is active.
    
    Change-Id: I5e6c93c64af0d201a8ec045fea5546e189baca74
    Signed-off-by: Skyler Grey <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160313
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Szymon Kłos <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161696
    Tested-by: Caolán McNamara <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 95ddeff36cfa..b8acbcd9e599 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3818,6 +3818,7 @@ static void doc_iniUnoCommands ()
         u".uno:InsertPictureContentControl"_ustr,
         u".uno:DataFilterAutoFilter"_ustr,
         u".uno:CellProtection"_ustr,
+        u".uno:MoveKeepInsertMode"_ustr
     };
 
     util::URL aCommandURL;
diff --git a/sc/inc/inputopt.hxx b/sc/inc/inputopt.hxx
index 05e59aad5716..aa4b4078e5df 100644
--- a/sc/inc/inputopt.hxx
+++ b/sc/inc/inputopt.hxx
@@ -26,6 +26,7 @@ class ScInputOptions
 private:
     sal_uInt16  nMoveDir;           // enum ScDirection
     bool        bMoveSelection;
+    bool        bMoveKeepEdit;
     bool        bEnterEdit;
     bool        bExtendFormat;
     bool        bRangeFinder;
@@ -47,6 +48,8 @@ public:
     bool        GetMoveSelection() const        { return bMoveSelection; }
     void        SetEnterEdit(bool bSet)         { bEnterEdit = bSet;     }
     bool        GetEnterEdit() const            { return bEnterEdit;     }
+    void        SetMoveKeepEdit(bool bSet)      { bMoveKeepEdit = bSet;  }
+    bool        GetMoveKeepEdit() const         { return bMoveKeepEdit;  }
     void        SetExtendFormat(bool bSet)      { bExtendFormat = bSet;  }
     bool        GetExtendFormat() const         { return bExtendFormat;  }
     void        SetRangeFinder(bool bSet)       { bRangeFinder = bSet;   }
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index f6f445fc5a2e..54d4c0b5a0e2 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -247,6 +247,7 @@ class SvxZoomSliderItem;
 
 #define SID_OPEN_CALC                   (SC_FUNCTION_START + 4)
 #define SID_CONVERT_FORMULA_TO_VALUE    (SC_FUNCTION_START + 5)
+#define FID_MOVE_KEEP_INSERT_MODE       (SC_FUNCTION_START + 6)
 #ifndef FILE_MENU_END // duplicated in sfx2/sfxsids.hrc
 #define FILE_MENU_END                   (SC_FUNCTION_START + 20)
 #endif
diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi
index 84217c63c949..7370d142607e 100644
--- a/sc/sdi/cellsh.sdi
+++ b/sc/sdi/cellsh.sdi
@@ -446,6 +446,8 @@ interface CellMovement
     ]
     SID_DATA_SELECT         [ ExecMethod = Execute; StateMethod = GetState; ]
     SID_DETECTIVE_FILLMODE  [ ExecMethod = Execute; StateMethod = GetState; ] 
// api:
+
+    FID_MOVE_KEEP_INSERT_MODE [ ExecMethod = Execute; ]
 }
 
 
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index d26e99ce2f5d..38151604a3d9 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -6685,3 +6685,18 @@ SfxVoidItem AutoSum SID_AUTO_SUM
     ToolBoxConfig = TRUE,
     GroupId = SfxGroupId::Intern;
 ]
+
+
+SfxVoidItem MoveKeepInsertMode FID_MOVE_KEEP_INSERT_MODE
+(SfxBoolItem Enable FID_MOVE_KEEP_INSERT_MODE)
+[
+    AutoUpdate = FALSE,
+    FastCall = FALSE,
+    ReadOnlyDoc = FALSE,
+    Toggle = FALSE,
+    Container = FALSE,
+    RecordAbsolute = FALSE,
+    RecordPerSet;
+
+    GroupId = SfxGroupId::Application;
+]
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 4c627e4bac6a..0074d9439bad 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3811,6 +3811,14 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, 
bool bStartEdit /* = false
 
         if (pActiveViewSh)
             pActiveViewSh->FindNextUnprot( bShift, true );
+
+        ScModule* pScMod = SC_MOD();
+        const ScInputOptions& rOpt = pScMod->GetInputOptions();
+
+        if ( (rOpt.GetMoveKeepEdit() && 
!comphelper::LibreOfficeKit::isActive())
+             || (pActiveViewSh->GetMoveKeepEdit() && 
comphelper::LibreOfficeKit::isActive()) )
+            pScMod->SetInputMode( SC_INPUT_TABLE );
+
         return true;
     }
 
@@ -3851,6 +3859,12 @@ bool ScInputHandler::KeyInput( const KeyEvent& rKEvt, 
bool bStartEdit /* = false
                 if (pActiveViewSh)
                     pActiveViewSh->MoveCursorEnter( bShift && !bControl );
 
+                ScModule* pScMod = SC_MOD();
+                const ScInputOptions& rOpt = pScMod->GetInputOptions();
+                if ( (rOpt.GetMoveKeepEdit() && 
!comphelper::LibreOfficeKit::isActive())
+                    || (pActiveViewSh->GetMoveKeepEdit() && 
comphelper::LibreOfficeKit::isActive()) )
+                    pScMod->SetInputMode( SC_INPUT_TABLE );
+
                 bUsed = true;
             }
             break;
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 47c5c46e1bb0..797ca0f621d8 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -176,6 +176,8 @@ private:
     bool                    bInPrepareClose;
     bool                    bInDispose;
 
+    bool                    bMoveKeepEdit;
+
     sal_uInt16              nCurRefDlgId;
 
     std::unique_ptr<SfxBroadcaster> pAccessibilityBroadcaster;
@@ -439,6 +441,9 @@ public:
     void ResetDragObject();
     void SetDragLink(const OUString& rDoc, const OUString& rTab, const 
OUString& rArea);
     void SetDragJump(ScDocument* pLocalDoc, const OUString& rTarget, const 
OUString& rText);
+
+    void SetMoveKeepEdit(bool value) { bMoveKeepEdit = value; };
+    bool GetMoveKeepEdit() { return bMoveKeepEdit; };
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx
index e6c89b6a2b9c..b7bd2daa4450 100644
--- a/sc/source/ui/view/cellsh3.cxx
+++ b/sc/source/ui/view/cellsh3.cxx
@@ -40,6 +40,7 @@
 #include <autoform.hxx>
 #include <cellsh.hxx>
 #include <inputhdl.hxx>
+#include <inputopt.hxx>
 #include <editable.hxx>
 #include <funcdesc.hxx>
 #include <markdata.hxx>
@@ -1087,6 +1088,25 @@ void ScCellShell::Execute( SfxRequest& rReq )
             OSL_FAIL("old slot SID_MARKAREA");
             break;
 
+        case FID_MOVE_KEEP_INSERT_MODE:
+        {
+            const SfxBoolItem* pEnabledArg = 
rReq.GetArg<SfxBoolItem>(FID_MOVE_KEEP_INSERT_MODE);
+            if (!pEnabledArg) {
+                SAL_WARN("sfx.appl", "FID_MOVE_KEEP_INSERT_MODE: must specify 
if you would like this to be enabled");
+                break;
+            }
+
+            ScInputOptions aInputOptions = pScMod->GetInputOptions();
+
+            aInputOptions.SetMoveKeepEdit(pEnabledArg->GetValue());
+            pScMod->SetInputOptions(aInputOptions);
+
+            if (comphelper::LibreOfficeKit::isActive())
+                pTabViewShell->SetMoveKeepEdit(pEnabledArg->GetValue());
+
+            break;
+        }
+
         default:
             OSL_FAIL("ScCellShell::Execute: unknown slot");
             break;

Reply via email to