sc/source/ui/unoobj/docuno.cxx | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-)
New commits: commit 0778a154bef54cf6d591c9b0e1298fcc38380981 Author: Tor Lillqvist <t...@collabora.com> AuthorDate: Mon Jun 29 09:08:52 2020 +0300 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Tue Jun 30 22:26:13 2020 +0200 Attempt to fix three more cases of just "hoping" that things work right Change-Id: I81c87740b36beeb1288649712f6415cb6074348f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97416 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Tor Lillqvist <t...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97473 Tested-by: Jenkins diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index d0ec84d8cea5..cce2b7816d94 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -583,9 +583,14 @@ VclPtr<vcl::Window> ScModelObj::getDocWindow() { SolarMutexGuard aGuard; - // There seems to be no clear way of getting the grid window for this - // particular document, hence we need to hope we get the right window. - ScViewData* pViewData = ScDocShell::GetViewData(); + ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false); + + // FIXME: Can this happen? What should we do? + if (!pViewShell) + return VclPtr<vcl::Window>(); + + ScViewData* pViewData = &pViewShell->GetViewData(); + VclPtr<vcl::Window> pWindow; if (pViewData) { @@ -652,9 +657,14 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt { SolarMutexGuard aGuard; - // There seems to be no clear way of getting the grid window for this - // particular document, hence we need to hope we get the right window. - ScViewData* pViewData = ScDocShell::GetViewData(); + ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false); + + // FIXME: Can this happen? What should we do? + if (!pViewShell) + return; + + ScViewData* pViewData = &pViewShell->GetViewData(); + ScGridWindow* pGridWindow = pViewData->GetActiveWin(); if (!pGridWindow) @@ -800,15 +810,20 @@ void ScModelObj::setGraphicSelection(int nType, int nX, int nY) { SolarMutexGuard aGuard; - // There seems to be no clear way of getting the grid window for this - // particular document, hence we need to hope we get the right window. - ScViewData* pViewData = ScDocShell::GetViewData(); + ScTabViewShell* pViewShell = pDocShell->GetBestViewShell(false); + + // FIXME: Can this happen? What should we do? + if (!pViewShell) + return; + + ScViewData* pViewData = &pViewShell->GetViewData(); + ScGridWindow* pGridWindow = pViewData->GetActiveWin(); double fPPTX = pViewData->GetPPTX(); double fPPTY = pViewData->GetPPTY(); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + pViewShell = pViewData->GetViewShell(); LokChartHelper aChartHelper(pViewShell); if (aChartHelper.setGraphicSelection(nType, nX, nY, fPPTX, fPPTY)) return; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits