tdf#94679 Writer: fix lost selection with Shift-PageDown

Push/Pop-ing the cursor led to selection loss.
SelectHiddenRange() immediately returns false if the current cursor
hasMark(), so avoid all of the bugs and expensive push/pop routines
when there is a mark already.

Change-Id: I4624a3e0b2267942812d0429d527ad97962ec7fc
Reviewed-on: https://gerrit.libreoffice.org/19108
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index c9b9aad..d8adc8d 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -660,9 +660,13 @@
    SfxObjectCreateMode eCreateMode =
                        GetView().GetDocShell()->GetCreateMode();

    rSh.Push();
    const bool bCrsrInHidden = rSh.SelectHiddenRange();
    rSh.Pop();
    bool bCrsrInHidden = false;
    if( !rSh.HasMark() )
    {
        rSh.Push();
        bCrsrInHidden = rSh.SelectHiddenRange();
        rSh.Pop();
    }

    while ( nWhich )
    {