Commit 4c660ff1 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add composite input to spreadsheets

parent 41cc3fe5
......@@ -125,6 +125,8 @@
this.cursorStyle = undefined;
this.cursorTID = undefined;
this.cursorPos = 0;
this.beginCompositePos = -1;
this.compositeLength = 0;
this.topLineIndex = 0;
this.m_oFont = oFont;
this.fmgrGraphics = fmgrGraphics;
......@@ -2688,6 +2690,38 @@
return {x: x, y: y};
};
CellEditor.prototype.Begin_CompositeInput = function () {
if (this.selectionBegin === this.selectionEnd) {
this.beginCompositePos = this.cursorPos;
this.compositeLength = 0;
} else {
this.beginCompositePos = this.selectionBegin;
this.compositeLength = this.selectionEnd - this.selectionBegin;
}
};
CellEditor.prototype.Replace_CompositeText = function (arrCharCodes) {
if (!this.isOpened) {
return;
}
var code, codePt, newText = '';
for (var i = 0; i < arrCharCodes.length; ++i) {
code = arrCharCodes[i];
if (code < 0x10000) {
newText += String.fromCharCode(code);
} else {
codePt = code - 0x10000;
newText += String.fromCharCode(0xD800 + (codePt >> 10), 0xDC00 + (codePt & 0x3FF));
}
}
this.replaceText(this.beginCompositePos, this.compositeLength, newText);
this.compositeLength = newText.length;
};
CellEditor.prototype.End_CompositeInput = function () {
this.beginCompositePos = -1;
this.compositeLength = 0;
};
//------------------------------------------------------------export---------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
......
......@@ -176,7 +176,7 @@
this.fontRenderingMode = null;
this.lockDraw = false; // Lock отрисовки на некоторое время
this.isCellEditMode = false;
this.isCellEditMode = false;
this.formulasList = []; // Список всех формул
this.lastFormulaPos = -1; // Последняя позиция формулы
......@@ -572,7 +572,22 @@
self.cellEditor._onWindowKeyUp(event);
}
};
this.Api.Begin_CompositeInput = function () {
self.cellEditor.Begin_CompositeInput();
if (!self.isCellEditMode) {
self._onEditCell(false, true, undefined, true, function() {
self.cellEditor.Begin_CompositeInput();
});
}
};
this.Api.Replace_CompositeText = function (arrCharCodes) {
if (self.isCellEditMode) {
self.cellEditor.Replace_CompositeText(arrCharCodes);
}
};
this.Api.End_CompositeInput = function() {
self.cellEditor.End_CompositeInput();
};
AscCommon.InitBrowserInputContext(this.Api, "id_target_cursor");
this.wsViewHandlers = new AscCommonExcel.asc_CHandlersList(/*handlers*/{
......
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