diff options
author | Bayram Çiçek <bayram.cicek@collabora.com> | 2024-10-30 16:29:16 +0300 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-10-31 12:59:06 +0100 |
commit | 459a9401f342210d7f6ab8fe6fa780ae28413ef6 (patch) | |
tree | bc04128df2416cec5c7799b6dc10f828640a132f /sc | |
parent | 4f7b778bd0c0ce6a97bb8964a935576a1d7d6637 (diff) |
sc: autofill: send to-be-deleted cell addresses
with LOK_CALLBACK_TOOLTIP
also avoid nullptr ViewShells:
- if (comphelper::LibreOfficeKit::isActive())
+ if (ScTabViewShell* pLOKViewShell
+ = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr)
Signed-off-by: Bayram Çiçek <bayram.cicek@collabora.com>
Change-Id: I38578297cc1aadefe8c43033cdb14b9460e22c90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175827
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/view/tabview4.cxx | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index 6fdfa0cefb81..99353eac81be 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -288,7 +288,26 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) aHelpStr = aHelpStr.replaceFirst("%2", OUString::number(nCols) ); } else if ( aViewData.GetDelMark( aDelRange ) ) + { aHelpStr = ScResId( STR_QUICKHELP_DELETE ); + + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) + { + // autofill: collect the cell addresses that will be deleted + OUString sDeleteCellAddress + = OUString::Concat(OUString::number(aDelRange.aStart.Row()) + " " + + OUString::number(aDelRange.aStart.Col()) + " " + + OUString::number(aDelRange.aEnd.Row()) + " " + + OUString::number(aDelRange.aEnd.Col())); + + tools::JsonWriter writer; + writer.put("type", "autofilldeletecells"); + writer.put("delrange", sDeleteCellAddress); + OString sPayloadString = writer.finishAndGetAsOString(); + pLOKViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); + } + } else if ( nEndX != aMarkRange.aEnd.Col() || nEndY != aMarkRange.aEnd.Row() ) aHelpStr = rDoc.GetAutoFillPreview( aMarkRange, nEndX, nEndY ); @@ -313,7 +332,8 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) sTipString = aHelpStr; sTopParent = pWin; - if (comphelper::LibreOfficeKit::isActive()) + if (ScTabViewShell* pLOKViewShell + = comphelper::LibreOfficeKit::isActive() ? aViewData.GetViewShell() : nullptr) { // we need to use nAddX and nAddX here because we need the next row&column address OUString sCol = OUString::number(nEndX + nAddX); @@ -327,8 +347,7 @@ void ScTabView::UpdateRef( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ ) writer.put("text", sTipString); writer.put("celladdress", sCellAddress); OString sPayloadString = writer.finishAndGetAsOString(); - ScTabViewShell* pViewShell = aViewData.GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); + pLOKViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TOOLTIP, sPayloadString); } } } |