Commit c802af97 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

load/save group

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@52147 954022d7-b5bf-4e40-9824-e11837661b57
parent 9458e3e7
......@@ -4729,6 +4729,118 @@ function BinaryPPTYLoader()
return shape;
}
this.ReadChartDataInGroup = function(group)
{
var s = this.stream;
var _rec_start = s.cur;
var _end_rec = _rec_start + s.GetULong() + 4;
this.TempGroupObject = group;
s.Skip2(1); // start attributes
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
var spid = s.GetString2();
break;
}
default:
break;
}
}
var _nvGraphicFramePr = null;
var _xfrm = null;
var _chart = null;
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
switch (_at)
{
case 0:
{
_nvGraphicFramePr = this.ReadNvUniProp();
break;
}
case 1:
{
_xfrm = this.ReadXfrm();
break;
}
case 2:
{
s.SkipRecord();
break;
}
case 3:
{
var _length = s.GetLong();
var _pos = s.cur;
_chart = new CChartAsGroup(this.TempGroupObject);
if(g_oTableId)
g_oTableId.m_bTurnOff = true;
var chart = new asc_CChart();
if(g_oTableId)
g_oTableId.m_bTurnOff = false;
var _stream = new FT_Stream2();
_stream.data = s.data;
_stream.pos = s.pos;
_stream.cur = s.cur;
_stream.size = s.size;
var oBinary_ChartReader = new Binary_ChartReader(_stream, chart, _chart);
oBinary_ChartReader.ReadExternal(_length);
if (null != chart.range.interval && chart.range.interval.length > 0)
{
if (_xfrm)
{
if (_chart.setXfrm)
{
_chart.setXfrm(_xfrm.offX, _xfrm.offY, _xfrm.extX, _xfrm.extY, _xfrm.rot, _xfrm.flipH, _xfrm.flipV);
}
else
{
_chart.setPosition(_xfrm.offX, _xfrm.offY);
_chart.setExtents(_xfrm.extX, _xfrm.extY);
}
}
_chart.setAscChart(chart);
}
else
_chart = null;
s.Seek2(_pos + _length);
break;
}
default:
{
break;
}
}
}
s.Seek2(_end_rec);
this.TempGroupObject = null;
if (_chart == null)
return null;
return _chart;
}
this.ReadGrFrame = function()
{
var s = this.stream;
......
......@@ -74,6 +74,8 @@ function CBinaryFileWriter()
this.pos = 0;
this.Init();
this.UseContinueWriter = false;
this.IsUseFullUrl = false;
this.DocumentOrigin = "";
this.PresentationThemesOrigin = "";
......@@ -2580,6 +2582,8 @@ function CBinaryFileWriter()
_memory.len = oThis.len;
_memory.pos = oThis.pos;
oThis.UseContinueWriter = true;
var oBinaryChartWriter = new BinaryChartWriter(_memory);
oBinaryChartWriter.WriteChartContent(grObj);
......@@ -2588,6 +2592,8 @@ function CBinaryFileWriter()
oThis.len = _memory.len;
oThis.pos = _memory.pos;
oThis.UseContinueWriter = false;
_memory.ImData = null;
_memory.data = null;
}
......
......@@ -525,7 +525,9 @@ function CPPTXContentLoader()
}
case 5:
{
s.SkipRecord();
var _chart = this.Reader.ReadChartDataInGroup(shape);
if (null != _chart)
shape.addGraphicObject(_chart);
break;
}
default:
......@@ -730,16 +732,34 @@ function CPPTXContentWriter()
this.ShapeTextBoxContent = null;
}
this.WriteTextBody = function(memory, textBody)
{
if (this.BinaryFileWriter.UseContinueWriter)
{
this.BinaryFileWriter.ImData = memory.ImData;
this.BinaryFileWriter.data = memory.data;
this.BinaryFileWriter.len = memory.len;
this.BinaryFileWriter.pos = memory.pos;
}
else
{
this.TreeDrawingIndex++;
this.arrayStackStarts.push(this.BinaryFileWriter.pos);
}
var _writer = this.BinaryFileWriter;
_writer.StartRecord(0);
_writer.WriteTxBody(textBody);
_writer.EndRecord();
if (this.BinaryFileWriter.UseContinueWriter)
{
memory.ImData = this.BinaryFileWriter.ImData;
memory.data = this.BinaryFileWriter.data;
memory.len = this.BinaryFileWriter.len;
memory.pos = this.BinaryFileWriter.pos;
}
else
{
this.TreeDrawingIndex--;
var oldPos = this.arrayStackStarts[this.arrayStackStarts.length - 1];
......@@ -748,18 +768,37 @@ function CPPTXContentWriter()
this.arrayStackStarts.splice(this.arrayStackStarts.length - 1, 1);
}
}
this.WriteSpPr = function(memory, spPr)
{
if (this.BinaryFileWriter.UseContinueWriter)
{
this.BinaryFileWriter.ImData = memory.ImData;
this.BinaryFileWriter.data = memory.data;
this.BinaryFileWriter.len = memory.len;
this.BinaryFileWriter.pos = memory.pos;
}
else
{
this.TreeDrawingIndex++;
this.arrayStackStarts.push(this.BinaryFileWriter.pos);
this.BinaryFileWriter.pos = 0;
}
var _writer = this.BinaryFileWriter;
_writer.StartRecord(0);
_writer.WriteSpPr(spPr);
_writer.EndRecord();
if (this.BinaryFileWriter.UseContinueWriter)
{
memory.ImData = this.BinaryFileWriter.ImData;
memory.data = this.BinaryFileWriter.data;
memory.len = this.BinaryFileWriter.len;
memory.pos = this.BinaryFileWriter.pos;
}
else
{
this.TreeDrawingIndex--;
var oldPos = this.arrayStackStarts[this.arrayStackStarts.length - 1];
......@@ -768,6 +807,7 @@ function CPPTXContentWriter()
this.arrayStackStarts.splice(this.arrayStackStarts.length - 1, 1);
}
}
this.WriteDrawing = function(memory, grObject, Document, oMapCommentId, oNumIdMap, copyParams)
{
this.TreeDrawingIndex++;
......@@ -1005,6 +1045,10 @@ function CPPTXContentWriter()
{
this.WriteGroup(elem, Document, oMapCommentId, oNumIdMap, copyParams);
}
else if ("undefined" !== typeof(CChartAsGroup) && elem instanceof CChartAsGroup)
{
this.BinaryFileWriter.WriteChart(elem);
}
_writer.EndRecord(0);
}
......
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