Commit 98b73c4e authored by Alexander.Trofimov's avatar Alexander.Trofimov

Поправил баг http://bugzserver/show_bug.cgi?id=25316

Можем выбирать данные для диаграммы с другого листа

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57463 954022d7-b5bf-4e40-9824-e11837661b57
parent bbfb02f9
...@@ -519,8 +519,7 @@ parserHelper.prototype.parse3DRef = function ( formula ) { ...@@ -519,8 +519,7 @@ parserHelper.prototype.parse3DRef = function ( formula ) {
return {sheet:sheetName, range:this.operand_str}; return {sheet:sheetName, range:this.operand_str};
else else
return null; return null;
} } else if ( this.isRef( formula, indexStartRange ) ) {
else if ( this.isRef( formula, indexStartRange ) ) {
if ( this.operand_str.length == formula.substring( indexStartRange ).length ) if ( this.operand_str.length == formula.substring( indexStartRange ).length )
return {sheet:sheetName, range:this.operand_str}; return {sheet:sheetName, range:this.operand_str};
else else
......
...@@ -126,6 +126,9 @@ ...@@ -126,6 +126,9 @@
this.overlayGraphicCtx = undefined; this.overlayGraphicCtx = undefined;
this.stringRender = undefined; this.stringRender = undefined;
this.selectionDialogType = c_oAscSelectionDialogType.None;
this.copyActiveSheet = -1;
// Комментарии для всего документа // Комментарии для всего документа
this.cellCommentator = null; this.cellCommentator = null;
...@@ -1194,6 +1197,14 @@ ...@@ -1194,6 +1197,14 @@
} }
} }
var tmpWorksheet, selectionRange = null;
if (c_oAscSelectionDialogType.Chart === this.selectionDialogType) {
// Когда идет выбор диапазона, то должны на закрываемом листе отменить выбор диапазона
tmpWorksheet = this.getWorksheet();
selectionRange = tmpWorksheet.activeRange.clone(true);
tmpWorksheet.setSelectionDialogMode(c_oAscSelectionDialogType.None);
}
var wb = this.model; var wb = this.model;
if (asc_typeof(index) === "number" && index >= 0) { if (asc_typeof(index) === "number" && index >= 0) {
if (index !== wb.getActive()) {wb.setActive(index);} if (index !== wb.getActive()) {wb.setActive(index);}
...@@ -1212,6 +1223,12 @@ ...@@ -1212,6 +1223,12 @@
ws.changeZoom(true); ws.changeZoom(true);
ws.draw(); ws.draw();
if (c_oAscSelectionDialogType.Chart === this.selectionDialogType) {
// Когда идет выбор диапазона, то на позываемом листе должны выставить нужный режим
ws.setSelectionDialogMode(this.selectionDialogType, selectionRange);
this.handlers.trigger("asc_onSelectionRangeChanged", ws.getSelectionRangeValue());
}
ws.objectRender.OnUpdateOverlay(); ws.objectRender.OnUpdateOverlay();
if (isSendInfo) { if (isSendInfo) {
this._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false)); this._onSelectionNameChanged(ws.getSelectionName(/*bRangeText*/false));
...@@ -1671,7 +1688,48 @@ ...@@ -1671,7 +1688,48 @@
}; };
WorkbookView.prototype.setSelectionDialogMode = function (selectionDialogType, selectRange) { WorkbookView.prototype.setSelectionDialogMode = function (selectionDialogType, selectRange) {
this.getWorksheet().setSelectionDialogMode(selectionDialogType, selectRange); if (selectionDialogType === this.selectionDialogType)
return;
if (c_oAscSelectionDialogType.None === selectionDialogType) {
this.selectionDialogType = selectionDialogType;
this.getWorksheet().setSelectionDialogMode(selectionDialogType, selectRange);
if (this.copyActiveSheet !== this.wsActive) {
this.showWorksheet(this.copyActiveSheet);
// Посылаем эвент о смене активного листа
this.handlers.trigger("asc_onActiveSheetChanged", this.copyActiveSheet);
}
this.copyActiveSheet = -1;
} else {
this.copyActiveSheet = this.wsActive;
var index, tmpSelectRange = parserHelp.parse3DRef(selectRange);
if (tmpSelectRange) {
if (c_oAscSelectionDialogType.Chart === selectionDialogType) {
// Получаем sheet по имени
var ws = this.model.getWorksheetByName(tmpSelectRange.sheet);
if (!ws || ws.getHidden())
tmpSelectRange = null;
else {
index = ws.getIndex();
this.showWorksheet(index);
// Посылаем эвент о смене активного листа
this.handlers.trigger("asc_onActiveSheetChanged", index);
tmpSelectRange = tmpSelectRange.range;
}
}
else
tmpSelectRange = tmpSelectRange.range;
} else {
// Это не 3D ссылка
tmpSelectRange = selectRange;
}
this.getWorksheet().setSelectionDialogMode(selectionDialogType, tmpSelectRange);
// Нужно выставить после, т.к. при смене листа не должны проставлять режим
this.selectionDialogType = selectionDialogType;
}
}; };
WorkbookView.prototype._cleanFindResults = function () { WorkbookView.prototype._cleanFindResults = function () {
......
...@@ -432,7 +432,7 @@ ...@@ -432,7 +432,7 @@
this.selectionDialogType = c_oAscSelectionDialogType.None; this.selectionDialogType = c_oAscSelectionDialogType.None;
this.isSelectionDialogMode = false; this.isSelectionDialogMode = false;
this.copyOfActiveRange = null; this.copyActiveRange = null;
this.startCellMoveResizeRange = null; this.startCellMoveResizeRange = null;
this.startCellMoveResizeRange2 = null; this.startCellMoveResizeRange2 = null;
...@@ -3446,7 +3446,7 @@ ...@@ -3446,7 +3446,7 @@
if (!this.isSelectionDialogMode) if (!this.isSelectionDialogMode)
range = this.activeRange.intersection(range !== undefined ? range : this.visibleRange); range = this.activeRange.intersection(range !== undefined ? range : this.visibleRange);
else else
range = this.copyOfActiveRange.intersection(range !== undefined ? range : this.visibleRange); range = this.copyActiveRange.intersection(range !== undefined ? range : this.visibleRange);
// Copy fill Handle // Copy fill Handle
var aFH = null; var aFH = null;
...@@ -3483,7 +3483,7 @@ ...@@ -3483,7 +3483,7 @@
offsetY = this.rows[this.visibleRange.r1].top - this.cellsTop - diffHeight; offsetY = this.rows[this.visibleRange.r1].top - this.cellsTop - diffHeight;
} }
var arn = (!this.isSelectionDialogMode) ? this.activeRange.clone(true) : this.copyOfActiveRange.clone(true); var arn = (!this.isSelectionDialogMode) ? this.activeRange.clone(true) : this.copyActiveRange.clone(true);
var x1 = (range) ? (this.cols[range.c1].left - offsetX - this.width_1px) : 0; var x1 = (range) ? (this.cols[range.c1].left - offsetX - this.width_1px) : 0;
var x2 = (range) ? (this.cols[range.c2].left + this.cols[range.c2].width - offsetX - this.width_1px) : 0; var x2 = (range) ? (this.cols[range.c2].left + this.cols[range.c2].width - offsetX - this.width_1px) : 0;
var y1 = (range) ? (this.rows[range.r1].top - offsetY) : 0; var y1 = (range) ? (this.rows[range.r1].top - offsetY) : 0;
...@@ -3609,7 +3609,7 @@ ...@@ -3609,7 +3609,7 @@
ctx.setFillStyle( opt.activeCellBackground ) ctx.setFillStyle( opt.activeCellBackground )
.fillRect(lRect, tRect, rRect - lRect, bRect - tRect); .fillRect(lRect, tRect, rRect - lRect, bRect - tRect);
var firstCell = (!this.isSelectionDialogMode) ? this.activeRange : this.copyOfActiveRange; var firstCell = (!this.isSelectionDialogMode) ? this.activeRange : this.copyActiveRange;
cr = this.model.getMergedByCell(firstCell.startRow, firstCell.startCol); cr = this.model.getMergedByCell(firstCell.startRow, firstCell.startCol);
// Получаем активную ячейку в выделении // Получаем активную ячейку в выделении
cr = range.intersection(null !== cr ? cr : asc_Range(firstCell.startCol, firstCell.startRow, firstCell.startCol, firstCell.startRow)); cr = range.intersection(null !== cr ? cr : asc_Range(firstCell.startCol, firstCell.startRow, firstCell.startCol, firstCell.startRow));
...@@ -3717,7 +3717,7 @@ ...@@ -3717,7 +3717,7 @@
WorksheetView.prototype._drawFormatPainterRange = function () { WorksheetView.prototype._drawFormatPainterRange = function () {
var lineWidth = 1, isDashLine = true, strokeColor = new CColor(0, 0, 0); var lineWidth = 1, isDashLine = true, strokeColor = new CColor(0, 0, 0);
this._drawElements(this, this._drawSelectionElement, this.copyOfActiveRange, isDashLine, lineWidth, strokeColor); this._drawElements(this, this._drawSelectionElement, this.copyActiveRange, isDashLine, lineWidth, strokeColor);
}; };
WorksheetView.prototype._drawFormulaRanges = function (arrRanges){ WorksheetView.prototype._drawFormulaRanges = function (arrRanges){
...@@ -4000,12 +4000,12 @@ ...@@ -4000,12 +4000,12 @@
y2 = Math.max(y2, yMR2); y2 = Math.max(y2, yMR2);
} }
if (null !== this.copyOfActiveRange) { if (null !== this.copyActiveRange) {
// Координаты для перемещения диапазона // Координаты для перемещения диапазона
var xCopyAr1 = this.cols[this.copyOfActiveRange.c1].left - offsetX - this.width_2px; var xCopyAr1 = this.cols[this.copyActiveRange.c1].left - offsetX - this.width_2px;
var xCopyAr2 = this.cols[this.copyOfActiveRange.c2].left + this.cols[this.copyOfActiveRange.c2].width - offsetX + this.width_1px + this.width_2px; var xCopyAr2 = this.cols[this.copyActiveRange.c2].left + this.cols[this.copyActiveRange.c2].width - offsetX + this.width_1px + this.width_2px;
var yCopyAr1 = this.rows[this.copyOfActiveRange.r1].top - offsetY - this.height_2px; var yCopyAr1 = this.rows[this.copyActiveRange.r1].top - offsetY - this.height_2px;
var yCopyAr2 = this.rows[this.copyOfActiveRange.r2].top + this.rows[this.copyOfActiveRange.r2].height - offsetY + this.height_1px + this.height_2px; var yCopyAr2 = this.rows[this.copyActiveRange.r2].top + this.rows[this.copyActiveRange.r2].height - offsetY + this.height_1px + this.height_2px;
// Выбираем наибольший range для очистки // Выбираем наибольший range для очистки
x1 = Math.min(x1, xCopyAr1); x1 = Math.min(x1, xCopyAr1);
...@@ -6959,7 +6959,7 @@ ...@@ -6959,7 +6959,7 @@
WorksheetView.prototype.applyFormatPainter = function () { WorksheetView.prototype.applyFormatPainter = function () {
var t = this; var t = this;
var from = t.copyOfActiveRange.getAllRange(), to = t.activeRange.getAllRange(); var from = t.copyActiveRange.getAllRange(), to = t.activeRange.getAllRange();
var onApplyFormatPainterCallback = function (isSuccess) { var onApplyFormatPainterCallback = function (isSuccess) {
// Очищаем выделение // Очищаем выделение
...@@ -6985,11 +6985,11 @@ ...@@ -6985,11 +6985,11 @@
c_oAscFormatPainterState.kOn); c_oAscFormatPainterState.kOn);
if (this.stateFormatPainter) { if (this.stateFormatPainter) {
this.copyOfActiveRange = this.activeRange.clone(true); this.copyActiveRange = this.activeRange.clone(true);
this._drawFormatPainterRange(); this._drawFormatPainterRange();
} else { } else {
this.cleanSelection(); this.cleanSelection();
this.copyOfActiveRange = null; this.copyActiveRange = null;
this._drawSelection(); this._drawSelection();
this.handlers.trigger("onStopFormatPainter"); this.handlers.trigger("onStopFormatPainter");
} }
...@@ -10257,10 +10257,6 @@ ...@@ -10257,10 +10257,6 @@
this.isFormulaEditMode = isFormulaEditMode; this.isFormulaEditMode = isFormulaEditMode;
}; };
WorksheetView.prototype.getFormulaEditMode = function () {
return this.isFormulaEditMode;
};
WorksheetView.prototype.setSelectionDialogMode = function (selectionDialogType, selectRange) { WorksheetView.prototype.setSelectionDialogMode = function (selectionDialogType, selectRange) {
if (selectionDialogType === this.selectionDialogType) if (selectionDialogType === this.selectionDialogType)
return; return;
...@@ -10269,26 +10265,20 @@ ...@@ -10269,26 +10265,20 @@
this.cleanSelection(); this.cleanSelection();
if (false === this.isSelectionDialogMode) { if (false === this.isSelectionDialogMode) {
if (null !== this.copyOfActiveRange) { if (null !== this.copyActiveRange)
this.activeRange = this.copyOfActiveRange.clone(true); this.activeRange = this.copyActiveRange.clone(true);
} this.copyActiveRange = null;
this.copyOfActiveRange = null;
} else { } else {
this.copyOfActiveRange = this.activeRange.clone(true); this.copyActiveRange = this.activeRange.clone(true);
if (selectRange) { if (selectRange) {
var tmpSelectRange = parserHelp.parse3DRef(selectRange); if (typeof selectRange === 'string') {
if (tmpSelectRange) { selectRange = this.model.getRange2(selectRange);
// ToDo стоит менять и лист для диаграмм if (selectRange)
tmpSelectRange = this.model.getRange2(tmpSelectRange.range); selectRange = selectRange.getBBox0();
} else {
// Это не 3D ссылка
tmpSelectRange = this.model.getRange2(selectRange);
} }
if (null !== tmpSelectRange) { if (null != selectRange)
var bbox = tmpSelectRange.getBBox0(); this.activeRange.assign(selectRange.c1, selectRange.r1, selectRange.c2, selectRange.r2);
this.activeRange.assign(bbox.c1, bbox.r1, bbox.c2, bbox.r2);
}
} }
} }
this._drawSelection(); this._drawSelection();
......
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