summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2019-12-04 22:29:10 +0000
committerMichael Meeks <michael.meeks@collabora.com>2019-12-09 10:42:14 +0100
commit53a647afa68264422d556156b4e77e1b6f46a996 (patch)
tree9bda90be096aaadbe2f30aaae71a91f7fd8ad302
parent3cd30978ebfbde5425038281252e9b85ef3a3c48 (diff)
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@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 2986620074d104611a6e78c98ee5a09941866125) Reviewed-on: https://gerrit.libreoffice.org/84698 Tested-by: Jenkins
-rw-r--r--sc/source/ui/inc/gridwin.hxx6
-rw-r--r--sc/source/ui/unoobj/docuno.cxx3
-rw-r--r--sc/source/ui/view/gridwin.cxx75
-rw-r--r--sc/source/ui/view/tabvwshc.cxx2
4 files changed, 60 insertions, 26 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index f64bfaa8d667..375e6e3cad2b 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -432,7 +432,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 04c5bcbe400f..cae9343550f6 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -886,6 +886,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 46c47bd46ecd..894f3d3f8e94 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5692,42 +5692,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());
}
}
@@ -6039,7 +6066,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 b936e5553a0d..b9ba63505887 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -462,7 +462,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)