summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-01-20 10:17:03 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-01-26 10:27:37 +0100
commit0869d8ef419918ead63363a73a1838f3fe616b2a (patch)
treefefc80bdbc76608427dac5c2e2594727cf48483e /desktop
parent07997cba7745997d7e2ed908a8764ba1f0777f1e (diff)
Add initial lok::Office::postMouseEvent()
There is no unit conversion yet, most probably we want to work with doc model coordinates at an API level, while VCL works with pixel coordinates. Change-Id: I98848851fbec5253e76c997844f6339402dfac46
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 14c18601f8a2..e8f98aa82330 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -253,6 +253,7 @@ static int lo_initialize (LibreOfficeKit* pThis, const ch
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);
+static void lo_postMouseEvent (LibreOfficeKit* pThis, int nType, int nX, int nY);
struct LibLibreOffice_Impl : public _LibreOfficeKit
@@ -272,6 +273,7 @@ struct LibLibreOffice_Impl : public _LibreOfficeKit
m_pOfficeClass->documentLoad = lo_documentLoad;
m_pOfficeClass->getError = lo_getError;
m_pOfficeClass->postKeyEvent = lo_postKeyEvent;
+ m_pOfficeClass->postMouseEvent = lo_postMouseEvent;
gOfficeClass = m_pOfficeClass;
}
@@ -670,6 +672,28 @@ static void lo_postKeyEvent(LibreOfficeKit* /*pThis*/, int nType, int nCode)
#endif
}
+static void lo_postMouseEvent(LibreOfficeKit* /*pThis*/, int nType, int nX, int nY)
+{
+#if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS)
+ if (SalFrame *pFocus = SvpSalFrame::GetFocusFrame())
+ {
+ MouseEvent aEvent = MouseEvent(Point(nX, nY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT);
+ switch (nType)
+ {
+ case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONDOWN, pFocus->GetWindow(), &aEvent);
+ break;
+ case LOK_MOUSEEVENT_MOUSEBUTTONUP:
+ Application::PostMouseEvent(VCLEVENT_WINDOW_MOUSEBUTTONUP, pFocus->GetWindow(), &aEvent);
+ break;
+ default:
+ assert(false);
+ break;
+ }
+ }
+#endif
+}
+
static void force_c_locale(void)
{
// force locale (and resource files loaded) to en-US