Commit 25ea7119 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

Bug 24658 - Удаление листа, содержащего диаграмму, не осуществляется и вызывает ошибку в консоли

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56627 954022d7-b5bf-4e40-9824-e11837661b57
parent ed937fdc
......@@ -4309,6 +4309,19 @@ function DrawingObjects() {
};
_this.rebuildChartGraphicObjects = function(data)
{
var wsViews = Asc["editor"].wb.wsViews;
for(var i = 0; i < wsViews.length; ++i)
{
if(wsViews[i])
{
wsViews[i].objectRender.rebuildCharts(data);
}
}
};
_this.rebuildCharts = function(data)
{
for(var i = 0; i < aObjects.length; ++i)
{
......@@ -4856,30 +4869,19 @@ function DrawingObjects() {
}
};
_this.updateChartReferences = function(oldWorksheet, newWorksheet) {
History.Create_NewPoint();
History.StartTransaction();
for (var i = 0; i < aObjects.length; i++) {
var graphicObject = aObjects[i].graphicObject;
if ( graphicObject.isChart() && (graphicObject.chart.range.interval.indexOf(oldWorksheet) == 0) ) {
var _interval = graphicObject.chart.range.interval;
graphicObject.chart.range.interval = graphicObject.chart.range.interval.replace(oldWorksheet, newWorksheet);
//TODO History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(graphicObject.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
//TODO History.Add(g_oUndoRedoGraphicObjects, historyitem_Chart_RangeInterval, null, null, new UndoRedoDataGraphicObjects(graphicObject.chart.Get_Id(), new UndoRedoDataGOSingleProp(_interval, graphicObject.chart.range.interval)));
//TODO History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(graphicObject.chart.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var _range = convertFormula(graphicObject.chart.range.interval, worksheet);
if ( _range ) {
graphicObject.chart.range.intervalObject = _range;
graphicObject.chart.rebuildSeries();
graphicObject.recalculate();
_this.updateChartReferences = function(oldWorksheet, newWorksheet)
{
ExecuteNoHistory(function(){
for (var i = 0; i < aObjects.length; i++) {
var graphicObject = aObjects[i].graphicObject;
if ( graphicObject.getObjectType() === historyitem_type_ChartSpace )
{
graphicObject.updateChartReferences(oldWorksheet, newWorksheet);
this.controller.startRecalculate();
}
}
}
History.EndTransaction();
}, this, []);
};
//-----------------------------------------------------------------------------------
......
......@@ -456,6 +456,59 @@ CChartSpace.prototype =
return this.checkSeriesRefs(this.checkSeriesIntersection, bbox, worksheet);
},
changeListName: function(val, oldName, newName)
{
if(val)
{
if(val.numRef && typeof val.numRef.f === "string")
{
val.numRef.setF(val.numRef.f.replace(new RegExp(oldName,'g'), newName));
}
if(val.strRef && typeof val.strRef.f === "string")
{
val.strRef.setF(val.strRef.f.replace(new RegExp(oldName,'g'), newName));
}
}
},
checkListName: function(val, oldName)
{
if(val)
{
if(val.numRef && typeof val.numRef.f === "string")
{
if(val.numRef.f.indexOf(oldName) > -1)
return true;
}
if(val.strRef && typeof val.strRef.f === "string")
{
if(val.strRef.f.indexOf(oldName) > -1)
return true;
}
}
return false;
},
changeChartReferences: function(oldWorksheetName, newWorksheetName)
{
this.checkSeriesRefs(this.changeListName, oldWorksheetName, newWorksheetName);
},
checkChartReferences: function(oldWorksheetName)
{
return this.checkSeriesRefs(this.checkListName, oldWorksheetName);
},
updateChartReferences: function(oldWorksheetName, newWorksheetName)
{
if(this.checkChartReferences(oldWorksheetName))
{
this.changeChartReferences(oldWorksheetName, newWorksheetName);
this.rebuildSeries();
}
},
checkSeriesRefs: function(callback, bbox, worksheet)
{
if(this.chart && this.chart.plotArea)
......
......@@ -2090,19 +2090,18 @@ Woorksheet.prototype.setName=function(name){
for(var id in this.workbook.cwf) {
this.workbook.getWorksheetById(id)._ReBuildFormulas(this.workbook.cwf[id].cells,lastName,this.sName);
}
if ( this.Drawings ) {
for (var i = 0; i < this.Drawings.length; i++) {
var drawingObject = this.Drawings[i];
if ( drawingObject.graphicObject && drawingObject.isChart() ) {
var _lastName = !rx_test_ws_name.test(lastName) ? "'" + lastName + "'" : lastName;
if ( drawingObject.graphicObject.chart.range.interval.indexOf(_lastName + "!") >= 0 ) {
drawingObject.graphicObject.chart.range.interval = drawingObject.graphicObject.chart.range.interval.replace(_lastName, !rx_test_ws_name.test(this.sName) ? "'" + this.sName + "'" : this.sName);
drawingObject.graphicObject.chart.rebuildSeries();
}
}
}
}
var _lastName = !rx_test_ws_name.test(lastName) ? "'" + lastName + "'" : lastName;
var _newName = !rx_test_ws_name.test(this.sName) ? "'" + this.sName + "'" : this.sName;
var t = window["Asc"]["editor"];
for (var key in t.wb.model.aWorksheets)
{
var wsModel = t.wb.model.aWorksheets[key];
var ws = t.wb.getWorksheet(wsModel.index);
if ( ws )
ws.objectRender.updateChartReferences(_lastName, _newName);
}
}
};
Woorksheet.prototype.getTabColor=function(){
......
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