diff options
-rw-r--r-- | sw/inc/AnnotationWin.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationMenuButton.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/docvw/AnnotationWin2.cxx | 15 |
3 files changed, 22 insertions, 4 deletions
diff --git a/sw/inc/AnnotationWin.hxx b/sw/inc/AnnotationWin.hxx index a11ec583792f..3be381bf3a7c 100644 --- a/sw/inc/AnnotationWin.hxx +++ b/sw/inc/AnnotationWin.hxx @@ -197,7 +197,10 @@ class SAL_DLLPUBLIC_RTTI SwAnnotationWin : public vcl::Window bool IsThreadResolved(); // Set this SwAnnotationWin as the currently active one - void SetActiveSidebarWin(); + // return false if it was already active + bool SetActiveSidebarWin(); + // Unset this SwAnnotationWin as the currently active one + void UnsetActiveSidebarWin(); /// Find the first annotation for the thread which this annotation is in. /// This may be the same annotation as this one. diff --git a/sw/source/uibase/docvw/AnnotationMenuButton.cxx b/sw/source/uibase/docvw/AnnotationMenuButton.cxx index 9ee6ac0ec805..663141839d00 100644 --- a/sw/source/uibase/docvw/AnnotationMenuButton.cxx +++ b/sw/source/uibase/docvw/AnnotationMenuButton.cxx @@ -72,7 +72,7 @@ void AnnotationMenuButton::Select() // tdf#136682 ensure this is the currently active sidebar win so the command // operates in an active sidebar context - mrSidebarWin.SetActiveSidebarWin(); + bool bSwitchedFocus = mrSidebarWin.SetActiveSidebarWin(); if (sIdent == "reply") mrSidebarWin.ExecuteCommand(FN_REPLY); @@ -90,6 +90,10 @@ void AnnotationMenuButton::Select() mrSidebarWin.ExecuteCommand(FN_DELETE_ALL_NOTES); else if (sIdent == "formatall") mrSidebarWin.ExecuteCommand(FN_FORMAT_ALL_NOTES); + + if (bSwitchedFocus) + mrSidebarWin.UnsetActiveSidebarWin(); + mrSidebarWin.GrabFocusToDocument(); } void AnnotationMenuButton::MouseButtonDown( const MouseEvent& rMEvt ) diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx index a84d0017a8f9..be1da018506a 100644 --- a/sw/source/uibase/docvw/AnnotationWin2.cxx +++ b/sw/source/uibase/docvw/AnnotationWin2.cxx @@ -1373,14 +1373,25 @@ IMPL_LINK( SwAnnotationWin, WindowEventListener, VclWindowEvent&, rEvent, void ) } } -void SwAnnotationWin::SetActiveSidebarWin() +bool SwAnnotationWin::SetActiveSidebarWin() { if (mrMgr.GetActiveSidebarWin() == this) - return; + return false; const bool bLockView = mrView.GetWrtShell().IsViewLocked(); mrView.GetWrtShell().LockView( true ); mrMgr.SetActiveSidebarWin(this); mrView.GetWrtShell().LockView( bLockView ); + return true; +} + +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 ); } IMPL_LINK(SwAnnotationWin, ScrollHdl, ScrollBar*, pScroll, void) |