summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-12-03 12:18:37 +0000
committerMichael Meeks <michael.meeks@collabora.com>2019-12-04 12:38:20 +0100
commite15a843051890a5cb0521ec8192df7cc3ebb86d3 (patch)
tree707a71389e2f372811689211306eb3f48ce97351 /sc/source/ui/view
parent0b245e26dab8f40693fdb7e8e08e662bdba7590e (diff)
lok: send other views our cursor position in their view co-ordinates.
Change-Id: If8d84a04e8d7b4863dcb9bc9058939b1eb793266 Reviewed-on: https://gerrit.libreoffice.org/84373 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r--sc/source/ui/view/gridwin.cxx48
1 files changed, 31 insertions, 17 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index d634c4a853f8..9a4a3a18a491 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5692,28 +5692,42 @@ OString ScGridWindow::getCellCursor() const
return pViewData->describeCellCursor();
}
-void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* pOtherShell) const
-{
- OString aCursor = getCellCursor();
+// Send our cursor details to a view described by @pOtherShell, or all views
+// if @pOtherShell is null. In each case send the current view a cell-cursor
+// event, and others a cell_view_cursor event.
+//
+// NB. we need to re-construct the cursor details for each other view in their
+// own zoomed co-ordinate system.
+void ScGridWindow::updateLibreOfficeKitCellCursor(const SfxViewShell* pForShell) const
+{
+ if (!pForShell) // recurse with it set
+ {
+ for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
+ it = SfxViewShell::GetNext(*it))
+ updateLibreOfficeKitCellCursor(it);
+ return;
+ }
+
ScTabViewShell* pViewShell = pViewData->GetViewShell();
- if (pOtherShell)
+ if (pForShell == pViewShell)
{
- if (pOtherShell == pViewShell)
- {
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr());
-
- if (bListValButton && aListValPos == pViewData->GetCurPos())
- updateLOKValListButton(true, aListValPos);
- }
- else
- {
- SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
- }
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, getCellCursor().getStr());
+ if (bListValButton && aListValPos == pViewData->GetCurPos())
+ updateLOKValListButton(true, aListValPos);
}
else
{
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr());
- SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
+ OString aCursor("EMPTY");
+ if (mpOOCursors) // cf. getCellCursor above
+ {
+ auto pOther = dynamic_cast<const ScTabViewShell *>(pForShell);
+ assert(pOther);
+ if (!pOther)
+ return;
+ aCursor = pOther->GetViewData().describeCellCursorAt(
+ pViewData->GetCurX(), pViewData->GetCurY()); // our position.
+ }
+ SfxLokHelper::notifyOtherView(pViewShell, pForShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
}
}