vcl/jsdialog/executor.cxx |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 2779e669fd54695ace5a9425280d1efca93729b6
Author:     Mert Tumer <mert.tu...@collabora.com>
AuthorDate: Wed Dec 16 23:01:25 2020 +0300
Commit:     Mert Tumer <mert.tu...@collabora.com>
CommitDate: Tue Jul 6 09:02:18 2021 +0200

    jsdialogs: send click pos for drawingarea
    
    Change-Id: I91aae808fe17f47fe9fa75dca069e4919c2ce4c3
    Signed-off-by: Mert Tumer <mert.tu...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108685
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109216
    Tested-by: Jenkins

diff --git a/vcl/jsdialog/executor.cxx b/vcl/jsdialog/executor.cxx
index c8659b22158e..39d39601c02f 100644
--- a/vcl/jsdialog/executor.cxx
+++ b/vcl/jsdialog/executor.cxx
@@ -141,6 +141,25 @@ bool ExecuteAction(sal_uInt64 nWindowId, const OString& 
rWidget, StringMap& rDat
             {
                 if (sAction == "click")
                 {
+                    int separatorPos = rData["data"].indexOf(';');
+                    if (separatorPos > 0)
+                    {
+                        // x;y
+                        std::string_view clickPosX = OUStringToOString(
+                            rData["data"].subView(0, separatorPos), 
RTL_TEXTENCODING_ASCII_US);
+                        std::string_view clickPosY = OUStringToOString(
+                            rData["data"].subView(separatorPos + 1), 
RTL_TEXTENCODING_ASCII_US);
+                        if (!clickPosX.empty() && !clickPosY.empty())
+                        {
+                            double posX = std::atof(clickPosX.data());
+                            double posY = std::atof(clickPosY.data());
+                            Size size = pArea->get_size_request();
+                            posX = posX * size.Width();
+                            posY = posY * size.Height();
+                            LOKTrigger::trigger_click(*pArea, Point(posX, 
posY));
+                            return true;
+                        }
+                    }
                     LOKTrigger::trigger_click(*pArea, Point(10, 10));
                     return true;
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to