Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/fix/pre7.5.1' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyLuzyanin committed Oct 19, 2023
2 parents 961c0dc + 4de5b18 commit 4ebc399
Show file tree
Hide file tree
Showing 28 changed files with 720 additions and 168 deletions.
13 changes: 12 additions & 1 deletion cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -8616,9 +8616,20 @@ var editor;
};

spreadsheet_api.prototype.asc_openExternalReference = function(externalReference) {
let t = this;
let isLocalDesktop = window["AscDesktopEditor"] && window["AscDesktopEditor"]["IsLocalFile"]();
if (isLocalDesktop) {
alert("NEED SUPPORT LOCAL OPEN FILE");
window["AscDesktopEditor"]["openExternalReference"](externalReference.externalReference.Id, function(error) {
let internalError = Asc.c_oAscError.ID.No;
switch (error) {
case 0: internalError = Asc.c_oAscError.ID.ConvertationOpenError; break;
default: break;
}

if (Asc.c_oAscError.ID.No !== internalError) {
t.sendEvent("asc_onError", internalError, c_oAscError.Level.NoCritical);
}
});
return null;
} else {
return externalReference;
Expand Down
8 changes: 5 additions & 3 deletions cell/view/EventsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -1798,22 +1798,24 @@
oOleSize.addPointToLocalHistory();
}

var coord = this._getCoordinates(event);
// Shapes
event.isLocked = this.isMousePressed = false;
if (2 === button) {
if (this.isShapeAction) {
event.ClickCount = this.clickCounter.clickCount;
this.handlers.trigger("graphicObjectMouseUp", event, coord.x, coord.y);
this.handlers.trigger('onContextMenu', event);
}
return true;
}

var coord = this._getCoordinates(event);
if(this.view.Api.isEyedropperStarted()) {
this.view.Api.finishEyedropper();
var t = this;
t.handlers.trigger("updateWorksheet", coord.x, coord.y, false, function(info){t.targetInfo = info;});
return true;
}
// Shapes
event.isLocked = this.isMousePressed = false;

if (this.isShapeAction) {
event.ClickCount = this.clickCounter.clickCount;
Expand Down
2 changes: 1 addition & 1 deletion cell/view/WorkbookView.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
this.findFillColor = new CColor(255, 238, 128, 1);

// Цвет закрепленных областей
this.frozenColor = new CColor(105, 119, 62, 1);
this.frozenColor = new CColor(129, 129, 129, 1);

// Число знаков для математической информации
this.mathMaxDigCount = 9;
Expand Down
40 changes: 33 additions & 7 deletions cell/view/WorksheetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4099,6 +4099,7 @@
const aFragments = portion;
const maxWidth = (width - left - right) / printScale;

let dLIns = 0, dRIns = 0;
const oShape = AscFormat.ExecuteNoHistory(function() {

const oMockLogicDoc = {
Expand Down Expand Up @@ -4136,10 +4137,7 @@
oShape.setWorksheet(t.model);
oShape.createTextBody();
let oBodyPr = oShape.txBody.bodyPr;
oBodyPr.bIns = 0;
oBodyPr.tIns = 0;
oBodyPr.lIns = 0;
oBodyPr.rIns = 0;
oBodyPr.resetInsets();
oBodyPr.anchor = 4;//top
let oContent = oShape.txBody.content;
const oParagraph = oContent.GetAllParagraphs()[0];
Expand Down Expand Up @@ -4182,7 +4180,20 @@
oParagraph.AddToContent(nFragment, oParaRun);
}

oShape.setTransformParams(-1.6, 0, maxWidth + 3.2, 2000, 0, false, false);
let dIns = 1.6;
let res = AscCommon.align_Left;
if (nAlign === AscCommon.align_Left) {
dLIns = 0;
dRIns = 2*dIns;
}
else if (nAlign === AscCommon.align_Right) {
dLIns = -2*dIns;
}
else if(nAlign === AscCommon.align_Center) {
dLIns = -dIns;
dRIns = dIns;
}
oShape.setTransformParams(-dLIns, 0, maxWidth + dLIns + dRIns, 2000, 0, false, false);
oShape.setBDeleted(false);
oShape.recalculate();

Expand Down Expand Up @@ -4216,7 +4227,7 @@

oGraphics.SaveGrState();
oGraphics.transform3(new AscCommon.CMatrix());
oGraphics.AddClipRect(left / printScale, top / printScale, (width - (left + right)) / printScale, (height - (top + bottom)) / printScale);
oGraphics.AddClipRect(left / printScale - dLIns / printScale, top / printScale, (width - (left + right)) / printScale + (dLIns + dRIns) / printScale, (height - (top + bottom)) / printScale);
oShape.draw(oGraphics);

oGraphics.RestoreGrState();
Expand Down Expand Up @@ -5840,6 +5851,21 @@
}
}

let _checkLastMergedRow = function (_mc, _row) {
let _res = _mc && _row === _mc.r2;
if (!_res) {
for (let i = _row + 1; i <= _mc.r2; i++) {
if (t._getRowHeight(i) !== 0) {
_res = false;
break;
} else {
_res = true;
}
}
}
return _res;
};

var arrPrevRow = [], arrCurrRow = [], arrNextRow = [];
var objMCPrevRow = null, objMCRow = null, objMCNextRow = null;
var bCur, bPrev, bNext, bTopCur, bTopPrev, bTopNext, bBotCur, bBotPrev, bBotNext;
Expand Down Expand Up @@ -6057,7 +6083,7 @@
continue;
}

if (!mc || row === mc.r2) {
if (!mc || (_checkLastMergedRow(mc, row))) {
// draw bottom border
drawHorizontalBorder(bCur, bBotCur, x1, y2, x2);
}
Expand Down
10 changes: 8 additions & 2 deletions common/BulletPreviewDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,15 @@
oGraphics.SetIntegerGrid(true);
oGraphics.transform(1, 0, 0, 1, 0, 0);

if (this.m_oApi && this.m_oApi.isDarkMode && oGraphics.darkModeOverride3)
if (this.m_oApi && this.m_oApi.isDarkMode)
{
oGraphics.darkModeOverride3();
if(this.m_oApi.getEditorId() === AscCommon.c_oEditorId.Word)
{
if(oGraphics.darkModeOverride3)
{
oGraphics.darkModeOverride3();
}
}
}

oGraphics.b_color1(this.m_oBackgroundColor.r, this.m_oBackgroundColor.g, this.m_oBackgroundColor.b, 255);
Expand Down
9 changes: 9 additions & 0 deletions common/Drawings/Format/Format.js
Original file line number Diff line number Diff line change
Expand Up @@ -10015,6 +10015,15 @@
this.lIns = 91440 / 36000;
this.rIns = 91440 / 36000;
};
CBodyPr.prototype.setInsets = function(l, t, r, b) {
this.lIns = l;
this.tIns = t;
this.rIns = r;
this.bIns = b;
};
CBodyPr.prototype.resetInsets = function() {
this.setInsets(0, 0, 0, 0);
};
CBodyPr.prototype.setDefault = function () {
this.setDefaultInsets();
this.flatTx = null;
Expand Down
6 changes: 5 additions & 1 deletion common/HistoryCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,8 @@
window['AscDFH'].historyitem_type_Pdf_Form = 2211 << 16;
window['AscDFH'].historyitem_type_Pdf_Comment = 2212 << 16;
window['AscDFH'].historyitem_type_Pdf_Ink = 2213 << 16;
window['AscDFH'].historyitem_type_Pdf_Annot = 2213 << 16;
window['AscDFH'].historyitem_type_Pdf_Annot = 2214 << 16;
window['AscDFH'].historyitem_type_Pdf_Pushbutton = 2215 << 16;



Expand Down Expand Up @@ -4003,6 +4004,9 @@

AscDFH.historyitem_Pdf_Form_Value = AscDFH.historyitem_type_Pdf_Form | 1;


AscDFH.historyitem_Pdf_Pushbutton_Image = AscDFH.historyitem_type_Pdf_Pushbutton | 1;

//------------------------------------------------------------------------------------------------------------------
// Типы изменений в PDF Annots
//------------------------------------------------------------------------------------------------------------------
Expand Down
10 changes: 8 additions & 2 deletions common/apiBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -4258,9 +4258,14 @@
baseEditorsApi.prototype.asc_correctEnterText = function(oldValue, newValue)
{
};
baseEditorsApi.prototype.asc_setContentDarkMode = baseEditorsApi.prototype["asc_setContentDarkMode"] = function(isDarkMode)
baseEditorsApi.prototype.asc_setContentDarkMode = function(isDarkMode)
{
//TODO: empty for bug 64713
if (this.isDarkMode === isDarkMode)
return;

this.isDarkMode = isDarkMode;

this.updateDarkMode();
};
baseEditorsApi.prototype.updateDarkMode = function()
{
Expand Down Expand Up @@ -4818,5 +4823,6 @@
prot["asc_searchEnabled"] = prot.asc_searchEnabled;
prot['asc_findText'] = prot.asc_findText;
prot['asc_endFindText'] = prot.asc_endFindText;
prot['asc_setContentDarkMode'] = prot.asc_setContentDarkMode;

})(window);
19 changes: 10 additions & 9 deletions common/apiBase_plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -1259,8 +1259,9 @@
};
}

const isDesktop = window["AscDesktopEditor"] !== undefined;
if (isDesktop)
// desktop detecting (it's necessary when we work with clouds into desktop)
const isLocal = ( (window["AscDesktopEditor"] !== undefined) && (window.location.protocol.indexOf('file') !== -1) );
if (isLocal)
{
// Отдаём весь конфиг, внутри вычислим путь к deploy
// TODO: отслеживать возможные ошибки при +/- плагинов: из ++кода отправлять статус операции и на основе его отправлять в менеджер плагинов корректный ответ.
Expand Down Expand Up @@ -1302,8 +1303,8 @@
if (this.disableCheckInstalledPlugins)
return;

const isDesktop = window["AscDesktopEditor"] !== undefined;
if (isDesktop) {
const isLocal = ( (window["AscDesktopEditor"] !== undefined) && (window.location.protocol.indexOf('file') !== -1) );
if (isLocal) {
// В случае Desktop не работаем с localStorage и extensions, этот метод может быть вызван из интерфейса
// если по какой-то причине (неактуальный cache) у пользователя есть asc_plugins_installed, asc_plugins_removed, то их нужно игнорировать/удалить
return;
Expand Down Expand Up @@ -1396,14 +1397,14 @@
}
*/

const isDesktop = window["AscDesktopEditor"] !== undefined;
const isLocal = ( (window["AscDesktopEditor"] !== undefined) && (window.location.protocol.indexOf('file') !== -1) );

// В случае Desktop нужно проверить какие плагины нельзя удалять. В UpdateInstallPlugins работаем с двумя типами папок.
// Пока проверка тут, но грамотнее будет сделать и использовать доп.свойство isSystemInstall класса CPlugin
// т.к. не будем лишний раз парсить папки, только при +/- плагинов.
let protectedPlugins = [];

if (isDesktop) {
if (isLocal) {
var _pluginsTmp = JSON.parse(window["AscDesktopEditor"]["GetInstallPlugins"]());

var len = _pluginsTmp[0]["pluginsData"].length;
Expand Down Expand Up @@ -1440,7 +1441,7 @@
});
}

if (isDesktop)
if (isLocal)
return returnArray;

// нужно послать и удаленные. так как удаленный может не быть в сторе. тогда его никак не установить обратно
Expand Down Expand Up @@ -1478,9 +1479,9 @@
Api.prototype["pluginMethod_RemovePlugin"] = function(guid, backup)
{
let removedPlugin = window.g_asc_plugins.unregister(guid);
const isDesktop = window["AscDesktopEditor"] !== undefined;
const isLocal = ( (window["AscDesktopEditor"] !== undefined) && (window.location.protocol.indexOf('file') !== -1) );

if (isDesktop)
if (isLocal)
{
// Вызываем только этот ++код, никаких дополнительных действий типа:
// window.g_asc_plugins.unregister(guid), window["UpdateInstallPlugins"](), this.sendEvent("asc_onPluginsReset"), window.g_asc_plugins.updateInterface()
Expand Down
6 changes: 6 additions & 0 deletions pdf/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,11 @@
CommentData.Read_FromAscCommentData(AscCommentData);
oDoc.EditComment(Id, CommentData);
};
PDFEditorApi.prototype.asc_selectComment = function(Id)
{
this.getPDFDoc().GoToAnnot(Id);
};

PDFEditorApi.prototype.asc_EditSelectAll = function()
{
let oViewer = this.getDocumentRenderer();
Expand Down Expand Up @@ -866,6 +871,7 @@
PDFEditorApi.prototype['asc_hideComments'] = PDFEditorApi.prototype.asc_hideComments;
PDFEditorApi.prototype['asc_removeComment'] = PDFEditorApi.prototype.asc_removeComment;
PDFEditorApi.prototype['asc_changeComment'] = PDFEditorApi.prototype.asc_changeComment;
PDFEditorApi.prototype['asc_selectComment'] = PDFEditorApi.prototype.asc_selectComment;

PDFEditorApi.prototype['asc_setSkin'] = PDFEditorApi.prototype.asc_setSkin;
PDFEditorApi.prototype['asc_getAnchorPosition'] = PDFEditorApi.prototype.asc_getAnchorPosition;
Expand Down
3 changes: 1 addition & 2 deletions pdf/src/annotations/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,7 @@
return this._display;
};
CAnnotationBase.prototype.onMouseUp = function() {
let oPos = AscPDF.GetGlobalCoordsByPageCoords(this._pagePos.x + this._pagePos.w, this._pagePos.y + this._pagePos.h / 2, this.GetPage(), true);
editor.sync_ShowComment([this.GetId()], oPos["X"], oPos["Y"])
this.GetDocument().ShowComment([this.GetId()]);
};
CAnnotationBase.prototype._AddReplyOnOpen = function(oReplyInfo) {
let oReply = new AscPDF.CAnnotationText(oReplyInfo["UniqueName"], this.GetPage(), [], this.GetDocument());
Expand Down
2 changes: 1 addition & 1 deletion pdf/src/annotations/highlights.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,10 @@
let angle2 = Math.atan2(dy2, dx2);
let rotationAngle = angle1;

oGraphicsPDF.SetGlobalAlpha(this.GetOpacity());
AscPDF.startMultiplyMode(oGraphicsPDF.context);

oGraphicsPDF.BeginPath();
oGraphicsPDF.SetGlobalAlpha(this.GetOpacity());
oGraphicsPDF.SetFillStyle(oRGBFill.r, oRGBFill.g, oRGBFill.b);

if (rotationAngle == 0 || rotationAngle == 3/2 * Math.PI) {
Expand Down
7 changes: 0 additions & 7 deletions pdf/src/annotations/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,6 @@

oDrawingObjects.OnMouseDown(e, X, Y, pageObject.index);
};
CAnnotationText.prototype.onMouseUp = function() {
let oViewer = editor.getDocumentRenderer();

let oPos = AscPDF.GetGlobalCoordsByPageCoords(this._pagePos.x + this._pagePos.w / oViewer.zoom, this._pagePos.y + this._pagePos.h / (2 * oViewer.zoom), this.GetPage(), true);
editor.sync_ShowComment([this.GetId()], oPos["X"], oPos["Y"])
};

CAnnotationText.prototype.IsComment = function() {
return true;
};
Expand Down
Loading

0 comments on commit 4ebc399

Please sign in to comment.