diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-17 11:45:02 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-20 01:33:09 -0400 |
commit | 2a03b0e6fe09ba8ce02977d50814800e720b8d46 (patch) | |
tree | e623bffcb0793a320a414fa537e7519c3976d96f /sc | |
parent | b91d37bcab9a6ab734c96b9e0ca59c49a75e0ed2 (diff) |
comphelper lok: remove the g_bViewCallback global
Its purpose was to allow incrementally migrate all callers of
SdrModel::libreOfficeKitCallback() to use
SfxViewShell::libreOfficeKitViewCallback() (which allows notifying only
the currently active or all views) instead. That is done by now, so it
can go.
Change-Id: I521bbbe5c638dfd844ebf025153459a37362d3c3
Reviewed-on: https://gerrit.libreoffice.org/26413
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
(cherry picked from commit 5b5706f41f97998785e1e7ad356580772da80c42)
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/global.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 22 | ||||
-rw-r--r-- | sc/source/core/data/document.cxx | 56 | ||||
-rw-r--r-- | sc/source/core/data/global.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 35 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 65 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/tabcont.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/view/tabview5.cxx | 9 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 24 |
14 files changed, 72 insertions, 215 deletions
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index b236bad1d0c5..9c37703f4d1c 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -529,8 +529,7 @@ public: static void SetUserList( const ScUserList* pNewList ); SC_DLLPUBLIC static const OUString& GetRscString( sal_uInt16 nIndex ); /// Open the specified URL. - /// If pDrawLayer is specified, check if tiled-rendering, and leave clients to handle the openURL action if that's the case. - static void OpenURL(const OUString& rURL, const OUString& rTarget, const SdrModel* pDrawLayer = nullptr); + static void OpenURL(const OUString& rURL, const OUString& rTarget); SC_DLLPUBLIC static OUString GetAbsDocName( const OUString& rFileName, SfxObjectShell* pShell ); SC_DLLPUBLIC static OUString GetDocTabName( const OUString& rFileName, diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 219d9be9e8eb..a65ab573aae5 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1305,16 +1305,11 @@ bool ScDocument::SearchAndReplace( rSearchItem, nCol, nRow ); // notify LibreOfficeKit about changed page - if ( comphelper::LibreOfficeKit::isActive() ) + if (comphelper::LibreOfficeKit::isActive()) { OString aPayload = OString::number(nTab); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + if (SfxViewShell* pViewShell = SfxViewShell::Current()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } } } @@ -1341,16 +1336,11 @@ bool ScDocument::SearchAndReplace( rSearchItem, nCol, nRow ); // notify LibreOfficeKit about changed page - if ( comphelper::LibreOfficeKit::isActive() ) + if (comphelper::LibreOfficeKit::isActive()) { OString aPayload = OString::number(nTab); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } } } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 19781108fba7..088f52a56bf8 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -586,17 +586,12 @@ bool ScDocument::InsertTab( if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer()) { - if (comphelper::LibreOfficeKit::isViewCallback()) + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + pViewShell = SfxViewShell::GetNext(*pViewShell); } - else - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } } @@ -764,19 +759,14 @@ bool ScDocument::DeleteTab( SCTAB nTab ) // sheet names of references are not valid until sheet is deleted pChartListenerCollection->UpdateScheduledSeriesRanges(); - if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer()) + if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + pViewShell = SfxViewShell::GetNext(*pViewShell); } - else - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } bValid = true; @@ -866,19 +856,14 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets ) // sheet names of references are not valid until sheet is deleted pChartListenerCollection->UpdateScheduledSeriesRanges(); - if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer()) + if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + pViewShell = SfxViewShell::GetNext(*pViewShell); } - else - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } bValid = true; @@ -925,17 +910,12 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool /* bUpdateRe if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer()) { - if (comphelper::LibreOfficeKit::isViewCallback()) + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + pViewShell = SfxViewShell::GetNext(*pViewShell); } - else - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } } } diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 7036bac3d245..4cd9401a6c68 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -870,23 +870,12 @@ bool ScGlobal::EETextObjEqual( const EditTextObject* pObj1, return false; } -void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget, const SdrModel* pDrawLayer) +void ScGlobal::OpenURL(const OUString& rURL, const OUString& rTarget) { if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); - } - else - { - if (pDrawLayer) - { - pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); - return; - } - } + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); } // OpenURL is always called in the GridWindow by mouse clicks in some way or another. diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index c379e74d60c6..a901f65a9797 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1709,18 +1709,11 @@ void ScInputHandler::UpdateActiveView() pTableView = nullptr; // setup the pTableView editeng for tiled rendering to get cursor and selections - if (pActiveViewSh && pTableView) + if (pTableView && pActiveViewSh) { - ScDocShell* pDocShell = pActiveViewSh->GetViewData().GetDocShell(); if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - pTableView->registerLibreOfficeKitViewCallback(pActiveViewSh); - else - { - ScDrawLayer *pDrawLayer = pDocShell->GetDocument().GetDrawLayer(); - pTableView->registerLibreOfficeKitCallback(pDrawLayer); - } + pTableView->registerLibreOfficeKitViewCallback(pActiveViewSh); } } @@ -2127,17 +2120,10 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified ) if ( pInputWin ) pInputWin->SetTextString( aText ); - ScDocShell* pDocSh = pActiveViewSh->GetViewData().GetDocShell(); - ScDocument& rDoc = pDocSh->GetDocument(); - if ( comphelper::LibreOfficeKit::isActive() ) + if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if (pActiveViewSh) - pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aText.toUtf8().getStr()); - } - else - rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_CELL_FORMULA, aText.toUtf8().getStr()); + if (pActiveViewSh) + pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aText.toUtf8().getStr()); } } @@ -3475,15 +3461,10 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, if ( pInputWin ) pInputWin->SetTextString(aString); - else if ( comphelper::LibreOfficeKit::isActive() ) + else if (comphelper::LibreOfficeKit::isActive()) { - 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 (pActiveViewSh) + pActiveViewSh->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_FORMULA, aString.toUtf8().getStr()); } } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 6d8b2f0c5b60..326062fafcfa 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -165,19 +165,14 @@ 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()) + if ((nPart & (PAINT_TOP | PAINT_LEFT)) && comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) + SfxViewShell* pViewShell = SfxViewShell::GetFirst(); + while (pViewShell) { - SfxViewShell* pViewShell = SfxViewShell::GetFirst(); - while (pViewShell) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - pViewShell = SfxViewShell::GetNext(*pViewShell); - } + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + pViewShell = SfxViewShell::GetNext(*pViewShell); } - else - aDocument.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 2df4022cf74c..2d1de4f58a45 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -865,10 +865,7 @@ void ScModelObj::resetSelection() pViewShell->Unmark(); // and hide the cell and text selection - if (comphelper::LibreOfficeKit::isViewCallback()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); - else - pDocShell->GetDocument().GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, ""); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); } void ScModelObj::setClipboard(const uno::Reference<datatransfer::clipboard::XClipboard>& xClipboard) diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 08b857509c45..e279da2dd3a2 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2461,7 +2461,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) // ScGlobal::OpenURL() only understands Calc A1 style syntax. // Convert it to Calc A1 before calling OpenURL(). if (pDoc->GetAddressConvention() == formula::FormulaGrammar::CONV_OOO) - ScGlobal::OpenURL(aUrl, aTarget, pViewData->GetDocument()->GetDrawLayer()); + ScGlobal::OpenURL(aUrl, aTarget); else { ScAddress aTempAddr; @@ -5851,17 +5851,8 @@ OString ScGridWindow::getCellCursor(const Fraction& rZoomX, const Fraction& rZoo void ScGridWindow::updateLibreOfficeKitCellCursor() { OString aCursor = getCellCursor(pViewData->GetZoomX(), pViewData->GetZoomY()); - 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()); - } + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, aCursor.getStr()); } void ScGridWindow::CursorChanged() @@ -5904,17 +5895,8 @@ void ScGridWindow::UpdateAllOverlays() void ScGridWindow::DeleteCursorOverlay() { - 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"); - } + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"); mpOOCursors.reset(); } @@ -5985,7 +5967,7 @@ void ScGridWindow::UpdateCopySourceOverlay() * * @param pLogicRects - if not 0, then don't invoke the callback, just collect the rectangles in the pointed vector. */ -static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pDrawLayer, const std::vector<Rectangle>& rRectangles, std::vector<Rectangle>* pLogicRects = nullptr) +static void updateLibreOfficeKitSelection(ScViewData* pViewData, const std::vector<Rectangle>& rRectangles, std::vector<Rectangle>* pLogicRects = nullptr) { if (!comphelper::LibreOfficeKit::isActive()) return; @@ -6028,19 +6010,10 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD // the selection itself OString aSelection = comphelper::string::join("; ", aRectangles).getStr(); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.getStr()); - } - else - { - pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); - pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); - pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.getStr()); - } + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.getStr()); } void ScGridWindow::UpdateCursorOverlay() @@ -6203,7 +6176,7 @@ void ScGridWindow::UpdateCursorOverlay() mpOOCursors->append(*pOverlay); // notify the LibreOfficeKit too - updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects); + updateLibreOfficeKitSelection(pViewData, aPixelRects); } } } @@ -6216,7 +6189,7 @@ void ScGridWindow::GetCellSelection(std::vector<Rectangle>& rLogicRects) { std::vector<Rectangle> aPixelRects; GetSelectionRects(aPixelRects); - updateLibreOfficeKitSelection(pViewData, pViewData->GetDocument()->GetDrawLayer(), aPixelRects, &rLogicRects); + updateLibreOfficeKitSelection(pViewData, aPixelRects, &rLogicRects); } void ScGridWindow::DeleteSelectionOverlay() @@ -6280,21 +6253,13 @@ void ScGridWindow::UpdateSelectionOverlay() mpOOSelection->append(*pOverlay); // notify the LibreOfficeKit too - updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects); + updateLibreOfficeKitSelection(pViewData, aPixelRects); } } else { - 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"); - } + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + pViewShell->libreOfficeKitViewCallback(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 462fc4993822..588a427892b4 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1103,13 +1103,8 @@ void ScGridWindow::LogicInvalidate(const Rectangle* pRectangle) sRectangle = aRectangle.toString(); } - 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()); + ScTabViewShell* pViewShell = pViewData->GetViewShell(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx index 20b74d78fcc9..d26ef42dc2d4 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -411,10 +411,7 @@ void ScTabControl::SwitchToPageId(sal_uInt16 nId) { // notify LibreOfficeKit about changed page OString aPayload = OString::number(nId - 1); - if (comphelper::LibreOfficeKit::isViewCallback()) - pViewData->GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - else - pViewData->GetDocument()->GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + pViewData->GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } } } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 34c5ecb3f79a..50114379e8c6 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -322,10 +322,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) if (pDocSh) { - if (comphelper::LibreOfficeKit::isViewCallback()) - aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); - else - pDocSh->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); + aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); // New area extended to the right of the sheet after last column // including overlapping area with aNewRowArea @@ -337,19 +334,13 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) // Only invalidate if spreadsheet extended to the right if (aNewColArea.getWidth()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, aNewColArea.toString().getStr()); - else - pDocSh->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, aNewColArea.toString().getStr()); + aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, aNewColArea.toString().getStr()); } // Only invalidate if spreadsheet extended to the bottom if (aNewRowArea.getHeight()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, aNewRowArea.toString().getStr()); - else - pDocSh->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, aNewRowArea.toString().getStr()); + aViewData.GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, aNewRowArea.toString().getStr()); } } } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 12783c13cccb..d19ec5a3e66b 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -310,13 +310,8 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) std::stringstream ss; ss << aDocSize.Width() << ", " << aDocSize.Height(); OString sRect = ss.str().c_str(); - 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()); + ScTabViewShell* pViewShell = aViewData.GetViewShell(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); } } } diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 1e2205425fc4..47a844f68013 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -946,12 +946,9 @@ void ScViewData::SetEditEngine( ScSplitPos eWhich, { pEditView[eWhich] = new EditView( pNewEngine, pWin ); - if (pDoc->GetDrawLayer() && comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - pEditView[eWhich]->registerLibreOfficeKitViewCallback(pViewShell); - else - pEditView[eWhich]->registerLibreOfficeKitCallback(pDoc->GetDrawLayer()); + pEditView[eWhich]->registerLibreOfficeKitViewCallback(pViewShell); } } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 93a41953f447..273b2904a6c0 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1791,10 +1791,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, GetFrameWin()->LeaveWait(); if (!bIsApi) { - if (comphelper::LibreOfficeKit::isViewCallback()) - GetViewData().GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, pSearchItem->GetSearchString().toUtf8().getStr()); - else - rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, pSearchItem->GetSearchString().toUtf8().getStr()); + GetViewData().GetViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, pSearchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } @@ -1823,15 +1820,9 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, } // Avoid LOK selection notifications before we have all the results. - if (comphelper::LibreOfficeKit::isViewCallback()) - GetViewData().GetViewShell()->setTiledSearching(true); - else - rDoc.GetDrawLayer()->setTiledSearching(true); + GetViewData().GetViewShell()->setTiledSearching(true); MarkDataChanged(); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetViewData().GetViewShell()->setTiledSearching(false); - else - rDoc.GetDrawLayer()->setTiledSearching(false); + GetViewData().GetViewShell()->setTiledSearching(false); if ( bFound ) { @@ -1883,13 +1874,8 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell* pViewShell = GetViewData().GetViewShell(); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); - } - else - rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + SfxViewShell* pViewShell = GetViewData().GetViewShell(); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); // Trigger LOK_CALLBACK_TEXT_SELECTION now. MarkDataChanged(); |