summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-06-14 09:18:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-06-14 13:47:24 +0200
commitca525d1375ab06889ba1cf9d904652f2eb61d1bf (patch)
tree64dff534b282b8e2e32024ca97eff6faad9f8b68 /sfx2
parent5cdf4e4478fc22442ed886ee888e64745be4f264 (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>
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 804440a4f24f..dd894c87dc37 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -61,9 +61,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;
@@ -75,13 +75,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 )
@@ -119,20 +127,18 @@ bool SfxFrameWindow_Impl::EventNotify( NotifyEvent& rNEvt )
if ( pView->GetViewShell()->KeyInput( *rNEvt.GetKeyEvent() ) )
return true;
}
- else if ( rNEvt.GetType() == MouseNotifyEvent::EXECUTEDIALOG )
- {
- 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();