summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/window.hxx1
-rw-r--r--sfx2/source/view/frame2.cxx34
-rw-r--r--vcl/inc/salframe.hxx4
-rw-r--r--vcl/source/window/dialog.cxx8
-rw-r--r--vcl/source/window/window.cxx5
5 files changed, 34 insertions, 18 deletions
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 3a3ea99d2c0f..f0eaaff573f1 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1605,6 +1605,7 @@ public:
virtual bool IsChart() const { return false; }
void SetHelpHdl(const Link<vcl::Window&, bool>& rLink);
+ void SetModalHierarchyHdl(const Link<bool, void>& rLink);
};
}
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();
diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx
index f1d4a05e5662..ad60072e08cf 100644
--- a/vcl/inc/salframe.hxx
+++ b/vcl/inc/salframe.hxx
@@ -108,6 +108,7 @@ private:
// the VCL window corresponding to this frame
VclPtr<vcl::Window> m_pWindow;
SALFRAMEPROC m_pProc;
+ Link<bool, void> m_aModalHierarchyHdl;
protected:
mutable std::unique_ptr<weld::Window> m_xFrameWeld;
public:
@@ -273,6 +274,9 @@ public:
// returns the instance set
vcl::Window* GetWindow() const { return m_pWindow; }
+ void SetModalHierarchyHdl(const Link<bool, void>& rLink) { m_aModalHierarchyHdl = rLink; }
+ void NotifyModalHierarchy(bool bModal) { m_aModalHierarchyHdl.Call(bModal); }
+
// Call the callback set; this sometimes necessary for implementation classes
// that should not know more than necessary about the SalFrame implementation
// (e.g. input methods, printer update handlers).
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index a1d8cf1e6a6c..898d8dbf4a99 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -915,8 +915,8 @@ bool Dialog::ImplStartExecuteModal()
if ( GetParent() )
{
- NotifyEvent aNEvt( MouseNotifyEvent::EXECUTEDIALOG, this );
- GetParent()->CompatNotify( aNEvt );
+ SalFrame* pFrame = GetParent()->ImplGetFrame();
+ pFrame->NotifyModalHierarchy(true);
}
mbInExecute = true;
// no real modality in LibreOfficeKit
@@ -1119,8 +1119,8 @@ void Dialog::EndDialog( long nResult )
Hide();
if ( GetParent() )
{
- NotifyEvent aNEvt( MouseNotifyEvent::ENDEXECUTEDIALOG, this );
- GetParent()->CompatNotify( aNEvt );
+ SalFrame* pFrame = GetParent()->ImplGetFrame();
+ pFrame->NotifyModalHierarchy(false);
}
mpDialogImpl->mnResult = nResult;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index ce0be303d2e8..002658ba99a6 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -1766,6 +1766,11 @@ void Window::ImplNewInputContext()
pFontInstance->Release();
}
+void Window::SetModalHierarchyHdl(const Link<bool, void>& rLink)
+{
+ ImplGetFrame()->SetModalHierarchyHdl(rLink);
+}
+
void Window::doLazyDelete()
{
SystemWindow* pSysWin = dynamic_cast<SystemWindow*>(this);