Commit 48b3466b authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

правка бага 21110 - [CoEdit] Ошибка в консоли при принятии диаграммы пользователем

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50704 954022d7-b5bf-4e40-9824-e11837661b57
parent 1816de29
......@@ -67,6 +67,7 @@ CChartAsGroup.prototype =
{
return null;
},
asc_getChart: function()
{
return this.chart;
......@@ -74,6 +75,7 @@ CChartAsGroup.prototype =
setAscChart: function(chart)
{
History.Add(this, {Type:historyitem_AutoShapes_AddChart, oldPr: this.chart, newPr: chart});
this.chart = chart;
},
......@@ -998,6 +1000,31 @@ CChartAsGroup.prototype =
this.vAxisTitle = yAxisTitle;
},
addXAxis: function(title)
{
var oldValue = isRealObject(this.hAxisTitle) ? this.hAxisTitle.Get_Id() : null;
var newValue = isRealObject(title) ? title.Get_Id() : null;
this.hAxisTitle = title;
History.Add(this, {Type: historyitem_AutoShapes_AddXAxis, oldPr: oldValue, newPr: newValue});
},
addYAxis: function(title)
{
var oldValue = isRealObject(this.vAxisTitle) ? this.vAxisTitle.Get_Id() : null;
var newValue = isRealObject(title) ? title.Get_Id() : null;
this.vAxisTitle = title;
History.Add(this, {Type: historyitem_AutoShapes_AddYAxis, oldPr: oldValue, newPr: newValue});
},
addTitle: function(title)
{
var oldValue = isRealObject(this.chartTitle) ? this.chartTitle.Get_Id() : null;
var newValue = isRealObject(title) ? title.Get_Id() : null;
this.chartTitle = title;
History.Add(this, {Type: historyitem_AutoShapes_AddTitle, oldPr: oldValue, newPr: newValue});
},
draw: function(graphics, pageIndex)
{
......@@ -2164,23 +2191,26 @@ CChartAsGroup.prototype =
var r = CreateBinaryReader(binary, 0, binary.length);
if(r.GetBool())
{
this.chartTitle = new CChartTitle(this, CHART_TITLE_TYPE_TITLE);
this.addTitle(new CChartTitle(this, CHART_TITLE_TYPE_TITLE));
this.chartTitle.readFromBinary(r);
}
if(r.GetBool())
{
this.vAxisTitle = new CChartTitle(this, CHART_TITLE_TYPE_V_AXIS);
this.addYAxis(new CChartTitle(this, CHART_TITLE_TYPE_V_AXIS));
this.vAxisTitle.readFromBinary(r);
}
if(r.GetBool())
{
this.hAxisTitle = new CChartTitle(this, CHART_TITLE_TYPE_H_AXIS);
this.addXAxis(new CChartTitle(this, CHART_TITLE_TYPE_H_AXIS));
this.hAxisTitle.readFromBinary(r);
}
this.setAscChart(new asc_CChart());
this.chart.Read_FromBinary2(r, true);
this.spPr.Read_FromBinary2(r);
var chart = new asc_CChart();
chart.Read_FromBinary2(r, true);
this.setAscChart(chart);
var spPr = new CSpPr();
spPr.Read_FromBinary2(r);
this.setSpPr(spPr);
this.init();
this.recalculate();
},
......@@ -2209,6 +2239,13 @@ CChartAsGroup.prototype =
},
setSpPr: function(spPr)
{
History.Add(this, {Type:historyitem_SetSetSpPr, oldPr: this.spPr, newPr: spPr});
this.spPr = spPr;
},
Undo: function(data)
{
......@@ -2313,6 +2350,31 @@ CChartAsGroup.prototype =
this.parent = data.Old;
break;
}
case historyitem_AutoShapes_AddChart:
{
this.chart = data.oldPr;
break;
}
case historyitem_AutoShapes_AddXAxis:
{
this.hAxisTitle = g_oTableId.Get_ById(data.oldPr);
break;
}
case historyitem_AutoShapes_AddYAxis:
{
this.vAxisTitle = g_oTableId.Get_ById(data.oldPr);
break;
}
case historyitem_AutoShapes_AddTitle:
{
this.chartTitle = g_oTableId.Get_ById(data.oldPr);
break;
}
case historyitem_SetSetSpPr:
{
this.spPr = data.oldPr;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
if(!this.parent)
......@@ -2420,6 +2482,31 @@ CChartAsGroup.prototype =
this.parent = data.New;
break;
}
case historyitem_AutoShapes_AddChart:
{
this.chart = data.newPr;
break;
}
case historyitem_AutoShapes_AddXAxis:
{
this.hAxisTitle = g_oTableId.Get_ById(data.newPr);
break;
}
case historyitem_AutoShapes_AddYAxis:
{
this.vAxisTitle = g_oTableId.Get_ById(data.newPr);
break;
}
case historyitem_AutoShapes_AddTitle:
{
this.chartTitle = g_oTableId.Get_ById(data.newPr);
break;
}
case historyitem_SetSetSpPr:
{
this.spPr = data.newPr;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
......@@ -2507,6 +2594,33 @@ CChartAsGroup.prototype =
}
break;
}
case historyitem_AutoShapes_AddChart:
{
w.WriteBool(isRealObject(data.newPr));
if(isRealObject(data.newPr))
{
data.newPr.Write_ToBinary2(w);
}
break;
}
case historyitem_AutoShapes_AddXAxis:
case historyitem_AutoShapes_AddYAxis:
case historyitem_AutoShapes_AddTitle:
{
w.WriteBool(typeof data.newPr === "string");
if(typeof data.newPr === "string")
w.WriteString2(data.newPr);
break;
}
case historyitem_SetSetSpPr:
{
w.WriteBool(isRealObject(data.newPr));
if(isRealObject(data.newPr))
{
data.newPr.Write_ToBinary2(w);
}
break;
}
}
},
......@@ -2621,10 +2735,74 @@ CChartAsGroup.prototype =
}
break;
}
case historyitem_AutoShapes_AddChart:
{
if(r.GetBool())
{
this.chart = new asc_CChart();
r.GetLong();
this.chart.Read_FromBinary2(r);
}
else
{
this.chart = null;
}
break;
}
case historyitem_AutoShapes_AddXAxis:
{
if(r.GetBool())
{
this.hAxisTitle = g_oTableId.Get_ById(r.GetString2());
}
else
{
this.hAxisTitle = null;
}
break;
}
case historyitem_AutoShapes_AddYAxis:
{
if(r.GetBool())
{
this.vAxisTitle = g_oTableId.Get_ById(r.GetString2());
}
else
{
this.vAxisTitle = null;
}
break;
}
case historyitem_AutoShapes_AddTitle:
{
if(r.GetBool())
{
this.chartTitle = g_oTableId.Get_ById(r.GetString2());
}
else
{
this.chartTitle = null;
}
break;
}
case historyitem_SetSetSpPr:
{
this.spPr = new CSpPr();
if(r.GetBool())
{
this.spPr.Read_FromBinary2(r);
}
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
}
if(!this.parent)
{
delete editor.WordControl.m_oLogicDocument.recalcMap[this.Id];
}
},
Write_ToBinary2: function(w)
......
......@@ -9,13 +9,12 @@ function CChartTitle(chartGroup, type)
this.layout = null;
this.overlay = false;
this.spPr = new CSpPr();
this.chartGroup = chartGroup;
this.drawingObjects = chartGroup.drawingObjects;
this.type = type;
//this.chartGroup = chartGroup;
//this.drawingObjects = chartGroup.drawingObjects;
//this.type = type;
this.txPr = null;
this.isDefaultText = false;
this.txBody = new CTextBody(this);
this.x = null;
this.y = null;
......@@ -42,10 +41,21 @@ function CChartTitle(chartGroup, type)
this.selected = false;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
if(isRealObject(chartGroup))
{
this.setChartGroup(chartGroup);
this.addTextBody(new CTextBody(this));
}
if(isRealNumber(type))
{
this.setType(type);
}
}
CChartTitle.prototype =
{
getObjectType: function()
{
return CLASS_TYPE_CHART_TITLE;
......@@ -56,13 +66,19 @@ CChartTitle.prototype =
return this.Id;
},
Write_ToBinary2: function(w)
setType: function(type)
{
History.Add(this, {Type:historyitem_AutoShapes_SetChartTitleType, oldPr : this.type, newPr: type});
this.type = type;
},
Read_FromBinary2: function(r)
{},
setChartGroup: function(chartGroup)
{
var oldPr = this.chartGroup ;
var newPr = chartGroup ;
History.Add(this, {Type: historyitem_AutoShapes_SetChartGroup, oldPr: oldPr, newPr: newPr});
this.chartGroup = chartGroup;
},
getTitleType: function()
{
......@@ -192,6 +208,9 @@ CChartTitle.prototype =
addTextBody: function(txBody)
{
var oldPr = this.txBody ;
var newPr = txBody ;
History.Add(this, {Type: historyitem_AutoShapes_SetChartTitleTxBody, oldPr: oldPr, newPr: newPr});
this.txBody = txBody;
},
......@@ -969,7 +988,7 @@ CChartTitle.prototype =
{
w.WriteBool(isRealObject(this.layout));
if(isRealObject(this.layout))
this.layout.writeToBinary(w);
this.layout.Write_ToBinary2(w);
w.WriteBool(this.overlay);
this.spPr.Write_ToBinary2(w);
w.WriteBool(isRealObject(this.txPr));
......@@ -985,8 +1004,9 @@ CChartTitle.prototype =
{
if(r.GetBool())
{
this.layout = new CChartLayout();
this.layout.readFromBinary(r);
var layout = new CChartLayout();
layout.Read_FromBinary2(r);
this.setLayout(layout);
}
this.overlay = r.GetBool();
this.spPr.Read_FromBinary2(r);
......@@ -998,7 +1018,7 @@ CChartTitle.prototype =
if(r.GetBool())
{
this.txBody = new CTextBody(this);
//this.txBody = new CTextBody(this);
this.txBody.readFromBinary(r);
}
......@@ -1014,6 +1034,13 @@ CChartTitle.prototype =
this.txBody.recalcInfo.recalculateBodyPr = true;
},
setOverlay: function(overlay)
{
var _overlay = overlay === true;
History.Add(this, {Type: historyitem_AutoShapes_SetChartTitleOverlay, oldPr: this.overlay === true, newPr: _overlay});
this.overlay = _overlay;
},
Undo: function(data)
{
switch(data.Type)
......@@ -1038,6 +1065,26 @@ CChartTitle.prototype =
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_AutoShapes_SetChartGroup:
{
this.chartGroup = data.oldPr;
break;
}
case historyitem_AutoShapes_SetChartTitleType:
{
this.type = data.oldPr;
break;
}
case historyitem_AutoShapes_SetChartTitleOverlay:
{
this.overlay = data.oldPr
break;
}
case historyitem_AutoShapes_SetChartTitleTxBody:
{
this.txBody = data.oldPr;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this.chartGroup;
},
......@@ -1066,6 +1113,26 @@ CChartTitle.prototype =
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_AutoShapes_SetChartGroup:
{
this.chartGroup = data.newPr;
break;
}
case historyitem_AutoShapes_SetChartTitleType:
{
this.type = data.newPr;
break;
}
case historyitem_AutoShapes_SetChartTitleOverlay:
{
this.overlay = data.newPr
break;
}
case historyitem_AutoShapes_SetChartTitleTxBody:
{
this.txBody = data.newPr;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this.chartGroup;
},
......@@ -1073,6 +1140,17 @@ CChartTitle.prototype =
Refresh_RecalcData: function()
{},
Write_ToBinary2: function(w)
{
w.WriteLong(historyitem_type_ChartTitle);
w.WriteString2(this.Id);
},
Read_FromBinary2: function(r)
{
this.Id = r.GetString2();
},
Save_Changes: function(data, w)
{
w.WriteLong(historyitem_type_ChartTitle);
......@@ -1093,6 +1171,39 @@ CChartTitle.prototype =
data.newBodyPr.Write_ToBinary2(w);
break;
}
case historyitem_AutoShapes_SetChartGroup:
{
w.WriteBool(isRealObject(data.newPr));
if(isRealObject(data.newPr))
{
w.WriteString2(data.newPr.Get_Id());
}
break;
}
case historyitem_AutoShapes_SetChartTitleType:
{
w.WriteBool(isRealNumber(data.newPr));
is(isRealNumber(data.newPr));
{
w.WriteLong(data.newPr);
}
break;
}
case historyitem_AutoShapes_SetChartTitleOverlay:
{
w.WriteBool(data.newPr);
break;
}
case historyitem_AutoShapes_SetChartTitleTxBody:
{
w.WriteBool(isRealObject(data.newPr));
if(isRealObject(data.newPr))
{
w.WriteString2(data.newPr.Get_Id());
}
break;
}
}
},
......@@ -1100,7 +1211,7 @@ CChartTitle.prototype =
Load_Changes: function(r)
{
if(r.GetLong() === historyitem_type_Shape)
if(r.GetLong() === historyitem_type_ChartTitle)
{
switch(r.GetLong())
{
......@@ -1126,6 +1237,48 @@ CChartTitle.prototype =
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_AutoShapes_SetChartGroup:
{
if(r.GetBool())
{
this.chartGroup = g_oTableId.Get_ById(r.GetString2());
}
else
{
this.chartGroup = null;
}
break;
}
case historyitem_AutoShapes_SetChartTitleType:
{
if(r.GetBool())
{
this.type = r.GetLong();
}
else
{
this.type = null;
}
break;
}
case historyitem_AutoShapes_SetChartTitleOverlay:
{
this.overlay = r.GetBool();
break;
}
case historyitem_AutoShapes_SetChartTitleTxBody:
{
if(r.GetBool())
{
this.txBody = g_oTableId.Get_ById(r.GetString2());
}
else
{
this.txBody = null;
}
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this.chartGroup;
......
......@@ -45,6 +45,8 @@ function CTableId()
this.Add = function(Class, Id)
{
if(Class instanceof asc_CChart)
return;
if ( false === this.m_bTurnOff )
{
Class.Id = Id;
......@@ -149,7 +151,7 @@ function CTableId()
case historyitem_type_Shape : Element = new CShape(); break;
case historyitem_type_Image : Element = new CImageShape(); break;
case historyitem_type_GroupShapes : Element = new CGroupShape(); break;
case historyitem_type_Chart : Element = new CChartData(true); break;
case historyitem_type_Chart : Element = new CChartAsGroup(); break;
case historyitem_type_Slide : Element = new Slide(); break;
case historyitem_type_PropLocker : Element = new PropLocker(); break;
case historyitem_type_Layout : Element = new SlideLayout(); break;
......@@ -157,6 +159,7 @@ function CTableId()
case historyitem_type_GraphicFrame : Element = new CGraphicFrame(); break;
case historyitem_type_SlideMaster : Element = new MasterSlide(); break;
case historyitem_type_Theme : Element = new CTheme(); break;
case historyitem_type_ChartTitle : Element = new CChartTitle();
}
Element.Read_FromBinary2(Reader);
......
......@@ -614,8 +614,39 @@ CTextBody.prototype =
readFromBinary: function(r, drawingDocument)
{
this.bodyPr.Read_FromBinary2(r);
readFromBinaryDocContent(this.content, r);
var bodyPr = new CBodyPr();
bodyPr.Read_FromBinary2(r);
if(isRealObject(this.parent) && this.parent.setBodyPr)
{
this.parent.setBodyPr(bodyPr);
}
//this.bodyPr.Read_FromBinary2(r);
var is_on = History.Is_On();
if(is_on)
{
History.TurnOff();
}
var dc= new CDocumentContent(this, editor.WordControl.m_oDrawingDocument, 0, 0, 0, 0, false, false);
readFromBinaryDocContent(dc, r);
if(is_on)
{
History.TurnOn();
}
for(var i = 0; i < dc.Content.length; ++i)
{
if(i > 0)
{
this.content.Add_NewParagraph()
}
var par = dc.Content[i];
for(var i = 0; i < par.Content.length; ++i)
{
if(par.Content[i].Copy)
this.content.Paragraph_Add(par.Content[i].Copy());
}
}
},
Undo: function(data)
......
......@@ -1885,8 +1885,11 @@ CGraphicObjects.prototype = {
image.setGeometry( CreateGeometry("rect"));
image.spPr.geometry.Init(5, 5);
image.setXfrm((this.slide.presentation.Width - W)/2, (this.slide.presentation.Height - H)/2, W, H, null, null, null);
this.slide.addToSpTreeToPos(this.slide.cSld.spTree.length, image);
editor.WordControl.m_oLogicDocument.recalcMap[image.Id] = image;
if(editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_AddShape, image) === false)
{
this.slide.addToSpTreeToPos(this.slide.cSld.spTree.length, image);
editor.WordControl.m_oLogicDocument.recalcMap[image.Id] = image;
}
},
groupShapes: function(drawingBase)
......@@ -2357,8 +2360,11 @@ CGraphicObjects.prototype = {
{
var chart = new CChartAsGroup(this.slide);
chart.initFromBinary(binary);
this.slide.addToSpTreeToPos(this.slide.cSld.spTree, chart);
editor.WordControl.m_oLogicDocument.recalcMap[chart.Id] = chart;
if(editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_AddShape, chart) === false)
{
this.slide.addToSpTreeToPos(this.slide.cSld.spTree, chart);
editor.WordControl.m_oLogicDocument.recalcMap[chart.Id] = chart;
}
},
editChart: function(binary)
......
......@@ -325,6 +325,18 @@ var historyitem_SetSpParent = 18;
var historyitem_SetGraphicObject = 19;
var historyitem_RemoveFromSpTreeGroup = 20;
var historyitem_AutoShapes_SwapGraphicObjects = 21;
var historyitem_AutoShapes_AddChart = 22;
var historyitem_AutoShapes_SetChartTitleType = 23;
var historyitem_AutoShapes_SetChartGroup = 24;
var historyitem_AutoShapes_AddXAxis = 25;
var historyitem_AutoShapes_AddYAxis = 26;
var historyitem_AutoShapes_AddTitle = 27;
var historyitem_AutoShapes_SetChartTitleOverlay = 28;
var historyitem_AutoShapes_SetChartTitleTxBody = 29;
......@@ -441,6 +453,7 @@ var historyitem_type_SlideMaster = 35;
function CHistory(Document)
{
this.Index = -1;
......
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