summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-02-27 15:38:30 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-03-02 08:51:01 +0100
commit6650fe947d41bc43cb05b572acb50180799d5b91 (patch)
tree13e0efb096f8aa410a4db57cdd162960b42c92e8 /desktop
parent645bebd9f6090b1c617bd95ea990a7dac4afaabc (diff)
LOK: move Office::postKeyEvent to Document
The implementation still sends them to the currently active VCL frame, not to the given document, though. Change-Id: I6fa2decdea3f949c55287e802cb3373c85664207
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx45
-rw-r--r--desktop/source/lib/lokandroid.cxx14
2 files changed, 31 insertions, 28 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 4aea3d044c4e..0c2f4a943a2d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -203,6 +203,10 @@ static void doc_initializeForRendering(LibreOfficeKitDocument* pThis);
static void doc_registerCallback(LibreOfficeKitDocument* pThis,
LibreOfficeKitCallback pCallback,
void* pData);
+static void doc_postKeyEvent(LibreOfficeKitDocument* pThis,
+ int nType,
+ int nCharCode,
+ int nKeyCode);
static void doc_postMouseEvent (LibreOfficeKitDocument* pThis,
int nType,
int nX,
@@ -239,6 +243,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument
m_pDocumentClass->getDocumentSize = doc_getDocumentSize;
m_pDocumentClass->initializeForRendering = doc_initializeForRendering;
m_pDocumentClass->registerCallback = doc_registerCallback;
+ m_pDocumentClass->postKeyEvent = doc_postKeyEvent;
m_pDocumentClass->postMouseEvent = doc_postMouseEvent;
m_pDocumentClass->setTextSelection = doc_setTextSelection;
@@ -266,7 +271,6 @@ static char * lo_getError (LibreOfficeKit* pThis);
static LibreOfficeKitDocument* lo_documentLoadWithOptions (LibreOfficeKit* pThis,
const char* pURL,
const char* pOptions);
-static void lo_postKeyEvent (LibreOfficeKit* pThis, int nType, int nCharCode, int nKeyCode);
struct LibLibreOffice_Impl : public _LibreOfficeKit
@@ -286,7 +290,6 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
m_pOfficeClass->documentLoad = lo_documentLoad;
m_pOfficeClass->getError = lo_getError;
m_pOfficeClass->documentLoadWithOptions = lo_documentLoadWithOptions;
- m_pOfficeClass->postKeyEvent = lo_postKeyEvent;
gOfficeClass = m_pOfficeClass;
}
@@ -693,6 +696,25 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis,
pDoc->registerCallback(pCallback, pData);
}
+static void doc_postKeyEvent(LibreOfficeKitDocument* /*pThis*/, int nType, int nCharCode, int nKeyCode)
+{
+#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
+ if (SalFrame *pFocus = SvpSalFrame::GetFocusFrame())
+ {
+ KeyEvent aEvent(nCharCode, nKeyCode, 0);
+ switch (nType)
+ {
+ case LOK_KEYEVENT_KEYINPUT:
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
+ break;
+ case LOK_KEYEVENT_KEYUP:
+ Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
+ break;
+ }
+ }
+#endif
+}
+
static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount)
{
ITiledRenderable* pDoc = getTiledRenderable(pThis);
@@ -726,25 +748,6 @@ static char* lo_getError (LibreOfficeKit *pThis)
return pMemory;
}
-static void lo_postKeyEvent(LibreOfficeKit* /*pThis*/, int nType, int nCharCode, int nKeyCode)
-{
-#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
- if (SalFrame *pFocus = SvpSalFrame::GetFocusFrame())
- {
- KeyEvent aEvent(nCharCode, nKeyCode, 0);
- switch (nType)
- {
- case LOK_KEYEVENT_KEYINPUT:
- Application::PostKeyEvent(VCLEVENT_WINDOW_KEYINPUT, pFocus->GetWindow(), &aEvent);
- break;
- case LOK_KEYEVENT_KEYUP:
- Application::PostKeyEvent(VCLEVENT_WINDOW_KEYUP, pFocus->GetWindow(), &aEvent);
- break;
- }
- }
-#endif
-}
-
static void force_c_locale(void)
{
// force locale (and resource files loaded) to en-US
diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx
index a4f7297e7178..528ffe141586 100644
--- a/desktop/source/lib/lokandroid.cxx
+++ b/desktop/source/lib/lokandroid.cxx
@@ -75,13 +75,6 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Office_destroyAn
_exit(0);
}
-extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Office_postKeyEvent
- (JNIEnv* pEnv, jobject aObject, jint nType, jint nCharCode, jint nKeyCode)
-{
- LibreOfficeKit* pLibreOfficeKit = getHandle<LibreOfficeKit>(pEnv, aObject);
- pLibreOfficeKit->pClass->postKeyEvent(pLibreOfficeKit, nType, nCharCode, nKeyCode);
-}
-
namespace
{
@@ -277,6 +270,13 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs
return result;
}
+extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postKeyEvent
+ (JNIEnv* pEnv, jobject aObject, jint nType, jint nCharCode, jint nKeyCode)
+{
+ LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject);
+ pDocument->pClass->postKeyEvent(pDocument, nType, nCharCode, nKeyCode);
+}
+
extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postMouseEvent
(JNIEnv* pEnv, jobject aObject, jint type, jint x, jint y, jint count)
{