[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 3 commits - sc/source

Henry Castro hcastro at collabora.com
Thu Jun 4 00:57:43 PDT 2015


 sc/source/core/data/documen3.cxx |   19 +++++++++++++++++++
 sc/source/ui/view/viewfun2.cxx   |   23 ++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit fa0eed40e7e5e5f83146ba4133b62c20e33e096d
Author: Henry Castro <hcastro at collabora.com>
Date:   Mon May 25 23:45:06 2015 -0400

    sc LOKit callback for search not found.
    
    Needed for signaling the user when no match was found for the searched input
    
    Change-Id: I10089d065c26deea7cb57a9dc20f130f9afb6d99

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 2449867..47b0ace 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1792,7 +1792,11 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
 
             GetFrameWin()->LeaveWait();
             if (!bIsApi)
+            {
+                rDoc.GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SEARCH_NOT_FOUND,
+                                                            pSearchItem->GetSearchString().toUtf8().getStr());
                 SvxSearchDialogWrapper::SetSearchLabel(SL_NotFound);
+            }
 
             break;                      // break 'while (TRUE)'
         }
commit 7c338fe589bc5e15c244c37f8b89f8ae86277564
Author: Henry Castro <hcastro at collabora.com>
Date:   Sat May 30 11:55:01 2015 -0400

    sc: Notify about the part change when searching.
    
    Change-Id: Ieea445b64f72f270885d6e21d4070fefe8d82567

diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index d521bd6..da216f2 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -74,6 +74,7 @@
 
 #include "globalnames.hxx"
 #include <boost/scoped_ptr.hpp>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 using namespace com::sun::star;
 
@@ -1289,8 +1290,17 @@ bool ScDocument::SearchAndReplace(
                                 rTab = nTab;
                             }
                             else
+                            {
                                 ScDocument::GetSearchAndReplaceStart(
                                     rSearchItem, nCol, nRow );
+
+                                // notify LibreOfficeKit about changed page
+                                if ( GetDrawLayer() && GetDrawLayer()->isTiledRendering() )
+                                {
+                                    OString aPayload = OString::number(nTab);
+                                    GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr());
+                                }
+                            }
                         }
                     }
             }
@@ -1310,8 +1320,17 @@ bool ScDocument::SearchAndReplace(
                                 rTab = nTab;
                             }
                             else
+                            {
                                 ScDocument::GetSearchAndReplaceStart(
                                     rSearchItem, nCol, nRow );
+
+                                // notify LibreOfficeKit about changed page
+                                if ( GetDrawLayer() && GetDrawLayer()->isTiledRendering() )
+                                {
+                                    OString aPayload = OString::number(nTab);
+                                    GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_SET_PART, aPayload.getStr());
+                                }
+                            }
                         }
                     }
             }
commit 572abb94b12d959c0f16b475101041e4ea27e48d
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri May 29 11:53:50 2015 -0400

    sc: SvxSearchItem, m_nStartPoint{X,Y}
    
    The idea is that if you have your cursor at the begining of a Calc document, and you scroll down a
    lot, then search, then it's annoying that search jumps back to the start of the document for the
    first hit.
    
    Add an optional way to provide what is the starting point of such a search, so we can have "when
    nothing is selected, then search from the top left corner of the visible area".
    
    Change-Id: I22624dd52a093759d46541e003d838aeb0db943f

diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 5b5ec3b..2449867 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1640,6 +1640,23 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
     if (bAddUndo && !rDoc.IsUndoEnabled())
         bAddUndo = false;
 
+    if ( !rMark.IsMarked() && !rMark.IsMultiMarked() && (pSearchItem->HasStartPoint()) )
+    {
+        // No selection -> but we have a start point (top left corner of the
+        // current view), start searching from there, not from the current
+        // cursor position.
+        SCsCOL nPosX;
+        SCsROW nPosY;
+
+        int nPixelX = pSearchItem->GetStartPointX() * GetViewData().GetPPTX();
+        int nPixelY = pSearchItem->GetStartPointY() * GetViewData().GetPPTY();
+
+        GetViewData().GetPosFromPixel(nPixelX, nPixelY, GetViewData().GetActivePart(), nPosX, nPosY);
+
+        AlignToCursor( nPosX, nPosY, SC_FOLLOW_JUMP );
+        SetCursor( nPosX, nPosY, true );
+    }
+
     SCCOL nCol, nOldCol;
     SCROW nRow, nOldRow;
     SCTAB nTab, nOldTab;
@@ -1825,9 +1842,9 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
             if (pGridWindow)
             {
                 // move the cell selection handles
+                pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_RESET, aCurPos.X(), aCurPos.Y());
                 pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_START, aCurPos.X(), aCurPos.Y());
                 pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_END, aCurPos.X(), aCurPos.Y());
-                pGridWindow->SetCellSelectionPixel(LOK_SETTEXTSELECTION_RESET, aCurPos.X(), aCurPos.Y());
             }
         }
 


More information about the Libreoffice-commits mailing list