loleaflet/README                        |    2 +-
 loleaflet/reference.html                |    8 +++++---
 loleaflet/src/control/Control.Search.js |    9 +++++++++
 loleaflet/src/control/Search.js         |    4 ++--
 4 files changed, 17 insertions(+), 6 deletions(-)

New commits:
commit 0bb8d0f1c32dbf71644fa627ed26c698ba2cc1ef
Author: Jan Holesovsky <[email protected]>
Date:   Mon Jan 25 22:15:04 2016 +0100

    loleaflet: Rename searchAll() to highlightAll() for clarity.
    
    The previous work changed the behaviour of searchAll so that it does not
    create a real selection, but instead adds additional mean of highlight, so
    that it is possible to show all the results, and travel them at the same 
time.
    
    The usage is now:
    
    * call once the highlightAll()
    * and then traverse the results using search()

diff --git a/loleaflet/README b/loleaflet/README
index 9b92d7e..7c91a30 100644
--- a/loleaflet/README
+++ b/loleaflet/README
@@ -82,7 +82,7 @@ API & events
 Search:
     - API:
         map.search(text, [backward])
-        map.searchAll(text, [backward])
+        map.higlightAll(text)
     - events:
         map.on('search', function (e) {}) (currently only fired when no search 
result is found) where:
             + e.originalPhrase = the phrase that has been searched for
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index cfc4a26..b84f9c3 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -1549,12 +1549,14 @@ unexpected behaviour.</h4>
         Or backwards if specified.</td>
        </tr>
        <tr>
-               <td><code><b>searchAll</b>(
+               <td><code><b>highlightAll</b>(
                        <nobr>&lt;String&gt; <i>phrase</i>,</nobr>
-                       <nobr>&lt;Boolean&gt; <i>backward?</i> )</nobr>
                </code></td>
                <td><code>undefined</code></td>
-               <td>Searches for all occurrences of the given phrase.</td>
+               <td>Highlights all the occurrences of the given phrase. Please 
note that
+                       this adds an extra layer for the highlights, so it is 
possible to
+                       see both all the highlighted phrase, and the current 
selection at
+                       the same time.</td>
        </tr>
        <tr>
                <td><code><b>setPermission</b>(
diff --git a/loleaflet/src/control/Control.Search.js 
b/loleaflet/src/control/Control.Search.js
index 57b662d..ff312bb 100644
--- a/loleaflet/src/control/Control.Search.js
+++ b/loleaflet/src/control/Control.Search.js
@@ -10,6 +10,8 @@ L.Control.Search = L.Control.extend({
                prevTitle: 'Previous',
                nextText: '&#x25BC',
                nextTitle: 'Next',
+               highlightText: '&#x263C',
+               highlightTitle: 'Highlight all',
                cancelText: '&#x2716',
                cancelTitle: 'Cancel'
        },
@@ -25,6 +27,8 @@ L.Control.Search = L.Control.extend({
                                searchName + '-prev', container, 
this._searchPrev);
                this._nextButton = this._createButton(options.nextText, 
options.nextTitle,
                                searchName + '-next', container, 
this._searchNext);
+               this._highlightButton = 
this._createButton(options.highlightText, options.highlightTitle,
+                               searchName + '-highlight', container, 
this._highlightAll);
                this._cancelButton = this._createButton(options.cancelText, 
options.cancelTitle,
                                searchName + '-cancel', container, 
this._cancel);
 
@@ -71,6 +75,11 @@ L.Control.Search = L.Control.extend({
                this._refocusOnMap();
        },
 
+       _highlightAll: function () {
+               this._map.highlightAll(this._searchBar.value);
+               this._refocusOnMap();
+       },
+
        _cancel: function () {
                L.DomUtil.setStyle(this._cancelButton, 'display', 'none');
                this._map.fire('clearselection');
diff --git a/loleaflet/src/control/Search.js b/loleaflet/src/control/Search.js
index 5528a08..22bd3dd 100644
--- a/loleaflet/src/control/Search.js
+++ b/loleaflet/src/control/Search.js
@@ -42,11 +42,11 @@ L.Map.include({
                this._socket.sendMessage('uno .uno:ExecuteSearch ' + 
JSON.stringify(searchCmd));
        },
 
-       searchAll: function (text, backward) {
+       highlightAll: function (text) {
                if (this._docLayer._searchResults && text === 
this._docLayer._searchTerm) {
                        return;
                }
-               this.search(text, backward, 1);
+               this.search(text, false, 1);
        },
 
        resetSelection: function () {
_______________________________________________
Libreoffice-commits mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to