From a9d1324b1dbf4a74ee0b02859eb3197005df1bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bayram=20=C3=87i=C3=A7ek?= Date: Fri, 4 Oct 2024 20:19:33 +0300 Subject: [PATCH] use row&column address for autofill preview popup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bayram Çiçek Change-Id: I2206f13210f57db27d962f931ec9b1ced5ec8cf7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174502 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara (cherry picked from commit 2a3053921ee67e305130fc3dee6278c00f737e92) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175917 Tested-by: Jenkins --- sc/source/ui/view/tabview4.cxx | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 8d1f1c871110..2352f732befd 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -315,23 +315,17 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) if (comphelper::LibreOfficeKit::isActive()) { - double nPPTX = aViewData.GetPPTX(); - double nPPTY = aViewData.GetPPTY(); + // we need to use nAddX and nAddX here because we need the next row&column address + OUString sCol = OUString::number(nEndX + nAddX); + OUString sRow = OUString::number(nEndY + nAddY); - 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(); - } + // since start and end cells are the same, duplicate them + OUString sCellAddress = OUString::Concat(sCol + " " + sRow + " " + sCol + " " + sRow); tools::JsonWriter writer; writer.put("type", "autofillpreviewtooltip"); writer.put("text", sTipString); - writer.put("location", sRectangleString); + writer.put("celladdress", sCellAddress); OString sPayloadString = writer.finishAndGetAsOString(); ScTabViewShell* pViewShell = aViewData.GetViewShell(); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString);