3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -0,0 +1,481 @@
/*
* (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.recalculateTransform = CShape.prototype.recalculateTransform;
CChartSpace.prototype.recalculateBounds = function () {
var t = this.localTransform;
var arr_p_x = [];
var arr_p_y = [];
arr_p_x.push(t.TransformPointX(0, 0));
arr_p_y.push(t.TransformPointY(0, 0));
arr_p_x.push(t.TransformPointX(this.extX, 0));
arr_p_y.push(t.TransformPointY(this.extX, 0));
arr_p_x.push(t.TransformPointX(this.extX, this.extY));
arr_p_y.push(t.TransformPointY(this.extX, this.extY));
arr_p_x.push(t.TransformPointX(0, this.extY));
arr_p_y.push(t.TransformPointY(0, this.extY));
this.bounds.x = Math.min.apply(Math, arr_p_x);
this.bounds.y = Math.min.apply(Math, arr_p_y);
this.bounds.l = this.bounds.x;
this.bounds.t = this.bounds.y;
this.bounds.r = Math.max.apply(Math, arr_p_x);
this.bounds.b = Math.max.apply(Math, arr_p_y);
this.bounds.w = this.bounds.r - this.bounds.l;
this.bounds.h = this.bounds.b - this.bounds.t;
};
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 = function () {
return false;
};
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.Get_Theme = CShape.prototype.Get_Theme;
CChartSpace.prototype.Get_ColorMap = CShape.prototype.Get_ColorMap;
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.setRecalculateInfo = function () {
this.recalcInfo = {
recalcTitle: null,
recalculateTransform: true,
recalculateBounds: true,
recalculateChart: true,
recalculateBaseColors: true,
recalculateSeriesColors: true,
recalculateMarkers: true,
recalculateGridLines: true,
recalculateDLbls: true,
recalculateAxisLabels: true,
dataLbls: [],
axisLabels: [],
recalculateAxisVal: true,
recalculateAxisCat: true,
recalculateAxisTickMark: true,
recalculateBrush: true,
recalculatePen: true,
recalculatePlotAreaBrush: true,
recalculatePlotAreaPen: true,
recalculateHiLowLines: true,
recalculateUpDownBars: true,
recalculateLegend: true,
recalculateWrapPolygon: true,
recalculatePenBrush: true,
recalculateTextPr: true
};
this.baseColors = [];
this.chartObj = null;
this.localTransform = new CMatrix();
this.snapArrayX = [];
this.snapArrayY = [];
this.rectGeometry = ExecuteNoHistory(function () {
return CreateGeometry("rect");
},
this, []);
this.bNeedUpdatePosition = true;
};
CChartSpace.prototype.recalcTransform = function () {
this.recalcInfo.recalculateTransform = true;
};
CChartSpace.prototype.recalcBounds = function () {
this.recalcInfo.recalculateBounds = true;
};
CChartSpace.prototype.recalcWrapPolygon = function () {
this.recalcInfo.recalculateWrapPolygon = 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.addToSetPosition = function (dLbl) {
if (dLbl instanceof CDLbl) {
this.recalcInfo.dataLbls.push(dLbl);
} else {
if (dLbl instanceof CTitle) {
this.recalcInfo.axisLabels.push(dLbl);
}
}
};
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.recalcWrapPolygon();
this.recalcTitles();
this.handleUpdateInternalChart();
};
CChartSpace.prototype.handleUpdateFlip = function () {
this.handleUpdateExtents();
};
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.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.recalcText = function () {
this.recalcInfo.recalculateAxisLabels = true;
this.recalcTitles2();
this.handleUpdateInternalChart();
};
CChartSpace.prototype.setStartPage = function (pageIndex) {
this.selectStartPage = pageIndex;
var title, content;
if (this.chart && this.chart.title) {
title = this.chart.title;
content = title.getDocContent();
content && content.Set_StartPage(pageIndex);
}
if (this.chart && this.chart.plotArea) {
var hor_axis = this.chart.plotArea.getHorizontalAxis();
if (hor_axis && hor_axis.title) {
title = hor_axis.title;
content = title.getDocContent();
content && content.Set_StartPage(pageIndex);
}
var vert_axis = this.chart.plotArea.getVerticalAxis();
if (vert_axis && vert_axis.title) {
title = vert_axis.title;
content = title.getDocContent();
content && content.Set_StartPage(pageIndex);
}
}
};
CChartSpace.prototype.getRecalcObject = CShape.prototype.getRecalcObject;
CChartSpace.prototype.setRecalcObject = CShape.prototype.setRecalcObject;
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.recalculate = function () {
if (this.bDeleted) {
return;
}
ExecuteNoHistory(function () {
this.updateLinks();
if (this.recalcInfo.recalcTitle) {
this.recalculateChartTitleEditMode(true);
this.recalcInfo.recalcTitle = null;
this.recalcInfo.bRecalculatedTitle = true;
} else {}
if (this.recalcInfo.recalculateTransform) {
this.recalculateTransform();
this.rectGeometry.Recalculate(this.extX, this.extY);
this.recalcInfo.recalculateTransform = 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.recalculateTextPr) {
this.recalculateTextPr();
this.recalcInfo.recalculateTextPr = false;
}
if (this.recalcInfo.recalculateBounds) {
this.recalculateBounds();
this.recalcInfo.recalculateBounds = false;
}
if (this.recalcInfo.recalculateWrapPolygon) {
this.recalculateWrapPolygon();
this.recalcInfo.recalculateWrapPolygon = false;
}
this.recalcInfo.axisLabels.length = 0;
this.bNeedUpdatePosition = true;
if (isRealNumber(this.posX) && isRealNumber(this.posY)) {
this.updatePosition(this.posX, this.posY);
}
},
this, []);
};
CChartSpace.prototype.deselect = CShape.prototype.deselect;
CChartSpace.prototype.getDrawingDocument = CShape.prototype.getDrawingDocument;
CChartSpace.prototype.updatePosition = CShape.prototype.updatePosition;
CChartSpace.prototype.recalculateWrapPolygon = CShape.prototype.recalculateWrapPolygon;
CChartSpace.prototype.getArrayWrapPolygons = function () {
return this.rectGeometry.getArrayPolygons();
};
CChartSpace.prototype.checkContentDrawings = function () {};
CChartSpace.prototype.checkShapeChildTransform = function () {
if (this.parent) {
var parent_shape = this.parent.isShapeChild(true);
if (parent_shape) {
var transform_text = parent_shape.transformText;
global_MatrixTransformer.MultiplyAppend(this.transform, transform_text);
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
if (this.chart) {
if (this.chart.plotArea) {
if (this.chart.plotArea.chart && this.chart.plotArea.chart.series) {
var series = this.chart.plotArea.chart.series;
for (var i = 0; i < series.length; ++i) {
var ser = series[i];
var pts = getPtsFromSeries(ser);
for (var j = 0; j < pts.length; ++j) {
if (pts[j].compiledDlb) {
pts[j].compiledDlb.checkShapeChildTransform(transform_text);
}
}
}
}
if (this.chart.plotArea.catAx) {
if (this.chart.plotArea.catAx.title) {
this.chart.plotArea.catAx.title.checkShapeChildTransform(transform_text);
}
if (this.chart.plotArea.catAx.labels) {
this.chart.plotArea.catAx.labels.checkShapeChildTransform(transform_text);
}
}
if (this.chart.plotArea.valAx) {
if (this.chart.plotArea.valAx.title) {
this.chart.plotArea.valAx.title.checkShapeChildTransform(transform_text);
}
if (this.chart.plotArea.valAx.labels) {
this.chart.plotArea.valAx.labels.checkShapeChildTransform(transform_text);
}
}
}
if (this.chart.title) {
this.chart.title.checkShapeChildTransform(transform_text);
}
if (this.chart.legend) {
this.chart.legend.checkShapeChildTransform(transform_text);
}
}
}
}
};
CChartSpace.prototype.recalculateLocalTransform = CShape.prototype.recalculateLocalTransform;
CChartSpace.prototype.updateTransformMatrix = function () {
var posX = this.localTransform.tx + this.posX;
var posY = this.localTransform.ty + this.posY;
this.transform = this.localTransform.CreateDublicate();
global_MatrixTransformer.TranslateAppend(this.transform, this.posX, this.posY);
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
this.updateChildLabelsTransform(posX, posY);
this.checkShapeChildTransform();
};
CChartSpace.prototype.getArrayWrapIntervals = CShape.prototype.getArrayWrapIntervals;
CChartSpace.prototype.select = CShape.prototype.select;
function CreateUnifillSolidFillSchemeColor(colorId, tintOrShade) {
var unifill = new CUniFill();
unifill.setFill(new CSolidFill());
unifill.fill.setColor(new CUniColor());
unifill.fill.color.setColor(new CSchemeColor());
unifill.fill.color.color.setId(colorId);
return CreateUniFillSolidFillWidthTintOrShade(unifill, tintOrShade);
}
function CreateNoFillLine() {
var ret = new CLn();
ret.setFill(CreateNoFillUniFill());
return ret;
}
function CreateNoFillUniFill() {
var ret = new CUniFill();
ret.setFill(new CNoFill());
return ret;
}

View File

@@ -0,0 +1,332 @@
/*
* (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
*
*/
CGroupShape.prototype.addToRecalculate = CShape.prototype.addToRecalculate;
CGroupShape.prototype.Get_Theme = CShape.prototype.Get_Theme;
CGroupShape.prototype.setStartPage = CShape.prototype.setStartPage;
CGroupShape.prototype.handleUpdateFill = function () {
for (var i = 0; i < this.spTree.length; ++i) {
this.spTree[i].handleUpdateFill();
}
};
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.handleUpdateLn = function () {
for (var i = 0; i < this.spTree.length; ++i) {
this.spTree[i].handleUpdateLn();
}
};
CGroupShape.prototype.getRecalcObject = CShape.prototype.getRecalcObject;
CGroupShape.prototype.setRecalcObject = CShape.prototype.setRecalcObject;
CGroupShape.prototype.Get_ColorMap = CShape.prototype.Get_ColorMap;
CGroupShape.prototype.getTargetDocContent = DrawingObjectsController.prototype.getTargetDocContent;
CGroupShape.prototype.documentUpdateInterfaceState = function () {
if (this.selection.textSelection) {
this.selection.textSelection.getDocContent().Document_UpdateInterfaceState();
} else {
if (this.selection.chartSelection && this.selection.chartSelection.selection.textSelection) {
this.selection.chartSelection.selection.textSelection.getDocContent().Document_UpdateInterfaceState();
} else {
var para_pr = DrawingObjectsController.prototype.getParagraphParaPr.call(this);
var text_pr = DrawingObjectsController.prototype.getParagraphTextPr.call(this);
if (!para_pr) {
para_pr = new CParaPr();
}
if (!text_pr) {
text_pr = new CTextPr();
}
editor.UpdateParagraphProp(para_pr);
editor.UpdateTextPr(text_pr);
}
}
};
CGroupShape.prototype.setRecalculateInfo = function () {
this.recalcInfo = {
recalculateBrush: true,
recalculatePen: true,
recalculateTransform: true,
recalculateArrGraphicObjects: true,
recalculateBounds: true,
recalculateScaleCoefficients: true,
recalculateWrapPolygon: true
};
this.localTransform = new CMatrix();
this.bounds = {
l: 0,
t: 0,
r: 0,
b: 0,
w: 0,
h: 0
};
this.posX = null;
this.posY = null;
this.snapArrayX = [];
this.snapArrayY = [];
this.bNeedUpdatePosition = true;
};
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.recalculate = function () {
if (this.bDeleted) {
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.recalcInfo.recalculateTransform = false;
}
if (this.recalcInfo.recalculateArrGraphicObjects) {
this.recalculateArrGraphicObjects();
this.recalcInfo.recalculateArrGraphicObjects = false;
}
if (this.recalcInfo.recalculateWrapPolygon) {
this.recalculateWrapPolygon();
this.recalcInfo.recalculateWrapPolygon = 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, []);
};
CGroupShape.prototype.recalcBounds = function () {
this.recalcInfo.recalculateBounds = true;
for (var i = 0; i < this.spTree.length; ++i) {
this.spTree[i].recalcBounds();
}
};
CGroupShape.prototype.addToDrawingObjects = CShape.prototype.addToDrawingObjects;
CGroupShape.prototype.setDrawingObjects = CShape.prototype.setDrawingObjects;
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.getParentObjects = CShape.prototype.getParentObjects;
CGroupShape.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
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.getDrawingDocument = CShape.prototype.getDrawingDocument;
CGroupShape.prototype.handleUpdatePosition = function () {
this.recalcBounds();
this.recalcTransform();
this.addToRecalculate();
for (var i = 0; i < this.spTree.length; ++i) {
if (this.spTree[i].recalcTransform) {
this.spTree[i].recalcTransform();
}
}
};
CGroupShape.prototype.handleUpdateRot = function () {
this.recalcTransform();
this.recalcBounds();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CGroupShape.prototype.recalcWrapPolygon = function () {
this.recalcInfo.recalculateWrapPolygon = true;
};
CGroupShape.prototype.handleUpdateFlip = function () {
this.recalcTransform();
this.recalcBounds();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CGroupShape.prototype.handleUpdateChildOffset = function () {
this.recalcTransform();
this.recalcBounds();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CGroupShape.prototype.handleUpdateChildExtents = function () {
this.recalcTransform();
this.recalcBounds();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CGroupShape.prototype.recalculateWrapPolygon = CShape.prototype.recalculateWrapPolygon;
CGroupShape.prototype.getArrayWrapPolygons = function () {
var arr_wrap_polygons = [];
for (var i = 0; i < this.spTree.length; ++i) {
arr_wrap_polygons = arr_wrap_polygons.concat(this.spTree[i].getArrayWrapPolygons());
}
return arr_wrap_polygons;
};
CGroupShape.prototype.recalculateTransform = CShape.prototype.recalculateTransform;
CGroupShape.prototype.updatePosition = CShape.prototype.updatePosition;
CGroupShape.prototype.checkShapeChild = function () {
return false;
};
CGroupShape.prototype.checkShapeChildTransform = function () {
for (var i = 0; i < this.spTree.length; ++i) {
this.spTree[i].updatePosition(this.posX, this.posY);
}
};
CGroupShape.prototype.getArrayWrapIntervals = CShape.prototype.getArrayWrapIntervals;
CGroupShape.prototype.updateTransformMatrix = CShape.prototype.updateTransformMatrix;
CGroupShape.prototype.recalculateLocalTransform = CShape.prototype.recalculateLocalTransform;
CGroupShape.prototype.checkContentDrawings = function () {};
CGroupShape.prototype.applyParentTransform = function (transform) {};
CGroupShape.prototype.Refresh_RecalcData = function (data) {
switch (data.Type) {
case historyitem_GroupShapeAddToSpTree:
case historyitem_GroupShapeRemoveFromSpTree:
if (!this.group) {
this.recalcInfo.recalculateArrGraphicObjects = true;
this.addToRecalculate();
} else {
this.group.handleUpdateSpTree();
}
}
this.Refresh_RecalcData2();
};
CGroupShape.prototype.Refresh_RecalcData2 = function () {
this.addToRecalculate();
};
CGroupShape.prototype.documentStatistics = function (stat) {
for (var i = 0; i < this.spTree.length; ++i) {
if (this.spTree[i].documentStatistics) {
this.spTree[i].documentStatistics(stat);
}
}
};
CGroupShape.prototype.recalculateText = function () {
for (var i = 0; i < this.spTree.length; ++i) {
if (this.spTree[i].recalculateText) {
this.spTree[i].recalculateText();
}
}
};
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 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.getBoundsPos = 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) {
var bounds = sp_tree[i].bounds;
var l = sp_tree[i].x;
var r = sp_tree[i].x + sp_tree[i].extX;
var t = sp_tree[i].y;
var b = sp_tree[i].y + sp_tree[i].extY;
x_arr_max.push(r);
x_arr_min.push(l);
y_arr_max.push(b);
y_arr_min.push(t);
}
return {
x: Math.min.apply(Math, x_arr_min),
y: Math.min.apply(Math, y_arr_min)
};
};
CGroupShape.prototype.getAbsolutePos = 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) {
var bounds = sp_tree[i].bounds;
var l = sp_tree[i].x;
var r = sp_tree[i].x + sp_tree[i].extX;
var t = sp_tree[i].y;
var b = sp_tree[i].y + sp_tree[i].extY;
x_arr_max.push(r);
x_arr_min.push(l);
y_arr_max.push(b);
y_arr_min.push(t);
}
return {
x: Math.min.apply(Math, x_arr_min),
y: Math.min.apply(Math, y_arr_min)
};
};

View File

@@ -0,0 +1,209 @@
/*
* (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.Get_Theme = CShape.prototype.Get_Theme;
CImageShape.prototype.Get_ColorMap = CShape.prototype.Get_ColorMap;
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.getArrayWrapPolygons = CShape.prototype.getArrayWrapPolygons;
CImageShape.prototype.hitToHandles = CShape.prototype.hitToHandles;
CImageShape.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
CImageShape.prototype.getRotateAngle = CShape.prototype.getRotateAngle;
CImageShape.prototype.recalculateWrapPolygon = CShape.prototype.recalculateWrapPolygon;
CImageShape.prototype.setRecalculateInfo = function () {
this.recalcInfo = {
recalculateBrush: true,
recalculatePen: true,
recalculateTransform: true,
recalculateBounds: true,
recalculateGeometry: true,
recalculateFill: true,
recalculateLine: true,
recalculateTransparent: true,
recalculateWrapPolygon: true
};
this.bNeedUpdatePosition = true;
this.bounds = {
l: 0,
t: 0,
r: 0,
b: 0,
w: 0,
h: 0
};
this.posX = null;
this.posY = null;
this.snapArrayX = [];
this.snapArrayY = [];
this.localTransform = new CMatrix();
this.localTransformText = new CMatrix();
};
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.recalcWrapPolygon = function () {
this.recalcInfo.recalculateWrapPolygon = true;
};
CImageShape.prototype.handleUpdatePosition = function () {
this.recalcTransform();
this.recalcBounds();
this.addToRecalculate();
};
CImageShape.prototype.handleUpdateExtents = function () {
this.recalcGeometry();
this.recalcBounds();
this.recalcTransform();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CImageShape.prototype.handleUpdateRot = function () {
this.recalcTransform();
this.recalcBounds();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CImageShape.prototype.handleUpdateFlip = function () {
this.recalcTransform();
this.recalcWrapPolygon();
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.recalculateLocalTransform = CShape.prototype.recalculateLocalTransform;
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) {
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.recalcInfo.recalculateTransform = false;
}
if (this.recalcInfo.recalculateGeometry) {
this.recalculateGeometry();
this.recalcInfo.recalculateGeometry = false;
}
if (this.recalcInfo.recalculateBounds) {
this.recalculateBounds();
this.recalcInfo.recalculateBounds = false;
}
if (this.recalcInfo.recalculateWrapPolygon) {
this.recalculateWrapPolygon();
this.recalcInfo.recalculateWrapPolygon = false;
}
this.bNeedUpdatePosition = true;
},
this, []);
};
CImageShape.prototype.canChangeWrapPolygon = CShape.prototype.canChangeWrapPolygon;
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;
CImageShape.prototype.updatePosition = CShape.prototype.updatePosition;
CImageShape.prototype.updateTransformMatrix = CShape.prototype.updateTransformMatrix;
CImageShape.prototype.getDrawingDocument = CShape.prototype.getDrawingDocument;
CImageShape.prototype.getArrayWrapIntervals = CShape.prototype.getArrayWrapIntervals;
CImageShape.prototype.getBounds = CShape.prototype.getBounds;
CImageShape.prototype.setStartPage = CShape.prototype.setStartPage;
CImageShape.prototype.getRecalcObject = CShape.prototype.getRecalcObject;
CImageShape.prototype.setRecalcObject = CShape.prototype.setRecalcObject;
CImageShape.prototype.checkContentDrawings = function () {};
CImageShape.prototype.hit = CShape.prototype.hit;
CImageShape.prototype.checkShapeChildTransform = function () {
if (this.parent) {
var parent_shape = this.parent.isShapeChild(true);
if (parent_shape) {
global_MatrixTransformer.MultiplyAppend(this.transform, parent_shape.transformText);
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
}
}
};

View File

@@ -0,0 +1,773 @@
/*
* (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
*
*/
CShape.prototype.setRecalculateInfo = function () {
this.recalcInfo = {
recalculateContent: true,
recalculateTxBoxContent: 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],
recalculateShapeStyleForParagraph: true,
recalculateWrapPolygon: true
};
this.bNeedUpdatePosition = true;
this.textStyleForParagraph = null;
this.contentWidth = null;
this.contentHeight = null;
this.compiledStyles = [];
this.bounds = {
l: 0,
t: 0,
r: 0,
b: 0,
w: 0,
h: 0
};
this.posX = null;
this.posY = null;
this.snapArrayX = [];
this.snapArrayY = [];
this.localTransform = new CMatrix();
this.localTransformText = new CMatrix();
};
CShape.prototype.recalcContent = function () {
if (this.bWordShape) {
this.recalcInfo.recalculateTxBoxContent = true;
} else {
this.recalcInfo.recalculateContent = 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;
this.snapArrayX.length = 0;
this.snapArrayY.length = 0;
};
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;
};
CShape.prototype.recalcTxBoxContent = function () {
this.recalcInfo.recalculateTxBoxContent = true;
};
CShape.prototype.recalcWrapPolygon = function () {
this.recalcInfo.recalculateWrapPolygon = true;
};
CShape.prototype.addToRecalculate = function () {
editor.WordControl.m_oLogicDocument.DrawingObjects.addToRecalculate(this);
};
CShape.prototype.handleUpdatePosition = function () {
this.recalcTransform();
this.recalcBounds();
this.recalcTransformText();
this.addToRecalculate();
};
CShape.prototype.handleUpdateExtents = function () {
this.recalcContent();
this.recalcGeometry();
this.recalcBounds();
this.recalcWrapPolygon();
this.recalcContent();
this.recalcTxBoxContent();
this.recalcTransform();
this.recalcTransformText();
this.addToRecalculate();
};
CShape.prototype.handleUpdateRot = function () {
this.recalcTransform();
if (this.txBody && this.txBody.bodyPr && this.txBody.bodyPr.upright) {
this.recalcContent();
}
this.recalcTransformText();
this.recalcBounds();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CShape.prototype.handleUpdateFlip = function () {
this.recalcTransform();
this.recalcTransformText();
this.recalcContent();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CShape.prototype.handleUpdateFill = function () {
this.recalcBrush();
this.recalcFill();
this.recalcTransparent();
this.addToRecalculate();
};
CShape.prototype.handleUpdateLn = function () {
this.recalcLine();
this.recalcPen();
this.addToRecalculate();
};
CShape.prototype.handleUpdateGeometry = function () {
this.recalcGeometry();
this.recalcBounds();
this.recalcWrapPolygon();
this.addToRecalculate();
};
CShape.prototype.convertPixToMM = function (pix) {
return this.getDrawingDocument().GetMMPerDot(pix);
};
CShape.prototype.getCanvasContext = function () {
return this.getDrawingDocument().CanvasHitContext;
};
CShape.prototype.getCompiledStyle = function () {
return this.style;
};
CShape.prototype.getHierarchy = function () {
return [];
};
CShape.prototype.getParentObjects = function () {
return {
slide: null,
layout: null,
master: null,
theme: editor.WordControl.m_oLogicDocument.theme
};
};
CShape.prototype.recalculateTxBoxContent = function () {
if (this.textBoxContent === null || this.textBoxContent.Parent !== this) {
return;
}
var _l, _t, _r, _b;
var body_pr = this.getBodyPr();
var l_ins = typeof body_pr.lIns === "number" ? body_pr.lIns : 2.54;
var t_ins = typeof body_pr.tIns === "number" ? body_pr.tIns : 1.27;
var r_ins = typeof body_pr.rIns === "number" ? body_pr.rIns : 2.54;
var b_ins = typeof body_pr.bIns === "number" ? body_pr.bIns : 1.27;
var _body_pr = this.getBodyPr();
if (this.spPr && isRealObject(this.spPr.geometry) && isRealObject(this.spPr.geometry.rect)) {
var _rect = this.spPr.geometry.rect;
_l = _rect.l + l_ins;
_t = _rect.t + t_ins;
_r = _rect.r - r_ins;
_b = _rect.b - b_ins;
} else {
_l = l_ins;
_t = t_ins;
_r = this.extX - r_ins;
_b = this.extY - b_ins;
}
if (!_body_pr.upright) {
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 = this.getFullRotate();
if (checkNormalRotate(_full_rotate)) {
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.textBoxContent.Reset(0, 0, _content_width, 20000);
var CurPage = 0;
var RecalcResult = recalcresult2_NextPage;
while (recalcresult2_End != RecalcResult) {
RecalcResult = this.textBoxContent.Recalculate_Page(CurPage++, true);
}
};
CShape.prototype.recalculate = function () {
if (this.bDeleted || !this.bWordShape) {
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.recalcInfo.recalculateTransform = false;
}
if (this.recalcInfo.recalculateGeometry) {
this.recalculateGeometry();
this.recalcInfo.recalculateGeometry = false;
}
if (this.recalcInfo.recalculateBounds) {
this.recalculateBounds();
this.recalcInfo.recalculateBounds = false;
}
if (this.recalcInfo.recalculateWrapPolygon) {
this.recalculateWrapPolygon();
this.recalcInfo.recalculateWrapPolygon = false;
}
this.bNeedUpdatePosition = true;
},
this, []);
};
CShape.prototype.recalculateText = function () {
if (!this.bWordShape) {
return;
}
ExecuteNoHistory(function () {
if (this.bWordShape) {
if (this.recalcInfo.recalculateTxBoxContent) {
this.recalculateTxBoxContent();
this.recalcInfo.recalculateTxBoxContent = false;
}
} else {
if (this.recalcInfo.recalculateContent) {
this.recalculateContent();
this.recalcInfo.recalculateContent = false;
}
}
if (this.recalcInfo.recalculateTransformText) {
this.recalculateTransformText();
}
},
this, []);
};
CShape.prototype.recalculateWrapPolygon = function () {
if (this.parent) {
var wrapping_polygon = this.parent.wrappingPolygon;
if (!wrapping_polygon.edited) {
if (this.spTree) {
for (var i = 0; i < this.spTree.length; ++i) {
this.spTree[i].recalculate();
}
}
wrapping_polygon.calculate(this);
} else {
wrapping_polygon.calculateRelToAbs(this.localTransform, this);
}
}
};
CShape.prototype.getArrayWrapPolygons = function () {
var ret;
if (this.spPr && this.spPr.geometry) {
ret = this.spPr.geometry.getArrayPolygons();
} else {
ret = [];
}
var t = this.localTransform;
for (var i = 0; i < ret.length; ++i) {
var polygon = ret[i];
for (var j = 0; j < polygon.length; ++j) {
var p = polygon[j];
var x = t.TransformPointX(p.x, p.y);
var y = t.TransformPointY(p.x, p.y);
p.x = x;
p.y = y;
}
}
return ret;
};
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 && 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);
}
content.Reset(0, 0, w, h);
content.Recalculate_Page(content.StartPage, true);
}
};
CShape.prototype.recalculateTransform = function () {
this.recalculateLocalTransform(this.localTransform);
};
CShape.prototype.updatePosition = function (x, y) {
this.posX = x;
this.posY = y;
if (!this.group) {
this.x = this.localX + x;
this.y = this.localY + y;
} else {
this.x = this.localX;
this.y = this.localY;
}
this.updateTransformMatrix();
};
CShape.prototype.checkShapeChild = function () {
return false;
};
CShape.prototype.checkShapeChildTransform = function () {};
CShape.prototype.getArrayWrapIntervals = function (x0, y0, x1, y1, Y0Sp, Y1Sp, LeftField, RightField, arr_intervals) {
return this.parent.getArrayWrapIntervals(x0, y0, x1, y1, Y0Sp, Y1Sp, LeftField, RightField, arr_intervals);
};
CShape.prototype.updateTransformMatrix = function () {
this.transform = this.localTransform.CreateDublicate();
global_MatrixTransformer.TranslateAppend(this.transform, this.posX, this.posY);
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
if (this.localTransformText) {
this.transformText = this.localTransformText.CreateDublicate();
global_MatrixTransformer.TranslateAppend(this.transformText, this.posX, this.posY);
this.invertTransformText = global_MatrixTransformer.Invert(this.transformText);
}
this.checkShapeChildTransform();
this.checkContentDrawings();
};
CShape.prototype.checkContentDrawings = function () {
if (this.textBoxContent) {
var all_drawings = this.textBoxContent.Get_AllDrawingObjects([]);
for (var i = 0; i < all_drawings.length; ++i) {
all_drawings[i].GraphicObj.updateTransformMatrix();
}
}
};
CShape.prototype.applyParentTransform = function (transform) {
global_MatrixTransformer.MultiplyAppend(this.transform, transform);
global_MatrixTransformer.MultiplyAppend(this.transformText, transform);
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
this.invertTransformText = global_MatrixTransformer.Invert(this.transformText);
};
CShape.prototype.recalculateShapeStyleForParagraph = function () {
var styles = editor.WordControl.m_oLogicDocument.Styles;
this.textStyleForParagraph = {
TextPr: styles.Default.TextPr.Copy(),
ParaPr: styles.Default.ParaPr.Copy()
};
var DefId = styles.Default.Paragraph;
var DefaultStyle = styles.Style[DefId];
if (DefaultStyle) {
this.textStyleForParagraph.ParaPr.Merge(DefaultStyle.ParaPr);
this.textStyleForParagraph.TextPr.Merge(DefaultStyle.TextPr);
}
if (this.style && this.style.fontRef) {
this.textStyleForParagraph.TextPr.Color.Auto = false;
var shape_text_pr = new CTextPr();
if (this.style.fontRef.Color) {
shape_text_pr.Unifill = CreateUniFillByUniColorCopy(this.style.fontRef.Color);
}
if (this.style.fontRef.idx === fntStyleInd_major) {
shape_text_pr.RFonts.Ascii = {
Name: "+mj-lt",
Index: -1
};
shape_text_pr.RFonts.EastAsia = {
Name: "+mj-ea",
Index: -1
};
shape_text_pr.RFonts.CS = {
Name: "+mj-cs",
Index: -1
};
} else {
if (this.style.fontRef.idx === fntStyleInd_minor) {
shape_text_pr.RFonts.Ascii = {
Name: "+mn-lt",
Index: -1
};
shape_text_pr.RFonts.EastAsia = {
Name: "+mn-ea",
Index: -1
};
shape_text_pr.RFonts.CS = {
Name: "+mn-cs",
Index: -1
};
}
}
this.textStyleForParagraph.TextPr.Merge(shape_text_pr);
}
};
CShape.prototype.Get_ShapeStyleForPara = function () {
if (this.recalcInfo.recalculateShapeStyleForParagraph) {
this.recalculateShapeStyleForParagraph();
this.recalcInfo.recalculateShapeStyleForParagraph = false;
}
return this.textStyleForParagraph;
};
CShape.prototype.Refresh_RecalcData = function (data) {
this.recalcTxBoxContent();
this.recalcTransformText();
this.Refresh_RecalcData2();
};
CShape.prototype.Refresh_RecalcData2 = function () {
this.recalcTxBoxContent();
this.recalcTransformText();
this.addToRecalculate();
var HdrFtr = this.Is_HdrFtr(true);
if (HdrFtr) {
HdrFtr.Refresh_RecalcData2();
}
};
CShape.prototype.getStartPageAbsolute = function () {
return 0;
};
CShape.prototype.Get_StartPage_Absolute = function () {
return 0;
};
CShape.prototype.Get_Numbering = function () {
return editor.WordControl.m_oLogicDocument.Numbering;
};
CShape.prototype.Get_TableStyleForPara = function () {
return null;
};
CShape.prototype.Is_Cell = function () {
return false;
};
CShape.prototype.hitInTextRect = function (x, y) {
var content = this.getDocContent && this.getDocContent();
if (content) {
var t_x, t_y;
t_x = this.invertTransform.TransformPointX(x, y);
t_y = this.invertTransform.TransformPointY(x, y);
var w, h, x, y;
if (this.spPr && 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)) {
x = this.spPr.geometry.rect.l;
y = this.spPr.geometry.rect.t;
w = this.spPr.geometry.rect.r - this.spPr.geometry.rect.l;
h = this.spPr.geometry.rect.b - this.spPr.geometry.rect.t;
} else {
x = 0;
y = 0;
w = this.extX;
h = this.extY;
}
return t_x > x && t_x < x + w && t_y > y && t_y < y + h;
}
return false;
};
CShape.prototype.Set_CurrentElement = function (bUpdate, pageIndex) {
var drawing_objects = editor.WordControl.m_oLogicDocument.DrawingObjects;
drawing_objects.resetSelection(true);
var para_drawing;
if (this.group) {
var main_group = this.group.getMainGroup();
drawing_objects.selectObject(main_group, pageIndex);
main_group.selectObject(this, pageIndex);
main_group.selection.textSelection = this;
drawing_objects.selection.groupSelection = main_group;
para_drawing = main_group.parent;
} else {
drawing_objects.selectObject(this, pageIndex);
drawing_objects.selection.textSelection = this;
para_drawing = this.parent;
}
var hdr_ftr = para_drawing.DocumentContent.Is_HdrFtr(true);
if (hdr_ftr) {
hdr_ftr.Content.CurPos.Type = docpostype_DrawingObjects;
hdr_ftr.Set_CurrentElement(bUpdate);
} else {
drawing_objects.document.CurPos.Type = docpostype_DrawingObjects;
drawing_objects.document.Selection.Use = true;
if (true === bUpdate) {
drawing_objects.document.Document_UpdateInterfaceState();
drawing_objects.document.Document_UpdateRulersState();
drawing_objects.document.Document_UpdateSelectionState();
}
}
};
CShape.prototype.GetParaDrawing = function () {
if (this.group) {
var cur_group = this.group;
while (cur_group.group) {
cur_group = cur_group.group;
}
if (cur_group.parent) {
return cur_group.parent;
}
} else {
if (this.parent) {
return this.parent;
}
}
return null;
};
CShape.prototype.Get_StartPage_Relative = function () {
return 0;
};
CShape.prototype.Check_TableCoincidence = function (table) {
var para_drawing = this.GetParaDrawing();
if (para_drawing && para_drawing.DocumentContent) {
return para_drawing.DocumentContent.Check_TableCoincidence(table);
}
return false;
};
CShape.prototype.Get_PrevElementEndInfo = function (CurElement) {
var para_drawing = this.GetParaDrawing();
if (isRealObject(para_drawing) && isRealObject(para_drawing.DocumentContent) && (para_drawing.DocumentContent.Get_PrevElementEndInfo)) {
var parent_paragraph = para_drawing.Get_ParentParagraph();
if (parent_paragraph) {
return para_drawing.DocumentContent.Get_PrevElementEndInfo(parent_paragraph);
}
}
return null;
};
CShape.prototype.Is_ThisElementCurrent = function (CurElement) {
return editor.WordControl.m_oLogicDocument.DrawingObjects.getTargetDocContent() === this.getDocContent();
};
CShape.prototype.Is_UseInDocument = function () {
return !this.bDeleted;
};
CShape.prototype.Is_HdrFtr = function (bool) {
if (!this.group) {
if (isRealObject(this.parent) && isRealObject(this.parent.DocumentContent)) {
return this.parent.DocumentContent.Is_HdrFtr(bool);
}
} else {
var cur_group = this.group;
while (cur_group.group) {
cur_group = cur_group.group;
}
if (isRealObject(cur_group.parent) && isRealObject(cur_group.parent.DocumentContent)) {
return cur_group.parent.DocumentContent.Is_HdrFtr(bool);
}
}
return bool ? null : false;
};
CShape.prototype.OnContentReDraw = function () {
if (!isRealObject(this.group)) {
if (isRealObject(this.parent)) {
this.parent.OnContentReDraw();
}
} else {
var cur_group = this.group;
while (isRealObject(cur_group.group)) {
cur_group = cur_group.group;
}
if (isRealObject(cur_group) && isRealObject(cur_group.parent)) {
cur_group.parent.OnContentReDraw();
}
}
};
CShape.prototype.Get_TextBackGroundColor = function () {
return undefined;
};
CShape.prototype.documentStatistics = function (stats) {
var content = this.getDocContent();
return content && content.DocumentStatistics(stats);
};
CShape.prototype.checkPosTransformText = function () {
if (isRealNumber(this.posX) && isRealNumber(this.posY)) {
this.transformText = this.localTransformText.CreateDublicate();
global_MatrixTransformer.TranslateAppend(this.transformText, this.posX, this.posY);
this.invertTransformText = global_MatrixTransformer.Invert(this.transformText);
}
};
CShape.prototype.getNearestPos = function (x, y, pageIndex) {
if (isRealObject(this.textBoxContent)) {
var t_x = this.invertTransformText.TransformPointX(x, y);
var t_y = this.invertTransformText.TransformPointY(x, y);
var nearest_pos = this.textBoxContent.Get_NearestPos(pageIndex, t_x, t_y, false);
nearest_pos.transform = this.transformText;
return nearest_pos;
}
return null;
};
CShape.prototype.cursorGetPos = function () {
var content = this.getDocContent();
if (isRealObject(content)) {
var pos = content.Cursor_GetPos();
var transform = this.transformText;
var x = transform.TransformPointX(pos.X, pos.Y);
var y = transform.TransformPointY(pos.X, pos.Y);
return {
X: x,
Y: y
};
}
return {
X: 0,
Y: 0
};
};
CShape.prototype.cursorMoveAt = function (X, Y, AddToSelect) {
var content = this.getDocContent();
if (isRealObject(content)) {
var t_x = this.invertTransformText.TransformPointX(X, Y);
var t_y = this.invertTransformText.TransformPointY(X, Y);
content.Cursor_MoveAt(t_x, t_y, AddToSelect, undefined, isRealNumber(this.selectStartPage) ? this.selectStartPage : 0);
}
};
CShape.prototype.Get_Styles = function () {
return editor.WordControl.m_oLogicDocument.Styles;
};
CShape.prototype.Is_InTable = function (bReturnTopTable) {
if (true === bReturnTopTable) {
return null;
}
return false;
};
CShape.prototype.Get_Numbering = function () {
return editor.WordControl.m_oLogicDocument.Get_Numbering();
};
CShape.prototype.Get_TableStyleForPara = function () {
return editor.WordControl.m_oLogicDocument.Get_TableStyleForPara();
};
CShape.prototype.Is_Cell = function () {
return false;
};
CShape.prototype.Is_DrawingShape = function () {
return true;
};
CShape.prototype.Is_InTable = function (bReturnTopTable) {
if (true === bReturnTopTable) {
return null;
}
return false;
};
CShape.prototype.canChangeWrapPolygon = function (bReturnTopTable) {
return true;
};
CShape.prototype.Get_ColorMap = function () {
return editor.WordControl.m_oLogicDocument.Get_ColorMap();
};
CShape.prototype.Is_TopDocument = function () {
return false;
};
CShape.prototype.recalcText = function () {
if (this.recalculateText && this.recalcTxBoxContent && this.recalculateText) {
this.recalcTxBoxContent();
this.recalcTransformText();
}
};
CShape.prototype.getRecalcObject = function () {
var content = this.getDocContent && this.getDocContent();
if (content) {
return content.Save_RecalculateObject();
}
if (this.spTree) {
var ret = [];
for (var i = 0; i < this.spTree.length; ++i) {
ret.push(this.spTree[i].getRecalcObject());
}
return ret;
}
return null;
};
CShape.prototype.setRecalcObject = function (object) {
if (!object) {
return;
}
var content = this.getDocContent && this.getDocContent();
if (content) {
content.Load_RecalculateObject(object);
}
if (Array.isArray(object) && this.spTree && this.spTree.length === object.length) {
for (var i = 0; i < this.spTree.length; ++i) {
this.spTree[i].setRecalcObject(object[i]);
}
}
};
CShape.prototype.setStartPage = function (pageIndex, bNoResetSelectPage) {
if (! (bNoResetSelectPage === true)) {
this.selectStartPage = pageIndex;
}
var content = this.getDocContent && this.getDocContent();
content && content.Set_StartPage(pageIndex);
if (Array.isArray(this.spTree)) {
for (var i = 0; i < this.spTree.length; ++i) {
this.spTree[i].setStartPage && this.spTree[i].setStartPage(pageIndex);
}
}
};
CShape.prototype.getStyles = function () {
return {
styles: editor.WordControl.m_oLogicDocument.Styles,
styleId: null
};
};