[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/source
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Sat Dec 7 21:32:31 UTC 2019
sc/source/ui/inc/gridwin.hxx | 6 ++-
sc/source/ui/unoobj/docuno.cxx | 3 +
sc/source/ui/view/gridwin.cxx | 75 +++++++++++++++++++++++++++--------------
sc/source/ui/view/tabvwshc.cxx | 2 -
4 files changed, 60 insertions(+), 26 deletions(-)
New commits:
commit 2986620074d104611a6e78c98ee5a09941866125
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Wed Dec 4 22:29:10 2019 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Sat Dec 7 22:31:54 2019 +0100
lok: calc - update our version of the other view's selections on zoom.
Change-Id: I8487f28d762c8bf5be4f00a331263218dc71d179
Reviewed-on: https://gerrit.libreoffice.org/84694
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 0f24ca05ee41..39242ccd0c1a 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -433,7 +433,11 @@ public:
/// get Cell cursor in this view's co-ordinate system @see ScModelObj::getCellCursor().
OString getCellCursor() const;
- void updateLibreOfficeKitCellCursor(const SfxViewShell* pOtherShell) const;
+ void notifyKitCellCursor() const;
+ void notifyKitCellViewCursor(const SfxViewShell* pForShell) const;
+ void updateKitCellCursor(const SfxViewShell* pOtherShell) const;
+ /// notify this view with new positions for other view's cursors (after zoom)
+ void updateKitOtherCursors() 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 13e3938a30a0..0a80f7a7579b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -892,6 +892,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
+ pViewData->GetActiveWin()->updateKitOtherCursors();
}
OUString ScModelObj::getRowColumnHeaders(const tools::Rectangle& rRectangle)
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index f00681cc0427..702031677df4 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5664,42 +5664,69 @@ OString ScGridWindow::getCellCursor() const
return pViewData->describeCellCursor();
}
-// 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
+void ScGridWindow::notifyKitCellCursor() const
+{
+ ScTabViewShell* pViewShell = pViewData->GetViewShell();
+
+ pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, getCellCursor().getStr());
+ if (bListValButton && aListValPos == pViewData->GetCurPos())
+ updateLOKValListButton(true, aListValPos);
+}
+
+void ScGridWindow::notifyKitCellViewCursor(const SfxViewShell* pForShell) const
+{
+ ScTabViewShell* pViewShell = pViewData->GetViewShell();
+
+ OString aCursor("EMPTY");
+ if (mpOOCursors) // cf. getCellCursor above
+ {
+ auto pForTabView = dynamic_cast<const ScTabViewShell *>(pForShell);
+ assert(pForTabView);
+ if (!pForTabView)
+ return;
+ aCursor = pForTabView->GetViewData().describeCellCursorAt(
+ pViewData->GetCurX(), pViewData->GetCurY()); // our position.
+ }
+ SfxLokHelper::notifyOtherView(pViewShell, pForShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor);
+}
+
+// Send our cursor details to a view described by @pForShell, or all views
+// if @pForShell 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
+void ScGridWindow::updateKitCellCursor(const SfxViewShell* pForShell) const
{
- if (!pForShell) // recurse with it set
+ if (!pForShell)
{
for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
it = SfxViewShell::GetNext(*it))
- updateLibreOfficeKitCellCursor(it);
+ updateKitCellCursor(it);
return;
}
- ScTabViewShell* pViewShell = pViewData->GetViewShell();
- if (pForShell == pViewShell)
- {
- pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, getCellCursor().getStr());
- if (bListValButton && aListValPos == pViewData->GetCurPos())
- updateLOKValListButton(true, aListValPos);
- }
+ if (pForShell == pViewData->GetViewShell())
+ notifyKitCellCursor();
else
+ notifyKitCellViewCursor(pForShell);
+}
+
+void ScGridWindow::updateKitOtherCursors() const
+{
+ for (SfxViewShell* it = SfxViewShell::GetFirst(); it;
+ it = SfxViewShell::GetNext(*it))
{
- 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);
+ auto pOther = dynamic_cast<const ScTabViewShell *>(it);
+ assert(pOther);
+ if (!pOther)
+ continue;
+ const ScGridWindow *pGrid = pOther->GetViewData().GetActiveWin();
+ assert(pGrid);
+ if (pGrid == this)
+ notifyKitCellCursor();
+ else
+ pGrid->notifyKitCellViewCursor(pViewData->GetViewShell());
}
}
@@ -6048,7 +6075,7 @@ void ScGridWindow::UpdateCursorOverlay()
if (comphelper::LibreOfficeKit::isActive())
{
mpOOCursors.reset(new sdr::overlay::OverlayObjectList);
- updateLibreOfficeKitCellCursor(nullptr);
+ updateKitCellCursor(nullptr);
}
else
{
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 38192b0206b9..61e776d8b798 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -551,7 +551,7 @@ void ScTabViewShell::NotifyCursor(SfxViewShell* pOtherShell) const
const ScGridWindow* pWin = GetViewData().GetActiveWin();
if (pWin)
- pWin->updateLibreOfficeKitCellCursor(pOtherShell);
+ pWin->updateKitCellCursor(pOtherShell);
}
css::uno::Reference<css::datatransfer::XTransferable2> ScTabViewShell::GetClipData(vcl::Window* pWin)
More information about the Libreoffice-commits
mailing list