Commit 22de2b09 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54163 954022d7-b5bf-4e40-9824-e11837661b57
parent 29d09d65
...@@ -834,6 +834,15 @@ CAxis.prototype = ...@@ -834,6 +834,15 @@ CAxis.prototype =
this.txPr = pr; this.txPr = pr;
}, },
getParentObjects: function()
{
return this.parent && this.parent.getParentObjects ? this.parent.getParentObjects() : null;
},
recalculateBrush: CDLbl.prototype.recalculateBrush,
recalculatePen: CDLbl.prototype.recalculatePen,
Undo: function(data) Undo: function(data)
{ {
switch (data.Type) switch (data.Type)
...@@ -3810,35 +3819,7 @@ CDLbl.prototype = ...@@ -3810,35 +3819,7 @@ CDLbl.prototype =
} }
else else
{ {
var tx_body = new CTextBody(); this.txBody = CreateTextBodyFromString(this.getDefaultTextForTxBody(), this.chart.getDrawingDocument(), this);
tx_body.setParent(this);
tx_body.setBodyPr(new CBodyPr());
tx_body.setContent(new CDocumentContent(tx_body, this.chart.getDrawingDocument(), 0, 0, 0, 0, false, false));
var compiled_string = this.getDefaultTextForTxBody();
var content = tx_body.content;
for(var i = 0; i < compiled_string.length; ++i)
{
var ch = compiled_string[i];
if (ch == '\t')
{
content.Paragraph_Add( new ParaTab(), false );
}
else if (ch == '\n')
{
content.Paragraph_Add( new ParaNewLine(break_Line), false );
}
else if (ch == '\r')
;
else if (ch != ' ')
{
content.Paragraph_Add(new ParaText(ch), false );
}
else
{
content.Paragraph_Add(new ParaSpace(1), false );
}
}
this.txBody = tx_body;
} }
}, },
...@@ -14836,3 +14817,36 @@ CView3d.prototype = ...@@ -14836,3 +14817,36 @@ CView3d.prototype =
} }
} }
}; };
function CreateTextBodyFromString(str, drawingDocument, parent)
{
var tx_body = new CTextBody();
tx_body.setParent(parent);
tx_body.setBodyPr(new CBodyPr());
tx_body.setContent(new CDocumentContent(tx_body, drawingDocument, 0, 0, 0, 0, false, false));
var content = tx_body.content;
for(var i = 0; i < str.length; ++i)
{
var ch = str[i];
if (ch == '\t')
{
content.Paragraph_Add( new ParaTab(), false );
}
else if (ch == '\n')
{
content.Paragraph_Add( new ParaNewLine(break_Line), false );
}
else if (ch == '\r')
;
else if (ch != ' ')
{
content.Paragraph_Add(new ParaText(ch), false );
}
else
{
content.Paragraph_Add(new ParaSpace(1), false );
}
}
return tx_body;
}
\ No newline at end of file
...@@ -38,7 +38,10 @@ CChartSpace.prototype.setRecalculateInfo = function() ...@@ -38,7 +38,10 @@ CChartSpace.prototype.setRecalculateInfo = function()
recalculateDLbls: true, recalculateDLbls: true,
recalculateAxisLabels: true, recalculateAxisLabels: true,
dataLbls:[], dataLbls:[],
axisLabels: [] axisLabels: [],
recalculateAxisVal: true,
recalculateAxisCat: true ,
recalculateAxisTickMark: true
}; };
this.baseColors = []; this.baseColors = [];
this.bounds = {l: 0, t: 0, r: 0, b:0, w: 0, h:0}; this.bounds = {l: 0, t: 0, r: 0, b:0, w: 0, h:0};
...@@ -203,7 +206,7 @@ CChartSpace.prototype.recalculate = function() ...@@ -203,7 +206,7 @@ CChartSpace.prototype.recalculate = function()
if(this.recalcInfo.recalculateTransform) if(this.recalcInfo.recalculateTransform)
{ {
this.recalculateTransform(); this.recalculateTransform();
this.recalcInforecalculateTransform = false; this.recalcInfo.recalculateTransform = false;
} }
if(this.recalcInfo.recalculateBounds) if(this.recalcInfo.recalculateBounds)
{ {
...@@ -230,6 +233,11 @@ CChartSpace.prototype.recalculate = function() ...@@ -230,6 +233,11 @@ CChartSpace.prototype.recalculate = function()
this.recalculateGridLines(); this.recalculateGridLines();
this.recalcInfo.recalculateGridLines = false; this.recalcInfo.recalculateGridLines = false;
} }
if(this.recalcInfo.recalculateAxisTickMark)
{
this.recalculateAxisTickMark();
this.recalcInfo.recalculateAxisTickMark = true;
}
if(this.recalcInfo.recalculateDLbls) if(this.recalcInfo.recalculateDLbls)
{ {
this.recalculateDLbls(); this.recalculateDLbls();
...@@ -245,10 +253,19 @@ CChartSpace.prototype.recalculate = function() ...@@ -245,10 +253,19 @@ CChartSpace.prototype.recalculate = function()
this.recalculateChart(); this.recalculateChart();
this.recalcInfo.recalculateChart = false; this.recalcInfo.recalculateChart = false;
} }
if(this.recalcInfo.recalculateAxisVal)
{
this.recalculateAxisVal();
this.recalcInfo.recalculateAxisVal = false;
}
for(var i = 0; i < this.recalcInfo.dataLbls.length; ++i) for(var i = 0; i < this.recalcInfo.dataLbls.length; ++i)
{
if(this.recalcInfo.dataLbls[i].series && this.recalcInfo.dataLbls[i].pt)
{ {
var pos = this.chartObj.reCalculatePositionText("dlbl", this, this.recalcInfo.dataLbls[i].series.idx, this.recalcInfo.dataLbls[i].pt.idx); var pos = this.chartObj.reCalculatePositionText("dlbl", this, this.recalcInfo.dataLbls[i].series.idx, this.recalcInfo.dataLbls[i].pt.idx);
this.recalcInfo.dataLbls[i].setPosition(pos.x, pos.y); this.recalcInfo.dataLbls[i].setPosition(pos.x, pos.y);
}
} }
this.recalcInfo.dataLbls.length = 0; this.recalcInfo.dataLbls.length = 0;
...@@ -477,7 +494,7 @@ CChartSpace.prototype.recalculateGridLines = function() ...@@ -477,7 +494,7 @@ CChartSpace.prototype.recalculateGridLines = function()
} }
compiled_grid_lines.Fill.merge(defaultStyle); compiled_grid_lines.Fill.merge(defaultStyle);
compiled_grid_lines.merge(spPr.ln); compiled_grid_lines.merge(spPr.ln);
compiled_grid_lines.calculate(parents.theme, parents.slide, parents.layout, parents.master, {R: 0, G: 0, B: 0, A: 255}) compiled_grid_lines.calculate(parents.theme, parents.slide, parents.layout, parents.master, {R: 0, G: 0, B: 0, A: 255});
return compiled_grid_lines; return compiled_grid_lines;
} }
return null; return null;
...@@ -1019,4 +1036,142 @@ CChartSpace.prototype.recalculateDLbls = function() ...@@ -1019,4 +1036,142 @@ CChartSpace.prototype.recalculateDLbls = function()
} }
}; };
CChartSpace.prototype.getValAxisValues = function()
{
if(!this.chartObj)
{
this.chartObj = new CChartsDrawer()
}
this.chartObj.preCalculateData(this);
var ret = [];
ret = ret.concat(this.chartObj.calcProp);
return ret;
};
CChartSpace.prototype.recalculateValAxLine = function()
{};
CChartSpace.prototype.recalculateAxisVal = function()
{
if(this.chart && this.chart.plotArea && this.chart.plotArea.valAx)
{
var val_ax = this.chart.plotArea.valAx;
val_ax.axisLabels = [];
var arr_val = this.getValAxisValues();
var i;
for(i = 0; i < arr_val.length; ++i)
{
var dlbl = new CDLbl();
dlbl.parent = val_ax;
dlbl.chart = this;
dlbl.spPr = val_ax.spPr;
dlbl.txPr = val_ax.txPr;
dlbl.tx = new CChartText();
dlbl.tx.rich = CreateTextBodyFromString(arr_val[i]+"", this.getDrawingDocument(), dlbl);
dlbl.recalculate();
val_ax.axisLabels.push(dlbl);
}
}
};
CChartSpace.prototype.recalculateAxisTickMark = function()
{
if(this.chart && this.chart.plotArea)
{
var calcMajorMinorGridLines = function (axis, defaultStyle, subtleLine, parents)
{
function calcGridLine(defaultStyle, spPr, subtleLine, parents)
{
var compiled_grid_lines = new CLn();
compiled_grid_lines.merge(subtleLine);
if(!compiled_grid_lines.Fill)
{
compiled_grid_lines.setFill(new CUniFill());
}
compiled_grid_lines.Fill.merge(defaultStyle);
if(spPr)
{
compiled_grid_lines.merge(spPr.ln);
}
compiled_grid_lines.calculate(parents.theme, parents.slide, parents.layout, parents.master, {R: 0, G: 0, B: 0, A: 255});
return compiled_grid_lines;
}
axis.compiledLn = calcGridLine(defaultStyle.axisAndMajorGridLines, axis.spPr, subtleLine, parents);
axis.compiledTickMarkLn = axis.compiledLn.createDuplicate();
if(isRealNumber(axis.compiledTickMarkLn.w))
axis.compiledTickMarkLn.w/=2;
axis.compiledTickMarkLn.calculate(parents.theme, parents.slide, parents.layout, parents.master, {R: 0, G: 0, B: 0, A: 255})
};
var default_style = CHART_STYLE_MANAGER.getDefaultLineStyleByIndex(this.style);
var parent_objects = this.getParentObjects();
var RGBA = {R:0, G:0, B:0, A: 255};
var subtle_line;
if(parent_objects.theme && parent_objects.theme.themeElements
&& parent_objects.theme.themeElements.fmtScheme
&& parent_objects.theme.themeElements.fmtScheme.lnStyleLst)
{
subtle_line = parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0];
}
if(this.chart.plotArea.valAx)
calcMajorMinorGridLines(this.chart.plotArea.valAx, default_style, subtle_line, parent_objects);
if(this.chart.plotArea.catAx)
calcMajorMinorGridLines(this.chart.plotArea.catAx, default_style, subtle_line, parent_objects);
}
};
CChartSpace.prototype.recalculateAxisCat = function()
{
};
CChartSpace.prototype.recalculateChartBrush = function()
{
var default_brush;
if(this.style >=1 && this.style <=32)
default_brush = CreateUnifillSolidFillSchemeColor(6, 0);
else if(this.style >=33 && this.style <= 40)
default_brush = CreateUnifillSolidFillSchemeColor(12, 0);
else
default_brush = CreateUnifillSolidFillSchemeColor(8, 0);
if(this.spPr && this.spPr.Fill)
{
default_brush.merge(this.spPr.Fill);
}
var parents = this.getParentObjects();
default_brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, {R: 0, G: 0, B: 0, A: 255});
this.brush = default_brush;
};
CChartSpace.prototype.recalculateChartPen = function()
{
var parent_objects = this.getParentObjects();
var default_line = new CLn();
if(parent_objects.theme && parent_objects.theme.themeElements
&& parent_objects.theme.themeElements.fmtScheme
&& parent_objects.theme.themeElements.fmtScheme.lnStyleLst)
{
default_line.merge(parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0]);
}
default_line.setFill(new CUniFill());
default_line.Fill.setFill(new CSolidFill());
default_line.Fill.fill.setColor(new CUniColor());
default_line.Fill.fill.color.setColor(new CSchemeColor());
};
function CreateUnifillSolidFillSchemeColor(colorId, tintOrShade)
{
var unifill = new CUniFill();
unifill.setFill(new CSolidFill());
unifill.fill.setColor(new CUniColor());
unifill.fill.color.setColor(new CSchemeColor());
unifill.fill.color.color.setId(colorId);
return CreateUniFillSolidFillWidthTintOrShade(unifill, tintOrShade);
}
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