tdf#134023 sw ui: stay at footer ONLY when showing control

This adds a missing piece to LO 6.4's
commit 342a5890dbcddccb4013e201e3ff3d9e6967e733

That tdf#84929 commit message suggested:
  One additional limitation could be added to only apply this
  if it is dealing with the footer, since in the case of a
  header there would be no screen-jump.

and this bug report shows why that is necessary.
I'm not sure why I didn't apply that immediately.
Perhaps to help identify situations where the entire
concept might be bad?

Change-Id: Icea861bec45262eed88c38bb7eea910289c06870
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96487
Tested-by: Justin Luth <justin_luth@sil.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
(cherry picked from commit c3cf3e908add6b6617eb0ee12385fbd8a70a9887)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96494
Tested-by: Jenkins
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
(cherry picked from commit df4585686eb56d95a871dd528ad06fd980a58591)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96505
(cherry picked from commit c441cc1529d21cb9dd9aac92f28601ff8b111745)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96703
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 0cf38b1..6a5c786 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2843,10 +2843,12 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                    // Repaint everything
                    Invalidate();

                    // If the control had not been showing, do not return to the cursor position,
                    // tdf#84929. If the footer control had not been showing, do not change the cursor position,
                    // because the user may have scrolled to turn on the separator control and
                    // if the cursor is now off-screen, then the user would need to scroll back again to use the control.
                    if ( !bSeparatorWasVisible && rSh.GetViewOptions()->IsUseHeaderFooterMenu() && !Application::IsHeadlessModeEnabled() )
                    // if the cursor cannot be positioned on-screen, then the user would need to scroll back again to use the control.
                    // This should only be done for the footer. The cursor can always be re-positioned near the header. tdf#134023.
                    if ( eControl == FrameControlType::Footer && !bSeparatorWasVisible
                         && rSh.GetViewOptions()->IsUseHeaderFooterMenu() && !Application::IsHeadlessModeEnabled() )
                        return;
                }
            }