Commit b12fa739 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Поддержал параметр isMatchCase в поиске

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48041 954022d7-b5bf-4e40-9824-e11837661b57
parent f3f0f545
...@@ -1798,8 +1798,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -1798,8 +1798,9 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
}, },
asc_findText: function (text, scanByRows, scanForward, isMatchCase, isWholeWord) { asc_findText: function (text, scanByRows, scanForward, isMatchCase, isWholeWord) {
// ToDo process isMatchCase, isWholeWord arguments // ToDo process isWholeWord arguments
var d = this.wb.findCellText(text, scanByRows, scanForward); var d = this.wb.findCellText({text: text, scanByRows: scanByRows, scanForward: scanForward,
isMatchCase: isMatchCase, isWholeWord: isWholeWord});
if (d) { if (d) {
if (d.deltaX) {this.controller.scrollHorizontal(d.deltaX);} if (d.deltaX) {this.controller.scrollHorizontal(d.deltaX);}
if (d.deltaY) {this.controller.scrollVertical(d.deltaY);} if (d.deltaY) {this.controller.scrollVertical(d.deltaY);}
......
...@@ -1333,12 +1333,12 @@ ...@@ -1333,12 +1333,12 @@
}, },
// Поиск текста в листе // Поиск текста в листе
findCellText: function (text, scanByRows, scanForward) { findCellText: function (options) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
// Останавливаем ввод данных в редакторе ввода // Останавливаем ввод данных в редакторе ввода
if (ws.getCellEditMode()) if (ws.getCellEditMode())
this._onStopCellEditing(); this._onStopCellEditing();
return ws.findCellText(text, scanByRows, scanForward); return ws.findCellText(options);
}, },
// Поиск ячейки по ссылке // Поиск ячейки по ссылке
......
...@@ -8571,10 +8571,10 @@ ...@@ -8571,10 +8571,10 @@
return offs; return offs;
}, },
findCellText: function (text, scanByRows, scanForward) { findCellText: function (options) {
var self = this; var self = this;
// ToDo не учитываем регистр if (true !== options.isMatchCase)
text = text.toLowerCase(); options.text = options.text.toLowerCase();
var ar = this.activeRange; var ar = this.activeRange;
var c = ar.startCol; var c = ar.startCol;
var r = ar.startRow; var r = ar.startRow;
...@@ -8582,9 +8582,9 @@ ...@@ -8582,9 +8582,9 @@
var minR = 0; var minR = 0;
var maxC = this.cols.length - 1; var maxC = this.cols.length - 1;
var maxR = this.rows.length - 1; var maxR = this.rows.length - 1;
var inc = scanForward ? +1 : -1; var inc = options.scanForward ? +1 : -1;
var ct, mc, excluded = []; var ct, mc, excluded = [];
var _tmpCell, lowerChars; var _tmpCell, cellText;
function isExcluded(col, row) { function isExcluded(col, row) {
for (var i = 0; i < excluded.length; ++i) { for (var i = 0; i < excluded.length; ++i) {
...@@ -8599,12 +8599,12 @@ ...@@ -8599,12 +8599,12 @@
do { do {
mc = self._getMergedCellsRange(c, r); mc = self._getMergedCellsRange(c, r);
if (mc) {excluded.push(mc);} if (mc) {excluded.push(mc);}
if (scanByRows) { if (options.scanByRows) {
c += mc ? (scanForward ? mc.c2 + 1 - c : mc.c1 - 1 - c) : inc; c += mc ? (options.scanForward ? mc.c2 + 1 - c : mc.c1 - 1 - c) : inc;
if (c < minC || c > maxC) {c = scanForward ? minC : maxC; r += inc;} if (c < minC || c > maxC) {c = options.scanForward ? minC : maxC; r += inc;}
} else { } else {
r += mc ? (scanForward ? mc.r2 + 1 - r : mc.r1 - 1 - r) : inc; r += mc ? (options.scanForward ? mc.r2 + 1 - r : mc.r1 - 1 - r) : inc;
if (r < minR || r > maxR) {r = scanForward ? minR : maxR; c += inc;} if (r < minR || r > maxR) {r = options.scanForward ? minR : maxR; c += inc;}
} }
if (c < minC || c > maxC || r < minR || r > maxR) {return undefined;} if (c < minC || c > maxC || r < minR || r > maxR) {return undefined;}
} while ( isExcluded(c, r) ); } while ( isExcluded(c, r) );
...@@ -8622,8 +8622,10 @@ ...@@ -8622,8 +8622,10 @@
_tmpCell = this.model.getCell (new CellAddress(mc.r1, mc.c1, 0)); _tmpCell = this.model.getCell (new CellAddress(mc.r1, mc.c1, 0));
else else
_tmpCell = this.model.getCell (new CellAddress(r, c, 0)); _tmpCell = this.model.getCell (new CellAddress(r, c, 0));
lowerChars = _tmpCell.getValueForEdit().toLowerCase(); cellText = _tmpCell.getValueForEdit();
if (lowerChars.indexOf(text) >= 0) { if (true !== options.isMatchCase)
cellText = cellText.toLowerCase();
if (cellText.indexOf(options.text) >= 0) {
return this._setActiveCell(c, r); return this._setActiveCell(c, r);
} }
} }
...@@ -8631,11 +8633,11 @@ ...@@ -8631,11 +8633,11 @@
// Сбрасываем замерженные // Сбрасываем замерженные
excluded = []; excluded = [];
// Продолжаем циклический поиск // Продолжаем циклический поиск
if (scanForward){ if (options.scanForward){
// Идем вперед с первой ячейки // Идем вперед с первой ячейки
minC = 0; minC = 0;
minR = 0; minR = 0;
if (scanByRows) { if (options.scanByRows) {
c = -1; c = -1;
r = 0; r = 0;
...@@ -8654,7 +8656,7 @@ ...@@ -8654,7 +8656,7 @@
// Идем назад с последней // Идем назад с последней
c = this.cols.length - 1; c = this.cols.length - 1;
r = this.rows.length - 1; r = this.rows.length - 1;
if (scanByRows) { if (options.scanByRows) {
minC = 0; minC = 0;
minR = ar.startRow; minR = ar.startRow;
} }
...@@ -8673,8 +8675,10 @@ ...@@ -8673,8 +8675,10 @@
_tmpCell = this.model.getCell (new CellAddress(mc.r1, mc.c1, 0)); _tmpCell = this.model.getCell (new CellAddress(mc.r1, mc.c1, 0));
else else
_tmpCell = this.model.getCell (new CellAddress(r, c, 0)); _tmpCell = this.model.getCell (new CellAddress(r, c, 0));
lowerChars = _tmpCell.getValueForEdit().toLowerCase(); cellText = _tmpCell.getValueForEdit();
if (lowerChars.indexOf(text) >= 0) { if (true !== options.isMatchCase)
cellText = cellText.toLowerCase();
if (cellText.indexOf(options.text) >= 0) {
return this._setActiveCell(c, r); return this._setActiveCell(c, r);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment