diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2018-02-07 17:19:58 +0530 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-03-25 18:24:50 +0200 |
commit | 71eb37053685a1b2e39f3bfc4eb5b96febbd4a7a (patch) | |
tree | 2972fceade6798ef934a44a31f73bffe647b8370 /desktop | |
parent | b26062d1c730b316e35df28a8c2c1219df08064a (diff) |
sw lok: IME support + unit test
Change-Id: I557493db23dfa3529606050c86161628dbd722e7
Reviewed-on: https://gerrit.libreoffice.org/49354
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
(cherry picked from commit 7f9f58f3a304733f7089719a5a65eef8c68c2b8d)
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 3 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 19 |
2 files changed, 21 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 9eb5e5cb0eb2..b4bb98da0071 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -2291,10 +2291,11 @@ void DesktopLOKTest::testABI() CPPUNIT_ASSERT_EQUAL(documentClassOffset(37), offsetof(struct _LibreOfficeKitDocumentClass, postWindowKeyEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(38), offsetof(struct _LibreOfficeKitDocumentClass, postWindowMouseEvent)); CPPUNIT_ASSERT_EQUAL(documentClassOffset(39), offsetof(struct _LibreOfficeKitDocumentClass, setViewLanguage)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(40), offsetof(struct _LibreOfficeKitDocumentClass, postExtTextInputEvent)); // Extending is fine, update this, and add new assert for the offsetof the // new method - CPPUNIT_ASSERT_EQUAL(documentClassOffset(40), sizeof(struct _LibreOfficeKitDocumentClass)); + CPPUNIT_ASSERT_EQUAL(documentClassOffset(41), sizeof(struct _LibreOfficeKitDocumentClass)); } CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 022a822a9607..26b6a799dfc7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -549,6 +549,9 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode); +static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis, + int nType, + const char* pText); static void doc_postWindowKeyEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, @@ -642,6 +645,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->initializeForRendering = doc_initializeForRendering; m_pDocumentClass->registerCallback = doc_registerCallback; m_pDocumentClass->postKeyEvent = doc_postKeyEvent; + m_pDocumentClass->postExtTextInputEvent = doc_postExtTextInputEvent; m_pDocumentClass->postWindowKeyEvent = doc_postWindowKeyEvent; m_pDocumentClass->postMouseEvent = doc_postMouseEvent; m_pDocumentClass->postWindowMouseEvent = doc_postWindowMouseEvent; @@ -2297,9 +2301,24 @@ static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nChar gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; return; } + pDoc->postKeyEvent(nType, nCharCode, nKeyCode); } +static void doc_postExtTextInputEvent(LibreOfficeKitDocument* pThis, int nType, const char* pText) +{ + SolarMutexGuard aGuard; + + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + + pDoc->postExtTextInputEvent(nType, OUString::fromUtf8(OString(pText, strlen(pText)))); +} + static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode) { SolarMutexGuard aGuard; |