use row&column address for autofill preview popup

Signed-off-by: Bayram Çiçek <bayram.cicek@collabora.com>
Change-Id: I2206f13210f57db27d962f931ec9b1ced5ec8cf7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174502
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 2a3053921ee67e305130fc3dee6278c00f737e92)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175917
Tested-by: Jenkins
This commit is contained in:
Bayram Çiçek 2024-10-04 20:19:33 +03:00 committed by Caolán McNamara
parent addad96a7a
commit a9d1324b1d

View file

@ -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);