diff options
| author | Caolán McNamara <caolanm@redhat.com> | 2020-09-17 11:24:37 +0100 |
|---|---|---|
| committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-17 15:05:03 +0200 |
| commit | 1b672e44c234f7ca396f7d593abfa74d766a2774 (patch) | |
| tree | 955b2bf60807f7c111b032948200c9b70f2a810c | |
| parent | 05ce868e4d576185e95e5b98691c61b29842a475 (diff) | |
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 <caolanm@redhat.com>
| -rw-r--r-- | sw/inc/AnnotationWin.hxx | 3 | ||||
| -rw-r--r-- | sw/source/uibase/docvw/AnnotationMenuButton.cxx | 7 | ||||
| -rw-r--r-- | sw/source/uibase/docvw/AnnotationWin2.cxx | 15 |
3 files changed, 21 insertions, 4 deletions
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(); |
