diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-03-13 17:18:11 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-03-14 10:14:11 +0100 |
commit | efef0583c62be4aeb5c360621cb3072ff336eb6b (patch) | |
tree | 346a86de3e7931b5292810811b054e04ac2b4da3 /sw/source/uibase/uno | |
parent | Removed duplicated include (diff) | |
download | core-efef0583c62be4aeb5c360621cb3072ff336eb6b.tar.gz core-efef0583c62be4aeb5c360621cb3072ff336eb6b.zip |
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 'sw/source/uibase/uno')
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 0a7c3d09b721..345fcba8ef11 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3512,27 +3512,7 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; - - VclPtr<vcl::Window> pWindow = getDocWindow(); - if (!pWindow || pWindow->IsDisposed()) - 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 SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) @@ -3560,29 +3540,10 @@ void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int } SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); - - - LOKAsyncEventData* pLOKEv = new LOKAsyncEventData; - pLOKEv->mpWindow = &rEditWin; - 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); - } - - pLOKEv->maMouseEvent = MouseEvent(Point(nX, nY), nCount, + SfxLokHelper::postMouseEventAsync(&rEditWin, nType, + Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); - Application::PostUserEvent(Link<void*, void>(pLOKEv, ITiledRenderable::LOKPostAsyncEvent)); } void SwXTextDocument::setTextSelection(int nType, int nX, int nY) |