diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index f9c9031d05cb..a6abd2a65486 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -17,8 +17,6 @@ namespace LibreOfficeKit static bool g_bActive(false); -static bool g_bViewCallback(true); - void setActive(bool bActive) { g_bActive = bActive; @@ -29,16 +27,6 @@ bool isActive() return g_bActive; } -void setViewCallback(bool bViewCallback) -{ - g_bViewCallback = bViewCallback; -} - -bool isViewCallback() -{ - return g_bViewCallback; -} - static void (*pStatusIndicatorCallback)(void *data, statusIndicatorCallbackType type, int percent)(nullptr); static void *pStatusIndicatorCallbackData(nullptr); diff --git a/desktop/README.vars b/desktop/README.vars index 39e3aaa20436..67c605698110 100644 --- a/desktop/README.vars +++ b/desktop/README.vars @@ -13,4 +13,3 @@ LibreOfficeKit -------------- LOK_DEBUG - Draw a small red rectangle in the top left corner so that it's easy to see where a new tile begins. -LOK_MODEL_CALLBACK - Use old document-global callback instead of multiple per-view ones. diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index bd31b9b54e2a..a0aebeed4fe7 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1342,25 +1342,11 @@ static void doc_registerCallback(LibreOfficeKitDocument* pThis, SolarMutexGuard aGuard; LibLODocument_Impl* pDocument = static_cast(pThis); - std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0; + std::size_t nView = SfxLokHelper::getView(); pDocument->mpCallbackFlushHandlers[nView].reset(new CallbackFlushHandler(pThis, pCallback, pData)); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell()) - pViewShell->registerLibreOfficeKitViewCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandlers[nView].get()); - } - else - { - ITiledRenderable* pDoc = getTiledRenderable(pThis); - if (!pDoc) - { - gImpl->maLastExceptionMsg = "Document doesn't support tiled rendering"; - return; - } - - pDoc->registerCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandlers[nView].get()); - } + if (SfxViewShell* pViewShell = SfxViewFrame::Current()->GetViewShell()) + pViewShell->registerLibreOfficeKitViewCallback(CallbackFlushHandler::callback, pDocument->mpCallbackFlushHandlers[nView].get()); } static void doc_postKeyEvent(LibreOfficeKitDocument* pThis, int nType, int nCharCode, int nKeyCode) @@ -1441,7 +1427,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma bool bResult = false; - std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0; + std::size_t nView = SfxLokHelper::getView(); if (bNotifyWhenFinished && pDocument->mpCallbackFlushHandlers[nView]) { bResult = comphelper::dispatchCommand(aCommand, comphelper::containerToSequence(aPropertyValuesVector), @@ -1477,7 +1463,7 @@ static void doc_postMouseEvent(LibreOfficeKitDocument* pThis, int nType, int nX, } LibLODocument_Impl* pLib = static_cast(pThis); - std::size_t nView = comphelper::LibreOfficeKit::isViewCallback() ? SfxLokHelper::getView() : 0; + std::size_t nView = SfxLokHelper::getView(); if (pLib->mpCallbackFlushHandlers[nView]) { pLib->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_MOUSE_POINTER, aPointerString.getStr()); @@ -2136,9 +2122,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char if (eStage != SECOND_INIT) comphelper::LibreOfficeKit::setActive(); - static bool bViewCallback = !getenv("LOK_MODEL_CALLBACK"); - comphelper::LibreOfficeKit::setViewCallback(bViewCallback); - if (eStage != PRE_INIT) comphelper::LibreOfficeKit::setStatusIndicatorCallback(lo_status_indicator_callback, pLib); diff --git a/desktop/source/lib/lokinteractionhandler.cxx b/desktop/source/lib/lokinteractionhandler.cxx index 0a7687e05730..eaf96ab1ad5d 100644 --- a/desktop/source/lib/lokinteractionhandler.cxx +++ b/desktop/source/lib/lokinteractionhandler.cxx @@ -117,7 +117,7 @@ void LOKInteractionHandler::postError(css::task::InteractionClassification class std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); - std::size_t nView = (comphelper::LibreOfficeKit::isViewCallback() && SfxViewShell::Current()) ? SfxLokHelper::getView() : 0; + std::size_t nView = SfxViewShell::Current() ? SfxLokHelper::getView() : 0; if (m_pLOKDocument && m_pLOKDocument->mpCallbackFlushHandlers.size() > nView && m_pLOKDocument->mpCallbackFlushHandlers[nView]) m_pLOKDocument->mpCallbackFlushHandlers[nView]->queue(LOK_CALLBACK_ERROR, aStream.str().c_str()); else if (m_pLOKit->mpCallback) diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index e203ed904bac..20f8b482bcaf 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -403,10 +403,7 @@ void EditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - pImpEditView->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); - else - pImpEditView->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); + pImpEditView->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); } } } @@ -417,10 +414,7 @@ void EditView::HideCursor() if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - pImpEditView->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); - else - pImpEditView->libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); + pImpEditView->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); } } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index d2e4ff30c9f4..0641e74b7466 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -120,15 +120,11 @@ void ImpEditView::SetBackgroundColor( const Color& rColor ) void ImpEditView::registerLibreOfficeKitCallback(OutlinerSearchable* pSearchable) { - // Per-view callbacks should always invoke ImpEditView::registerLibreOfficeKitViewCallback(). - assert(!comphelper::LibreOfficeKit::isViewCallback()); mpLibreOfficeKitSearchable = pSearchable; } void ImpEditView::libreOfficeKitCallback(int nType, const char* pPayload) const { - // Per-view callbacks should always invoke ImpEditView::libreOfficeKitViewCallback(). - assert(!comphelper::LibreOfficeKit::isViewCallback()); if (mpLibreOfficeKitSearchable) mpLibreOfficeKitSearchable->libreOfficeKitCallback(nType, pPayload); } @@ -402,10 +398,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou aStart = OutputDevice::LogicToLogic(aStart, MAP_100TH_MM, MAP_TWIP); aStart.Move(aOrigin.getX(), aOrigin.getY()); - if (comphelper::LibreOfficeKit::isViewCallback()) - libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); + libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); Rectangle& rEnd = aRectangles.back(); Rectangle aEnd = Rectangle(rEnd.Right() - 1, rEnd.Top(), rEnd.Right(), rEnd.Bottom()); @@ -413,10 +406,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou aEnd = OutputDevice::LogicToLogic(aEnd, MAP_100TH_MM, MAP_TWIP); aEnd.Move(aOrigin.getX(), aOrigin.getY()); - if (comphelper::LibreOfficeKit::isViewCallback()) - libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); + libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); } std::vector v; @@ -430,10 +420,7 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou sRectangle = comphelper::string::join("; ", v); } - if (comphelper::LibreOfficeKit::isViewCallback()) - libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr()); + libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangle.getStr()); pOutWin->Pop(); } @@ -1030,10 +1017,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) aRect.setWidth(0); OString sRect = aRect.toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); + libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); } CursorDirection nCursorDir = CursorDirection::NONE; diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx index 2cc38c60e455..79fa115e6585 100644 --- a/include/comphelper/lok.hxx +++ b/include/comphelper/lok.hxx @@ -36,11 +36,6 @@ COMPHELPER_DLLPUBLIC void setStatusIndicatorCallback(void (*callback)(void *data // Check whether the code is running as invoked through LibreOfficeKit. COMPHELPER_DLLPUBLIC bool isActive(); -/// Check whether clients register a callback for each view. -COMPHELPER_DLLPUBLIC bool isViewCallback(); -/// Set whether clients register a callback for each view. -COMPHELPER_DLLPUBLIC void setViewCallback(bool bViewCallback); - // Status indicator handling. Even if in theory there could be several status indicators active at // the same time, in practice there is only one at a time, so we don't handle any identification of // status indicator in this API. diff --git a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx index 60c8bd713ac1..7dbe13fe573a 100644 --- a/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtktiledviewer.cxx @@ -1314,15 +1314,13 @@ static GtkWidget* createWindow(TiledWindow& rWindow) gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pUnoCmdDebugger, -1); g_signal_connect(G_OBJECT(pUnoCmdDebugger), "clicked", G_CALLBACK(unoCommandDebugger), nullptr); - static bool bViewCallback = !getenv("LOK_MODEL_CALLBACK"); - if (bViewCallback) - { - GtkToolItem* pNewViewButton = gtk_tool_button_new( nullptr, nullptr); - gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pNewViewButton), "view-continuous-symbolic"); - gtk_tool_item_set_tooltip_text(pNewViewButton, "New View"); - gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pNewViewButton, -1); - g_signal_connect(G_OBJECT(pNewViewButton), "clicked", G_CALLBACK(createView), nullptr); - } + // New view button. + GtkToolItem* pNewViewButton = gtk_tool_button_new( nullptr, nullptr); + gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON (pNewViewButton), "view-continuous-symbolic"); + gtk_tool_item_set_tooltip_text(pNewViewButton, "New View"); + gtk_toolbar_insert(GTK_TOOLBAR(pUpperToolbar), pNewViewButton, -1); + g_signal_connect(G_OBJECT(pNewViewButton), "clicked", G_CALLBACK(createView), nullptr); + gtk_box_pack_start(GTK_BOX(rWindow.m_pVBox), pUpperToolbar, FALSE, FALSE, 0 ); // Adds to top. // Lower toolbar. diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index d06d58ba1873..bb2f7b2d8c9c 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -533,8 +533,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 84b93f026a47..e9f71115ae3e 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1321,16 +1321,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()); } } } @@ -1357,16 +1352,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 a99d9e2e8d7f..fd485737e5ca 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, ""); } } @@ -762,19 +757,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; @@ -864,19 +854,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; @@ -923,17 +908,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 72fac5763d72..04c91be91491 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -878,23 +878,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 cc4be130d62b..c94bfbade5ef 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1878,18 +1878,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); } } @@ -2296,17 +2289,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()); } } @@ -3653,15 +3639,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 20bb96cc3928..4c2c4e537375 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 7da7eee545df..b41a200987d6 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -867,10 +867,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& xClipboard) diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 7c900d9e8363..08aa48f28a11 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -2334,7 +2334,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; @@ -5717,17 +5717,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() @@ -5770,17 +5761,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(); } @@ -5851,7 +5833,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& rRectangles, std::vector* pLogicRects = nullptr) +static void updateLibreOfficeKitSelection(ScViewData* pViewData, const std::vector& rRectangles, std::vector* pLogicRects = nullptr) { if (!comphelper::LibreOfficeKit::isActive()) return; @@ -5894,19 +5876,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() @@ -6068,7 +6041,7 @@ void ScGridWindow::UpdateCursorOverlay() mpOOCursors->append(*pOverlay); // notify the LibreOfficeKit too - updateLibreOfficeKitSelection(pViewData, pDoc->GetDrawLayer(), aPixelRects); + updateLibreOfficeKitSelection(pViewData, aPixelRects); } } } @@ -6081,7 +6054,7 @@ void ScGridWindow::GetCellSelection(std::vector& rLogicRects) { std::vector aPixelRects; GetSelectionRects(aPixelRects); - updateLibreOfficeKitSelection(pViewData, pViewData->GetDocument()->GetDrawLayer(), aPixelRects, &rLogicRects); + updateLibreOfficeKitSelection(pViewData, aPixelRects, &rLogicRects); } void ScGridWindow::DeleteSelectionOverlay() @@ -6144,21 +6117,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 fd0aa9204d1a..aedd922a651f 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1026,13 +1026,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 dbc4af745689..139a4ff7ab8d 100644 --- a/sc/source/ui/view/tabcont.cxx +++ b/sc/source/ui/view/tabcont.cxx @@ -419,10 +419,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 042b85935fcb..698c356a7745 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 7024567f32fd..07e1bcf27610 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 1a0de869e508..7ef5dbccecfc 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -945,12 +945,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 6399db42242d..889c7f2fea37 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1790,10 +1790,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); } @@ -1822,15 +1819,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 ) { @@ -1882,13 +1873,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(); diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index d8acaf60d68d..c936af755cc6 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -377,20 +377,14 @@ void SdDrawDocument::InsertPage(SdrPage* pPage, sal_uInt16 nPos) if (!bLast) UpdatePageRelativeURLs(static_cast( pPage ), nPos, 1); - if (comphelper::LibreOfficeKit::isActive() && - static_cast(pPage)->GetPageKind() == PK_STANDARD) + if (comphelper::LibreOfficeKit::isActive() && static_cast(pPage)->GetPageKind() == PK_STANDARD) { - 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 - libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } } @@ -416,20 +410,14 @@ SdrPage* SdDrawDocument::RemovePage(sal_uInt16 nPgNum) if (!bLast) UpdatePageRelativeURLs(static_cast(pPage), nPgNum, -1); - if (comphelper::LibreOfficeKit::isActive() && - static_cast(pPage)->GetPageKind() == PK_STANDARD) + if (comphelper::LibreOfficeKit::isActive() && static_cast(pPage)->GetPageKind() == PK_STANDARD) { - 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 - libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, ""); } return pPage; diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx index 3681a461f0d5..992edf1cc63d 100644 --- a/sd/source/ui/func/fusel.cxx +++ b/sd/source/ui/func/fusel.cxx @@ -278,13 +278,8 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt) // If tiled rendering, let client handles URL execution and early returns. if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.pURLField->GetURL().toUtf8().getStr()); - } - else - mpDoc->libreOfficeKitCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.pURLField->GetURL().toUtf8().getStr()); + SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, aVEvt.pURLField->GetURL().toUtf8().getStr()); return true; } diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 2ea4d8102b5e..c1ac3ced45ff 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -620,16 +620,10 @@ bool Outliner::SearchAndReplaceAll() { // Disable selection change notifications during search all. SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rSfxViewShell.setTiledSearching(true); - else - pViewShell->GetDoc()->setTiledSearching(true); - comphelper::ScopeGuard aGuard([pViewShell, &rSfxViewShell]() + rSfxViewShell.setTiledSearching(true); + comphelper::ScopeGuard aGuard([&rSfxViewShell]() { - if (comphelper::LibreOfficeKit::isViewCallback()) - rSfxViewShell.setTiledSearching(false); - else - pViewShell->GetDoc()->setTiledSearching(false); + rSfxViewShell.setTiledSearching(false); }); // Go to beginning/end of document. @@ -680,10 +674,7 @@ bool Outliner::SearchAndReplaceAll() std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); } } @@ -693,13 +684,8 @@ bool Outliner::SearchAndReplaceAll() { // Find-all, tiled rendering and we have at least one match. OString aPayload = OString::number(mnStartPageIndex); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); // Emit a selection callback here: // 1) The original one is no longer valid, as we there was a SET_PART in between @@ -712,13 +698,7 @@ bool Outliner::SearchAndReplaceAll() aRectangles.push_back(rSelection.m_aRectangles); } OString sRectangles = comphelper::string::join("; ", aRectangles); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); } mnStartPageIndex = (sal_uInt16)-1; @@ -824,13 +804,8 @@ bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) { // notify LibreOfficeKit about changed page OString aPayload = OString::number(maCurrentPosition.mnPageIndex); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); // also about search result selections boost::property_tree::ptree aTree; @@ -847,13 +822,7 @@ bool Outliner::SearchAndReplaceOnce(std::vector* pSelections) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); aPayload = aStream.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); - } - else - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); } else { @@ -1201,17 +1170,12 @@ void Outliner::ShowEndOfSearchDialog() if (!mbStringFound) { SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); - if (comphelper::LibreOfficeKit::isViewCallback()) + std::shared_ptr pViewShell(mpWeakViewShell.lock()); + if (pViewShell) { - std::shared_ptr pViewShell(mpWeakViewShell.lock()); - if (pViewShell) - { - SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8().getStr()); - } + SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8().getStr()); } - else - mpDrawDocument->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, mpSearchItem->GetSearchString().toUtf8().getStr()); } // don't do anything else for search diff --git a/sd/source/ui/view/drviews1.cxx b/sd/source/ui/view/drviews1.cxx index b2711f20b280..92fc471bb1a6 100644 --- a/sd/source/ui/view/drviews1.cxx +++ b/sd/source/ui/view/drviews1.cxx @@ -929,13 +929,8 @@ bool DrawViewShell::SwitchPage(sal_uInt16 nSelectedPage) { // notify LibreOfficeKit about changed page OString aPayload = OString::number(nSelectedPage); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if (SfxViewShell* pViewShell = GetViewShell()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - } - else - GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + if (SfxViewShell* pViewShell = GetViewShell()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } rtl::Reference< sd::SlideShow > xSlideshow( SlideShow::GetSlideShow( GetDoc() ) ); diff --git a/sd/source/ui/view/sdwindow.cxx b/sd/source/ui/view/sdwindow.cxx index ab9917e322e6..580e7a664fef 100644 --- a/sd/source/ui/view/sdwindow.cxx +++ b/sd/source/ui/view/sdwindow.cxx @@ -1017,13 +1017,8 @@ void Window::LogicInvalidate(const Rectangle* pRectangle) aRectangle = OutputDevice::LogicToLogic(aRectangle, MAP_100TH_MM, MAP_TWIP); sRectangle = aRectangle.toString(); } - if (comphelper::LibreOfficeKit::isViewCallback()) - { - SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); - rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - } - else - mpViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + SfxViewShell& rSfxViewShell = mpViewShell->GetViewShellBase(); + rSfxViewShell.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } } // end of namespace sd diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index da43a7b09290..0d973a911205 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -1992,16 +1992,8 @@ void SfxDispatcher::ExecutePopup( const OUString& rResName, vcl::Window *pWin, c std::stringstream aStream; boost::property_tree::write_json(aStream, aRoot, true); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if (SfxViewShell* pViewShell = xImp->pFrame->GetViewShell()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str()); - } - else - { - const SfxObjectShell* objSh = xImp->pFrame->GetObjectShell(); - objSh->libreOfficeKitCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str()); - } + if (SfxViewShell* pViewShell = xImp->pFrame->GetViewShell()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str()); } else { diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 7168390229e1..3ade4be41141 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -1032,16 +1032,8 @@ static void InterceptLOKStateChangeEvent(const SfxViewFrame* pViewFrame, const c return; } OUString payload = aBuffer.makeStringAndClear(); - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if (const SfxViewShell* pViewShell = pViewFrame->GetViewShell()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); - } - else - { - const SfxObjectShell* pObjectShell = pViewFrame->GetObjectShell(); - pObjectShell->libreOfficeKitCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); - } + if (const SfxViewShell* pViewShell = pViewFrame->GetViewShell()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, payload.toUtf8().getStr()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index cb88a6c79a88..c5f60854a78f 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -461,10 +461,7 @@ OutlinerView* SdrObjEditView::ImpMakeOutlinerView(vcl::Window* pWin, bool /*bNoP } pOutlView->SetControlWord(nStat); pOutlView->SetBackgroundColor( aBackground ); - if (comphelper::LibreOfficeKit::isViewCallback()) - pOutlView->registerLibreOfficeKitViewCallback(SfxViewShell::Current()); - else - pOutlView->registerLibreOfficeKitCallback(GetModel()); + pOutlView->registerLibreOfficeKitViewCallback(SfxViewShell::Current()); if (pText!=nullptr) { pOutlView->SetAnchorMode((EVAnchorMode)(pText->GetOutlinerViewAnchorMode())); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 7d4d5cd6d85b..721a63a9c9a3 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -816,9 +816,6 @@ void SdrModel::registerLibreOfficeKitCallback(LibreOfficeKitCallback pCallback, void SdrModel::libreOfficeKitCallback(int nType, const char* pPayload) const { - // Per-view callbacks should always invoke SfxViewShell::libreOfficeKitViewCallback(). - assert(!comphelper::LibreOfficeKit::isViewCallback()); - if (mbTiledSearching) { switch (nType) @@ -837,13 +834,11 @@ void SdrModel::libreOfficeKitCallback(int nType, const char* pPayload) const void SdrModel::setTiledSearching(bool bTiledSearching) { - assert(!comphelper::LibreOfficeKit::isViewCallback()); mbTiledSearching = bTiledSearching; } bool SdrModel::isTiledSearching() const { - assert(!comphelper::LibreOfficeKit::isViewCallback()); return mbTiledSearching; } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 5cb8371b6757..94d2c9ae2de6 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -230,13 +230,8 @@ void SdrMarkView::ModelHasChanged() sSelection = aSelection.toString(); } - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sSelection.getStr()); - } - else - GetModel()->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sSelection.getStr()); + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sSelection.getStr()); } } @@ -712,13 +707,8 @@ void SdrMarkView::SetMarkHandles() if (bTiledRendering) { // Suppress handles -> empty graphic selection. - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY"); - } - else - GetModel()->libreOfficeKitCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY"); + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY"); } return; } @@ -738,13 +728,8 @@ void SdrMarkView::SetMarkHandles() if (xController.is() && xController->hasSelectedCells()) { // The table shape has selected cells, which provide text selection already -> no graphic selection. - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY"); - } - else - GetModel()->libreOfficeKitCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY"); + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, "EMPTY"); return; } } @@ -773,21 +758,11 @@ void SdrMarkView::SetMarkHandles() sSelection = aSelection.toString(); // hide the text selection too - if (comphelper::LibreOfficeKit::isViewCallback()) - { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); - } - else - GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, ""); - } - if (comphelper::LibreOfficeKit::isViewCallback()) - { if(SfxViewShell* pViewShell = SfxViewShell::Current()) - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, ""); } - else - GetModel()->libreOfficeKitCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr()); + if(SfxViewShell* pViewShell = SfxViewShell::Current()) + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_GRAPHIC_SELECTION, sSelection.getStr()); } if (bFrmHdl) diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 699fd142c5f4..5aff1044a7a9 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2169,20 +2169,11 @@ void SvxTableController::updateSelectionOverlay() aSelection = OutputDevice::LogicToLogic(aSelection, MAP_100TH_MM, MAP_TWIP); } - if (comphelper::LibreOfficeKit::isViewCallback()) + if(SfxViewShell* pViewShell = SfxViewShell::Current()) { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aSelectionStart.toString().getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aSelectionEnd.toString().getStr()); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr()); - } - } - else - { - pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aSelectionStart.toString().getStr()); - pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aSelectionEnd.toString().getStr()); - pTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, aSelectionStart.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, aSelectionEnd.toString().getStr()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, aSelection.toString().getStr()); } } } @@ -2200,20 +2191,11 @@ void SvxTableController::destroySelectionOverlay() if (comphelper::LibreOfficeKit::isActive()) { // Clear the LOK text selection so far provided by this table. - if (comphelper::LibreOfficeKit::isViewCallback()) + if(SfxViewShell* pViewShell = SfxViewShell::Current()) { - if(SfxViewShell* pViewShell = SfxViewShell::Current()) - { - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); - pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); - } - } - else - { - mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); - mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); - mxTableObj->GetModel()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, "EMPTY"); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); } } } diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 47415ca3bc14..bd7670136ac2 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -2138,10 +2138,7 @@ void SwCursorShell::ShowCursor() if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(true).getStr()); } UpdateCursor(); @@ -2160,10 +2157,7 @@ void SwCursorShell::HideCursor() if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_CURSOR_VISIBLE, OString::boolean(false).getStr()); } } } diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 8c9ee305b82c..30f6f8f60c4e 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -189,19 +189,13 @@ void SwVisibleCursor::SetPosAndShow() { m_nPageLastTime = nPage; OString aPayload = OString::number(nPage - 1); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); - else - m_pCursorShell->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); } // notify about the cursor position & size Rectangle aSVRect(aRect.Pos().getX(), aRect.Pos().getY(), aRect.Pos().getX() + aRect.SSize().Width(), aRect.Pos().getY() + aRect.SSize().Height()); OString sRect = aSVRect.toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); - else - m_pCursorShell->libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); + m_pCursorShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR, sRect.getStr()); } if ( !m_pCursorShell->IsCursorReadonly() || m_pCursorShell->GetViewOptions()->IsSelectionInReadonly() ) @@ -382,18 +376,12 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) if (aStartRect.HasArea()) { OString sRect = aStartRect.SVRect().toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_START, sRect.getStr()); } if (aEndRect.HasArea()) { OString sRect = aEndRect.SVRect().toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION_END, sRect.getStr()); } } @@ -406,10 +394,7 @@ void SwSelPaintRects::Show(std::vector* pSelectionRectangles) OString sRect = comphelper::string::join("; ", aRect); if (!pSelectionRectangles) { - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); } else pSelectionRectangles->push_back(sRect); @@ -616,10 +601,7 @@ void SwShellCursor::Show() aRect.push_back(rSelectionRectangle); } OString sRect = comphelper::string::join("; ", aRect); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); - else - GetShell()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); + GetShell()->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, sRect.getStr()); } } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 6e500097c31f..f2cb6a1fa4f6 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -1023,10 +1023,7 @@ void SwViewShell::SizeChgNotify() std::stringstream ss; ss << aDocSize.Width() + 2L * DOCUMENTBORDER << ", " << aDocSize.Height() + 2L * DOCUMENTBORDER; OString sRect = ss.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); - else - libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); + GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, sRect.getStr()); } } } diff --git a/sw/source/uibase/docvw/SidebarScrollBar.cxx b/sw/source/uibase/docvw/SidebarScrollBar.cxx index 86ca488d9a11..40ddf08c9784 100644 --- a/sw/source/uibase/docvw/SidebarScrollBar.cxx +++ b/sw/source/uibase/docvw/SidebarScrollBar.cxx @@ -57,10 +57,7 @@ void SidebarScrollBar::LogicInvalidate(const Rectangle* pRectangle) OString sRectangle = aRectangle.toString(); SwWrtShell& rWrtShell = m_rView.GetWrtShell(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - else - rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void SidebarScrollBar::MouseButtonUp(const MouseEvent& /*rMouseEvent*/) diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 9ecfeaeebe26..afe4e8a57660 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -213,10 +213,7 @@ void SidebarTextControl::LogicInvalidate(const Rectangle* pRectangle) OString sRectangle = aRectangle.toString(); SwWrtShell& rWrtShell = mrDocView.GetWrtShell(); - if (comphelper::LibreOfficeKit::isViewCallback()) - rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - else - rWrtShell.libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); + rWrtShell.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void SidebarTextControl::KeyInput( const KeyEvent& rKeyEvt ) diff --git a/sw/source/uibase/docvw/SidebarWin.cxx b/sw/source/uibase/docvw/SidebarWin.cxx index 60c78b80dcad..8fbd74042b48 100644 --- a/sw/source/uibase/docvw/SidebarWin.cxx +++ b/sw/source/uibase/docvw/SidebarWin.cxx @@ -614,13 +614,7 @@ void SwSidebarWin::InitControls() if (comphelper::LibreOfficeKit::isActive()) { // If there is a callback already registered, inform the new outliner view about it. - if (comphelper::LibreOfficeKit::isViewCallback()) - mpOutlinerView->registerLibreOfficeKitViewCallback(&mrView); - else - { - SwDrawModel* pDrawModel = mrView.GetWrtShellPtr()->getIDocumentDrawModelAccess().GetDrawModel(); - mpOutlinerView->registerLibreOfficeKitCallback(pDrawModel); - } + mpOutlinerView->registerLibreOfficeKitViewCallback(&mrView); } //create Scrollbars diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index fafaf0ef3b41..5f8e026c2eec 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -6397,13 +6397,7 @@ void SwEditWin::LogicInvalidate(const Rectangle* pRectangle) else sRectangle = pRectangle->toString(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_rView.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - else - { - if (m_rView.GetWrtShellPtr()) - m_rView.GetWrtShell().libreOfficeKitCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); - } + m_rView.libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sRectangle.getStr()); } void SwEditWin::LogicMouseButtonDown(const MouseEvent& rMouseEvent) diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index 41097862f08f..d773d10edb26 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -134,10 +134,7 @@ static void lcl_emitSearchResultCallbacks(SvxSearchItem* pSearchItem, SwWrtShell boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - if (comphelper::LibreOfficeKit::isViewCallback()) - pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); - else - pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); } } @@ -266,26 +263,16 @@ void SwView::ExecSearch(SfxRequest& rReq) case SvxSearchCmd::FIND_ALL: { // Disable LOK selection notifications during search. - SwDrawModel* pModel = m_pWrtShell->getIDocumentDrawModelAccess().GetDrawModel(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->setTiledSearching(true); - else if (pModel) - pModel->setTiledSearching(true); + m_pWrtShell->GetSfxViewShell()->setTiledSearching(true); bool bRet = SearchAll(); - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->setTiledSearching(false); - else if (pModel) - pModel->setTiledSearching(false); + m_pWrtShell->GetSfxViewShell()->setTiledSearching(false); if( !bRet ) { #if HAVE_FEATURE_DESKTOP if( !bQuiet ) { - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } #endif @@ -406,10 +393,7 @@ void SwView::ExecSearch(SfxRequest& rReq) #if HAVE_FEATURE_DESKTOP if( !bQuiet ) { - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } #endif @@ -605,10 +589,7 @@ bool SwView::SearchAndWrap(bool bApi) if( !bApi ) { #if HAVE_FEATURE_DESKTOP - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); #endif } @@ -661,10 +642,7 @@ bool SwView::SearchAndWrap(bool bApi) } else if(!bApi) { - if (comphelper::LibreOfficeKit::isViewCallback()) - m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); - else - m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); + m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, m_pSrchItem->GetSearchString().toUtf8().getStr()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } #endif diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index e35df9d6a3da..aba44d2265bc 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -473,10 +473,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, sal_uInt16 nFilter, // We are doing tiledRendering, let the client handles the URL loading. if (comphelper::LibreOfficeKit::isActive()) { - if (comphelper::LibreOfficeKit::isViewCallback()) - rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); - else - rVSh.libreOfficeKitCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); + rVSh.GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_HYPERLINK_CLICKED, rURL.toUtf8().getStr()); return; }