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() { ...@@ -1763,6 +1763,37 @@ function DrawingObjects() {
isInit = true; 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.recalculate = function(all)
{ {
_this.controller.recalculate(all); _this.controller.recalculate(all);
......
...@@ -4298,35 +4298,48 @@ DrawingObjectsController.prototype = ...@@ -4298,35 +4298,48 @@ DrawingObjectsController.prototype =
var selection_state = {}; var selection_state = {};
if(this.selection.textSelection) if(this.selection.textSelection)
{ {
selection_state.focus = true;
selection_state.textObject = this.selection.textSelection; selection_state.textObject = this.selection.textSelection;
selection_state.selectStartPage = this.selection.textSelection.selectStartPage; selection_state.selectStartPage = this.selection.textSelection.selectStartPage;
selection_state.textSelection = this.selection.textSelection.getDocContent().Get_SelectionState(); selection_state.textSelection = this.selection.textSelection.getDocContent().Get_SelectionState();
} }
else if(this.selection.groupSelection) else if(this.selection.groupSelection)
{ {
selection_state.focus = true;
selection_state.groupObject = this.selection.groupSelection; selection_state.groupObject = this.selection.groupSelection;
selection_state.selectStartPage = this.selection.groupSelection.selectStartPage; selection_state.selectStartPage = this.selection.groupSelection.selectStartPage;
selection_state.groupSelection = this.selection.groupSelection.getSelectionState(); selection_state.groupSelection = this.selection.groupSelection.getSelectionState();
} }
else if(this.selection.chartSelection) else if(this.selection.chartSelection)
{ {
selection_state.focus = true;
selection_state.chartObject = this.selection.chartSelection; selection_state.chartObject = this.selection.chartSelection;
selection_state.selectStartPage = this.selection.chartSelection.selectStartPage; selection_state.selectStartPage = this.selection.chartSelection.selectStartPage;
selection_state.chartSelection = this.selection.chartSelection.getSelectionState(); selection_state.chartSelection = this.selection.chartSelection.getSelectionState();
} }
else if(this.selection.wrapPolygonSelection) else if(this.selection.wrapPolygonSelection)
{ {
selection_state.focus = true;
selection_state.wrapObject = this.selection.wrapPolygonSelection; selection_state.wrapObject = this.selection.wrapPolygonSelection;
selection_state.selectStartPage = this.selection.wrapPolygonSelection.selectStartPage; selection_state.selectStartPage = this.selection.wrapPolygonSelection.selectStartPage;
} }
else else
{ {
selection_state.focus = this.selectedObjects.length > 0;
selection_state.selection = []; selection_state.selection = [];
for(var i = 0; i < this.selectedObjects.length; ++i) for(var i = 0; i < this.selectedObjects.length; ++i)
{ {
selection_state.selection.push({object: this.selectedObjects[i], pageIndex: this.selectedObjects[i].selectStartPage}); 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]; return [selection_state];
}, },
......
...@@ -1789,7 +1789,8 @@ CChartSpace.prototype = ...@@ -1789,7 +1789,8 @@ CChartSpace.prototype =
series_f = null; series_f = null;
} }
} }
series_f.push(cur_bbox); if(series_f !== null)
series_f.push(cur_bbox);
} }
else else
series_f = null; series_f = null;
...@@ -1910,7 +1911,7 @@ CChartSpace.prototype = ...@@ -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) 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) ...@@ -83,6 +83,11 @@ function addToDrawings(worksheet, graphic, position, lockByDefault)
_this.objectLocker.checkObjects( function(result) {} ); _this.objectLocker.checkObjects( function(result) {} );
} }
worksheet.setSelectionShape(true); */ worksheet.setSelectionShape(true); */
if(graphic.recalcTransform)
{
graphic.recalcTransform();
graphic.addToRecalculate();
}
return ret; return ret;
} }
......
...@@ -334,21 +334,6 @@ CHistory.prototype = ...@@ -334,21 +334,6 @@ CHistory.prototype =
wsViews[i].objectRender.controller.recalculate2(undefined); 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) { UndoRedoEnd: function (Point, oRedoObjectParam, bUndo) {
if (!bUndo && null == Point) { if (!bUndo && null == Point) {
...@@ -387,25 +372,35 @@ CHistory.prototype = ...@@ -387,25 +372,35 @@ CHistory.prototype =
for (var i in Point.UpdateRigions) for (var i in Point.UpdateRigions)
this.workbook.handlers.trigger("cleanCellCache", i, Point.UpdateRigions[i]); this.workbook.handlers.trigger("cleanCellCache", i, Point.UpdateRigions[i]);
if (bUndo) { if (bUndo) {
this.workbook.handlers.trigger("setSelection", Point.SelectRange.clone(), /*validRange*/false); if(Point.SelectionState && Point.SelectionState[0] && Point.SelectionState[0].focus) {
if (Point.SelectionState != null) if (Point.SelectionState != null) {
{ this.workbook.handlers.trigger("setSelectionState", Point.SelectionState);
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 { else {
var oSelectRange = null; var State = null;
if (null != Point.SelectRangeRedo) if ( this.Index === this.Points.length - 1 )
oSelectRange = Point.SelectRangeRedo; State = this.LastState;
else if (null != Point.SelectRange) else
oSelectRange = Point.SelectRange; State = this.Points[this.Index + 1].SelectionState;
if (null != oSelectRange)
this.workbook.handlers.trigger("setSelection", oSelectRange.clone()); if ( State && State[0] && State[0].focus) {
this.workbook.handlers.trigger("setSelectionState", State);
}
else {
var oSelectRange = null;
if (null != Point.SelectRangeRedo)
oSelectRange = Point.SelectRangeRedo;
else if (null != Point.SelectRange)
oSelectRange = Point.SelectRange;
if (null != oSelectRange)
this.workbook.handlers.trigger("setSelection", oSelectRange.clone());
}
} }
for (var i in oRedoObjectParam.oChangeWorksheetUpdate) for (var i in oRedoObjectParam.oChangeWorksheetUpdate)
this.workbook.handlers.trigger("changeWorksheetUpdate", oRedoObjectParam.oChangeWorksheetUpdate[i]); this.workbook.handlers.trigger("changeWorksheetUpdate", oRedoObjectParam.oChangeWorksheetUpdate[i]);
......
...@@ -590,21 +590,27 @@ ...@@ -590,21 +590,27 @@
}; };
WorkbookView.prototype._onSetSelectionState = function (state) { 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);
ws.objectRender.controller.setSelectionState(state);
ws.objectRender.controller.updateOverlay();
ws.objectRender.controller.updateSelectionState();
// Селектим после выставления состояния if(state[0] && state[0].worksheet)
if (0 < ws.objectRender.controller.selectedObjects.length) {
ws.setSelectionShape(true); 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();
}
// Селектим после выставления состояния
}
}; };
WorkbookView.prototype._onChangeSelection = function (isStartPoint, dc, dr, isCoord, isSelectMode, callback) { 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