summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-06-14 09:18:44 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2020-05-01 17:58:17 +0200
commit64317b35feee9c4e1dfbe7d1e580c2146ad652bb (patch)
treec7ac28b57f0c03b47b4eec731c3bf8e95b032e0f /sfx2
parent872ee053d3c75ca47fbd29f4504d1bd5c21b05df (diff)
disable 'quit' menu entry when modal dialog waiting response
Traditionally when a modal dialog is active, the quit menu entry of all LibreOffice toplevel frames, not just those which are themselves modal, is get disabled. This has come unstuck because its implemented by dialogs emitting MouseNotifyEvent::[END]EXECUTEDIALOG on its parent, and SfxFrameWindow_Impl listening for that event. But if the dialog parent is the toplevel parent of SfxFrameWindow_Impl then it doesn't get seen by the SfxFrameWindow_Impl child. Change-Id: I0c4a5472d16d9169e68f6b0c230d039f1119489a Reviewed-on: https://gerrit.libreoffice.org/74030 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit ca525d1375ab06889ba1cf9d904652f2eb61d1bf) Conflicts: include/vcl/event.hxx include/vcl/window.hxx sfx2/source/view/frame2.cxx vcl/source/window/dialog.cxx vcl/source/window/window.cxx
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/frame2.cxx34
1 files changed, 20 insertions, 14 deletions
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 6fc3cff26a7d..e003d9697358 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -58,9 +58,9 @@ using namespace ::com::sun::star::container;
using namespace ::com::sun::star::beans;
using ::com::sun::star::frame::XComponentLoader;
-
class SfxFrameWindow_Impl : public vcl::Window
{
+ DECL_LINK(ModalHierarchyHdl, bool, void);
public:
SfxFrame* pFrame;
@@ -72,13 +72,21 @@ public:
virtual bool EventNotify( NotifyEvent& rEvt ) override;
virtual void Resize() override;
virtual void GetFocus() override;
+ virtual void dispose() override;
void DoResize();
};
-SfxFrameWindow_Impl::SfxFrameWindow_Impl( SfxFrame* pF, vcl::Window& i_rContainerWindow )
- : Window( &i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK )
- , pFrame( pF )
+SfxFrameWindow_Impl::SfxFrameWindow_Impl(SfxFrame* pF, vcl::Window& i_rContainerWindow)
+ : Window(&i_rContainerWindow, WB_BORDER | WB_CLIPCHILDREN | WB_NODIALOGCONTROL | WB_3DLOOK)
+ , pFrame(pF)
+{
+ i_rContainerWindow.SetModalHierarchyHdl(LINK(this, SfxFrameWindow_Impl, ModalHierarchyHdl));
+}
+
+void SfxFrameWindow_Impl::dispose()
{
+ GetParent()->SetModalHierarchyHdl(Link<bool, void>());
+ vcl::Window::dispose();
}
void SfxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
@@ -116,20 +124,18 @@ bool SfxFrameWindow_Impl::EventNotify( NotifyEvent& rNEvt )
if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) )
return true;
}
- else if ( rNEvt.GetType() == MouseNotifyEvent::EXECUTEDIALOG /*|| rNEvt.GetType() == MouseNotifyEvent::INPUTDISABLE*/ )
- {
- pView->SetModalMode( true );
- return true;
- }
- else if ( rNEvt.GetType() == MouseNotifyEvent::ENDEXECUTEDIALOG /*|| rNEvt.GetType() == MouseNotifyEvent::INPUTENABLE*/ )
- {
- pView->SetModalMode( false );
- return true;
- }
return Window::EventNotify( rNEvt );
}
+IMPL_LINK(SfxFrameWindow_Impl, ModalHierarchyHdl, bool, bSetModal, void)
+{
+ SfxViewFrame* pView = pFrame->GetCurrentViewFrame();
+ if (!pView || !pView->GetObjectShell())
+ return;
+ pView->SetModalMode(bSetModal);
+}
+
bool SfxFrameWindow_Impl::PreNotify( NotifyEvent& rNEvt )
{
MouseNotifyEvent nType = rNEvt.GetType();