Commit 5fdce5ad 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@53430 954022d7-b5bf-4e40-9824-e11837661b57
parent c7652f03
...@@ -4,7 +4,7 @@ function CBandFmt() ...@@ -4,7 +4,7 @@ function CBandFmt()
this.spPr = null; this.spPr = null;
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
g_oIdCounter.Add(this, this.Id); g_oTableId.Add(this, this.Id);
} }
CBandFmt.prototype = CBandFmt.prototype =
......
...@@ -19,7 +19,7 @@ function CChart() ...@@ -19,7 +19,7 @@ function CChart()
this.view3D = null; this.view3D = null;
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
g_oIdCounter.Add(this, this.Id); g_oTableId.Add(this, this.Id);
} }
CChart.prototype = CChart.prototype =
......
...@@ -1711,8 +1711,7 @@ CPageSetup.prototype = ...@@ -1711,8 +1711,7 @@ CPageSetup.prototype =
} }
}; };
function CreateLineChart(asc_series, type)
function CreateDefaultLineNormalChart(asc_series)
{ {
var chart_space = new CChartSpace(); var chart_space = new CChartSpace();
chart_space.setDate1904(false); chart_space.setDate1904(false);
...@@ -1725,58 +1724,30 @@ function CreateDefaultLineNormalChart(asc_series) ...@@ -1725,58 +1724,30 @@ function CreateDefaultLineNormalChart(asc_series)
chart.setPlotArea(new CPlotArea()); chart.setPlotArea(new CPlotArea());
chart.setLegend(new CLegend()); chart.setLegend(new CLegend());
chart.setPlotVisOnly(true); chart.setPlotVisOnly(true);
chart.setDispBlanksAs(DISP_BLANKS_AS_GAP); var disp_blanks_as;
if(type === GROUPING_STANDARD)
{
disp_blanks_as = DISP_BLANKS_AS_GAP;
}
else
{
disp_blanks_as = DISP_BLANKS_AS_ZERO;
}
chart.setDispBlanksAs(disp_blanks_as);
chart.setShowDLblsOverMax(false); chart.setShowDLblsOverMax(false);
var plot_area = chart.plotArea; var plot_area = chart.plotArea;
plot_area.setLayout(new CLayout()); plot_area.setLayout(new CLayout());
plot_area.setChart(new CLineChart()); plot_area.setChart(new CLineChart());
plot_area.setCatAx(new CAxis()); plot_area.setCatAx(new CAxis());
plot_area.setValAx(new CAxis()); plot_area.setValAx(new CAxis());
var cat_ax = plot_area.catAx;
cat_ax.setScaling(new CScaling());
cat_ax.setDelete(false);
cat_ax.setAxPos(AX_POS_B);
cat_ax.setMajorTickMark(TICK_MARK_OUT);
cat_ax.setMinorTickMark(TICK_MARK_NONE);
cat_ax.setTickLblPos(TICK_LABEL_POSITION_NEXT_TO);
cat_ax.setCrosses(CROSSES_AUTO_ZERO);
cat_ax.setAuto(true);
cat_ax.setLblAlgn(LBL_ALG_CTR);
cat_ax.setLblOffset(100);
cat_ax.setNoMultiLvlLbl(false);
var scaling = cat_ax.scaling;
scaling.setOrientation(ORIENTATION_MIN_MAX);
var val_ax = plot_area.valAx;
val_ax.setScaling(new CScaling());
val_ax.setDelete(false);
val_ax.setAxPos(AX_POS_L);
val_ax.setMajorGridlines(new CSpPr());
val_ax.setNumFmt(new CNumFmt());
val_ax.setMajorTickMark(TICK_MARK_OUT);
val_ax.setMinorTickMark(TICK_MARK_NONE);
val_ax.setTickLblPos(TICK_LABEL_POSITION_NEXT_TO);
val_ax.setCrossAx(cat_ax.Get_Id());
val_ax.setCrosses(CROSSES_AUTO_ZERO);
val_ax.setCrossBetween(CROSS_BETWEEN_BETWEEN);
cat_ax.setCrossAx(val_ax.Get_Id());
scaling = val_ax.scaling;
scaling.setOrientation(ORIENTATION_MIN_MAX);
var legend = chart.legend;
legend.setLegendPos(LEGEND_POS_R);
legend.setLayout(new CLayout());
legend.setOverlay(false);
var line_chart = plot_area.chart; var line_chart = plot_area.chart;
line_chart.setGrouping(GROUPING_STANDARD); line_chart.setGrouping(type);
line_chart.setVaryColors(false); line_chart.setVaryColors(false);
line_chart.setDLbls(new CDLbls()); line_chart.setDLbls(new CDLbls());
line_chart.setMarker(true); line_chart.setMarker(true);
line_chart.setSmooth(false); line_chart.setSmooth(false);
line_chart.addAxId(cat_ax.Get_Id()); line_chart.addAxId(plot_area.catAx.Get_Id());
line_chart.addAxId(val_ax.Get_Id()); line_chart.addAxId(plot_area.valAx.Get_Id());
for(var i = 0; i < asc_series.length; ++i) for(var i = 0; i < asc_series.length; ++i)
{ {
var series = new CLineSeries(); var series = new CLineSeries();
...@@ -1785,61 +1756,24 @@ function CreateDefaultLineNormalChart(asc_series) ...@@ -1785,61 +1756,24 @@ function CreateDefaultLineNormalChart(asc_series)
series.setMarker(new CMarker()); series.setMarker(new CMarker());
series.marker.setSymbol(SYMBOL_NONE); series.marker.setSymbol(SYMBOL_NONE);
series.setSmooth(false); series.setSmooth(false);
series.setVal(new CYVal());
var val = series.val;
val.setNumRef(new CNumRef());
var num_ref = val.numRef;
num_ref.setF(asc_series[i].Val.Formula);
num_ref.setNumCache(new CNumLit());
var num_cache = num_ref.numCache;
num_cache.setPtCount(asc_series[i].Val.NumCache.length);
for(var j = 0; j < asc_series[i].Val.NumCache.length; ++j)
{
var pt = new CNumericPoint();
pt.setIdx(j);
pt.setFormatCode(asc_series[i].Val.NumCache[j].numFormatStr);
pt.setVal(asc_series[i].Val.NumCache[j].val);
num_cache.addPt(pt);
}
line_chart.addSer(series);
} }
var d_lbls = line_chart.dLbls;
d_lbls.setShowLegendKey(false);
d_lbls.setShowVal(false);
d_lbls.setShowCatName(false);
d_lbls.setShowSerName(false);
d_lbls.setShowPercent(false);
d_lbls.setShowBubbleSize(false);
var print_settings = chart_space.printSettings;
print_settings.setHeaderFooter(new CHeaderFooterChart());
print_settings.setPageMargins(new CPageMarginsChart());
var page_margins = print_settings.pageMargins;
page_margins.setB(0.75);
page_margins.setL(0.7);
page_margins.setR(0.7);
page_margins.setT(0.75);
page_margins.setHeader(0.3);
page_margins.setFooter(0.3);
page_margins.setPageSetup(new CPageSetup());
return chart_space;
}
function CreateDefaultLineStackedChart()
{
var chart_space = new CChartSpace();
chart_space.setDate1904(false);
chart_space.setLang("ru-RU");
chart_space.setRoundedCorners(false);
chart_space.setChart(new CChart());
chart_space.setPrintSettings(new CPrintSettings());
var chart = chart_space.chart;
chart.setAutoTitleDeleted(false);
chart.setPlotArea(new CPlotArea());
chart.setLegend(new CLegend());
chart.setPlotVisOnly(true);
chart.setDispBlanksAs(DISP_BLANKS_AS_ZERO);
chart.setShowDLblsOverMax(false);
var plot_area = chart.plotArea;
plot_area.setLayout(new CLayout());
plot_area.setChart(new CLineChart());
plot_area.setCatAx(new CAxis());
plot_area.setValAx(new CAxis());
var line_chart = plot_area.chart;
line_chart.setGrouping(GROUPING_STACKED);
line_chart.setVaryColors(false);
line_chart.setDLbls(new CDLbls());
line_chart.setMarker(true);
line_chart.setSmooth(false);
line_chart.addAxId(plot_area.catAx);
line_chart.addAxId(plot_area.valAx);
var d_lbls = line_chart.dLbls; var d_lbls = line_chart.dLbls;
d_lbls.setShowLegendKey(false); d_lbls.setShowLegendKey(false);
d_lbls.setShowVal(false); d_lbls.setShowVal(false);
...@@ -1847,15 +1781,14 @@ function CreateDefaultLineStackedChart() ...@@ -1847,15 +1781,14 @@ function CreateDefaultLineStackedChart()
d_lbls.setShowSerName(false); d_lbls.setShowSerName(false);
d_lbls.setShowPercent(false); d_lbls.setShowPercent(false);
d_lbls.setShowBubbleSize(false); d_lbls.setShowBubbleSize(false);
var cat_ax = plot_area.catAx; var cat_ax = plot_area.catAx;
cat_ax.setScaling(new CScaling()); cat_ax.setScaling(new CScaling());
cat_ax.setDelete(false); cat_ax.setDelete(false);
cat_ax.setAxPos(AX_POS_B); cat_ax.setAxPos(AX_POS_B);
cat_ax.setMajorTickMark(TICK_MARK_OUT); cat_ax.setMajorTickMark(TICK_MARK_OUT);
cat_ax.setMinorTickMark(TICK_MARK_NONE); cat_ax.setMinorTickMark(TICK_MARK_OUT);
cat_ax.setTickLblPos(TICK_LABEL_POSITION_NEXT_TO); cat_ax.setTickLblPos(TICK_LABEL_POSITION_NEXT_TO);
cat_ax.setCrossAx(line_chart.valAx.Get_Id()); cat_ax.setCrossAx(plot_area.valAx.Get_Id());
cat_ax.setCrosses(CROSSES_AUTO_ZERO); cat_ax.setCrosses(CROSSES_AUTO_ZERO);
cat_ax.setAuto(true); cat_ax.setAuto(true);
cat_ax.setLblAlgn(LBL_ALG_CTR); cat_ax.setLblAlgn(LBL_ALG_CTR);
...@@ -1863,7 +1796,6 @@ function CreateDefaultLineStackedChart() ...@@ -1863,7 +1796,6 @@ function CreateDefaultLineStackedChart()
cat_ax.setNoMultiLvlLbl(false); cat_ax.setNoMultiLvlLbl(false);
var scaling = cat_ax.scaling; var scaling = cat_ax.scaling;
scaling.setOrientation(ORIENTATION_MIN_MAX); scaling.setOrientation(ORIENTATION_MIN_MAX);
var val_ax = plot_area.valAx; var val_ax = plot_area.valAx;
val_ax.setScaling(new CScaling()); val_ax.setScaling(new CScaling());
val_ax.setDelete(false); val_ax.setDelete(false);
...@@ -1873,18 +1805,36 @@ function CreateDefaultLineStackedChart() ...@@ -1873,18 +1805,36 @@ function CreateDefaultLineStackedChart()
val_ax.setMajorTickMark(TICK_MARK_OUT); val_ax.setMajorTickMark(TICK_MARK_OUT);
val_ax.setMinorTickMark(TICK_MARK_NONE); val_ax.setMinorTickMark(TICK_MARK_NONE);
val_ax.setTickLblPos(TICK_LABEL_POSITION_NEXT_TO); val_ax.setTickLblPos(TICK_LABEL_POSITION_NEXT_TO);
val_ax.setCrossAx(cat_ax.Get_Id()); val_ax.setCrossAx(plot_area.catAx);
val_ax.setCrosses(CROSSES_AUTO_ZERO); val_ax.setCrosses(CROSSES_AUTO_ZERO);
val_ax.setCrossBetween(CROSS_BETWEEN_BETWEEN); val_ax.setCrossBetween(CROSS_BETWEEN_BETWEEN);
scaling = val_ax.scaling; scaling = val_ax.scaling;
scaling.setOrientation(ORIENTATION_MIN_MAX); scaling.setOrientation(ORIENTATION_MIN_MAX);
var num_fmt = val_ax.numFmt; var num_fmt = val_ax.numFmt;
num_fmt.setFormatCode("General"); var format_code;
if(type === GROUPING_PERCENT_STACKED)
{
format_code = "0%";
}
else
{
format_code = "General";
}
num_fmt.setFormatCode(format_code);
num_fmt.setSourceLinked(true); num_fmt.setSourceLinked(true);
var legend = chart.legend; var legend = chart.legend;
legend.setLegendPos(LEGEND_POS_R); legend.setLegendPos(LEGEND_POS_R);
legend.setLayout(new CLayout()); legend.setLayout(new CLayout());
legend.setOverlay(false); legend.setOverlay(false);
return chart_space; var print_settings = chart_space.printSettings;
print_settings.setHeaderFooter(new CHeaderFooterChart());
print_settings.setPageMargins(new CPageMarginsChart());
print_settings.setPageSetup(new CPageSetup());
var page_margins = print_settings.pageMargins;
page_margins.setB(0.75);
page_margins.setL(0.7);
page_margins.setR(0.7);
page_margins.setT(0.75);
page_margins.setHeader(0.3);
page_margins.setFooter(0.3);
} }
\ No newline at end of file
...@@ -302,7 +302,7 @@ var historyitem_ErrBars_SetVal = 2296; ...@@ -302,7 +302,7 @@ var historyitem_ErrBars_SetVal = 2296;
var historyitem_MinusPlus_SetnNumLit = 2297; var historyitem_MinusPlus_SetnNumLit = 2297;
var historyitem_MinusPlus_SetnNumRef = 2298; var historyitem_MinusPlus_SetnNumRef = 2298;
var historyitem_NumLit_SetFormatCode = 2299; var historyitem_NumLit_SetFormatCode = 2299;
var historyitem_NumLit_SetPt = 2300; var historyitem_NumLit_AddPt = 2300;
var historyitem_NumLit_SetPtCount = 2301; var historyitem_NumLit_SetPtCount = 2301;
var historyitem_NumericPoint_SetFormatCode = 2302; var historyitem_NumericPoint_SetFormatCode = 2302;
var historyitem_NumericPoint_SetIdx = 2303; var historyitem_NumericPoint_SetIdx = 2303;
...@@ -466,7 +466,7 @@ var historyitem_SpPr_SetXfrm = 2458; ...@@ -466,7 +466,7 @@ var historyitem_SpPr_SetXfrm = 2458;
var historyitem_SpPr_SetGeometry = 2459; var historyitem_SpPr_SetGeometry = 2459;
var historyitem_SpPr_SetFill = 2460; var historyitem_SpPr_SetFill = 2460;
var historyitem_SpPr_SetLn = 2461; var historyitem_SpPr_SetLn = 2461;
var historyitem_ClrScheme_SetClr = 2462; var historyitem_ClrScheme_AddClr = 2462;
var historyitem_ClrScheme_SetName = 2463; var historyitem_ClrScheme_SetName = 2463;
var historyitem_ClrMap_SetClr = 2464; var historyitem_ClrMap_SetClr = 2464;
var historyitem_ExtraClrScheme_SetClrScheme = 2465; var historyitem_ExtraClrScheme_SetClrScheme = 2465;
...@@ -523,6 +523,13 @@ var historyitem_PageSetupSetPaperSize = 2515; ...@@ -523,6 +523,13 @@ var historyitem_PageSetupSetPaperSize = 2515;
var historyitem_PageSetupSetPaperWidth = 2516; var historyitem_PageSetupSetPaperWidth = 2516;
var historyitem_PageSetupSetUseFirstPageNumb = 2517; var historyitem_PageSetupSetUseFirstPageNumb = 2517;
var historyitem_PageSetupSetVerticalDpi = 2518; var historyitem_PageSetupSetVerticalDpi = 2518;
var historyitem_ShapeSetNvSpPr = 2519;
var historyitem_ShapeSetSpPr = 2520;
var historyitem_ShapeSetStyle = 2521;
var historyitem_ShapeSetTxBody = 2522;
var historyitem_ShapeSetTextBoxContent = 2523;
var historyitem_ShapeSetParent = 2524;
var historyitem_ShapeSetGroup = 2525;
var historyitem_type_ColorMod = 1001; var historyitem_type_ColorMod = 1001;
var historyitem_type_ColorModifiers = 1002; var historyitem_type_ColorModifiers = 1002;
...@@ -627,6 +634,7 @@ var historyitem_type_PrintSettings = 1099; ...@@ -627,6 +634,7 @@ var historyitem_type_PrintSettings = 1099;
var historyitem_type_HeaderFooterChart = 1100; var historyitem_type_HeaderFooterChart = 1100;
var historyitem_type_PageMarginsChart = 1101; var historyitem_type_PageMarginsChart = 1101;
var historyitem_type_PageSetup = 1102; var historyitem_type_PageSetup = 1102;
var historyitem_type_Shape = 1103;
......
...@@ -1492,11 +1492,11 @@ CUniColor.prototype = ...@@ -1492,11 +1492,11 @@ CUniColor.prototype =
{ {
if(r.GetBool()) if(r.GetBool())
{ {
this.Mods = = g_oTableId.Get_ById(r.GetString2()); this.Mods = g_oTableId.Get_ById(r.GetString2());
} }
else else
{ {
thos.Mods = null; this.Mods = null;
} }
break; break;
} }
...@@ -3813,7 +3813,7 @@ EndArrow.prototype = ...@@ -3813,7 +3813,7 @@ EndArrow.prototype =
Read_FromBinary2: function (r) Read_FromBinary2: function (r)
{ {
this.Id = r.GetString2(); this.Id = r.GetString2();
} },
getObjectType: function() getObjectType: function()
{ {
...@@ -4726,7 +4726,7 @@ DefaultShapeDefinition.prototype= ...@@ -4726,7 +4726,7 @@ DefaultShapeDefinition.prototype=
Undo: function(data) Undo: function(data)
{ {
switch() switch(data.Type)
{ {
case historyitem_DefaultShapeDefinition_SetSpPr: case historyitem_DefaultShapeDefinition_SetSpPr:
{ {
...@@ -4753,7 +4753,7 @@ DefaultShapeDefinition.prototype= ...@@ -4753,7 +4753,7 @@ DefaultShapeDefinition.prototype=
Redo: function(data) Redo: function(data)
{ {
switch() switch(data.Type)
{ {
case historyitem_DefaultShapeDefinition_SetSpPr: case historyitem_DefaultShapeDefinition_SetSpPr:
{ {
...@@ -6742,7 +6742,7 @@ function CSpPr() ...@@ -6742,7 +6742,7 @@ function CSpPr()
this.Geometry = null;//new Geometry(); this.Geometry = null;//new Geometry();
this.Fill = null; this.Fill = null;
this.ln = null; this.ln = null;
this.parent = null;
this.merge = function(spPr) this.merge = function(spPr)
{ {
/*if(spPr.xfrm != null) /*if(spPr.xfrm != null)
...@@ -7063,9 +7063,9 @@ ClrScheme.prototype = ...@@ -7063,9 +7063,9 @@ ClrScheme.prototype =
this.name = name; this.name = name;
}, },
setColor: function(index, color) addColor: function(index, color)
{ {
History.Add(this, {Type: historyitem_ClrScheme_SetClr, index: index, newColor: color, oldColor: this.colors[index]}); History.Add(this, {Type: historyitem_ClrScheme_AddClr, index: index, newColor: color, oldColor: this.colors[index]});
this.colors[index] = color; this.colors[index] = color;
}, },
...@@ -7078,7 +7078,7 @@ ClrScheme.prototype = ...@@ -7078,7 +7078,7 @@ ClrScheme.prototype =
this.name = data.oldPr; this.name = data.oldPr;
break; break;
} }
case historyitem_ClrScheme_SetClr: case historyitem_ClrScheme_AddClr:
{ {
this.colors[data.index] = data.oldColor; this.colors[data.index] = data.oldColor;
} }
...@@ -7094,7 +7094,7 @@ ClrScheme.prototype = ...@@ -7094,7 +7094,7 @@ ClrScheme.prototype =
this.name = data.newPr; this.name = data.newPr;
break; break;
} }
case historyitem_ClrScheme_SetClr: case historyitem_ClrScheme_AddClr:
{ {
this.colors[data.index] = data.newColor; this.colors[data.index] = data.newColor;
} }
...@@ -7111,7 +7111,7 @@ ClrScheme.prototype = ...@@ -7111,7 +7111,7 @@ ClrScheme.prototype =
writeString(w, data.newPr); writeString(w, data.newPr);
break; break;
} }
case historyitem_ClrScheme_SetClr: case historyitem_ClrScheme_AddClr:
{ {
writeLong(w, data.index); writeLong(w, data.index);
writeOject(w, data.newColor); writeOject(w, data.newColor);
...@@ -7129,7 +7129,7 @@ ClrScheme.prototype = ...@@ -7129,7 +7129,7 @@ ClrScheme.prototype =
this.name = readString(r); this.name = readString(r);
break; break;
} }
case historyitem_ClrScheme_SetClr: case historyitem_ClrScheme_AddClr:
{ {
var index = readLong(r); var index = readLong(r);
var color = readObject(r); var color = readObject(r);
...@@ -7161,6 +7161,9 @@ function ClrMap() ...@@ -7161,6 +7161,9 @@ function ClrMap()
return _copy; return _copy;
}; };
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
} }
ClrMap.prototype = ClrMap.prototype =
......
...@@ -14,7 +14,6 @@ function CLineChart() ...@@ -14,7 +14,6 @@ function CLineChart()
this.upDownBars = null; this.upDownBars = null;
this.varyColors = null; this.varyColors = null;
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id); g_oTableId.Add(this, this.Id);
} }
...@@ -136,24 +135,31 @@ CLineChart.prototype = ...@@ -136,24 +135,31 @@ CLineChart.prototype =
this.marker = data.oldPr; this.marker = data.oldPr;
break break
} }
case historyitem_LineChart_SetSer: case historyitem_LineChart_AddSer:
{ {
this.series = data.oldPr; for(var i = this.series.length - 1; i > -1; --i)
{
if(this.series[i] === data.ser)
{
this.series.splice(i, 1);
break;
}
}
break break
} }
case historyitem_LineChart_SetSmooth: case historyitem_LineChart_SetSmooth:
{ {
this.axId = data.oldPr; this.smooth = data.oldPr;
break break
} }
case historyitem_LineChart_SetUpDownBars: case historyitem_LineChart_SetUpDownBars:
{ {
this.axId = data.oldPr; this.upDownBars = data.oldPr;
break break
} }
case historyitem_LineChart_SetVaryColors: case historyitem_LineChart_SetVaryColors:
{ {
this.axId = data.oldPr; this.varyColors = data.oldPr;
break break
} }
} }
...@@ -195,22 +201,22 @@ CLineChart.prototype = ...@@ -195,22 +201,22 @@ CLineChart.prototype =
} }
case historyitem_LineChart_AddSer: case historyitem_LineChart_AddSer:
{ {
this.series = data.newPr; this.series.push(data.ser);
break break
} }
case historyitem_LineChart_SetSmooth: case historyitem_LineChart_SetSmooth:
{ {
this.axId = data.newPr; this.smooth = data.newPr;
break break
} }
case historyitem_LineChart_SetUpDownBars: case historyitem_LineChart_SetUpDownBars:
{ {
this.axId = data.newPr; this.upDownBars = data.newPr;
break break
} }
case historyitem_LineChart_SetVaryColors: case historyitem_LineChart_SetVaryColors:
{ {
this.axId = data.newPr; this.varyColors = data.newPr;
break break
} }
} }
......
function CNumLit() function CNumLit()
{ {
this.formatCode = null; this.formatCode = null;
this.pt = null; this.pts = [];
this.ptCount = null; this.ptCount = null;
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
...@@ -37,15 +37,15 @@ CNumLit.prototype = ...@@ -37,15 +37,15 @@ CNumLit.prototype =
this.formatCode = pr; this.formatCode = pr;
}, },
setPt: function(pr) addPt: function(pr)
{ {
History.Add(this, {Type:historyitem_NumLit_SetPt, oldPr: this.pt, newPr: pr}); History.Add(this, {Type:historyitem_NumLit_AddPt, pt: pr});
this.pt = pr; this.pts.push(pr);
}, },
setPtCount: function(pr) setPtCount: function(pr)
{ {
History.Add(this, {Type:historyitem_NumLit_SetPt, oldPr: this.pt, newPr: pr}); History.Add(this, {Type:historyitem_NumLit_SetPtCount, oldPr: this.pts, newPr: pr});
this.ptCount = pr; this.ptCount = pr;
}, },
...@@ -59,9 +59,15 @@ CNumLit.prototype = ...@@ -59,9 +59,15 @@ CNumLit.prototype =
break; break;
} }
case historyitem_NumLit_SetPt: case historyitem_NumLit_AddPt:
{ {
this.pt = data.oldPr; for(var i = this.pts.length - 1; i > -1; --i)
{
if(this.pts[i] === data.pt)
{
this.pts.splice(i, 1);
}
}
break; break;
} }
...@@ -83,9 +89,9 @@ CNumLit.prototype = ...@@ -83,9 +89,9 @@ CNumLit.prototype =
break; break;
} }
case historyitem_NumLit_SetPt: case historyitem_NumLit_AddPt:
{ {
this.pt = data.newPr; this.pts.push(data.newPr);
break; break;
} }
...@@ -104,31 +110,19 @@ CNumLit.prototype = ...@@ -104,31 +110,19 @@ CNumLit.prototype =
{ {
case historyitem_NumLit_SetFormatCode: case historyitem_NumLit_SetFormatCode:
{ {
w.WriteBool(typeof data.newPr === "string"); writeString(w, data.newPr);
if(typeof data.newPr === "string")
{
w.WriteString2(data.newPr);
}
break; break;
} }
case historyitem_NumLit_SetPt: case historyitem_NumLit_AddPt:
{ {
w.WriteBool(isRealObject(data.newPr)); writeObject(w, data.pt);
if(isRealObject(data.newPr))
{
w.WriteString2(data.newPr.Get_Id());
}
break; break;
} }
case historyitem_NumLit_SetPtCount: case historyitem_NumLit_SetPtCount:
{ {
w.WriteBool(isRealNumber(data.newPr)); writeLong(w, data.newPr);
if(isRealNumber(data.newPr))
{
w.WriteLong(data.newPr);
}
break; break;
} }
} }
...@@ -141,40 +135,23 @@ CNumLit.prototype = ...@@ -141,40 +135,23 @@ CNumLit.prototype =
{ {
case historyitem_NumLit_SetFormatCode: case historyitem_NumLit_SetFormatCode:
{ {
if(r.GetBool()) this.formatCode = readString(r);
{
this.formatCode = r.GetString2();
}
else
{
this.formatCode = null;
}
break; break;
} }
case historyitem_NumLit_SetPt: case historyitem_NumLit_AddPt:
{ {
if(r.GetBool()) var pt = readObject(r);
{ if(isRealObject(pt))
this.pt = g_oTableId.Get_ById(r.GetString2());
}
else
{ {
this.pt = null; this.pts.push(pt);
} }
break; break;
} }
case historyitem_NumLit_SetPtCount: case historyitem_NumLit_SetPtCount:
{ {
if(r.GetBool()) this.ptCount = readLong(r);
{
this.ptCount = r.GetLong();
}
else
{
this.ptCount = null;
}
break; break;
} }
} }
......
...@@ -11,7 +11,7 @@ function CPictureOptions() ...@@ -11,7 +11,7 @@ function CPictureOptions()
this.pictureStackUnit = null; this.pictureStackUnit = null;
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
g_oIdCounter.Add(this, this.Id); g_oTableId.Add(this, this.Id);
} }
CPictureOptions.prototype = CPictureOptions.prototype =
......
This diff is collapsed.
...@@ -798,6 +798,28 @@ DrawingObjectsController.prototype = ...@@ -798,6 +798,28 @@ DrawingObjectsController.prototype =
addChartDrawingObject: function(chart, options) addChartDrawingObject: function(chart, options)
{ {
switch (chart.type)
{
case "Line":
{
switch (chart.subType)
{
case "normal":
{
return CreateLineChart(chart.series, GROUPING_STANDARD);
}
case "stacked":
{
return CreateLineChart(chart.series, GROUPING_STACKED);
}
case "stackedPer":
{
return CreateLineChart(chart.series, GROUPING_PERCENT_STACKED);
}
}
break;
}
}
var chart_as_group = new CChartAsGroup(null, this.drawingObjects); var chart_as_group = new CChartAsGroup(null, this.drawingObjects);
chart_as_group.initFromChartObject(chart, options); chart_as_group.initFromChartObject(chart, options);
this.resetSelectionState(); this.resetSelectionState();
......
...@@ -29,6 +29,13 @@ function CChartAsGroup(drawingBase, drawingObjects) ...@@ -29,6 +29,13 @@ function CChartAsGroup(drawingBase, drawingObjects)
this.invertTransform = new CMatrix(); this.invertTransform = new CMatrix();
this.group = null; this.group = null;
this.rot = 0; this.rot = 0;
this.bounds =
{
x: 0,
y: 0,
w: 0,
h: 0
};
this.recalculateInfo = this.recalculateInfo =
{ {
recalculateAll: true recalculateAll: true
...@@ -46,7 +53,6 @@ function CChartAsGroup(drawingBase, drawingObjects) ...@@ -46,7 +53,6 @@ function CChartAsGroup(drawingBase, drawingObjects)
} }
} }
CChartAsGroup.prototype = CChartAsGroup.prototype =
{ {
calculateContent: function() calculateContent: function()
...@@ -89,6 +95,8 @@ CChartAsGroup.prototype = ...@@ -89,6 +95,8 @@ CChartAsGroup.prototype =
return ret; return ret;
}, },
getBoundsInGroup: function() getBoundsInGroup: function()
{ {
...@@ -148,6 +156,22 @@ CChartAsGroup.prototype = ...@@ -148,6 +156,22 @@ CChartAsGroup.prototype =
this.recalculate(); this.recalculate();
}, },
recalculateBounds: function()
{
try
{
var boundsChecker = new CSlideBoundsChecker();
this.draw(boundsChecker);
boundsChecker.CorrectBounds();
this.bounds.x = boundsChecker.Bounds.min_x;
this.bounds.y = boundsChecker.Bounds.min_y;
this.bounds.w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
this.bounds.h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
}
catch(e)
{}
},
isChart: function() isChart: function()
{ {
return true; return true;
...@@ -1375,6 +1399,7 @@ CChartAsGroup.prototype = ...@@ -1375,6 +1399,7 @@ CChartAsGroup.prototype =
this.brush.fill.canvas= this.drawingObjects.getChartRender().insertChart(this.chart, this.drawingObjects.convertMetric(this.extX, 3, 0),this.drawingObjects.convertMetric(this.extY, 3, 0)); this.brush.fill.canvas= this.drawingObjects.getChartRender().insertChart(this.chart, this.drawingObjects.convertMetric(this.extX, 3, 0),this.drawingObjects.convertMetric(this.extY, 3, 0));
this.brush.fill.RasterImageId = ""; this.brush.fill.RasterImageId = "";
this.updateDrawingBaseCoordinates(); this.updateDrawingBaseCoordinates();
this.recalculateBounds();
//this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId); //this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId);
}, },
......
...@@ -19,6 +19,7 @@ function CGroupShape(drawingBase, drawingObjects) ...@@ -19,6 +19,7 @@ function CGroupShape(drawingBase, drawingObjects)
recalculateArrGraphicObjects: true recalculateArrGraphicObjects: true
}; };
this.x = null; this.x = null;
this.y = null; this.y = null;
this.x = null; this.x = null;
...@@ -33,7 +34,13 @@ function CGroupShape(drawingBase, drawingObjects) ...@@ -33,7 +34,13 @@ function CGroupShape(drawingBase, drawingObjects)
this.transformText = null; this.transformText = null;
this.invertTransformText = null; this.invertTransformText = null;
this.cursorTypes = []; this.cursorTypes = [];
this.bounds =
{
x: 0,
y: 0,
w: 0,
h: 0
};
this.brush = null; this.brush = null;
this.pen = null; this.pen = null;
this.selected = false; this.selected = false;
...@@ -81,6 +88,22 @@ CGroupShape.prototype = ...@@ -81,6 +88,22 @@ CGroupShape.prototype =
}, },
recalculateBounds: function()
{
try
{
var boundsChecker = new CSlideBoundsChecker();
this.draw(boundsChecker);
boundsChecker.CorrectBounds();
this.bounds.x = boundsChecker.Bounds.min_x;
this.bounds.y = boundsChecker.Bounds.min_y;
this.bounds.w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
this.bounds.h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
}
catch(e)
{}
},
setDrawingObjects: function(drawingObjects) setDrawingObjects: function(drawingObjects)
{ {
if ( isRealObject(drawingObjects) && drawingObjects.getWorksheet() ) if ( isRealObject(drawingObjects) && drawingObjects.getWorksheet() )
...@@ -642,6 +665,7 @@ CGroupShape.prototype = ...@@ -642,6 +665,7 @@ CGroupShape.prototype =
{ {
this.arrGraphicObjects[i].recalculate(aImages); this.arrGraphicObjects[i].recalculate(aImages);
} }
this.recalculateBounds();
}, },
recalculateArrGraphicObjects: function() recalculateArrGraphicObjects: function()
...@@ -713,6 +737,7 @@ CGroupShape.prototype = ...@@ -713,6 +737,7 @@ CGroupShape.prototype =
if(typeof this.spTree[i].calculateTransformTextMatrix === "function") if(typeof this.spTree[i].calculateTransformTextMatrix === "function")
this.spTree[i].calculateTransformTextMatrix(); this.spTree[i].calculateTransformTextMatrix();
} }
this.recalculateBounds();
}, },
setPaddings: function(paddings) setPaddings: function(paddings)
......
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