Commit 64ab0f3d authored by Alexey.Musinov's avatar Alexey.Musinov

[ios] cell editor

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@66920 954022d7-b5bf-4e40-9824-e11837661b57
parent 089b83a3
......@@ -153,6 +153,8 @@
selectionTimeout: 20
};
this.dontUpdateText = false;
this._init(settings);
return this;
......@@ -921,7 +923,9 @@
this._updateUndoRedoChanged();
if (!this.dontUpdateText) {
window["native"].onCellEditorChangeText(this._getFragmentsText(this.options.fragments));
}
};
CellEditor.prototype._fireUpdated = function () {
......@@ -1322,8 +1326,12 @@
if (!this._checkMaxCellLength(length)) {return false;}
this.dontUpdateText = true;
if (this.selectionBegin !== this.selectionEnd) {this._removeChars(undefined, undefined, isRange);}
this.dontUpdateText = false;
if (pos === undefined) {pos = this.cursorPos;}
if (!this.undoMode) {
......
......@@ -217,9 +217,9 @@ WorksheetView.prototype._getDrawSelection_Local = function (c1, r1, c2, r2, isFr
isFrozen = !!isFrozen;
if (asc["editor"].isStartAddShape || this.objectRender.selectedGraphicObjectsExists()) {
if (this.isChartAreaEditMode) {
this._drawFormulaRanges(this.arrActiveChartsRanges);
}
//if (this.isChartAreaEditMode) {
// this._drawFormulaRanges(this.arrActiveChartsRanges);
//}
return;
}
......@@ -496,8 +496,6 @@ WorksheetView.prototype._getDrawSelection_Local = function (c1, r1, c2, r2, isFr
//}
}
return native_selection;
// draw fill handle select
if (this.activeFillHandle !== null) {
//if (2 === this.fillHandleArea && (aFH.c1 !== aFH.c2 || aFH.r1 !== aFH.r2)){
......@@ -531,10 +529,14 @@ WorksheetView.prototype._getDrawSelection_Local = function (c1, r1, c2, r2, isFr
//ctx.stroke();
}
var formulaRanges = [];
if (!isFrozen && this.isFormulaEditMode) {
// this._drawFormulaRanges(this.arrActiveFormulaRanges);
formulaRanges = this.__drawFormulaRanges(this.arrActiveFormulaRanges, offsetX, offsetY);
}
return {'selection':native_selection, 'formulaRanges': formulaRanges};
if (!isFrozen && this.isChartAreaEditMode) {
// this._drawFormulaRanges(this.arrActiveChartsRanges);
}
......@@ -649,4 +651,47 @@ WorksheetView.prototype._changeSelectionTopLeft = function (x, y, isCoord, isSel
return this._calcActiveRangeOffset(x,y);
};
WorksheetView.prototype.__drawFormulaRanges = function (arrRanges, offsetX, offsetY) {
var ranges = [];
var i;//, lineWidth = 1, isDashLine = false, length = c_oAscFormulaRangeBorderColor.length;
// var strokeColor, fillColor, colorIndex, uniqueColorIndex = 0, tmpColors = [];
for (i = 0; i < arrRanges.length; ++i) {
//var oFormulaRange = arrRanges[i].clone(true);
ranges.push(arrRanges[i].c1);
ranges.push(arrRanges[i].c2);
ranges.push(arrRanges[i].r1);
ranges.push(arrRanges[i].r2);
var _l = this.cols[arrRanges[i].c1].left - offsetX,
_r = this.cols[arrRanges[i].c2].left + this.cols[arrRanges[i].c2].width - offsetX,
_t = this.rows[arrRanges[i].r1].top - offsetY,
_b = this.rows[arrRanges[i].r2].top + this.rows[arrRanges[i].r2].height - offsetY;
ranges.push(_l);
ranges.push(_t);
ranges.push(_r);
ranges.push(_b);
// console.log('FormulaRange ('+ i +') ' + JSON.stringify(arrRanges[i]));
// colorIndex = asc.getUniqueRangeColor(arrRanges, i, tmpColors);
// if (null == colorIndex)
// colorIndex = uniqueColorIndex++;
// tmpColors.push(colorIndex);
//
// strokeColor = fillColor = c_oAscFormulaRangeBorderColor[colorIndex % length];
// this._drawElements(this, this._drawSelectionElement, oFormulaRange, isDashLine, lineWidth,
// strokeColor, fillColor);
}
return ranges;
};
WorksheetView.prototype.__getFormulaRanges = function() {
this.__drawFormulaRanges(this.arrActiveFormulaRanges, offsetX, offsetY);
}
......@@ -2946,7 +2946,6 @@ function OfflineEditor () {
stream["ClearNoAttack"]();
asc_WriteCCelInfo(cellInfo, stream);
window["native"]["OnCallMenuEvent"](2402, stream); // ASC_SPREADSHEETS_EVENT_TYPE_SELECTION_CHANGED
t.onSelectionChanged(cellInfo);
});
_api.asc_registerCallback('asc_onSelectionNameChanged', function(name) {
......@@ -2962,7 +2961,6 @@ function OfflineEditor () {
window["native"]["OnCallMenuEvent"](2403, stream); // ASC_SPREADSHEETS_EVENT_TYPE_EDITOR_SELECTION_CHANGED
});
_api.asc_registerCallback('asc_onSendThemeColorSchemes', function(schemes) {
var stream = global_memory_stream_menu;
stream["ClearNoAttack"]();
asc_WriteColorSchemes(schemes, stream);
......@@ -2985,6 +2983,12 @@ function OfflineEditor () {
stream['WriteLong'](level);
window["native"]["OnCallMenuEvent"](500, stream); // ASC_MENU_EVENT_TYPE_ON_ERROR
});
_api.asc_registerCallback('asc_onEditCell', function(state) {
var stream = global_memory_stream_menu;
stream["ClearNoAttack"]();
stream['WriteLong'](state);
window["native"]["OnCallMenuEvent"](2600, stream); // ASC_SPREADSHEETS_EVENT_TYPE_ON_EDIT_CELL
});
};
this.updateFrozen = function () {
var ws = _api.wb.getWorksheet();
......@@ -4201,7 +4205,7 @@ function offline_of() {_s.openFile();}
function offline_stz(v) {_s.zoom = v; _api.asc_setZoom(v);}
function offline_ds(x, y, width, height, ratio) {_s.drawSheet(x, y, width, height, ratio);}
function offline_dh(x, y, width, height, type, ratio) {_s.drawHeader(x, y, width, height, type, ratio);}
function offline_mouse_down(x, y, pin, isViewer) {
function offline_mouse_down(x, y, pin, isViewer, isFormulaEditMode) {
_s.isShapeAction = false;
var ws = _api.wb.getWorksheet();
......@@ -4227,11 +4231,22 @@ function offline_mouse_down(x, y, pin, isViewer) {
}
_s.cellPin = pin;
_s.isFormulaEditMode = isFormulaEditMode;
if (0 != _s.cellPin) {
ws.leftTopRange = ws.activeRange.clone();
} else {
if (isFormulaEditMode) {
var ret = wb.cellEditor.canEnterCellRange();
ret ? wb.cellEditor.activateCellRange() : true;
}
ws.changeSelectionStartPoint(x, y, true, true);
if (isFormulaEditMode) {
ws.enterCellRange(wb.cellEditor);
}
}
ws.visibleRange = range;
......@@ -4240,6 +4255,7 @@ function offline_mouse_down(x, y, pin, isViewer) {
}
function offline_mouse_move(x, y, isViewer) {
var ws = _api.wb.getWorksheet();
var wb = _api.wb;
var range = ws.visibleRange.clone();
range.c1 = _s.col0;
......@@ -4248,7 +4264,6 @@ function offline_mouse_move(x, y, isViewer) {
if (_s.isShapeAction) {
if (!isViewer) {
var wb = _api.wb;
var e = {isLocked: true, Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false};
ws.objectRender.graphicObjectMouseMove(e, x, y);
}
......@@ -4257,8 +4272,13 @@ function offline_mouse_move(x, y, isViewer) {
ws._changeSelectionTopLeft(x, y, true, true, true);
else if (1 === _s.cellPin)
ws._changeSelectionTopLeft(x, y, true, true, false);
else
else {
ws.changeSelectionEndPoint(x, y, true, true);
if (_s.isFormulaEditMode) {
ws.enterCellRange(wb.cellEditor);
}
}
}
ws.visibleRange = range;
......@@ -4311,6 +4331,14 @@ function offline_keyboard_down(keys) {
wb._onChangeSelection(true, 0, 1, false, false, undefined);
}
}
function offline_cell_editor_draw(width, height, ratio) {
_null_object.width = width * ratio;
_null_object.height = height * ratio;
var wb = _api.wb;
var cellEditor = _api.wb.cellEditor;
cellEditor._draw();
}
function offline_cell_editor_open(isSelectAll, x, y, width, height, ratio) {
_null_object.width = width * ratio;
_null_object.height = height * ratio;
......@@ -4319,12 +4347,7 @@ function offline_cell_editor_open(isSelectAll, x, y, width, height, ratio) {
wb.cellEditor.isSelectAll = isSelectAll;
// if (isCoord) {
wb._onEditCell(x, y, true, undefined, undefined, true, false);
// }
// else {
// wb._onEditCell(parseInt(x), parseInt(y), false, undefined, undefined, true, false);
// }
return [wb.cellEditor.left, wb.cellEditor.top, wb.cellEditor.right, wb.cellEditor.bottom,
wb.cellEditor.curLeft, wb.cellEditor.curTop, wb.cellEditor.curHeight];
......@@ -4805,11 +4828,10 @@ function offline_apply_event(type,params) {
if (bIsNeed)
{
var _originSize = this.Native["GetOriginalImageSize"](_imagePr.ImageUrl);
var _w = _originSize[0];
var _h = _originSize[1];
var _w = _originSize[0] * 25.4 / 96.0;
var _h = _originSize[1] * 25.4 / 96.0;
// сбрасываем урл
//_imagePr.ImageUrl = undefined;
_imagePr.ImageUrl = undefined;
// var Page_Width = 210;
// var Page_Height = 297;
......@@ -4839,14 +4861,14 @@ function offline_apply_event(type,params) {
// var __w = Math.max(1, _page_width - (_page_x_left_margin + _page_x_right_margin));
// var __h = Math.max(1, _page_height - (_page_y_top_margin + _page_y_bottom_margin));
//
// var wI = (undefined !== _w) ? Math.max(_w * g_dKoef_pix_to_mm, 1) : 1;
// var hI = (undefined !== _h) ? Math.max(_h * g_dKoef_pix_to_mm, 1) : 1;
//
// wI = Math.max(5, Math.min(wI, __w));
// hI = Math.max(5, Math.min(hI, __h));
var wI = (undefined !== _w) ? Math.max(_w * 25.4 / 96.0, 1) : 1;
var hI = (undefined !== _h) ? Math.max(_h * 25.4 / 96.0, 1) : 1;
wI = Math.max(5, Math.min(wI, __w));
hI = Math.max(5, Math.min(hI, __h));
_imagePr.Width = _w; // wI;
_imagePr.Height = _h; // hI;
_imagePr.Width = wI;
_imagePr.Height = hI;
}
break;
......
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