summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2020-12-26 13:17:23 -0900
committerJim Raykowski <raykowj@gmail.com>2021-01-15 01:02:58 +0100
commit9598018e67dfc10c35022cbec4844363b7dd98ab (patch)
tree2e23b701b24d18e929a6f9185dc5afb5f4f5345e /sw
parentfd2dbccefa27f4d24b3d92ba2477202c9963cc9a (diff)
Make page navigation in move navigation handler consistent
Page navigation in the move navigation handler scrolls the view without moving the cursor or unselecting selections. This patch makes page navigation that results in document wrapping, scroll the view without changing the cursor position or selections. This is useful, for example, when find all search is made and page viewing is wanted that does not destroy cursor selections. Change-Id: Ie062eeba9a29c2b8a42605ed842d60244cc74147 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108380 Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx36
1 files changed, 15 insertions, 21 deletions
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index bfa8ec038f8a..348a9a0d3621 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -343,32 +343,26 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
switch( m_nMoveType )
{
case NID_PGE:
- if ( bNext )
+ {
+ if (USHRT_MAX == rSh.GetNextPrevPageNum(bNext))
{
- if ( USHRT_MAX == rSh.GetNextPrevPageNum( true ) )
- {
- rSh.GotoPage( 1, true );
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::EndWrapped );
- }
- else
- {
- PhyPageDown();
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
- }
+ const Point aPt(GetVisArea().Left(),
+ rSh.GetPagePos(bNext ? 1 : rSh.GetPageCnt()).Y());
+ Point aAlPt(AlignToPixel(aPt) );
+ // If there is a difference, has been truncated --> then add one pixel,
+ // so that no residue of the previous page is visible.
+ if(aPt.Y() != aAlPt.Y())
+ aAlPt.AdjustY(3 * GetEditWin().PixelToLogic(Size(0, 1)).Height());
+ SetVisArea(aAlPt);
+ SvxSearchDialogWrapper::SetSearchLabel(bNext ? SearchLabel::EndWrapped :
+ SearchLabel::StartWrapped);
}
else
{
- if ( USHRT_MAX == rSh.GetNextPrevPageNum( false ) )
- {
- rSh.GotoPage( rSh.GetPageCnt(), true );
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::StartWrapped );
- }
- else
- {
- PhyPageUp();
- SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty );
- }
+ bNext ? PhyPageDown() : PhyPageUp();
+ SvxSearchDialogWrapper::SetSearchLabel(SearchLabel::Empty);
}
+ }
break;
case NID_TBL :
rSh.EnterStdMode();