sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx | 32 +++++++++++++++-- sw/source/uibase/inc/FrameControl.hxx | 1 2 files changed, 31 insertions(+), 2 deletions(-)
New commits: commit d748430c7d12d71a4cc4ed178e072026ea218641 Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Tue Apr 13 13:47:44 2021 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Mon Apr 19 02:22:35 2021 +0200 Ensure outline content visibility 'Hide' button is removed when mouse move leaving window event results in move outside of the outline frame area and when entering a 'Show' button directly from a 'Hide' button which is required by gtk3 but not gen. Change-Id: Ib4d834b8a3b9051ec628406b8da369986a9e1e21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114071 Tested-by: Jenkins Reviewed-by: Jim Raykowski <rayk...@gmail.com> diff --git a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx index 263009c13683..a50832c3385f 100644 --- a/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx +++ b/sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx @@ -23,6 +23,8 @@ #include <viewopt.hxx> +#include <FrameControlsManager.hxx> + SwOutlineContentVisibilityWin::SwOutlineContentVisibilityWin(SwEditWin* pEditWin, const SwFrame* pFrame) : InterimItemWindow(pEditWin, "modules/swriter/ui/outlinebutton.ui", "OutlineButton") @@ -223,14 +225,40 @@ IMPL_LINK(SwOutlineContentVisibilityWin, MouseMoveHdl, const MouseEvent&, rMEvt, auto nY = GetPosPixel().getY() + rMEvt.GetPosPixel().getY(); if (nY <= 0 || nY <= aFrameAreaPxRect.Top() || nY >= aFrameAreaPxRect.Bottom() || nY >= GetEditWin()->GetSizePixel().Height()) - Hide(); + { + GetEditWin()->SetSavedOutlineFrame(nullptr); + GetEditWin()->GetFrameControlsManager().RemoveControlsByType( + FrameControlType::Outline, GetFrame()); + // warning: "this" is disposed now + } } } else if (rMEvt.IsEnterWindow()) { + // Leave window event might not have resulted in removing hide button from saved frame + // and the edit win might not receive mouse event between leaving saved frame button and + // entering this button. + if (GetFrame() != GetEditWin()->GetSavedOutlineFrame()) + { + SwFrameControlPtr pFrameControl = GetEditWin()->GetFrameControlsManager().GetControl( + FrameControlType::Outline, GetEditWin()->GetSavedOutlineFrame()); + if (pFrameControl) + { + SwOutlineContentVisibilityWin* pControl + = dynamic_cast<SwOutlineContentVisibilityWin*>(pFrameControl->GetIFacePtr()); + if (pControl && pControl->GetSymbol() == ButtonSymbol::HIDE) + { + GetEditWin()->GetFrameControlsManager().RemoveControlsByType( + FrameControlType::Outline, GetEditWin()->GetSavedOutlineFrame()); + // The outline content visibility window frame control (hide button) + // for saved outline frame is now disposed. + } + } + GetEditWin()->SetSavedOutlineFrame(const_cast<SwFrame*>(GetFrame())); + } if (!m_bDestroyed && m_aDelayTimer.IsActive()) m_aDelayTimer.Stop(); - // bring button to top and grab focus + // bring button to top SetZOrder(this, ZOrderFlags::First); } return false; diff --git a/sw/source/uibase/inc/FrameControl.hxx b/sw/source/uibase/inc/FrameControl.hxx index a2cc7e9edf21..9efce9cf699e 100644 --- a/sw/source/uibase/inc/FrameControl.hxx +++ b/sw/source/uibase/inc/FrameControl.hxx @@ -46,6 +46,7 @@ public: ~SwFrameControl(); vcl::Window* GetWindow() { return mxWindow.get(); } + ISwFrameControl* GetIFacePtr() { return mpIFace; } void SetReadonly( bool bReadonly ) { mpIFace->SetReadonly( bReadonly ); } void ShowAll( bool bShow ) { mpIFace->ShowAll( bShow ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits