Commit 960bf331 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

(2.0.0.131): AVSOfficeDocxFile2

(1.0.0.54): XlsxSerializerCom
открытие для chart текстовых настроек.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47592 954022d7-b5bf-4e40-9824-e11837661b57
parent de3def33
......@@ -27,6 +27,7 @@
"../Common/FontsFreeType/font_engine.js",
"../Common/FontsFreeType/FontFile.js",
"../Common/FontsFreeType/FontManager.js",
"../Common/PresentationSerializeAdapter.js",
"../Word/Drawing/Externals.js",
"../Word/Drawing/Graphics.js",
"../Word/Drawing/Metafile.js",
......
......@@ -63,6 +63,7 @@
"../Common/FontsFreeType/font_engine.js",
"../Common/FontsFreeType/FontFile.js",
"../Common/FontsFreeType/FontManager.js",
"../Common/PresentationSerializeAdapter.js",
"../Word/Drawing/Externals.js",
"../Word/Drawing/AllFonts.js",
"../Word/Drawing/GlobalLoaders.js",
......
......@@ -217,6 +217,7 @@ function CChartData(bWordContext, chart) {
_this.data = [];
_this.themeColors = [];
_this.series = [];
if ( chart ) {
for (var row = 0; row < chart.data.length; row++) {
......@@ -993,6 +994,42 @@ asc_CChart.prototype = {
asc_getChartEditorFlag: function() { return this.bChartEditor; },
asc_setChartEditorFlag: function(value) { this.bChartEditor = value; },
generateFontMap: function(oFontMap)
{
var font;
font = this.header.asc_getFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
font = this.xAxis.asc_getTitleFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
font = this.xAxis.asc_getLabelFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
font = this.yAxis.asc_getTitleFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
font = this.yAxis.asc_getLabelFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
font = this.legend.asc_getFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
for(var i = 0, length = this.series.length; i < length; ++i)
{
var seria = this.series[i];
if(null != seria)
{
font = seria.asc_getTitleFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
font = seria.asc_getLabelFont();
if(null != font)
oFontMap[font.asc_getName()] = 1;
}
}
},
rebuildSeries: function() {
var _t = this;
var bbox = _t.range.intervalObject.getBBox0();
......@@ -1674,6 +1711,7 @@ function asc_CChartSeria() {
this.Val = { Formula: null, NumCache: [] };
this.xVal = { Formula: null, NumCache: [] };
this.Tx = null;
this.TxFont = new asc_CChartFont();
this.Marker = { Size: null, Symbol: null };
this.OutlineColor = null;
this.FormatCode = "";
......@@ -1689,7 +1727,8 @@ function asc_CChartSeria() {
MarkerSymbol: 6,
OutlineColor: 7,
FormatCode: 8,
LabelFont: 9
LabelFont: 9,
TxFont: 10
};
}
......@@ -1703,6 +1742,9 @@ asc_CChartSeria.prototype = {
asc_getTitle: function() { return this.Tx; },
asc_setTitle: function(title) { this.Tx = title; },
asc_getTitleFont: function() { return this.TxFont; },
asc_setTitleFont: function(title) { this.TxFont = title; },
asc_getMarkerSize: function() { return this.Marker.Size; },
asc_setMarkerSize: function(size) { this.Marker.Size = size; },
......@@ -1716,6 +1758,9 @@ asc_CChartSeria.prototype = {
asc_getFormatCode: function() { return this.FormatCode; },
asc_setFormatCode: function(format) { this.FormatCode = format; },
asc_getLabelFont: function() { return this.LabelFont; },
asc_setLabelFont: function(format) { this.LabelFont = format; },
// For collaborative editing
getType: function() {
return UndoRedoDataTypes.ChartSeriesData;
......@@ -1732,6 +1777,7 @@ asc_CChartSeria.prototype = {
case this.Properties.XValFormula: return this.xVal.Formula; break;
case this.Properties.XValNumCache: return this.xVal.NumCache; break;
case this.Properties.Tx: return this.Tx; break;
case this.Properties.TxFont: return this.TxFont; break;
case this.Properties.MarkerSize: return this.Marker.Size; break;
case this.Properties.MarkerSymbol: return this.Marker.Symbol; break;
case this.Properties.OutlineColor: return this.OutlineColor; break;
......@@ -1747,6 +1793,7 @@ asc_CChartSeria.prototype = {
case this.Properties.XValFormula: this.xVal.Formula = value; break;
case this.Properties.XValNumCache: this.xVal.NumCache = value; break;
case this.Properties.Tx: this.Tx = value; break;
case this.Properties.TxFont: this.TxFont = value; break;
case this.Properties.MarkerSize: this.Marker.Size = value; break;
case this.Properties.MarkerSymbol: this.Marker.Symbol = value; break;
case this.Properties.OutlineColor: this.OutlineColor = value; break;
......
//todo
//
function PresentationSimpleSerializer()
{
this.stream = null;
}
PresentationSimpleSerializer.prototype = {
ReadTextBody: function(stream)
{
if (null == this.stream)
{
this.stream = new FileStream();
this.stream.obj = stream.obj;
this.stream.data = stream.data;
this.stream.size = stream.size;
}
this.stream.pos = stream.pos;
this.stream.cur = stream.cur;
var s = this.stream;
var _main_type = s.GetUChar(); // 0!!!
var txBody = this.ReadTextBodyInternal();
stream.pos = s.pos;
stream.cur = s.cur;
return txBody;
},
ReadTextBodyInternal: function(shape)
{
var txbody = {bodyPr: null, lstStyle: null, content: null, textFieldFlag: null};
var s = this.stream;
var _rec_start = s.cur;
var _end_rec = _rec_start + s.GetULong() + 4;
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
switch (_at)
{
case 0:
{
txbody.bodyPr = this.ReadBodyPr();
break;
}
case 1:
{
txbody.lstStyle = this.ReadTextListStyle();
break;
}
case 2:
{
s.Skip2(4);
var _c = s.GetULong();
txbody.content = new Array();
if(_c>0)
{
txbody.content.length = 0;
}
var _last_field_type = false;
for (var i = 0; i < _c; i++)
{
s.Skip2(1); // type
var _paragraph = this.ReadParagraph(txbody.content);
txbody.content.push(_paragraph);
if(_paragraph.f_type != undefined || _paragraph.f_text != undefined || _paragraph.f_id != undefined)
{
_last_field_type = true;
}
}
if(_last_field_type)
{
txbody.textFieldFlag = true;
}
break;
}
default:
{
break;
}
}
}
s.Seek2(_end_rec);
return txbody;
},
ReadBodyPr: function()
{
var bodyPr = {flatTx: null, anchor: null, anchorCtr: null, bIns: null, compatLnSpc: null, forceAA: null, fromWordArt: null, horzOverflow: null,
lIns: null, numCol: null, rIns: null, rot: null, rtlCol: null, spcCol: null, spcFirstLastPara: null, tIns: null,
upright: null, vert: null, vertOverflow: null, wrap: null, textFit: null};
var s = this.stream;
var _end_rec = s.cur + s.GetULong() + 4;
s.Skip2(1); // start attributes
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
bodyPr.flatTx = s.GetLong();
break;
}
case 1:
{
bodyPr.anchor = s.GetUChar();
break;
}
case 2:
{
bodyPr.anchorCtr = s.GetBool();
break;
}
case 3:
{
bodyPr.bIns = s.GetLong()/36000;
break;
}
case 4:
{
bodyPr.compatLnSpc = s.GetBool();
break;
}
case 5:
{
bodyPr.forceAA = s.GetBool();
break;
}
case 6:
{
bodyPr.fromWordArt = s.GetBool();
break;
}
case 7:
{
bodyPr.horzOverflow = s.GetUChar();
break;
}
case 8:
{
bodyPr.lIns = s.GetLong()/36000;
break;
}
case 9:
{
bodyPr.numCol = s.GetLong();
break;
}
case 10:
{
bodyPr.rIns = s.GetLong()/36000;
break;
}
case 11:
{
bodyPr.rot = s.GetLong();
break;
}
case 12:
{
bodyPr.rtlCol = s.GetBool();
break;
}
case 13:
{
bodyPr.spcCol = s.GetLong();
break;
}
case 14:
{
bodyPr.spcFirstLastPara = s.GetBool();
break;
}
case 15:
{
bodyPr.tIns = s.GetLong()/36000;
break;
}
case 16:
{
bodyPr.upright = s.GetBool();
break;
}
case 17:
{
bodyPr.vert = s.GetUChar();
break;
}
case 18:
{
bodyPr.vertOverflow = s.GetUChar();
break;
}
case 19:
{
bodyPr.wrap = s.GetUChar();
break;
}
default:
break;
}
}
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
switch (_at)
{
case 1:
{
var _end_rec2 = s.cur + s.GetULong() + 4;
s.Skip2(1); // start attributes
var txFit = new CTextFit();
txFit.type = -1;
while (true)
{
var _at2 = s.GetUChar();
if (_at2 == g_nodeAttributeEnd)
break;
switch (_at2)
{
case 0:
{
txFit.type = s.GetLong() - 1;
break;
}
case 1:
{
txFit.fontScale = s.GetLong();
break;
}
case 2:
{
txFit.lnSpcReduction = s.GetLong();
break;
}
default:
break;
}
}
if (txFit.type != -1)
{
bodyPr.textFit = txFit;
}
s.Seek2(_end_rec2);
break;
}
default:
{
s.SkipRecord();
}
}
}
s.Seek2(_end_rec);
return bodyPr;
},
ReadTextListStyle: function()
{
var styles = {levels: new Array(10)};
var s = this.stream;
var _rec_start = s.cur;
var _end_rec = _rec_start + s.GetULong() + 4;
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
styles.levels[_at] = this.ReadTextParagraphPr();
}
s.Seek2(_end_rec);
return styles;
},
ReadTextParagraphPr: function()
{
var tPr = {
rPr: null
};
var rPr = null;
var s = this.stream;
var _end_rec = s.cur + s.GetULong() + 4;
s.Skip2(1); // start attributes
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
var _align = s.GetUChar();
break;
}
case 1:
{
var default_tab = s.GetLong()/36000;
break;
}
case 2:
{
s.Skip2(1); // eaLnBrk
break;
}
case 3:
{
s.Skip2(1); // font align
break;
}
case 4:
{
s.Skip2(1); // hangingPunct
break;
}
case 5:
{
s.GetLong()
break;
}
case 6:
{
s.Skip2(1); // latinLnBrk
break;
}
case 7:
{
s.GetLong();
break;
}
case 8:
{
s.GetLong();
break;
}
case 9:
{
s.GetLong();
break;
}
case 10:
{
s.Skip2(1); // rtl
break;
}
default:
break;
}
}
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
switch (_at)
{
case 8:
{
tPr.rPr = this.ReadRunProperties();
break;
}
default:
{
var cur_pos = s.cur;
var _len = s.GetULong();
s.Seek2(cur_pos + _len + 4);
}
}
}
//
s.Seek2(_end_rec);
return tPr;
},
ReadRunProperties: function()
{
var rPr = new Object();
var s = this.stream;
var _end_rec = s.cur + s.GetULong() + 4;
s.Skip2(1); // start attributes
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
var altLang = s.GetString2();
break;
}
case 1:
{
rPr.Bold = s.GetBool();
break;
}
case 2:
{
var baseline = s.GetLong();
break;
}
case 3:
{
var bmk = s.GetString2();
break;
}
case 4:
{
s.Skip2(1); // cap
break;
}
case 5:
{
s.Skip2(1); // dirty
break;
}
case 6:
{
s.Skip2(1); // error
break;
}
case 7:
{
rPr.Italic = s.GetBool();
break;
}
case 8:
{
s.Skip2(4); // kern
break;
}
case 9:
{
s.Skip2(1); // kumimoji
break;
}
case 10:
{
var lang = s.GetString2();
break;
}
case 11:
{
s.Skip2(1); // noproof
break;
}
case 12:
{
s.Skip2(1); // normalizeH
break;
}
case 13:
{
s.Skip2(1); // smtClean
break;
}
case 14:
{
s.Skip2(4); // smtId
break;
}
case 15:
{
s.Skip2(4); // spc
break;
}
case 16:
{
rPr.Strikeout = (s.GetUChar() != 1);
break;
}
case 17:
{
var _size = s.GetLong() / 100;
_size = ((_size * 2) + 0.5) >> 0;
_size /= 2;
rPr.FontSize = _size;
break;
}
case 18:
{
rPr.Underline = (s.GetUChar() != 12);
break;
}
default:
break;
}
}
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
switch (_at)
{
case 0:
{
s.SkipRecord();
break;
}
case 1:
{
rPr.unifill = this.ReadUniFill();
break;
}
case 2:
{
s.SkipRecord();
break;
}
case 3:
{
var _font_latin = this.ReadTextFontTypeface();
rPr.FontFamily = { Name: _font_latin, Index : -1 };
break;
}
case 4:
{
var ea = this.ReadTextFontTypeface();
break;
}
case 5:
{
var cs = this.ReadTextFontTypeface();
break;
}
case 6:
{
var sym = this.ReadTextFontTypeface();
break;
}
case 7:
{
s.SkipRecord();
break;
}
case 8:
{
s.SkipRecord();
}
default:
{
s.SkipRecord();
}
}
}
s.Seek2(_end_rec);
return rPr;
},
ReadUniFill: function()
{
var s = this.stream;
var read_start = s.cur;
var read_end = read_start + s.GetULong() + 4;
var uni_fill = new CUniFill();
if (s.cur < read_end)
{
var _type = s.GetUChar();
var _e = s.cur + s.GetULong() + 4;
switch (_type)
{
case FILL_TYPE_SOLID:
{
s.Skip2(1); // type + len
uni_fill.fill = new CSolidFill();
uni_fill.fill.color = this.ReadUniColor();
var mods = uni_fill.fill.color.Mods.Mods;
var _len = mods.length;
for (var i = 0; i < _len; i++)
{
if (mods[i].name == "alpha")
{
uni_fill.transparent = (255 * mods[i].val / 100000) >> 0;
mods.splice(i, 1);
break;
}
}
break;
}
default:
{
s.Seek2(_e);
break;
}
}
}
s.Seek2(read_end);
return uni_fill;
},
ReadUniColor : function()
{
var s = this.stream;
var _len = s.GetULong();
var read_start = s.cur;
var read_end = read_start + _len;
var uni_color = new CUniColor();
if (s.cur < read_end)
{
var _type = s.GetUChar();
var _e = s.cur + s.GetULong() + 4;
switch (_type)
{
case COLOR_TYPE_PRST:
{
s.Skip2(2);
uni_color.color = new CPrstColor();
uni_color.color.id = s.GetString2();
s.Skip2(1);
if (s.cur < _e)
{
if (0 == s.GetUChar())
{
uni_color.Mods.Mods = this.ReadColorModifiers();
}
}
break;
}
case COLOR_TYPE_SCHEME:
{
s.Skip2(2);
uni_color.color = new CSchemeColor();
uni_color.color.id = s.GetUChar();
s.Skip2(1);
if (s.cur < _e)
{
if (0 == s.GetUChar())
{
uni_color.Mods.Mods = this.ReadColorModifiers();
}
}
break;
}
case COLOR_TYPE_SRGB:
{
s.Skip2(1);
uni_color.color = new CRGBColor();
s.Skip2(1);
uni_color.color.RGBA.R = s.GetUChar();
s.Skip2(1);
uni_color.color.RGBA.G = s.GetUChar();
s.Skip2(1);
uni_color.color.RGBA.B = s.GetUChar();
s.Skip2(1);
if (s.cur < _e)
{
if (0 == s.GetUChar())
{
uni_color.Mods.Mods = this.ReadColorModifiers();
}
}
break;
}
case COLOR_TYPE_SYS:
{
s.Skip2(1);
uni_color.color = new CSysColor();
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
uni_color.color.id = s.GetString2();
break;
}
case 1:
{
uni_color.color.RGBA.R = s.GetUChar();
break;
}
case 2:
{
uni_color.color.RGBA.G = s.GetUChar();
break;
}
case 3:
{
uni_color.color.RGBA.B = s.GetUChar();
break;
}
default:
break;
}
}
if (s.cur < _e)
{
if (0 == s.GetUChar())
{
uni_color.Mods.Mods = this.ReadColorModifiers();
}
}
break;
}
}
}
s.Seek2(read_end);
return uni_color;
},
ReadColorModifiers : function()
{
var s = this.stream;
var _start = s.cur;
var _end = _start + s.GetULong() + 4;
var _ret = null;
var _count = s.GetULong();
for (var i = 0; i < _count; i++)
{
if (s.cur > _end)
break;
s.Skip2(1);
var _s1 = s.cur;
var _e1 = _s1 + s.GetULong() + 4;
if (_s1 < _e1)
{
s.Skip2(1);
if (null == _ret)
_ret = new Array();
var _mod = new CColorMod();
_ret[_ret.length] = _mod;
while (true)
{
var _type = s.GetUChar();
if (0 == _type)
{
_mod.name = s.GetString2();
var _find = _mod.name.indexOf(":");
if (_find >= 0 && _find < (_mod.name.length - 1))
_mod.name = _mod.name.substring(_find + 1);
}
else if (1 == _type)
_mod.val = s.GetLong();
else if (g_nodeAttributeEnd == _type)
break;
else
break;
}
}
s.Seek2(_e1);
}
s.Seek2(_end);
return _ret;
},
ReadTextFontTypeface: function()
{
var s = this.stream;
var _rec_start = s.cur;
var _end_rec = _rec_start + s.GetULong() + 4;
var charset = "";
var panose = "";
var pitchFamily = "";
var typeface = "";
s.Skip2(1); // start attributes
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
{
charset = s.GetString2();
break;
}
case 1:
{
panose = s.GetString2();
break;
}
case 2:
{
pitchFamily = s.GetString2();
break;
}
case 3:
{
typeface = s.GetString2();
break;
}
default:
break;
}
}
s.Seek2(_end_rec);
return typeface;
},
ReadParagraph: function()
{
var par = {rPr: null, text: ""};
var s = this.stream;
var _rec_start = s.cur;
var _end_rec = _rec_start + s.GetULong() + 4;
while (s.cur < _end_rec)
{
var _at = s.GetUChar();
switch (_at)
{
case 0:
{
var textProperties = this.ReadTextParagraphPr();
if(textProperties.rPr!=undefined)
{
par.rPr = textProperties.rPr;
}
break;
}
case 1:
{
var endRunPr = this.ReadRunProperties();
break;
}
case 2:
{
s.Skip2(4);
var _c = s.GetULong();
for (var i = 0; i < _c; i++)
{
s.Skip2(5); // type (0) + len
var _type = s.GetUChar();
switch (_type)
{
case PARRUN_TYPE_RUN:
{
var _end = s.cur + s.GetULong() + 4;
s.Skip2(1); // start attr
var _text = "";
while (true)
{
var _at = s.GetUChar();
if (_at == g_nodeAttributeEnd)
break;
if (0 == _at)
_text = s.GetString2();
}
s.Seek2(_end);
var bIsHyper = false;
par.text += _text;
break;
}
case PARRUN_TYPE_BR:
{
par.text += "\r\n";
var _end = s.cur + s.GetULong() + 4;
s.Seek2(_end);
break;
}
default:
break;
}
}
break;
}
default:
{
s.Skip2(4);
var _c = s.GetULong();
s.Seek2(_c);
break;
}
}
}
s.Seek2(_end_rec);
return par;
}
};
\ No newline at end of file
......@@ -736,14 +736,25 @@ var c_oSer_ChartType =
Legend: 0,
Title: 1,
PlotArea: 2,
Style: 3
Style: 3,
TitlePptx: 4,
TitleTxPrPptx: 5,
ShowBorder: 6
};
/** @enum */
var c_oSer_ChartLegendType =
{
LegendPos: 0,
Overlay: 1,
Layout: 2
Layout: 2,
LegendEntry: 3
};
/** @enum */
var c_oSer_ChartLegendEntryType =
{
Delete: 0,
Index: 1,
TxPrPptx: 2
};
/** @enum */
var c_oSer_ChartLegendLayoutType =
......@@ -773,7 +784,10 @@ var c_oSer_ChartCatAxType =
Title: 0,
MajorGridlines: 1,
Delete: 2,
AxPos: 3
AxPos: 3,
TitlePptx: 4,
TitleTxPrPptx: 5,
TxPrPptx: 6
};
/** @enum */
var c_oSer_BasicChartType =
......@@ -794,7 +808,9 @@ var c_oSer_ChartSeriesType =
Marker: 2,
OutlineColor: 3,
xVal: 4,
TxRef: 5
TxRef: 5,
Index: 6,
Order: 7
};
/** @enum */
var c_oSer_ChartSeriesMarkerType =
......@@ -805,7 +821,8 @@ var c_oSer_ChartSeriesMarkerType =
/** @enum */
var c_oSer_ChartSeriesDataLabelsType =
{
ShowVal: 0
ShowVal: 0,
TxPrPptx: 1
};
/** @enum */
var c_oSer_ChartSeriesNumCacheType =
......@@ -1236,8 +1253,12 @@ function Binary_ChartReader(stream, chart)
this.bcr = new Binary_CommonReader(this.stream);
this.chart = chart;
this.chartType = null;
this.oLegendEntries = new Object();
this.oSeriesByIndex = new Object();
this.PreRead = function()
{
this.oLegendEntries = new Object();
this.oSeriesByIndex = new Object();
this.chart.legend.bShow = false;
}
this.Read = function(length)
......@@ -1253,11 +1274,21 @@ function Binary_ChartReader(stream, chart)
};
this.PostRead = function()
{
if("" != this.chartType && null != this.chart.seriesOpen && this.chart.seriesOpen.length > 0)
if("" != this.chartType && null != this.chart.series && this.chart.series.length > 0)
{
// interval Woorksheet.init
// 1, isChart() true
this.chart.type = this.chartType;
for(var i in this.oLegendEntries)
{
var index = i - 0;
var legendEntries = this.oLegendEntries[i];
if(null != legendEntries.oTxPr)
{
var seria = this.oSeriesByIndex[i];
if(null != seria && null != legendEntries.oTxPr.font)
seria.titleFont = legendEntries.oTxPr.font;
}
}
}
}
this.GraphicFrame = function(type, length)
......@@ -1282,7 +1313,7 @@ function Binary_ChartReader(stream, chart)
{
this.chart.legend.bShow = true;
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadLegend(t,l);
return oThis.ReadLegend(t,l, this.oLegendEntries);
});
}
else if ( c_oSer_ChartType.Title === type )
......@@ -1321,18 +1352,29 @@ function Binary_ChartReader(stream, chart)
}
}
}
// Excel
this.chart.xAxis.bShow = this.chart.yAxis.bShow = false;
this.chart.xAxis.bGrid = this.chart.yAxis.bGrid = false;
var fExecAxis = function(oFrom, oTo)
{
for(var i in oFrom)
oTo[i] = oFrom[i];
if(null != oFrom.title)
oTo.title = oFrom.title;
if(null != oFrom.bDefaultTitle)
oTo.bDefaultTitle = oFrom.bDefaultTitle;
if(null != oFrom.bShow)
oTo.bShow = oFrom.bShow;
if(null != oFrom.bGrid)
oTo.bGrid = oFrom.bGrid;
if(null != oFrom.titlefont)
oTo.titleFont = oFrom.titlefont;
if(null != oFrom.lablefont)
oTo.labelFont = oFrom.lablefont;
}
if(null != xAxis)
fExecAxis(xAxis, this.chart.xAxis);
if(null != yAxis)
fExecAxis(yAxis, this.chart.yAxis);
//
// - Excel
var bTemp = this.chart.xAxis.bGrid;
this.chart.xAxis.bGrid = this.chart.yAxis.bGrid;
this.chart.yAxis.bGrid = bTemp;
......@@ -1347,11 +1389,25 @@ function Binary_ChartReader(stream, chart)
{
this.chart.styleId = this.stream.GetULongLE();
}
else if ( c_oSer_ChartType.TitlePptx === type || c_oSer_ChartType.TitleTxPrPptx === type)
{
var oPresentationSimpleSerializer = new PresentationSimpleSerializer();
var textBody = oPresentationSimpleSerializer.ReadTextBody(this.stream);
var params = this.ParsePptxParagraph(textBody);
if(c_oSer_ChartType.TitlePptx === type)
this.chart.header.title = params.text;
else
this.chart.header.bDefaultTitle = true;
if(null != params.font)
this.chart.header.font = params.font;
}
else if ( c_oSer_ChartType.ShowBorder === type )
this.chart.bShowBorder = this.stream.GetBool();
else
res = c_oSerConstants.ReadUnknown;
return res;
};
this.ReadLegend = function(type, length)
this.ReadLegend = function(type, length, oLegendEntries)
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
......@@ -1367,15 +1423,42 @@ function Binary_ChartReader(stream, chart)
var byteLegendPos = this.stream.GetUChar();
switch(byteLegendPos)
{
case EChartLegendPos.chartlegendposLeft: this.chart.legend.position = "left";break;
case EChartLegendPos.chartlegendposTop: this.chart.legend.position = "top";break;
case EChartLegendPos.chartlegendposLeft: this.chart.legend.position = c_oAscChartLegend.left;break;
case EChartLegendPos.chartlegendposTop: this.chart.legend.position = c_oAscChartLegend.top;break;
case EChartLegendPos.chartlegendposRight:
case EChartLegendPos.chartlegendposRightTop: this.chart.legend.position = "right";break;
case EChartLegendPos.chartlegendposBottom: this.chart.legend.position = "bottom";break;
case EChartLegendPos.chartlegendposRightTop: this.chart.legend.position = c_oAscChartLegend.right;break;
case EChartLegendPos.chartlegendposBottom: this.chart.legend.position = c_oAscChartLegend.bottom;break;
}
}
else if ( c_oSer_ChartLegendType.Overlay === type )
this.chart.legend.bOverlay = this.stream.GetBool();
else if ( c_oSer_ChartLegendType.LegendEntry === type )
{
var oNewLegendEntry = {nIndex: null, bDelete: null, oTxPr: null};
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadLegendEntry(t,l, oNewLegendEntry);
});
if(null != oNewLegendEntry.nIndex)
this.oLegendEntries[oNewLegendEntry.nIndex] = oNewLegendEntry;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
this.ReadLegendEntry = function(type, length, oLegendEntry)
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
if(c_oSer_ChartLegendEntryType.Index === type)
oLegendEntry.nIndex = this.stream.GetULongLE();
else if(c_oSer_ChartLegendEntryType.Delete === type)
oLegendEntry.bDelete = this.stream.GetBool();
else if(c_oSer_ChartLegendEntryType.TxPrPptx === type)
{
var oPresentationSimpleSerializer = new PresentationSimpleSerializer();
var textBody = oPresentationSimpleSerializer.ReadTextBody(this.stream);
oLegendEntry.oTxPr = this.ParsePptxParagraph(textBody);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
......@@ -1412,14 +1495,14 @@ function Binary_ChartReader(stream, chart)
var oThis = this;
if ( c_oSer_ChartPlotAreaType.CatAx === type )
{
oAxis.CatAx = new Object();
oAxis.CatAx = {title: null, bDefaultTitle: null, bGrid: null, bShow: null, axPos: null, titlefont: null, lablefont: null};
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadAx(t,l, oAxis.CatAx);
});
}
else if ( c_oSer_ChartPlotAreaType.ValAx === type )
{
var oNewValAx = new Object();
var oNewValAx = {title: null, bDefaultTitle: null, bGrid: null, bShow: null, axPos: null, titlefont: null, lablefont: null};
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadAx(t,l, oNewValAx);
});
......@@ -1427,16 +1510,16 @@ function Binary_ChartReader(stream, chart)
}
else if ( c_oSer_ChartPlotAreaType.BasicChart === type )
{
var oData = new Object();
var oData = {BarDerection: null};
res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.ReadBasicChart(t,l, oData);
});
if(null != oData.BarDerection && "HBar" == this.chartType)
if(null != oData.BarDerection && c_oAscChartType.hbar == this.chartType)
{
switch(oData.BarDerection)
{
case EChartBarDerection.chartbardirectionBar:break;
case EChartBarDerection.chartbardirectionCol: this.chartType = "Bar";break;
case EChartBarDerection.chartbardirectionCol: this.chartType = c_oAscChartType.bar;break;
}
}
}
......@@ -1444,7 +1527,7 @@ function Binary_ChartReader(stream, chart)
res = c_oSerConstants.ReadUnknown;
return res;
}
this.ReadAx = function(type, length, oAx, oAx2)
this.ReadAx = function(type, length, oAx)
{
var res = c_oSerConstants.ReadOk;
var oThis = this;
......@@ -1460,6 +1543,30 @@ function Binary_ChartReader(stream, chart)
oAx.bShow = !this.stream.GetBool();
else if ( c_oSer_ChartCatAxType.AxPos === type )
oAx.axPos = this.stream.GetUChar();
else if ( c_oSer_ChartCatAxType.TitlePptx === type || c_oSer_ChartCatAxType.TitleTxPrPptx === type)
{
var oPresentationSimpleSerializer = new PresentationSimpleSerializer();
var textBody = oPresentationSimpleSerializer.ReadTextBody(this.stream);
var params = this.ParsePptxParagraph(textBody);
if(c_oSer_ChartCatAxType.TitlePptx === type)
oAx.title = params.text;
else
oAx.bDefaultTitle = true;
if(null != params.font)
oAx.titlefont = params.font;
}
else if ( c_oSer_ChartCatAxType.TxPrPptx === type )
{
var oPresentationSimpleSerializer = new PresentationSimpleSerializer();
var textBody = oPresentationSimpleSerializer.ReadTextBody(this.stream);
var params = this.ParsePptxParagraph(textBody);
if("" != params.text)
oAx.title = params.text;
else
oAx.bDefaultTitle = true;
if(null != params.font)
oAx.lablefont = params.font;
}
else
res = c_oSerConstants.ReadUnknown;
return res;
......@@ -1474,16 +1581,16 @@ function Binary_ChartReader(stream, chart)
switch(byteType)
{
case EChartBasicTypes.chartbasicBarChart:
case EChartBasicTypes.chartbasicBar3DChart: this.chartType = "HBar";break;
case EChartBasicTypes.chartbasicBar3DChart: this.chartType = c_oAscChartType.hbar;break;
case EChartBasicTypes.chartbasicAreaChart:
case EChartBasicTypes.chartbasicRadarChart: this.chartType = "Area";break;
case EChartBasicTypes.chartbasicRadarChart: this.chartType = c_oAscChartType.area;break;
case EChartBasicTypes.chartbasicLineChart:
case EChartBasicTypes.chartbasicLine3DChart: this.chartType = "Line";break;
case EChartBasicTypes.chartbasicLine3DChart: this.chartType = c_oAscChartType.line;break;
case EChartBasicTypes.chartbasicPieChart:
case EChartBasicTypes.chartbasicDoughnutChart: this.chartType = "Pie";break;
case EChartBasicTypes.chartbasicDoughnutChart: this.chartType = c_oAscChartType.pie;break;
case EChartBasicTypes.chartbasicBubbleChart:
case EChartBasicTypes.chartbasicScatterChart: this.chartType = "Scatter";break;
case EChartBasicTypes.chartbasicStockChart: this.chartType = "Stock";break;
case EChartBasicTypes.chartbasicScatterChart: this.chartType = c_oAscChartType.scatter;break;
case EChartBasicTypes.chartbasicStockChart: this.chartType = c_oAscChartType.stock;break;
}
}
else if ( c_oSer_BasicChartType.BarDerection === type )
......@@ -1491,13 +1598,16 @@ function Binary_ChartReader(stream, chart)
else if ( c_oSer_BasicChartType.Grouping === type )
{
var byteGrouping = this.stream.GetUChar();
var subtype = null;
switch(byteGrouping)
{
case EChartBarGrouping.chartbargroupingClustered:
case EChartBarGrouping.chartbargroupingStandard: this.chart.subType = "normal";break;
case EChartBarGrouping.chartbargroupingPercentStacked: this.chart.subType = "stackedPer";break;
case EChartBarGrouping.chartbargroupingStacked: this.chart.subType = "stacked";break;
case EChartBarGrouping.chartbargroupingStandard: subtype = c_oAscChartSubType.normal;break;
case EChartBarGrouping.chartbargroupingPercentStacked: subtype = c_oAscChartSubType.stackedPer;break;
case EChartBarGrouping.chartbargroupingStacked: subtype = c_oAscChartSubType.stacked;break;
}
if(null != subtype)
this.chart.subType = subtype;
}
else if ( c_oSer_BasicChartType.Overlap === type )
{
......@@ -1505,7 +1615,6 @@ function Binary_ChartReader(stream, chart)
}
else if ( c_oSer_BasicChartType.Series === type )
{
this.chart.seriesOpen = new Array();
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeries(t,l);
});
......@@ -1526,11 +1635,11 @@ function Binary_ChartReader(stream, chart)
var oThis = this;
if ( c_oSer_BasicChartType.Seria === type )
{
var seria = new Object();
var seria = new asc_CChartSeria();
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeria(t,l, seria);
});
this.chart.seriesOpen.push(seria);
this.chart.series.push(seria);
}
else
res = c_oSerConstants.ReadUnknown;
......@@ -1542,30 +1651,27 @@ function Binary_ChartReader(stream, chart)
var oThis = this;
if ( c_oSer_ChartSeriesType.xVal === type )
{
seria.xVal = new Object();
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeriesNumCache(t,l, seria.xVal);
});
}
else if ( c_oSer_ChartSeriesType.Val === type )
{
seria.Val = new Object();
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeriesNumCache(t,l, seria.Val);
});
}
else if ( c_oSer_ChartSeriesType.Tx === type )
seria.Tx = this.stream.GetString2LE(length);
else if ( c_oSer_ChartSeriesType.TxRef === type )
{
seria.TxRef = new Object();
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeriesNumCache(t,l, seria.TxRef);
});
}
seria.title = this.stream.GetString2LE(length);
// else if ( c_oSer_ChartSeriesType.TxRef === type )
// {
// seria.TxRef = new Object();
// res = this.bcr.Read1(length, function(t,l){
// return oThis.ReadSeriesNumCache(t,l, seria.TxRef);
// });
// }
else if ( c_oSer_ChartSeriesType.Marker === type )
{
seria.Marker = new Object();
res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.ReadSeriesMarkers(t,l, seria.Marker);
});
......@@ -1576,8 +1682,18 @@ function Binary_ChartReader(stream, chart)
res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.bcr.ReadColorSpreadsheet(t,l, color);
});
if(null != color.rgb)
seria.OutlineColor = color.rgb;
if(null != color.theme)
seria.OutlineColor = g_oColorManager.getThemeColor(color.theme, color.tint);
else if(null != color.rgb)
seria.OutlineColor = new RgbColor(0x00ffffff & color.rgb);
}
else if ( c_oSer_ChartSeriesType.Index === type )
{
this.oSeriesByIndex[this.stream.GetULongLE()] = seria;
}
else if ( c_oSer_ChartSeriesType.Order === type )
{
this.stream.GetULongLE();
}
else
res = c_oSerConstants.ReadUnknown;
......@@ -1591,9 +1707,8 @@ function Binary_ChartReader(stream, chart)
Val.Formula = this.stream.GetString2LE(length);
else if ( c_oSer_ChartSeriesNumCacheType.NumCache === type )
{
Val.values = new Array();
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadSeriesNumCacheValues(t,l, Val.values);
return oThis.ReadSeriesNumCacheValues(t,l, Val.NumCache);
});
}
else
......@@ -1628,10 +1743,88 @@ function Binary_ChartReader(stream, chart)
var oThis = this;
if ( c_oSer_ChartSeriesDataLabelsType.ShowVal === type )
this.chart.bShowValue = this.stream.GetBool();
else if ( c_oSer_ChartSeriesDataLabelsType.TxPrPptx === type )
{
var oPresentationSimpleSerializer = new PresentationSimpleSerializer();
var textBody = oPresentationSimpleSerializer.ReadTextBody(this.stream);
//this.ParsePptxParagraph(textBody);
}
else
res = c_oSerConstants.ReadUnknown;
return res;
};
this.ParsePptxParagraph = function(textbody)
{
var res = {text: "", font: null};
for(var i = 0, length = textbody.content.length; i < length; ++i)
{
var par = textbody.content[i];
if(0 != i)
res.text += "\r\n";
else
{
if(null != par.rPr)
{
res.font = new asc_CChartFont();
if(null != par.rPr.Bold)
res.font.bold = par.rPr.Bold ? 1 : 0;
if(null != par.rPr.Italic)
res.font.italic = par.rPr.Italic ? 1 : 0;
if(null != par.rPr.Underline)
res.font.underline = par.rPr.Underline ? 1 : 0;
if(null != par.rPr.FontSize)
res.font.size = par.rPr.FontSize;
if(null != par.rPr.FontFamily && null != par.rPr.FontFamily.Name && "" != par.rPr.FontFamily.Name)
res.font.name = par.rPr.FontFamily.Name;
// if(null != par.rPr.unifill)
// {
// var fill = par.rPr.unifill.fill;
// if(null != fill && FILL_TYPE_SOLID == fill.type)
// {
// var color = fill.color;
// if(null != color.color)
// {
// color = color.color;
// if(null != color)
// {
// var rgba = {R:0, G:0, B:0, A:255};
// if(COLOR_TYPE_SRGB == color.type)
// {
// rgba.R = color.RGBA.R;
// rgba.G = color.RGBA.G;
// rgba.B = color.RGBA.B;
// }
// else if(COLOR_TYPE_SCHEME == color.type)
// {
// var _theme = null;
// var _clrMap = null;
// if(null != Asc && null != Asc.editor && null != Asc.editor.wbModel)
// {
// _theme = Asc.editor.wbModel.theme;
// _clrMap = Asc.editor.wbModel.clrSchemeMap;
// }
// else if(null != editor && null != editor.WordControl && null != editor.WordControl.m_oLogicDocument)
// {
// _theme = editor.WordControl.m_oLogicDocument.theme;
// _clrMap = editor.WordControl.m_oLogicDocument.clrSchemeMap;
// }
// if(null != _theme && null != _clrMap)
// color.Calculate(_theme, _clrMap, rgba);
// }
// var num = rgba.R << 16 | rgba.G << 8 | rgba.B;
// var c = num.toString(16);
// while (c.length < 6) {c = "0" + c;}
// res.font.color = num;
// }
// }
// }
// }
}
}
res.text += par.text;
}
return res;
}
}
function isRealObject(obj)
......
......@@ -99,7 +99,10 @@
<script type="text/javascript" src="apiDefines.js"></script>
<script type="text/javascript" src="api.js"></script>
<script type="text/javascript" src="menu/menu.js"></script>
<!--for presentation-->
<script type="text/javascript" src="../Common/PresentationSerializeAdapter.js"></script>
<!--for theme-->
<script type="text/javascript" src="../Common/Shapes/EditorSettings.js"></script>
<script type="text/javascript" src="../Common/Shapes/Serialize.js"></script>
......
......@@ -4827,8 +4827,6 @@ function Binary_WorksheetTableReader(stream, wb, aSharedStrings, aCellXfs, Dxfs,
}
else if ( c_oSerWorksheetsTypes.Drawings == type )
{
if(null == oWorksheet.Drawings)
oWorksheet.Drawings = new Array();
res = this.bcr.Read1(length, function(t,l){
return oThis.ReadDrawings(t,l, oWorksheet.Drawings, oWorksheet.Id);
});
......
......@@ -1361,6 +1361,7 @@ function Workbook(sUrlPath, eventsHandlers, oApi){
this.nActive = 0;
this.theme = GenerateDefaultTheme(this);
this.clrSchemeMap = GenerateDefaultColorMap();
this.DefinedNames = new Object();
this.oRealDefinedNames = new Object();
......@@ -2095,6 +2096,7 @@ function Woorksheet(wb, _index, bAddUserId, sId){
this.nColsCount = 0;
this.aGCells = new Object();// 0 based
this.aCols = new Array();// 0 based
this.Drawings = new Array();
this.oAllCol = null;
this.objForRebuldFormula = {};
this.aComments = new Array();
......@@ -2150,6 +2152,16 @@ Woorksheet.prototype.generateFontMap=function(oFontMap){
}
}
}
//пробегаемся по chart
for(var i = 0, length = this.Drawings.length; i < length; ++i)
{
var drawing = this.Drawings[i];
if(drawing.isChart())
{
var chart = drawing.chart;
chart.generateFontMap(oFontMap);
}
}
}
Woorksheet.prototype.clone=function(sNewId){
var oNewWs;
......@@ -2309,9 +2321,9 @@ Woorksheet.prototype.initPostOpen = function(){
//анализируем series
var oBounds = null;
var ws = null;
for(var j = 0; j < chart.seriesOpen.length; ++j)
for(var j = 0; j < chart.series.length; ++j)
{
var seria = chart.seriesOpen[j];
var seria = chart.series[j];
if(0 == j && null != seria && null != seria.xVal && null != seria.xVal.Formula)
{
var sRef = seria.xVal.Formula.replace(/\$/g,"");
......
......@@ -5183,9 +5183,9 @@ function Binary_DocumentTableReader(doc, openParams, ImageMap, stream, bAllowFlo
});
oBinary_ChartReader.PostRead();
//анализируем серии заполняем data
for(var i = 0, length = chart.seriesOpen.length; i < length; ++i)
for(var i = 0, length = chart.series.length; i < length; ++i)
{
var seria = chart.seriesOpen[i];
var seria = chart.series[i];
if(null != seria)
{
if(0 == i)
......
......@@ -154,6 +154,9 @@
<script type="text/javascript" src="../Common/SerializeCommonWordExcel.js"></script>
<script type="text/javascript" src="Editor/SerializeCommon.js"></script>
<!--for presentation-->
<script type="text/javascript" src="../Common/PresentationSerializeAdapter.js"></script>
</head>
<body id="id_body" class="block_elem" style="-moz-user-select:none;-khtml-user-select:none;user-select:none;width:100%;height:100%;background-color:#B0B0B0;overflow:hidden;position:fixed;" UNSELECTABLE="on">
<div id="id_menu" class="block_elem" style="width:100%;height:21mm;background-color:#F4F5F6;">
......
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