summaryrefslogtreecommitdiff
path: root/sd/source/ui/unoidl/unomodel.cxx
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-03-13 17:18:11 +0100
committerMichael Meeks <michael.meeks@collabora.com>2019-03-14 10:14:11 +0100
commitefef0583c62be4aeb5c360621cb3072ff336eb6b (patch)
tree346a86de3e7931b5292810811b054e04ac2b4da3 /sd/source/ui/unoidl/unomodel.cxx
parent1da82a6e80cd2147839031250dba10976560962d (diff)
LOK: re-factor async key & mouse event re-posting.
A fairly pure re-factor, although adding disposed window checking to a number of sites with a warning. Moves the event emission helpers from VCL into SfxLokHelper: we're going to need more view / integration here next anyway. Removes lots of copy/paste horror. Change-Id: I279c11a1d8093b4feeeb6b7850f500806fff80dd Reviewed-on: https://gerrit.libreoffice.org/69218 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sd/source/ui/unoidl/unomodel.cxx')
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx44
1 files changed, 4 insertions, 40 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 41cd4ad24a27..06a91d3df357 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -46,6 +46,7 @@
#include "unopool.hxx"
#include <sfx2/dispatch.hxx>
#include <sfx2/bindings.hxx>
+#include <sfx2/lokhelper.hxx>
#include <vcl/commandevent.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -2476,27 +2477,7 @@ void SdXImpressDocument::initializeForTiledRendering(const css::uno::Sequence<cs
void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode)
{
SolarMutexGuard aGuard;
-
- VclPtr<vcl::Window> pWindow = getDocWindow();
- if (!pWindow)
- return;
-
- LOKAsyncEventData* pLOKEv = new LOKAsyncEventData;
- pLOKEv->mpWindow = pWindow;
- switch (nType)
- {
- case LOK_KEYEVENT_KEYINPUT:
- pLOKEv->mnEvent = VclEventId::WindowKeyInput;
- break;
- case LOK_KEYEVENT_KEYUP:
- pLOKEv->mnEvent = VclEventId::WindowKeyUp;
- break;
- default:
- assert(false);
- }
-
- pLOKEv->maKeyEvent = KeyEvent(nCharCode, nKeyCode, 0);
- Application::PostUserEvent(Link<void*, void>(pLOKEv, ITiledRenderable::LOKPostAsyncEvent));
+ SfxLokHelper::postKeyEventAsync(getDocWindow(), nType, nCharCode, nKeyCode);
}
void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier)
@@ -2524,28 +2505,11 @@ void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, i
return;
}
- LOKAsyncEventData* pLOKEv = new LOKAsyncEventData;
- pLOKEv->mpWindow = pViewShell->GetActiveWindow();
- switch (nType)
- {
- case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pLOKEv->mnEvent = VclEventId::WindowMouseButtonDown;
- break;
- case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pLOKEv->mnEvent = VclEventId::WindowMouseButtonUp;
- break;
- case LOK_MOUSEEVENT_MOUSEMOVE:
- pLOKEv->mnEvent = VclEventId::WindowMouseMove;
- break;
- default:
- assert(false);
- }
-
const Point aPos(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)));
- pLOKEv->maMouseEvent = MouseEvent(aPos, nCount,
+ SfxLokHelper::postMouseEventAsync(pViewShell->GetActiveWindow(), nType,
+ aPos, nCount,
MouseEventModifiers::SIMPLECLICK,
nButtons, nModifier);
- Application::PostUserEvent(Link<void*, void>(pLOKEv, ITiledRenderable::LOKPostAsyncEvent));
}
void SdXImpressDocument::setTextSelection(int nType, int nX, int nY)