summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorJim Raykowski <raykowj@gmail.com>2021-04-13 13:47:44 -0800
committerJim Raykowski <raykowj@gmail.com>2021-04-19 02:22:35 +0200
commitd748430c7d12d71a4cc4ed178e072026ea218641 (patch)
tree2aa0f26e9bef78f4703065d9c58c44252832a451 /sw/source
parentc0aa577dd567ddd705a8e88d0614b633629d23d2 (diff)
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 <raykowj@gmail.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/uibase/docvw/OutlineContentVisibilityWin.cxx32
-rw-r--r--sw/source/uibase/inc/FrameControl.hxx1
2 files changed, 31 insertions, 2 deletions
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 ); }