diff options
author | Tor Lillqvist <tml@collabora.com> | 2020-06-29 09:08:52 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2020-06-30 22:26:13 +0200 |
commit | 0778a154bef54cf6d591c9b0e1298fcc38380981 (patch) | |
tree | d93d492a6d35d9bf8f990ac10d14ef55be8fa11c /sc | |
parent | 31951265f541c9f5acf424674e2d1d97c0f3b8c2 (diff) |
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 <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97473
Tested-by: Jenkins
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 35 |
1 files changed, 25 insertions, 10 deletions
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; |