summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-03-06 15:07:01 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-03-06 20:39:13 +0100
commite3b14639dca24f5ca559044651d2140f8f4a0e74 (patch)
tree471094ff37cc147cedd93ea37acb9eb0e3946894
parent8d11b953c0a69f4f5eb5ca42dec3812a62d0cd0f (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>
-rw-r--r--sw/source/uibase/inc/navipi.hxx2
-rw-r--r--sw/source/uibase/utlui/navipi.cxx37
2 files changed, 25 insertions, 14 deletions
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)