sc/source/ui/view/tabview4.cxx |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

New commits:
commit 886d9d3e25ea051b19ad27e5769d097d3782df5d
Author:     Bayram Çiçek <bayram.ci...@collabora.com>
AuthorDate: Thu Aug 29 12:13:58 2024 +0300
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Sep 9 13:04:59 2024 +0200

    add autofillpreviewtooltip type for LOK_CALLBACK_TOOLTIP
    
    - during autofilling of cells, there is a preview shows the cell value 
before filling
    - we need to send tooltip text and location info by using 
LOK_CALLBACK_TOOLTIP
    
    Signed-off-by: Bayram Çiçek <bayram.ci...@collabora.com>
    Change-Id: I9961764007aece9122c03eff7c155e7f3f25d9c4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172589
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    (cherry picked from commit 4a8731411bfdc51d042c6df52d0c2391a03ea028)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173023
    Tested-by: Jenkins

diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 2c7a5e1bdbed..8d1f1c871110 100644
--- a/sc/source/ui/view/tabview4.cxx
+++ b/sc/source/ui/view/tabview4.cxx
@@ -28,6 +28,8 @@
 #include <globstr.hrc>
 #include <scresid.hxx>
 #include <inputhdl.hxx>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+#include <tools/json_writer.hxx>
 
 // ---  Referenz-Eingabe / Fill-Cursor
 
@@ -310,6 +312,30 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB 
nCurZ )
         nTipAlign = nAlign;
         sTipString = aHelpStr;
         sTopParent = pWin;
+
+        if (comphelper::LibreOfficeKit::isActive())
+        {
+            double nPPTX = aViewData.GetPPTX();
+            double nPPTY = aViewData.GetPPTY();
+
+            OString sRectangleString = "EMPTY"_ostr;
+            if (!aTipRectangle.IsEmpty())
+            {
+                // selection start handle
+                tools::Rectangle aLogicRectangle(
+                    aTipRectangle.Left() / nPPTX, aTipRectangle.Top() / nPPTY,
+                    aTipRectangle.Right() / nPPTX, aTipRectangle.Bottom() / 
nPPTY);
+                sRectangleString = aLogicRectangle.toString();
+            }
+
+            tools::JsonWriter writer;
+            writer.put("type", "autofillpreviewtooltip");
+            writer.put("text", sTipString);
+            writer.put("location", sRectangleString);
+            OString sPayloadString = writer.finishAndGetAsOString();
+            ScTabViewShell* pViewShell = aViewData.GetViewShell();
+            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, 
sPayloadString);
+        }
     }
 }
 

Reply via email to