sc/source/core/data/documen3.cxx | 17 +++++++++++++++-- sc/source/ui/view/gridwin.cxx | 18 +++++++++++++++--- sc/source/ui/view/viewfun2.cxx | 14 +++++++++++--- 3 files changed, 41 insertions(+), 8 deletions(-)
New commits: commit c07257be27869d66736211fde75efff835432138 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Tue Jun 14 15:08:45 2016 +0200 sc: implement per-view LOK_CALLBACK_SEARCH_RESULT_SELECTION One view doesn't crash the other one now when the search is performed. Change-Id: I9ba0a07a76d9c11c4cec279305efb4e5025ec12d Reviewed-on: https://gerrit.libreoffice.org/26263 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index c38714d..84b93f0 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 edcbff8..7c900d9 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 d0b3cad..6902561 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits