summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-02-13 10:54:35 +0000
committerCaolán McNamara <caolanm@redhat.com>2020-02-13 16:51:11 +0100
commita2e0abc7c6b02e2ea37d269e216d6550be76c8fe (patch)
treeeca3a48065db76f1740a3a83465c341abf942793 /desktop
parent119044e8c9e13dcdc0d5d1e080c8f168446c48f4 (diff)
factor out dialog hacks
Change-Id: Iceefc8d739fb93b97adfa1e35d8308f0c48f02e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88600 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx22
1 files changed, 9 insertions, 13 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 34b6155975c5..0869b3a92ab7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -126,7 +126,7 @@
#include <vcl/virdev.hxx>
#include <vcl/ImageTree.hxx>
#include <vcl/ITiledRenderable.hxx>
-#include <vcl/dialog.hxx>
+#include <vcl/dialoghelper.hxx>
#include <unicode/uchar.h>
#include <unotools/syslocaleoptions.hxx>
#include <unotools/mediadescriptor.hxx>
@@ -3813,10 +3813,7 @@ static void doc_postWindowMouseEvent(LibreOfficeKitDocument* /*pThis*/, unsigned
const Point aPos(nX, nY);
MouseEvent aEvent(aPos, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
- if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
- {
- pDialog->EnableInput();
- }
+ vcl::EnableDialogInput(pWindow);
switch (nType)
{
@@ -3865,10 +3862,7 @@ static void doc_postWindowGestureEvent(LibreOfficeKitDocument* /*pThis*/, unsign
PanningOrientation::Vertical,
};
- if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
- {
- pDialog->EnableInput();
- }
+ vcl::EnableDialogInput(pWindow);
Application::PostGestureEvent(VclEventId::WindowGestureEvent, pWindow, &aEvent);
}
@@ -5174,10 +5168,12 @@ static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindo
if (nAction == LOK_WINDOW_CLOSE)
{
- if (Dialog* pDialog = dynamic_cast<Dialog*>(pWindow.get()))
- pDialog->Close();
- else if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow.get()))
- pFloatWin->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
+ bool bWasDialog = vcl::CloseDialog(pWindow);
+ if (!bWasDialog)
+ {
+ if (FloatingWindow* pFloatWin = dynamic_cast<FloatingWindow*>(pWindow.get()))
+ pFloatWin->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
+ }
}
else if (nAction == LOK_WINDOW_PASTE)
{