Commit 2374e140 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@67641 954022d7-b5bf-4e40-9824-e11837661b57
parent 0f22c782
......@@ -649,6 +649,17 @@ WorksheetView.prototype._changeSelectionTopLeft = function (x, y, isCoord, isSel
return this._calcActiveRangeOffset(x,y);
};
WorksheetView.prototype.__chartsRanges = function() {
if (asc["editor"].isStartAddShape || this.objectRender.selectedGraphicObjectsExists()) {
if (this.isChartAreaEditMode) {
return this.__drawFormulaRanges(this.arrActiveChartsRanges, 0, 0);
}
}
return null;
};
WorksheetView.prototype.__drawFormulaRanges = function (arrRanges, offsetX, offsetY) {
var ranges = [],i = 0, type = 0, left = 0, right = 0, top = 0, bottom = 0;
......@@ -695,8 +706,4 @@ WorksheetView.prototype.__drawFormulaRanges = function (arrRanges, offsetX, offs
return ranges;
};
WorksheetView.prototype.__getFormulaRanges = function() {
this.__drawFormulaRanges(this.arrActiveFormulaRanges, offsetX, offsetY);
};
......@@ -4378,6 +4378,21 @@ function offline_mouse_move(x, y, isViewer) {
var e = {isLocked: true, Button: 0, ClickCount: 1, shiftKey: false, metaKey: false, ctrlKey: false};
ws.objectRender.graphicObjectMouseMove(e, x, y);
}
} else {
if (_s.isFormulaEditMode) {
var ret = false;
ret = wb.cellEditor.canEnterCellRange();
ret ? wb.cellEditor.activateCellRange() : true;
if (!ret) {
_s.isFormulaEditMode = false;
ws.visibleRange = range;
return {'action':'closeCellEditor'};
}
ws.changeSelectionEndPoint(x, y, true, true);
ws.enterCellRange(wb.cellEditor);
} else {
if (-1 == _s.cellPin)
ws._changeSelectionTopLeft(x, y, true, true, true);
......@@ -4385,14 +4400,13 @@ function offline_mouse_move(x, y, isViewer) {
ws._changeSelectionTopLeft(x, y, true, true, false);
else {
ws.changeSelectionEndPoint(x, y, true, true);
if (_s.isFormulaEditMode) {
ws.enterCellRange(wb.cellEditor);
}
}
}
ws.visibleRange = range;
return null;
}
function offline_mouse_up(x, y, isViewer) {
var ws = _api.wb.getWorksheet();
......@@ -4419,6 +4433,9 @@ function offline_mouse_up(x, y, isViewer) {
function offline_get_selection(x, y, width, height, autocorrection) {
return _s.getSelection(x, y, width, height, autocorrection);
}
function offline_get_charts_ranges() {
return _api.wb.getWorksheet().__chartsRanges();
}
function offline_get_worksheet_bounds() {
return _s.getMaxBounds();
}
......@@ -4579,7 +4596,14 @@ function offline_cell_editor_mouse_event(events) {
}
function offline_cell_editor_close(x, y, width, height, ratio) {
var e = {which: 13, shiftKey: false, metaKey: false, ctrlKey: false};
_api.wb.cellEditor._tryCloseEditor(e);
//_api.wb.cellEditor._tryCloseEditor(e);
if (_api.wb.cellEditor.close(true)) {
_api.wb.getWorksheet().handlers.trigger('applyCloseEvent', e);
}
_api.wb._onWSSelectionChanged(/*info*/null);
}
function offline_cell_editor_selection() {
return _api.wb.cellEditor._drawSelection();
......
......@@ -1011,12 +1011,10 @@
}
if (doAjust) {this._adjustCanvas();}
if (!window['IS_NATIVE_EDITOR']) {
this._renderText(); // вызов нужен для пересчета поля line.startX, которое используется в _updateCursorPosition
this._fireUpdated(); // вызов нужен для обновление текста верхней строки, перед обновлением позиции курсора
this._updateCursorPosition(true);
this._showCursor();
}
this._updateUndoRedoChanged();
......@@ -1150,8 +1148,10 @@
CellEditor.prototype._renderText = function (dy) {
var t = this, opt = t.options, ctx = t.drawingCtx;
if (!window['IS_NATIVE_EDITOR']) {
ctx.setFillStyle(opt.background)
.fillRect(0, 0, ctx.getWidth(), ctx.getHeight());
}
if (opt.fragments.length > 0) {
t.textRender.render(t._getContentLeft(), (dy === undefined ? 0 : dy), t._getContentWidth(), opt.textColor);
......@@ -1797,10 +1797,8 @@
CellEditor.prototype._tryCloseEditor = function (event) {
if (this.close(true)) {
if (!window['IS_NATIVE_EDITOR']) {
this.handlers.trigger("applyCloseEvent", event);
}
}
};
CellEditor.prototype._getAutoComplete = function(str) {
......
......@@ -432,6 +432,47 @@
});
}
if (window['IS_NATIVE_EDITOR']) {
this.cellEditor = new asc.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont,
/*handlers*/{
"closed" : function () {self._onCloseCellEditor.apply(self, arguments);},
"updated" : function () {self._onUpdateCellEditor.apply(self, arguments);},
"gotFocus" : function (hasFocus) {self.controller.setFocus(!hasFocus);},
"copy" : function () {self.copyToClipboard.apply(self, arguments);},
"paste" : function () {self.pasteFromClipboard.apply(self, arguments);},
"cut" : function () {self.cutToClipboard.apply(self, arguments);},
"updateFormulaEditMod": function () {
self.controller.setFormulaEditMode.apply(self.controller, arguments);
var ws = self.getWorksheet();
if (ws) {
ws.cleanSelection();
ws.cleanFormulaRanges();
ws.setFormulaEditMode.apply(ws, arguments);
}
},
"updateEditorState" : function (state) {self.handlers.trigger("asc_onEditCell", state);},
"isGlobalLockEditCell" : function () {return self.collaborativeEditing.getGlobalLockEditCell();},
"updateFormulaEditModEnd" : function (rangeUpdated) {self.getWorksheet().updateSelection();},
"newRange" : function (range) { self.getWorksheet().addFormulaRange(range); },
"existedRange" : function (range) { self.getWorksheet().activeFormulaRange(range); },
"updateUndoRedoChanged" : function (bCanUndo, bCanRedo) {
self.handlers.trigger("asc_onCanUndoChanged", bCanUndo);
self.handlers.trigger("asc_onCanRedoChanged", bCanRedo);
},
"applyCloseEvent" : function () {self.controller._onWindowKeyDown.apply(self.controller, arguments);},
"isViewerMode" : function () {return self.controller.settings.isViewerMode;},
"popUpSelectorKeyDown" : function (event) {return self._onPopUpSelectorKeyDown(event);},
"getFormulaRanges" : function () {return self.getWorksheet().getFormulaRanges();},
"setStrictClose" : function (val) {self.controller.setStrictClose(val);},
"updateEditorSelectionInfo" : function (info) {self.handlers.trigger("asc_onEditorSelectionChanged", info);},
"onContextMenu" : function (event) {self.handlers.trigger("asc_onContextMenu", event);}
},
/*settings*/{
font: this.defaultFont,
padding: this.defaults.worksheetView.cells.padding
});
}
this.wsViewHandlers = new asc.asc_CHandlersList(/*handlers*/{
"getViewerMode" : function () { return self.controller.getViewerMode ? self.controller.getViewerMode() : true; },
"reinitializeScroll" : function () {self.controller.reinitializeScroll(/*All*/);},
......@@ -941,6 +982,8 @@
WorkbookView.prototype._onShowAutoComplete = function () {
var ws = this.getWorksheet();
var arrValues = ws.getCellAutoCompleteValues(ws.activeRange.startCol, ws.activeRange.startRow);
if (!window['IS_NATIVE_EDITOR'])
this.popUpSelector.show(false, arrValues, this.getWorksheet().getActiveCellCoord());
};
......@@ -1539,6 +1582,9 @@
};
WorkbookView.prototype.restoreFocus = function () {
if (window["NATIVE_EDITOR_ENJINE"])
return;
if (this.cellEditor.hasFocus) {
this.cellEditor.restoreFocus();
}
......@@ -1570,12 +1616,16 @@
}
}
if ( 0 < arrResult.length ) {
if (!window['IS_NATIVE_EDITOR'])
this.popUpSelector.show( true, arrResult, this.getWorksheet().getActiveCellCoord() );
this.lastFormulaPos = formulaPos;
this.lastFormulaName = formulaName;
}
else {
if (!window['IS_NATIVE_EDITOR'])
this.popUpSelector.hide();
this.lastFormulaPos = -1;
this.lastFormulaName = '';
}
......
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