3.0 source code
This commit is contained in:
2229
OfficeWeb/sdk/PowerPoint/Editor/Format/Chart.js
vendored
2229
OfficeWeb/sdk/PowerPoint/Editor/Format/Chart.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
* (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;
|
||||
}
|
||||
CChartLayout.prototype = {
|
||||
createDuplicate: function () {
|
||||
var ret = new CChartLayout();
|
||||
this.isManual = false;
|
||||
ret.layoutTarget = this.layoutTarget;
|
||||
ret.xMode = this.xMode;
|
||||
ret.yMode = this.yMode;
|
||||
ret.wMode = this.wMode;
|
||||
ret.hMode = this.hMode;
|
||||
ret.x = this.x;
|
||||
ret.y = this.y;
|
||||
ret.w = this.w;
|
||||
ret.h = this.h;
|
||||
return ret;
|
||||
},
|
||||
Write_ToBinary2: 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);
|
||||
}
|
||||
},
|
||||
Read_FromBinary2: function (r) {
|
||||
if (r.GetBool()) {
|
||||
(this.layoutTarget) = r.GetLong();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.xMode) = r.GetLong();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.yMode) = r.GetLong();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.wMode) = r.GetLong();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.hMode) = r.GetLong();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.x) = r.GetDouble();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.y) = r.GetDouble();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.w) = r.GetDouble();
|
||||
}
|
||||
if (r.GetBool()) {
|
||||
(this.h) = r.GetDouble();
|
||||
}
|
||||
},
|
||||
setXMode: function (mode) {
|
||||
this.xMode = mode;
|
||||
},
|
||||
setYMode: function (mode) {
|
||||
this.yMode = mode;
|
||||
},
|
||||
setX: function (x) {
|
||||
this.x = x;
|
||||
},
|
||||
setY: function (y) {
|
||||
this.y = y;
|
||||
},
|
||||
setIsManual: function (isManual) {
|
||||
this.isManual = isManual;
|
||||
}
|
||||
};
|
||||
@@ -1,238 +0,0 @@
|
||||
/*
|
||||
* (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 * 16 * 16 + cur_legend_info.color.G * 16 + 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);
|
||||
}
|
||||
}
|
||||
};
|
||||
584
OfficeWeb/sdk/PowerPoint/Editor/Format/ChartSpacePrototype.js
Normal file
584
OfficeWeb/sdk/PowerPoint/Editor/Format/ChartSpacePrototype.js
Normal file
@@ -0,0 +1,584 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
"use strict";
|
||||
function getChartTranslateManager() {
|
||||
return editor.chartTranslate;
|
||||
}
|
||||
CChartSpace.prototype.addToDrawingObjects = CShape.prototype.addToDrawingObjects;
|
||||
CChartSpace.prototype.setDrawingObjects = CShape.prototype.setDrawingObjects;
|
||||
CChartSpace.prototype.setDrawingBase = CShape.prototype.setDrawingBase;
|
||||
CChartSpace.prototype.deleteDrawingBase = CShape.prototype.deleteDrawingBase;
|
||||
CChartSpace.prototype.setParent2 = CShape.prototype.setParent2;
|
||||
CChartSpace.prototype.getDrawingObjectsController = CShape.prototype.getDrawingObjectsController;
|
||||
CChartSpace.prototype.handleUpdateTheme = CShape.prototype.handleUpdateTheme;
|
||||
CChartSpace.prototype.getIsSingleBody = CShape.prototype.getIsSingleBody;
|
||||
CChartSpace.prototype.getSlideIndex = CShape.prototype.getSlideIndex;
|
||||
CChartSpace.prototype.recalculateTransform = function () {
|
||||
CShape.prototype.recalculateTransform.call(this);
|
||||
this.localTransform.Reset();
|
||||
};
|
||||
CChartSpace.prototype.recalculatePlotAreaChartBrush = function () {
|
||||
if (this.chart && this.chart.plotArea) {
|
||||
var plot_area = this.chart.plotArea;
|
||||
var default_brush;
|
||||
var tint = 0.2;
|
||||
if (this.style >= 1 && this.style <= 32) {
|
||||
if (this.bPreview) {
|
||||
default_brush = CreateUnifillSolidFillSchemeColor(6, tint);
|
||||
} else {
|
||||
default_brush = CreateNoFillUniFill();
|
||||
}
|
||||
} else {
|
||||
if (this.style >= 33 && this.style <= 34) {
|
||||
default_brush = CreateUnifillSolidFillSchemeColor(8, 0.2);
|
||||
} else {
|
||||
if (this.style >= 35 && this.style <= 40) {
|
||||
default_brush = CreateUnifillSolidFillSchemeColor(this.style - 35, 0 + tint);
|
||||
} else {
|
||||
default_brush = CreateUnifillSolidFillSchemeColor(8, 0.95);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plot_area.spPr && plot_area.spPr.Fill) {
|
||||
default_brush.merge(plot_area.spPr.Fill);
|
||||
}
|
||||
var parents = this.getParentObjects();
|
||||
default_brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, {
|
||||
R: 0,
|
||||
G: 0,
|
||||
B: 0,
|
||||
A: 255
|
||||
});
|
||||
plot_area.brush = default_brush;
|
||||
}
|
||||
};
|
||||
CChartSpace.prototype.recalculateChartBrush = function () {
|
||||
var default_brush;
|
||||
if (this.style >= 1 && this.style <= 32) {
|
||||
if (this.bPreview) {
|
||||
default_brush = CreateUnifillSolidFillSchemeColor(6, 0);
|
||||
} else {
|
||||
default_brush = CreateNoFillUniFill();
|
||||
}
|
||||
} else {
|
||||
if (this.style >= 33 && this.style <= 40) {
|
||||
default_brush = CreateUnifillSolidFillSchemeColor(12, 0);
|
||||
} else {
|
||||
default_brush = CreateUnifillSolidFillSchemeColor(8, 0);
|
||||
}
|
||||
}
|
||||
if (this.spPr && this.spPr.Fill) {
|
||||
default_brush.merge(this.spPr.Fill);
|
||||
}
|
||||
var parents = this.getParentObjects();
|
||||
default_brush.calculate(parents.theme, parents.slide, parents.layout, parents.master, {
|
||||
R: 0,
|
||||
G: 0,
|
||||
B: 0,
|
||||
A: 255
|
||||
});
|
||||
this.brush = default_brush;
|
||||
};
|
||||
CChartSpace.prototype.recalculateChartPen = function () {
|
||||
var parent_objects = this.getParentObjects();
|
||||
var default_line = new CLn();
|
||||
if (parent_objects.theme && parent_objects.theme.themeElements && parent_objects.theme.themeElements.fmtScheme && parent_objects.theme.themeElements.fmtScheme.lnStyleLst) {
|
||||
default_line.merge(parent_objects.theme.themeElements.fmtScheme.lnStyleLst[0]);
|
||||
}
|
||||
var fill;
|
||||
if (this.style >= 1 && this.style <= 32) {
|
||||
if (this.bPreview) {
|
||||
fill = CreateUnifillSolidFillSchemeColor(15, 0.75);
|
||||
} else {
|
||||
fill = CreateNoFillUniFill();
|
||||
}
|
||||
} else {
|
||||
if (this.style >= 33 && this.style <= 40) {
|
||||
fill = CreateUnifillSolidFillSchemeColor(8, 0.75);
|
||||
} else {
|
||||
fill = CreateUnifillSolidFillSchemeColor(12, 0);
|
||||
}
|
||||
}
|
||||
default_line.setFill(fill);
|
||||
if (this.spPr && this.spPr.ln) {
|
||||
default_line.merge(this.spPr.ln);
|
||||
}
|
||||
var parents = this.getParentObjects();
|
||||
default_line.calculate(parents.theme, parents.slide, parents.layout, parents.master, {
|
||||
R: 0,
|
||||
G: 0,
|
||||
B: 0,
|
||||
A: 255
|
||||
});
|
||||
this.pen = default_line;
|
||||
checkBlackUnifill(this.pen.Fill, true);
|
||||
};
|
||||
CChartSpace.prototype.recalcText = function () {
|
||||
this.recalcInfo.recalculateAxisLabels = true;
|
||||
this.recalcTitles2();
|
||||
this.handleUpdateInternalChart();
|
||||
};
|
||||
CChartSpace.prototype.recalculateBounds = CShape.prototype.recalculateBounds;
|
||||
CChartSpace.prototype.deselect = CShape.prototype.deselect;
|
||||
CChartSpace.prototype.hitToHandles = CShape.prototype.hitToHandles;
|
||||
CChartSpace.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
|
||||
CChartSpace.prototype.getRotateAngle = CShape.prototype.getRotateAngle;
|
||||
CChartSpace.prototype.getInvertTransform = CShape.prototype.getInvertTransform;
|
||||
CChartSpace.prototype.hit = CShape.prototype.hit;
|
||||
CChartSpace.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
|
||||
CChartSpace.prototype.hitInPath = CShape.prototype.hitInPath;
|
||||
CChartSpace.prototype.hitInTextRect = CShape.prototype.hitInTextRect;
|
||||
CChartSpace.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection;
|
||||
CChartSpace.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum;
|
||||
CChartSpace.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients;
|
||||
CChartSpace.prototype.check_bounds = CShape.prototype.check_bounds;
|
||||
CChartSpace.prototype.normalize = CShape.prototype.normalize;
|
||||
CChartSpace.prototype.getFullFlipH = CShape.prototype.getFullFlipH;
|
||||
CChartSpace.prototype.getFullFlipV = CShape.prototype.getFullFlipV;
|
||||
CChartSpace.prototype.setWorksheet = CShape.prototype.setWorksheet;
|
||||
CChartSpace.prototype.handleUpdateLn = function () {
|
||||
this.recalcInfo.recalculatePenBrush = true;
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CChartSpace.prototype.setRecalculateInfo = function () {
|
||||
this.recalcInfo = {
|
||||
recalcTitle: null,
|
||||
bRecalculatedTitle: false,
|
||||
recalculateTransform: true,
|
||||
recalculateBounds: true,
|
||||
recalculateChart: true,
|
||||
recalculateBaseColors: true,
|
||||
recalculateSeriesColors: true,
|
||||
recalculateMarkers: true,
|
||||
recalculateGridLines: true,
|
||||
recalculateDLbls: true,
|
||||
recalculateAxisLabels: true,
|
||||
dataLbls: [],
|
||||
axisLabels: [],
|
||||
recalculateAxisVal: true,
|
||||
recalculateAxisTickMark: true,
|
||||
recalculateBrush: true,
|
||||
recalculatePen: true,
|
||||
recalculatePlotAreaBrush: true,
|
||||
recalculatePlotAreaPen: true,
|
||||
recalculateHiLowLines: true,
|
||||
recalculateUpDownBars: true,
|
||||
recalculateLegend: true,
|
||||
recalculateReferences: true,
|
||||
recalculateBBox: true,
|
||||
recalculateFormulas: true,
|
||||
recalculatePenBrush: true,
|
||||
recalculateTextPr: true,
|
||||
recalculateBBoxRange: true
|
||||
};
|
||||
this.baseColors = [];
|
||||
this.bounds = {
|
||||
l: 0,
|
||||
t: 0,
|
||||
r: 0,
|
||||
b: 0,
|
||||
w: 0,
|
||||
h: 0
|
||||
};
|
||||
this.chartObj = null;
|
||||
this.rectGeometry = ExecuteNoHistory(function () {
|
||||
return CreateGeometry("rect");
|
||||
},
|
||||
this, []);
|
||||
this.lockType = c_oAscLockTypes.kLockTypeNone;
|
||||
};
|
||||
CChartSpace.prototype.recalcTransform = function () {
|
||||
this.recalcInfo.recalculateTransform = true;
|
||||
};
|
||||
CChartSpace.prototype.recalcBounds = function () {
|
||||
this.recalcInfo.recalculateBounds = true;
|
||||
};
|
||||
CChartSpace.prototype.recalcChart = function () {
|
||||
this.recalcInfo.recalculateChart = true;
|
||||
};
|
||||
CChartSpace.prototype.recalcBaseColors = function () {
|
||||
this.recalcInfo.recalculateBaseColors = true;
|
||||
};
|
||||
CChartSpace.prototype.recalcSeriesColors = function () {
|
||||
this.recalcInfo.recalculateSeriesColors = true;
|
||||
};
|
||||
CChartSpace.prototype.recalcDLbls = function () {
|
||||
this.recalcInfo.recalculateDLbls = true;
|
||||
};
|
||||
CChartSpace.prototype.addToRecalculate = CShape.prototype.addToRecalculate;
|
||||
CChartSpace.prototype.handleUpdatePosition = function () {
|
||||
this.recalcTransform();
|
||||
this.recalcBounds();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CChartSpace.prototype.handleUpdateExtents = function () {
|
||||
this.recalcChart();
|
||||
this.recalcBounds();
|
||||
this.recalcTransform();
|
||||
this.recalcTitles();
|
||||
this.handleUpdateInternalChart();
|
||||
};
|
||||
CChartSpace.prototype.handleUpdateFlip = function () {
|
||||
this.recalcTransform();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CChartSpace.prototype.handleUpdateChart = function () {
|
||||
this.recalcChart();
|
||||
this.setRecalculateInfo();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CChartSpace.prototype.handleUpdateStyle = function () {
|
||||
this.recalcInfo.recalculateSeriesColors = true;
|
||||
this.recalcInfo.recalculateLegend = true;
|
||||
this.recalcInfo.recalculatePlotAreaBrush = true;
|
||||
this.recalcInfo.recalculatePlotAreaPen = true;
|
||||
this.recalcInfo.recalculateBrush = true;
|
||||
this.recalcInfo.recalculatePen = true;
|
||||
this.recalcInfo.recalculateHiLowLines = true;
|
||||
this.recalcInfo.recalculateUpDownBars = true;
|
||||
this.handleTitlesAfterChangeTheme();
|
||||
this.recalcInfo.recalculateAxisLabels = true;
|
||||
this.recalcInfo.recalculateAxisVal = true;
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CChartSpace.prototype.handleUpdateFill = function () {
|
||||
this.recalcInfo.recalculatePenBrush = true;
|
||||
this.recalcInfo.recalculateBrush = true;
|
||||
this.recalcInfo.recalculateChart = true;
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CChartSpace.prototype.handleUpdateLn = function () {
|
||||
this.recalcInfo.recalculatePenBrush = true;
|
||||
this.recalcInfo.recalculatePen = true;
|
||||
this.recalcInfo.recalculateChart = true;
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CChartSpace.prototype.canGroup = CShape.prototype.canGroup;
|
||||
CChartSpace.prototype.convertPixToMM = CShape.prototype.convertPixToMM;
|
||||
CChartSpace.prototype.getCanvasContext = CShape.prototype.getCanvasContext;
|
||||
CChartSpace.prototype.getHierarchy = CShape.prototype.getHierarchy;
|
||||
CChartSpace.prototype.getParentObjects = CShape.prototype.getParentObjects;
|
||||
CChartSpace.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
|
||||
CChartSpace.prototype.recalculateChart = function () {
|
||||
if (this.chartObj == null) {
|
||||
this.chartObj = new CChartsDrawer();
|
||||
}
|
||||
this.chartObj.reCalculate(this);
|
||||
};
|
||||
CChartSpace.prototype.canResize = CShape.prototype.canResize;
|
||||
CChartSpace.prototype.canMove = CShape.prototype.canMove;
|
||||
CChartSpace.prototype.canRotate = function () {
|
||||
return false;
|
||||
};
|
||||
CChartSpace.prototype.createResizeTrack = CShape.prototype.createResizeTrack;
|
||||
CChartSpace.prototype.createMoveTrack = CShape.prototype.createMoveTrack;
|
||||
CChartSpace.prototype.getAspect = CShape.prototype.getAspect;
|
||||
CChartSpace.prototype.getRectBounds = CShape.prototype.getRectBounds;
|
||||
CChartSpace.prototype.recalculateBounds = function () {
|
||||
var transform = this.transform;
|
||||
var a_x = [];
|
||||
var a_y = [];
|
||||
a_x.push(transform.TransformPointX(0, 0));
|
||||
a_y.push(transform.TransformPointY(0, 0));
|
||||
a_x.push(transform.TransformPointX(this.extX, 0));
|
||||
a_y.push(transform.TransformPointY(this.extX, 0));
|
||||
a_x.push(transform.TransformPointX(this.extX, this.extY));
|
||||
a_y.push(transform.TransformPointY(this.extX, this.extY));
|
||||
a_x.push(transform.TransformPointX(0, this.extY));
|
||||
a_y.push(transform.TransformPointY(0, this.extY));
|
||||
this.bounds.l = Math.min.apply(Math, a_x);
|
||||
this.bounds.t = Math.min.apply(Math, a_y);
|
||||
this.bounds.r = Math.max.apply(Math, a_x);
|
||||
this.bounds.b = Math.max.apply(Math, a_y);
|
||||
this.bounds.w = this.bounds.r - this.bounds.l;
|
||||
this.bounds.h = this.bounds.b - this.bounds.t;
|
||||
this.bounds.x = this.bounds.l;
|
||||
this.bounds.y = this.bounds.t;
|
||||
};
|
||||
CChartSpace.prototype.recalculate = function () {
|
||||
if (this.bDeleted || !this.parent) {
|
||||
return;
|
||||
}
|
||||
ExecuteNoHistory(function () {
|
||||
this.updateLinks();
|
||||
if (this.recalcInfo.recalcTitle) {
|
||||
this.recalculateChartTitleEditMode();
|
||||
this.recalcInfo.recalcTitle.updatePosition(this.transform.tx, this.transform.ty);
|
||||
this.recalcInfo.recalcTitle = null;
|
||||
this.recalcInfo.bRecalculatedTitle = true;
|
||||
}
|
||||
var b_transform = false;
|
||||
if (this.recalcInfo.recalculateTransform) {
|
||||
this.recalculateTransform();
|
||||
this.rectGeometry.Recalculate(this.extX, this.extY);
|
||||
this.recalcInfo.recalculateTransform = false;
|
||||
this.calculateSnapArrays();
|
||||
b_transform = true;
|
||||
}
|
||||
if (this.recalcInfo.recalculateReferences) {
|
||||
this.recalculateReferences();
|
||||
this.recalcInfo.recalculateReferences = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateBBox) {
|
||||
this.recalculateBBox();
|
||||
this.recalcInfo.recalculateBBox = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateBaseColors) {
|
||||
this.recalculateBaseColors();
|
||||
this.recalcInfo.recalculateBaseColors = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateMarkers) {
|
||||
this.recalculateMarkers();
|
||||
this.recalcInfo.recalculateMarkers = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateSeriesColors) {
|
||||
this.recalculateSeriesColors();
|
||||
this.recalcInfo.recalculateSeriesColors = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateGridLines) {
|
||||
this.recalculateGridLines();
|
||||
this.recalcInfo.recalculateGridLines = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateAxisTickMark) {
|
||||
this.recalculateAxisTickMark();
|
||||
this.recalcInfo.recalculateAxisTickMark = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateDLbls) {
|
||||
this.recalculateDLbls();
|
||||
this.recalcInfo.recalculateDLbls = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateBrush) {
|
||||
this.recalculateChartBrush();
|
||||
this.recalcInfo.recalculateBrush = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculatePen) {
|
||||
this.recalculateChartPen();
|
||||
this.recalcInfo.recalculatePen = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateHiLowLines) {
|
||||
this.recalculateHiLowLines();
|
||||
this.recalcInfo.recalculateHiLowLines = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculatePlotAreaBrush) {
|
||||
this.recalculatePlotAreaChartBrush();
|
||||
this.recalcInfo.recalculatePlotAreaBrush = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculatePlotAreaPen) {
|
||||
this.recalculatePlotAreaChartPen();
|
||||
this.recalcInfo.recalculatePlotAreaPen = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateUpDownBars) {
|
||||
this.recalculateUpDownBars();
|
||||
this.recalcInfo.recalculateUpDownBars = false;
|
||||
}
|
||||
var b_recalc_legend = false;
|
||||
if (this.recalcInfo.recalculateLegend) {
|
||||
this.recalculateLegend();
|
||||
this.recalcInfo.recalculateLegend = false;
|
||||
b_recalc_legend = true;
|
||||
}
|
||||
var b_recalc_labels = false;
|
||||
if (this.recalcInfo.recalculateAxisLabels) {
|
||||
this.recalculateAxisLabels();
|
||||
this.recalcInfo.recalculateAxisLabels = false;
|
||||
b_recalc_labels = true;
|
||||
}
|
||||
if (this.recalcInfo.recalculateAxisVal) {
|
||||
this.recalculateAxis();
|
||||
this.recalcInfo.recalculateAxisVal = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculatePenBrush) {
|
||||
this.recalculatePenBrush();
|
||||
this.recalcInfo.recalculatePenBrush = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateChart) {
|
||||
this.recalculateChart();
|
||||
this.recalcInfo.recalculateChart = false;
|
||||
}
|
||||
for (var i = 0; i < this.recalcInfo.dataLbls.length; ++i) {
|
||||
var series = this.chart.plotArea.chart.series;
|
||||
if (this.recalcInfo.dataLbls[i].series && this.recalcInfo.dataLbls[i].pt) {
|
||||
var ser_idx = this.recalcInfo.dataLbls[i].series.idx;
|
||||
for (var j = 0; j < series.length; ++j) {
|
||||
if (series[j].idx === this.recalcInfo.dataLbls[i].series.idx) {
|
||||
var pos = this.chartObj.reCalculatePositionText("dlbl", this, j, this.recalcInfo.dataLbls[i].pt.idx);
|
||||
this.recalcInfo.dataLbls[i].setPosition(pos.x, pos.y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.recalcInfo.dataLbls.length = 0;
|
||||
if (b_recalc_labels) {
|
||||
if (this.chart && this.chart.title) {
|
||||
var pos = this.chartObj.reCalculatePositionText("title", this, this.chart.title);
|
||||
this.chart.title.setPosition(pos.x, pos.y);
|
||||
}
|
||||
if (this.chart && this.chart.plotArea && this.chart.plotArea) {
|
||||
var hor_axis = this.chart.plotArea.getHorizontalAxis();
|
||||
if (hor_axis && hor_axis.title) {
|
||||
var old_cat_ax = this.chart.plotArea.catAx;
|
||||
this.chart.plotArea.catAx = hor_axis;
|
||||
var pos = this.chartObj.reCalculatePositionText("catAx", this, hor_axis.title);
|
||||
hor_axis.title.setPosition(pos.x, pos.y);
|
||||
this.chart.plotArea.catAx = old_cat_ax;
|
||||
}
|
||||
var vert_axis = this.chart.plotArea.getVerticalAxis();
|
||||
if (vert_axis && vert_axis.title) {
|
||||
var old_val_ax = this.chart.plotArea.valAx;
|
||||
this.chart.plotArea.valAx = vert_axis;
|
||||
var pos = this.chartObj.reCalculatePositionText("valAx", this, vert_axis.title);
|
||||
vert_axis.title.setPosition(pos.x, pos.y);
|
||||
this.chart.plotArea.valAx = old_val_ax;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (b_recalc_legend && this.chart && this.chart.legend) {
|
||||
var pos = this.chartObj.reCalculatePositionText("legend", this, this.chart.legend);
|
||||
this.chart.legend.setPosition(pos.x, pos.y);
|
||||
}
|
||||
if (this.recalcInfo.recalculateBounds) {
|
||||
this.recalculateBounds();
|
||||
this.recalcInfo.recalculateBounds = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateTextPr) {
|
||||
this.recalculateTextPr();
|
||||
this.recalcInfo.recalculateTextPr = false;
|
||||
}
|
||||
this.updateChildLabelsTransform(this.transform.tx, this.transform.ty);
|
||||
this.recalcInfo.dataLbls.length = 0;
|
||||
this.recalcInfo.axisLabels.length = 0;
|
||||
this.bNeedUpdatePosition = true;
|
||||
},
|
||||
this, []);
|
||||
};
|
||||
CChartSpace.prototype.deselect = CShape.prototype.deselect;
|
||||
CChartSpace.prototype.getDrawingDocument = CShape.prototype.getDrawingDocument;
|
||||
CChartSpace.prototype.recalculateLocalTransform = CShape.prototype.recalculateLocalTransform;
|
||||
CChartSpace.prototype.Get_Theme = CShape.prototype.Get_Theme;
|
||||
CChartSpace.prototype.Get_ColorMap = CShape.prototype.Get_ColorMap;
|
||||
CTable.prototype.Get_TableOffsetCorrection = function () {
|
||||
return 0;
|
||||
};
|
||||
CTable.prototype.Selection_Draw_Page = function (Page_abs) {
|
||||
if (false === this.Selection.Use) {
|
||||
return;
|
||||
}
|
||||
var CurPage = Page_abs - this.Get_StartPage_Absolute();
|
||||
if (CurPage < 0 || CurPage >= this.Pages.length) {
|
||||
return;
|
||||
}
|
||||
switch (this.Selection.Type) {
|
||||
case table_Selection_Cell:
|
||||
var Row_prev_index = -1;
|
||||
for (var Index = 0; Index < this.Selection.Data.length; Index++) {
|
||||
var Pos = this.Selection.Data[Index];
|
||||
var Row = this.Content[Pos.Row];
|
||||
var Cell = Row.Get_Cell(Pos.Cell);
|
||||
var CellInfo = Row.Get_CellInfo(Pos.Cell);
|
||||
var CellMar = Cell.Get_Margins();
|
||||
if (-1 === Row_prev_index || Row_prev_index != Pos.Row) {
|
||||
Row_prev_index = Pos.Row;
|
||||
}
|
||||
var X_start = CellInfo.X_cell_start;
|
||||
var X_end = CellInfo.X_cell_end;
|
||||
var Cell_Pages = Cell.Content_Get_PagesCount();
|
||||
var Cell_PageRel = Page_abs - Cell.Content.Get_StartPage_Absolute();
|
||||
if (Cell_PageRel < 0 || Cell_PageRel >= Cell_Pages) {
|
||||
continue;
|
||||
}
|
||||
var Bounds = Cell.Content_Get_PageBounds(Cell_PageRel);
|
||||
var Y_offset = Cell.Temp.Y_VAlign_offset[Cell_PageRel];
|
||||
if (0 != Cell_PageRel) {
|
||||
var TempRowIndex = this.Pages[CurPage].FirstRow;
|
||||
this.DrawingDocument.AddPageSelection(Page_abs, X_start, this.RowsInfo[TempRowIndex].Y[CurPage] + this.RowsInfo[TempRowIndex].TopDy[CurPage] + Y_offset, X_end - X_start, this.RowsInfo[TempRowIndex].H[CurPage]);
|
||||
} else {
|
||||
this.DrawingDocument.AddPageSelection(Page_abs, X_start, this.RowsInfo[Pos.Row].Y[CurPage] + this.RowsInfo[Pos.Row].TopDy[CurPage] + Y_offset, X_end - X_start, this.RowsInfo[Pos.Row].H[CurPage]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case table_Selection_Text:
|
||||
var Cell = this.Content[this.Selection.StartPos.Pos.Row].Get_Cell(this.Selection.StartPos.Pos.Cell);
|
||||
Cell.Content.Selection_Draw_Page(Page_abs);
|
||||
break;
|
||||
}
|
||||
};
|
||||
CStyle.prototype.Create_NormalTable = function () {
|
||||
var TablePr = {
|
||||
TableInd: {
|
||||
W: 0,
|
||||
Type: tblwidth_Mm
|
||||
},
|
||||
TableCellMar: {
|
||||
Top: {
|
||||
W: 1.27,
|
||||
Type: tblwidth_Mm
|
||||
},
|
||||
Left: {
|
||||
W: 2.54,
|
||||
Type: tblwidth_Mm
|
||||
},
|
||||
Bottom: {
|
||||
W: 1.27,
|
||||
Type: tblwidth_Mm
|
||||
},
|
||||
Right: {
|
||||
W: 2.54,
|
||||
Type: tblwidth_Mm
|
||||
}
|
||||
}
|
||||
};
|
||||
this.Set_UiPriority(99);
|
||||
this.Set_SemiHidden(true);
|
||||
this.Set_UnhideWhenUsed(true);
|
||||
this.Set_TablePr(TablePr);
|
||||
};
|
||||
CTablePr.prototype.Init_Default = function () {
|
||||
this.TableStyleColBandSize = 1;
|
||||
this.TableStyleRowBandSize = 1;
|
||||
this.Jc = align_Left;
|
||||
this.Shd = new CDocumentShd();
|
||||
this.TableBorders.Bottom = new CDocumentBorder();
|
||||
this.TableBorders.Left = new CDocumentBorder();
|
||||
this.TableBorders.Right = new CDocumentBorder();
|
||||
this.TableBorders.Top = new CDocumentBorder();
|
||||
this.TableBorders.InsideH = new CDocumentBorder();
|
||||
this.TableBorders.InsideV = new CDocumentBorder();
|
||||
this.TableCellMar.Bottom = new CTableMeasurement(tblwidth_Mm, 1.27);
|
||||
this.TableCellMar.Left = new CTableMeasurement(tblwidth_Mm, 2.54);
|
||||
this.TableCellMar.Right = new CTableMeasurement(tblwidth_Mm, 2.54);
|
||||
this.TableCellMar.Top = new CTableMeasurement(tblwidth_Mm, 1.27);
|
||||
this.TableCellSpacing = null;
|
||||
this.TableInd = 0;
|
||||
this.TableW = new CTableMeasurement(tblwidth_Auto, 0);
|
||||
this.TableLayout = tbllayout_AutoFit;
|
||||
};
|
||||
@@ -1,955 +0,0 @@
|
||||
/*
|
||||
* (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.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.recalcInfo = {
|
||||
recalculateTransform: true,
|
||||
recalculateBrush: true,
|
||||
recalculatePen: true
|
||||
};
|
||||
this.selected = false;
|
||||
this.Id = g_oIdCounter.Get_NewId();
|
||||
g_oTableId.Add(this, this.Id);
|
||||
if (isRealObject(chartGroup)) {
|
||||
this.setChartGroup(chartGroup);
|
||||
this.addTextBody(new CTextBody(this));
|
||||
}
|
||||
if (isRealNumber(type)) {
|
||||
this.setType(type);
|
||||
}
|
||||
}
|
||||
CChartTitle.prototype = {
|
||||
getObjectType: function () {
|
||||
return CLASS_TYPE_CHART_TITLE;
|
||||
},
|
||||
Get_Id: function () {
|
||||
return this.Id;
|
||||
},
|
||||
setType: function (type) {
|
||||
History.Add(this, {
|
||||
Type: historyitem_AutoShapes_SetChartTitleType,
|
||||
oldPr: this.type,
|
||||
newPr: type
|
||||
});
|
||||
this.type = type;
|
||||
},
|
||||
setChartGroup: function (chartGroup) {
|
||||
var oldPr = this.chartGroup;
|
||||
var newPr = chartGroup;
|
||||
History.Add(this, {
|
||||
Type: historyitem_AutoShapes_SetChartGroup,
|
||||
oldPr: oldPr,
|
||||
newPr: newPr
|
||||
});
|
||||
this.chartGroup = chartGroup;
|
||||
},
|
||||
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;
|
||||
}
|
||||
},
|
||||
getParentObjects: function () {
|
||||
return this.chartGroup.getParentObjects();
|
||||
},
|
||||
updateInterfaceTextState: function () {
|
||||
var _b_no_change_indent;
|
||||
_b_no_change_indent = false;
|
||||
if (this.txBody !== null && typeof this.txBody === "object") {
|
||||
if (this.txBody.content !== null && typeof this.txBody.content === "object") {
|
||||
var _content = this.txBody.content;
|
||||
if (typeof _content.Document_UpdateInterfaceState === "function") {
|
||||
_content.Document_UpdateInterfaceState();
|
||||
}
|
||||
}
|
||||
}
|
||||
editor.asc_fireCallback("asc_canIncreaseIndent", false);
|
||||
editor.asc_fireCallback("asc_canDecreaseIndent", false);
|
||||
},
|
||||
isPlaceholder: function () {
|
||||
return false;
|
||||
},
|
||||
isEmptyPlaceholder: function () {
|
||||
return false;
|
||||
},
|
||||
isEmpty: function () {
|
||||
return isRealObject(this.txBody) ? this.txBody.isEmpty() : true;
|
||||
},
|
||||
getTextSelectionState: function () {
|
||||
if (this.txBody) {
|
||||
return this.txBody.content.Get_SelectionState();
|
||||
}
|
||||
return [];
|
||||
},
|
||||
setTextSelectionState: function (s) {
|
||||
if (this.txBody) {
|
||||
this.txBody.content.Set_SelectionState(s, s.length - 1);
|
||||
}
|
||||
},
|
||||
Get_Styles: 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;
|
||||
default_legend_style.TextPr.FontFamily = {
|
||||
Name: "Calibri",
|
||||
Index: -1
|
||||
};
|
||||
default_legend_style.TextPr.RFonts = new CRFonts();
|
||||
default_legend_style.TextPr.RFonts.Ascii = {
|
||||
Name: "Calibri",
|
||||
Index: -1
|
||||
};
|
||||
default_legend_style.TextPr.RFonts.EastAsia = {
|
||||
Name: "Calibri",
|
||||
Index: -1
|
||||
};
|
||||
default_legend_style.TextPr.RFonts.HAnsi = {
|
||||
Name: "Calibri",
|
||||
Index: -1
|
||||
};
|
||||
default_legend_style.TextPr.RFonts.CS = {
|
||||
Name: "Calibri",
|
||||
Index: -1
|
||||
};
|
||||
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.Jc = align_Center;
|
||||
var tx_pr;
|
||||
if (isRealObject(this.txPr)) {}
|
||||
styles.Style[styles.Id] = default_legend_style;
|
||||
++styles.Id;
|
||||
return styles;
|
||||
},
|
||||
select: function () {
|
||||
this.selected = true;
|
||||
},
|
||||
deselect: function () {
|
||||
this.selected = false;
|
||||
if (isRealObject(this.txBody) && isRealObject(this.txBody.content)) {
|
||||
this.txBody.content.Selection_Remove();
|
||||
}
|
||||
},
|
||||
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.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 (txBody) {
|
||||
this.txBody = txBody;
|
||||
},
|
||||
setLayoutX: function (x) {
|
||||
if (!isRealObject(this.layout)) {
|
||||
this.layout = new CChartLayout();
|
||||
}
|
||||
this.layout.setX(x);
|
||||
},
|
||||
setLayoutY: function (y) {
|
||||
if (!isRealObject(this.layout)) {
|
||||
this.layout = new CChartLayout();
|
||||
}
|
||||
this.layout.setY(y);
|
||||
},
|
||||
addTextBody: function (txBody) {
|
||||
var oldPr = this.txBody;
|
||||
var newPr = txBody;
|
||||
History.Add(this, {
|
||||
Type: historyitem_AutoShapes_SetChartTitleTxBody,
|
||||
oldPr: oldPr,
|
||||
newPr: newPr
|
||||
});
|
||||
this.txBody = txBody;
|
||||
},
|
||||
paragraphAdd: function (paraItem, bRecalculate) {
|
||||
if (!isRealObject(this.txBody)) {
|
||||
this.txBody = new CTextBody(this);
|
||||
}
|
||||
this.txBody.content.Paragraph_Add(paraItem, false);
|
||||
this.recalculatePosExt();
|
||||
this.txBody.content.RecalculateCurPos();
|
||||
},
|
||||
recalculatePosExt: function () {
|
||||
var old_cx = this.x + this.extX * 0.5;
|
||||
var old_cy = this.y + this.extY * 0.5;
|
||||
var body_pr = 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 - (body_pr.rIns + body_pr.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;
|
||||
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();
|
||||
},
|
||||
remove: function (Count, bOnlyText, bRemoveOnlySelection) {
|
||||
this.txBody.content.Remove(Count, bOnlyText, bRemoveOnlySelection);
|
||||
var old_cx = this.x + this.extX * 0.5;
|
||||
var old_cy = this.y + this.extY * 0.5;
|
||||
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.extY, title_width);
|
||||
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();
|
||||
return;
|
||||
},
|
||||
updateSelectionState: function () {
|
||||
this.txBody.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
|
||||
},
|
||||
recalculateCurPos: function () {
|
||||
if (isRealObject(this.txBody)) {
|
||||
this.txBody.content.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.upright === false) {
|
||||
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 {
|
||||
var _full_rotate = this.getFullRotate();
|
||||
var _full_flip = this.getFullFlip();
|
||||
var _hc = this.extX * 0.5;
|
||||
var _vc = this.extY * 0.5;
|
||||
var _transformed_shape_xc = this.transform.TransformPointX(_hc, _vc);
|
||||
var _transformed_shape_yc = this.transform.TransformPointY(_hc, _vc);
|
||||
var _content_width, content_height2;
|
||||
if ((_full_rotate >= 0 && _full_rotate < Math.PI * 0.25) || (_full_rotate > 3 * Math.PI * 0.25 && _full_rotate < 5 * Math.PI * 0.25) || (_full_rotate > 7 * Math.PI * 0.25 && _full_rotate < 2 * Math.PI)) {
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _r - _l;
|
||||
content_height2 = _b - _t;
|
||||
} else {
|
||||
_content_width = _b - _t;
|
||||
content_height2 = _r - _l;
|
||||
}
|
||||
} else {
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _b - _t;
|
||||
content_height2 = _r - _l;
|
||||
} else {
|
||||
_content_width = _r - _l;
|
||||
content_height2 = _b - _t;
|
||||
}
|
||||
}
|
||||
if (_content_height < content_height2) {
|
||||
switch (_body_pr.anchor) {
|
||||
case 0:
|
||||
_vertical_shift = content_height2 - _content_height;
|
||||
break;
|
||||
case 1:
|
||||
_vertical_shift = (content_height2 - _content_height) * 0.5;
|
||||
break;
|
||||
case 2:
|
||||
_vertical_shift = (content_height2 - _content_height) * 0.5;
|
||||
break;
|
||||
case 3:
|
||||
_vertical_shift = (content_height2 - _content_height) * 0.5;
|
||||
break;
|
||||
case 4:
|
||||
_vertical_shift = 0;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
_vertical_shift = 0;
|
||||
}
|
||||
var _text_rect_xc = _l + (_r - _l) * 0.5;
|
||||
var _text_rect_yc = _t + (_b - _t) * 0.5;
|
||||
var _vx = _text_rect_xc - _hc;
|
||||
var _vy = _text_rect_yc - _vc;
|
||||
var _transformed_text_xc, _transformed_text_yc;
|
||||
if (!_full_flip.flipH) {
|
||||
_transformed_text_xc = _transformed_shape_xc + _vx;
|
||||
} else {
|
||||
_transformed_text_xc = _transformed_shape_xc - _vx;
|
||||
}
|
||||
if (!_full_flip.flipV) {
|
||||
_transformed_text_yc = _transformed_shape_yc + _vy;
|
||||
} else {
|
||||
_transformed_text_yc = _transformed_shape_yc - _vy;
|
||||
}
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform, 0, _vertical_shift);
|
||||
if (_body_pr.vert === nVertTTvert) {
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform, -_content_width * 0.5, -content_height2 * 0.5);
|
||||
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI * 0.5);
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform, _content_width * 0.5, content_height2 * 0.5);
|
||||
}
|
||||
if (_body_pr.vert === nVertTTvert270) {
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform, -_content_width * 0.5, -content_height2 * 0.5);
|
||||
global_MatrixTransformer.RotateRadAppend(_text_transform, -Math.PI * 1.5);
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform, _content_width * 0.5, content_height2 * 0.5);
|
||||
}
|
||||
global_MatrixTransformer.TranslateAppend(_text_transform, _transformed_text_xc - _content_width * 0.5, _transformed_text_yc - content_height2 * 0.5);
|
||||
var body_pr = this.bodyPr;
|
||||
var l_ins = typeof body_pr.lIns === "number" ? body_pr.lIns : 1;
|
||||
var t_ins = typeof body_pr.tIns === "number" ? body_pr.tIns : 0.5;
|
||||
var r_ins = typeof body_pr.rIns === "number" ? body_pr.rIns : 0.5;
|
||||
var b_ins = typeof body_pr.bIns === "number" ? body_pr.bIns : 0.5;
|
||||
this.clipRect = {
|
||||
x: -l_ins,
|
||||
y: -_vertical_shift - t_ins,
|
||||
w: this.contentWidth + (r_ins + l_ins),
|
||||
h: this.contentHeight + (b_ins + t_ins)
|
||||
};
|
||||
}
|
||||
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) {
|
||||
graphics.SetIntegerGrid(false);
|
||||
graphics.transform3(this.transformText);
|
||||
this.txBody.draw(graphics);
|
||||
graphics.reset();
|
||||
graphics.SetIntegerGrid(true);
|
||||
},
|
||||
selectionSetStart: function (e, x, y, slideIndex) {
|
||||
if (isRealObject(this.txBody)) {
|
||||
var tx, ty;
|
||||
tx = this.invertTransformText.TransformPointX(x, y);
|
||||
ty = this.invertTransformText.TransformPointY(x, y);
|
||||
this.txBody.content.Selection_SetStart(tx, ty, 0, e);
|
||||
}
|
||||
},
|
||||
selectionSetEnd: function (e, x, y, slideIndex) {
|
||||
if (isRealObject(this.txBody)) {
|
||||
var tx, ty;
|
||||
tx = this.invertTransformText.TransformPointX(x, y);
|
||||
ty = this.invertTransformText.TransformPointY(x, y);
|
||||
this.txBody.content.Selection_SetEnd(tx, ty, 0, e);
|
||||
}
|
||||
},
|
||||
setPosition: function (x, y) {
|
||||
var layout = new CChartLayout();
|
||||
layout.setIsManual(true);
|
||||
layout.setXMode(LAYOUT_MODE_EDGE);
|
||||
layout.setX(x / this.chartGroup.extX);
|
||||
layout.setYMode(LAYOUT_MODE_EDGE);
|
||||
layout.setY(y / this.chartGroup.extY);
|
||||
this.setLayout(layout);
|
||||
},
|
||||
setLayout: function (layout) {
|
||||
var oldLayout = this.layout ? this.layout.createDuplicate() : null;
|
||||
var newLayout = layout ? layout.createDuplicate() : null;
|
||||
History.Add(this, {
|
||||
Type: historyitem_SetCahrtLayout,
|
||||
oldLayout: oldLayout,
|
||||
newLayout: newLayout
|
||||
});
|
||||
this.layout = layout;
|
||||
if (this.chartGroup) {
|
||||
editor.WordControl.m_oLogicDocument.recalcMap[this.chartGroup.Id] = this.chartGroup;
|
||||
}
|
||||
},
|
||||
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(editor.WordControl.m_oDrawingDocument.CanvasHitContext, 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(editor.WordControl.m_oDrawingDocument.CanvasHitContext, 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 = editor.WordControl.m_oDrawingDocument.CanvasHitContext;
|
||||
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;
|
||||
},
|
||||
recalcAll: function () {},
|
||||
recalcAllColors: function () {},
|
||||
onParagraphChanged: function () {
|
||||
if (this.chartGroup) {
|
||||
editor.WordControl.m_oLogicDocument.recalcMap[this.chartGroup.Id] = this.chartGroup;
|
||||
}
|
||||
},
|
||||
writeToBinary: function (w) {
|
||||
w.WriteBool(isRealObject(this.layout));
|
||||
if (isRealObject(this.layout)) {
|
||||
this.layout.Write_ToBinary2(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()) {
|
||||
var layout = new CChartLayout();
|
||||
layout.Read_FromBinary2(r);
|
||||
this.setLayout(layout);
|
||||
}
|
||||
this.overlay = r.GetBool();
|
||||
this.spPr.Read_FromBinary2(r);
|
||||
if (r.GetBool()) {
|
||||
this.txBody.readFromBinary(r);
|
||||
}
|
||||
},
|
||||
setBodyPr: function (bodyPr) {
|
||||
var old_body_pr = this.txBody.bodyPr;
|
||||
this.txBody.bodyPr = bodyPr;
|
||||
var new_body_pr = this.txBody.bodyPr.createDuplicate();
|
||||
History.Add(this, {
|
||||
Type: historyitem_SetShapeBodyPr,
|
||||
oldBodyPr: old_body_pr,
|
||||
newBodyPr: new_body_pr
|
||||
});
|
||||
this.txBody.recalcInfo.recalculateBodyPr = true;
|
||||
},
|
||||
setOverlay: function (overlay) {
|
||||
var _overlay = overlay === true;
|
||||
History.Add(this, {
|
||||
Type: historyitem_AutoShapes_SetChartTitleOverlay,
|
||||
oldPr: this.overlay === true,
|
||||
newPr: _overlay
|
||||
});
|
||||
this.overlay = _overlay;
|
||||
},
|
||||
Undo: function (data) {
|
||||
switch (data.Type) {
|
||||
case historyitem_SetCahrtLayout:
|
||||
if (isRealObject(data.oldLayout)) {
|
||||
this.layout = data.oldLayout.createDuplicate();
|
||||
} else {
|
||||
this.layout = null;
|
||||
}
|
||||
break;
|
||||
case historyitem_SetShapeBodyPr:
|
||||
this.txBody.bodyPr = data.oldBodyPr.createDuplicate();
|
||||
this.txBody.recalcInfo.recalculateBodyPr = true;
|
||||
this.recalcInfo.recalculateContent = true;
|
||||
this.recalcInfo.recalculateTransformText = true;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartGroup:
|
||||
this.chartGroup = data.oldPr;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleType:
|
||||
this.type = data.oldPr;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleOverlay:
|
||||
this.overlay = data.oldPr;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleTxBody:
|
||||
this.txBody = data.oldPr;
|
||||
break;
|
||||
}
|
||||
if (this.chartGroup) {
|
||||
editor.WordControl.m_oLogicDocument.recalcMap[this.chartGroup.Id] = this.chartGroup;
|
||||
}
|
||||
},
|
||||
Redo: function (data) {
|
||||
switch (data.Type) {
|
||||
case historyitem_SetCahrtLayout:
|
||||
if (isRealObject(data.newLayout)) {
|
||||
this.layout = data.newLayout.createDuplicate();
|
||||
} else {
|
||||
this.layout = null;
|
||||
}
|
||||
break;
|
||||
case historyitem_SetShapeBodyPr:
|
||||
this.txBody.bodyPr = data.newBodyPr.createDuplicate();
|
||||
this.txBody.recalcInfo.recalculateBodyPr = true;
|
||||
this.recalcInfo.recalculateContent = true;
|
||||
this.recalcInfo.recalculateTransformText = true;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartGroup:
|
||||
this.chartGroup = data.newPr;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleType:
|
||||
this.type = data.newPr;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleOverlay:
|
||||
this.overlay = data.newPr;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleTxBody:
|
||||
this.txBody = data.newPr;
|
||||
break;
|
||||
}
|
||||
if (this.chartGroup) {
|
||||
editor.WordControl.m_oLogicDocument.recalcMap[this.chartGroup.Id] = this.chartGroup;
|
||||
}
|
||||
},
|
||||
Refresh_RecalcData: function () {},
|
||||
Write_ToBinary2: function (w) {
|
||||
w.WriteLong(historyitem_type_ChartTitle);
|
||||
w.WriteString2(this.Id);
|
||||
},
|
||||
Read_FromBinary2: function (r) {
|
||||
this.Id = r.GetString2();
|
||||
},
|
||||
Save_Changes: function (data, w) {
|
||||
w.WriteLong(historyitem_type_ChartTitle);
|
||||
w.WriteLong(data.Type);
|
||||
switch (data.Type) {
|
||||
case historyitem_SetCahrtLayout:
|
||||
w.WriteBool(isRealObject(data.newLayout));
|
||||
if (isRealObject(data.newLayout)) {
|
||||
data.newLayout.Write_ToBinary2(w);
|
||||
}
|
||||
break;
|
||||
case historyitem_SetShapeBodyPr:
|
||||
data.newBodyPr.Write_ToBinary2(w);
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartGroup:
|
||||
w.WriteBool(isRealObject(data.newPr));
|
||||
if (isRealObject(data.newPr)) {
|
||||
w.WriteString2(data.newPr.Get_Id());
|
||||
}
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleType:
|
||||
w.WriteBool(isRealNumber(data.newPr));
|
||||
if (isRealNumber(data.newPr)) {}
|
||||
w.WriteLong(data.newPr);
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleOverlay:
|
||||
w.WriteBool(data.newPr);
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleTxBody:
|
||||
w.WriteBool(isRealObject(data.newPr));
|
||||
if (isRealObject(data.newPr)) {
|
||||
w.WriteString2(data.newPr.Get_Id());
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
Load_Changes: function (r) {
|
||||
if (r.GetLong() === historyitem_type_ChartTitle) {
|
||||
switch (r.GetLong()) {
|
||||
case historyitem_SetCahrtLayout:
|
||||
if (r.GetBool()) {
|
||||
this.layout = new CChartLayout();
|
||||
this.layout.Read_FromBinary2(r);
|
||||
} else {
|
||||
this.layout = null;
|
||||
}
|
||||
break;
|
||||
case historyitem_SetShapeBodyPr:
|
||||
this.txBody.bodyPr = new CBodyPr();
|
||||
this.txBody.bodyPr.Read_FromBinary2(r);
|
||||
this.txBody.recalcInfo.recalculateBodyPr = true;
|
||||
this.recalcInfo.recalculateContent = true;
|
||||
this.recalcInfo.recalculateTransformText = true;
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartGroup:
|
||||
if (r.GetBool()) {
|
||||
this.chartGroup = g_oTableId.Get_ById(r.GetString2());
|
||||
} else {
|
||||
this.chartGroup = null;
|
||||
}
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleType:
|
||||
if (r.GetBool()) {
|
||||
this.type = r.GetLong();
|
||||
} else {
|
||||
this.type = null;
|
||||
}
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleOverlay:
|
||||
this.overlay = r.GetBool();
|
||||
break;
|
||||
case historyitem_AutoShapes_SetChartTitleTxBody:
|
||||
if (r.GetBool()) {
|
||||
this.txBody = g_oTableId.Get_ById(r.GetString2());
|
||||
} else {
|
||||
this.txBody = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (this.chartGroup) {
|
||||
editor.WordControl.m_oLogicDocument.recalcMap[this.chartGroup.Id] = this.chartGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
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 one or more lines are too long
File diff suppressed because it is too large
Load Diff
215
OfficeWeb/sdk/PowerPoint/Editor/Format/GroupPrototype.js
Normal file
215
OfficeWeb/sdk/PowerPoint/Editor/Format/GroupPrototype.js
Normal file
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
"use strict";
|
||||
CGroupShape.prototype.addToRecalculate = CShape.prototype.addToRecalculate;
|
||||
CGroupShape.prototype.handleUpdateTheme = CShape.prototype.handleUpdateTheme;
|
||||
CGroupShape.prototype.getSlideIndex = CShape.prototype.getSlideIndex;
|
||||
CGroupShape.prototype.handleUpdateFill = function () {
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].handleUpdateFill();
|
||||
}
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CGroupShape.prototype.handleUpdateLn = function () {
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].handleUpdateLn();
|
||||
}
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CGroupShape.prototype.recalcText = function () {
|
||||
if (this.spTree) {
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
if (this.spTree[i].recalcText) {
|
||||
this.spTree[i].recalcText();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
CGroupShape.prototype.setRecalculateInfo = function () {
|
||||
var recalcInfo = this.recalcInfo;
|
||||
this.recalcInfo = {
|
||||
recalculateBrush: true,
|
||||
recalculatePen: true,
|
||||
recalculateTransform: true,
|
||||
recalculateArrGraphicObjects: true,
|
||||
recalculateBounds: true,
|
||||
recalculateScaleCoefficients: true
|
||||
};
|
||||
this.localTransform = new CMatrix();
|
||||
this.bounds = {
|
||||
l: 0,
|
||||
t: 0,
|
||||
r: 0,
|
||||
b: 0,
|
||||
w: 0,
|
||||
h: 0
|
||||
};
|
||||
this.lockType = c_oAscLockTypes.kLockTypeNone;
|
||||
};
|
||||
CGroupShape.prototype.recalcTransform = function () {
|
||||
this.recalcInfo.recalculateScaleCoefficients = true;
|
||||
this.recalcInfo.recalculateTransform = true;
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].recalcTransform();
|
||||
}
|
||||
};
|
||||
CGroupShape.prototype.recalcBounds = function () {
|
||||
this.recalcInfo.recalculateBounds = true;
|
||||
};
|
||||
CGroupShape.prototype.addToDrawingObjects = CShape.prototype.addToDrawingObjects;
|
||||
CGroupShape.prototype.getDrawingObjectsController = CShape.prototype.getDrawingObjectsController;
|
||||
CGroupShape.prototype.setDrawingObjects = function (drawingObjects) {
|
||||
this.drawingObjects = drawingObjects;
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].setDrawingObjects(drawingObjects);
|
||||
}
|
||||
};
|
||||
CGroupShape.prototype.setWorksheet = function (worksheet) {
|
||||
History.Add(this, {
|
||||
Type: historyitem_AutoShapes_SetWorksheet,
|
||||
oldPr: this.worksheet,
|
||||
newPr: worksheet
|
||||
});
|
||||
this.worksheet = worksheet;
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].setWorksheet(worksheet);
|
||||
}
|
||||
};
|
||||
CGroupShape.prototype.setDrawingBase = CShape.prototype.setDrawingBase;
|
||||
CGroupShape.prototype.deleteDrawingBase = CShape.prototype.deleteDrawingBase;
|
||||
CGroupShape.prototype.addToRecalculate = CShape.prototype.addToRecalculate;
|
||||
CGroupShape.prototype.convertPixToMM = CShape.prototype.convertPixToMM;
|
||||
CGroupShape.prototype.getCanvasContext = CShape.prototype.getCanvasContext;
|
||||
CGroupShape.prototype.getHierarchy = CShape.prototype.getHierarchy;
|
||||
CGroupShape.prototype.getIsSingleBody = CShape.prototype.getIsSingleBody;
|
||||
CGroupShape.prototype.getParentObjects = CShape.prototype.getParentObjects;
|
||||
CGroupShape.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
|
||||
CGroupShape.prototype.recalculateBounds = function () {
|
||||
var sp_tree = this.spTree;
|
||||
var x_arr_max = [],
|
||||
y_arr_max = [],
|
||||
x_arr_min = [],
|
||||
y_arr_min = [];
|
||||
for (var i = 0; i < sp_tree.length; ++i) {
|
||||
sp_tree[i].recalculate();
|
||||
var bounds = sp_tree[i].bounds;
|
||||
var l = bounds.l;
|
||||
var r = bounds.r;
|
||||
var t = bounds.t;
|
||||
var b = bounds.b;
|
||||
x_arr_max.push(r);
|
||||
x_arr_min.push(l);
|
||||
y_arr_max.push(b);
|
||||
y_arr_min.push(t);
|
||||
}
|
||||
if (!this.group) {
|
||||
var tr = this.localTransform;
|
||||
var arr_p_x = [];
|
||||
var arr_p_y = [];
|
||||
arr_p_x.push(tr.TransformPointX(0, 0));
|
||||
arr_p_y.push(tr.TransformPointY(0, 0));
|
||||
arr_p_x.push(tr.TransformPointX(this.extX, 0));
|
||||
arr_p_y.push(tr.TransformPointY(this.extX, 0));
|
||||
arr_p_x.push(tr.TransformPointX(this.extX, this.extY));
|
||||
arr_p_y.push(tr.TransformPointY(this.extX, this.extY));
|
||||
arr_p_x.push(tr.TransformPointX(0, this.extY));
|
||||
arr_p_y.push(tr.TransformPointY(0, this.extY));
|
||||
x_arr_max = x_arr_max.concat(arr_p_x);
|
||||
x_arr_min = x_arr_min.concat(arr_p_x);
|
||||
y_arr_max = y_arr_max.concat(arr_p_y);
|
||||
y_arr_min = y_arr_min.concat(arr_p_y);
|
||||
}
|
||||
this.bounds.x = Math.min.apply(Math, x_arr_min);
|
||||
this.bounds.y = Math.min.apply(Math, y_arr_min);
|
||||
this.bounds.l = this.bounds.x;
|
||||
this.bounds.t = this.bounds.y;
|
||||
this.bounds.r = Math.max.apply(Math, x_arr_max);
|
||||
this.bounds.b = Math.max.apply(Math, y_arr_max);
|
||||
this.bounds.w = this.bounds.r - this.bounds.l;
|
||||
this.bounds.h = this.bounds.b - this.bounds.t;
|
||||
};
|
||||
CGroupShape.prototype.deselect = CShape.prototype.deselect;
|
||||
CGroupShape.prototype.hitToHandles = CShape.prototype.hitToHandles;
|
||||
CGroupShape.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
|
||||
CGroupShape.prototype.getRotateAngle = CShape.prototype.getRotateAngle;
|
||||
CGroupShape.prototype.handleUpdatePosition = function () {
|
||||
this.recalcTransform();
|
||||
this.addToRecalculate();
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
if (this.spTree[i].handleUpdatePosition) {
|
||||
this.spTree[i].handleUpdatePosition();
|
||||
}
|
||||
}
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CGroupShape.prototype.handleUpdateExtents = function () {
|
||||
this.recalcTransform();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CGroupShape.prototype.handleUpdateRot = CGroupShape.prototype.handleUpdatePosition;
|
||||
CGroupShape.prototype.handleUpdateFlip = CGroupShape.prototype.handleUpdatePosition;
|
||||
CGroupShape.prototype.handleUpdateChildOffset = CGroupShape.prototype.handleUpdatePosition;
|
||||
CGroupShape.prototype.handleUpdateChildExtents = CGroupShape.prototype.handleUpdatePosition;
|
||||
CGroupShape.prototype.updatePosition = CShape.prototype.updatePosition;
|
||||
CGroupShape.prototype.setParent2 = CShape.prototype.setParent2;
|
||||
CGroupShape.prototype.recalculate = function () {
|
||||
if (this.bDeleted || !this.parent) {
|
||||
return;
|
||||
}
|
||||
ExecuteNoHistory(function () {
|
||||
if (this.recalcInfo.recalculateBrush) {
|
||||
this.recalculateBrush();
|
||||
this.recalcInfo.recalculateBrush = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculatePen) {
|
||||
this.recalculatePen();
|
||||
this.recalcInfo.recalculatePen = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateTransform) {
|
||||
this.recalculateTransform();
|
||||
this.calculateSnapArrays();
|
||||
this.recalcInfo.recalculateTransform = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateArrGraphicObjects) {
|
||||
this.recalculateArrGraphicObjects();
|
||||
this.recalcInfo.recalculateArrGraphicObjects = false;
|
||||
}
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].recalculate();
|
||||
}
|
||||
if (this.recalcInfo.recalculateBounds) {
|
||||
this.recalculateBounds();
|
||||
this.recalcInfo.recalculateBounds = false;
|
||||
}
|
||||
},
|
||||
this, []);
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
179
OfficeWeb/sdk/PowerPoint/Editor/Format/ImagePrototype.js
Normal file
179
OfficeWeb/sdk/PowerPoint/Editor/Format/ImagePrototype.js
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
"use strict";
|
||||
CImageShape.prototype.addToDrawingObjects = CShape.prototype.addToDrawingObjects;
|
||||
CImageShape.prototype.setDrawingObjects = CShape.prototype.setDrawingObjects;
|
||||
CImageShape.prototype.setDrawingBase = CShape.prototype.setDrawingBase;
|
||||
CImageShape.prototype.deleteDrawingBase = CShape.prototype.deleteDrawingBase;
|
||||
CImageShape.prototype.addToRecalculate = CShape.prototype.addToRecalculate;
|
||||
CImageShape.prototype.convertPixToMM = CShape.prototype.convertPixToMM;
|
||||
CImageShape.prototype.getCanvasContext = CShape.prototype.getCanvasContext;
|
||||
CImageShape.prototype.getHierarchy = CShape.prototype.getHierarchy;
|
||||
CImageShape.prototype.getParentObjects = CShape.prototype.getParentObjects;
|
||||
CImageShape.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
|
||||
CImageShape.prototype.recalculateBounds = CShape.prototype.recalculateBounds;
|
||||
CImageShape.prototype.deselect = CShape.prototype.deselect;
|
||||
CImageShape.prototype.hitToHandles = CShape.prototype.hitToHandles;
|
||||
CImageShape.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
|
||||
CImageShape.prototype.getRotateAngle = CShape.prototype.getRotateAngle;
|
||||
CImageShape.prototype.setWorksheet = CShape.prototype.setWorksheet;
|
||||
CImageShape.prototype.getDrawingObjectsController = CShape.prototype.getDrawingObjectsController;
|
||||
CImageShape.prototype.setParent2 = CShape.prototype.setParent2;
|
||||
CImageShape.prototype.handleUpdateTheme = CShape.prototype.handleUpdateTheme;
|
||||
CImageShape.prototype.getIsSingleBody = CShape.prototype.getIsSingleBody;
|
||||
CImageShape.prototype.getSlideIndex = CShape.prototype.getSlideIndex;
|
||||
CImageShape.prototype.setRecalculateInfo = function () {
|
||||
this.recalcInfo = {
|
||||
recalculateBrush: true,
|
||||
recalculatePen: true,
|
||||
recalculateTransform: true,
|
||||
recalculateBounds: true,
|
||||
recalculateGeometry: true,
|
||||
recalculateStyle: true,
|
||||
recalculateFill: true,
|
||||
recalculateLine: true,
|
||||
recalculateTransparent: true
|
||||
};
|
||||
this.bounds = {
|
||||
l: 0,
|
||||
t: 0,
|
||||
r: 0,
|
||||
b: 0,
|
||||
w: 0,
|
||||
h: 0
|
||||
};
|
||||
this.lockType = c_oAscLockTypes.kLockTypeNone;
|
||||
};
|
||||
CImageShape.prototype.recalcBrush = function () {
|
||||
this.recalcInfo.recalculateBrush = true;
|
||||
};
|
||||
CImageShape.prototype.recalcPen = function () {
|
||||
this.recalcInfo.recalculatePen = true;
|
||||
};
|
||||
CImageShape.prototype.recalcTransform = function () {
|
||||
this.recalcInfo.recalculateTransform = true;
|
||||
};
|
||||
CImageShape.prototype.recalcBounds = function () {
|
||||
this.recalcInfo.recalculateBounds = true;
|
||||
};
|
||||
CImageShape.prototype.recalcGeometry = function () {
|
||||
this.recalcInfo.recalculateGeometry = true;
|
||||
};
|
||||
CImageShape.prototype.recalcStyle = function () {
|
||||
this.recalcInfo.recalculateStyle = true;
|
||||
};
|
||||
CImageShape.prototype.recalcFill = function () {
|
||||
this.recalcInfo.recalculateFill = true;
|
||||
};
|
||||
CImageShape.prototype.recalcLine = function () {
|
||||
this.recalcInfo.recalculateLine = true;
|
||||
};
|
||||
CImageShape.prototype.recalcTransparent = function () {
|
||||
this.recalcInfo.recalculateTransparent = true;
|
||||
};
|
||||
CImageShape.prototype.handleUpdatePosition = function () {
|
||||
this.recalcTransform();
|
||||
this.recalcBounds();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CImageShape.prototype.handleUpdateExtents = function () {
|
||||
this.recalcGeometry();
|
||||
this.recalcBounds();
|
||||
this.recalcTransform();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CImageShape.prototype.handleUpdateRot = function () {
|
||||
this.recalcTransform();
|
||||
this.recalcBounds();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CImageShape.prototype.handleUpdateFlip = function () {
|
||||
this.recalcTransform();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CImageShape.prototype.handleUpdateFill = function () {
|
||||
this.recalcBrush();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CImageShape.prototype.handleUpdateLn = function () {
|
||||
this.recalcLine();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CImageShape.prototype.handleUpdateGeometry = function () {
|
||||
this.recalcBounds();
|
||||
this.recalcGeometry();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CImageShape.prototype.convertPixToMM = CShape.prototype.convertPixToMM;
|
||||
CImageShape.prototype.getCanvasContext = CShape.prototype.getCanvasContext;
|
||||
CImageShape.prototype.getCompiledStyle = CShape.prototype.getCompiledStyle;
|
||||
CImageShape.prototype.getHierarchy = CShape.prototype.getHierarchy;
|
||||
CImageShape.prototype.getParentObjects = CShape.prototype.getParentObjects;
|
||||
CImageShape.prototype.recalculate = function () {
|
||||
if (this.bDeleted || !this.parent) {
|
||||
return;
|
||||
}
|
||||
ExecuteNoHistory(function () {
|
||||
if (this.recalcInfo.recalculateBrush) {
|
||||
this.recalculateBrush();
|
||||
this.recalcInfo.recalculateBrush = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculatePen) {
|
||||
this.recalculatePen();
|
||||
this.recalcInfo.recalculatePen = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateTransform) {
|
||||
this.recalculateTransform();
|
||||
this.calculateSnapArrays();
|
||||
this.recalcInfo.recalculateTransform = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateGeometry) {
|
||||
this.recalculateGeometry();
|
||||
this.recalcInfo.recalculateGeometry = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateBounds) {
|
||||
this.recalculateBounds();
|
||||
this.recalcInfo.recalculateBounds = false;
|
||||
}
|
||||
},
|
||||
this, []);
|
||||
};
|
||||
CImageShape.prototype.recalculateBounds = CShape.prototype.recalculateBounds;
|
||||
CImageShape.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
|
||||
CImageShape.prototype.hitInPath = CShape.prototype.hitInPath;
|
||||
CImageShape.prototype.hitToHandles = CShape.prototype.hitToHandles;
|
||||
CImageShape.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
|
||||
CImageShape.prototype.getNumByCardDirection = CShape.prototype.getNumByCardDirection;
|
||||
CImageShape.prototype.getCardDirectionByNum = CShape.prototype.getCardDirectionByNum;
|
||||
CImageShape.prototype.getResizeCoefficients = CShape.prototype.getResizeCoefficients;
|
||||
CImageShape.prototype.check_bounds = CShape.prototype.check_bounds;
|
||||
CImageShape.prototype.normalize = CShape.prototype.normalize;
|
||||
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
648
OfficeWeb/sdk/PowerPoint/Editor/Format/ShapePrototype.js
Normal file
648
OfficeWeb/sdk/PowerPoint/Editor/Format/ShapePrototype.js
Normal file
@@ -0,0 +1,648 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
"use strict";
|
||||
var G_O_DEFAULT_COLOR_MAP = GenerateDefaultColorMap();
|
||||
CRFonts.prototype.Merge = function (RFonts) {
|
||||
if (undefined !== RFonts.Ascii) {
|
||||
this.Ascii = RFonts.Ascii;
|
||||
}
|
||||
if (undefined != RFonts.EastAsia) {
|
||||
this.EastAsia = RFonts.EastAsia;
|
||||
} else {
|
||||
if (undefined !== RFonts.Ascii) {
|
||||
this.EastAsia = RFonts.Ascii;
|
||||
}
|
||||
}
|
||||
if (undefined != RFonts.HAnsi) {
|
||||
this.HAnsi = RFonts.HAnsi;
|
||||
} else {
|
||||
if (undefined !== RFonts.Ascii) {
|
||||
this.HAnsi = RFonts.Ascii;
|
||||
}
|
||||
}
|
||||
if (undefined != RFonts.CS) {
|
||||
this.CS = RFonts.CS;
|
||||
} else {
|
||||
if (undefined !== RFonts.Ascii) {
|
||||
this.CS = RFonts.Ascii;
|
||||
}
|
||||
}
|
||||
if (undefined != RFonts.Hint) {
|
||||
this.Hint = RFonts.Hint;
|
||||
}
|
||||
};
|
||||
CShape.prototype.setDrawingObjects = function (drawingObjects) {};
|
||||
CShape.prototype.setWorksheet = function (worksheet) {
|
||||
History.Add(this, {
|
||||
Type: historyitem_AutoShapes_SetWorksheet,
|
||||
oldPr: this.worksheet,
|
||||
newPr: worksheet
|
||||
});
|
||||
this.worksheet = worksheet;
|
||||
if (this.spTree) {
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].setWorksheet(worksheet);
|
||||
}
|
||||
}
|
||||
};
|
||||
CShape.prototype.setDrawingBase = function (drawingBase) {
|
||||
this.drawingBase = drawingBase;
|
||||
if (Array.isArray(this.spTree)) {
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].setDrawingBase(drawingBase);
|
||||
}
|
||||
}
|
||||
};
|
||||
CShape.prototype.getDrawingObjectsController = function () {
|
||||
if (this.parent && this.parent.getObjectType() === historyitem_type_Slide) {
|
||||
return this.parent.graphicObjects;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
function addToDrawings(worksheet, graphic, position, lockByDefault) {
|
||||
var drawingObjects;
|
||||
var wsViews = Asc["editor"].wb.wsViews;
|
||||
for (var i = 0; i < wsViews.length; ++i) {
|
||||
if (wsViews[i] && wsViews[i].model === worksheet) {
|
||||
drawingObjects = wsViews[i].objectRender;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!drawingObjects) {
|
||||
drawingObjects = new DrawingObjects();
|
||||
}
|
||||
var drawingObject = drawingObjects.createDrawingObject();
|
||||
drawingObject.graphicObject = graphic;
|
||||
graphic.setDrawingBase(drawingObject);
|
||||
if (!worksheet) {
|
||||
return;
|
||||
}
|
||||
var ret, aObjects = worksheet.Drawings;
|
||||
if (isRealNumber(position)) {
|
||||
aObjects.splice(position, 0, drawingObject);
|
||||
ret = position;
|
||||
} else {
|
||||
ret = aObjects.length;
|
||||
aObjects.push(drawingObject);
|
||||
}
|
||||
if (graphic.recalcTransform) {
|
||||
graphic.recalcTransform();
|
||||
graphic.addToRecalculate();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
function deleteDrawingBase(aObjects, graphicId) {
|
||||
var position = null;
|
||||
for (var i = 0; i < aObjects.length; i++) {
|
||||
if (aObjects[i].graphicObject.Get_Id() == graphicId) {
|
||||
aObjects.splice(i, 1);
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return position;
|
||||
}
|
||||
CShape.prototype.addToDrawingObjects = function (pos) {
|
||||
if (this.parent && this.parent.cSld && this.parent.cSld.spTree) {
|
||||
this.parent.shapeAdd(pos, this);
|
||||
}
|
||||
};
|
||||
CShape.prototype.deleteDrawingBase = function (bCheckPlaceholder) {
|
||||
if (this.parent && this.parent.cSld && this.parent.cSld.spTree) {
|
||||
var pos = this.parent.removeFromSpTreeById(this.Id);
|
||||
if (bCheckPlaceholder && this.isPlaceholder() && !this.isEmptyPlaceholder()) {
|
||||
var hierarchy = this.getHierarchy();
|
||||
if (hierarchy[0]) {
|
||||
var copy = hierarchy[0].copy();
|
||||
copy.setParent(this.parent);
|
||||
copy.addToDrawingObjects(pos);
|
||||
var doc_content = copy.getDocContent && copy.getDocContent();
|
||||
if (doc_content) {
|
||||
doc_content.Set_ApplyToAll(true);
|
||||
doc_content.Remove(-1);
|
||||
doc_content.Set_ApplyToAll(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
CShape.prototype.setRecalculateInfo = function () {
|
||||
this.recalcInfo = {
|
||||
recalculateContent: true,
|
||||
recalculateBrush: true,
|
||||
recalculatePen: true,
|
||||
recalculateTransform: true,
|
||||
recalculateTransformText: true,
|
||||
recalculateBounds: true,
|
||||
recalculateGeometry: true,
|
||||
recalculateStyle: true,
|
||||
recalculateFill: true,
|
||||
recalculateLine: true,
|
||||
recalculateTransparent: true,
|
||||
recalculateTextStyles: [true, true, true, true, true, true, true, true, true],
|
||||
recalculateContent2: true
|
||||
};
|
||||
this.compiledStyles = [];
|
||||
this.textPropsForRecalc = [];
|
||||
this.bounds = {
|
||||
l: 0,
|
||||
t: 0,
|
||||
r: 0,
|
||||
b: 0,
|
||||
w: 0,
|
||||
h: 0
|
||||
};
|
||||
this.lockType = c_oAscLockTypes.kLockTypeNone;
|
||||
};
|
||||
CShape.prototype.recalcContent = function () {
|
||||
this.recalcInfo.recalculateContent = true;
|
||||
};
|
||||
CShape.prototype.recalcContent2 = function () {
|
||||
this.recalcInfo.recalculateContent2 = true;
|
||||
};
|
||||
CShape.prototype.getDrawingDocument = function () {
|
||||
return editor.WordControl.m_oLogicDocument.DrawingDocument;
|
||||
};
|
||||
CShape.prototype.recalcBrush = function () {
|
||||
this.recalcInfo.recalculateBrush = true;
|
||||
};
|
||||
CShape.prototype.recalcPen = function () {
|
||||
this.recalcInfo.recalculatePen = true;
|
||||
};
|
||||
CShape.prototype.recalcTransform = function () {
|
||||
this.recalcInfo.recalculateTransform = true;
|
||||
};
|
||||
CShape.prototype.recalcTransformText = function () {
|
||||
this.recalcInfo.recalculateTransformText = true;
|
||||
};
|
||||
CShape.prototype.recalcBounds = function () {
|
||||
this.recalcInfo.recalculateBounds = true;
|
||||
};
|
||||
CShape.prototype.recalcGeometry = function () {
|
||||
this.recalcInfo.recalculateGeometry = true;
|
||||
};
|
||||
CShape.prototype.recalcStyle = function () {
|
||||
this.recalcInfo.recalculateStyle = true;
|
||||
};
|
||||
CShape.prototype.recalcFill = function () {
|
||||
this.recalcInfo.recalculateFill = true;
|
||||
};
|
||||
CShape.prototype.recalcLine = function () {
|
||||
this.recalcInfo.recalculateLine = true;
|
||||
};
|
||||
CShape.prototype.recalcTransparent = function () {
|
||||
this.recalcInfo.recalculateTransparent = true;
|
||||
};
|
||||
CShape.prototype.recalcTextStyles = function () {
|
||||
this.recalcInfo.recalculateTextStyles = [true, true, true, true, true, true, true, true, true];
|
||||
};
|
||||
CShape.prototype.addToRecalculate = function () {
|
||||
History.RecalcData_Add({
|
||||
Type: historyrecalctype_Drawing,
|
||||
Object: this
|
||||
});
|
||||
};
|
||||
CShape.prototype.getSlideIndex = function () {
|
||||
if (this.parent && isRealNumber(this.parent.num)) {
|
||||
return this.parent.num;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
CShape.prototype.handleUpdatePosition = function () {
|
||||
this.recalcTransform();
|
||||
this.recalcBounds();
|
||||
this.recalcTransformText();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CShape.prototype.handleUpdateExtents = function () {
|
||||
this.recalcGeometry();
|
||||
this.recalcBounds();
|
||||
this.recalcTransform();
|
||||
this.recalcContent();
|
||||
this.recalcContent2();
|
||||
this.recalcTransformText();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CShape.prototype.handleUpdateTheme = function () {
|
||||
this.setRecalculateInfo();
|
||||
if (this.isPlaceholder() && !(this.spPr && this.spPr.xfrm && (this.getObjectType() === historyitem_type_GroupShape && this.spPr.xfrm.isNotNullForGroup() || this.getObjectType() !== historyitem_type_GroupShape && this.spPr.xfrm.isNotNull()))) {
|
||||
this.recalcTransform();
|
||||
this.recalcGeometry();
|
||||
}
|
||||
var content = this.getDocContent && this.getDocContent();
|
||||
if (content) {
|
||||
content.Recalc_AllParagraphs_CompiledPr();
|
||||
}
|
||||
this.recalcContent && this.recalcContent();
|
||||
this.recalcFill && this.recalcFill();
|
||||
this.recalcLine && this.recalcLine();
|
||||
this.recalcPen && this.recalcPen();
|
||||
this.recalcBrush && this.recalcBrush();
|
||||
this.recalcStyle && this.recalcStyle();
|
||||
this.recalcInfo.recalculateTextStyles && (this.recalcInfo.recalculateTextStyles = [true, true, true, true, true, true, true, true, true]);
|
||||
this.recalcBounds && this.recalcBounds();
|
||||
this.handleTitlesAfterChangeTheme && this.handleTitlesAfterChangeTheme();
|
||||
if (Array.isArray(this.spTree)) {
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].handleUpdateTheme();
|
||||
}
|
||||
}
|
||||
};
|
||||
CShape.prototype.handleUpdateRot = function () {
|
||||
this.recalcTransform();
|
||||
if (this.txBody && this.txBody.bodyPr && this.txBody.bodyPr.upright) {
|
||||
this.recalcContent();
|
||||
this.recalcContent2();
|
||||
}
|
||||
this.recalcTransformText();
|
||||
this.recalcBounds();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CShape.prototype.handleUpdateFlip = function () {
|
||||
this.recalcTransform();
|
||||
this.recalcTransformText();
|
||||
this.recalcContent();
|
||||
this.recalcContent2();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CShape.prototype.handleUpdateFill = function () {
|
||||
this.recalcBrush();
|
||||
this.recalcFill();
|
||||
this.recalcTransparent();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CShape.prototype.handleUpdateLn = function () {
|
||||
this.recalcPen();
|
||||
this.recalcLine();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CShape.prototype.handleUpdateGeometry = function () {
|
||||
this.recalcGeometry();
|
||||
this.recalcBounds();
|
||||
this.recalcContent();
|
||||
this.recalcContent2();
|
||||
this.recalcTransformText();
|
||||
this.addToRecalculate();
|
||||
};
|
||||
CShape.prototype.convertPixToMM = function (pix) {
|
||||
return editor.WordControl.m_oLogicDocument.DrawingDocument.GetMMPerDot(pix);
|
||||
};
|
||||
CShape.prototype.getCanvasContext = function () {
|
||||
return editor.WordControl.m_oLogicDocument.DrawingDocument.CanvasHitContext;
|
||||
};
|
||||
CShape.prototype.getCompiledStyle = function () {
|
||||
return this.style;
|
||||
};
|
||||
CShape.prototype.getParentObjects = function () {
|
||||
if (this.parent) {
|
||||
switch (this.parent.getObjectType()) {
|
||||
case historyitem_type_Slide:
|
||||
return {
|
||||
presentation: editor.WordControl.m_oLogicDocument,
|
||||
slide: this.parent,
|
||||
layout: this.parent.Layout,
|
||||
master: this.parent.Layout ? this.parent.Layout.Master : null,
|
||||
theme: this.themeOverride ? this.themeOverride : (this.parent.Layout && this.parent.Layout.Master ? this.parent.Layout.Master.Theme : null)
|
||||
};
|
||||
case historyitem_type_SlideLayout:
|
||||
return {
|
||||
presentation: editor.WordControl.m_oLogicDocument,
|
||||
slide: null,
|
||||
layout: this.parent,
|
||||
master: this.parent.Master,
|
||||
theme: this.themeOverride ? this.themeOverride : (this.parent.Master ? this.parent.Master.Theme : null)
|
||||
};
|
||||
case historyitem_type_SlideMaster:
|
||||
return {
|
||||
presentation: editor.WordControl.m_oLogicDocument,
|
||||
slide: null,
|
||||
layout: null,
|
||||
master: this.parent,
|
||||
theme: this.themeOverride ? this.themeOverride : this.parent.Theme
|
||||
};
|
||||
}
|
||||
}
|
||||
return {
|
||||
slide: null,
|
||||
layout: null,
|
||||
master: null,
|
||||
theme: null
|
||||
};
|
||||
};
|
||||
CShape.prototype.recalcText = function () {
|
||||
this.recalcInfo.recalculateContent = true;
|
||||
this.recalcInfo.recalculateContent2 = true;
|
||||
this.recalcInfo.recalculateTransformText = true;
|
||||
};
|
||||
CShape.prototype.recalculate = function () {
|
||||
if (this.bDeleted || !this.parent) {
|
||||
return;
|
||||
}
|
||||
var check_slide_placeholder = !this.isPlaceholder() || (this.parent && this.parent.getObjectType() === historyitem_type_Slide);
|
||||
ExecuteNoHistory(function () {
|
||||
if (this.recalcInfo.recalculateBrush) {
|
||||
this.recalculateBrush();
|
||||
this.recalcInfo.recalculateBrush = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculatePen) {
|
||||
this.recalculatePen();
|
||||
this.recalcInfo.recalculatePen = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateTransform) {
|
||||
this.recalculateTransform();
|
||||
this.calculateSnapArrays();
|
||||
this.recalcInfo.recalculateTransform = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateGeometry) {
|
||||
this.recalculateGeometry();
|
||||
this.recalcInfo.recalculateGeometry = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateContent && check_slide_placeholder) {
|
||||
this.recalculateContent();
|
||||
this.recalcInfo.recalculateContent = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateContent2 && check_slide_placeholder) {
|
||||
this.recalculateContent2();
|
||||
this.recalcInfo.recalculateContent2 = false;
|
||||
}
|
||||
if (this.recalcInfo.recalculateTransformText && check_slide_placeholder) {
|
||||
this.recalculateTransformText();
|
||||
this.recalcInfo.recalculateTransformText = false;
|
||||
this.clipRect = null;
|
||||
}
|
||||
if (this.recalcInfo.recalculateBounds) {
|
||||
this.recalculateBounds();
|
||||
this.recalcInfo.recalculateBounds = false;
|
||||
}
|
||||
},
|
||||
this, []);
|
||||
};
|
||||
CShape.prototype.recalculateBounds = function () {
|
||||
var boundsChecker = new CSlideBoundsChecker();
|
||||
this.draw(boundsChecker);
|
||||
boundsChecker.CorrectBounds();
|
||||
this.bounds.x = boundsChecker.Bounds.min_x;
|
||||
this.bounds.y = boundsChecker.Bounds.min_y;
|
||||
this.bounds.l = boundsChecker.Bounds.min_x;
|
||||
this.bounds.t = boundsChecker.Bounds.min_y;
|
||||
this.bounds.r = boundsChecker.Bounds.max_x;
|
||||
this.bounds.b = boundsChecker.Bounds.max_y;
|
||||
this.bounds.w = boundsChecker.Bounds.max_x - boundsChecker.Bounds.min_x;
|
||||
this.bounds.h = boundsChecker.Bounds.max_y - boundsChecker.Bounds.min_y;
|
||||
};
|
||||
CShape.prototype.recalculateContent = function () {
|
||||
var content = this.getDocContent();
|
||||
if (content) {
|
||||
var w, h;
|
||||
var l_ins, t_ins, r_ins, b_ins;
|
||||
var body_pr = this.getBodyPr();
|
||||
if (body_pr) {
|
||||
l_ins = isRealNumber(body_pr.lIns) ? body_pr.lIns : 2.54;
|
||||
r_ins = isRealNumber(body_pr.rIns) ? body_pr.rIns : 2.54;
|
||||
t_ins = isRealNumber(body_pr.tIns) ? body_pr.tIns : 1.27;
|
||||
b_ins = isRealNumber(body_pr.bIns) ? body_pr.bIns : 1.27;
|
||||
} else {
|
||||
l_ins = 2.54;
|
||||
r_ins = 2.54;
|
||||
t_ins = 1.27;
|
||||
b_ins = 1.27;
|
||||
}
|
||||
if (this.spPr.geometry && this.spPr.geometry.rect && isRealNumber(this.spPr.geometry.rect.l) && isRealNumber(this.spPr.geometry.rect.t) && isRealNumber(this.spPr.geometry.rect.r) && isRealNumber(this.spPr.geometry.rect.r)) {
|
||||
w = this.spPr.geometry.rect.r - this.spPr.geometry.rect.l - (l_ins + r_ins) + 1;
|
||||
h = this.spPr.geometry.rect.b - this.spPr.geometry.rect.t - (t_ins + b_ins) + 1;
|
||||
} else {
|
||||
w = this.extX - (l_ins + r_ins) + 1;
|
||||
h = this.extY - (t_ins + b_ins) + 1;
|
||||
}
|
||||
if (this.txBody) {
|
||||
if (!body_pr.upright) {
|
||||
if (! (body_pr.vert === nVertTTvert || body_pr.vert === nVertTTvert270)) {
|
||||
this.txBody.contentWidth = w;
|
||||
this.txBody.contentHeight = h;
|
||||
} else {
|
||||
this.txBody.contentWidth = h;
|
||||
this.txBody.contentHeight = w;
|
||||
}
|
||||
} else {
|
||||
var _full_rotate = this.getFullRotate();
|
||||
if (checkNormalRotate(_full_rotate)) {
|
||||
if (! (body_pr.vert === nVertTTvert || body_pr.vert === nVertTTvert270)) {
|
||||
this.txBody.contentWidth = w;
|
||||
this.txBody.contentHeight = h;
|
||||
} else {
|
||||
this.txBody.contentWidth = h;
|
||||
this.txBody.contentHeight = w;
|
||||
}
|
||||
} else {
|
||||
if (! (body_pr.vert === nVertTTvert || body_pr.vert === nVertTTvert270)) {
|
||||
this.txBody.contentWidth = h;
|
||||
this.txBody.contentHeight = w;
|
||||
} else {
|
||||
this.txBody.contentWidth = w;
|
||||
this.txBody.contentHeight = h;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.contentWidth = this.txBody.contentWidth;
|
||||
this.contentHeight = this.txBody.contentHeight;
|
||||
content.Set_StartPage(0);
|
||||
content.Reset(0, 0, w, 20000);
|
||||
content.Recalculate_Page(content.StartPage, true);
|
||||
}
|
||||
};
|
||||
CShape.prototype.recalculateContent2 = function () {
|
||||
if (this.txBody) {
|
||||
if (this.isPlaceholder()) {
|
||||
if (!this.isEmptyPlaceholder()) {
|
||||
return;
|
||||
}
|
||||
var text = typeof pHText[0][this.nvSpPr.nvPr.ph.type] === "string" && pHText[0][this.nvSpPr.nvPr.ph.type].length > 0 ? pHText[0][this.nvSpPr.nvPr.ph.type] : pHText[0][phType_body];
|
||||
if (!this.txBody.content2) {
|
||||
this.txBody.content2 = CreateDocContentFromString(text, this.getDrawingDocument(), this.txBody);
|
||||
} else {
|
||||
this.txBody.content2.Recalc_AllParagraphs_CompiledPr();
|
||||
}
|
||||
var content = this.txBody.content2;
|
||||
if (content) {
|
||||
var w, h;
|
||||
var l_ins, t_ins, r_ins, b_ins;
|
||||
var body_pr = this.getBodyPr();
|
||||
if (body_pr) {
|
||||
l_ins = isRealNumber(body_pr.lIns) ? body_pr.lIns : 2.54;
|
||||
r_ins = isRealNumber(body_pr.rIns) ? body_pr.rIns : 2.54;
|
||||
t_ins = isRealNumber(body_pr.tIns) ? body_pr.tIns : 1.27;
|
||||
b_ins = isRealNumber(body_pr.bIns) ? body_pr.bIns : 1.27;
|
||||
} else {
|
||||
l_ins = 2.54;
|
||||
r_ins = 2.54;
|
||||
t_ins = 1.27;
|
||||
b_ins = 1.27;
|
||||
}
|
||||
if (this.spPr.geometry && this.spPr.geometry.rect && isRealNumber(this.spPr.geometry.rect.l) && isRealNumber(this.spPr.geometry.rect.t) && isRealNumber(this.spPr.geometry.rect.r) && isRealNumber(this.spPr.geometry.rect.r)) {
|
||||
w = this.spPr.geometry.rect.r - this.spPr.geometry.rect.l - (l_ins + r_ins);
|
||||
h = this.spPr.geometry.rect.b - this.spPr.geometry.rect.t - (t_ins + b_ins);
|
||||
} else {
|
||||
w = this.extX - (l_ins + r_ins);
|
||||
h = this.extY - (t_ins + b_ins);
|
||||
}
|
||||
if (!body_pr.upright) {
|
||||
if (! (body_pr.vert === nVertTTvert || body_pr.vert === nVertTTvert270)) {
|
||||
this.txBody.contentWidth2 = w;
|
||||
this.txBody.contentHeight2 = h;
|
||||
} else {
|
||||
this.txBody.contentWidth2 = h;
|
||||
this.txBody.contentHeight2 = w;
|
||||
}
|
||||
} else {
|
||||
var _full_rotate = this.getFullRotate();
|
||||
if (checkNormalRotate(_full_rotate)) {
|
||||
if (! (body_pr.vert === nVertTTvert || body_pr.vert === nVertTTvert270)) {
|
||||
this.txBody.contentWidth2 = w;
|
||||
this.txBody.contentHeight2 = h;
|
||||
} else {
|
||||
this.txBody.contentWidth2 = h;
|
||||
this.txBody.contentHeight2 = w;
|
||||
}
|
||||
} else {
|
||||
if (! (body_pr.vert === nVertTTvert || body_pr.vert === nVertTTvert270)) {
|
||||
this.txBody.contentWidth2 = h;
|
||||
this.txBody.contentHeight2 = w;
|
||||
} else {
|
||||
this.txBody.contentWidth2 = w;
|
||||
this.txBody.contentHeight2 = h;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.contentWidth2 = this.txBody.contentWidth2;
|
||||
this.contentHeight2 = this.txBody.contentHeight2;
|
||||
var content_ = this.getDocContent();
|
||||
if (content_ && content_.Content[0]) {
|
||||
content.Content[0].Pr = content_.Content[0].Pr;
|
||||
var para_text_pr = new ParaTextPr(content_.Content[0].Get_FirstRunPr());
|
||||
content.Set_ApplyToAll(true);
|
||||
content.Paragraph_Add(para_text_pr);
|
||||
content.Set_ApplyToAll(false);
|
||||
}
|
||||
content.Set_StartPage(0);
|
||||
content.Reset(0, 0, w, 20000);
|
||||
content.Recalculate_Page(content.StartPage, true);
|
||||
} else {
|
||||
this.txBody.content2 = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
CShape.prototype.Get_ColorMap = function () {
|
||||
var parent_objects = this.getParentObjects();
|
||||
if (parent_objects.slide && parent_objects.slide.clrMap) {
|
||||
return parent_objects.slide.clrMap;
|
||||
} else {
|
||||
if (parent_objects.layout && parent_objects.layout.clrMap) {
|
||||
return parent_objects.layout.clrMap;
|
||||
} else {
|
||||
if (parent_objects.master && parent_objects.master.clrMap) {
|
||||
return parent_objects.master.clrMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
return G_O_DEFAULT_COLOR_MAP;
|
||||
};
|
||||
CShape.prototype.getStyles = function (index) {
|
||||
return this.Get_Styles(index);
|
||||
};
|
||||
CShape.prototype.Get_Worksheet = function () {
|
||||
return this.worksheet;
|
||||
};
|
||||
CShape.prototype.setParent2 = function (parent) {
|
||||
this.setParent(parent);
|
||||
if (Array.isArray(this.spTree)) {
|
||||
for (var i = 0; i < this.spTree.length; ++i) {
|
||||
this.spTree[i].setParent2(parent);
|
||||
}
|
||||
}
|
||||
};
|
||||
CShape.prototype.hitInTextRect = function (x, y) {
|
||||
var content = this.getDocContent && this.getDocContent();
|
||||
if (content && this.invertTransformText) {
|
||||
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 < content.XLimit && t_y > 0 && t_y < content.Get_SummaryHeight();
|
||||
}
|
||||
return false;
|
||||
};
|
||||
CShape.prototype.getIsSingleBody = function (x, y) {
|
||||
if (!this.isPlaceholder()) {
|
||||
return false;
|
||||
}
|
||||
if (this.getPlaceholderType() !== phType_body) {
|
||||
return false;
|
||||
}
|
||||
if (this.parent && this.parent.cSld && Array.isArray(this.parent.cSld.spTree)) {
|
||||
var sp_tree = this.parent.cSld.spTree;
|
||||
for (var i = 0; i < sp_tree.length; ++i) {
|
||||
if (sp_tree[i] !== this && sp_tree[i].getPlaceholderType && sp_tree[i].getPlaceholderType() === phType_body) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
CShape.prototype.Set_CurrentElement = function (bUpdate, pageIndex) {
|
||||
if (this.parent) {
|
||||
var drawing_objects = this.parent.graphicObjects;
|
||||
drawing_objects.resetSelection(true);
|
||||
if (this.group) {
|
||||
var main_group = this.group.getMainGroup();
|
||||
drawing_objects.selectObject(main_group, 0);
|
||||
main_group.selectObject(this, 0);
|
||||
main_group.selection.textSelection = this;
|
||||
drawing_objects.selection.groupSelection = main_group;
|
||||
} else {
|
||||
drawing_objects.selectObject(this, 0);
|
||||
drawing_objects.selection.textSelection = this;
|
||||
}
|
||||
if (editor.WordControl.m_oLogicDocument.CurPage !== this.parent.num) {
|
||||
editor.WordControl.m_oLogicDocument.Set_CurPage(this.parent.num);
|
||||
editor.WordControl.GoToPage(this.parent.num);
|
||||
}
|
||||
}
|
||||
};
|
||||
CTextBody.prototype.Get_Worksheet = function () {
|
||||
return this.parent && this.parent.Get_Worksheet && this.parent.Get_Worksheet();
|
||||
};
|
||||
CTextBody.prototype.getDrawingDocument = function () {
|
||||
return this.parent && this.parent.getDrawingDocument && this.parent.getDrawingDocument();
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,520 +0,0 @@
|
||||
/*
|
||||
* (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 CDocumentSpelling() {
|
||||
this.Paragraphs = new Object();
|
||||
this.Words = new Object();
|
||||
this.CheckPara = new Object();
|
||||
this.CurPara = new Object();
|
||||
}
|
||||
CDocumentSpelling.prototype = {
|
||||
Add_Paragraph: function (Id, Para) {
|
||||
this.Paragraphs[Id] = Para;
|
||||
},
|
||||
Remove_Paragraph: function (Id) {
|
||||
delete this.Paragraphs[Id];
|
||||
},
|
||||
Check_Word: function (Word) {
|
||||
if (undefined != this.Words[Word]) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
Add_Word: function (Word) {
|
||||
this.Words[Word] = true;
|
||||
for (var Id in this.Paragraphs) {
|
||||
var Para = this.Paragraphs[Id];
|
||||
Para.SpellChecker.Ignore(Word);
|
||||
}
|
||||
},
|
||||
Add_ParagraphToCheck: function (Id, Para) {
|
||||
this.CheckPara[Id] = Para;
|
||||
},
|
||||
Continue_CheckSpelling: function () {
|
||||
var Counter = 0;
|
||||
for (var Id in this.CheckPara) {
|
||||
var Para = this.CheckPara[Id];
|
||||
Para.Continue_CheckSpelling();
|
||||
delete this.CheckPara[Id];
|
||||
Counter++;
|
||||
if (Counter > 20) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var Id in this.CurPara) {
|
||||
var Para = this.CurPara[Id];
|
||||
delete this.CurPara[Id];
|
||||
Para.SpellChecker.Reset_ElementsWithCurPos();
|
||||
Para.SpellChecker.Check();
|
||||
}
|
||||
},
|
||||
Add_CurPara: function (Id, Para) {
|
||||
this.CurPara[Id] = Para;
|
||||
}
|
||||
};
|
||||
function CParaSpellChecker() {
|
||||
this.Elements = new Array();
|
||||
this.RecalcId = -1;
|
||||
this.ParaId = -1;
|
||||
}
|
||||
CParaSpellChecker.prototype = {
|
||||
Clear: function () {
|
||||
this.Elements = new Array();
|
||||
},
|
||||
Add: function (StartPos, EndPos, Word, Lang) {
|
||||
this.Elements.push(new CParaSpellCheckerElement(StartPos, EndPos, Word, Lang));
|
||||
},
|
||||
Check: function () {
|
||||
var Paragraph = g_oTableId.Get_ById(this.ParaId);
|
||||
var bCurrent = Paragraph.Is_ThisElementCurrent();
|
||||
var CurPos = -1;
|
||||
if (true === bCurrent && false === Paragraph.Selection.Use) {
|
||||
CurPos = Paragraph.CurPos.ContentPos;
|
||||
}
|
||||
var usrWords = new Array();
|
||||
var usrLang = new Array();
|
||||
var Count = this.Elements.length;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
Element.CurPos = false;
|
||||
if (1 >= Element.Word.length) {
|
||||
Element.Checked = true;
|
||||
} else {
|
||||
if (null === Element.Checked && -1 != CurPos && Element.EndPos >= CurPos - 1 && Element.StartPos <= CurPos) {
|
||||
Element.Checked = true;
|
||||
Element.CurPos = true;
|
||||
editor.WordControl.m_oLogicDocument.Spelling.Add_CurPara(this.ParaId, g_oTableId.Get_ById(this.ParaId));
|
||||
}
|
||||
}
|
||||
if (null === Element.Checked) {
|
||||
usrWords.push(this.Elements[Index].Word);
|
||||
usrLang.push(this.Elements[Index].Lang);
|
||||
}
|
||||
}
|
||||
if (0 < usrWords.length) {
|
||||
spellCheck(editor, {
|
||||
"type": "spell",
|
||||
"ParagraphId": this.ParaId,
|
||||
"RecalcId": this.RecalcId,
|
||||
"ElementId": 0,
|
||||
"usrWords": usrWords,
|
||||
"usrLang": usrLang
|
||||
});
|
||||
}
|
||||
},
|
||||
Check_CallBack: function (RecalcId, UsrCorrect) {
|
||||
if (RecalcId == this.RecalcId) {
|
||||
var DocumentSpelling = editor.WordControl.m_oLogicDocument.Spelling;
|
||||
var Count = this.Elements.length;
|
||||
var Index2 = 0;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (null === Element.Checked && true != Element.Checked) {
|
||||
if (true === DocumentSpelling.Check_Word(Element.Word)) {
|
||||
Element.Checked = true;
|
||||
} else {
|
||||
Element.Checked = UsrCorrect[Index2];
|
||||
}
|
||||
Index2++;
|
||||
}
|
||||
}
|
||||
this.Internal_UpdateParagraphState();
|
||||
}
|
||||
},
|
||||
Internal_UpdateParagraphState: function () {
|
||||
var DocumentSpelling = editor.WordControl.m_oLogicDocument.Spelling;
|
||||
var bMisspeled = false;
|
||||
var Count = this.Elements.length;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
if (false === this.Elements[Index].Checked) {
|
||||
bMisspeled = true;
|
||||
}
|
||||
}
|
||||
if (true === bMisspeled) {
|
||||
DocumentSpelling.Add_Paragraph(this.ParaId, g_oTableId.Get_ById(this.ParaId));
|
||||
} else {
|
||||
DocumentSpelling.Remove_Paragraph(this.ParaId);
|
||||
}
|
||||
},
|
||||
Check_Spelling: function (Pos) {
|
||||
var Count = this.Elements.length;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (Element.StartPos > Pos) {
|
||||
break;
|
||||
} else {
|
||||
if (Element.EndPos < Pos) {
|
||||
continue;
|
||||
} else {
|
||||
return (Element.Checked === null ? true : Element.Checked);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
Document_UpdateInterfaceState: function (StartPos, EndPos) {
|
||||
var Count = this.Elements.length;
|
||||
var FoundElement = null;
|
||||
var FoundIndex = -1;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (Element.StartPos <= EndPos && Element.EndPos >= StartPos && false === Element.Checked) {
|
||||
if (null != FoundElement) {
|
||||
FoundElement = null;
|
||||
break;
|
||||
} else {
|
||||
FoundIndex = Index;
|
||||
FoundElement = Element;
|
||||
}
|
||||
}
|
||||
}
|
||||
var Word = "";
|
||||
var Variants = null;
|
||||
var Checked = null;
|
||||
if (null != FoundElement) {
|
||||
Word = FoundElement.Word;
|
||||
Variants = FoundElement.Variants;
|
||||
Checked = FoundElement.Checked;
|
||||
if (null === Variants) {
|
||||
spellCheck(editor, {
|
||||
"type": "suggest",
|
||||
"ParagraphId": this.ParaId,
|
||||
"RecalcId": this.RecalcId,
|
||||
"ElementId": FoundIndex,
|
||||
"usrWords": [Word],
|
||||
"usrLang": [FoundElement.Lang]
|
||||
});
|
||||
}
|
||||
}
|
||||
if (null === Checked) {
|
||||
Checked = true;
|
||||
}
|
||||
editor.sync_SpellCheckCallback(Word, Checked, Variants, this.ParaId, FoundIndex);
|
||||
},
|
||||
Check_CallBack2: function (RecalcId, ElementId, usrVariants) {
|
||||
if (RecalcId == this.RecalcId) {
|
||||
this.Elements[ElementId].Variants = usrVariants[0];
|
||||
}
|
||||
},
|
||||
Ignore: function (Word) {
|
||||
var Count = this.Elements.length;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (false === Element.Checked && Word === Element.Word) {
|
||||
Element.Checked = true;
|
||||
}
|
||||
}
|
||||
this.Internal_UpdateParagraphState();
|
||||
},
|
||||
Update_OnAdd: function (Paragraph, Pos, Item) {
|
||||
var ItemType = Item.Type;
|
||||
var Left = null;
|
||||
var Right = null;
|
||||
var Count = this.Elements.length;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (Element.StartPos > Pos) {
|
||||
if (null == Right) {
|
||||
Right = Element;
|
||||
}
|
||||
Element.StartPos++;
|
||||
}
|
||||
if (Element.EndPos >= Pos) {
|
||||
Element.EndPos++;
|
||||
} else {
|
||||
Left = Element;
|
||||
}
|
||||
}
|
||||
var RecalcInfo = Paragraph.RecalcInfo;
|
||||
RecalcInfo.Update_Spell_OnChange(Pos, 1, true);
|
||||
if (para_TextPr != ItemType) {
|
||||
var StartPos = (null === Left ? 0 : Left.StartPos);
|
||||
var EndPos = (null === Right ? Paragraph.Content.length - 1 : Right.EndPos);
|
||||
RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_Pos, StartPos, EndPos);
|
||||
} else {
|
||||
if (undefined != Item.Value.Caps) {
|
||||
RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All);
|
||||
} else {
|
||||
if (para_TextPr === ItemType) {
|
||||
RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_Lang);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Update_OnRemove: function (Paragraph, Pos, Count) {
|
||||
var Left = null;
|
||||
var Right = null;
|
||||
var _Count = this.Elements.length;
|
||||
for (var Index = 0; Index < _Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (Element.StartPos > Pos) {
|
||||
if (null == Right) {
|
||||
Right = Element;
|
||||
}
|
||||
if (Element.StartPos > Pos + Count) {
|
||||
Element.StartPos -= Count;
|
||||
} else {
|
||||
Element.StartPos = Pos;
|
||||
}
|
||||
}
|
||||
if (Element.EndPos >= Pos) {
|
||||
if (Element.EndPos >= Pos + Count) {
|
||||
Element.EndPos -= Count;
|
||||
} else {
|
||||
Element.EndPos = Math.max(0, Pos - 1);
|
||||
}
|
||||
} else {
|
||||
Left = Element;
|
||||
}
|
||||
}
|
||||
var StartPos = (null === Left ? 0 : Left.StartPos);
|
||||
var EndPos = (null === Right ? Paragraph.Content.length - 1 : Right.EndPos);
|
||||
var RecalcInfo = Paragraph.RecalcInfo;
|
||||
RecalcInfo.Update_Spell_OnChange(Pos, Count, false);
|
||||
RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_Pos, StartPos, EndPos);
|
||||
},
|
||||
Get_ElementsBeforeAfterPos: function (StartPos, EndPos) {
|
||||
var Before = new Array();
|
||||
var After = new Array();
|
||||
var Count = this.Elements.length;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (Element.EndPos < StartPos) {
|
||||
Before.push(Element);
|
||||
} else {
|
||||
if (Element.StartPos >= EndPos) {
|
||||
After.push(Element);
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
Before: Before,
|
||||
After: After
|
||||
};
|
||||
},
|
||||
Reset_ElementsWithCurPos: function () {
|
||||
var Count = this.Elements.length;
|
||||
for (var Index = 0; Index < Count; Index++) {
|
||||
var Element = this.Elements[Index];
|
||||
if (true === Element.CurPos) {
|
||||
Element.Checked = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function CParaSpellCheckerElement(StartPos, EndPos, Word, Lang) {
|
||||
this.StartPos = StartPos;
|
||||
this.EndPos = EndPos;
|
||||
this.Word = Word;
|
||||
this.Lang = Lang;
|
||||
this.Checked = null;
|
||||
this.CurPos = false;
|
||||
this.Variants = null;
|
||||
}
|
||||
function SpellCheck_CallBack(Obj) {
|
||||
if (undefined != Obj && undefined != Obj["ParagraphId"]) {
|
||||
var ParaId = Obj["ParagraphId"];
|
||||
var Paragraph = g_oTableId.Get_ById(ParaId);
|
||||
var Type = Obj["type"];
|
||||
if (null != Paragraph) {
|
||||
if ("spell" === Type) {
|
||||
Paragraph.SpellChecker.Check_CallBack(Obj["RecalcId"], Obj["usrCorrect"]);
|
||||
Paragraph.ReDraw();
|
||||
} else {
|
||||
if ("suggest" === Type) {
|
||||
Paragraph.SpellChecker.Check_CallBack2(Obj["RecalcId"], Obj["ElementId"], Obj["usrSuggest"]);
|
||||
editor.sync_SpellCheckVariantsFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CTable.prototype.Restart_CheckSpelling = function () {
|
||||
var RowsCount = this.Content.length;
|
||||
for (var CurRow = 0; CurRow < RowsCount; CurRow++) {
|
||||
var Row = this.Content[CurRow];
|
||||
var CellsCount = Row.Get_CellsCount();
|
||||
for (var CurCell = 0; CurCell < CellsCount; CurCell++) {
|
||||
Row.Get_Cell(CurCell).Content.Restart_CheckSpelling();
|
||||
}
|
||||
}
|
||||
};
|
||||
Paragraph.prototype.Restart_CheckSpelling = function () {
|
||||
this.RecalcInfo.Set_Type_0_Spell(pararecalc_0_Spell_All);
|
||||
this.CompiledPr.NeedRecalc = true;
|
||||
this.LogicDocument.Spelling.Add_ParagraphToCheck(this.Get_Id(), this);
|
||||
};
|
||||
Paragraph.prototype.Internal_CheckSpelling = function () {
|
||||
if (pararecalc_0_Spell_None !== this.RecalcInfo.Recalc_0_Spell.Type) {
|
||||
if (null != g_oTableId.Get_ById(this.Get_Id())) {
|
||||
this.LogicDocument.Spelling.Add_ParagraphToCheck(this.Get_Id(), this);
|
||||
}
|
||||
}
|
||||
};
|
||||
Paragraph.prototype.Continue_CheckSpelling = function () {
|
||||
var CheckLang = false;
|
||||
if (pararecalc_0_Spell_None === this.RecalcInfo.Recalc_0_Spell.Type) {
|
||||
return;
|
||||
} else {
|
||||
if (pararecalc_0_Spell_All === this.RecalcInfo.Recalc_0_Spell.Type) {
|
||||
this.SpellChecker.Clear();
|
||||
var Pr = this.Get_CompiledPr();
|
||||
var CurTextPr = Pr.TextPr;
|
||||
var CurLcid = CurTextPr.Lang.Val;
|
||||
var bWord = false;
|
||||
var sWord = "";
|
||||
var nWordStart = 0;
|
||||
var nWordEnd = 0;
|
||||
var ContentLength = this.Content.length;
|
||||
for (var Pos = 0; Pos < ContentLength; Pos++) {
|
||||
var Item = this.Content[Pos];
|
||||
if (para_TextPr === Item.Type) {
|
||||
CurTextPr = this.Internal_CalculateTextPr(Pos);
|
||||
if (true === bWord && CurLcid != CurTextPr.Lang.Val) {
|
||||
bWord = false;
|
||||
this.SpellChecker.Add(nWordStart, nWordEnd, sWord, CurLcid);
|
||||
}
|
||||
CurLcid = CurTextPr.Lang.Val;
|
||||
continue;
|
||||
} else {
|
||||
if (para_Text === Item.Type && false === Item.Is_Punctuation() && false === Item.Is_NBSP() && false === Item.Is_Number() && false === Item.Is_SpecialSymbol()) {
|
||||
if (false === bWord) {
|
||||
bWord = true;
|
||||
nWordStart = Pos;
|
||||
nWordEnd = Pos;
|
||||
if (true != CurTextPr.Caps) {
|
||||
sWord = Item.Value;
|
||||
} else {
|
||||
sWord = Item.Value.toUpperCase();
|
||||
}
|
||||
} else {
|
||||
if (true != CurTextPr.Caps) {
|
||||
sWord += Item.Value;
|
||||
} else {
|
||||
sWord += Item.Value.toUpperCase();
|
||||
}
|
||||
nWordEnd = Pos;
|
||||
}
|
||||
} else {
|
||||
if (true === bWord) {
|
||||
bWord = false;
|
||||
this.SpellChecker.Add(nWordStart, nWordEnd, sWord, CurLcid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CheckLang = false;
|
||||
} else {
|
||||
if (pararecalc_0_Spell_Pos === this.RecalcInfo.Recalc_0_Spell.Type) {
|
||||
var StartPos = this.RecalcInfo.Recalc_0_Spell.StartPos;
|
||||
var EndPos = Math.min(this.RecalcInfo.Recalc_0_Spell.EndPos, this.Content.length - 1);
|
||||
var BoundElements = this.SpellChecker.Get_ElementsBeforeAfterPos(StartPos, EndPos);
|
||||
this.SpellChecker.Clear();
|
||||
var CountBefore = BoundElements.Before.length;
|
||||
for (var Pos = 0; Pos < CountBefore; Pos++) {
|
||||
this.SpellChecker.Elements.push(BoundElements.Before[Pos]);
|
||||
}
|
||||
var Pr = this.Get_CompiledPr();
|
||||
var CurTextPr = Pr.TextPr;
|
||||
var CurLcid = CurTextPr.Lang.Val;
|
||||
var bWord = false;
|
||||
var sWord = "";
|
||||
var nWordStart = 0;
|
||||
var nWordEnd = 0;
|
||||
for (var Pos = StartPos; Pos <= EndPos; Pos++) {
|
||||
var Item = this.Content[Pos];
|
||||
if (para_TextPr === Item.Type) {
|
||||
CurTextPr = this.Internal_CalculateTextPr(Pos);
|
||||
if (true === bWord && CurLcid != CurTextPr.Lang.Val) {
|
||||
bWord = false;
|
||||
this.SpellChecker.Add(nWordStart, nWordEnd, sWord, CurLcid);
|
||||
}
|
||||
CurLcid = CurTextPr.Lang.Val;
|
||||
continue;
|
||||
} else {
|
||||
if (para_Text === Item.Type && false === Item.Is_Punctuation() && false === Item.Is_NBSP()) {
|
||||
if (false === bWord) {
|
||||
bWord = true;
|
||||
nWordStart = Pos;
|
||||
nWordEnd = Pos;
|
||||
if (true != CurTextPr.Caps) {
|
||||
sWord = Item.Value;
|
||||
} else {
|
||||
sWord = Item.Value.toUpperCase();
|
||||
}
|
||||
} else {
|
||||
if (true != CurTextPr.Caps) {
|
||||
sWord += Item.Value;
|
||||
} else {
|
||||
sWord += Item.Value.toUpperCase();
|
||||
}
|
||||
nWordEnd = Pos;
|
||||
}
|
||||
} else {
|
||||
if (true === bWord) {
|
||||
bWord = false;
|
||||
this.SpellChecker.Add(nWordStart, nWordEnd, sWord, CurLcid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true === bWord) {
|
||||
this.SpellChecker.Add(nWordStart, nWordEnd, sWord, CurLcid);
|
||||
}
|
||||
var CountAfter = BoundElements.After.length;
|
||||
for (var Pos = 0; Pos < CountAfter; Pos++) {
|
||||
this.SpellChecker.Elements.push(BoundElements.After[Pos]);
|
||||
}
|
||||
CheckLang = true;
|
||||
} else {
|
||||
if (pararecalc_0_Spell_Lang === this.RecalcInfo.Recalc_0_Spell.Type) {
|
||||
CheckLang = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true === CheckLang) {
|
||||
var WordsCount = this.SpellChecker.Elements.length;
|
||||
for (var ElemId = 0; ElemId < WordsCount; ElemId++) {
|
||||
var Element = this.SpellChecker.Elements[ElemId];
|
||||
var CurLang = Element.Lang;
|
||||
var Lang = this.Internal_GetLang(Element.EndPos);
|
||||
if (CurLang != Lang.Val) {
|
||||
Element.Lang = Lang.Val;
|
||||
Element.Checked = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.SpellChecker.RecalcId = this.LogicDocument.RecalcId;
|
||||
this.SpellChecker.ParaId = this.Get_Id();
|
||||
this.SpellChecker.Check();
|
||||
this.RecalcInfo.Recalc_0_Spell.Type = pararecalc_0_Spell_None;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,782 +0,0 @@
|
||||
/*
|
||||
* (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 field_type_slidenum = 0;
|
||||
var field_type_datetime = 1;
|
||||
var field_type_datetime1 = 2;
|
||||
var field_type_datetime2 = 3;
|
||||
var field_type_datetime3 = 4;
|
||||
var field_type_datetime4 = 5;
|
||||
var field_type_datetime5 = 6;
|
||||
var field_type_datetime6 = 7;
|
||||
var field_type_datetime7 = 8;
|
||||
var field_type_datetime8 = 9;
|
||||
var field_type_datetime9 = 10;
|
||||
var field_type_datetime10 = 11;
|
||||
var field_type_datetime11 = 12;
|
||||
var field_type_datetime12 = 13;
|
||||
var field_type_datetime13 = 14;
|
||||
var pHText = [];
|
||||
pHText[0] = [];
|
||||
pHText[0][phType_body] = "Slide text";
|
||||
pHText[0][phType_chart] = "Chart";
|
||||
pHText[0][phType_clipArt] = "ClipArt";
|
||||
pHText[0][phType_ctrTitle] = "Slide title";
|
||||
pHText[0][phType_dgm] = "Diagram";
|
||||
pHText[0][phType_dt] = "Date and time";
|
||||
pHText[0][phType_ftr] = "Footer";
|
||||
pHText[0][phType_hdr] = "Header";
|
||||
pHText[0][phType_media] = "Media";
|
||||
pHText[0][phType_obj] = "Slide text";
|
||||
pHText[0][phType_pic] = "Picture";
|
||||
pHText[0][phType_sldImg] = "Image";
|
||||
pHText[0][phType_sldNum] = "Slide number";
|
||||
pHText[0][phType_subTitle] = "Slide subtitle";
|
||||
pHText[0][phType_tbl] = "Table";
|
||||
pHText[0][phType_title] = "Slide title";
|
||||
var field_months = [];
|
||||
field_months[0] = [];
|
||||
field_months[0][0] = "января";
|
||||
field_months[0][1] = "февраля";
|
||||
field_months[0][2] = "марта";
|
||||
field_months[0][3] = "апреля";
|
||||
field_months[0][4] = "мая";
|
||||
field_months[0][5] = "июня";
|
||||
field_months[0][6] = "июля";
|
||||
field_months[0][7] = "августа";
|
||||
field_months[0][8] = "сентября";
|
||||
field_months[0][9] = "октября";
|
||||
field_months[0][10] = "ноября";
|
||||
field_months[0][11] = "декабря";
|
||||
var nOTClip = 0;
|
||||
var nOTEllipsis = 1;
|
||||
var nOTOwerflow = 2;
|
||||
var nTextATB = 0;
|
||||
var nTextATCtr = 1;
|
||||
var nTextATDist = 2;
|
||||
var nTextATJust = 3;
|
||||
var nTextATT = 4;
|
||||
var nVertTTeaVert = 0;
|
||||
var nVertTThorz = 1;
|
||||
var nVertTTmongolianVert = 2;
|
||||
var nVertTTvert = 3;
|
||||
var nVertTTvert270 = 4;
|
||||
var nVertTTwordArtVert = 5;
|
||||
var nVertTTwordArtVertRtl = 6;
|
||||
var nTWTNone = 0;
|
||||
var nTWTSquare = 1;
|
||||
function CTextBody(shape) {
|
||||
this.bodyPr = new CBodyPr();
|
||||
this.lstStyle = new TextListStyle();
|
||||
this.content2 = null;
|
||||
this.compiledBodyPr = new CBodyPr();
|
||||
this.recalcInfo = {
|
||||
recalculateBodyPr: true,
|
||||
recalculateContent2: true
|
||||
};
|
||||
this.textPropsForRecalc = [];
|
||||
this.bRecalculateNumbering = true;
|
||||
this.Id = g_oIdCounter.Get_NewId();
|
||||
g_oTableId.Add(this, this.Id);
|
||||
if (isRealObject(shape)) {
|
||||
this.setShape(shape);
|
||||
this.setDocContent(new CDocumentContent(this, editor.WordControl.m_oLogicDocument.DrawingDocument, 0, 0, 0, 20000, false, false));
|
||||
}
|
||||
}
|
||||
CTextBody.prototype = {
|
||||
getSearchResults: function (str) {
|
||||
return this.content != null ? this.content.getSearchResults(str) : [];
|
||||
},
|
||||
Get_Id: function () {
|
||||
return this.Id;
|
||||
},
|
||||
setLstStyle: function (lstStyle) {
|
||||
History.Add(this, {
|
||||
Type: historyitem_SetLstStyle,
|
||||
oldPr: this.lstStyle,
|
||||
newPr: lstStyle
|
||||
});
|
||||
this.lstStyle = lstStyle;
|
||||
},
|
||||
setShape: function (shape) {
|
||||
History.Add(this, {
|
||||
Type: historyitem_SetShape,
|
||||
oldPr: this.shape,
|
||||
newPr: shape
|
||||
});
|
||||
this.shape = shape;
|
||||
},
|
||||
setDocContent: function (docContent) {
|
||||
History.Add(this, {
|
||||
Type: historyitem_SetDocContent,
|
||||
oldPr: this.content,
|
||||
newPr: docContent
|
||||
});
|
||||
this.content = docContent;
|
||||
},
|
||||
Write_ToBinary2: function (w) {
|
||||
w.WriteLong(historyitem_type_TextBody);
|
||||
w.WriteString2(this.Id);
|
||||
},
|
||||
Read_FromBinary2: function (r) {
|
||||
this.Id = r.GetString2();
|
||||
},
|
||||
recalculate: function () {},
|
||||
recalcAll: function () {
|
||||
this.recalcInfo = {
|
||||
recalculateBodyPr: true,
|
||||
recalculateContent2: true
|
||||
};
|
||||
this.bRecalculateNumbering = true;
|
||||
var content = this.content;
|
||||
for (var i = 0; i < content.Content.length; ++i) {
|
||||
content.Content[i].Recalc_CompiledPr();
|
||||
content.Content[i].RecalcInfo.Recalc_0_Type = pararecalc_0_All;
|
||||
}
|
||||
this.arrStyles = [];
|
||||
content.arrStyles = [];
|
||||
},
|
||||
recalcColors: function () {
|
||||
this.content.recalcColors();
|
||||
},
|
||||
recalculateBodyPr: function () {
|
||||
if (this.recalcInfo.recalculateBodyPr) {
|
||||
this.compiledBodyPr.setDefault();
|
||||
if (this.shape.isPlaceholder()) {
|
||||
var hierarchy = this.shape.getHierarchy();
|
||||
for (var i = hierarchy.length - 1; i > -1; --i) {
|
||||
if (isRealObject(hierarchy[i]) && isRealObject(hierarchy[i].txBody) && isRealObject(hierarchy[i].txBody.bodyPr)) {
|
||||
this.compiledBodyPr.merge(hierarchy[i].txBody.bodyPr);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isRealObject(this.bodyPr)) {
|
||||
this.compiledBodyPr.merge(this.bodyPr);
|
||||
}
|
||||
}
|
||||
},
|
||||
Refresh_RecalcData: function () {},
|
||||
updateSelectionState: function (drawingDocument) {
|
||||
var Doc = this.content;
|
||||
if (true === Doc.Is_SelectionUse() && !Doc.Selection_IsEmpty()) {
|
||||
drawingDocument.UpdateTargetTransform(this.shape.transformText);
|
||||
drawingDocument.TargetEnd();
|
||||
drawingDocument.SelectEnabled(true);
|
||||
drawingDocument.SelectClear();
|
||||
this.content.Selection_Draw_Page(this.shape.parent ? this.shape.parent.num : this.shape.chartGroup.parent.num);
|
||||
drawingDocument.SelectShow();
|
||||
} else {
|
||||
drawingDocument.UpdateTargetTransform(this.shape.transformText);
|
||||
drawingDocument.TargetShow();
|
||||
drawingDocument.SelectEnabled(false);
|
||||
}
|
||||
},
|
||||
isEmpty: function () {
|
||||
return this.content.Is_Empty();
|
||||
},
|
||||
OnContentReDraw: function () {},
|
||||
calculateContent: function () {
|
||||
var parent_object = this.shape.getParentObjects();
|
||||
for (var i = 0; i < this.textPropsForRecalc.length; ++i) {
|
||||
var props = this.textPropsForRecalc[i].Value;
|
||||
if (props && props.FontFamily && typeof props.FontFamily.Name === "string" && isThemeFont(props.FontFamily.Name)) {
|
||||
props.FontFamily.themeFont = props.FontFamily.Name;
|
||||
props.FontFamily.Name = getFontInfo(props.FontFamily.Name)(parent_object.theme.themeElements.fontScheme);
|
||||
}
|
||||
var TextPr = props;
|
||||
var parents = parent_object;
|
||||
if (isRealObject(TextPr) && isRealObject(TextPr.unifill) && isRealObject(TextPr.unifill.fill)) {
|
||||
TextPr.unifill.calculate(parents.theme, parents.slide, parents.layout, parents.master, {
|
||||
R: 0,
|
||||
G: 0,
|
||||
B: 0,
|
||||
A: 255
|
||||
});
|
||||
var _rgba = TextPr.unifill.getRGBAColor();
|
||||
TextPr.Color = new CDocumentColor(_rgba.R, _rgba.G, _rgba.B);
|
||||
}
|
||||
if (isRealObject(props.FontFamily) && typeof props.FontFamily.Name === "string") {
|
||||
TextPr.RFonts.Ascii = {
|
||||
Name: TextPr.FontFamily.Name,
|
||||
Index: -1
|
||||
};
|
||||
TextPr.RFonts.CS = {
|
||||
Name: TextPr.FontFamily.Name,
|
||||
Index: -1
|
||||
};
|
||||
TextPr.RFonts.HAnsi = {
|
||||
Name: TextPr.FontFamily.Name,
|
||||
Index: -1
|
||||
};
|
||||
}
|
||||
}
|
||||
this.textPropsForRecalc.length = 0;
|
||||
if (this.bRecalculateNumbering) {
|
||||
this.content.RecalculateNumbering();
|
||||
this.bRecalculateNumbering = false;
|
||||
}
|
||||
this.content.Set_StartPage(0);
|
||||
if (this.textFieldFlag) {
|
||||
this.textFieldFlag = false;
|
||||
if (this.shape && this.shape.isPlaceholder()) {
|
||||
var _ph_type = this.shape.getPlaceholderType();
|
||||
switch (_ph_type) {
|
||||
case phType_dt:
|
||||
var _cur_date = new Date();
|
||||
var _cur_year = _cur_date.getFullYear();
|
||||
var _cur_month = _cur_date.getMonth();
|
||||
var _cur_month_day = _cur_date.getDate();
|
||||
var _cur_week_day = _cur_date.getDay();
|
||||
var _cur_hour = _cur_date.getHours();
|
||||
var _cur_minute = _cur_date.getMinutes();
|
||||
var _cur_second = _cur_date.getSeconds();
|
||||
var _text_string = "";
|
||||
switch (this.fieldType) {
|
||||
default:
|
||||
_text_string += (_cur_month_day > 9 ? _cur_month_day : "0" + _cur_month_day) + "." + ((_cur_month + 1) > 9 ? (_cur_month + 1) : "0" + (_cur_month + 1)) + "." + _cur_year;
|
||||
break;
|
||||
}
|
||||
var par = this.content.Content[0];
|
||||
var EndPos = par.Internal_GetEndPos();
|
||||
var _history_status = History.Is_On();
|
||||
if (_history_status) {
|
||||
History.TurnOff();
|
||||
}
|
||||
for (var _text_index = 0; _text_index < _text_string.length; ++_text_index) {
|
||||
if (_text_string[_text_index] != " ") {
|
||||
par.Internal_Content_Add(EndPos, new ParaText(_text_string[_text_index]));
|
||||
} else {
|
||||
par.Internal_Content_Add(EndPos, new ParaSpace(1));
|
||||
}++EndPos;
|
||||
}
|
||||
if (_history_status) {
|
||||
History.TurnOn();
|
||||
}
|
||||
this.calculateContent();
|
||||
break;
|
||||
case phType_sldNum:
|
||||
if (this.shape.parent instanceof Slide) {
|
||||
var _text_string = "" + (this.shape.parent.num + 1);
|
||||
par = this.content.Content[0];
|
||||
EndPos = par.Internal_GetEndPos();
|
||||
_history_status = History.Is_On();
|
||||
if (_history_status) {
|
||||
History.TurnOff();
|
||||
}
|
||||
for (_text_index = 0; _text_index < _text_string.length; ++_text_index) {
|
||||
if (_text_string[_text_index] != " ") {
|
||||
par.Internal_Content_Add(EndPos, new ParaText(_text_string[_text_index]));
|
||||
} else {
|
||||
par.Internal_Content_Add(EndPos, new ParaSpace(1));
|
||||
}++EndPos;
|
||||
}
|
||||
if (_history_status) {
|
||||
History.TurnOn();
|
||||
}
|
||||
this.calculateContent();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.bodyPr.textFit !== null && typeof this.bodyPr.textFit === "object") {
|
||||
if (this.bodyPr.textFit.type === text_fit_NormAuto) {
|
||||
var text_fit = this.bodyPr.textFit;
|
||||
var font_scale, spacing_scale;
|
||||
if (!isNaN(text_fit.fontScale) && typeof text_fit.fontScale === "number") {
|
||||
font_scale = text_fit.fontScale / 100000;
|
||||
}
|
||||
if (!isNaN(text_fit.lnSpcReduction) && typeof text_fit.lnSpcReduction === "number") {
|
||||
spacing_scale = text_fit.lnSpcReduction / 100000;
|
||||
}
|
||||
if (!isNaN(font_scale) && typeof font_scale === "number" || !isNaN(spacing_scale) && typeof spacing_scale === "number") {
|
||||
var pars = this.content.Content;
|
||||
for (var index = 0; index < pars.length; ++index) {
|
||||
var parg = pars[index];
|
||||
if (!isNaN(spacing_scale) && typeof spacing_scale === "number") {
|
||||
var spacing = parg.Pr.Spacing;
|
||||
var spacing2 = parg.Get_CompiledPr(false).ParaPr;
|
||||
parg.Recalc_CompiledPr();
|
||||
var spc = (spacing2.Line * spacing_scale);
|
||||
if (!isNaN(spc) && typeof spc === "number") {
|
||||
spacing.Line = spc;
|
||||
}
|
||||
spc = (spacing2.Before * spacing_scale);
|
||||
if (!isNaN(spc) && typeof spc === "number") {
|
||||
spacing.Before = spc;
|
||||
}
|
||||
spc = (spacing2.After * spacing_scale);
|
||||
if (!isNaN(spc) && typeof spc === "number") {
|
||||
spacing.After = spc;
|
||||
}
|
||||
}
|
||||
if (!isNaN(font_scale) && typeof font_scale === "number") {
|
||||
var par_font_size = parg.Get_CompiledPr(false).TextPr.FontSize;
|
||||
parg.Recalc_CompiledPr();
|
||||
for (var r = 0; r < parg.Content.length; ++r) {
|
||||
var item = parg.Content[r];
|
||||
if (item.Type === para_TextPr) {
|
||||
var value = item.Value;
|
||||
if (!isNaN(value.FontSize) && typeof value.FontSize === "number") {
|
||||
value.FontSize = (value.FontSize * font_scale) >> 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
var result_par_text_pr_font_size = (par_font_size * font_scale) >> 0;
|
||||
if (!isNaN(result_par_text_pr_font_size) && typeof result_par_text_pr_font_size === "number") {
|
||||
var b_insert_text_pr = false,
|
||||
pos = -1;
|
||||
for (var p = 0; p < parg.Content.length; ++p) {
|
||||
if (parg.Content[p].Type === para_TextPr) {
|
||||
if (! (!isNaN(parg.Content[p].Value.FontSize) && typeof parg.Content[p].Value.FontSize === "number")) {
|
||||
parg.Content[p].Value.FontSize = result_par_text_pr_font_size;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (parg.Content[p].Type === para_Text) {
|
||||
b_insert_text_pr = true;
|
||||
pos = p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (b_insert_text_pr) {
|
||||
var history_is_on = History.Is_On();
|
||||
if (history_is_on) {
|
||||
History.TurnOff();
|
||||
}
|
||||
parg.Internal_Content_Add(p, new ParaTextPr({
|
||||
FontSize: result_par_text_pr_font_size
|
||||
}));
|
||||
if (history_is_on) {
|
||||
History.TurnOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.bodyPr.textFit = null;
|
||||
this.calculateContent();
|
||||
return;
|
||||
}
|
||||
this.bodyPr.normAutofit = false;
|
||||
var _l, _t, _r, _b;
|
||||
var _body_pr = this.getBodyPr();
|
||||
var sp = this.shape;
|
||||
if (isRealObject(sp.spPr.geometry) && isRealObject(sp.spPr.geometry.rect)) {
|
||||
var _rect = sp.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 = sp.extX - _body_pr.rIns;
|
||||
_b = sp.extY - _body_pr.bIns;
|
||||
}
|
||||
if (_body_pr.upright === false) {
|
||||
var _content_width;
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _r - _l;
|
||||
this.contentWidth = _content_width;
|
||||
this.contentHeight = _b - _t;
|
||||
} else {
|
||||
_content_width = _b - _t;
|
||||
this.contentWidth = _content_width;
|
||||
this.contentHeight = _r - _l;
|
||||
}
|
||||
} else {
|
||||
var _full_rotate = sp.getFullRotate();
|
||||
if ((_full_rotate >= 0 && _full_rotate < Math.PI * 0.25) || (_full_rotate > 3 * Math.PI * 0.25 && _full_rotate < 5 * Math.PI * 0.25) || (_full_rotate > 7 * Math.PI * 0.25 && _full_rotate < 2 * Math.PI)) {
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _r - _l;
|
||||
this.contentWidth = _content_width;
|
||||
this.contentHeight = _b - _t;
|
||||
} else {
|
||||
_content_width = _b - _t;
|
||||
this.contentWidth = _content_width;
|
||||
this.contentHeight = _r - _l;
|
||||
}
|
||||
} else {
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _b - _t;
|
||||
this.contentWidth = _content_width;
|
||||
this.contentHeight = _r - _l;
|
||||
} else {
|
||||
_content_width = _r - _l;
|
||||
this.contentWidth = _content_width;
|
||||
this.contentHeight = _b - _t;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.content.Reset(0, 0, _content_width, 20000);
|
||||
this.content.Recalculate_Page(0, true);
|
||||
this.contentHeight = this.getSummaryHeight();
|
||||
if (this.recalcInfo.recalculateContent2) {
|
||||
var _history_is_on = History.Is_On();
|
||||
if (_history_is_on) {
|
||||
History.TurnOff();
|
||||
}
|
||||
if (this.shape.isPlaceholder()) {
|
||||
var text = pHText[0][this.shape.nvSpPr.nvPr.ph.type] != undefined ? pHText[0][this.shape.nvSpPr.nvPr.ph.type] : pHText[0][phType_body];
|
||||
this.content2 = new CDocumentContent(this, editor.WordControl.m_oDrawingDocument, 0, 0, 0, 0, false, false);
|
||||
this.content2.Content.length = 0;
|
||||
var par = new Paragraph(editor.WordControl.m_oDrawingDocument, this.content2, 0, 0, 0, 0, 0);
|
||||
var EndPos = 0;
|
||||
for (var key = 0; key < text.length; ++key) {
|
||||
par.Internal_Content_Add(EndPos++, CreateParaContentFromString(text[key]));
|
||||
}
|
||||
if (this.content && this.content.Content[0]) {
|
||||
if (this.content.Content[0].Pr) {
|
||||
par.Pr = this.content.Content[0].Pr.Copy();
|
||||
}
|
||||
if (this.content.Content[0].rPr) {
|
||||
par.rPr = clone(this.content.Content[0].rPr);
|
||||
}
|
||||
}
|
||||
this.content2.Internal_Content_Add(0, par);
|
||||
this.content2.RecalculateNumbering();
|
||||
this.content2.Set_StartPage(0);
|
||||
if (_body_pr.upright === false) {
|
||||
var _content_width;
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _r - _l;
|
||||
this.contentWidth2 = _content_width;
|
||||
this.contentHeight2 = _b - _t;
|
||||
} else {
|
||||
_content_width = _b - _t;
|
||||
this.contentWidth2 = _content_width;
|
||||
this.contentHeight2 = _r - _l;
|
||||
}
|
||||
} else {
|
||||
var _full_rotate = sp.getFullRotate();
|
||||
if ((_full_rotate >= 0 && _full_rotate < Math.PI * 0.25) || (_full_rotate > 3 * Math.PI * 0.25 && _full_rotate < 5 * Math.PI * 0.25) || (_full_rotate > 7 * Math.PI * 0.25 && _full_rotate < 2 * Math.PI)) {
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _r - _l;
|
||||
this.contentWidth2 = _content_width;
|
||||
this.contentHeight2 = _b - _t;
|
||||
} else {
|
||||
_content_width = _b - _t;
|
||||
this.contentWidth2 = _content_width;
|
||||
this.contentHeight2 = _r - _l;
|
||||
}
|
||||
} else {
|
||||
if (! (_body_pr.vert === nVertTTvert || _body_pr.vert === nVertTTvert270)) {
|
||||
_content_width = _b - _t;
|
||||
this.contentWidth2 = _content_width;
|
||||
this.contentHeight2 = _r - _l;
|
||||
} else {
|
||||
_content_width = _r - _l;
|
||||
this.contentWidth2 = _content_width;
|
||||
this.contentHeight2 = _b - _t;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.content2.Reset(0, 0, _content_width, 20000);
|
||||
this.content2.Recalculate_Page(0, true);
|
||||
this.contentHeight2 = this.getSummaryHeight2();
|
||||
}
|
||||
if (_history_is_on) {
|
||||
History.TurnOn();
|
||||
}
|
||||
this.recalcInfo.recalculateContent2 = false;
|
||||
}
|
||||
},
|
||||
copy: function (txBody) {
|
||||
txBody.setDocContent(this.content.Copy(txBody));
|
||||
},
|
||||
updateCursorType: function (x, y, e) {
|
||||
if (this.shape && this.shape.invertTransformText) {
|
||||
var tx = this.shape.invertTransformText.TransformPointX(x, y);
|
||||
var ty = this.shape.invertTransformText.TransformPointY(x, y);
|
||||
this.content.Update_CursorType(tx, ty, 0);
|
||||
}
|
||||
},
|
||||
Get_StartPage_Absolute: function () {
|
||||
return isRealObject(this.shape) && isRealObject(this.shape.parent) && isRealNumber(this.shape.parent.num) ? this.shape.parent.num : (this.shape.chartGroup ? this.shape.chartGroup.parent.num : 0);
|
||||
},
|
||||
Is_HdrFtr: function () {
|
||||
return false;
|
||||
},
|
||||
Get_PageContentStartPos: function (pageNum) {
|
||||
return {
|
||||
X: 0,
|
||||
Y: 0,
|
||||
XLimit: this.contentWidth,
|
||||
YLimit: 20000
|
||||
};
|
||||
},
|
||||
Get_Numbering: function () {
|
||||
return new CNumbering();
|
||||
},
|
||||
getBodyPr: function () {
|
||||
if (this.recalcInfo.recalculateBodyPr) {
|
||||
this.recalculateBodyPr();
|
||||
this.recalcInfo.recalculateBodyPr = false;
|
||||
}
|
||||
return this.compiledBodyPr;
|
||||
},
|
||||
onParagraphChanged: function () {
|
||||
if (this.shape) {
|
||||
this.shape.onParagraphChanged();
|
||||
}
|
||||
},
|
||||
getSummaryHeight: function () {
|
||||
return this.content.Get_SummaryHeight();
|
||||
},
|
||||
getSummaryHeight2: function () {
|
||||
return this.content2 ? this.content2.Get_SummaryHeight() : 0;
|
||||
},
|
||||
getCompiledBodyPr: function () {
|
||||
this.recalculateBodyPr();
|
||||
return this.compiledBodyPr;
|
||||
},
|
||||
addPhContent: function (phType) {},
|
||||
Get_TableStyleForPara: function () {
|
||||
return null;
|
||||
},
|
||||
draw: function (graphics) {
|
||||
if ((!this.content || this.content.Is_Empty()) && this.content2 != null && !this.shape.addTextFlag && (this.shape.isEmptyPlaceholder ? this.shape.isEmptyPlaceholder() : false)) {
|
||||
if (graphics.IsNoDrawingEmptyPlaceholder !== true && graphics.IsNoDrawingEmptyPlaceholderText !== true) {
|
||||
if (graphics.IsNoSupportTextDraw) {
|
||||
var _w2 = this.content2.XLimit;
|
||||
var _h2 = this.content2.Get_SummaryHeight();
|
||||
graphics.rect(this.content2.X, this.content2.Y, _w2, _h2);
|
||||
}
|
||||
this.content2.Draw(0, graphics);
|
||||
}
|
||||
} else {
|
||||
if (this.content) {
|
||||
if (graphics.IsNoSupportTextDraw) {
|
||||
var _w = this.content.XLimit;
|
||||
var _h = this.content.Get_SummaryHeight();
|
||||
graphics.rect(this.content.X, this.content.Y, _w, _h);
|
||||
}
|
||||
this.content.Draw(0, graphics);
|
||||
}
|
||||
}
|
||||
},
|
||||
Get_Styles: function (level) {
|
||||
return this.shape.Get_Styles(level);
|
||||
},
|
||||
Is_Cell: function () {
|
||||
return false;
|
||||
},
|
||||
OnContentRecalculate: function () {},
|
||||
Set_CurrentElement: function () {},
|
||||
writeToBinary: function (w) {
|
||||
this.bodyPr.Write_ToBinary2(w);
|
||||
writeToBinaryDocContent(this.content, w);
|
||||
},
|
||||
getMargins: function () {
|
||||
var _parent_transform = this.shape.transform;
|
||||
var _l;
|
||||
var _r;
|
||||
var _b;
|
||||
var _t;
|
||||
var _body_pr = this.getBodyPr();
|
||||
var sp = this.shape;
|
||||
if (isRealObject(sp.spPr.geometry) && isRealObject(sp.spPr.geometry.rect)) {
|
||||
var _rect = sp.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 = sp.extX - _body_pr.rIns;
|
||||
_b = sp.extY - _body_pr.bIns;
|
||||
}
|
||||
var x_lt, y_lt, x_rb, y_rb;
|
||||
x_lt = _parent_transform.TransformPointX(_l, _t);
|
||||
y_lt = _parent_transform.TransformPointY(_l, _t);
|
||||
x_rb = _parent_transform.TransformPointX(_r, _b);
|
||||
y_rb = _parent_transform.TransformPointY(_r, _b);
|
||||
var hc = (_r - _l) / 2;
|
||||
var vc = (_b - _t) / 2;
|
||||
var xc = (x_lt + x_rb) / 2;
|
||||
var yc = (y_lt + y_rb) / 2;
|
||||
var tx = xc - hc;
|
||||
var ty = yc - vc;
|
||||
return {
|
||||
L: xc - hc,
|
||||
T: yc - vc,
|
||||
R: xc + hc,
|
||||
B: yc + vc,
|
||||
textMatrix: this.shape.transform
|
||||
};
|
||||
},
|
||||
readFromBinary: function (r, drawingDocument) {
|
||||
var bodyPr = new CBodyPr();
|
||||
bodyPr.Read_FromBinary2(r);
|
||||
if (isRealObject(this.parent) && this.parent.setBodyPr) {
|
||||
this.parent.setBodyPr(bodyPr);
|
||||
}
|
||||
var is_on = History.Is_On();
|
||||
if (is_on) {
|
||||
History.TurnOff();
|
||||
}
|
||||
var dc = new CDocumentContent(this, editor.WordControl.m_oDrawingDocument, 0, 0, 0, 0, false, false);
|
||||
readFromBinaryDocContent(dc, r);
|
||||
if (is_on) {
|
||||
History.TurnOn();
|
||||
}
|
||||
for (var i = 0; i < dc.Content.length; ++i) {
|
||||
if (i > 0) {
|
||||
this.content.Add_NewParagraph();
|
||||
}
|
||||
var par = dc.Content[i];
|
||||
for (var j = 0; j < par.Content.length; ++j) {
|
||||
if (! (par.Content[j] instanceof ParaEnd || par.Content[j] instanceof ParaEmpty || par.Content[j] instanceof ParaNumbering) && par.Content[j].Copy) {
|
||||
this.content.Paragraph_Add(par.Content[j].Copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
Undo: function (data) {
|
||||
switch (data.Type) {
|
||||
case historyitem_SetShape:
|
||||
this.shape = data.oldPr;
|
||||
break;
|
||||
case historyitem_SetDocContent:
|
||||
this.content = data.oldPr;
|
||||
break;
|
||||
case historyitem_SetLstStyle:
|
||||
this.lstStyle = data.oldPr;
|
||||
break;
|
||||
}
|
||||
},
|
||||
Redo: function (data) {
|
||||
switch (data.Type) {
|
||||
case historyitem_SetShape:
|
||||
this.shape = data.newPr;
|
||||
break;
|
||||
case historyitem_SetDocContent:
|
||||
this.content = data.newPr;
|
||||
break;
|
||||
case historyitem_SetLstStyle:
|
||||
this.lstStyle = data.newPr;
|
||||
break;
|
||||
}
|
||||
},
|
||||
Save_Changes: function (data, w) {
|
||||
w.WriteLong(historyitem_type_TextBody);
|
||||
w.WriteLong(data.Type);
|
||||
switch (data.Type) {
|
||||
case historyitem_SetShape:
|
||||
case historyitem_SetDocContent:
|
||||
w.WriteBool(isRealObject(data.newPr));
|
||||
if (isRealObject(data.newPr)) {
|
||||
w.WriteString2(data.newPr.Get_Id());
|
||||
}
|
||||
break;
|
||||
case historyitem_SetLstStyle:
|
||||
w.WriteBool(isRealObject(data.newPr));
|
||||
if (isRealObject(data.newPr)) {
|
||||
data.newPr.Write_ToBinary2(w);
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
Load_Changes: function (r) {
|
||||
if (r.GetLong() === historyitem_type_TextBody) {
|
||||
var type = r.GetLong();
|
||||
switch (type) {
|
||||
case historyitem_SetShape:
|
||||
if (r.GetBool()) {
|
||||
this.shape = g_oTableId.Get_ById(r.GetString2());
|
||||
}
|
||||
break;
|
||||
case historyitem_SetDocContent:
|
||||
if (r.GetBool()) {
|
||||
this.content = g_oTableId.Get_ById(r.GetString2());
|
||||
}
|
||||
break;
|
||||
case historyitem_SetLstStyle:
|
||||
if (r.GetBool()) {
|
||||
this.lstStyle = new TextListStyle();
|
||||
this.lstStyle.Read_FromBinary2(r);
|
||||
} else {
|
||||
this.lstStyle = null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
getSelectedTextHtml: function () {},
|
||||
Refresh_RecalcData2: function () {},
|
||||
getRectWidth: function (maxWidth) {
|
||||
var body_pr = this.getBodyPr();
|
||||
var r_ins = body_pr.rIns;
|
||||
var l_ins = body_pr.lIns;
|
||||
var max_content_width = maxWidth - r_ins - l_ins;
|
||||
this.content.RecalculateNumbering();
|
||||
this.content.Reset(0, 0, max_content_width, 20000);
|
||||
this.content.Recalculate_Page(0, true);
|
||||
var max_width = 0;
|
||||
for (var i = 0; i < this.content.Content.length; ++i) {
|
||||
var par = this.content.Content[i];
|
||||
for (var j = 0; j < par.Lines.length; ++j) {
|
||||
if (par.Lines[j].Ranges[0].W > max_width) {
|
||||
max_width = par.Lines[j].Ranges[0].W;
|
||||
}
|
||||
}
|
||||
}
|
||||
return max_width + 2 + r_ins + l_ins;
|
||||
},
|
||||
getRectHeight: function (maxHeight, width) {
|
||||
this.content.RecalculateNumbering();
|
||||
this.content.Reset(0, 0, width, 20000);
|
||||
this.content.Recalculate_Page(0, true);
|
||||
var content_height = this.getSummaryHeight();
|
||||
var t_ins = isRealNumber(this.bodyPr.tIns) ? this.bodyPr.tIns : 1.27;
|
||||
var b_ins = isRealNumber(this.bodyPr.bIns) ? this.bodyPr.bIns : 1.27;
|
||||
return content_height + t_ins + b_ins;
|
||||
}
|
||||
};
|
||||
function CreateParaContentFromString(str) {
|
||||
if (str == "\t") {
|
||||
return new ParaTab();
|
||||
} else {
|
||||
if (str == "\n") {
|
||||
return new ParaNewLine(break_Line);
|
||||
} else {
|
||||
if (str != " ") {
|
||||
return new ParaText(str);
|
||||
} else {
|
||||
return new ParaSpace(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user