Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/fix/pre8.3.1' into hotfi…
Browse files Browse the repository at this point in the history
…x/v8.3.1
  • Loading branch information
KirillovIlya committed Feb 8, 2025
2 parents e0351b7 + e203cd6 commit f476f8a
Show file tree
Hide file tree
Showing 31 changed files with 926 additions and 223 deletions.
15 changes: 15 additions & 0 deletions cell/model/FormulaObjects/lookupandreferenceFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,11 @@ function (window, undefined) {
return arg0;
}

let argError;
if (argError = this._checkErrorArg([arg0, arg1, arg2, arg3])) {
return argError;
}

arg1 = arg1.tocNumber();
arg2 = arg2.tocNumber();
arg3 = arg3.tocNumber();
Expand Down Expand Up @@ -3449,6 +3454,11 @@ function (window, undefined) {
let arg0 = arg[0], arg1 = arg[1], arg2, arg3;
let isXMatch = arg[4];

let argError = cBaseFunction.prototype._checkErrorArg.call(this, arg);
if (argError) {
return argError;
}

if(isXMatch) {
if (cElementType.empty === arg1.type) {
return new cError(cErrorType.wrong_value_type);
Expand All @@ -3474,6 +3484,11 @@ function (window, undefined) {
}
} else if (cElementType.array === arg0.type) {
arg0 = arg0.getElementRowCol(0,0);
} else if (cElementType.cell === arg0.type || cElementType.cell3D === arg0.type) {
let _valueArg0 = arg0.getValue();
if (cElementType.error === _valueArg0.type) {
return _valueArg0;
}
} else if (cElementType.error === arg0.type) {
return arg0;
}
Expand Down
2 changes: 1 addition & 1 deletion cell/model/FormulaObjects/parserFormula.js
Original file line number Diff line number Diff line change
Expand Up @@ -9960,7 +9960,7 @@ function parserFormula( formula, parent, _ws ) {

parserFormula.prototype.getFormulaHyperlink = function () {
for (var i = 0; i < this.outStack.length; i++) {
if (this.outStack[i] && this.outStack[i].name === "HYPERLINK") {
if (this.outStack[i] && (this.outStack[i].name === "HYPERLINK" || this.outStack[i].name === "IMPORTRANGE")) {
return true;
}
}
Expand Down
24 changes: 24 additions & 0 deletions cell/model/FormulaObjects/textanddataFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,27 @@ function (window, undefined) {
AscCommonExcel.importRangeLinksState.importRangeLinks[linkName].push(is3DRef);
}

let checkHyperlink = function (string) {
if (!string) {
return false;
}

// protocol check
let protocols = ['http://', 'https://', 'ftp://'];
let hasValidProtocol = false;

for (let i = 0; i < protocols.length; i++) {
if (string.indexOf(protocols[i]) === 0) {
hasValidProtocol = true;
break;
}
}

// domain check
let hasDomain = string.indexOf('.') !== -1 && string.charAt(0) !== '.';
return hasValidProtocol && hasDomain;
}

let api = window["Asc"]["editor"];
let wb = api && api.wbModel;
let eR = wb && wb.getExternalLinkByName(arg0.toString());
Expand Down Expand Up @@ -1273,6 +1294,9 @@ function (window, undefined) {
let externalCell = row.getCell(j);
if (externalCell) {
let cellValue = externalCell.getFormulaValue();
if (cellValue && cellValue.value && checkHyperlink(cellValue.value)) {
cellValue.hyperlink = cellValue.value;
}
ret.addElement(cellValue);
}
}
Expand Down
5 changes: 4 additions & 1 deletion cell/model/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,8 +1593,11 @@ CHistory.prototype.GetSerializeArray = function()
};
CHistory.prototype.Is_LastPointEmpty = function()
{
if (!this.Points[this.Index] || this.Points[this.Index].Items.length <= 0)
if (!this.Points[this.Index] || this.Points[this.Index].Items.length <= 0 || (this.Points[this.Index].Items.length === 1
&& this.Points[this.Index].Items[0].Type === AscCH.historyitem_Unknown))
{
return true;
}

return false;
};
Expand Down
24 changes: 22 additions & 2 deletions cell/model/Workbook.js
Original file line number Diff line number Diff line change
Expand Up @@ -15421,6 +15421,26 @@
if (oListenerCell instanceof Asc.CT_WorksheetSource) {
continue;
}
if (oListeners[i].getFunctionName()) {
const aOutStack = oListeners[i].outStack;
const aExcludeFormulas = AscCommonExcel.aExcludeRecursiveFormulas;
const oCycleCells = new Map();

_foreachRefElements(function (oElem, nIndex) {
if (oElem.containCell2(oListenerCell)) {
const nIndexWithFunction = nIndex + 2;
const oElemWithFunction = aOutStack[nIndexWithFunction];
if (oElemWithFunction.type === cElementType.func && aExcludeFormulas.includes(oElemWithFunction.name)) {
oCycleCells.set(true, nIndex);
return;
}
oCycleCells.set(false, nIndex);
}
}, aOutStack);
if (oCycleCells.size > 0 && oCycleCells.get(false) === undefined) {
continue;
}
}
let oRes = fAction(oListenerCell, oCell, nListenerCellIndex);
if (oRes != null) {
return;
Expand Down Expand Up @@ -15624,7 +15644,7 @@
} else {
oRange = oRefElement.getRange();
}
let oRes = fAction(oRange, nLastIndex, i);
let oRes = fAction(oRange, i, nLastIndex);
if (oRes != null) {
return;
}
Expand Down Expand Up @@ -15761,7 +15781,7 @@
}

const aRefElements = _getRefElements(oFormulaParsed);
_foreachRefElements(function (oRange, nLastRefElemIndex, nIndex) {
_foreachRefElements(function (oRange, nIndex, nLastRefElemIndex) {
oRange._foreachNoEmpty(function(oCell) {
let nCellIndex = getCellIndex(oCell.nRow, oCell.nCol);
let sCellWsName = oCell.ws.getName().toLowerCase();
Expand Down
3 changes: 3 additions & 0 deletions cell/view/WorksheetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,9 @@

let c2 = Math.min(selectionRange.c2, this.nColsCount - 1);
let r2 = Math.min(selectionRange.r2, this.nRowsCount - 1);
if (selectionRange.c1 === c2 && selectionRange.r1 === r2 && selectionRange.isOneCell()) {
return null;
}
for (let c = selectionRange.c1; c <= c2; ++c) {
for (let r = selectionRange.r1; r <= r2; ++r) {
let cellCache = this._getCellTextCache(c, r, true);
Expand Down
10 changes: 10 additions & 0 deletions common/Drawings/CommonController.js
Original file line number Diff line number Diff line change
Expand Up @@ -7292,6 +7292,16 @@
}
}
}

if (Asc.editor.isPdfEditor()) {
let oDoc = Asc.editor.getPDFDoc();
let oPageInfo = oDoc.GetPageInfo(drawing.GetPage());

if (oPageInfo.IsDeleteLock()) {
locked = true;
}
}

var lockAspect = drawing.getNoChangeAspect();
var oMainGroup = drawing.getMainGroup();
let sOwnName = drawing.getObjectName();
Expand Down
16 changes: 13 additions & 3 deletions common/Drawings/GraphicsBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@
};
CGraphicsBase.prototype.p_width = function(w)
{
this.textAlpha = undefined;
};
CGraphicsBase.prototype.p_dash = function(params)
{
Expand Down Expand Up @@ -589,9 +588,9 @@
this.drawHorLine(align, y, x + leftMW, r + rightMW, penW);
};

CGraphicsBase.prototype.DrawPolygon = function(oPath, lineWidth, shift)
CGraphicsBase.prototype.drawPolygon = function(oPath, lineWidth, shift)
{
this.p_width(lineWidth);
this.p_width(lineWidth * 1000);
this._s();

let Points = oPath.Points;
Expand Down Expand Up @@ -644,6 +643,17 @@
this.ds();
this._e();
};

CGraphicsBase.prototype.drawPolygonByRects = function(rects, lineWidth, shift)
{
let polygon = new AscCommon.CPolygon();
polygon.fill(rects);
let paths = polygon.GetPaths(shift ? shift : 0);
for (let i = 0, count = paths.length; i < count; ++i)
{
this.drawPolygon(paths[i], lineWidth, 0);
}
};

/**
* made with the use of:
Expand Down
19 changes: 12 additions & 7 deletions common/HistoryCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1809,6 +1809,7 @@
window['AscDFH'].historyitem_type_Pdf_Drawing = 2229 << 16;
window['AscDFH'].historyitem_type_Pdf_Page = 2230 << 16;
window['AscDFH'].historyitem_type_Pdf_Annot_Stamp = 2231 << 16;
window['AscDFH'].historyitem_type_Pdf_PropLocker = 2232 << 16;

window['AscDFH'].historyitem_type_CustomProperties = 2301 << 16;

Expand Down Expand Up @@ -2328,6 +2329,8 @@
window['AscDFH'].historyitem_SdtPr_ComplexFormPr = window['AscDFH'].historyitem_type_SdtPr | 24;
window['AscDFH'].historyitem_SdtPr_OForm = window['AscDFH'].historyitem_type_SdtPr | 25;
window['AscDFH'].historyitem_SdtPr_DataBinding = window['AscDFH'].historyitem_type_SdtPr | 26;
window['AscDFH'].historyitem_SdtPr_ShdColor = window['AscDFH'].historyitem_type_SdtPr | 27;
window['AscDFH'].historyitem_SdtPr_BorderColor = window['AscDFH'].historyitem_type_SdtPr | 28;
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе CSdtPr
//------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -4080,13 +4083,15 @@
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе CPDFDoc
//------------------------------------------------------------------------------------------------------------------
window['AscDFH'].historyitem_PDF_Document_AnnotsContent = window['AscDFH'].historyitem_type_PDF_Document | 1;
window['AscDFH'].historyitem_PDF_Document_DrawingsContent = window['AscDFH'].historyitem_type_PDF_Document | 2;
window['AscDFH'].historyitem_PDF_Document_FieldsContent = window['AscDFH'].historyitem_type_PDF_Document | 3;
window['AscDFH'].historyitem_PDF_Document_PagesContent = window['AscDFH'].historyitem_type_PDF_Document | 4;
window['AscDFH'].historyitem_PDF_Document_RotatePage = window['AscDFH'].historyitem_type_PDF_Document | 5;
window['AscDFH'].historyitem_PDF_Document_RecognizePage = window['AscDFH'].historyitem_type_PDF_Document | 6;
window['AscDFH'].historyitem_PDF_Document_SetDocument = window['AscDFH'].historyitem_type_PDF_Document | 7;
window['AscDFH'].historyitem_PDF_Document_AnnotsContent = window['AscDFH'].historyitem_type_PDF_Document | 1;
window['AscDFH'].historyitem_PDF_Document_DrawingsContent = window['AscDFH'].historyitem_type_PDF_Document | 2;
window['AscDFH'].historyitem_PDF_Document_FieldsContent = window['AscDFH'].historyitem_type_PDF_Document | 3;
window['AscDFH'].historyitem_PDF_Document_PagesContent = window['AscDFH'].historyitem_type_PDF_Document | 4;
window['AscDFH'].historyitem_PDF_Document_RotatePage = window['AscDFH'].historyitem_type_PDF_Document | 5;
window['AscDFH'].historyitem_PDF_Document_RecognizePage = window['AscDFH'].historyitem_type_PDF_Document | 6;
window['AscDFH'].historyitem_PDF_Document_SetDocument = window['AscDFH'].historyitem_type_PDF_Document | 7;
window['AscDFH'].historyitem_PDF_Document_PageLocks = window['AscDFH'].historyitem_type_PDF_Document | 8;
window['AscDFH'].historyitem_PDF_PropLocker_ObjectId = window['AscDFH'].historyitem_type_PDF_Document | 9;


AscDFH.historyitem_CustomPropertiesAddProperty = AscDFH.historyitem_type_CustomProperties | 0;
Expand Down
1 change: 1 addition & 0 deletions common/TableId.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@
this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_FreeText] = AscPDF.CAnnotationFreeText;
this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Annot_Stamp] = AscPDF.CAnnotationStamp;
this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_Page] = AscPDF.CPageInfo;
this.m_oFactoryClass[AscDFH.historyitem_type_Pdf_PropLocker] = AscPDF.PropLocker;
}

this.m_oFactoryClass[AscDFH.historyitem_type_DocumentMacros] = AscCommon.CDocumentMacros;
Expand Down
33 changes: 33 additions & 0 deletions common/apiCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3439,6 +3439,33 @@ function (window, undefined) {
this.canEditText = v;
};

/** @constructor */
function asc_CPdfPageProperty() {
this.deleteLock = false;
this.rotateLock = false;
this.editLock = false;
}

asc_CPdfPageProperty.prototype.constructor = asc_CPdfPageProperty;
asc_CPdfPageProperty.prototype.asc_getDeleteLock = function () {
return this.deleteLock;
};
asc_CPdfPageProperty.prototype.asc_putDeleteLock = function (v) {
this.deleteLock = v;
};
asc_CPdfPageProperty.prototype.asc_getRotateLock = function () {
return this.rotateLock;
};
asc_CPdfPageProperty.prototype.asc_putRotateLock = function (v) {
this.rotateLock = v;
};
asc_CPdfPageProperty.prototype.asc_getEditLock = function () {
return this.editLock;
};
asc_CPdfPageProperty.prototype.asc_putEditLock = function (v) {
this.editLock = v;
};

/** @constructor */
function asc_TextArtProperties(obj) {
if (obj) {
Expand Down Expand Up @@ -6716,6 +6743,12 @@ function (window, undefined) {
prot["asc_getCanEditText"] = prot.asc_getCanEditText;
prot["asc_setCanEditText"] = prot.asc_setCanEditText;

window["Asc"]["asc_CPdfPageProperty"] = window["Asc"].asc_CPdfPageProperty = asc_CPdfPageProperty;
prot = asc_CPdfPageProperty.prototype;
prot["asc_getDeleteLock"] = prot.asc_getDeleteLock;
prot["asc_putDeleteLock"] = prot.asc_putDeleteLock;
prot["asc_getEditLock"] = prot.asc_getEditLock;
prot["asc_putEditLock"] = prot.asc_putEditLock;

window["Asc"]["asc_TextArtProperties"] = window["Asc"].asc_TextArtProperties = asc_TextArtProperties;
prot = asc_TextArtProperties.prototype;
Expand Down
10 changes: 7 additions & 3 deletions common/commonDefines.js
Original file line number Diff line number Diff line change
Expand Up @@ -707,9 +707,10 @@ window.AscCommon.g_cIsBeta = "false";
MailMerge : 10,
ContentControl : 11,
Animation : 12,
Text : 13, // viewer
Annot : 14,
UnProtectedRegion : 15
UnProtectedRegion : 13,
Text : 14, // viewer
Annot : 15,
PdfPage : 16
};

var c_oAscLineDrawingRule = {
Expand Down Expand Up @@ -4313,6 +4314,9 @@ window.AscCommon.g_cIsBeta = "false";
"dd.MM.yyyy",
"dddd, d MMMM yyyy 'г.'",
"d MMMM yyyy 'г.'",
"'«'d'»' MMMM yyyy 'года'",
"d MMMM yyyy 'года'",
"d MMMM yyyy",
"dd.MM.yy",
"yyyy-MM-dd",
"d-MMM-yy",
Expand Down
4 changes: 2 additions & 2 deletions common/editorscommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3902,7 +3902,7 @@
const fullPatterns = [];
for (let i = 0; i < opt_namesList[0].length; i += 1) {
for (let j = 0; j < opt_namesList[1].length; j += 1) {
fullPatterns.push('^(' + opt_namesList[0][i] + ')\\s*\\[\\s*(' + opt_namesList[1][j] + ')\\s*\\]');
fullPatterns.push('^(' + XRegExp.escape(opt_namesList[0][i]) + ')\\s*\\[\\s*(' + XRegExp.escape(opt_namesList[1][j]) + ')\\s*\\]');
}
}
const fullRegs = fullPatterns.map(function(pattern) {
Expand All @@ -3917,7 +3917,7 @@
}
}
const shortPatterns = opt_namesList[1].map(function(name) {
return '^(' + name + ')(?:\\W|$)'
return '^(' + XRegExp.escape(name) + ')(?:\\W|$)';
});
const shortRegs = shortPatterns.map(function(pattern) {
return new RegExp(pattern, 'i');
Expand Down
7 changes: 7 additions & 0 deletions common/serviceworker/document_editor_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if (pathnameParts.length > 1 && pathnameParts[pathnameParts.length - 2]) {
const g_cacheNamePrefix = 'document_editor_static_';
const g_cacheName = g_cacheNamePrefix + g_version;
const patternPrefix = new RegExp(g_version + "/(web-apps|sdkjs|sdkjs-plugins|fonts|dictionaries)");
const isDesktopEditor = navigator.userAgent.indexOf("AscDesktopEditor") !== -1;

function putInCache(request, response) {
return caches.open(g_cacheName)
Expand Down Expand Up @@ -100,5 +101,11 @@ self.addEventListener('fetch', (event) => {
if (request.method !== "GET" || !patternPrefix.test(request.url)) {
return;
}

if (isDesktopEditor) {
if (-1 !== request.url.indexOf("/sdkjs/common/AllFonts.js"))
return;
}

event.respondWith(cacheFirst(event));
});
Loading

0 comments on commit f476f8a

Please sign in to comment.