diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-14 15:08:45 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-14 14:23:44 +0000 |
commit | c07257be27869d66736211fde75efff835432138 (patch) | |
tree | 69d090cba70f90fde62ab1cfb85944ae50da887e /sc/source/ui | |
parent | 5f5b740761a8a38b48de523f7a03dcd24c166e37 (diff) |
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 <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 18 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 14 |
2 files changed, 26 insertions, 6 deletions
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(); |