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

bug #27054

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68068 954022d7-b5bf-4e40-9824-e11837661b57
parent f1d5c8ad
...@@ -1196,7 +1196,7 @@ ...@@ -1196,7 +1196,7 @@
// Порядок эвентов для dblClick - http://javascript.ru/tutorial/events/mouse#dvoynoy-levyy-klik // Порядок эвентов для dblClick - http://javascript.ru/tutorial/events/mouse#dvoynoy-levyy-klik
// Проверка для IE, т.к. он присылает DblClick при сдвиге мыши... // Проверка для IE, т.к. он присылает DblClick при сдвиге мыши...
if (this.mouseDownLastCord && coord.x === this.mouseDownLastCord.x && coord.y === this.mouseDownLastCord.y && 0 === event.button) { if (this.mouseDownLastCord && coord.x === this.mouseDownLastCord.x && coord.y === this.mouseDownLastCord.y && 0 === event.button && !this.handlers.trigger('isFormatPainter')) {
// Выставляем, что мы уже сделали dblClick (иначе вдруг браузер не поддерживает свойство detail) // Выставляем, что мы уже сделали dblClick (иначе вдруг браузер не поддерживает свойство detail)
this.isDblClickInMouseDown = true; this.isDblClickInMouseDown = true;
// Нам нужно обработать эвент браузера о dblClick (если мы редактируем ячейку, то покажем курсор, если нет - то просто ничего не произойдет) // Нам нужно обработать эвент браузера о dblClick (если мы редактируем ячейку, то покажем курсор, если нет - то просто ничего не произойдет)
...@@ -1491,13 +1491,15 @@ ...@@ -1491,13 +1491,15 @@
}; };
/** @param event {KeyboardEvent} */ /** @param event {KeyboardEvent} */
asc_CEventsController.prototype._onMouseDblClick = function (event) { asc_CEventsController.prototype._onMouseDblClick = function(event) {
if (this.handlers.trigger("isGlobalLockEditCell")) if (this.handlers.trigger('isGlobalLockEditCell') || this.handlers.trigger('isFormatPainter')) {
return false; return false;
}
// Браузер не поддерживает свойство detail (будем делать по координатам) // Браузер не поддерживает свойство detail (будем делать по координатам)
if (false === this.isDblClickInMouseDown) if (false === this.isDblClickInMouseDown) {
return this.doMouseDblClick(event, /*isHideCursor*/false); return this.doMouseDblClick(event, /*isHideCursor*/false);
}
this.isDblClickInMouseDown = false; this.isDblClickInMouseDown = false;
......
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
return this; return this;
} }
WorkbookView.prototype._init = function (fontRenderingMode) { WorkbookView.prototype._init = function(fontRenderingMode) {
var self = this; var self = this;
// Init font managers rendering // Init font managers rendering
...@@ -218,13 +218,13 @@ ...@@ -218,13 +218,13 @@
this.setFontRenderingMode(fontRenderingMode, /*isInit*/true); this.setFontRenderingMode(fontRenderingMode, /*isInit*/true);
// add style // add style
var _head = document.getElementsByTagName('head')[0]; var _head = document.getElementsByTagName('head')[0];
var style0 = document.createElement('style'); var style0 = document.createElement('style');
style0.type = 'text/css'; style0.type = 'text/css';
style0.innerHTML = ".block_elem { position:absolute;padding:0;margin:0; }"; style0.innerHTML = ".block_elem { position:absolute;padding:0;margin:0; }";
_head.appendChild(style0); _head.appendChild(style0);
// create canvas // create canvas
if (null != this.element) { if (null != this.element) {
this.element.innerHTML = '<div id="ws-canvas-outer">\ this.element.innerHTML = '<div id="ws-canvas-outer">\
<canvas id="ws-canvas"></canvas>\ <canvas id="ws-canvas"></canvas>\
...@@ -246,34 +246,42 @@ ...@@ -246,34 +246,42 @@
AscBrowser.isRetina = false; AscBrowser.isRetina = false;
} }
this.buffers.main = new asc.DrawingContext({canvas: this.canvas, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont}); this.buffers.main = new asc.DrawingContext({
this.buffers.overlay = new asc.DrawingContext({canvas: this.canvasOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont}); canvas: this.canvas, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont
});
this.buffers.mainGraphic = new asc.DrawingContext({canvas: this.canvasGraphic, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont}); this.buffers.overlay = new asc.DrawingContext({
this.buffers.overlayGraphic = new asc.DrawingContext({canvas: this.canvasGraphicOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont}); canvas: this.canvasOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont
});
this.buffers.mainGraphic = new asc.DrawingContext({
canvas: this.canvasGraphic, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont
});
this.buffers.overlayGraphic = new asc.DrawingContext({
canvas: this.canvasGraphicOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont
});
this.drawingCtx = this.buffers.main; this.drawingCtx = this.buffers.main;
this.overlayCtx = this.buffers.overlay; this.overlayCtx = this.buffers.overlay;
this.drawingGraphicCtx = this.buffers.mainGraphic; this.drawingGraphicCtx = this.buffers.mainGraphic;
this.overlayGraphicCtx = this.buffers.overlayGraphic; this.overlayGraphicCtx = this.buffers.overlayGraphic;
// Обновляем размеры (чуть ниже, потому что должны быть проинициализированы ctx) // Обновляем размеры (чуть ниже, потому что должны быть проинициализированы ctx)
this._canResize(); this._canResize();
// Shapes // Shapes
var canvasWidth = this.drawingGraphicCtx.canvas.width; var canvasWidth = this.drawingGraphicCtx.canvas.width;
var canvasHeight = this.drawingGraphicCtx.canvas.height; var canvasHeight = this.drawingGraphicCtx.canvas.height;
this.buffers.shapeCtx = new CGraphics(); this.buffers.shapeCtx = new CGraphics();
this.buffers.shapeCtx.init(this.drawingGraphicCtx.ctx, canvasWidth, canvasHeight, (canvasWidth*25.4/this.drawingGraphicCtx.ppiX), (canvasHeight*25.4/this.drawingGraphicCtx.ppiY)); this.buffers.shapeCtx.init(this.drawingGraphicCtx.ctx, canvasWidth, canvasHeight, (canvasWidth * 25.4 / this.drawingGraphicCtx.ppiX), (canvasHeight * 25.4 / this.drawingGraphicCtx.ppiY));
this.buffers.shapeCtx.m_oFontManager = this.fmgrGraphics[2]; this.buffers.shapeCtx.m_oFontManager = this.fmgrGraphics[2];
var overlayWidth = this.overlayGraphicCtx.canvas.width; var overlayWidth = this.overlayGraphicCtx.canvas.width;
var overlayHeight = this.overlayGraphicCtx.canvas.height; var overlayHeight = this.overlayGraphicCtx.canvas.height;
this.buffers.shapeOverlayCtx = new CGraphics(); this.buffers.shapeOverlayCtx = new CGraphics();
this.buffers.shapeOverlayCtx.init(this.overlayGraphicCtx.ctx, overlayWidth, overlayHeight, (overlayWidth*25.4/this.overlayGraphicCtx.ppiX), (overlayHeight*25.4/this.overlayGraphicCtx.ppiY)); this.buffers.shapeOverlayCtx.init(this.overlayGraphicCtx.ctx, overlayWidth, overlayHeight, (overlayWidth * 25.4 / this.overlayGraphicCtx.ppiX), (overlayHeight * 25.4 / this.overlayGraphicCtx.ppiY));
this.buffers.shapeOverlayCtx.m_oFontManager = this.fmgrGraphics[2]; this.buffers.shapeOverlayCtx.m_oFontManager = this.fmgrGraphics[2];
this.stringRender = new asc.StringRender(this.buffers.main); this.stringRender = new asc.StringRender(this.buffers.main);
...@@ -283,93 +291,156 @@ ...@@ -283,93 +291,156 @@
this._calcMaxDigitWidth(); this._calcMaxDigitWidth();
if (!window["NATIVE_EDITOR_ENJINE"]) { if (!window["NATIVE_EDITOR_ENJINE"]) {
// initialize events controller // initialize events controller
this.controller.init(this, this.element, /*this.canvasOverlay*/ this.canvasGraphicOverlay, /*handlers*/{ this.controller.init(this, this.element, /*this.canvasOverlay*/ this.canvasGraphicOverlay, /*handlers*/{
"resize": function () {self.resize.apply(self, arguments);}, "resize": function() {
"reinitializeScroll": function () {self._onScrollReinitialize.apply(self, arguments);}, self.resize.apply(self, arguments);
"scrollY": function () {self._onScrollY.apply(self, arguments);}, }, "reinitializeScroll": function() {
"scrollX": function () {self._onScrollX.apply(self, arguments);}, self._onScrollReinitialize.apply(self, arguments);
"changeSelection": function () {self._onChangeSelection.apply(self, arguments);}, }, "scrollY": function() {
"changeSelectionDone": function () {self._onChangeSelectionDone.apply(self, arguments);}, self._onScrollY.apply(self, arguments);
"changeSelectionRightClick":function () {self._onChangeSelectionRightClick.apply(self, arguments);}, }, "scrollX": function() {
"selectionActivePointChanged": function () {self._onSelectionActivePointChanged.apply(self, arguments);}, self._onScrollX.apply(self, arguments);
"updateWorksheet": function () {self._onUpdateWorksheet.apply(self, arguments);}, }, "changeSelection": function() {
"resizeElement": function () {self._onResizeElement.apply(self, arguments);}, self._onChangeSelection.apply(self, arguments);
"resizeElementDone": function () {self._onResizeElementDone.apply(self, arguments);}, }, "changeSelectionDone": function() {
"changeFillHandle": function () {self._onChangeFillHandle.apply(self, arguments);}, self._onChangeSelectionDone.apply(self, arguments);
"changeFillHandleDone": function () {self._onChangeFillHandleDone.apply(self, arguments);}, }, "changeSelectionRightClick": function() {
"moveRangeHandle": function () {self._onMoveRangeHandle.apply(self, arguments);}, self._onChangeSelectionRightClick.apply(self, arguments);
"moveRangeHandleDone": function () {self._onMoveRangeHandleDone.apply(self, arguments);}, }, "selectionActivePointChanged": function() {
"moveResizeRangeHandle": function () {self._onMoveResizeRangeHandle.apply(self, arguments);}, self._onSelectionActivePointChanged.apply(self, arguments);
"moveResizeRangeHandleDone":function () {self._onMoveResizeRangeHandleDone.apply(self, arguments);}, }, "updateWorksheet": function() {
"editCell": function () {self._onEditCell.apply(self, arguments);}, self._onUpdateWorksheet.apply(self, arguments);
"stopCellEditing": function () {return self._onStopCellEditing.apply(self, arguments);}, }, "resizeElement": function() {
"empty": function () {self._onEmpty.apply(self, arguments);}, self._onResizeElement.apply(self, arguments);
"canEnterCellRange": function() { }, "resizeElementDone": function() {
self.cellEditor.setFocus(false); self._onResizeElementDone.apply(self, arguments);
var ret = self.cellEditor.canEnterCellRange(); }, "changeFillHandle": function() {
ret ? self.cellEditor.activateCellRange() : true; self._onChangeFillHandle.apply(self, arguments);
return ret; }, "changeFillHandleDone": function() {
}, self._onChangeFillHandleDone.apply(self, arguments);
"enterCellRange": function () { }, "moveRangeHandle": function() {
self.lockDraw = true; self._onMoveRangeHandle.apply(self, arguments);
self.cellEditor.setFocus(false); }, "moveRangeHandleDone": function() {
self.getWorksheet().enterCellRange(self.cellEditor); self._onMoveRangeHandleDone.apply(self, arguments);
self.lockDraw = false; }, "moveResizeRangeHandle": function() {
}, self._onMoveResizeRangeHandle.apply(self, arguments);
"copy": function () {self.copyToClipboard.apply(self, arguments);}, }, "moveResizeRangeHandleDone": function() {
"paste": function () {self.pasteFromClipboard.apply(self, arguments);}, self._onMoveResizeRangeHandleDone.apply(self, arguments);
"cut": function () {self.cutToClipboard.apply(self, arguments);}, }, "editCell": function() {
"undo": function () {self.undo.apply(self, arguments);}, self._onEditCell.apply(self, arguments);
"redo": function () {self.redo.apply(self, arguments);}, }, "stopCellEditing": function() {
"addColumn": function () {self._onAddColumn.apply(self, arguments);}, return self._onStopCellEditing.apply(self, arguments);
"addRow": function () {self._onAddRow.apply(self, arguments);}, }, "empty": function() {
"mouseDblClick": function () {self._onMouseDblClick.apply(self, arguments);}, self._onEmpty.apply(self, arguments);
"showNextPrevWorksheet": function () {self._onShowNextPrevWorksheet.apply(self, arguments);}, }, "canEnterCellRange": function() {
"setFontAttributes": function () {self._onSetFontAttributes.apply(self, arguments);}, self.cellEditor.setFocus(false);
"selectColumnsByRange": function () {self._onSelectColumnsByRange.apply(self, arguments);}, var ret = self.cellEditor.canEnterCellRange();
"selectRowsByRange": function () {self._onSelectRowsByRange.apply(self, arguments);}, ret ? self.cellEditor.activateCellRange() : true;
"save": function () {self.Api.asc_Save();}, return ret;
"showCellEditorCursor": function () {self._onShowCellEditorCursor.apply(self, arguments);}, }, "enterCellRange": function() {
"print": function () {self.Api.asc_Print();}, self.lockDraw = true;
"addFunction": function () {self.insertFormulaInEditor.apply(self, arguments);}, self.cellEditor.setFocus(false);
"canvasClick": function () {self.enableKeyEventsHandler(true);}, self.getWorksheet().enterCellRange(self.cellEditor);
"autoFiltersClick": function () {self._onAutoFiltersClick.apply(self, arguments);}, self.lockDraw = false;
"commentCellClick": function () {self._onCommentCellClick.apply(self, arguments);}, }, "copy": function() {
"isGlobalLockEditCell": function () {return self.collaborativeEditing.getGlobalLockEditCell();}, self.copyToClipboard.apply(self, arguments);
"updateSelectionName": function () {self._onUpdateSelectionName.apply(self, arguments);}, }, "paste": function() {
"stopFormatPainter": function () {self._onStopFormatPainter.apply(self, arguments);}, self.pasteFromClipboard.apply(self, arguments);
}, "cut": function() {
// Shapes self.cutToClipboard.apply(self, arguments);
"graphicObjectMouseDown": function () {self._onGraphicObjectMouseDown.apply(self, arguments);}, }, "undo": function() {
"graphicObjectMouseMove": function () {self._onGraphicObjectMouseMove.apply(self, arguments);}, self.undo.apply(self, arguments);
"graphicObjectMouseUp": function () {self._onGraphicObjectMouseUp.apply(self, arguments);}, }, "redo": function() {
"graphicObjectMouseUpEx": function () {self._onGraphicObjectMouseUpEx.apply(self, arguments);}, self.redo.apply(self, arguments);
"graphicObjectWindowKeyDown": function () {return self._onGraphicObjectWindowKeyDown.apply(self, arguments);}, }, "addColumn": function() {
"graphicObjectWindowKeyPress": function () {return self._onGraphicObjectWindowKeyPress.apply(self, arguments);}, self._onAddColumn.apply(self, arguments);
"getGraphicsInfo": function () {return self._onGetGraphicsInfo.apply(self, arguments);}, }, "addRow": function() {
"getSelectedGraphicObjects": function () {return self._onGetSelectedGraphicObjects.apply(self, arguments);}, self._onAddRow.apply(self, arguments);
"updateSelectionShape": function () {return self._onUpdateSelectionShape.apply(self, arguments);}, }, "mouseDblClick": function() {
"canReceiveKeyPress": function () {return self.getWorksheet().objectRender.controller.canReceiveKeyPress();}, self._onMouseDblClick.apply(self, arguments);
"stopAddShape": function () { }, "showNextPrevWorksheet": function() {
self.getWorksheet().objectRender.controller.checkEndAddShape(); self._onShowNextPrevWorksheet.apply(self, arguments);
}, }, "setFontAttributes": function() {
self._onSetFontAttributes.apply(self, arguments);
}, "selectColumnsByRange": function() {
self._onSelectColumnsByRange.apply(self, arguments);
}, "selectRowsByRange": function() {
self._onSelectRowsByRange.apply(self, arguments);
}, "save": function() {
self.Api.asc_Save();
}, "showCellEditorCursor": function() {
self._onShowCellEditorCursor.apply(self, arguments);
}, "print": function() {
self.Api.asc_Print();
}, "addFunction": function() {
self.insertFormulaInEditor.apply(self, arguments);
}, "canvasClick": function() {
self.enableKeyEventsHandler(true);
}, "autoFiltersClick": function() {
self._onAutoFiltersClick.apply(self, arguments);
}, "commentCellClick": function() {
self._onCommentCellClick.apply(self, arguments);
}, "isGlobalLockEditCell": function() {
return self.collaborativeEditing.getGlobalLockEditCell();
}, "updateSelectionName": function() {
self._onUpdateSelectionName.apply(self, arguments);
}, "stopFormatPainter": function() {
self._onStopFormatPainter.apply(self, arguments);
},
// Shapes
"graphicObjectMouseDown": function() {
self._onGraphicObjectMouseDown.apply(self, arguments);
}, "graphicObjectMouseMove": function() {
self._onGraphicObjectMouseMove.apply(self, arguments);
}, "graphicObjectMouseUp": function() {
self._onGraphicObjectMouseUp.apply(self, arguments);
}, "graphicObjectMouseUpEx": function() {
self._onGraphicObjectMouseUpEx.apply(self, arguments);
}, "graphicObjectWindowKeyDown": function() {
return self._onGraphicObjectWindowKeyDown.apply(self, arguments);
}, "graphicObjectWindowKeyPress": function() {
return self._onGraphicObjectWindowKeyPress.apply(self, arguments);
}, "getGraphicsInfo": function() {
return self._onGetGraphicsInfo.apply(self, arguments);
}, "getSelectedGraphicObjects": function() {
return self._onGetSelectedGraphicObjects.apply(self, arguments);
}, "updateSelectionShape": function() {
return self._onUpdateSelectionShape.apply(self, arguments);
}, "canReceiveKeyPress": function() {
return self.getWorksheet().objectRender.controller.canReceiveKeyPress();
}, "stopAddShape": function() {
self.getWorksheet().objectRender.controller.checkEndAddShape();
},
// Frozen anchor // Frozen anchor
"moveFrozenAnchorHandle": function () {self._onMoveFrozenAnchorHandle.apply(self, arguments);}, "moveFrozenAnchorHandle": function() {
"moveFrozenAnchorHandleDone": function () {self._onMoveFrozenAnchorHandleDone.apply(self, arguments);}, self._onMoveFrozenAnchorHandle.apply(self, arguments);
}, "moveFrozenAnchorHandleDone": function() {
self._onMoveFrozenAnchorHandleDone.apply(self, arguments);
},
// AutoComplete // AutoComplete
"showAutoComplete": function () {self._onShowAutoComplete.apply(self, arguments);}, "showAutoComplete": function() {
"onContextMenu": function (event) {self.handlers.trigger("asc_onContextMenu", event);} self._onShowAutoComplete.apply(self, arguments);
}); }, "onContextMenu": function(event) {
self.handlers.trigger("asc_onContextMenu", event);
},
// FormatPainter
'isFormatPainter': function() {
return self.getWorksheet().stateFormatPainter;
}
});
if (this.input && this.input.addEventListener) { if (this.input && this.input.addEventListener) {
this.input.addEventListener("focus", function () { this.input.addEventListener("focus", function() {
self.input.isFocused = true; self.input.isFocused = true;
if (self.controller.settings.isViewerMode) { if (self.controller.settings.isViewerMode) {
return; return;
} }
self._onStopFormatPainter();
self.controller.setStrictClose(true); self.controller.setStrictClose(true);
self.cellEditor.callTopLineMouseup = true; self.cellEditor.callTopLineMouseup = true;
if (!self.controller.isCellEditMode && !self.controller.isFillHandleMode) { if (!self.controller.isCellEditMode && !self.controller.isFillHandleMode) {
...@@ -378,147 +449,180 @@ ...@@ -378,147 +449,180 @@
}, false); }, false);
} }
this.cellEditor = new asc.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont, this.cellEditor = new asc.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont, /*handlers*/{
/*handlers*/{ "closed": function() {
"closed" : function () {self._onCloseCellEditor.apply(self, arguments);}, self._onCloseCellEditor.apply(self, arguments);
"updated" : function () {self._onUpdateCellEditor.apply(self, arguments);}, }, "updated": function() {
"gotFocus" : function (hasFocus) {self.controller.setFocus(!hasFocus);}, self._onUpdateCellEditor.apply(self, arguments);
"copy" : function () {self.copyToClipboard.apply(self, arguments);}, }, "gotFocus": function(hasFocus) {
"paste" : function () {self.pasteFromClipboard.apply(self, arguments);}, self.controller.setFocus(!hasFocus);
"cut" : function () {self.cutToClipboard.apply(self, arguments);}, }, "copy": function() {
"updateFormulaEditMod": function () { self.copyToClipboard.apply(self, arguments);
self.controller.setFormulaEditMode.apply(self.controller, arguments); }, "paste": function() {
var ws = self.getWorksheet(); self.pasteFromClipboard.apply(self, arguments);
if (ws) { }, "cut": function() {
if (!self.lockDraw) { self.cutToClipboard.apply(self, arguments);
ws.cleanSelection(); }, "updateFormulaEditMod": function() {
} self.controller.setFormulaEditMode.apply(self.controller, arguments);
ws.cleanFormulaRanges(); var ws = self.getWorksheet();
ws.setFormulaEditMode.apply(ws, arguments); if (ws) {
if (!self.lockDraw) {
ws.cleanSelection();
} }
}, ws.cleanFormulaRanges();
"updateEditorState" : function (state) {self.handlers.trigger("asc_onEditCell", state);}, ws.setFormulaEditMode.apply(ws, arguments);
"isGlobalLockEditCell" : function () {return self.collaborativeEditing.getGlobalLockEditCell();}, }
"updateFormulaEditModEnd" : function () { }, "updateEditorState": function(state) {
self.handlers.trigger("asc_onEditCell", state);
}, "isGlobalLockEditCell": function() {
return self.collaborativeEditing.getGlobalLockEditCell();
}, "updateFormulaEditModEnd": function() {
if (!self.lockDraw) {
self.getWorksheet().updateSelection();
}
}, "newRange": function(range, ws) {
if (!ws) {
self.getWorksheet().addFormulaRange(range);
} else {
self.getWorksheet(self.model.getWorksheetIndexByName(ws)).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;
}, "getFormulaRanges": function() {
return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.getFormulaRanges() : self.getWorksheet().getFormulaRanges();
}, "getCellFormulaEnterWSOpen": function() {
return self.cellFormulaEnterWSOpen;
}, "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
});
}
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) {
if (!self.lockDraw) { if (!self.lockDraw) {
self.getWorksheet().updateSelection(); ws.cleanSelection();
} }
}, ws.cleanFormulaRanges();
"newRange" : function (range,ws) { ws.setFormulaEditMode.apply(ws, arguments);
if( !ws ){ }
self.getWorksheet().addFormulaRange(range); }, "updateEditorState": function(state) {
} else { self.handlers.trigger("asc_onEditCell", state);
self.getWorksheet(self.model.getWorksheetIndexByName(ws)).addFormulaRange(range); }, "isGlobalLockEditCell": function() {
} return self.collaborativeEditing.getGlobalLockEditCell();
}, }, "updateFormulaEditModEnd": function(rangeUpdated) {
"existedRange" : function (range) { self.getWorksheet().activeFormulaRange(range); }, self.getWorksheet().updateSelection();
"updateUndoRedoChanged" : function (bCanUndo, bCanRedo) { }, "newRange": function(range, ws) {
self.handlers.trigger("asc_onCanUndoChanged", bCanUndo); if (!ws) {
self.handlers.trigger("asc_onCanRedoChanged", bCanRedo); self.getWorksheet().addFormulaRange(range);
}, } else {
"applyCloseEvent" : function () {self.controller._onWindowKeyDown.apply(self.controller, arguments);}, self.getWorksheet(self.model.getWorksheetIndexByName(ws)).addFormulaRange(range);
"isViewerMode" : function () {return self.controller.settings.isViewerMode;}, }
"getFormulaRanges" : function () { }, "existedRange": function(range) {
return self.cellFormulaEnterWSOpen ? self.getWorksheet().activeFormulaRange(range);
self.cellFormulaEnterWSOpen.getFormulaRanges() : }, "updateUndoRedoChanged": function(bCanUndo, bCanRedo) {
self.getWorksheet().getFormulaRanges(); self.handlers.trigger("asc_onCanUndoChanged", bCanUndo);
}, self.handlers.trigger("asc_onCanRedoChanged", bCanRedo);
"getCellFormulaEnterWSOpen" : function () {return self.cellFormulaEnterWSOpen;}, }, "applyCloseEvent": function() {
"setStrictClose" : function (val) {self.controller.setStrictClose(val);}, self.controller._onWindowKeyDown.apply(self.controller, arguments);
"updateEditorSelectionInfo" : function (info) {self.handlers.trigger("asc_onEditorSelectionChanged", info);}, }, "isViewerMode": function() {
"onContextMenu" : function (event) {self.handlers.trigger("asc_onContextMenu", event);} return self.controller.settings.isViewerMode;
}, }, "getFormulaRanges": function() {
/*settings*/{ return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.getFormulaRanges() : self.getWorksheet().getFormulaRanges();
font: this.defaultFont, }, "getCellFormulaEnterWSOpen": function() {
padding: this.defaults.worksheetView.cells.padding return self.cellFormulaEnterWSOpen;
}); }, "setStrictClose": function(val) {
} self.controller.setStrictClose(val);
}, "updateEditorSelectionInfo": function(info) {
if (window['IS_NATIVE_EDITOR']) { self.handlers.trigger("asc_onEditorSelectionChanged", info);
this.cellEditor = new asc.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont, }, "onContextMenu": function(event) {
/*handlers*/{ self.handlers.trigger("asc_onContextMenu", event);
"closed" : function () {self._onCloseCellEditor.apply(self, arguments);}, }
"updated" : function () {self._onUpdateCellEditor.apply(self, arguments);}, }, /*settings*/{
"gotFocus" : function (hasFocus) {self.controller.setFocus(!hasFocus);}, font: this.defaultFont, padding: this.defaults.worksheetView.cells.padding
"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) {
if (!self.lockDraw) {
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,ws) {
if( !ws ){
self.getWorksheet().addFormulaRange(range);
} else {
self.getWorksheet(self.model.getWorksheetIndexByName(ws)).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;},
"getFormulaRanges" : function () {
return self.cellFormulaEnterWSOpen ?
self.cellFormulaEnterWSOpen.getFormulaRanges() :
self.getWorksheet().getFormulaRanges();
},
"getCellFormulaEnterWSOpen" : function () {return self.cellFormulaEnterWSOpen;},
"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*/{ this.wsViewHandlers = new asc.asc_CHandlersList(/*handlers*/{
"getViewerMode" : function () { return self.controller.getViewerMode ? self.controller.getViewerMode() : true; }, "getViewerMode": function() {
"reinitializeScroll" : function () {self.controller.reinitializeScroll(/*All*/);}, return self.controller.getViewerMode ? self.controller.getViewerMode() : true;
"reinitializeScrollY" : function () {self.controller.reinitializeScroll(/*vertical*/1);}, }, "reinitializeScroll": function() {
"reinitializeScrollX" : function () {self.controller.reinitializeScroll(/*horizontal*/2);}, self.controller.reinitializeScroll(/*All*/);
"selectionChanged" : function () {self._onWSSelectionChanged.apply(self, arguments);}, }, "reinitializeScrollY": function() {
"selectionNameChanged" : function () {self._onSelectionNameChanged.apply(self, arguments);}, self.controller.reinitializeScroll(/*vertical*/1);
"selectionMathInfoChanged" : function () {self._onSelectionMathInfoChanged.apply(self, arguments);}, }, "reinitializeScrollX": function() {
"onErrorEvent" : function (errorId, level) {self.handlers.trigger("asc_onError", errorId, level);}, self.controller.reinitializeScroll(/*horizontal*/2);
"slowOperation" : function (isStart) {(isStart ? self.Api.sync_StartAction : self.Api.sync_EndAction).call(self.Api, c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SlowOperation);}, }, "selectionChanged": function() {
"setAutoFiltersDialog" : function (arrVal) {self.handlers.trigger("asc_onSetAFDialog", arrVal);}, self._onWSSelectionChanged.apply(self, arguments);
"selectionRangeChanged" : function (val) {self.handlers.trigger("asc_onSelectionRangeChanged", val);}, }, "selectionNameChanged": function() {
"onRenameCellTextEnd" : function (countFind, countReplace) {self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace);}, self._onSelectionNameChanged.apply(self, arguments);
"onStopFormatPainter" : function () {self.handlers.trigger("asc_onStopFormatPainter");}, }, "selectionMathInfoChanged": function() {
"onDocumentPlaceChanged" : function () {self._onDocumentPlaceChanged();}, self._onSelectionMathInfoChanged.apply(self, arguments);
"updateSheetViewSettings" : function () {self.handlers.trigger("asc_onUpdateSheetViewSettings");}, }, "onErrorEvent": function(errorId, level) {
"onScroll" : function (d) {self.controller.scroll(d);}, self.handlers.trigger("asc_onError", errorId, level);
"getLockDefNameManagerStatus":function(){return self.defNameAllowCreate} }, "slowOperation": function(isStart) {
(isStart ? self.Api.sync_StartAction : self.Api.sync_EndAction).call(self.Api, c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SlowOperation);
}, "setAutoFiltersDialog": function(arrVal) {
self.handlers.trigger("asc_onSetAFDialog", arrVal);
}, "selectionRangeChanged": function(val) {
self.handlers.trigger("asc_onSelectionRangeChanged", val);
}, "onRenameCellTextEnd": function(countFind, countReplace) {
self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace);
}, "onStopFormatPainter": function() {
self.handlers.trigger("asc_onStopFormatPainter");
}, "onDocumentPlaceChanged": function() {
self._onDocumentPlaceChanged();
}, "updateSheetViewSettings": function() {
self.handlers.trigger("asc_onUpdateSheetViewSettings");
}, "onScroll": function(d) {
self.controller.scroll(d);
}, "getLockDefNameManagerStatus": function() {
return self.defNameAllowCreate
}
}); });
this.model.handlers.add("cleanCellCache", function (wsId, oRanges, canChangeColWidth, bLockDraw, updateHeight) { this.model.handlers.add("cleanCellCache", function(wsId, oRanges, canChangeColWidth, bLockDraw, updateHeight) {
var ws = self.getWorksheetById(wsId); var ws = self.getWorksheetById(wsId);
if (ws) if (ws) {
ws.updateRanges(oRanges, canChangeColWidth, ws.updateRanges(oRanges, canChangeColWidth, bLockDraw || wsId != self.getWorksheet(self.wsActive).model.getId(), updateHeight);
bLockDraw || wsId != self.getWorksheet(self.wsActive).model.getId(), updateHeight); }
}); });
this.model.handlers.add("changeWorksheetUpdate", function (wsId, val) { this.model.handlers.add("changeWorksheetUpdate", function(wsId, val) {
var ws = self.getWorksheetById(wsId); var ws = self.getWorksheetById(wsId);
if (ws) if (ws) {
ws.changeWorksheet("update", val); ws.changeWorksheet("update", val);
}
}); });
this.model.handlers.add("showWorksheet", function (wsId) { this.model.handlers.add("showWorksheet", function(wsId) {
var wsModel = self.model.getWorksheetById(wsId), index; var wsModel = self.model.getWorksheetById(wsId), index;
if (wsModel) { if (wsModel) {
index = wsModel.getIndex(); index = wsModel.getIndex();
...@@ -526,52 +630,52 @@ ...@@ -526,52 +630,52 @@
self.handlers.trigger("asc_onActiveSheetChanged", index); self.handlers.trigger("asc_onActiveSheetChanged", index);
} }
}); });
this.model.handlers.add("setSelection", function () { this.model.handlers.add("setSelection", function() {
self._onSetSelection.apply(self, arguments); self._onSetSelection.apply(self, arguments);
}); });
this.model.handlers.add("getSelection", function () { this.model.handlers.add("getSelection", function() {
return self._onGetSelection.apply(self); return self._onGetSelection.apply(self);
}); });
this.model.handlers.add("getSelectionState", function () { this.model.handlers.add("getSelectionState", function() {
return self._onGetSelectionState.apply(self); return self._onGetSelectionState.apply(self);
}); });
this.model.handlers.add("setSelectionState", function () { this.model.handlers.add("setSelectionState", function() {
self._onSetSelectionState.apply(self, arguments); self._onSetSelectionState.apply(self, arguments);
}); });
this.model.handlers.add("reInit", function () { this.model.handlers.add("reInit", function() {
self.reInit.apply(self, arguments); self.reInit.apply(self, arguments);
}); });
this.model.handlers.add("drawWS", function () { this.model.handlers.add("drawWS", function() {
self.drawWS.apply(self, arguments); self.drawWS.apply(self, arguments);
}); });
this.model.handlers.add("showDrawingObjects", function () { this.model.handlers.add("showDrawingObjects", function() {
self.onShowDrawingObjects.apply(self, arguments); self.onShowDrawingObjects.apply(self, arguments);
}); });
this.model.handlers.add("setCanUndo", function (bCanUndo) { this.model.handlers.add("setCanUndo", function(bCanUndo) {
self.handlers.trigger("asc_onCanUndoChanged", bCanUndo); self.handlers.trigger("asc_onCanUndoChanged", bCanUndo);
}); });
this.model.handlers.add("setCanRedo", function (bCanRedo) { this.model.handlers.add("setCanRedo", function(bCanRedo) {
self.handlers.trigger("asc_onCanRedoChanged", bCanRedo); self.handlers.trigger("asc_onCanRedoChanged", bCanRedo);
}); });
this.model.handlers.add("setDocumentModified", function (bIsModified) { this.model.handlers.add("setDocumentModified", function(bIsModified) {
self.Api.onUpdateDocumentModified(bIsModified); self.Api.onUpdateDocumentModified(bIsModified);
}); });
this.model.handlers.add("initCommentsToSave", function () { this.model.handlers.add("initCommentsToSave", function() {
self._initCommentsToSave(); self._initCommentsToSave();
}); });
this.model.handlers.add("replaceWorksheet", function (from, to) { this.model.handlers.add("replaceWorksheet", function(from, to) {
self.replaceWorksheet(from, to); self.replaceWorksheet(from, to);
}); });
this.model.handlers.add("removeWorksheet", function (nIndex) { this.model.handlers.add("removeWorksheet", function(nIndex) {
self.removeWorksheet(nIndex); self.removeWorksheet(nIndex);
}); });
this.model.handlers.add("spliceWorksheet", function () { this.model.handlers.add("spliceWorksheet", function() {
self.spliceWorksheet.apply(self, arguments); self.spliceWorksheet.apply(self, arguments);
}); });
this.model.handlers.add("updateWorksheetByModel", function () { this.model.handlers.add("updateWorksheetByModel", function() {
self.updateWorksheetByModel.apply(self, arguments); self.updateWorksheetByModel.apply(self, arguments);
}); });
this.model.handlers.add("undoRedoAddRemoveRowCols", function (sheetId, type, range, bUndo) { this.model.handlers.add("undoRedoAddRemoveRowCols", function(sheetId, type, range, bUndo) {
if (true === bUndo) { if (true === bUndo) {
if (historyitem_Worksheet_AddRows === type) { if (historyitem_Worksheet_AddRows === type) {
self.collaborativeEditing.removeRowsRange(sheetId, range.clone(true)); self.collaborativeEditing.removeRowsRange(sheetId, range.clone(true));
...@@ -602,35 +706,45 @@ ...@@ -602,35 +706,45 @@
} }
} }
}); });
this.model.handlers.add("undoRedoHideSheet", function (sheetId) { this.model.handlers.add("undoRedoHideSheet", function(sheetId) {
self.showWorksheet(sheetId); self.showWorksheet(sheetId);
// Посылаем callback об изменении списка листов // Посылаем callback об изменении списка листов
self.handlers.trigger("asc_onSheetsChanged"); self.handlers.trigger("asc_onSheetsChanged");
}); });
this.handlers.add("asc_onLockDefNameManager",function(reason){self.defNameAllowCreate = !(reason == c_oAscDefinedNameReason.LockDefNameManager);}); this.handlers.add("asc_onLockDefNameManager", function(reason) {
self.defNameAllowCreate = !(reason == c_oAscDefinedNameReason.LockDefNameManager);
});
this.cellCommentator = new CCellCommentator({ this.cellCommentator = new CCellCommentator({
model: new WorkbookCommentsModel(this.handlers), model: new WorkbookCommentsModel(this.handlers),
collaborativeEditing: this.collaborativeEditing, collaborativeEditing: this.collaborativeEditing,
draw: function() {}, draw: function() {
handlers: {trigger: function (){return true;}} },
handlers: {
trigger: function() {
return true;
}
}
}); });
var commentList = this.cellCommentator.prepareComments(this.model.aComments); var commentList = this.cellCommentator.prepareComments(this.model.aComments);
if (0 < commentList.length) if (0 < commentList.length) {
this.handlers.trigger("asc_onAddComments", commentList); this.handlers.trigger("asc_onAddComments", commentList);
}
this.clipboard.Api = this.Api; this.clipboard.Api = this.Api;
this.clipboard.init(); this.clipboard.init();
this.initFormulasList(); this.initFormulasList();
this.fReplaceCallback = function () {self._replaceCellTextCallback.apply(self, arguments);}; this.fReplaceCallback = function() {
self._replaceCellTextCallback.apply(self, arguments);
};
if (this.Api.isMobileVersion) { if (this.Api.isMobileVersion) {
this.MobileTouchManager = new CMobileTouchManager(); this.MobileTouchManager = new CMobileTouchManager();
this.MobileTouchManager.Init(this); this.MobileTouchManager.Init(this);
} }
return this; return this;
}; };
......
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