[Libreoffice-commits] core.git: sc/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Jun 14 11:59:26 UTC 2016


 sc/source/ui/app/inputhdl.cxx    |   10 ++++++++-
 sc/source/ui/docshell/docsh3.cxx |   14 ++++++++++++-
 sc/source/ui/view/gridwin.cxx    |   40 +++++++++++++++++++++++++++++++--------
 sc/source/ui/view/gridwin4.cxx   |    8 ++++++-
 sc/source/ui/view/tabview5.cxx   |    8 ++++++-
 5 files changed, 68 insertions(+), 12 deletions(-)

New commits:
commit 0f258538b842e3a8639efc8c2c7afc16a1b0819e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 14 13:10:42 2016 +0200

    sc: implement per-view LOK_CALLBACK_INVALIDATE_TILES
    
    Port enough callbacks to the view callback, so that gtktiledviewer
    doesn't crash on opening a file.
    
    Change-Id: Iec39608ce3cdf7dcf5a7272f8c9a3415483a8e76
    Reviewed-on: https://gerrit.libreoffice.org/26251
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index dd96bfb..4b68939 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -3641,7 +3641,15 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState,
                         if ( pInputWin )
                             pInputWin->SetTextString(aString);
                         else if ( comphelper::LibreOfficeKit::isActive() )
-                            rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr());
+                        {
+                            if (comphelper::LibreOfficeKit::isViewCallback())
+                            {
+                                if (pActiveViewSh)
+                                    pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr());
+                            }
+                            else
+                                rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr());
+                        }
                     }
 
                     if ( pInputWin )                        // Named range input
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 72bdfad..20bb96c 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -166,7 +166,19 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, sal_uInt16 nPart, sal_uI
     // LOK: we are supposed to update the row / columns headers (and actually
     // the document size too - cell size affects that, obviously)
     if ((nPart & (PAINT_TOP | PAINT_LEFT)) && comphelper::LibreOfficeKit::isActive() && aDocument.GetDrawLayer())
-        aDocument.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
+    {
+        if (comphelper::LibreOfficeKit::isViewCallback())
+        {
+            SfxViewShell* pViewShell = SfxViewShell::GetFirst();
+            while (pViewShell)
+            {
+                pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
+                pViewShell = SfxViewShell::GetNext(*pViewShell);
+            }
+        }
+        else
+            aDocument.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
+    }
 }
 
 void ScDocShell::PostPaintGridAll()
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index f106884..edcbff8 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -5716,10 +5716,18 @@ OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoo
 
 void ScGridWindow::updateLibreOfficeKitCellCursor()
 {
-    ScDocument* pDoc = pViewData->GetDocument();
-    ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
     OString aCursor = getCellCursor(pViewData->GetZoomX(), pViewData->GetZoomY());
-    pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr());
+    if (comphelper::LibreOfficeKit::isViewCallback())
+    {
+        ScTabViewShell* pViewShell = pViewData->GetViewShell();
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr());
+    }
+    else
+    {
+        ScDocument* pDoc = pViewData->GetDocument();
+        ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+        pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr());
+    }
 }
 
 void ScGridWindow::CursorChanged()
@@ -5762,9 +5770,17 @@ void ScGridWindow::UpdateAllOverlays()
 
 void ScGridWindow::DeleteCursorOverlay()
 {
-    ScDocument* pDoc = pViewData->GetDocument();
-    ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
-    pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY");
+    if (comphelper::LibreOfficeKit::isViewCallback())
+    {
+        ScTabViewShell* pViewShell = pViewData->GetViewShell();
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY");
+    }
+    else
+    {
+        ScDocument* pDoc = pViewData->GetDocument();
+        ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+        pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY");
+    }
     mpOOCursors.reset();
 }
 
@@ -6121,8 +6137,16 @@ void ScGridWindow::UpdateSelectionOverlay()
     }
     else
     {
-        ScDocument* pDoc = pViewData->GetDocument();
-        pDoc->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY");
+        if (comphelper::LibreOfficeKit::isViewCallback())
+        {
+            ScTabViewShell* pViewShell = pViewData->GetViewShell();
+            pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY");
+        }
+        else
+        {
+            ScDocument* pDoc = pViewData->GetDocument();
+            pDoc->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY");
+        }
     }
 
     if ( aOldMode != aDrawMode )
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e698066..fd0aa92 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1026,7 +1026,13 @@ void ScGridWindow::LogicInvalidate(const Rectangle* pRectangle)
         sRectangle = aRectangle.toString();
     }
 
-    pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
+    if (comphelper::LibreOfficeKit::isViewCallback())
+    {
+        ScTabViewShell* pViewShell = pViewData->GetViewShell();
+        pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
+    }
+    else
+        pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr());
 }
 
 void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 6e5e3bf..7024567 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -310,7 +310,13 @@ void ScTabView::TabChanged( bool bSameTabButMoved )
             std::stringstream ss;
             ss << aDocSize.Width() << ", " << aDocSize.Height();
             OString sRect = ss.str().c_str();
-            pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr());
+            if (comphelper::LibreOfficeKit::isViewCallback())
+            {
+                ScTabViewShell* pViewShell = aViewData.GetViewShell();
+                pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr());
+            }
+            else
+                pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr());
         }
     }
 }


More information about the Libreoffice-commits mailing list