sw/inc/AnnotationWin.hxx | 3 +++ sw/source/uibase/docvw/AnnotationMenuButton.cxx | 7 +++++++ sw/source/uibase/docvw/AnnotationWin2.cxx | 15 +++++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-)
New commits: commit 1b672e44c234f7ca396f7d593abfa74d766a2774 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Sep 17 11:24:37 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Thu Sep 17 15:05:03 2020 +0200 tdf#136682 set the sidebar of the menubutton as active on execute command so the command will be executed on the expected sidebar window Change-Id: Ic7ffe363005292edeb93c5a1220a9bcb97096c4a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102914 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index 1410ad5d689b..c2cc2298fcd3 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -195,6 +195,9 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window bool IsResolved() const; bool IsThreadResolved(); + // Set this SwAnnotationWin as the currently active one + void SetActiveSidebarWin(); + /// Find the first annotation for the thread which this annotation is in. /// This may be the same annotation as this one. SwAnnotationWin* GetTopReplyNote(); diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx index f56e745c1641..58e4f7a8a610 100644 --- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx +++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx @@ -67,6 +67,13 @@ void AnnotationMenuButton::dispose() void AnnotationMenuButton::Select() { OString sIdent = GetCurItemIdent(); + if (sIdent.isEmpty()) + return; + + // tdf#136682 ensure this is the currently active sidebar win so the command + // operates in an active sidebar context + mrSidebarWin.SetActiveSidebarWin(); + if (sIdent == "reply") mrSidebarWin.ExecuteCommand(FN_REPLY); if (sIdent == "resolve" || sIdent == "unresolve") diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index f5430214479f..d9ec987b58b9 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1332,14 +1332,21 @@ IMPL_LINK( SwAnnotationWin, WindowEventListener, VclWindowEvent&, rEvent, void ) else if ( rEvent.GetId() == VclEventId::WindowActivate && rEvent.GetWindow() == mpSidebarTextControl ) { - const bool bLockView = mrView.GetWrtShell().IsViewLocked(); - mrView.GetWrtShell().LockView( true ); - mrMgr.SetActiveSidebarWin( this ); - mrView.GetWrtShell().LockView( bLockView ); + SetActiveSidebarWin(); mrMgr.MakeVisible( this ); } } +void SwAnnotationWin::SetActiveSidebarWin() +{ + if (mrMgr.GetActiveSidebarWin() == this) + return; + const bool bLockView = mrView.GetWrtShell().IsViewLocked(); + mrView.GetWrtShell().LockView( true ); + mrMgr.SetActiveSidebarWin(this); + mrView.GetWrtShell().LockView( bLockView ); +} + IMPL_LINK(SwAnnotationWin, ScrollHdl, ScrollBar*, pScroll, void) { long nDiff = GetOutlinerView()->GetEditView().GetVisArea().Top() - pScroll->GetThumbPos(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits