Commit 01cc6bf3 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@49257 954022d7-b5bf-4e40-9824-e11837661b57
parent de162cd2
......@@ -1513,29 +1513,27 @@ CChartAsGroup.prototype =
{
this.hAxisTitle.getAllFonts(AllFonts);
}
},
getChartBinary: function()
{
// Записываем объект в бинарник для редактора документов
var w = new CMemory();
w.WriteBool(isRealObject(this.chartTitle));
if(isRealObject(this.chartTitle))
{
this.chartTitle.writeToBinary();
this.chartTitle.writeToBinary(w);
}
w.WriteBool(isRealObject(this.vAxisTitle));
if(isRealObject(this.vAxisTitle))
{
this.vAxisTitle.writeToBinary();
this.vAxisTitle.writeToBinary(w);
}
w.WriteBool(isRealObject(this.hAxisTitle));
if(isRealObject(this.hAxisTitle))
{
this.hAxisTitle.writeToBinary();
this.hAxisTitle.writeToBinary(w);
}
this.chart.Write_ToBinary2(w);
......@@ -1546,6 +1544,28 @@ CChartAsGroup.prototype =
setChartBinary: function(binary)
{
// Приводим бинарник к внутренней структуре
var r = CreateBinaryReader(binary, 0, binary.length);
if(r.GetBool())
{
this.chartTitle = 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.vAxisTitle.readFromBinary(r);
}
if(r.GetBool())
{
this.hAxisTitle = new CChartTitle(this, CHART_TITLE_TYPE_H_AXIS);
this.hAxisTitle.readFromBinary(r);
}
this.chart.Read_FromBinary2(r);
this.spPr.Read_FromBinary2(r);
this.init();
this.recalculate();
this.addToDrawingObjects();
}
};
......@@ -965,7 +965,6 @@ CChartTitle.prototype =
w.WriteBool(isRealObject(this.txBody));
if(isRealObject(this.txBody))
this.txBody.writeToBinary(w);
},
readFromBinary: function(r)
......@@ -990,4 +989,4 @@ CChartTitle.prototype =
}
}
};
\ No newline at end of file
};
......@@ -180,6 +180,9 @@ Paragraph.prototype =
return CLASS_TYPE_PARAGRAPH;
},
GetType : function()
{
return type_Paragraph;
......
......@@ -257,6 +257,16 @@ ParaText.prototype =
{
this.Value = Reader.GetString2();
this.SpaceAfter = Reader.GetBool();
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
......@@ -395,6 +405,16 @@ ParaSpace.prototype =
Read_FromBinary : function(Reader)
{
this.Value = Reader.GetLong();
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
......@@ -1854,6 +1874,16 @@ ParaTextPr.prototype =
break;
}
}
},
writeToBinary: function(w)
{
this.Write_ToBinary2(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary2(r);
}
};
......@@ -1913,9 +1943,20 @@ ParaEnd.prototype =
Read_FromBinary : function(Reader)
{
}
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
// Класс ParaNewLine
......@@ -2063,6 +2104,18 @@ ParaNewLine.prototype =
if ( break_Page === this.BreakType )
this.Flags = { NewLine : Reader.GetBool() };
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
......@@ -2103,6 +2156,18 @@ ParaNewLineRendered.prototype =
Read_FromBinary : function(Reader)
{
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
......@@ -2144,6 +2209,18 @@ ParaInlineBreak.prototype =
Read_FromBinary : function(Reader)
{
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
......@@ -2185,6 +2262,18 @@ ParaPageBreakRenderer.prototype =
Read_FromBinary : function(Reader)
{
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
......@@ -2243,6 +2332,18 @@ ParaEmpty.prototype =
Read_FromBinary : function(Reader)
{
this.NeedToDelete = Reader.GetBool();
},
writeToBinary: function(w)
{
this.Write_ToBinary(w)
},
readFromBinary: function(r)
{
this.Read_FromBinary(r);
}
};
......@@ -6904,5 +7005,43 @@ function ParagraphContent_Read_FromBinary(Reader)
}
function ParagraphContent_Read_FromBinary2(Reader)
{
var ElementType = Reader.GetLong();
var Element = null;
switch ( ElementType )
{
case para_TextPr :
case para_Drawing :
case para_HyperlinkStart :
{
var ElementId = Reader.GetString2();
Element = g_oTableId.Get_ById( ElementId );
return Element;
}
case para_Text : Element = new ParaText(); break;
case para_Space : Element = new ParaSpace(); break;
case para_End : Element = new ParaEnd(); break;
case para_NewLine : Element = new ParaNewLine(); break;
case para_NewLineRendered : Element = new ParaNewLineRendered(); break;
case para_InlineBreak : Element = new ParaInlineBreak(); break;
case para_PageBreakRendered : Element = new ParaPageBreakRenderer(); break;
case para_Empty : Element = new ParaEmpty(); break;
case para_Numbering : Element = new ParaNumbering(); break;
case para_Tab : Element = new ParaTab(); break;
case para_PageNum : Element = new ParaPageNum(); break;
case para_FlowObjectAnchor : Element = new ParaFlowObjectAnchor(); break;
case para_HyperlinkEnd : Element = new ParaHyperlinkEnd(); break;
case para_CommentStart : Element = new ParaCommentStart(); break;
case para_CommentEnd : Element = new ParaCommentEnd(); break;
case para_PresentationNumbering : Element = new ParaPresentationNumbering(); break;
}
if ( null != Element )
Element.readFromBinary(Reader);
return Element;
}
......@@ -1540,6 +1540,7 @@ CShape.prototype =
}
this.invertTransformText = global_MatrixTransformer.Invert(this.transformText);
},
getFullFlip: function()
{
return {flipH: this.getFullFlipH(), flipV: this.getFullFlipV()};
......
......@@ -914,5 +914,90 @@ CTextBody.prototype =
{
this.bodyPr.Read_FromBinary2(r);
this.content = new CDocumentContent(this, drawingDocument, 0, 0, 0, 20000, false, false);
},
writeToBinary: function(w)
{
this.bodyPr.Write_ToBinary2(w);
writeToBinaryDocContent(this.content, w);
},
readFromBinary: function(r, drawingDocument)
{
this.bodyPr.readFromBinary(r);
readFromBinaryDocContent(this.content, r);
}
};
\ No newline at end of file
};
function writeToBinaryDocContent(docContent, w)
{
w.WriteBool(docContent.TurnOffInnerWrap);
w.WriteBool(docContent.Split);
var Count = docContent.Content.length;
w.WriteLong(Count);
for ( var Index = 0; Index < Count; Index++ )
writeToBinaryParagraph(docContent.Content[Index], w);
}
function readFromBinaryDocContent(docContent, r)
{
docContent.TurnOffInnerWrap = r.GetBool();
docContent.Split = r.GetBool();
var Count = r.GetLong();
docContent.Content = new Array();
for ( var Index = 0; Index < Count; Index++ )
{
var p = new Paragraph(docContent.DrawingDocument, docContent, 0, 0, 0, 0, 0);
readFromBinaryParagraph(p, r);
docContent.Content.push(p);
}
}
function writeToBinaryParagraph(p, w)
{
p.Pr.Write_ToBinary( w );
p.TextPr.writeToBinary(w);
var StartPos = w.GetCurPosition();
w.Skip( 4 );
var Len = p.Content.length;
var Count = 0;
for ( var Index = 0; Index < Len; Index++ )
{
var Item = p.Content[Index];
if ( true === Item.Is_RealContent() )
{
Item.Write_ToBinary( w );
Count++;
}
}
var EndPos = w.GetCurPosition();
w.Seek( StartPos );
w.WriteLong( Count );
w.Seek( EndPos );
}
function readFromBinaryParagraph(p, r)
{
p.Pr = new CParaPr();
p.Pr.Read_FromBinary( r );
p.TextPr = new ParaTextPr();
p.TextPr.readFromBinary(r);
p.Content = new Array();
var Count = r.GetLong();
for ( var Index = 0; Index < Count; Index++ )
{
var Element = ParagraphContent_Read_FromBinary(r);
if ( null != Element )
p.Content.push( Element );
}
}
......@@ -444,7 +444,7 @@ CGraphicObjects.prototype =
shape_props.verticalTextAlign = undefined;
}
}
if(c_obj.isImage() && c_obj.chart == null)
if(c_obj.isImage() )
{
if(!isRealObject(image_props))
{
......@@ -459,7 +459,7 @@ CGraphicObjects.prototype =
image_props.ImageUrl = null;
}
}
if(c_obj.isImage() && isRealObject(c_obj.chart))
if(c_obj.chart)
{
if(!isRealObject(chart_props))
{
......@@ -592,10 +592,10 @@ CGraphicObjects.prototype =
if(chart_props.ShapeProperties)
chart_props.ShapeProperties = CreateAscShapePropFromProp(chart_props.ShapeProperties);
if(chart_props.ChartProperties)
/* if(chart_props.ChartProperties)
{
chart_props.ChartProperties = chart_props.ChartProperties.serializeChart();
}
} */
ret.push(chart_props);
}
return ret;
......@@ -1089,11 +1089,10 @@ CGraphicObjects.prototype =
for(var i = 0; i < selected_arr.length; ++i)
{
if(selected_arr[i].GraphicObj.chart != null)
return selected_arr[i].GraphicObj.chart.serializeChart();
return selected_arr[i].GraphicObj;
}
var chart = new CChartData(false);
return chart.serializeChart();
return new CChartAsGroup();
},
updateCharts: function()
......
......@@ -1823,28 +1823,91 @@ CChartAsGroup.prototype =
}
}
},
getChartBinary: function()
{
return "_chart_";
},
setChartBinary: function(binary)
{
},
getBinary: function()
getChartBinary: function()
{
var w = new CMemory();
w.WriteBool(isRealObject(this.chartTitle));
if(isRealObject(this.chartTitle))
{
this.chartTitle.writeToBinary(w);
}
w.WriteBool(isRealObject(this.vAxisTitle));
if(isRealObject(this.vAxisTitle))
{
this.vAxisTitle.writeToBinary(w);
}
w.WriteBool(isRealObject(this.hAxisTitle));
if(isRealObject(this.hAxisTitle))
{
this.hAxisTitle.writeToBinary(w);
}
this.chart.Write_ToBinary2(w);
this.spPr.Write_ToBinary2(w);
return w.pos + ";" + w.GetBase64Memory();
},
readFromBinary: function(reader)
{}
setChartBinary: function(binary)
{
// Приводим бинарник к внутренней структуре
var r = CreateBinaryReader(binary, 0, binary.length);
if(r.GetBool())
{
this.chartTitle = 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.vAxisTitle.readFromBinary(r);
}
if(r.GetBool())
{
this.hAxisTitle = new CChartTitle(this, CHART_TITLE_TYPE_H_AXIS);
this.hAxisTitle.readFromBinary(r);
}
this.chart.Read_FromBinary2(r);
this.spPr.Read_FromBinary2(r);
this.init();
this.recalculate();
this.addToDrawingObjects();
}
};
window["Asc"].CChartAsGroup = CChartAsGroup;
window["Asc"]["CChartAsGroup"] = CChartAsGroup;
prot = CChartAsGroup.prototype;
prot["asc_getChart"] = prot.asc_getChart;
\ No newline at end of file
prot["asc_getChart"] = prot.asc_getChart;
var CLASS_TYPE_TABLE_ID = 0;
var CLASS_TYPE_DOCUMENT_CONTENT = 1;
var CLASS_TYPE_SHAPE = 2;
var CLASS_TYPE_IMAGE = 3;
var CLASS_TYPE_GROUP = 4;
var CLASS_TYPE_XFRM = 5;
var CLASS_TYPE_GEOMETRY = 6;
var CLASS_TYPE_PATH = 7;
var CLASS_TYPE_PARAGRAPH = 8;
var CLASS_TYPE_TEXT_BODY = 9;
var CLASS_TYPE_TEXT_PR = 10;
var CLASS_TYPE_UNI_FILL = 11;
var CLASS_TYPE_PATTERN_FILL = 12;
var CLASS_TYPE_GRAD_FILL = 13;
var CLASS_TYPE_SOLID_FILL = 14;
var CLASS_TYPE_UNI_COLOR = 15;
var CLASS_TYPE_SCHEME_COLOR = 16;
var CLASS_TYPE_RGB_COLOR = 17;
var CLASS_TYPE_PRST_COLOR = 18;
var CLASS_TYPE_SYS_COLOR = 19;
var CLASS_TYPE_LINE = 20;
var CLASS_TYPE_CHART_AS_GROUP = 21;
var CLASS_TYPE_CHART_LEGEND = 22;
var CLASS_TYPE_CHART_TITLE = 23;
var CLASS_TYPE_COLOR_MOD = 24;
var CLASS_TYPE_LEGEND_ENTRY = 22;
var CLASS_TYPE_CHART_DATA = 23;
\ No newline at end of file
......@@ -918,5 +918,44 @@ CChartTitle.prototype =
getInvertTransform: function()
{
return this.invertTransform;
},
writeToBinary: function(w)
{
w.WriteBool(isRealObject(this.layout));
if(isRealOBject(this.layout))
this.layout.writeToBinary(w);
w.WriteBool(this.overlay);
this.spPr.Write_ToBinary2(w);
w.WriteBool(isRealObject(this.txPr));
if(isRealObject(this.txPr))
this.txPr.writeToBinary(w);
w.WriteBool(isRealObject(this.txBody));
if(isRealObject(this.txBody))
this.txBody.writeToBinary(w);
},
readFromBinary: function(r)
{
if(r.GetBool())
{
this.layout = new CChartLayout();
this.layout.readFromBinary(r);
}
this.overlay = r.GetBool();
this.spPr.Read_FromBinary2(r);
if(r.GetBool())
{
this.txPr = new CTextBody(this);
this.txPr.readFromBinary(r);
}
if(r.GetBool())
{
this.txBody = new CTextBody(this);
this.txBody.readFromBinary(r);
}
}
};
\ No newline at end of file
......@@ -547,5 +547,90 @@ CTextBody.prototype =
{
this.bodyPr.Read_FromBinary2(r);
this.content = new CDocumentContent(this, drawingDocument, 0, 0, 0, 20000, false, false);
},
writeToBinary: function(w)
{
this.bodyPr.Write_ToBinary2(w);
writeToBinaryDocContent(this.content, w);
},
readFromBinary: function(r, drawingDocument)
{
this.bodyPr.readFromBinary(r);
readFromBinaryDocContent(this.content, r);
}
};
function writeToBinaryDocContent(docContent, w)
{
w.WriteBool(docContent.TurnOffInnerWrap);
w.WriteBool(docContent.Split);
var Count = docContent.Content.length;
w.WriteLong(Count);
for ( var Index = 0; Index < Count; Index++ )
writeToBinaryParagraph(docContent.Content[Index], w);
}
function readFromBinaryDocContent(docContent, r)
{
docContent.TurnOffInnerWrap = r.GetBool();
docContent.Split = r.GetBool();
var Count = r.GetLong();
docContent.Content = new Array();
for ( var Index = 0; Index < Count; Index++ )
{
var p = new Paragraph(docContent.DrawingDocument, docContent, 0, 0, 0, 0, 0);
readFromBinaryParagraph(p, r);
docContent.Content.push(p);
}
}
function writeToBinaryParagraph(p, w)
{
p.Pr.Write_ToBinary( w );
p.TextPr.writeToBinary(w);
var StartPos = w.GetCurPosition();
w.Skip( 4 );
var Len = p.Content.length;
var Count = 0;
for ( var Index = 0; Index < Len; Index++ )
{
var Item = p.Content[Index];
if ( true === Item.Is_RealContent() )
{
Item.Write_ToBinary( w );
Count++;
}
}
var EndPos = w.GetCurPosition();
w.Seek( StartPos );
w.WriteLong( Count );
w.Seek( EndPos );
}
function readFromBinaryParagraph(p, r)
{
p.Pr = new CParaPr();
p.Pr.Read_FromBinary( r );
p.TextPr = new ParaTextPr();
p.TextPr.readFromBinary(r);
p.Content = new Array();
var Count = r.GetLong();
for ( var Index = 0; Index < Count; Index++ )
{
var Element = ParagraphContent_Read_FromBinary(r);
if ( null != Element )
p.Content.push( Element );
}
};
\ No newline at end of file
}
\ No newline at end of file
......@@ -520,7 +520,7 @@ WordGroupShapes.prototype =
var ret = null;
for(var i = 0; i < this.spTree.length; ++i)
{
if(this.spTree[i].isImage() && isRealObject(this.spTree[i].chart))
if(isRealObject(this.spTree[i].chart))
{
if(!isRealObject(ret))
ret = {ChartProperties: this.spTree[i].chart};
......
......@@ -6871,9 +6871,8 @@ asc_docs_api.prototype.asc_getChartObject = function()
for (var i = 0; i < this.WordControl.m_oDrawingDocument.GuiControlColorsMap.length; i++) {
chart["themeColors"].push( this.WordControl.m_oDrawingDocument.GuiControlColorsMap[i].get_hex() );
}*/
var chart = new CChartAsGroup(); // Внутри asc_CChart
return chart;
return this.WordControl.m_oLogicDocument.Get_ChartObject();
}
asc_docs_api.prototype.asc_addChartDrawingObject = function(chartBinary)
......
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