summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Varga <mihai.varga@collabora.com>2015-10-04 19:40:13 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-10-07 11:30:07 +0200
commit527a83d77c139427028ad08bef3a6349135716f7 (patch)
treecf0b7f6728463cf39978f15b0555f9c0fa1ae4f9
parent6818a61e94b7a7bfcab276e3ced3aa75c3deb16e (diff)
LOK: added the button type and key modifier to postMouseEvent()
To get a better functionality we need to know the button type (left, right, middle). We also need the key modifier (ctrl, alt, shift) for actions such as ctrl+click (to open a link) or shift+click to select (cherry picked from commit c90c08a65c480a1012182979d5e9218f17a2ba2e) Conflicts: libreofficekit/Library_libreofficekitgtk.mk libreofficekit/source/gtk/lokdocview.cxx libreofficekit/source/gtk/tilebuffer.hxx Change-Id: Iaccb93b276f8a6870dd41cc5132dbb85d2bbf71b
-rw-r--r--desktop/source/lib/init.cxx8
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h4
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx4
-rw-r--r--include/vcl/ITiledRenderable.hxx2
-rw-r--r--libreofficekit/source/gtk/lokdocview.cxx7
-rw-r--r--sc/inc/docuno.hxx3
-rw-r--r--sc/source/ui/unoobj/docuno.cxx5
-rw-r--r--sd/source/ui/inc/unomodel.hxx3
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx5
-rw-r--r--sw/inc/unotxdoc.hxx3
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx4
11 files changed, 29 insertions, 19 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 0c831b1354e9..5f07d513b0e2 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -233,7 +233,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);
@@ -927,7 +929,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)
@@ -936,7 +938,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 cd12ad64f245..e9167c510110 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 69889fcd8796..0014f4d75e05 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/source/gtk/lokdocview.cxx b/libreofficekit/source/gtk/lokdocview.cxx
index 1e5beae1d05d..e70e95f0998c 100644
--- a/libreofficekit/source/gtk/lokdocview.cxx
+++ b/libreofficekit/source/gtk/lokdocview.cxx
@@ -21,6 +21,7 @@
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <LibreOfficeKit/LibreOfficeKitGtk.h>
#include <rsc/rsc-vcl-shared-types.hxx>
+#include <vcl/event.hxx>
#if !GLIB_CHECK_VERSION(2,32,0)
#define G_SOURCE_REMOVE FALSE
@@ -461,7 +462,7 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent)
if ((pEvent->time - m_nLastButtonPressTime) < 250)
nCount++;
m_nLastButtonPressTime = pEvent->time;
- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
+ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, MOUSE_LEFT, 0);
break;
}
case GDK_BUTTON_RELEASE:
@@ -470,7 +471,7 @@ gboolean LOKDocView_Impl::signalButtonImpl(GdkEventButton* pEvent)
if ((pEvent->time - m_nLastButtonReleaseTime) < 250)
nCount++;
m_nLastButtonReleaseTime = pEvent->time;
- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount);
+ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEBUTTONUP, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), nCount, MOUSE_LEFT, 0);
break;
}
default:
@@ -552,7 +553,7 @@ gboolean LOKDocView_Impl::signalMotionImpl(GdkEventButton* pEvent)
}
// Otherwise a mouse move, as on the desktop.
- m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), 1);
+ m_pDocument->pClass->postMouseEvent(m_pDocument, LOK_MOUSEEVENT_MOUSEMOVE, pixelToTwip(pEvent->x), pixelToTwip(pEvent->y), 1, MOUSE_LEFT, 0);
return FALSE;
}
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index cd6888598f69..cc132278bdf8 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -54,6 +54,7 @@
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <svl/itemprop.hxx>
+#include <vcl/event.hxx>
#include <vcl/ITiledRenderable.hxx>
#include "drwlayer.hxx"
@@ -401,7 +402,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 84b2857b6542..26ce45b8d359 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -576,7 +576,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;
@@ -592,7 +592,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 009fb672cf27..4d7314875f0b 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>
@@ -248,7 +249,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 7e378362dc44..b8be619ba372 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -2441,7 +2441,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;
@@ -2449,7 +2449,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 311147eeaaea..346cab63ca02 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>
@@ -422,7 +423,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 0abbdfcff64e..7cb32fc065c6 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3273,12 +3273,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)
{