summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-06-03 20:31:58 -0800
committerJim Raykowski <raykowj@gmail.com>2020-06-04 09:56:58 +0200
commitea59cd05e84849c3fde514b7070081af4a052360 (patch)
tree799f9a897f4e6981e0cd7874bda353897b235c56 /sw
parentcbcd40a7ab1db1d312fcfcb1c1dad55a2a971377 (diff)
tdf#101211 follow-up: move cursor to start of next/prev pg UNO functions
This is a follow-up patch that fixes the cursor not moving to the start of the page when multiple pages are visible. The cursor move behavior is; if the cursor is visible, the page number the cursor is visible on is used as the reference. If the cursor is not visible, the page number of the first visible page is used as the reference. Change-Id: Ibdfaa763bf7283e46d8c68270dfa6b5f0012ca0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95476 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/uiview/view2.cxx52
1 files changed, 28 insertions, 24 deletions
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index fca753fe6a20..13cfcc930f3b 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -572,32 +572,36 @@ void SwView::Execute(SfxRequest &rReq)
case FN_TO_PREV_PAGE:
case FN_TO_NEXT_PAGE:
{
- SwFrame* pPageFrame = m_pWrtShell->Imp()->GetFirstVisPage(m_pWrtShell->GetOut());
- if (pPageFrame)
+ sal_uInt16 nPage = 0;
+ if (m_pWrtShell->IsCursorVisible())
+ nPage = m_pWrtShell->GetCursor()->GetPageNum();
+ else
+ {
+ SwFrame* pPageFrame = m_pWrtShell->Imp()->GetFirstVisPage(m_pWrtShell->GetOut());
+ if (pPageFrame)
+ nPage = pPageFrame->GetPhyPageNum();
+ }
+ if (nPage != 0)
{
- sal_uInt16 nPage(pPageFrame->GetPhyPageNum());
- if (nPage != 0)
+ sal_uInt16 nOldPage(nPage);
+ if (FN_TO_PREV_PAGE == nSlot && nPage > 1)
+ nPage--;
+ else if (FN_TO_NEXT_PAGE == nSlot && nPage < m_pWrtShell->GetPageCount())
+ nPage++;
+ if (nPage != nOldPage)
{
- sal_uInt16 nOldPage(nPage);
- if (FN_TO_PREV_PAGE == nSlot && nPage > 1)
- nPage--;
- else if (FN_TO_NEXT_PAGE == nSlot && nPage < m_pWrtShell->GetPageCount())
- nPage++;
- if (nPage != nOldPage)
- {
- m_pWrtShell->LockPaint();
- if (IsDrawMode())
- LeaveDrawCreate();
- m_pWrtShell->EnterStdMode();
- m_pWrtShell->GotoPage(nPage, true);
- // set visible area (borrowed from SwView::PhyPageUp/Down)
- const Point aPt(m_aVisArea.Left(), m_pWrtShell->GetPagePos(nPage).Y());
- Point aAlPt(AlignToPixel(aPt));
- if(aPt.Y() != aAlPt.Y())
- aAlPt.AdjustY(3 * GetEditWin().PixelToLogic(Size(0, 1)).Height());
- SetVisArea(aAlPt);
- m_pWrtShell->UnlockPaint();
- }
+ m_pWrtShell->LockPaint();
+ if (IsDrawMode())
+ LeaveDrawCreate();
+ m_pWrtShell->EnterStdMode();
+ m_pWrtShell->GotoPage(nPage, true);
+ // set visible area (borrowed from SwView::PhyPageUp/Down)
+ const Point aPt(m_aVisArea.Left(), m_pWrtShell->GetPagePos(nPage).Y());
+ Point aAlPt(AlignToPixel(aPt));
+ if(aPt.Y() != aAlPt.Y())
+ aAlPt.AdjustY(3 * GetEditWin().PixelToLogic(Size(0, 1)).Height());
+ SetVisArea(aAlPt);
+ m_pWrtShell->UnlockPaint();
}
}
}