diff options
-rw-r--r-- | include/sfx2/viewsh.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 10 | ||||
-rw-r--r-- | sd/source/ui/view/Outliner.cxx | 17 | ||||
-rw-r--r-- | sfx2/source/view/viewimp.hxx | 2 | ||||
-rw-r--r-- | sfx2/source/view/viewsh.cxx | 25 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewsrch.cxx | 8 |
7 files changed, 59 insertions, 9 deletions
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 6c3d7da5569e..d489d55bfa64 100644 --- a/include/sfx2/viewsh.hxx +++ b/include/sfx2/viewsh.hxx @@ -327,6 +327,10 @@ public: void registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCallback, void* pLibreOfficeKitData); /// Invokes the registered callback, if there are any. void libreOfficeKitViewCallback(int nType, const char* pPayload) const override; + /// Set if we are doing tiled searching. + void setTiledSearching(bool bTiledSearching); + /// Are we doing tiled searching? + bool isTiledSearching() const; }; diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index fd5682b2b0a0..69c1e21b7900 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1825,9 +1825,15 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, } // Avoid LOK selection notifications before we have all the results. - rDoc.GetDrawLayer()->setTiledSearching(true); + if (comphelper::LibreOfficeKit::isViewCallback()) + GetViewData().GetViewShell()->setTiledSearching(true); + else + rDoc.GetDrawLayer()->setTiledSearching(true); MarkDataChanged(); - rDoc.GetDrawLayer()->setTiledSearching(false); + if (comphelper::LibreOfficeKit::isViewCallback()) + GetViewData().GetViewShell()->setTiledSearching(false); + else + rDoc.GetDrawLayer()->setTiledSearching(false); if ( bFound ) { diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index e6b5b1803ef6..bb218ab9dca3 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -619,8 +619,18 @@ bool Outliner::SearchAndReplaceAll() else if( nullptr != dynamic_cast< const DrawViewShell *>( pViewShell.get() )) { // Disable selection change notifications during search all. - pViewShell->GetDoc()->setTiledSearching(true); - comphelper::ScopeGuard aGuard([pViewShell]() { pViewShell->GetDoc()->setTiledSearching(false); }); + SfxViewShell& rSfxViewShell = pViewShell->GetViewShellBase(); + if (comphelper::LibreOfficeKit::isViewCallback()) + rSfxViewShell.setTiledSearching(true); + else + pViewShell->GetDoc()->setTiledSearching(true); + comphelper::ScopeGuard aGuard([pViewShell, &rSfxViewShell]() + { + if (comphelper::LibreOfficeKit::isViewCallback()) + rSfxViewShell.setTiledSearching(false); + else + pViewShell->GetDoc()->setTiledSearching(false); + }); // Go to beginning/end of document. maObjectIterator = ::sd::outliner::OutlinerContainer(this).begin(); @@ -671,10 +681,7 @@ bool Outliner::SearchAndReplaceAll() boost::property_tree::write_json(aStream, aTree); OString aPayload = aStream.str().c_str(); 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()); } diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx index 74e70b1721ee..9b1c1428bd2e 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -64,6 +64,8 @@ struct SfxViewShell_Impl LibreOfficeKitCallback m_pLibreOfficeKitViewCallback; void* m_pLibreOfficeKitViewData; + /// Set if we are in the middle of a tiled search. + bool m_bTiledSearching; explicit SfxViewShell_Impl(SfxViewShellFlags const nFlags); ~SfxViewShell_Impl(); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index ae34ef5dc12f..ced79a62e0fe 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -55,6 +55,8 @@ #include <comphelper/sequenceashashmap.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/settings.hxx> +#include <vcl/commandinfoprovider.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <sfx2/app.hxx> #include "view.hrc" @@ -309,6 +311,7 @@ SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags) , mpIPClientList(nullptr) , m_pLibreOfficeKitViewCallback(nullptr) , m_pLibreOfficeKitViewData(nullptr) +, m_bTiledSearching(false) {} SfxViewShell_Impl::~SfxViewShell_Impl() @@ -1603,10 +1606,32 @@ void SfxViewShell::registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCa void SfxViewShell::libreOfficeKitViewCallback(int nType, const char* pPayload) const { + if (pImp->m_bTiledSearching) + { + switch (nType) + { + case LOK_CALLBACK_TEXT_SELECTION: + case LOK_CALLBACK_TEXT_SELECTION_START: + case LOK_CALLBACK_TEXT_SELECTION_END: + case LOK_CALLBACK_GRAPHIC_SELECTION: + return; + } + } + if (pImp->m_pLibreOfficeKitViewCallback) pImp->m_pLibreOfficeKitViewCallback(nType, pPayload, pImp->m_pLibreOfficeKitViewData); } +void SfxViewShell::setTiledSearching(bool bTiledSearching) +{ + pImp->m_bTiledSearching = bTiledSearching; +} + +bool SfxViewShell::isTiledSearching() const +{ + return pImp->m_bTiledSearching; +} + bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent ) /* [Description] diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 4a8d04a16b27..840ecc9163ad 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -856,11 +856,13 @@ void SdrModel::libreOfficeKitCallback(int nType, const char* pPayload) const void SdrModel::setTiledSearching(bool bTiledSearching) { + assert(!comphelper::LibreOfficeKit::isViewCallback()); mbTiledSearching = bTiledSearching; } bool SdrModel::isTiledSearching() const { + assert(!comphelper::LibreOfficeKit::isViewCallback()); return mbTiledSearching; } diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx index c2eee692ff36..296eefe9559e 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -275,10 +275,14 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage) { // Disable LOK selection notifications during search. SwDrawModel* pModel = m_pWrtShell->getIDocumentDrawModelAccess().GetDrawModel(); - if (pModel) + if (comphelper::LibreOfficeKit::isViewCallback()) + m_pWrtShell->GetSfxViewShell()->setTiledSearching(true); + else if (pModel) pModel->setTiledSearching(true); bool bRet = SearchAll(); - if (pModel) + if (comphelper::LibreOfficeKit::isViewCallback()) + m_pWrtShell->GetSfxViewShell()->setTiledSearching(false); + else if (pModel) pModel->setTiledSearching(false); if( !bRet ) |