diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-01 09:11:37 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-09-01 09:07:48 +0000 |
commit | fcf417a77369853195d6727b2db8df290663256e (patch) | |
tree | 9905acc11d39f87e75833eb1b5ed0873b6bb14bf /sc/source/ui/view/gridwin.cxx | |
parent | b8ee524330d924456931ad602eb4701b55a2aa85 (diff) |
sc lok: implement SfxViewShell::NotifyCursor() API
This way a new Calc view gets the cell cursors of existing views even if
they don't move after registering the LOK callback in the new view.
Change-Id: I5babc9921d37217ac199d4c19ed33cbb9620d119
Reviewed-on: https://gerrit.libreoffice.org/28581
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc/source/ui/view/gridwin.cxx')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 94d38beb07cb..220cd6f7f31f 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5682,7 +5682,8 @@ OString ScGridWindow::getCellCursor( int nOutputWidth, int nOutputHeight, return getCellCursor(zoomX, zoomY); } -OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) { +OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoomY) const +{ // GridWindow stores a shown cell cursor in mpOOCursors, hence // we can use that to determine whether we would want to be showing // one (client-side) for tiled rendering too. @@ -5714,12 +5715,22 @@ OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoo return aRect.toString(); } -void ScGridWindow::updateLibreOfficeKitCellCursor() +void ScGridWindow::updateLibreOfficeKitCellCursor(SfxViewShell* pOtherShell) const { OString aCursor = getCellCursor(pViewData->GetZoomX(), pViewData->GetZoomY()); ScTabViewShell* pViewShell = pViewData->GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr()); - SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor); + if (pOtherShell) + { + if (pOtherShell == pViewShell) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr()); + else + SfxLokHelper::notifyOtherView(pViewShell, pOtherShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor); + } + else + { + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr()); + SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor); + } } void ScGridWindow::CursorChanged() @@ -6010,7 +6021,7 @@ void ScGridWindow::UpdateCursorOverlay() if (comphelper::LibreOfficeKit::isActive()) { mpOOCursors.reset(new sdr::overlay::OverlayObjectList); - updateLibreOfficeKitCellCursor(); + updateLibreOfficeKitCellCursor(nullptr); } else { |