From 712540224d7c5c8cdb4a5214e2d7963a314c1928 Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Wed, 14 Feb 2018 17:33:16 +0530 Subject: lok IME: support dialogs as well Change-Id: Ic78da45dadaa5a4e1ca78e20d04974108581121e Reviewed-on: https://gerrit.libreoffice.org/49714 Tested-by: Jenkins Reviewed-by: pranavk --- desktop/source/lib/init.cxx | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'desktop') diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index bc788d243b9e..8d0611c21d07 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -543,6 +543,7 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nCharCode, int nKeyCode); static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis, + unsigned nWindowId, int nType, const char* pText); static void doc_postWindowKeyEvent(LibreOfficeKitDocument* pThis, @@ -2298,18 +2299,43 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar pDoc->postKeyEvent(nType, nCharCode, nKeyCode); } -static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis, int nType, const char* pText) +static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, const char* pText) { SolarMutexGuard aGuard; + VclPtr pWindow; + if (nWindowId == 0) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + pWindow = pDoc->getDocWindow(); + } + else + { + pWindow = vcl::Window::FindLOKWindow(nWindowId); + } - ITiledRenderable* pDoc = getTiledRenderable(pThis); - if (!pDoc) + if (!pWindow) { - gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + gImpl->maLastExceptionMsg = "No window found for window id: " + OUString::number(nWindowId); return; } - pDoc->postExtTextInputEvent(nType, OUString::fromUtf8(OString(pText, strlen(pText)))); + 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, ""); + break; + default: + assert(false && "Unhandled External Text input event!"); + } } static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode) -- cgit