summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2024-08-06 08:06:03 -0800
committerJim Raykowski <raykowj@gmail.com>2024-08-12 17:59:04 +0200
commit4437f5874203298715157cd858caf8cf7992342b (patch)
tree5af62005c8b50e2569a3e5486c26145d76a5482d /sw
parenta9577dd52d4bcf273bae4abbc8f168eab777172d (diff)
Resolves: tdf#112932 Pressing enter in read-ony Table of Content
doesnt jump to heading Allows jump to heading using the Enter key or key modifier one in combination with the Enter key (Ctrl+Enter) when table of content is in protected mode. This changes the previous behavior of only allowing the Enter key to jump to the heading when the document is in read-only mode to also allowing key modifier one in combination with the Enter key to jump to the heading. Change-Id: Ib7451cef40d3ecf56295c2b23a6e663fad18fece Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171554 Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 99843fb243f2..6351f6e2b1b9 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -1699,6 +1699,17 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt)
End };
SwKeyState eKeyState = bIsViewReadOnly ? SwKeyState::CheckDocReadOnlyKeys : SwKeyState::CheckKey;
+
+ // tdf#112932 Pressing enter in read-ony Table of Content doesnt jump to heading
+ if (!bIsViewReadOnly
+ && ((rKeyCode.GetModifier() | rKeyCode.GetCode()) == KEY_RETURN
+ || (rKeyCode.GetModifier() | rKeyCode.GetCode()) == (KEY_MOD1 | KEY_RETURN)))
+ {
+ const SwTOXBase* pTOXBase = rSh.GetCurTOX();
+ if (pTOXBase && SwEditShell::IsTOXBaseReadonly(*pTOXBase))
+ eKeyState = SwKeyState::CheckDocReadOnlyKeys;
+ }
+
SwKeyState eNextKeyState = SwKeyState::End;
sal_uInt8 nDir = 0;
@@ -2350,6 +2361,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
}
break;
case KEY_RETURN:
+ case KEY_RETURN | KEY_MOD1:
{
const SelectionType nSelectionType = rSh.GetSelectionType();
if(nSelectionType & SelectionType::Frame)