sw/source/uibase/inc/navipi.hxx | 2 +- sw/source/uibase/utlui/navipi.cxx | 37 ++++++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 14 deletions(-)
New commits: commit e3b14639dca24f5ca559044651d2140f8f4a0e74 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Mar 6 15:07:01 2020 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Mar 6 20:39:13 2020 +0100 focus getting stuck in the navigator spinbutton Change-Id: I483cb726d6abc7cad41244e26811fb6e98d9fb3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90113 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/uibase/inc/navipi.hxx b/sw/source/uibase/inc/navipi.hxx index 6d48e6cda665..1404d826da83 100644 --- a/sw/source/uibase/inc/navipi.hxx +++ b/sw/source/uibase/inc/navipi.hxx @@ -101,7 +101,7 @@ class SwNavigationPI : public PanelLayout DECL_LINK( MenuSelectHdl, Menu *, bool ); DECL_LINK( ChangePageHdl, Timer*, void ); DECL_LINK( PageEditModifyHdl, weld::SpinButton&, void ); - void EditAction(); + bool EditAction(); void UsePage(); protected: diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index 5817e0a5ef05..c9c2cd1d0fa0 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -388,17 +388,28 @@ FactoryFunction SwNavigationPI::GetUITestFactory() const // Action-Handler Edit: // Switches to the page if the structure view is not turned on. -void SwNavigationPI::EditAction() +bool SwNavigationPI::EditAction() { SwView *pView = GetCreateView(); - if (pView) - { - if(m_aPageChgIdle.IsActive()) - m_aPageChgIdle.Stop(); - m_pCreateView->GetWrtShell().GotoPage(GetPageEdit().get_value(), true); - m_pCreateView->GetEditWin().GrabFocus(); - m_pCreateView->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE); - } + if (!pView) + return false; + + if (m_aPageChgIdle.IsActive()) + m_aPageChgIdle.Stop(); + + SwWrtShell &rSh = m_pCreateView->GetWrtShell(); + sal_uInt16 nNewPage = GetPageEdit().get_value(); + + sal_uInt16 nPhyPage, nVirPage; + rSh.GetPageNum(nPhyPage, nVirPage); + if (nPhyPage == nNewPage) + return false; + + rSh.GotoPage(nNewPage, true); + m_pCreateView->GetEditWin().GrabFocus(); + m_pCreateView->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE); + + return true; } void SwNavigationPI::ZoomOut() @@ -1059,11 +1070,11 @@ bool SwNavigationPI::IsGlobalDoc() const IMPL_LINK_NOARG(SwNavigationPI, ChangePageHdl, Timer *, void) { - if (!IsDisposed()) - { - EditAction(); + if (IsDisposed()) + return; + + if (EditAction()) GetPageEdit().GrabFocus(); - } } IMPL_LINK_NOARG(SwNavigationPI, PageEditModifyHdl, weld::SpinButton&, void) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits