Commit 1bff76fc authored by dmitry.shahtanov's avatar dmitry.shahtanov

Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into develop

parents f4d14e1b ffae52cb
This diff is collapsed.
......@@ -3153,7 +3153,7 @@ function Woorksheet(wb, _index, sId){
this.sheetPr = null;
this.aFormulaExt = null;
this.autoFilters = new asc.AutoFilters(this);
this.autoFilters = asc.AutoFilters !== undefined ? new asc.AutoFilters(this) : null;
this.oDrawingOjectsManager = new DrawingObjectsManager(this);
this.contentChanges = new CContentChanges();
......
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
"use strict";
var g_fontManager2 = null;
......@@ -629,6 +629,7 @@ CGraphics.prototype =
if (0 != this.m_oPen.LineWidth)
{
this.Native["PD_p_width"](this.m_oPen.LineWidth);
this.m_oContext.lineWidth = this.m_oPen.LineWidth;
}
else
{
......@@ -639,6 +640,7 @@ CGraphics.prototype =
var _koef = Math.sqrt(((_x2 - _x1)*(_x2 - _x1) + (_y2 - _y1)*(_y2 - _y1)) / 2);
this.Native["PD_p_width"](1 / _koef);
this.m_oContext.lineWidth = 1 / _koef;
}
}
else
......@@ -651,10 +653,12 @@ CGraphics.prototype =
var koef = Math.sqrt((x * x + y * y) / 2);
this.Native["PD_p_width"](this.m_oPen.LineWidth * koef);
this.m_oContext.lineWidth = this.m_oPen.LineWidth * koef;
}
else
{
this.Native["PD_p_width"](1);
this.m_oContext.lineWidth = 1;
}
}
},
......
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
/*
*
* (c) Copyright Ascensio System Limited 2010-2016
*
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
* In accordance with Section 7(a) of the GNU GPL 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 more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
*
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
*
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
*
* Pursuant to Section 7  3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
* relevant author attributions when distributing the software. If the display of the logo in its graphic
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
* in every copy of the program you distribute.
* Pursuant to Section 7  3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
window.IsShapeToImageConverter = false;
function DrawLineEnd(xEnd, yEnd, xPrev, yPrev, type, w, len, drawer, trans)
{
......@@ -963,10 +963,123 @@ CShapeDrawer.prototype =
}
var rgba = this.StrokeUniColor;
this.NativeGraphics["PD_p_width"](this.StrokeWidth);
this.NativeGraphics["PD_p_color"](rgba.R, rgba.G, rgba.B, rgba.A);
this.NativeGraphics["PD_Stroke"]();
if (this.IsRectShape && this.Graphics.AddSmartRect !== undefined)
{
// if (undefined !== this.Shape.extX)
// this.Graphics.AddSmartRect(0, 0, this.Shape.extX, this.Shape.extY, this.StrokeWidth);
// else
// this.Graphics.ds();
}
else
{
// this.Graphics.ds();
}
if (null != this.OldLineJoin && !this.IsArrowsDrawing)
{
this.Graphics.m_oContext.lineJoin = this.OldLineJoin;
}
var arr = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.ArrayPoints : this.Graphics.ArrayPoints;
if (arr != null && arr.length > 1 && this.IsCurrentPathCanArrows === true)
{
this.IsArrowsDrawing = true;
// значит стрелки есть. теперь:
// определяем толщину линии "как есть"
// трансформируем точки в окончательные.
// и отправляем на отрисовку (с матрицей)
var trans = (this.Graphics.IsTrack === true) ? this.Graphics.Graphics.m_oFullTransform : this.Graphics.m_oFullTransform;
var trans1 = global_MatrixTransformer.Invert(trans);
var x1 = trans.TransformPointX(0, 0);
var y1 = trans.TransformPointY(0, 0);
var x2 = trans.TransformPointX(1, 1);
var y2 = trans.TransformPointY(1, 1);
var dKoef = Math.sqrt(((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))/2);
var _pen_w = (this.Graphics.IsTrack === true) ? (this.Graphics.Graphics.m_oContext.lineWidth * dKoef) : (this.Graphics.m_oContext.lineWidth * dKoef);
var _max_delta_eps2 = 0.001;
if (this.Ln.headEnd != null)
{
var _x1 = trans.TransformPointX(arr[0].x, arr[0].y);
var _y1 = trans.TransformPointY(arr[0].x, arr[0].y);
var _x2 = trans.TransformPointX(arr[1].x, arr[1].y);
var _y2 = trans.TransformPointY(arr[1].x, arr[1].y);
var _max_delta_eps = Math.max(this.Ln.headEnd.GetLen(_pen_w), 5);
var _max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
var cur_point = 2;
while (_max_delta < _max_delta_eps && cur_point < arr.length)
{
_x2 = trans.TransformPointX(arr[cur_point].x, arr[cur_point].y);
_y2 = trans.TransformPointY(arr[cur_point].x, arr[cur_point].y);
_max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
cur_point++;
}
if (_max_delta > _max_delta_eps2)
{
if (this.Graphics.IsTrack)
{
this.Graphics.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.headEnd.type, this.Ln.headEnd.GetWidth(_pen_w), this.Ln.headEnd.GetLen(_pen_w), this, trans1);
this.Graphics.Graphics.ArrayPoints = arr;
}
else
{
this.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.headEnd.type, this.Ln.headEnd.GetWidth(_pen_w), this.Ln.headEnd.GetLen(_pen_w), this, trans1);
this.Graphics.ArrayPoints = arr;
}
}
}
if (this.Ln.tailEnd != null)
{
var _1 = arr.length-1;
var _2 = arr.length-2;
var _x1 = trans.TransformPointX(arr[_1].x, arr[_1].y);
var _y1 = trans.TransformPointY(arr[_1].x, arr[_1].y);
var _x2 = trans.TransformPointX(arr[_2].x, arr[_2].y);
var _y2 = trans.TransformPointY(arr[_2].x, arr[_2].y);
var _max_delta_eps = Math.max(this.Ln.tailEnd.GetLen(_pen_w), 5);
var _max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
var cur_point = _2 - 1;
while (_max_delta < _max_delta_eps && cur_point >= 0)
{
_x2 = trans.TransformPointX(arr[cur_point].x, arr[cur_point].y);
_y2 = trans.TransformPointY(arr[cur_point].x, arr[cur_point].y);
_max_delta = Math.max(Math.abs(_x1 - _x2), Math.abs(_y1 - _y2));
cur_point--;
}
if (_max_delta > _max_delta_eps2)
{
if (this.Graphics.IsTrack)
{
this.Graphics.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.tailEnd.type, this.Ln.tailEnd.GetWidth(_pen_w), this.Ln.tailEnd.GetLen(_pen_w), this, trans1);
this.Graphics.Graphics.ArrayPoints = arr;
}
else
{
this.Graphics.ArrayPoints = null;
DrawLineEnd(_x1, _y1, _x2, _y2, this.Ln.tailEnd.type, this.Ln.tailEnd.GetWidth(_pen_w), this.Ln.tailEnd.GetLen(_pen_w), this, trans1);
this.Graphics.ArrayPoints = arr;
}
}
}
this.IsArrowsDrawing = false;
}
},
drawFillStroke : function(bIsFill, fill_mode, bIsStroke)
......
......@@ -4028,10 +4028,10 @@ function OfflineEditor () {
var styleThumbnailWidth = Math.floor(92.0 * pxToMM);
var styleThumbnailHeight = Math.floor(48.0 * pxToMM);
asc.AutoFilters.prototype = Object.create (asc.AutoFilters.prototype);
asc.AutoFilters.prototype.constructor = asc.AutoFilters;
asc.WorkbookView.prototype = Object.create (asc.WorkbookView.prototype);
asc.WorkbookView.prototype.constructor = asc.WorkbookView;
asc.AutoFilters.prototype.getTablePictures = function(wb, fmgrGraphics, oFont) {
asc.WorkbookView.prototype.af_getTablePictures = function(wb, fmgrGraphics, oFont) {
window['native'].SetStylesType(1);
......@@ -4054,14 +4054,14 @@ function OfflineEditor () {
if(customStyles[i].table)
{
window['native'].BeginDrawDocumentStyle(customStyles[i].name, n);
this._drawSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont);
this.af_getSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont);
// options =
// {
// name: i,
// displayName: customStyles[i].displayName,
// type: 'custom',
// image: this._drawSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont)
// image: this.af_getSmallIconTable(canvas, customStyles[i], fmgrGraphics, oFont)
// };
// result[n] = new formatTablePictures(options);
......@@ -4079,14 +4079,14 @@ function OfflineEditor () {
if(defaultStyles[i].table)
{
window['native'].BeginDrawDefaultStyle(defaultStyles[i].name, n);
this._drawSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont);
this.af_getSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont);
// options =
// {
// name: i,
// displayName: defaultStyles[i].displayName,
// type: 'default',
// image: this._drawSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont)
// image: this.af_getSmallIconTable(canvas, defaultStyles[i], fmgrGraphics, oFont)
// };
//result[n] = new formatTablePictures(options);
n++;
......@@ -4097,7 +4097,7 @@ function OfflineEditor () {
}
return result;
};
asc.AutoFilters.prototype._drawSmallIconTable = function(canvas, style, fmgrGraphics, oFont) {
asc.WorkbookView.prototype.af_getSmallIconTable = function(canvas, style, fmgrGraphics, oFont) {
var ctx = new Asc.DrawingContext({canvas: canvas, units: 0/*pt*/, fmgrGraphics: fmgrGraphics, font: oFont});
var styleOptions = style;
......@@ -4602,12 +4602,20 @@ function offline_mouse_down(x, y, pin, isViewerMode, isFormulaEditMode, isRangeR
ws.isChartAreaEditMode = false;
}
window.AscAlwaysSaveAspectOnResizeTrack = true;
var ischart = false;
var controller = ws.objectRender.controller;
var selected_objects = controller.selection.groupSelection ? controller.selection.groupSelection.selectedObjects : controller.selectedObjects;
if (selected_objects.length === 1 && selected_objects[0].getObjectType() === historyitem_type_ChartSpace) {
ischart = true;
}
else if (selected_objects.length === 1 && selected_objects[0].getObjectType() === historyitem_type_Shape) {
var shapeObj = selected_objects[0];
if (shapeObj.spPr && shapeObj.spPr.geometry && shapeObj.spPr.geometry.preset === "line") {
window.AscAlwaysSaveAspectOnResizeTrack = false;
}
}
return {id:graphicsInfo.id, ischart: ischart};
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment