summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
authorBayram Çiçek <bayram.cicek@collabora.com>2024-10-30 16:29:16 +0300
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-20 12:14:09 +0100
commit57d123745a6e07da2a9893540e42b72e55641a59 (patch)
tree7d258813194a47efe58ba0bd717da1f668e6bd72 /sc/source/ui/view
parent5e3a88a283bbbe772703e099adcd70baf7ad3e2f (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> (cherry picked from commit 459a9401f342210d7f6ab8fe6fa780ae28413ef6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176825 Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/tabview4.cxx25
1 files changed, 22 insertions, 3 deletions
diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx
index 2352f732befd..082c275fe113 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);
}
}
}