Commit 92c37c1a 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@54580 954022d7-b5bf-4e40-9824-e11837661b57
parent 47e429d2
......@@ -5144,13 +5144,11 @@ CGeometry2.prototype =
AddPath: function(path)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Add_Path, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddObject(path.Id)), null);
this.pathLst.push(path);
},
AddRect: function(l, t, r, b)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Add_GeometryRect, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataAddGeometryRect(l, t, r, b)), null);
this.rectS = {};
this.rectS.l = l;
this.rectS.t = t;
......
......@@ -3884,8 +3884,11 @@ function DrawingObjects() {
if ( _range )
chart.range.intervalObject = _range;
chart.rebuildSeries();
chart.worksheet = worksheet; // Для формул серий
ExecuteNoHistory(function()
{
chart.rebuildSeries();
chart.worksheet = worksheet; // Для формул серий
}, this, []);
return this.controller.addChartDrawingObject(chart, options);
}
......
......@@ -614,6 +614,8 @@ DrawingObjectsController.prototype =
}
if(i === this.selectedObjects.length)
this.selectedObjects.push(object);
if(this.selectedObjects.length === 1 && this.selectedObjects[0] instanceof CChartSpace)
window["asc"]["editor"].handlers.trigger("asc_onSelectChart", this.selectedObjects[0]);
},
......@@ -1193,21 +1195,10 @@ DrawingObjectsController.prototype =
{
var chart = null;
for (var i = 0; i < this.selectedObjects.length; i++) {
if ( this.selectedObjects[i].isChart() ) {
if ( chart != null )
return null;
this.selectedObjects[i].syncAscChart();
chart = new asc_CChart(this.selectedObjects[0].chart);
}
if ( this.selectedObjects[i].isGroup() ) {
for ( var j = 0; j < this.selectedObjects[i].arrGraphicObjects.length; j++ ) {
if ( this.selectedObjects[i].arrGraphicObjects[j].isChart() ) {
if ( chart != null )
return null;
this.selectedObjects[i].arrGraphicObjects[j].syncAscChart();
chart = new asc_CChart(this.selectedObjects[i].arrGraphicObjects[j].chart);
}
}
if ( this.selectedObjects[i].isChart() )
{
this.selectedObjects[i].drObjects = this;
return this.selectedObjects[i];
}
}
return chart;
......@@ -1225,32 +1216,265 @@ DrawingObjectsController.prototype =
},
editChartCallback: function(chart)
getSelectedObjectsByTypes: function()
{
if(this.selectedObjects.length === 1)
var ret = {shapes: [], images: [], groups: [], charts: []};
var selected_objects = this.curState.group ? this.curState.group.selectedObjects : this.selectedObjects;
for(var i = 0; i < selected_objects.length; ++i)
{
if(this.selectedObjects[0].isChart())
var drawing = selected_objects[i];
var type = drawing.getObjectType();
switch(type)
{
this.selectedObjects[0].setChart(chart);
this.selectedObjects[0].recalculate();
this.drawingObjects.showDrawingObjects(true);
return;
case historyitem_type_Shape:
{
ret.shapes.push(drawing);
break;
}
case historyitem_type_ImageShape:
{
ret.images.push(drawing);
break;
}
case historyitem_type_GroupShape:
{
ret.groups.push(drawing);
break;
}
case historyitem_type_ChartSpace:
{
ret.charts.push(drawing);
break;
}
}
}
return ret;
},
editChartCallback: function(chartSettings)
{
var objects_by_types = this.getSelectedObjectsByTypes();
if(objects_by_types.charts.length === 1)
{
//Style Index
var chart_space = objects_by_types.charts[0];
var style_index = chartSettings.getStyle();
if(isRealNumber(style_index) && style_index > 0 && style_index < 49)
{
chart_space.setStyle(style_index);
}
if(isRealObject(this.curState.group))
//Title Settings
var chart = chart_space.chart;
var title_show_settings = chartSettings.getTitle();
if(title_show_settings === c_oAscChartTitleShowSettings.none)
{
if(this.curState.group.selectedObjects.length === 1)
if(chart.title)
{
if(this.curState.group.selectedObjects[0].isChart())
chart.setTitle(null);
}
}
else if(title_show_settings === c_oAscChartTitleShowSettings.noOverlay
|| title_show_settings === c_oAscChartTitleShowSettings.overlay)
{
if(!chart.title)
{
chart.setTitle(new CTitle());
}
chart.title.setOverlay(title_show_settings === c_oAscChartTitleShowSettings.overlay);
}
//Row/Cols
if(chartSettings.getRowCols() !== null)
{
chart_space.swapData();
}
var plot_area = chart.plotArea;
//horAxisLabel
var hor_axis_label_setting = chartSettings.getHorAxisLabel();
if(hor_axis_label_setting !== null)
{
var hor_axis = plot_area.getHorizontalAxis();
if(hor_axis)
{
switch (hor_axis_label_setting)
{
case c_oAscChartHorAxisLabelShowSettings.none:
{
hor_axis.setTitle(null);
break;
}
case c_oAscChartHorAxisLabelShowSettings.noOverlay:
{
if(!hor_axis.title)
{
hor_axis.setTitle(new CTitle());
}
if(hor_axis.title.overlay)
hor_axis.title.setOverlay(false);
break;
}
}
}
}
//vertAxis
var vert_axis_labels_settings = chartSettings.getVertAxisLabel();
if(vert_axis_labels_settings !== null)
{
var vert_axis = plot_area.getVerticalAxis();
if(vert_axis)
{
switch (vert_axis_labels_settings)
{
this.curState.group.selectedObjects[0].setChart(chart);
this.curState.group.selectedObjects[0].recalculate();
this.drawingObjects.showDrawingObjects(true);
return;
case c_oAscChartVertAxisLabelShowSettings.none:
{
if(vert_axis.title)
{
vert_axis.setTitle(null);
}
break;
}
case c_oAscChartVertAxisLabelShowSettings.vertical:
{
//TODO: пока СDocumentContent не поддерживает вертикальный текст, может быть будет когда-нибудь, хотя вряд ли.
break;
}
default:
{
if( vert_axis_labels_settings === c_oAscChartVertAxisLabelShowSettings.rotated
|| vert_axis_labels_settings === c_oAscChartVertAxisLabelShowSettings.horizontal)
{
if(!vert_axis.title)
{
vert_axis.setTitle(new CTitle());
}
if(!vert_axis.title.txPr)
{
vert_axis.title.setTxPr(new CTextBody());
}
if(!vert_axis.title.txPr.bodyPr)
{
vert_axis.title.txPr.setBodyPr(new CBodyPr());
}
vert_axis.title.txPr.bodyPr.reset();
vert_axis.title.txPr.bodyPr.setRot(vert_axis_labels_settings === c_oAscChartVertAxisLabelShowSettings.rotated ? Math.PI/2 : 0);
vert_axis.title.txPr.bodyPr.setVert(nVertTThorz);
}
}
}
}
}
//legend
var legend_pos_settings = chartSettings.getLegendPos();
if(legend_pos_settings !== null)
{
if(legend_pos_settings === c_oAscChartLegendShowSettings.none)
{
if(chart.legend)
{
chart.setLegend(null);
}
}
else
{
if(!chart.legend)
{
chart.setLegend(new CLegend());
}
if(isRealNumber(LEGEND_POS_MAP[legend_pos_settings]))
{
chart.legend.setLegendPos(LEGEND_POS_MAP[legend_pos_settings]);
if(legend_pos_settings === c_oAscChartLegendShowSettings.leftOverlay
|| legend_pos_settings === c_oAscChartLegendShowSettings.rightOverlay)
{
if(chart.legend.overlay !== true)
{
chart.legend.setOverlay(true);
}
}
}
}
}
//gridLines
//Hor GridLInes
var setAxisGridLines = function(axis, gridLinesSettings)
{
if(axis)
{
switch(gridLinesSettings)
{
case c_oAscGridLinesSettings.none:
{
if(axis.majorGridlines)
axis.setMajorGridlines(null);
if(axis.minorGridlines)
axis.setMinorGridlines(null);
break;
}
case c_oAscGridLinesSettings.major:
{
if(!axis.majorGridlines)
axis.setMajorGridlines(new CSpPr());
if(axis.minorGridlines)
axis.setMinorGridlines(null);
break;
}
case c_oAscGridLinesSettings.minor:
{
if(!axis.minorGridlines)
axis.setMinorGridlines(new CSpPr());
if(axis.majorGridlines)
axis.setMajorGridlines(null);
break;
}
case c_oAscGridLinesSettings.majorMinor:
{
if(!axis.minorGridlines)
axis.setMinorGridlines(new CSpPr());
if(!axis.majorGridlines)
axis.setMajorGridlines(new CSpPr());
break;
}
}
}
};
setAxisGridLines(plot_area.getHorizontalAxis(), chartSettings.getHorGridLines());
setAxisGridLines(plot_area.getVerticalAxis(), chartSettings.getVertGridLines());
var chart_type = plot_area.chart;
//Data Labels
var data_labels_pos_setting = chartSettings.getDataLabelsPos();
if(isRealNumber(data_labels_pos_setting))
{
if(data_labels_pos_setting === c_oAscChartDataLabelsPos.none)
{
chart_type.setDLbls(null);
}
else
{
if(isRealNumber(DLBL_POS_DEFINES_MAP[data_labels_pos_setting]))
{
if(!chart_type.dLbls)
{
var d_lbls = new CDLbls();
d_lbls.setShowVal(true);
chart_type.setDLbls(d_lbls);
}
chart_type.dLbls.setDLblPos(DLBL_POS_DEFINES_MAP[data_labels_pos_setting]);
}
}
}
//Vert Axis
chart_space.addToRecalculate(); //TODO
chart_space.setRecalculateInfo();//TODO: обязательно переделать
this.startRecalculate();
}
},
......@@ -1720,7 +1944,7 @@ DrawingObjectsController.prototype =
max_y = bounds.maxY;
min_x = bounds.minX;
min_y = bounds.minY;
for(i = 1; i < grouped_objects.length; ++i)
for(var i = 1; i < grouped_objects.length; ++i)
{
bounds = grouped_objects[i].getBoundsInGroup();
if(max_x < bounds.maxX)
......
......@@ -3715,6 +3715,19 @@ var DLBL_POS_OUT_END = 6;
var DLBL_POS_R = 7;
var DLBL_POS_T = 8;
var DLBL_POS_DEFINES_MAP = [];
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.b] = DLBL_POS_B;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.bestFit] = DLBL_POS_BEST_FIT;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.ctr] = DLBL_POS_CTR;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.inBase] = DLBL_POS_IN_BASE;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.inEnd] = DLBL_POS_IN_END;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.l] = DLBL_POS_L;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.outEnd] = DLBL_POS_OUT_END;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.r] = DLBL_POS_R;
DLBL_POS_DEFINES_MAP[c_oAscChartDataLabelsPos.t] = DLBL_POS_T;
function CDLbl()
{
this.bDelete = null;
......@@ -4044,21 +4057,21 @@ CDLbl.prototype =
_alpha = Math.atan2(_dy_t, _dx_t);
if (_body_pr.vert === nVertTTvert) {
if (_dx_lt_rb * _dy_t - _dy_lt_rb * _dx_t <= 0) {
global_MatrixTransformer.RotateRadAppend(_text_transform, -_alpha - Math.PI * 0.5 - (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.RotateRadAppend(_text_transform, -_alpha - Math.PI * 0.5 + (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rt, _t_y_rt);
}
else {
global_MatrixTransformer.RotateRadAppend(_text_transform, Math.PI * 0.5 - _alpha - (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.RotateRadAppend(_text_transform, Math.PI * 0.5 - _alpha + (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_lt, _t_y_lt);
}
}
else {
if (_dx_lt_rb * _dy_t - _dy_lt_rb * _dx_t <= 0) {
global_MatrixTransformer.RotateRadAppend(_text_transform, -_alpha - Math.PI * 1.5 - (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.RotateRadAppend(_text_transform, -_alpha - Math.PI * 1.5 + (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_lb, _t_y_lb);
}
else {
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI * 0.5 - _alpha - (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI * 0.5 - _alpha + (isRealNumber(_body_pr.rot) ? _body_pr.rot : 0));
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rb, _t_y_rb);
}
}
......@@ -4416,8 +4429,23 @@ CDLbl.prototype =
}
default:
{
this.extX = max_width + 1.25;
this.extY = this.txBody.content.Get_SummaryHeight() + SCALE_INSET_COEFF;
var _rot = isRealNumber(bodyPr.rot) ? bodyPr.rot : 0;
var t = new CMatrix();
global_MatrixTransformer.RotateRadAppend(t, -_rot);
var w, h, x0, y0, x1, y1, x2, y2, x3, y3;
w = max_width;
h = this.txBody.content.Get_SummaryHeight();
x0 = 0;
y0 = 0;
x1 = t.TransformPointX(w, 0);
y1 = t.TransformPointY(w, 0);
x2 = t.TransformPointX(w, h);
y2 = t.TransformPointY(w, h);
x3 = t.TransformPointX(0, h);
y3 = t.TransformPointY(0, h);
this.extX = Math.max(x0, x1, x2, x3) - Math.min(x0, x1, x2, x3) + 1.25;
this.extY = Math.max(y0, y1, y2, y3) - Math.min(y0, y1, y2, y3) + SCALE_INSET_COEFF;
this.x = 0;
this.y = 0;
break;
......@@ -7214,6 +7242,16 @@ var LEGEND_POS_R = 2;
var LEGEND_POS_B = 3;
var LEGEND_POS_TR = 4;
var LEGEND_POS_MAP = [];
LEGEND_POS_MAP[c_oAscChartLegendShowSettings.left] = LEGEND_POS_L;
LEGEND_POS_MAP[c_oAscChartLegendShowSettings.top] = LEGEND_POS_T;
LEGEND_POS_MAP[c_oAscChartLegendShowSettings.right] = LEGEND_POS_R;
LEGEND_POS_MAP[c_oAscChartLegendShowSettings.bottom] = LEGEND_POS_B;
LEGEND_POS_MAP[c_oAscChartLegendShowSettings.leftOverlay] = LEGEND_POS_L;
LEGEND_POS_MAP[c_oAscChartLegendShowSettings.rightOverlay] = LEGEND_POS_R;
function CLegend()
{
this.layout = null;
......@@ -10812,13 +10850,18 @@ CPivotFmt.prototype =
function CPlotArea()
{
this.chart = null;
this.catAx = null;
this.dateAx = null;
this.dTable = null;
this.layout = null;
this.serAx = null;
this.spPr = null;
//ТоDo
this.valAx = null;
this.catAx = null;
this.dateAx = null;
//
this.axis = [];
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
......@@ -10847,6 +10890,19 @@ CPlotArea.prototype =
this.Id = r.GetString2();
},
addAxis: function(axis)
{
History.Add(this, {Type: historyitem_PlotArea_AddAxis, newPr:axis});
this.axis.push(axis);
//TODO: полей catAx и valAx не должно быть все оси бадут лежать в одном массиве
if(axis instanceof CCatAx)
this.catAx = axis;
if(axis instanceof CValAx)
this.valAx = axis;
},
setChart: function(pr)
{
History.Add(this, {Type: historyitem_PlotArea_SetChart, oldPr: this.chart, newPr:pr});
......@@ -10895,6 +10951,18 @@ CPlotArea.prototype =
this.valAx = pr;
},
getHorizontalAxis: function()
{
return this.catAx; //TODO
},
getVerticalAxis: function()
{
return this.valAx; //TODO
},
Undo: function(data)
{
switch (data.Type)
......@@ -10934,6 +11002,18 @@ CPlotArea.prototype =
this.valAx = data.oldPr;
break;
}
case historyitem_PlotArea_AddAxis:
{
for(var i = this.axis.length; i > -1; --i)
{
if(this.axis[i] === data.newPr)
{
this.axis.splice(i, 1);
break;
}
}
break;
}
}
},
......@@ -10976,6 +11056,11 @@ CPlotArea.prototype =
this.valAx = data.newPr;
break;
}
case historyitem_PlotArea_AddAxis:
{
this.axis.push(data.newPr);
break;
}
}
},
......@@ -10991,6 +11076,7 @@ CPlotArea.prototype =
case historyitem_PlotArea_SetSerAx:
case historyitem_PlotArea_SetSpPr:
case historyitem_PlotArea_SetValAx:
case historyitem_PlotArea_AddAxis:
{
writeObject(w, data.newPr);
break;
......@@ -11038,6 +11124,12 @@ CPlotArea.prototype =
this.valAx = readObject(r);
break;
}
case historyitem_PlotArea_AddAxis:
{
var axis = readObject(r);
this.axis.push(axis);
break;
}
}
}
};
......
......@@ -1967,9 +1967,9 @@ function CreateLineChart(asc_chart, type)
var plot_area = chart.plotArea;
plot_area.setLayout(new CLayout());
plot_area.setChart(new CLineChart());
plot_area.setCatAx(new CCatAx());
plot_area.addAxis(new CCatAx());
plot_area.catAx.setTitle(new CTitle());
plot_area.setValAx(new CValAx());
plot_area.addAxis(new CValAx());
plot_area.valAx.setTitle(new CTitle());
var title = plot_area.valAx.title;
title.setTxPr(new CTextBody());
......@@ -2132,8 +2132,8 @@ function CreateBarChart(asc_chart, type)
var plot_area = chart.plotArea;
plot_area.setLayout(new CLayout());
plot_area.setChart(new CBarChart());
plot_area.setCatAx(new CCatAx());
plot_area.setValAx(new CValAx());
plot_area.addAxis(new CCatAx());
plot_area.addAxis(new CValAx());
var bar_chart = plot_area.chart;
bar_chart.setBarDir(BAR_DIR_COL);
bar_chart.setGrouping(type);
......@@ -2284,8 +2284,8 @@ function CreateHBarChart(asc_chart, type)
var plot_area = chart.plotArea;
plot_area.setLayout(new CLayout());
plot_area.setChart(new CBarChart());
plot_area.setCatAx(new CCatAx());
plot_area.setValAx(new CValAx());
plot_area.addAxis(new CCatAx());
plot_area.addAxis(new CValAx());
var bar_chart = plot_area.chart;
bar_chart.setBarDir(BAR_DIR_BAR);
bar_chart.setGrouping(type);
......@@ -2439,8 +2439,8 @@ function CreateAreaChart(asc_chart, type)
var plot_area = chart.plotArea;
plot_area.setLayout(new CLayout());
plot_area.setChart(new CAreaChart());
plot_area.setCatAx(new CCatAx());
plot_area.setValAx(new CValAx());
plot_area.addAxis(new CCatAx());
plot_area.addAxis(new CValAx());
var area_chart = plot_area.chart;
area_chart.setGrouping(GROUPING_STANDARD);
area_chart.setVaryColors(false);
......@@ -2589,8 +2589,8 @@ function CreatePieChart(asc_chart, type)
plot_area.setChart(new CPieChart());
var pie_chart = plot_area.chart;
pie_chart.setVaryColors(true);
plot_area.setCatAx(new CCatAx());
plot_area.setValAx(new CValAx());
plot_area.addAxis(new CCatAx());
plot_area.addAxis(new CValAx());
var parsedHeaders = asc_chart.parseSeriesHeaders();
for(var i = 0; i < asc_series.length; ++i)
{
......@@ -2702,8 +2702,8 @@ function CreateScatterChart(asc_chart)
var scatter_chart = plot_area.chart;
scatter_chart.setScatterStyle(SCATTER_STYLE_LINE_MARKER);
scatter_chart.setVaryColors(false);
plot_area.setCatAx(new CValAx());
plot_area.setValAx(new CValAx());
plot_area.addAxis(new CValAx());
plot_area.addAxis(new CValAx());
var first_series = asc_series.length > 1 ? asc_series[0] : null;
var start_index = asc_series.length > 1 ? 1 : 0;
......@@ -2862,8 +2862,8 @@ function CreateStockChart(asc_chart)
var plot_area = chart.plotArea;
plot_area.setLayout(new CLayout());
plot_area.setChart(new CStockChart());
plot_area.setCatAx(new CCatAx());
plot_area.setValAx(new CValAx());
plot_area.addAxis(new CCatAx());
plot_area.addAxis(new CValAx());
var line_chart = plot_area.chart;
line_chart.setDLbls(new CDLbls());
line_chart.addAxId(plot_area.catAx);
......
......@@ -141,6 +141,7 @@ var historyitem_PlotArea_SetLayout = 2137;
var historyitem_PlotArea_SetSerAx = 2138;
var historyitem_PlotArea_SetSpPr = 2139;
var historyitem_PlotArea_SetValAx = 2140;
var historyitem_PlotArea_AddAxis = 2141;
var historyitem_Axis_SetType = 2141;
var historyitem_Axis_SetAuto = 2142;
var historyitem_Axis_SetAxId = 2143;
......
......@@ -172,11 +172,25 @@ function ExecuteNoHistory(f, oThis, args)
{
History.TurnOff();
}
var b_table_id = false;
if(g_oTableId && !g_oTableId.m_bTurnOff)
{
g_oTableId.m_bTurnOff = true;
b_table_id = true;
}
var ret = f.apply(oThis, args);
if(is_on)
{
History.TurnOn();
}
if(b_table_id)
{
g_oTableId.m_bTurnOff = false;
}
return ret;
}
......
......@@ -85,625 +85,630 @@ function CreatePenBrushForChartTrack()
function ResizeTrackShapeImage(originalObject, cardDirection)
{
this.originalObject = originalObject;
this.numberHandle = originalObject.getNumByCardDirection(cardDirection);
var numberHandle = this.numberHandle;
this.flipH = originalObject.flipH;
this.flipV = originalObject.flipV;
var _flip_h = originalObject.flipH;
var _flip_v = originalObject.flipV;
var _half_height = originalObject.extY*0.5;
var _half_width = originalObject.extX*0.5;
var _sin = Math.sin(originalObject.rot);
var _cos = Math.cos(originalObject.rot);
var _translated_num_handle;
if(!_flip_h && !_flip_v)
ExecuteNoHistory(function()
{
_translated_num_handle = numberHandle;
}
else if(_flip_h && !_flip_v)
{
_translated_num_handle = TRANSLATE_HANDLE_FLIP_H[numberHandle];
}
else if(!_flip_h && _flip_v)
{
_translated_num_handle = TRANSLATE_HANDLE_FLIP_V[numberHandle];
}
else
{
_translated_num_handle = TRANSLATE_HANDLE_FLIP_H_AND_FLIP_V[numberHandle];
}
this.originalObject = originalObject;
this.numberHandle = originalObject.getNumByCardDirection(cardDirection);
this.bAspect = numberHandle % 2 === 0;
this.aspect = this.bAspect === true ? this.originalObject.getAspect(_translated_num_handle) : 0;
var numberHandle = this.numberHandle;
this.flipH = originalObject.flipH;
this.flipV = originalObject.flipV;
var _flip_h = originalObject.flipH;
var _flip_v = originalObject.flipV;
var _half_height = originalObject.extY*0.5;
var _half_width = originalObject.extX*0.5;
this.sin = _sin;
this.cos = _cos;
this.translatetNumberHandle = _translated_num_handle;
var _sin = Math.sin(originalObject.rot);
var _cos = Math.cos(originalObject.rot);
switch (_translated_num_handle)
{
case 0:
case 1:
var _translated_num_handle;
if(!_flip_h && !_flip_v)
{
this.fixedPointX = (_half_width*_cos - _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (_half_width*_sin + _half_height*_cos) + _half_height + originalObject.y;
break;
_translated_num_handle = numberHandle;
}
case 2:
case 3:
else if(_flip_h && !_flip_v)
{
this.fixedPointX = (-_half_width*_cos - _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (-_half_width*_sin + _half_height*_cos) + _half_height + originalObject.y;
break;
_translated_num_handle = TRANSLATE_HANDLE_FLIP_H[numberHandle];
}
case 4:
case 5:
else if(!_flip_h && _flip_v)
{
this.fixedPointX = (-_half_width*_cos + _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (-_half_width*_sin - _half_height*_cos) + _half_height + originalObject.y;
break;
_translated_num_handle = TRANSLATE_HANDLE_FLIP_V[numberHandle];
}
case 6:
case 7:
else
{
this.fixedPointX = (_half_width*_cos + _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (_half_width*_sin - _half_height*_cos) + _half_height + originalObject.y;
break;
_translated_num_handle = TRANSLATE_HANDLE_FLIP_H_AND_FLIP_V[numberHandle];
}
}
this.mod = this.translatetNumberHandle % 4;
this.centerPointX = originalObject.x + _half_width;
this.centerPointY = originalObject.y + _half_height;
//this.lineFlag = originalObject.checkLine();
this.bAspect = numberHandle % 2 === 0;
this.aspect = this.bAspect === true ? this.originalObject.getAspect(_translated_num_handle) : 0;
this.originalExtX = originalObject.extX;
this.originalExtY = originalObject.extY;
this.originalFlipH = _flip_h;
this.originalFlipV = _flip_v;
this.sin = _sin;
this.cos = _cos;
this.translatetNumberHandle = _translated_num_handle;
this.usedExtX = this.originalExtX === 0 ? (/*this.lineFlag ? this.originalExtX :*/ 0.01) : this.originalExtX;
this.usedExtY = this.originalExtY === 0 ? (/*this.lineFlag ? this.originalExtY :*/ 0.01) : this.originalExtY;
switch (_translated_num_handle)
{
case 0:
case 1:
{
this.fixedPointX = (_half_width*_cos - _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (_half_width*_sin + _half_height*_cos) + _half_height + originalObject.y;
break;
}
case 2:
case 3:
{
this.fixedPointX = (-_half_width*_cos - _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (-_half_width*_sin + _half_height*_cos) + _half_height + originalObject.y;
break;
}
case 4:
case 5:
{
this.fixedPointX = (-_half_width*_cos + _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (-_half_width*_sin - _half_height*_cos) + _half_height + originalObject.y;
break;
}
case 6:
case 7:
{
this.fixedPointX = (_half_width*_cos + _half_height*_sin) + _half_width + originalObject.x;
this.fixedPointY = (_half_width*_sin - _half_height*_cos) + _half_height + originalObject.y;
break;
}
}
this.resizedExtX = this.originalExtX;
this.resizedExtY = this.originalExtY;
this.resizedflipH = _flip_h;
this.resizedflipV = _flip_v;
this.resizedPosX = originalObject.x;
this.resizedPosY = originalObject.y;
this.resizedRot = originalObject.rot;
this.mod = this.translatetNumberHandle % 4;
this.centerPointX = originalObject.x + _half_width;
this.centerPointY = originalObject.y + _half_height;
this.transform = originalObject.transform.CreateDublicate();
this.geometry = originalObject.spPr.geometry ? originalObject.spPr.geometry.createDuplicate() : (function(){ var geometry = CreateGeometry("rect"); geometry.Recalculate(5, 5); return geometry})();
if(!originalObject.isChart())
{
this.brush = originalObject.brush;
this.pen = originalObject.pen;
}
else
{
var pen_brush = CreatePenBrushForChartTrack();
this.brush = pen_brush.brush;
this.pen = pen_brush.pen;
}
//this.lineFlag = originalObject.checkLine();
this.originalExtX = originalObject.extX;
this.originalExtY = originalObject.extY;
this.originalFlipH = _flip_h;
this.originalFlipV = _flip_v;
this.isLine = originalObject.spPr.geometry && originalObject.spPr.geometry.preset === "line";
this.bChangeCoef = this.translatetNumberHandle % 2 === 0 && this.originalFlipH !== this.originalFlipV;
this.usedExtX = this.originalExtX === 0 ? (/*this.lineFlag ? this.originalExtX :*/ 0.01) : this.originalExtX;
this.usedExtY = this.originalExtY === 0 ? (/*this.lineFlag ? this.originalExtY :*/ 0.01) : this.originalExtY;
this.overlayObject = new OverlayObject(this.geometry, this.resizedExtX, this.resizedExtY, this.brush, this.pen, this.transform);
this.resizedExtX = this.originalExtX;
this.resizedExtY = this.originalExtY;
this.resizedflipH = _flip_h;
this.resizedflipV = _flip_v;
this.resizedPosX = originalObject.x;
this.resizedPosY = originalObject.y;
this.resizedRot = originalObject.rot;
this.transform = originalObject.transform.CreateDublicate();
this.geometry = originalObject.spPr.geometry ? originalObject.spPr.geometry.createDuplicate() : (function(){ var geometry = CreateGeometry("rect"); geometry.Recalculate(5, 5); return geometry})();
this.track = function(kd1, kd2, e)
{
if(!e.CtrlKey)
this.resize(kd1, kd2, e.ShiftKey);
if(!originalObject.isChart())
{
this.brush = originalObject.brush;
this.pen = originalObject.pen;
}
else
this.resizeRelativeCenter(kd1, kd2, e.ShiftKey)
};
{
var pen_brush = CreatePenBrushForChartTrack();
this.brush = pen_brush.brush;
this.pen = pen_brush.pen;
}
this.resize = function(kd1, kd2, ShiftKey)
{
var _cos = this.cos;
var _sin = this.sin;
var _real_height, _real_width;
var _abs_height, _abs_width;
var _new_resize_half_width;
var _new_resize_half_height;
var _new_used_half_width;
var _new_used_half_height;
var _temp;
this.isLine = originalObject.spPr.geometry && originalObject.spPr.geometry.preset === "line";
this.bChangeCoef = this.translatetNumberHandle % 2 === 0 && this.originalFlipH !== this.originalFlipV;
if(ShiftKey === true && this.bAspect === true)
{
var _new_aspect = this.aspect*(Math.abs(kd1/ kd2));
this.overlayObject = new OverlayObject(this.geometry, this.resizedExtX, this.resizedExtY, this.brush, this.pen, this.transform);
if (_new_aspect >= this.aspect)
kd2 = Math.abs(kd1)*(kd2 >= 0 ? 1 : -1 );
else
kd1 = Math.abs(kd2)*(kd1 >= 0 ? 1 : -1);
}
if(this.bChangeCoef)
this.track = function(kd1, kd2, e)
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
switch (this.translatetNumberHandle)
if(!e.CtrlKey)
this.resize(kd1, kd2, e.ShiftKey);
else
this.resizeRelativeCenter(kd1, kd2, e.ShiftKey)
};
this.resize = function(kd1, kd2, ShiftKey)
{
case 0:
case 1:
var _cos = this.cos;
var _sin = this.sin;
var _real_height, _real_width;
var _abs_height, _abs_width;
var _new_resize_half_width;
var _new_resize_half_height;
var _new_used_half_width;
var _new_used_half_height;
var _temp;
if(ShiftKey === true && this.bAspect === true)
{
if(this.translatetNumberHandle === 0)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0 )
{
this.resizedflipH = !this.originalFlipH;
}
else
this.resizedflipH = this.originalFlipH;
}
if(this.translatetNumberHandle === 1)
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
var _new_aspect = this.aspect*(Math.abs(kd1/ kd2));
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0 )
if (_new_aspect >= this.aspect)
kd2 = Math.abs(kd1)*(kd2 >= 0 ? 1 : -1 );
else
kd1 = Math.abs(kd2)*(kd1 >= 0 ? 1 : -1);
}
if(this.bChangeCoef)
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
switch (this.translatetNumberHandle)
{
case 0:
case 1:
{
this.resizedflipV = !this.originalFlipV;
if(this.isLine && ShiftKey)
if(this.translatetNumberHandle === 0)
{
this.resizedflipH = !this.originalFlipH;
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0 )
{
this.resizedflipH = !this.originalFlipH;
}
else
this.resizedflipH = this.originalFlipH;
}
}
else
{
this.resizedflipV = this.originalFlipV;
if(this.isLine && ShiftKey && this.resizedflipH !== this.originalFlipH)
if(this.translatetNumberHandle === 1)
{
this.resizedflipV = !this.originalFlipV;
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
}
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
_new_used_half_width = -_new_resize_half_width;
}
else
{
_new_used_half_width = _new_resize_half_width;
}
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
}
else
{
_new_used_half_height = _new_resize_half_height;
}
this.resizedPosX = this.fixedPointX + (-_new_used_half_width*_cos + _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (-_new_used_half_width*_sin - _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
case 2:
case 3:
{
if(this.translatetNumberHandle === 2)
{
_temp = kd2;
kd2 = kd1;
kd1 = _temp;
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0 )
{
this.resizedflipV = !this.originalFlipV;
if(this.isLine && ShiftKey)
{
this.resizedflipH = !this.originalFlipH;
}
}
else
{
this.resizedflipV = this.originalFlipV;
}
if(this.isLine && ShiftKey && this.resizedflipH !== this.originalFlipH)
{
this.resizedflipV = !this.originalFlipV;
}
}
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0 )
{
this.resizedflipH = !this.originalFlipH;
if(this.isLine && ShiftKey)
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
this.resizedflipV = !this.originalFlipV;
_new_used_half_width = -_new_resize_half_width;
}
}
else
{
this.resizedflipH = this.originalFlipH;
if(this.isLine && ShiftKey && this.resizedflipV !== this.originalFlipV)
else
{
this.resizedflipH = !this.originalFlipH;
_new_used_half_width = _new_resize_half_width;
}
}
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
_new_used_half_width = -_new_resize_half_width;
}
else
{
_new_used_half_width = _new_resize_half_width;
}
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
}
else
{
_new_used_half_height = _new_resize_half_height;
}
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
this.resizedPosX = this.fixedPointX + (-_new_used_half_width*_cos + _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (-_new_used_half_width*_sin - _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
else
case 2:
case 3:
{
_new_used_half_height = _new_resize_half_height;
}
this.resizedPosX = this.fixedPointX + (_new_used_half_width*_cos + _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (_new_used_half_width*_sin - _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
if(this.translatetNumberHandle === 2)
{
_temp = kd2;
kd2 = kd1;
kd1 = _temp;
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0 )
this.resizedflipV = !this.originalFlipV;
else
this.resizedflipV = this.originalFlipV;
}
case 4:
case 5:
{
if(this.translatetNumberHandle === 4)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0 )
{
this.resizedflipH = !this.originalFlipH;
if(this.isLine && ShiftKey)
{
this.resizedflipV = !this.originalFlipV;
}
}
else
{
this.resizedflipH = this.originalFlipH;
}
else
{
_temp = kd2;
kd2 = kd1;
kd1 = _temp;
}
if(this.isLine && ShiftKey && this.resizedflipV !== this.originalFlipV)
{
this.resizedflipH = !this.originalFlipH;
}
}
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0 )
{
this.resizedflipV = !this.originalFlipV;
if(this.isLine && ShiftKey)
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
this.resizedflipH = !this.originalFlipH;
_new_used_half_width = -_new_resize_half_width;
}
}
else
{
this.resizedflipV = this.originalFlipV;
if(this.isLine && ShiftKey && this.resizedflipH !== this.originalFlipH)
else
{
this.resizedflipV = !this.originalFlipV;
_new_used_half_width = _new_resize_half_width;
}
}
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
_new_used_half_width = -_new_resize_half_width;
}
else
{
_new_used_half_width = _new_resize_half_width;
}
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
}
else
{
_new_used_half_height = _new_resize_half_height;
}
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
}
else
{
_new_used_half_height = _new_resize_half_height;
this.resizedPosX = this.fixedPointX + (_new_used_half_width*_cos + _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (_new_used_half_width*_sin - _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
this.resizedPosX = this.fixedPointX + (_new_used_half_width*_cos - _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (_new_used_half_width*_sin + _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
case 6:
case 7:
{
if(this.translatetNumberHandle === 6)
case 4:
case 5:
{
_real_height = this.usedExtY*kd1;
if(this.translatetNumberHandle === 4)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0 )
this.resizedflipH = !this.originalFlipH;
else
this.resizedflipH = this.originalFlipH;
}
else
{
_temp = kd2;
kd2 = kd1;
kd1 = _temp;
}
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0 )
{
this.resizedflipV = !this.originalFlipV;
if(this.isLine && ShiftKey)
{
this.resizedflipH = !this.originalFlipH;
}
}
else
{
this.resizedflipV = this.originalFlipV;
}
else
{
_temp = kd2;
kd2 = kd1;
kd1 = _temp;
}
if(this.isLine && ShiftKey && this.resizedflipH !== this.originalFlipH)
{
this.resizedflipV = !this.originalFlipV;
}
}
_real_width = this.usedExtX*kd2;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0 )
{
this.resizedflipH = !this.originalFlipH;
if(this.isLine && ShiftKey)
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
this.resizedflipV = !this.originalFlipV;
_new_used_half_width = -_new_resize_half_width;
}
}
else
{
this.resizedflipH = this.originalFlipH;
if(this.isLine && ShiftKey && this.resizedflipV !== this.originalFlipV)
else
{
this.resizedflipH = !this.originalFlipH;
_new_used_half_width = _new_resize_half_width;
}
}
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
_new_used_half_width = -_new_resize_half_width;
}
else
{
_new_used_half_width = _new_resize_half_width;
}
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
}
else
{
_new_used_half_height = _new_resize_half_height;
}
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
}
else
{
_new_used_half_height = _new_resize_half_height;
this.resizedPosX = this.fixedPointX + (_new_used_half_width*_cos - _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (_new_used_half_width*_sin + _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
this.resizedPosX = this.fixedPointX + (-_new_used_half_width*_cos - _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (-_new_used_half_width*_sin + _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
}
case 6:
case 7:
{
if(this.translatetNumberHandle === 6)
{
_real_height = this.usedExtY*kd1;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
if(_real_height < 0 )
this.resizedflipV = !this.originalFlipV;
else
this.resizedflipV = this.originalFlipV;
}
else
{
_temp = kd2;
kd2 = kd1;
kd1 = _temp;
}
this.geometry.Recalculate(this.resizedExtX, this.resizedExtY);
this.overlayObject.updateExtents(this.resizedExtX, this.resizedExtY);
_real_width = this.usedExtX*kd2;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
if(_real_width < 0 )
{
this.resizedflipH = !this.originalFlipH;
if(this.isLine && ShiftKey)
{
this.resizedflipV = !this.originalFlipV;
}
}
else
{
this.resizedflipH = this.originalFlipH;
if(this.isLine && ShiftKey && this.resizedflipV !== this.originalFlipV)
{
this.resizedflipH = !this.originalFlipH;
}
}
var _transform = this.transform;
_transform.Reset();
_new_resize_half_width = this.resizedExtX*0.5;
_new_resize_half_height = this.resizedExtY*0.5;
if(this.resizedflipH !== this.originalFlipH)
{
_new_used_half_width = -_new_resize_half_width;
}
else
{
_new_used_half_width = _new_resize_half_width;
}
var _horizontal_center = this.resizedExtX*0.5;
var _vertical_center = this.resizedExtY*0.5;
global_MatrixTransformer.TranslateAppend(_transform, -_horizontal_center, -_vertical_center);
if(this.resizedflipV !== this.originalFlipV)
{
_new_used_half_height = -_new_resize_half_height;
}
else
{
_new_used_half_height = _new_resize_half_height;
}
if(this.resizedflipH)
{
global_MatrixTransformer.ScaleAppend(_transform, -1, 1);
}
if(this.resizedflipV)
{
global_MatrixTransformer.ScaleAppend(_transform, 1, -1);
}
this.resizedPosX = this.fixedPointX + (-_new_used_half_width*_cos - _new_used_half_height*_sin) - _new_resize_half_width;
this.resizedPosY = this.fixedPointY + (-_new_used_half_width*_sin + _new_used_half_height*_cos) - _new_resize_half_height;
break;
}
}
global_MatrixTransformer.RotateRadAppend(_transform, -this.resizedRot);
this.geometry.Recalculate(this.resizedExtX, this.resizedExtY);
this.overlayObject.updateExtents(this.resizedExtX, this.resizedExtY);
var _transform = this.transform;
_transform.Reset();
global_MatrixTransformer.TranslateAppend(_transform, this.resizedPosX, this.resizedPosY);
global_MatrixTransformer.TranslateAppend(_transform, _horizontal_center, _vertical_center);
if(this.originalObject.group)
{
global_MatrixTransformer.MultiplyAppend(_transform, this.originalObject.group.transform);
}
};
var _horizontal_center = this.resizedExtX*0.5;
var _vertical_center = this.resizedExtY*0.5;
global_MatrixTransformer.TranslateAppend(_transform, -_horizontal_center, -_vertical_center);
this.resizeRelativeCenter = function(kd1, kd2, ShiftKey)
{
if(this.isLine)
{
this.resize(kd1, kd2, ShiftKey);
return;
}
kd1 = 2*kd1 - 1;
kd2 = 2*kd2 - 1;
var _real_height, _real_width;
var _abs_height, _abs_width;
if(this.resizedflipH)
{
global_MatrixTransformer.ScaleAppend(_transform, -1, 1);
}
if(this.resizedflipV)
{
global_MatrixTransformer.ScaleAppend(_transform, 1, -1);
}
if(ShiftKey === true && this.bAspect === true)
{
var _new_aspect = this.aspect*(Math.abs(kd1/ kd2));
global_MatrixTransformer.RotateRadAppend(_transform, -this.resizedRot);
if (_new_aspect >= this.aspect)
kd2 = Math.abs(kd1)*(kd2 >= 0 ? 1 : -1 );
else
kd1 = Math.abs(kd2)*(kd1 >= 0 ? 1 : -1);
}
var _temp;
if(this.bChangeCoef)
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
if(this.mod === 0 || this.mod === 1)
{
if(this.mod === 0)
global_MatrixTransformer.TranslateAppend(_transform, this.resizedPosX, this.resizedPosY);
global_MatrixTransformer.TranslateAppend(_transform, _horizontal_center, _vertical_center);
if(this.originalObject.group)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
this.resizedflipH = _real_width < 0 ? !this.originalFlipH : this.originalFlipH;
global_MatrixTransformer.MultiplyAppend(_transform, this.originalObject.group.transform);
}
else
};
this.resizeRelativeCenter = function(kd1, kd2, ShiftKey)
{
if(this.isLine)
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
this.resize(kd1, kd2, ShiftKey);
return;
}
kd1 = 2*kd1 - 1;
kd2 = 2*kd2 - 1;
var _real_height, _real_width;
var _abs_height, _abs_width;
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
this.resizedflipV = _real_height < 0 ? !this.originalFlipV : this.originalFlipV;
if(ShiftKey === true && this.bAspect === true)
{
var _new_aspect = this.aspect*(Math.abs(kd1/ kd2));
if (_new_aspect >= this.aspect)
kd2 = Math.abs(kd1)*(kd2 >= 0 ? 1 : -1 );
else
kd1 = Math.abs(kd2)*(kd1 >= 0 ? 1 : -1);
}
}
else
{
if(this.mod === 2)
var _temp;
if(this.bChangeCoef)
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
if(this.mod === 0 || this.mod === 1)
{
if(this.mod === 0)
{
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
this.resizedflipH = _real_width < 0 ? !this.originalFlipH : this.originalFlipH;
}
else
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
this.resizedflipV = _real_height < 0 ? !this.originalFlipV : this.originalFlipV;
}
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
this.resizedflipH = _real_width < 0 ? !this.originalFlipH : this.originalFlipH;
else
{
if(this.mod === 2)
{
_temp = kd1;
kd1 = kd2;
kd2 = _temp;
}
_real_height = this.usedExtY*kd2;
_abs_height = Math.abs(_real_height);
this.resizedExtY = _abs_height >= MIN_SHAPE_SIZE || this.isLine ? _abs_height : MIN_SHAPE_SIZE;
this.resizedflipV = _real_height < 0 ? !this.originalFlipV : this.originalFlipV;
this.resizedPosX = this.centerPointX - this.resizedExtX*0.5;
this.resizedPosY = this.centerPointY - this.resizedExtY*0.5;
}
_real_width = this.usedExtX*kd1;
_abs_width = Math.abs(_real_width);
this.resizedExtX = _abs_width >= MIN_SHAPE_SIZE || this.isLine ? _abs_width : MIN_SHAPE_SIZE;
this.resizedflipH = _real_width < 0 ? !this.originalFlipH : this.originalFlipH;
this.geometry.Recalculate(this.resizedExtX, this.resizedExtY);
this.overlayObject.updateExtents(this.resizedExtX, this.resizedExtY);
}
var _transform = this.transform;
_transform.Reset();
this.resizedPosX = this.centerPointX - this.resizedExtX*0.5;
this.resizedPosY = this.centerPointY - this.resizedExtY*0.5;
var _horizontal_center = this.resizedExtX*0.5;
var _vertical_center = this.resizedExtY*0.5;
global_MatrixTransformer.TranslateAppend(_transform, -_horizontal_center, -_vertical_center);
this.geometry.Recalculate(this.resizedExtX, this.resizedExtY);
this.overlayObject.updateExtents(this.resizedExtX, this.resizedExtY);
if(this.resizedflipH)
{
global_MatrixTransformer.ScaleAppend(_transform, -1, 1);
}
if(this.resizedflipV)
{
global_MatrixTransformer.ScaleAppend(_transform, 1, -1);
}
var _transform = this.transform;
_transform.Reset();
global_MatrixTransformer.RotateRadAppend(_transform, -this.resizedRot);
var _horizontal_center = this.resizedExtX*0.5;
var _vertical_center = this.resizedExtY*0.5;
global_MatrixTransformer.TranslateAppend(_transform, -_horizontal_center, -_vertical_center);
if(this.resizedflipH)
{
global_MatrixTransformer.ScaleAppend(_transform, -1, 1);
}
if(this.resizedflipV)
{
global_MatrixTransformer.ScaleAppend(_transform, 1, -1);
}
global_MatrixTransformer.TranslateAppend(_transform, this.resizedPosX, this.resizedPosY);
global_MatrixTransformer.TranslateAppend(_transform, _horizontal_center, _vertical_center);
global_MatrixTransformer.RotateRadAppend(_transform, -this.resizedRot);
};
this.draw = function(overlay)
{
this.overlayObject.draw(overlay);
};
global_MatrixTransformer.TranslateAppend(_transform, this.resizedPosX, this.resizedPosY);
global_MatrixTransformer.TranslateAppend(_transform, _horizontal_center, _vertical_center);
this.getBounds = function()
{
var bounds_checker = new CSlideBoundsChecker();
bounds_checker.init(Page_Width, Page_Height, Page_Width, Page_Height);
this.draw(bounds_checker);
return {l: bounds_checker.Bounds.min_x, t: bounds_checker.Bounds.min_y, r: bounds_checker.Bounds.max_x , b: bounds_checker.Bounds.max_y};
};
};
this.getBoundsRect = function()
{
var t = this.transform;
var max_x, min_x, max_y, min_y;
min_x = t.TransformPointX(0, 0);
max_x = min_x;
min_y = t.TransformPointY(0, 0);
max_y = min_y;
var arr = [{x: this.resizedExtX, y: 0}, {x: this.resizedExtX, y: this.resizedExtY}, {x: 0, y: this.resizedExtY}];
var t_x, t_y;
for(var i = 0; i < arr.length; ++i)
this.draw = function(overlay)
{
var p = arr[i];
t_x = t.TransformPointX(p.x, p.y);
t_y = t.TransformPointY(p.x, p.y);
if(t_x < min_x)
min_x = t_x;
if(t_x > max_x)
max_x = t_x;
if(t_y < min_y)
min_y = t_y;
if(t_y > max_y)
max_y = t_y;
}
return {l: min_x, t: min_y, r: max_x, b: max_y};
};
this.overlayObject.draw(overlay);
};
this.trackEnd = function()
{
var scale_coefficients, ch_off_x, ch_off_y;
if(this.originalObject.group)
{
scale_coefficients = this.originalObject.group.getResultScaleCoefficients();
ch_off_x = this.originalObject.group.spPr.xfrm.chOffX;
ch_off_y = this.originalObject.group.spPr.xfrm.chOffY;
}
else
{
scale_coefficients = {cx: 1, cy: 1};
ch_off_x = 0;
ch_off_y = 0;
}
var xfrm = this.originalObject.spPr.xfrm;
xfrm.setOffX(this.resizedPosX/scale_coefficients.cx + ch_off_x);
xfrm.setOffY(this.resizedPosY/scale_coefficients.cy + ch_off_y);
xfrm.setExtX(this.resizedExtX/scale_coefficients.cx);
xfrm.setExtY(this.resizedExtY/scale_coefficients.cy);
xfrm.setFlipH(this.resizedflipH);
xfrm.setFlipV(this.resizedflipV);
};
this.getBounds = function()
{
var bounds_checker = new CSlideBoundsChecker();
bounds_checker.init(Page_Width, Page_Height, Page_Width, Page_Height);
this.draw(bounds_checker);
return {l: bounds_checker.Bounds.min_x, t: bounds_checker.Bounds.min_y, r: bounds_checker.Bounds.max_x , b: bounds_checker.Bounds.max_y};
};
this.getBoundsRect = function()
{
var t = this.transform;
var max_x, min_x, max_y, min_y;
min_x = t.TransformPointX(0, 0);
max_x = min_x;
min_y = t.TransformPointY(0, 0);
max_y = min_y;
var arr = [{x: this.resizedExtX, y: 0}, {x: this.resizedExtX, y: this.resizedExtY}, {x: 0, y: this.resizedExtY}];
var t_x, t_y;
for(var i = 0; i < arr.length; ++i)
{
var p = arr[i];
t_x = t.TransformPointX(p.x, p.y);
t_y = t.TransformPointY(p.x, p.y);
if(t_x < min_x)
min_x = t_x;
if(t_x > max_x)
max_x = t_x;
if(t_y < min_y)
min_y = t_y;
if(t_y > max_y)
max_y = t_y;
}
return {l: min_x, t: min_y, r: max_x, b: max_y};
};
this.trackEnd = function()
{
var scale_coefficients, ch_off_x, ch_off_y;
if(this.originalObject.group)
{
scale_coefficients = this.originalObject.group.getResultScaleCoefficients();
ch_off_x = this.originalObject.group.spPr.xfrm.chOffX;
ch_off_y = this.originalObject.group.spPr.xfrm.chOffY;
}
else
{
scale_coefficients = {cx: 1, cy: 1};
ch_off_x = 0;
ch_off_y = 0;
}
var xfrm = this.originalObject.spPr.xfrm;
xfrm.setOffX(this.resizedPosX/scale_coefficients.cx + ch_off_x);
xfrm.setOffY(this.resizedPosY/scale_coefficients.cy + ch_off_y);
xfrm.setExtX(this.resizedExtX/scale_coefficients.cx);
xfrm.setExtY(this.resizedExtY/scale_coefficients.cy);
xfrm.setFlipH(this.resizedflipH);
xfrm.setFlipV(this.resizedflipV);
};
}, this, []);
}
function ResizeTrackGroup(originalObject, cardDirection, parentTrack)
{
ExecuteNoHistory(function()
{
this.original = originalObject;
this.originalObject = originalObject;
......@@ -1337,12 +1342,15 @@ function ResizeTrackGroup(originalObject, cardDirection, parentTrack)
}
};
}, this, []);
}
function ShapeForResizeInGroup(originalObject, parentTrack)
{
ExecuteNoHistory(function()
{
this.originalObject = originalObject;
this.parentTrack = parentTrack;
this.x = originalObject.x;
......@@ -1444,4 +1452,5 @@ function ShapeForResizeInGroup(originalObject, parentTrack)
if(this.parentTrack)
global_MatrixTransformer.MultiplyAppend(t, this.parentTrack.transform);
};
}, this, []);
}
......@@ -188,7 +188,186 @@
prot["put_b"] = prot.put_b;
prot["getA"] = prot.getA;
prot["get_hex"] = prot.get_hex;
}
function asc_ChartSettings()
{
this.style = null;
this.title = null;
this.rowCols = null;
this.horAxisLabel = null;
this.vertAxisLabel = null;
this.legendPos = null;
this.dataLabelsPos = null;
this.vertAx = null;
this.horAx = null;
this.horGridLines = null;
this.vertGridLines = null;
}
asc_ChartSettings.prototype =
{
putStyle: function(index)
{
this.style = index;
},
getStyle: function()
{
return this.style;
},
putTitle: function(v)
{
this.title = v;
},
getTitle: function()
{
return this.title;
},
putRowCols: function(v)
{
this.rowCols = v;
},
getRowCols: function()
{
return this.rowCols;
},
putHorAxisLabel: function(v)
{
this.horAxisLabel = v;
},
putVertAxisLabel: function(v)
{
this.vertAxisLabel = v;
},
putLegendPos: function(v)
{
this.legendPos = v;
},
putDataLabelsPos: function(v)
{
this.dataLabelsPos = v;
},
putCatAx: function(v)
{
this.vertAx = v;
},
putValAx: function(v)
{
this.horAx = v;
},
getHorAxisLabel: function(v)
{
return this.horAxisLabel;
},
getVertAxisLabel: function(v)
{
return this.vertAxisLabel;
},
getLegendPos: function(v)
{
return this.legendPos;
},
getDataLabelsPos: function(v)
{
return this.dataLabelsPos;
},
getVertAx: function(v)
{
return this.vertAx;
},
getHorAx: function(v)
{
return this.horAx;
},
putHorGridLines: function(v)
{
this.horGridLines = v;
},
getHorGridLines: function(v)
{
return this.horGridLines;
},
putVertGridLines: function(v)
{
this.vertGridLines = v;
},
getVertGridLines: function()
{
return this.vertGridLines;
}
};
prot = asc_ChartSettings.prototype;
prot["putStyle"] = prot.putStyle;
prot["putTitle"] = prot.putTitle;
prot["putRowCols"] = prot.putRowCols;
prot["putHorAxisLabel"] = prot.putHorAxisLabel;
prot["putVertAxisLabel"] = prot.putVertAxisLabel;
prot["putLegendPos"] = prot.putLegendPos;
prot["putDataLabelsPos"] = prot.putDataLabelsPos;
prot["putCatAx"] = prot.putCatAx;
prot["putValAx"] = prot.putValAx;
prot["getStyle"] = prot.getStyle;
prot["getTitle"] = prot.getTitle;
prot["getRowCols"] = prot.getRowCols;
prot["getHorAxisLabel"] = prot.getHorAxisLabel;
prot["getVertAxisLabel"] = prot.getVertAxisLabel;
prot["getLegendPos"] = prot.getLegendPos;
prot["getDataLabelsPos"] = prot.getDataLabelsPos;
prot["getHorAx"] = prot.getHorAx;
prot["getVertAx"] = prot.getVertAx;
prot["getHorGridLines"] = prot.getVertGridLines;
prot["putHorGridLines"] = prot.putVertGridLines;
prot["getVertGridLines"] = prot.getVertGridLines;
prot["putVertGridLines"] = prot.putVertGridLines;
window["asc_ChartSettings"] = asc_ChartSettings;
function asc_AxisSettings()
{
this.type = null;
this.settings = null;
}
asc_AxisSettings.prototype =
{
putType: function(val)
{
this.type = val;
},
putSettings: function(val)
{
this.settings = val;
},
getType: function()
{
return this.type;
},
getSettings: function()
{
return this.settings;
}
};
prot = asc_AxisSettings.prototype;
prot["putType"] = prot.putType;
prot["putSettings"] = prot.putSettings;
prot["getType"] = prot.getType;
prot["getSettings"] = prot.getSettings;
window["asc_AxisSettings"] = asc_AxisSettings;
}
)(window);
var CColor = window["CColor"];
\ No newline at end of file
var CColor = window["CColor"];
var asc_ChartSettings = window["asc_ChartSettings"];
var asc_AxisSettings = window["asc_AxisSettings"];
\ No newline at end of file
......@@ -86,3 +86,83 @@ var vertalign_SuperScript = 1;
var vertalign_SubScript = 2;
var hdrftr_Header = 0x01;
var hdrftr_Footer = 0x02;
var c_oAscChartTitleShowSettings =
{
none: 0,
overlay: 1,
noOverlay: 2
};
var c_oAscChartHorAxisLabelShowSettings =
{
none: 0,
noOverlay: 1
};
var c_oAscChartVertAxisLabelShowSettings =
{
none: 0,
rotated: 1,
vertical: 2,
horizontal: 3
};
var c_oAscChartLegendShowSettings =
{
none: 0,
left: 1,
top: 2,
right: 3,
bottom: 4,
leftOverlay: 5,
rightOverlay: 6
};
var c_oAscChartDataLabelsPos =
{
none: 0,
b: 1,
bestFit: 2,
ctr: 3,
inBase: 4,
inEnd: 5,
l: 6,
outEnd: 7,
r: 8,
t: 9
};
var c_oAscChartCatAxisSettings =
{
none: 0,
leftToRight: 1,
rightToLeft: 2,
noLabels: 3
};
var c_oAscChartValAxisSettings =
{
none: 0,
byDefault: 1,
thousands: 2,
millions: 3,
billions: 4,
log: 5
};
var c_oAscAxisTypeSettings =
{
vert: 0,
hor: 1
};
var c_oAscGridLinesSettings =
{
none: 0,
major: 1,
minor: 2,
majorMinor: 3
};
\ No newline at end of file
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