diff options
-rw-r--r-- | chart2/source/controller/inc/ChartWindow.hxx | 5 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartWindow.cxx | 15 | ||||
-rw-r--r-- | sfx2/source/view/lokcharthelper.cxx | 41 |
3 files changed, 42 insertions, 19 deletions
diff --git a/chart2/source/controller/inc/ChartWindow.hxx b/chart2/source/controller/inc/ChartWindow.hxx index db9044970247..e4020c64e114 100644 --- a/chart2/source/controller/inc/ChartWindow.hxx +++ b/chart2/source/controller/inc/ChartWindow.hxx @@ -54,6 +54,11 @@ public: virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; virtual void RequestHelp( const HelpEvent& rHEvt ) override; + /// For LibreOfficeKit, we need to route these to the mouse events. + virtual void LogicMouseButtonDown(const MouseEvent&) override; + virtual void LogicMouseButtonUp(const MouseEvent&) override; + virtual void LogicMouseMove(const MouseEvent&) override; + void ForceInvalidate(); virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) override; virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE ) override; diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx index f0f6593d31fd..a0f7c31de47d 100644 --- a/chart2/source/controller/main/ChartWindow.cxx +++ b/chart2/source/controller/main/ChartWindow.cxx @@ -265,6 +265,21 @@ void ChartWindow::RequestHelp( const HelpEvent& rHEvt ) vcl::Window::RequestHelp( rHEvt ); } +void ChartWindow::LogicMouseButtonDown(const MouseEvent& rEvent) +{ + MouseButtonDown(rEvent); +} + +void ChartWindow::LogicMouseButtonUp(const MouseEvent& rEvent) +{ + MouseButtonUp(rEvent); +} + +void ChartWindow::LogicMouseMove(const MouseEvent& rEvent) +{ + MouseMove(rEvent); +} + void ChartWindow::adjustHighContrastMode() { static const DrawModeFlags nContrastMode = diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx index b3a326bfbc0b..370330ea83a6 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; } } |