summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-02-27 12:00:25 +0100
committerAndras Timar <andras.timar@collabora.com>2018-03-26 07:46:08 +0200
commit2cb11dc380c27215d244126960fdf62dc36e6f44 (patch)
treec03d8553ac71a5b4ac8fcff99419a9bb1d87b592 /sfx2
parente3072a1395d799410cf65e54bba2eac7a4fe4748 (diff)
lo chart2: The LokChartHelper must post the mouse events too.
Calling directly causes freezes in Execute() when instantiating dialogs. Change-Id: I3aa09b99e5a13027892aeba02860e87e29b172da Reviewed-on: https://gerrit.libreoffice.org/50419 Reviewed-by: Marco Cecchetti <mrcekets@gmail.com> Tested-by: Marco Cecchetti <mrcekets@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/50483 Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 584fc20be3bb6f90d17ef8a131575af9871cb1c4)
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/view/lokcharthelper.cxx41
1 files changed, 22 insertions, 19 deletions
diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx
index dc82d2ffe4db..cd7e6feeffc0 100644
--- a/sfx2/source/view/lokcharthelper.cxx
+++ b/sfx2/source/view/lokcharthelper.cxx
@@ -15,6 +15,8 @@
#include <toolkit/helper/vclunohelper.hxx>
#include <tools/fract.hxx>
#include <tools/mapunit.hxx>
+#include <vcl/ITiledRenderable.hxx>
+#include <vcl/svapp.hxx>
#include <vcl/virdev.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -22,7 +24,6 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
-
#define TWIPS_PER_PIXEL 15
using namespace com::sun::star;
@@ -275,32 +276,34 @@ bool LokChartHelper::postMouseEvent(int nType, int nX, int nY,
tools::Rectangle rChartBBox = GetChartBoundingBox();
if (rChartBBox.IsInside(aMousePos))
{
+ vcl::ITiledRenderable::LOKAsyncEventData* pLOKEv = new vcl::ITiledRenderable::LOKAsyncEventData;
+ pLOKEv->mpWindow = pChartWindow;
+ switch (nType)
+ {
+ case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
+ pLOKEv->mnEvent = VclEventId::WindowMouseButtonDown;
+ break;
+ case LOK_MOUSEEVENT_MOUSEBUTTONUP:
+ pLOKEv->mnEvent = VclEventId::WindowMouseButtonUp;
+ break;
+ case LOK_MOUSEEVENT_MOUSEMOVE:
+ pLOKEv->mnEvent = VclEventId::WindowMouseMove;
+ break;
+ default:
+ assert(false);
+ }
+
int nChartWinX = nX - rChartBBox.Left();
int nChartWinY = nY - rChartBBox.Top();
// chart window expects pixels, but the conversion factor
// can depend on the client zoom
Point aPos(nChartWinX * fScaleX, nChartWinY * fScaleY);
- MouseEvent aEvent(aPos, nCount,
+ pLOKEv->maMouseEvent = MouseEvent(aPos, nCount,
MouseEventModifiers::SIMPLECLICK, nButtons, nModifier);
- switch (nType)
- {
- case LOK_MOUSEEVENT_MOUSEBUTTONDOWN:
- pChartWindow->MouseButtonDown(aEvent);
- break;
- case LOK_MOUSEEVENT_MOUSEBUTTONUP:
- pChartWindow->MouseButtonUp(aEvent);
- if (pChartWindow->IsTracking())
- pChartWindow->EndTracking(TrackingEventFlags::DontCallHdl);
- break;
- case LOK_MOUSEEVENT_MOUSEMOVE:
- pChartWindow->MouseMove(aEvent);
- break;
- default:
- assert(false);
- break;
- }
+ Application::PostUserEvent(Link<void*, void>(pLOKEv, vcl::ITiledRenderable::LOKPostAsyncEvent));
+
return true;
}
}