summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-01-08 17:13:20 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-01-12 11:06:41 +0100
commit8de39435246176ed3eb603c177c8c3d26f9027b9 (patch)
treec0e84eaacb06dd0911c94946ec48a9fdb64a47b8 /desktop
parent8d8729cecd3b1707c936873ec02c9fbca3c66cf2 (diff)
Add lok::Office::postKeyEvent()
Change-Id: Ib80a8dd433b22a5e88aaab8e11d5c42ced8097ae
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx18
1 files changed, 18 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 08a353fbd2d5..c3eedf5b98d7 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -54,6 +54,7 @@
#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
// And let's also grab the SvpSalInstance and SvpSalVirtualDevice
#include <headless/svpinst.hxx>
+#include <headless/svpframe.hxx>
#include <headless/svpvd.hxx>
#include <basebmp/bitmapdevice.hxx>
@@ -251,6 +252,8 @@ static void lo_destroy (LibreOfficeKit* pThis);
static int lo_initialize (LibreOfficeKit* pThis, const char* pInstallPath);
static LibreOfficeKitDocument* lo_documentLoad (LibreOfficeKit* pThis, const char* pURL);
static char * lo_getError (LibreOfficeKit* pThis);
+static void lo_postKeyEvent (LibreOfficeKit* pThis, int nType, int nCode);
+
struct LibLibreOffice_Impl : public _LibreOfficeKit
{
@@ -268,6 +271,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
m_pOfficeClass->destroy = lo_destroy;
m_pOfficeClass->documentLoad = lo_documentLoad;
m_pOfficeClass->getError = lo_getError;
+ m_pOfficeClass->postKeyEvent = lo_postKeyEvent;
gOfficeClass = m_pOfficeClass;
}
@@ -647,6 +651,20 @@ static char* lo_getError (LibreOfficeKit *pThis)
return pMemory;
}
+static void lo_postKeyEvent(LibreOfficeKit* /*pThis*/, int nType, int nCode)
+{
+#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
+ if (SalFrame *pFocus = SvpSalFrame::GetFocusFrame())
+ {
+ KeyEvent aEvent(nCode, nCode, 0);
+ if (nType == 0)
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
+ else
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
+ }
+#endif
+}
+
static void force_c_locale(void)
{
// force locale (and resource files loaded) to en-US