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