tdf#158783 sw: SwCursorShell::GotoTOXMark() must actually move cursor

The problem was that the buttons in SwIndexMarkPane got the
next/previous mark, but SwCursorShell::GotoTOXMark() may return the
next/previous mark without actually moving the cursor.

It happens that the current mark is outside a table and the next mark is
inside a table, then UpdateCursor() doesn't accept the invalid cursor
range and resets the point to its previous position.

Change-Id: I5c0fb4a9bbcbdd479581172834b6eda76a5abbc1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161970
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 3fefff7ce29a234694343105c50c7bc3259a9cb8)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161949
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index db11d4e..8132378 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -600,6 +600,7 @@ const SwTOXMark& SwCursorShell::GotoTOXMark( const SwTOXMark& rStart,
    SwPosition& rPos = *GetCursor()->GetPoint();
    rPos.Assign(rNewMark.GetTextTOXMark()->GetTextNode(),
                 rNewMark.GetTextTOXMark()->GetStart() );
    GetCursor()->DeleteMark(); // tdf#158783 prevent UpdateCursor resetting point

    if( !m_pCurrentCursor->IsSelOvr() )
        UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE |