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@collabora.com>
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index 512a3bf..1d4ebfa 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 53ae31f..24c3c57 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 12988e4..19f663f 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 b9dde38..ba544b7 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)