[Libreoffice-commits] core.git: include/sfx2 sc/source sd/source sfx2/source svx/source sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Jun 15 17:27:15 UTC 2016


 include/sfx2/viewsh.hxx              |    4 ++++
 sc/source/ui/view/viewfun2.cxx       |   10 ++++++++--
 sd/source/ui/view/Outliner.cxx       |   17 ++++++++++++-----
 sfx2/source/view/viewimp.hxx         |    2 ++
 sfx2/source/view/viewsh.cxx          |   24 ++++++++++++++++++++++++
 svx/source/svdraw/svdmodel.cxx       |    2 ++
 sw/source/uibase/uiview/viewsrch.cxx |    8 ++++++--
 7 files changed, 58 insertions(+), 9 deletions(-)

New commits:
commit c97422fa103618ba19bde0d815674a0173058bb4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Jun 15 17:56:38 2016 +0200

    sfx2: bring the view shell's LOK callback up to date with SdrModel
    
    This fixes CppunitTest_sw_tiledrendering in the LOK_VIEW_CALLBACK=1
    case.
    
    Change-Id: Ib79e57908c3edda0154341baba8279ede4281a42
    Reviewed-on: https://gerrit.libreoffice.org/26313
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 7ed08c1..b46b092 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 6902561..6399db4 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 12bbfe3..2ea4d81 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 e3e60e2..fe3b494 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 e3ec058..635ba12 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 f0fc1df..7d4d5cd 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 2e069c6..4109786 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 )


More information about the Libreoffice-commits mailing list