Commit d1b3f31d 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@54657 954022d7-b5bf-4e40-9824-e11837661b57
parent 664781de
......@@ -4204,64 +4204,81 @@ CDLbl.prototype =
this.transformText = this.ownTransformText.CreateDublicate();
},
getStyles: function()
{
var styles = new CStyles();
var style = new CStyle("dataLblStyle", null, null, null);
var text_pr = new CTextPr();
text_pr.FontSize = 10;
var parent_objects = this.chart.getParentObjects();
var theme = parent_objects.theme;
var para_pr = new CParaPr();
para_pr.Spacing.Before = 0.0;
para_pr.Spacing.After = 0.0;
para_pr.Spacing.Line = 1;
para_pr.Spacing.LineRule = linerule_Auto;
style.ParaPr = para_pr;
var font_name = theme.themeElements.fontScheme.minorFont.latin;
text_pr.RFonts.Ascii = {Name: font_name, Index: -1};
text_pr.RFonts.EastAsia = {Name: font_name, Index: -1};
text_pr.RFonts.HAnsi = {Name: font_name, Index: -1};
text_pr.RFonts.CS = {Name: font_name, Index: -1};
text_pr.RFonts.Hint = {Name: font_name, Index: -1};
style.TextPr = text_pr;
var chart_text_pr;
if(this.chart.txPr
&& this.chart.txPr.content
&& this.chart.txPr.content.Content[0]
&& this.chart.txPr.content.Content[0].Pr
&& this.chart.txPr.content.Content[0].Pr.DefaultRunPr)
{
chart_text_pr = this.chart.txPr.content.Content[0].Pr.DefaultRunPr;
style.TextPr.Merge(chart_text_pr);
}
if(this instanceof CTitle)
{
style.TextPr.Bold = true;
if(this.parent instanceof CChart)
{
if(chart_text_pr && typeof chart_text_pr.FontSize === "number")
style.TextPr.FontSize *= 1.2;
else
style.TextPr.FontSize = 18;
}
}
if(this instanceof CalcLegendEntry
&& this.legend
&& this.legend.txPr
&& this.legend.txPr.content
&& this.legend.txPr.content.Content[0]
&& this.legend.txPr.content.Content[0].Pr
&& this.legend.txPr.content.Content[0].Pr.DefaultRunPr)
{
style.TextPr.Merge(this.legend.txPr.content.Content[0].Pr.DefaultRunPr);
}
if(this.txPr
&& this.txPr.content
&& this.txPr.content.Content[0]
&& this.txPr.content.Content[0].Pr
&& this.txPr.content.Content[0].Pr.DefaultRunPr)
{
style.TextPr.Merge(this.txPr.content.Content[0].Pr.DefaultRunPr);
}
styles.Add(style);
return {lastId: style.Id, styles: styles};
},
recalculateStyle: function()
{
ExecuteNoHistory(function()
{
var styles = new CStyles();
var style = new CStyle("dataLblStyle", null, null, null);
var text_pr = new CTextPr();
text_pr.FontSize = 10;
var parent_objects = this.chart.getParentObjects();
var theme = parent_objects.theme;
var para_pr = new CParaPr();
para_pr.Spacing.Before = 0.0;
para_pr.Spacing.After = 0.0;
para_pr.Spacing.Line = 1;
para_pr.Spacing.LineRule = linerule_Auto;
style.ParaPr = para_pr;
var font_name = theme.themeElements.fontScheme.minorFont.latin;
text_pr.RFonts.Ascii = {Name: font_name, Index: -1};
text_pr.RFonts.EastAsia = {Name: font_name, Index: -1};
text_pr.RFonts.HAnsi = {Name: font_name, Index: -1};
text_pr.RFonts.CS = {Name: font_name, Index: -1};
text_pr.RFonts.Hint = {Name: font_name, Index: -1};
style.TextPr = text_pr;
var chart_text_pr;
if(this.chart.txPr
&& this.chart.txPr.content
&& this.chart.txPr.content.Content[0]
&& this.chart.txPr.content.Content[0].Pr
&& this.chart.txPr.content.Content[0].Pr.DefaultRunPr)
{
chart_text_pr = this.chart.txPr.content.Content[0].Pr.DefaultRunPr;
style.TextPr.Merge(chart_text_pr);
}
if(this instanceof CTitle)
{
style.TextPr.Bold = true;
if(this.parent instanceof CChart)
{
if(chart_text_pr && typeof chart_text_pr.FontSize === "number")
style.TextPr.FontSize *= 1.2;
else
style.TextPr.FontSize = 18;
}
}
if(this.txPr
&& this.txPr.content
&& this.txPr.content.Content[0]
&& this.txPr.content.Content[0].Pr
&& this.txPr.content.Content[0].Pr.DefaultRunPr)
{
style.TextPr.Merge(this.txPr.content.Content[0].Pr.DefaultRunPr);
}
styles.Add(style);
this.compiledStyles = {lastId: style.Id, styles: styles};
this.compiledStyles = this.getStyles();
},
this, []);
},
......@@ -7261,6 +7278,13 @@ function CLegend()
this.spPr = null;
this.txPr = null;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.calcEntryes = [];
this.transform = new CMatrix();
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
......@@ -7318,6 +7342,16 @@ CLegend.prototype =
this.txPr = txPr;
},
findLegendEntryByIndex: function(idx)
{
for(var i = 0; i < this.legendEntryes.length; ++i)
{
if(this.legendEntryes[i].idx === idx)
return this.legendEntryes[i];
}
return null;
},
Undo: function(data)
{
switch (data.Type)
......@@ -7537,6 +7571,7 @@ function CLegendEntry()
this.idx = null;
this.txPr = null;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
......@@ -8398,17 +8433,17 @@ CLineSeries.prototype =
};
var SYMBOL_CIRCLE = 0;
var SYMBOL_DASH = 1;
var SYMBOL_DIAMOND = 2;
var SYMBOL_DOT = 3;
var SYMBOL_NONE = 4;
var SYMBOL_PICTURE = 5;
var SYMBOL_PLUS = 6;
var SYMBOL_SQUARE = 7;
var SYMBOL_STAR = 8;
var SYMBOL_CIRCLE = 0;
var SYMBOL_DASH = 1;
var SYMBOL_DIAMOND = 2;
var SYMBOL_DOT = 3;
var SYMBOL_NONE = 4;
var SYMBOL_PICTURE = 5;
var SYMBOL_PLUS = 6;
var SYMBOL_SQUARE = 7;
var SYMBOL_STAR = 8;
var SYMBOL_TRIANGLE = 9;
var SYMBOL_X = 10;
var SYMBOL_X = 10;
var MARKER_SYMBOL_TYPE = [];
......@@ -15705,4 +15740,33 @@ CValAxisLabels.prototype =
}
}
}
};
function CalcLegendEntry(legend, chart)
{
this.chart = chart;
this.legend = legend;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.marker = null;
this.txBody = null;
this.txPr = null;
this.recalcInfo =
{
recalcStyle: true
};
}
CalcLegendEntry.prototype =
{
recalculate: function()
{
},
getStyles: CDLbl.prototype.getStyles,
recalculateStyle: CDLbl.prototype.recalculateStyle,
Get_Styles: CDLbl.prototype.Get_Styles
};
\ No newline at end of file
......@@ -1015,7 +1015,6 @@ CTextBody.prototype =
var r_ins = body_pr.rIns;
var l_ins = body_pr.lIns;
var max_content_width = maxWidth - r_ins - l_ins;
this.content.RecalculateNumbering();
this.content.Reset(0, 0, max_content_width, 20000);
this.content.Recalculate_Page(0, true);
var max_width = 0;
......
......@@ -841,9 +841,9 @@ CChartSpace.prototype.recalculateSeriesColors = function()
compiled_line.merge(default_line);
compiled_line.Fill.merge(base_line_fills[i]);
compiled_line.w *= style.line3;
if(ser.spPr && spPr.ln)
if(ser.spPr && ser.spPr.ln)
{
compiled_line.merge(spPr.ln);
compiled_line.merge(ser.spPr.ln);
}
if(Array.isArray(ser.dPt))
{
......@@ -2230,6 +2230,8 @@ CChartSpace.prototype.recalculateAxis = function()
val_ax = axis_by_types.valAx[0];
if(cat_ax && val_ax)
{
cat_ax.labels = null;
val_ax.labels = null;
var sizes = this.getChartSizes();
var rect = {x: sizes.startX, y:sizes.startY, w:sizes.w, h: sizes.h};
//расчитаем подписи для вертикальной оси
......@@ -2470,6 +2472,13 @@ CChartSpace.prototype.recalculateAxis = function()
}
};
CChartSpace.prototype.getAllSeries = function()
{
//TODO:Переделать когда будем поддерживать насколько вложенных чартов
return this.chart.plotArea.chart.series;
};
CChartSpace.prototype.recalculateLegend = function()
{
if(this.chart && this.chart.legend)
......@@ -2478,9 +2487,50 @@ CChartSpace.prototype.recalculateLegend = function()
var arr_str_labels = [], i, series = this.chart.plotArea.chart.series;
for(i = 0; i < series.length; ++i)
arr_str_labels.push(series[i].getSeriesName());
var calc_entryes = legend.calcEntryes;
calc_entryes.length = 0;
for(i = 0; i < arr_str_labels.length; ++i)
{
var calc_entry = new CalcLegendEntry(legend, this);
calc_entry.txBody = CreateTextBodyFromString(arr_strings[i], this.getDrawingDocument(), calc_entry);
var entry = legend.findLegendEntryByIndex(i);
if(entry)
calc_entry.txPr = entry.txPr;
calc_entryes.push(calc_entry);
}
var legend_pos;
if(isRealNumber(legend.legendPos))
{
legend_pos = legend.legendPos;
}
else if(!isRealObject(legend.layout) || !isRealObject(legend.layout.manualLayout))
{
legend_pos = LEGEND_POS_L;
}
if(isRealNumber(legend_pos))
{
if(legend_pos === LEGEND_POS_L || legend_pos === LEGEND_POS_R || legend_pos === LEGEND_POS_TR)
{
var max_width = 0, cur_width, max_font_size = 0, cur_font_size;
for(i = 0; i < calc_entryes.length; ++i)
{
calc_entry = calc_entryes[i];
cur_width = calc_entry.txBody.getRectWidth(2000);
if(cur_width > max_width)
max_width = cur_width;
cur_font_size = calc_entry.txBody.content.Content[0].CompiledPr.Pr.TextPr.FontSize;
if(cur_font_size > max_font_size)
max_font_size = cur_font_size;
}
}
else
{
}
}
}
};
......
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