diff options
-rw-r--r-- | android/Bootstrap/src/org/libreoffice/kit/Document.java | 3 | ||||
-rw-r--r-- | android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java | 2 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 7 | ||||
-rw-r--r-- | desktop/source/lib/lokandroid.cxx | 4 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 3 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 5 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKitGtk.h | 4 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 2 | ||||
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.c | 18 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 |
11 files changed, 38 insertions, 16 deletions
diff --git a/android/Bootstrap/src/org/libreoffice/kit/Document.java b/android/Bootstrap/src/org/libreoffice/kit/Document.java index 6966d2911032..cb798b52f2fa 100644 --- a/android/Bootstrap/src/org/libreoffice/kit/Document.java +++ b/android/Bootstrap/src/org/libreoffice/kit/Document.java @@ -103,8 +103,9 @@ public class Document { * @param type - mouse event type * @param x - x coordinate * @param y - y coordinate + * @param count - number of events */ - public native void postMouseEvent(int type, int x, int y); + public native void postMouseEvent(int type, int x, int y, int count); /** * Callback to retrieve messages from LOK diff --git a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java index 20fce2711ad9..78af14b2d93b 100644 --- a/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java +++ b/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitTileProvider.java @@ -316,7 +316,7 @@ public class LOKitTileProvider implements TileProvider, Document.MessageCallback int x = (int) pixelToTwip(inDocument.x, mDPI); int y = (int) pixelToTwip(inDocument.y, mDPI); - mDocument.postMouseEvent(type, x, y); + mDocument.postMouseEvent(type, x, y, 1); } @Override diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 940f413a2c9b..644301969ca8 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -205,7 +205,8 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, static void doc_postMouseEvent (LibreOfficeKitDocument* pThis, int nType, int nX, - int nY); + int nY, + int nCount); struct LibLODocument_Impl : public _LibreOfficeKitDocument { @@ -659,7 +660,7 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, pDoc->registerCallback(pCallback, pData); } -static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) +static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount) { ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -668,7 +669,7 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, return; } - pDoc->postMouseEvent(nType, nX, nY); + pDoc->postMouseEvent(nType, nX, nY, nCount); } diff --git a/desktop/source/lib/lokandroid.cxx b/desktop/source/lib/lokandroid.cxx index 9ea51078c30f..d253cfe37bcc 100644 --- a/desktop/source/lib/lokandroid.cxx +++ b/desktop/source/lib/lokandroid.cxx @@ -278,10 +278,10 @@ extern "C" SAL_JNI_EXPORT jint JNICALL Java_org_libreoffice_kit_Office_saveAs } extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_kit_Document_postMouseEvent - (JNIEnv* pEnv, jobject aObject, jint type, jint x, jint y) + (JNIEnv* pEnv, jobject aObject, jint type, jint x, jint y, jint count) { LibreOfficeKitDocument* pDocument = getHandle<LibreOfficeKitDocument>(pEnv, aObject); - pDocument->pClass->postMouseEvent(pDocument, type, x, y); + pDocument->pClass->postMouseEvent(pDocument, type, x, y, count); } /* DirectBufferAllocator */ diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index e4852e4c4535..0ee2883b4027 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -175,7 +175,8 @@ struct _LibreOfficeKitDocumentClass void (*postMouseEvent)(LibreOfficeKitDocument* pThis, int nType, int nX, - int nY); + int nY, + int nCount); #endif // LOK_USE_UNSTABLE_API }; diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index 9891d4922fb5..8448fcd75204 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -111,10 +111,11 @@ public: * @param nType Event type, like down, move or up. * @param nX horizontal position in document coordinates * @param nY vertical position in document coordinates + * @param nCount number of clicks: 1 for single click, 2 for double click */ - inline void postMouseEvent(int nType, int nX, int nY) + inline void postMouseEvent(int nType, int nX, int nY, int nCount) { - mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY); + mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount); } #endif // LOK_USE_UNSTABLE_API }; diff --git a/include/LibreOfficeKit/LibreOfficeKitGtk.h b/include/LibreOfficeKit/LibreOfficeKitGtk.h index 7313215eb1b4..934d55acc748 100644 --- a/include/LibreOfficeKit/LibreOfficeKitGtk.h +++ b/include/LibreOfficeKit/LibreOfficeKitGtk.h @@ -46,6 +46,10 @@ struct _LOKDocView GdkRectangle m_aVisibleCursor; /// Cursor is visible or hidden (for blinking). gboolean m_bCursorVisible; + /// Time of the last button press. + guint32 m_nLastButtonPressTime; + /// Time of the last button release. + guint32 m_nLastButtonReleaseTime; }; struct _LOKDocViewClass diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index b231e98e61ff..9edd7a11aa9e 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -106,7 +106,7 @@ public: * * @see lok::Document::postMouseEvent(). */ - virtual void postMouseEvent(int /*nType*/, int /*nX*/, int /*nY*/) { } + virtual void postMouseEvent(int /*nType*/, int /*nX*/, int /*nY*/, int /*nCount*/) { } }; } // namespace vcl diff --git a/libreofficekit/source/gtk/lokdocview.c b/libreofficekit/source/gtk/lokdocview.c index d0c5cfba2314..3e791a7b6705 100644 --- a/libreofficekit/source/gtk/lokdocview.c +++ b/libreofficekit/source/gtk/lokdocview.c @@ -50,11 +50,23 @@ void lcl_signalButton(GtkWidget* pEventBox, GdkEventButton* pEvent, LOKDocView* switch (pEvent->type) { case GDK_BUTTON_PRESS: - pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); + { + int nCount = 1; + if ((pEvent->time - pDocView->m_nLastButtonPressTime) < 250) + nCount++; + pDocView->m_nLastButtonPressTime = pEvent->time; + pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount); break; + } case GDK_BUTTON_RELEASE: - pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y)); + { + int nCount = 1; + if ((pEvent->time - pDocView->m_nLastButtonReleaseTime) < 250) + nCount++; + pDocView->m_nLastButtonReleaseTime = pEvent->time; + pDocView->pDocument->pClass->postMouseEvent(pDocView->pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount); break; + } default: break; } @@ -116,6 +128,8 @@ static void lok_docview_init( LOKDocView* pDocView ) pDocView->m_bEdit = FALSE; memset(&pDocView->m_aVisibleCursor, 0, sizeof(pDocView->m_aVisibleCursor)); pDocView->m_bCursorVisible = FALSE; + pDocView->m_nLastButtonPressTime = 0; + pDocView->m_nLastButtonReleaseTime = 0; gtk_signal_connect( GTK_OBJECT(pDocView), "destroy", GTK_SIGNAL_FUNC(lcl_onDestroy), NULL ); diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 2d5161e2f2e0..894a12714946 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -414,7 +414,7 @@ public: */ virtual void registerCallback(LibreOfficeKitCallback pCallback, void* pData) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::postMouseEvent(). - virtual void postMouseEvent(int nType, int nX, int nY) SAL_OVERRIDE; + virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; void Invalidate(); void Reactivate(SwDocShell* pNewDocShell); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index e0de39b3564c..70abbac57cbf 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3173,12 +3173,12 @@ void SwXTextDocument::registerCallback(LibreOfficeKitCallback pCallback, void* p pViewShell->registerLibreOfficeKitCallback(pCallback, pData); } -void SwXTextDocument::postMouseEvent(int nType, int nX, int nY) +void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount) { SolarMutexGuard aGuard; SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); - MouseEvent aEvent(Point(nX, nY), 1, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + MouseEvent aEvent(Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); switch (nType) { |