summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMarco Cecchetti <mrcekets@gmail.com>2019-07-10 10:32:07 +0200
committerMichael Meeks <michael.meeks@collabora.com>2019-10-01 10:01:57 +0200
commit9590e8d0a2194b36d5a025a21dc2e71f37f4f54b (patch)
tree76eb45d9a9b27a0bd4f7f0f25693cb2caddb128a /desktop
parent0ff8140676877f7a37ceb14d9ba797d6e2a18cf6 (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')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx3
-rw-r--r--desktop/source/lib/init.cxx44
2 files changed, 46 insertions, 1 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index 93e81b595f65..eb3c713560ee 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -2782,10 +2782,11 @@ void DesktopLOKTest::testABI()
CPPUNIT_ASSERT_EQUAL(documentClassOffset(52), offsetof(struct _LibreOfficeKitDocumentClass, getClipboard));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(53), offsetof(struct _LibreOfficeKitDocumentClass, setClipboard));
CPPUNIT_ASSERT_EQUAL(documentClassOffset(54), offsetof(struct _LibreOfficeKitDocumentClass, getSelectionType));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), offsetof(struct _LibreOfficeKitDocumentClass, removeTextContext));
// Extending is fine, update this, and add new assert for the offsetof the
// new method
- CPPUNIT_ASSERT_EQUAL(documentClassOffset(55), sizeof(struct _LibreOfficeKitDocumentClass));
+ CPPUNIT_ASSERT_EQUAL(documentClassOffset(56), sizeof(struct _LibreOfficeKitDocumentClass));
}
CPPUNIT_TEST_SUITE_REGISTRATION(DesktopLOKTest);
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");