diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 14 | ||||
-rw-r--r-- | include/sfx2/lokhelper.hxx | 4 | ||||
-rw-r--r-- | sfx2/source/view/lokhelper.cxx | 26 |
3 files changed, 31 insertions, 13 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 3b8e7eb128c7..6a43d56c0296 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3044,19 +3044,7 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig return; } - switch (nType) - { - case LOK_EXT_TEXTINPUT: - pWindow->PostExtTextInputEvent(VclEventId::ExtTextInput, - OUString::fromUtf8(OString(pText, strlen(pText)))); - break; - case LOK_EXT_TEXTINPUT_END: - pWindow->PostExtTextInputEvent(VclEventId::EndExtTextInput, - OUString::fromUtf8(OString(pText, strlen(pText)))); - break; - default: - assert(false && "Unhandled External Text input event!"); - } + SfxLokHelper::postExtTextEventAsync(pWindow, nType, OUString::fromUtf8(OString(pText, strlen(pText)))); } static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx index 1e6a0caad205..760b2ed5dfc6 100644 --- a/include/sfx2/lokhelper.hxx +++ b/include/sfx2/lokhelper.hxx @@ -65,6 +65,10 @@ public: static void postKeyEventAsync(const VclPtr<vcl::Window> &xWindow, int nType, int nCharCode, int nKeyCode, int nRepeat = 0); + /// Helper for posting input event + static void postExtTextEventAsync(const VclPtr<vcl::Window> &xWindow, + int nType, const OUString &rText); + /// Helper for posting async mouse event static void postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, int nType, const Point &rPos, diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx index f9c559093861..b7a4b238f18b 100644 --- a/sfx2/source/view/lokhelper.cxx +++ b/sfx2/source/view/lokhelper.cxx @@ -301,6 +301,7 @@ namespace VclEventId mnEvent; MouseEvent maMouseEvent; KeyEvent maKeyEvent; + OUString maText; }; void LOKPostAsyncEvent(void* pEv, void*) @@ -356,6 +357,10 @@ namespace case VclEventId::WindowMouseMove: pLOKEv->mpWindow->LogicMouseMove(pLOKEv->maMouseEvent); break; + case VclEventId::ExtTextInput: + case VclEventId::EndExtTextInput: + pLOKEv->mpWindow->PostExtTextInputEvent(pLOKEv->mnEvent, pLOKEv->maText); + break; default: assert(false); break; @@ -405,6 +410,27 @@ void SfxLokHelper::postKeyEventAsync(const VclPtr<vcl::Window> &xWindow, postEventAsync(pLOKEv); } +void SfxLokHelper::postExtTextEventAsync(const VclPtr<vcl::Window> &xWindow, + int nType, const OUString &rText) +{ + LOKAsyncEventData* pLOKEv = new LOKAsyncEventData; + switch (nType) + { + case LOK_EXT_TEXTINPUT: + pLOKEv->mnEvent = VclEventId::ExtTextInput; + pLOKEv->maText = rText; + break; + case LOK_EXT_TEXTINPUT_END: + pLOKEv->mnEvent = VclEventId::EndExtTextInput; + pLOKEv->maText = ""; + break; + default: + assert(false); + } + pLOKEv->mpWindow = xWindow; + postEventAsync(pLOKEv); +} + void SfxLokHelper::postMouseEventAsync(const VclPtr<vcl::Window> &xWindow, int nType, const Point &rPos, int nCount, MouseEventModifiers aModifiers, |