sw/source/uibase/docvw/edtwin.cxx |   12 ++++++++++++
 1 file changed, 12 insertions(+)

New commits:
commit 4437f5874203298715157cd858caf8cf7992342b
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Tue Aug 6 08:06:03 2024 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Mon Aug 12 17:59:04 2024 +0200

    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.tie...@documentfoundation.org>
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

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)

Reply via email to