sc/source/ui/inc/gridwin.hxx | 1 + sc/source/ui/unoobj/docuno.cxx | 3 ++- sc/source/ui/view/gridwin.cxx | 38 +++++++++++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-)
New commits: commit ca2fdd792de5d6d208097b3049238865058c7cc1 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Mon Dec 9 15:40:24 2019 +0000 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Mon Dec 9 23:01:08 2019 +0100 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 <jenkinscollaboraoff...@gmail.com> Reviewed-by: Michael Meeks <michael.me...@collabora.com> diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 39242ccd0c1a..70f0e267b8fa 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -438,6 +438,7 @@ public: void updateKitCellCursor(const SfxViewShell* pOtherShell) const; /// notify this view with new positions for other view's cursors (after zoom) void updateKitOtherCursors() const; + void updateOtherKitSelections() const; /// Same as MouseButtonDown(), but coordinates are in logic unit. virtual void LogicMouseButtonDown(const MouseEvent& rMouseEvent) override; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 0a80f7a7579b..eb6957a0a5c1 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -893,8 +893,9 @@ void ScModelObj::setClientZoom(int nTilePixelWidth_, int nTilePixelHeight_, int pViewData->SetZoom(Fraction(nTilePixelWidth_ * TWIPS_PER_PIXEL, nTileTwipWidth_), Fraction(nTilePixelHeight_ * TWIPS_PER_PIXEL, nTileTwipHeight_), true); - // refresh our view's take on other view's cursors + // refresh our view's take on other view's cursors & selections pViewData->GetActiveWin()->updateKitOtherCursors(); + pViewData->GetActiveWin()->updateOtherKitSelections(); } OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle) diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 702031677df4..638c8b645aa6 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5882,7 +5882,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. */ @@ -5928,6 +5928,42 @@ 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; + + const ScGridWindow *pGrid = pOther->GetViewData().GetActiveWin(); + assert(pGrid); + + // 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 { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits