diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-14 13:10:42 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-14 11:58:59 +0000 |
commit | 0f258538b842e3a8639efc8c2c7afc16a1b0819e (patch) | |
tree | da51c65173c380d0e60ee0cee38907200e088f2b | |
parent | e0681a63566a5e4ccd7570f7884f73b05ba3f349 (diff) |
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@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 14 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 40 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 8 |
5 files changed, 68 insertions, 12 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index dd96bfbb880f..4b6893998ca9 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 72bdfadbebaf..20bb96cc3928 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 f106884376cf..edcbff82687e 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 e698066820de..fd0aa9204d1a 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 6e5e3bf27caa..7024567f32fd 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()); } } } |