diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2018-02-07 17:19:58 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2018-02-08 08:40:25 +0100 |
commit | 7f9f58f3a304733f7089719a5a65eef8c68c2b8d (patch) | |
tree | 3ee9c3b4548304306a7dbd9ed0ab33249d88cc64 /desktop | |
parent | 274825b4180c81540cd0d1b22c5243f1b39fe4db (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>
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 4488aa8c155c..4d2d50644b16 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 ab7b72d526dc..2165a781725a 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -540,6 +540,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, @@ -633,6 +636,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; @@ -2288,9 +2292,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; |