Commit faf65450 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

отрисовка текста в диаграммах(word)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@47667 954022d7-b5bf-4e40-9824-e11837661b57
parent 06748ba6
......@@ -11,10 +11,10 @@ function ChartRender() {
g_bChartPreview = true;
else
g_bChartPreview = false;
if(window["editor"])
return;
if (chart.worksheet && !OfficeExcel.drawingCtxCharts)//выставление контекста для отрисовки
OfficeExcel.drawingCtxCharts = chart.worksheet.getDrawingContextCharts();
else if(window["editor"] && !OfficeExcel.drawingCtxCharts)
OfficeExcel.drawingCtxCharts = new CDrawingContextWord();
chartCanvas = document.createElement('canvas');
$(chartCanvas).css('width', width);
$(chartCanvas).css('height', height);
......@@ -1336,7 +1336,8 @@ function drawChart(chart, arrValues, width, height) {
var defaultXTitle = 'X Axis';
var defaultYTitle = 'Y Axis';
var defaultTitle = 'Diagram Title';
if(OfficeExcel.drawingCtxCharts)
OfficeExcel.drawingCtxCharts.setCanvas(chartCanvas);
// По типу
switch (chart.type) {
case c_oAscChartType.line:
......@@ -2017,34 +2018,37 @@ function getFontProperties(type)
var xAxisTitle = bar._xAxisTitle;
var yAxisTitle = bar._yAxisTitle;
var chartTitle = bar._chartTitle;
var fontProp = Asc.FontProperties;
if(!fontProp)
fontProp = FontProperties;
switch (type) {
case "xLabels":
{
return new Asc.FontProperties(props._xlabels_font,props._xlabels_size,props._xlabels_bold, props._xlabels_italic, props._xlabels_underline);
return new fontProp(props._xlabels_font,props._xlabels_size,props._xlabels_bold, props._xlabels_italic, props._xlabels_underline);
}
case "yLabels":
{
return new Asc.FontProperties(props._ylabels_font, props._ylabels_size, props._ylabels_bold, props._ylabels_italic, props._ylabels_underline);
return new fontProp(props._ylabels_font, props._ylabels_size, props._ylabels_bold, props._ylabels_italic, props._ylabels_underline);
}
case "xTitle":
{
return new Asc.FontProperties(xAxisTitle._font, xAxisTitle._size, xAxisTitle._bold, xAxisTitle._italic, xAxisTitle._underline);
return new fontProp(xAxisTitle._font, xAxisTitle._size, xAxisTitle._bold, xAxisTitle._italic, xAxisTitle._underline);
}
case "yTitle":
{
return new Asc.FontProperties(yAxisTitle._font, yAxisTitle._size, yAxisTitle._bold, yAxisTitle._italic, yAxisTitle._underline);
return new fontProp(yAxisTitle._font, yAxisTitle._size, yAxisTitle._bold, yAxisTitle._italic, yAxisTitle._underline);
}
case "key":
{
return new Asc.FontProperties(props._key_text_font,props._key_text_size,props._key_text_bold, props._key_text_italic, props._key_text_underline);
return new fontProp(props._key_text_font,props._key_text_size,props._key_text_bold, props._key_text_italic, props._key_text_underline);
}
case "title":
{
return new Asc.FontProperties(chartTitle._font, chartTitle._size, chartTitle._bold, chartTitle._italic, chartTitle._underline);
return new fontProp(chartTitle._font, chartTitle._size, chartTitle._bold, chartTitle._italic, chartTitle._underline);
}
case "labelsAbove":
{
return new Asc.FontProperties(props._ylabels_labels_above_labels_above_font, props._labels_above_size, props._labels_above_bold, props._labels_above_italic, props._labels_above_underline);
return new fontProp(props._ylabels_labels_above_labels_above_font, props._labels_above_size, props._labels_above_bold, props._labels_above_italic, props._labels_above_underline);
}
}
}
......
......@@ -1504,7 +1504,10 @@
{
scale = drwContext.scaleFactor;
drwContext.setCanvas(bar.canvas);
var fontProp = Asc.FontProperties;
if(!fontProp)
fontProp = FontProperties;
context = drwContext;
// Need these now the angle can be specified, ie defaults for the former two args
if (typeof(arguments[6]) == null) arguments[6] = 'bottom'; // Vertical alignment. Default to bottom/baseline
......@@ -1520,15 +1523,15 @@
}
// First, translate to x/y coords
context.save();
/*context.save();
context.canvas.__OfficeExcel_originalx__ = x;
context.canvas.__OfficeExcel_originaly__ = y;
context.translate(x, y);
context.translate(x, y);*/
var italic = arguments[13] && arguments[13].italic ? arguments[13].italic : false;
var underline = arguments[13] && arguments[13].underline ? arguments[13].underline : false;
var ascFont = new Asc.FontProperties(font, size, arguments[11], italic, underline);
var ascFont = new fontProp(font, size, arguments[11], italic, underline);
context.setFont(ascFont);
var width;
......@@ -1594,7 +1597,7 @@
context.fillText(text, x*0.75, y*0.75);
context.lineWidth = 1;
}
context.restore();
//context.restore();
}
else
{
......@@ -1755,23 +1758,33 @@
if(!angle)
angle = 90;
if(window["editor"])
{
//****TeST****
var m = new CMatrix();
drawingCtx.setFont(font, angle);
m.Rotate(90);
drawingCtx.transform(m.sx, m.shy, m.shx, m.sy, m.tx, m.ty);
drawingCtx.fillText(text, cx - 90, cy - 90, 0, 0, angle);
}
else
{
var m = new asc.Matrix();
m.rotate(angle, 0);
var m = new asc.Matrix();
m.rotate(angle, 0);
var mbt = new asc.Matrix();
mbt.translate(cx + textWidth, cy + textHeight);
drawingCtx.setFont(font, angle);
var mbt = new asc.Matrix();
mbt.translate(cx + textWidth, cy + textHeight);
drawingCtx.setTextTransform(m.sx, m.shy, m.shx, m.sy, m.tx, m.ty);
drawingCtx.setTransform(mbt.sx, mbt.shy, mbt.shx, mbt.sy, mbt.tx, mbt.ty);
drawingCtx.updateTransforms();
drawingCtx.setFont(font, angle);
drawingCtx.setTextTransform(m.sx, m.shy, m.shx, m.sy, m.tx, m.ty);
drawingCtx.setTransform(mbt.sx, mbt.shy, mbt.shx, mbt.sy, mbt.tx, mbt.ty);
drawingCtx.updateTransforms();
drawingCtx.fillText(text, 0, 0, 0, 0, angle);
drawingCtx.fillText(text, 0, 0, 0, 0, angle);
drawingCtx.resetTransforms();
drawingCtx.resetTransforms();
}
}
......
This diff is collapsed.
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