diff options
author | Marco Cecchetti <mrcekets@gmail.com> | 2019-07-10 10:32:07 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-10-01 10:01:57 +0200 |
commit | 9590e8d0a2194b36d5a025a21dc2e71f37f4f54b (patch) | |
tree | 76eb45d9a9b27a0bd4f7f0f25693cb2caddb128a /desktop/source | |
parent | 0ff8140676877f7a37ceb14d9ba797d6e2a18cf6 (diff) |
lok: handling a single msg for deleting multiple characters
also includes:
lok: fixing testABI failure
Change-Id: I4df662a0df49a864c4b307efdd963b857bb77792
lok: missing removeTextContext implementation for Document class
Change-Id: I884ad07f330afc19dfe759c08c8a17bdb4f9dcf3
Change-Id: I045d89f9fa478f37fc2917e159e044eee7e1ab31
Reviewed-on: https://gerrit.libreoffice.org/79879
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/lib/init.cxx | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2af356e0bb7b..3b8e7eb128c7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -764,6 +764,11 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsigned nWindowId, int nType, const char* pText); +static void doc_removeTextContext(LibreOfficeKitDocument* pThis, + unsigned nLOKWindowId, + int nCharBefore, + int nCharAfter); + static void doc_postWindowKeyEvent(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nType, @@ -933,6 +938,7 @@ LibLODocument_Impl::LibLODocument_Impl(const uno::Reference <css::lang::XCompone m_pDocumentClass->registerCallback = doc_registerCallback; m_pDocumentClass->postKeyEvent = doc_postKeyEvent; m_pDocumentClass->postWindowExtTextInputEvent = doc_postWindowExtTextInputEvent; + m_pDocumentClass->removeTextContext = doc_removeTextContext; m_pDocumentClass->postWindowKeyEvent = doc_postWindowKeyEvent; m_pDocumentClass->postMouseEvent = doc_postMouseEvent; m_pDocumentClass->postWindowMouseEvent = doc_postWindowMouseEvent; @@ -3053,6 +3059,44 @@ static void doc_postWindowExtTextInputEvent(LibreOfficeKitDocument* pThis, unsig } } +static void doc_removeTextContext(LibreOfficeKitDocument* pThis, unsigned nLOKWindowId, int nCharBefore, int nCharAfter) +{ + SolarMutexGuard aGuard; + VclPtr<vcl::Window> pWindow; + if (nLOKWindowId == 0) + { + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + pWindow = pDoc->getDocWindow(); + } + else + { + pWindow = vcl::Window::FindLOKWindow(nLOKWindowId); + } + + if (!pWindow) + { + gImpl->maLastExceptionMsg = "No window found for window id: " + OUString::number(nLOKWindowId); + return; + } + + if (nCharBefore > 0) + { + // backspace + SfxLokHelper::postKeyEventAsync(pWindow, LOK_EXT_TEXTINPUT, 8, 1283, nCharBefore - 1); + } + + if (nCharAfter > 0) + { + // delete (forward) + SfxLokHelper::postKeyEventAsync(pWindow, LOK_EXT_TEXTINPUT, 46, 1286, nCharAfter - 1); + } +} + static void doc_postWindowKeyEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nType, int nCharCode, int nKeyCode) { comphelper::ProfileZone aZone("doc_postWindowKeyEvent"); |