Commit 63d5c00a authored by Alexander.Trofimov's avatar Alexander.Trofimov

check idle in spreadsheets

parent 26d9821e
...@@ -595,135 +595,135 @@ ...@@ -595,135 +595,135 @@
AscCommon.InitBrowserInputContext(this.Api, "id_target_cursor"); AscCommon.InitBrowserInputContext(this.Api, "id_target_cursor");
} }
this.cellEditor = this.cellEditor =
new AscCommonExcel.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont, /*handlers*/{ new AscCommonExcel.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont, /*handlers*/{
"closed": function () { "closed": function () {
self._onCloseCellEditor.apply(self, arguments); self._onCloseCellEditor.apply(self, arguments);
}, "updated": function () { }, "updated": function () {
self._onUpdateCellEditor.apply(self, arguments); self.Api.checkLastWork();
}, "gotFocus": function (hasFocus) { self._onUpdateCellEditor.apply(self, arguments);
self.controller.setFocus(!hasFocus); }, "gotFocus": function (hasFocus) {
}, "updateFormulaEditMod": function () { self.controller.setFocus(!hasFocus);
self.controller.setFormulaEditMode.apply(self.controller, arguments); }, "updateFormulaEditMod": function () {
var ws = self.getWorksheet(); self.controller.setFormulaEditMode.apply(self.controller, arguments);
if (ws) { var ws = self.getWorksheet();
if (!self.lockDraw) { if (ws) {
ws.cleanSelection(); if (!self.lockDraw) {
} ws.cleanSelection();
for (var i in self.wsViews) { }
self.wsViews[i].cleanFormulaRanges(); for (var i in self.wsViews) {
} self.wsViews[i].cleanFormulaRanges();
}
// ws.cleanFormulaRanges(); // ws.cleanFormulaRanges();
ws.setFormulaEditMode.apply(ws, arguments); ws.setFormulaEditMode.apply(ws, arguments);
} }
}, "updateEditorState": function (state) { }, "updateEditorState": function (state) {
self.handlers.trigger("asc_onEditCell", state); self.handlers.trigger("asc_onEditCell", state);
}, "isGlobalLockEditCell": function () { }, "isGlobalLockEditCell": function () {
return self.collaborativeEditing.getGlobalLockEditCell(); return self.collaborativeEditing.getGlobalLockEditCell();
}, "updateFormulaEditModEnd": function () { }, "updateFormulaEditModEnd": function () {
if (!self.lockDraw) { if (!self.lockDraw) {
self.getWorksheet().updateSelection(); self.getWorksheet().updateSelection();
} }
}, "newRange": function (range, ws) { }, "newRange": function (range, ws) {
if (!ws) { if (!ws) {
self.getWorksheet().addFormulaRange(range); self.getWorksheet().addFormulaRange(range);
} else { } else {
self.getWorksheet(self.model.getWorksheetIndexByName(ws)).addFormulaRange(range); self.getWorksheet(self.model.getWorksheetIndexByName(ws)).addFormulaRange(range);
} }
}, "existedRange": function (range, ws) { }, "existedRange": function (range, ws) {
var editRangeSheet = ws ? self.model.getWorksheetIndexByName(ws) : self.copyActiveSheet; var editRangeSheet = ws ? self.model.getWorksheetIndexByName(ws) : self.copyActiveSheet;
if (-1 === editRangeSheet || editRangeSheet === self.wsActive) { if (-1 === editRangeSheet || editRangeSheet === self.wsActive) {
self.getWorksheet().activeFormulaRange(range); self.getWorksheet().activeFormulaRange(range);
} else { } else {
self.getWorksheet(editRangeSheet).removeFormulaRange(range); self.getWorksheet(editRangeSheet).removeFormulaRange(range);
self.getWorksheet().addFormulaRange(range); self.getWorksheet().addFormulaRange(range);
} }
}, "updateUndoRedoChanged": function (bCanUndo, bCanRedo) { }, "updateUndoRedoChanged": function (bCanUndo, bCanRedo) {
self.handlers.trigger("asc_onCanUndoChanged", bCanUndo); self.handlers.trigger("asc_onCanUndoChanged", bCanUndo);
self.handlers.trigger("asc_onCanRedoChanged", bCanRedo); self.handlers.trigger("asc_onCanRedoChanged", bCanRedo);
}, "applyCloseEvent": function () { }, "applyCloseEvent": function () {
self.controller._onWindowKeyDown.apply(self.controller, arguments); self.controller._onWindowKeyDown.apply(self.controller, arguments);
}, "isViewerMode": function () { }, "isViewerMode": function () {
return self.controller.settings.isViewerMode; return self.controller.settings.isViewerMode;
}, "getFormulaRanges": function () { }, "getFormulaRanges": function () {
return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.getFormulaRanges() : return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.getFormulaRanges() :
self.getWorksheet().getFormulaRanges(); self.getWorksheet().getFormulaRanges();
}, "getCellFormulaEnterWSOpen": function () { }, "getCellFormulaEnterWSOpen": function () {
return self.cellFormulaEnterWSOpen; return self.cellFormulaEnterWSOpen;
}, "getActiveWS": function () { }, "getActiveWS": function () {
return self.getWorksheet().model; return self.getWorksheet().model;
}, "setStrictClose": function (val) { }, "setStrictClose": function (val) {
self.controller.setStrictClose(val); self.controller.setStrictClose(val);
}, "updateEditorSelectionInfo": function (info) { }, "updateEditorSelectionInfo": function (info) {
self.handlers.trigger("asc_onEditorSelectionChanged", info); self.handlers.trigger("asc_onEditorSelectionChanged", info);
}, "onContextMenu": function (event) { }, "onContextMenu": function (event) {
self.handlers.trigger("asc_onContextMenu", event); self.handlers.trigger("asc_onContextMenu", event);
} }
}, /*settings*/{ }, /*settings*/{
font: this.defaultFont, padding: this.defaults.worksheetView.cells.padding font: this.defaultFont, padding: this.defaults.worksheetView.cells.padding
}); });
this.wsViewHandlers = new AscCommonExcel.asc_CHandlersList(/*handlers*/{ this.wsViewHandlers = new AscCommonExcel.asc_CHandlersList(/*handlers*/{
"getViewerMode": function() { "getViewerMode": function () {
return self.controller.getViewerMode ? self.controller.getViewerMode() : true; return self.controller.getViewerMode ? self.controller.getViewerMode() : true;
}, "reinitializeScroll": function() { }, "reinitializeScroll": function () {
self.controller.reinitializeScroll(/*All*/); self.controller.reinitializeScroll(/*All*/);
}, "reinitializeScrollY": function() { }, "reinitializeScrollY": function () {
self.controller.reinitializeScroll(/*vertical*/1); self.controller.reinitializeScroll(/*vertical*/1);
}, "reinitializeScrollX": function() { }, "reinitializeScrollX": function () {
self.controller.reinitializeScroll(/*horizontal*/2); self.controller.reinitializeScroll(/*horizontal*/2);
}, "selectionChanged": function() { }, "selectionChanged": function () {
self._onWSSelectionChanged(); self._onWSSelectionChanged();
}, "selectionNameChanged": function() { }, "selectionNameChanged": function () {
self._onSelectionNameChanged.apply(self, arguments); self._onSelectionNameChanged.apply(self, arguments);
}, "selectionMathInfoChanged": function() { }, "selectionMathInfoChanged": function () {
self._onSelectionMathInfoChanged.apply(self, arguments); self._onSelectionMathInfoChanged.apply(self, arguments);
},'onFilterInfo': function(countFilter, countRecords) { }, 'onFilterInfo': function (countFilter, countRecords) {
self.handlers.trigger("asc_onFilterInfo", countFilter, countRecords); self.handlers.trigger("asc_onFilterInfo", countFilter, countRecords);
}, "onErrorEvent": function(errorId, level) { }, "onErrorEvent": function (errorId, level) {
self.handlers.trigger("asc_onError", errorId, level); self.handlers.trigger("asc_onError", errorId, level);
}, "slowOperation": function(isStart) { }, "slowOperation": function (isStart) {
(isStart ? self.Api.sync_StartAction : self.Api.sync_EndAction).call(self.Api, c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SlowOperation); (isStart ? self.Api.sync_StartAction : self.Api.sync_EndAction).call(self.Api,
}, "setAutoFiltersDialog": function(arrVal) { c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SlowOperation);
self.handlers.trigger("asc_onSetAFDialog", arrVal); }, "setAutoFiltersDialog": function (arrVal) {
}, "selectionRangeChanged": function(val) { self.handlers.trigger("asc_onSetAFDialog", arrVal);
self.handlers.trigger("asc_onSelectionRangeChanged", val); }, "selectionRangeChanged": function (val) {
}, "onRenameCellTextEnd": function(countFind, countReplace) { self.handlers.trigger("asc_onSelectionRangeChanged", val);
self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace); }, "onRenameCellTextEnd": function (countFind, countReplace) {
}, 'onStopFormatPainter': function() { self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace);
self._onStopFormatPainter(); }, 'onStopFormatPainter': function () {
}, 'getRangeFormatPainter': function() { self._onStopFormatPainter();
return self.rangeFormatPainter; }, 'getRangeFormatPainter': function () {
},"onDocumentPlaceChanged": function() { return self.rangeFormatPainter;
self._onDocumentPlaceChanged(); }, "onDocumentPlaceChanged": function () {
}, "updateSheetViewSettings": function() { self._onDocumentPlaceChanged();
self.handlers.trigger("asc_onUpdateSheetViewSettings"); }, "updateSheetViewSettings": function () {
}, "onScroll": function(d) { self.handlers.trigger("asc_onUpdateSheetViewSettings");
self.controller.scroll(d); }, "onScroll": function (d) {
}, "getLockDefNameManagerStatus": function() { self.controller.scroll(d);
return self.defNameAllowCreate; }, "getLockDefNameManagerStatus": function () {
}, 'isActive': function() { return self.defNameAllowCreate;
return (-1 === self.copyActiveSheet || self.wsActive === self.copyActiveSheet); }, 'isActive': function () {
}, return (-1 === self.copyActiveSheet || self.wsActive === self.copyActiveSheet);
"getCellEditMode": function() { }, "getCellEditMode": function () {
return self.isCellEditMode; return self.isCellEditMode;
}, }, "drawMobileSelection": function (color) {
"drawMobileSelection" : function(color) { if (self.MobileTouchManager) {
if (self.MobileTouchManager) var _canvas = self.getWorksheet().objectRender.getDrawingCanvas();
{ if (_canvas) {
var _canvas = self.getWorksheet().objectRender.getDrawingCanvas(); self.MobileTouchManager.CheckSelect(_canvas.trackOverlay, color);
if (_canvas) }
self.MobileTouchManager.CheckSelect(_canvas.trackOverlay, color); }
} }, "showSpecialPasteOptions": function (val) {
}, self.handlers.trigger("asc_onShowSpecialPasteOptions", val);
"showSpecialPasteOptions": function(val) { if (!window['AscCommon'].g_clipboardBase.showSpecialPasteButton) {
self.handlers.trigger("asc_onShowSpecialPasteOptions", val); window['AscCommon'].g_clipboardBase.showSpecialPasteButton = true;
if(!window['AscCommon'].g_clipboardBase.showSpecialPasteButton) }
{ }, 'checkLastWork': function () {
window['AscCommon'].g_clipboardBase.showSpecialPasteButton = true; self.Api.checkLastWork();
} }
} });
});
this.model.handlers.add("cleanCellCache", function(wsId, oRanges, bLockDraw, updateHeight) { this.model.handlers.add("cleanCellCache", function(wsId, oRanges, bLockDraw, updateHeight) {
var ws = self.getWorksheetById(wsId, true); var ws = self.getWorksheetById(wsId, true);
......
...@@ -1966,6 +1966,7 @@ ...@@ -1966,6 +1966,7 @@
if (lockDraw || this.model.workbook.bCollaborativeChanges || window['IS_NATIVE_EDITOR']) { if (lockDraw || this.model.workbook.bCollaborativeChanges || window['IS_NATIVE_EDITOR']) {
return this; return this;
} }
this.handlers.trigger("checkLastWork");
this._clean(); this._clean();
this._drawCorner(); this._drawCorner();
this._drawColumnHeaders(/*drawingCtx*/ undefined); this._drawColumnHeaders(/*drawingCtx*/ undefined);
...@@ -3736,6 +3737,8 @@ ...@@ -3736,6 +3737,8 @@
return; return;
} }
this.handlers.trigger("checkLastWork");
// set clipping rect to cells area // set clipping rect to cells area
var ctx = this.overlayCtx; var ctx = this.overlayCtx;
ctx.save().beginPath() ctx.save().beginPath()
...@@ -6031,6 +6034,7 @@ ...@@ -6031,6 +6034,7 @@
}; };
WorksheetView.prototype.getCursorTypeFromXY = function (x, y, isViewerMode) { WorksheetView.prototype.getCursorTypeFromXY = function (x, y, isViewerMode) {
this.handlers.trigger("checkLastWork");
var res, c, r, f, i, offsetX, offsetY, cellCursor; var res, c, r, f, i, offsetX, offsetY, cellCursor;
var sheetId = this.model.getId(), userId, lockRangePosLeft, lockRangePosTop, lockInfo, oHyperlink; var sheetId = this.model.getId(), userId, lockRangePosLeft, lockRangePosTop, lockInfo, oHyperlink;
var widthDiff = 0, heightDiff = 0, isLocked = false, target = c_oTargetType.Cells, row = -1, col = -1, isSelGraphicObject, isNotFirst; var widthDiff = 0, heightDiff = 0, isLocked = false, target = c_oTargetType.Cells, row = -1, col = -1, isSelGraphicObject, isNotFirst;
......
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