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 | 24 | ||||
-rw-r--r-- | svx/source/svdraw/svdmodel.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewsrch.cxx | 8 |
7 files changed, 58 insertions, 9 deletions
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx index 7ed08c11c11c..b46b09249012 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 69025612166c..6399db42242d 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1822,9 +1822,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 12bbfe3b7bec..2ea4d8102b5e 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 e3e60e228f32..fe3b4940e43f 100644 --- a/sfx2/source/view/viewimp.hxx +++ b/sfx2/source/view/viewimp.hxx @@ -61,6 +61,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 e3ec058b725a..635ba12c0afc 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -56,6 +56,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <vcl/settings.hxx> #include <vcl/commandinfoprovider.hxx> +#include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <sfx2/app.hxx> #include "view.hrc" @@ -250,6 +251,7 @@ SfxViewShell_Impl::SfxViewShell_Impl(SfxViewShellFlags const nFlags) , mpIPClientList(nullptr) , m_pLibreOfficeKitViewCallback(nullptr) , m_pLibreOfficeKitViewData(nullptr) +, m_bTiledSearching(false) {} SfxViewShell_Impl::~SfxViewShell_Impl() @@ -1458,10 +1460,32 @@ void SfxViewShell::registerLibreOfficeKitViewCallback(LibreOfficeKitCallback pCa void SfxViewShell::libreOfficeKitViewCallback(int nType, const char* pPayload) const { + if (pImpl->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 (pImpl->m_pLibreOfficeKitViewCallback) pImpl->m_pLibreOfficeKitViewCallback(nType, pPayload, pImpl->m_pLibreOfficeKitViewData); } +void SfxViewShell::setTiledSearching(bool bTiledSearching) +{ + pImpl->m_bTiledSearching = bTiledSearching; +} + +bool SfxViewShell::isTiledSearching() const +{ + return pImpl->m_bTiledSearching; +} + bool SfxViewShell::KeyInput( const KeyEvent &rKeyEvent ) /* [Description] diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index f0fc1df4b198..7d4d5cd6d85b 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -837,11 +837,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 2e069c65fcc1..41097862f08f 100644 --- a/sw/source/uibase/uiview/viewsrch.cxx +++ b/sw/source/uibase/uiview/viewsrch.cxx @@ -267,10 +267,14 @@ void SwView::ExecSearch(SfxRequest& rReq) { // 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 ) |