[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - sc/source

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Mon Jun 29 13:49:46 UTC 2020


 sc/source/ui/unoobj/docuno.cxx |   35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

New commits:
commit cda9684c1e1b34c1a7da5e0aaa34228fa6ec0aab
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Mon Jun 29 09:08:52 2020 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Mon Jun 29 15:49:11 2020 +0200

    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 at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

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;


More information about the Libreoffice-commits mailing list