summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.co.uk>2017-07-30 06:06:56 +0530
committerPranav Kant <pranavk@collabora.co.uk>2017-10-02 11:01:07 +0530
commitd43ffd307a21af234576e8efc99f306b110765b1 (patch)
treea4940a49f7f29f02bca9d4e4f9757bde248aa285 /sw
parent522a9c0a4164caf82b17e9808636577ebe75bf67 (diff)
lokdialog: Handle key events in core
Change-Id: If84aaac87beebf69d92db5446fc713d8cc20421e
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx31
1 files changed, 30 insertions, 1 deletions
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 782d5f7f952c..8d2184a3bfa2 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3667,9 +3667,38 @@ void SwXTextDocument::paintDialog(const vcl::DialogID& rDialogID, VirtualDevice&
nHeight = aSize.getHeight();
}
-void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& /*rDialogID*/, int /*nType*/, int /*nCharCode*/, int /*nKeyCode*/)
+void SwXTextDocument::postDialogKeyEvent(const vcl::DialogID& rDialogID, int nType, int nCharCode, int nKeyCode)
{
+ SolarMutexGuard aGuard;
+
+ // check if dialog is already open
+ SfxViewFrame* pViewFrame = pDocShell->GetView()->GetViewFrame();
+ SfxSlotPool* pSlotPool = SW_MOD()->GetSlotPool();
+ const SfxSlot* pSlot = pSlotPool->GetUnoSlot(rDialogID);
+ if (!pSlot)
+ {
+ SAL_WARN("lok.dialog", "No slot found for " << rDialogID);
+ return;
+ }
+ SfxChildWindow* pChild = pViewFrame->GetChildWindow(pSlot->GetSlotId());
+ if (pChild)
+ {
+ Dialog* pDialog = static_cast<Dialog*>(pChild->GetWindow());
+ KeyEvent aEvent(nCharCode, nKeyCode, 0);
+ switch (nType)
+ {
+ case LOK_KEYEVENT_KEYINPUT:
+ pDialog->LOKKeyInput(aEvent);
+ break;
+ case LOK_KEYEVENT_KEYUP:
+ pDialog->LOKKeyUp(aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+ }
}
void SwXTextDocument::postDialogMouseEvent(const vcl::DialogID& rDialogID, int nType, int nX, int nY,