diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-03-06 15:07:01 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-03-06 20:39:13 +0100 |
commit | e3b14639dca24f5ca559044651d2140f8f4a0e74 (patch) | |
tree | 471094ff37cc147cedd93ea37acb9eb0e3946894 /sw/source/uibase/utlui/navipi.cxx | |
parent | 8d11b953c0a69f4f5eb5ca42dec3812a62d0cd0f (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/utlui/navipi.cxx')
-rw-r--r-- | sw/source/uibase/utlui/navipi.cxx | 37 |
1 files changed, 24 insertions, 13 deletions
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) |