Commit ca6f11b1 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov

дополнительно для ревизии 68053

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68105 954022d7-b5bf-4e40-9824-e11837661b57
parent 1cf07481
...@@ -453,7 +453,7 @@ ...@@ -453,7 +453,7 @@
CellEditor.prototype.activateCellRange = function () { CellEditor.prototype.activateCellRange = function () {
var res = this._findRangeUnderCursor(); var res = this._findRangeUnderCursor();
res.range ? this.handlers.trigger( "existedRange", res.range ) : this.handlers.trigger( "newRange" ); res.range ? this.handlers.trigger( "existedRange", res.range, res.wsName ) : this.handlers.trigger( "newRange" );
}; };
CellEditor.prototype.enterCellRange = function ( rangeStr ) { CellEditor.prototype.enterCellRange = function ( rangeStr ) {
...@@ -826,7 +826,7 @@ ...@@ -826,7 +826,7 @@
switch( r.oper.type ){ switch( r.oper.type ){
case cElementType.cell :{ case cElementType.cell :{
if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){ if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){
continue; wsName = this.handlers.trigger("getCellFormulaEnterWSOpen").model.getName();
} }
ret = true; ret = true;
break; break;
...@@ -839,7 +839,7 @@ ...@@ -839,7 +839,7 @@
} }
case cElementType.cellsRange :{ case cElementType.cellsRange :{
if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){ if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){
continue; wsName = this.handlers.trigger("getCellFormulaEnterWSOpen").model.getName();
} }
ret = true; ret = true;
break; break;
...@@ -920,7 +920,7 @@ ...@@ -920,7 +920,7 @@
switch( r.oper.type ){ switch( r.oper.type ){
case cElementType.cell :{ case cElementType.cell :{
if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){ if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){
continue; wsName = this.handlers.trigger("getCellFormulaEnterWSOpen").model.getName();
} }
ret = true; ret = true;
break; break;
...@@ -933,7 +933,7 @@ ...@@ -933,7 +933,7 @@
} }
case cElementType.cellsRange :{ case cElementType.cellsRange :{
if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){ if( this.handlers.trigger("getCellFormulaEnterWSOpen") ){
continue; wsName = this.handlers.trigger("getCellFormulaEnterWSOpen").model.getName();
} }
ret = true; ret = true;
break; break;
...@@ -953,14 +953,17 @@ ...@@ -953,14 +953,17 @@
if ( ret && t.cursorPos > _s && t.cursorPos <= _s + r.oper.value.length ) { if ( ret && t.cursorPos > _s && t.cursorPos <= _s + r.oper.value.length ) {
range = t._parseRangeStr( r.oper.value ); range = t._parseRangeStr( r.oper.value );
if( range ){ if( range ){
return {index: _s, length: r.oper.value.length, range: range}; if( this.handlers.trigger("getActiveWS") && this.handlers.trigger("getActiveWS").getName() != wsName ){
return {index: -1, length: 0, range: null};
}
return {index: _s, length: r.oper.value.length, range: range, wsName: wsName};
} }
} }
} }
} }
return !range ? return !range ?
{index: -1, length: 0, range: null} : {index: -1, length: 0, range: null} :
{index: _s, length: r.oper.value.length, range: range}; {index: _s, length: r.oper.value.length, range: range, wsName: wsName};
}; };
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* @param {Window} window * @param {Window} window
* @param {undefined} undefined * @param {undefined} undefined
*/ */
function($, window, undefined) { function ($, window, undefined) {
/* /*
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
var asc_getcvt = asc.getCvtRatio; var asc_getcvt = asc.getCvtRatio;
var asc_CSP = asc.asc_CStylesPainter; var asc_CSP = asc.asc_CStylesPainter;
function WorkbookCommentsModel(handlers) { function WorkbookCommentsModel (handlers) {
this.workbook = {handlers: handlers}; this.workbook = {handlers: handlers};
} }
WorkbookCommentsModel.prototype.getId = function() { WorkbookCommentsModel.prototype.getId = function () {
return "workbook"; return "workbook";
}; };
WorkbookCommentsModel.prototype.getMergedByCell = function() { WorkbookCommentsModel.prototype.getMergedByCell = function () {
return null; return null;
}; };
...@@ -276,136 +276,191 @@ ...@@ -276,136 +276,191 @@
this.controller.init(this, this.element, /*this.canvasOverlay*/ this.canvasGraphicOverlay, /*handlers*/{ this.controller.init(this, this.element, /*this.canvasOverlay*/ this.canvasGraphicOverlay, /*handlers*/{
"resize": function() { "resize": function() {
self.resize.apply(self, arguments); self.resize.apply(self, arguments);
}, "reinitializeScroll": function() { },
"reinitializeScroll": function() {
self._onScrollReinitialize.apply(self, arguments); self._onScrollReinitialize.apply(self, arguments);
}, "scrollY": function() { },
"scrollY": function() {
self._onScrollY.apply(self, arguments); self._onScrollY.apply(self, arguments);
}, "scrollX": function() { },
"scrollX": function() {
self._onScrollX.apply(self, arguments); self._onScrollX.apply(self, arguments);
}, "changeSelection": function() { },
"changeSelection": function() {
self._onChangeSelection.apply(self, arguments); self._onChangeSelection.apply(self, arguments);
}, "changeSelectionDone": function() { },
"changeSelectionDone": function() {
self._onChangeSelectionDone.apply(self, arguments); self._onChangeSelectionDone.apply(self, arguments);
}, "changeSelectionRightClick": function() { },
"changeSelectionRightClick": function() {
self._onChangeSelectionRightClick.apply(self, arguments); self._onChangeSelectionRightClick.apply(self, arguments);
}, "selectionActivePointChanged": function() { },
"selectionActivePointChanged": function() {
self._onSelectionActivePointChanged.apply(self, arguments); self._onSelectionActivePointChanged.apply(self, arguments);
}, "updateWorksheet": function() { },
"updateWorksheet": function() {
self._onUpdateWorksheet.apply(self, arguments); self._onUpdateWorksheet.apply(self, arguments);
}, "resizeElement": function() { },
"resizeElement": function() {
self._onResizeElement.apply(self, arguments); self._onResizeElement.apply(self, arguments);
}, "resizeElementDone": function() { },
"resizeElementDone": function() {
self._onResizeElementDone.apply(self, arguments); self._onResizeElementDone.apply(self, arguments);
}, "changeFillHandle": function() { },
"changeFillHandle": function() {
self._onChangeFillHandle.apply(self, arguments); self._onChangeFillHandle.apply(self, arguments);
}, "changeFillHandleDone": function() { },
"changeFillHandleDone": function() {
self._onChangeFillHandleDone.apply(self, arguments); self._onChangeFillHandleDone.apply(self, arguments);
}, "moveRangeHandle": function() { },
"moveRangeHandle": function() {
self._onMoveRangeHandle.apply(self, arguments); self._onMoveRangeHandle.apply(self, arguments);
}, "moveRangeHandleDone": function() { },
"moveRangeHandleDone": function() {
self._onMoveRangeHandleDone.apply(self, arguments); self._onMoveRangeHandleDone.apply(self, arguments);
}, "moveResizeRangeHandle": function() { },
"moveResizeRangeHandle": function() {
self._onMoveResizeRangeHandle.apply(self, arguments); self._onMoveResizeRangeHandle.apply(self, arguments);
}, "moveResizeRangeHandleDone": function() { },
"moveResizeRangeHandleDone": function() {
self._onMoveResizeRangeHandleDone.apply(self, arguments); self._onMoveResizeRangeHandleDone.apply(self, arguments);
}, "editCell": function() { },
"editCell": function() {
self._onEditCell.apply(self, arguments); self._onEditCell.apply(self, arguments);
}, "stopCellEditing": function() { },
"stopCellEditing": function() {
return self._onStopCellEditing.apply(self, arguments); return self._onStopCellEditing.apply(self, arguments);
}, "empty": function() { },
"empty": function() {
self._onEmpty.apply(self, arguments); self._onEmpty.apply(self, arguments);
}, "canEnterCellRange": function() { },
"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() { },
"copy": function() {
self.copyToClipboard.apply(self, arguments); self.copyToClipboard.apply(self, arguments);
}, "paste": function() { },
"paste": function() {
self.pasteFromClipboard.apply(self, arguments); self.pasteFromClipboard.apply(self, arguments);
}, "cut": function() { },
"cut": function() {
self.cutToClipboard.apply(self, arguments); self.cutToClipboard.apply(self, arguments);
}, "undo": function() { },
"undo": function() {
self.undo.apply(self, arguments); self.undo.apply(self, arguments);
}, "redo": function() { },
"redo": function() {
self.redo.apply(self, arguments); self.redo.apply(self, arguments);
}, "addColumn": function() { },
"addColumn": function() {
self._onAddColumn.apply(self, arguments); self._onAddColumn.apply(self, arguments);
}, "addRow": function() { },
"addRow": function() {
self._onAddRow.apply(self, arguments); self._onAddRow.apply(self, arguments);
}, "mouseDblClick": function() { },
"mouseDblClick": function() {
self._onMouseDblClick.apply(self, arguments); self._onMouseDblClick.apply(self, arguments);
}, "showNextPrevWorksheet": function() { },
"showNextPrevWorksheet": function() {
self._onShowNextPrevWorksheet.apply(self, arguments); self._onShowNextPrevWorksheet.apply(self, arguments);
}, "setFontAttributes": function() { },
"setFontAttributes": function() {
self._onSetFontAttributes.apply(self, arguments); self._onSetFontAttributes.apply(self, arguments);
}, "selectColumnsByRange": function() { },
"selectColumnsByRange": function() {
self._onSelectColumnsByRange.apply(self, arguments); self._onSelectColumnsByRange.apply(self, arguments);
}, "selectRowsByRange": function() { },
"selectRowsByRange": function() {
self._onSelectRowsByRange.apply(self, arguments); self._onSelectRowsByRange.apply(self, arguments);
}, "save": function() { },
"save": function() {
self.Api.asc_Save(); self.Api.asc_Save();
}, "showCellEditorCursor": function() { },
"showCellEditorCursor": function() {
self._onShowCellEditorCursor.apply(self, arguments); self._onShowCellEditorCursor.apply(self, arguments);
}, "print": function() { },
"print": function() {
self.Api.asc_Print(); self.Api.asc_Print();
}, "addFunction": function() { },
"addFunction": function() {
self.insertFormulaInEditor.apply(self, arguments); self.insertFormulaInEditor.apply(self, arguments);
}, "canvasClick": function() { },
"canvasClick": function() {
self.enableKeyEventsHandler(true); self.enableKeyEventsHandler(true);
}, "autoFiltersClick": function() { },
"autoFiltersClick": function() {
self._onAutoFiltersClick.apply(self, arguments); self._onAutoFiltersClick.apply(self, arguments);
}, "commentCellClick": function() { },
"commentCellClick": function() {
self._onCommentCellClick.apply(self, arguments); self._onCommentCellClick.apply(self, arguments);
}, "isGlobalLockEditCell": function() { },
"isGlobalLockEditCell": function() {
return self.collaborativeEditing.getGlobalLockEditCell(); return self.collaborativeEditing.getGlobalLockEditCell();
}, "updateSelectionName": function() { },
"updateSelectionName": function() {
self._onUpdateSelectionName.apply(self, arguments); self._onUpdateSelectionName.apply(self, arguments);
}, "stopFormatPainter": function() { },
"stopFormatPainter": function() {
self._onStopFormatPainter.apply(self, arguments); self._onStopFormatPainter.apply(self, arguments);
}, },
// Shapes // Shapes
"graphicObjectMouseDown": function() { "graphicObjectMouseDown": function() {
self._onGraphicObjectMouseDown.apply(self, arguments); self._onGraphicObjectMouseDown.apply(self, arguments);
}, "graphicObjectMouseMove": function() { },
"graphicObjectMouseMove": function() {
self._onGraphicObjectMouseMove.apply(self, arguments); self._onGraphicObjectMouseMove.apply(self, arguments);
}, "graphicObjectMouseUp": function() { },
"graphicObjectMouseUp": function() {
self._onGraphicObjectMouseUp.apply(self, arguments); self._onGraphicObjectMouseUp.apply(self, arguments);
}, "graphicObjectMouseUpEx": function() { },
"graphicObjectMouseUpEx": function() {
self._onGraphicObjectMouseUpEx.apply(self, arguments); self._onGraphicObjectMouseUpEx.apply(self, arguments);
}, "graphicObjectWindowKeyDown": function() { },
"graphicObjectWindowKeyDown": function() {
return self._onGraphicObjectWindowKeyDown.apply(self, arguments); return self._onGraphicObjectWindowKeyDown.apply(self, arguments);
}, "graphicObjectWindowKeyPress": function() { },
"graphicObjectWindowKeyPress": function() {
return self._onGraphicObjectWindowKeyPress.apply(self, arguments); return self._onGraphicObjectWindowKeyPress.apply(self, arguments);
}, "getGraphicsInfo": function() { },
"getGraphicsInfo": function() {
return self._onGetGraphicsInfo.apply(self, arguments); return self._onGetGraphicsInfo.apply(self, arguments);
}, "getSelectedGraphicObjects": function() { },
"getSelectedGraphicObjects": function() {
return self._onGetSelectedGraphicObjects.apply(self, arguments); return self._onGetSelectedGraphicObjects.apply(self, arguments);
}, "updateSelectionShape": function() { },
"updateSelectionShape": function() {
return self._onUpdateSelectionShape.apply(self, arguments); return self._onUpdateSelectionShape.apply(self, arguments);
}, "canReceiveKeyPress": function() { },
"canReceiveKeyPress": function() {
return self.getWorksheet().objectRender.controller.canReceiveKeyPress(); return self.getWorksheet().objectRender.controller.canReceiveKeyPress();
}, "stopAddShape": function() { },
"stopAddShape": function() {
self.getWorksheet().objectRender.controller.checkEndAddShape(); self.getWorksheet().objectRender.controller.checkEndAddShape();
}, },
// Frozen anchor // Frozen anchor
"moveFrozenAnchorHandle": function() { "moveFrozenAnchorHandle": function() {
self._onMoveFrozenAnchorHandle.apply(self, arguments); self._onMoveFrozenAnchorHandle.apply(self, arguments);
}, "moveFrozenAnchorHandleDone": function() { },
"moveFrozenAnchorHandleDone": function() {
self._onMoveFrozenAnchorHandleDone.apply(self, arguments); self._onMoveFrozenAnchorHandleDone.apply(self, arguments);
}, },
// AutoComplete // AutoComplete
"showAutoComplete": function() { "showAutoComplete": function() {
self._onShowAutoComplete.apply(self, arguments); self._onShowAutoComplete.apply(self, arguments);
}, "onContextMenu": function(event) { },
"onContextMenu": function(event) {
self.handlers.trigger("asc_onContextMenu", event); self.handlers.trigger("asc_onContextMenu", event);
}, },
...@@ -429,21 +484,28 @@ ...@@ -429,21 +484,28 @@
} }
}, false); }, false);
} }
}
this.cellEditor = new asc.CellEditor(this.element, this.input, this.fmgrGraphics, this.m_oFont, /*handlers*/{ this.cellEditor = new asc.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._onUpdateCellEditor.apply(self, arguments);
}, "gotFocus": function(hasFocus) { },
"gotFocus": function(hasFocus) {
self.controller.setFocus(!hasFocus); self.controller.setFocus(!hasFocus);
}, "copy": function() { },
"copy": function() {
self.copyToClipboard.apply(self, arguments); self.copyToClipboard.apply(self, arguments);
}, "paste": function() { },
"paste": function() {
self.pasteFromClipboard.apply(self, arguments); self.pasteFromClipboard.apply(self, arguments);
}, "cut": function() { },
"cut": function() {
self.cutToClipboard.apply(self, arguments); self.cutToClipboard.apply(self, arguments);
}, "updateFormulaEditMod": function() { },
"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,144 +515,116 @@ ...@@ -453,144 +515,116 @@
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) { },
self.getWorksheet().activeFormulaRange(range); "existedRange": function(range, ws) {
}, "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;
}, "getActiveWS": function() {
return self.getWorksheet().model;
}, "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) {
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) { if (!ws) {
self.getWorksheet().addFormulaRange(range); self.getWorksheet().activeFormulaRange(range);
} else { } else {
self.getWorksheet(self.model.getWorksheetIndexByName(ws)).addFormulaRange(range); self.getWorksheet(self.model.getWorksheetIndexByName(ws)).activeFormulaRange(range);
} }
}, "existedRange": function(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() { },
"isViewerMode": function() {
return self.controller.settings.isViewerMode; return self.controller.settings.isViewerMode;
}, "getFormulaRanges": function() { },
"getFormulaRanges": function() {
return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.getFormulaRanges() : self.getWorksheet().getFormulaRanges(); return self.cellFormulaEnterWSOpen ? self.cellFormulaEnterWSOpen.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 asc.asc_CHandlersList(/*handlers*/{ this.wsViewHandlers = new asc.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.apply(self, arguments); self._onWSSelectionChanged.apply(self, arguments);
}, "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);
}, "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, c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.SlowOperation);
}, "setAutoFiltersDialog": function(arrVal) { },
"setAutoFiltersDialog": function(arrVal) {
self.handlers.trigger("asc_onSetAFDialog", arrVal); self.handlers.trigger("asc_onSetAFDialog", arrVal);
}, "selectionRangeChanged": function(val) { },
"selectionRangeChanged": function(val) {
self.handlers.trigger("asc_onSelectionRangeChanged", val); self.handlers.trigger("asc_onSelectionRangeChanged", val);
}, "onRenameCellTextEnd": function(countFind, countReplace) { },
"onRenameCellTextEnd": function(countFind, countReplace) {
self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace); self.handlers.trigger("asc_onRenameCellTextEnd", countFind, countReplace);
}, "onStopFormatPainter": function() { },
"onStopFormatPainter": function() {
self.handlers.trigger("asc_onStopFormatPainter"); self.handlers.trigger("asc_onStopFormatPainter");
}, "onDocumentPlaceChanged": function() { },
"onDocumentPlaceChanged": function() {
self._onDocumentPlaceChanged(); self._onDocumentPlaceChanged();
}, "updateSheetViewSettings": function() { },
"updateSheetViewSettings": function() {
self.handlers.trigger("asc_onUpdateSheetViewSettings"); self.handlers.trigger("asc_onUpdateSheetViewSettings");
}, "onScroll": function(d) { },
"onScroll": function(d) {
self.controller.scroll(d); self.controller.scroll(d);
}, "getLockDefNameManagerStatus": function() { },
"getLockDefNameManagerStatus": function() {
return self.defNameAllowCreate return self.defNameAllowCreate
} }
}); });
...@@ -733,26 +767,26 @@ ...@@ -733,26 +767,26 @@
return this; return this;
}; };
WorkbookView.prototype.destroy = function() { WorkbookView.prototype.destroy = function () {
this.controller.destroy(); this.controller.destroy();
this.cellEditor.destroy(); this.cellEditor.destroy();
return this; return this;
}; };
WorkbookView.prototype._createWorksheetView = function(wsModel) { WorkbookView.prototype._createWorksheetView = function (wsModel) {
return new asc.WorksheetView(wsModel, this.wsViewHandlers, this.buffers, this.stringRender, this.maxDigitWidth, this.collaborativeEditing, this.defaults.worksheetView); return new asc.WorksheetView(wsModel, this.wsViewHandlers, this.buffers, this.stringRender, this.maxDigitWidth, this.collaborativeEditing, this.defaults.worksheetView);
}; };
WorkbookView.prototype._onSelectionNameChanged = function(name) { WorkbookView.prototype._onSelectionNameChanged = function (name) {
this.handlers.trigger("asc_onSelectionNameChanged", name); this.handlers.trigger("asc_onSelectionNameChanged", name);
}; };
WorkbookView.prototype._onSelectionMathInfoChanged = function(info) { WorkbookView.prototype._onSelectionMathInfoChanged = function (info) {
this.handlers.trigger("asc_onSelectionMathChanged", info); this.handlers.trigger("asc_onSelectionMathChanged", info);
}; };
// Проверяет, сменили ли мы диапазон (для того, чтобы не отправлять одинаковую информацию о диапазоне) // Проверяет, сменили ли мы диапазон (для того, чтобы не отправлять одинаковую информацию о диапазоне)
WorkbookView.prototype._isEqualRange = function(range, isSelectOnShape) { WorkbookView.prototype._isEqualRange = function (range, isSelectOnShape) {
if (null === this.lastSendInfoRange) { if (null === this.lastSendInfoRange) {
return false; return false;
} }
...@@ -760,7 +794,7 @@ ...@@ -760,7 +794,7 @@
return this.lastSendInfoRange.isEqual(range) && this.lastSendInfoRangeIsSelectOnShape === isSelectOnShape; return this.lastSendInfoRange.isEqual(range) && this.lastSendInfoRangeIsSelectOnShape === isSelectOnShape;
}; };
WorkbookView.prototype._onWSSelectionChanged = function(info) { WorkbookView.prototype._onWSSelectionChanged = function (info) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if (this.cellFormulaEnterWSOpen) { if (this.cellFormulaEnterWSOpen) {
...@@ -789,7 +823,7 @@ ...@@ -789,7 +823,7 @@
}; };
WorkbookView.prototype._onScrollReinitialize = function(whichSB, callback) { WorkbookView.prototype._onScrollReinitialize = function (whichSB, callback) {
var ws = this.getWorksheet(), vsize = !whichSB || whichSB === 1 ? ws.getVerticalScrollRange() : undefined, hsize = !whichSB || whichSB === 2 ? ws.getHorizontalScrollRange() : undefined; var ws = this.getWorksheet(), vsize = !whichSB || whichSB === 1 ? ws.getVerticalScrollRange() : undefined, hsize = !whichSB || whichSB === 2 ? ws.getHorizontalScrollRange() : undefined;
if (vsize != undefined) { if (vsize != undefined) {
...@@ -802,7 +836,7 @@ ...@@ -802,7 +836,7 @@
asc_applyFunction(callback, vsize, hsize); asc_applyFunction(callback, vsize, hsize);
}; };
WorkbookView.prototype._onScrollY = function(pos) { WorkbookView.prototype._onScrollY = function (pos) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var delta = asc_round(pos - ws.getFirstVisibleRow(/*allowPane*/true)); var delta = asc_round(pos - ws.getFirstVisibleRow(/*allowPane*/true));
if (delta !== 0) { if (delta !== 0) {
...@@ -810,7 +844,7 @@ ...@@ -810,7 +844,7 @@
} }
}; };
WorkbookView.prototype._onScrollX = function(pos) { WorkbookView.prototype._onScrollX = function (pos) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var delta = asc_round(pos - ws.getFirstVisibleCol(/*allowPane*/true)); var delta = asc_round(pos - ws.getFirstVisibleCol(/*allowPane*/true));
if (delta !== 0) { if (delta !== 0) {
...@@ -818,19 +852,19 @@ ...@@ -818,19 +852,19 @@
} }
}; };
WorkbookView.prototype._onSetSelection = function(range, validRange) { WorkbookView.prototype._onSetSelection = function (range, validRange) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws._checkSelectionShape(); ws._checkSelectionShape();
var d = ws.setSelectionUndoRedo(range, validRange); var d = ws.setSelectionUndoRedo(range, validRange);
this.controller.scroll(d); this.controller.scroll(d);
}; };
WorkbookView.prototype._onGetSelection = function() { WorkbookView.prototype._onGetSelection = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.getActiveRangeObj(); return ws.getActiveRangeObj();
}; };
WorkbookView.prototype._onGetSelectionState = function() { WorkbookView.prototype._onGetSelectionState = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var res = null; var res = null;
if (isRealObject(ws.objectRender) && isRealObject(ws.objectRender.controller)) { if (isRealObject(ws.objectRender) && isRealObject(ws.objectRender.controller)) {
...@@ -840,7 +874,7 @@ ...@@ -840,7 +874,7 @@
return (res && res[0] && res[0].focus) ? res : null; return (res && res[0] && res[0].focus) ? res : null;
}; };
WorkbookView.prototype._onSetSelectionState = function(state) { WorkbookView.prototype._onSetSelectionState = function (state) {
if (null !== state) { if (null !== state) {
var ws = this.getWorksheetById(state[0].worksheetId); var ws = this.getWorksheetById(state[0].worksheetId);
if (ws && ws.objectRender && ws.objectRender.controller) { if (ws && ws.objectRender && ws.objectRender.controller) {
...@@ -856,7 +890,7 @@ ...@@ -856,7 +890,7 @@
} }
}; };
WorkbookView.prototype._onChangeSelection = function(isStartPoint, dc, dr, isCoord, isSelectMode, callback) { WorkbookView.prototype._onChangeSelection = function (isStartPoint, dc, dr, isCoord, isSelectMode, callback) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var d = isStartPoint ? ws.changeSelectionStartPoint(dc, dr, isCoord, isSelectMode) : ws.changeSelectionEndPoint(dc, dr, isCoord, isSelectMode); var d = isStartPoint ? ws.changeSelectionStartPoint(dc, dr, isCoord, isSelectMode) : ws.changeSelectionEndPoint(dc, dr, isCoord, isSelectMode);
if (!isCoord && !isStartPoint && !isSelectMode) { if (!isCoord && !isStartPoint && !isSelectMode) {
...@@ -867,7 +901,7 @@ ...@@ -867,7 +901,7 @@
}; };
// Окончание выделения // Окончание выделения
WorkbookView.prototype._onChangeSelectionDone = function(x, y) { WorkbookView.prototype._onChangeSelectionDone = function (x, y) {
if (c_oAscSelectionDialogType.None !== this.selectionDialogType) { if (c_oAscSelectionDialogType.None !== this.selectionDialogType) {
return; return;
} }
...@@ -920,19 +954,19 @@ ...@@ -920,19 +954,19 @@
}; };
// Обработка нажатия правой кнопки мыши // Обработка нажатия правой кнопки мыши
WorkbookView.prototype._onChangeSelectionRightClick = function(dc, dr) { WorkbookView.prototype._onChangeSelectionRightClick = function (dc, dr) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.changeSelectionStartPointRightClick(dc, dr); ws.changeSelectionStartPointRightClick(dc, dr);
}; };
// Обработка движения в выделенной области // Обработка движения в выделенной области
WorkbookView.prototype._onSelectionActivePointChanged = function(dc, dr, callback) { WorkbookView.prototype._onSelectionActivePointChanged = function (dc, dr, callback) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var d = ws.changeSelectionActivePoint(dc, dr); var d = ws.changeSelectionActivePoint(dc, dr);
asc_applyFunction(callback, d); asc_applyFunction(callback, d);
}; };
WorkbookView.prototype._onUpdateWorksheet = function(canvasElem, x, y, ctrlKey, callback) { WorkbookView.prototype._onUpdateWorksheet = function (canvasElem, x, y, ctrlKey, callback) {
var ws = this.getWorksheet(), ct = undefined; var ws = this.getWorksheet(), ct = undefined;
var arrMouseMoveObjects = []; // Теперь это массив из объектов, над которыми курсор var arrMouseMoveObjects = []; // Теперь это массив из объектов, над которыми курсор
...@@ -1008,7 +1042,7 @@ ...@@ -1008,7 +1042,7 @@
// Отсылаем эвент с объектами // Отсылаем эвент с объектами
this.handlers.trigger("asc_onMouseMove", arrMouseMoveObjects); this.handlers.trigger("asc_onMouseMove", arrMouseMoveObjects);
if (ct.target === c_oTargetType.MoveRange && ctrlKey && ct.cursor == "move") { if(ct.target === c_oTargetType.MoveRange && ctrlKey && ct.cursor == "move"){
ct.cursor = "copy"; ct.cursor = "copy";
} }
...@@ -1024,7 +1058,7 @@ ...@@ -1024,7 +1058,7 @@
asc_applyFunction(callback, ct); asc_applyFunction(callback, ct);
}; };
WorkbookView.prototype._onResizeElement = function(target, x, y) { WorkbookView.prototype._onResizeElement = function (target, x, y) {
var arrMouseMoveObjects = []; var arrMouseMoveObjects = [];
if (target.target === c_oTargetType.ColumnResize) { if (target.target === c_oTargetType.ColumnResize) {
arrMouseMoveObjects.push(this.getWorksheet().drawColumnGuides(target.col, x, y, target.mouseX)); arrMouseMoveObjects.push(this.getWorksheet().drawColumnGuides(target.col, x, y, target.mouseX));
...@@ -1043,7 +1077,7 @@ ...@@ -1043,7 +1077,7 @@
this.handlers.trigger("asc_onMouseMove", arrMouseMoveObjects); this.handlers.trigger("asc_onMouseMove", arrMouseMoveObjects);
}; };
WorkbookView.prototype._onResizeElementDone = function(target, x, y, isResizeModeMove) { WorkbookView.prototype._onResizeElementDone = function (target, x, y, isResizeModeMove) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if (isResizeModeMove) { if (isResizeModeMove) {
if (ws.objectRender) { if (ws.objectRender) {
...@@ -1065,49 +1099,49 @@ ...@@ -1065,49 +1099,49 @@
}; };
// Обработка автозаполнения // Обработка автозаполнения
WorkbookView.prototype._onChangeFillHandle = function(x, y, callback) { WorkbookView.prototype._onChangeFillHandle = function (x, y, callback) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var d = ws.changeSelectionFillHandle(x, y); var d = ws.changeSelectionFillHandle(x, y);
asc_applyFunction(callback, d); asc_applyFunction(callback, d);
}; };
// Обработка окончания автозаполнения // Обработка окончания автозаполнения
WorkbookView.prototype._onChangeFillHandleDone = function(x, y, ctrlPress) { WorkbookView.prototype._onChangeFillHandleDone = function (x, y, ctrlPress) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.applyFillHandle(x, y, ctrlPress); ws.applyFillHandle(x, y, ctrlPress);
}; };
// Обработка перемещения диапазона // Обработка перемещения диапазона
WorkbookView.prototype._onMoveRangeHandle = function(x, y, callback, ctrlKey) { WorkbookView.prototype._onMoveRangeHandle = function (x, y, callback,ctrlKey) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var d = ws.changeSelectionMoveRangeHandle(x, y, ctrlKey); var d = ws.changeSelectionMoveRangeHandle(x, y, ctrlKey);
asc_applyFunction(callback, d); asc_applyFunction(callback, d);
}; };
// Обработка окончания перемещения диапазона // Обработка окончания перемещения диапазона
WorkbookView.prototype._onMoveRangeHandleDone = function(ctrlKey) { WorkbookView.prototype._onMoveRangeHandleDone = function (ctrlKey) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.applyMoveRangeHandle(ctrlKey); ws.applyMoveRangeHandle(ctrlKey);
}; };
WorkbookView.prototype._onMoveResizeRangeHandle = function(x, y, target, callback) { WorkbookView.prototype._onMoveResizeRangeHandle = function (x, y, target, callback) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var d = ws.changeSelectionMoveResizeRangeHandle(x, y, target, this.cellEditor); var d = ws.changeSelectionMoveResizeRangeHandle(x, y, target, this.cellEditor);
asc_applyFunction(callback, d); asc_applyFunction(callback, d);
}; };
WorkbookView.prototype._onMoveResizeRangeHandleDone = function(target) { WorkbookView.prototype._onMoveResizeRangeHandleDone = function (target) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.applyMoveResizeRangeHandle(target); ws.applyMoveResizeRangeHandle(target);
}; };
// Frozen anchor // Frozen anchor
WorkbookView.prototype._onMoveFrozenAnchorHandle = function(x, y, target) { WorkbookView.prototype._onMoveFrozenAnchorHandle = function (x, y, target) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.drawFrozenGuides(x, y, target); ws.drawFrozenGuides(x, y, target);
}; };
WorkbookView.prototype._onMoveFrozenAnchorHandleDone = function(x, y, target) { WorkbookView.prototype._onMoveFrozenAnchorHandleDone = function (x, y, target) {
// Закрепляем область // Закрепляем область
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.applyFrozenAnchor(x, y, target); ws.applyFrozenAnchor(x, y, target);
...@@ -1123,7 +1157,7 @@ ...@@ -1123,7 +1157,7 @@
this.getWorksheet().autoFilters.onAutoFilterClick(idFilter); this.getWorksheet().autoFilters.onAutoFilterClick(idFilter);
}; };
WorkbookView.prototype._onCommentCellClick = function(x, y) { WorkbookView.prototype._onCommentCellClick = function (x, y) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var comments = ws.cellCommentator.getCommentsXY(x, y); var comments = ws.cellCommentator.getCommentsXY(x, y);
if (comments.length) { if (comments.length) {
...@@ -1131,7 +1165,7 @@ ...@@ -1131,7 +1165,7 @@
} }
}; };
WorkbookView.prototype._onUpdateSelectionName = function() { WorkbookView.prototype._onUpdateSelectionName = function () {
if (this.canUpdateAfterShiftUp) { if (this.canUpdateAfterShiftUp) {
this.canUpdateAfterShiftUp = false; this.canUpdateAfterShiftUp = false;
var ws = this.getWorksheet(); var ws = this.getWorksheet();
...@@ -1139,7 +1173,7 @@ ...@@ -1139,7 +1173,7 @@
} }
}; };
WorkbookView.prototype._onStopFormatPainter = function() { WorkbookView.prototype._onStopFormatPainter = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if (ws.stateFormatPainter) { if (ws.stateFormatPainter) {
ws.formatPainter(); ws.formatPainter();
...@@ -1147,53 +1181,53 @@ ...@@ -1147,53 +1181,53 @@
}; };
// Shapes // Shapes
WorkbookView.prototype._onGraphicObjectMouseDown = function(e, x, y) { WorkbookView.prototype._onGraphicObjectMouseDown = function (e, x, y) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.objectRender.graphicObjectMouseDown(e, x, y); ws.objectRender.graphicObjectMouseDown(e, x, y);
}; };
WorkbookView.prototype._onGraphicObjectMouseMove = function(e, x, y) { WorkbookView.prototype._onGraphicObjectMouseMove = function (e, x, y) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.objectRender.graphicObjectMouseMove(e, x, y); ws.objectRender.graphicObjectMouseMove(e, x, y);
}; };
WorkbookView.prototype._onGraphicObjectMouseUp = function(e, x, y) { WorkbookView.prototype._onGraphicObjectMouseUp = function (e, x, y) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.objectRender.graphicObjectMouseUp(e, x, y); ws.objectRender.graphicObjectMouseUp(e, x, y);
}; };
WorkbookView.prototype._onGraphicObjectMouseUpEx = function(e, x, y) { WorkbookView.prototype._onGraphicObjectMouseUpEx = function (e, x, y) {
//var ws = this.getWorksheet(); //var ws = this.getWorksheet();
//ws.objectRender.coordsManager.calculateCell(x, y); //ws.objectRender.coordsManager.calculateCell(x, y);
}; };
WorkbookView.prototype._onGraphicObjectWindowKeyDown = function(e) { WorkbookView.prototype._onGraphicObjectWindowKeyDown = function (e) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.objectRender.graphicObjectKeyDown(e); return ws.objectRender.graphicObjectKeyDown(e);
}; };
WorkbookView.prototype._onGraphicObjectWindowKeyPress = function(e) { WorkbookView.prototype._onGraphicObjectWindowKeyPress = function (e) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.objectRender.graphicObjectKeyPress(e); return ws.objectRender.graphicObjectKeyPress(e);
}; };
WorkbookView.prototype._onGetGraphicsInfo = function(x, y) { WorkbookView.prototype._onGetGraphicsInfo = function (x, y) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.objectRender.checkCursorDrawingObject(x, y); return ws.objectRender.checkCursorDrawingObject(x, y);
}; };
WorkbookView.prototype._onGetSelectedGraphicObjects = function() { WorkbookView.prototype._onGetSelectedGraphicObjects = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.objectRender.getSelectedGraphicObjects(); return ws.objectRender.getSelectedGraphicObjects();
}; };
WorkbookView.prototype._onUpdateSelectionShape = function(isSelectOnShape) { WorkbookView.prototype._onUpdateSelectionShape = function (isSelectOnShape) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return ws.setSelectionShape(isSelectOnShape); return ws.setSelectionShape(isSelectOnShape);
}; };
// Double click // Double click
WorkbookView.prototype._onMouseDblClick = function(x, y, isHideCursor, callback) { WorkbookView.prototype._onMouseDblClick = function (x, y, isHideCursor, callback) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
var ct = ws.getCursorTypeFromXY(x, y, this.controller.settings.isViewerMode); var ct = ws.getCursorTypeFromXY(x, y, this.controller.settings.isViewerMode);
...@@ -1263,7 +1297,7 @@ ...@@ -1263,7 +1297,7 @@
asc_applyFunction(callback, true); asc_applyFunction(callback, true);
}; };
var editLockCallback = function(res) { var editLockCallback = function (res) {
if (!res) { if (!res) {
t.controller.setCellEditMode(false); t.controller.setCellEditMode(false);
t.controller.setStrictClose(false); t.controller.setStrictClose(false);
...@@ -1286,35 +1320,38 @@ ...@@ -1286,35 +1320,38 @@
} }
}; };
WorkbookView.prototype._onStopCellEditing = function() { WorkbookView.prototype._onStopCellEditing = function () {
return this.cellEditor.close(true); return this.cellEditor.close(true);
}; };
WorkbookView.prototype._onCloseCellEditor = function() { WorkbookView.prototype._onCloseCellEditor = function () {
this.controller.setCellEditMode(false); this.controller.setCellEditMode(false);
this.controller.setStrictClose(false); this.controller.setStrictClose(false);
this.controller.setFormulaEditMode(false); this.controller.setFormulaEditMode(false);
var ws = this.getWorksheet(); var ws = this.getWorksheet(),
if (this.cellFormulaEnterWSOpen) { isCellEditMode;
ws.setCellEditMode(false); ws.setCellEditMode(false);
ws.setFormulaEditMode(false); ws.setFormulaEditMode(false);
if( this.cellFormulaEnterWSOpen ){
ws = this.cellFormulaEnterWSOpen; ws = this.cellFormulaEnterWSOpen;
}
var isCellEditMode = ws.getCellEditMode();
ws.setCellEditMode(false); ws.setCellEditMode(false);
ws.setFormulaEditMode(false); ws.setFormulaEditMode(false);
if (this.cellFormulaEnterWSOpen) { }
isCellEditMode = ws.getCellEditMode();
if( this.cellFormulaEnterWSOpen ){
this.cellFormulaEnterWSOpen = null; this.cellFormulaEnterWSOpen = null;
var index = ws.model.getIndex(); var index = ws.model.getIndex();
this.showWorksheet(index); this.showWorksheet(index);
this.handlers.trigger("asc_onActiveSheetChanged", index); this.handlers.trigger("asc_onActiveSheetChanged", index);
} }
if (this.getWorksheet().model.getId() == ws.model.getId()) { if( this.getWorksheet().model.getId() == ws.model.getId() ){
ws.updateSelection(); ws.updateSelection();
} }
for (var i in this.wsViews) { for(var i in this.wsViews){
this.wsViews[i].cleanFormulaRanges() this.wsViews[i].cleanFormulaRanges()
this.wsViews[i].setFormulaEditMode(false); this.wsViews[i].setFormulaEditMode( false );
} }
if (isCellEditMode) { if (isCellEditMode) {
this.handlers.trigger("asc_onEditCell", c_oAscCellEditorState.editEnd); this.handlers.trigger("asc_onEditCell", c_oAscCellEditorState.editEnd);
...@@ -1333,18 +1370,18 @@ ...@@ -1333,18 +1370,18 @@
}; };
WorkbookView.prototype._onEmpty = function() { WorkbookView.prototype._onEmpty = function () {
this.getWorksheet().emptySelection(c_oAscCleanOptions.Text); this.getWorksheet().emptySelection(c_oAscCleanOptions.Text);
}; };
WorkbookView.prototype._onAddColumn = function(isNotActive) { WorkbookView.prototype._onAddColumn = function (isNotActive) {
var res = this.getWorksheet().expandColsOnScroll(isNotActive); var res = this.getWorksheet().expandColsOnScroll(isNotActive);
if (res) { if (res) {
this.controller.reinitializeScroll(/*horizontal*/2); this.controller.reinitializeScroll(/*horizontal*/2);
} }
}; };
WorkbookView.prototype._onAddRow = function(isNotActive) { WorkbookView.prototype._onAddRow = function (isNotActive) {
var res = this.getWorksheet().expandRowsOnScroll(isNotActive); var res = this.getWorksheet().expandRowsOnScroll(isNotActive);
if (res) { // Добавлены строки if (res) { // Добавлены строки
// после добавления controller.settings.wheelScrollLines // после добавления controller.settings.wheelScrollLines
...@@ -1353,7 +1390,7 @@ ...@@ -1353,7 +1390,7 @@
} }
}; };
WorkbookView.prototype._onShowNextPrevWorksheet = function(direction) { WorkbookView.prototype._onShowNextPrevWorksheet = function (direction) {
// Проверка на неправильное направление // Проверка на неправильное направление
if (0 === direction) { if (0 === direction) {
return false; return false;
...@@ -1374,7 +1411,7 @@ ...@@ -1374,7 +1411,7 @@
return false; return false;
}; };
WorkbookView.prototype._onSetFontAttributes = function(prop) { WorkbookView.prototype._onSetFontAttributes = function (prop) {
var val; var val;
var selectionInfo = this.getWorksheet().getSelectionInfo().asc_getFont(); var selectionInfo = this.getWorksheet().getSelectionInfo().asc_getFont();
switch (prop) { switch (prop) {
...@@ -1396,15 +1433,15 @@ ...@@ -1396,15 +1433,15 @@
return this.setFontAttributes(prop, val); return this.setFontAttributes(prop, val);
}; };
WorkbookView.prototype._onSelectColumnsByRange = function() { WorkbookView.prototype._onSelectColumnsByRange = function () {
this.getWorksheet()._selectColumnsByRange(); this.getWorksheet()._selectColumnsByRange();
}; };
WorkbookView.prototype._onSelectRowsByRange = function() { WorkbookView.prototype._onSelectRowsByRange = function () {
this.getWorksheet()._selectRowsByRange(); this.getWorksheet()._selectRowsByRange();
}; };
WorkbookView.prototype._onShowCellEditorCursor = function() { WorkbookView.prototype._onShowCellEditorCursor = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
// Показываем курсор // Показываем курсор
if (ws.getCellEditMode()) { if (ws.getCellEditMode()) {
...@@ -1412,24 +1449,24 @@ ...@@ -1412,24 +1449,24 @@
} }
}; };
WorkbookView.prototype._onDocumentPlaceChanged = function() { WorkbookView.prototype._onDocumentPlaceChanged = function () {
if (this.isDocumentPlaceChangedEnabled) { if (this.isDocumentPlaceChangedEnabled) {
this.handlers.trigger("asc_onDocumentPlaceChanged"); this.handlers.trigger("asc_onDocumentPlaceChanged");
} }
}; };
WorkbookView.prototype.getTablePictures = function() { WorkbookView.prototype.getTablePictures = function () {
var autoFilters = new asc.AutoFilters(); var autoFilters = new asc.AutoFilters();
return autoFilters.getTablePictures(this.model, this.fmgrGraphics, this.m_oFont); return autoFilters.getTablePictures(this.model, this.fmgrGraphics, this.m_oFont);
}; };
WorkbookView.prototype.getCellStyles = function() { WorkbookView.prototype.getCellStyles = function () {
var oStylesPainter = new asc_CSP(); var oStylesPainter = new asc_CSP();
oStylesPainter.generateStylesAll(this.model.CellStyles, this.fmgrGraphics, this.m_oFont, this.stringRender); oStylesPainter.generateStylesAll(this.model.CellStyles, this.fmgrGraphics, this.m_oFont, this.stringRender);
return oStylesPainter; return oStylesPainter;
}; };
WorkbookView.prototype.getWorksheetById = function(id) { WorkbookView.prototype.getWorksheetById = function (id) {
var wsModel = this.model.getWorksheetById(id); var wsModel = this.model.getWorksheetById(id);
if (wsModel) { if (wsModel) {
return this.getWorksheet(wsModel.getIndex()); return this.getWorksheet(wsModel.getIndex());
...@@ -1441,7 +1478,7 @@ ...@@ -1441,7 +1478,7 @@
* @param {Number} [index] * @param {Number} [index]
* @return {WorksheetView} * @return {WorksheetView}
*/ */
WorkbookView.prototype.getWorksheet = function(index) { WorkbookView.prototype.getWorksheet = function (index) {
var wb = this.model; var wb = this.model;
var i = asc_typeof(index) === "number" && index >= 0 ? index : wb.getActive(); var i = asc_typeof(index) === "number" && index >= 0 ? index : wb.getActive();
var ws = this.wsViews[i]; var ws = this.wsViews[i];
...@@ -1460,7 +1497,7 @@ ...@@ -1460,7 +1497,7 @@
* @param [bLockDraw] * @param [bLockDraw]
* @returns {WorkbookView} * @returns {WorkbookView}
*/ */
WorkbookView.prototype.showWorksheet = function(index, isResized, bLockDraw) { WorkbookView.prototype.showWorksheet = function (index, isResized, bLockDraw) {
if (index === this.wsActive) { if (index === this.wsActive) {
return this; return this;
} }
...@@ -1471,33 +1508,28 @@ ...@@ -1471,33 +1508,28 @@
var ws = this.getWorksheet(); var ws = this.getWorksheet();
// Останавливаем ввод данных в редакторе ввода. Если в режиме ввода формул, то продолжаем работать с cellEditor'ом, чтобы можно было // Останавливаем ввод данных в редакторе ввода. Если в режиме ввода формул, то продолжаем работать с cellEditor'ом, чтобы можно было
// выбирать ячейки для формулы // выбирать ячейки для формулы
if (ws.getCellEditMode() && !(this.cellEditor && this.cellEditor.isFormula()) && !isResized) {
this._onStopCellEditing();
}
// Делаем очистку селекта
ws.cleanSelection();
this.stopTarget(ws);
} if (ws.getCellEditMode()){
if( this.cellEditor && this.cellEditor.formulaIsOperator() ){
// if( ws && ws.getCellEditMode() && this.cellEditor.isFormula() ){ this.copyActiveSheet = this.wsActive;
/*запоминаем лист, на котором был открыт редактор ячейки, для работы cellEditor в режиме ввода ячеек с другого листа*/ if( !this.cellFormulaEnterWSOpen )
if (this.cellEditor) { this.cellFormulaEnterWSOpen = tmpWorksheet = ws;
if (this.cellEditor.formulaIsOperator()) {
var _ws = this.getWorksheet();
if (!this.cellFormulaEnterWSOpen) {
this.cellFormulaEnterWSOpen = tmpWorksheet = _ws;
} else { } else {
this.cellEditor._showCanvas(); ws.setFormulaEditMode(false);
_ws.setFormulaEditMode(false);
} }
} else { }
if (this.getWorksheet().getCellEditMode() && !isResized) { else{
if (!isResized)
this._onStopCellEditing(); this._onStopCellEditing();
} }
} }
// Делаем очистку селекта
ws.cleanSelection();
this.stopTarget(ws);
} }
// }
if (c_oAscSelectionDialogType.Chart === this.selectionDialogType) { if (c_oAscSelectionDialogType.Chart === this.selectionDialogType) {
// Когда идет выбор диапазона, то должны на закрываемом листе отменить выбор диапазона // Когда идет выбор диапазона, то должны на закрываемом листе отменить выбор диапазона
...@@ -1527,7 +1559,21 @@ ...@@ -1527,7 +1559,21 @@
ws.changeZoom(true); ws.changeZoom(true);
} }
if (!bLockDraw) { if (this.cellEditor && this.cellFormulaEnterWSOpen ) {
if( ws.model.getId() == this.cellFormulaEnterWSOpen.model.getId() ){
this.cellFormulaEnterWSOpen.setFormulaEditMode( true );
this.cellEditor._showCanvas();
}
else if ( ws.getCellEditMode() && this.cellEditor.isFormula() ) {
this.cellFormulaEnterWSOpen.setFormulaEditMode( false );
/*скрываем cellEditor, в редактор добавляем %selected sheet name%+"!" */
this.cellEditor._hideCanvas();
ws.cleanSelection();
ws.setFormulaEditMode(true);
}
}
if (!bLockDraw)
ws.draw(); ws.draw();
} }
...@@ -1540,20 +1586,7 @@ ...@@ -1540,20 +1586,7 @@
ws.objectRender.controller.updateSelectionState(); ws.objectRender.controller.updateSelectionState();
ws.objectRender.controller.updateOverlay(); ws.objectRender.controller.updateOverlay();
} }
if (this.cellEditor) {
if (this.cellFormulaEnterWSOpen && ws.model.getId() == this.cellFormulaEnterWSOpen.model.getId()) {
this.cellFormulaEnterWSOpen = null;
this.cellEditor._showCanvas();
}
if (this.cellFormulaEnterWSOpen && this.cellFormulaEnterWSOpen.getCellEditMode() && this.cellEditor.isFormula() && ws.model.getId() != this.cellFormulaEnterWSOpen.model.getId()) {
/*скрываем cellEditor, в редактор добавляем %selected sheet name%+"!" */
this.cellFormulaEnterWSOpen.setFormulaEditMode(true);
this.cellEditor._hideCanvas();
ws.cleanSelection();
ws.setFormulaEditMode(true);
}
}
if (isSendInfo) { if (isSendInfo) {
this._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false)); this._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false));
...@@ -1572,7 +1605,7 @@ ...@@ -1572,7 +1605,7 @@
}; };
/** @param nIndex {Number} массив индексов */ /** @param nIndex {Number} массив индексов */
WorkbookView.prototype.removeWorksheet = function(nIndex) { WorkbookView.prototype.removeWorksheet = function (nIndex) {
this.stopTarget(null); this.stopTarget(null);
this.wsViews.splice(nIndex, 1); this.wsViews.splice(nIndex, 1);
// Сбрасываем активный (чтобы не досчитывать после смены) // Сбрасываем активный (чтобы не досчитывать после смены)
...@@ -1580,7 +1613,7 @@ ...@@ -1580,7 +1613,7 @@
}; };
// Меняет местами 2 элемента просмотра // Меняет местами 2 элемента просмотра
WorkbookView.prototype.replaceWorksheet = function(indexFrom, indexTo) { WorkbookView.prototype.replaceWorksheet = function (indexFrom, indexTo) {
// Только если есть активный // Только если есть активный
if (-1 !== this.wsActive) { if (-1 !== this.wsActive) {
var ws = this.getWorksheet(this.wsActive); var ws = this.getWorksheet(this.wsActive);
...@@ -1596,11 +1629,11 @@ ...@@ -1596,11 +1629,11 @@
// Чтобы поменять, нужно его добавить // Чтобы поменять, нужно его добавить
this.getWorksheet(indexTo); this.getWorksheet(indexTo);
} }
var movedSheet = this.wsViews.splice(indexFrom, 1); var movedSheet = this.wsViews.splice(indexFrom,1);
this.wsViews.splice(indexTo, 0, movedSheet[0]) this.wsViews.splice(indexTo,0,movedSheet[0])
}; };
WorkbookView.prototype.stopTarget = function(ws) { WorkbookView.prototype.stopTarget = function (ws) {
if (null === ws && -1 !== this.wsActive) { if (null === ws && -1 !== this.wsActive) {
ws = this.getWorksheet(this.wsActive); ws = this.getWorksheet(this.wsActive);
} }
...@@ -1610,7 +1643,7 @@ ...@@ -1610,7 +1643,7 @@
}; };
// Копирует элемент перед другим элементом // Копирует элемент перед другим элементом
WorkbookView.prototype.copyWorksheet = function(index, insertBefore) { WorkbookView.prototype.copyWorksheet = function (index, insertBefore) {
// Только если есть активный // Только если есть активный
if (-1 !== this.wsActive) { if (-1 !== this.wsActive) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
...@@ -1625,13 +1658,13 @@ ...@@ -1625,13 +1658,13 @@
this.wsActive = -1; this.wsActive = -1;
} }
if (null != insertBefore && insertBefore >= 0 && insertBefore < this.wsViews.length) { if (null != insertBefore && insertBefore >= 0 && insertBefore < this.wsViews.length){
// Помещаем нулевой элемент перед insertBefore // Помещаем нулевой элемент перед insertBefore
this.wsViews.splice(insertBefore, 0, null); this.wsViews.splice(insertBefore, 0, null);
} }
}; };
WorkbookView.prototype.updateWorksheetByModel = function() { WorkbookView.prototype.updateWorksheetByModel = function () {
// ToDo Сделал небольшую заглушку с показом листа. Нужно как мне кажется перейти от wsViews на wsViewsId (хранить по id) // ToDo Сделал небольшую заглушку с показом листа. Нужно как мне кажется перейти от wsViews на wsViewsId (хранить по id)
var oldActiveWs; var oldActiveWs;
if (-1 !== this.wsActive) { if (-1 !== this.wsActive) {
...@@ -1659,13 +1692,13 @@ ...@@ -1659,13 +1692,13 @@
} }
}; };
WorkbookView.prototype.spliceWorksheet = function() { WorkbookView.prototype.spliceWorksheet = function () {
this.stopTarget(null); this.stopTarget(null);
this.wsViews.splice.apply(this.wsViews, arguments); this.wsViews.splice.apply(this.wsViews, arguments);
this.wsActive = -1; this.wsActive = -1;
}; };
WorkbookView.prototype._canResize = function() { WorkbookView.prototype._canResize = function () {
var oldWidth = this.canvas.width; var oldWidth = this.canvas.width;
var oldHeight = this.canvas.height; var oldHeight = this.canvas.height;
var width = this.element.offsetWidth - (this.Api.isMobileVersion ? 0 : this.defaults.scroll.widthPx); var width = this.element.offsetWidth - (this.Api.isMobileVersion ? 0 : this.defaults.scroll.widthPx);
...@@ -1698,11 +1731,11 @@ ...@@ -1698,11 +1731,11 @@
}; };
/** @param event {jQuery.Event} */ /** @param event {jQuery.Event} */
WorkbookView.prototype.resize = function(event) { WorkbookView.prototype.resize = function (event) {
if (this._canResize()) { if (this._canResize()) {
var item; var item;
var activeIndex = this.model.getActive(); var activeIndex = this.model.getActive();
for (var i in this.wsViews) { for(var i in this.wsViews) {
item = this.wsViews[i]; item = this.wsViews[i];
// Делаем resize (для не активных сменим как только сделаем его активным) // Делаем resize (для не активных сменим как только сделаем его активным)
item.resize(/*isDraw*/i == activeIndex); item.resize(/*isDraw*/i == activeIndex);
...@@ -1718,25 +1751,25 @@ ...@@ -1718,25 +1751,25 @@
}; };
// Получаем свойство: редактируем мы сейчас или нет // Получаем свойство: редактируем мы сейчас или нет
WorkbookView.prototype.getCellEditMode = function() { WorkbookView.prototype.getCellEditMode = function () {
return this.controller.isCellEditMode; return this.controller.isCellEditMode;
}; };
WorkbookView.prototype.getIsTrackShape = function() { WorkbookView.prototype.getIsTrackShape = function(){
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if (!ws) { if(!ws){
return false; return false;
} }
if (ws.objectRender && ws.objectRender.controller) { if(ws.objectRender && ws.objectRender.controller){
return ws.objectRender.controller.checkTrackDrawings(); return ws.objectRender.controller.checkTrackDrawings();
} }
}; };
WorkbookView.prototype.getZoom = function() { WorkbookView.prototype.getZoom = function () {
return this.drawingCtx.getZoom(); return this.drawingCtx.getZoom();
}; };
WorkbookView.prototype.changeZoom = function(factor) { WorkbookView.prototype.changeZoom = function (factor) {
if (factor === this.getZoom()) { if (factor === this.getZoom()) {
return; return;
} }
...@@ -1752,7 +1785,7 @@ ...@@ -1752,7 +1785,7 @@
var item; var item;
var activeIndex = this.model.getActive(); var activeIndex = this.model.getActive();
for (i in this.wsViews) { for(i in this.wsViews) {
item = this.wsViews[i]; item = this.wsViews[i];
// Меняем zoom (для не активных сменим как только сделаем его активным) // Меняем zoom (для не активных сменим как только сделаем его активным)
item.changeZoom(/*isDraw*/i == activeIndex); item.changeZoom(/*isDraw*/i == activeIndex);
...@@ -1764,10 +1797,10 @@ ...@@ -1764,10 +1797,10 @@
} }
this.controller.reinitializeScroll(); this.controller.reinitializeScroll();
this.handlers.trigger("asc_onZoomChanged", this.getZoom()); this.handlers.trigger("asc_onZoomChanged",this.getZoom());
}; };
WorkbookView.prototype.enableKeyEventsHandler = function(f) { WorkbookView.prototype.enableKeyEventsHandler = function (f) {
this.controller.enableKeyEventsHandler(f); this.controller.enableKeyEventsHandler(f);
if (this.cellEditor) { if (this.cellEditor) {
this.cellEditor.enableKeyEventsHandler(f); this.cellEditor.enableKeyEventsHandler(f);
...@@ -1775,7 +1808,7 @@ ...@@ -1775,7 +1808,7 @@
}; };
// Останавливаем ввод данных в редакторе ввода // Останавливаем ввод данных в редакторе ввода
WorkbookView.prototype.closeCellEditor = function() { WorkbookView.prototype.closeCellEditor = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
// Останавливаем ввод данных в редакторе ввода // Останавливаем ввод данных в редакторе ввода
if (ws.getCellEditMode() && !this.cellEditor.formulaIsOperator() /*&& !this.cellFormulaEnterWSOpen*/) { if (ws.getCellEditMode() && !this.cellEditor.formulaIsOperator() /*&& !this.cellFormulaEnterWSOpen*/) {
...@@ -1925,7 +1958,7 @@ ...@@ -1925,7 +1958,7 @@
} }
}; };
WorkbookView.prototype.copyToClipboard = function() { WorkbookView.prototype.copyToClipboard = function () {
var t = this, ws, v; var t = this, ws, v;
if (!t.controller.isCellEditMode) { if (!t.controller.isCellEditMode) {
ws = t.getWorksheet(); ws = t.getWorksheet();
...@@ -1938,7 +1971,7 @@ ...@@ -1938,7 +1971,7 @@
} }
}; };
WorkbookView.prototype.copyToClipboardButton = function() { WorkbookView.prototype.copyToClipboardButton = function () {
var t = this, ws, v; var t = this, ws, v;
if (!t.controller.isCellEditMode) { if (!t.controller.isCellEditMode) {
ws = t.getWorksheet(); ws = t.getWorksheet();
...@@ -1953,31 +1986,31 @@ ...@@ -1953,31 +1986,31 @@
} }
}; };
WorkbookView.prototype.pasteFromClipboard = function() { WorkbookView.prototype.pasteFromClipboard = function () {
var t = this; var t = this;
if (!t.controller.isCellEditMode) { if (!t.controller.isCellEditMode) {
var ws = t.getWorksheet(); var ws = t.getWorksheet();
t.clipboard.pasteRange(ws); t.clipboard.pasteRange(ws);
} else { } else {
t.clipboard.pasteAsText(function(text) { t.clipboard.pasteAsText(function (text) {
t.cellEditor.pasteText(text); t.cellEditor.pasteText(text);
}); });
} }
}; };
WorkbookView.prototype.pasteFromClipboardButton = function() { WorkbookView.prototype.pasteFromClipboardButton = function () {
var t = this; var t = this;
if (!t.controller.isCellEditMode) { if (!t.controller.isCellEditMode) {
var ws = t.getWorksheet(); var ws = t.getWorksheet();
return t.clipboard.pasteRangeButton(ws); return t.clipboard.pasteRangeButton(ws);
} else { } else {
return t.clipboard.pasteAsTextButton(function(text) { return t.clipboard.pasteAsTextButton(function (text) {
t.cellEditor.pasteText(text); t.cellEditor.pasteText(text);
}); });
} }
}; };
WorkbookView.prototype.cutToClipboard = function() { WorkbookView.prototype.cutToClipboard = function () {
var t = this, ws, v; var t = this, ws, v;
if (!t.controller.isCellEditMode && !window.USER_AGENT_SAFARI_MACOS) { if (!t.controller.isCellEditMode && !window.USER_AGENT_SAFARI_MACOS) {
ws = t.getWorksheet(); ws = t.getWorksheet();
...@@ -1988,7 +2021,7 @@ ...@@ -1988,7 +2021,7 @@
t.clipboard.copyRange(ws.getSelectedRange(), ws, true); t.clipboard.copyRange(ws.getSelectedRange(), ws, true);
ws.emptySelection(c_oAscCleanOptions.All); ws.emptySelection(c_oAscCleanOptions.All);
} else if (!window.USER_AGENT_SAFARI_MACOS) { } else if(!window.USER_AGENT_SAFARI_MACOS){
v = t.cellEditor.cutSelection(); v = t.cellEditor.cutSelection();
if (v) { if (v) {
t.clipboard.copyCellValue(v); t.clipboard.copyCellValue(v);
...@@ -1996,11 +2029,11 @@ ...@@ -1996,11 +2029,11 @@
} }
}; };
WorkbookView.prototype.bIsEmptyClipboard = function() { WorkbookView.prototype.bIsEmptyClipboard = function () {
return this.clipboard.bIsEmptyClipboard(this.controller.isCellEditMode); return this.clipboard.bIsEmptyClipboard(this.controller.isCellEditMode);
}; };
WorkbookView.prototype.cutToClipboardButton = function() { WorkbookView.prototype.cutToClipboardButton = function () {
var t = this, ws, v; var t = this, ws, v;
if (!t.controller.isCellEditMode) { if (!t.controller.isCellEditMode) {
ws = t.getWorksheet(); ws = t.getWorksheet();
...@@ -2019,7 +2052,7 @@ ...@@ -2019,7 +2052,7 @@
} }
}; };
WorkbookView.prototype.undo = function() { WorkbookView.prototype.undo = function () {
if (!this.controller.isCellEditMode) { if (!this.controller.isCellEditMode) {
if (!History.Undo() && this.collaborativeEditing.getFast() && this.collaborativeEditing.getCollaborativeEditing()) { if (!History.Undo() && this.collaborativeEditing.getFast() && this.collaborativeEditing.getCollaborativeEditing()) {
this.Api.sync_TryUndoInFastCollaborative(); this.Api.sync_TryUndoInFastCollaborative();
...@@ -2029,7 +2062,7 @@ ...@@ -2029,7 +2062,7 @@
} }
}; };
WorkbookView.prototype.redo = function() { WorkbookView.prototype.redo = function () {
if (!this.controller.isCellEditMode) { if (!this.controller.isCellEditMode) {
History.Redo(); History.Redo();
} else { } else {
...@@ -2037,7 +2070,7 @@ ...@@ -2037,7 +2070,7 @@
} }
}; };
WorkbookView.prototype.setFontAttributes = function(prop, val) { WorkbookView.prototype.setFontAttributes = function (prop, val) {
if (!this.controller.isCellEditMode) { if (!this.controller.isCellEditMode) {
this.getWorksheet().setSelectionInfo(prop, val); this.getWorksheet().setSelectionInfo(prop, val);
} else { } else {
...@@ -2045,7 +2078,7 @@ ...@@ -2045,7 +2078,7 @@
} }
}; };
WorkbookView.prototype.changeFontSize = function(prop, val) { WorkbookView.prototype.changeFontSize = function (prop, val) {
if (!this.controller.isCellEditMode) { if (!this.controller.isCellEditMode) {
this.getWorksheet().setSelectionInfo(prop, val); this.getWorksheet().setSelectionInfo(prop, val);
} else { } else {
...@@ -2053,7 +2086,7 @@ ...@@ -2053,7 +2086,7 @@
} }
}; };
WorkbookView.prototype.emptyCells = function(options) { WorkbookView.prototype.emptyCells = function (options) {
if (!this.controller.isCellEditMode) { if (!this.controller.isCellEditMode) {
this.getWorksheet().emptySelection(options); this.getWorksheet().emptySelection(options);
this.restoreFocus(); this.restoreFocus();
...@@ -2062,7 +2095,7 @@ ...@@ -2062,7 +2095,7 @@
} }
}; };
WorkbookView.prototype.setSelectionDialogMode = function(selectionDialogType, selectRange) { WorkbookView.prototype.setSelectionDialogMode = function (selectionDialogType, selectRange) {
if (selectionDialogType === this.selectionDialogType) { if (selectionDialogType === this.selectionDialogType) {
return; return;
} }
...@@ -2110,13 +2143,13 @@ ...@@ -2110,13 +2143,13 @@
} }
}; };
WorkbookView.prototype._cleanFindResults = function() { WorkbookView.prototype._cleanFindResults = function () {
this.lastFindOptions = null; this.lastFindOptions = null;
this.lastFindResults = {}; this.lastFindResults = {};
}; };
// Поиск текста в листе // Поиск текста в листе
WorkbookView.prototype.findCellText = function(options) { WorkbookView.prototype.findCellText = function (options) {
// Для поиска эта переменная не нужна (но она может остаться от replace) // Для поиска эта переменная не нужна (но она может остаться от replace)
options.activeRange = null; options.activeRange = null;
...@@ -2166,7 +2199,7 @@ ...@@ -2166,7 +2199,7 @@
result = tmpResult; result = tmpResult;
this.showWorksheet(i); this.showWorksheet(i);
// Посылаем эвент о смене активного листа // Посылаем эвент о смене активного листа
this.handlers.trigger("asc_onActiveSheetChanged", i); this.handlers.trigger ("asc_onActiveSheetChanged", i);
key = result.c1 + "-" + result.r1; key = result.c1 + "-" + result.r1;
} }
...@@ -2187,7 +2220,7 @@ ...@@ -2187,7 +2220,7 @@
}; };
// Замена текста в листе // Замена текста в листе
WorkbookView.prototype.replaceCellText = function(options) { WorkbookView.prototype.replaceCellText = function (options) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
// Останавливаем ввод данных в редакторе ввода // Останавливаем ввод данных в редакторе ввода
if (ws.getCellEditMode()) { if (ws.getCellEditMode()) {
...@@ -2205,7 +2238,7 @@ ...@@ -2205,7 +2238,7 @@
ws.replaceCellText(options, false, this.fReplaceCallback); ws.replaceCellText(options, false, this.fReplaceCallback);
}; };
WorkbookView.prototype._replaceCellTextCallback = function(options) { WorkbookView.prototype._replaceCellTextCallback = function (options) {
options.updateFindAll(); options.updateFindAll();
if (!options.scanOnOnlySheet && options.isReplaceAll) { if (!options.scanOnOnlySheet && options.isReplaceAll) {
// Замена на всей книге // Замена на всей книге
...@@ -2231,7 +2264,7 @@ ...@@ -2231,7 +2264,7 @@
}; };
// Поиск ячейки по ссылке // Поиск ячейки по ссылке
WorkbookView.prototype.findCell = function(reference) { WorkbookView.prototype.findCell = function (reference) {
var ws = this.getWorksheet(), retRange; var ws = this.getWorksheet(), retRange;
// Останавливаем ввод данных в редакторе ввода // Останавливаем ввод данных в редакторе ввода
if (ws.getCellEditMode()) { if (ws.getCellEditMode()) {
...@@ -2242,25 +2275,25 @@ ...@@ -2242,25 +2275,25 @@
return ws.findCell(reference); return ws.findCell(reference);
}; };
WorkbookView.prototype.getDefinedNames = function(defNameListId) { WorkbookView.prototype.getDefinedNames = function (defNameListId) {
return this.model.getDefinedNamesWB(defNameListId); return this.model.getDefinedNamesWB(defNameListId);
}; };
WorkbookView.prototype.setDefinedNames = function(defName) { WorkbookView.prototype.setDefinedNames = function (defName) {
//ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel. //ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel.
this.model.setDefinesNames(defName.Name, defName.Ref, defName.Scope); this.model.setDefinesNames(defName.Name,defName.Ref,defName.Scope);
this.handlers.trigger("asc_onDefName"); this.handlers.trigger("asc_onDefName");
}; };
WorkbookView.prototype.checkDefName = function(checkName, scope) { WorkbookView.prototype.checkDefName = function (checkName,scope) {
return this.model.checkDefName(checkName, scope); return this.model.checkDefName(checkName,scope);
}; };
WorkbookView.prototype.editDefinedNames = function(oldName, newName) { WorkbookView.prototype.editDefinedNames = function (oldName, newName) {
//ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel. //ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel.
if (this.collaborativeEditing.getGlobalLock()) { if (this.collaborativeEditing.getGlobalLock()) {
return; return;
...@@ -2268,18 +2301,18 @@ ...@@ -2268,18 +2301,18 @@
var ws = this.getWorksheet(), t = this; var ws = this.getWorksheet(), t = this;
var editDefinedNamesCallback = function(res) { var editDefinedNamesCallback = function (res) {
if (res) { if (res) {
t.model.editDefinesNames(oldName, newName); t.model.editDefinesNames(oldName, newName);
t.handlers.trigger("asc_onEditDefName", oldName, newName); t.handlers.trigger("asc_onEditDefName", oldName, newName);
t.handlers.trigger("asc_onRefreshDefNameList"); t.handlers.trigger("asc_onRefreshDefNameList");
} else { } else {
t.handlers.trigger("asc_onError", c_oAscError.ID.LockCreateDefName, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError",c_oAscError.ID.LockCreateDefName,c_oAscError.Level.NoCritical);
} }
t._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false)); t._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false));
}; };
var defNameId; var defNameId;
if (oldName) { if( oldName ){
defNameId = t.model.getDefinedName(oldName); defNameId = t.model.getDefinedName(oldName);
defNameId = defNameId ? defNameId.nodeId : null; defNameId = defNameId ? defNameId.nodeId : null;
} }
...@@ -2288,7 +2321,7 @@ ...@@ -2288,7 +2321,7 @@
}; };
WorkbookView.prototype.delDefinedNames = function(oldName) { WorkbookView.prototype.delDefinedNames = function (oldName) {
//ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel. //ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel.
if (this.collaborativeEditing.getGlobalLock()) { if (this.collaborativeEditing.getGlobalLock()) {
return; return;
...@@ -2296,14 +2329,14 @@ ...@@ -2296,14 +2329,14 @@
var ws = this.getWorksheet(), t = this var ws = this.getWorksheet(), t = this
if (oldName) { if( oldName ){
var delDefinedNamesCallback = function(res) { var delDefinedNamesCallback = function (res) {
if (res) { if (res) {
t.handlers.trigger("asc_onDelDefName", t.model.delDefinesNames(oldName)); t.handlers.trigger("asc_onDelDefName", t.model.delDefinesNames(oldName));
t.handlers.trigger("asc_onRefreshDefNameList"); t.handlers.trigger("asc_onRefreshDefNameList");
} else { } else {
t.handlers.trigger("asc_onError", c_oAscError.ID.LockCreateDefName, c_oAscError.Level.NoCritical); t.handlers.trigger("asc_onError",c_oAscError.ID.LockCreateDefName,c_oAscError.Level.NoCritical);
} }
t._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false)); t._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false));
}; };
...@@ -2315,26 +2348,26 @@ ...@@ -2315,26 +2348,26 @@
}; };
WorkbookView.prototype.getDefaultDefinedName = function() { WorkbookView.prototype.getDefaultDefinedName = function () {
//ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel. //ToDo проверка defName.ref на знак "=" в начале ссылки. знака нет тогда это либо число либо строка, так делает Excel.
var ws = this.getWorksheet(); var ws = this.getWorksheet();
return new Asc.asc_CDefName("", ws.getSelectionRangeValue(), null); return new Asc.asc_CDefName( "", ws.getSelectionRangeValue(), null );
}; };
WorkbookView.prototype.unlockDefName = function() { WorkbookView.prototype.unlockDefName = function () {
this.model.unlockDefName(); this.model.unlockDefName();
this.handlers.trigger("asc_onRefreshDefNameList"); this.handlers.trigger("asc_onRefreshDefNameList");
this.handlers.trigger("asc_onLockDefNameManager", c_oAscDefinedNameReason.OK); this.handlers.trigger("asc_onLockDefNameManager",c_oAscDefinedNameReason.OK);
}; };
WorkbookView.prototype._onCheckDefNameLock = function() { WorkbookView.prototype._onCheckDefNameLock = function () {
return this.model.checkDefNameLock(); return this.model.checkDefNameLock();
}; };
// Печать // Печать
WorkbookView.prototype.printSheet = function(pdf_writer, printPagesData) { WorkbookView.prototype.printSheet = function (pdf_writer, printPagesData) {
var ws; var ws;
// Закончили печать или нет // Закончили печать или нет
var isEndPrint = false; var isEndPrint = false;
...@@ -2360,7 +2393,7 @@ ...@@ -2360,7 +2393,7 @@
return isEndPrint; return isEndPrint;
}; };
WorkbookView.prototype.calcPagesPrint = function(adjustPrint) { WorkbookView.prototype.calcPagesPrint = function (adjustPrint) {
var ws = null; var ws = null;
var wb = this.model; var wb = this.model;
var activeWs; var activeWs;
...@@ -2398,13 +2431,13 @@ ...@@ -2398,13 +2431,13 @@
// Вызывать только для нативной печати // Вызывать только для нативной печати
WorkbookView.prototype._nativeCalculate = function() { WorkbookView.prototype._nativeCalculate = function() {
var item; var item;
for (var i in this.wsViews) { for(var i in this.wsViews) {
item = this.wsViews[i]; item = this.wsViews[i];
item._prepareDrawingObjects(); item._prepareDrawingObjects();
} }
}; };
WorkbookView.prototype._initCommentsToSave = function() { WorkbookView.prototype._initCommentsToSave = function () {
var isFirst = true; var isFirst = true;
for (var wsKey in this.wsViews) { for (var wsKey in this.wsViews) {
var wsView = this.wsViews[wsKey]; var wsView = this.wsViews[wsKey];
...@@ -2425,23 +2458,23 @@ ...@@ -2425,23 +2458,23 @@
} }
}; };
WorkbookView.prototype.reInit = function() { WorkbookView.prototype.reInit = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws._initCellsArea(/*fullRecalc*/true); ws._initCellsArea(/*fullRecalc*/true);
ws._updateVisibleColsCount(); ws._updateVisibleColsCount();
ws._updateVisibleRowsCount(); ws._updateVisibleRowsCount();
}; };
WorkbookView.prototype.drawWS = function() { WorkbookView.prototype.drawWS = function (){
this.getWorksheet().draw(); this.getWorksheet().draw();
}; };
WorkbookView.prototype.onShowDrawingObjects = function(clearCanvas) { WorkbookView.prototype.onShowDrawingObjects = function (clearCanvas) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
ws.objectRender.showDrawingObjects(clearCanvas); ws.objectRender.showDrawingObjects(clearCanvas);
}; };
WorkbookView.prototype.insertHyperlink = function(options) { WorkbookView.prototype.insertHyperlink = function (options) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if (ws.objectRender.selectedGraphicObjectsExists()) { if ( ws.objectRender.selectedGraphicObjectsExists() ) {
if (ws.objectRender.controller.canAddHyperlink()) { if (ws.objectRender.controller.canAddHyperlink()) {
ws.objectRender.controller.insertHyperlink(options); ws.objectRender.controller.insertHyperlink(options);
} }
...@@ -2452,7 +2485,7 @@ ...@@ -2452,7 +2485,7 @@
this.restoreFocus(); this.restoreFocus();
} }
}; };
WorkbookView.prototype.removeHyperlink = function() { WorkbookView.prototype.removeHyperlink = function () {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if (ws.objectRender.selectedGraphicObjectsExists()) { if (ws.objectRender.selectedGraphicObjectsExists()) {
ws.objectRender.controller.removeHyperlink(); ws.objectRender.controller.removeHyperlink();
...@@ -2461,7 +2494,7 @@ ...@@ -2461,7 +2494,7 @@
} }
}; };
WorkbookView.prototype.setDocumentPlaceChangedEnabled = function(val) { WorkbookView.prototype.setDocumentPlaceChangedEnabled = function (val) {
this.isDocumentPlaceChangedEnabled = val; this.isDocumentPlaceChangedEnabled = val;
}; };
...@@ -2469,7 +2502,7 @@ ...@@ -2469,7 +2502,7 @@
* @param {c_oAscRenderingModeType} mode Режим отрисовки * @param {c_oAscRenderingModeType} mode Режим отрисовки
* @param {Boolean} isInit инициализация или нет * @param {Boolean} isInit инициализация или нет
*/ */
WorkbookView.prototype.setFontRenderingMode = function(mode, isInit) { WorkbookView.prototype.setFontRenderingMode = function (mode, isInit) {
var ws; var ws;
if (mode !== this.fontRenderingMode) { if (mode !== this.fontRenderingMode) {
this.fontRenderingMode = mode; this.fontRenderingMode = mode;
...@@ -2489,14 +2522,14 @@ ...@@ -2489,14 +2522,14 @@
} }
}; };
WorkbookView.prototype.initFormulasList = function() { WorkbookView.prototype.initFormulasList = function () {
this.formulasList = []; this.formulasList = [];
var oFormulaList = cFormulaFunctionLocalized ? cFormulaFunctionLocalized : cFormulaFunction; var oFormulaList = cFormulaFunctionLocalized ? cFormulaFunctionLocalized : cFormulaFunction;
for (var f in oFormulaList) for (var f in oFormulaList)
this.formulasList.push(f); this.formulasList.push(f);
}; };
WorkbookView.prototype._setHintsProps = function(bIsHinting, bIsSubpixHinting) { WorkbookView.prototype._setHintsProps = function (bIsHinting, bIsSubpixHinting) {
var manager, hintProps; var manager, hintProps;
for (var i = 0, length = this.fmgrGraphics.length; i < length; ++i) { for (var i = 0, length = this.fmgrGraphics.length; i < length; ++i) {
manager = this.fmgrGraphics[i]; manager = this.fmgrGraphics[i];
...@@ -2531,7 +2564,7 @@ ...@@ -2531,7 +2564,7 @@
} }
}; };
WorkbookView.prototype._calcMaxDigitWidth = function() { WorkbookView.prototype._calcMaxDigitWidth = function () {
// set default worksheet header font for calculations // set default worksheet header font for calculations
this.buffers.main.setFont(this.defaultFont); this.buffers.main.setFont(this.defaultFont);
// Измеряем в pt // Измеряем в pt
......
...@@ -340,7 +340,7 @@ ...@@ -340,7 +340,7 @@
this.nColsCount = 0; this.nColsCount = 0;
// Массив ячеек для текущей формулы // Массив ячеек для текущей формулы
this.arrActiveFormulaRanges = []; this.arrActiveFormulaRanges = [];
this.arrActiveFormulaRangesPosition = 0; this.arrActiveFormulaRangesPosition = -1;
this.arrActiveChartsRanges = []; this.arrActiveChartsRanges = [];
//------------------------ //------------------------
...@@ -11614,7 +11614,7 @@ ...@@ -11614,7 +11614,7 @@
}; };
WorksheetView.prototype.activeFormulaRange = function ( range ) { WorksheetView.prototype.activeFormulaRange = function ( range ) {
this.arrActiveFormulaRangesPosition = 0; this.arrActiveFormulaRangesPosition = -1;
for ( var i = 0; i < this.arrActiveFormulaRanges.length; ++i ) { for ( var i = 0; i < this.arrActiveFormulaRanges.length; ++i ) {
if ( this.arrActiveFormulaRanges[i].isEqual( range ) ) { if ( this.arrActiveFormulaRanges[i].isEqual( range ) ) {
this.arrActiveFormulaRangesPosition = i; this.arrActiveFormulaRangesPosition = i;
......
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