Commit 6883a8df authored by Alexander.Trofimov's avatar 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 23ed8324
...@@ -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
...@@ -246,11 +246,19 @@ ...@@ -246,11 +246,19 @@
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.overlay = new asc.DrawingContext({
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.mainGraphic = new asc.DrawingContext({
this.buffers.overlayGraphic = new asc.DrawingContext({canvas: this.canvasGraphicOverlay, units: 1/*pt*/, fmgrGraphics: this.fmgrGraphics, font: this.m_oFont}); 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;
...@@ -266,14 +274,14 @@ ...@@ -266,14 +274,14 @@
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);
...@@ -285,91 +293,154 @@ ...@@ -285,91 +293,154 @@
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._onResizeElementDone.apply(self, arguments);
}, "changeFillHandle": function() {
self._onChangeFillHandle.apply(self, arguments);
}, "changeFillHandleDone": function() {
self._onChangeFillHandleDone.apply(self, arguments);
}, "moveRangeHandle": function() {
self._onMoveRangeHandle.apply(self, arguments);
}, "moveRangeHandleDone": function() {
self._onMoveRangeHandleDone.apply(self, arguments);
}, "moveResizeRangeHandle": function() {
self._onMoveResizeRangeHandle.apply(self, arguments);
}, "moveResizeRangeHandleDone": function() {
self._onMoveResizeRangeHandleDone.apply(self, arguments);
}, "editCell": function() {
self._onEditCell.apply(self, arguments);
}, "stopCellEditing": function() {
return self._onStopCellEditing.apply(self, arguments);
}, "empty": function() {
self._onEmpty.apply(self, arguments);
}, "canEnterCellRange": function() {
self.cellEditor.setFocus(false); self.cellEditor.setFocus(false);
var ret = self.cellEditor.canEnterCellRange(); var ret = self.cellEditor.canEnterCellRange();
ret ? self.cellEditor.activateCellRange() : true; ret ? self.cellEditor.activateCellRange() : true;
return ret; return ret;
}, }, "enterCellRange": function() {
"enterCellRange": function () {
self.lockDraw = true; self.lockDraw = true;
self.cellEditor.setFocus(false); self.cellEditor.setFocus(false);
self.getWorksheet().enterCellRange(self.cellEditor); self.getWorksheet().enterCellRange(self.cellEditor);
self.lockDraw = false; self.lockDraw = false;
}, "copy": function() {
self.copyToClipboard.apply(self, arguments);
}, "paste": function() {
self.pasteFromClipboard.apply(self, arguments);
}, "cut": function() {
self.cutToClipboard.apply(self, arguments);
}, "undo": function() {
self.undo.apply(self, arguments);
}, "redo": function() {
self.redo.apply(self, arguments);
}, "addColumn": function() {
self._onAddColumn.apply(self, arguments);
}, "addRow": function() {
self._onAddRow.apply(self, arguments);
}, "mouseDblClick": function() {
self._onMouseDblClick.apply(self, arguments);
}, "showNextPrevWorksheet": function() {
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);
}, },
"copy": function () {self.copyToClipboard.apply(self, arguments);},
"paste": function () {self.pasteFromClipboard.apply(self, arguments);},
"cut": function () {self.cutToClipboard.apply(self, arguments);},
"undo": function () {self.undo.apply(self, arguments);},
"redo": function () {self.redo.apply(self, arguments);},
"addColumn": function () {self._onAddColumn.apply(self, arguments);},
"addRow": function () {self._onAddRow.apply(self, arguments);},
"mouseDblClick": function () {self._onMouseDblClick.apply(self, arguments);},
"showNextPrevWorksheet": function () {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 // Shapes
"graphicObjectMouseDown": function () {self._onGraphicObjectMouseDown.apply(self, arguments);}, "graphicObjectMouseDown": function() {
"graphicObjectMouseMove": function () {self._onGraphicObjectMouseMove.apply(self, arguments);}, self._onGraphicObjectMouseDown.apply(self, arguments);
"graphicObjectMouseUp": function () {self._onGraphicObjectMouseUp.apply(self, arguments);}, }, "graphicObjectMouseMove": function() {
"graphicObjectMouseUpEx": function () {self._onGraphicObjectMouseUpEx.apply(self, arguments);}, self._onGraphicObjectMouseMove.apply(self, arguments);
"graphicObjectWindowKeyDown": function () {return self._onGraphicObjectWindowKeyDown.apply(self, arguments);}, }, "graphicObjectMouseUp": function() {
"graphicObjectWindowKeyPress": function () {return self._onGraphicObjectWindowKeyPress.apply(self, arguments);}, self._onGraphicObjectMouseUp.apply(self, arguments);
"getGraphicsInfo": function () {return self._onGetGraphicsInfo.apply(self, arguments);}, }, "graphicObjectMouseUpEx": function() {
"getSelectedGraphicObjects": function () {return self._onGetSelectedGraphicObjects.apply(self, arguments);}, self._onGraphicObjectMouseUpEx.apply(self, arguments);
"updateSelectionShape": function () {return self._onUpdateSelectionShape.apply(self, arguments);}, }, "graphicObjectWindowKeyDown": function() {
"canReceiveKeyPress": function () {return self.getWorksheet().objectRender.controller.canReceiveKeyPress();}, return self._onGraphicObjectWindowKeyDown.apply(self, arguments);
"stopAddShape": function () { }, "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(); 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,15 +449,20 @@ ...@@ -378,15 +449,20 @@
}, 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);
}, "paste": function() {
self.pasteFromClipboard.apply(self, arguments);
}, "cut": function() {
self.cutToClipboard.apply(self, arguments);
}, "updateFormulaEditMod": function() {
self.controller.setFormulaEditMode.apply(self.controller, arguments); self.controller.setFormulaEditMode.apply(self.controller, arguments);
var ws = self.getWorksheet(); var ws = self.getWorksheet();
if (ws) { if (ws) {
...@@ -396,54 +472,60 @@ ...@@ -396,54 +472,60 @@
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 () {return self.collaborativeEditing.getGlobalLockEditCell();}, }, "isGlobalLockEditCell": function() {
"updateFormulaEditModEnd" : function () { return self.collaborativeEditing.getGlobalLockEditCell();
}, "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) {
"existedRange" : function (range) { self.getWorksheet().activeFormulaRange(range); }, self.getWorksheet().activeFormulaRange(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 () {return self.controller.settings.isViewerMode;}, }, "isViewerMode": function() {
"getFormulaRanges" : function () { return self.controller.settings.isViewerMode;
return self.cellFormulaEnterWSOpen ? }, "getFormulaRanges": function() {
self.cellFormulaEnterWSOpen.getFormulaRanges() : return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.getFormulaRanges() : self.getWorksheet().getFormulaRanges();
self.getWorksheet().getFormulaRanges(); }, "getCellFormulaEnterWSOpen": function() {
}, return self.cellFormulaEnterWSOpen;
"getCellFormulaEnterWSOpen" : function () {return self.cellFormulaEnterWSOpen;}, }, "setStrictClose": function(val) {
"setStrictClose" : function (val) {self.controller.setStrictClose(val);}, self.controller.setStrictClose(val);
"updateEditorSelectionInfo" : function (info) {self.handlers.trigger("asc_onEditorSelectionChanged", info);}, }, "updateEditorSelectionInfo": function(info) {
"onContextMenu" : function (event) {self.handlers.trigger("asc_onContextMenu", event);} self.handlers.trigger("asc_onEditorSelectionChanged", info);
}, }, "onContextMenu": function(event) {
/*settings*/{ self.handlers.trigger("asc_onContextMenu", event);
font: this.defaultFont, }
padding: this.defaults.worksheetView.cells.padding }, /*settings*/{
font: this.defaultFont, padding: this.defaults.worksheetView.cells.padding
}); });
} }
if (window['IS_NATIVE_EDITOR']) { if (window['IS_NATIVE_EDITOR']) {
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);
}, "paste": function() {
self.pasteFromClipboard.apply(self, arguments);
}, "cut": function() {
self.cutToClipboard.apply(self, arguments);
}, "updateFormulaEditMod": function() {
self.controller.setFormulaEditMode.apply(self.controller, arguments); self.controller.setFormulaEditMode.apply(self.controller, arguments);
var ws = self.getWorksheet(); var ws = self.getWorksheet();
if (ws) { if (ws) {
...@@ -453,72 +535,94 @@ ...@@ -453,72 +535,94 @@
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 () {return self.collaborativeEditing.getGlobalLockEditCell();}, }, "isGlobalLockEditCell": function() {
"updateFormulaEditModEnd" : function (rangeUpdated) {self.getWorksheet().updateSelection();}, return self.collaborativeEditing.getGlobalLockEditCell();
"newRange" : function (range,ws) { }, "updateFormulaEditModEnd": function(rangeUpdated) {
if( !ws ){ self.getWorksheet().updateSelection();
}, "newRange": function(range, 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) {
"existedRange" : function (range) { self.getWorksheet().activeFormulaRange(range); }, self.getWorksheet().activeFormulaRange(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 () {return self.controller.settings.isViewerMode;}, }, "isViewerMode": function() {
"getFormulaRanges" : function () { return self.controller.settings.isViewerMode;
return self.cellFormulaEnterWSOpen ? }, "getFormulaRanges": function() {
self.cellFormulaEnterWSOpen.getFormulaRanges() : return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.getFormulaRanges() : self.getWorksheet().getFormulaRanges();
self.getWorksheet().getFormulaRanges(); }, "getCellFormulaEnterWSOpen": function() {
}, return self.cellFormulaEnterWSOpen;
"getCellFormulaEnterWSOpen" : function () {return self.cellFormulaEnterWSOpen;}, }, "setStrictClose": function(val) {
"setStrictClose" : function (val) {self.controller.setStrictClose(val);}, self.controller.setStrictClose(val);
"updateEditorSelectionInfo" : function (info) {self.handlers.trigger("asc_onEditorSelectionChanged", info);}, }, "updateEditorSelectionInfo": function(info) {
"onContextMenu" : function (event) {self.handlers.trigger("asc_onContextMenu", event);} self.handlers.trigger("asc_onEditorSelectionChanged", info);
}, }, "onContextMenu": function(event) {
/*settings*/{ self.handlers.trigger("asc_onContextMenu", event);
font: this.defaultFont, }
padding: this.defaults.worksheetView.cells.padding }, /*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,30 +706,40 @@ ...@@ -602,30 +706,40 @@
} }
} }
}); });
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();
......
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