init repo

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

View File

@@ -0,0 +1,651 @@
/*
* (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 ArcToCurvers = null;
var ArcToOnCanvas = null;
var HitToArc = null;
(function () {
function Arc3(ctx, fX, fY, fWidth, fHeight, fStartAngle, fSweepAngle) {
var sin1 = Math.sin(fStartAngle);
var cos1 = Math.cos(fStartAngle);
var __x = cos1 / fWidth;
var __y = sin1 / fHeight;
var l = 1 / Math.sqrt(__x * __x + __y * __y);
var cx = fX - l * cos1;
var cy = fY - l * sin1;
Arc2(ctx, cx - fWidth, cy - fHeight, 2 * fWidth, 2 * fHeight, fStartAngle, fSweepAngle);
}
function Arc2(ctx, fX, fY, fWidth, fHeight, fStartAngle, fSweepAngle) {
if (0 >= fWidth || 0 >= fHeight) {
return;
}
fStartAngle = -fStartAngle;
fSweepAngle = -fSweepAngle;
if (false) {
var fStartX = fX + fWidth / 2 + fWidth / 2 * Math.cos(AngToEllPrm(fStartAngle, fWidth / 2, fHeight / 2));
var fStartY = fY + fHeight / 2 - fHeight / 2 * Math.sin(AngToEllPrm(fStartAngle, fWidth / 2, fHeight / 2));
if (fSweepAngle < (2 * Math.PI)) {
ctx._m(fStartX, fStartY);
}
}
var bClockDirection = false;
var fEndAngle = (2 * Math.PI) - (fSweepAngle + fStartAngle);
var fSrtAngle = (2 * Math.PI) - fStartAngle;
if (fSweepAngle > 0) {
bClockDirection = true;
}
if (Math.abs(fSweepAngle) >= (2 * Math.PI)) {
Ellipse(ctx, fX + fWidth / 2, fY + fHeight / 2, fWidth / 2, fHeight / 2);
} else {
EllipseArc(ctx, fX + fWidth / 2, fY + fHeight / 2, fWidth / 2, fHeight / 2, fSrtAngle, fEndAngle, bClockDirection);
}
}
function AngToEllPrm(fAngle, fXRad, fYRad) {
return Math.atan2(Math.sin(fAngle) / fYRad, Math.cos(fAngle) / fXRad);
}
function Ellipse(ctx, fX, fY, fXRad, fYRad) {
ctx._m(fX - fXRad, fY);
var c_fKappa = 0.5520000000000001;
ctx._c(fX - fXRad, fY + fYRad * c_fKappa, fX - fXRad * c_fKappa, fY + fYRad, fX, fY + fYRad);
ctx._c(fX + fXRad * c_fKappa, fY + fYRad, fX + fXRad, fY + fYRad * c_fKappa, fX + fXRad, fY);
ctx._c(fX + fXRad, fY - fYRad * c_fKappa, fX + fXRad * c_fKappa, fY - fYRad, fX, fY - fYRad);
ctx._c(fX - fXRad * c_fKappa, fY - fYRad, fX - fXRad, fY - fYRad * c_fKappa, fX - fXRad, fY);
}
function EllipseArc(ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, bClockDirection) {
while (fAngle1 < 0) {
fAngle1 += (2 * Math.PI);
}
while (fAngle1 > (2 * Math.PI)) {
fAngle1 -= (2 * Math.PI);
}
while (fAngle2 < 0) {
fAngle2 += (2 * Math.PI);
}
while (fAngle2 >= (2 * Math.PI)) {
fAngle2 -= (2 * Math.PI);
}
if (!bClockDirection) {
if (fAngle1 <= fAngle2) {
EllipseArc2(ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, false);
} else {
EllipseArc2(ctx, fX, fY, fXRad, fYRad, fAngle1, 2 * Math.PI, false);
EllipseArc2(ctx, fX, fY, fXRad, fYRad, 0, fAngle2, false);
}
} else {
if (fAngle1 >= fAngle2) {
EllipseArc2(ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, true);
} else {
EllipseArc2(ctx, fX, fY, fXRad, fYRad, fAngle1, 0, true);
EllipseArc2(ctx, fX, fY, fXRad, fYRad, 2 * Math.PI, fAngle2, true);
}
}
}
function EllipseArc2(ctx, fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection) {
var nFirstPointQuard = ((2 * dAngle1 / Math.PI) >> 0) + 1;
var nSecondPointQuard = ((2 * dAngle2 / Math.PI) >> 0) + 1;
nSecondPointQuard = Math.min(4, Math.max(1, nSecondPointQuard));
nFirstPointQuard = Math.min(4, Math.max(1, nFirstPointQuard));
var fStartX = fX + fXRad * Math.cos(AngToEllPrm(dAngle1, fXRad, fYRad));
var fStartY = fY + fYRad * Math.sin(AngToEllPrm(dAngle1, fXRad, fYRad));
var EndPoint = {
X: 0,
Y: 0
};
var fCurX = fStartX,
fCurY = fStartY;
var dStartAngle = dAngle1;
var dEndAngle = 0;
if (!bClockDirection) {
for (var nIndex = nFirstPointQuard; nIndex <= nSecondPointQuard; nIndex++) {
if (nIndex == nSecondPointQuard) {
dEndAngle = dAngle2;
} else {
dEndAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nFirstPointQuard)) {
dStartAngle = (nIndex - 1) * Math.PI / 2;
}
EndPoint = EllipseArc3(ctx, fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false);
}
} else {
for (var nIndex = nFirstPointQuard; nIndex >= nSecondPointQuard; nIndex--) {
if (nIndex == nFirstPointQuard) {
dStartAngle = dAngle1;
} else {
dStartAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nSecondPointQuard)) {
dEndAngle = (nIndex - 1) * Math.PI / 2;
} else {
dEndAngle = dAngle2;
}
EndPoint = EllipseArc3(ctx, fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false);
}
}
}
function EllipseArc3(ctx, fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection) {
var fAlpha = Math.sin(dAngle2 - dAngle1) * (Math.sqrt(4 + 3 * Math.tan((dAngle2 - dAngle1) / 2) * Math.tan((dAngle2 - dAngle1) / 2)) - 1) / 3;
var sin1 = Math.sin(dAngle1);
var cos1 = Math.cos(dAngle1);
var sin2 = Math.sin(dAngle2);
var cos2 = Math.cos(dAngle2);
var fX1 = fX + fXRad * cos1;
var fY1 = fY + fYRad * sin1;
var fX2 = fX + fXRad * cos2;
var fY2 = fY + fYRad * sin2;
var fCX1 = fX1 - fAlpha * fXRad * sin1;
var fCY1 = fY1 + fAlpha * fYRad * cos1;
var fCX2 = fX2 + fAlpha * fXRad * sin2;
var fCY2 = fY2 - fAlpha * fYRad * cos2;
if (!bClockDirection) {
ctx._c(fCX1, fCY1, fCX2, fCY2, fX2, fY2);
return {
X: fX2,
Y: fY2
};
} else {
ctx._c(fCX2, fCY2, fCX1, fCY1, fX1, fY1);
return {
X: fX1,
Y: fY1
};
}
}
ArcToCurvers = Arc3;
function _ArcToOnCanvas(context, start_x, start_y, width_r, height_r, start_ang, sweep_ang) {
var _sin = Math.sin(start_ang);
var _cos = Math.cos(start_ang);
var _x = _cos / width_r;
var _y = _sin / height_r;
var _l = 1 / Math.sqrt(_x * _x + _y * _y);
var _cx = start_x - _l * _cos;
var _cy = start_y - _l * _sin;
ArcTo2OnCanvas(context, _cx - width_r, _cy - height_r, 2 * width_r, 2 * height_r, start_ang, sweep_ang);
}
function ArcTo2OnCanvas(context, _l_c_x, _l_c_y, width, height, start_ang, sweep_ang) {
if (0 >= width || 0 >= height) {
return;
}
start_ang = -start_ang;
sweep_ang = -sweep_ang;
var bClockDirection = false;
var fEndAngle = (2 * Math.PI) - (sweep_ang + start_ang);
var fSrtAngle = (2 * Math.PI) - start_ang;
if (sweep_ang > 0) {
bClockDirection = true;
}
if (Math.abs(sweep_ang) >= (2 * Math.PI)) {
EllipseOnCanvas(context, _l_c_x + width / 2, _l_c_y + height / 2, width / 2, height / 2);
} else {
EllipseArcOnCanvas(context, _l_c_x + width / 2, _l_c_y + height / 2, width / 2, height / 2, fSrtAngle, fEndAngle, bClockDirection);
}
}
function EllipseOnCanvas(ctx, fX, fY, fXRad, fYRad) {
ctx.moveTo(fX - fXRad, fY);
var c_fKappa = 0.5520000000000001;
ctx.bezierCurveTo(fX - fXRad, fY + fYRad * c_fKappa, fX - fXRad * c_fKappa, fY + fYRad, fX, fY + fYRad);
ctx.bezierCurveTo(fX + fXRad * c_fKappa, fY + fYRad, fX + fXRad, fY + fYRad * c_fKappa, fX + fXRad, fY);
ctx.bezierCurveTo(fX + fXRad, fY - fYRad * c_fKappa, fX + fXRad * c_fKappa, fY - fYRad, fX, fY - fYRad);
ctx.bezierCurveTo(fX - fXRad * c_fKappa, fY - fYRad, fX - fXRad, fY - fYRad * c_fKappa, fX - fXRad, fY);
}
function EllipseArcOnCanvas(ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, bClockDirection) {
while (fAngle1 < 0) {
fAngle1 += (2 * Math.PI);
}
while (fAngle1 > (2 * Math.PI)) {
fAngle1 -= (2 * Math.PI);
}
while (fAngle2 < 0) {
fAngle2 += (2 * Math.PI);
}
while (fAngle2 >= (2 * Math.PI)) {
fAngle2 -= (2 * Math.PI);
}
if (!bClockDirection) {
if (fAngle1 <= fAngle2) {
EllipseArc2OnCanvas(ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, false);
} else {
EllipseArc2OnCanvas(ctx, fX, fY, fXRad, fYRad, fAngle1, 2 * Math.PI, false);
EllipseArc2OnCanvas(ctx, fX, fY, fXRad, fYRad, 0, fAngle2, false);
}
} else {
if (fAngle1 >= fAngle2) {
EllipseArc2OnCanvas(ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, true);
} else {
EllipseArc2OnCanvas(ctx, fX, fY, fXRad, fYRad, fAngle1, 0, true);
EllipseArc2OnCanvas(ctx, fX, fY, fXRad, fYRad, 2 * Math.PI, fAngle2, true);
}
}
}
function EllipseArc2OnCanvas(ctx, fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection) {
var nFirstPointQuard = ((2 * dAngle1 / Math.PI) >> 0) + 1;
var nSecondPointQuard = ((2 * dAngle2 / Math.PI) >> 0) + 1;
nSecondPointQuard = Math.min(4, Math.max(1, nSecondPointQuard));
nFirstPointQuard = Math.min(4, Math.max(1, nFirstPointQuard));
var fStartX = fX + fXRad * Math.cos(AngToEllPrm(dAngle1, fXRad, fYRad));
var fStartY = fY + fYRad * Math.sin(AngToEllPrm(dAngle1, fXRad, fYRad));
var EndPoint = {
X: 0,
Y: 0
};
ctx.lineTo(fStartX, fStartY);
var fCurX = fStartX,
fCurY = fStartY;
var dStartAngle = dAngle1;
var dEndAngle = 0;
if (!bClockDirection) {
for (var nIndex = nFirstPointQuard; nIndex <= nSecondPointQuard; nIndex++) {
if (nIndex == nSecondPointQuard) {
dEndAngle = dAngle2;
} else {
dEndAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nFirstPointQuard)) {
dStartAngle = (nIndex - 1) * Math.PI / 2;
}
EndPoint = EllipseArc3OnCanvas(ctx, fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false);
}
} else {
for (var nIndex = nFirstPointQuard; nIndex >= nSecondPointQuard; nIndex--) {
if (nIndex == nFirstPointQuard) {
dStartAngle = dAngle1;
} else {
dStartAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nSecondPointQuard)) {
dEndAngle = (nIndex - 1) * Math.PI / 2;
} else {
dEndAngle = dAngle2;
}
EndPoint = EllipseArc3OnCanvas(ctx, fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false);
}
}
}
function EllipseArc3OnCanvas(ctx, fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection) {
var fAlpha = Math.sin(dAngle2 - dAngle1) * (Math.sqrt(4 + 3 * Math.tan((dAngle2 - dAngle1) / 2) * Math.tan((dAngle2 - dAngle1) / 2)) - 1) / 3;
var sin1 = Math.sin(dAngle1);
var cos1 = Math.cos(dAngle1);
var sin2 = Math.sin(dAngle2);
var cos2 = Math.cos(dAngle2);
var fX1 = fX + fXRad * cos1;
var fY1 = fY + fYRad * sin1;
var fX2 = fX + fXRad * cos2;
var fY2 = fY + fYRad * sin2;
var fCX1 = fX1 - fAlpha * fXRad * sin1;
var fCY1 = fY1 + fAlpha * fYRad * cos1;
var fCX2 = fX2 + fAlpha * fXRad * sin2;
var fCY2 = fY2 - fAlpha * fYRad * cos2;
if (!bClockDirection) {
ctx.bezierCurveTo(fCX1, fCY1, fCX2, fCY2, fX2, fY2);
return {
X: fX2,
Y: fY2
};
} else {
ctx.bezierCurveTo(fCX2, fCY2, fCX1, fCY1, fX1, fY1);
return {
X: fX1,
Y: fY1
};
}
}
function _HitToArc(context, px, py, start_x, start_y, width_r, height_r, start_ang, sweep_ang) {
var _sin = Math.sin(start_ang);
var _cos = Math.cos(start_ang);
var _x = _cos / width_r;
var _y = _sin / height_r;
var _l = 1 / Math.sqrt(_x * _x + _y * _y);
var _cx = start_x - _l * _cos;
var _cy = start_y - _l * _sin;
return HitToArc2(px, py, context, _cx - width_r, _cy - height_r, 2 * width_r, 2 * height_r, start_ang, sweep_ang);
}
function HitToArc2(px, py, context, _l_c_x, _l_c_y, width, height, start_ang, sweep_ang) {
if (0 >= width || 0 >= height) {
return;
}
start_ang = -start_ang;
sweep_ang = -sweep_ang;
var bClockDirection = false;
var fEndAngle = (2 * Math.PI) - (sweep_ang + start_ang);
var fSrtAngle = (2 * Math.PI) - start_ang;
if (sweep_ang > 0) {
bClockDirection = true;
}
if (Math.abs(sweep_ang) >= (2 * Math.PI)) {
return HitToEllipseOnCanvas(px, py, context, _l_c_x + width / 2, _l_c_y + height / 2, width / 2, height / 2);
} else {
return HitToEllipseArcOnCanvas(px, py, context, _l_c_x + width / 2, _l_c_y + height / 2, width / 2, height / 2, fSrtAngle, fEndAngle, bClockDirection);
}
}
function HitToEllipseOnCanvas(px, py, ctx, fX, fY, fXRad, fYRad) {
var c_fKappa = 0.5520000000000001;
return HitInBezier4(ctx, px, py, fX - fXRad, fY, fX - fXRad, fY + fYRad * c_fKappa, fX - fXRad * c_fKappa, fY + fYRad, fX, fY + fYRad) || HitInBezier4(ctx, px, py, fX, fY + fYRad, fX + fXRad * c_fKappa, fY + fYRad, fX + fXRad, fY + fYRad * c_fKappa, fX + fXRad, fY) || HitInBezier4(ctx, px, py, fX + fXRad, fY, fX + fXRad, fY - fYRad * c_fKappa, fX + fXRad * c_fKappa, fY - fYRad, fX, fY - fYRad) || HitInBezier4(ctx, px, py, fX, fY - fYRad, fX - fXRad * c_fKappa, fY - fYRad, fX - fXRad, fY - fYRad * c_fKappa, fX - fXRad, fY);
}
function HitToEllipseArcOnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, bClockDirection) {
while (fAngle1 < 0) {
fAngle1 += (2 * Math.PI);
}
while (fAngle1 > (2 * Math.PI)) {
fAngle1 -= (2 * Math.PI);
}
while (fAngle2 < 0) {
fAngle2 += (2 * Math.PI);
}
while (fAngle2 >= (2 * Math.PI)) {
fAngle2 -= (2 * Math.PI);
}
if (!bClockDirection) {
if (fAngle1 <= fAngle2) {
return HitToEllipseArc2OnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, false);
} else {
return HitToEllipseArc2OnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, fAngle1, 2 * Math.PI, false) || HitToEllipseArc2OnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, 0, fAngle2, false);
}
} else {
if (fAngle1 >= fAngle2) {
return HitToEllipseArc2OnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, fAngle1, fAngle2, true);
} else {
return HitToEllipseArc2OnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, fAngle1, 0, true) || HitToEllipseArc2OnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, 2 * Math.PI, fAngle2, true);
}
}
}
function HitToEllipseArc2OnCanvas(px, py, ctx, fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection) {
var nFirstPointQuard = ((2 * dAngle1 / Math.PI) >> 0) + 1;
var nSecondPointQuard = ((2 * dAngle2 / Math.PI) >> 0) + 1;
nSecondPointQuard = Math.min(4, Math.max(1, nSecondPointQuard));
nFirstPointQuard = Math.min(4, Math.max(1, nFirstPointQuard));
var fStartX = fX + fXRad * Math.cos(AngToEllPrm(dAngle1, fXRad, fYRad));
var fStartY = fY + fYRad * Math.sin(AngToEllPrm(dAngle1, fXRad, fYRad));
var EndPoint = {
X: fStartX,
Y: fStartY,
hit: false
};
var dStartAngle = dAngle1;
var dEndAngle = 0;
if (!bClockDirection) {
for (var nIndex = nFirstPointQuard; nIndex <= nSecondPointQuard; nIndex++) {
if (nIndex == nSecondPointQuard) {
dEndAngle = dAngle2;
} else {
dEndAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nFirstPointQuard)) {
dStartAngle = (nIndex - 1) * Math.PI / 2;
}
EndPoint = HitToEllipseArc3OnCanvas(px, py, EndPoint, ctx, fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false);
if (EndPoint.hit) {
return true;
}
}
} else {
for (var nIndex = nFirstPointQuard; nIndex >= nSecondPointQuard; nIndex--) {
if (nIndex == nFirstPointQuard) {
dStartAngle = dAngle1;
} else {
dStartAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nSecondPointQuard)) {
dEndAngle = (nIndex - 1) * Math.PI / 2;
} else {
dEndAngle = dAngle2;
}
EndPoint = HitToEllipseArc3OnCanvas(px, py, EndPoint, ctx, fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false);
if (EndPoint.hit) {
return true;
}
}
}
return false;
}
function HitToEllipseArc3OnCanvas(px, py, EndPoint, ctx, fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection) {
var fAlpha = Math.sin(dAngle2 - dAngle1) * (Math.sqrt(4 + 3 * Math.tan((dAngle2 - dAngle1) / 2) * Math.tan((dAngle2 - dAngle1) / 2)) - 1) / 3;
var sin1 = Math.sin(dAngle1);
var cos1 = Math.cos(dAngle1);
var sin2 = Math.sin(dAngle2);
var cos2 = Math.cos(dAngle2);
var fX1 = fX + fXRad * cos1;
var fY1 = fY + fYRad * sin1;
var fX2 = fX + fXRad * cos2;
var fY2 = fY + fYRad * sin2;
var fCX1 = fX1 - fAlpha * fXRad * sin1;
var fCY1 = fY1 + fAlpha * fYRad * cos1;
var fCX2 = fX2 + fAlpha * fXRad * sin2;
var fCY2 = fY2 - fAlpha * fYRad * cos2;
if (!bClockDirection) {
return {
X: fX2,
Y: fY2,
hit: HitInBezier4(ctx, px, py, EndPoint.X, EndPoint.Y, fCX1, fCY1, fCX2, fCY2, fX2, fY2)
};
} else {
return {
X: fX1,
Y: fY1,
hit: HitInBezier4(ctx, px, py, EndPoint.X, EndPoint.Y, fCX2, fCY2, fCX1, fCY1, fX1, fY1)
};
}
}
ArcToOnCanvas = _ArcToOnCanvas;
HitToArc = _HitToArc;
})();
function getArrayPointsCurveBezierAtArcTo(fX, fY, fWidth, fHeight, fStartAngle, fSweepAngle, lastPointX, lastPointY) {
var sin1 = Math.sin(fStartAngle);
var cos1 = Math.cos(fStartAngle);
var __x = cos1 / fWidth;
var __y = sin1 / fHeight;
var l = 1 / Math.sqrt(__x * __x + __y * __y);
var cx = fX - l * cos1;
var cy = fY - l * sin1;
return getArrayPointsCurveBezierAtArcTo2(cx - fWidth, cy - fHeight, 2 * fWidth, 2 * fHeight, fStartAngle, fSweepAngle, lastPointX, lastPointY);
}
function getArrayPointsCurveBezierAtArcTo2(fX, fY, fWidth, fHeight, fStartAngle, fSweepAngle, lastPointX, lastPointY) {
if (0 >= fWidth || 0 >= fHeight) {
return [];
}
fStartAngle = -fStartAngle;
fSweepAngle = -fSweepAngle;
var bClockDirection = false;
var fEndAngle = (2 * Math.PI) - (fSweepAngle + fStartAngle);
var fSrtAngle = (2 * Math.PI) - fStartAngle;
if (fSweepAngle > 0) {
bClockDirection = true;
}
if (Math.abs(fSweepAngle) >= (2 * Math.PI)) {
return getArrayPointsCurveBezierAtArcToEllipse(fX + fWidth / 2, fY + fHeight / 2, fWidth / 2, fHeight / 2);
} else {
return getArrayPointsCurveBezierAtArcToEllipseArc(fX + fWidth / 2, fY + fHeight / 2, fWidth / 2, fHeight / 2, fSrtAngle, fEndAngle, bClockDirection, lastPointX, lastPointY);
}
}
function getArrayPointsCurveBezierAtArcToEllipse(fX, fY, fXRad, fYRad) {
var c_fKappa = 0.5520000000000001;
var ret_arr = [];
ret_arr.push({
x0: fX - fXRad,
y0: fY,
x1: fX - fXRad,
y1: fY + fYRad * c_fKappa,
x2: fX - fXRad * c_fKappa,
y2: fY + fYRad,
x3: fX,
y3: fY + fYRad
});
ret_arr.push({
x0: fX,
y0: fY + fYRad,
x1: fX + fXRad * c_fKappa,
y1: fY + fYRad,
x2: fX + fXRad,
y2: fY + fYRad * c_fKappa,
x3: fX + fXRad,
y3: fY
});
ret_arr.push({
x0: fX + fXRad,
y0: fY,
x1: fX + fXRad,
y1: fY - fYRad * c_fKappa,
x2: fX + fXRad * c_fKappa,
y2: fY - fYRad,
x3: fX,
y3: fY - fYRad
});
ret_arr.push({
x0: fX + fXRad,
y0: fY,
x1: fX + fXRad,
y1: fY - fYRad * c_fKappa,
x2: fX + fXRad * c_fKappa,
y2: fY - fYRad,
x3: fX,
y3: fY - fYRad
});
ret_arr.push({
x0: fX,
y0: fY - fYRad,
x1: fX - fXRad * c_fKappa,
y1: fY - fYRad,
x2: fX - fXRad,
y2: fY - fYRad * c_fKappa,
x3: fX - fXRad,
y3: fY
});
return ret_arr;
}
function getArrayPointsCurveBezierAtArcToEllipseArc(fX, fY, fXRad, fYRad, fAngle1, fAngle2, bClockDirection, lastPointX, lastPointY) {
while (fAngle1 < 0) {
fAngle1 += (2 * Math.PI);
}
while (fAngle1 > (2 * Math.PI)) {
fAngle1 -= (2 * Math.PI);
}
while (fAngle2 < 0) {
fAngle2 += (2 * Math.PI);
}
while (fAngle2 >= (2 * Math.PI)) {
fAngle2 -= (2 * Math.PI);
}
if (!bClockDirection) {
if (fAngle1 <= fAngle2) {
return getArrayPointsCurveBezierAtArcToEllipseArc2(fX, fY, fXRad, fYRad, fAngle1, fAngle2, false, lastPointX, lastPointY);
} else {
var tmp = getArrayPointsCurveBezierAtArcToEllipseArc2(fX, fY, fXRad, fYRad, fAngle1, 2 * Math.PI, false, lastPointX, lastPointY);
return tmp.concat(getArrayPointsCurveBezierAtArcToEllipseArc2(fX, fY, fXRad, fYRad, 0, fAngle2, false, tmp.x4, tmp.y4));
}
} else {
if (fAngle1 >= fAngle2) {
return getArrayPointsCurveBezierAtArcToEllipseArc2(fX, fY, fXRad, fYRad, fAngle1, fAngle2, true, lastPointX, lastPointY);
} else {
tmp = getArrayPointsCurveBezierAtArcToEllipseArc2(fX, fY, fXRad, fYRad, fAngle1, 0, true, lastPointX, lastPointY);
return tmp.concat(getArrayPointsCurveBezierAtArcToEllipseArc2(fX, fY, fXRad, fYRad, 2 * Math.PI, fAngle2, true, tmp.x4, tmp.y4));
}
}
}
function getArrayPointsCurveBezierAtArcToEllipseArc2(fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection, lastPointX, lastPointY) {
var nFirstPointQuard = ((2 * dAngle1 / Math.PI) >> 0) + 1;
var nSecondPointQuard = ((2 * dAngle2 / Math.PI) >> 0) + 1;
nSecondPointQuard = Math.min(4, Math.max(1, nSecondPointQuard));
nFirstPointQuard = Math.min(4, Math.max(1, nFirstPointQuard));
var fStartX = fX + fXRad * Math.cos(AngToEllPrm(dAngle1, fXRad, fYRad));
var fStartY = fY + fYRad * Math.sin(AngToEllPrm(dAngle1, fXRad, fYRad));
var EndPoint = {
X: 0,
Y: 0
};
var fCurX = fStartX,
fCurY = fStartY;
var dStartAngle = dAngle1;
var dEndAngle = 0;
if (!bClockDirection) {
for (var nIndex = nFirstPointQuard; nIndex <= nSecondPointQuard; nIndex++) {
if (nIndex == nSecondPointQuard) {
dEndAngle = dAngle2;
} else {
dEndAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nFirstPointQuard)) {
dStartAngle = (nIndex - 1) * Math.PI / 2;
}
return getArrayPointsCurveBezierAtArcToEllipseArc3(fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false, lastPointX, lastPointY);
}
} else {
for (var nIndex = nFirstPointQuard; nIndex >= nSecondPointQuard; nIndex--) {
if (nIndex == nFirstPointQuard) {
dStartAngle = dAngle1;
} else {
dStartAngle = nIndex * Math.PI / 2;
}
if (! (nIndex == nSecondPointQuard)) {
dEndAngle = (nIndex - 1) * Math.PI / 2;
} else {
dEndAngle = dAngle2;
}
return getArrayPointsCurveBezierAtArcToEllipseArc3(fX, fY, fXRad, fYRad, AngToEllPrm(dStartAngle, fXRad, fYRad), AngToEllPrm(dEndAngle, fXRad, fYRad), false, lastPointX, lastPointY);
}
}
}
function getArrayPointsCurveBezierAtArcToEllipseArc3(fX, fY, fXRad, fYRad, dAngle1, dAngle2, bClockDirection, lastPointX, lastPointY) {
var fAlpha = Math.sin(dAngle2 - dAngle1) * (Math.sqrt(4 + 3 * Math.tan((dAngle2 - dAngle1) / 2) * Math.tan((dAngle2 - dAngle1) / 2)) - 1) / 3;
var sin1 = Math.sin(dAngle1);
var cos1 = Math.cos(dAngle1);
var sin2 = Math.sin(dAngle2);
var cos2 = Math.cos(dAngle2);
var fX1 = fX + fXRad * cos1;
var fY1 = fY + fYRad * sin1;
var fX2 = fX + fXRad * cos2;
var fY2 = fY + fYRad * sin2;
var fCX1 = fX1 - fAlpha * fXRad * sin1;
var fCY1 = fY1 + fAlpha * fYRad * cos1;
var fCX2 = fX2 + fAlpha * fXRad * sin2;
var fCY2 = fY2 - fAlpha * fYRad * cos2;
if (!bClockDirection) {
return [{
x0: lastPointX,
y0: lastPointY,
x1: fCX1,
y1: fCY1,
x2: fCX2,
y2: fCY2,
x3: fX2,
y3: fY2
}];
} else {
return [{
x0: lastPointX,
y0: lastPointY,
x1: fCX2,
y1: fCY2,
x2: fCX1,
y2: fCY1,
x3: fX1,
y3: fY1
}];
}
}

View File

@@ -0,0 +1,136 @@
/*
* (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 CShapeColor(r, g, b) {
this.r = r;
this.g = g;
this.b = b;
this.darken = function () {
var hslColor = RGBToHSL(this);
hslColor.l *= 0.9;
return HSLToRGB(hslColor);
};
this.darkenLess = function () {
var hslColor = RGBToHSL(this);
hslColor.l *= 0.85;
return HSLToRGB(hslColor);
};
this.lighten = function () {
var hslColor = RGBToHSL(this);
hslColor.l *= 1.1;
if (hslColor.l > 1) {
hslColor.l = 1;
}
return HSLToRGB(hslColor);
};
this.lightenLess = function () {
var hslColor = RGBToHSL(this);
hslColor.l *= 1.1;
if (hslColor.l > 1) {
hslColor.l = 1;
}
return HSLToRGB(hslColor);
};
this.norm = function (a) {
return this;
};
}
function RGBToHSL(RGBColor) {
var r, g, b;
r = RGBColor.r / 255;
g = RGBColor.g / 255;
b = RGBColor.b / 255;
var max, min;
max = Math.max(r, g, b);
min = Math.min(r, g, b);
var h, s, l;
h = max === min ? 0 : (max == r && g >= b) ? 60 * (g - b) / (max - min) : (max == r && g < b) ? 60 * (g - b) / (max - min) + 360 : (max == g) ? 60 * (b - r) / (max - min) + 120 : 60 * (r - g) / (max - min) + 240;
l = (max + min) * 0.5;
s = l > 0.5 ? (max - min) / (2 - max - min) : (max - min) / (max + min);
while (h < 0) {
h += 360;
}
while (h >= 360) {
h -= 360;
}
return {
h: h,
s: s,
l: l
};
}
function HSLToRGB(HSLColor) {
var h, s, l, r, g, b;
h = HSLColor.h / 360;
s = HSLColor.s;
l = HSLColor.l;
var q, p, tr, tg, tb;
q = l < 0.5 ? (l * (1 + s)) : l + s - l * s;
p = 2 * l - q;
tr = h + 1 / 3;
tg = h;
tb = h - 1 / 3;
if (tr < 0) {
tr += 1;
}
if (tr > 1) {
tr -= 1;
}
if (tg < 0) {
tg += 1;
}
if (tg > 1) {
tg -= 1;
}
if (tb < 0) {
tb += 1;
}
if (tb > 1) {
tb -= 1;
}
r = Math.round(255 * (tr < 1 / 6 ? p + ((q - p) * 6 * tr) : (1 / 6 < tr && tr < 1 / 2) ? q : (1 / 2 < tr && tr < 2 / 3) ? (p + ((q - p) * (2 / 3 - tr) * 6)) : p));
g = Math.round(255 * (tg < 1 / 6 ? p + ((q - p) * 6 * tg) : (1 / 6 < tg && tg < 1 / 2) ? q : (1 / 2 < tg && tg < 2 / 3) ? (p + ((q - p) * (2 / 3 - tg) * 6)) : p));
b = Math.round(255 * (tb < 1 / 6 ? p + ((q - p) * 6 * tb) : (1 / 6 < tb && tb < 1 / 2) ? q : (1 / 2 < tb && tb < 2 / 3) ? (p + ((q - p) * (2 / 3 - tb) * 6)) : p));
if (r > 255) {
r = 255;
}
if (g > 255) {
g = 255;
}
if (b > 255) {
b = 255;
}
return {
r: r,
g: g,
b: b
};
}

View File

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
/*
* (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 scrollUpHover(elem) {
elem.style.backgroundPosition = "0px -19px";
}
function scrollUpOut(elem) {
elem.style.backgroundPosition = "0px 0px";
}
function scrollUpDown(elem) {
elem.style.backgroundPosition = "0px -38px";
}
function scrollDownHover(elem) {
elem.style.backgroundPosition = "0px -19px";
}
function scrollDownOut(elem) {
elem.style.backgroundPosition = "0px -38px";
}
function scrollDownDown(elem) {
elem.style.backgroundPosition = "0px 0px";
}
function scrollLeftHover(elem) {
elem.style.backgroundPosition = "-19px 0px";
}
function scrollLeftOut(elem) {
elem.style.backgroundPosition = "0px 0px";
}
function scrollLeftDown(elem) {
elem.style.backgroundPosition = "-38px 0px";
}
function scrollRightHover(elem) {
elem.style.backgroundPosition = "-19px 0px";
}
function scrollRightOut(elem) {
elem.style.backgroundPosition = "-38px 0px";
}
function scrollRightDown(elem) {
elem.style.backgroundPosition = "0px 0px";
}
function scrollDragHover(elem) {
elem.style.backgroundColor = "#DDDDDD";
}
function scrollDragOut(elem) {
elem.style.backgroundColor = "#D3D3D3";
}
function scrollDragDown(elem) {
elem.style.backgroundColor = "#CCCCCC";
}

File diff suppressed because one or more lines are too long

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,68 @@
/*
* (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 translations_map = {};
var styles_index_map = {};
styles_index_map["Normal"] = 0;
styles_index_map["No list"] = 1;
styles_index_map["Heading 1"] = 2;
styles_index_map["Heading 2"] = 3;
styles_index_map["Heading 3"] = 4;
styles_index_map["Heading 4"] = 5;
styles_index_map["Heading 5"] = 6;
styles_index_map["Heading 6"] = 7;
styles_index_map["Heading 7"] = 8;
styles_index_map["Heading 8"] = 9;
styles_index_map["Heading 9"] = 10;
styles_index_map["Paragraph List"] = 11;
styles_index_map["Normal Table"] = 12;
styles_index_map["No Spacing"] = 13;
translations_map["en"] = {};
translations_map["en"].DefaultStyles = ["Normal", "No List", "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5", "Heading 6", "Heading 7", "Heading 8", "Heading 9", "Paragraph List", "Normal Table", "No Spacing"];
translations_map["en"].StylesText = "AaBbCcDdEeFf";
translations_map["ru"] = {};
translations_map["ru"].DefaultStyles = ["Обычный", "Нет списка", "Заголовок 1", "Заголовок 2", "Заголовок 3", "Заголовок 4", "Заголовок 5", "Заголовок 6", "Заголовок 7", "Заголовок 8", "Заголовок 9", "Абзац списка", "Обычная таблица", "Без интервала"];
translations_map["ru"].StylesText = "АаБбВвГгДдЕе";
translations_map["de"] = {};
translations_map["de"].DefaultStyles = ["Standard", "Keine Liste", "Überschrift 1", "Überschrift 2", "Überschrift 3", "Überschrift 4", "Überschrift 5", "Überschrift 6", "Überschrift 7", "Überschrift 8", "Überschrift 9", "Listenabsatz", "Normale Tabelle", "Kein Leerraum"];
translations_map["de"].StylesText = "AaBbCcDdEeFf";
translations_map["fr"] = {};
translations_map["fr"].DefaultStyles = ["Normal", "Sans liste", "Titre 1", "Titre 2", "Titre 3", "Titre 4", "Titre 5", "Titre 6", "Titre 7", "Titre 8", "Titre 9", "Paragraphe de liste", "Tableau normal", "Sans interligne"];
translations_map["fr"].StylesText = "AaBbCcDdEeFf";
translations_map["it"] = {};
translations_map["it"].DefaultStyles = ["Normale", "Nessun elenco", "Titolo 1", "Titolo 2", "Titolo 3", "Titolo 4", "Titolo 5", "Titolo 6", "Titolo 7", "Titolo 8", "Titolo 9", "Paragrafo elenco", "Tabella normale", "Nessuna spaziatura"];
translations_map["it"].StylesText = "AaBbCcDdEeFf";
translations_map["es"] = {};
translations_map["es"].DefaultStyles = ["Normal", "No lista", "Título 1", "Título 2", "Título 3", "Título 4", "Título 5", "Título 6", "Título 7", "Título 8", "Título 9", "Lista de párrafos", "Tabla", "Sin espaciado"];
translations_map["es"].StylesText = "AaBbCcDdEeFf";
translations_map["lv"] = {};
translations_map["lv"].DefaultStyles = ["Normāls", "Nav saraksts", "Virsraksts 1", "Virsraksts 2", "Virsraksts 3", "Virsraksts 4", "Virsraksts 5", "Virsraksts 6", "Virsraksts 7", "Virsraksts 8", "Virsraksts 9", "Panta saraksts", "Normāla tabula", "Bez atstarpes"];
translations_map["lv"].StylesText = "AaBbCcDdEeFf";