diff options
author | Jim Raykowski <raykowj@gmail..com> | 2019-11-02 12:51:36 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2019-11-07 00:57:48 +0100 |
commit | 25c390e17a7f1c018b5eed1ef7dfd568b76f4a84 (patch) | |
tree | edeea5ed84d237ff16b4d43d83033e0fb5d23668 /sw/source/uibase/wrtsh | |
parent | 51c23bffbd8dd9fa0b39c87a61eb051320e81f96 (diff) |
tdf#38199 Readonly mode tab key: Don't scroll if no hyperlink found
When viewing a document in readonly mode the action of the tab key is to
move among Graphic, Frame, Ole, DrawObject, or DbForm if one these is
already selected. If the cursor is inside an input field and has no multi
selection then move among InputFields. Finally if neither the previous
two cases apply then move among Hyperlinks which causes cursor position
to move to top or bottom of the document when no Hyperlink is found.
When no Hyperlink is found this patch restores the cursor position to
the position before search and does not scroll to it on EndAction.
Change-Id: I94ac882e7be124d2ddb6f86daac03a9389117cc5
Reviewed-on: https://gerrit.libreoffice.org/81955
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw/source/uibase/wrtsh')
-rw-r--r-- | sw/source/uibase/wrtsh/select.cxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index e06f3dc69777..90664ae098f5 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -941,15 +941,22 @@ void SwWrtShell::SelectNextPrevHyperlink( bool bNext ) { StartAction(); bool bRet = SwCursorShell::SelectNxtPrvHyperlink( bNext ); - if( !bRet ) + if( !bRet ) // didn't find? wrap and check again { - // will we have this feature? + SwShellCursor* pCursor = GetCursor_(); + SwCursorSaveState aSaveState(*pCursor); EnterStdMode(); if( bNext ) SttEndDoc(true); else SttEndDoc(false); - SwCursorShell::SelectNxtPrvHyperlink( bNext ); + bRet = SwCursorShell::SelectNxtPrvHyperlink(bNext); + if (!bRet) // didn't find again? restore cursor position and bail + { + pCursor->RestoreSavePos(); + EndAction(true); // don't scroll to restored cursor position + return; + } } EndAction(); |