[Libreoffice-commits] core.git: editeng/source sw/inc sw/source

Bayram Çiçek (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 20 09:13:58 UTC 2021


 editeng/source/editeng/editview.cxx          |    7 ++++++-
 sw/inc/AnnotationWin.hxx                     |    1 +
 sw/source/uibase/docvw/AnnotationWin2.cxx    |   17 ++++++++++++-----
 sw/source/uibase/docvw/SidebarTxtControl.cxx |    2 ++
 4 files changed, 21 insertions(+), 6 deletions(-)

New commits:
commit 4bb59cd1f45133994d3d13642367470f528094f4
Author:     Bayram Çiçek <mail at bayramcicek.com.tr>
AuthorDate: Thu Jul 8 12:56:23 2021 +0300
Commit:     Muhammet Kara <muhammet.kara at collabora.com>
CommitDate: Fri Aug 20 11:13:21 2021 +0200

    tdf#91519: prevent jump to top of the comment view
    
    In Writer,
    there are 3 issues about comment section:
    
    - comment section scrolls to top of its view
    when clicking inside a comment view.
    
    - clicking inside a comment view, scrolls the
    view to old cursor location automatically
    (if old cursor out of the visible area)
    
    - comment section scrolls automatically to the
    old *selected* text (if it's out of visible area)
    when clicking inside the Writer canvas view
    
    this commit is intended to solve these issues
    
    Change-Id: If7d62373f5215adea85512b66b78736e04e02c3c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118638
    Tested-by: Jenkins
    Reviewed-by: Muhammet Kara <muhammet.kara at collabora.com>

diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 512a3bf54915..1d4ebfae186c 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -282,7 +282,12 @@ void EditView::SetSelection( const ESelection& rESel )
     pImpEditView->SetEditSelection( aNewSelection );
     pImpEditView->DrawSelectionXOR();
     bool bGotoCursor = pImpEditView->DoAutoScroll();
-    ShowCursor( bGotoCursor );
+
+    // comments section in Writer:
+    // don't scroll to the selection if it is
+    // out of visible area of comment canvas.
+    if (HasSelection())
+        ShowCursor( bGotoCursor );
 }
 
 ESelection EditView::GetSelection() const
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx
index 53ae31f83b10..24c3c5792976 100644
--- a/sw/inc/AnnotationWin.hxx
+++ b/sw/inc/AnnotationWin.hxx
@@ -122,6 +122,7 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin final : public InterimItemWindow
         void            DoResize();
         void            ResizeIfNecessary(tools::Long aOldHeight, tools::Long aNewHeight);
         void            SetScrollbar();
+        void            LockView(bool bLock);
 
         void            SetVirtualPosSize( const Point& aPoint, const Size& aSize);
         Point           VirtualPos()    { return mPosSize.TopLeft(); }
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 12988e4d3343..19f663f9895c 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -994,7 +994,10 @@ void SwAnnotationWin::ActivatePostIt()
 
     CheckMetaText();
     SetViewState(ViewState::EDIT);
-    GetOutlinerView()->ShowCursor();
+
+    // prevent autoscroll to the old cursor location
+    // when cursor out of visible area
+    GetOutlinerView()->ShowCursor(false);
 
     mpOutlinerView->GetEditView().SetInsertMode(mrView.GetWrtShellPtr()->IsInsMode());
 
@@ -1168,10 +1171,10 @@ bool SwAnnotationWin::SetActiveSidebarWin()
 {
     if (mrMgr.GetActiveSidebarWin() == this)
         return false;
-    const bool bLockView = mrView.GetWrtShell().IsViewLocked();
     mrView.GetWrtShell().LockView( true );
     mrMgr.SetActiveSidebarWin(this);
-    mrView.GetWrtShell().LockView( bLockView );
+    mrView.GetWrtShell().LockView( true );
+
     return true;
 }
 
@@ -1179,10 +1182,14 @@ void SwAnnotationWin::UnsetActiveSidebarWin()
 {
     if (mrMgr.GetActiveSidebarWin() != this)
         return;
-    const bool bLockView = mrView.GetWrtShell().IsViewLocked();
     mrView.GetWrtShell().LockView( true );
     mrMgr.SetActiveSidebarWin(nullptr);
-    mrView.GetWrtShell().LockView( bLockView );
+    mrView.GetWrtShell().LockView( false );
+}
+
+void SwAnnotationWin::LockView(bool bLock)
+{
+    mrView.GetWrtShell().LockView( bLock );
 }
 
 IMPL_LINK(SwAnnotationWin, ScrollHdl, weld::ScrolledWindow&, rScrolledWindow, void)
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index b9dde38dc1a7..ba544b7c88dd 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -147,6 +147,8 @@ void SidebarTextControl::LoseFocus()
     {
         Invalidate();
     }
+    // set false for autoscroll to typing location
+    mrSidebarWin.LockView(false);
 }
 
 OUString SidebarTextControl::RequestHelp(tools::Rectangle& rHelpRect)


More information about the Libreoffice-commits mailing list