diff --git a/.gitignore b/.gitignore
index 087fc940fe..91eb3abfe4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,4 @@ package-lock.json
*/node_modules
*/package-lock.json
connector
+tests/package*
diff --git a/cell/api.js b/cell/api.js
index 3daa0d6081..5491fe8eb9 100644
--- a/cell/api.js
+++ b/cell/api.js
@@ -3242,7 +3242,7 @@ var editor;
}
}
- if (this.isMobileVersion) {
+ if (this.isUseOldMobileVersion()) {
this.wb.defaults.worksheetView.halfSelection = true;
this.wb.defaults.worksheetView.activeCellBorderColor = new CColor(79, 158, 79);
var _container = document.getElementById(this.HtmlElementName);
@@ -3258,11 +3258,14 @@ var editor;
if ((typeof AscCommonExcel.CMobileTouchManager) !== "undefined")
{
- this.wb.MobileTouchManager = new AscCommonExcel.CMobileTouchManager({eventsElement: "cell_mobile_element", desktopMode : !this.isMobileVersion});
+ this.wb.MobileTouchManager = new AscCommonExcel.CMobileTouchManager({eventsElement: "cell_mobile_element", desktopMode : !this.isUseOldMobileVersion()});
this.wb.MobileTouchManager.Init(this);
- if (this.isMobileVersion)
+ if (this.isUseOldMobileVersion())
this.wb.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);
+
+ if (this.controller)
+ this.wb.MobileTouchManager.addClickElement([this.controller.element]);
}
this.asc_CheckGuiControlColors();
diff --git a/cell/model/FormulaObjects/parserFormula.js b/cell/model/FormulaObjects/parserFormula.js
index e91f42f757..e169cd94c4 100644
--- a/cell/model/FormulaObjects/parserFormula.js
+++ b/cell/model/FormulaObjects/parserFormula.js
@@ -9987,8 +9987,12 @@ function parserFormula( formula, parent, _ws ) {
*/
function CalcRecursion() {
this.nLevel = 0;
- this.nIterStep = 1;
this.bIsForceBacktracking = false;
+ this.bIsProcessRecursion = false;
+ this.aElems = [];
+ this.aElemsPart = [];
+
+ this.nIterStep = 1;
this.oStartCellIndex = null;
this.nRecursionCounter = 0;
this.oGroupChangedCells = null;
@@ -10022,6 +10026,10 @@ function parserFormula( formula, parent, _ws ) {
* @param {boolean} bIsForceBacktracking
*/
CalcRecursion.prototype.setIsForceBacktracking = function (bIsForceBacktracking) {
+ if (!this.getIsForceBacktracking()) {
+ this.aElemsPart = [];
+ this.aElems.push(this.aElemsPart);
+ }
this.bIsForceBacktracking = bIsForceBacktracking;
};
/**
@@ -10033,6 +10041,22 @@ function parserFormula( formula, parent, _ws ) {
CalcRecursion.prototype.getIsForceBacktracking = function () {
return this.bIsForceBacktracking;
};
+ /**
+ * Method sets a flag who recognizes work with aElems in _checkDirty method is already in process.
+ * @memberof CalcRecursion
+ * @param {boolean} bIsProcessRecursion
+ */
+ CalcRecursion.prototype.setIsProcessRecursion = function (bIsProcessRecursion) {
+ this.bIsProcessRecursion = bIsProcessRecursion;
+ };
+ /**
+ * Method returns a flag who recognizes work with aElems in _checkDirty method is already in process.
+ * @memberof CalcRecursion
+ * @returns {boolean}
+ */
+ CalcRecursion.prototype.getIsProcessRecursion = function () {
+ return this.bIsProcessRecursion;
+ }
/**
* Method increases recursion level. Uses for tracking a level of recursion in _checkDirty method.
* @memberof CalcRecursion
@@ -10074,6 +10098,32 @@ function parserFormula( formula, parent, _ws ) {
return res;
};
+ /**
+ * Method inserts cells which need to be processed in _checkDirty method again.
+ * Uses for formula chains that reached max recursion level.
+ * @memberof CalcRecursion
+ * @param {{ws:Worksheet, nRow:number, nCol:number}} oCellCoordinate
+ */
+ CalcRecursion.prototype.insert = function (oCellCoordinate) {
+ this.aElemsPart.push(oCellCoordinate);
+ };
+ /**
+ * Method executes callback for each cell from aElems in reverse order.
+ * aElems stores cell coordinates which need to be processed in _checkDirty method again.
+ * @memberof CalcRecursion
+ * @param {Function} fCallback
+ */
+ CalcRecursion.prototype.foreachInReverse = function (fCallback) {
+ for (let i = this.aElems.length - 1; i >= 0; i--) {
+ let aElemsPart = this.aElems[i];
+ for (let j = 0, length = aElemsPart.length; j < length; j++) {
+ fCallback(aElemsPart[j]);
+ if (this.getIsForceBacktracking()) {
+ return;
+ }
+ }
+ }
+ };
/**
* Method increases iteration step.
* @memberof CalcRecursion
diff --git a/cell/model/Workbook.js b/cell/model/Workbook.js
index 4dd32bb65f..229eb048ff 100644
--- a/cell/model/Workbook.js
+++ b/cell/model/Workbook.js
@@ -2910,7 +2910,7 @@
AscFormat.ExecuteNoHistory(function () {
this.CustomProperties = new AscCommon.CCustomProperties();
- }, this, []);
+ }, this, [], true);
this.theme = null;
this.clrSchemeMap = null;
@@ -15178,7 +15178,7 @@
if (oSheetListeners.cellMap.hasOwnProperty(nCellIndex)) {
return oSheetListeners.cellMap[nCellIndex];
- } else {
+ } else if (aOutStack && aOutStack.length) {
for (let nIndex in oSheetListeners.areaMap) {
if (oSheetListeners.areaMap[nIndex].bbox.contains(this.nCol, this.nRow)
&& !_isExcludeFormula(aOutStack, oSheetListeners.areaMap[nIndex])) {
@@ -15607,8 +15607,8 @@
const t = this;
// Checks cell contains formula or formula is not calculated yet
if (this.getIsDirty()) {
- g_cCalcRecursion.incLevel();
if (g_cCalcRecursion.checkLevel()) {
+ g_cCalcRecursion.incLevel();
const isCalc = this.getIsCalc();
this.setIsCalc(true);
const calculatedArrayFormulas = [];
@@ -15639,8 +15639,27 @@
});
g_cCalcRecursion.decLevel();
- this.setIsCalc(false);
- this.setIsDirty(false);
+ if (g_cCalcRecursion.getIsForceBacktracking()) {
+ g_cCalcRecursion.insert({ws: this.ws, nRow: this.nRow, nCol: this.nCol});
+ if (g_cCalcRecursion.getLevel() === 0 && !g_cCalcRecursion.getIsProcessRecursion()) {
+ g_cCalcRecursion.setIsProcessRecursion(true);
+ do {
+ g_cCalcRecursion.setIsForceBacktracking(false);
+ g_cCalcRecursion.foreachInReverse(function(oElem) {
+ oElem.ws._getCellNoEmpty(oElem.nRow, oElem.nCol, function(oCell) {
+ if(oCell && oCell.getIsDirty()) {
+ oCell.setIsCalc(false);
+ oCell._checkDirty();
+ }
+ });
+ });
+ } while (g_cCalcRecursion.getIsForceBacktracking());
+ g_cCalcRecursion.setIsProcessRecursion(false);
+ }
+ } else {
+ this.setIsCalc(false);
+ this.setIsDirty(false);
+ }
}
}
};
diff --git a/cell/view/EventsController.js b/cell/view/EventsController.js
index e0b7b77922..3282775867 100644
--- a/cell/view/EventsController.js
+++ b/cell/view/EventsController.js
@@ -154,7 +154,7 @@
return;
}
- if (this.view.Api.isMobileVersion) {
+ if (this.view.Api.isUseOldMobileVersion()) {
/*раньше события на ресайз вызывался из меню через контроллер. теперь контроллер в меню не доступен, для ресайза подписываемся на глобальный ресайз от window.*/
window.addEventListener("resize", function () {
self._onWindowResize.apply(self, arguments);
@@ -1642,6 +1642,8 @@
touchManager.stopTouchingInProcess();
return res;
}
+ if (touchManager)
+ touchManager.checkMouseFocus(event);
var t = this;
asc["editor"].checkInterfaceElementBlur();
@@ -2177,6 +2179,11 @@
}
}
+ if (event.shiftKey) {
+ deltaX = deltaY;
+ deltaY = 0;
+ }
+
if (this.smoothWheelCorrector && !wb.smoothScroll) {
deltaX = this.smoothWheelCorrector.get_DeltaX(deltaX);
deltaY = this.smoothWheelCorrector.get_DeltaY(deltaY);
diff --git a/cell/view/WorkbookView.js b/cell/view/WorkbookView.js
index 25b12a930d..5b2f4bbba9 100644
--- a/cell/view/WorkbookView.js
+++ b/cell/view/WorkbookView.js
@@ -354,10 +354,10 @@
if (null != this.element) {
if (!this.Api.VersionHistory && !this.Api.isEditOleMode) {
this.element.innerHTML = '
\
-
\
-
\
-
\
-
\
+
\
+
\
+
\
+
\
\
';
diff --git a/cell/view/WorksheetView.js b/cell/view/WorksheetView.js
index 9197f02d38..b5c3c91945 100644
--- a/cell/view/WorksheetView.js
+++ b/cell/view/WorksheetView.js
@@ -1556,6 +1556,20 @@
this.updateResize = false;
this.objectRender.resizeCanvas();
+ if (this.getRightToLeft()) {
+ AscFormat.ExecuteNoHistory(function () {
+ let drawings = this.objectRender.controller.getDrawingObjects();
+ for (var i = 0; i < drawings.length; ++i) {
+ if (!drawings[i].group) {
+ AscFormat.CheckSpPrXfrm3(drawings[i], true);
+ } else {
+ AscFormat.CheckSpPrXfrm(drawings[i], true);
+ }
+ }
+ this.objectRender.controller.recalculate(true);
+ }, this, []);
+ }
+
if (editor) {
editor.move();
}
diff --git a/cell/view/mobileTouch.js b/cell/view/mobileTouch.js
index 87bc4b6585..62fc6340e4 100644
--- a/cell/view/mobileTouch.js
+++ b/cell/view/mobileTouch.js
@@ -941,8 +941,8 @@ function (window, undefined)
this.Api.sendEvent("asc_onTapEvent", e);
var typeMenu = this.delegate.GetContextMenuType();
- if (typeMenu == AscCommon.MobileTouchContextMenuType.Target ||
- (typeMenu == AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
+ if (typeMenu === AscCommon.MobileTouchContextMenuType.Target ||
+ (typeMenu === AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
isPreventDefault = false;
}
else
@@ -973,6 +973,12 @@ function (window, undefined)
// TODO:
this.delegate.Drawing_OnMouseUp(e.changedTouches ? e.changedTouches[0] : e);
this.Mode = AscCommon.MobileTouchMode.None;
+
+ var typeMenu = this.delegate.GetContextMenuType();
+ if (typeMenu === AscCommon.MobileTouchContextMenuType.Target ||
+ (typeMenu === AscCommon.MobileTouchContextMenuType.Select && this.delegate.IsInObject()))
+ isPreventDefault = false;
+
break;
}
case AscCommon.MobileTouchMode.Select:
@@ -1008,7 +1014,7 @@ function (window, undefined)
this.delegate.Api.controller._onMouseMove(_e);
}
- if (this.CellEditorType == Asc.c_oAscCellEditorState.editFormula)
+ if (this.CellEditorType === Asc.c_oAscCellEditorState.editFormula)
isPreventDefault = false;
if (this.Api.isViewMode || isPreventDefault)
@@ -1023,6 +1029,9 @@ function (window, undefined)
if (true !== this.iScroll.isAnimating && (this.CellEditorType != Asc.c_oAscCellEditorState.editFormula))
this.CheckContextMenuTouchEnd(isCheckContextMenuMode, isCheckContextMenuSelect, isCheckContextMenuCursor);
+ if (!isPreventDefault && this.Api.isMobileVersion && !this.Api.isUseOldMobileVersion())
+ this.showKeyboard(true);
+
return false;
};
@@ -1030,6 +1039,7 @@ function (window, undefined)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
+ this.removeHandlersOnClick();
return this.onTouchStart(e);
};
CMobileTouchManager.prototype.mainOnTouchMove = function(e)
diff --git a/common/Charts/ChartsDrawer.js b/common/Charts/ChartsDrawer.js
index ca8ed40b78..a84f82e8ed 100644
--- a/common/Charts/ChartsDrawer.js
+++ b/common/Charts/ChartsDrawer.js
@@ -8678,6 +8678,7 @@ drawLineChart.prototype = {
_calculateLines: function () {
var xPoints = this.catAx.xPoints;
var yPoints = this.valAx.yPoints;
+ let isLog;
if(!xPoints || !yPoints) {
return;
@@ -8688,6 +8689,7 @@ drawLineChart.prototype = {
seria = this.chart.series[i];
numCache = this.cChartDrawer.getNumCache(seria.val);
+ isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;
if (!numCache) {
continue;
@@ -8721,7 +8723,7 @@ drawLineChart.prototype = {
compiledMarkerSize = idxPoint && idxPoint.compiledMarker && idxPoint.compiledMarker.size ? idxPoint.compiledMarker.size : null;
compiledMarkerSymbol = idxPoint && idxPoint.compiledMarker && AscFormat.isRealNumber(idxPoint.compiledMarker.symbol) ? idxPoint.compiledMarker.symbol : null;
- if (val != null) {
+ if (val != null && ((isLog && val !== 0) || !isLog)) {
this.paths.points[i][n] = this.cChartDrawer.calculatePoint(x, y, compiledMarkerSize, compiledMarkerSymbol);
let errBars = this.chart.series[i].errBars[0];
if (errBars) {
@@ -9225,11 +9227,13 @@ drawAreaChart.prototype = {
var y, x, val, seria, dataSeries, numCache;
var pxToMm = this.chartProp.pxToMM;
var nullPositionOX = this.catAx.posY;
+ let isLog;
for (var i = 0; i < this.chart.series.length; i++) {
seria = this.chart.series[i];
numCache = this.cChartDrawer.getNumCache(seria.val);
+ isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;
if (!numCache) {
continue;
@@ -9241,7 +9245,7 @@ drawAreaChart.prototype = {
//рассчитываем значения
val = this._getYVal(n, i);
- if(null === val && this.cChartDrawer.nDimensionCount !== 3) {
+ if((null === val && this.cChartDrawer.nDimensionCount !== 3) || (isLog && val === 0)) {
continue;
}
@@ -14241,6 +14245,7 @@ drawScatterChart.prototype = {
_recalculateScatter: function () {
let seria, yVal, xVal, points, yNumCache, compiledMarkerSize, compiledMarkerSymbol, yPoint, idx, xPoint;
let dispBlanksAs = this.cChartSpace.chart.dispBlanksAs;
+ let isLog;
let t = this;
let _initObjs = function (_index) {
@@ -14261,6 +14266,7 @@ drawScatterChart.prototype = {
for (let i = 0; i < this.chart.series.length; i++) {
seria = this.chart.series[i];
yNumCache = this.cChartDrawer.getNumCache(seria.yVal);
+ isLog = this.valAx && this.valAx.scaling ? this.valAx.scaling.logBase : false;
if (!yNumCache) {
continue;
@@ -14299,7 +14305,7 @@ drawScatterChart.prototype = {
_initObjs(i);
- if (yVal != null) {
+ if (yVal != null && ((isLog && yVal !== 0) || !isLog)) {
let x = this.cChartDrawer.getYPosition(xVal, this.catAx, true);
let y = this.cChartDrawer.getYPosition(yVal, this.valAx, true);
this.paths.points[i].push(this.cChartDrawer.calculatePoint(x, y, compiledMarkerSize, compiledMarkerSymbol));
diff --git a/common/CollaborativeEditingBase.js b/common/CollaborativeEditingBase.js
index 4a52e88877..6370957ddf 100644
--- a/common/CollaborativeEditingBase.js
+++ b/common/CollaborativeEditingBase.js
@@ -963,6 +963,10 @@
CCollaborativeEditingBase.prototype.Add_DocumentPosition = function(DocumentPos){
this.m_aDocumentPositions.Add_DocumentPosition(DocumentPos);
};
+ CCollaborativeEditingBase.prototype.Remove_DocumentPosition = function(docPos)
+ {
+ this.m_aDocumentPositions.Remove_DocumentPosition(docPos);
+ };
CCollaborativeEditingBase.prototype.Add_ForeignCursor = function(UserId, DocumentPos, UserShortId){
this.m_aForeignCursorsPos.Remove_DocumentPosition(this.m_aCursorsToUpdate[UserId]);
this.m_aForeignCursors[UserId] = DocumentPos;
diff --git a/common/Drawings/Format/Format.js b/common/Drawings/Format/Format.js
index 107ce209ef..46fe5d4984 100644
--- a/common/Drawings/Format/Format.js
+++ b/common/Drawings/Format/Format.js
@@ -1316,11 +1316,11 @@
}
}
- function ExecuteNoHistory(f, oThis, args) {
+ function ExecuteNoHistory(f, oThis, args, notOffTableId) {
AscCommon.History.TurnOff && AscCommon.History.TurnOff();
var b_table_id = false;
- if (g_oTableId && !g_oTableId.m_bTurnOff) {
+ if (!notOffTableId && g_oTableId && !g_oTableId.m_bTurnOff) {
g_oTableId.m_bTurnOff = true;
b_table_id = true;
}
diff --git a/common/Drawings/WorkEvents.js b/common/Drawings/WorkEvents.js
index 69d36f8f6f..eaa6d9cbe4 100644
--- a/common/Drawings/WorkEvents.js
+++ b/common/Drawings/WorkEvents.js
@@ -67,7 +67,7 @@
var isUsePointerEvents = true;
if (AscBrowser.isChrome && (AscBrowser.chromeVersion <= 70)) // xp
isUsePointerEvents = false;
- else if (AscBrowser.isSafari && (AscBrowser.safariVersion < 17004001))
+ else if (AscBrowser.isSafari && (AscBrowser.safariVersion < 15000000))
isUsePointerEvents = false;
else if (AscBrowser.isIE)
isUsePointerEvents = false;
@@ -758,8 +758,9 @@
return oEvent.defaultPrevented;
}
- function PaintMessageLoop(interval)
+ function PaintMessageLoop(interval, api)
{
+ this.isUseInterval = api.isMobileVersion !== true;
this.interval = interval || 40;
this.id = null;
@@ -775,7 +776,7 @@
window.oCancelRequestAnimationFrame ||
window.msCancelRequestAnimationFrame || null;
- this.isUseRequestAnimationFrame = AscCommon.AscBrowser.isChrome;
+ this.isUseRequestAnimationFrame = AscCommon.AscBrowser.isChrome || AscCommon.AscBrowser.isSafari;
if (this.isUseRequestAnimationFrame && !this.requestAnimationFrame)
this.isUseRequestAnimationFrame = false;
@@ -822,7 +823,7 @@
PaintMessageLoop.prototype._animation = function()
{
var now = Date.now();
- if (-1 === this.requestAnimationOldTime || (now >= (this.requestAnimationOldTime + 40)) || (now < this.requestAnimationOldTime))
+ if (!this.isUseInterval || -1 === this.requestAnimationOldTime || (now >= (this.requestAnimationOldTime + this.interval)) || (now < this.requestAnimationOldTime))
{
this.requestAnimationOldTime = now;
this.engine();
diff --git a/common/HistoryCommon.js b/common/HistoryCommon.js
index 693d9fd8d4..9c484310f7 100644
--- a/common/HistoryCommon.js
+++ b/common/HistoryCommon.js
@@ -1433,7 +1433,9 @@
window['AscDFH'].historyitem_type_GlossaryDocument = 67 << 16;
window['AscDFH'].historyitem_type_DocPart = 68 << 16;
window['AscDFH'].historyitem_type_Endnotes = 69 << 16;
-
+ window['AscDFH'].historyitem_type_ParagraphPermStart = 70 << 16;
+ window['AscDFH'].historyitem_type_ParagraphPermEnd = 71 << 16;
+
window['AscDFH'].historyitem_type_CommonShape = 1000 << 16; // Этот класс добавлен для элементов, у которых нет конкретного класса
window['AscDFH'].historyitem_type_ColorMod = 1001 << 16;
diff --git a/common/Scrolls/mobileTouchManagerBase.js b/common/Scrolls/mobileTouchManagerBase.js
index 70a3a57715..dced457e37 100644
--- a/common/Scrolls/mobileTouchManagerBase.js
+++ b/common/Scrolls/mobileTouchManagerBase.js
@@ -254,6 +254,10 @@
{
return false;
};
+ CMobileDelegateSimple.prototype.IsLockedZoom = function()
+ {
+ return false;
+ };
/**
* @extends {CMobileDelegateSimple}
@@ -611,6 +615,12 @@
{
return false;//(null != this.DrawingDocument.m_oDocumentRenderer);
};
+ CMobileDelegateEditor.prototype.IsLockedZoom = function()
+ {
+ // Fix after testing...
+ return false;
+ return this.HtmlPage.ReaderModeCurrent === 1;
+ };
CMobileDelegateEditor.prototype.IsNativeViewer = function()
{
if (null != this.DrawingDocument.m_oDocumentRenderer)
@@ -670,7 +680,7 @@
this.TimeDown = 0;
this.DownPoint = null;
this.DownPointOriginal = {X : 0, Y : 0};
- this.MoveMinDist = 50;
+ this.MoveMinDist = 20;
this.isGlassDrawed = false;
this.MoveAfterDown = false;
@@ -734,6 +744,11 @@
this.isShowingContextMenu = false;
this.isMobileContextMenuShowResize = false;
+
+ // On Android, there is no way to show the keyboard except onclick
+ // TODO: may be exist another way??
+ this.isCheckFocusOnClick = AscCommon.AscBrowser.isAndroid;
+ this.isCheckFocusOnClickValue = false;
}
CMobileTouchManagerBase.prototype.initEvents = function(_id)
@@ -751,6 +766,16 @@
return true;
};
+ CMobileTouchManagerBase.prototype.checkMouseFocus = function(e)
+ {
+ // mobile version does not get focus with mouse events
+ if (this.Api.isMobileVersion && e && "mouse" === e.pointerType)
+ {
+ if (AscCommon.g_inputContext)
+ AscCommon.g_inputContext.setInterfaceEnableKeyEvents(true);
+ }
+ };
+
CMobileTouchManagerBase.prototype.checkTouchEvent = function(e)
{
if (!e)
@@ -1227,7 +1252,7 @@
}
var _new_value = this.delegate.GetZoomFit();
- if (this.isDesktopMode)
+ if (this.isDesktopMode && !this.Api.isMobileVersion)
{
let c_min_zoom_value = 50; // delegate method
if (_new_value > c_min_zoom_value)
@@ -1331,7 +1356,9 @@
{
that.ContextMenuShowTimerId = -1;
var _pos = that.delegate.GetContextMenuPosition();
+ if (AscCommon.g_inputContext) AscCommon.g_inputContext.isGlobalDisableFocus = true;
that.Api.sendEvent("asc_onShowPopMenu", _pos.X, _pos.Y, (_pos.Mode > 1) ? true : false);
+ if (AscCommon.g_inputContext) AscCommon.g_inputContext.isGlobalDisableFocus = false;
}, 500);
};
@@ -2657,13 +2684,43 @@
return _count;
};
- CMobileTouchManagerBase.prototype.showKeyboard = function()
+ CMobileTouchManagerBase.prototype.showKeyboard = function(isForce)
{
if (AscCommon.g_inputContext)
{
- if (this.ContextMenuLastMode == AscCommon.MobileTouchContextMenuType.Target)
+ let isShow = (isForce === true) ? true : false;
+ if (!isShow)
+ {
+ if (this.ContextMenuLastMode === AscCommon.MobileTouchContextMenuType.Target)
+ {
+ if (this.Api.canEnterText())
+ isShow = true;
+ }
+ }
+ if (isShow)
+ AscCommon.g_inputContext.HtmlArea.focus();
+
+ if (this.isCheckFocusOnClick)
+ this.isCheckFocusOnClickValue = true;
+ }
+ };
+
+ CMobileTouchManagerBase.prototype.addClickElement = function(elems)
+ {
+ for (let i = 0, len = elems.length; i < len; i++)
+ elems[i].onclick = this.onClickElement.bind(this);
+ };
+
+ CMobileTouchManagerBase.prototype.onClickElement = function(e)
+ {
+ if (this.isCheckFocusOnClickValue === true)
+ {
+ if (AscCommon.g_inputContext)
AscCommon.g_inputContext.HtmlArea.focus();
+ this.isCheckFocusOnClickValue = false;
}
+
+ this.checkHandlersOnClick();
};
CMobileTouchManagerBase.prototype.scrollTo = function(x, y)
diff --git a/common/TableId.js b/common/TableId.js
index 564cead484..8e92fa5ae5 100644
--- a/common/TableId.js
+++ b/common/TableId.js
@@ -351,6 +351,8 @@
this.m_oFactoryClass[AscDFH.historyitem_type_SmartArtDrawing ] = AscFormat.Drawing;
this.m_oFactoryClass[AscDFH.historyitem_type_DiagramData ] = AscFormat.DiagramData;
this.m_oFactoryClass[AscDFH.historyitem_type_CEffectProperties ] = AscFormat.CEffectProperties;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ParagraphPermStart] = AscWord.ParagraphPermStart;
+ this.m_oFactoryClass[AscDFH.historyitem_type_ParagraphPermEnd ] = AscWord.ParagraphPermEnd;
if (window['AscCommonSlide'])
{
diff --git a/common/apiBase.js b/common/apiBase.js
index a06a2beeb8..e48e3f9a15 100644
--- a/common/apiBase.js
+++ b/common/apiBase.js
@@ -2372,6 +2372,13 @@
{
return this.textArtPreviewManager.getWordArtPreviews();
};
+ baseEditorsApi.prototype.isUseOldMobileVersion = function()
+ {
+ if (!this.isMobileVersion)
+ return false;
+ // return true for old scheme
+ return false;
+ };
// Add image
baseEditorsApi.prototype.AddImageUrl = function(urls, imgProp, token, obj)
{
@@ -4598,6 +4605,10 @@
this.updateDarkMode();
};
+ baseEditorsApi.prototype.canEnterText = function()
+ {
+ return this.canEdit();
+ };
baseEditorsApi.prototype.updateDarkMode = function()
{
};
diff --git a/common/apiCommon.js b/common/apiCommon.js
index 5365a9d8d8..31b57f632d 100644
--- a/common/apiCommon.js
+++ b/common/apiCommon.js
@@ -5161,7 +5161,7 @@ function (window, undefined) {
}
let _oldTrackRevision = false;
- if (oApi.getEditorId() === AscCommon.c_oEditorId.Word && oApi.WordControl && !oApi.isPdfEditor())
+ if (oApi.getEditorId() === AscCommon.c_oEditorId.Word && oApi.WordControl && oApi.WordControl.m_oLogicDocument && !oApi.isPdfEditor())
_oldTrackRevision = oApi.WordControl.m_oLogicDocument.GetLocalTrackRevisions();
if (false !== _oldTrackRevision)
diff --git a/common/commonDefines.js b/common/commonDefines.js
index b88d72b427..878a62f2fe 100644
--- a/common/commonDefines.js
+++ b/common/commonDefines.js
@@ -1080,7 +1080,7 @@ window.AscCommon.g_cIsBeta = "false";
var ST_ChildOrderType = {
b: 0,
- t: 1
+ t: 1
}
var ST_AlgorithmType = {
@@ -1107,7 +1107,7 @@ window.AscCommon.g_cIsBeta = "false";
equ: 1,
gte: 2,
lte: 3
- }
+ }
var ST_ElementType = {
all: 0,
@@ -2474,9 +2474,9 @@ window.AscCommon.g_cIsBeta = "false";
pasteOnlyFormula: 1,
formulaNumberFormat: 2,
formulaAllFormatting: 3,
- formulaWithoutBorders: 4,
+ formulaWithoutBorders: 4,
formulaColumnWidth: 5,
- mergeConditionalFormating: 6,
+ mergeConditionalFormating: 6,
pasteOnlyValues: 7,
valueNumberFormat: 8,
valueAllFormating: 9,
@@ -3809,8 +3809,36 @@ window.AscCommon.g_cIsBeta = "false";
Shape: "Shape",
OleObject: "OleObject"
};
-
-
+
+ // 17.18.21 ST_EdGrp
+ const ST_EdGrp = {
+ administrators : 0,
+ contributors : 1,
+ current : 2,
+ editors : 3,
+ everyone : 4,
+ none : 5,
+ owners : 6
+ };
+
+ window['Asc']['ST_EdGrp'] = window['Asc'].ST_EdGrp = ST_EdGrp;
+ ST_EdGrp['administrators'] = ST_EdGrp.administrators;
+ ST_EdGrp['contributors'] = ST_EdGrp.contributors;
+ ST_EdGrp['current'] = ST_EdGrp.current;
+ ST_EdGrp['editors'] = ST_EdGrp.editors;
+ ST_EdGrp['everyone'] = ST_EdGrp.everyone;
+ ST_EdGrp['none'] = ST_EdGrp.none;
+
+ // 17.18.13 ST_DisplacedByCustomXml
+ const ST_DisplacedByCustomXml = {
+ next : 0,
+ prev : 1
+ };
+ window['Asc']['ST_DisplacedByCustomXml'] = window['Asc'].ST_DisplacedByCustomXml = ST_DisplacedByCustomXml;
+ ST_DisplacedByCustomXml['next'] = ST_DisplacedByCustomXml.next;
+ ST_DisplacedByCustomXml['prev'] = ST_DisplacedByCustomXml.prev;
+
+
var c_oAscDateTimeFormat = {};
c_oAscDateTimeFormat[lcid_arSA] = [
"dd/MM/yyyy",
diff --git a/common/text_input2.js b/common/text_input2.js
index d8ba87dae9..c50b36d347 100644
--- a/common/text_input2.js
+++ b/common/text_input2.js
@@ -112,6 +112,7 @@
this.nativeFocusElementNoRemoveOnElementFocus = false;
this.InterfaceEnableKeyEvents = true;
this.isNoClearOnFocus = false;
+ this.isGlobalDisableFocus = false;
this.ReadOnlyCounter = 0;
@@ -879,7 +880,8 @@
return;
}
- focusHtmlElement(this.HtmlArea);
+ if (!this.isGlobalDisableFocus)
+ focusHtmlElement(this.HtmlArea);
}
};
CTextInputPrototype.externalEndCompositeInput = function()
@@ -942,7 +944,11 @@
{
_style = ("left:-" + (this.HtmlAreaWidth >> 1) + "px;top:" + (-this.HtmlAreaOffset) + "px;");
_style += "color:transparent;caret-color:transparent;background:transparent;";
- _style += (AscCommon.AscBrowser.isAppleDevices && !AscCommon.AscBrowser.isTelegramWebView && (AscCommon.AscBrowser.maxTouchPoints > 0)) ? "font-size:0px;" : "font-size:8px;";
+
+ if (this.Api.isUseOldMobileVersion())
+ _style += (AscCommon.AscBrowser.isAppleDevices && !AscCommon.AscBrowser.isTelegramWebView && (AscCommon.AscBrowser.maxTouchPoints > 0)) ? "font-size:0px;" : "font-size:8px;";
+ else
+ _style += "font-size:8px;";
}
else
{
@@ -1072,7 +1078,7 @@
_elem.style.height = _elemSrc.style.height;
}
- if (this.Api.isMobileVersion)
+ if (this.Api.isUseOldMobileVersion())
{
var _elem1 = document.getElementById("area_id_parent");
var _elem2 = document.getElementById("area_id");
@@ -1143,7 +1149,7 @@
};
CTextInputPrototype.move = function(x, y)
{
- if (this.Api.isMobileVersion)
+ if (this.Api.isUseOldMobileVersion())
return;
var oTarget = document.getElementById(this.TargetId);
@@ -1225,11 +1231,22 @@
if (!this.isDisableKeyboard)
{
- if (this.Api.isRestrictionView() && !this.Api.isRestrictionForms())
+ switch (this.Api.editorId)
{
- // в пдф даем комментировать и заполнять формы во вью с сохранением в копию
- if (!this.Api.isPdfEditor())
- this.isDisableKeyboard = true;
+ case AscCommon.c_oEditorId.Word:
+ {
+ // use canEnterText instead this
+ break;
+ }
+ case AscCommon.c_oEditorId.Presentation:
+ case AscCommon.c_oEditorId.Spreadsheet:
+ {
+ if (this.Api.isRestrictionView() && !this.Api.isRestrictionForms())
+ this.isDisableKeyboard = true;
+ break;
+ }
+ default:
+ break;
}
}
diff --git a/common/workerspeech.js b/common/workerspeech.js
index 07ed0b3947..375d58e9fb 100644
--- a/common/workerspeech.js
+++ b/common/workerspeech.js
@@ -150,7 +150,8 @@
this.speechElement.setAttribute("role", "region");
this.speechElement.setAttribute("aria-label", "");
this.speechElement.setAttribute("aria-live", "assertive");
- this.speechElement.setAttribute("aria-atomic", "true");
+ if (!(AscCommon.AscBrowser.isMozilla && AscCommon.AscBrowser.isWindows))
+ this.speechElement.setAttribute("aria-atomic", "true");
this.speechElement.setAttribute("aria-hidden", "false");
//AscCommon.g_inputContext.HtmlArea.setAttribute("aria-describedby", "area_id_screen_reader");
diff --git a/configs/cell.json b/configs/cell.json
index ed1838a5a9..5a639b4464 100644
--- a/configs/cell.json
+++ b/configs/cell.json
@@ -202,6 +202,7 @@
"common/Drawings/Format/SlicerView.js",
"cell/model/PivotTables.js",
+ "word/Editor/Paragraph/RunContent/Types.js",
"word/Math/mathTypes.js",
"word/Editor/Styles.js",
"word/Math/math-settings.js",
@@ -214,13 +215,15 @@
"word/Editor/Paragraph/Run/RunAutoCorrect.js",
"word/Editor/DocumentContentElementBase.js",
"word/Editor/ParagraphContentBase.js",
+ "word/Editor/annotations/perm-ranges-manager.js",
+ "word/Editor/annotations/annotation-mark-base.js",
+ "word/Editor/annotations/paragraph-perm.js",
"word/Editor/Bookmarks.js",
"word/Editor/Comments.js",
"word/Editor/CommentsChanges.js",
"word/Editor/StylesChanges.js",
"word/Editor/RevisionsChange.js",
"word/Editor/FlowObjects.js",
- "word/Editor/Paragraph/RunContent/Types.js",
"word/Editor/Paragraph/RunContent/Base.js",
"word/Editor/Paragraph/RunContent/FootnoteReference.js",
"word/Editor/Paragraph/RunContent/FootnoteRef.js",
diff --git a/configs/slide.json b/configs/slide.json
index 13f3569515..4572559b9e 100644
--- a/configs/slide.json
+++ b/configs/slide.json
@@ -152,6 +152,7 @@
"cell/model/CellInfo.js",
"cell/view/DrawingObjectsController.js",
+ "word/Editor/Paragraph/RunContent/Types.js",
"word/Math/mathTypes.js",
"word/Editor/Styles.js",
"word/Math/math-settings.js",
@@ -214,7 +215,6 @@
"slide/Editor/Format/Notes.js",
"word/Editor/StylesChanges.js",
"word/Editor/RevisionsChange.js",
- "word/Editor/Paragraph/RunContent/Types.js",
"word/Editor/Paragraph/RunContent/Base.js",
"word/Editor/Paragraph/RunContent/FootnoteReference.js",
"word/Editor/Paragraph/RunContent/FootnoteRef.js",
diff --git a/configs/word.json b/configs/word.json
index 13db151e47..ea77fafa31 100644
--- a/configs/word.json
+++ b/configs/word.json
@@ -154,6 +154,7 @@
"cell/model/Serialize.js",
"cell/model/CellInfo.js",
+ "word/Editor/Paragraph/RunContent/Types.js",
"word/Math/mathTypes.js",
"word/Editor/Styles.js",
"word/Math/math-settings.js",
@@ -178,11 +179,13 @@
"word/Editor/ParagraphContentBase.js",
"word/Editor/Comments.js",
"word/Editor/CommentsChanges.js",
+ "word/Editor/annotations/perm-ranges-manager.js",
+ "word/Editor/annotations/annotation-mark-base.js",
+ "word/Editor/annotations/paragraph-perm.js",
"word/Editor/Bookmarks.js",
"word/Editor/StylesChanges.js",
"word/Editor/RevisionsChange.js",
"word/Editor/FlowObjects.js",
- "word/Editor/Paragraph/RunContent/Types.js",
"word/Editor/Paragraph/RunContent/Base.js",
"word/Editor/Paragraph/RunContent/FootnoteReference.js",
"word/Editor/Paragraph/RunContent/FootnoteRef.js",
diff --git a/pdf/api.js b/pdf/api.js
index 2e18db937b..8f8e540ebe 100644
--- a/pdf/api.js
+++ b/pdf/api.js
@@ -2488,6 +2488,14 @@
oDoc.SearchEngine.Show = isShow;
this.DocumentRenderer.onUpdateOverlay();
};
+ PDFEditorApi.prototype.canEnterText = function()
+ {
+ return this.canEdit();
+ };
+ PDFEditorApi.prototype.asc_GetTableOfContentsPr = function()
+ {
+ return null;
+ };
PDFEditorApi.prototype._printDesktop = function(options) {
if (!this.DocumentRenderer)
return false;
@@ -2878,4 +2886,6 @@
PDFEditorApi.prototype['asc_GetSelectionBounds'] = PDFEditorApi.prototype.asc_GetSelectionBounds;
PDFEditorApi.prototype['asc_setPdfViewer'] = PDFEditorApi.prototype.asc_setPdfViewer;
+ PDFEditorApi.prototype['asc_GetTableOfContentsPr'] = PDFEditorApi.prototype.asc_GetTableOfContentsPr;
+
})(window, window.document);
diff --git a/pdf/src/engine/drawingfile.js b/pdf/src/engine/drawingfile.js
index 02f972412d..1d506100a2 100644
--- a/pdf/src/engine/drawingfile.js
+++ b/pdf/src/engine/drawingfile.js
@@ -153,47 +153,47 @@ len-=4;var buffer=new Uint8Array(Module["HEAP8"].buffer,data+4,len);var reader=n
pageObj.fontsUpdateType=UpdateFontsSource.Undefined}}if(pagesRepaint_Page.length>0&&drawingFile.onRepaintPages)drawingFile.onRepaintPages(pagesRepaint_Page);if(pagesRepaint_Annotation.length>0&&drawingFile.onRepaintAnnotations)drawingFile.onRepaintAnnotations(pagesRepaint_Annotation);if(pagesRepaint_Forms.length>0&&drawingFile.onRepaintForms)drawingFile.onRepaintForms(pagesRepaint_Forms);delete _t.externalCallback};if(2!==file.LoadFontAsync)file.LoadFontAsync(baseFontsPath,null)}}var memoryBuffer=
fileId.toUtf8();var pointer=Module["_malloc"](memoryBuffer.length);Module.HEAP8.set(memoryBuffer,pointer);Module["HEAP8"][status]=fileStatus==0?1:0;return pointer};CFile.prototype.lockPageNumForFontsLoader=function(pageIndex,type){this.fontPageIndex=pageIndex;this.fontPageUpdateType=type};CFile.prototype.unlockPageNumForFontsLoader=function(){this.fontPageIndex=-1;drawingFile.fontPageUpdateType=UpdateFontsSource.Undefined};CFile.prototype.getOriginPage=function(originIndex){for(var i=0;i0)this._free(this.stream);this.stream=-1;self.drawingFile=null};
-CFile.prototype["getFileBinary"]=function(){if(0>=this.stream)return"";return new Uint8Array(Module["HEAP8"].buffer,this.stream,this.stream_size)};CFile.prototype["isNeedPassword"]=function(){return this._isNeedPassword};CFile.prototype.getInfo=function(){if(!this.nativeFile)return false;var ptr=this._getInfo();var reader=ptr.getReader();if(!reader)return false;this.StartID=reader.readInt();var _pages=reader.readInt();for(var i=0;i<_pages;i++){var rec={};rec["W"]=reader.readInt();rec["H"]=reader.readInt();
-rec["Dpi"]=reader.readInt();rec["Rotate"]=reader.readInt();rec["originIndex"]=i;rec.fonts=[];rec.fontsUpdateType=UpdateFontsSource.Undefined;rec.text=null;this.pages.push(rec)}var json_info=reader.readString();try{this.info=JSON.parse(json_info)}catch(err$1){}ptr.free();return this.pages.length>0};CFile.prototype["getStructure"]=function(){var ptr=this._getStructure();var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["page"]=reader.readInt();rec["level"]=
-reader.readInt();rec["y"]=reader.readDouble();rec["description"]=reader.readString();res.push(rec)}ptr.free();return res};CFile.prototype["getLinks"]=function(pageIndex){var ptr=this._getLinks(pageIndex);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["link"]=reader.readString();rec["dest"]=reader.readDouble();rec["x"]=reader.readDouble();rec["y"]=reader.readDouble();rec["w"]=reader.readDouble();rec["h"]=reader.readDouble();res.push(rec)}ptr.free();
-return res};CFile.prototype["getGlyphs"]=function(pageIndex){var i=this.getOriginPage(pageIndex);if(i<0)return null;var page=this.pages[i];if(!page||page.fonts.length>0)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var res=this._getGlyphs(pageIndex);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){res=null;return null}if(res&&this.onUpdateStatistics)this.onUpdateStatistics(res.info[0],res.info[1],res.info[2],res.info[3]);return res.result||null};CFile.prototype["destroyTextInfo"]=
-function(){this._destroyTextInfo()};CFile.prototype.getWidgetFonts=function(type){var ptr=this._getInteractiveFormsFonts(type);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var n=reader.readInt();for(var i=0;i>1&1;var bPrint=rec["annotflag"]>>2&1;rec["noZoom"]=rec["annotflag"]>>3&1;rec["noRotate"]=rec["annotflag"]>>4&1;var bNoView=
-rec["annotflag"]>>5&1;rec["locked"]=rec["annotflag"]>>7&1;rec["ToggleNoView"]=rec["annotflag"]>>8&1;rec["lockedC"]=rec["annotflag"]>>9&1;rec["display"]=0;if(bHidden)rec["display"]=1;else if(bPrint)if(bNoView)rec["display"]=3;else rec["display"]=0;else if(bNoView)rec["display"]=0;else rec["display"]=2;rec["page"]=reader.readInt();rec["rect"]={};rec["rect"]["x1"]=reader.readDouble2();rec["rect"]["y1"]=reader.readDouble2();rec["rect"]["x2"]=reader.readDouble2();rec["rect"]["y2"]=reader.readDouble2();
-var flags=reader.readInt();if(flags&1<<0)rec["UniqueName"]=reader.readString();if(flags&1<<1)rec["Contents"]=reader.readString();if(flags&1<<2){rec["BE"]={};rec["BE"]["S"]=reader.readByte();rec["BE"]["I"]=reader.readDouble()}if(flags&1<<3){var n=reader.readInt();rec["C"]=[];for(var i=0;i>6&1;if(flags&1<<7)rec["OUserID"]=reader.readString()}function readAnnotAP(reader,AP){AP["i"]=reader.readInt();AP["x"]=reader.readInt();AP["y"]=reader.readInt();AP["w"]=reader.readInt();AP["h"]=reader.readInt();var n=reader.readInt();for(var i=0;i0)res["CO"]=[];for(var i=0;i0)res["Parents"]=[];for(var i$6=0;i$6>0&1;rec$12["required"]=rec$12["flag"]>>1&1;rec$12["noexport"]=rec$12["flag"]>>2&1;var flags$14=reader.readInt();if(flags$14&1<<0)rec$12["userName"]=reader.readString();if(flags$14&1<<1)rec$12["defaultStyle"]=reader.readString();if(flags$14&1<<2)rec$12["font"]["actual"]=reader.readString();if(flags$14&1<<3)rec$12["highlight"]=reader.readByte();if(flags$14&1<<4)rec$12["font"]["key"]=reader.readString();if(flags$14&1<<5){var n$15=reader.readInt();rec$12["BC"]=[];for(var i$16=0;i$160)rec$12["AA"]={};for(var i$19=0;i$19>4&1}}else if(rec$12["type"]==29||rec$12["type"]==28){if(flags$14&1<<9)rec$12["value"]=reader.readString();rec$12["style"]=reader.readByte();if(flags$14&1<<14)rec$12["ExportValue"]=reader.readString();rec$12["NoToggleToOff"]=rec$12["flag"]>>14&1;rec$12["radiosInUnison"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==
-30){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10)rec$12["maxLen"]=reader.readInt();if(rec$12["flag"]&1<<25)rec$12["richValue"]=reader.readString();rec$12["multiline"]=rec$12["flag"]>>12&1;rec$12["password"]=rec$12["flag"]>>13&1;rec$12["fileSelect"]=rec$12["flag"]>>20&1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["doNotScroll"]=rec$12["flag"]>>23&1;rec$12["comb"]=rec$12["flag"]>>24&1;rec$12["richText"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==31||rec$12["type"]==
-32){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10){var n$20=reader.readInt();rec$12["opt"]=[];for(var i$21=0;i$21>18&1;rec$12["multipleSelection"]=rec$12["flag"]>>21&1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["commitOnSelChange"]=rec$12["flag"]>>26&1}else if(rec$12["type"]==33)rec$12["Sig"]=flags$14>>9&1;res["Fields"].push(rec$12)}ptr.free();return res};CFile.prototype["getInteractiveFormsAP"]=function(pageIndex,width,height,backgroundColor,nWidget,sView,sButtonView){var nView=
--1;if(sView)if(sView=="N")nView=0;else if(sView=="D")nView=1;else if(sView=="R")nView=2;var nButtonView=-1;if(sButtonView)nButtonView=sButtonView=="Off"?0:1;this.lockPageNumForFontsLoader(pageIndex,UpdateFontsSource.Forms);var ptr=this._getInteractiveFormsAP(width,height,backgroundColor,pageIndex,nWidget,nView,nButtonView);var reader=ptr.getReader();this.unlockPageNumForFontsLoader();if(!reader)return[];var res=[];while(reader.isValid()){var AP={};readAnnotAP(reader,AP);res.push(AP)}ptr.free();return res};
-CFile.prototype["getButtonIcons"]=function(pageIndex,width,height,backgroundColor,bBase64,nWidget,sIconView){var nView=-1;if(sIconView)if(sIconView=="I")nView=0;else if(sIconView=="RI")nView=1;else if(sIconView=="IX")nView=2;var ptr=this._getButtonIcons(backgroundColor,pageIndex,bBase64,nWidget,nView);var reader=ptr.getReader();if(!reader)return{};var res={};res["MK"]=[];res["View"]=[];while(reader.isValid()){var MK={};MK["i"]=reader.readInt();var n=reader.readInt();for(var i=0;i>0&1;oFont["italic"]=nFontFlag>>1&1;oFont["strikethrough"]=nFontFlag>>3&1;oFont["underlined"]=nFontFlag>>4&1;if(nFontFlag&1<<5)oFont["vertical"]=reader.readDouble();if(nFontFlag&1<<6)oFont["actual"]=reader.readString();oFont["size"]=reader.readDouble();oFont["color"]=[];oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["name"]=reader.readString();oFont["text"]=reader.readString();
-rec["RC"].push(oFont)}}if(flags&1<<4)rec["CreationDate"]=reader.readString();if(flags&1<<5)rec["RefTo"]=reader.readInt();if(flags&1<<6)rec["RefToReason"]=reader.readByte();if(flags&1<<7)rec["Subj"]=reader.readString()}if(rec["Type"]==0){if(rec["C"]){rec["IC"]=rec["C"];delete rec["C"]}rec["Open"]=flags>>15&1;if(flags&1<<16)rec["Icon"]=reader.readByte();if(flags&1<<17)rec["StateModel"]=reader.readByte();if(flags&1<<18)rec["State"]=reader.readByte()}else if(rec["Type"]==3){rec["L"]=[];for(var i$26=0;i$26<
-4;++i$26)rec["L"].push(reader.readDouble());if(flags&1<<15){rec["LE"]=[];rec["LE"].push(reader.readByte());rec["LE"].push(reader.readByte())}if(flags&1<<16){var n$27=reader.readInt();rec["IC"]=[];for(var i$28=0;i$28>19&1;if(flags&1<<20)rec["IT"]=reader.readByte();if(flags&1<<21)rec["LLO"]=reader.readDouble();if(flags&1<<22)rec["CP"]=reader.readByte();
-if(flags&1<<23){rec["CO"]=[];rec["CO"].push(reader.readDouble());rec["CO"].push(reader.readDouble())}}else if(rec["Type"]==14){var n$29=reader.readInt();rec["InkList"]=[];for(var i$30=0;i$307&&rec["Type"]<12){var n$31=reader.readInt();rec["QuadPoints"]=[];for(var i$32=0;i$320)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var ptr=this._getPixmap(pageIndex,width,height,backgroundColor);this.unlockPageNumForFontsLoader();
-if(page.fonts.length>0){this._free(ptr);ptr=null}return ptr};function addToArrayAsDictionary(arr,value){var isFound=false;for(var i=0,len=arr.length;i=pageIndex)pages[j]+=1}};CFile.prototype["removePage"]=function(pageIndex){var result=this.pages.splice(pageIndex,1);if(this.fontStreams)for(var i in this.fontStreams){var pages=this.fontStreams[i].pages;for(var j=0;jpageIndex)pages[j]-=1;else if(pages[j]==pageIndex)pages.splice(j,1)}return result};self["AscViewer"]["Free"]=function(pointer){CFile.prototype._free(pointer)};self["AscViewer"]["InitializeFonts"]=function(basePath){return CFile.prototype._InitializeFonts(basePath)};
-self["AscViewer"]["CheckStreamId"]=function(data,status){return CFile.prototype._CheckStreamId(data,status)};self["AscViewer"]["CDrawingFile"]=CFile;self.drawingFile=null})(window,undefined);
+CFile.prototype["loadFromDataWithPassword"]=function(password){if(0!=this.nativeFile)this._closeFile();var isSuccess=this._openFile(undefined,password);var error=this._getError();this.type=this._getType();self.drawingFile=this;if(!error)this.getInfo();this._isNeedPassword=4===error?true:false;return error};CFile.prototype["getType"]=function(){return this.type};CFile.prototype["close"]=function(){this._closeFile();this.nativeFile=0;this.pages=[];this.info=null;this.StartID=null;if(this.stream>0)this._free(this.stream);
+this.stream=-1;self.drawingFile=null};CFile.prototype["getFileBinary"]=function(){if(0>=this.stream)return"";return new Uint8Array(Module["HEAP8"].buffer,this.stream,this.stream_size)};CFile.prototype["isNeedPassword"]=function(){return this._isNeedPassword};CFile.prototype.getInfo=function(){if(!this.nativeFile)return false;var ptr=this._getInfo();var reader=ptr.getReader();if(!reader)return false;this.StartID=reader.readInt();var _pages=reader.readInt();for(var i=0;i<_pages;i++){var rec={};rec["W"]=
+reader.readInt();rec["H"]=reader.readInt();rec["Dpi"]=reader.readInt();rec["Rotate"]=reader.readInt();rec["originIndex"]=i;rec.fonts=[];rec.fontsUpdateType=UpdateFontsSource.Undefined;rec.text=null;this.pages.push(rec)}var json_info=reader.readString();try{this.info=JSON.parse(json_info)}catch(err$1){}ptr.free();return this.pages.length>0};CFile.prototype["getStructure"]=function(){var ptr=this._getStructure();var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec=
+{};rec["page"]=reader.readInt();rec["level"]=reader.readInt();rec["y"]=reader.readDouble();rec["description"]=reader.readString();res.push(rec)}ptr.free();return res};CFile.prototype["getLinks"]=function(pageIndex){var ptr=this._getLinks(pageIndex);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["link"]=reader.readString();rec["dest"]=reader.readDouble();rec["x"]=reader.readDouble();rec["y"]=reader.readDouble();rec["w"]=reader.readDouble();rec["h"]=
+reader.readDouble();res.push(rec)}ptr.free();return res};CFile.prototype["getGlyphs"]=function(pageIndex){var i=this.getOriginPage(pageIndex);if(i<0)return null;var page=this.pages[i];if(!page||page.fonts.length>0)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var res=this._getGlyphs(pageIndex);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){res=null;return null}if(res&&this.onUpdateStatistics)this.onUpdateStatistics(res.info[0],res.info[1],res.info[2],res.info[3]);
+return res.result||null};CFile.prototype["destroyTextInfo"]=function(){this._destroyTextInfo()};CFile.prototype.getWidgetFonts=function(type){var ptr=this._getInteractiveFormsFonts(type);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var n=reader.readInt();for(var i=0;i>1&1;var bPrint=rec["annotflag"]>>2&1;rec["noZoom"]=
+rec["annotflag"]>>3&1;rec["noRotate"]=rec["annotflag"]>>4&1;var bNoView=rec["annotflag"]>>5&1;rec["locked"]=rec["annotflag"]>>7&1;rec["ToggleNoView"]=rec["annotflag"]>>8&1;rec["lockedC"]=rec["annotflag"]>>9&1;rec["display"]=0;if(bHidden)rec["display"]=1;else if(bPrint)if(bNoView)rec["display"]=3;else rec["display"]=0;else if(bNoView)rec["display"]=0;else rec["display"]=2;rec["page"]=reader.readInt();rec["rect"]={};rec["rect"]["x1"]=reader.readDouble2();rec["rect"]["y1"]=reader.readDouble2();rec["rect"]["x2"]=
+reader.readDouble2();rec["rect"]["y2"]=reader.readDouble2();var flags=reader.readInt();if(flags&1<<0)rec["UniqueName"]=reader.readString();if(flags&1<<1)rec["Contents"]=reader.readString();if(flags&1<<2){rec["BE"]={};rec["BE"]["S"]=reader.readByte();rec["BE"]["I"]=reader.readDouble()}if(flags&1<<3){var n=reader.readInt();rec["C"]=[];for(var i=0;i>6&1;if(flags&1<<7)rec["OUserID"]=reader.readString()}function readAnnotAP(reader,AP){AP["i"]=reader.readInt();AP["x"]=reader.readInt();AP["y"]=reader.readInt();AP["w"]=reader.readInt();AP["h"]=reader.readInt();var n=reader.readInt();for(var i=0;i0)res["CO"]=[];for(var i=0;i0)res["Parents"]=
+[];for(var i$6=0;i$6>0&1;rec$12["required"]=rec$12["flag"]>>1&1;rec$12["noexport"]=rec$12["flag"]>>2&1;var flags$14=reader.readInt();if(flags$14&1<<0)rec$12["userName"]=reader.readString();if(flags$14&1<<1)rec$12["defaultStyle"]=reader.readString();if(flags$14&1<<2)rec$12["font"]["actual"]=reader.readString();if(flags$14&1<<3)rec$12["highlight"]=reader.readByte();
+if(flags$14&1<<4)rec$12["font"]["key"]=reader.readString();if(flags$14&1<<5){var n$15=reader.readInt();rec$12["BC"]=[];for(var i$16=0;i$160)rec$12["AA"]={};for(var i$19=0;i$19>4&1}}else if(rec$12["type"]==29||rec$12["type"]==28){if(flags$14&1<<9)rec$12["value"]=reader.readString();
+rec$12["style"]=reader.readByte();if(flags$14&1<<14)rec$12["ExportValue"]=reader.readString();rec$12["NoToggleToOff"]=rec$12["flag"]>>14&1;rec$12["radiosInUnison"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==30){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10)rec$12["maxLen"]=reader.readInt();if(rec$12["flag"]&1<<25)rec$12["richValue"]=reader.readString();rec$12["multiline"]=rec$12["flag"]>>12&1;rec$12["password"]=rec$12["flag"]>>13&1;rec$12["fileSelect"]=rec$12["flag"]>>20&
+1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["doNotScroll"]=rec$12["flag"]>>23&1;rec$12["comb"]=rec$12["flag"]>>24&1;rec$12["richText"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==31||rec$12["type"]==32){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10){var n$20=reader.readInt();rec$12["opt"]=[];for(var i$21=0;i$21>18&1;rec$12["multipleSelection"]=rec$12["flag"]>>21&1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["commitOnSelChange"]=rec$12["flag"]>>26&1}else if(rec$12["type"]==
+33)rec$12["Sig"]=flags$14>>9&1;res["Fields"].push(rec$12)}ptr.free();return res};CFile.prototype["getInteractiveFormsAP"]=function(pageIndex,width,height,backgroundColor,nWidget,sView,sButtonView){var nView=-1;if(sView)if(sView=="N")nView=0;else if(sView=="D")nView=1;else if(sView=="R")nView=2;var nButtonView=-1;if(sButtonView)nButtonView=sButtonView=="Off"?0:1;this.lockPageNumForFontsLoader(pageIndex,UpdateFontsSource.Forms);var ptr=this._getInteractiveFormsAP(width,height,backgroundColor,pageIndex,
+nWidget,nView,nButtonView);var reader=ptr.getReader();this.unlockPageNumForFontsLoader();if(!reader)return[];var res=[];while(reader.isValid()){var AP={};readAnnotAP(reader,AP);res.push(AP)}ptr.free();return res};CFile.prototype["getButtonIcons"]=function(pageIndex,width,height,backgroundColor,bBase64,nWidget,sIconView){var nView=-1;if(sIconView)if(sIconView=="I")nView=0;else if(sIconView=="RI")nView=1;else if(sIconView=="IX")nView=2;var ptr=this._getButtonIcons(backgroundColor,pageIndex,bBase64,
+nWidget,nView);var reader=ptr.getReader();if(!reader)return{};var res={};res["MK"]=[];res["View"]=[];while(reader.isValid()){var MK={};MK["i"]=reader.readInt();var n=reader.readInt();for(var i=0;i>0&1;oFont["italic"]=nFontFlag>>1&1;oFont["strikethrough"]=nFontFlag>>3&1;oFont["underlined"]=nFontFlag>>4&1;if(nFontFlag&1<<5)oFont["vertical"]=reader.readDouble();if(nFontFlag&1<<6)oFont["actual"]=reader.readString();
+oFont["size"]=reader.readDouble();oFont["color"]=[];oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["name"]=reader.readString();oFont["text"]=reader.readString();rec["RC"].push(oFont)}}if(flags&1<<4)rec["CreationDate"]=reader.readString();if(flags&1<<5)rec["RefTo"]=reader.readInt();if(flags&1<<6)rec["RefToReason"]=reader.readByte();if(flags&1<<7)rec["Subj"]=reader.readString()}if(rec["Type"]==0){if(rec["C"]){rec["IC"]=
+rec["C"];delete rec["C"]}rec["Open"]=flags>>15&1;if(flags&1<<16)rec["Icon"]=reader.readByte();if(flags&1<<17)rec["StateModel"]=reader.readByte();if(flags&1<<18)rec["State"]=reader.readByte()}else if(rec["Type"]==3){rec["L"]=[];for(var i$26=0;i$26<4;++i$26)rec["L"].push(reader.readDouble());if(flags&1<<15){rec["LE"]=[];rec["LE"].push(reader.readByte());rec["LE"].push(reader.readByte())}if(flags&1<<16){var n$27=reader.readInt();rec["IC"]=[];for(var i$28=0;i$28>19&1;if(flags&1<<20)rec["IT"]=reader.readByte();if(flags&1<<21)rec["LLO"]=reader.readDouble();if(flags&1<<22)rec["CP"]=reader.readByte();if(flags&1<<23){rec["CO"]=[];rec["CO"].push(reader.readDouble());rec["CO"].push(reader.readDouble())}}else if(rec["Type"]==14){var n$29=reader.readInt();rec["InkList"]=[];for(var i$30=0;i$307&&rec["Type"]<12){var n$31=reader.readInt();rec["QuadPoints"]=[];for(var i$32=0;i$320)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var ptr=this._getPixmap(pageIndex,width,height,backgroundColor);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){this._free(ptr);ptr=null}return ptr};function addToArrayAsDictionary(arr,value){var isFound=false;for(var i=0,len=arr.length;i=pageIndex)pages[j]+=1}};CFile.prototype["removePage"]=function(pageIndex){var result=this.pages.splice(pageIndex,1);if(this.fontStreams)for(var i in this.fontStreams){var pages=this.fontStreams[i].pages;for(var j=0;jpageIndex)pages[j]-=
+1;else if(pages[j]==pageIndex)pages.splice(j,1)}return result};self["AscViewer"]["Free"]=function(pointer){CFile.prototype._free(pointer)};self["AscViewer"]["InitializeFonts"]=function(basePath){return CFile.prototype._InitializeFonts(basePath)};self["AscViewer"]["CheckStreamId"]=function(data,status){return CFile.prototype._CheckStreamId(data,status)};self["AscViewer"]["CDrawingFile"]=CFile;self.drawingFile=null})(window,undefined);
diff --git a/pdf/src/engine/drawingfile_ie.js b/pdf/src/engine/drawingfile_ie.js
index fdf89aaccb..ddffd7451b 100644
--- a/pdf/src/engine/drawingfile_ie.js
+++ b/pdf/src/engine/drawingfile_ie.js
@@ -22108,47 +22108,47 @@ len-=4;var buffer=new Uint8Array(Module["HEAP8"].buffer,data+4,len);var reader=n
pageObj.fontsUpdateType=UpdateFontsSource.Undefined}}if(pagesRepaint_Page.length>0&&drawingFile.onRepaintPages)drawingFile.onRepaintPages(pagesRepaint_Page);if(pagesRepaint_Annotation.length>0&&drawingFile.onRepaintAnnotations)drawingFile.onRepaintAnnotations(pagesRepaint_Annotation);if(pagesRepaint_Forms.length>0&&drawingFile.onRepaintForms)drawingFile.onRepaintForms(pagesRepaint_Forms);delete _t.externalCallback};if(2!==file.LoadFontAsync)file.LoadFontAsync(baseFontsPath,null)}}var memoryBuffer=
fileId.toUtf8();var pointer=Module["_malloc"](memoryBuffer.length);Module.HEAP8.set(memoryBuffer,pointer);Module["HEAP8"][status]=fileStatus==0?1:0;return pointer};CFile.prototype.lockPageNumForFontsLoader=function(pageIndex,type){this.fontPageIndex=pageIndex;this.fontPageUpdateType=type};CFile.prototype.unlockPageNumForFontsLoader=function(){this.fontPageIndex=-1;drawingFile.fontPageUpdateType=UpdateFontsSource.Undefined};CFile.prototype.getOriginPage=function(originIndex){for(var i=0;i0)this._free(this.stream);this.stream=-1;self.drawingFile=null};
-CFile.prototype["getFileBinary"]=function(){if(0>=this.stream)return"";return new Uint8Array(Module["HEAP8"].buffer,this.stream,this.stream_size)};CFile.prototype["isNeedPassword"]=function(){return this._isNeedPassword};CFile.prototype.getInfo=function(){if(!this.nativeFile)return false;var ptr=this._getInfo();var reader=ptr.getReader();if(!reader)return false;this.StartID=reader.readInt();var _pages=reader.readInt();for(var i=0;i<_pages;i++){var rec={};rec["W"]=reader.readInt();rec["H"]=reader.readInt();
-rec["Dpi"]=reader.readInt();rec["Rotate"]=reader.readInt();rec["originIndex"]=i;rec.fonts=[];rec.fontsUpdateType=UpdateFontsSource.Undefined;rec.text=null;this.pages.push(rec)}var json_info=reader.readString();try{this.info=JSON.parse(json_info)}catch(err$1){}ptr.free();return this.pages.length>0};CFile.prototype["getStructure"]=function(){var ptr=this._getStructure();var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["page"]=reader.readInt();rec["level"]=
-reader.readInt();rec["y"]=reader.readDouble();rec["description"]=reader.readString();res.push(rec)}ptr.free();return res};CFile.prototype["getLinks"]=function(pageIndex){var ptr=this._getLinks(pageIndex);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["link"]=reader.readString();rec["dest"]=reader.readDouble();rec["x"]=reader.readDouble();rec["y"]=reader.readDouble();rec["w"]=reader.readDouble();rec["h"]=reader.readDouble();res.push(rec)}ptr.free();
-return res};CFile.prototype["getGlyphs"]=function(pageIndex){var i=this.getOriginPage(pageIndex);if(i<0)return null;var page=this.pages[i];if(!page||page.fonts.length>0)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var res=this._getGlyphs(pageIndex);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){res=null;return null}if(res&&this.onUpdateStatistics)this.onUpdateStatistics(res.info[0],res.info[1],res.info[2],res.info[3]);return res.result||null};CFile.prototype["destroyTextInfo"]=
-function(){this._destroyTextInfo()};CFile.prototype.getWidgetFonts=function(type){var ptr=this._getInteractiveFormsFonts(type);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var n=reader.readInt();for(var i=0;i>1&1;var bPrint=rec["annotflag"]>>2&1;rec["noZoom"]=rec["annotflag"]>>3&1;rec["noRotate"]=rec["annotflag"]>>4&1;var bNoView=
-rec["annotflag"]>>5&1;rec["locked"]=rec["annotflag"]>>7&1;rec["ToggleNoView"]=rec["annotflag"]>>8&1;rec["lockedC"]=rec["annotflag"]>>9&1;rec["display"]=0;if(bHidden)rec["display"]=1;else if(bPrint)if(bNoView)rec["display"]=3;else rec["display"]=0;else if(bNoView)rec["display"]=0;else rec["display"]=2;rec["page"]=reader.readInt();rec["rect"]={};rec["rect"]["x1"]=reader.readDouble2();rec["rect"]["y1"]=reader.readDouble2();rec["rect"]["x2"]=reader.readDouble2();rec["rect"]["y2"]=reader.readDouble2();
-var flags=reader.readInt();if(flags&1<<0)rec["UniqueName"]=reader.readString();if(flags&1<<1)rec["Contents"]=reader.readString();if(flags&1<<2){rec["BE"]={};rec["BE"]["S"]=reader.readByte();rec["BE"]["I"]=reader.readDouble()}if(flags&1<<3){var n=reader.readInt();rec["C"]=[];for(var i=0;i>6&1;if(flags&1<<7)rec["OUserID"]=reader.readString()}function readAnnotAP(reader,AP){AP["i"]=reader.readInt();AP["x"]=reader.readInt();AP["y"]=reader.readInt();AP["w"]=reader.readInt();AP["h"]=reader.readInt();var n=reader.readInt();for(var i=0;i0)res["CO"]=[];for(var i=0;i0)res["Parents"]=[];for(var i$6=0;i$6>0&1;rec$12["required"]=rec$12["flag"]>>1&1;rec$12["noexport"]=rec$12["flag"]>>2&1;var flags$14=reader.readInt();if(flags$14&1<<0)rec$12["userName"]=reader.readString();if(flags$14&1<<1)rec$12["defaultStyle"]=reader.readString();if(flags$14&1<<2)rec$12["font"]["actual"]=reader.readString();if(flags$14&1<<3)rec$12["highlight"]=reader.readByte();if(flags$14&1<<4)rec$12["font"]["key"]=reader.readString();if(flags$14&1<<5){var n$15=reader.readInt();rec$12["BC"]=[];for(var i$16=0;i$160)rec$12["AA"]={};for(var i$19=0;i$19>4&1}}else if(rec$12["type"]==29||rec$12["type"]==28){if(flags$14&1<<9)rec$12["value"]=reader.readString();rec$12["style"]=reader.readByte();if(flags$14&1<<14)rec$12["ExportValue"]=reader.readString();rec$12["NoToggleToOff"]=rec$12["flag"]>>14&1;rec$12["radiosInUnison"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==
-30){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10)rec$12["maxLen"]=reader.readInt();if(rec$12["flag"]&1<<25)rec$12["richValue"]=reader.readString();rec$12["multiline"]=rec$12["flag"]>>12&1;rec$12["password"]=rec$12["flag"]>>13&1;rec$12["fileSelect"]=rec$12["flag"]>>20&1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["doNotScroll"]=rec$12["flag"]>>23&1;rec$12["comb"]=rec$12["flag"]>>24&1;rec$12["richText"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==31||rec$12["type"]==
-32){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10){var n$20=reader.readInt();rec$12["opt"]=[];for(var i$21=0;i$21>18&1;rec$12["multipleSelection"]=rec$12["flag"]>>21&1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["commitOnSelChange"]=rec$12["flag"]>>26&1}else if(rec$12["type"]==33)rec$12["Sig"]=flags$14>>9&1;res["Fields"].push(rec$12)}ptr.free();return res};CFile.prototype["getInteractiveFormsAP"]=function(pageIndex,width,height,backgroundColor,nWidget,sView,sButtonView){var nView=
--1;if(sView)if(sView=="N")nView=0;else if(sView=="D")nView=1;else if(sView=="R")nView=2;var nButtonView=-1;if(sButtonView)nButtonView=sButtonView=="Off"?0:1;this.lockPageNumForFontsLoader(pageIndex,UpdateFontsSource.Forms);var ptr=this._getInteractiveFormsAP(width,height,backgroundColor,pageIndex,nWidget,nView,nButtonView);var reader=ptr.getReader();this.unlockPageNumForFontsLoader();if(!reader)return[];var res=[];while(reader.isValid()){var AP={};readAnnotAP(reader,AP);res.push(AP)}ptr.free();return res};
-CFile.prototype["getButtonIcons"]=function(pageIndex,width,height,backgroundColor,bBase64,nWidget,sIconView){var nView=-1;if(sIconView)if(sIconView=="I")nView=0;else if(sIconView=="RI")nView=1;else if(sIconView=="IX")nView=2;var ptr=this._getButtonIcons(backgroundColor,pageIndex,bBase64,nWidget,nView);var reader=ptr.getReader();if(!reader)return{};var res={};res["MK"]=[];res["View"]=[];while(reader.isValid()){var MK={};MK["i"]=reader.readInt();var n=reader.readInt();for(var i=0;i>0&1;oFont["italic"]=nFontFlag>>1&1;oFont["strikethrough"]=nFontFlag>>3&1;oFont["underlined"]=nFontFlag>>4&1;if(nFontFlag&1<<5)oFont["vertical"]=reader.readDouble();if(nFontFlag&1<<6)oFont["actual"]=reader.readString();oFont["size"]=reader.readDouble();oFont["color"]=[];oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["name"]=reader.readString();oFont["text"]=reader.readString();
-rec["RC"].push(oFont)}}if(flags&1<<4)rec["CreationDate"]=reader.readString();if(flags&1<<5)rec["RefTo"]=reader.readInt();if(flags&1<<6)rec["RefToReason"]=reader.readByte();if(flags&1<<7)rec["Subj"]=reader.readString()}if(rec["Type"]==0){if(rec["C"]){rec["IC"]=rec["C"];delete rec["C"]}rec["Open"]=flags>>15&1;if(flags&1<<16)rec["Icon"]=reader.readByte();if(flags&1<<17)rec["StateModel"]=reader.readByte();if(flags&1<<18)rec["State"]=reader.readByte()}else if(rec["Type"]==3){rec["L"]=[];for(var i$26=0;i$26<
-4;++i$26)rec["L"].push(reader.readDouble());if(flags&1<<15){rec["LE"]=[];rec["LE"].push(reader.readByte());rec["LE"].push(reader.readByte())}if(flags&1<<16){var n$27=reader.readInt();rec["IC"]=[];for(var i$28=0;i$28>19&1;if(flags&1<<20)rec["IT"]=reader.readByte();if(flags&1<<21)rec["LLO"]=reader.readDouble();if(flags&1<<22)rec["CP"]=reader.readByte();
-if(flags&1<<23){rec["CO"]=[];rec["CO"].push(reader.readDouble());rec["CO"].push(reader.readDouble())}}else if(rec["Type"]==14){var n$29=reader.readInt();rec["InkList"]=[];for(var i$30=0;i$307&&rec["Type"]<12){var n$31=reader.readInt();rec["QuadPoints"]=[];for(var i$32=0;i$320)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var ptr=this._getPixmap(pageIndex,width,height,backgroundColor);this.unlockPageNumForFontsLoader();
-if(page.fonts.length>0){this._free(ptr);ptr=null}return ptr};function addToArrayAsDictionary(arr,value){var isFound=false;for(var i=0,len=arr.length;i=pageIndex)pages[j]+=1}};CFile.prototype["removePage"]=function(pageIndex){var result=this.pages.splice(pageIndex,1);if(this.fontStreams)for(var i in this.fontStreams){var pages=this.fontStreams[i].pages;for(var j=0;jpageIndex)pages[j]-=1;else if(pages[j]==pageIndex)pages.splice(j,1)}return result};self["AscViewer"]["Free"]=function(pointer){CFile.prototype._free(pointer)};self["AscViewer"]["InitializeFonts"]=function(basePath){return CFile.prototype._InitializeFonts(basePath)};
-self["AscViewer"]["CheckStreamId"]=function(data,status){return CFile.prototype._CheckStreamId(data,status)};self["AscViewer"]["CDrawingFile"]=CFile;self.drawingFile=null})(window,undefined);
+CFile.prototype["loadFromDataWithPassword"]=function(password){if(0!=this.nativeFile)this._closeFile();var isSuccess=this._openFile(undefined,password);var error=this._getError();this.type=this._getType();self.drawingFile=this;if(!error)this.getInfo();this._isNeedPassword=4===error?true:false;return error};CFile.prototype["getType"]=function(){return this.type};CFile.prototype["close"]=function(){this._closeFile();this.nativeFile=0;this.pages=[];this.info=null;this.StartID=null;if(this.stream>0)this._free(this.stream);
+this.stream=-1;self.drawingFile=null};CFile.prototype["getFileBinary"]=function(){if(0>=this.stream)return"";return new Uint8Array(Module["HEAP8"].buffer,this.stream,this.stream_size)};CFile.prototype["isNeedPassword"]=function(){return this._isNeedPassword};CFile.prototype.getInfo=function(){if(!this.nativeFile)return false;var ptr=this._getInfo();var reader=ptr.getReader();if(!reader)return false;this.StartID=reader.readInt();var _pages=reader.readInt();for(var i=0;i<_pages;i++){var rec={};rec["W"]=
+reader.readInt();rec["H"]=reader.readInt();rec["Dpi"]=reader.readInt();rec["Rotate"]=reader.readInt();rec["originIndex"]=i;rec.fonts=[];rec.fontsUpdateType=UpdateFontsSource.Undefined;rec.text=null;this.pages.push(rec)}var json_info=reader.readString();try{this.info=JSON.parse(json_info)}catch(err$1){}ptr.free();return this.pages.length>0};CFile.prototype["getStructure"]=function(){var ptr=this._getStructure();var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec=
+{};rec["page"]=reader.readInt();rec["level"]=reader.readInt();rec["y"]=reader.readDouble();rec["description"]=reader.readString();res.push(rec)}ptr.free();return res};CFile.prototype["getLinks"]=function(pageIndex){var ptr=this._getLinks(pageIndex);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["link"]=reader.readString();rec["dest"]=reader.readDouble();rec["x"]=reader.readDouble();rec["y"]=reader.readDouble();rec["w"]=reader.readDouble();rec["h"]=
+reader.readDouble();res.push(rec)}ptr.free();return res};CFile.prototype["getGlyphs"]=function(pageIndex){var i=this.getOriginPage(pageIndex);if(i<0)return null;var page=this.pages[i];if(!page||page.fonts.length>0)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var res=this._getGlyphs(pageIndex);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){res=null;return null}if(res&&this.onUpdateStatistics)this.onUpdateStatistics(res.info[0],res.info[1],res.info[2],res.info[3]);
+return res.result||null};CFile.prototype["destroyTextInfo"]=function(){this._destroyTextInfo()};CFile.prototype.getWidgetFonts=function(type){var ptr=this._getInteractiveFormsFonts(type);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var n=reader.readInt();for(var i=0;i>1&1;var bPrint=rec["annotflag"]>>2&1;rec["noZoom"]=
+rec["annotflag"]>>3&1;rec["noRotate"]=rec["annotflag"]>>4&1;var bNoView=rec["annotflag"]>>5&1;rec["locked"]=rec["annotflag"]>>7&1;rec["ToggleNoView"]=rec["annotflag"]>>8&1;rec["lockedC"]=rec["annotflag"]>>9&1;rec["display"]=0;if(bHidden)rec["display"]=1;else if(bPrint)if(bNoView)rec["display"]=3;else rec["display"]=0;else if(bNoView)rec["display"]=0;else rec["display"]=2;rec["page"]=reader.readInt();rec["rect"]={};rec["rect"]["x1"]=reader.readDouble2();rec["rect"]["y1"]=reader.readDouble2();rec["rect"]["x2"]=
+reader.readDouble2();rec["rect"]["y2"]=reader.readDouble2();var flags=reader.readInt();if(flags&1<<0)rec["UniqueName"]=reader.readString();if(flags&1<<1)rec["Contents"]=reader.readString();if(flags&1<<2){rec["BE"]={};rec["BE"]["S"]=reader.readByte();rec["BE"]["I"]=reader.readDouble()}if(flags&1<<3){var n=reader.readInt();rec["C"]=[];for(var i=0;i>6&1;if(flags&1<<7)rec["OUserID"]=reader.readString()}function readAnnotAP(reader,AP){AP["i"]=reader.readInt();AP["x"]=reader.readInt();AP["y"]=reader.readInt();AP["w"]=reader.readInt();AP["h"]=reader.readInt();var n=reader.readInt();for(var i=0;i0)res["CO"]=[];for(var i=0;i0)res["Parents"]=
+[];for(var i$6=0;i$6>0&1;rec$12["required"]=rec$12["flag"]>>1&1;rec$12["noexport"]=rec$12["flag"]>>2&1;var flags$14=reader.readInt();if(flags$14&1<<0)rec$12["userName"]=reader.readString();if(flags$14&1<<1)rec$12["defaultStyle"]=reader.readString();if(flags$14&1<<2)rec$12["font"]["actual"]=reader.readString();if(flags$14&1<<3)rec$12["highlight"]=reader.readByte();
+if(flags$14&1<<4)rec$12["font"]["key"]=reader.readString();if(flags$14&1<<5){var n$15=reader.readInt();rec$12["BC"]=[];for(var i$16=0;i$160)rec$12["AA"]={};for(var i$19=0;i$19>4&1}}else if(rec$12["type"]==29||rec$12["type"]==28){if(flags$14&1<<9)rec$12["value"]=reader.readString();
+rec$12["style"]=reader.readByte();if(flags$14&1<<14)rec$12["ExportValue"]=reader.readString();rec$12["NoToggleToOff"]=rec$12["flag"]>>14&1;rec$12["radiosInUnison"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==30){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10)rec$12["maxLen"]=reader.readInt();if(rec$12["flag"]&1<<25)rec$12["richValue"]=reader.readString();rec$12["multiline"]=rec$12["flag"]>>12&1;rec$12["password"]=rec$12["flag"]>>13&1;rec$12["fileSelect"]=rec$12["flag"]>>20&
+1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["doNotScroll"]=rec$12["flag"]>>23&1;rec$12["comb"]=rec$12["flag"]>>24&1;rec$12["richText"]=rec$12["flag"]>>25&1}else if(rec$12["type"]==31||rec$12["type"]==32){if(flags$14&1<<9)rec$12["value"]=reader.readString();if(flags$14&1<<10){var n$20=reader.readInt();rec$12["opt"]=[];for(var i$21=0;i$21>18&1;rec$12["multipleSelection"]=rec$12["flag"]>>21&1;rec$12["doNotSpellCheck"]=rec$12["flag"]>>22&1;rec$12["commitOnSelChange"]=rec$12["flag"]>>26&1}else if(rec$12["type"]==
+33)rec$12["Sig"]=flags$14>>9&1;res["Fields"].push(rec$12)}ptr.free();return res};CFile.prototype["getInteractiveFormsAP"]=function(pageIndex,width,height,backgroundColor,nWidget,sView,sButtonView){var nView=-1;if(sView)if(sView=="N")nView=0;else if(sView=="D")nView=1;else if(sView=="R")nView=2;var nButtonView=-1;if(sButtonView)nButtonView=sButtonView=="Off"?0:1;this.lockPageNumForFontsLoader(pageIndex,UpdateFontsSource.Forms);var ptr=this._getInteractiveFormsAP(width,height,backgroundColor,pageIndex,
+nWidget,nView,nButtonView);var reader=ptr.getReader();this.unlockPageNumForFontsLoader();if(!reader)return[];var res=[];while(reader.isValid()){var AP={};readAnnotAP(reader,AP);res.push(AP)}ptr.free();return res};CFile.prototype["getButtonIcons"]=function(pageIndex,width,height,backgroundColor,bBase64,nWidget,sIconView){var nView=-1;if(sIconView)if(sIconView=="I")nView=0;else if(sIconView=="RI")nView=1;else if(sIconView=="IX")nView=2;var ptr=this._getButtonIcons(backgroundColor,pageIndex,bBase64,
+nWidget,nView);var reader=ptr.getReader();if(!reader)return{};var res={};res["MK"]=[];res["View"]=[];while(reader.isValid()){var MK={};MK["i"]=reader.readInt();var n=reader.readInt();for(var i=0;i>0&1;oFont["italic"]=nFontFlag>>1&1;oFont["strikethrough"]=nFontFlag>>3&1;oFont["underlined"]=nFontFlag>>4&1;if(nFontFlag&1<<5)oFont["vertical"]=reader.readDouble();if(nFontFlag&1<<6)oFont["actual"]=reader.readString();
+oFont["size"]=reader.readDouble();oFont["color"]=[];oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["color"].push(reader.readDouble2());oFont["name"]=reader.readString();oFont["text"]=reader.readString();rec["RC"].push(oFont)}}if(flags&1<<4)rec["CreationDate"]=reader.readString();if(flags&1<<5)rec["RefTo"]=reader.readInt();if(flags&1<<6)rec["RefToReason"]=reader.readByte();if(flags&1<<7)rec["Subj"]=reader.readString()}if(rec["Type"]==0){if(rec["C"]){rec["IC"]=
+rec["C"];delete rec["C"]}rec["Open"]=flags>>15&1;if(flags&1<<16)rec["Icon"]=reader.readByte();if(flags&1<<17)rec["StateModel"]=reader.readByte();if(flags&1<<18)rec["State"]=reader.readByte()}else if(rec["Type"]==3){rec["L"]=[];for(var i$26=0;i$26<4;++i$26)rec["L"].push(reader.readDouble());if(flags&1<<15){rec["LE"]=[];rec["LE"].push(reader.readByte());rec["LE"].push(reader.readByte())}if(flags&1<<16){var n$27=reader.readInt();rec["IC"]=[];for(var i$28=0;i$28>19&1;if(flags&1<<20)rec["IT"]=reader.readByte();if(flags&1<<21)rec["LLO"]=reader.readDouble();if(flags&1<<22)rec["CP"]=reader.readByte();if(flags&1<<23){rec["CO"]=[];rec["CO"].push(reader.readDouble());rec["CO"].push(reader.readDouble())}}else if(rec["Type"]==14){var n$29=reader.readInt();rec["InkList"]=[];for(var i$30=0;i$307&&rec["Type"]<12){var n$31=reader.readInt();rec["QuadPoints"]=[];for(var i$32=0;i$320)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var ptr=this._getPixmap(pageIndex,width,height,backgroundColor);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){this._free(ptr);ptr=null}return ptr};function addToArrayAsDictionary(arr,value){var isFound=false;for(var i=0,len=arr.length;i=pageIndex)pages[j]+=1}};CFile.prototype["removePage"]=function(pageIndex){var result=this.pages.splice(pageIndex,1);if(this.fontStreams)for(var i in this.fontStreams){var pages=this.fontStreams[i].pages;for(var j=0;jpageIndex)pages[j]-=
+1;else if(pages[j]==pageIndex)pages.splice(j,1)}return result};self["AscViewer"]["Free"]=function(pointer){CFile.prototype._free(pointer)};self["AscViewer"]["InitializeFonts"]=function(basePath){return CFile.prototype._InitializeFonts(basePath)};self["AscViewer"]["CheckStreamId"]=function(data,status){return CFile.prototype._CheckStreamId(data,status)};self["AscViewer"]["CDrawingFile"]=CFile;self.drawingFile=null})(window,undefined);
diff --git a/pdf/src/engine/drawingfile_native.js b/pdf/src/engine/drawingfile_native.js
index abbe9d0268..c632571331 100644
--- a/pdf/src/engine/drawingfile_native.js
+++ b/pdf/src/engine/drawingfile_native.js
@@ -47,12 +47,12 @@ pageIndex,nAnnot,nView){g_module_pointer.ptr=g_native_drawing_file["GetAnnotatio
-1:nWidget,nView,nButtonView);return g_module_pointer};CFile.prototype._scanPage=function(page,mode){g_module_pointer.ptr=g_native_drawing_file["ScanPage"](page,mode===undefined?0:mode);return g_module_pointer};CFile.prototype._getImageBase64=function(rId){return g_native_drawing_file["GetImageBase64"](rId)};CFile.prototype._getGlyphs=function(pageIndex){var res={};res.info=[0,0,0,0];res.result=[];return res};CFile.prototype._destroyTextInfo=function(){g_native_drawing_file["DestroyTextInfo"](rId)};
CFile.prototype._getPixmap=function(pageIndex,width,height,backgroundColor){return null};CFile.prototype._InitializeFonts=function(basePath){};CFile.prototype._CheckStreamId=function(data,status){};CFile.prototype.lockPageNumForFontsLoader=function(pageIndex,type){this.fontPageIndex=pageIndex;this.fontPageUpdateType=type};CFile.prototype.unlockPageNumForFontsLoader=function(){this.fontPageIndex=-1;drawingFile.fontPageUpdateType=UpdateFontsSource.Undefined};CFile.prototype.getOriginPage=function(originIndex){for(var i=
0;i0)this._free(this.stream);
-this.stream=-1;self.drawingFile=null};CFile.prototype["getFileBinary"]=function(){if(0>=this.stream)return"";return new Uint8Array(Module["HEAP8"].buffer,this.stream,this.stream_size)};CFile.prototype["isNeedPassword"]=function(){return this._isNeedPassword};CFile.prototype.getInfo=function(){if(!this.nativeFile)return false;var ptr=this._getInfo();var reader=ptr.getReader();if(!reader)return false;this.StartID=reader.readInt();var _pages=reader.readInt();for(var i=0;i<_pages;i++){var rec={};rec["W"]=
-reader.readInt();rec["H"]=reader.readInt();rec["Dpi"]=reader.readInt();rec["Rotate"]=reader.readInt();rec["originIndex"]=i;rec.fonts=[];rec.fontsUpdateType=UpdateFontsSource.Undefined;rec.text=null;this.pages.push(rec)}var json_info=reader.readString();try{this.info=JSON.parse(json_info)}catch(err){}ptr.free();return this.pages.length>0};CFile.prototype["getStructure"]=function(){var ptr=this._getStructure();var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec=
-{};rec["page"]=reader.readInt();rec["level"]=reader.readInt();rec["y"]=reader.readDouble();rec["description"]=reader.readString();res.push(rec)}ptr.free();return res};CFile.prototype["getLinks"]=function(pageIndex){var ptr=this._getLinks(pageIndex);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["link"]=reader.readString();rec["dest"]=reader.readDouble();rec["x"]=reader.readDouble();rec["y"]=reader.readDouble();rec["w"]=reader.readDouble();rec["h"]=
-reader.readDouble();res.push(rec)}ptr.free();return res};CFile.prototype["getGlyphs"]=function(pageIndex){var i=this.getOriginPage(pageIndex);if(i<0)return null;var page=this.pages[i];if(!page||page.fonts.length>0)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var res=this._getGlyphs(pageIndex);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){res=null;return null}if(res&&this.onUpdateStatistics)this.onUpdateStatistics(res.info[0],res.info[1],res.info[2],res.info[3]);
-return res.result||null};CFile.prototype["destroyTextInfo"]=function(){this._destroyTextInfo()};CFile.prototype.getWidgetFonts=function(type){var ptr=this._getInteractiveFormsFonts(type);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var n=reader.readInt();for(var i=0;i0)this._free(this.stream);this.stream=-1;self.drawingFile=null};CFile.prototype["getFileBinary"]=function(){if(0>=this.stream)return"";return new Uint8Array(Module["HEAP8"].buffer,this.stream,this.stream_size)};CFile.prototype["isNeedPassword"]=function(){return this._isNeedPassword};CFile.prototype.getInfo=function(){if(!this.nativeFile)return false;var ptr=this._getInfo();var reader=ptr.getReader();if(!reader)return false;this.StartID=reader.readInt();
+var _pages=reader.readInt();for(var i=0;i<_pages;i++){var rec={};rec["W"]=reader.readInt();rec["H"]=reader.readInt();rec["Dpi"]=reader.readInt();rec["Rotate"]=reader.readInt();rec["originIndex"]=i;rec.fonts=[];rec.fontsUpdateType=UpdateFontsSource.Undefined;rec.text=null;this.pages.push(rec)}var json_info=reader.readString();try{this.info=JSON.parse(json_info)}catch(err){}ptr.free();return this.pages.length>0};CFile.prototype["getStructure"]=function(){var ptr=this._getStructure();var reader=ptr.getReader();
+if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["page"]=reader.readInt();rec["level"]=reader.readInt();rec["y"]=reader.readDouble();rec["description"]=reader.readString();res.push(rec)}ptr.free();return res};CFile.prototype["getLinks"]=function(pageIndex){var ptr=this._getLinks(pageIndex);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var rec={};rec["link"]=reader.readString();rec["dest"]=reader.readDouble();rec["x"]=reader.readDouble();rec["y"]=
+reader.readDouble();rec["w"]=reader.readDouble();rec["h"]=reader.readDouble();res.push(rec)}ptr.free();return res};CFile.prototype["getGlyphs"]=function(pageIndex){var i=this.getOriginPage(pageIndex);if(i<0)return null;var page=this.pages[i];if(!page||page.fonts.length>0)return null;this.lockPageNumForFontsLoader(i,UpdateFontsSource.Page);var res=this._getGlyphs(pageIndex);this.unlockPageNumForFontsLoader();if(page.fonts.length>0){res=null;return null}if(res&&this.onUpdateStatistics)this.onUpdateStatistics(res.info[0],
+res.info[1],res.info[2],res.info[3]);return res.result||null};CFile.prototype["destroyTextInfo"]=function(){this._destroyTextInfo()};CFile.prototype.getWidgetFonts=function(type){var ptr=this._getInteractiveFormsFonts(type);var reader=ptr.getReader();if(!reader)return[];var res=[];while(reader.isValid()){var n=reader.readInt();for(var i=0;i>1&1;var bPrint=rec["annotflag"]>>2&1;rec["noZoom"]=
diff --git a/pdf/src/file.js b/pdf/src/file.js
index c85113dae9..febcba7efd 100644
--- a/pdf/src/file.js
+++ b/pdf/src/file.js
@@ -150,6 +150,7 @@
this.isUse3d = false;
this.cacheManager = null;
this.logging = true;
+ this.type = -1;
this.Selection = {
Page1 : 0,
@@ -661,6 +662,13 @@ void main() {\n\
if (!stream)
return { Line : -1, Glyph : -1 };
+ if (this.type === 2)
+ {
+ let k = 72 / 96;
+ x *= k;
+ y *= k;
+ }
+
// textline parameters
var _line = -1;
var _glyph = -1;
@@ -815,7 +823,17 @@ void main() {\n\
return { Line : _line, Glyph : _glyph };
}
- tmp = Math.abs(y - _lineY);
+ if (_distX >= 0 && _distX <= _lineWidth)
+ tmp = Math.abs(y - _lineY);
+ else if (_distX < 0)
+ {
+ tmp = Math.sqrt((x - _lineX) * (x - _lineX) + (y - _lineY) * (y - _lineY));
+ }
+ else
+ {
+ var _xx1 = _lineX + _lineWidth;
+ tmp = Math.sqrt((x - _xx1) * (x - _xx1) + (y - _lineY) * (y - _lineY));
+ }
if (tmp < _minDist)
{
@@ -2814,6 +2832,8 @@ void main() {\n\
var error = file.nativeFile["loadFromData"](data);
if (0 === error)
{
+ file.type = file.nativeFile["getType"]();
+
file.nativeFile["onRepaintPages"] = function(pages) {
file.onRepaintPages && file.onRepaintPages(pages);
};
@@ -2859,6 +2879,8 @@ void main() {\n\
var error = file.nativeFile["loadFromDataWithPassword"](password);
if (0 === error)
{
+ file.type = file.nativeFile["getType"]();
+
file.nativeFile["onRepaintPages"] = function(pages) {
file.onRepaintPages && file.onRepaintPages(pages);
};
diff --git a/pdf/src/thumbnails.js b/pdf/src/thumbnails.js
index dcada52851..caf12de105 100644
--- a/pdf/src/thumbnails.js
+++ b/pdf/src/thumbnails.js
@@ -495,7 +495,7 @@
{
let pdfDoc = this.viewer.getPDFDoc();
- if (pdfDoc.fontLoader.isWorking())
+ if (pdfDoc.fontLoader.isWorking() || AscCommon.CollaborativeEditing.waitingImagesForLoad)
return true;
var isNeedTasks = false;
diff --git a/pdf/src/viewer.js b/pdf/src/viewer.js
index fdac7f47b9..83d0471f3b 100644
--- a/pdf/src/viewer.js
+++ b/pdf/src/viewer.js
@@ -2008,6 +2008,9 @@
return res;
}
+ if (oThis.touchManager)
+ oThis.touchManager.checkMouseFocus(e);
+
oThis.isFocusOnThumbnails = false;
AscCommon.stopEvent(e);
diff --git a/slide/Drawing/HtmlPage.js b/slide/Drawing/HtmlPage.js
index d830b42c7f..05bf6d4224 100644
--- a/slide/Drawing/HtmlPage.js
+++ b/slide/Drawing/HtmlPage.js
@@ -292,7 +292,7 @@ function CEditorPage(api)
this.DrawingFreeze = false;
this.NoneRepaintPages = false;
- this.paintMessageLoop = new AscCommon.PaintMessageLoop(40);
+ this.paintMessageLoop = new AscCommon.PaintMessageLoop(40, api);
this.MouseHandObject = null;
@@ -1514,7 +1514,7 @@ function CEditorPage(api)
this.initEventsMobile = function()
{
- if (this.m_oApi.isMobileVersion)
+ if (this.m_oApi.isUseOldMobileVersion())
{
this.MobileTouchManager = new AscCommon.CMobileTouchManager( { eventsElement : "slides_mobile_element" } );
this.MobileTouchManager.Init(this.m_oApi);
@@ -1558,6 +1558,8 @@ function CEditorPage(api)
this.MobileTouchManager = new AscCommon.CMobileTouchManager( { eventsElement : "slides_mobile_element", desktopMode : true } );
this.MobileTouchManager.Init(this.m_oApi);
+ this.MobileTouchManager.addClickElement([this.m_oEditor.HtmlElement, this.m_oOverlay.HtmlElement]);
+
this.MobileTouchManagerThumbnails = new AscCommon.CMobileTouchManagerThumbnails( { eventsElement : "slides_mobile_element", desktopMode : true } );
this.MobileTouchManagerThumbnails.Init(this.m_oApi);
}
@@ -3293,6 +3295,9 @@ function CEditorPage(api)
return res;
}
+ if (oThis.MobileTouchManager)
+ oThis.MobileTouchManager.checkMouseFocus(e);
+
oThis.m_oApi.checkInterfaceElementBlur();
oThis.m_oApi.checkLastWork();
@@ -3830,9 +3835,18 @@ function CEditorPage(api)
oThis.m_nVerticalSlideChangeOnScrollEnabled = true;
- if (0 != deltaX)
+ let isSupportDirections2 = false;
+ if (!isSupportDirections2)
+ {
+ if (Math.abs(deltaY) >= Math.abs(deltaX))
+ deltaX = 0;
+ else
+ deltaY = 0;
+ }
+
+ if (0 !== deltaX)
oThis.m_oScrollHorApi.scrollBy(deltaX, 0, false);
- else if (0 != deltaY)
+ if (0 !== deltaY)
oThis.m_oScrollVerApi.scrollBy(0, deltaY, false);
oThis.m_nVerticalSlideChangeOnScrollEnabled = false;
diff --git a/slide/Drawing/mobileTouchManager.js b/slide/Drawing/mobileTouchManager.js
index 3a9080aaea..3b37627bb4 100644
--- a/slide/Drawing/mobileTouchManager.js
+++ b/slide/Drawing/mobileTouchManager.js
@@ -1010,6 +1010,9 @@
if (true !== this.iScroll.isAnimating)
this.CheckContextMenuTouchEnd(isCheckContextMenuMode, isCheckContextMenuSelect, isCheckContextMenuCursor, isCheckContextMenuTableRuler);
+ if (!isPreventDefault && this.Api.isMobileVersion && !this.Api.isUseOldMobileVersion())
+ this.showKeyboard();
+
return false;
};
@@ -1018,6 +1021,8 @@
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
+ this.removeHandlersOnClick();
+
if (!this.Api.asc_IsFocus())
this.Api.asc_enableKeyEvents(true);
diff --git a/word/Drawing/HtmlPage.js b/word/Drawing/HtmlPage.js
index 33414b573d..220b222740 100644
--- a/word/Drawing/HtmlPage.js
+++ b/word/Drawing/HtmlPage.js
@@ -207,7 +207,7 @@ function CEditorPage(api)
this.IsInitControl = false;
// paint loop
- this.paintMessageLoop = new AscCommon.PaintMessageLoop(40);
+ this.paintMessageLoop = new AscCommon.PaintMessageLoop(40, api);
this.m_oApi = api;
var oThis = this;
@@ -495,7 +495,7 @@ function CEditorPage(api)
this.initEventsMobile = function()
{
- if (this.m_oApi.isMobileVersion)
+ if (this.m_oApi.isUseOldMobileVersion())
{
this.MobileTouchManager = new AscCommon.CMobileTouchManager( { eventsElement : "word_mobile_element" } );
this.MobileTouchManager.Init(this.m_oApi);
@@ -535,6 +535,8 @@ function CEditorPage(api)
this.MobileTouchManager = new AscCommon.CMobileTouchManager( { eventsElement : "word_mobile_element", desktopMode : true } );
this.MobileTouchManager.Init(this.m_oApi);
this.MobileTouchManager.Resize();
+
+ this.MobileTouchManager.addClickElement([this.m_oEditor.HtmlElement, this.m_oOverlay.HtmlElement]);
}
};
@@ -1727,6 +1729,9 @@ function CEditorPage(api)
return res;
}
+ if (oThis.MobileTouchManager)
+ oThis.MobileTouchManager.checkMouseFocus(e);
+
oThis.m_oApi.checkInterfaceElementBlur();
oThis.m_oApi.checkLastWork();
@@ -2292,7 +2297,7 @@ function CEditorPage(api)
// пошлем сначала моусдаун
//oWordControl.m_oLogicDocument.OnMouseDown(global_mouseEvent, pos.X, pos.Y, pos.Page);
}
- if(!oThis.checkFinishEyedropper())
+ if (!oThis.checkFinishEyedropper())
{
if (bIsSendedToEditor)
oWordControl.m_oLogicDocument.OnMouseUp(global_mouseEvent, pos.X, pos.Y, pos.Page);
@@ -2302,8 +2307,12 @@ function CEditorPage(api)
oWordControl.MouseDownDocumentCounter = 0;
oWordControl.m_bIsMouseUpSend = false;
- oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();
- oWordControl.m_oLogicDocument.Document_UpdateRulersState();
+
+ if (bIsSendedToEditor)
+ {
+ oWordControl.m_oLogicDocument.Document_UpdateInterfaceState();
+ oWordControl.m_oLogicDocument.Document_UpdateRulersState();
+ }
oWordControl.EndUpdateOverlay();
};
@@ -2380,9 +2389,18 @@ function CEditorPage(api)
deltaX >>= 0;
deltaY >>= 0;
- if (0 != deltaX)
+ let isSupportDirections2 = false;
+ if (!isSupportDirections2)
+ {
+ if (Math.abs(deltaY) >= Math.abs(deltaX))
+ deltaX = 0;
+ else
+ deltaY = 0;
+ }
+
+ if (0 !== deltaX)
oThis.m_oScrollHorApi.scrollBy(deltaX, 0, false);
- else if (0 != deltaY)
+ if (0 !== deltaY)
oThis.m_oScrollVerApi.scrollBy(0, deltaY, false);
// здесь - имитируем моус мув ---------------------------
diff --git a/word/Drawing/Rulers.js b/word/Drawing/Rulers.js
index 5c03c16616..a600fa903d 100644
--- a/word/Drawing/Rulers.js
+++ b/word/Drawing/Rulers.js
@@ -2270,6 +2270,8 @@ function CHorRuler()
this.m_oWordControl.m_oLogicDocument.SetParagraphTabs(_arr);
this.m_oWordControl.m_oLogicDocument.FinalizeAction();
}
+ this.m_oWordControl.m_oLogicDocument.UpdateSelection();
+ this.m_oWordControl.m_oLogicDocument.UpdateInterface();
}
this.SetPrProperties = function(isTemporary)
@@ -2280,7 +2282,11 @@ function CHorRuler()
let logicDocument = this.m_oWordControl.m_oLogicDocument;
if (logicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Properties))
+ {
+ logicDocument.UpdateSelection();
+ logicDocument.UpdateInterface();
return;
+ }
isTemporary = isTemporary && logicDocument.IsDocumentEditor();
@@ -2311,8 +2317,8 @@ function CHorRuler()
this.m_oWordControl.m_oLogicDocument.SetDocumentMargin( { Left : this.m_dMarginLeft, Right : this.m_dMarginRight }, true);
this.m_oWordControl.m_oLogicDocument.FinalizeAction();
}
- //oWordControl.m_oLogicDocument.SetParagraphIndent( { Left : this.m_dIndentLeft, Right : this.m_dIndentRight,
- // FirstLine: (this.m_dIndentLeftFirst - this.m_dIndentLeft) } );
+ this.m_oWordControl.m_oLogicDocument.UpdateSelection();
+ this.m_oWordControl.m_oLogicDocument.UpdateInterface();
}
this.SetTableProperties = function()
@@ -2326,11 +2332,12 @@ function CHorRuler()
if (this.m_oTableMarkup)
this.m_oTableMarkup.CorrectFrom();
- this.m_oWordControl.m_oLogicDocument.UpdateInterface();
this.m_oWordControl.m_oLogicDocument.UpdateRulers();
this.m_oWordControl.m_oLogicDocument.FinalizeAction();
}
- }
+ this.m_oWordControl.m_oLogicDocument.UpdateSelection();
+ this.m_oWordControl.m_oLogicDocument.UpdateInterface();
+ }
this.SetColumnsProperties = function()
{
diff --git a/word/Drawing/mobileTouchManager.js b/word/Drawing/mobileTouchManager.js
index 64526a7ed6..24cf0bddf3 100644
--- a/word/Drawing/mobileTouchManager.js
+++ b/word/Drawing/mobileTouchManager.js
@@ -153,6 +153,9 @@
}
}
+ if (!isLockedTouch && this.delegate.IsLockedZoom())
+ isLockedTouch = true;
+
if (!isLockedTouch && (2 === touchesCount))
{
this.Mode = AscCommon.MobileTouchMode.Zoom;
@@ -374,7 +377,8 @@
}
else
{
- this.iScroll._move(e);
+ if (this.MoveAfterDown)
+ this.iScroll._move(e);
AscCommon.stopEvent(e);
}
break;
@@ -731,6 +735,9 @@
if (AscCommon.g_inputContext.isHardCheckKeyboard)
isPreventDefault ? AscCommon.g_inputContext.preventVirtualKeyboard_Hard() : AscCommon.g_inputContext.enableVirtualKeyboard_Hard();
+ if (!isPreventDefault && this.Api.isMobileVersion && !this.Api.isUseOldMobileVersion())
+ this.showKeyboard();
+
return false;
};
@@ -739,6 +746,8 @@
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
+ this.removeHandlersOnClick();
+
if (!this.Api.asc_IsFocus())
this.Api.asc_enableKeyEvents(true);
diff --git a/word/Editor/Comments.js b/word/Editor/Comments.js
index 6f16b43216..4b1ef02b42 100644
--- a/word/Editor/Comments.js
+++ b/word/Editor/Comments.js
@@ -1403,7 +1403,7 @@ ParaComment.prototype.IsUseInDocument = function()
return false;
return oParagraph.IsUseInDocument();
-}
+};
ParaComment.prototype.RemoveMark = function()
{
var oParagraph = this.GetParagraph();
diff --git a/word/Editor/Comparison.js b/word/Editor/Comparison.js
index 0aa6fdeb2c..4f04646131 100644
--- a/word/Editor/Comparison.js
+++ b/word/Editor/Comparison.js
@@ -849,7 +849,7 @@
const oNode = oChange.insert[oChange.insert.length - 1];
const oLastText = oNode.element;
const oEndOfInsertRun = oNode.getContentElement();
- const oParentParagraph = (this.partner && this.partner.element) || oEndOfInsertRun.Paragraph;
+ const oParentParagraph = (this.partner && this.partner.element) || oEndOfInsertRun.GetParent();
const applyingParagraph = this.getApplyParagraph(comparison);
const arrEndBookmarks = oNode.getLastBookmarks();
if (arrEndBookmarks)
@@ -964,7 +964,7 @@
const oLastElement = oLastNode.getContentElement();
const applyingParagraph = this.getApplyParagraph(comparison);
- const oParentParagraph = (this.partner && this.partner.element) || oLastElement.Paragraph;
+ const oParentParagraph = (this.partner && this.partner.element) || oLastElement.GetParent();
let k = posOfLastInsertRun;
let lastCheckRun;
for(k -= 1; k > -1; --k)
@@ -4232,7 +4232,7 @@
const oLastElement = this.elements[this.elementIndex];
this.innerElementIndex = oLastElement.elements.length - 1;
const oLastRun = oLastElement.lastRun;
- const oParent = oLastRun.Paragraph;
+ const oParent = oLastRun.GetParent();
this.parent = oParent;
const oContent = oParent.Content;
for (let i = oContent.length - 1; i >= 0; i -= 1) {
diff --git a/word/Editor/Document.js b/word/Editor/Document.js
index 3c60bf0dca..66a93ea0aa 100644
--- a/word/Editor/Document.js
+++ b/word/Editor/Document.js
@@ -2184,6 +2184,9 @@ function CDocument(DrawingDocument, isMainLogicDocument)
// Класс, управляющий полями
this.FieldsManager = new CDocumentFieldsManager();
+
+ if (typeof AscWord.PermRangesManager !== "undefined")
+ this.PermRangesManager = new AscWord.PermRangesManager(this);
// Класс, управляющий закладками
if (typeof CBookmarksManager !== "undefined")
@@ -2948,6 +2951,9 @@ CDocument.prototype.FinalizeUndoRedoAction = function()
if (this.Action.Additional.ContentControlChange)
this.private_FinalizeContentControlChange();
+ this.Comments.CheckMarks();
+ this.PermRangesManager.updateMarks();
+
this.Action.UndoRedo = false;
this.Action.Additional = {};
@@ -2987,6 +2993,7 @@ CDocument.prototype.private_CheckAdditionalOnFinalize = function()
this.Action.Additional.Start = true;
this.Comments.CheckMarks();
+ this.PermRangesManager.updateMarks();
if (this.Action.Additional.TrackMove)
this.private_FinalizeRemoveTrackMove();
@@ -3018,6 +3025,9 @@ CDocument.prototype.private_CheckAdditionalOnFinalize = function()
if (this.Action.Additional.ContentControlChange)
this.private_FinalizeContentControlChange();
+ if (this.Action.Additional.DeletedAnnotationMarks)
+ this.private_FinalizeDeletingAnnotationsMarks();
+
if (this.OFormDocument)
this.OFormDocument.onEndAction();
@@ -3237,6 +3247,53 @@ CDocument.prototype.private_FinalizeContentControlChange = function()
this.Api.asc_OnChangeContentControl(this.Action.Additional.ContentControlChange[sId]);
}
};
+CDocument.prototype.private_FinalizeDeletingAnnotationsMarks = function()
+{
+ let docState = this.SaveDocumentState();
+
+ let permMarks = this.Action.Additional.DeletedAnnotationMarks.perm;
+ for (let rangeId in permMarks)
+ {
+ let info = permMarks[rangeId];
+ if (info.start && info.end)
+ {
+ this.CollaborativeEditing.Remove_DocumentPosition(info.start.docPos);
+ this.CollaborativeEditing.Remove_DocumentPosition(info.end.docPos);
+ this.PermRangesManager.checkRange(rangeId);
+ continue;
+ }
+
+ let docPos = info.start ? info.start.docPos : info.end.docPos;
+ let mark = info.start ? info.start.mark : info.end.mark;
+
+ let actualMark = info.start ? this.PermRangesManager.getStartMark(rangeId) : this.PermRangesManager.getEndMark(rangeId);
+ if ((actualMark && actualMark !== mark) || mark.isUseInDocument())
+ {
+ this.CollaborativeEditing.Remove_DocumentPosition(docPos);
+ this.PermRangesManager.checkRange(rangeId);
+ continue;
+ }
+
+ this.CollaborativeEditing.Update_DocumentPosition(docPos);
+ let lastClass = docPos[docPos.length - 1].Class;
+
+ if (lastClass instanceof AscWord.Paragraph || lastClass instanceof AscWord.ParagraphContentWithParagraphLikeContent)
+ {
+ let newPosition = Math.min(lastClass.GetElementsCount(), Math.max(docPos[docPos.length - 1].Position, 0));
+ lastClass.AddToContent(newPosition, mark);
+ }
+ else
+ {
+ // TODO: Сделать ветку, если последний элемент Document/DocumentContent
+ // Ничего не делаем, отрезок должен удалиться на PermRangesManager.checkRange
+ }
+
+ this.CollaborativeEditing.Remove_DocumentPosition(docPos);
+ this.PermRangesManager.checkRange(rangeId);
+ }
+
+ this.LoadDocumentState(docState);
+};
CDocument.prototype.private_FinalizeCheckFocusAndBlurCC = function()
{
@@ -9097,7 +9154,7 @@ CDocument.prototype.OnKeyDown = function(e)
}
case Asc.c_oAscDocumentShortcutType.EditRedo:
{
- if (this.CanEdit() || this.IsEditCommentsMode() || this.IsFillingFormMode())
+ if (!this.IsViewMode() && !this.IsViewModeInReview())
this.Document_Redo();
bRetValue = keydownresult_PreventAll;
@@ -9105,7 +9162,7 @@ CDocument.prototype.OnKeyDown = function(e)
}
case Asc.c_oAscDocumentShortcutType.EditUndo:
{
- if ((this.CanEdit() || this.IsEditCommentsMode() || this.IsFillingFormMode()) && !this.IsViewModeInReview())
+ if (!this.IsViewMode() && !this.IsViewModeInReview())
this.Document_Undo();
bRetValue = keydownresult_PreventAll;
@@ -10303,6 +10360,21 @@ CDocument.prototype.CorrectEnterText = function(oldValue, newValue)
return true;
};
+CDocument.prototype.canEnterText = function()
+{
+ if (this.IsSelectionUse() && !this.IsTextSelectionUse())
+ return false;
+
+ if (this.Api.isViewMode)
+ return false;
+
+ if (this.Api.isRestrictionComments() || this.Api.isRestrictionView())
+ return this._checkPermRangeForCurrentSelection();
+ else if (this.IsFillingFormMode())
+ return this.IsInFormField(false, true);
+
+ return this.CanEdit();
+};
CDocument.prototype.OnMouseDown = function(e, X, Y, PageIndex)
{
if (PageIndex < 0)
@@ -11339,6 +11411,7 @@ CDocument.prototype.Document_AddPageNum = function(AlignV, AlignH)
if (PageIndex < 0)
PageIndex = this.CurPage;
+ this.RemoveSelection();
this.Create_HdrFtrWidthPageNum(PageIndex, AlignV, AlignH);
}
else
@@ -13317,18 +13390,197 @@ CDocument.prototype.IsCursorInHyperlink = function(bCheckEnd)
* Данная функция вызывается в основной функции проверки лока совместного редактирования, но есть действия, которые
* не требуют проверки лока совместки, в таких случая перед выполнением действия надо вызывать эту проверку
* @param [isIgnoreCanEditFlag=false]
+ * @param [checkType=undefined]
+ * @param [additionalData=undefined]
* @returns {boolean}
*/
-CDocument.prototype.CanPerformAction = function(isIgnoreCanEditFlag)
+CDocument.prototype.CanPerformAction = function(isIgnoreCanEditFlag, checkType, additionalData)
+{
+ return (this.IsPermRangeEditing(checkType, additionalData) || !((!this.CanEdit() && true !== isIgnoreCanEditFlag) || (true === this.CollaborativeEditing.Get_GlobalLock())));
+};
+/**
+ * Проверяем, что действие с заданным типом произойдет в разрешенной области
+ * @param changesType
+ * @param additionalData
+ * @returns {boolean}
+ */
+CDocument.prototype.IsPermRangeEditing = function(changesType, additionalData)
+{
+ if (this.Api.isViewMode || !(this.Api.isRestrictionComments() || this.Api.isRestrictionView()))
+ return false;
+
+ if (AscCommon.changestype_None !== changesType)
+ {
+ if (AscCommon.changestype_Table_Properties === changesType || AscCommon.changestype_Table_RemoveCells === changesType)
+ {
+ let currentTable = this.GetCurrentTable();
+ if (!currentTable || !currentTable.isWholeElementInPermRange())
+ return false;
+ }
+ else if (AscCommon.changestype_Paragraph_Properties === changesType)
+ {
+ let selectedParagraphs = this.GetSelectedParagraphs();
+ if (!this._checkPermRangeForCurrentSelection())
+ return false;
+
+ if (0 !== selectedParagraphs.length && !this._checkPermRangeForElement(selectedParagraphs[0]))
+ return false;
+
+ if (selectedParagraphs.length > 1 && !this._checkPermRangeForElement(selectedParagraphs[selectedParagraphs.length - 1]))
+ return false;
+ }
+ else
+ {
+ if (!this._checkChangesTypeForPermRangeForSelection(changesType))
+ return false;
+
+ if (!this._checkPermRangeForCurrentSelection())
+ return false;
+ }
+ }
+
+ if (additionalData)
+ {
+ if (AscCommon.changestype_2_InlineObjectMove === additionalData.Type)
+ {
+ // TODO: Надо проверить не целиком параграф, а только то место, куда происходит вставка
+ let pageNum = additionalData.PageNum;
+ let x = additionalData.X;
+ let y = additionalData.Y;
+ let para = this.Get_NearestPos(pageNum, x, y).Paragraph;
+ return this._checkPermRangeForElement(para);
+ }
+ else if (AscCommon.changestype_2_Element_and_Type === additionalData.Type)
+ {
+ return (this._checkChangesTypeForPermRange(additionalData.CheckType)
+ && this._checkPermRangeForElement(additionalData.Element));
+ }
+ else if (AscCommon.changestype_2_ElementsArray_and_Type === additionalData.Type)
+ {
+ if (!this._checkChangesTypeForPermRange(additionalData.CheckType))
+ return false;
+
+ for (let i = 0, count = additionalData.Elements.length; i < count; ++i)
+ {
+ if (!this._checkPermRangeForElement(additionalData.Elements[i]))
+ return false;
+ }
+ return true;
+ }
+ else if (AscCommon.changestype_2_Element_and_Type_Array === additionalData.Type)
+ {
+ for (let i = 0, count = Math.min(additionalData.Elements.length, additionalData.CheckTypes.length); i < count; ++i)
+ {
+ if (!this._checkChangesTypeForPermRange(additionalData.CheckTypes[i]))
+ return false;
+
+ if (!this._checkPermRangeForElement(additionalData.Elements[i]))
+ return false;
+ }
+ return true;
+ }
+ else if (AscCommon.changestype_2_AdditionalTypes === additionalData.Type)
+ {
+ if (!this._checkPermRangeForCurrentSelection())
+ return false;
+
+ for (let i = 0, count = additionalData.Types.length; i < count; ++i)
+ {
+ if (!this._checkChangesTypeForPermRange(additionalData.Types[i]))
+ return false;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ return true;
+};
+CDocument.prototype._checkActionForPermRange = function(changesType, additionalData)
+{
+ if (undefined === changesType || (AscCommon.changestype_None === changesType && undefined === additionalData))
+ return false;
+
+ if (AscCommon.changestype_None !== changesType && !this._checkChangesTypeForPermRange(changesType))
+ return false;
+
+ return (!additionalData || !this._checkChangesTypeForPermRange(additionalData.CheckType))
+};
+CDocument.prototype._checkChangesTypeForPermRange = function(changesType)
+{
+ // TODO: Пока запрещаем любые действия с автофигурами
+ // Разрешаем только действия, связанные с текущим выделением, либо выбранным элементом, любые глобальные изменения,
+ // например, изменения секции или настроек документа - запрещаем
+ return (AscCommon.changestype_Paragraph_Content === changesType
+ || AscCommon.changestype_Paragraph_Properties === changesType
+ || AscCommon.changestype_Paragraph_AddText === changesType
+ || AscCommon.changestype_Paragraph_TextProperties === changesType
+ || AscCommon.changestype_Document_Content === changesType
+ || AscCommon.changestype_Document_Content_Add === changesType
+ || AscCommon.changestype_Table_Properties === changesType
+ || AscCommon.changestype_Table_RemoveCells === changesType
+ || AscCommon.changestype_ContentControl_Remove === changesType
+ || AscCommon.changestype_ContentControl_Properties === changesType
+ || AscCommon.changestype_ContentControl_Add === changesType
+ || AscCommon.changestype_Remove === changesType
+ || AscCommon.changestype_Delete === changesType
+ || AscCommon.changestype_Text_Props === changesType);
+};
+CDocument.prototype._checkChangesTypeForPermRangeForSelection = function(changesType)
+{
+ return (AscCommon.changestype_Paragraph_Content === changesType
+ || AscCommon.changestype_Paragraph_Properties === changesType
+ || AscCommon.changestype_Paragraph_AddText === changesType
+ || AscCommon.changestype_Paragraph_TextProperties === changesType
+ || AscCommon.changestype_Document_Content === changesType
+ || AscCommon.changestype_Document_Content_Add === changesType
+ || AscCommon.changestype_Remove === changesType
+ || AscCommon.changestype_Delete === changesType
+ || AscCommon.changestype_Text_Props === changesType);
+};
+CDocument.prototype._checkPermRangeForCurrentSelection = function()
+{
+ // TODO: Пока запрещаем любые действия, связанные с выделением автофигур
+ if (this.IsTextSelectionUse())
+ {
+ if (true !== this.Selection.Use || this.Controller !== this.LogicDocumentController)
+ return;
+
+ // Надо проверить, что у нас начало и конец попали хотя бы в один общий промежуток
+ let startPos = this.GetContentPosition(true, true);
+ let endPos = this.GetContentPosition(true, false);
+
+ let startRanges = this.GetPermRangesByContentPos(startPos);
+ let endRanges = this.GetPermRangesByContentPos(endPos);
+ return AscWord.PermRangesManager.isInPermRange(startRanges, endRanges);
+ }
+ else if (!this.IsSelectionUse())
+ {
+ let currentPos = this.GetContentPosition();
+ return this.GetPermRangesByContentPos(currentPos).length > 0;
+ }
+
+ return false;
+};
+CDocument.prototype._checkPermRangeForElement = function(element)
{
- return !((!this.CanEdit() && true !== isIgnoreCanEditFlag) || (true === this.CollaborativeEditing.Get_GlobalLock()));
+ if (!element
+ && !(element instanceof AscWord.Paragraph)
+ && !(element instanceof AscWord.Table)
+ && !(element instanceof AscWord.BlockLevelSdt))
+ return false;
+
+ return element.isWholeElementInPermRange();
};
CDocument.prototype.Document_Is_SelectionLocked = function(CheckType, AdditionalData, DontLockInFastMode, isIgnoreCanEditFlag, fCallback)
{
if (this.IsActionStarted() && this.IsPostActionLockCheck())
return false;
- if (!this.CanPerformAction(isIgnoreCanEditFlag))
+ if (!this.CanPerformAction(isIgnoreCanEditFlag, CheckType, AdditionalData))
{
if (fCallback)
fCallback(true);
@@ -15632,7 +15884,7 @@ CDocument.prototype.private_StoreViewPositions = function(state)
state.AnchorDistance = xyInfo.Y - viewPort[0].Y;
}
};
-CDocument.prototype.Load_DocumentStateAfterLoadChanges = function(State)
+CDocument.prototype.Load_DocumentStateAfterLoadChanges = function(State, updateSelection)
{
this.CollaborativeEditing.UpdateDocumentPositionsByState(State);
@@ -15690,16 +15942,19 @@ CDocument.prototype.Load_DocumentStateAfterLoadChanges = function(State)
this.ViewPosition = null;
}
- this.UpdateSelection();
-
+ // TODO: По-хорошему, надо чтобы те места откуда вызывался данный метод сами обновляли состояние, если там оно нужно
+ // тогда не пришлось бы делать такие заглушки для мест, где это обновление мешает (например при перетаскивании
+ // линеек таблицы)
+ if (false !== updateSelection)
+ this.UpdateSelection();
};
CDocument.prototype.SaveDocumentState = function(isRemoveSelection)
{
return this.Save_DocumentStateBeforeLoadChanges(isRemoveSelection);
};
-CDocument.prototype.LoadDocumentState = function(oState)
+CDocument.prototype.LoadDocumentState = function(oState, updateSelection)
{
- return this.Load_DocumentStateAfterLoadChanges(oState);
+ return this.Load_DocumentStateAfterLoadChanges(oState, updateSelection);
};
CDocument.prototype.SetContentSelection = function(StartDocPos, EndDocPos, Depth, StartFlag, EndFlag)
{
@@ -23613,6 +23868,23 @@ CDocument.prototype.UpdateFields = function(isBySelection)
}
};
+CDocument.prototype.GetPermRangesByContentPos = function(docPos)
+{
+ if (!docPos)
+ return [];
+
+ let state = this.SaveDocumentState();
+
+ this.SetContentPosition(docPos, 0, 0);
+
+ let result = [];
+ let currentParagraph = this.controller_GetCurrentParagraph(true, null);
+ if (currentParagraph)
+ result = currentParagraph.GetCurrentPermRanges();
+
+ this.LoadDocumentState(state, false);
+ return result;
+};
/**
* Получаем ссылку на класс, управляющий закладками
* @returns {CBookmarksManager}
@@ -25792,6 +26064,30 @@ CDocument.prototype.AddParaMath = function(nType)
this.UpdateSelection();
this.UpdateInterface();
};
+CDocument.prototype.OnDeleteAnnotationMark = function(mark)
+{
+ if (!this.Action.Start || this.Action.UndoRedo)
+ return;
+
+ if (!this.Action.Additional.DeletedAnnotationMarks)
+ this.Action.Additional.DeletedAnnotationMarks = {perm : {}, comments : {}, bookmarks : {}};
+
+ if (mark.isPermMark())
+ {
+ let permMarks = this.Action.Additional.DeletedAnnotationMarks.perm;
+ let rangeId = mark.getRangeId();
+ if (!permMarks[rangeId])
+ permMarks[rangeId] = {};
+
+ let docPos = mark.GetDocumentPositionFromObject();
+ if (mark.isStart())
+ permMarks[rangeId].start = {mark : mark, docPos : docPos};
+ else
+ permMarks[rangeId].end = {mark : mark, docPos : docPos};
+
+ this.CollaborativeEditing.Add_DocumentPosition(docPos);
+ }
+};
CDocument.prototype.OnChangeContentControl = function(oControl)
{
if (!this.Action.Start && !this.Action.UndoRedo)
diff --git a/word/Editor/DocumentContentElementBase.js b/word/Editor/DocumentContentElementBase.js
index 3f9a6e044e..ffe21e3a19 100644
--- a/word/Editor/DocumentContentElementBase.js
+++ b/word/Editor/DocumentContentElementBase.js
@@ -133,6 +133,16 @@ CDocumentContentElementBase.prototype.GetPrevDocumentElement = function()
return oPrev;
};
+CDocumentContentElementBase.prototype.GetNextParagraphInDocument = function()
+{
+ let next = this.GetNextDocumentElement();
+ return next ? next.GetFirstParagraph() : null;
+};
+CDocumentContentElementBase.prototype.GetPrevParagraphInDocument = function()
+{
+ let prev = this.GetPrevDocumentElement();
+ return prev ? prev.GetLastParagraph() : null;
+};
CDocumentContentElementBase.prototype.GetParent = function()
{
return this.Parent;
@@ -1414,6 +1424,34 @@ CDocumentContentElementBase.prototype.isPreventedPreDelete = function()
let logicDocument = this.GetLogicDocument();
return !logicDocument || !logicDocument.IsDocumentEditor() || logicDocument.isPreventedPreDelete();
};
+CDocumentContentElementBase.prototype.isWholeElementInPermRange = function()
+{
+ // TODO: В таблицах GetNextDocumentElement/GetPrevDocumentElement не работает, надо проверить не баг ли это
+ // по логике оба варианта должны выдавать одинаковый результат
+
+ // let prevPara = this.GetPrevParagraphInDocument();
+ // let nextPara = this.GetNextParagraphInDocument();
+ //
+ // let startRanges = prevPara ? prevPara.GetEndInfo().GetPermRanges() : [];
+ // let endRanges = nextPara ? nextPara.GetEndInfoByPage(-1).GetPermRanges() : [];
+
+ let startPara = this.GetFirstParagraph();
+ let endPara = this.GetLastParagraph();
+
+ if (!startPara
+ || !endPara
+ || !startPara.IsRecalculated()
+ || !endPara.IsRecalculated())
+ return false;
+
+ let startInfo = startPara.GetEndInfoByPage(-1);
+ let endInfo = endPara.GetEndInfo();
+
+ let startRanges = startInfo ? startInfo.GetPermRanges() : [];
+ let endRanges = endInfo ? endInfo.GetPermRanges() : [];
+
+ return AscWord.PermRangesManager.isInPermRange(startRanges, endRanges);
+};
//--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
diff --git a/word/Editor/Merge.js b/word/Editor/Merge.js
index 60ec60fb44..b578b58a45 100644
--- a/word/Editor/Merge.js
+++ b/word/Editor/Merge.js
@@ -87,7 +87,7 @@
arrToRemove = arrToRemove.reverse();
}
nInsertPosition = arrToRemove[0].GetPosInParent();
- comparison.resolveConflicts(arrToInsert, arrToRemove, arrToRemove[0].Paragraph, nInsertPosition);
+ comparison.resolveConflicts(arrToInsert, arrToRemove, this.getApplyParagraph(comparison), nInsertPosition);
}
}
@@ -509,7 +509,7 @@
const bIsWordBeginWithText = oPartnerTextElement.isWordBeginWith(oOriginalTextElement);
const bIsWordEndWithText = oPartnerTextElement.isWordEndWith(oOriginalTextElement);
- const oParagraph = oOriginalTextElement.lastRun.Paragraph;
+ const oParent = oOriginalTextElement.lastRun.GetParent();
const oMainMockParagraph = this.par.element;
if (bIsWordBeginWithText) {
for (let i = 0; i < oOriginalTextElement.elements.length; i += 1) {
@@ -567,21 +567,21 @@
nLastRunPosition = oOriginalTextElement.lastRun.GetPosInParent();
nMockRunPosition = oOriginalTextElement.lastRun.GetPosInParent(oMainMockParagraph);
oNewOriginalTextElement.lastRun = arrContentForInsert[0];
- nLastOriginalElementPosition = oParagraph.Content[nLastRunPosition].GetElementPosition(oOriginalTextElement.elements[oOriginalTextElement.elements.length - 1]);
- oSplitRun = oParagraph.Content[nLastRunPosition].Split2(nLastOriginalElementPosition + 1, oParagraph, nLastRunPosition)
+ nLastOriginalElementPosition = oParent.Content[nLastRunPosition].GetElementPosition(oOriginalTextElement.elements[oOriginalTextElement.elements.length - 1]);
+ oSplitRun = oParent.Content[nLastRunPosition].Split2(nLastOriginalElementPosition + 1, oParent, nLastRunPosition)
oMainMockParagraph.Add_ToContent(nLastRunPosition + 1, oSplitRun);
} else {
nLastRunPosition = oOriginalTextElement.firstRun.GetPosInParent();
nMockRunPosition = oOriginalTextElement.firstRun.GetPosInParent(oMainMockParagraph);
nPreviousRunPosition = nLastRunPosition + arrContentForInsert.length;
- nLastOriginalElementPosition = oParagraph.Content[nLastRunPosition].GetElementPosition(oOriginalTextElement.elements[0]);
- oSplitRun = oParagraph.Content[nLastRunPosition].Split2(nLastOriginalElementPosition, oParagraph, nLastRunPosition);
+ nLastOriginalElementPosition = oParent.Content[nLastRunPosition].GetElementPosition(oOriginalTextElement.elements[0]);
+ oSplitRun = oParent.Content[nLastRunPosition].Split2(nLastOriginalElementPosition, oParent, nLastRunPosition);
oMainMockParagraph.Add_ToContent(nMockRunPosition + 1, oSplitRun);
oNewOriginalTextElement.firstRun = arrContentForInsert[0];
}
for (let i = 0; i < arrContentForInsert.length; i += 1) {
- oParagraph.Add_ToContent(nLastRunPosition + 1, arrContentForInsert[i]);
+ oParent.Add_ToContent(nLastRunPosition + 1, arrContentForInsert[i]);
oMainMockParagraph.Add_ToContent(nMockRunPosition + 1, arrContentForInsert[i]);
}
}
@@ -589,7 +589,7 @@
if (bIsWordEndWithText && !bIsWordBeginWithText) {
let nElementsAmount = oOriginalTextElement.elements.length;
let nCurrentRunPosition = nPreviousRunPosition + 1;
- let oCurrentRun = oParagraph.Content[nCurrentRunPosition];
+ let oCurrentRun = oParent.Content[nCurrentRunPosition];
while (nElementsAmount) {
const oReviewInfo = comparison.getCompareReviewInfo(oCurrentRun);
oNewOriginalTextElement.lastRun = oCurrentRun;
@@ -602,7 +602,7 @@
}
}
nCurrentRunPosition += 1;
- oCurrentRun = oParagraph.Content[nCurrentRunPosition];
+ oCurrentRun = oParent.Content[nCurrentRunPosition];
}
}
} else if (oPartnerTextElement.elements.length < oOriginalTextElement.elements.length) {
@@ -846,9 +846,9 @@
if (oInsertInfo.isParaEnd) {
oRun.AddAfterParaEnd(oInsertParaMove);
} else {
- const oParagraph = oRun.Paragraph;
- const nPosition = oRun.GetPosInParent(oParagraph);
- oParagraph.AddToContent(nPosition, oInsertParaMove);
+ const oParent = oRun.GetParent();
+ const nPosition = oRun.GetPosInParent(oParent);
+ oParent.AddToContent(nPosition, oInsertParaMove);
}
}
}
diff --git a/word/Editor/Paragraph.js b/word/Editor/Paragraph.js
index ae3715561c..f5eec26f00 100644
--- a/word/Editor/Paragraph.js
+++ b/word/Editor/Paragraph.js
@@ -611,6 +611,18 @@ Paragraph.prototype.GetAllParaMaths = function(arrParaMaths)
return arrParaMaths;
};
+Paragraph.prototype.GetAllPermRangeMarks = function(marks)
+{
+ if (!marks)
+ marks = [];
+
+ for (let i = 0, count = this.Content.length; i < count; ++i)
+ {
+ this.Content[i].GetAllPermRangeMarks(marks);
+ }
+
+ return marks;
+};
Paragraph.prototype.GetAllSeqFieldsByType = function(sType, aFields)
{
@@ -2673,6 +2685,23 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
pGraphics.df();
Element = aHigh.Get_Next();
}
+
+ //----------------------------------------------------------------------------------------------------------
+ // Рисуем выделение разрешенных областей
+ //----------------------------------------------------------------------------------------------------------
+ let aPerm = PDSH.Perm;
+ Element = aPerm.Get_Next();
+ while (null != Element)
+ {
+ if (!pGraphics.set_fillColor)
+ pGraphics.b_color1(Element.r, Element.g, Element.b, 255);
+ else
+ pGraphics.set_fillColor(Element.r, Element.g, Element.b);
+
+ pGraphics.rect(Element.x0, Element.y0, Element.x1 - Element.x0, Element.y1 - Element.y0);
+ pGraphics.df();
+ Element = aPerm.Get_Next();
+ }
//----------------------------------------------------------------------------------------------------------
// Рисуем комментарии
@@ -12712,23 +12741,20 @@ Paragraph.prototype.PreDelete = function()
// Кроме этого, если тут начинались или заканчивались комметарии, то их тоже
// удаляем.
+ let logicDocument = this.GetLogicDocument();
for (var Index = 0; Index < this.Content.length; Index++)
{
var Item = this.Content[Index];
if (Item.PreDelete)
Item.PreDelete(true);
-
- if(this.LogicDocument)
+
+ if (logicDocument && logicDocument.IsDocumentEditor())
{
- if (para_Comment === Item.Type && true === this.LogicDocument.RemoveCommentsOnPreDelete)
- {
- this.LogicDocument.RemoveComment(Item.CommentId, true, false);
- }
+ if (para_Comment === Item.Type && true === logicDocument.RemoveCommentsOnPreDelete)
+ logicDocument.RemoveComment(Item.CommentId, true, false);
else if (para_Bookmark === Item.Type)
- {
- this.LogicDocument.GetBookmarksManager().SetNeedUpdate(true);
- }
+ logicDocument.GetBookmarksManager().SetNeedUpdate(true);
}
}
@@ -13585,15 +13611,15 @@ Paragraph.prototype.Split = function(oNewParagraph, oContentPos, isNoDuplicate)
// добавляем в начало нового параграфа.
var NewContent = this.Content.slice(nCurPos + 1);
-
+
+ this.Internal_Content_Remove2(nCurPos + 1, this.Content.length - nCurPos - 1);
+ this.CheckParaEnd();
+
// Очищаем новый параграф и добавляем в него Right элемент и NewContent
oNewParagraph.Internal_Content_Remove2(0, oNewParagraph.Content.length);
oNewParagraph.ConcatContent(NewContent);
oNewParagraph.Internal_Content_Add(0, NewElement);
oNewParagraph.CorrectContent();
-
- this.Internal_Content_Remove2(nCurPos + 1, this.Content.length - nCurPos - 1);
- this.CheckParaEnd();
}
if (false !== localTrack)
@@ -16729,6 +16755,22 @@ Paragraph.prototype.AddContentControl = function(nContentControlType)
return oContentControl;
}
};
+Paragraph.prototype.GetCurrentPermRanges = function()
+{
+ let permRanges = [];
+
+ let endInfo = this.GetEndInfoByPage(-1);
+ if (endInfo)
+ permRanges = endInfo.GetPermRanges().slice();
+
+ let endPos = Math.min(this.CurPos.ContentPos, this.Content.length - 1);
+ for (let pos = 0; pos <= endPos; ++pos)
+ {
+ this.Content[pos].GetCurrentPermRanges(permRanges, pos === endPos);
+ }
+
+ return permRanges;
+};
Paragraph.prototype.GetCurrentComplexFields = function(bReturnFieldPos)
{
var arrComplexFields = [];
@@ -18103,24 +18145,24 @@ Paragraph.prototype.AddTrackMoveMark = function(isFrom, isStart, sMarkId)
};
/**
* Удаляем из параграфа заданный элемент, если он тут есть
- * @param oElement
+ * @param element
*/
-Paragraph.prototype.RemoveElement = function(oElement)
+Paragraph.prototype.RemoveElement = function(element)
{
- for (var nPos = 0, nCount = this.Content.length; nPos < nCount; ++nPos)
+ for (let i = 0, count = this.Content.length; i < count; ++i)
{
- var oItem = this.Content[nPos];
- if (oItem === oElement)
+ let item = this.Content[i];
+ if (item === element)
{
- this.Internal_Content_Remove(nPos);
- nPos--;
- nCount--;
+ this.RemoveFromContent(i, 1);
+ return true;
}
- else if (oItem.RemoveElement)
+ else if (item.RemoveElement(element))
{
- oItem.RemoveElement(oElement);
+ return true;
}
}
+ return false;
};
/**
* Пробегаемся по все ранам с заданной функцией
@@ -19056,6 +19098,7 @@ function CParagraphPageEndInfo()
{
this.Comments = []; // Массив незакрытых комментариев на данной странице
this.ComplexFields = []; // Массив незакрытых полей на данной странице
+ this.PermRanges = []; // Массив незакрытых разрешенных областей
this.RunRecalcInfo = null;
this.RecalcId = -1;
@@ -19064,16 +19107,18 @@ CParagraphPageEndInfo.prototype.Copy = function()
{
var oInfo = new CParagraphPageEndInfo();
- for (var nIndex = 0, nCount = this.Comments.length; nIndex < nCount; ++nIndex)
+ for (let nIndex = 0, nCount = this.Comments.length; nIndex < nCount; ++nIndex)
{
oInfo.Comments.push(this.Comments[nIndex]);
}
- for (var nIndex = 0, nCount = this.ComplexFields.length; nIndex < nCount; ++nIndex)
+ for (let nIndex = 0, nCount = this.ComplexFields.length; nIndex < nCount; ++nIndex)
{
if (this.ComplexFields[nIndex].ComplexField.IsUse())
oInfo.ComplexFields.push(this.ComplexFields[nIndex].Copy());
}
+
+ oInfo.PermRanges = this.PermRanges.slice();
return oInfo;
};
@@ -19081,6 +19126,7 @@ CParagraphPageEndInfo.prototype.SetFromPRSI = function(PRSI)
{
this.Comments = PRSI.Comments;
this.ComplexFields = PRSI.ComplexFields;
+ this.PermRanges = PRSI.PermRanges;
};
CParagraphPageEndInfo.prototype.GetComplexFields = function()
{
@@ -19095,23 +19141,35 @@ CParagraphPageEndInfo.prototype.GetComments = function()
{
return this.Comments;
};
+CParagraphPageEndInfo.prototype.GetPermRanges = function()
+{
+ return this.PermRanges;
+};
CParagraphPageEndInfo.prototype.IsEqual = function(oEndInfo)
{
- if (this.Comments.length !== oEndInfo.Comments.length || this.ComplexFields.length !== oEndInfo.ComplexFields.length)
+ if (this.Comments.length !== oEndInfo.Comments.length
+ || this.ComplexFields.length !== oEndInfo.ComplexFields.length
+ || this.PermRanges.length !== oEndInfo.PermRanges.length)
return false;
- for (var nIndex = 0, nCount = this.Comments.length; nIndex < nCount; ++nIndex)
+ for (let nIndex = 0, nCount = this.Comments.length; nIndex < nCount; ++nIndex)
{
if (this.Comments[nIndex] !== oEndInfo.Comments[nIndex])
return false;
}
- for (var nIndex = 0, nCount = this.ComplexFields.length; nIndex < nCount; ++nIndex)
+ for (let nIndex = 0, nCount = this.ComplexFields.length; nIndex < nCount; ++nIndex)
{
if (!this.ComplexFields[nIndex].IsEqual(oEndInfo.ComplexFields[nIndex]))
return false;
}
-
+
+ for (let index = 0, count = this.PermRanges.length; index < count; ++index)
+ {
+ if (this.PermRanges[index] !== oEndInfo.PermRanges[index])
+ return false;
+ }
+
return true;
};
CParagraphPageEndInfo.prototype.CheckRecalcId = function(recalcId)
diff --git a/word/Editor/Paragraph/ComplexField.js b/word/Editor/Paragraph/ComplexField.js
index 3c465e1678..9534fc5714 100644
--- a/word/Editor/Paragraph/ComplexField.js
+++ b/word/Editor/Paragraph/ComplexField.js
@@ -381,10 +381,12 @@ ParaFieldChar.prototype.IsNeedSaveRecalculateObject = function()
};
ParaFieldChar.prototype.SaveRecalculateObject = function(isCopy)
{
- return new AscWord.PageNumRecalculateObject(this.Type, this.graphemes, this.widths, this.Width, isCopy);
+ return new FieldCharRecalculateObject(this.Type, this.numText, this.checkBox, this.graphemes, this.widths, this.Width, isCopy);
};
ParaFieldChar.prototype.LoadRecalculateObject = function(recalcObj)
{
+ this.numText = recalcObj.numText;
+ this.checkBox = recalcObj.checkBox;
this.graphemes = recalcObj.graphemes;
this.widths = recalcObj.widths;
this.Width = recalcObj.width;
@@ -394,6 +396,8 @@ ParaFieldChar.prototype.PrepareRecalculateObject = function()
{
this.graphemes = [];
this.widths = [];
+ this.checkBox = null;
+ this.numText = null;
};
ParaFieldChar.prototype.IsValid = function()
{
@@ -425,6 +429,19 @@ ParaFieldChar.prototype.FindNextFillingForm = function(isNext, isCurrent, isStar
return (this.IsEnd() && (!isCurrent || isNext) ? this.ComplexField : null);
};
+/**
+ * @constructor
+ */
+function FieldCharRecalculateObject(type, numText, checkBox, graphemes, widths, totalWidth, isCopy)
+{
+ this.type = type;
+ this.numText = numText;
+ this.checkBox = checkBox;
+ this.graphemes = graphemes && isCopy ? graphemes.slice() : graphemes;
+ this.widths = widths && isCopy ? widths.slice() : widths;
+ this.width = totalWidth;
+}
+
/**
* Класс представляющий символ инструкции сложного поля
* @param {Number} nCharCode
diff --git a/word/Editor/Paragraph/RunContent/PageNum.js b/word/Editor/Paragraph/RunContent/PageNum.js
index 49a27f88d9..6732e619af 100644
--- a/word/Editor/Paragraph/RunContent/PageNum.js
+++ b/word/Editor/Paragraph/RunContent/PageNum.js
@@ -175,15 +175,9 @@
function PageNumRecalculateObject(type, graphemes, widths, totalWidth, isCopy)
{
this.type = type;
- this.graphemes = graphemes;
- this.widths = widths;
+ this.graphemes = graphemes && isCopy ? graphemes.slice() : graphemes;
+ this.widths = widths && isCopy ? widths.slice() : widths;
this.width = totalWidth;
-
- if (isCopy)
- {
- this.graphemes = graphemes.slice();
- this.widths = widths.slice();
- }
}
//--------------------------------------------------------export----------------------------------------------------
diff --git a/word/Editor/Paragraph/RunContent/Types.js b/word/Editor/Paragraph/RunContent/Types.js
index 1421ea6b3e..22fe96e18e 100644
--- a/word/Editor/Paragraph/RunContent/Types.js
+++ b/word/Editor/Paragraph/RunContent/Types.js
@@ -79,6 +79,8 @@ var para_Bookmark = 0x0047;
var para_RevisionMove = 0x0048;
var para_EndnoteReference = 0x0049; // Ссылка на сноску
var para_EndnoteRef = 0x004a; // Номер сноски (должен быть только внутри сноски)
+var para_PermStart = 0x004b;
+var para_PermEnd = 0x004c;
(function(window)
{
diff --git a/word/Editor/Paragraph/draw/highlight-draw-state.js b/word/Editor/Paragraph/draw/highlight-draw-state.js
index 732a6cbf81..6aaabaacf4 100644
--- a/word/Editor/Paragraph/draw/highlight-draw-state.js
+++ b/word/Editor/Paragraph/draw/highlight-draw-state.js
@@ -40,6 +40,7 @@
const FLAG_COMPLEX_FIELD = 0x0010;
const FLAG_COLLABORATION = 0x0020;
const FLAG_SHD = 0x0040;
+ const FLAG_PERM_RANGE = 0x0080;
/**
* Class for storing the current draw state of paragraph highlight (text/paragraph/field/etc. background)
@@ -67,12 +68,14 @@
this.MMFields = new CParaDrawingRangeLines();
this.CFields = new CParaDrawingRangeLines();
this.HyperCF = new CParaDrawingRangeLines();
+ this.Perm = new CParaDrawingRangeLines();
this.DrawComments = true;
this.DrawSolvedComments = true;
this.haveCurrentComment = false;
this.currentCommentId = null;
this.comments = []; // current list of comments
+ this.permRanges = {};
this.hyperlinks = [];
@@ -98,6 +101,8 @@
this.highlight = highlight_None;
this.shdColor = null;
this.shd = null;
+
+ this.permColor = null;
}
ParagraphHighlightDrawState.prototype.init = function(paragraph, graphics)
{
@@ -113,6 +118,14 @@
this.DrawSolvedComments = commentManager && commentManager.isUseSolved();
this.DrawMMFields = logicDocument && logicDocument.IsDocumentEditor() && logicDocument.isHighlightMailMergeFields();
this.currentCommentId = commentManager ? commentManager.getCurrentCommentId() : -1;
+
+ this.permColor = new AscWord.CDocumentColor(233, 233, 233, 255);
+ if (logicDocument && logicDocument.IsDocumentEditor())
+ {
+ let docApi = logicDocument.GetApi();
+ if (docApi.isRestrictionView() || docApi.isRestrictionComments())
+ this.permColor = new AscWord.CDocumentColor(255, 254, 213, 255);
+ }
};
ParagraphHighlightDrawState.prototype.resetPage = function(page)
{
@@ -124,6 +137,7 @@
this.comments = [];
this.haveCurrentComment = false;
+ this.permRanges = [];
let pageEndInfo = this.Paragraph.GetEndInfoByPage(page - 1);
if (pageEndInfo)
@@ -132,6 +146,11 @@
{
this.addComment(pageEndInfo.Comments[index]);
}
+
+ for (let index = 0, count = pageEndInfo.PermRanges.length; index < count; ++index)
+ {
+ this.addPermRange(pageEndInfo.PermRanges[index]);
+ }
}
this.complexFields.resetPage(this.Paragraph, page);
};
@@ -160,6 +179,7 @@
this.MMFields.Clear();
this.CFields.Clear();
this.HyperCF.Clear();
+ this.Perm.Clear();
this.run = null;
this.highlight = highlight_None;
@@ -198,6 +218,26 @@
if (-1 !== index)
this.comments.splice(index, 1);
};
+ ParagraphHighlightDrawState.prototype.addPermRange = function(rangeId)
+ {
+ this.permRanges.push(rangeId);
+ };
+ ParagraphHighlightDrawState.prototype.removePermRange = function(rangeId)
+ {
+ if (!this.permRanges.length)
+ return;
+
+ if (this.permRanges[this.permRanges.length - 1] === rangeId)
+ {
+ --this.permRanges.length;
+ }
+ else
+ {
+ let pos = this.permRanges.indexOf(rangeId);
+ if (-1 !== pos)
+ this.permRanges.splice(pos, 1);
+ }
+ };
ParagraphHighlightDrawState.prototype.increaseSearchCounter = function()
{
++this.searchCounter;
@@ -425,6 +465,9 @@
if ((flags & FLAG_COLLABORATION) && collColor)
this.Coll.Add(startY, endY, startX, endX, 0, collColor.r, collColor.g, collColor.b);
+
+ if (flags & FLAG_PERM_RANGE && this.permColor)
+ this.Perm.Add(startY, endY, startX, endX, 0, this.permColor.r, this.permColor.g, this.permColor.b);
};
ParagraphHighlightDrawState.prototype.pushHyperlink = function(hyperlink)
{
@@ -462,6 +505,8 @@
flags |= FLAG_SEARCH;
if (this.isComplexFieldHighlight())
flags |= FLAG_COMPLEX_FIELD;
+ if (this.permRanges.length > 0)
+ flags |= FLAG_PERM_RANGE;
if (element.Type !== para_End)
flags |= FLAG_SHD;
diff --git a/word/Editor/Paragraph/search-position-by-coords.js b/word/Editor/Paragraph/search-position-by-coords.js
index 6312662b81..d57100794a 100644
--- a/word/Editor/Paragraph/search-position-by-coords.js
+++ b/word/Editor/Paragraph/search-position-by-coords.js
@@ -508,9 +508,9 @@
this.inTextPos = this.pos.Copy();
this.inTextX = false;
}
- else if (x > range.XVisible + range.W)
+ else if (x > range.XEndVisible)
{
- this.setDiff(range.XVisible + range.W - x);
+ this.setDiff(range.XEndVisible - x);
this.pos = para.Get_StartRangePos2(this.line, this.range);
this.inTextPos = this.pos.Copy();
this.inTextX = false;
@@ -525,9 +525,9 @@
this.inTextPos = this.pos.Copy();
this.inTextX = false;
}
- else if (x > range.XVisible + range.W)
+ else if (x > range.XEndVisible)
{
- this.setDiff(range.XVisible + range.W - x);
+ this.setDiff(range.XEndVisible - x);
this.pos = para.Get_EndRangePos2(this.line, this.range);
this.inTextPos = this.pos.Copy();
this.inTextX = false;
diff --git a/word/Editor/ParagraphContentBase.js b/word/Editor/ParagraphContentBase.js
index f994f5969b..1f5bde6c2b 100644
--- a/word/Editor/ParagraphContentBase.js
+++ b/word/Editor/ParagraphContentBase.js
@@ -71,6 +71,9 @@ CParagraphContentBase.prototype.IsStopCursorOnEntryExit = function()
CParagraphContentBase.prototype.PreDelete = function()
{
};
+CParagraphContentBase.prototype.GetCurrentPermRanges = function(permRanges, isCurrent)
+{
+};
/**
* Выствялем параграф, в котром лежит данный элемент
* @param {Paragraph} oParagraph
@@ -846,6 +849,13 @@ CParagraphContentBase.prototype.IsStartFromNewLine = function()
{
return false;
};
+/**
+ * Удаляем из параграфа заданный элемент, если он тут есть
+ * @param element
+ */
+CParagraphContentBase.prototype.RemoveElement = function(element)
+{
+};
/**
* Пробегаемся по все ранам с заданной функцией
* @param fCheck - функция проверки содержимого рана
@@ -959,6 +969,11 @@ CParagraphContentBase.prototype.createDuplicateForSmartArt = function(oPr)
*/
CParagraphContentBase.prototype.CalculateTextToTable = function(oEngine){};
+CParagraphContentBase.prototype.GetAllPermRangeMarks = function(marks)
+{
+ return [];
+};
+
/**
* Это базовый класс для элементов содержимого(контент) параграфа, у которых есть свое содержимое.
* @constructor
@@ -2402,6 +2417,18 @@ CParagraphContentWithParagraphLikeContent.prototype.Get_Text = function(Text)
this.Content[CurPos].Get_Text( Text );
}
};
+CParagraphContentWithParagraphLikeContent.prototype.GetAllPermRangeMarks = function(marks)
+{
+ if (!marks)
+ marks = [];
+
+ for (let i = 0, count = this.Content.length; i < count; ++i)
+ {
+ this.Content[i].GetAllPermRangeMarks(marks);
+ }
+
+ return marks;
+};
CParagraphContentWithParagraphLikeContent.prototype.GetAllParagraphs = function(Props, ParaArray)
{
var ContentLen = this.Content.length;
@@ -4560,6 +4587,14 @@ CParagraphContentWithParagraphLikeContent.prototype.PreDelete = function()
this.RemoveSelection();
};
+CParagraphContentWithParagraphLikeContent.prototype.GetCurrentPermRanges = function(permRanges, isCurrent)
+{
+ let endPos = isCurrent ? Math.min(this.State.ContentPos, this.Content.length - 1) : this.Content.length - 1;
+ for (let pos = 0; pos <= endPos; ++pos)
+ {
+ this.Content[pos].GetCurrentPermRanges(permRanges, isCurrent && pos === endPos);
+ }
+};
CParagraphContentWithParagraphLikeContent.prototype.GetCurrentComplexFields = function(arrComplexFields, isCurrent, isFieldPos)
{
var nEndPos = isCurrent ? this.State.ContentPos : this.Content.length - 1;
@@ -4628,6 +4663,23 @@ CParagraphContentWithParagraphLikeContent.prototype.CanAddComment = function()
return true;
};
+CParagraphContentWithParagraphLikeContent.prototype.RemoveElement = function(element)
+{
+ for (let i = 0, count = this.Content.length; i < count; ++i)
+ {
+ let item = this.Content[i];
+ if (item === element)
+ {
+ this.RemoveFromContent(i, 1);
+ return true;
+ }
+ else if (item.RemoveElement(element))
+ {
+ return true;
+ }
+ }
+ return false;
+};
CParagraphContentWithParagraphLikeContent.prototype.CheckRunContent = function(fCheck, oStartPos, oEndPos, nDepth, oCurrentPos, isForward)
{
if (undefined === isForward)
@@ -4965,3 +5017,6 @@ function private_ParagraphContentChangesCheckLock(lockData)
lockData.lock();
}
}
+//--------------------------------------------------------export----------------------------------------------------
+AscWord.ParagraphContentBase = CParagraphContentBase;
+AscWord.ParagraphContentWithParagraphLikeContent = CParagraphContentWithParagraphLikeContent;
diff --git a/word/Editor/Paragraph_Recalculate.js b/word/Editor/Paragraph_Recalculate.js
index 181fa55c36..336df4a087 100644
--- a/word/Editor/Paragraph_Recalculate.js
+++ b/word/Editor/Paragraph_Recalculate.js
@@ -2082,6 +2082,8 @@ Paragraph.prototype.private_RecalculateLineAlign = function(CurLine, CurPa
return PRSA.RecalcResult;
}
}
+
+ Range.XEndVisible = PRSA.X;
}
return PRSA.RecalcResult;
@@ -2992,24 +2994,26 @@ CParaLineMetrics.prototype.Reset = function()
function CParaLineRange(X, XEnd)
{
- this.X = X; // Начальная позиция отрезка без учета прилегания содержимого
- this.XVisible = 0; // Начальная позиция отрезка с учетом прилегания содержимого
- this.XEnd = XEnd; // Предельное значение по X для данного отрезка
- this.StartPos = 0; // Позиция в контенте параграфа, с которой начинается данный отрезок
- this.EndPos = 0; // Позиция в контенте параграфа, на которой заканчиваетсяданный отрезок
- this.W = 0;
- this.Spaces = 0; // Количество пробелов в отрезке, без учета пробелов в конце отрезка
- this.WEnd = 0; // Если есть знак конца параграфа в данном отрезке, то это его ширина
- this.WBreak = 0; // Если в конце отрезка есть разрыв строки/колонки/страницы
+ this.X = X; // Начальная позиция отрезка без учета прилегания содержимого
+ this.XVisible = 0; // Начальная позиция отрезка с учетом прилегания содержимого
+ this.XEnd = XEnd; // Предельное значение по X для данного отрезка
+ this.XEndVisible = X; // Где фактически заканчивается содержимое в данном отрезке
+ this.StartPos = 0; // Позиция в контенте параграфа, с которой начинается данный отрезок
+ this.EndPos = 0; // Позиция в контенте параграфа, на которой заканчиваетсяданный отрезок
+ this.W = 0;
+ this.Spaces = 0; // Количество пробелов в отрезке, без учета пробелов в конце отрезка
+ this.WEnd = 0; // Если есть знак конца параграфа в данном отрезке, то это его ширина
+ this.WBreak = 0; // Если в конце отрезка есть разрыв строки/колонки/страницы
}
CParaLineRange.prototype =
{
Shift : function(Dx, Dy)
{
- this.X += Dx;
- this.XEnd += Dx;
- this.XVisible += Dx;
+ this.X += Dx;
+ this.XEnd += Dx;
+ this.XVisible += Dx;
+ this.XEndVisible += Dx;
},
Copy : function()
@@ -3019,6 +3023,7 @@ CParaLineRange.prototype =
NewRange.X = this.X;
NewRange.XVisible = this.XVisible;
NewRange.XEnd = this.XEnd;
+ NewRange.XEndVisible = this.XEndVisible;
NewRange.StartPos = this.StartPos;
NewRange.EndPos = this.EndPos;
NewRange.W = this.W;
@@ -4342,6 +4347,7 @@ function CParagraphRecalculateStateInfo()
this.fast = false;
this.Comments = [];
this.ComplexFields = [];
+ this.PermRanges = [];
}
CParagraphRecalculateStateInfo.prototype = Object.create(ParagraphRecalculateStateBase.prototype);
CParagraphRecalculateStateInfo.prototype.constructor = CParagraphRecalculateStateInfo;
@@ -4353,34 +4359,28 @@ CParagraphRecalculateStateInfo.prototype.isFastRecalculation = function()
{
return this.fast;
};
-CParagraphRecalculateStateInfo.prototype.Reset = function(PrevInfo)
+CParagraphRecalculateStateInfo.prototype.Reset = function(prevInfo)
{
- if (null !== PrevInfo && undefined !== PrevInfo)
- {
- this.Comments = [];
- this.ComplexFields = [];
-
- if (PrevInfo.Comments)
- {
- for (var nIndex = 0, nCount = PrevInfo.Comments.length; nIndex < nCount; ++nIndex)
- {
- this.Comments[nIndex] = PrevInfo.Comments[nIndex];
- }
- }
+ this.Comments = [];
+ this.ComplexFields = [];
+ this.PermRanges = [];
+
+ if (!prevInfo)
+ return;
+
+ if (prevInfo.Comments)
+ this.Comments = prevInfo.Comments.slice();
- if (PrevInfo.ComplexFields)
+ if (prevInfo.ComplexFields)
+ {
+ for (let index = 0, count = prevInfo.ComplexFields.length; index < count; ++index)
{
- for (var nIndex = 0, nCount = PrevInfo.ComplexFields.length; nIndex < nCount; ++nIndex)
- {
- this.ComplexFields[nIndex] = PrevInfo.ComplexFields[nIndex].Copy();
- }
+ this.ComplexFields[index] = prevInfo.ComplexFields[index].Copy();
}
}
- else
- {
- this.Comments = [];
- this.ComplexFields = [];
- }
+
+ if (prevInfo.PermRanges)
+ this.PermRanges = prevInfo.PermRanges.slice();
};
CParagraphRecalculateStateInfo.prototype.AddComment = function(Id)
{
@@ -4398,6 +4398,21 @@ CParagraphRecalculateStateInfo.prototype.RemoveComment = function(Id)
}
}
};
+CParagraphRecalculateStateInfo.prototype.addPermRange = function(rangeId)
+{
+ this.PermRanges.push(rangeId);
+};
+CParagraphRecalculateStateInfo.prototype.removePermRange = function(rangeId)
+{
+ let pos = this.PermRanges.indexOf(rangeId);
+ if (-1 === pos)
+ return;
+
+ if (this.PermRanges.length - 1 === pos)
+ --this.PermRanges.length;
+ else
+ this.PermRanges.splice(pos, 1);
+};
CParagraphRecalculateStateInfo.prototype.processFieldChar = function(oFieldChar)
{
if (!oFieldChar || !oFieldChar.IsUse())
diff --git a/word/Editor/Run.js b/word/Editor/Run.js
index 2494c02bea..6259eae584 100644
--- a/word/Editor/Run.js
+++ b/word/Editor/Run.js
@@ -11219,8 +11219,12 @@ ParaRun.prototype.RemoveElement = function(oElement)
for (var nIndex = 0, nCount = this.Content.length; nIndex < nCount; ++nIndex)
{
if (oElement === this.Content[nIndex])
- return this.RemoveFromContent(nIndex, 1, true);
+ {
+ this.RemoveFromContent(nIndex, 1, true);
+ return true;
+ }
}
+ return false;
};
ParaRun.prototype.GotoFootnoteRef = function(isNext, isCurrent, isStepOver, isStepFootnote, isStepEndnote)
{
diff --git a/word/Editor/SelectedContent.js b/word/Editor/SelectedContent.js
index cd18ef0d75..c8e3befa1b 100644
--- a/word/Editor/SelectedContent.js
+++ b/word/Editor/SelectedContent.js
@@ -52,6 +52,7 @@
this.Comments = [];
this.CommentsMarks = {};
this.Maths = [];
+ this.PermRangeMarks = [];
this.LogicDocument = null;
@@ -91,6 +92,7 @@
this.DrawingObjects = [];
this.Comments = [];
this.Maths = [];
+ this.PermRangeMarks = [];
this.MoveDrawing = false;
@@ -104,6 +106,7 @@
this.private_CollectObjects();
this.private_CheckComments(oLogicDocument);
this.private_CheckTrackMove(oLogicDocument);
+ this.private_CheckPermRangeMarks(oLogicDocument);
};
CSelectedContent.prototype.SetNewCommentsGuid = function(isNew)
{
@@ -534,6 +537,7 @@
oParagraph.GetAllDrawingObjects(this.DrawingObjects);
oParagraph.GetAllComments(this.Comments);
oParagraph.GetAllMaths(this.Maths);
+ oParagraph.GetAllPermRangeMarks(this.PermRangeMarks);
}
if (oElement.IsParagraph() && nCount > 1)
@@ -678,6 +682,17 @@
oLogicDocument.TrackMoveId = null;
}
};
+ CSelectedContent.prototype.private_CheckPermRangeMarks = function(logicDocument)
+ {
+ // TODO: Пока мы удаляем все метки. В будущем надо сделать, что если скопированы начало и конец, то мы
+ // приписываем им новый id диапазона, а если скопировано только начала или конец, то удаляем такие метки
+
+ for (let markIndex = 0, markCount = this.PermRangeMarks.length; markIndex < markCount; ++markIndex)
+ {
+ let mark = this.PermRangeMarks[markIndex];
+ mark.removeMark();
+ }
+ };
CSelectedContent.prototype.private_CreateNewCommentsGuid = function()
{
let oManager = this.LogicDocument.GetCommentsManager();
diff --git a/word/Editor/Serialize2.js b/word/Editor/Serialize2.js
index d335e5046d..d7447794cb 100644
--- a/word/Editor/Serialize2.js
+++ b/word/Editor/Serialize2.js
@@ -452,7 +452,10 @@ var c_oSerParType = {
BookmarkEnd: 24,
MRun: 25,
AltChunk: 26,
- DocParts: 27
+ DocParts: 27,
+ PermStart: 28,
+ PermEnd: 29,
+ JsaProjectExternal: 30
};
var c_oSerGlossary = {
DocPart: 0,
@@ -488,7 +491,9 @@ var c_oSerDocTableType = {
MoveFromRangeStart: 14,
MoveFromRangeEnd: 15,
MoveToRangeStart: 16,
- MoveToRangeEnd: 17
+ MoveToRangeEnd: 17,
+ PermStart: 18,
+ PermEnd: 19
};
var c_oSerRunType = {
run:0,
@@ -700,6 +705,15 @@ var c_oSer_CommentsType = {
UserData: 15
};
+var c_oSerPermission = {
+ Id : 0,
+ DisplacedByCustomXml : 1,
+ ColFirst : 2,
+ ColLast : 3,
+ Ed : 4,
+ EdGroup : 5
+};
+
var c_oSer_StyleType = {
Character: 1,
Numbering: 2,
@@ -954,7 +968,22 @@ var c_oSer_OMathContentType = {
MoveFromRangeStart: 68,
MoveFromRangeEnd: 69,
MoveToRangeStart: 70,
- MoveToRangeEnd: 71
+ MoveToRangeEnd: 71,
+ AnnotationRef: 72,
+ CommentReference: 73,
+ ContentPart: 74,
+ Cr: 75,
+ EndnoteRef: 76,
+ EndnoteReference: 77,
+ FootnoteRef: 78,
+ FootnoteReference: 79,
+ LastRenderedPageBreak: 80,
+ NoBreakHyphen: 81,
+ SoftHyphen: 82,
+ Sym: 83,
+ Tab: 84,
+ PermStart: 85,
+ PermEnd: 86
};
var c_oSer_HyperlinkType = {
Content: 0,
@@ -1713,6 +1742,48 @@ function readBookmarkEnd(length, bcr, oReadResult, paragraphContent) {
oReadResult.addBookmarkEnd(paragraphContent, bookmark, true);
return res;
}
+function readPermStart(length, bcr, oReadResult, paragraphContent) {
+ if ((typeof AscWord === "undefined") || (typeof AscWord.ParagraphPermStart === "undefined"))
+ return c_oSerConstants.ReadUnknown;
+
+ let permPr = {};
+ let res = readPermPr(length, bcr, permPr);
+ let permStart = AscWord.ParagraphPermStart.fromObject(permPr);
+ oReadResult.addPermStart(paragraphContent, permStart);
+ return res;
+}
+function readPermEnd(length, bcr, oReadResult, paragraphContent) {
+ if ((typeof AscWord === "undefined") || (typeof AscWord.ParagraphPermEnd === "undefined"))
+ return c_oSerConstants.ReadUnknown;
+
+ let permPr = {};
+ let res = readPermPr(length, bcr, permPr);
+ let permEnd = AscWord.ParagraphPermEnd.fromObject(permPr);
+ oReadResult.addPermEnd(paragraphContent, permEnd);
+ return res;
+}
+function readPermPr(length, bcr, permPr) {
+ let stream = bcr.stream;
+ return bcr.Read1(length, function(type, length) {
+ if (c_oSerPermission.Id === type)
+ permPr.id = stream.GetString2LE(length);
+ else if (c_oSerPermission.DisplacedByCustomXml === type)
+ permPr.displacedByCustomXml = stream.GetUChar();
+ else if (c_oSerPermission.ColFirst === type)
+ permPr.colFirst = stream.GetULongLE();
+ else if (c_oSerPermission.ColLast === type)
+ permPr.colLast = stream.GetULongLE();
+ else if (c_oSerPermission.Ed === type)
+ permPr.ed = stream.GetString2LE(length);
+ else if (c_oSerPermission.EdGroup === type)
+ permPr.edGrp = stream.GetUChar();
+ else
+ return c_oSerConstants.ReadUnknown;
+
+ return c_oSerConstants.ReadOk;
+ });
+}
+
function initMathRevisions(elem ,props, reader) {
if(props.del) {
elem.SetReviewTypeWithInfo(reviewtype_Remove, props.del, false);
@@ -5472,6 +5543,12 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
case para_RevisionMove:
WiteMoveRange(this.bs, this.saveParams, item);
break;
+ case para_PermStart:
+ case para_PermEnd:
+ this.bs.WriteItem(para_PermStart === item.Type ? c_oSerParType.PermStart : c_oSerParType.PermEnd, function() {
+ oThis.WritePermPr(item);
+ });
+ break;
}
}
if ((bLastRun && bUseSelection && !par.Selection_CheckParaEnd()) || (selectedAll != undefined && selectedAll === false) )
@@ -5844,6 +5921,37 @@ function BinaryDocumentTableWriter(memory, doc, oMapCommentId, oNumIdMap, copyPa
});
}
};
+ this.WritePermPr = function(permMark) {
+ let _t = this;
+ if (undefined !== permMark.getRangeId()) {
+ this.memory.WriteByte(c_oSerPermission.Id);
+ this.memory.WriteString2(permMark.getRangeId());
+ }
+ if (undefined !== permMark.getColFirst()) {
+ this.bs.WriteItem(c_oSerPermission.ColFirst, function() {
+ _t.memory.WriteLong(permMark.getColFirst());
+ });
+ }
+ if (undefined !== permMark.getColLast()) {
+ this.bs.WriteItem(c_oSerPermission.ColLast, function() {
+ _t.memory.WriteLong(permMark.getColLast());
+ });
+ }
+ if (undefined !== permMark.getDisplacedByCustomXml()) {
+ this.bs.WriteItem(c_oSerPermission.DisplacedByCustomXml, function() {
+ _t.memory.WriteByte(permMark.getDisplacedByCustomXml());
+ });
+ }
+ if (undefined !== permMark.getEd()) {
+ this.memory.WriteByte(c_oSerPermission.Ed);
+ this.memory.WriteString2(permMark.getEd());
+ }
+ if (undefined !== permMark.getEdGrp()) {
+ this.bs.WriteItem(c_oSerPermission.EdGroup, function() {
+ _t.memory.WriteByte(permMark.getEdGrp());
+ });
+ }
+ };
this.WriteRunContent = function (oRun, nStart, nEnd, delText)
{
@@ -8301,10 +8409,8 @@ function BinaryFileReader(doc, openParams)
api.sync_AddComment( oNewComment.Id, oNewComment.Data );
}
}
- //remove bookmarks without end
- this.oReadResult.deleteMarkupStartWithoutEnd(this.oReadResult.bookmarksStarted);
- //todo crush
- // this.oReadResult.deleteMarkupStartWithoutEnd(this.oReadResult.moveRanges);
+
+ this.oReadResult.deleteMarkupStartWithoutEnd();
if (this.oReadResult.DocumentContent.length > 0) {
this.Document.ReplaceContent(this.oReadResult.DocumentContent);
@@ -8689,11 +8795,9 @@ function BinaryFileReader(doc, openParams)
api.sync_AddComment( oNewComment.Id, oNewComment.Data );
}
}
- //remove bookmarks without end
- this.oReadResult.deleteMarkupStartWithoutEnd(this.oReadResult.bookmarksStarted);
- //todo crush
- // this.oReadResult.deleteMarkupStartWithoutEnd(this.oReadResult.moveRanges);
-
+
+ this.oReadResult.deleteMarkupStartWithoutEnd();
+
for (var i = 0, length = this.oReadResult.aTableCorrect.length; i < length; ++i) {
var table = this.oReadResult.aTableCorrect[i];
table.ReIndexing(0);
@@ -11279,8 +11383,13 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curNot
});
} else if (c_oSerParType.JsaProject === type) {
this.Document.DrawingDocument.m_oWordControl.m_oApi.macros.SetData(AscCommon.GetStringUtf8(this.stream, length));
- } else
- res = c_oSerConstants.ReadUnknown;
+ } else if (c_oSerParType.PermStart === type) {
+ res = readPermStart(length, this.bcr, this.oReadResult, null);
+ } else if (c_oSerParType.PermEnd === type) {
+ res = readPermEnd(length, this.bcr, this.oReadResult, this.oReadResult.lastPar);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
this.ReadDocParts = function (type, length, glossary) {
@@ -11612,8 +11721,14 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curNot
res = readMoveRangeStart(length, this.bcr, this.stream, this.oReadResult, paragraphContent, false);
} else if ( c_oSerParType.MoveToRangeEnd === type && this.oReadResult.checkReadRevisions()) {
res = readMoveRangeEnd(length, this.bcr, this.stream, this.oReadResult, paragraphContent);
- } else
- res = c_oSerConstants.ReadUnknown;
+ } else if (c_oSerParType.PermStart === type) {
+ res = readPermStart(length, this.bcr, this.oReadResult, paragraphContent);
+ } else if (c_oSerParType.PermEnd === type) {
+ res = readPermEnd(length, this.bcr, this.oReadResult, paragraphContent);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
+
return res;
};
this.AppendQuoteToCurrentComments = function(text) {
@@ -12808,8 +12923,13 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curNot
res = readMoveRangeStart(length, this.bcr, this.stream, this.oReadResult, null, false);
} else if (c_oSerDocTableType.MoveToRangeEnd === type && this.oReadResult.checkReadRevisions()) {
res = readMoveRangeEnd(length, this.bcr, this.stream, this.oReadResult, this.oReadResult.lastPar, true);
- } else
- res = c_oSerConstants.ReadUnknown;
+ } else if (c_oSerDocTableType.PermStart === type) {
+ res = readPermStart(length, this.bcr, this.oReadResult, null);
+ } else if (c_oSerDocTableType.PermEnd === type) {
+ res = readPermEnd(length, this.bcr, this.oReadResult, this.oReadResult.lastPar);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
this.Read_Row = function(type, length, Row)
@@ -12861,8 +12981,13 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curNot
res = readMoveRangeStart(length, this.bcr, this.stream, this.oReadResult, null, false);
} else if (c_oSerDocTableType.MoveToRangeEnd === type && this.oReadResult.checkReadRevisions()) {
res = readMoveRangeEnd(length, this.bcr, this.stream, this.oReadResult, this.oReadResult.lastPar, true);
- } else
- res = c_oSerConstants.ReadUnknown;
+ } else if (c_oSerDocTableType.PermStart === type) {
+ res = readPermStart(length, this.bcr, this.oReadResult, null);
+ } else if (c_oSerDocTableType.PermEnd === type) {
+ res = readPermEnd(length, this.bcr, this.oReadResult, this.oReadResult.lastPar);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
return res;
};
this.ReadCell = function(type, length, cell)
@@ -13795,8 +13920,13 @@ function Binary_oMathReader(stream, oReadResult, curNote, openParams)
res = readMoveRangeStart(length, this.bcr, this.stream, this.oReadResult, paragraphContent, false);
} else if (c_oSer_OMathContentType.MoveToRangeEnd === type && this.oReadResult.checkReadRevisions()) {
res = readMoveRangeEnd(length, this.bcr, this.stream, this.oReadResult, paragraphContent);
- } else
- res = c_oSerConstants.ReadUnknown;
+ } else if (c_oSer_OMathContentType.PermStart === type) {
+ res = readPermStart(length, this.bcr, this.oReadResult, paragraphContent);
+ } else if (c_oSer_OMathContentType.PermEnd === type) {
+ res = readPermEnd(length, this.bcr, this.oReadResult, paragraphContent);
+ } else {
+ res = c_oSerConstants.ReadUnknown;
+ }
if (oElem && bLast)
oElem.Correct_Content(false);
@@ -17280,6 +17410,7 @@ function DocReadResult(doc) {
this.endnotes = {};
this.endnoteRefs = [];
this.bookmarksStarted = {};
+ this.permRangesStarted = {};
this.moveRanges = {};
this.Application;
this.AppVersion;
@@ -17359,6 +17490,39 @@ DocReadResult.prototype = {
this.toNextPar.push({type: para_RevisionMove, elem: elem, id: id});
}
},
+ addPermStart: function(paragraphContent, elem, canAddToNext) {
+ let rangeId = elem.getRangeId();
+ if (undefined === rangeId || null === rangeId)
+ return;
+
+ if (this.bCopyPaste)
+ return;
+
+ if (paragraphContent)
+ {
+ this.permRangesStarted[rangeId] = {parent : paragraphContent, elem : elem};
+ paragraphContent.AddToContentToEnd(elem);
+ }
+ else if (canAddToNext)
+ {
+ this.toNextPar.push(elem);
+ }
+ },
+ addPermEnd: function(paragraphContent, elem, canAddToNext) {
+ let rangeId = elem.getRangeId();
+ if (!this.permRangesStarted[rangeId])
+ return;
+
+ if (paragraphContent)
+ {
+ delete this.permRangesStarted[rangeId];
+ paragraphContent.AddToContentToEnd(elem);
+ }
+ else if (canAddToNext)
+ {
+ this.toNextPar.push(elem);
+ }
+ },
addToNextPar: function(par) {
if (this.toNextPar.length > 0) {
for (var i = 0; i < this.toNextPar.length; i++) {
@@ -17378,13 +17542,26 @@ DocReadResult.prototype = {
this.addMoveRangeEnd(par, elem.elem, elem.id, false);
}
break;
+ case para_PermStart:
+ this.addPermStart(par, elem.elem, false);
+ break;
+ case para_PermEnd:
+ this.addPermEnd(par, elem.elem, false);
+ break;
}
}
this.toNextPar = [];
}
this.lastPar = par;
},
- deleteMarkupStartWithoutEnd: function(elems) {
+ deleteMarkupStartWithoutEnd: function() {
+ this._deleteMarkupStartWithoutEnd(this.bookmarksStarted);
+ this._deleteMarkupStartWithoutEnd(this.permRangesStarted);
+ //todo crush
+ // this._deleteMarkupStartWithoutEnd(this.moveRanges);
+ },
+
+ _deleteMarkupStartWithoutEnd: function(elems) {
for (var id in elems) {
if (elems.hasOwnProperty(id)) {
let elem = elems[id];
diff --git a/word/Editor/StructuredDocumentTags/BlockLevel.js b/word/Editor/StructuredDocumentTags/BlockLevel.js
index 9e59184ba9..63a0059de2 100644
--- a/word/Editor/StructuredDocumentTags/BlockLevel.js
+++ b/word/Editor/StructuredDocumentTags/BlockLevel.js
@@ -2725,3 +2725,4 @@ window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].CBlockLevelSdt = CBlockLevelSdt;
window['AscCommonWord'].type_BlockLevelSdt = type_BlockLevelSdt;
window["AscWord"].CBlockLevelSdt = CBlockLevelSdt;
+window["AscWord"].BlockLevelSdt = CBlockLevelSdt;
diff --git a/word/Editor/Styles.js b/word/Editor/Styles.js
index 177392ab14..7d63864ccd 100644
--- a/word/Editor/Styles.js
+++ b/word/Editor/Styles.js
@@ -12266,7 +12266,7 @@ CRFonts.prototype.Merge = function(oRFonts)
this.AsciiTheme = oRFonts.AsciiTheme;
this.Ascii = undefined;
}
- else if (oRFonts.Ascii)
+ else if (oRFonts.Ascii && oRFonts.Ascii.Name)
{
this.Ascii = oRFonts.Ascii;
this.AsciiTheme = undefined;
@@ -12277,7 +12277,7 @@ CRFonts.prototype.Merge = function(oRFonts)
this.EastAsiaTheme = oRFonts.EastAsiaTheme;
this.EastAsia = undefined;
}
- else if (oRFonts.EastAsia)
+ else if (oRFonts.EastAsia && oRFonts.EastAsia.Name)
{
this.EastAsia = oRFonts.EastAsia;
this.EastAsiaTheme = undefined;
@@ -12288,7 +12288,7 @@ CRFonts.prototype.Merge = function(oRFonts)
this.HAnsiTheme = oRFonts.HAnsiTheme;
this.HAnsi = undefined;
}
- else if (oRFonts.HAnsi)
+ else if (oRFonts.HAnsi && oRFonts.HAnsi.Name)
{
this.HAnsi = oRFonts.HAnsi;
this.HAnsiTheme = undefined;
@@ -12299,7 +12299,7 @@ CRFonts.prototype.Merge = function(oRFonts)
this.CSTheme = oRFonts.CSTheme;
this.CS = undefined;
}
- else if (oRFonts.CS)
+ else if (oRFonts.CS && oRFonts.CS.Name)
{
this.CS = oRFonts.CS;
this.CSTheme = undefined;
@@ -12990,7 +12990,7 @@ CTextPr.prototype.Merge = function(TextPr)
if (undefined != TextPr.Underline)
this.Underline = TextPr.Underline;
- if (undefined != TextPr.FontFamily)
+ if (undefined != TextPr.FontFamily && undefined !== TextPr.FontFamily.Name)
{
this.FontFamily = {};
this.FontFamily.Name = TextPr.FontFamily.Name;
diff --git a/word/Editor/Table/TableCell.js b/word/Editor/Table/TableCell.js
index 4f09ee1235..e84b95129a 100644
--- a/word/Editor/Table/TableCell.js
+++ b/word/Editor/Table/TableCell.js
@@ -2771,6 +2771,10 @@ CTableCell.prototype.OnContentChange = function()
if (table)
table.OnContentChange();
};
+CTableCell.prototype.PreDelete = function()
+{
+ this.Content.PreDelete();
+};
function CTableCellRecalculateObject()
diff --git a/word/Editor/Table/TableRow.js b/word/Editor/Table/TableRow.js
index 1a59d1b13a..abb8cc2692 100644
--- a/word/Editor/Table/TableRow.js
+++ b/word/Editor/Table/TableRow.js
@@ -225,18 +225,10 @@ CTableRow.prototype =
PreDelete : function()
{
- var CellsCount = this.Get_CellsCount();
- for ( var CurCell = 0; CurCell < CellsCount; CurCell++ )
- {
- var Cell = this.Get_Cell( CurCell );
-
- var CellContent = Cell.Content.Content;
- var ContentCount = CellContent.length;
- for ( var Pos = 0; Pos < ContentCount; Pos++ )
- {
- CellContent[Pos].PreDelete();
- }
- }
+ for (let iCell = 0, cellCount = this.GetCellsCount(); iCell < cellCount; ++iCell)
+ {
+ this.GetCell(iCell).PreDelete();
+ }
},
//-----------------------------------------------------------------------------------
// Работаем с стилем строки
@@ -608,6 +600,8 @@ CTableRow.prototype =
Remove_Cell : function(Index)
{
+ this.Content[Index].PreDelete();
+
AscCommon.History.Add(new CChangesTableRowRemoveCell(this, Index, [this.Content[Index]]));
this.Content.splice(Index, 1);
diff --git a/word/Editor/annotations/annotation-mark-base.js b/word/Editor/annotations/annotation-mark-base.js
new file mode 100644
index 0000000000..b66ccacf36
--- /dev/null
+++ b/word/Editor/annotations/annotation-mark-base.js
@@ -0,0 +1,92 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2024
+ *
+ * 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 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * 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
+ *
+ */
+
+"use strict";
+
+(function()
+{
+ /**
+ * Base class for annotation marks like bookmarkStart/bookmarkEnd/permStart/permEnd/commentStart/commentEnd
+ * @constructor
+ */
+ function AnnotationMarkBase()
+ {
+ }
+
+ AnnotationMarkBase.prototype.isPermMark = function()
+ {
+ return false;
+ };
+ AnnotationMarkBase.prototype.isCommentMark = function()
+ {
+ return false;
+ };
+ AnnotationMarkBase.prototype.isBookmarkMark = function()
+ {
+ return false;
+ };
+ AnnotationMarkBase.prototype.isStart = function()
+ {
+ return false;
+ };
+ AnnotationMarkBase.prototype.isEnd = function()
+ {
+ return false;
+ };
+ AnnotationMarkBase.prototype.isUseInDocument = function()
+ {
+ let paragraph = this.getParagraph();
+ if (!paragraph)
+ return false;
+
+ return (paragraph && paragraph.IsUseInDocument() && !!paragraph.Get_PosByElement(this));
+ };
+ AnnotationMarkBase.prototype.getParagraph = function()
+ {
+ return this.GetParagraph();
+ };
+ AnnotationMarkBase.prototype.removeMark = function()
+ {
+ let paragraph = this.getParagraph();
+ if (!paragraph)
+ return false;
+
+ return paragraph.RemoveElement(this);
+ };
+ AnnotationMarkBase.prototype.getPositionInDocument = function()
+ {
+ return this.GetDocumentPositionFromObject();
+ };
+ //--------------------------------------------------------export----------------------------------------------------
+ AscWord.AnnotationMarkBase = AnnotationMarkBase;
+})();
+
diff --git a/word/Editor/annotations/paragraph-perm.js b/word/Editor/annotations/paragraph-perm.js
new file mode 100644
index 0000000000..e5b0089d26
--- /dev/null
+++ b/word/Editor/annotations/paragraph-perm.js
@@ -0,0 +1,335 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2024
+ *
+ * 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 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * 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
+ *
+ */
+
+"use strict";
+
+(function()
+{
+
+ /**
+ * @constructor
+ * @extends {CParagraphContentBase}
+ */
+ function ParagraphPermBase()
+ {
+ CParagraphContentBase.call(this);
+ this.Id = AscCommon.g_oIdCounter.Get_NewId();
+ AscCommon.g_oTableId.Add(this, this.Id);
+ }
+
+ ParagraphPermBase.prototype = Object.create(CParagraphContentBase.prototype);
+ ParagraphPermBase.prototype.constructor = ParagraphPermBase;
+ Object.assign(ParagraphPermBase.prototype, AscWord.AnnotationMarkBase.prototype);
+
+ ParagraphPermBase.prototype.Get_Id = function()
+ {
+ return this.Id;
+ };
+ ParagraphPermBase.prototype.GetId = function()
+ {
+ return this.Id;
+ };
+ ParagraphPermBase.prototype.Copy = function()
+ {
+ return new this.constructor();
+ };
+ ParagraphPermBase.prototype.PreDelete = function()
+ {
+ let logicDocument = this.GetLogicDocument();
+ if (!logicDocument || !logicDocument.IsDocumentEditor())
+ return;
+
+ logicDocument.OnDeleteAnnotationMark(this);
+ };
+ ParagraphPermBase.prototype.SetParagraph = function(p)
+ {
+ CParagraphContentBase.prototype.SetParagraph.call(this, p);
+ AscWord.registerPermRangeMark(this);
+ };
+ ParagraphPermBase.prototype.GetAllPermRangeMarks = function(marks)
+ {
+ marks.push(this);
+ };
+ /**
+ * Очень важно, что в режимах комментирования и просмотра, мы проход через данный элемент считаем как перемещение курсора,
+ * т.к. на этом завязано выделение текущего слова и применение настроек к текущему слову (оно должно применяться
+ * только к той части, что внутри разрешенного диапазона)
+ * @returns {boolean}
+ */
+ ParagraphPermBase.prototype.IsStopCursorOnEntryExit = function()
+ {
+ let logicDocument = this.GetLogicDocument();
+ if (!logicDocument || !logicDocument.IsDocumentEditor())
+ return false;
+
+ let api = logicDocument.GetApi();
+ return api.isRestrictionComments() || api.isRestrictionView();
+ };
+ ParagraphPermBase.prototype.isPermMark = function()
+ {
+ return true;
+ };
+ ParagraphPermBase.prototype.getRangeId = function()
+ {
+ return this.rangeId;
+ };
+ ParagraphPermBase.prototype.getColFirst = function()
+ {
+ return this.colFirst;
+ };
+ ParagraphPermBase.prototype.getColLast = function()
+ {
+ return this.colLast;
+ };
+ ParagraphPermBase.prototype.getDisplacedByCustomXml = function()
+ {
+ return this.displacedByCustomXml;
+ };
+ ParagraphPermBase.prototype.getEd = function()
+ {
+ return this.ed;
+ };
+ ParagraphPermBase.prototype.getEdGrp = function()
+ {
+ return this.edGrp;
+ };
+ //----------------------------------------------------------------------------------------------------------------------
+ // Collaboration
+ //----------------------------------------------------------------------------------------------------------------------
+ ParagraphPermBase.prototype.Refresh_RecalcData = function()
+ {
+ };
+
+ /**
+ * @param rangeId
+ * @param colFirst
+ * @param colLast
+ * @param displacedByCustomXml
+ * @param ed
+ * @param edGrp
+ * @constructor
+ * @extends {ParagraphPermBase}
+ */
+ function ParagraphPermStart(rangeId, colFirst, colLast, displacedByCustomXml, ed, edGrp)
+ {
+ this.rangeId = rangeId;
+ this.colFirst = undefined !== colFirst && null !== colFirst ? colFirst : undefined;
+ this.colLast = undefined !== colLast && null !== colLast ? colLast : undefined;
+ this.displacedByCustomXml = undefined !== displacedByCustomXml && null !== displacedByCustomXml ? displacedByCustomXml : undefined;
+ this.ed = undefined !== ed && null !== ed ? ed : undefined;
+ this.edGrp = undefined !== edGrp && null !== edGrp ? edGrp : undefined;
+
+ ParagraphPermBase.call(this);
+
+ this.Type = para_PermStart;
+ }
+ ParagraphPermStart.prototype = Object.create(ParagraphPermBase.prototype);
+ ParagraphPermStart.prototype.constructor = ParagraphPermStart;
+
+ ParagraphPermStart.fromObject = function(obj)
+ {
+ if (!obj)
+ obj = {};
+
+ return new ParagraphPermStart(obj.id, obj.colFirst, obj.colLast, obj.displacedByCustomXml, obj.ed, obj.edGrp);
+ };
+ ParagraphPermStart.prototype.isStart = function()
+ {
+ return true;
+ };
+ ParagraphPermStart.prototype.Draw_HighLights = function(PDSH)
+ {
+ PDSH.addPermRange(this.rangeId);
+ };
+ ParagraphPermStart.prototype.Recalculate_PageEndInfo = function(PRSI, curLine, curRange)
+ {
+ PRSI.addPermRange(this.rangeId);
+ };
+ ParagraphPermStart.prototype.RecalculateEndInfo = function(PRSI)
+ {
+ PRSI.addPermRange(this.rangeId);
+ };
+ ParagraphPermStart.prototype.GetCurrentPermRanges = function(permRanges, isCurrent)
+ {
+ let pos = permRanges.indexOf(this.rangeId);
+ // TODO: Такого не должно быть
+ if (-1 !== pos)
+ return;
+
+ permRanges.push(this.rangeId);
+ };
+ ParagraphPermStart.prototype.Copy = function()
+ {
+ return new ParagraphPermStart(this.rangeId, this.colFirst, this.colLast, this.displacedByCustomXml, this.ed, this.edGrp);
+ };
+ ParagraphPermStart.prototype.Write_ToBinary2 = function(writer)
+ {
+ writer.WriteLong(AscDFH.historyitem_type_ParagraphPermStart);
+
+ writer.WriteString2("" + this.Id);
+ writer.WriteString2("" + this.rangeId);
+
+ let startPos = writer.GetCurPosition();
+ writer.Skip(4);
+ let flags = 0;
+
+ if (undefined !== this.colFirst)
+ {
+ writer.WriteLong(this.colFirst);
+ flags |= 1;
+ }
+
+ if (undefined !== this.colLast)
+ {
+ writer.WriteLong(this.colLast);
+ flags |= 2;
+ }
+
+ if (undefined !== this.displacedByCustomXml)
+ {
+ writer.WriteByte(this.displacedByCustomXml);
+ flags |= 4;
+ }
+
+ if (undefined !== this.ed)
+ {
+ writer.WriteString2(this.ed);
+ flags |= 8;
+ }
+
+ if (undefined !== this.edGrp)
+ {
+ writer.WriteByte(this.edGrp);
+ flags |= 16;
+ }
+
+ let endPos = writer.GetCurPosition();
+ writer.Seek(startPos);
+ writer.WriteLong(flags);
+ writer.Seek(endPos);
+ };
+ ParagraphPermStart.prototype.Read_FromBinary2 = function(reader)
+ {
+ this.Id = reader.GetString2();
+ this.rangeId = reader.GetString2();
+
+ let flags = reader.GetLong();
+
+ if (flags & 1)
+ this.colFirst = reader.GetLong();
+
+ if (flags & 2)
+ this.colLast = reader.GetLong();
+
+ if (flags & 4)
+ this.displacedByCustomXml = reader.GetByte();
+
+ if (flags & 8)
+ this.ed = reader.GetString2();
+
+ if (flags & 16)
+ this.edGrp = reader.GetByte();
+ };
+
+ /**
+ * @param rangeId
+ * @constructor
+ * @extends {ParagraphPermBase}
+ */
+ function ParagraphPermEnd(rangeId)
+ {
+ this.rangeId = rangeId;
+ ParagraphPermBase.call(this);
+
+ this.Type = para_PermEnd;
+ }
+ ParagraphPermEnd.prototype = Object.create(ParagraphPermBase.prototype);
+ ParagraphPermEnd.prototype.constructor = ParagraphPermEnd;
+
+ ParagraphPermEnd.fromObject = function(obj)
+ {
+ if (!obj)
+ return null;
+
+ return new ParagraphPermEnd(obj.id);
+ };
+ ParagraphPermEnd.prototype.isEnd = function()
+ {
+ return true;
+ };
+ ParagraphPermEnd.prototype.Draw_HighLights = function(PDSH)
+ {
+ PDSH.removePermRange(this.rangeId);
+ };
+ ParagraphPermEnd.prototype.Recalculate_PageEndInfo = function(PRSI, curLine, curRange)
+ {
+ PRSI.removePermRange(this.rangeId);
+ };
+ ParagraphPermEnd.prototype.RecalculateEndInfo = function(PRSI)
+ {
+ PRSI.removePermRange(this.rangeId);
+ };
+ ParagraphPermEnd.prototype.GetCurrentPermRanges = function(permRanges, isCurrent)
+ {
+ let pos = permRanges.indexOf(this.rangeId);
+
+ // TODO: Такого не должно быть
+ if (-1 === pos)
+ return;
+
+ if (pos === permRanges.length - 1)
+ --permRanges.length;
+ else
+ permRanges.splice(pos, 1);
+ };
+ ParagraphPermEnd.prototype.Copy = function()
+ {
+ return new ParagraphPermEnd(this.rangeId);
+ };
+ ParagraphPermEnd.prototype.Write_ToBinary2 = function(writer)
+ {
+ writer.WriteLong(AscDFH.historyitem_type_ParagraphPermEnd);
+
+ writer.WriteString2("" + this.Id);
+ writer.WriteString2("" + this.rangeId);
+ };
+ ParagraphPermEnd.prototype.Read_FromBinary2 = function(reader)
+ {
+ this.Id = reader.GetString2();
+ this.rangeId = reader.GetString2();
+ };
+
+ //--------------------------------------------------------export----------------------------------------------------
+ AscWord.ParagraphPermStart = ParagraphPermStart;
+ AscWord.ParagraphPermEnd = ParagraphPermEnd;
+})();
+
diff --git a/word/Editor/annotations/perm-ranges-manager.js b/word/Editor/annotations/perm-ranges-manager.js
new file mode 100644
index 0000000000..2530770854
--- /dev/null
+++ b/word/Editor/annotations/perm-ranges-manager.js
@@ -0,0 +1,185 @@
+/*
+ * (c) Copyright Ascensio System SIA 2010-2024
+ *
+ * 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 20A-6 Ernesta Birznieka-Upish
+ * street, Riga, Latvia, EU, LV-1050.
+ *
+ * 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
+ *
+ */
+
+"use strict";
+
+(function()
+{
+ let marksToCheck = [];
+
+ /**
+ * @param logicDocument {AscWord.Document}
+ * @constructor
+ */
+ function PermRangesManager(logicDocument)
+ {
+ this.logicDocument = logicDocument
+
+ this.ranges = {};
+ }
+
+ /**
+ * Статический метод, который проверяет попадаем ли целиком в разрешенный диапазон по заданным стартовому и
+ * конечному диапазонам
+ * @param startRanges
+ * @param endRanges
+ */
+ PermRangesManager.isInPermRange = function(startRanges, endRanges)
+ {
+ // TODO: Пока мы просто проверяем само наличие диапазона, в будущем надо проверяеть пользователя
+
+ if (endRanges.length < 0)
+ return false;
+
+ for (let iRange = 0, rangeCount = endRanges.length; iRange < rangeCount; ++iRange)
+ {
+ if (-1 !== startRanges.indexOf(endRanges[iRange]))
+ return true;
+ }
+
+ return false;
+ };
+ PermRangesManager.prototype.addMark = function(mark)
+ {
+ let rangeId = mark.getRangeId();
+ if (!this.ranges[rangeId])
+ this.ranges[rangeId] = {};
+
+ if (mark.isStart())
+ this.ranges[rangeId].start = mark;
+ else
+ this.ranges[rangeId].end = mark;
+ };
+ PermRangesManager.prototype.getStartMark = function(rangeId)
+ {
+ this.updateMarks();
+
+ if (!this.ranges[rangeId] || !this.ranges[rangeId].start)
+ return null
+
+ return this.ranges[rangeId].start;
+ };
+ PermRangesManager.prototype.getEndMark = function(rangeId)
+ {
+ this.updateMarks();
+
+ if (!this.ranges[rangeId] || !this.ranges[rangeId].end)
+ return null;
+
+ return this.ranges[rangeId].end;
+ };
+ PermRangesManager.prototype.updateMarks = function()
+ {
+ for (let i = 0, count = marksToCheck.length; i < count; ++i)
+ {
+ let mark = marksToCheck[i];
+ if (!mark.isUseInDocument())
+ continue;
+
+ this.addMark(mark);
+ }
+
+ marksToCheck.length = 0;
+ };
+ /**
+ * Проверяем заданный отрезок, если он невалидный или пустой, тогда удаляем его из документа
+ * @param {number} rangeId
+ */
+ PermRangesManager.prototype.checkRange = function(rangeId)
+ {
+ this.updateMarks();
+
+ if (!this._isValidRange(rangeId) || this._isEmptyRange(rangeId))
+ this.removeRange(rangeId);
+ };
+ PermRangesManager.prototype.removeRange = function(rangeId)
+ {
+ if (!this.ranges[rangeId])
+ return;
+
+ if (this.ranges[rangeId].start)
+ this.ranges[rangeId].start.removeMark();
+
+ if (this.ranges[rangeId].end)
+ this.ranges[rangeId].end.removeMark();
+
+ delete this.ranges[rangeId];
+ };
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ // Private area
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ PermRangesManager.prototype._isValidRange = function(rangeId)
+ {
+ if (!this.ranges[rangeId])
+ return false;
+
+ let start = this.ranges[rangeId].start;
+ let end = this.ranges[rangeId].end;
+
+ if (!start || !end || !start.isUseInDocument() || !end.isUseInDocument())
+ return false;
+
+ let startPos = start.getPositionInDocument();
+ let endPos = end.getPositionInDocument();
+
+ if (!startPos || !endPos)
+ return false;
+
+ return AscWord.CompareDocumentPositions(startPos, endPos) <= 0;
+ };
+ PermRangesManager.prototype._isEmptyRange = function(rangeId)
+ {
+ // Здесь мы считаем, что заданный отрезок валидный
+
+ let state = this.logicDocument.SaveDocumentState();
+
+ let startPos = this.ranges[rangeId].start.getPositionInDocument();
+ let endPos = this.ranges[rangeId].end.getPositionInDocument();
+
+ this.logicDocument.SetSelectionByContentPositions(startPos, endPos);
+ let result = this.logicDocument.IsSelectionEmpty();
+
+ this.logicDocument.LoadDocumentState(state);
+
+ return result;
+ };
+
+ function registerPermRangeMark(mark)
+ {
+ marksToCheck.push(mark);
+ }
+ //--------------------------------------------------------export----------------------------------------------------
+ AscWord.PermRangesManager = PermRangesManager;
+ AscWord.registerPermRangeMark = registerPermRangeMark;
+
+})();
+
diff --git a/word/api.js b/word/api.js
index f14f2dc570..9d70754289 100644
--- a/word/api.js
+++ b/word/api.js
@@ -2497,8 +2497,9 @@ background-repeat: no-repeat;\
this.WordControl.m_oLogicDocument.Document_Undo();
_logicDoc.StartAction(AscDFH.historydescription_Document_PasteHotKey);
- AscCommon.Editor_Paste_Exec(this, null, null, null, null, props);
- _logicDoc.FinalizeAction();
+ AscCommon.Editor_Paste_Exec(this, null, null, null, null, props, function () {
+ _logicDoc.FinalizeAction();
+ });
}
};
@@ -13589,7 +13590,11 @@ background-repeat: no-repeat;\
return true;
};
-
+ asc_docs_api.prototype.canEnterText = function()
+ {
+ let logicDocument = this.private_GetLogicDocument();
+ return logicDocument ? logicDocument.canEnterText() : false;
+ };
asc_docs_api.prototype.updateDarkMode = function()
{
if (!this.WordControl || !this.WordControl.m_oDrawingDocument)