diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-21 12:42:08 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-01-26 10:27:42 +0100 |
commit | bb0b878b9d8a63e43c5063b65b1b2381621a18f6 (patch) | |
tree | bbbbf5232a6e60dcb176923c58eb44cd2aebc2e6 /desktop | |
parent | 167412ce5e10f2e84ac960eb99bf9ce87df03050 (diff) |
LOK: move postMouseEvent to Document
Change-Id: I5d2d2d05fc0f55d98a1e7a1591b4d66fd93ad353
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index e8f98aa82330..154a8f5ae630 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_postMouseEvent (LibreOfficeKitDocument* pThis, + int nType, + int nX, + int nY); struct LibLODocument_Impl : public _LibreOfficeKitDocument { @@ -230,6 +234,7 @@ struct LibLODocument_Impl : public _LibreOfficeKitDocument m_pDocumentClass->getDocumentSize = doc_getDocumentSize; m_pDocumentClass->initializeForRendering = doc_initializeForRendering; m_pDocumentClass->registerCallback = doc_registerCallback; + m_pDocumentClass->postMouseEvent = doc_postMouseEvent; gDocumentClass = m_pDocumentClass; } @@ -253,7 +258,6 @@ 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 @@ -273,7 +277,6 @@ 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; } @@ -644,6 +647,19 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, pDoc->registerCallback(pCallback, pData); } +static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) +{ + ITiledRenderable* pDoc = getTiledRenderable(pThis); + if (!pDoc) + { + gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; + return; + } + + pDoc->postMouseEvent(nType, nX, nY); +} + + static char* lo_getError (LibreOfficeKit *pThis) { LibLibreOffice_Impl* pLib = static_cast<LibLibreOffice_Impl*>(pThis); @@ -672,28 +688,6 @@ 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 |