Skip to content

Commit

Permalink
Merge branch hotfix/v7.2.2 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
papacarlo committed Dec 20, 2022
2 parents 8e38eca + 76e9105 commit 2f7a18f
Show file tree
Hide file tree
Showing 41 changed files with 1,195 additions and 193 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 12
node-version: 14
- name: Run unit tests
run: |
npm install -g grunt-cli node-qunit-puppeteer
Expand All @@ -30,6 +30,7 @@ jobs:
node-qunit-puppeteer tests/word/unit-tests/paragraphContentPos.html
node-qunit-puppeteer tests/word/document-calculation/paragraph.html
node-qunit-puppeteer tests/word/document-calculation/table/flowTablePosition.html
node-qunit-puppeteer tests/word/document-calculation/textShaper/textShaper.html
node-qunit-puppeteer tests/word/forms/forms.html
node-qunit-puppeteer tests/word/forms/complexForm.html
node-qunit-puppeteer tests/word/api/api.html
Expand Down
7 changes: 6 additions & 1 deletion cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,12 @@ var editor;

spreadsheet_api.prototype._printDesktop = function (options) {
window.AscDesktopEditor_PrintOptions = options;
window["AscDesktopEditor"]["Print"]();

let desktopOptions = {};
if (options && options.advancedOptions)
desktopOptions["nativeOptions"] = options.advancedOptions.asc_getNativeOptions();

window["AscDesktopEditor"]["Print"](JSON.stringify(desktopOptions));
return true;
};

Expand Down
5 changes: 5 additions & 0 deletions cell/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2807,6 +2807,7 @@
this.ignorePrintArea = null;

this.isOnlyFirstPage = null;
this.nativeOptions = undefined;

// ToDo сюда же start и end page index

Expand All @@ -2818,6 +2819,8 @@
asc_CAdjustPrint.prototype.asc_setPageOptionsMap = function (val) { this.pageOptionsMap = val; };
asc_CAdjustPrint.prototype.asc_getIgnorePrintArea = function () { return this.ignorePrintArea; };
asc_CAdjustPrint.prototype.asc_setIgnorePrintArea = function (val) { this.ignorePrintArea = val; };
asc_CAdjustPrint.prototype.asc_getNativeOptions = function () { return this.nativeOptions; };
asc_CAdjustPrint.prototype.asc_setNativeOptions = function (val) { this.nativeOptions = val; };

/** @constructor */
function asc_CLockInfo () {
Expand Down Expand Up @@ -3632,6 +3635,8 @@
prot["asc_setPageOptionsMap"] = prot.asc_setPageOptionsMap;
prot["asc_getIgnorePrintArea"] = prot.asc_getIgnorePrintArea;
prot["asc_setIgnorePrintArea"] = prot.asc_setIgnorePrintArea;
prot["asc_getNativeOptions"] = prot.asc_getNativeOptions;
prot["asc_setNativeOptions"] = prot.asc_setNativeOptions;

window["AscCommonExcel"].asc_CLockInfo = asc_CLockInfo;

Expand Down
4 changes: 2 additions & 2 deletions common/Charts/ChartsDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13958,7 +13958,7 @@ valAxisChart.prototype = {
return;
}

var stepX = points[1] ? Math.abs(points[1].pos - points[0].pos) : Math.abs(points[1].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
var stepX = points[1] ? Math.abs(points[1].pos - points[0].pos) : Math.abs(points[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
minorStep = stepX / minorLinesCount;
posY = this.valAx.posY;

Expand Down Expand Up @@ -14464,7 +14464,7 @@ axisChart.prototype = {
return;
}

var stepX = points[1] ? Math.abs(points[1].pos - points[0].pos) : Math.abs(points[1].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
var stepX = points[1] ? Math.abs(points[1].pos - points[0].pos) : Math.abs(points[0].pos - this.chartProp.chartGutter._bottom / this.chartProp.pxToMM);
minorStep = stepX / minorLinesCount;
posY = this.axis.posY;

Expand Down
6 changes: 4 additions & 2 deletions common/Drawings/Format/GraphicFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,9 @@ CGraphicFrame.prototype.IsThisElementCurrent = function()
newGraphicObject.graphicObject = Graphic;
return newGraphicObject;
};

CGraphicFrame.prototype.Get_ShapeStyleForPara = function() {
return null;
};
function ConvertToWordTableBorder(oBorder) {
if(!oBorder) {
return undefined;
Expand Down Expand Up @@ -1502,7 +1504,7 @@ CGraphicFrame.prototype.IsThisElementCurrent = function()
AscCommon.g_oIdCounter.m_bLoad = bLoadVal;
AscCommon.g_oIdCounter.m_bRead = bRead;
oRow.Set_Height(Math.max(1, fRowHeight - fMaxTopMargin - fMaxBottomMargin - fMaxTopBorder/2 - fMaxBottomBorder/2), Asc.linerule_AtLeast);
};
}
//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CGraphicFrame = CGraphicFrame;
Expand Down
29 changes: 17 additions & 12 deletions common/Drawings/Format/Shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@ CShape.prototype.convertToWord = function (document) {
};

CShape.prototype.convertToPPTX = function (drawingDocument, worksheet, bIsAddMath) {
var c = new CShape();
let c = new CShape();
c.setWordShape(false);
c.setBDeleted(false);
c.setWorksheet(worksheet);
Expand All @@ -1194,21 +1194,26 @@ CShape.prototype.convertToPPTX = function (drawingDocument, worksheet, bIsAddMat
c.setStyle(this.style.createDuplicate());
}
if (this.textBoxContent) {
var tx_body = new AscFormat.CTextBody();
let tx_body = new AscFormat.CTextBody();
tx_body.setParent(c);
if (this.bodyPr) {
tx_body.setBodyPr(this.bodyPr.createDuplicate());
}
var new_content = new AscFormat.CDrawingDocContent(tx_body, drawingDocument, 0, 0, 0, 0, false, false, true);
new_content.Internal_Content_RemoveAll();
var paragraphs = this.textBoxContent.Content;

var index = 0;
for (var i = 0; i < paragraphs.length; ++i) {
var cur_par = paragraphs[i];
if (cur_par instanceof Paragraph) {
var new_paragraph = ConvertParagraphToPPTX(cur_par, drawingDocument, new_content, bIsAddMath);
new_content.Internal_Content_Add(index++, new_paragraph, false);
let new_content = new AscFormat.CDrawingDocContent(tx_body, drawingDocument, 0, 0, 0, 0, false, false, true);
let aContent = this.textBoxContent.Content;
let aNewParagraphs = [];
for (let nIdx = 0; nIdx < aContent.length; ++nIdx) {
let oCurElement = aContent[nIdx];
if (oCurElement instanceof AscCommonWord.Paragraph) {
let oParagraph = ConvertParagraphToPPTX(oCurElement, drawingDocument, new_content, bIsAddMath);
aNewParagraphs.push(oParagraph);
}
}
if(aNewParagraphs.length > 0) {
new_content.Internal_Content_RemoveAll();
for (let nIdx = 0; nIdx < aNewParagraphs.length; ++nIdx) {
let oParagraph = aNewParagraphs[nIdx];
new_content.Internal_Content_Add(nIdx, oParagraph, false);
}
}
tx_body.setContent(new_content);
Expand Down
56 changes: 32 additions & 24 deletions common/Local/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,29 @@
}
};

AscCommon.baseEditorsApi.prototype["asc_setIsReadOnly"] = function(value, is_from_app)
AscCommon.baseEditorsApi.prototype["local_sendEvent"] = function()
{
return this.sendEvent.apply(this, arguments);
};

AscCommon.baseEditorsApi.prototype["asc_setLocalRestrictions"] = function(value, is_from_app)
{
if (value)
this.localRestrintions = value;
if (value !== Asc.c_oAscLocalRestrictionType.None)
this.asc_addRestriction(Asc.c_oAscRestrictionType.View);
else
this.asc_removeRestriction(Asc.c_oAscRestrictionType.View);

if (is_from_app)
return;

window["AscDesktopEditor"] && window["AscDesktopEditor"]["SetIsReadOnly"] && window["AscDesktopEditor"]["SetIsReadOnly"](value);
};
AscCommon.baseEditorsApi.prototype["asc_isReadOnly"] = function()
{
return this.isRestrictionView();
window["AscDesktopEditor"] && window["AscDesktopEditor"]["SetLocalRestrictions"] && window["AscDesktopEditor"]["SetLocalRestrictions"](value);
};
AscCommon.baseEditorsApi.prototype["local_sendEvent"] = function()
AscCommon.baseEditorsApi.prototype["asc_getLocalRestrictions"] = function()
{
return this.sendEvent.apply(this, arguments);
if (undefined === this.localRestrintions)
return Asc.c_oAscLocalRestrictionType.None;
return this.localRestrintions;
};
})(window);

Expand Down Expand Up @@ -441,7 +445,25 @@ AscCommon.InitDragAndDrop = function(oHtmlElement, callback) {
editor.endInlineDropTarget(e);

var _files = window["AscDesktopEditor"]["GetDropFiles"]();
if (0 == _files.length)
let countInserted = 0;
if (0 !== _files.length)
{
let countInserted = 0;
for (var i = 0; i < _files.length; i++)
{
if (window["AscDesktopEditor"]["IsImageFile"](_files[i]))
{
if (_files[i] === "")
continue;
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](_files[i]);
editor.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url));
++countInserted;
break;
}
}
}

if (0 === countInserted)
{
// test html
var htmlValue = e.dataTransfer.getData("text/html");
Expand All @@ -458,20 +480,6 @@ AscCommon.InitDragAndDrop = function(oHtmlElement, callback) {
return;
}
}
else
{
for (var i = 0; i < _files.length; i++)
{
if (window["AscDesktopEditor"]["IsImageFile"](_files[i]))
{
if (_files[i] == "")
continue;
var _url = window["AscDesktopEditor"]["LocalFileGetImageUrl"](_files[i]);
editor.AddImageUrlAction(AscCommon.g_oDocumentUrls.getImageUrl(_url));
break;
}
}
}
};
}
};
Expand Down
10 changes: 9 additions & 1 deletion common/apiBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,7 @@
}
this.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.Open);
this.sendEvent('asc_onDocumentContentReady');
this.CoAuthoringApi.sendClientLog("debug", "onDocumentContentReady");

if (window.g_asc_plugins)
window.g_asc_plugins.onPluginEvent("onDocumentContentReady");
Expand Down Expand Up @@ -1478,6 +1479,7 @@
t.setViewModeDisconnect(AscCommon.getEnableDownloadByCloseCode(code));
t.disconnectOnSave = {code: code, reason: reason};
} else {
t.CoAuthoringApi.sendClientLog('debug', 'disconnect code:' + code + ';reason:' + reason);
t.CoAuthoringApi.disconnect(code, reason);
}
}
Expand Down Expand Up @@ -2447,7 +2449,13 @@
};
baseEditorsApi.prototype.asc_getUrlType = function(url)
{
return AscCommon.getUrlType(url);
let res = AscCommon.getUrlType(url);
if (window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsLocalFile"]() &&
(res === AscCommon.c_oAscUrlType.Invalid || !(AscCommon.rx_allowedProtocols.test(url) || /^(www.)|@/i.test(url))))
{
res = AscCommon.c_oAscUrlType.Unsafe;
}
return res;
};
baseEditorsApi.prototype.asc_prepareUrl = function(url)
{
Expand Down
13 changes: 13 additions & 0 deletions common/commonDefines.js
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,13 @@ var lcid_haLatn = 0x7c68; // Hausa, Latin
// открывается именно просмотрщик.
};

var c_oAscLocalRestrictionType = {
None : 0x00,
ReadOnly : 0x01,
Locked : 0x02,
Nosafe : 0x04
};

// Режимы отрисовки
var c_oAscFontRenderingModeType = {
noHinting : 1,
Expand Down Expand Up @@ -4232,6 +4239,12 @@ var lcid_haLatn = 0x7c68; // Hausa, Latin
prot['OnlySignatures'] = c_oAscRestrictionType.OnlySignatures;
prot['View'] = c_oAscRestrictionType.View;

prot = window['Asc']['c_oAscLocalRestrictionType'] = window['Asc'].c_oAscLocalRestrictionType = c_oAscLocalRestrictionType;
prot['None'] = c_oAscLocalRestrictionType.None;
prot['ReadOnly'] = c_oAscLocalRestrictionType.ReadOnly;
prot['Locked'] = c_oAscLocalRestrictionType.Locked;
prot['Nosafe'] = c_oAscLocalRestrictionType.Nosafe;


prot = window["AscCommon"]["c_oAscCellAnchorType"] = window["AscCommon"].c_oAscCellAnchorType = c_oAscCellAnchorType;
prot["cellanchorAbsolute"] = prot.cellanchorAbsolute;
Expand Down
9 changes: 9 additions & 0 deletions common/docscoapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@
}
};

CDocsCoApi.prototype.sendClientLog = function(level, msg) {
if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.sendClientLog(level, msg);
}
};
CDocsCoApi.prototype.sendCursor = function(cursor) {
if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.sendCursor(cursor);
Expand Down Expand Up @@ -1028,6 +1033,10 @@
}
};

DocsCoApi.prototype.sendClientLog = function(level, msg) {
this._send({'type': 'clientLog', 'level': level, 'msg': msg});
};

DocsCoApi.prototype.sendCursor = function(cursor) {
if (typeof cursor === 'string') {
this._send({"type": "cursor", "cursor": cursor});
Expand Down
Loading

0 comments on commit 2f7a18f

Please sign in to comment.