Commit 7d8543a6 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Выставление селекта после Undo/Redo

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57426 954022d7-b5bf-4e40-9824-e11837661b57
parent 24a9849c
......@@ -1763,6 +1763,37 @@ function DrawingObjects() {
isInit = true;
};
_this.getSelectedDrawingsRange = function()
{
var i, rmin=gc_nMaxRow, rmax = 0, cmin = gc_nMaxCol, cmax = 0, selectedObjects = this.controller.selectedObjects, drawingBase;
for(i = 0; i < selectedObjects.length; ++i)
{
drawingBase = selectedObjects[i].drawingBase;
if(drawingBase)
{
if(drawingBase.from.col < cmin)
{
cmin = drawingBase.from.col;
}
if(drawingBase.from.row < rmin)
{
rmin = drawingBase.from.row;
}
if(drawingBase.to.col > cmax)
{
cmax = drawingBase.to.col;
}
if(drawingBase.to.row > rmax)
{
rmax = drawingBase.to.row;
}
}
}
return new asc_Range( cmin, rmin, cmax, rmax, true );
};
_this.recalculate = function(all)
{
_this.controller.recalculate(all);
......
......@@ -4298,35 +4298,48 @@ DrawingObjectsController.prototype =
var selection_state = {};
if(this.selection.textSelection)
{
selection_state.focus = true;
selection_state.textObject = this.selection.textSelection;
selection_state.selectStartPage = this.selection.textSelection.selectStartPage;
selection_state.textSelection = this.selection.textSelection.getDocContent().Get_SelectionState();
}
else if(this.selection.groupSelection)
{
selection_state.focus = true;
selection_state.groupObject = this.selection.groupSelection;
selection_state.selectStartPage = this.selection.groupSelection.selectStartPage;
selection_state.groupSelection = this.selection.groupSelection.getSelectionState();
}
else if(this.selection.chartSelection)
{
selection_state.focus = true;
selection_state.chartObject = this.selection.chartSelection;
selection_state.selectStartPage = this.selection.chartSelection.selectStartPage;
selection_state.chartSelection = this.selection.chartSelection.getSelectionState();
}
else if(this.selection.wrapPolygonSelection)
{
selection_state.focus = true;
selection_state.wrapObject = this.selection.wrapPolygonSelection;
selection_state.selectStartPage = this.selection.wrapPolygonSelection.selectStartPage;
}
else
{
selection_state.focus = this.selectedObjects.length > 0;
selection_state.selection = [];
for(var i = 0; i < this.selectedObjects.length; ++i)
{
selection_state.selection.push({object: this.selectedObjects[i], pageIndex: this.selectedObjects[i].selectStartPage});
}
}
if(this.drawingObjects)
{
var worksheetView = this.drawingObjects.getWorksheet();
if(worksheetView)
{
selection_state.worksheet = worksheetView.model;
}
}
return [selection_state];
},
......
......@@ -1789,6 +1789,7 @@ CChartSpace.prototype =
series_f = null;
}
}
if(series_f !== null)
series_f.push(cur_bbox);
}
else
......@@ -1910,7 +1911,7 @@ CChartSpace.prototype =
}
}
if(series_f.length === 1)
if(series_f !== null && series_f.length === 1)
{
if(series_f[0].r1 === series_f[0].r2 && series_f[0].c1 !== series_f[0].c2)
{
......
......@@ -83,6 +83,11 @@ function addToDrawings(worksheet, graphic, position, lockByDefault)
_this.objectLocker.checkObjects( function(result) {} );
}
worksheet.setSelectionShape(true); */
if(graphic.recalcTransform)
{
graphic.recalcTransform();
graphic.addToRecalculate();
}
return ret;
}
......
......@@ -334,21 +334,6 @@ CHistory.prototype =
wsViews[i].objectRender.controller.recalculate2(undefined);
}
}
// Восстанавливаем состояние на следующую точку
var State = null;
if ( this.Index === this.Points.length - 1 )
State = this.LastState;
else
State = this.Points[this.Index + 1].SelectionState;
if ( isRealObject(State) )
this.workbook.handlers.trigger("setSelectionState", State);
if(isRealObject(this.lastDrawingObjects))
{
this.lastDrawingObjects.sendGraphicObjectProps();
this.lastDrawingObjects = null;
}
},
UndoRedoEnd: function (Point, oRedoObjectParam, bUndo) {
if (!bUndo && null == Point) {
......@@ -387,16 +372,24 @@ CHistory.prototype =
for (var i in Point.UpdateRigions)
this.workbook.handlers.trigger("cleanCellCache", i, Point.UpdateRigions[i]);
if (bUndo) {
this.workbook.handlers.trigger("setSelection", Point.SelectRange.clone(), /*validRange*/false);
if (Point.SelectionState != null)
{
if(Point.SelectionState && Point.SelectionState[0] && Point.SelectionState[0].focus) {
if (Point.SelectionState != null) {
this.workbook.handlers.trigger("setSelectionState", Point.SelectionState);
var wsView = window["Asc"]["editor"].wb.getWorksheet();
if(wsView && wsView.objectRender && wsView.objectRender.controller)
{
wsView.objectRender.controller.updateOverlay();
}
}
else {
this.workbook.handlers.trigger("setSelection", Point.SelectRange.clone(), /*validRange*/false);
}
}
else {
var State = null;
if ( this.Index === this.Points.length - 1 )
State = this.LastState;
else
State = this.Points[this.Index + 1].SelectionState;
if ( State && State[0] && State[0].focus) {
this.workbook.handlers.trigger("setSelectionState", State);
}
else {
var oSelectRange = null;
......@@ -407,6 +400,8 @@ CHistory.prototype =
if (null != oSelectRange)
this.workbook.handlers.trigger("setSelection", oSelectRange.clone());
}
}
for (var i in oRedoObjectParam.oChangeWorksheetUpdate)
this.workbook.handlers.trigger("changeWorksheetUpdate", oRedoObjectParam.oChangeWorksheetUpdate[i]);
if (oRedoObjectParam.bOnSheetsChanged)
......
......@@ -590,21 +590,27 @@
};
WorkbookView.prototype._onSetSelectionState = function (state) {
var index = 0;
for ( var i = 0; i < this.wsViews.length; i++ ) {
if (this.wsViews[i] && state.sheetId === this.wsViews[i].model.Id ) {
index = this.wsViews[i].model.index;
break;
}
}
var ws = this.getWorksheet(index);
if(state[0] && state[0].worksheet)
{
var ws = this.getWorksheet(state[0].worksheet.index);
if(ws)
{
this.showWorksheet(state[0].worksheet.index);
ws.setSelectionShape(true);
ws.objectRender.controller.setSelectionState(state);
var d = ws.setSelectionUndoRedoObject(ws.objectRender.getSelectedDrawingsRange());
if (d) {
if (d.deltaX) {this.controller.scrollHorizontal(d.deltaX);}
if (d.deltaY) {this.controller.scrollVertical(d.deltaY);}
}
ws.objectRender.showDrawingObjectsEx(true);
ws.objectRender.controller.updateOverlay();
ws.objectRender.controller.updateSelectionState();
}
// Селектим после выставления состояния
if (0 < ws.objectRender.controller.selectedObjects.length)
ws.setSelectionShape(true);
}
};
WorkbookView.prototype._onChangeSelection = function (isStartPoint, dc, dr, isCoord, isSelectMode, callback) {
......
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