diff options
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 48 |
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); } } |