init repo

This commit is contained in:
nikolay ivanov
2014-07-05 18:22:49 +00:00
commit a8be6b9e72
17348 changed files with 9229832 additions and 0 deletions

View File

@@ -0,0 +1,369 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function CBounds() {
this.L = 0;
this.T = 0;
this.R = 0;
this.B = 0;
this.isAbsL = false;
this.isAbsT = false;
this.isAbsR = false;
this.isAbsB = false;
this.AbsW = -1;
this.AbsH = -1;
this.SetParams = function (_l, _t, _r, _b, abs_l, abs_t, abs_r, abs_b, absW, absH) {
this.L = _l;
this.T = _t;
this.R = _r;
this.B = _b;
this.isAbsL = abs_l;
this.isAbsT = abs_t;
this.isAbsR = abs_r;
this.isAbsB = abs_b;
this.AbsW = absW;
this.AbsH = absH;
};
}
function CAbsolutePosition() {
this.L = 0;
this.T = 0;
this.R = 0;
this.B = 0;
}
var g_anchor_left = 1;
var g_anchor_top = 2;
var g_anchor_right = 4;
var g_anchor_bottom = 8;
function CControl() {
this.Bounds = new CBounds();
this.Anchor = g_anchor_left | g_anchor_top;
this.Name = null;
this.Parent = null;
this.TabIndex = null;
this.HtmlElement = null;
this.AbsolutePosition = new CBounds();
this.Resize = function (_width, _height, api) {
if ((null == this.Parent) || (null == this.HtmlElement)) {
return;
}
var _x = 0;
var _y = 0;
var _r = 0;
var _b = 0;
var hor_anchor = (this.Anchor & 5);
var ver_anchor = (this.Anchor & 10);
if (g_anchor_left == hor_anchor) {
if (this.Bounds.isAbsL) {
_x = this.Bounds.L;
} else {
_x = (this.Bounds.L * _width / 1000);
}
if (-1 != this.Bounds.AbsW) {
_r = _x + this.Bounds.AbsW;
} else {
if (this.Bounds.isAbsR) {
_r = (_width - this.Bounds.R);
} else {
_r = this.Bounds.R * _width / 1000;
}
}
} else {
if (g_anchor_right == hor_anchor) {
if (this.Bounds.isAbsR) {
_r = (_width - this.Bounds.R);
} else {
_r = (this.Bounds.R * _width / 1000);
}
if (-1 != this.Bounds.AbsW) {
_x = _r - this.Bounds.AbsW;
} else {
if (this.Bounds.isAbsL) {
_x = this.Bounds.L;
} else {
_x = this.Bounds.L * _width / 1000;
}
}
} else {
if ((g_anchor_left | g_anchor_right) == hor_anchor) {
if (this.Bounds.isAbsL) {
_x = this.Bounds.L;
} else {
_x = (this.Bounds.L * _width / 1000);
}
if (this.Bounds.isAbsR) {
_r = (_width - this.Bounds.R);
} else {
_r = (this.Bounds.R * _width / 1000);
}
} else {
_x = this.Bounds.L;
_r = this.Bounds.R;
}
}
}
if (g_anchor_top == ver_anchor) {
if (this.Bounds.isAbsT) {
_y = this.Bounds.T;
} else {
_y = (this.Bounds.T * _height / 1000);
}
if (-1 != this.Bounds.AbsH) {
_b = _y + this.Bounds.AbsH;
} else {
if (this.Bounds.isAbsB) {
_b = (_height - this.Bounds.B);
} else {
_b = this.Bounds.B * _height / 1000;
}
}
} else {
if (g_anchor_bottom == ver_anchor) {
if (this.Bounds.isAbsB) {
_b = (_height - this.Bounds.B);
} else {
_b = (this.Bounds.B * _height / 1000);
}
if (-1 != this.Bounds.AbsH) {
_y = _b - this.Bounds.AbsH;
} else {
if (this.Bounds.isAbsT) {
_y = this.Bounds.T;
} else {
_y = this.Bounds.T * _height / 1000;
}
}
} else {
if ((g_anchor_top | g_anchor_bottom) == ver_anchor) {
if (this.Bounds.isAbsT) {
_y = this.Bounds.T;
} else {
_y = (this.Bounds.T * _height / 1000);
}
if (this.Bounds.isAbsB) {
_b = (_height - this.Bounds.B);
} else {
_b = (this.Bounds.B * _height / 1000);
}
} else {
_y = this.Bounds.T;
_b = this.Bounds.B;
}
}
}
if (_r < _x) {
_r = _x;
}
if (_b < _y) {
_b = _y;
}
this.AbsolutePosition.L = _x;
this.AbsolutePosition.T = _y;
this.AbsolutePosition.R = _r;
this.AbsolutePosition.B = _b;
this.HtmlElement.style.left = ((_x * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
this.HtmlElement.style.top = ((_y * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
this.HtmlElement.style.width = (((_r - _x) * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
this.HtmlElement.style.height = (((_b - _y) * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
if (api !== undefined && api.CheckRetinaElement && api.CheckRetinaElement(this.HtmlElement)) {
var _W = ((_r - _x) * g_dKoef_mm_to_pix + 0.5) >> 0;
var _H = ((_b - _y) * g_dKoef_mm_to_pix + 0.5) >> 0;
this.HtmlElement.width = _W << 1;
this.HtmlElement.height = _H << 1;
} else {
this.HtmlElement.width = ((_r - _x) * g_dKoef_mm_to_pix + 0.5) >> 0;
this.HtmlElement.height = ((_b - _y) * g_dKoef_mm_to_pix + 0.5) >> 0;
}
};
}
function CControlContainer() {
this.Bounds = new CBounds();
this.Anchor = g_anchor_left | g_anchor_top;
this.Name = null;
this.Parent = null;
this.TabIndex = null;
this.HtmlElement = null;
this.AbsolutePosition = new CBounds();
this.Controls = new Array();
this.AddControl = function (ctrl) {
ctrl.Parent = this;
this.Controls[this.Controls.length] = ctrl;
};
this.Resize = function (_width, _height, api) {
if (null == this.Parent) {
this.AbsolutePosition.L = 0;
this.AbsolutePosition.T = 0;
this.AbsolutePosition.R = _width;
this.AbsolutePosition.B = _height;
if (null != this.HtmlElement) {
var lCount = this.Controls.length;
for (var i = 0; i < lCount; i++) {
this.Controls[i].Resize(_width, _height, api);
}
}
return;
}
var _x = 0;
var _y = 0;
var _r = 0;
var _b = 0;
var hor_anchor = (this.Anchor & 5);
var ver_anchor = (this.Anchor & 10);
if (g_anchor_left == hor_anchor) {
if (this.Bounds.isAbsL) {
_x = this.Bounds.L;
} else {
_x = (this.Bounds.L * _width / 1000);
}
if (-1 != this.Bounds.AbsW) {
_r = _x + this.Bounds.AbsW;
} else {
if (this.Bounds.isAbsR) {
_r = (_width - this.Bounds.R);
} else {
_r = this.Bounds.R * _width / 1000;
}
}
} else {
if (g_anchor_right == hor_anchor) {
if (this.Bounds.isAbsR) {
_r = (_width - this.Bounds.R);
} else {
_r = (this.Bounds.R * _width / 1000);
}
if (-1 != this.Bounds.AbsW) {
_x = _r - this.Bounds.AbsW;
} else {
if (this.Bounds.isAbsL) {
_x = this.Bounds.L;
} else {
_x = this.Bounds.L * _width / 1000;
}
}
} else {
if ((g_anchor_left | g_anchor_right) == hor_anchor) {
if (this.Bounds.isAbsL) {
_x = this.Bounds.L;
} else {
_x = (this.Bounds.L * _width / 1000);
}
if (this.Bounds.isAbsR) {
_r = (_width - this.Bounds.R);
} else {
_r = (this.Bounds.R * _width / 1000);
}
} else {
_x = this.Bounds.L;
_r = this.Bounds.R;
}
}
}
if (g_anchor_top == ver_anchor) {
if (this.Bounds.isAbsT) {
_y = this.Bounds.T;
} else {
_y = (this.Bounds.T * _height / 1000);
}
if (-1 != this.Bounds.AbsH) {
_b = _y + this.Bounds.AbsH;
} else {
if (this.Bounds.isAbsB) {
_b = (_height - this.Bounds.B);
} else {
_b = this.Bounds.B * _height / 1000;
}
}
} else {
if (g_anchor_bottom == ver_anchor) {
if (this.Bounds.isAbsB) {
_b = (_height - this.Bounds.B);
} else {
_b = (this.Bounds.B * _height / 1000);
}
if (-1 != this.Bounds.AbsH) {
_y = _b - this.Bounds.AbsH;
} else {
if (this.Bounds.isAbsT) {
_y = this.Bounds.T;
} else {
_y = this.Bounds.T * _height / 1000;
}
}
} else {
if ((g_anchor_top | g_anchor_bottom) == ver_anchor) {
if (this.Bounds.isAbsT) {
_y = this.Bounds.T;
} else {
_y = (this.Bounds.T * _height / 1000);
}
if (this.Bounds.isAbsB) {
_b = (_height - this.Bounds.B);
} else {
_b = (this.Bounds.B * _height / 1000);
}
} else {
_y = this.Bounds.T;
_b = this.Bounds.B;
}
}
}
if (_r < _x) {
_r = _x;
}
if (_b < _y) {
_b = _y;
}
this.AbsolutePosition.L = _x;
this.AbsolutePosition.T = _y;
this.AbsolutePosition.R = _r;
this.AbsolutePosition.B = _b;
this.HtmlElement.style.left = ((_x * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
this.HtmlElement.style.top = ((_y * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
this.HtmlElement.style.width = (((_r - _x) * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
this.HtmlElement.style.height = (((_b - _y) * g_dKoef_mm_to_pix + 0.5) >> 0) + "px";
var lCount = this.Controls.length;
for (var i = 0; i < lCount; i++) {
this.Controls[i].Resize(_r - _x, _b - _y, api);
}
};
}
function CreateControlContainer(name) {
var ctrl = new CControlContainer();
ctrl.Name = name;
ctrl.HtmlElement = document.getElementById(name);
return ctrl;
}
function CreateControl(name) {
var ctrl = new CControl();
ctrl.Name = name;
ctrl.HtmlElement = document.getElementById(name);
return ctrl;
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,175 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var LAYOUT_MODE_EDGE = 0;
var LAYOUT_MODE_FACTOR = 1;
var LAYOUT_TARGET_INNER = 0;
var LAYOUT_TARGET_OUTER = 1;
function CChartLayout() {
this.isManual = false;
this.layoutTarget = null;
this.xMode = null;
this.yMode = null;
this.wMode = null;
this.hMode = null;
this.x = null;
this.y = null;
this.w = null;
this.h = null;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id, null);
}
CChartLayout.prototype = {
Get_Id: function () {
return this.Id;
},
getObjectType: function () {
return CLASS_TYPE_CHART_LAYOUT;
},
setXMode: function (mode) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_X_Mode, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.xMode, mode)), null);
this.xMode = mode;
},
setYMode: function (mode) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_Y_Mode, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.yMode, mode)), null);
this.yMode = mode;
},
setX: function (x) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_X, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.x, x)), null);
this.x = x;
},
setY: function (y) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_Y, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.y, y)), null);
this.y = y;
},
setIsManual: function (isManual) {
this.isManual = isManual;
},
Undo: function (type, data) {
switch (type) {
case historyitem_AutoShapes_Layout_Set_X_Mode:
this.xMode = data.oldValue;
break;
case historyitem_AutoShapes_Layout_Set_Y_Mode:
this.yMode = data.oldValue;
break;
case historyitem_AutoShapes_Layout_Set_X:
this.x = data.oldValue;
break;
case historyitem_AutoShapes_Layout_Set_Y:
this.y = data.oldValue;
break;
}
},
Redo: function (type, data) {
switch (type) {
case historyitem_AutoShapes_Layout_Set_X_Mode:
this.xMode = data.newValue;
break;
case historyitem_AutoShapes_Layout_Set_Y_Mode:
this.yMode = data.newValue;
break;
case historyitem_AutoShapes_Layout_Set_X:
this.x = data.newValue;
break;
case historyitem_AutoShapes_Layout_Set_Y:
this.y = data.newValue;
break;
}
},
writeToBinary: function (w) {
w.WriteBool(isRealNumber(this.layoutTarget));
if (isRealNumber(this.layoutTarget)) {
w.WriteLong(this.layoutTarget);
}
w.WriteBool(isRealNumber(this.xMode));
if (isRealNumber(this.xMode)) {
w.WriteLong(this.xMode);
}
w.WriteBool(isRealNumber(this.yMode));
if (isRealNumber(this.yMode)) {
w.WriteLong(this.yMode);
}
w.WriteBool(isRealNumber(this.wMode));
if (isRealNumber(this.wMode)) {
w.WriteLong(this.wMode);
}
w.WriteBool(isRealNumber(this.hMode));
if (isRealNumber(this.hMode)) {
w.WriteLong(this.hMode);
}
w.WriteBool(isRealNumber(this.x));
if (isRealNumber(this.x)) {
w.WriteDouble(this.x);
}
w.WriteBool(isRealNumber(this.y));
if (isRealNumber(this.y)) {
w.WriteDouble(this.y);
}
w.WriteBool(isRealNumber(this.w));
if (isRealNumber(this.w)) {
w.WriteDouble(this.w);
}
w.WriteBool(isRealNumber(this.h));
if (isRealNumber(this.h)) {
w.WriteDouble(this.h);
}
},
readFromBinary: function (r) {
if (r.GetBool()) {
this.layoutTarget = r.GetLong();
}
if (r.GetBool()) {
this.setXMode(r.GetLong());
}
if (r.GetBool()) {
this.setYMode(r.GetLong());
}
if (r.GetBool()) {
this.wMode = r.GetLong();
}
if (r.GetBool()) {
this.hMode = r.GetLong();
}
if (r.GetBool()) {
this.setX(r.GetDouble());
}
if (r.GetBool()) {
this.setY(r.GetDouble());
}
if (r.GetBool()) {
this.w = r.GetDouble();
}
if (r.GetBool()) {
this.h = r.GetDouble();
}
}
};

View File

@@ -0,0 +1,238 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var LEGEND_ELEMENT_TYPE_RECT = 0;
var LEGEND_ELEMENT_TYPE_LINE = 1;
function CLegendEntry() {
this.bDelete = null;
this.idx = null;
this.txPr = null;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CLegendEntry.prototype = {
Get_Id: function () {
return this.Id;
},
getObjectType: function () {
return CLASS_TYPE_LEGEND_ENTRY;
}
};
function CChartLegend() {
this.chartGroup = null;
this.layout = null;
this.legendEntries = [];
this.legendPos = null;
this.overlay = false;
this.spPr = new CSpPr();
this.txPr = null;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.calculatedEntry = [];
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CChartLegend.prototype = {
getObjectType: function () {
return CLASS_TYPE_CHART_LEGEND;
},
Get_Id: function () {
return this.Id;
},
getStyles: function (level) {
var styles = new CStyles();
var default_legend_style = new CStyle("defaultLegendStyle", styles.Default, null, styletype_Paragraph);
default_legend_style.TextPr.FontSize = 10;
default_legend_style.TextPr.themeFont = "Calibri";
var tx_pr;
if (isRealObject(this.txPr)) {}
styles.Style[styles.Id] = default_legend_style;
++styles.Id;
return styles;
},
init: function () {
this.setStartValues();
return;
var chart = this.chartGroup.chart;
var chart_legend = chart.getLegendInfo();
if (chart_legend.length > 0) {
var shape_type = chart_legend[0].marker === c_oAscLegendMarkerType.Line ? "line" : "rect";
for (var i = 0; i < chart_legend.length; ++i) {
var legend_entry_obj = chart_legend[i];
var entry_string = legend_entry_obj.text;
var cur_legend_entry = new CLegendEntryGroup(this);
cur_legend_entry.marker = chart_legend[0].marker;
cur_legend_entry.drawingObjects = this.chartGroup.drawingObjects;
cur_legend_entry.textBody = new CTextBody(cur_legend_entry);
cur_legend_entry.idx = i;
for (var key in entry_string) {
cur_legend_entry.textBody.paragraphAdd(new ParaText(entry_string[key]), false);
}
cur_legend_entry.textBody.content.Reset(0, 0, 30, 30);
cur_legend_entry.textBody.content.Recalculate_Page(0, true);
cur_legend_entry.geometry = CreateGeometry(shape_type);
cur_legend_entry.geometry.Init(5, 5);
cur_legend_entry.brush = new CUniFill();
cur_legend_entry.brush.fill = new CSolidFill();
cur_legend_entry.brush.fill.color.color = new CRGBColor();
cur_legend_entry.brush.fill.color.color.RGBA = {
R: legend_entry_obj.color.R,
G: legend_entry_obj.color.G,
B: legend_entry_obj.color.B,
A: 255
};
}
}
},
draw: function (graphics) {
for (var i = 0; i < this.calculatedEntry.length; ++i) {
this.calculatedEntry[i].draw(graphics);
}
},
setStartValues: function () {
var is_on_history = History.Is_On();
var is_on_table_id = !g_oTableId.m_bTurnOff;
if (is_on_history) {
History.TurnOff();
}
if (is_on_table_id) {
g_oTableId.m_bTurnOff = true;
}
g_oTableId.m_bTurnOff = true;
var chart = this.chartGroup.chart;
var legend_info = chart.getLegendInfo();
this.calculatedEntry.length = 0;
if (legend_info.length > 0) {
var bullet_type = legend_info[0].marker === c_oAscLegendMarkerType.Line ? "line" : "rect";
for (var i = 0; i < legend_info.length; ++i) {
var cur_legend_info = legend_info[i];
var legend_entry = this.legendEntries[i];
if (isRealObject(legend_entry) && legend_entry.bDelete === true) {
continue;
}
var entry = new CLegendEntryGroup(this);
entry.bullet = new CShape(null, this.chartGroup.drawingObjects, legend_entry);
var uni_fill = new CUniFill();
uni_fill.setFill(new CSolidFill());
uni_fill.fill.setColor(new CUniColor());
uni_fill.fill.color.setColor(new CRGBColor());
uni_fill.fill.color.setColor(cur_legend_info.color.R * 256 * 256 + cur_legend_info.color.G * 256 + cur_legend_info.color.B);
if (bullet_type === "line") {
entry.bullet.setPresetGeometry("line");
entry.bullet.setUniFill(uni_fill);
} else {
entry.bullet.setPresetGeometry("rect");
var shape_fill = new CUniFill();
shape_fill.setFill(new CNoFill());
var shape_line = new CLn();
var line_fill = new CUniFill();
line_fill.setFill(new CNoFill());
shape_line.setFill(line_fill);
entry.bullet.setUniFill(shape_fill);
entry.bullet.setUniLine(shape_line);
entry.bullet.addTextBody(new CTextBody(entry.bullet));
entry.bullet.paragraphAdd(new ParaTextPr({
unifill: uni_fill
}));
entry.bullet.paragraphAdd(new ParaText(String.fromCharCode(167)));
}
entry.title = new CShape(null, this.chartGroup.drawingObjects);
entry.title.addTextBody(new CTextBody(entry.title));
for (var i in cur_legend_info.text) {
entry.title.paragraphAdd(new ParaText(cur_legend_info.text[i]));
}
this.calculatedEntry.push(entry);
}
}
if (is_on_history) {
History.TurnOn();
}
if (is_on_table_id) {
g_oTableId.m_bTurnOff = false;
}
},
setChartGroup: function (chartGroup) {
this.chartGroup = chartGroup;
},
recalculateInternalPositionsAndExtents: function () {
this.extX = null;
this.extY = null;
if (isRealObject(this.layout) && isRealNumber(this.layout.w) && isRealNumber(this.layout.h)) {
this.extX = this.chartGroup.extX * this.layout.w;
this.extY = this.chartGroup.extY * this.layout.h;
} else {
switch (this.legendPos) {
case c_oAscChartLegend.right:
case c_oAscChartLegend.left:
for (var i = 0; i < this.calculatedEntry.length; ++i) {
var cur_legend_entry = this.calculatedEntry[i];
}
break;
}
}
},
recalculateWithoutLayout: function () {}
};
function CLegendEntryGroup(legend) {
this.legend = legend;
this.bullet = null;
this.title = null;
}
CLegendEntryGroup.prototype = {
setLegendGroup: function (legendGroup) {},
getStyles: function () {
var styles = new CStyles();
var default_style = new CStyle("defaultEntryStyle", null, null, styletype_Paragraph);
default_style.TextPr.themeFont = "Calibri";
default_style.TextPr.FontSize = 10;
styles.Style[styles.Id] = default_style;
++styles.Id;
var legend_style = new CStyle("legend_style", styles.Id - 1, null, styletype_Paragraph);
styles.Style[styles.Id] = legend_style;
++styles.Id;
var entry_style = new CStyle("entry_style", styles.Id - 1, null, styletype_Paragraph);
if (isRealObject(this.legendGroup.legendEntries[this.idx]) && isRealObject(this.legendGroup.legendEntries[this.idx].txPr)) {}
styles.Style[styles.Id] = entry_style;
++styles.Id;
return styles;
},
getBulletStyles: function () {},
getTitleStyles: function () {},
recalculateInternalPosition: function () {},
draw: function (graphics) {
if (isRealObject(this.bullet) && isRealObject(this.title)) {
this.bullet.draw(graphics);
this.title.draw(graphics);
}
}
};

View File

@@ -0,0 +1,977 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var CHART_TITLE_TYPE_TITLE = 0;
var CHART_TITLE_TYPE_H_AXIS = 1;
var CHART_TITLE_TYPE_V_AXIS = 2;
var paraDrawing;
function CChartTitle(chartGroup, type) {
this.layout = null;
this.overlay = false;
this.spPr = new CSpPr();
this.txPr = null;
this.isDefaultText = false;
this.txBody = null;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.brush = null;
this.pen = null;
this.spPr.geometry = CreateGeometry("rect");
this.spPr.geometry.Init(5, 5);
this.invertTransform = new CMatrix();
this.invertTransformText = new CMatrix();
this.transform = new CMatrix();
this.transformText = new CMatrix();
this.recalculateInfo = {
recalculateTransform: true,
recalculateBrush: true,
recalculatePen: true
};
this.selected = false;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
if (chartGroup) {
this.setChartGroup(chartGroup);
}
if (isRealNumber(type)) {
this.setType(type);
}
}
CChartTitle.prototype = {
getObjectType: function () {
return CLASS_TYPE_CHART_TITLE;
},
Get_Id: function () {
return this.Id;
},
getTitleType: function () {
if (this === this.chartGroup.chartTitle) {
return CHART_TITLE_TYPE_TITLE;
}
if (this === this.chartGroup.hAxisTitle) {
return CHART_TITLE_TYPE_H_AXIS;
}
if (this === this.chartGroup.vAxisTitle) {
return CHART_TITLE_TYPE_V_AXIS;
}
},
setBodyPr: function (bodyPr) {
if (isRealObject(this.txBody)) {
this.txBody.bodyPr = bodyPr;
}
},
isEmpty: function () {
return isRealObject(this.txBody) ? this.txBody.isEmpty() : true;
},
setType: function (type) {
var oldValue = this.type;
var newValue = type;
this.type = type;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetChartTitleType, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
},
Get_Styles: function () {
return new CStyles();
},
select: function () {
this.selected = true;
},
deselect: function () {
this.selected = false;
if (isRealObject(this.txBody) && isRealObject(this.txBody.content)) {
this.txBody.content.Selection_Remove();
}
},
getParagraphParaPr: function () {
if (this.txBody) {
return this.txBody.content.Get_Paragraph_ParaPr();
}
return null;
},
getParagraphTextPr: function () {
if (this.txBody) {
return this.txBody.content.Get_Paragraph_TextPr();
}
return null;
},
getAllParagraphParaPr: function () {
if (this.txBody) {
this.txBody.content.Set_ApplyToAll(true);
var paraPr = this.txBody.content.Get_Paragraph_ParaPr();
this.txBody.content.Set_ApplyToAll(false);
return paraPr;
}
return null;
},
getAllParagraphTextPr: function () {
if (this.txBody) {
this.txBody.content.Set_ApplyToAll(true);
var paraPr = this.txBody.content.Get_Paragraph_TextPr();
this.txBody.content.Set_ApplyToAll(false);
return paraPr;
}
return null;
},
increaseFontSize: function () {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.txBody.content.Paragraph_IncDecFontSize(true);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
decreaseFontSize: function () {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.txBody.content.Paragraph_IncDecFontSize(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
increaseAllFontSize: function () {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.txBody.content.Set_ApplyToAll(true);
this.txBody.content.Paragraph_IncDecFontSize(true);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
this.calculateTransformTextMatrix();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
decreaseAllFontSize: function () {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.txBody.content.Set_ApplyToAll(true);
this.txBody.content.Paragraph_IncDecFontSize(false);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
this.calculateTransformTextMatrix();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellFontName: function (fontName) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_FontFamily({
Name: fontName,
Index: -1
});
this.txBody.paragraphAdd(text_pr);
this.chartGroup.recalculate();
this.drawingObjects.showDrawingObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellFontSize: function (fontSize) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_FontSize(fontSize);
this.txBody.paragraphAdd(text_pr);
this.chartGroup.recalculate();
this.drawingObjects.showDrawingObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellBold: function (isBold) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Bold(isBold);
this.txBody.paragraphAdd(text_pr);
this.chartGroup.recalculate();
this.drawingObjects.showDrawingObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellItalic: function (isItalic) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Italic(isItalic);
this.txBody.paragraphAdd(text_pr);
this.chartGroup.recalculate();
this.drawingObjects.showDrawingObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellUnderline: function (isUnderline) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Underline(isUnderline);
this.txBody.paragraphAdd(text_pr);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellStrikeout: function (isStrikeout) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Strikeout(isStrikeout);
this.txBody.paragraphAdd(text_pr);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellTextColor: function (color) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var unifill = new CUniFill();
unifill.setFill(new CSolidFill());
unifill.fill.setColor(CorrectUniColor2(color, null));
var text_pr = new ParaTextPr();
text_pr.SetUniFill(unifill);
this.txBody.paragraphAdd(text_pr);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllFontName: function (fontName) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_FontFamily({
Name: fontName,
Index: -1
});
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllFontSize: function (fontSize) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_FontSize(fontSize);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllBold: function (isBold) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Bold(isBold);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllItalic: function (isItalic) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Italic(isItalic);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllUnderline: function (isUnderline) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Underline(isUnderline);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllStrikeout: function (isStrikeout) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_Strikeout(isStrikeout);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllSubscript: function (isSubscript) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_VertAlign(isSubscript ? vertalign_SubScript : vertalign_Baseline);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllSuperscript: function (isSuperscript) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var text_pr = new ParaTextPr();
text_pr.Set_VertAlign(isSubscript ? vertalign_SuperScript : vertalign_Baseline);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setCellAllTextColor: function (color) {
if (isRealObject(this.txBody)) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var unifill = new CUniFill();
unifill.setFill(new CSolidFill());
unifill.fill.setColor(CorrectUniColor2(color, null));
var text_pr = new ParaTextPr();
text_pr.SetUniFill(unifill);
this.txBody.content.Set_ApplyToAll(true);
this.txBody.paragraphAdd(text_pr);
this.txBody.content.Set_ApplyToAll(false);
this.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setChartGroup: function (chartGroup) {
var old_value = this.chartGroup ? this.chartGroup.Get_Id() : null;
var new_value = chartGroup ? chartGroup.Get_Id() : null;
this.chartGroup = chartGroup;
this.setDrawingObjects(chartGroup ? chartGroup.drawingObjects : null);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_AddChartGroup, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(old_value, new_value)), null);
},
setDrawingObjects: function (drawingObjects) {
if (isRealObject(drawingObjects) && drawingObjects.getWorksheet()) {
var newValue = drawingObjects.getWorksheet().model.getId();
var oldValue = isRealObject(this.drawingObjects) ? this.drawingObjects.getWorksheet().model.getId() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetDrawingObjects, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.drawingObjects = drawingObjects;
}
},
Get_Id: function () {
return this.Id;
},
Undo: function (type, data) {
switch (type) {
case historyitem_AutoShapes_AddChartGroup:
this.chartGroup = g_oTableId.Get_ById(data.oldValue);
if (isRealObject(this.chartGroup)) {
this.drawingObjects = this.chartGroup.drawingObjects;
}
break;
case historyitem_AutoShapes_SetDrawingObjects:
if (data.oldValue !== null) {
var api = window["Asc"]["editor"];
if (api.wb) {
var ws = api.wb.getWorksheetById(data.oldValue);
this.drawingObjects = ws.objectRender;
}
}
break;
case historyitem_AutoShapes_AddTextBody:
this.txBody = g_oTableId.Get_ById(data.oldValue);
break;
case historyitem_AutoShapes_SetChartTitleLayout:
this.layout = g_oTableId.Get_ById(data.oldValue);
break;
case historyitem_AutoShapes_SetChartTitleType:
this.type = data.oldValue;
break;
}
},
Redo: function (type, data) {
switch (type) {
case historyitem_AutoShapes_AddChartGroup:
this.chartGroup = g_oTableId.Get_ById(data.newValue);
if (isRealObject(this.chartGroup)) {
this.drawingObjects = this.chartGroup.drawingObjects;
}
break;
case historyitem_AutoShapes_SetDrawingObjects:
if (data.oldValue !== null) {
var api = window["Asc"]["editor"];
if (api.wb) {
var ws = api.wb.getWorksheetById(data.newValue);
this.drawingObjects = ws.objectRender;
}
}
break;
case historyitem_AutoShapes_AddTextBody:
this.txBody = g_oTableId.Get_ById(data.newValue);
break;
case historyitem_AutoShapes_SetChartTitleLayout:
this.layout = g_oTableId.Get_ById(data.newValue);
break;
case historyitem_AutoShapes_SetChartTitleType:
this.type = data.newValue;
break;
}
},
getStyles: function () {
var styles = new CStyles();
var default_legend_style = new CStyle("defaultLegendStyle", styles.Default, null, styletype_Paragraph);
default_legend_style.TextPr.themeFont = "Calibri";
default_legend_style.TextPr.Bold = true;
if (this.getTitleType() === CHART_TITLE_TYPE_TITLE) {
default_legend_style.TextPr.FontSize = 18;
} else {
default_legend_style.TextPr.FontSize = 10;
}
default_legend_style.ParaPr.Spacing.After = 0;
default_legend_style.ParaPr.Spacing.Before = 0;
default_legend_style.ParaPr.Spacing.LineRule = linerule_AtLeast;
default_legend_style.ParaPr.Spacing.Line = 1;
default_legend_style.ParaPr.Jc = align_Center;
var tx_pr;
if (isRealObject(this.txPr)) {}
styles.Style[styles.Id] = default_legend_style;
++styles.Id;
return styles;
},
initFromString: function (title) {
this.textBody.initFromString(title);
},
setDefaultText: function (val) {
this.isDefaultText = val;
},
recalculateTransform: function () {
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, this.x, this.y);
global_MatrixTransformer.MultiplyAppend(this.transform, this.chartGroup.getTransform());
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
},
recalculateTransform2: function () {
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, this.x, this.y);
global_MatrixTransformer.MultiplyAppend(this.transform, this.chartGroup.getTransform());
},
setTextBody: function (textBody) {
var oldId = isRealObject(this.txBody) ? this.txBody.Get_Id() : null;
var newId = isRealObject(textBody) ? textBody.Get_Id() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_AddTextBody, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldId, newId)));
this.txBody = textBody;
},
setLayoutX: function (x) {
if (!isRealObject(this.layout)) {
this.setLayout(new CChartLayout());
}
this.layout.setX(x);
},
setLayoutY: function (y) {
if (!isRealObject(this.layout)) {
this.setLayout(new CChartLayout());
}
this.layout.setY(y);
},
addTextBody: function (txBody) {
this.txBody = txBody;
},
paragraphAdd: function (paraItem, bRecalculate) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
if (!isRealObject(this.txBody)) {
this.txBody = new CTextBody(this);
}
this.txBody.paragraphAdd(paraItem);
this.recalculatePosExt();
this.txBody.recalculateCurPos();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
return;
},
recalculatePosExt: function () {
var old_cx = this.x + this.extX * 0.5;
var old_cy = this.y + this.extY * 0.5;
var bodyPr = this.txBody.getBodyPr();
switch (this.type) {
case CHART_TITLE_TYPE_TITLE:
case CHART_TITLE_TYPE_H_AXIS:
var max_title_width = this.chartGroup.extX * 0.8;
var title_width = this.txBody.getRectWidth(max_title_width);
this.extX = title_width;
this.extY = this.txBody.getRectHeight(this.chartGroup.extY, title_width - (bodyPr.rIns + bodyPr.lIns));
this.x = old_cx - this.extX * 0.5;
if (this.x + this.extX > this.chartGroup.extX) {
this.x = this.chartGroup.extX - this.extX;
}
if (this.x < 0) {
this.x = 0;
}
this.y = old_cy - this.extY * 0.5;
if (this.y + this.extY > this.chartGroup.extY) {
this.y = this.chartGroup.extY - this.extY;
}
if (this.y < 0) {
this.y = 0;
}
if (isRealObject(this.layout) && isRealNumber(this.layout.x)) {
this.layout.setX(this.x / this.chartGroup.extX);
}
break;
case CHART_TITLE_TYPE_V_AXIS:
var max_title_height = this.chartGroup.extY * 0.8;
var body_pr = this.txBody.getBodyPr();
this.extY = this.txBody.getRectWidth(max_title_height) - body_pr.rIns - body_pr.lIns + body_pr.tIns + body_pr.bIns;
this.extX = this.txBody.getRectHeight(this.chartGroup.extX, this.extY) - (-body_pr.rIns - body_pr.lIns + body_pr.tIns + body_pr.bIns);
this.spPr.geometry.Recalculate(this.extX, this.extY);
this.x = old_cx - this.extX * 0.5;
if (this.x + this.extX > this.chartGroup.extX) {
this.x = this.chartGroup.extX - this.extX;
}
if (this.x < 0) {
this.x = 0;
}
this.y = old_cy - this.extY * 0.5;
if (this.y + this.extY > this.chartGroup.extY) {
this.y = this.chartGroup.extY - this.extY;
}
if (this.y < 0) {
this.y = 0;
}
if (isRealObject(this.layout) && isRealNumber(this.layout.y)) {
this.layout.setY(this.y / this.chartGroup.extY);
}
break;
}
this.spPr.geometry.Recalculate(this.extX, this.extY);
this.recalculateTransform();
this.calculateTransformTextMatrix();
this.calculateContent();
},
getFullRotate: function () {
return 0;
},
getFullFlip: function () {
return {
flipH: false,
flipV: false
};
},
addNewParagraph: function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.txBody.addNewParagraph();
this.recalculatePosExt();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
remove: function (direction, bOnlyText) {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.txBody.remove(direction, bOnlyText);
this.recalculatePosExt();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.chartGroup.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
updateSelectionState: function (drawingDocument) {
this.txBody.updateSelectionState(drawingDocument);
},
recalculateCurPos: function () {
if (this.txBody) {
this.txBody.recalculateCurPos();
}
},
drawTextSelection: function () {
if (isRealObject(this.txBody)) {
this.txBody.drawTextSelection();
}
},
calculateContent: function () {
if (this.txBody) {
this.txBody.calculateContent();
}
},
getColorMap: function () {
return this.chartGroup.drawingObjects.controller.getColorMap();
},
getTheme: function () {
return this.chartGroup.drawingObjects.getWorkbook().theme;
},
calculateTransformTextMatrix: function () {
if (this.txBody === null) {
return;
}
this.transformText.Reset();
var _text_transform = this.transformText;
var _shape_transform = this.transform;
var _body_pr = this.txBody.getBodyPr();
var _content_height = this.txBody.getSummaryHeight();
var _l, _t, _r, _b;
var _t_x_lt, _t_y_lt, _t_x_rt, _t_y_rt, _t_x_lb, _t_y_lb, _t_x_rb, _t_y_rb;
if (isRealObject(this.spPr.geometry) && isRealObject(this.spPr.geometry.rect)) {
var _rect = this.spPr.geometry.rect;
_l = _rect.l + _body_pr.lIns;
_t = _rect.t + _body_pr.tIns;
_r = _rect.r - _body_pr.rIns;
_b = _rect.b - _body_pr.bIns;
} else {
_l = _body_pr.lIns;
_t = _body_pr.tIns;
_r = this.extX - _body_pr.rIns;
_b = this.extY - _body_pr.bIns;
}
if (_l >= _r) {
var _c = (_l + _r) * 0.5;
_l = _c - 0.01;
_r = _c + 0.01;
}
if (_t >= _b) {
_c = (_t + _b) * 0.5;
_t = _c - 0.01;
_b = _c + 0.01;
}
_t_x_lt = _shape_transform.TransformPointX(_l, _t);
_t_y_lt = _shape_transform.TransformPointY(_l, _t);
_t_x_rt = _shape_transform.TransformPointX(_r, _t);
_t_y_rt = _shape_transform.TransformPointY(_r, _t);
_t_x_lb = _shape_transform.TransformPointX(_l, _b);
_t_y_lb = _shape_transform.TransformPointY(_l, _b);
_t_x_rb = _shape_transform.TransformPointX(_r, _b);
_t_y_rb = _shape_transform.TransformPointY(_r, _b);
var _dx_t, _dy_t;
_dx_t = _t_x_rt - _t_x_lt;
_dy_t = _t_y_rt - _t_y_lt;
var _dx_lt_rb, _dy_lt_rb;
_dx_lt_rb = _t_x_rb - _t_x_lt;
_dy_lt_rb = _t_y_rb - _t_y_lt;
var _vertical_shift;
var _text_rect_height = _b - _t;
var _text_rect_width = _r - _l;
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
if (_content_height < _text_rect_height) {
switch (_body_pr.anchor) {
case 0:
_vertical_shift = _text_rect_height - _content_height;
break;
case 1:
_vertical_shift = (_text_rect_height - _content_height) * 0.5;
break;
case 2:
_vertical_shift = (_text_rect_height - _content_height) * 0.5;
break;
case 3:
_vertical_shift = (_text_rect_height - _content_height) * 0.5;
break;
case 4:
_vertical_shift = 0;
break;
}
} else {
_vertical_shift = 0;
}
global_MatrixTransformer.TranslateAppend(_text_transform, 0, _vertical_shift);
if (_dx_lt_rb * _dy_t - _dy_lt_rb * _dx_t <= 0) {
var alpha = Math.atan2(_dy_t, _dx_t);
global_MatrixTransformer.RotateRadAppend(_text_transform, -alpha);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_lt, _t_y_lt);
} else {
alpha = Math.atan2(_dy_t, _dx_t);
global_MatrixTransformer.RotateRadAppend(_text_transform, Math.PI - alpha);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rt, _t_y_rt);
}
} else {
if (_content_height < _text_rect_width) {
switch (_body_pr.anchor) {
case 0:
_vertical_shift = _text_rect_width - _content_height;
break;
case 1:
_vertical_shift = (_text_rect_width - _content_height) * 0.5;
break;
case 2:
_vertical_shift = (_text_rect_width - _content_height) * 0.5;
break;
case 3:
_vertical_shift = (_text_rect_width - _content_height) * 0.5;
break;
case 4:
_vertical_shift = 0;
break;
}
} else {
_vertical_shift = 0;
}
global_MatrixTransformer.TranslateAppend(_text_transform, 0, _vertical_shift);
var _alpha;
_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);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rt, _t_y_rt);
} else {
global_MatrixTransformer.RotateRadAppend(_text_transform, Math.PI * 0.5 - _alpha);
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);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_lb, _t_y_lb);
} else {
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI * 0.5 - _alpha);
global_MatrixTransformer.TranslateAppend(_text_transform, _t_x_rb, _t_y_rb);
}
}
}
if (isRealObject(this.spPr.geometry) && isRealObject(this.spPr.geometry.rect)) {
var rect = this.spPr.geometry.rect;
this.clipRect = {
x: rect.l,
y: rect.t,
w: rect.r - rect.l,
h: rect.b - rect.t
};
} else {
this.clipRect = {
x: 0,
y: 0,
w: this.absExtX,
h: this.absExtY
};
}
this.invertTransformText = global_MatrixTransformer.Invert(this.transformText);
},
recalculateAfterTextAdd: function () {
switch (this.type) {
case CHART_TITLE_TYPE_TITLE:
var body_pr = this.txBody.bodyPr;
var r_ins = isRealNumber(body_pr.rIns) ? body_pr.rIns : 1.27;
var l_ins = isRealNumber(body_pr.lIns) ? body_pr.lIns : 2.54;
var t_ins = isRealNumber(body_pr.tIns) ? body_pr.tIns : 1.27;
var b_ins = isRealNumber(body_pr.bIns) ? body_pr.bIns : 1.27;
var max_width = this.chartGroup.extX * 0.8 - r_ins - l_ins;
var title_content = this.txBody.content;
title_content.Reset(0, 0, max_width, 20000);
title_content.Recalculate_Page(0);
var result_width;
if (! (title_content.Content.length > 1 || title_content.Content[0].Lines.length > 1)) {
if (title_content.Content[0].Lines[0].Ranges[0].W < max_width) {
title_content.Reset(0, 0, title_content.Content[0].Lines[0].Ranges[0].W, 20000);
title_content.Recalculate_Page(0);
}
result_width = title_content.Content[0].Lines[0].Ranges[0].W + r_ins + l_ins;
} else {
var width = 0;
for (var i = 0; i < title_content.Content.length; ++i) {
var par = title_content.Content[i];
for (var j = 0; j < par.Lines.length; ++j) {
if (par.Lines[j].Ranges[0].W > width) {
width = par.Lines[j].Ranges[0].W;
}
}
}
result_width = width + r_ins + l_ins;
}
this.extX = result_width;
this.extY = title_content.Get_SummaryHeight() + r_ins + l_ins;
this.x = this.chartGroup.extX - this.extX * 0.5;
this.y = 2.5;
break;
}
},
recalculateBrush: function () {},
recalculatePen: function () {},
draw: function (graphics) {
if (! (graphics.ClearMode === true)) {
graphics.SetIntegerGrid(false);
graphics.transform3(this.transformText);
this.txBody.draw(graphics);
graphics.reset();
graphics.SetIntegerGrid(true);
}
},
selectionSetStart: function (e, x, y) {
var t_x, t_y;
t_x = this.invertTransformText.TransformPointX(x, y);
t_y = this.invertTransformText.TransformPointY(x, y);
var event = new CMouseEventHandler();
event.fromJQueryEvent(e);
this.txBody.selectionSetStart(event, t_x, t_y);
},
selectionSetEnd: function (e, x, y) {
var t_x, t_y;
t_x = this.invertTransformText.TransformPointX(x, y);
t_y = this.invertTransformText.TransformPointY(x, y);
var event = new CMouseEventHandler();
event.fromJQueryEvent(e);
this.txBody.selectionSetEnd(event, t_x, t_y);
},
setPosition: function (x, y) {
if (!isRealObject(this.layout)) {
this.setLayout(new CChartLayout());
}
this.layout.setIsManual(true);
this.layout.setXMode(LAYOUT_MODE_EDGE);
this.layout.setX(x / this.chartGroup.extX);
this.layout.setYMode(LAYOUT_MODE_EDGE);
this.layout.setY(y / this.chartGroup.extY);
},
setLayout: function (layout) {
var oldValue = this.layout ? this.layout.Get_Id() : null;
var newValue = layout ? layout.Get_Id() : null;
this.layout = layout;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetChartTitleLayout, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
},
setOverlay: function (overlay) {
var oldValue = this.overlay;
var newValue = overlay;
this.overlay = overlay;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetChartOverlay, null, null, new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
},
getRectBounds: function () {
var transform = this.getTransform();
var w = this.extX;
var h = this.extY;
var rect_points = [{
x: 0,
y: 0
},
{
x: w,
y: 0
},
{
x: w,
y: h
},
{
x: 0,
y: h
}];
var min_x, max_x, min_y, max_y;
min_x = transform.TransformPointX(rect_points[0].x, rect_points[0].y);
min_y = transform.TransformPointY(rect_points[0].x, rect_points[0].y);
max_x = min_x;
max_y = min_y;
var cur_x, cur_y;
for (var i = 1; i < 4; ++i) {
cur_x = transform.TransformPointX(rect_points[i].x, rect_points[i].y);
cur_y = transform.TransformPointY(rect_points[i].x, rect_points[i].y);
if (cur_x < min_x) {
min_x = cur_x;
}
if (cur_x > max_x) {
max_x = cur_x;
}
if (cur_y < min_y) {
min_y = cur_y;
}
if (cur_y > max_y) {
max_y = cur_y;
}
}
return {
minX: min_x,
maxX: max_x,
minY: min_y,
maxY: max_y
};
},
hit: function (x, y) {
return this.hitInInnerArea(x, y) || this.hitInPath(x, y) || this.hitInTextRect(x, y);
},
hitInPath: function (x, y) {
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if (isRealObject(this.spPr.geometry)) {
return this.spPr.geometry.hitInPath(this.drawingObjects.getCanvasContext(), x_t, y_t);
}
return false;
},
hitInInnerArea: function (x, y) {
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if (isRealObject(this.spPr.geometry)) {
return this.spPr.geometry.hitInInnerArea(this.drawingObjects.getCanvasContext(), x_t, y_t);
}
return x_t > 0 && x_t < this.extX && y_t > 0 && y_t < this.extY;
},
hitInTextRect: function (x, y) {
if (isRealObject(this.txBody)) {
var t_x, t_y;
t_x = this.invertTransformText.TransformPointX(x, y);
t_y = this.invertTransformText.TransformPointY(x, y);
return t_x > 0 && t_x < this.txBody.contentWidth && t_y > 0 && t_y < this.txBody.contentHeight;
}
return false;
},
hitInBoundingRect: function (x, y) {
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
var _hit_context = this.drawingObjects.getCanvasContext();
return (HitInLine(_hit_context, x_t, y_t, 0, 0, this.extX, 0) || HitInLine(_hit_context, x_t, y_t, this.extX, 0, this.extX, this.extY) || HitInLine(_hit_context, x_t, y_t, this.extX, this.extY, 0, this.extY) || HitInLine(_hit_context, x_t, y_t, 0, this.extY, 0, 0));
},
getInvertTransform: function () {
return this.invertTransform;
},
getAllFonts: function (AllFonts) {
if (this.txBody && this.txBody.content) {
this.txBody.content.Document_Get_AllFontNames(AllFonts);
}
},
writeToBinary: function (w) {
w.WriteBool(isRealObject(this.layout));
if (isRealObject(this.layout)) {
this.layout.writeToBinary(w);
}
w.WriteBool(this.overlay);
this.spPr.Write_ToBinary2(w);
w.WriteBool(isRealObject(this.txBody));
if (isRealObject(this.txBody)) {
this.txBody.writeToBinary(w);
}
},
readFromBinary: function (r) {
if (r.GetBool()) {
this.setLayout(new CChartLayout());
this.layout.readFromBinary(r);
}
this.setOverlay(r.GetBool());
this.spPr.Read_FromBinary2(r);
if (r.GetBool()) {
this.setTextBody(new CTextBody(this));
this.txBody.readFromBinary(r);
}
},
OnContentRecalculate: function () {
if (this.chartGroup) {
this.chartGroup.recalculate();
}
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,805 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var fontslot_ASCII = 0;
var fontslot_EastAsia = 1;
var fontslot_CS = 2;
var fontslot_HAnsi = 3;
var fonthint_Default = 0;
var fonthint_CS = 1;
var fonthint_EastAsia = 2;
var lcid_unknown = 0;
var lcid_ar = 1;
var lcid_bg = 2;
var lcid_ca = 3;
var lcid_zhHans = 4;
var lcid_cs = 5;
var lcid_da = 6;
var lcid_de = 7;
var lcid_el = 8;
var lcid_en = 9;
var lcid_es = 10;
var lcid_fi = 11;
var lcid_fr = 12;
var lcid_he = 13;
var lcid_hu = 14;
var lcid_is = 15;
var lcid_it = 16;
var lcid_ja = 17;
var lcid_ko = 18;
var lcid_nl = 19;
var lcid_no = 20;
var lcid_pl = 21;
var lcid_pt = 22;
var lcid_rm = 23;
var lcid_ro = 24;
var lcid_ru = 25;
var lcid_hr = 26;
var lcid_sk = 27;
var lcid_sq = 28;
var lcid_sv = 29;
var lcid_th = 30;
var lcid_tr = 31;
var lcid_ur = 32;
var lcid_id = 33;
var lcid_uk = 34;
var lcid_be = 35;
var lcid_sl = 36;
var lcid_et = 37;
var lcid_lv = 38;
var lcid_lt = 39;
var lcid_tg = 40;
var lcid_fa = 41;
var lcid_vi = 42;
var lcid_hy = 43;
var lcid_az = 44;
var lcid_eu = 45;
var lcid_hsb = 46;
var lcid_mk = 47;
var lcid_tn = 50;
var lcid_xh = 52;
var lcid_zu = 53;
var lcid_af = 54;
var lcid_ka = 55;
var lcid_fo = 56;
var lcid_hi = 57;
var lcid_mt = 58;
var lcid_se = 59;
var lcid_ga = 60;
var lcid_ms = 62;
var lcid_kk = 63;
var lcid_ky = 64;
var lcid_sw = 65;
var lcid_tk = 66;
var lcid_uz = 67;
var lcid_tt = 68;
var lcid_bn = 69;
var lcid_pa = 70;
var lcid_gu = 71;
var lcid_or = 72;
var lcid_ta = 73;
var lcid_te = 74;
var lcid_kn = 75;
var lcid_ml = 76;
var lcid_as = 77;
var lcid_mr = 78;
var lcid_sa = 79;
var lcid_mn = 80;
var lcid_bo = 81;
var lcid_cy = 82;
var lcid_km = 83;
var lcid_lo = 84;
var lcid_gl = 86;
var lcid_kok = 87;
var lcid_syr = 90;
var lcid_si = 91;
var lcid_iu = 93;
var lcid_am = 94;
var lcid_tzm = 95;
var lcid_ne = 97;
var lcid_fy = 98;
var lcid_ps = 99;
var lcid_fil = 100;
var lcid_dv = 101;
var lcid_ha = 104;
var lcid_yo = 106;
var lcid_quz = 107;
var lcid_nso = 108;
var lcid_ba = 109;
var lcid_lb = 110;
var lcid_kl = 111;
var lcid_ig = 112;
var lcid_ii = 120;
var lcid_arn = 122;
var lcid_moh = 124;
var lcid_br = 126;
var lcid_ug = 128;
var lcid_mi = 129;
var lcid_oc = 130;
var lcid_co = 131;
var lcid_gsw = 132;
var lcid_sah = 133;
var lcid_qut = 134;
var lcid_rw = 135;
var lcid_wo = 136;
var lcid_prs = 140;
var lcid_gd = 145;
var lcid_arSA = 1025;
var lcid_bgBG = 1026;
var lcid_caES = 1027;
var lcid_zhTW = 1028;
var lcid_csCZ = 1029;
var lcid_daDK = 1030;
var lcid_deDE = 1031;
var lcid_elGR = 1032;
var lcid_enUS = 1033;
var lcid_esES_tradnl = 1034;
var lcid_fiFI = 1035;
var lcid_frFR = 1036;
var lcid_heIL = 1037;
var lcid_huHU = 1038;
var lcid_isIS = 1039;
var lcid_itIT = 1040;
var lcid_jaJP = 1041;
var lcid_koKR = 1042;
var lcid_nlNL = 1043;
var lcid_nbNO = 1044;
var lcid_plPL = 1045;
var lcid_ptBR = 1046;
var lcid_rmCH = 1047;
var lcid_roRO = 1048;
var lcid_ruRU = 1049;
var lcid_hrHR = 1050;
var lcid_skSK = 1051;
var lcid_sqAL = 1052;
var lcid_svSE = 1053;
var lcid_thTH = 1054;
var lcid_trTR = 1055;
var lcid_urPK = 1056;
var lcid_idID = 1057;
var lcid_ukUA = 1058;
var lcid_beBY = 1059;
var lcid_slSI = 1060;
var lcid_etEE = 1061;
var lcid_lvLV = 1062;
var lcid_ltLT = 1063;
var lcid_tgCyrlTJ = 1064;
var lcid_faIR = 1065;
var lcid_viVN = 1066;
var lcid_hyAM = 1067;
var lcid_azLatnAZ = 1068;
var lcid_euES = 1069;
var lcid_wenDE = 1070;
var lcid_mkMK = 1071;
var lcid_stZA = 1072;
var lcid_tsZA = 1073;
var lcid_tnZA = 1074;
var lcid_venZA = 1075;
var lcid_xhZA = 1076;
var lcid_zuZA = 1077;
var lcid_afZA = 1078;
var lcid_kaGE = 1079;
var lcid_foFO = 1080;
var lcid_hiIN = 1081;
var lcid_mtMT = 1082;
var lcid_seNO = 1083;
var lcid_msMY = 1086;
var lcid_kkKZ = 1087;
var lcid_kyKG = 1088;
var lcid_swKE = 1089;
var lcid_tkTM = 1090;
var lcid_uzLatnUZ = 1091;
var lcid_ttRU = 1092;
var lcid_bnIN = 1093;
var lcid_paIN = 1094;
var lcid_guIN = 1095;
var lcid_orIN = 1096;
var lcid_taIN = 1097;
var lcid_teIN = 1098;
var lcid_knIN = 1099;
var lcid_mlIN = 1100;
var lcid_asIN = 1101;
var lcid_mrIN = 1102;
var lcid_saIN = 1103;
var lcid_mnMN = 1104;
var lcid_boCN = 1105;
var lcid_cyGB = 1106;
var lcid_kmKH = 1107;
var lcid_loLA = 1108;
var lcid_myMM = 1109;
var lcid_glES = 1110;
var lcid_kokIN = 1111;
var lcid_mni = 1112;
var lcid_sdIN = 1113;
var lcid_syrSY = 1114;
var lcid_siLK = 1115;
var lcid_chrUS = 1116;
var lcid_iuCansCA = 1117;
var lcid_amET = 1118;
var lcid_tmz = 1119;
var lcid_neNP = 1121;
var lcid_fyNL = 1122;
var lcid_psAF = 1123;
var lcid_filPH = 1124;
var lcid_dvMV = 1125;
var lcid_binNG = 1126;
var lcid_fuvNG = 1127;
var lcid_haLatnNG = 1128;
var lcid_ibbNG = 1129;
var lcid_yoNG = 1130;
var lcid_quzBO = 1131;
var lcid_nsoZA = 1132;
var lcid_baRU = 1133;
var lcid_lbLU = 1134;
var lcid_klGL = 1135;
var lcid_igNG = 1136;
var lcid_krNG = 1137;
var lcid_gazET = 1138;
var lcid_tiER = 1139;
var lcid_gnPY = 1140;
var lcid_hawUS = 1141;
var lcid_soSO = 1143;
var lcid_iiCN = 1144;
var lcid_papAN = 1145;
var lcid_arnCL = 1146;
var lcid_mohCA = 1148;
var lcid_brFR = 1150;
var lcid_ugCN = 1152;
var lcid_miNZ = 1153;
var lcid_ocFR = 1154;
var lcid_coFR = 1155;
var lcid_gswFR = 1156;
var lcid_sahRU = 1157;
var lcid_qutGT = 1158;
var lcid_rwRW = 1159;
var lcid_woSN = 1160;
var lcid_prsAF = 1164;
var lcid_pltMG = 1165;
var lcid_gdGB = 1169;
var lcid_arIQ = 2049;
var lcid_zhCN = 2052;
var lcid_deCH = 2055;
var lcid_enGB = 2057;
var lcid_esMX = 2058;
var lcid_frBE = 2060;
var lcid_itCH = 2064;
var lcid_nlBE = 2067;
var lcid_nnNO = 2068;
var lcid_ptPT = 2070;
var lcid_roMO = 2072;
var lcid_ruMO = 2073;
var lcid_srLatnCS = 2074;
var lcid_svFI = 2077;
var lcid_urIN = 2080;
var lcid_azCyrlAZ = 2092;
var lcid_dsbDE = 2094;
var lcid_seSE = 2107;
var lcid_gaIE = 2108;
var lcid_msBN = 2110;
var lcid_uzCyrlUZ = 2115;
var lcid_bnBD = 2117;
var lcid_paPK = 2118;
var lcid_mnMongCN = 2128;
var lcid_boBT = 2129;
var lcid_sdPK = 2137;
var lcid_iuLatnCA = 2141;
var lcid_tzmLatnDZ = 2143;
var lcid_neIN = 2145;
var lcid_quzEC = 2155;
var lcid_tiET = 2163;
var lcid_arEG = 3073;
var lcid_zhHK = 3076;
var lcid_deAT = 3079;
var lcid_enAU = 3081;
var lcid_esES = 3082;
var lcid_frCA = 3084;
var lcid_srCyrlCS = 3098;
var lcid_seFI = 3131;
var lcid_tmzMA = 3167;
var lcid_quzPE = 3179;
var lcid_arLY = 4097;
var lcid_zhSG = 4100;
var lcid_deLU = 4103;
var lcid_enCA = 4105;
var lcid_esGT = 4106;
var lcid_frCH = 4108;
var lcid_hrBA = 4122;
var lcid_smjNO = 4155;
var lcid_arDZ = 5121;
var lcid_zhMO = 5124;
var lcid_deLI = 5127;
var lcid_enNZ = 5129;
var lcid_esCR = 5130;
var lcid_frLU = 5132;
var lcid_bsLatnBA = 5146;
var lcid_smjSE = 5179;
var lcid_arMA = 6145;
var lcid_enIE = 6153;
var lcid_esPA = 6154;
var lcid_frMC = 6156;
var lcid_srLatnBA = 6170;
var lcid_smaNO = 6203;
var lcid_arTN = 7169;
var lcid_enZA = 7177;
var lcid_esDO = 7178;
var lcid_frWest = 7180;
var lcid_srCyrlBA = 7194;
var lcid_smaSE = 7227;
var lcid_arOM = 8193;
var lcid_enJM = 8201;
var lcid_esVE = 8202;
var lcid_frRE = 8204;
var lcid_bsCyrlBA = 8218;
var lcid_smsFI = 8251;
var lcid_arYE = 9217;
var lcid_enCB = 9225;
var lcid_esCO = 9226;
var lcid_frCG = 9228;
var lcid_srLatnRS = 9242;
var lcid_smnFI = 9275;
var lcid_arSY = 10241;
var lcid_enBZ = 10249;
var lcid_esPE = 10250;
var lcid_frSN = 10252;
var lcid_srCyrlRS = 10266;
var lcid_arJO = 11265;
var lcid_enTT = 11273;
var lcid_esAR = 11274;
var lcid_frCM = 11276;
var lcid_srLatnME = 11290;
var lcid_arLB = 12289;
var lcid_enZW = 12297;
var lcid_esEC = 12298;
var lcid_frCI = 12300;
var lcid_srCyrlME = 12314;
var lcid_arKW = 13313;
var lcid_enPH = 13321;
var lcid_esCL = 13322;
var lcid_frML = 13324;
var lcid_arAE = 14337;
var lcid_enID = 14345;
var lcid_esUY = 14346;
var lcid_frMA = 14348;
var lcid_arBH = 15361;
var lcid_enHK = 15369;
var lcid_esPY = 15370;
var lcid_frHT = 15372;
var lcid_arQA = 16385;
var lcid_enIN = 16393;
var lcid_esBO = 16394;
var lcid_enMY = 17417;
var lcid_esSV = 17418;
var lcid_enSG = 18441;
var lcid_esHN = 18442;
var lcid_esNI = 19466;
var lcid_esPR = 20490;
var lcid_esUS = 21514;
var lcid_bsCyrl = 25626;
var lcid_bsLatn = 26650;
var lcid_srCyrl = 27674;
var lcid_srLatn = 28698;
var lcid_smn = 28731;
var lcid_azCyrl = 29740;
var lcid_sms = 29755;
var lcid_zh = 30724;
var lcid_nn = 30740;
var lcid_bs = 30746;
var lcid_azLatn = 30764;
var lcid_sma = 30779;
var lcid_uzCyrl = 30787;
var lcid_mnCyrl = 30800;
var lcid_iuCans = 30813;
var lcid_zhHant = 31748;
var lcid_nb = 31764;
var lcid_sr = 31770;
var lcid_tgCyrl = 31784;
var lcid_dsb = 31790;
var lcid_smj = 31803;
var lcid_uzLatn = 31811;
var lcid_mnMong = 31824;
var lcid_iuLatn = 31837;
var lcid_tzmLatn = 31839;
var lcid_haLatn = 31848;
(function (document) {
function CDetectFontUse() {
this.DetectData = null;
this.TableChunkLen = 65536;
this.TableChunks = 4;
this.TableChunkMain = 0;
this.TableChunkHintEA = this.TableChunkLen;
this.TableChunkHintZH = 2 * this.TableChunkLen;
this.TableChunkHintEACS = 3 * this.TableChunkLen;
this.Init = function () {
this.DetectData = g_memory.Alloc(this.TableChunkLen * this.TableChunks);
var _data = this.DetectData.data;
var i, j;
j = 0;
for (i = 0; i <= 127; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 160; i <= 1279; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 1424; i <= 1983; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 4352; i <= 4607; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 7680; i <= 7935; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 7936; i <= 10175; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 11904; i <= 12703; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 12800; i <= 19855; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 19968; i <= 40879; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 40960; i <= 42191; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 44032; i <= 55215; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 55296; i <= 57343; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 57344; i <= 63743; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 63744; i <= 64255; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 64256; i <= 64284; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 64285; i <= 65023; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65072; i <= 65135; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 65136; i <= 65278; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65280; i <= 65519; i++) {
_data[i + j] = fontslot_EastAsia;
}
j = this.TableChunkHintEA;
for (i = 0; i <= 127; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 160; i <= 1279; i++) {
_data[i + j] = fontslot_HAnsi;
}
_data[161 + j] = fontslot_EastAsia;
_data[164 + j] = fontslot_EastAsia;
_data[167 + j] = fontslot_EastAsia;
_data[168 + j] = fontslot_EastAsia;
_data[170 + j] = fontslot_EastAsia;
_data[173 + j] = fontslot_EastAsia;
_data[175 + j] = fontslot_EastAsia;
_data[176 + j] = fontslot_EastAsia;
_data[177 + j] = fontslot_EastAsia;
_data[178 + j] = fontslot_EastAsia;
_data[179 + j] = fontslot_EastAsia;
_data[180 + j] = fontslot_EastAsia;
_data[182 + j] = fontslot_EastAsia;
_data[183 + j] = fontslot_EastAsia;
_data[184 + j] = fontslot_EastAsia;
_data[185 + j] = fontslot_EastAsia;
_data[186 + j] = fontslot_EastAsia;
_data[188 + j] = fontslot_EastAsia;
_data[189 + j] = fontslot_EastAsia;
_data[190 + j] = fontslot_EastAsia;
_data[191 + j] = fontslot_EastAsia;
_data[215 + j] = fontslot_EastAsia;
_data[247 + j] = fontslot_EastAsia;
for (i = 688; i <= 1279; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 1424; i <= 1983; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 4352; i <= 4607; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 7680; i <= 7935; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 7936; i <= 8191; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 8192; i <= 10175; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 11904; i <= 12703; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 12800; i <= 19855; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 19968; i <= 40879; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 40960; i <= 42191; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 44032; i <= 55215; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 55296; i <= 57343; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 57344; i <= 63743; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 63744; i <= 64255; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 64256; i <= 64284; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 64285; i <= 65023; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65072; i <= 65135; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 65136; i <= 65278; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65280; i <= 65519; i++) {
_data[i + j] = fontslot_EastAsia;
}
j = this.TableChunkHintZH;
for (i = 0; i <= 127; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 160; i <= 255; i++) {
_data[i + j] = fontslot_HAnsi;
}
_data[161 + j] = fontslot_EastAsia;
_data[164 + j] = fontslot_EastAsia;
_data[167 + j] = fontslot_EastAsia;
_data[168 + j] = fontslot_EastAsia;
_data[170 + j] = fontslot_EastAsia;
_data[173 + j] = fontslot_EastAsia;
_data[175 + j] = fontslot_EastAsia;
_data[176 + j] = fontslot_EastAsia;
_data[177 + j] = fontslot_EastAsia;
_data[178 + j] = fontslot_EastAsia;
_data[179 + j] = fontslot_EastAsia;
_data[180 + j] = fontslot_EastAsia;
_data[182 + j] = fontslot_EastAsia;
_data[183 + j] = fontslot_EastAsia;
_data[184 + j] = fontslot_EastAsia;
_data[185 + j] = fontslot_EastAsia;
_data[186 + j] = fontslot_EastAsia;
_data[188 + j] = fontslot_EastAsia;
_data[189 + j] = fontslot_EastAsia;
_data[190 + j] = fontslot_EastAsia;
_data[191 + j] = fontslot_EastAsia;
_data[215 + j] = fontslot_EastAsia;
_data[247 + j] = fontslot_EastAsia;
_data[224 + j] = fontslot_EastAsia;
_data[225 + j] = fontslot_EastAsia;
_data[232 + j] = fontslot_EastAsia;
_data[233 + j] = fontslot_EastAsia;
_data[234 + j] = fontslot_EastAsia;
_data[236 + j] = fontslot_EastAsia;
_data[237 + j] = fontslot_EastAsia;
_data[242 + j] = fontslot_EastAsia;
_data[243 + j] = fontslot_EastAsia;
_data[249 + j] = fontslot_EastAsia;
_data[250 + j] = fontslot_EastAsia;
_data[252 + j] = fontslot_EastAsia;
for (i = 256; i <= 687; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 688; i <= 1279; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 1424; i <= 1983; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 4352; i <= 4607; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 7680; i <= 7935; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 7936; i <= 8191; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 8192; i <= 10175; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 11904; i <= 12703; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 12800; i <= 19855; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 19968; i <= 40879; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 40960; i <= 42191; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 44032; i <= 55215; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 55296; i <= 57343; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 57344; i <= 63743; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 63744; i <= 64255; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 64256; i <= 64284; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 64285; i <= 65023; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65072; i <= 65135; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 65136; i <= 65278; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65280; i <= 65519; i++) {
_data[i + j] = fontslot_EastAsia;
}
j = this.TableChunkHintEACS;
for (i = 0; i <= 127; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 160; i <= 255; i++) {
_data[i + j] = fontslot_HAnsi;
}
_data[161 + j] = fontslot_EastAsia;
_data[164 + j] = fontslot_EastAsia;
_data[167 + j] = fontslot_EastAsia;
_data[168 + j] = fontslot_EastAsia;
_data[170 + j] = fontslot_EastAsia;
_data[173 + j] = fontslot_EastAsia;
_data[175 + j] = fontslot_EastAsia;
_data[176 + j] = fontslot_EastAsia;
_data[177 + j] = fontslot_EastAsia;
_data[178 + j] = fontslot_EastAsia;
_data[179 + j] = fontslot_EastAsia;
_data[180 + j] = fontslot_EastAsia;
_data[182 + j] = fontslot_EastAsia;
_data[183 + j] = fontslot_EastAsia;
_data[184 + j] = fontslot_EastAsia;
_data[185 + j] = fontslot_EastAsia;
_data[186 + j] = fontslot_EastAsia;
_data[188 + j] = fontslot_EastAsia;
_data[189 + j] = fontslot_EastAsia;
_data[190 + j] = fontslot_EastAsia;
_data[191 + j] = fontslot_EastAsia;
_data[215 + j] = fontslot_EastAsia;
_data[247 + j] = fontslot_EastAsia;
for (i = 256; i <= 687; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 688; i <= 1279; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 1424; i <= 1983; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 4352; i <= 4607; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 7680; i <= 7935; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 7936; i <= 8191; i++) {
_data[i + j] = fontslot_HAnsi;
}
for (i = 8192; i <= 10175; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 11904; i <= 12703; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 12800; i <= 19855; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 19968; i <= 40879; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 40960; i <= 42191; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 44032; i <= 55215; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 55296; i <= 57343; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 57344; i <= 63743; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 63744; i <= 64255; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 64256; i <= 64284; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 64285; i <= 65023; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65072; i <= 65135; i++) {
_data[i + j] = fontslot_EastAsia;
}
for (i = 65136; i <= 65278; i++) {
_data[i + j] = fontslot_ASCII;
}
for (i = 65280; i <= 65519; i++) {
_data[i + j] = fontslot_EastAsia;
}
};
this.Get_FontClass = function (nUnicode, nHint, nEastAsia_lcid, bCS, bRTL) {
var _glyph_slot = fontslot_ASCII;
if (nHint != fonthint_EastAsia) {
_glyph_slot = this.DetectData.data[nUnicode];
} else {
if (nEastAsia_lcid == lcid_zh) {
_glyph_slot = this.DetectData.data[this.TableChunkHintZH + nUnicode];
} else {
_glyph_slot = this.DetectData.data[this.TableChunkHintEA + nUnicode];
}
if (_glyph_slot == fontslot_EastAsia) {
return _glyph_slot;
}
}
if (bCS || bRTL) {
return fontslot_CS;
}
return _glyph_slot;
};
}
window["CDetectFontUse"] = CDetectFontUse;
})(window.document);
var g_font_detector = new CDetectFontUse();
g_font_detector.Init();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function CGraphicFrame(drawingBase, drawingObjects) {
this.drawingBase = drawingBase;
this.drawingObjects = drawingObjects;
this.obj = null;
this.spPr = new CSpPr();
this.transform = new CMatrix();
this.group = null;
}
CGraphicFrame.prototype = {
recalculate: function () {},
recalculateTransform: function () {
var xfrm = this.spPr.xfrm;
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, xfrm.offX, xfrm.offY);
if (isRealObject(this.group)) {
global_MatrixTransformer.MultiplyAppend(this.transform, this.group.getTransform());
}
},
draw: function (graphics) {
if (isRealObject(this.obj)) {
this.obj.draw(graphics);
}
}
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,92 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function CIdCounter() {
this.m_sUserId = null;
this.m_bLoad = true;
this.m_nIdCounterLoad = 0;
this.m_nIdCounterEdit = 0;
this.Get_NewId = function () {
if (true === this.m_bLoad || null === this.m_sUserId) {
this.m_nIdCounterLoad++;
return ("" + this.m_nIdCounterLoad);
} else {
this.m_nIdCounterEdit++;
var cur_id = ("" + this.m_sUserId + "_" + this.m_nIdCounterEdit);
while (isRealObject(g_oTableId.Get_ById(cur_id))) {
this.m_nIdCounterEdit++;
cur_id = ("" + this.m_sUserId + "_" + this.m_nIdCounterEdit);
}
return cur_id;
}
};
this.Set_UserId = function (sUserId) {
this.m_sUserId = sUserId;
};
this.Set_Load = function (bValue) {
this.m_bLoad = bValue;
};
}
var g_oIdCounter = null;
var CLASS_TYPE_TABLE_ID = 0;
var CLASS_TYPE_DOCUMENT_CONTENT = 1;
var CLASS_TYPE_SHAPE = 2;
var CLASS_TYPE_IMAGE = 3;
var CLASS_TYPE_GROUP = 4;
var CLASS_TYPE_XFRM = 5;
var CLASS_TYPE_GEOMETRY = 6;
var CLASS_TYPE_PATH = 7;
var CLASS_TYPE_PARAGRAPH = 8;
var CLASS_TYPE_TEXT_BODY = 9;
var CLASS_TYPE_TEXT_PR = 10;
var CLASS_TYPE_UNI_FILL = 11;
var CLASS_TYPE_PATTERN_FILL = 12;
var CLASS_TYPE_GRAD_FILL = 13;
var CLASS_TYPE_SOLID_FILL = 14;
var CLASS_TYPE_UNI_COLOR = 15;
var CLASS_TYPE_SCHEME_COLOR = 16;
var CLASS_TYPE_RGB_COLOR = 17;
var CLASS_TYPE_PRST_COLOR = 18;
var CLASS_TYPE_SYS_COLOR = 19;
var CLASS_TYPE_LINE = 20;
var CLASS_TYPE_CHART_AS_GROUP = 21;
var CLASS_TYPE_CHART_LEGEND = 22;
var CLASS_TYPE_CHART_TITLE = 23;
var CLASS_TYPE_COLOR_MOD = 24;
var CLASS_TYPE_LEGEND_ENTRY = 25;
var CLASS_TYPE_CHART_DATA = 26;
var CLASS_TYPE_NO_FILL = 27;
var CLASS_TYPE_GS = 28;
var CLASS_TYPE_GRAD_LIN = 29;
var CLASS_TYPE_GRAD_PAT = 30;
var CLASS_TYPE_BLIP_FILL = 31;
var CLASS_TYPE_CHART_LAYOUT = 32;
var g_oTableId = null;

View File

@@ -0,0 +1,525 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
(function (document) {
var ImageLoadStatus = {
Loading: 0,
Complete: 1
};
function CImageLoad(src) {
this.src = src;
this.Image = null;
this.Status = ImageLoadStatus.Complete;
}
function CGlobalImageLoader() {
this.map_image_index = {};
this.imagesPath = "";
this.Api = null;
this.ThemeLoader = null;
this.images_loading = null;
this.bIsLoadDocumentFirst = false;
this.bIsAsyncLoadDocumentImages = false;
this.put_Api = function (_api) {
this.Api = _api;
};
this.LoadDocumentImages = function (_images, isUrl) {
if (this.ThemeLoader == null) {
this.Api.asyncImagesDocumentStartLoaded();
} else {
this.ThemeLoader.asyncImagesStartLoaded();
}
this.images_loading = [];
for (var id in _images) {
this.images_loading[this.images_loading.length] = getFullImageSrc(_images[id]);
}
if (!this.bIsAsyncLoadDocumentImages) {
this._LoadImages();
} else {
var _len = this.images_loading.length;
for (var i = 0; i < _len; i++) {
this.LoadImageAsync(i);
}
this.images_loading.splice(0, _len);
if (this.ThemeLoader == null) {
this.Api.asyncImagesDocumentEndLoaded();
} else {
this.ThemeLoader.asyncImagesEndLoaded();
}
}
};
var oThis = this;
this._LoadImages = function () {
if (0 == this.images_loading.length) {
if (this.ThemeLoader == null) {
this.Api.asyncImagesDocumentEndLoaded();
} else {
this.ThemeLoader.asyncImagesEndLoaded();
}
return;
}
var _id = this.images_loading[0];
var oImage = new CImageLoad(_id);
oImage.Status = ImageLoadStatus.Loading;
oImage.Image = new Image();
oThis.map_image_index[oImage.src] = oImage;
oImage.Image.onload = function () {
oImage.Status = ImageLoadStatus.Complete;
if (oThis.bIsLoadDocumentFirst === true) {
oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress();
}
oThis.images_loading.shift();
oThis._LoadImages();
};
oImage.Image.onerror = function () {
oImage.Status = ImageLoadStatus.Complete;
oImage.Image = null;
if (oThis.bIsLoadDocumentFirst === true) {
oThis.Api.OpenDocumentProgress.CurrentImage++;
oThis.Api.SendOpenProgress();
}
oThis.images_loading.shift();
oThis._LoadImages();
};
oImage.Image.src = oImage.src;
};
this.LoadImage = function (src, Type) {
var _image = this.map_image_index[src];
if (undefined != _image) {
return _image;
}
this.Api.asyncImageStartLoaded();
var oImage = new CImageLoad(src);
oImage.Type = Type;
oImage.Image = new Image();
oImage.Status = ImageLoadStatus.Loading;
oThis.map_image_index[oImage.src] = oImage;
oImage.Image.onload = function () {
oImage.Status = ImageLoadStatus.Complete;
oThis.Api.asyncImageEndLoaded(oImage);
};
oImage.Image.onerror = function () {
oImage.Image = null;
oImage.Status = ImageLoadStatus.Complete;
oThis.Api.asyncImageEndLoaded(oImage);
};
oImage.Image.src = oImage.src;
return null;
};
this.LoadImageAsync = function (i) {
var _id = oThis.images_loading[i];
var oImage = new CImageLoad(_id);
oImage.Status = ImageLoadStatus.Loading;
oImage.Image = new Image();
oThis.map_image_index[oImage.src] = oImage;
oImage.Image.onload = function () {
oImage.Status = ImageLoadStatus.Complete;
oThis.Api.asyncImageEndLoadedBackground(oImage);
};
oImage.Image.onerror = function () {
oImage.Status = ImageLoadStatus.Complete;
oImage.Image = null;
oThis.Api.asyncImageEndLoadedBackground(oImage);
};
oImage.Image.src = oImage.src;
};
}
function CEmbeddedCutFontsLoader() {
this.Api = null;
this.font_infos = [];
this.font_files = [];
this.map_name_cutindex = null;
this.CurrentFindFileParse = -1;
this.Url = "";
this.bIsCutFontsUse = false;
var oThis = this;
this.load_cut_fonts = function () {
var scriptElem = document.createElement("script");
if (scriptElem.readyState && false) {
scriptElem.onreadystatechange = function () {
if (this.readyState == "complete" || this.readyState == "loaded") {
scriptElem.onreadystatechange = null;
setTimeout(oThis._callback_script_load, 0);
}
};
}
scriptElem.onload = scriptElem.onerror = oThis._callback_font_load;
scriptElem.setAttribute("src", this.Url);
scriptElem.setAttribute("type", "text/javascript");
document.getElementsByTagName("head")[0].appendChild(scriptElem);
this.Api.asyncFontsDocumentStartLoaded();
};
this._callback_font_load = function () {
if (undefined === embedded_fonts) {
return;
}
oThis.CurrentFindFileParse = 0;
setTimeout(oThis.parse_font, 10);
},
this.parse_font = function () {
var __font_data_idx = g_fonts_streams.length;
g_fonts_streams[__font_data_idx] = CreateFontData2(embedded_fonts[oThis.CurrentFindFileParse], undefined);
embedded_fonts[oThis.CurrentFindFileParse] = "";
oThis.font_files[oThis.CurrentFindFileParse].SetStreamIndex(__font_data_idx);
oThis.font_files[oThis.CurrentFindFileParse].Status = 0;
oThis.CurrentFindFileParse++;
if (oThis.CurrentFindFileParse >= oThis.font_files.length) {
oThis.Api.asyncFontsDocumentEndLoaded();
return;
}
setTimeout(oThis.parse_font, 10);
};
this.init_cut_fonts = function (_fonts) {
this.map_name_cutindex = {};
var _len = _fonts.length;
for (var i = 0; i < _len; i++) {
var _font = _fonts[i];
var _info = this.map_name_cutindex[_font.Name];
if (_info === undefined) {
_info = new CFontInfo(_font.Name, "", FONT_TYPE_ADDITIONAL_CUT, -1, -1, -1, -1, -1, -1, -1, -1);
this.map_name_cutindex[_font.Name] = _info;
}
switch (_font.Style) {
case 0:
_info.indexR = _font.IndexCut;
_info.faceIndexR = 0;
break;
case 1:
_info.indexB = _font.IndexCut;
_info.faceIndexB = 0;
break;
case 2:
_info.indexI = _font.IndexCut;
_info.faceIndexI = 0;
break;
case 3:
_info.indexBI = _font.IndexCut;
_info.faceIndexBI = 0;
break;
default:
break;
}
this.font_files[i] = new CFontFileLoader("embedded_cut" + i);
}
};
}
function CGlobalFontLoader() {
this.fonts_streams = new Array();
this.fontFilesPath = "";
this.fontFiles = window.g_font_files;
this.fontInfos = window.g_font_infos;
this.map_font_index = window.g_map_font_index;
this.embeddedFilesPath = "";
this.embeddedFontFiles = new Array();
this.embeddedFontInfos = new Array();
this.ThemeLoader = null;
this.Api = null;
this.fonts_loading = new Array();
this.fonts_loading_after_style = new Array();
this.bIsLoadDocumentFirst = false;
this.currentInfoLoaded = null;
this.embedded_cut_manager = new CEmbeddedCutFontsLoader();
this.put_Api = function (_api) {
this.Api = _api;
this.embedded_cut_manager.Api = _api;
};
this.LoadEmbeddedFonts = function (url, _fonts) {
this.embeddedFilesPath = url;
var _count = _fonts.length;
if (0 == _count) {
return;
}
this.embeddedFontInfos = new Array(_count);
var map_files = {};
for (var i = 0; i < _count; i++) {
map_files[_fonts[i].id] = _fonts[i].id;
}
var index = 0;
for (var i in map_files) {
this.embeddedFontFiles[index] = new CFontFileLoader(map_files[i]);
this.embeddedFontFiles[index].CanUseOriginalFormat = false;
this.embeddedFontFiles[index].IsNeedAddJSToFontPath = false;
map_files[i] = index++;
}
for (var i = 0; i < _count; i++) {
var lStyle = 0;
if (0 == lStyle) {
this.embeddedFontInfos[i] = new CFontInfo(_fonts[i].name, "", FONT_TYPE_EMBEDDED, map_files[_fonts[i].id], 0, -1, -1, -1, -1, -1, -1);
} else {
if (2 == lStyle) {
this.embeddedFontInfos[i] = new CFontInfo(_fonts[i].name, "", FONT_TYPE_EMBEDDED, -1, -1, map_files[_fonts[i].id], _fonts[i].faceindex, -1, -1, -1, -1);
} else {
if (1 == lStyle) {
this.embeddedFontInfos[i] = new CFontInfo(_fonts[i].name, "", FONT_TYPE_EMBEDDED, -1, -1, -1, -1, map_files[_fonts[i].id], _fonts[i].faceindex, -1, -1);
} else {
this.embeddedFontInfos[i] = new CFontInfo(_fonts[i].name, "", FONT_TYPE_EMBEDDED, -1, -1, -1, -1, -1, -1, map_files[_fonts[i].id], _fonts[i].faceindex);
}
}
}
}
var _count_infos_ = this.fontInfos.length;
for (var i = 0; i < _count; i++) {
this.map_font_index[_fonts[i].name] = i + _count_infos_;
this.fontInfos[i + _count_infos_] = this.embeddedFontInfos[i];
}
};
this.SetStandartFonts = function () {
var standarts = window.standarts;
if (undefined == standarts) {
standarts = [];
for (var i = 0; i < window.g_font_infos.length; i++) {
standarts.push(window.g_font_infos[i].Name);
}
}
var _count = standarts.length;
var _infos = this.fontInfos;
var _map = this.map_font_index;
for (var i = 0; i < _count; i++) {
_infos[_map[standarts[i]]].Type = FONT_TYPE_STANDART;
}
};
this.CheckFontsPaste = function (_fonts) {
for (var i in _fonts) {
var info_ind = this.map_font_index[_fonts[i]];
if (info_ind != undefined) {
this.fonts_loading[this.fonts_loading.length] = this.fontInfos[info_ind];
}
}
this.Api.asyncFontsDocumentStartLoaded();
this._LoadFonts();
};
this.AddLoadFonts = function (info, need_styles) {
this.fonts_loading[this.fonts_loading.length] = info;
this.fonts_loading[this.fonts_loading.length - 1].NeedStyles = (need_styles == undefined) ? 15 : need_styles;
};
this.LoadDocumentFonts = function (_fonts, is_default) {
if (this.embedded_cut_manager.bIsCutFontsUse) {
return this.embedded_cut_manager.load_cut_fonts();
}
var gui_fonts = new Array();
var gui_count = 0;
for (var i = 0; i < this.fontInfos.length; i++) {
var info = this.fontInfos[i];
if (FONT_TYPE_STANDART == info.Type) {
var __font = new CFont(info.Name, "", info.Type, info.Thumbnail);
gui_fonts[gui_count++] = __font;
}
}
for (var i in _fonts) {
if (_fonts[i].Type != FONT_TYPE_EMBEDDED) {
var info = this.fontInfos[this.map_font_index[_fonts[i].name]];
this.AddLoadFonts(info, _fonts[i].NeedStyles);
if (info.Type == FONT_TYPE_ADDITIONAL) {
var __font = new CFont(info.Name, "", info.Type, info.Thumbnail);
gui_fonts[gui_count++] = __font;
}
} else {
var ind = -1;
for (var j = 0; j < this.embeddedFontInfos.length; j++) {
if (this.embeddedFontInfos[j].Name == _fonts[i].name) {
this.AddLoadFonts(this.embeddedFontInfos[j], 0);
break;
}
}
}
}
this.Api.sync_InitEditorFonts(gui_fonts);
if (this.Api.IsNeedDefaultFonts()) {
this.AddLoadFonts(this.fontInfos[this.map_font_index["Arial"]], 15);
this.AddLoadFonts(this.fontInfos[this.map_font_index["Symbol"]], 15);
this.AddLoadFonts(this.fontInfos[this.map_font_index["Wingdings"]], 15);
this.AddLoadFonts(this.fontInfos[this.map_font_index["Courier New"]], 15);
this.AddLoadFonts(this.fontInfos[this.map_font_index["Times New Roman"]], 15);
}
this.Api.asyncFontsDocumentStartLoaded();
this.bIsLoadDocumentFirst = true;
this._LoadFonts();
};
this.LoadDocumentFonts2 = function (_fonts) {
for (var i in _fonts) {
var info = this.fontInfos[this.map_font_index[_fonts[i].name]];
this.AddLoadFonts(info, 15);
}
if (null == this.ThemeLoader) {
this.Api.asyncFontsDocumentStartLoaded();
} else {
this.ThemeLoader.asyncFontsStartLoaded();
}
this._LoadFonts();
};
var oThis = this;
this._LoadFonts = function () {
if (0 == this.fonts_loading.length) {
if (null == this.ThemeLoader) {
this.Api.asyncFontsDocumentEndLoaded();
} else {
this.ThemeLoader.asyncFontsEndLoaded();
}
if (this.bIsLoadDocumentFirst === true) {
var _count = this.fonts_loading_after_style.length;
for (var i = 0; i < _count; i++) {
var _info = this.fonts_loading_after_style[i];
_info.NeedStyles = 15;
_info.CheckFontLoadStyles(this);
}
this.fonts_loading_after_style.splice(0, this.fonts_loading_after_style.length);
this.bIsLoadDocumentFirst = false;
}
return;
}
var fontinfo = this.fonts_loading[0];
var IsNeed = fontinfo.CheckFontLoadStyles(this);
if (IsNeed) {
setTimeout(oThis._check_loaded, 50);
} else {
if (this.bIsLoadDocumentFirst === true) {
this.Api.OpenDocumentProgress.CurrentFont++;
this.Api.SendOpenProgress();
}
this.fonts_loading_after_style[this.fonts_loading_after_style.length] = this.fonts_loading[0];
this.fonts_loading.shift();
this._LoadFonts();
}
};
this._check_loaded = function () {
var IsNeed = false;
if (0 == oThis.fonts_loading.length) {
oThis._LoadFonts();
return;
}
var current = oThis.fonts_loading[0];
var IsNeed = current.CheckFontLoadStyles(oThis);
if (true === IsNeed) {
setTimeout(oThis._check_loaded, 50);
} else {
if (oThis.bIsLoadDocumentFirst === true) {
oThis.Api.OpenDocumentProgress.CurrentFont++;
oThis.Api.SendOpenProgress();
}
oThis.fonts_loading_after_style[oThis.fonts_loading_after_style.length] = oThis.fonts_loading[0];
oThis.fonts_loading.shift();
oThis._LoadFonts();
}
};
this.LoadFont = function (fontinfo) {
this.currentInfoLoaded = fontinfo;
this.currentInfoLoaded = fontinfo;
this.currentInfoLoaded.NeedStyles = 15;
var IsNeed = this.currentInfoLoaded.CheckFontLoadStyles(this);
if (IsNeed) {
this.Api.asyncFontStartLoaded();
setTimeout(this.check_loaded, 20);
return true;
} else {
this.currentInfoLoaded = null;
return false;
}
};
this.check_loaded = function () {
var current = oThis.currentInfoLoaded;
if (null == current) {
return;
}
var IsNeed = current.CheckFontLoadStyles(oThis);
if (IsNeed) {
setTimeout(oThis.check_loaded, 50);
} else {
oThis.Api.asyncFontEndLoaded(oThis.currentInfoLoaded);
oThis.currentInfoLoaded = null;
}
};
this.LoadFontsFromServer = function (_fonts) {
var _count = _fonts.length;
for (var i = 0; i < _count; i++) {
var _info_ind = this.map_font_index[_fonts[i]];
if (undefined !== _info_ind) {
var _info = this.fontInfos[_info_ind];
_info.LoadFontsFromServer(this);
}
}
};
}
CGlobalFontLoader.prototype.SetStreamIndexEmb = function (font_index, stream_index) {
this.embeddedFontFiles[font_index].SetStreamIndex(stream_index);
};
function CGlobalScriptLoader() {
this.Status = -1;
this.callback = null;
this.oCallBackThis = null;
var oThis = this;
this.CheckLoaded = function () {
return (0 == oThis.Status || 1 == oThis.Status);
};
this.LoadScriptAsync = function (url, _callback, _callback_this) {
this.callback = _callback;
this.oCallBackThis = _callback_this;
if (-1 != this.Status) {
return true;
}
this.Status = 2;
var scriptElem = document.createElement("script");
if (scriptElem.readyState && false) {
scriptElem.onreadystatechange = function () {
if (this.readyState == "complete" || this.readyState == "loaded") {
scriptElem.onreadystatechange = null;
setTimeout(oThis._callback_script_load, 0);
}
};
}
scriptElem.onload = scriptElem.onerror = oThis._callback_script_load;
scriptElem.setAttribute("src", url);
scriptElem.setAttribute("type", "text/javascript");
document.getElementsByTagName("head")[0].appendChild(scriptElem);
return false;
};
this._callback_script_load = function () {
if (oThis.Status != 3) {
oThis.Status = 1;
}
if (null != oThis.callback) {
oThis.callback(oThis.oCallBackThis);
oThis.callback = null;
}
};
}
window.g_font_loader = new CGlobalFontLoader();
window.g_image_loader = new CGlobalImageLoader();
window.g_script_loader = new CGlobalScriptLoader();
window.g_script_loader2 = new CGlobalScriptLoader();
window.g_flow_anchor = new Image();
window.g_flow_anchor.asc_complete = false;
window.g_flow_anchor.onload = function () {
window.g_flow_anchor.asc_complete = true;
};
window.g_flow_anchor.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAARCAYAAADUryzEAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAAd0SU1FB90FEQkoAWe6v2gAAABoSURBVDjLzZRBDsAgCAQd0v9/eXpqokaxrWlSjgLL7kJELTsRWRIQ8BUAoIpKBhJlM8g8uCarfMbgJwCrVWX+HE8MGw1rJKyaRzVRP96R0jONFcVVrjmku2bWMrY9mJ5yz2YGzu5/cAJM80IX4Fh6ugAAAABJRU5ErkJggg==";
window["CGlobalFontLoader"] = CGlobalFontLoader;
CGlobalFontLoader.prototype["SetStreamIndexEmb"] = CGlobalFontLoader.prototype.SetStreamIndexEmb;
})(window.document);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,102 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function HitInLine(context, px, py, x0, y0, x1, y1) {
if (x0 !== x1 && y0 !== y1) {
var l = Math.min(x0, x1);
var t = Math.min(y0, y1);
var r = Math.max(x0, x1);
var b = Math.max(y0, y1);
if (px < l || px > r || py < t || py > b) {
return false;
}
}
var tx, ty, dx, dy, d;
tx = x1 - x0;
ty = y1 - y0;
d = 1.5 / Math.sqrt(tx * tx + ty * ty);
dx = -ty * d;
dy = tx * d;
context.beginPath();
context.moveTo(x0, y0);
context.lineTo(x0 + dx, y0 + dy);
context.lineTo(x1 + dx, y1 + dy);
context.lineTo(x1 - dx, y1 - dy);
context.lineTo(x0 - dx, y0 - dy);
context.closePath();
return context.isPointInPath(px, py);
}
function HitInBezier4(context, px, py, x0, y0, x1, y1, x2, y2, x3, y3) {
var l = Math.min(x0, x1, x2, x3);
var t = Math.min(y0, y1, y2, y3);
var r = Math.max(x0, x1, x2, x3);
var b = Math.max(y0, y1, y2, y3);
if (px < l || px > r || py < t || py > b) {
return false;
}
var tx, ty, dx, dy, d;
tx = x3 - x0;
ty = y3 - y0;
d = 1.5 / Math.sqrt(tx * tx + ty * ty);
dx = -ty * d;
dy = tx * d;
context.beginPath();
context.moveTo(x0, y0);
context.lineTo(x0 + dx, y0 + dy);
context.bezierCurveTo(x1 + dx, y1 + dy, x2 + dx, y2 + dy, x3 + dx, y3 + dy);
context.lineTo(x3 - dx, y3 - dy);
context.bezierCurveTo(x2 - dx, y2 - dy, x1 - dx, y1 - dy, x0 - dx, y0 - dy);
context.closePath();
return context.isPointInPath(px, py);
}
function HitInBezier3(context, px, py, x0, y0, x1, y1, x2, y2) {
var l = Math.min(x0, x1, x2);
var t = Math.min(y0, y1, y2);
var r = Math.max(x0, x1, x2);
var b = Math.max(y0, y1, y2);
if (px < l || px > r || py < t || py > b) {
return false;
}
var tx, ty, dx, dy, d;
tx = x2 - x0;
ty = y2 - y0;
d = 1.5 / Math.sqrt(tx * tx + ty * ty);
dx = -ty * d;
dy = tx * d;
context.beginPath();
context.moveTo(x0, y0);
context.lineTo(x0 + dx, y0 + dy);
context.quadraticCurveTo(x1 + dx, y1 + dy, x2 + dx, y2 + dy);
context.lineTo(x2 - dx, y2 - dy);
context.quadraticCurveTo(x1 - dx, y1 - dy, x0 - dx, y0 - dy);
context.closePath();
return context.isPointInPath(px, py);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,279 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function XYAdjustmentTrack(originalShape, adjIndex) {
this.originalShape = originalShape;
this.geometry = originalShape.spPr.geometry.createDuplicate();
this.adjastment = this.geometry.ahXYLst[adjIndex];
this.shapeWidth = this.originalShape.extX;
this.shapeHeight = this.originalShape.extY;
this.xFlag = false;
this.yFlag = false;
this.refX = null;
this.refY = null;
if (this.adjastment !== null && typeof this.adjastment === "object") {
var _ref_x = this.adjastment.gdRefX;
var _gd_lst = this.geometry.gdLst;
if (typeof _ref_x === "string" && typeof _gd_lst[_ref_x] === "number" && typeof this.adjastment.minX === "number" && typeof this.adjastment.maxX === "number") {
_gd_lst[_ref_x] = this.adjastment.minX;
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
this.minRealX = this.adjastment.posX;
_gd_lst[_ref_x] = this.adjastment.maxX;
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
this.maxRealX = this.adjastment.posX;
this.maximalRealX = Math.max(this.maxRealX, this.minRealX);
this.minimalRealX = Math.min(this.maxRealX, this.minRealX);
this.minimalRealativeX = Math.min(this.adjastment.minX, this.adjastment.maxX);
this.maximalRealativeX = Math.max(this.adjastment.minX, this.adjastment.maxX);
if (this.maximalRealX - this.minimalRealX > 0) {
this.coeffX = (this.adjastment.maxX - this.adjastment.minX) / (this.maxRealX - this.minRealX);
this.xFlag = true;
}
}
var _ref_y = this.adjastment.gdRefY;
if (typeof _ref_y === "string" && typeof _gd_lst[_ref_y] === "number" && typeof this.adjastment.minY === "number" && typeof this.adjastment.maxY === "number") {
_gd_lst[_ref_y] = this.adjastment.minY;
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
this.minRealY = this.adjastment.posY;
_gd_lst[_ref_y] = this.adjastment.maxY;
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
this.maxRealY = this.adjastment.posY;
this.maximalRealY = Math.max(this.maxRealY, this.minRealY);
this.minimalRealY = Math.min(this.maxRealY, this.minRealY);
this.minimalRealativeY = Math.min(this.adjastment.minY, this.adjastment.maxY);
this.maximalRealativeY = Math.max(this.adjastment.minY, this.adjastment.maxY);
if (this.maximalRealY - this.minimalRealY > 0) {
this.coeffY = (this.adjastment.maxY - this.adjastment.minY) / (this.maxRealY - this.minRealY);
this.yFlag = true;
}
}
if (this.xFlag) {
this.refX = _ref_x;
}
if (this.yFlag) {
this.refY = _ref_y;
}
}
this.overlayObject = new OverlayObject(this.geometry, originalShape.extX, originalShape.extY, originalShape.brush, originalShape.pen, originalShape.transform);
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
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.track = function (posX, posY) {
var invert_transform = this.originalShape.invertTransform;
var _relative_x = invert_transform.TransformPointX(posX, posY);
var _relative_y = invert_transform.TransformPointY(posX, posY);
var bRecalculate = false;
if (this.xFlag) {
var _new_x = this.adjastment.minX + this.coeffX * (_relative_x - this.minRealX);
if (_new_x <= this.maximalRealativeX && _new_x >= this.minimalRealativeX) {
if (this.geometry.gdLst[this.adjastment.gdRefX] !== _new_x) {
bRecalculate = true;
}
this.geometry.gdLst[this.adjastment.gdRefX] = _new_x;
} else {
if (_new_x > this.maximalRealativeX) {
if (this.geometry.gdLst[this.adjastment.gdRefX] !== this.maximalRealativeX) {
bRecalculate = true;
}
this.geometry.gdLst[this.adjastment.gdRefX] = this.maximalRealativeX;
} else {
if (this.geometry.gdLst[this.adjastment.gdRefX] !== this.minimalRealativeX) {
bRecalculate = true;
}
this.geometry.gdLst[this.adjastment.gdRefX] = this.minimalRealativeX;
}
}
}
if (this.yFlag) {
var _new_y = this.adjastment.minY + this.coeffY * (_relative_y - this.minRealY);
if (_new_y <= this.maximalRealativeY && _new_y >= this.minimalRealativeY) {
if (this.geometry.gdLst[this.adjastment.gdRefY] !== _new_y) {
bRecalculate = true;
}
this.geometry.gdLst[this.adjastment.gdRefY] = _new_y;
} else {
if (_new_y > this.maximalRealativeY) {
if (this.geometry.gdLst[this.adjastment.gdRefY] !== this.maximalRealativeY) {
bRecalculate = true;
}
this.geometry.gdLst[this.adjastment.gdRefY] = this.maximalRealativeY;
} else {
if (this.geometry.gdLst[this.adjastment.gdRefY] !== this.minimalRealativeY) {
bRecalculate = true;
}
this.geometry.gdLst[this.adjastment.gdRefY] = this.minimalRealativeY;
}
}
}
if (bRecalculate) {
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
}
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterParagraphAddUndo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateGeometry_Undo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Id, new UndoRedoDataShapeRecalc()), null);
this.originalShape.setAdjustmentValue(this.refX, this.geometry.gdLst[this.adjastment.gdRefX], this.refY, this.geometry.gdLst[this.adjastment.gdRefY]);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateGeometry_Redo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Id, new UndoRedoDataShapeRecalc()), null);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterParagraphAddRedo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.originalShape.recalculateGeometry();
this.originalShape.calculateContent();
this.originalShape.calculateTransformTextMatrix();
};
}
function PolarAdjustmentTrack(originalShape, adjIndex) {
this.originalShape = originalShape;
this.geometry = originalShape.spPr.geometry.createDuplicate();
this.adjastment = this.geometry.ahPolarLst[adjIndex];
this.shapeWidth = this.originalShape.extX;
this.shapeHeight = this.originalShape.extY;
this.radiusFlag = false;
this.angleFlag = false;
this.refR = null;
this.refAng = null;
if (this.adjastment !== null && typeof this.adjastment === "object") {
var _ref_r = this.adjastment.gdRefR;
var _gd_lst = this.geometry.gdLst;
if (typeof _ref_r === "string" && typeof _gd_lst[_ref_r] === "number" && typeof this.adjastment.minR === "number" && typeof this.adjastment.maxR === "number") {
_gd_lst[_ref_r] = this.adjastment.minR;
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
var _dx = this.adjastment.posX - this.shapeWidth * 0.5;
var _dy = this.adjastment.posY - this.shapeWidth * 0.5;
this.minRealR = Math.sqrt(_dx * _dx + _dy * _dy);
_gd_lst[_ref_r] = this.adjastment.maxR;
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
_dx = this.adjastment.posX - this.shapeWidth * 0.5;
_dy = this.adjastment.posY - this.shapeHeight * 0.5;
this.maxRealR = Math.sqrt(_dx * _dx + _dy * _dy);
this.maximalRealRadius = Math.max(this.maxRealR, this.minRealR);
this.minimalRealRadius = Math.min(this.maxRealR, this.minRealR);
this.minimalRealativeRadius = Math.min(this.adjastment.minR, this.adjastment.maxR);
this.maximalRealativeRadius = Math.max(this.adjastment.minR, this.adjastment.maxR);
if (this.maximalRealRadius - this.minimalRealRadius > 0) {
this.coeffR = (this.adjastment.maxR - this.adjastment.minR) / (this.maxRealR - this.minRealR);
this.radiusFlag = true;
}
}
var _ref_ang = this.adjastment.gdRefAng;
if (typeof _ref_ang === "string" && typeof _gd_lst[_ref_ang] === "number" && typeof this.adjastment.minAng === "number" && typeof this.adjastment.maxAng === "number") {
this.angleFlag = true;
this.minimalAngle = Math.min(this.adjastment.minAng, this.adjastment.maxAng);
this.maximalAngle = Math.max(this.adjastment.minAng, this.adjastment.maxAng);
}
if (this.radiusFlag) {
this.refR = _ref_r;
}
if (this.angleFlag) {
this.refAng = _ref_ang;
}
}
this.overlayObject = new OverlayObject(this.geometry, this.originalShape.extX, this.originalShape.extY, this.originalShape.brush, this.originalShape.pen, this.originalShape.transform);
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
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.track = function (posX, posY) {
var _temp_x = posX - this.xLT;
var _temp_y = posY - this.yLT;
var _sin = this.sin;
var _cos = this.cos;
var invert_transform = this.originalShape.invertTransform;
var _relative_x = invert_transform.TransformPointX(posX, posY);
var _relative_y = invert_transform.TransformPointY(posX, posY);
var _pos_x_relative_center = _relative_x - this.shapeHeight * 0.5;
var _pos_y_relative_center = _relative_y - this.shapeWidth * 0.5;
if (this.radiusFlag) {
var _radius = Math.sqrt(_pos_x_relative_center * _pos_x_relative_center + _pos_y_relative_center * _pos_y_relative_center);
var _new_radius = this.adjastment.minR + this.coeffR * (_radius - this.minRealR);
if (_new_radius <= this.maximalRealativeRadius && _new_radius >= this.minimalRealativeRadius) {
this.geometry.gdLst[this.adjastment.gdRefR] = _new_radius;
} else {
if (_new_radius > this.maximalRealativeRadius) {
this.geometry.gdLst[this.adjastment.gdRefR] = this.maximalRealativeRadius;
} else {
this.geometry.gdLst[this.adjastment.gdRefR] = this.minimalRealativeRadius;
}
}
}
if (this.angleFlag) {
var _angle = Math.atan2(_pos_y_relative_center, _pos_x_relative_center);
while (_angle < 0) {
_angle += 2 * Math.PI;
}
while (_angle >= 2 * Math.PI) {
_angle -= 2 * Math.PI;
}
_angle *= cToDeg;
if (_angle >= this.minimalAngle && _angle <= this.maximalAngle) {
this.geometry.gdLst[this.adjastment.gdRefAng] = _angle;
} else {
if (_angle >= this.maximalAngle) {
this.geometry.gdLst[this.adjastment.gdRefAng] = this.maximalAngle;
} else {
if (_angle <= this.minimalAngle) {
this.geometry.gdLst[this.adjastment.gdRefAng] = this.minimalAngle;
}
}
}
}
this.geometry.Recalculate(this.shapeWidth, this.shapeHeight);
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterParagraphAddUndo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateGeometry_Undo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Id, new UndoRedoDataShapeRecalc()), null);
this.originalShape.setAdjustmentValue(this.refR, this.geometry.gdLst[this.adjastment.gdRefR], this.refAng, this.geometry.gdLst[this.adjastment.gdRefAng]);
this.originalShape.recalculateGeometry();
this.originalShape.calculateContent();
this.originalShape.calculateTransformTextMatrix();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterParagraphAddRedo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateGeometry_Redo, null, null, new UndoRedoDataGraphicObjects(this.originalShape.Id, new UndoRedoDataShapeRecalc()), null);
};
}

View File

@@ -0,0 +1,330 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function MoveShapeImageTrack(originalObject) {
this.originalObject = originalObject;
this.transform = new CMatrix();
this.x = null;
this.y = null;
this.overlayObject = new OverlayObject(this.originalObject.spPr.geometry, this.originalObject.extX, this.originalObject.extY, this.originalObject.brush, this.originalObject.pen, this.transform);
this.getOriginalBoundsRect = function () {
return this.originalObject.getRectBounds();
};
this.track = function (dx, dy) {
var original = this.originalObject;
this.x = original.x + dx;
this.y = original.y + dy;
this.transform.Reset();
var hc = original.extX * 0.5;
var vc = original.extY * 0.5;
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if (original.flipH) {
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
}
if (original.flipV) {
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(this.transform, -original.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
};
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.setPosition(this.x, this.y);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.recalculateTransform();
this.originalObject.calculateTransformTextMatrix();
this.originalObject.updateDrawingBaseCoordinates();
};
}
function MoveShapeImageTrackInGroup(originalObject) {
this.originalObject = originalObject;
this.x = null;
this.y = null;
this.transform = new CMatrix();
var pen, brush;
if (! (typeof CChartAsGroup != "undefined" && this.originalObject instanceof CChartAsGroup)) {
pen = this.originalObject.pen;
brush = this.originalObject.brush;
} else {
brush = new CUniFill();
brush.fill = new CSolidFill();
brush.fill.color = new CUniColor();
brush.fill.color.RGBA = {
R: 255,
G: 255,
B: 255,
A: 255
};
brush.fill.color.color = new CRGBColor();
brush.fill.color.color.RGBA = {
R: 255,
G: 255,
B: 255,
A: 255
};
pen = new CLn();
pen.Fill = new CUniFill();
pen.Fill.fill = new CSolidFill();
pen.Fill.fill.color = new CUniColor();
pen.Fill.fill.color.color = new CRGBColor();
}
this.overlayObject = new OverlayObject(this.originalObject.spPr.geometry, this.originalObject.extX, this.originalObject.extY, brush, pen, this.transform);
this.inv = global_MatrixTransformer.Invert(originalObject.group.transform);
this.inv.tx = 0;
this.inv.ty = 0;
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
this.track = function (dx, dy) {
var dx_t = this.inv.TransformPointX(dx, dy);
var dy_t = this.inv.TransformPointY(dx, dy);
this.x = this.originalObject.x + dx_t;
this.y = this.originalObject.y + dy_t;
this.calculateTransform();
};
this.getOriginalBoundsRect = function () {
return this.originalObject.getRectBounds();
};
this.calculateTransform = function () {
var t = this.transform;
t.Reset();
global_MatrixTransformer.TranslateAppend(t, -this.originalObject.extX * 0.5, -this.originalObject.extY * 0.5);
if (this.originalObject.flipH) {
global_MatrixTransformer.ScaleAppend(t, -1, 1);
}
if (this.originalObject.flipV) {
global_MatrixTransformer.ScaleAppend(t, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(t, -this.originalObject.rot);
global_MatrixTransformer.TranslateAppend(t, this.x + this.originalObject.extX * 0.5, this.y + this.originalObject.extY * 0.5);
global_MatrixTransformer.MultiplyAppend(t, this.originalObject.group.getTransform());
};
this.trackEnd = function () {
var scale_scale_coefficients = this.originalObject.group.getResultScaleCoefficients();
var xfrm = this.originalObject.group.spPr.xfrm;
this.originalObject.setPosition(this.x / scale_scale_coefficients.cx + xfrm.chOffX, this.y / scale_scale_coefficients.cy + xfrm.chOffY);
this.originalObject.recalculateTransform();
this.originalObject.calculateTransformTextMatrix();
};
}
function MoveGroupTrack(originalObject) {
this.x = null;
this.y = null;
this.originalObject = originalObject;
this.transform = new CMatrix();
this.overlayObjects = [];
this.arrTransforms2 = [];
var arr_graphic_objects = originalObject.getArrGraphicObjects();
var group_invert_transform = originalObject.getInvertTransform();
for (var i = 0; i < arr_graphic_objects.length; ++i) {
var gr_obj_transform_copy = arr_graphic_objects[i].getTransform().CreateDublicate();
global_MatrixTransformer.MultiplyAppend(gr_obj_transform_copy, group_invert_transform);
this.arrTransforms2[i] = gr_obj_transform_copy;
var pen, brush;
if (! (typeof CChartAsGroup != "undefined" && arr_graphic_objects[i] instanceof CChartAsGroup)) {
pen = arr_graphic_objects[i].pen;
brush = arr_graphic_objects[i].brush;
} else {
brush = new CUniFill();
brush.fill = new CSolidFill();
brush.fill.color = new CUniColor();
brush.fill.color.RGBA = {
R: 255,
G: 255,
B: 255,
A: 255
};
brush.fill.color.color = new CRGBColor();
brush.fill.color.color.RGBA = {
R: 255,
G: 255,
B: 255,
A: 255
};
pen = new CLn();
pen.Fill = new CUniFill();
pen.Fill.fill = new CSolidFill();
pen.Fill.fill.color = new CUniColor();
pen.Fill.fill.color.color = new CRGBColor();
}
this.overlayObjects[i] = new OverlayObject(arr_graphic_objects[i].spPr.geometry, arr_graphic_objects[i].extX, arr_graphic_objects[i].extY, brush, pen, new CMatrix());
}
this.getOriginalBoundsRect = function () {
return this.originalObject.getRectBounds();
};
this.track = function (dx, dy) {
var original = this.originalObject;
this.x = original.x + dx;
this.y = original.y + dy;
this.transform.Reset();
var hc = original.extX * 0.5;
var vc = original.extY * 0.5;
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if (original.flipH) {
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
}
if (original.flipV) {
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(this.transform, -original.rot);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
for (var i = 0; i < this.overlayObjects.length; ++i) {
var new_transform = this.arrTransforms2[i].CreateDublicate();
global_MatrixTransformer.MultiplyAppend(new_transform, this.transform);
this.overlayObjects[i].updateTransformMatrix(new_transform);
}
};
this.draw = function (overlay) {
for (var i = 0; i < this.overlayObjects.length; ++i) {
this.overlayObjects[i].draw(overlay);
}
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.originalObject.setPosition(this.x, this.y);
this.originalObject.recalculate();
this.originalObject.updateDrawingBaseCoordinates();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
};
}
function MoveTitleInChart(originalObject) {
this.originalObject = originalObject;
this.x = null;
this.y = null;
this.transform = new CMatrix();
var pen = new CLn();
pen.Fill = new CUniFill();
pen.Fill.fill = new CSolidFill();
pen.Fill.fill.color = new CUniColor();
pen.Fill.fill.color.color = new CRGBColor();
this.overlayObject = new OverlayObject(this.originalObject.spPr.geometry, this.originalObject.extX, this.originalObject.extY, this.originalObject.brush, pen, this.transform);
this.inv = global_MatrixTransformer.Invert(originalObject.chartGroup.transform);
this.inv.tx = 0;
this.inv.ty = 0;
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
this.track = function (dx, dy) {
var dx_t = this.inv.TransformPointX(dx, dy);
var dy_t = this.inv.TransformPointY(dx, dy);
this.x = this.originalObject.x + dx_t;
this.y = this.originalObject.y + dy_t;
if (this.x + this.originalObject.extX > this.originalObject.chartGroup.extX) {
this.x = this.originalObject.chartGroup.extX - this.originalObject.extX;
}
if (this.x < 0) {
this.x = 0;
}
if (this.y + this.originalObject.extY > this.originalObject.chartGroup.extY) {
this.y = this.originalObject.chartGroup.extY - this.originalObject.extY;
}
if (this.y < 0) {
this.y = 0;
}
this.calculateTransform();
};
this.getOriginalBoundsRect = function () {
return this.originalObject.getRectBounds();
};
this.calculateTransform = function () {
var t = this.transform;
t.Reset();
global_MatrixTransformer.TranslateAppend(t, -this.originalObject.extX * 0.5, -this.originalObject.extY * 0.5);
global_MatrixTransformer.TranslateAppend(t, this.x + this.originalObject.extX * 0.5, this.y + this.originalObject.extY * 0.5);
global_MatrixTransformer.MultiplyAppend(t, this.originalObject.chartGroup.getTransform());
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.chartGroup.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.setPosition(this.x, this.y);
this.originalObject.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.chartGroup.Id, new UndoRedoDataShapeRecalc()), null);
};
}
function MoveTrackChart(originalObject) {
this.originalObject = originalObject;
this.transform = new CMatrix();
this.x = null;
this.y = null;
var geometry = CreateGeometry("rect");
geometry.Init(this.originalObject.extX, this.originalObject.extY);
geometry.Recalculate(this.originalObject.extX, this.originalObject.extY);
var brush = new CUniFill();
brush.fill = new CSolidFill();
brush.fill.color = new CUniColor();
brush.fill.color.RGBA = {
R: 255,
G: 255,
B: 255,
A: 255
};
brush.fill.color.color = new CRGBColor();
brush.fill.color.color.RGBA = {
R: 255,
G: 255,
B: 255,
A: 255
};
var pen = new CLn();
pen.Fill = new CUniFill();
pen.Fill.fill = new CSolidFill();
pen.Fill.fill.color = new CUniColor();
pen.Fill.fill.color.color = new CRGBColor();
this.overlayObject = new OverlayObject(this.originalObject.spPr.geometry, this.originalObject.extX, this.originalObject.extY, brush, pen, this.transform);
this.getOriginalBoundsRect = function () {
return this.originalObject.getRectBounds();
};
this.track = function (dx, dy) {
var original = this.originalObject;
this.x = original.x + dx;
this.y = original.y + dy;
this.transform.Reset();
var hc = original.extX * 0.5;
var vc = original.extY * 0.5;
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
};
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.x = this.x;
this.originalObject.y = this.y;
this.originalObject.updateDrawingBaseCoordinates();
this.originalObject.setPosition(this.x, this.y);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.recalculateTransform();
this.originalObject.calculateTransformTextMatrix();
};
}

View File

@@ -0,0 +1,344 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function NewShapeTrack(drawingObjects, presetGeom, startX, startY) {
this.drawingObjects = drawingObjects;
this.presetGeom = presetGeom;
this.startX = startX;
this.startY = startY;
this.headEnd = false;
this.tailEnd = false;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.flipH = null;
this.flipV = null;
this.transform = new CMatrix();
var theme = drawingObjects.getWorkbook().theme;
var color_map = GenerateDefaultColorMap().color_map;
var style;
if (presetGeom !== "textRect") {
style = CreateDefaultShapeStyle();
} else {
style = CreateDefaultTextRectStyle();
}
var brush = theme.getFillStyle(style.fillRef.idx);
style.fillRef.Color.Calculate(theme, color_map, {
R: 0,
G: 0,
B: 0,
A: 255
});
var RGBA = style.fillRef.Color.RGBA;
if (style.fillRef.Color.color != null) {
if (brush.fill != null && (brush.fill.type == FILL_TYPE_SOLID || brush.fill.type == FILL_TYPE_GRAD)) {
brush.fill.color = style.fillRef.Color.createDuplicate();
}
}
var pen = theme.getLnStyle(style.lnRef.idx);
style.lnRef.Color.Calculate(theme, color_map, {
R: 0,
G: 0,
B: 0,
A: 255
});
RGBA = style.lnRef.Color.RGBA;
var final_preset = presetGeom;
var sPreset = presetGeom;
switch (sPreset) {
case "lineWithArrow":
final_preset = "line";
this.tailEnd = true;
break;
case "lineWithTwoArrows":
final_preset = "line";
this.tailEnd = true;
this.headEnd = true;
break;
case "bentConnector5WithArrow":
final_preset = "bentConnector5";
this.tailEnd = true;
break;
case "bentConnector5WithTwoArrows":
final_preset = "bentConnector5";
this.tailEnd = true;
this.headEnd = true;
break;
case "curvedConnector3WithArrow":
final_preset = "curvedConnector3";
this.tailEnd = true;
break;
case "curvedConnector3WithTwoArrows":
final_preset = "curvedConnector3";
this.tailEnd = true;
this.headEnd = true;
break;
case "textRect":
final_preset = "rect";
break;
default:
final_preset = sPreset;
break;
}
if (presetGeom === "textRect") {
if (presetGeom === "textRect") {
var ln, fill;
ln = new CLn();
ln.w = 6350;
ln.Fill = new CUniFill();
ln.Fill.fill = new CSolidFill();
ln.Fill.fill.color = new CUniColor();
ln.Fill.fill.color.color = new CPrstColor();
ln.Fill.fill.color.color.id = "black";
fill = new CUniFill();
fill.fill = new CSolidFill();
fill.fill.color = new CUniColor();
fill.fill.color.color = new CSchemeColor();
fill.fill.color.color.id = 12;
pen.merge(ln);
brush.merge(fill);
}
} else {
if (this.tailEnd || this.headEnd) {
var ln;
ln = new CLn();
if (this.tailEnd) {
ln.tailEnd = new EndArrow();
ln.tailEnd.type = LineEndType.Arrow;
ln.tailEnd.len = LineEndSize.Mid;
}
if (this.headEnd) {
ln.headEnd = new EndArrow();
ln.headEnd.type = LineEndType.Arrow;
ln.headEnd.len = LineEndSize.Mid;
}
pen.merge(ln);
}
}
pen.Fill.calculate(theme, color_map, RGBA);
brush.calculate(theme, color_map, RGBA);
this.finalPreset = final_preset;
var geometry = CreateGeometry(final_preset);
geometry.Init(5, 5);
this.overlayObject = new OverlayObject(geometry, 5, 5, brush, pen, this.transform);
this.lineFlag = CheckLinePreset(final_preset);
this.isLine = this.lineFlag;
this.track = function (e, x, y) {
this.flipH = false;
this.flipV = false;
var real_dist_x = x - this.startX;
var abs_dist_x = Math.abs(real_dist_x);
var real_dist_y = y - this.startY;
var abs_dist_y = Math.abs(real_dist_y);
if (this.isLine) {
if (x < this.startX) {
this.flipH = true;
}
if (y < this.startY) {
this.flipV = true;
}
}
if (! (e.ctrlKey || e.shiftKey) || (e.CtrlKey && !e.ShiftKey && this.isLine)) {
this.extX = abs_dist_x >= MIN_SHAPE_SIZE ? abs_dist_x : (this.isLine ? 0 : MIN_SHAPE_SIZE);
this.extY = abs_dist_y >= MIN_SHAPE_SIZE ? abs_dist_y : (this.isLine ? 0 : MIN_SHAPE_SIZE);
if (real_dist_x >= 0) {
this.x = this.startX;
} else {
this.x = abs_dist_x >= MIN_SHAPE_SIZE ? x : this.startX - this.extX;
}
if (real_dist_y >= 0) {
this.y = this.startY;
} else {
this.y = abs_dist_y >= MIN_SHAPE_SIZE ? y : this.startY - this.extY;
}
} else {
if (e.ctrlKey && !e.shiftKey) {
if (abs_dist_x >= MIN_SHAPE_SIZE_DIV2) {
this.x = this.startX - abs_dist_x;
this.extX = 2 * abs_dist_x;
} else {
this.x = this.startX - MIN_SHAPE_SIZE_DIV2;
this.extX = MIN_SHAPE_SIZE;
}
if (abs_dist_y >= MIN_SHAPE_SIZE_DIV2) {
this.y = this.startY - abs_dist_y;
this.extY = 2 * abs_dist_y;
} else {
this.y = this.startY - MIN_SHAPE_SIZE_DIV2;
this.extY = MIN_SHAPE_SIZE;
}
} else {
if (!e.ctrlKey && e.shiftKey) {
var new_width, new_height;
var prop_coefficient = (typeof SHAPE_ASPECTS[this.presetGeom] === "number" ? SHAPE_ASPECTS[this.presetGeom] : 1);
if (abs_dist_y === 0) {
new_width = abs_dist_x > MIN_SHAPE_SIZE ? abs_dist_x : MIN_SHAPE_SIZE;
new_height = abs_dist_x / prop_coefficient;
} else {
var new_aspect = abs_dist_x / abs_dist_y;
if (new_aspect >= prop_coefficient) {
new_width = abs_dist_x;
new_height = abs_dist_x / prop_coefficient;
} else {
new_height = abs_dist_y;
new_width = abs_dist_y * prop_coefficient;
}
}
if (new_width < MIN_SHAPE_SIZE || new_height < MIN_SHAPE_SIZE) {
var k_wh = new_width / new_height;
if (new_height < MIN_SHAPE_SIZE && new_width < MIN_SHAPE_SIZE) {
if (new_height < new_width) {
new_height = MIN_SHAPE_SIZE;
new_width = new_height * k_wh;
} else {
new_width = MIN_SHAPE_SIZE;
new_height = new_width / k_wh;
}
} else {
if (new_height < MIN_SHAPE_SIZE) {
new_height = MIN_SHAPE_SIZE;
new_width = new_height * k_wh;
} else {
new_width = MIN_SHAPE_SIZE;
new_height = new_width / k_wh;
}
}
}
this.extX = new_width;
this.extY = new_height;
if (real_dist_x >= 0) {
this.x = this.startX;
} else {
this.x = this.startX - this.extX;
}
if (real_dist_y >= 0) {
this.y = this.startY;
} else {
this.y = this.startY - this.extY;
}
if (this.isLine) {
var angle = Math.atan2(real_dist_y, real_dist_x);
if (angle >= 0 && angle <= Math.PI / 8 || angle <= 0 && angle >= -Math.PI / 8 || angle >= 7 * Math.PI / 8 && angle <= Math.PI) {
this.extY = 0;
this.y = this.startY;
} else {
if (angle >= 3 * Math.PI / 8 && angle <= 5 * Math.PI / 8 || angle <= -3 * Math.PI / 8 && angle >= -5 * Math.PI / 8) {
this.extX = 0;
this.x = this.startX;
}
}
}
} else {
var new_width, new_height;
var prop_coefficient = (typeof SHAPE_ASPECTS[this.presetGeom] === "number" ? SHAPE_ASPECTS[this.presetGeom] : 1);
if (abs_dist_y === 0) {
new_width = abs_dist_x > MIN_SHAPE_SIZE_DIV2 ? abs_dist_x * 2 : MIN_SHAPE_SIZE;
new_height = new_width / prop_coefficient;
} else {
var new_aspect = abs_dist_x / abs_dist_y;
if (new_aspect >= prop_coefficient) {
new_width = abs_dist_x * 2;
new_height = new_width / prop_coefficient;
} else {
new_height = abs_dist_y * 2;
new_width = new_height * prop_coefficient;
}
}
if (new_width < MIN_SHAPE_SIZE || new_height < MIN_SHAPE_SIZE) {
var k_wh = new_width / new_height;
if (new_height < MIN_SHAPE_SIZE && new_width < MIN_SHAPE_SIZE) {
if (new_height < new_width) {
new_height = MIN_SHAPE_SIZE;
new_width = new_height * k_wh;
} else {
new_width = MIN_SHAPE_SIZE;
new_height = new_width / k_wh;
}
} else {
if (new_height < MIN_SHAPE_SIZE) {
new_height = MIN_SHAPE_SIZE;
new_width = new_height * k_wh;
} else {
new_width = MIN_SHAPE_SIZE;
new_height = new_width / k_wh;
}
}
}
this.extX = new_width;
this.extY = new_height;
this.x = this.startX - this.extX * 0.5;
this.y = this.startY - this.extY * 0.5;
}
}
}
this.overlayObject.updateExtents(this.extX, this.extY);
this.transform.Reset();
var hc = this.extX * 0.5;
var vc = this.extY * 0.5;
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if (this.flipH) {
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
}
if (this.flipV) {
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
}
global_MatrixTransformer.TranslateAppend(this.transform, this.x + hc, this.y + vc);
};
this.ctrlDown = function () {};
this.shiftDown = function () {};
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
this.trackEnd = function () {
var shape = new CShape(null, this.drawingObjects);
if (this.presetGeom !== "textRect") {
shape.initDefault(this.x, this.y, this.extX, this.extY, this.flipH === true, this.flipV === true, this.finalPreset, this.tailEnd, this.headEnd);
} else {
shape.initDefaultTextRect(this.x, this.y, this.extX, this.extY, false, false);
}
shape.select(this.drawingObjects.controller);
this.drawingObjects.controller.curState.resultObject = shape;
var bounds_rect = shape.getRectBounds();
var check_position = shape.drawingObjects.checkGraphicObjectPosition(bounds_rect.minX, bounds_rect.minY, bounds_rect.maxX - bounds_rect.minX, bounds_rect.maxY - bounds_rect.minY);
if (!check_position.result) {
shape.setPosition(this.x + check_position.x, this.y + check_position.y);
shape.recalculateTransform();
shape.calculateContent();
shape.calculateTransformTextMatrix();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterInit, null, null, new UndoRedoDataGraphicObjects(shape.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
shape.addToDrawingObjects();
};
}
function CheckLinePreset(preset) {
return preset === "line";
}

View File

@@ -0,0 +1,191 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function PolyLine(drawingObjects) {
this.drawingObjects = drawingObjects;
this.arrPoint = [];
this.Matrix = new CMatrixL();
this.TransformMatrix = new CMatrixL();
this.style = CreateDefaultShapeStyle();
var _calculated_line;
var wb = this.drawingObjects.getWorkbook();
var _theme = wb.theme;
var colorMap = GenerateDefaultColorMap().color_map;
var RGBA = {
R: 0,
G: 0,
B: 0,
A: 255
};
if (isRealObject(_theme) && typeof _theme.getLnStyle === "function" && isRealObject(this.style) && isRealObject(this.style.lnRef) && isRealNumber(this.style.lnRef.idx) && isRealObject(this.style.lnRef.Color) && typeof this.style.lnRef.Color.Calculate === "function") {
_calculated_line = _theme.getLnStyle(this.style.lnRef.idx);
this.style.lnRef.Color.Calculate(_theme, colorMap, {
R: 0,
G: 0,
B: 0,
A: 255
});
RGBA = this.style.lnRef.Color.RGBA;
} else {
_calculated_line = new CLn();
}
if (isRealObject(_calculated_line.Fill)) {
_calculated_line.Fill.calculate(_theme, colorMap, RGBA);
}
this.pen = _calculated_line;
this.polylineForDrawer = new PolylineForDrawer(this);
this.Draw = function (graphics) {
graphics.SetIntegerGrid(false);
graphics.transform3(this.Matrix);
var shape_drawer = new CShapeDrawer();
shape_drawer.fromShape(this, graphics);
shape_drawer.draw(this);
};
this.draw = function (g) {
this.polylineForDrawer.Draw(g);
return;
if (this.arrPoint.length < 2) {
return;
}
g._m(this.arrPoint[0].x, this.arrPoint[0].y);
for (var i = 1; i < this.arrPoint.length; ++i) {
g._l(this.arrPoint[i].x, this.arrPoint[i].y);
}
g.ds();
};
this.getLeftTopPoint = function () {
if (this.arrPoint.length < 1) {
return {
x: 0,
y: 0
};
}
var xMax = this.arrPoint[0].x,
yMax = this.arrPoint[0].y,
xMin = xMax,
yMin = yMax;
var i;
for (i = 1; i < this.arrPoint.length; ++i) {
if (this.arrPoint[i].x > xMax) {
xMax = this.arrPoint[i].x;
}
if (this.arrPoint[i].y > yMax) {
yMax = this.arrPoint[i].y;
}
if (this.arrPoint[i].x < xMin) {
xMin = this.arrPoint[i].x;
}
if (this.arrPoint[i].y < yMin) {
yMin = this.arrPoint[i].y;
}
}
return {
x: xMin,
y: yMin
};
};
this.createShape = function (document) {
var xMax = this.arrPoint[0].x,
yMax = this.arrPoint[0].y,
xMin = xMax,
yMin = yMax;
var i;
var bClosed = false;
if (this.arrPoint.length > 2) {
var dx = this.arrPoint[0].x - this.arrPoint[this.arrPoint.length - 1].x;
var dy = this.arrPoint[0].y - this.arrPoint[this.arrPoint.length - 1].y;
if (Math.sqrt(dx * dx + dy * dy) < this.drawingObjects.convertMetric(3, 0, 3)) {
bClosed = true;
}
}
var _n = bClosed ? this.arrPoint.length - 1 : this.arrPoint.length;
for (i = 1; i < _n; ++i) {
if (this.arrPoint[i].x > xMax) {
xMax = this.arrPoint[i].x;
}
if (this.arrPoint[i].y > yMax) {
yMax = this.arrPoint[i].y;
}
if (this.arrPoint[i].x < xMin) {
xMin = this.arrPoint[i].x;
}
if (this.arrPoint[i].y < yMin) {
yMin = this.arrPoint[i].y;
}
}
var shape = new CShape(null, this.drawingObjects);
shape.setXfrmObject(new CXfrm());
shape.setPosition(xMin, yMin);
shape.setExtents(xMax - xMin, yMax - yMin);
shape.setStyleBinary(CreateDefaultShapeStyle());
var geometry = new CGeometry();
geometry.AddPathCommand(0, undefined, bClosed ? "norm" : "none", undefined, xMax - xMin, yMax - yMin);
geometry.AddRect("l", "t", "r", "b");
geometry.AddPathCommand(1, (this.arrPoint[0].x - xMin) + "", (this.arrPoint[0].y - yMin) + "");
for (i = 1; i < _n; ++i) {
geometry.AddPathCommand(2, (this.arrPoint[i].x - xMin) + "", (this.arrPoint[i].y - yMin) + "");
}
if (bClosed) {
geometry.AddPathCommand(6);
}
geometry.Init(xMax - xMin, yMax - yMin);
shape.setGeometry(geometry);
shape.recalculate();
shape.addToDrawingObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterInit, null, null, new UndoRedoDataGraphicObjects(shape.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
return shape;
};
}
function PolylineForDrawer(polyline) {
this.polyline = polyline;
this.pen = polyline.pen;
this.brush = polyline.brush;
this.TransformMatrix = polyline.TransformMatrix;
this.Matrix = polyline.Matrix;
this.Draw = function (graphics) {
graphics.SetIntegerGrid(false);
graphics.transform3(this.Matrix);
var shape_drawer = new CShapeDrawer();
shape_drawer.fromShape(this, graphics);
shape_drawer.draw(this);
};
this.draw = function (g) {
g._e();
if (this.polyline.arrPoint.length < 2) {
return;
}
g._m(this.polyline.arrPoint[0].x, this.polyline.arrPoint[0].y);
for (var i = 1; i < this.polyline.arrPoint.length; ++i) {
g._l(this.polyline.arrPoint[i].x, this.polyline.arrPoint[i].y);
}
g.ds();
};
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,257 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
function OverlayObject(geometry, extX, extY, brush, pen, transform) {
this.geometry = geometry;
this.ext = {};
this.ext.cx = extX;
this.ext.cy = extY;
this.brush = brush;
this.pen = pen;
this.TransformMatrix = transform;
this.shapeDrawer = new CShapeDrawer();
this.updateTransform = function (extX, extY, transform) {
this.ext.cx = extX;
this.ext.cy = extY;
this.transform = transform;
};
this.updateExtents = function (extX, extY) {
this.ext.cx = extX;
this.ext.cy = extY;
this.geometry.Recalculate(extX, extY);
};
this.updateTransformMatrix = function (transform) {
this.TransformMatrix = transform;
};
this.draw = function (overlay) {
overlay.SaveGrState();
overlay.SetIntegerGrid(false);
overlay.transform3(this.TransformMatrix, false);
this.shapeDrawer.fromShape2(this, overlay, this.geometry);
this.shapeDrawer.draw(this.geometry);
overlay.RestoreGrState();
};
this.check_bounds = function (boundsChecker) {
if (this.geometry) {
this.geometry.check_bounds(boundsChecker);
} else {
boundsChecker._s();
boundsChecker._m(0, 0);
boundsChecker._l(this.ext.cx, 0);
boundsChecker._l(this.ext.cx, this.ext.cy);
boundsChecker._l(0, this.ext.cy);
boundsChecker._z();
boundsChecker._e();
}
};
}
function RotateTrackShapeImage(originalObject) {
this.originalObject = originalObject;
this.transform = originalObject.transform.CreateDublicate();
this.overlayObject = new OverlayObject(originalObject.spPr.geometry, originalObject.extX, originalObject.extY, originalObject.brush, originalObject.pen, this.transform);
this.angle = originalObject.rot;
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
this.track = function (angle, e) {
var new_rot = angle + this.originalObject.rot;
while (new_rot < 0) {
new_rot += 2 * Math.PI;
}
while (new_rot >= 2 * Math.PI) {
new_rot -= 2 * Math.PI;
}
if (new_rot < MIN_ANGLE || new_rot > 2 * Math.PI - MIN_ANGLE) {
new_rot = 0;
}
if (Math.abs(new_rot - Math.PI * 0.5) < MIN_ANGLE) {
new_rot = Math.PI * 0.5;
}
if (Math.abs(new_rot - Math.PI) < MIN_ANGLE) {
new_rot = Math.PI;
}
if (Math.abs(new_rot - 1.5 * Math.PI) < MIN_ANGLE) {
new_rot = 1.5 * Math.PI;
}
if (e.shiftKey) {
new_rot = (Math.PI / 12) * Math.floor(12 * new_rot / (Math.PI));
}
this.angle = new_rot;
var hc, vc;
hc = this.originalObject.extX * 0.5;
vc = this.originalObject.extY * 0.5;
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if (this.originalObject.flipH) {
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
}
if (this.originalObject.flipV) {
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(this.transform, -this.angle);
global_MatrixTransformer.TranslateAppend(this.transform, this.originalObject.x + hc, this.originalObject.y + vc);
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.setRotate(this.angle);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.recalculateTransform();
this.originalObject.calculateContent();
this.originalObject.calculateTransformTextMatrix();
};
}
function RotateTrackShapeImageInGroup(originalObject) {
this.originalObject = originalObject;
this.transform = originalObject.transform.CreateDublicate();
this.overlayObject = new OverlayObject(originalObject.spPr.geometry, originalObject.extX, originalObject.extY, originalObject.brush, originalObject.pen, this.transform);
this.angle = originalObject.rot;
var full_flip_h = this.originalObject.getFullFlipH();
var full_flip_v = this.originalObject.getFullFlipV();
this.signum = !full_flip_h && !full_flip_v || full_flip_h && full_flip_v ? 1 : -1;
this.draw = function (overlay) {
this.overlayObject.draw(overlay);
};
this.track = function (angle, e) {
var new_rot = this.signum * angle + this.originalObject.rot;
while (new_rot < 0) {
new_rot += 2 * Math.PI;
}
while (new_rot >= 2 * Math.PI) {
new_rot -= 2 * Math.PI;
}
if (new_rot < MIN_ANGLE || new_rot > 2 * Math.PI - MIN_ANGLE) {
new_rot = 0;
}
if (Math.abs(new_rot - Math.PI * 0.5) < MIN_ANGLE) {
new_rot = Math.PI * 0.5;
}
if (Math.abs(new_rot - Math.PI) < MIN_ANGLE) {
new_rot = Math.PI;
}
if (Math.abs(new_rot - 1.5 * Math.PI) < MIN_ANGLE) {
new_rot = 1.5 * Math.PI;
}
if (e.shiftKey) {
new_rot = (Math.PI / 12) * Math.floor(12 * new_rot / (Math.PI));
}
this.angle = new_rot;
var hc, vc;
hc = this.originalObject.extX * 0.5;
vc = this.originalObject.extY * 0.5;
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if (this.originalObject.flipH) {
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
}
if (this.originalObject.flipV) {
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(this.transform, -this.angle);
global_MatrixTransformer.TranslateAppend(this.transform, this.originalObject.x + hc, this.originalObject.y + vc);
global_MatrixTransformer.MultiplyAppend(this.transform, this.originalObject.group.getTransform());
};
this.trackEnd = function () {
this.originalObject.setRotate(this.angle);
this.originalObject.recalculateTransform();
this.originalObject.calculateContent();
this.originalObject.calculateTransformTextMatrix();
};
}
function RotateTrackGroup(originalObject) {
this.originalObject = originalObject;
this.transform = originalObject.transform.CreateDublicate();
this.overlayObjects = [];
this.arrTransforms = [];
this.arrTransforms2 = [];
var arr_graphic_objects = originalObject.getArrGraphicObjects();
var group_invert_transform = originalObject.getInvertTransform();
for (var i = 0; i < arr_graphic_objects.length; ++i) {
var gr_obj_transform_copy = arr_graphic_objects[i].getTransform().CreateDublicate();
global_MatrixTransformer.MultiplyAppend(gr_obj_transform_copy, group_invert_transform);
this.arrTransforms2[i] = gr_obj_transform_copy;
this.overlayObjects[i] = new OverlayObject(arr_graphic_objects[i].spPr.geometry, arr_graphic_objects[i].extX, arr_graphic_objects[i].extY, arr_graphic_objects[i].brush, arr_graphic_objects[i].pen, arr_graphic_objects[i].transform.CreateDublicate());
}
this.angle = originalObject.rot;
this.draw = function (overlay) {
for (var i = 0; i < this.overlayObjects.length; ++i) {
this.overlayObjects[i].draw(overlay);
}
};
this.track = function (angle, e) {
var new_rot = angle + this.originalObject.rot;
while (new_rot < 0) {
new_rot += 2 * Math.PI;
}
while (new_rot >= 2 * Math.PI) {
new_rot -= 2 * Math.PI;
}
if (new_rot < MIN_ANGLE || new_rot > 2 * Math.PI - MIN_ANGLE) {
new_rot = 0;
}
if (Math.abs(new_rot - Math.PI * 0.5) < MIN_ANGLE) {
new_rot = Math.PI * 0.5;
}
if (Math.abs(new_rot - Math.PI) < MIN_ANGLE) {
new_rot = Math.PI;
}
if (Math.abs(new_rot - 1.5 * Math.PI) < MIN_ANGLE) {
new_rot = 1.5 * Math.PI;
}
if (e.shiftKey) {
new_rot = (Math.PI / 12) * Math.floor(12 * new_rot / (Math.PI));
}
this.angle = new_rot;
var hc, vc;
hc = this.originalObject.extX * 0.5;
vc = this.originalObject.extY * 0.5;
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, -hc, -vc);
if (this.originalObject.flipH) {
global_MatrixTransformer.ScaleAppend(this.transform, -1, 1);
}
if (this.originalObject.flipV) {
global_MatrixTransformer.ScaleAppend(this.transform, 1, -1);
}
global_MatrixTransformer.RotateRadAppend(this.transform, -this.angle);
global_MatrixTransformer.TranslateAppend(this.transform, this.originalObject.x + hc, this.originalObject.y + vc);
for (var i = 0; i < this.overlayObjects.length; ++i) {
var new_transform = this.arrTransforms2[i].CreateDublicate();
global_MatrixTransformer.MultiplyAppend(new_transform, this.transform);
this.overlayObjects[i].updateTransformMatrix(new_transform);
}
};
this.trackEnd = function () {
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
this.originalObject.setRotate(this.angle);
this.originalObject.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
};
}

View File

@@ -0,0 +1,329 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var K = 1 / 4;
var mt = 0,
lt = 1,
cb = 2,
cl = 3;
function SplineCommandMoveTo(x, y) {
this.id = 0;
this.x = x;
this.y = y;
}
function SplineCommandLineTo(x, y) {
this.id = 1;
this.x = x;
this.y = y;
this.changeLastPoint = function (x, y) {
this.x = x;
this.y = y;
};
}
function SplineCommandBezier(x1, y1, x2, y2, x3, y3) {
this.id = 2;
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.x3 = x3;
this.y3 = y3;
this.changeLastPoint = function (x, y) {
this.x3 = x;
this.y3 = y;
this.x2 = this.x1 + (this.x3 - this.x1) * 0.5;
this.y2 = this.y1 + (this.y3 - this.y1) * 0.5;
};
}
function Spline(drawingObjects) {
this.path = [];
this.drawingObjects = drawingObjects;
this.Matrix = new CMatrix();
this.TransformMatrix = new CMatrix();
this.style = CreateDefaultShapeStyle();
var _calculated_line;
var _theme = drawingObjects.getWorkbook().theme;
var colorMap = GenerateDefaultColorMap().color_map;
var RGBA = {
R: 0,
G: 0,
B: 0,
A: 255
};
if (isRealObject(_theme) && typeof _theme.getLnStyle === "function" && isRealObject(this.style) && isRealObject(this.style.lnRef) && isRealNumber(this.style.lnRef.idx) && isRealObject(this.style.lnRef.Color) && typeof this.style.lnRef.Color.Calculate === "function") {
_calculated_line = _theme.getLnStyle(this.style.lnRef.idx);
this.style.lnRef.Color.Calculate(_theme, colorMap, {
R: 0,
G: 0,
B: 0,
A: 255
});
RGBA = this.style.lnRef.Color.RGBA;
} else {
_calculated_line = new CLn();
}
if (isRealObject(_calculated_line.Fill)) {
_calculated_line.Fill.calculate(_theme, colorMap, RGBA);
}
this.pen = _calculated_line;
this.splineForDraw = new SplineForDrawer(this);
this.Draw = function (graphics) {
graphics.SetIntegerGrid(false);
graphics.transform3(this.Matrix);
var shape_drawer = new CShapeDrawer();
shape_drawer.fromShape(this, graphics);
shape_drawer.draw(this);
};
this.draw = function (g) {
this.splineForDraw.Draw(g);
return;
for (var i = 0; i < this.path.length; ++i) {
var lastX, lastY;
switch (this.path[i].id) {
case 0:
g._m(this.path[i].x, this.path[i].y);
lastX = this.path[i].x;
lastY = this.path[i].y;
break;
case 1:
g._l(this.path[i].x, this.path[i].y);
lastX = this.path[i].x;
lastY = this.path[i].y;
break;
case 2:
g._c(this.path[i].x1, this.path[i].y1, this.path[i].x2, this.path[i].y2, this.path[i].x3, this.path[i].y3);
lastX = this.path[i].x3;
lastY = this.path[i].y3;
break;
}
}
g.ds();
};
this.getLeftTopPoint = function () {
if (this.path.length < 1) {
return {
x: 0,
y: 0
};
}
var min_x = this.path[0].x;
var max_x = min_x;
var min_y = this.path[0].y;
var max_y = min_y;
var last_x = this.path[0].x,
last_y = this.path[0].y;
for (var index = 1; index < this.path.length; ++index) {
var path_command = this.path[index];
if (path_command.id === 1) {
if (min_x > path_command.x) {
min_x = path_command.x;
}
if (max_x < path_command.x) {
max_x = path_command.x;
}
if (min_y > path_command.y) {
min_y = path_command.y;
}
if (max_y < path_command.y) {
max_y = path_command.y;
}
} else {
var bezier_polygon = partition_bezier4(last_x, last_y, path_command.x1, path_command.y1, path_command.x2, path_command.y2, path_command.x3, path_command.y3, APPROXIMATE_EPSILON);
for (var point_index = 1; point_index < bezier_polygon.length; ++point_index) {
var cur_point = bezier_polygon[point_index];
if (min_x > cur_point.x) {
min_x = cur_point.x;
}
if (max_x < cur_point.x) {
max_x = cur_point.x;
}
if (min_y > cur_point.y) {
min_y = cur_point.y;
}
if (max_y < cur_point.y) {
max_y = cur_point.y;
}
}
}
}
return {
x: min_x,
y: min_y
};
};
this.createShape = function (drawingObjects) {
var xMax = this.path[0].x,
yMax = this.path[0].y,
xMin = xMax,
yMin = yMax;
var i;
var bClosed = false;
if (this.path.length > 2) {
var dx = this.path[0].x - this.path[this.path.length - 1].x3;
var dy = this.path[0].y - this.path[this.path.length - 1].y3;
if (Math.sqrt(dx * dx + dy * dy) < 3) {
bClosed = true;
this.path[this.path.length - 1].x3 = this.path[0].x;
this.path[this.path.length - 1].y3 = this.path[0].y;
if (this.path.length > 3) {
var vx = (this.path[1].x3 - this.path[this.path.length - 2].x3) / 6;
var vy = (this.path[1].y3 - this.path[this.path.length - 2].y3) / 6;
} else {
vx = -(this.path[1].y3 - this.path[0].y) / 6;
vy = (this.path[1].x3 - this.path[0].x) / 6;
}
this.path[1].x1 = this.path[0].x + vx;
this.path[1].y1 = this.path[0].y + vy;
this.path[this.path.length - 1].x2 = this.path[0].x - vx;
this.path[this.path.length - 1].y2 = this.path[0].y - vy;
}
}
var min_x = this.path[0].x;
var max_x = min_x;
var min_y = this.path[0].y;
var max_y = min_y;
var last_x = this.path[0].x,
last_y = this.path[0].y;
for (var index = 1; index < this.path.length; ++index) {
var path_command = this.path[index];
if (path_command.id === 1) {
if (min_x > path_command.x) {
min_x = path_command.x;
}
if (max_x < path_command.x) {
max_x = path_command.x;
}
if (min_y > path_command.y) {
min_y = path_command.y;
}
if (max_y < path_command.y) {
max_y = path_command.y;
}
last_x = path_command.x;
last_y = path_command.y;
} else {
var bezier_polygon = partition_bezier4(last_x, last_y, path_command.x1, path_command.y1, path_command.x2, path_command.y2, path_command.x3, path_command.y3, APPROXIMATE_EPSILON);
for (var point_index = 1; point_index < bezier_polygon.length; ++point_index) {
var cur_point = bezier_polygon[point_index];
if (min_x > cur_point.x) {
min_x = cur_point.x;
}
if (max_x < cur_point.x) {
max_x = cur_point.x;
}
if (min_y > cur_point.y) {
min_y = cur_point.y;
}
if (max_y < cur_point.y) {
max_y = cur_point.y;
}
last_x = path_command.x3;
last_y = path_command.y3;
}
}
}
xMin = min_x;
xMax = max_x;
yMin = min_y;
yMax = max_y;
var shape = new CShape(null, this.drawingObjects);
shape.setXfrmObject(new CXfrm());
shape.setPosition(xMin, yMin);
shape.setExtents(xMax - xMin, yMax - yMin);
shape.setStyleBinary(CreateDefaultShapeStyle());
var geometry = new CGeometry();
geometry.AddPathCommand(0, undefined, bClosed ? "norm" : "none", undefined, xMax - xMin, yMax - yMin);
geometry.AddRect("l", "t", "r", "b");
for (i = 0; i < this.path.length; ++i) {
switch (this.path[i].id) {
case 0:
geometry.AddPathCommand(1, (this.path[i].x - xMin) + "", (this.path[i].y - yMin) + "");
break;
case 1:
geometry.AddPathCommand(2, (this.path[i].x - xMin) + "", (this.path[i].y - yMin) + "");
break;
case 2:
geometry.AddPathCommand(5, (this.path[i].x1 - xMin) + "", (this.path[i].y1 - yMin) + "", (this.path[i].x2 - xMin) + "", (this.path[i].y2 - yMin) + "", (this.path[i].x3 - xMin) + "", (this.path[i].y3 - yMin) + "");
break;
}
}
if (bClosed) {
geometry.AddPathCommand(6);
}
geometry.Init(xMax - xMin, yMax - yMin);
shape.setGeometry(geometry);
shape.recalculate();
shape.addToDrawingObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterInit, null, null, new UndoRedoDataGraphicObjects(shape.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
return shape;
};
this.addPathCommand = function (pathCommand) {
this.path.push(pathCommand);
};
}
function SplineForDrawer(spline) {
this.spline = spline;
this.pen = spline.pen;
this.brush = spline.brush;
this.TransformMatrix = spline.TransformMatrix;
this.Matrix = spline.Matrix;
this.Draw = function (graphics) {
graphics.SetIntegerGrid(false);
graphics.transform3(this.Matrix);
var shape_drawer = new CShapeDrawer();
shape_drawer.fromShape(this, graphics);
shape_drawer.draw(this);
};
this.draw = function (g) {
g._e();
for (var i = 0; i < this.spline.path.length; ++i) {
var lastX, lastY;
switch (this.spline.path[i].id) {
case 0:
g._m(this.spline.path[i].x, this.spline.path[i].y);
lastX = this.spline.path[i].x;
lastY = this.spline.path[i].y;
break;
case 1:
g._l(this.spline.path[i].x, this.spline.path[i].y);
lastX = this.spline.path[i].x;
lastY = this.spline.path[i].y;
break;
case 2:
g._c(this.spline.path[i].x1, this.spline.path[i].y1, this.spline.path[i].x2, this.spline.path[i].y2, this.spline.path[i].x3, this.spline.path[i].y3);
lastX = this.spline.path[i].x3;
lastY = this.spline.path[i].y3;
break;
}
}
g.ds();
};
}