diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2019-12-09 15:40:24 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-12-16 14:13:23 +0100 |
commit | d1064efc84c151630c0294a92b4caa08be676d8b (patch) | |
tree | b3be4f963b1f4c796ff11bc39fd6c5c74b69afaf /sc/source/ui/view | |
parent | 6c844f9bbc76f615d9a49526670538f045d82e0b (diff) |
lok: calc - update our version of the other view's selections on zoom.
Change-Id: I4d23bb77045b41d04109e7dd70a1f47bca8aaa56
Reviewed-on: https://gerrit.libreoffice.org/84767
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/84768
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/view')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index b358d9605caf..28fbef5fb1f7 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5910,7 +5910,7 @@ static OString rectanglesToString(const std::vector<tools::Rectangle> &rLogicRec } /** - * Turn the selection ranges rRectangles into the LibreOfficeKit selection, and call the callback. + * Turn the selection ranges rRectangles into the LibreOfficeKit selection, and send to other views. * * @param pLogicRects - if set then don't invoke the callback, just collect the rectangles in the pointed vector. */ @@ -5956,6 +5956,39 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect } } +/** + * Fetch the selection ranges for other views into the LibreOfficeKit selection, + * map them into our view co-ordinates and send to our view. + */ +void ScGridWindow::updateOtherKitSelections() const +{ + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + + for (SfxViewShell* it = SfxViewShell::GetFirst(); it; + it = SfxViewShell::GetNext(*it)) + { + auto pOther = dynamic_cast<const ScTabViewShell *>(it); + assert(pOther); + if (!pOther) + return; + + // Fetch pixels & convert for each view separately. + tools::Rectangle aBoundingBox; + std::vector<tools::Rectangle> aPixelRects; + GetPixelRectsFor(pOther->GetViewData().GetMarkData() /* theirs */, aPixelRects); + auto aOtherLogicRects = convertPixelToLogical(&pViewShell->GetViewData(), aPixelRects, aBoundingBox); + OString aRectsString = rectanglesToString(aOtherLogicRects); + if (it == pViewShell) + { + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, aBoundingBox.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aRectsString.getStr()); + } + else + SfxLokHelper::notifyOtherView(it, pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, + "selection", aRectsString.getStr()); + } +} + namespace { |