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()
this.spPr = null;
this.Id = g_oIdCounter.Get_NewId();
g_oIdCounter.Add(this, this.Id);
g_oTableId.Add(this, this.Id);
}
CBandFmt.prototype =
......
......@@ -19,7 +19,7 @@ function CChart()
this.view3D = null;
this.Id = g_oIdCounter.Get_NewId();
g_oIdCounter.Add(this, this.Id);
g_oTableId.Add(this, this.Id);
}
CChart.prototype =
......
......@@ -1711,8 +1711,7 @@ CPageSetup.prototype =
}
};
function CreateDefaultLineNormalChart(asc_series)
function CreateLineChart(asc_series, type)
{
var chart_space = new CChartSpace();
chart_space.setDate1904(false);
......@@ -1725,58 +1724,30 @@ function CreateDefaultLineNormalChart(asc_series)
chart.setPlotArea(new CPlotArea());
chart.setLegend(new CLegend());
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);
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 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;
line_chart.setGrouping(GROUPING_STANDARD);
line_chart.setGrouping(type);
line_chart.setVaryColors(false);
line_chart.setDLbls(new CDLbls());
line_chart.setMarker(true);
line_chart.setSmooth(false);
line_chart.addAxId(cat_ax.Get_Id());
line_chart.addAxId(val_ax.Get_Id());
line_chart.addAxId(plot_area.catAx.Get_Id());
line_chart.addAxId(plot_area.valAx.Get_Id());
for(var i = 0; i < asc_series.length; ++i)
{
var series = new CLineSeries();
......@@ -1785,61 +1756,24 @@ function CreateDefaultLineNormalChart(asc_series)
series.setMarker(new CMarker());
series.marker.setSymbol(SYMBOL_NONE);
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;
d_lbls.setShowLegendKey(false);
d_lbls.setShowVal(false);
......@@ -1847,15 +1781,14 @@ function CreateDefaultLineStackedChart()
d_lbls.setShowSerName(false);
d_lbls.setShowPercent(false);
d_lbls.setShowBubbleSize(false);
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.setMinorTickMark(TICK_MARK_OUT);
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.setAuto(true);
cat_ax.setLblAlgn(LBL_ALG_CTR);
......@@ -1863,7 +1796,6 @@ function CreateDefaultLineStackedChart()
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);
......@@ -1873,18 +1805,36 @@ function CreateDefaultLineStackedChart()
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.setCrossAx(plot_area.catAx);
val_ax.setCrosses(CROSSES_AUTO_ZERO);
val_ax.setCrossBetween(CROSS_BETWEEN_BETWEEN);
scaling = val_ax.scaling;
scaling.setOrientation(ORIENTATION_MIN_MAX);
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);
var legend = chart.legend;
legend.setLegendPos(LEGEND_POS_R);
legend.setLayout(new CLayout());
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;
var historyitem_MinusPlus_SetnNumLit = 2297;
var historyitem_MinusPlus_SetnNumRef = 2298;
var historyitem_NumLit_SetFormatCode = 2299;
var historyitem_NumLit_SetPt = 2300;
var historyitem_NumLit_AddPt = 2300;
var historyitem_NumLit_SetPtCount = 2301;
var historyitem_NumericPoint_SetFormatCode = 2302;
var historyitem_NumericPoint_SetIdx = 2303;
......@@ -466,7 +466,7 @@ var historyitem_SpPr_SetXfrm = 2458;
var historyitem_SpPr_SetGeometry = 2459;
var historyitem_SpPr_SetFill = 2460;
var historyitem_SpPr_SetLn = 2461;
var historyitem_ClrScheme_SetClr = 2462;
var historyitem_ClrScheme_AddClr = 2462;
var historyitem_ClrScheme_SetName = 2463;
var historyitem_ClrMap_SetClr = 2464;
var historyitem_ExtraClrScheme_SetClrScheme = 2465;
......@@ -523,6 +523,13 @@ var historyitem_PageSetupSetPaperSize = 2515;
var historyitem_PageSetupSetPaperWidth = 2516;
var historyitem_PageSetupSetUseFirstPageNumb = 2517;
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_ColorModifiers = 1002;
......@@ -627,6 +634,7 @@ var historyitem_type_PrintSettings = 1099;
var historyitem_type_HeaderFooterChart = 1100;
var historyitem_type_PageMarginsChart = 1101;
var historyitem_type_PageSetup = 1102;
var historyitem_type_Shape = 1103;
......
......@@ -1492,11 +1492,11 @@ CUniColor.prototype =
{
if(r.GetBool())
{
this.Mods = = g_oTableId.Get_ById(r.GetString2());
this.Mods = g_oTableId.Get_ById(r.GetString2());
}
else
{
thos.Mods = null;
this.Mods = null;
}
break;
}
......@@ -3813,7 +3813,7 @@ EndArrow.prototype =
Read_FromBinary2: function (r)
{
this.Id = r.GetString2();
}
},
getObjectType: function()
{
......@@ -4726,7 +4726,7 @@ DefaultShapeDefinition.prototype=
Undo: function(data)
{
switch()
switch(data.Type)
{
case historyitem_DefaultShapeDefinition_SetSpPr:
{
......@@ -4753,7 +4753,7 @@ DefaultShapeDefinition.prototype=
Redo: function(data)
{
switch()
switch(data.Type)
{
case historyitem_DefaultShapeDefinition_SetSpPr:
{
......@@ -6742,7 +6742,7 @@ function CSpPr()
this.Geometry = null;//new Geometry();
this.Fill = null;
this.ln = null;
this.parent = null;
this.merge = function(spPr)
{
/*if(spPr.xfrm != null)
......@@ -7063,9 +7063,9 @@ ClrScheme.prototype =
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;
},
......@@ -7078,7 +7078,7 @@ ClrScheme.prototype =
this.name = data.oldPr;
break;
}
case historyitem_ClrScheme_SetClr:
case historyitem_ClrScheme_AddClr:
{
this.colors[data.index] = data.oldColor;
}
......@@ -7094,7 +7094,7 @@ ClrScheme.prototype =
this.name = data.newPr;
break;
}
case historyitem_ClrScheme_SetClr:
case historyitem_ClrScheme_AddClr:
{
this.colors[data.index] = data.newColor;
}
......@@ -7111,7 +7111,7 @@ ClrScheme.prototype =
writeString(w, data.newPr);
break;
}
case historyitem_ClrScheme_SetClr:
case historyitem_ClrScheme_AddClr:
{
writeLong(w, data.index);
writeOject(w, data.newColor);
......@@ -7129,7 +7129,7 @@ ClrScheme.prototype =
this.name = readString(r);
break;
}
case historyitem_ClrScheme_SetClr:
case historyitem_ClrScheme_AddClr:
{
var index = readLong(r);
var color = readObject(r);
......@@ -7161,6 +7161,9 @@ function ClrMap()
return _copy;
};
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
ClrMap.prototype =
......
......@@ -14,7 +14,6 @@ function CLineChart()
this.upDownBars = null;
this.varyColors = null;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
......@@ -136,24 +135,31 @@ CLineChart.prototype =
this.marker = data.oldPr;
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
}
case historyitem_LineChart_SetSmooth:
{
this.axId = data.oldPr;
this.smooth = data.oldPr;
break
}
case historyitem_LineChart_SetUpDownBars:
{
this.axId = data.oldPr;
this.upDownBars = data.oldPr;
break
}
case historyitem_LineChart_SetVaryColors:
{
this.axId = data.oldPr;
this.varyColors = data.oldPr;
break
}
}
......@@ -195,22 +201,22 @@ CLineChart.prototype =
}
case historyitem_LineChart_AddSer:
{
this.series = data.newPr;
this.series.push(data.ser);
break
}
case historyitem_LineChart_SetSmooth:
{
this.axId = data.newPr;
this.smooth = data.newPr;
break
}
case historyitem_LineChart_SetUpDownBars:
{
this.axId = data.newPr;
this.upDownBars = data.newPr;
break
}
case historyitem_LineChart_SetVaryColors:
{
this.axId = data.newPr;
this.varyColors = data.newPr;
break
}
}
......
function CNumLit()
{
this.formatCode = null;
this.pt = null;
this.pts = [];
this.ptCount = null;
this.Id = g_oIdCounter.Get_NewId();
......@@ -37,15 +37,15 @@ CNumLit.prototype =
this.formatCode = pr;
},
setPt: function(pr)
addPt: function(pr)
{
History.Add(this, {Type:historyitem_NumLit_SetPt, oldPr: this.pt, newPr: pr});
this.pt = pr;
History.Add(this, {Type:historyitem_NumLit_AddPt, pt: pr});
this.pts.push(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;
},
......@@ -59,9 +59,15 @@ CNumLit.prototype =
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;
}
......@@ -83,9 +89,9 @@ CNumLit.prototype =
break;
}
case historyitem_NumLit_SetPt:
case historyitem_NumLit_AddPt:
{
this.pt = data.newPr;
this.pts.push(data.newPr);
break;
}
......@@ -104,31 +110,19 @@ CNumLit.prototype =
{
case historyitem_NumLit_SetFormatCode:
{
w.WriteBool(typeof data.newPr === "string");
if(typeof data.newPr === "string")
{
w.WriteString2(data.newPr);
}
writeString(w, data.newPr);
break;
}
case historyitem_NumLit_SetPt:
case historyitem_NumLit_AddPt:
{
w.WriteBool(isRealObject(data.newPr));
if(isRealObject(data.newPr))
{
w.WriteString2(data.newPr.Get_Id());
}
writeObject(w, data.pt);
break;
}
case historyitem_NumLit_SetPtCount:
{
w.WriteBool(isRealNumber(data.newPr));
if(isRealNumber(data.newPr))
{
w.WriteLong(data.newPr);
}
writeLong(w, data.newPr);
break;
}
}
......@@ -141,40 +135,23 @@ CNumLit.prototype =
{
case historyitem_NumLit_SetFormatCode:
{
if(r.GetBool())
{
this.formatCode = r.GetString2();
}
else
{
this.formatCode = null;
}
this.formatCode = readString(r);
break;
}
case historyitem_NumLit_SetPt:
case historyitem_NumLit_AddPt:
{
if(r.GetBool())
{
this.pt = g_oTableId.Get_ById(r.GetString2());
}
else
var pt = readObject(r);
if(isRealObject(pt))
{
this.pt = null;
this.pts.push(pt);
}
break;
}
case historyitem_NumLit_SetPtCount:
{
if(r.GetBool())
{
this.ptCount = r.GetLong();
}
else
{
this.ptCount = null;
}
this.ptCount = readLong(r);
break;
}
}
......
......@@ -11,7 +11,7 @@ function CPictureOptions()
this.pictureStackUnit = null;
this.Id = g_oIdCounter.Get_NewId();
g_oIdCounter.Add(this, this.Id);
g_oTableId.Add(this, this.Id);
}
CPictureOptions.prototype =
......
function CShape(parent)
function CShape()
{
this.spLocks = null;
this.useBgFill = null;
this.nvSpPr = null;
this.spPr = null;
this.style = null;
this.txBody = null;
this.nvSpPr = null;
this.spPr = null;
this.style = null;
this.txBody = null;
this.textBoxContent = null;
this.parent = null;//В Word - ParaDrawing, в Excell - DrawingBase, в PowerPoint - Slide;
this.group = null;
this.x = null;
this.y = null;
......@@ -27,11 +26,72 @@ function CShape(parent)
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add( this, this.Id );
this.init();
}
CShape.prototype =
{
Get_Id: function ()
{
return this.Id;
},
getObjectType: function()
{
return historyitem_type_Shape;
},
Write_ToBinary2: function (w)
{
w.WriteLong(historyitem_type_Shape);
w.WriteString2(this.Id);
},
Read_FromBinary2: function (r)
{
this.Id = r.GetString2();
},
setNvSpPr: function (pr)
{
History.Add(this, { Type: historyitem_ShapeSetNvSpPr, oldPr: this.nvSpPr, newPr: pr });
this.nvSpPr = pr;
},
setSpPr: function (spPr)
{
History.Add(this, { Type: historyitem_ShapeSetSpPr, oldPr: this.spPr, newPr: spPr });
this.spPr = spPr;
},
setStyle: function (style)
{
History.Add(this, { Type: historyitem_ShapeSetStyle, oldPr: this.style, newPr: style });
this.style = style;
},
setTxBody: function (txBody)
{
History.Add(this, { Type: historyitem_ShapeSetTxBody, oldPr: this.txBody, newPr: txBody });
this.txBody = txBody;
},
setTextBoxContent: function(textBoxContent)
{
History.Add(this, {Type: historyitem_ShapeSetTextBoxContent, oldPr: this.textBoxContent, newPr: textBoxContent});
this.textBoxContent = textBoxContent;
},
setParent: function (parent)
{
History.Add(this, { Type: historyitem_ShapeSetParent, oldPr: this.parent, newPr: parent });
this.parent = parent;
},
setGroup: function (group)
{
History.Add(this, { Type: historyitem_ShapeSetGroup, oldPr: this.group, newPr: group });
this.group = group;
},
......@@ -78,9 +138,6 @@ CShape.prototype =
}
},
Get_Id: function () {
return this.Id;
},
getType: function () {
return DRAWING_OBJECT_TYPE_SHAPE;
......@@ -170,7 +227,6 @@ CShape.prototype =
}
},
Get_SelectedText: function (bClearText) {
if (this.txBody) {
return this.txBody.content.Get_SelectedText(bClearText);
......@@ -201,14 +257,12 @@ CShape.prototype =
return new CParaPr();
},
Paragraph_ClearFormatting: function () {
if (this.txBody) {
return this.txBody.content.Paragraph_ClearFormatting();
}
},
initDefaultTextRect: function (x, y, extX, extY, flipH, flipV) {
this.setXfrm(x, y, extX, extY, 0, flipH, flipV);
this.setPresetGeometry("rect");
......@@ -233,10 +287,6 @@ CShape.prototype =
},
setParent: function (parent) {
History.Add(this, { Type: historyitem_SetShapeParent, Old: this.parent, New: parent });
this.parent = parent;
},
setUniFill: function (fill) {
this.spPr.Fill = fill;
......@@ -271,12 +321,10 @@ CShape.prototype =
return false;
},
isChart: function () {
return false;
},
isGroup: function () {
return false;
},
......@@ -574,35 +622,7 @@ CShape.prototype =
return isRealObject(this.nvSpPr) && isRealObject(this.nvSpPr.nvPr) && isRealObject(this.nvSpPr.nvPr.ph);
},
setNvSpPr: function (pr) {
History.Add(this, { Type: historyitem_SetSetNvSpPr, oldPr: this.nvSpPr, newPr: pr });
this.nvSpPr = pr;
if (this.parent && pr && pr.cNvPr && isRealNumber(pr.cNvPr.id)) {
if (pr.cNvPr.id > this.parent.maxId) {
this.parent.maxId = pr.cNvPr.id + 1;
}
}
},
setTextBody: function (txBody) {
History.Add(this, { Type: historyitem_SetTextBody, oldPr: this.txBody, newPr: txBody });
this.txBody = txBody;
},
setSpPr: function (spPr) {
History.Add(this, { Type: historyitem_SetSetSpPr, oldPr: this.spPr, newPr: spPr });
this.spPr = spPr;
},
setStyle: function (style) {
History.Add(this, { Type: historyitem_SetSetStyle, oldPr: this.style, newPr: style });
this.style = style;
},
setGroup: function (group) {
History.Add(this, { Type: historyitem_SetSpGroup, oldPr: this.group, newPr: group });
this.group = group;
},
getPlaceholderType: function () {
return this.isPlaceholder() ? this.nvSpPr.nvPr.ph.type : null;
......@@ -2345,7 +2365,6 @@ CShape.prototype =
}
},
setParagraphIndent: function (val) {
if (isRealObject(this.txBody)) {
this.txBody.content.Set_ParagraphIndent(val);
......@@ -2686,7 +2705,6 @@ CShape.prototype =
graphics.SetIntegerGrid(true);
},
getRotateAngle: function (x, y) {
var transform = this.getTransformMatrix();
var rotate_distance = this.getParentObjects().presentation.DrawingDocument.GetMMPerDot(TRACK_DISTANCE_ROTATE);
......@@ -2714,14 +2732,12 @@ CShape.prototype =
return same_flip ? angle : -angle;
},
getFullFlipH: function () {
if (!isRealObject(this.group))
return this.flipH;
return this.group.getFullFlipH() ? !this.flipH : this.flipH;
},
getFullFlipV: function () {
if (!isRealObject(this.group))
return this.flipV;
......@@ -2801,7 +2817,6 @@ CShape.prototype =
return this.pen;
},
canChangeArrows: function () {
if (this.spPr.geometry == null) {
return false;
......@@ -2846,7 +2861,6 @@ CShape.prototype =
return null;
},
setVerticalAlign: function (align) {
if (this.txBody) {
......@@ -3087,7 +3101,6 @@ CShape.prototype =
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
setLine: function (line) {
var old_line = this.spPr.ln;
var new_line = line;
......@@ -3132,8 +3145,6 @@ CShape.prototype =
return { hit: false, adjPolarFlag: null, adjNum: null };
},
hitToHandles: function (x, y) {
var invert_transform = this.getInvertTransform();
var t_x, t_y;
......@@ -3270,7 +3281,6 @@ CShape.prototype =
}
},
canChangeAdjustments: function () {
return true; //TODO
},
......@@ -3287,9 +3297,6 @@ CShape.prototype =
return new MoveShapeImageTrack(this);
},
createRotateInGroupTrack: function () {
return new RotateTrackShapeImageInGroup(this);
},
......@@ -3341,580 +3348,157 @@ CShape.prototype =
Undo: function (data) {
switch (data.Type) {
case historyitem_SetShapeRot:
{
this.spPr.xfrm.rot = data.oldRot;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeOffset:
{
this.spPr.xfrm.offX = data.oldOffsetX;
this.spPr.xfrm.offY = data.oldOffsetY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeExtents:
{
this.spPr.xfrm.extX = data.oldExtentX;
this.spPr.xfrm.extY = data.oldExtentY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeFlips:
{
this.spPr.xfrm.flipH = data.oldFlipH;
this.spPr.xfrm.flipV = data.oldFlipV;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if (isRealObject(data.oldFill)) {
this.spPr.Fill = data.oldFill.createDuplicate();
}
else {
this.spPr.Fill = null;
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if (isRealObject(data.oldLine)) {
this.spPr.ln = data.oldLine.createDuplicate();
}
else {
this.spPr.ln = null;
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_SetShapeSetGeometry:
{
if (isRealObject(data.oldGeometry)) {
this.spPr.geometry = data.oldGeometry.createDuplicate();
this.spPr.geometry.Init(5, 5);
}
else {
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = data.oldBodyPr.createDuplicate();
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetSetNvSpPr:
switch (data.Type)
{
case historyitem_ShapeSetNvSpPr:
{
this.nvSpPr = data.oldPr;
break;
}
case historyitem_SetSetSpPr:
case historyitem_ShapeSetSpPr:
{
this.spPr = data.oldPr;
break;
}
case historyitem_SetSetStyle:
case historyitem_ShapeSetStyle:
{
this.style = data.oldPr;
break;
}
case historyitem_SetTextBody:
case historyitem_ShapeSetTxBody:
{
this.txBody = data.oldPr;
break;
}
case historyitem_SetSpGroup:
case historyitem_ShapeSetTextBoxContent:
{
this.group = data.oldPr;
this.textBoxContent = data.oldPr;
break;
}
case historyitem_SetShapeParent:
case historyitem_ShapeSetParent:
{
this.parent = data.Old;
this.parent = data.oldPr;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
if (!this.parent) {
delete editor.WordControl.m_oLogicDocument.recalcMap[this.Id];
}
},
Redo: function (data) {
switch (data.Type) {
case historyitem_SetShapeRot:
case historyitem_ShapeSetGroup:
{
this.spPr.xfrm.rot = data.newRot;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeOffset:
{
this.spPr.xfrm.offX = data.newOffsetX;
this.spPr.xfrm.offY = data.newOffsetY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeExtents:
{
this.spPr.xfrm.extX = data.newExtentX;
this.spPr.xfrm.extY = data.newExtentY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeFlips:
{
this.spPr.xfrm.flipH = data.newFlipH;
this.spPr.xfrm.flipV = data.newFlipV;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if (isRealObject(data.newFill)) {
this.spPr.Fill = data.newFill.createDuplicate();
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
this.group = data.oldPr;
break;
}
case historyitem_SetShapeSetLine:
{
if (isRealObject(data.newLine)) {
this.spPr.ln = data.newLine.createDuplicate();
}
else {
this.spPr.ln = null;
}
}
},
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
break;
}
case historyitem_SetShapeSetGeometry:
{
if (isRealObject(data.newGeometry)) {
this.spPr.geometry = data.newGeometry.createDuplicate();
this.spPr.geometry.Init(5, 5);
}
else {
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = data.newBodyPr.createDuplicate();
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetSetNvSpPr:
Redo: function (data)
{
switch (data.Type)
{
case historyitem_ShapeSetNvSpPr:
{
this.nvSpPr = data.newPr;
break;
}
case historyitem_SetSetSpPr:
case historyitem_ShapeSetSpPr:
{
this.spPr = data.newPr;
break;
}
case historyitem_SetSetStyle:
case historyitem_ShapeSetStyle:
{
this.style = data.newPr;
break;
}
case historyitem_SetTextBody:
case historyitem_ShapeSetTxBody:
{
this.txBody = data.newPr;
break;
}
case historyitem_SetSpGroup:
{
this.group = data.newPr;
break;
}
case historyitem_SetShapeParent:
case historyitem_ShapeSetTextBoxContent:
{
this.parent = data.New;
this.textBoxContent = data.newPr;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
if (!this.parent) {
delete editor.WordControl.m_oLogicDocument.recalcMap[this.Id];
}
},
Save_Changes: function (data, w) {
w.WriteLong(historyitem_type_Shape);
w.WriteLong(data.Type);
var bool;
switch (data.Type) {
case historyitem_SetShapeRot:
case historyitem_ShapeSetParent:
{
w.WriteDouble(data.newRot);
this.parent = data.newPr;
break;
}
case historyitem_SetShapeOffset:
case historyitem_ShapeSetGroup:
{
w.WriteDouble(data.newOffsetX);
w.WriteDouble(data.newOffsetY);
w.WriteBool(isRealObject(editor)
&& isRealObject(editor.WordControl)
&& isRealObject(editor.WordControl.m_oLogicDocument));
if(isRealObject(editor)
&& isRealObject(editor.WordControl)
&& isRealObject(editor.WordControl.m_oLogicDocument))
{
w.WriteDouble(editor.WordControl.m_oLogicDocument.Width);
w.WriteDouble(editor.WordControl.m_oLogicDocument.Height);
}
break;
}
case historyitem_SetShapeExtents:
{
w.WriteDouble(data.newExtentX);
w.WriteDouble(data.newExtentY);
w.WriteBool(isRealObject(editor)
&& isRealObject(editor.WordControl)
&& isRealObject(editor.WordControl.m_oLogicDocument));
if(isRealObject(editor)
&& isRealObject(editor.WordControl)
&& isRealObject(editor.WordControl.m_oLogicDocument))
{
w.WriteDouble(editor.WordControl.m_oLogicDocument.Width);
w.WriteDouble(editor.WordControl.m_oLogicDocument.Height);
}
break;
}
case historyitem_SetShapeFlips:
{
w.WriteBool(data.newFlipH);
w.WriteBool(data.newFlipV);
break;
}
case historyitem_SetShapeSetFill:
{
w.WriteBool(isRealObject(data.newFill));
if (isRealObject(data.newFill)) {
data.newFill.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeSetLine:
{
w.WriteBool(isRealObject(data.newLine));
if (isRealObject(data.newLine)) {
data.newLine.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeSetGeometry:
{
w.WriteBool(isRealObject(data.newGeometry));
if (isRealObject(data.newGeometry)) {
data.newGeometry.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeBodyPr:
{
data.newBodyPr.Write_ToBinary2(w);
break;
}
case historyitem_SetSetNvSpPr:
{
w.WriteBool(isRealObject(data.newPr));
if (isRealObject(data.newPr)) {
data.newPr.Write_ToBinary2(w);
}
this.group = data.newPr;
break;
}
}
},
case historyitem_SetSetSpPr:
{
w.WriteBool(isRealObject(data.newPr));
if (isRealObject(data.newPr)) {
data.newPr.Write_ToBinary2(w);
}
break;
}
case historyitem_SetSetStyle:
{
w.WriteBool(isRealObject(data.newPr));
if (isRealObject(data.newPr)) {
data.newPr.Write_ToBinary2(w);
}
break;
}
Save_Changes: function (data, w)
{
w.WriteLong(this.getObjectType());
w.WriteLong(data.Type);
switch (data.Type)
{
case historyitem_ShapeSetNvSpPr:
case historyitem_ShapeSetSpPr:
case historyitem_ShapeSetStyle:
case historyitem_ShapeSetTxBody:
case historyitem_ShapeSetTextBoxContent:
case historyitem_ShapeSetParent:
case historyitem_ShapeSetGroup:
case historyitem_SetTextBody:
{
w.WriteBool(isRealObject(data.newPr));
if (isRealObject(data.newPr)) {
w.WriteString2(data.newPr.Get_Id());
}
break;
}
case historyitem_SetSpGroup:
{
w.WriteBool(isRealObject(data.newPr));
if (isRealObject(data.newPr)) {
w.WriteString2(data.newPr.Get_Id());
}
break;
}
case historyitem_SetShapeParent:
{
w.WriteBool(isRealObject(data.New));
if (isRealObject(data.New)) {
w.WriteString2(data.New.Id);
}
writeObject(data.newPr);
break;
}
}
},
Load_Changes: function (r) {
if (r.GetLong() === historyitem_type_Shape) {
switch (r.GetLong()) {
case historyitem_SetShapeRot:
{
this.spPr.xfrm.rot = r.GetDouble();
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeOffset:
{
this.spPr.xfrm.offX = r.GetDouble();
this.spPr.xfrm.offY = r.GetDouble();
if(r.GetBool())
{
var p_width = r.GetDouble();
var p_height = r.GetDouble();
if(isRealObject(editor)
&& isRealObject(editor.WordControl)
&& isRealObject(editor.WordControl.m_oLogicDocument))
{
var kw = editor.WordControl.m_oLogicDocument.Width / p_width;
var kh = editor.WordControl.m_oLogicDocument.Height / p_height;
this.spPr.xfrm.offX*=kw;
this.spPr.xfrm.offY*=kh;
}
}
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeExtents:
{
this.spPr.xfrm.extX = r.GetDouble();
this.spPr.xfrm.extY = r.GetDouble();
if(r.GetBool())
{
var p_width = r.GetDouble();
var p_height = r.GetDouble();
if(isRealObject(editor)
&& isRealObject(editor.WordControl)
&& isRealObject(editor.WordControl.m_oLogicDocument))
{
var kw = editor.WordControl.m_oLogicDocument.Width / p_width;
var kh = editor.WordControl.m_oLogicDocument.Height / p_height;
this.spPr.xfrm.extX*=kw;
this.spPr.xfrm.extY*=kh;
}
}
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeFlips:
{
this.spPr.xfrm.flipH = r.GetBool();
this.spPr.xfrm.flipV = r.GetBool();
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if (r.GetBool()) {
this.spPr.Fill = new CUniFill();
this.spPr.Fill.Read_FromBinary2(r);
}
if (this.spPr.Fill && this.spPr.Fill.fill instanceof CBlipFill
&& typeof this.spPr.Fill.fill.RasterImageId === "string") {
CollaborativeEditing.Add_NewImage(this.spPr.Fill.fill.RasterImageId);
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if (r.GetBool()) {
this.spPr.ln = new CLn();
this.spPr.ln.Read_FromBinary2(r);
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
break;
}
case historyitem_SetShapeSetGeometry:
{
if (r.GetBool()) {
this.spPr.geometry = new Geometry();
this.spPr.geometry.Read_FromBinary2(r);
this.spPr.geometry.Init(5, 5);
}
else {
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
Load_Changes: function (r)
{
if (r.GetLong() === this.getObjecType())
{
var type = r.GetLong();
switch (r.GetLong())
{
case historyitem_ShapeSetNvSpPr:
{
this.txBody.bodyPr = new CBodyPr();
this.txBody.bodyPr.Read_FromBinary2(r);
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
this.nvSpPr = readObject(r);
break;
}
case historyitem_SetSetNvSpPr:
case historyitem_ShapeSetSpPr:
{
if (r.GetBool()) {
this.nvSpPr = new UniNvPr();
this.nvSpPr.Read_FromBinary2(r);
}
else {
this.nvSpPr = null;
}
this.spPr = readObject(r);
break;
}
case historyitem_SetSetSpPr:
case historyitem_ShapeSetStyle:
{
this.spPr = new CSpPr();
if (r.GetBool()) {
this.spPr.Read_FromBinary2(r);
}
this.style = readObject(r);
break;
}
case historyitem_SetSetStyle:
case historyitem_ShapeSetTxBody:
{
if (r.GetBool()) {
this.style = new CShapeStyle();
this.style.Read_FromBinary2(r);
}
else {
this.style = null;
}
this.txBody = readObject(r);
break;
}
case historyitem_SetTextBody:
case historyitem_ShapeSetTextBoxContent:
{
if (r.GetBool()) {
this.txBody = g_oTableId.Get_ById(r.GetString2());
}
else {
this.txBody = null;
}
this.textBoxContent = readObject(r);
break;
}
case historyitem_SetSpGroup:
case historyitem_ShapeSetParent:
{
if (r.GetBool()) {
this.group = g_oTableId.Get_ById(r.GetString2());
}
else {
this.group = null;
}
this.parent = readObject(r);
break;
}
case historyitem_SetShapeParent:
case historyitem_ShapeSetGroup:
{
if (r.GetBool()) {
this.parent = g_oTableId.Get_ById(r.GetString2());
}
this.group = readObject(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) {
w.WriteLong(historyitem_type_Shape);
w.WriteString2(this.Id);
},
Read_FromBinary2: function (r) {
this.Id = r.GetString2();
},
Load_LinkData: function (linkData) {
this.parent = g_oTableId.Get_ById(linkData.parent);
Load_LinkData: function (linkData)
{
}
};
......
......@@ -798,6 +798,28 @@ DrawingObjectsController.prototype =
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);
chart_as_group.initFromChartObject(chart, options);
this.resetSelectionState();
......
......@@ -29,6 +29,13 @@ function CChartAsGroup(drawingBase, drawingObjects)
this.invertTransform = new CMatrix();
this.group = null;
this.rot = 0;
this.bounds =
{
x: 0,
y: 0,
w: 0,
h: 0
};
this.recalculateInfo =
{
recalculateAll: true
......@@ -46,7 +53,6 @@ function CChartAsGroup(drawingBase, drawingObjects)
}
}
CChartAsGroup.prototype =
{
calculateContent: function()
......@@ -89,6 +95,8 @@ CChartAsGroup.prototype =
return ret;
},
getBoundsInGroup: function()
{
......@@ -148,6 +156,22 @@ CChartAsGroup.prototype =
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()
{
return true;
......@@ -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.RasterImageId = "";
this.updateDrawingBaseCoordinates();
this.recalculateBounds();
//this.drawingObjects.loadImageRedraw(this.brush.fill.RasterImageId);
},
......
......@@ -19,6 +19,7 @@ function CGroupShape(drawingBase, drawingObjects)
recalculateArrGraphicObjects: true
};
this.x = null;
this.y = null;
this.x = null;
......@@ -33,7 +34,13 @@ function CGroupShape(drawingBase, drawingObjects)
this.transformText = null;
this.invertTransformText = null;
this.cursorTypes = [];
this.bounds =
{
x: 0,
y: 0,
w: 0,
h: 0
};
this.brush = null;
this.pen = null;
this.selected = false;
......@@ -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)
{
if ( isRealObject(drawingObjects) && drawingObjects.getWorksheet() )
......@@ -642,6 +665,7 @@ CGroupShape.prototype =
{
this.arrGraphicObjects[i].recalculate(aImages);
}
this.recalculateBounds();
},
recalculateArrGraphicObjects: function()
......@@ -713,6 +737,7 @@ CGroupShape.prototype =
if(typeof this.spTree[i].calculateTransformTextMatrix === "function")
this.spTree[i].calculateTransformTextMatrix();
}
this.recalculateBounds();
},
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