[Libreoffice-commits] core.git: sw/source
Jim Raykowski (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jun 4 07:57:40 UTC 2020
sw/source/uibase/uiview/view2.cxx | 52 ++++++++++++++++++++------------------
1 file changed, 28 insertions(+), 24 deletions(-)
New commits:
commit ea59cd05e84849c3fde514b7070081af4a052360
Author: Jim Raykowski <raykowj at gmail.com>
AuthorDate: Wed Jun 3 20:31:58 2020 -0800
Commit: Jim Raykowski <raykowj at gmail.com>
CommitDate: Thu Jun 4 09:56:58 2020 +0200
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 at gmail.com>
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();
}
}
}
More information about the Libreoffice-commits
mailing list