sw/source/uibase/uiview/viewmdi.cxx |   36 +++++++++++++++---------------------
 1 file changed, 15 insertions(+), 21 deletions(-)

New commits:
commit 9598018e67dfc10c35022cbec4844363b7dd98ab
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Sat Dec 26 13:17:23 2020 -0900
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Fri Jan 15 01:02:58 2021 +0100

    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 <rayk...@gmail.com>

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();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to