summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
authorSkyler Grey <skyler.grey@collabora.com>2023-12-04 14:08:09 +0000
committerAndras Timar <andras.timar@collabora.com>2024-01-16 22:11:38 +0100
commitdee7f73d312d063c8a445dbcb735bb8fa23fa61b (patch)
tree8fd63dd49d2186e177861784a187f96530ce22d9 /sc/source/ui
parent6a20e8ae6c7d60ea39df4e2308f57880d64b7229 (diff)
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 <skyler.grey@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160313 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161696 Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/app/inputhdl.cxx14
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx5
-rw-r--r--sc/source/ui/view/cellsh3.cxx20
3 files changed, 39 insertions, 0 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 809ba8520e33..e7e7f6041c8a 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 b537af6900d2..fff123aa1bc6 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -174,6 +174,8 @@ private:
bool bInPrepareClose;
bool bInDispose;
+ bool bMoveKeepEdit;
+
sal_uInt16 nCurRefDlgId;
std::unique_ptr<SfxBroadcaster> pAccessibilityBroadcaster;
@@ -437,6 +439,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;