diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-13 18:11:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-06-13 17:54:46 +0000 |
commit | de432c0af127cc42a75292ec2288c13cbe0f1a44 (patch) | |
tree | d6515d7f2cff53c8e374966d1bff5d3746937891 /sd/source | |
parent | a61b7b81556c7ed3adc7022d488865f878237fb7 (diff) |
sd: implement per-view LOK_CALLBACK_SEARCH_RESULT_SELECTION
This way views can search without disturbing each other.
Change-Id: I40e69b6102a959ef1f1825a7af1438c2f2fcf807
Reviewed-on: https://gerrit.libreoffice.org/26227
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 53 |
1 files changed, 46 insertions, 7 deletions
diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index de41df2d55c0..12bbfe3b7bec 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -670,7 +670,13 @@ bool Outliner::SearchAndReplaceAll() std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + 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()); } } @@ -680,7 +686,13 @@ bool Outliner::SearchAndReplaceAll() { // Find-all, tiled rendering and we have at least one match. OString aPayload = OString::number(mnStartPageIndex); - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + 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()); // Emit a selection callback here: // 1) The original one is no longer valid, as we there was a SET_PART in between @@ -693,7 +705,13 @@ bool Outliner::SearchAndReplaceAll() aRectangles.push_back(rSelection.m_aRectangles); } OString sRectangles = comphelper::string::join("; ", aRectangles); - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_TEXT_SELECTION, sRectangles.getStr()); + 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()); } mnStartPageIndex = (sal_uInt16)-1; @@ -799,7 +817,13 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections) { // notify LibreOfficeKit about changed page OString aPayload = OString::number(maCurrentPosition.mnPageIndex); - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr()); + 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()); // also about search result selections boost::property_tree::ptree aTree; @@ -816,7 +840,13 @@ bool Outliner::SearchAndReplaceOnce(std::vector<SearchSelection>* pSelections) std::stringstream aStream; boost::property_tree::write_json(aStream, aTree); aPayload = aStream.str().c_str(); - pViewShell->GetDoc()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, aPayload.getStr()); + 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()); } else { @@ -1164,8 +1194,17 @@ void Outliner::ShowEndOfSearchDialog() if (!mbStringFound) { SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound); - mpDrawDocument->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, - mpSearchItem->GetSearchString().toUtf8().getStr()); + if (comphelper::LibreOfficeKit::isViewCallback()) + { + std::shared_ptr<ViewShell> pViewShell(mpWeakViewShell.lock()); + if (pViewShell) + { + 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 |