summaryrefslogtreecommitdiffstats
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-03 17:54:48 +0000
commitc6b18508aec0e609b4c3c000faf89c21e93620bd (patch)
tree42d862fa2b3f43992964154b235484caa4c0d633
parentlok: cleanup getCellCursor (diff)
downloadcore-c6b18508aec0e609b4c3c000faf89c21e93620bd.tar.gz
core-c6b18508aec0e609b4c3c000faf89c21e93620bd.zip
lok: send other views our cursor position in their view co-ordinates.
Change-Id: If8d84a04e8d7b4863dcb9bc9058939b1eb793266
-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 7064457290e3..a4ce729b3e2f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5664,28 +5664,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);
}
}