diff options
-rw-r--r-- | sc/source/core/data/documen3.cxx | 17 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 14 |
3 files changed, 41 insertions, 8 deletions
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index c38714dfccb7..84b93f026a47 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -24,6 +24,7 @@ #include <sfx2/linkmgr.hxx> #include <sfx2/bindings.hxx> #include <sfx2/objsh.hxx> +#include <sfx2/viewsh.hxx> #include <svl/zforlist.hxx> #include <svl/PasswordHelper.hxx> #include <vcl/svapp.hxx> @@ -1323,7 +1324,13 @@ bool ScDocument::SearchAndReplace( if ( comphelper::LibreOfficeKit::isActive() ) { OString aPayload = OString::number(nTab); - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + 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()); } } } @@ -1353,7 +1360,13 @@ bool ScDocument::SearchAndReplace( if ( comphelper::LibreOfficeKit::isActive() ) { OString aPayload = OString::number(nTab); - GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + 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()); } } } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index edcbff82687e..7c900d9e8363 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -5886,15 +5886,27 @@ static void updateLibreOfficeKitSelection(ScViewData* pViewData, ScDrawLayer* pD // selection start handle Rectangle aStart(aBoundingBox.Left() / nPPTX, aBoundingBox.Top() / nPPTY, aBoundingBox.Left() / nPPTX, (aBoundingBox.Top() / nPPTY) + 256); - pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_START, aStart.toString().getStr()); // selection end handle Rectangle aEnd(aBoundingBox.Right() / nPPTX, (aBoundingBox.Bottom() / nPPTY) - 256, aBoundingBox.Right() / nPPTX, aBoundingBox.Bottom() / nPPTY); - pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION_END, aEnd.toString().getStr()); // the selection itself - pDrawLayer->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, comphelper::string::join("; ", aRectangles).getStr()); + 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()); + } } void ScGridWindow::UpdateCursorOverlay() diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index d0b3cad53cd5..69025612166c 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1790,8 +1790,10 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, GetFrameWin()->LeaveWait(); if (!bIsApi) { - rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, - pSearchItem->GetSearchString().toUtf8().getStr()); + 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()); SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); } @@ -1874,7 +1876,13 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + 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()); // Trigger LOK_CALLBACK_TEXT_SELECTION now. MarkDataChanged(); |