diff options
-rw-r--r-- | desktop/source/lib/init.cxx | 8 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.h | 4 | ||||
-rw-r--r-- | include/LibreOfficeKit/LibreOfficeKit.hxx | 4 | ||||
-rw-r--r-- | include/vcl/ITiledRenderable.hxx | 2 | ||||
-rw-r--r-- | libreofficekit/Library_libreofficekitgtk.mk | 4 | ||||
-rw-r--r-- | libreofficekit/source/gtk/lokdocview.cxx | 57 | ||||
-rw-r--r-- | libreofficekit/source/gtk/tilebuffer.hxx | 4 | ||||
-rw-r--r-- | sc/inc/docuno.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/inc/unomodel.hxx | 3 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 5 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 |
13 files changed, 88 insertions, 18 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 7eb54d3a6064..8fe6295d1321 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -230,7 +230,9 @@ static void doc_postMouseEvent (LibreOfficeKitDocument* pThis, int nType, int nX, int nY, - int nCount); + int nCount, + int nButtons, + int nModifier); static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pCommand, const char* pArguments); @@ -925,7 +927,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* /*pThis*/, const char* pC } } -static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount) +static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, int nY, int nCount, int nButtons, int nModifier) { ITiledRenderable* pDoc = getTiledRenderable(pThis); if (!pDoc) @@ -934,7 +936,7 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, return; } - pDoc->postMouseEvent(nType, nX, nY, nCount); + pDoc->postMouseEvent(nType, nX, nY, nCount, nButtons, nModifier); } static void doc_setTextSelection(LibreOfficeKitDocument* pThis, int nType, int nX, int nY) diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h index d83dd49f32b5..83dcc9803d8a 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.h +++ b/include/LibreOfficeKit/LibreOfficeKit.h @@ -137,7 +137,9 @@ struct _LibreOfficeKitDocumentClass int nType, int nX, int nY, - int nCount); + int nCount, + int nButtons, + int nModifier); /// @see lok::Document::postUnoCommand void (*postUnoCommand) (LibreOfficeKitDocument* pThis, diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx index acdfa27531e7..72231ad6af1c 100644 --- a/include/LibreOfficeKit/LibreOfficeKit.hxx +++ b/include/LibreOfficeKit/LibreOfficeKit.hxx @@ -192,9 +192,9 @@ public: * @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, int nCount) + inline void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) { - mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount); + mpDoc->pClass->postMouseEvent(mpDoc, nType, nX, nY, nCount, nButtons, nModifier); } /** diff --git a/include/vcl/ITiledRenderable.hxx b/include/vcl/ITiledRenderable.hxx index fd336f603296..c294d20dc9cf 100644 --- a/include/vcl/ITiledRenderable.hxx +++ b/include/vcl/ITiledRenderable.hxx @@ -112,7 +112,7 @@ public: * * @see lok::Document::postMouseEvent(). */ - virtual void postMouseEvent(int nType, int nX, int nY, int nCount) = 0; + virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) = 0; /** * Sets the start or end of a text selection. diff --git a/libreofficekit/Library_libreofficekitgtk.mk b/libreofficekit/Library_libreofficekitgtk.mk index 71a77e9e36a3..7d25abf944b1 100644 --- a/libreofficekit/Library_libreofficekitgtk.mk +++ b/libreofficekit/Library_libreofficekitgtk.mk @@ -16,6 +16,10 @@ $(eval $(call gb_Library_add_exception_objects,libreofficekitgtk,\ libreofficekit/source/gtk/tilebuffer \ )) +$(eval $(call gb_Library_use_externals,libreofficekitgtk,\ + boost_headers \ +)) + $(eval $(call gb_Library_add_cxxflags,libreofficekitgtk,\ $$(GTK3_CFLAGS) \ )) diff --git a/libreofficekit/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx index 2270231b1cf5..2d34e581ae73 100644 --- a/libreofficekit/source/gtk/lokdocview.cxx +++ b/libreofficekit/source/gtk/lokdocview.cxx @@ -20,6 +20,7 @@ #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <LibreOfficeKit/LibreOfficeKitGtk.h> #include <rsc/rsc-vcl-shared-types.hxx> +#include <vcl/event.hxx> #include "tilebuffer.hxx" @@ -66,6 +67,10 @@ struct _LOKDocViewPrivate guint32 m_nLastButtonPressTime; /// Time of the last button release. guint32 m_nLastButtonReleaseTime; + /// Last pressed button (left, right, middle) + guint32 m_nLastButtonPressed; + /// Key modifier (ctrl, atl, shift) + guint32 m_nKeyModifier; /// Rectangles of the current text selection. std::vector<GdkRectangle> m_aTextSelectionRectangles; /// Position and size of the selection start (as if there would be a cursor caret there). @@ -267,6 +272,7 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) return FALSE; } + priv->m_nKeyModifier = 0; switch (pEvent->keyval) { case GDK_KEY_BackSpace: @@ -296,6 +302,21 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) case GDK_KEY_Right: nKeyCode = com::sun::star::awt::Key::RIGHT; break; + case GDK_KEY_Shift_L: + case GDK_KEY_Shift_R: + if (pEvent->type == GDK_KEY_PRESS) + priv->m_nKeyModifier |= KEY_SHIFT; + break; + case GDK_KEY_Control_L: + case GDK_KEY_Control_R: + if (pEvent->type == GDK_KEY_PRESS) + priv->m_nKeyModifier |= KEY_MOD1; + break; + case GDK_KEY_Alt_L: + case GDK_KEY_Alt_R: + if (pEvent->type == GDK_KEY_PRESS) + priv->m_nKeyModifier |= KEY_MOD2; + break; default: if (pEvent->keyval >= GDK_KEY_F1 && pEvent->keyval <= GDK_KEY_F26) nKeyCode = com::sun::star::awt::Key::F1 + (pEvent->keyval - GDK_KEY_F1); @@ -309,7 +330,6 @@ signalKey (GtkWidget* pWidget, GdkEventKey* pEvent) if (pEvent->state & GDK_SHIFT_MASK) nKeyCode |= KEY_SHIFT; - if (pEvent->type == GDK_KEY_RELEASE) { GTask* task = g_task_new(pDocView, NULL, NULL, NULL); @@ -1060,6 +1080,20 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); pLOEvent->m_nPostMouseEventCount = nCount; + switch (pEvent->button) + { + case 1: + pLOEvent->m_nPostMouseEventButton = MOUSE_LEFT; + break; + case 2: + pLOEvent->m_nPostMouseEventButton = MOUSE_MIDDLE; + break; + case 3: + pLOEvent->m_nPostMouseEventButton = MOUSE_RIGHT; + break; + } + pLOEvent->m_nPostMouseEventModifier = priv->m_nKeyModifier; + priv->m_nLastButtonPressed = pLOEvent->m_nPostMouseEventButton; g_task_set_task_data(task, pLOEvent, LOEvent::destroy); g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); @@ -1078,6 +1112,20 @@ lok_doc_view_signal_button(GtkWidget* pWidget, GdkEventButton* pEvent) pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); pLOEvent->m_nPostMouseEventCount = nCount; + switch (pEvent->button) + { + case 1: + pLOEvent->m_nPostMouseEventButton = MOUSE_LEFT; + break; + case 2: + pLOEvent->m_nPostMouseEventButton = MOUSE_MIDDLE; + break; + case 3: + pLOEvent->m_nPostMouseEventButton = MOUSE_RIGHT; + break; + } + pLOEvent->m_nPostMouseEventModifier = priv->m_nKeyModifier; + priv->m_nLastButtonPressed = pLOEvent->m_nPostMouseEventButton; g_task_set_task_data(task, pLOEvent, LOEvent::destroy); g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); @@ -1182,6 +1230,9 @@ lok_doc_view_signal_motion (GtkWidget* pWidget, GdkEventMotion* pEvent) pLOEvent->m_nPostMouseEventX = pixelToTwip(pEvent->x, priv->m_fZoom); pLOEvent->m_nPostMouseEventY = pixelToTwip(pEvent->y, priv->m_fZoom); pLOEvent->m_nPostMouseEventCount = 1; + pLOEvent->m_nPostMouseEventButton = priv->m_nLastButtonPressed; + pLOEvent->m_nPostMouseEventModifier = priv->m_nKeyModifier; + g_task_set_task_data(task, pLOEvent, LOEvent::destroy); g_thread_pool_push(priv->lokThreadPool, g_object_ref(task), NULL); @@ -1218,7 +1269,9 @@ postMouseEventInThread(gpointer data) pLOEvent->m_nPostMouseEventType, pLOEvent->m_nPostMouseEventX, pLOEvent->m_nPostMouseEventY, - pLOEvent->m_nPostMouseEventCount); + pLOEvent->m_nPostMouseEventCount, + pLOEvent->m_nPostMouseEventButton, + pLOEvent->m_nPostMouseEventModifier); } static void diff --git a/libreofficekit/source/gtk/tilebuffer.hxx b/libreofficekit/source/gtk/tilebuffer.hxx index 5a989fcf2059..668a72007f46 100644 --- a/libreofficekit/source/gtk/tilebuffer.hxx +++ b/libreofficekit/source/gtk/tilebuffer.hxx @@ -202,6 +202,8 @@ struct LOEvent int m_nPostMouseEventX; int m_nPostMouseEventY; int m_nPostMouseEventCount; + int m_nPostMouseEventButton; + int m_nPostMouseEventModifier; ///@} /// @name setGraphicSelection parameters @@ -230,6 +232,8 @@ struct LOEvent , m_nPostMouseEventX(0) , m_nPostMouseEventY(0) , m_nPostMouseEventCount(0) + , m_nPostMouseEventButton(0) + , m_nPostMouseEventModifier(0) , m_nSetGraphicSelectionType(0) , m_nSetGraphicSelectionX(0) , m_nSetGraphicSelectionY(0) diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index 34235a2a0b75..91358f6f5350 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -51,6 +51,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.h> #include <svl/itemprop.hxx> +#include <vcl/event.hxx> #include <vcl/ITiledRenderable.hxx> #include "drwlayer.hxx" @@ -398,7 +399,7 @@ public: virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::postMouseEvent(). - virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; + virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons = MOUSE_LEFT, int nModifier = 0) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::setTextSelection(). virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index e1835bd0d6dd..f9c7fdec8bbe 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -591,7 +591,7 @@ void ScModelObj::postKeyEvent(int nType, int nCharCode, int nKeyCode) } } -void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount) +void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) { SolarMutexGuard aGuard; @@ -607,7 +607,8 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount) pViewData->SetZoom(Fraction(1, 1), Fraction(1, 1), true); // Calc operates in pixels... - MouseEvent aEvent(Point(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY()), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + MouseEvent aEvent(Point(nX * pViewData->GetPPTX(), nY * pViewData->GetPPTY()), nCount, + MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); switch (nType) { diff --git a/sd/source/ui/inc/unomodel.hxx b/sd/source/ui/inc/unomodel.hxx index 6aff89c83444..f3debf8640a2 100644 --- a/sd/source/ui/inc/unomodel.hxx +++ b/sd/source/ui/inc/unomodel.hxx @@ -45,6 +45,7 @@ #include <sfx2/sfxbasemodel.hxx> #include <svx/fmdmod.hxx> +#include <vcl/event.hxx> #include <vcl/ITiledRenderable.hxx> #include <editeng/unoipset.hxx> @@ -249,7 +250,7 @@ public: /// @see vcl::ITiledRenderable::postKeyEvent(). virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::postMouseEvent(). - virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; + virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons = MOUSE_LEFT, int nModifier = 0) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::setTextSelection(). virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::getTextSelection(). diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index b12a77050ff0..0d322ea151f8 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2422,7 +2422,7 @@ void SdXImpressDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) } } -void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount) +void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) { SolarMutexGuard aGuard; @@ -2430,7 +2430,8 @@ void SdXImpressDocument::postMouseEvent(int nType, int nX, int nY, int nCount) if (!pViewShell) return; - MouseEvent aEvent(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + MouseEvent aEvent(Point(convertTwipToMm100(nX), convertTwipToMm100(nY)), nCount, + MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); switch (nType) { diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 1edefc4c82be..7315aab1985e 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -66,6 +66,7 @@ #include <editeng/UnoForbiddenCharsTable.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/implbase.hxx> +#include <vcl/event.hxx> #include <vcl/ITiledRenderable.hxx> #include <com/sun/star/tiledrendering/XTiledRenderable.hpp> @@ -419,7 +420,7 @@ public: /// @see vcl::ITiledRenderable::postKeyEvent(). virtual void postKeyEvent(int nType, int nCharCode, int nKeyCode) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::postMouseEvent(). - virtual void postMouseEvent(int nType, int nX, int nY, int nCount) SAL_OVERRIDE; + virtual void postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons = MOUSE_LEFT, int nModifier = 0) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::setTextSelection(). virtual void setTextSelection(int nType, int nX, int nY) SAL_OVERRIDE; /// @see vcl::ITiledRenderable::getTextSelection(). diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index b7f3d76b12dc..9a8128b5a345 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3272,12 +3272,12 @@ void SwXTextDocument::postKeyEvent(int nType, int nCharCode, int nKeyCode) } } -void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount) +void SwXTextDocument::postMouseEvent(int nType, int nX, int nY, int nCount, int nButtons, int nModifier) { SolarMutexGuard aGuard; SwEditWin& rEditWin = pDocShell->GetView()->GetEditWin(); - MouseEvent aEvent(Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, MOUSE_LEFT); + MouseEvent aEvent(Point(nX, nY), nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); switch (nType) { |