summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-06-14 15:08:45 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-06-14 14:23:44 +0000
commitc07257be27869d66736211fde75efff835432138 (patch)
tree69d090cba70f90fde62ab1cfb85944ae50da887e
parent5f5b740761a8a38b48de523f7a03dcd24c166e37 (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>
-rw-r--r--sc/source/core/data/documen3.cxx17
-rw-r--r--sc/source/ui/view/gridwin.cxx18
-rw-r--r--sc/source/ui/view/viewfun2.cxx14
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();