sw/source/uibase/uiview/viewsrch.cxx |   29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

New commits:
commit 52696e31e740d4076092f89531e58d11538f478f
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Jun 10 14:02:52 2016 +0200

    sw: implement per-view LOK_CALLBACK_SEARCH_RESULT_SELECTION
    
    This way searching in one view does not affect the search state of an
    other view.
    
    Change-Id: I6d873b1609a8f6cb3cfe07e1f2fa92024c3545d9
    Reviewed-on: https://gerrit.libreoffice.org/26161
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>
    Tested-by: Jenkins <c...@libreoffice.org>

diff --git a/sw/source/uibase/uiview/viewsrch.cxx 
b/sw/source/uibase/uiview/viewsrch.cxx
index a15c1ad..2e069c6 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -134,7 +134,10 @@ static void lcl_emitSearchResultCallbacks(SvxSearchItem* 
pSearchItem, SwWrtShell
         boost::property_tree::write_json(aStream, aTree);
         OString aPayload = aStream.str().c_str();
 
-        
pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, 
aPayload.getStr());
+        if (comphelper::LibreOfficeKit::isViewCallback())
+            
pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION,
 aPayload.getStr());
+        else
+            
pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_RESULT_SELECTION, 
aPayload.getStr());
     }
 }
 
@@ -275,8 +278,10 @@ void SwView::ExecSearch(SfxRequest& rReq)
 #if HAVE_FEATURE_DESKTOP
                     if( !bQuiet )
                     {
-                        
m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
-                                
m_pSrchItem->GetSearchString().toUtf8().getStr());
+                        if (comphelper::LibreOfficeKit::isViewCallback())
+                            
m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
 m_pSrchItem->GetSearchString().toUtf8().getStr());
+                        else
+                            
m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, 
m_pSrchItem->GetSearchString().toUtf8().getStr());
                         SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
                     }
 #endif
@@ -397,8 +402,10 @@ void SwView::ExecSearch(SfxRequest& rReq)
 #if HAVE_FEATURE_DESKTOP
                         if( !bQuiet )
                         {
-                            
m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
-                                    
m_pSrchItem->GetSearchString().toUtf8().getStr());
+                            if (comphelper::LibreOfficeKit::isViewCallback())
+                                
m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
 m_pSrchItem->GetSearchString().toUtf8().getStr());
+                            else
+                                
m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, 
m_pSrchItem->GetSearchString().toUtf8().getStr());
                             
SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
                         }
 #endif
@@ -594,8 +601,10 @@ bool SwView::SearchAndWrap(bool bApi)
         if( !bApi )
         {
 #if HAVE_FEATURE_DESKTOP
-            m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
-                    m_pSrchItem->GetSearchString().toUtf8().getStr());
+            if (comphelper::LibreOfficeKit::isViewCallback())
+                
m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
 m_pSrchItem->GetSearchString().toUtf8().getStr());
+            else
+                
m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, 
m_pSrchItem->GetSearchString().toUtf8().getStr());
             SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
 #endif
         }
@@ -648,8 +657,10 @@ bool SwView::SearchAndWrap(bool bApi)
     }
     else if(!bApi)
     {
-        m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
-                m_pSrchItem->GetSearchString().toUtf8().getStr());
+        if (comphelper::LibreOfficeKit::isViewCallback())
+            
m_pWrtShell->GetSfxViewShell()->libreOfficeKitViewCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
 m_pSrchItem->GetSearchString().toUtf8().getStr());
+        else
+            m_pWrtShell->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND, 
m_pSrchItem->GetSearchString().toUtf8().getStr());
         SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
     }
 #endif
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to