diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2020-06-16 08:38:04 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-06-29 15:15:08 +0200 |
commit | a40cb25a21d6d36ca227c77c5e58c102660bdd65 (patch) | |
tree | 4286ecf36d5ae8826b8eeb30fc0900887f22825f | |
parent | pdf: add text page object attribs, refactor ImpSdrPdfImport, tests (diff) | |
download | core-a40cb25a21d6d36ca227c77c5e58c102660bdd65.tar.gz core-a40cb25a21d6d36ca227c77c5e58c102660bdd65.zip |
jsdialog: click action for drawing area
Change-Id: I2434bec675559a97e5d251c6d6a958464b6db034
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96853
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97395
Tested-by: Jenkins
-rw-r--r-- | desktop/source/lib/init.cxx | 13 | ||||
-rw-r--r-- | include/vcl/layout.hxx | 20 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/salvtables.hxx | 2 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 7 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 5 |
6 files changed, 39 insertions, 10 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 20ec8c0caccf..9dcd1a2e0dac 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3679,6 +3679,19 @@ static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWin bContinueWithLOKWindow = true; } } + else if (sControlType == "drawingarea") + { + auto pArea = dynamic_cast<weld::DrawingArea*>(pWidget); + if (pArea) + { + if (sAction == "click") + { + pArea->click(Point(10, 10)); + } + else + bContinueWithLOKWindow = true; + } + } else if (sControlType == "spinfield") { auto pSpinField = dynamic_cast<weld::SpinButton*>(pWidget); diff --git a/include/vcl/layout.hxx b/include/vcl/layout.hxx index cee1621f2f3b..ff33f1a107f8 100644 --- a/include/vcl/layout.hxx +++ b/include/vcl/layout.hxx @@ -666,16 +666,6 @@ private: if (!m_aMouseMotionHdl.Call(rMEvt)) Control::MouseMove(rMEvt); } - virtual void MouseButtonDown(const MouseEvent& rMEvt) override - { - if (!m_aMousePressHdl.Call(rMEvt)) - Control::MouseButtonDown(rMEvt); - } - virtual void MouseButtonUp(const MouseEvent& rMEvt) override - { - if (!m_aMouseReleaseHdl.Call(rMEvt)) - Control::MouseButtonUp(rMEvt); - } virtual void KeyInput(const KeyEvent& rKEvt) override { if (!m_aKeyPressHdl.Call(rKEvt)) @@ -749,6 +739,16 @@ public: { SetBackground(); } + virtual void MouseButtonDown(const MouseEvent& rMEvt) override + { + if (!m_aMousePressHdl.Call(rMEvt)) + Control::MouseButtonDown(rMEvt); + } + virtual void MouseButtonUp(const MouseEvent& rMEvt) override + { + if (!m_aMouseReleaseHdl.Call(rMEvt)) + Control::MouseButtonUp(rMEvt); + } void SetUITestFactory(FactoryFunction pFactoryFunction, void* pUserData) { m_pFactoryFunction = pFactoryFunction; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 05d5eeeb50d4..6d72135b21ee 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -2107,6 +2107,8 @@ public: virtual a11yref get_accessible_parent() = 0; virtual a11yrelationset get_accessible_relation_set() = 0; virtual Point get_accessible_location() = 0; + + virtual void click(Point pos) = 0; }; class VCL_DLLPUBLIC Menu diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index 3e748bf5a657..53515ad13ac6 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -1160,6 +1160,8 @@ public: virtual ~SalInstanceDrawingArea() override; virtual OutputDevice& get_ref_device() override; + + virtual void click(Point pos) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 6a299156b404..391f2a6dc40a 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -5760,6 +5760,13 @@ SalInstanceDrawingArea::~SalInstanceDrawingArea() OutputDevice& SalInstanceDrawingArea::get_ref_device() { return *m_xDrawingArea; } +void SalInstanceDrawingArea::click(Point pos) +{ + MouseEvent aEvent(pos); + m_xDrawingArea->MouseButtonDown(aEvent); + m_xDrawingArea->MouseButtonUp(aEvent); +} + IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void) { m_aDrawHdl.Call(aPayload); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 804fa0ec7df3..620cc74b5fae 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -12826,6 +12826,11 @@ public: { return *m_xDevice; } + + void click(Point /*pos*/) override + { + //TODO + } }; } |