sc/source/ui/view/gridwin.cxx | 48 +++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 17 deletions(-)
New commits: commit e15a843051890a5cb0521ec8192df7cc3ebb86d3 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Tue Dec 3 12:18:37 2019 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Wed Dec 4 12:38:20 2019 +0100 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.me...@collabora.com> 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); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits