summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2020-06-29 09:08:52 +0300
committerTor Lillqvist <tml@collabora.com>2020-06-29 15:49:11 +0200
commitcda9684c1e1b34c1a7da5e0aaa34228fa6ec0aab (patch)
treeddabea621ee60026a433a560c3c1c8bea27d7c8c /sc
parentdb934da2f3d6b9ae3a1f62579a173098e3c15742 (diff)
Attempt to fix three more places 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>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/unoobj/docuno.cxx35
1 files changed, 25 insertions, 10 deletions
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index b1e0bcc9d902..a29a5d7eea3b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -581,9 +581,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)
{
@@ -650,9 +655,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)
@@ -798,15 +808,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;