1
0
mirror of https://github.com/ONLYOFFICE/sdkjs.git synced 2025-04-18 14:24:11 +03:00

Merge branch hotfix/v8.3.3 into master

This commit is contained in:
papacarlo 2025-04-16 07:36:50 +00:00
commit 3377e3fd5c
58 changed files with 2316 additions and 1509 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3434,6 +3434,13 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
cBaseFunction.prototype.Calculate = function () {
return new cError(cErrorType.wrong_name);
};
cBaseFunction.prototype.getArrayIndex = function (index) {
let res = false;
if (this.arrayIndexes) {
res = this.arrayIndexes[index];
}
return res;
};
cBaseFunction.prototype.Assemble2 = function (arg, start, count) {
var str = "", c = start + count - 1;
@ -3867,7 +3874,6 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
}
}
var arrayIndexes = this.arrayIndexes;
var replaceAreaByValue = cReturnFormulaType.value_replace_area === returnFormulaType;
var replaceAreaByRefs = cReturnFormulaType.area_to_ref === returnFormulaType;
//добавлен специальный тип для функции сT, она использует из области всегда первый аргумент
@ -3876,13 +3882,14 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
// Проверка должен ли элемент поступать в формулу без изменени?
const checkArrayIndex = function(index) {
let res = false;
if(arrayIndexes) {
if(arrayIndexes[index] === arrayIndexesType.any) {
let arrayIndex = t.getArrayIndex(index);
if(arrayIndex) {
if(arrayIndex === arrayIndexesType.any) {
res = true;
} else if(typeof arrayIndexes[index] === "object") {
} else if(typeof arrayIndex === "object") {
//для данной проверки запрашиваем у объекта 0 индекс, там хранится значение индекса аргумента
//от которого зависит стоит ли вопринимать данный аргумент как массив или нет
let tempsArgIndex = arrayIndexes[index][0];
let tempsArgIndex = arrayIndex[0];
if(undefined !== tempsArgIndex && arg[tempsArgIndex]) {
if(cElementType.cellsRange === arg[tempsArgIndex].type || cElementType.cellsRange3D === arg[tempsArgIndex].type || cElementType.array === arg[tempsArgIndex].type) {
res = true;
@ -3896,7 +3903,8 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
const checkArayIndexType = function(index, argType) {
// check for type of argument - whether array and range can be processed or just one of them
let res = false;
if(arrayIndexes && argType === arrayIndexes[index]) {
let arrayIndex = t.getArrayIndex(index);
if(argType === arrayIndex) {
res = true;
}
return res;
@ -3920,7 +3928,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
//bIsSpecialFunction - сделано только для для функции sumproduct
//необходимо, чтобы все внутренние функции возвращали массив, те обрабатывались как формулы массива
if((true === this.bArrayFormula || bIsSpecialFunction) && (!returnFormulaType || replaceAreaByValue || replaceAreaByRefs || arrayIndexes || replaceOnlyArray)) {
if((true === this.bArrayFormula || bIsSpecialFunction) && (!returnFormulaType || replaceAreaByValue || replaceAreaByRefs || this.arrayIndexes || replaceOnlyArray)) {
if (functionsCanReturnArray.indexOf(this.name.toLowerCase()) !== -1) {
var _tmp = this.Calculate(arg, opt_bbox, opt_defName, this.ws, bIsSpecialFunction);
@ -4086,12 +4094,13 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
const checkArrayIndex = function(index) {
let res = false;
if(arrayIndexes) {
if(1 === arrayIndexes[index]) {
let arrayIndex = t.getArrayIndex(index);
if(1 === arrayIndex) {
res = true;
} else if(typeof arrayIndexes[index] === "object") {
} else if(typeof arrayIndex === "object") {
// for this situation check object 0 for an index, the value of the argument index is stored there
// which determines whether a given argument should be treated as an array or not
let tempsArgIndex = arrayIndexes[index][0];
let tempsArgIndex = arrayIndex[0];
if(undefined !== tempsArgIndex && arg[tempsArgIndex]) {
if(cElementType.cellsRange === arg[tempsArgIndex].type || cElementType.cellsRange3D === arg[tempsArgIndex].type || cElementType.array === arg[tempsArgIndex].type) {
res = true;
@ -4139,7 +4148,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
let width = 1, height = 1;
for (let i = 0; i < arg.length; i++) {
if (!this.arrayIndexes || !this.arrayIndexes[i]) {
if (!this.arrayIndexes || !this.getArrayIndex(i)) {
let objSize = arg[i].getDimensions();
if (objSize) {
height = Math.max(objSize.row, height);

View File

@ -5175,6 +5175,9 @@ function (window, undefined) {
cCOUNTIFS.prototype.numFormat = AscCommonExcel.cNumFormatNone;
//TODO все четные - на вход должны приходить как array/area
cCOUNTIFS.prototype.arrayIndexes = {0: 1, 2: 1, 4: 1, 6: 1, 8: 1};
cCOUNTIFS.prototype.getArrayIndex = function (index) {
return index % 2 === 0 ? 1 : null;
};
cCOUNTIFS.prototype.returnValueType = AscCommonExcel.cReturnFormulaType.area_to_ref;
cCOUNTIFS.prototype.argumentsType = [[argType.reference, argType.any]];
cCOUNTIFS.prototype.Calculate = function (arg) {

View File

@ -1299,7 +1299,7 @@ function (window, undefined) {
ref = formulaParsed.ref,
coords = AscCommonExcel.getFromCellIndex(cellIndex, true),
row = coords.row, col = coords.col, shared, base,
length = formulaParsed.outStack.length, isPartOfFunc, numberOfArgs, funcReturnType, funcArrayIndexes;
length = formulaParsed.outStack.length, isPartOfFunc, numberOfArgs, funcReturnType, funcArray;
if (formulaParsed.shared !== null) {
shared = formulaParsed.getShared();
@ -1312,7 +1312,7 @@ function (window, undefined) {
continue;
}
if (numberOfArgs <= 0) {
funcArrayIndexes = null;
funcArray = null;
isPartOfFunc = null;
}
@ -1323,9 +1323,9 @@ function (window, undefined) {
if (funcReturnType === AscCommonExcel.cReturnFormulaType.array) {
// range refers to formula, add property inFormulaRef = true
inFormulaRef = true;
} else if (funcArrayIndexes) {
} else if (funcArray) {
// if have no returnType check for arrayIndexes and if element pass in raw form(as array, range) to argument
if (funcArrayIndexes[numberOfArgs - 1]) {
if (funcArray.getArrayIndex(numberOfArgs - 1)) {
inFormulaRef = true;
}
}
@ -1336,7 +1336,7 @@ function (window, undefined) {
isPartOfFunc = true;
numberOfArgs = formulaParsed.outStack[i - 1];
funcReturnType = elem.returnValueType;
funcArrayIndexes = elem.arrayIndexes;
funcArray = elem;
}
let is3D = elemType === cElementType.cell3D || elemType === cElementType.cellsRange3D || elemType === cElementType.name3D,

View File

@ -15460,11 +15460,14 @@
const aExcludeFormulas = AscCommonExcel.aExcludeRecursiveFormulas;
const oCycleCells = new Map();
_foreachRefElements(function (oElem, nIndex) {
_foreachRefElements(function (oElem, nIndex, nLastIndex) {
if (oElem.containCell2(oListenerCell)) {
const nIndexWithFunction = nIndex + 2;
if (nIndexWithFunction > nLastIndex) {
return;
}
const oElemWithFunction = aOutStack[nIndexWithFunction];
if (oElemWithFunction.type === cElementType.func && aExcludeFormulas.includes(oElemWithFunction.name)) {
if (oElemWithFunction && oElemWithFunction.type === cElementType.func && aExcludeFormulas.includes(oElemWithFunction.name)) {
oCycleCells.set(true, nIndex);
return;
}
@ -15606,10 +15609,10 @@
});
if (oTableStructOperand) {
let oTableOpRange = oTableStructOperand.getRange();
if (!oTableOpRange.bbox.contains(this.nCol, this.nRow)) {
if (oTableOpRange.bbox && !oTableOpRange.bbox.contains(this.nCol, this.nRow)) {
return;
}
let bContainRange = oCellListeners.bbox.containsRange(oTableOpRange.bbox);
let bContainRange = oCellListeners.bbox && oCellListeners.bbox.containsRange(oTableOpRange.bbox);
if (bContainRange && oCellListeners.bbox.contains(this.nCol, this.nRow)) {
g_cCalcRecursion.setStartCellIndex({cellId: nCellIndex, wsName: this.ws.getName().toLowerCase()});
}

View File

@ -2213,6 +2213,7 @@
}
AscCommon.global_mouseEvent.LockMouse();
AscCommon.capturePointer(event, this.element);
if (t.view.Api.isEyedropperStarted()) {
return;

View File

@ -53,6 +53,7 @@
this.m_oLogicDocument = this.m_oApi.WordControl && this.m_oApi.WordControl.m_oLogicDocument;
this.m_oDrawingDocument = this.m_oLogicDocument && this.m_oLogicDocument.DrawingDocument;
this.m_oLang = this.m_oApi.asc_GetPossibleNumberingLanguage();
this.m_oCurrentPara = null;
this.m_oPrimaryTextColor = new AscCommonWord.CDocumentColor(0, 0, 0);
// для словесного текста используем цвет контрастнее
@ -132,6 +133,14 @@
return nXPositionOfLine;
}
CBulletPreviewDrawerBase.prototype.isRtl = function()
{
if (!this.m_oCurrentPara)
this.m_oCurrentPara = this.m_oLogicDocument ? this.m_oLogicDocument.GetCurrentParagraph(true) : null;
return this.m_oCurrentPara ? this.m_oCurrentPara.isRtlDirection() : false;
};
CBulletPreviewDrawerBase.prototype.getFontSizeByLineHeight = function (nLineHeight)
{
@ -256,7 +265,12 @@
oParaRun.Set_Pr(oTextPr);
oParaRun.AddText(sText);
oParagraph.AddToContent(0, oParaRun);
if (this.isRtl())
oParagraph.SetParagraphBidi(true);
oParagraph.SetParagraphAlign(AscCommon.align_Left);
return oParagraph;
}
@ -271,7 +285,7 @@
let oParagraph = this.getParagraphWithText(sText, oTextPr);
if (!oParagraph) return null;
oParagraph.Reset(0, 0, 1000, 1000, 0, 0, 1);
oParagraph.Recalculate_Page(0);
oParagraph.LineNumbersInfo = null;
@ -280,57 +294,76 @@
const nBaseLineOffset = oParagraph.Lines[0].Y;
const nYOffset = nY - ((nBaseLineOffset * AscCommon.g_dKoef_mm_to_pix) >> 0);
let nXOffset = nX;
if (nAlign === AscCommon.align_Right) {
nXOffset -= nNumberingTextWidth;
} else if (nAlign === AscCommon.align_Center) {
nXOffset -= (nNumberingTextWidth >> 1);
let isRtl = this.isRtl();
if (isRtl)
{
if (nAlign === AscCommon.align_Left)
nXOffset -= nNumberingTextWidth;
else if (nAlign === AscCommon.align_Center)
nXOffset -= (nNumberingTextWidth >> 1);
}
else
{
if (nAlign === AscCommon.align_Right)
nXOffset -= nNumberingTextWidth;
else if (nAlign === AscCommon.align_Center)
nXOffset -= (nNumberingTextWidth >> 1);
}
let cleanX = nXOffset - 1;
let nBackTextWidth = 0;
if (nNumberingTextWidth !== 0)
{
nBackTextWidth = nNumberingTextWidth + 4; // 4 - чтобы линия никогда не была 'совсем рядом'
if (isRtl)
cleanX -= 4;
if (nSuff === Asc.c_oAscNumberingSuff.Space ||
nSuff === Asc.c_oAscNumberingSuff.None)
{
nBackTextWidth += 4;
if (isRtl)
cleanX -= 4;
}
}
this.cleanParagraphField(oGraphics, (nXOffset - 1) * AscCommon.g_dKoef_pix_to_mm, (nY - nLineHeight) * AscCommon.g_dKoef_pix_to_mm, (nBackTextWidth + 1) * AscCommon.g_dKoef_pix_to_mm, (nLineHeight + (nLineHeight >> 1)) * AscCommon.g_dKoef_pix_to_mm);
this.cleanParagraphField(oGraphics, cleanX * AscCommon.g_dKoef_pix_to_mm, (nY - nLineHeight) * AscCommon.g_dKoef_pix_to_mm, (nBackTextWidth + 2) * AscCommon.g_dKoef_pix_to_mm, (nLineHeight + (nLineHeight >> 1)) * AscCommon.g_dKoef_pix_to_mm);
this.drawParagraph(oGraphics, oParagraph, nXOffset, nYOffset);
// рисуем текст вместо черты текста
this.drawStyleText(oGraphics, oParagraphTextOptions, nXOffset + nBackTextWidth, nY, nLineHeight, oTextPr);
this.drawStyleText(oGraphics, oParagraphTextOptions, isRtl ? nXOffset : nXOffset + nBackTextWidth, nY, nLineHeight, oTextPr);
};
CBulletPreviewDrawerBase.prototype.drawStyleText = function (oGraphics, oParagraphTextOptions, nXEndPositionOfNumbering, nY, nLineHeight, oNumberingTextPr)
CBulletPreviewDrawerBase.prototype.drawStyleText = function (oGraphics, oParagraphTextOptions, numberingXEnd, nY, nLineHeight, oNumberingTextPr)
{
if (oParagraphTextOptions)
{
const sParagraphText = oParagraphTextOptions.addingText;
const oHeadingTextPr = new AscCommonWord.CTextPr();
oHeadingTextPr.RFonts.SetAll("Arial");
oHeadingTextPr.FontSize = oHeadingTextPr.FontSizeCS = oNumberingTextPr.FontSize * 0.8;
oHeadingTextPr.Color = oParagraphTextOptions.color.Copy();
if (!oParagraphTextOptions)
return;
const isRtl = this.isRtl();
const sParagraphText = oParagraphTextOptions.addingText;
const oHeadingTextPr = new AscCommonWord.CTextPr();
oHeadingTextPr.RFonts.SetAll("Arial");
oHeadingTextPr.FontSize = oHeadingTextPr.FontSizeCS = oNumberingTextPr.FontSize * 0.8;
oHeadingTextPr.Color = oParagraphTextOptions.color.Copy();
const oParagraph = this.getParagraphWithText(sParagraphText, oHeadingTextPr);
if (!oParagraph) return;
const oParagraph = this.getParagraphWithText(sParagraphText, oHeadingTextPr);
if (!oParagraph)
return;
oParagraph.Reset(0, 0, 1000, 1000, 0, 0, 1);
oParagraph.Recalculate_Page(0);
oParagraph.LineNumbersInfo = null;
const nParagraphTextWidth = oParagraph.getRange(0, 0).W * AscCommon.g_dKoef_mm_to_pix;
const nBaseLineOffset = oParagraph.Lines[0].Y;
oParagraph.Reset(0, 0, 1000, 1000, 0, 0, 1);
oParagraph.Recalculate_Page(0);
oParagraph.LineNumbersInfo = null;
const nYOffset = nY - ((nBaseLineOffset * AscCommon.g_dKoef_mm_to_pix) >> 0);
const nTextXOffset = isRtl ? Math.min(numberingXEnd, oParagraphTextOptions.startPositionX) - nParagraphTextWidth : Math.max(numberingXEnd, oParagraphTextOptions.startPositionX);
const nParagraphTextWidth = oParagraph.Lines[0].Ranges[0].W * AscCommon.g_dKoef_mm_to_pix;
const nBaseLineOffset = oParagraph.Lines[0].Y;
const nYOffset = nY - ((nBaseLineOffset * AscCommon.g_dKoef_mm_to_pix) >> 0);
const nTextXOffset = Math.max(nXEndPositionOfNumbering, oParagraphTextOptions.startPositionX);
this.cleanParagraphField(oGraphics, nTextXOffset * AscCommon.g_dKoef_pix_to_mm, (nY - nLineHeight) * AscCommon.g_dKoef_pix_to_mm, (nParagraphTextWidth + 2) * AscCommon.g_dKoef_pix_to_mm, (nLineHeight + (nLineHeight >> 1)) * AscCommon.g_dKoef_pix_to_mm);
this.drawParagraph(oGraphics, oParagraph, nTextXOffset, nYOffset);
}
this.cleanParagraphField(oGraphics, nTextXOffset * AscCommon.g_dKoef_pix_to_mm, (nY - nLineHeight) * AscCommon.g_dKoef_pix_to_mm, (nParagraphTextWidth + 2) * AscCommon.g_dKoef_pix_to_mm, (nLineHeight + (nLineHeight >> 1)) * AscCommon.g_dKoef_pix_to_mm);
this.drawParagraph(oGraphics, oParagraph, nTextXOffset, nYOffset);
}
CBulletPreviewDrawerBase.prototype.cleanParagraphField = function (oGraphics, nX, nY, nWidth, nHeight)
@ -614,8 +647,7 @@
if (typeof sText !== 'string') return;
const oTextPr = oLvl.GetTextPr().Copy();
const oSumInformation = this.getWidthHeightGlyphs(sText, oTextPr);
const nX = (nWidth >> 1) - Math.round((oSumInformation.Width / 2 + oSumInformation.rasterOffsetX) * AscCommon.g_dKoef_mm_to_pix);
const nX = (nWidth >> 1) - (this.isRtl() ? -1 : 1) * Math.round((oSumInformation.Width / 2 + oSumInformation.rasterOffsetX) * AscCommon.g_dKoef_mm_to_pix);
const nY = (nHeight >> 1) + Math.round((oSumInformation.Height / 2 + (oSumInformation.Ascent - oSumInformation.Height + oSumInformation.rasterOffsetY)) * AscCommon.g_dKoef_mm_to_pix);
return {nX: nX, nY: nY, nLineHeight: oSumInformation.Height};
};
@ -647,6 +679,8 @@
const nOffset = (nHeight_px - (nLineWidth * nCountOfLines + nLineDistance * nCountOfLines)) >> 1;
const nTextBaseOffsetX = nOffset + Math.floor(2.25 * AscCommon.g_dKoef_mm_to_pix);
const isRtl = this.isRtl();
let nY = nOffset + 11;
for (let j = 0; j < nCountOfLines; j += 1)
@ -656,8 +690,8 @@
const nWidthmm = Math.round((nWidth_px - nOffsetBase)) * AscCommon.g_dKoef_pix_to_mm;
const nWidthLinemm = 2 * AscCommon.g_dKoef_pix_to_mm;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nYmm, nTextBaseXmm, nWidthmm, nWidthLinemm);
const nTextYx = nTextBaseOffsetX - Math.floor(3.25 * AscCommon.g_dKoef_mm_to_pix);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nYmm, isRtl ? nOffset * AscCommon.g_dKoef_pix_to_mm : nTextBaseXmm, nWidthmm, nWidthLinemm);
const nTextYx = isRtl ? nWidth_px - nTextBaseOffsetX + Math.floor(3.25 * AscCommon.g_dKoef_mm_to_pix) : nTextBaseOffsetX - Math.floor(3.25 * AscCommon.g_dKoef_mm_to_pix);
const nTextYy = nY + (nLineWidth * 2.5);
const nLineHeight = nLineDistance - 4;
oTextPr.FontSize = this.getFontSizeByLineHeight(nLineHeight);
@ -743,6 +777,7 @@
const nOffset = (nHeight_px - (nLineWidth * nCountOfLines + nLineDistance * nCountOfLines)) >> 1;
let nY = nOffset + 11;
const nCorrectAddedOffsetX = this.getMultiLvlAddedOffsetX(arrLvls);
const isRtl = this.isRtl();
for (let i = 0; i < nCountOfLines; i += 1)
{
const oLvl = arrLvls[i];
@ -751,14 +786,17 @@
oTextPr.FontSize = this.getFontSizeByLineHeight(nLineHeight);
const nNumberPosition = oLvl.GetNumberPosition() + nCorrectAddedOffsetX;
const nFirstLineIndent = this.getFirstLineIndent(oLvl) + nCorrectAddedOffsetX;
const nTextYx = nOffsetBase + nNumberPosition * this.m_nMultiLvlIndentCoefficient;
//const nTextYx = nOffsetBase + nNumberPosition * this.m_nMultiLvlIndentCoefficient;
const nTextYy = nY + (nLineWidth * 2.5);
const nXPositionOfLine = nOffsetBase + (nFirstLineIndent * this.m_nMultiLvlIndentCoefficient) << 0;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nXPositionOfLine * AscCommon.g_dKoef_pix_to_mm, (nWidth_px - nOffsetBase) * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
const horlineX = isRtl ? nOffsetBase : nOffsetBase + (nFirstLineIndent * this.m_nMultiLvlIndentCoefficient) << 0;
const horlineR = isRtl ? nWidth_px - (nOffsetBase + (nFirstLineIndent * this.m_nMultiLvlIndentCoefficient) << 0) : nWidth_px - nOffsetBase;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, horlineX * AscCommon.g_dKoef_pix_to_mm, horlineR * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
const nTextYx = isRtl ? nWidth_px - nOffsetBase - nNumberPosition * this.m_nMultiLvlIndentCoefficient : nOffsetBase + nNumberPosition * this.m_nMultiLvlIndentCoefficient;
const drawingContent = oLvl.GetDrawingContent(arrLvls, i, 1, this.m_oLang);
const oParagraphTextOptions = this.getHeadingTextInformation(oLvl, nXPositionOfLine, nTextYy);
const oParagraphTextOptions = this.getHeadingTextInformation(oLvl, isRtl ? horlineR : horlineX, nTextYy);
if (typeof drawingContent !== 'string')
{
this.drawImageBulletsWithLine(drawingContent, nTextYx, nTextYy, nLineHeight, oGraphics, oParagraphTextOptions, oTextPr);
@ -874,8 +912,9 @@
const nY = (nHeight_px >> 1) - (nLineWidth >> 1);
const nLineHeight = (nHeight_px >> 1);
const nScaleCoefficient = this.getScaleCoefficientForMultiLevel(this.m_arrNumberingLvl, nWidth_px - nOffsetBase * 6);
const isRtl = this.isRtl();
for (let i = 0; i < nAmountOfPreview; i += 1)
for (let i = 0; i < nAmountOfPreview; ++i)
{
const oLvl = this.m_arrNumberingLvl[i];
oLvl.Jc = AscCommon.align_Left;
@ -890,11 +929,14 @@
oTextPr.FontSize = oTextPr.FontSizeCS = this.getFontSizeByLineHeight(nLineHeight);
const nNumberPosition = oLvl.GetNumberPosition();
const nXLinePosition = nOffsetBase + (this.getFirstLineIndent(oLvl) * AscCommon.g_dKoef_mm_to_pix * nScaleCoefficient) << 0;
const nTextYx = nOffsetBase + nNumberPosition * AscCommon.g_dKoef_mm_to_pix * nScaleCoefficient;
const nTextYx = isRtl ? nWidth_px - (nOffsetBase + nNumberPosition * AscCommon.g_dKoef_mm_to_pix * nScaleCoefficient): nOffsetBase + nNumberPosition * AscCommon.g_dKoef_mm_to_pix * nScaleCoefficient;
const nTextYy = nY + (nLineWidth << 1);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nXLinePosition * AscCommon.g_dKoef_pix_to_mm, (nWidth_px - nOffsetBase) * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
const oParagraphTextOptions = this.getHeadingTextInformation(oLvl, nXLinePosition, nTextYy);
const horlineX = isRtl ? nOffsetBase : nOffsetBase + nNumberPosition * AscCommon.g_dKoef_mm_to_pix * nScaleCoefficient;
const horlineR = isRtl ? nWidth_px - (nOffsetBase + nNumberPosition * AscCommon.g_dKoef_mm_to_pix * nScaleCoefficient) : nWidth_px - nOffsetBase;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, horlineX * AscCommon.g_dKoef_pix_to_mm, horlineR * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
const oParagraphTextOptions = this.getHeadingTextInformation(oLvl, isRtl ? horlineR : horlineX, nTextYy);
if (typeof drawingContent === "string")
{
this.drawTextWithLvlInformation(drawingContent, oLvl, nTextYx, nTextYy, (nHeight_px >> 1), oGraphics, oParagraphTextOptions);
@ -1011,6 +1053,8 @@
const nCurrentLvl = this.m_nCurrentLvl;
oGraphics.p_color(this.m_oSecondaryLineTextColor.r, this.m_oSecondaryLineTextColor.g, this.m_oSecondaryLineTextColor.b, 255);
const isRtl = this.isRtl();
let nY = nOffset + 2;
for (let i = 0; i < this.m_arrNumberingLvl.length; i += 1)
@ -1019,24 +1063,32 @@
const oTextPr = oLvl.GetTextPr();
oTextPr.FontSize = this.getFontSizeByLineHeight(nLineDistance);
const nNumberPosition = oLvl.GetNumberPosition();
const nTextYx = (nOffsetBase + nNumberPosition * AscCommon.g_dKoef_mm_to_pix * this.m_nScaleIndentsCoefficient) >> 0;
let nTextYx = (nOffsetBase + nNumberPosition * AscCommon.g_dKoef_mm_to_pix * this.m_nScaleIndentsCoefficient) >> 0;
const nIndentSize = (nOffsetBase + oLvl.GetIndentSize() * AscCommon.g_dKoef_mm_to_pix * this.m_nScaleIndentsCoefficient) >> 0;
const nTextYy = nY + nLineWidth;
const nOffsetText = nOffsetBase + (this.getFirstLineIndent(oLvl) * AscCommon.g_dKoef_mm_to_pix * this.m_nScaleIndentsCoefficient) >> 0;
if (isRtl)
nTextYx = nWidth_px - nTextYx;
const posX0 = isRtl ? nOffsetBase : nOffsetText;
const posR0 = isRtl ? nWidth_px - nOffsetText : nWidth_px - nOffsetBase;
const posX1 = isRtl ? nOffsetBase : nIndentSize;
const posR1 = isRtl ? nWidth_px - nIndentSize : nWidth_px - nOffsetBase;
if (i === nCurrentLvl)
{
oGraphics.p_color(this.m_oPrimaryTextColor.r, this.m_oPrimaryTextColor.g, this.m_oPrimaryTextColor.b, 255);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nOffsetText * AscCommon.g_dKoef_pix_to_mm, (nWidth_px - nOffsetBase) * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, posX0 * AscCommon.g_dKoef_pix_to_mm, posR0 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
nY += (nLineWidth + nLineDistance);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nIndentSize * AscCommon.g_dKoef_pix_to_mm, (nWidth_px - nOffsetBase) * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, posX1 * AscCommon.g_dKoef_pix_to_mm, posR1 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
oGraphics.p_color(this.m_oSecondaryLineTextColor.r, this.m_oSecondaryLineTextColor.g, this.m_oSecondaryLineTextColor.b, 255);
}
else
{
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nOffsetText * AscCommon.g_dKoef_pix_to_mm, (nWidth_px - nOffsetBase) * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, posX0 * AscCommon.g_dKoef_pix_to_mm, posR0 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
}
const oParagraphTextOptions = this.getHeadingTextInformation(oLvl, nOffsetText, nTextYy);
@ -1056,8 +1108,11 @@
nY += (nLineWidth + nLineDistance);
}
this.cleanParagraphField(oGraphics, (nWidth_px - nOffsetBase) * AscCommon.g_dKoef_pix_to_mm, 0, nWidth_px * AscCommon.g_dKoef_pix_to_mm, nHeight_px * AscCommon.g_dKoef_pix_to_mm);
if (isRtl)
this.cleanParagraphField(oGraphics, 0, 0, (nOffsetBase - 1) * AscCommon.g_dKoef_pix_to_mm, nHeight_px * AscCommon.g_dKoef_pix_to_mm);
else
this.cleanParagraphField(oGraphics, (nWidth_px - nOffsetBase + 1) * AscCommon.g_dKoef_pix_to_mm, 0, nOffsetBase * AscCommon.g_dKoef_pix_to_mm, nHeight_px * AscCommon.g_dKoef_pix_to_mm);
};
CBulletPreviewDrawerAdvancedOptions.prototype.getScaleCoefficientForSingleLevel = function (nWorkspaceWidth)
{
@ -1104,6 +1159,7 @@
const oGraphics = this.m_oGraphics;
const nHeight_px = oCanvas.clientHeight;
const nWidth_px = oCanvas.clientWidth;
const isRtl = this.isRtl();
const nOffsetBase = 10;
const nLineWidth = 4;
@ -1169,8 +1225,10 @@
nTabSize = nOffsetBase + ((nRawTabSize * AscCommon.g_dKoef_mm_to_pix * nScaleCoefficient) << 0);
}
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nLeftOffset2 * AscCommon.g_dKoef_pix_to_mm, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm); nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nLeftOffset2 * AscCommon.g_dKoef_pix_to_mm, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm); nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nLeftOffset2 * AscCommon.g_dKoef_pix_to_mm, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nLeftOffset2 * AscCommon.g_dKoef_pix_to_mm, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
nY += nYDist;
oGraphics.p_color(this.m_oPrimaryTextColor.r, this.m_oPrimaryTextColor.g, this.m_oPrimaryTextColor.b, 255);
let nTextYx = nNumberPosition;
@ -1200,16 +1258,27 @@
{
nOffsetTextX = this.getFirstLineIndent(oCurrentLvl, nTextYx * AscCommon.g_dKoef_pix_to_mm, nIndentSize * AscCommon.g_dKoef_pix_to_mm, AscFormat.isRealNumber(nTabSize) ? nTabSize * AscCommon.g_dKoef_pix_to_mm : null);
}
if (isRtl)
nTextYx = nWidth_px - nTextYx;
const posX0 = isRtl ? nOffsetBase : nOffsetTextX * AscCommon.g_dKoef_mm_to_pix;
const posR0 = isRtl ? nWidth_px - nOffsetTextX * AscCommon.g_dKoef_mm_to_pix : nWidth_px - nOffsetBase;
const posX1 = isRtl ? nOffsetBase : nIndentSize;
const posR1 = isRtl ? nWidth_px - nIndentSize : nWidth_px - nOffsetBase;
for (let i = 0; i < 3; i += 1)
{
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nOffsetTextX, nRightOffset * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm); nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nIndentSize * AscCommon.g_dKoef_pix_to_mm, nRightOffset * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm); nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, posX0 * AscCommon.g_dKoef_pix_to_mm, posR0 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, posX1 * AscCommon.g_dKoef_pix_to_mm, posR1 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
nY += nYDist;
}
oGraphics.p_color(this.m_oSecondaryLineTextColor.r, this.m_oSecondaryLineTextColor.g, this.m_oSecondaryLineTextColor.b, 255);
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nLeftOffset2 * AscCommon.g_dKoef_pix_to_mm, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm); nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nLeftOffset2 * AscCommon.g_dKoef_pix_to_mm, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
nY += nYDist;
oGraphics.drawHorLine(AscCommon.c_oAscLineDrawingRule.Center, nY * AscCommon.g_dKoef_pix_to_mm, nLeftOffset2 * AscCommon.g_dKoef_pix_to_mm, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, nLineWidth * AscCommon.g_dKoef_pix_to_mm);
for (let i = 0; i < arrTextYy.length; i += 1)
@ -1229,7 +1298,10 @@
}
}
}
this.cleanParagraphField(oGraphics, nRightOffset2 * AscCommon.g_dKoef_pix_to_mm, 0, nWidth_px * AscCommon.g_dKoef_pix_to_mm, nHeight_px * AscCommon.g_dKoef_pix_to_mm);
if (isRtl)
this.cleanParagraphField(oGraphics, 0, 0, (nOffsetBase - 1) * AscCommon.g_dKoef_pix_to_mm, nHeight_px * AscCommon.g_dKoef_pix_to_mm);
else
this.cleanParagraphField(oGraphics, (nWidth_px - nOffsetBase + 1) * AscCommon.g_dKoef_pix_to_mm, 0, nOffsetBase * AscCommon.g_dKoef_pix_to_mm, nHeight_px * AscCommon.g_dKoef_pix_to_mm);
};
CBulletPreviewDrawerAdvancedOptions.prototype.draw = function ()
{

View File

@ -747,10 +747,13 @@
var oNvPr;
if (this.document || this.drawingObjects && this.drawingObjects.cSld) {
var bCheckTextHyperlink = false;
if (this.isSlideShow()) {
bCheckTextHyperlink = true;
}
// var bCheckTextHyperlink = false;
// if (this.isSlideShow()) {
// bCheckTextHyperlink = true;
// }
const bCheckTextHyperlink = true;
var sHyperlink = null;
var sTooltip = "";
var oTextHyperlink;
@ -7936,25 +7939,24 @@
}
let hyperlink_properties = null;
if(drawings.length === 1) {
let oDrawing = drawings[0];
let isStickyNote = oDrawing.IsAnnot && oDrawing.IsAnnot() && oDrawing.IsComment(); // skip pdf text annot
if (drawings.length === 1) {
const oDrawing = drawings[0];
const oDocContent = oDrawing.getDocContent && oDrawing.getDocContent();
if(!isStickyNote && (oDrawing.isShape() || oDrawing.isImage())) {
const isStickyNote = oDrawing.IsAnnot && oDrawing.IsAnnot() && oDrawing.IsComment(); // skip pdf text annot
const isValidType = oDrawing.isShape() || oDrawing.isImage();
let oNvPr = oDrawing.getCNvProps();
if (oNvPr) {
let oHyper = oNvPr.hlinkClick;
if(oHyper && oHyper.id) {
hyperlink_properties = new Asc.CHyperlinkProperty();
hyperlink_properties.Text = null;
hyperlink_properties.Value = oHyper.id;
hyperlink_properties.ToolTip = oHyper.tooltip;
}
if (!isStickyNote && !oDocContent && isValidType) {
const oNvPr = oDrawing.getCNvProps();
if (oNvPr && oNvPr.hlinkClick && oNvPr.hlinkClick.id) {
hyperlink_properties = new Asc.CHyperlinkProperty();
hyperlink_properties.Text = null;
hyperlink_properties.Value = oNvPr.hlinkClick.id;
hyperlink_properties.ToolTip = oNvPr.hlinkClick.tooltip;
}
}
}
return {
imageProps: image_props,
shapeProps: shape_props,
@ -11630,7 +11632,10 @@
}
if (referenceShape.bWordShape) {
resultShape.bWordShape = true;
if (resultShape.setWordShape) {
resultShape.setWordShape(true);
}
if (AscCommon.isRealObject(referenceShape.textBoxContent)) {
const textBoxContent = referenceShape.textBoxContent.Copy(resultShape, referenceShape.textBoxContent.DrawingDocument);
resultShape.setTextBoxContent(textBoxContent);
@ -11791,7 +11796,11 @@
const paraDrawing = new ParaDrawing(5, 5, null, graphicController.drawingDocument, null, null);
paraDrawing.Set_GraphicObject(newShape);
paraDrawing.Set_DrawingType(drawing_Anchor);
paraDrawing.Set_WrappingType(WRAPPING_TYPE_NONE);
paraDrawing.Set_WrappingType(referenceShape.parent.wrappingType || WRAPPING_TYPE_NONE);
paraDrawing.Set_BehindDoc(referenceShape.parent.behindDoc);
paraDrawing.Check_WrapPolygon();
paraDrawing.setExtent(newShape.spPr.xfrm.extX, newShape.spPr.xfrm.extY);
const nearestPos = graphicController.document.Get_NearestPos(pageIndex, dOffX, dOffY, true, paraDrawing);

File diff suppressed because one or more lines are too long

View File

@ -871,6 +871,10 @@
CGraphicsBase.prototype.End_Command = function(commandId)
{
};
CGraphicsBase.prototype.SetBorder = function(border)
{
};
//------------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};

View File

@ -646,7 +646,6 @@ function NewShapeTrack(presetGeom, startX, startY, theme, master, layout, slide,
_sp_pr.setParent(shape);
var nv_sp_pr = new AscFormat.UniNvPr();
nv_sp_pr.cNvPr.setId(0);
shape.setNvSpPr(nv_sp_pr);
var nvUniSpPr = new AscFormat.CNvUniSpPr();

View File

@ -97,6 +97,15 @@
var _type = AscCommon.getPtrEvtType(type);
return elem[_type];
};
AscCommon.capturePointer = function(e, elem)
{
if (e.pointerType === "mouse" && elem.setPointerCapture)
{
try {
elem.setPointerCapture(e.pointerId);
} catch (e) {}
}
};
function CMouseEventHandler()
{
@ -451,6 +460,8 @@
if (!global_mouseEvent.IsLocked || !global_mouseEvent.Sender)
global_mouseEvent.Sender = (e.srcElement) ? e.srcElement : e.target;
AscCommon.capturePointer(e, global_mouseEvent.Sender);
if (isClicks)
{
var CurTime = new Date().getTime();

View File

@ -4075,6 +4075,7 @@
// annot stamp
AscDFH.historyitem_Pdf_Stamp_Type = AscDFH.historyitem_type_Pdf_Annot_Stamp | 1;
AscDFH.historyitem_Pdf_Stamp_InRect = AscDFH.historyitem_type_Pdf_Annot_Stamp | 2;
AscDFH.historyitem_Pdf_Stamp_Rect = AscDFH.historyitem_type_Pdf_Annot_Stamp | 3;
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в PDF drawing prototype

View File

@ -2138,7 +2138,33 @@ NumFormat.prototype =
}
var hasSign = false;
var nReadState = FormatStates.Decimal;
var nFormatLength = this.aRawFormat.length;
var nFormatLength = this.aRawFormat.length;
let isArabic = (lcid_ar === cultureInfoLCID.LCID
|| lcid_arSY === cultureInfoLCID.LCID
|| lcid_arSA === cultureInfoLCID.LCID
|| lcid_arAE === cultureInfoLCID.LCID
|| lcid_arBH === cultureInfoLCID.LCID
|| lcid_arDZ === cultureInfoLCID.LCID
|| lcid_arEG === cultureInfoLCID.LCID
|| lcid_arIQ === cultureInfoLCID.LCID
|| lcid_arJO === cultureInfoLCID.LCID
|| lcid_arKW === cultureInfoLCID.LCID
|| lcid_arQA === cultureInfoLCID.LCID
);
let _t = this;
function checkRLM(prev)
{
if (!isArabic)
return;
if (undefined === prev
|| prev < 0
|| (numFormat_TimeSeparator !== _t.aRawFormat[prev].type
&& (numFormat_Text !== _t.aRawFormat[prev].type || ":" !== _t.aRawFormat[prev].val)))
oCurText.text += "";
}
for(var i = 0; i < nFormatLength; ++i)
{
var item = this.aRawFormat[i];
@ -2178,7 +2204,11 @@ NumFormat.prototype =
}
else if(numFormat_Text == item.type)
{
oCurText.text += item.val;
if(',' === item.val && isArabic) {
oCurText.text += "،";
} else {
oCurText.text += item.val;
}
}
else if(numFormat_TextPlaceholder == item.type)
{
@ -2272,12 +2302,14 @@ NumFormat.prototype =
}
else
{
checkRLM();
oCurText.text += 'a'.repeat(item.val);
}
}
else if(numFormat_Year == item.type)
{
if (item.val > 0) {
checkRLM();
if (item.val <= 2) {
oCurText.text += (oParsedNumber.date.year.toString().slice(-2));
} else {
@ -2291,10 +2323,13 @@ NumFormat.prototype =
else if(numFormat_Month == item.type)
{
var m = oParsedNumber.date.month;
if(item.val == 1)
oCurText.text += m + 1;
else if(item.val == 2)
oCurText.text += this._ZeroPad(m + 1);
if (item.val === 1) {
checkRLM();
oCurText.text += m + 1;
} else if (item.val === 2) {
checkRLM();
oCurText.text += this._ZeroPad(m + 1);
}
else if (item.val == 3) {
if (this.bDay && cultureInfoLCID.AbbreviatedMonthGenitiveNames.length > 0)
oCurText.text += cultureInfoLCID.AbbreviatedMonthGenitiveNames[m];
@ -2315,10 +2350,13 @@ NumFormat.prototype =
}
else if(numFormat_Day == item.type)
{
if(item.val == 1)
oCurText.text += oParsedNumber.date.d;
else if(item.val == 2)
oCurText.text += this._ZeroPad(oParsedNumber.date.d);
if(item.val == 1) {
checkRLM();
oCurText.text += oParsedNumber.date.d;
} else if(item.val === 2) {
checkRLM();
oCurText.text += this._ZeroPad(oParsedNumber.date.d);
}
else if(item.val == 3)
oCurText.text += cultureInfoLCID.AbbreviatedDayNames[oParsedNumber.date.dayWeek];
else if(item.val > 0)
@ -2332,21 +2370,27 @@ NumFormat.prototype =
h = oParsedNumber.date.countDay*24 + oParsedNumber.date.hour;
if(this.bTimePeriod === true)
h = h%12||12;
if(item.val == 1)
oCurText.text += h;
else if(item.val > 0)
oCurText.text += this._ZeroPad(h);
if (item.val > 0) {
checkRLM(i - 1);
if (item.val === 1)
oCurText.text += h;
else
oCurText.text += this._ZeroPad(h);
}
}
else if(numFormat_Minute == item.type)
{
var min = oParsedNumber.date.min;
if(item.bElapsed === true)
min = oParsedNumber.date.countDay*24*60 + oParsedNumber.date.hour*60 + oParsedNumber.date.min;
if(item.val == 1)
oCurText.text += min;
else if(item.val > 0)
oCurText.text += this._ZeroPad(min);
if (item.val > 0) {
checkRLM(i - 1);
if (item.val === 1)
oCurText.text += min;
else
oCurText.text += this._ZeroPad(min);
}
}
else if(numFormat_Second == item.type)
{
@ -2355,11 +2399,14 @@ NumFormat.prototype =
s = oParsedNumber.date.sec + Math.round(oParsedNumber.date.ms/1000);
if(item.bElapsed === true)
s = oParsedNumber.date.countDay*24*60*60 + oParsedNumber.date.hour*60*60 + oParsedNumber.date.min*60 + s;
if(item.val == 1)
oCurText.text += s;
else if(item.val > 0)
oCurText.text += this._ZeroPad(s);
if (item.val > 0) {
checkRLM(i - 1);
if (item.val === 1)
oCurText.text += s;
else
oCurText.text += this._ZeroPad(s);
}
}
else if (numFormat_AmPm == item.type) {
if (cultureInfoLCID.AMDesignator.length > 0 && cultureInfoLCID.PMDesignator.length > 0)
@ -2384,6 +2431,7 @@ NumFormat.prototype =
else if (dMs < 100)
nExponent = -1;
var aMilSec = this._FormatNumber(dMs, nExponent, item.format.concat(), FormatStates.Frac, cultureInfo);
checkRLM(i - 1);
for (var k = 0; k < aMilSec.length; k++)
this._AddDigItem(res, oCurText, aMilSec[k]);
}

View File

@ -6757,8 +6757,16 @@ function BinaryPPTYLoader()
continue;
_object = this.ReadSpTreeElement();
if(_object)
{
const objectId = _object.getFormatId();
const objectCNvProps = _object.getCNvProps();
if (objectId !== null && objectCNvProps !== null) {
if (this.map_shapes_by_id[objectCNvProps.id]) {
objectCNvProps.setId(AscCommon.CreateDurableId());
}
}
shapes[shapes.length] = _object;
}
}
@ -10703,6 +10711,7 @@ function BinaryPPTYLoader()
oThis.bcr.Read1(nDocLength, function(t,l){
return oBinary_DocumentTableReader.ReadDocumentContent(t,l, content_arr);
});
oThis.oReadResult.checkDocumentContentReviewType(content_arr);
this.ParaDrawing = oCurParaDrawing;
for(var i = 0, length = content_arr.length; i < length; ++i){
if(i == length - 1)

View File

@ -171,6 +171,8 @@
this.forceSaveForm = null;
this.forceSaveUndoRequest = false; // Флаг нужен, чтобы мы знали, что данное сохранение пришло по запросу Undo в совместке
this.forceSaveSendFormRequest = false;
this.forceSaveDisconnectRequest = false;
this.forceSaveOformRequest = false;
this.saveRelativePrev = {};
// Version History
@ -1365,7 +1367,10 @@
};
baseEditorsApi.prototype.forceSave = function()
{
return this.CoAuthoringApi.forceSave();
if (!this.getViewMode()) {
return this.CoAuthoringApi.forceSave();
}
return false;
};
baseEditorsApi.prototype.saveFromChanges = function(data, timeout, callback) {
var t = this;
@ -2858,8 +2863,14 @@
if (this.canSave && this._saveCheck() && this.canSendChanges()) {
this.IsUserSave = !isAutoSave;
if (this.asc_isDocumentCanSave() || this._haveChanges() || this._haveOtherChanges() ||
this.canUnlockDocument || this.forceSaveUndoRequest || this.forceSaveSendFormRequest) {
if (this.asc_isDocumentCanSave()
|| this._haveChanges()
|| this._haveOtherChanges()
|| this.canUnlockDocument
|| this.forceSaveUndoRequest
|| this.forceSaveSendFormRequest
|| this.forceSaveDisconnectRequest
|| this.forceSaveOformRequest) {
if (this._prepareSave(isIdle)) {
// Не даем пользователю сохранять, пока не закончится сохранение (если оно началось)
this.canSave = false;

View File

@ -584,7 +584,7 @@
/**
* An object containing the watermark properties.
* @typedef {Object} watermark_on_draw
* @property {float} transparent The watermark transparency degree.
* @property {number} transparent The watermark transparency degree.
* @property {string} type The {@link /docbuilder/global#ShapeType shape type} which specifies the preset shape geometry for the current watermark.
* @property {number} width The watermark width measured in millimeters.
* @property {number} height The watermark height measured in millimeters.
@ -1187,7 +1187,7 @@
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias ReplaceTextSmart
* @param {Array} arrString - An array of replacement strings.
* @param {string[]} arrString - An array of replacement strings.
* @param {string} [sParaTab="\t"] - A character which is used to specify the tab in the source text. Any symbol can be used. The default separator is "\t".
* @param {string} [sParaNewLine="\r\n"] - A character which is used to specify the line break character in the source text. Any symbol can be used. The default separator is "\r\n".
* @returns {boolean} - Always returns true.
@ -1872,6 +1872,7 @@
/**
* Adds an item to the context menu.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias AddContextMenuItem
@ -1888,6 +1889,7 @@
/**
* Updates an item in the context menu with the specified items.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias UpdateContextMenuItem
@ -1944,6 +1946,7 @@
/**
* Adds an item to the toolbar menu.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @alias AddToolbarMenuItem
@ -1965,6 +1968,7 @@
/**
* Shows the plugin modal window.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} frameId - The frame ID.
@ -1986,6 +1990,7 @@
/**
* Activates (moves forward) the plugin window/panel.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} frameId - The frame ID.
@ -2000,6 +2005,7 @@
/**
* Closes the plugin modal window.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} frameId - The frame ID.
@ -2014,6 +2020,7 @@
/**
* Sends a message to the plugin modal window.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} windowID - The frame ID.
@ -2030,6 +2037,7 @@
/**
* Resizes the plugin modal window.
* @undocumented
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} frameId - The frame ID.

View File

@ -165,8 +165,9 @@
0xFF63 : 0xFF62, // c # HALFWIDTH RIGHT CORNER BRACKET
0x003E : 0x003C, // o
0x003C : 0x003E // c
0x003C : 0x003E, // c
0x00AB : 0x00BB, // o # «
0x00BB : 0x00AB // c # »
};
let pairedGraphemes = {};

View File

@ -90,7 +90,7 @@
RLI : FLAG.NEUTRAL | FLAG.ISOLATE | FLAG.RTL,
FSI : FLAG.NEUTRAL | FLAG.ISOLATE | FLAG.FS,
PDI : FLAG.NEUTRAL | FLAG.WEAK | FLAG.ISOLATE,
PM : FLAG.STRONG // Paragraph end mark
PM : FLAG.STRONG // Paragraph end mark or strong with main direction of the text (tab/break)
};
const DIRECTION = {

View File

@ -157,6 +157,9 @@
{
this.FontsByRange[_range.Name] = _range.Name;
this.FontsByRangeCount++;
if (window["onLogPickFont"])
window["onLogPickFont"]("FontBySymbol: " + _char + " => " + _range.Name);
}
return _range.Name;

View File

@ -2936,6 +2936,10 @@
var _font = this.GetFontIndex(oSelect, true);
this.FontPickerMap[name] = _font;
if (window["onLogPickFont"])
window["onLogPickFont"]("FontPicker: " + name + " => " + _font.m_wsFontName);
return _font;
}
};

View File

@ -118,7 +118,7 @@
this.FontSize = oFontInfo.Size;
AscFonts.HB_ShapeString(this, nFontId, oFontInfo.Style, this.FontId, this.GetLigaturesType(), nScript, this.Direction, "en");
AscFonts.HB_ShapeString(this, nFontId, oFontInfo.Style, this.FontId, this.GetLigaturesType(nScript), nScript, this.Direction, "en");
// Значит шрифт был подобран, возвращаем назад состояние отрисовщика
if (this.FontId.m_pFaceInfo.family_name !== oFontInfo.Name)
@ -129,7 +129,7 @@
this.ClearBuffer();
};
CTextShaper.prototype.GetLigaturesType = function()
CTextShaper.prototype.GetLigaturesType = function(textScript)
{
return Asc.LigaturesType.None;
};

View File

@ -569,6 +569,7 @@ window.startPluginApi = function() {
/**
* executeMethod
* @undocumented
* @memberof Plugin
* @alias executeMethod
* @description Defines the method used to execute certain editor methods using the plugin.
@ -620,6 +621,7 @@ window.startPluginApi = function() {
/**
* resizeWindow (only for visual modal plugins)
* @undocumented
* @memberof Plugin
* @alias resizeWindow
* @description Defines the method used to change the window size updating the minimum/maximum sizes.
@ -661,6 +663,7 @@ window.startPluginApi = function() {
/**
* callCommand
* @undocumented
* @memberof Plugin
* @alias callCommand
* @description Defines the method used to send the data back to the editor.
@ -700,6 +703,7 @@ window.startPluginApi = function() {
/**
* callModule
* @undocumented
* @memberof Plugin
* @alias callModule
* @description Defines the method used to execute a remotely located script following a link.
@ -733,6 +737,7 @@ window.startPluginApi = function() {
/**
* loadModule
* @undocumented
* @memberof Plugin
* @alias loadModule
* @description Defines the method used to load a remotely located text resource.
@ -759,6 +764,7 @@ window.startPluginApi = function() {
/**
* @function attachEvent
* @undocumented
* @memberof Plugin
* @alias attachEvent
* @description Defines the method to add an event listener, a function that will be called whenever the specified event is delivered to the target.
@ -770,6 +776,7 @@ window.startPluginApi = function() {
/**
* @function attachContextMenuClickEvent
* @undocumented
* @memberof Plugin
* @alias attachContextMenuClickEvent
* @description Defines the method to add an event listener, a function that will be called whenever the specified event is clicked in the context menu.
@ -800,6 +807,7 @@ window.startPluginApi = function() {
/**
* @function createWindow
* @undocumented
* @memberof InputHelper
* @alias createWindow
* @description Creates an input helper window.
@ -808,6 +816,7 @@ window.startPluginApi = function() {
/**
* @function getItems
* @undocumented
* @memberof InputHelper
* @alias getItems
* @description Returns an array of the {@link global#InputHelperItem InputHelperItem} objects that contain all the items from the input helper.
@ -817,6 +826,7 @@ window.startPluginApi = function() {
/**
* @function setItems
* @undocumented
* @memberof InputHelper
* @alias setItems
* @description Sets the items to the input helper.
@ -826,6 +836,7 @@ window.startPluginApi = function() {
/**
* @function show
* @undocumented
* @memberof InputHelper
* @alias show
* @description Shows an input helper.
@ -837,6 +848,7 @@ window.startPluginApi = function() {
/**
* @function unShow
* @undocumented
* @memberof InputHelper
* @alias unShow
* @description Hides an input helper.
@ -845,6 +857,7 @@ window.startPluginApi = function() {
/**
* @function getScrollSizes
* @undocumented
* @memberof InputHelper
* @alias getScrollSizes
* @description Returns the sizes of the input helper scrolled window. Returns an object with width and height parameters.
@ -854,6 +867,7 @@ window.startPluginApi = function() {
/**
* createInputHelper
* @undocumented
* @memberof Plugin
* @alias createInputHelper
* @description Defines the method used to create an {@link inputhelper input helper} - a window that appears and disappears when you type text. Its location is tied to the cursor.
@ -867,6 +881,7 @@ window.startPluginApi = function() {
};
/**
* getInputHelper
* @undocumented
* @memberof Plugin
* @alias getInputHelper
* @description Defines the method used to get the {@link inputhelper InputHelper object}.
@ -882,6 +897,7 @@ window.startPluginApi = function() {
/**
* sendToPlugin
* @undocumented
* @memberof Plugin
* @alias sendToPlugin
* @description Sends a message from the modal window to the plugin.

View File

@ -1929,6 +1929,8 @@ CArrowDrawer.prototype.InitSize = function ( sizeW, sizeH )
this.that.mouseDown = true;
AscCommon.capturePointer(e, this.that.canvas);
//arrow pressed
if (this.that.settings.showArrows && arrowHover) {
this.that.mouseDownArrow = true;

View File

@ -1150,9 +1150,10 @@
}
} else if (oGrp) {
if (oGrp.selectStartPage === pageIndex) {
isDrawHandles = !oGrp.IsAnnot;
isDrawHandles = !oGrp.IsAnnot();
let bDrawGroupTrack = !oGrp.IsAnnot() || oGrp.IsAnnot() && !oGrp.IsInTextBox();
drawingDocument.DrawTrack(
bDrawGroupTrack && drawingDocument.DrawTrack(
AscFormat.TYPE_TRACK.GROUP_PASSIVE,
oGrp.getTransformMatrix(),
0,

View File

@ -1347,7 +1347,8 @@
let yContent = oTransform.TransformPointY(0, Y);
oController.resetSelection();
oController.selection.groupSelection = this;
if (this.IsInTextBox() == false && false == this.Lock.Is_Locked()) {
oDoc.SetGlobalHistory();
oDoc.DoAction(function() {

View File

@ -296,16 +296,16 @@
this.SetNeedRecalc(true);
this.SetWasChanged(true);
};
CAnnotationStamp.prototype.SetRect = function(aRect, bUpdateShapeSizes) {
CAnnotationStamp.prototype.SetRect = function(aRect, isOnRotate) {
let oViewer = editor.getDocumentRenderer();
let oDoc = oViewer.getPDFDoc();
let aCurRect = this.GetRect();
oDoc.History.Add(new CChangesPDFAnnotRect(this, aCurRect, aRect));
oDoc.History.Add(new CChangesPDFAnnotStampRect(this, aCurRect, aRect, isOnRotate));
this._origRect = aRect;
this.SetWasChanged(true);
this.SetNeedRecalcSizes(!!bUpdateShapeSizes);
this.SetNeedRecalcSizes(!isOnRotate);
};
CAnnotationStamp.prototype.SetNeedRecalcSizes = function(bRecalc) {
this._needRecalcSizes = bRecalc;
@ -377,7 +377,7 @@
let oNewStamp = new CAnnotationStamp(AscCommon.CreateGUID(), this.GetOrigRect().slice(), oDoc);
oNewStamp.inRect = this.inRect;
oNewStamp.SetInRect(this.inRect);
oNewStamp.lazyCopy = true;
this.fillObject(oNewStamp);
@ -396,6 +396,7 @@
oNewStamp.SetWidth(this.GetWidth());
oNewStamp.SetOpacity(this.GetOpacity());
oNewStamp.recalcGeometry()
oNewStamp.SetNeedRecalcSizes(false);
oNewStamp.Recalculate(true);
oNewStamp.SetIconType(this.GetIconType());
oNewStamp.SetRenderStructure(this.GetRenderStructure());
@ -462,7 +463,7 @@
aNewRect[2] = Math.round(oGrBounds.r) * g_dKoef_mm_to_pt;
aNewRect[3] = Math.round(oGrBounds.b) * g_dKoef_mm_to_pt;
this.SetRect(aNewRect, false);
this.SetRect(aNewRect, true);
};
CAnnotationStamp.prototype.WriteToBinary = function(memory) {
memory.WriteByte(AscCommon.CommandType.ctAnnotField);

View File

@ -77,7 +77,7 @@
if (oParent)
return oParent.GetParentCurIdxs();
};
CBaseListField.prototype.SetTopIndex = function() {};
CBaseListField.prototype.SetCommitOnSelChange = function(bValue) {
this._commitOnSelChange = bValue;
this.SetWasChanged(true);

View File

@ -64,6 +64,7 @@ AscDFH.changesFactory[AscDFH.historyitem_type_Pdf_Annot_FreeText_RC] = CChange
AscDFH.changesFactory[AscDFH.historyitem_type_Pdf_Annot_FreeText_Align] = CChangesPDFFreeTextAlign;
AscDFH.changesFactory[AscDFH.historyitem_Pdf_Stamp_Type] = CChangesPDFAnnotStampType;
AscDFH.changesFactory[AscDFH.historyitem_Pdf_Stamp_InRect] = CChangesPDFAnnotStampInRect;
AscDFH.changesFactory[AscDFH.historyitem_Pdf_Stamp_Rect] = CChangesPDFAnnotStampRect;
function CChangesAnnotArrayOfDoubleProperty(Class, Old, New) {
@ -932,6 +933,40 @@ CChangesPDFAnnotStampInRect.prototype.private_SetValue = function(Value)
oAnnot.SetInRect(Value);
};
/**
* @constructor
* @extends {AscDFH.CChangesAnnotArrayOfDoubleProperty}
*/
function CChangesPDFAnnotStampRect(Class, Old, New, isOnRotate, Color)
{
AscDFH.CChangesAnnotArrayOfDoubleProperty.call(this, Class, Old, New, isOnRotate, Color);
this.isOnRotate = !!isOnRotate;
}
CChangesPDFAnnotStampRect.prototype = Object.create(AscDFH.CChangesAnnotArrayOfDoubleProperty.prototype);
CChangesPDFAnnotStampRect.prototype.constructor = CChangesPDFAnnotStampRect;
CChangesPDFAnnotStampRect.prototype.Type = AscDFH.historyitem_Pdf_Stamp_Rect;
CChangesPDFAnnotStampRect.prototype.private_SetValue = function(Value)
{
let oAnnot = this.Class;
oAnnot.SetRect(Value, this.isOnRotate);
};
CChangesPDFAnnotStampRect.prototype.WriteToBinary = function(Writer)
{
CChangesAnnotArrayOfDoubleProperty.prototype.WriteToBinary.call(this, Writer);
Writer.WriteBool(this.isOnRotate);
};
CChangesPDFAnnotStampRect.prototype.ReadFromBinary = function(Reader)
{
CChangesAnnotArrayOfDoubleProperty.prototype.ReadFromBinary.call(this, Reader);
this.isOnRotate = Reader.GetBool();
};
CChangesAnnotArrayOfDoubleProperty.prototype.Load = function(){
this.Redo();
this.RefreshRecalcData();
};
/**
* @constructor
* @extends {AscDFH.CChangesBaseLongProperty}

View File

@ -695,7 +695,7 @@ function CEditorPage(api)
style.innerHTML = styleContent;
_head.appendChild(style);
this.reporterTranslates = ["Reset", "Slide {0} of {1}", "End slideshow", "Pen", "Highlighter", "Ink color", "Eraser", "Erase screen"];
this.reporterTranslates = [ "Reset", "Slide {0} of {1}", "End slideshow", "The end of slide preview. Click to exit.", "Pen", "Highlighter", "Ink color", "Eraser", "Erase screen" ];
var _translates = this.m_oApi.reporterTranslates;
if (_translates)
{
@ -707,6 +707,7 @@ function CEditorPage(api)
this.reporterTranslates[5] = _translates[5];
this.reporterTranslates[6] = _translates[6];
this.reporterTranslates[7] = _translates[7];
this.reporterTranslates[8] = _translates[8];
if (_translates[3])
this.m_oApi.DemonstrationEndShowMessage(_translates[3]);
@ -739,17 +740,17 @@ function CEditorPage(api)
_buttonsContent += [
"<ul id=\"dem_id_draw_menu\" class=\"dem_menu\">",
"<li><a data-ratio data-tool=\"pen\"><span class=\"menu-item-icon btn-pen back_image_buttons\"></span>" + this.reporterTranslates[3] + "</a></li>",
"<li><a data-ratio data-tool=\"highlighter\"><span class=\"menu-item-icon btn-highlighter back_image_buttons\"></span>" + this.reporterTranslates[4] + "</a></li>",
"<li><a data-ratio data-tool=\"pen\"><span class=\"menu-item-icon btn-pen back_image_buttons\"></span>" + this.reporterTranslates[4] + "</a></li>",
"<li><a data-ratio data-tool=\"highlighter\"><span class=\"menu-item-icon btn-highlighter back_image_buttons\"></span>" + this.reporterTranslates[5] + "</a></li>",
"<li class=\"dem_draw_menu_divider\"></li>",
"<li id=\"dem_id_draw_color_menu_trigger\" class=\"submenu\"><a style=\"padding-left:28px;\">" + this.reporterTranslates[5] + "</a>",
"<li id=\"dem_id_draw_color_menu_trigger\" class=\"submenu\"><a style=\"padding-left:28px;\">" + this.reporterTranslates[6] + "</a>",
"<ul id=\"dem_id_draw_color_menu\" class=\"dem_menu\" style=\"width: 162px;\">",
colorList,
"</ul>",
"</li>",
"<li class=\"dem_draw_menu_divider\"></li>",
"<li><a data-ratio data-tool=\"eraser\"><span class=\"menu-item-icon btn-eraser back_image_buttons\"></span>" + this.reporterTranslates[6] + "</a></li>",
"<li><a data-tool=\"erase-all\"><span class=\"menu-item-icon btn-erase-all back_image_buttons\"></span>" + this.reporterTranslates[7] + "</a></li>",
"<li><a data-ratio data-tool=\"eraser\"><span class=\"menu-item-icon btn-eraser back_image_buttons\"></span>" + this.reporterTranslates[7] + "</a></li>",
"<li><a data-tool=\"erase-all\"><span class=\"menu-item-icon btn-erase-all back_image_buttons\"></span>" + this.reporterTranslates[8] + "</a></li>",
"</ul>"
].join("");

View File

@ -5891,6 +5891,20 @@ CPresentation.prototype.EnterText = function (value) {
}
return bRetValue;
};
CPresentation.prototype.GetCurrentParagraph = function(bIgnoreSelection, bReturnSelectedArray, oPr) {
let oController = this.GetCurrentController();
if (!oController) {
return null;
}
let oContent = oController.getTargetDocContent();
if(!oContent) {
return null;
}
return oContent.GetCurrentParagraph(bIgnoreSelection, bReturnSelectedArray, oPr);
};
CPresentation.prototype.CorrectEnterText = function (oldValue, newValue) {
if (undefined === oldValue
|| null === oldValue

View File

@ -719,9 +719,9 @@
* @memberof Api
* @typeofeditors ["CPE"]
* @param {ChartType} [sType="bar"] - The chart type used for the chart display.
* @param {Array} aSeries - The array of the data used to build the chart from.
* @param {Array} aSeriesNames - The array of the names (the source table column names) used for the data which the chart will be build from.
* @param {Array} aCatNames - The array of the names (the source table row names) used for the data which the chart will be build from.
* @param {number[][]} aSeries - The array of the data used to build the chart from.
* @param {number[] | string[]} aSeriesNames - The array of the names (the source table column names) used for the data which the chart will be build from.
* @param {number[] | string[]} aCatNames - The array of the names (the source table row names) used for the data which the chart will be build from.
* @param {EMU} nWidth - The chart width in English measure units.
* @param {EMU} nHeight - The chart height in English measure units.
* @param {number} nStyleIndex - The chart color style index (can be <b>1 - 48</b>, as described in OOXML specification).
@ -906,12 +906,13 @@
let oPresentation = private_GetPresentation();
let oParsedObj = JSON.parse(sMessage);
let oResult = null;
if (oParsedObj["tblStyleLst"])
oReader.TableStylesFromJSON(oParsedObj["tblStyleLst"]);
switch (oParsedObj["type"])
{
case "presentation":
if (oParsedObj["tblStyleLst"])
oReader.TableStylesFromJSON(oParsedObj["tblStyleLst"]);
let oSldSize = oParsedObj["sldSz"] ? oReader.SlideSizeFromJSON(oParsedObj["sldSz"]) : null;
let oShowPr = oParsedObj["showPr"] ? oReader.ShowPrFromJSON(oParsedObj["showPr"]) : null;
oSldSize && oPresentation.setSldSz(oSldSize);
@ -972,8 +973,6 @@
oResult = this.private_CreateApiHyperlink(oReader.HyperlinkFromJSON(oParsedObj));
break;
case "graphicFrame":
if (oParsedObj["tblStyleLst"])
oReader.TableStylesFromJSON(oParsedObj["tblStyleLst"]);
oResult = new ApiTable(oReader.GraphicObjFromJSON(oParsedObj));
break;
case "image":
@ -1006,18 +1005,12 @@
oResult = this.private_CreateApiUniColor(oReader.ColorFromJSON(oParsedObj));
break;
case "slide":
if (oParsedObj["tblStyleLst"])
oReader.TableStylesFromJSON(oParsedObj["tblStyleLst"]);
oResult = new ApiSlide(oReader.SlideFromJSON(oParsedObj));
break;
case "sldLayout":
if (oParsedObj["tblStyleLst"])
oReader.TableStylesFromJSON(oParsedObj["tblStyleLst"]);
oResult = new ApiLayout(oReader.SlideLayoutFromJSON(oParsedObj));
break;
case "sldMaster":
if (oParsedObj["tblStyleLst"])
oReader.TableStylesFromJSON(oParsedObj["tblStyleLst"]);
oResult = new ApiMaster(oReader.MasterSlideFromJSON(oParsedObj));
break;
case "fontScheme":
@ -1030,8 +1023,6 @@
oResult = new ApiThemeColorScheme(oReader.ClrSchemeFromJSON(oParsedObj));
break;
case "slides":
if (oParsedObj["tblStyleLst"])
oReader.TableStylesFromJSON(oParsedObj["tblStyleLst"]);
let aApiSlides = []
let aSlides = oReader.SlidesFromJSON(oParsedObj);
for (let nSlide = 0; nSlide < aSlides.length; nSlide++)
@ -1110,7 +1101,6 @@
return -1;
};
/**
* Returns a slide by its position in the presentation.
* @memberof ApiPresentation
@ -1137,6 +1127,39 @@
return this.GetSlideByIndex(this.GetCurSlideIndex());
};
/**
* Returns the current visible slide, layout or master.
* @typeofeditors ["CPE"]
* @memberof ApiPresentation
* @returns {ApiSlide | ApiLayout | ApiMaster | null} - returns null if the current slide is not found.
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/GetCurrentVisibleSlide.js
*/
ApiPresentation.prototype.GetCurrentVisibleSlide = function () {
const slideIndex = this.GetCurSlideIndex();
if (!Asc.editor.isMasterMode()) {
return this.GetSlideByIndex(slideIndex);
}
const aMasters = this.GetAllSlideMasters();
let accumulatedIndex = 0;
for (let i = 0; i < aMasters.length; i++) {
const master = aMasters[i];
if (accumulatedIndex === slideIndex) {
return master;
}
const layouts = master.GetAllLayouts();
if (slideIndex < accumulatedIndex + layouts.length + 1) {
return layouts[slideIndex - accumulatedIndex - 1];
}
accumulatedIndex += layouts.length + 1;
}
return null;
};
/**
* Appends a new slide to the end of the presentation.
@ -1152,8 +1175,6 @@
}
};
/**
* Sets the size to the current presentation.
* @typeofeditors ["CPE"]
@ -1388,7 +1409,7 @@
* Converts the ApiPresentation object into the JSON object.
* @memberof ApiPresentation
* @typeofeditors ["CPE"]
* @param {bool} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @param {boolean} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @returns {JSON}
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/ToJSON.js
*/
@ -1403,12 +1424,12 @@
* Converts the slides from the current ApiPresentation object into the JSON objects.
* @memberof ApiPresentation
* @typeofeditors ["CPE"]
* @param {bool} [nStart=0] - The index to the start slide.
* @param {bool} [nStart=ApiPresentation.GetSlidesCount() - 1] - The index to the end slide.
* @param {bool} [bWriteLayout=false] - Specifies if the slide layout will be written to the JSON object or not.
* @param {bool} [bWriteMaster=false] - Specifies if the slide master will be written to the JSON object or not (bWriteMaster is false if bWriteLayout === false).
* @param {bool} [bWriteAllMasLayouts=false] - Specifies if all child layouts from the slide master will be written to the JSON object or not.
* @param {bool} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @param {boolean} [nStart=0] - The index to the start slide.
* @param {boolean} [nStart=ApiPresentation.GetSlidesCount() - 1] - The index to the end slide.
* @param {boolean} [bWriteLayout=false] - Specifies if the slide layout will be written to the JSON object or not.
* @param {boolean} [bWriteMaster=false] - Specifies if the slide master will be written to the JSON object or not (bWriteMaster is false if bWriteLayout === false).
* @param {boolean} [bWriteAllMasLayouts=false] - Specifies if all child layouts from the slide master will be written to the JSON object or not.
* @param {boolean} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @returns {JSON[]}
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/SlidesToJSON.js
*/
@ -1446,6 +1467,91 @@
return aApiComments;
};
/**
* Private method to collect all objects of a specific type from the presentation (OleObjects, Charts, Shapes, Images).
* Calls 'getObjectsMethod' method on each slide, master and layout to get the objects.
*/
ApiPresentation.prototype._collectAllObjects = function (getObjectsMethod) {
const aObjects = [];
function collectObjects(aSource) {
aSource.forEach(function (oSource) {
oSource[getObjectsMethod]().forEach(function (oObject) {
aObjects.push(oObject);
});
});
}
const aSlides = this.GetAllSlides();
const aMasters = this.GetAllSlideMasters();
// Can't use flatMap because it's not supported in IE11
const aLayouts = aMasters.reduce(function (acc, oMaster) {
return acc.concat(oMaster.GetAllLayouts());
}, []);
collectObjects(aSlides);
collectObjects(aMasters);
collectObjects(aLayouts);
return aObjects;
};
/**
* Returns an array with all the OLE objects from the current presentation.
* @memberof ApiPresentation
* @typeofeditors ["CPE"]
* @returns {ApiOleObject[]}
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/GetAllOleObjects.js
*/
ApiPresentation.prototype.GetAllOleObjects = function () {
return this._collectAllObjects('GetAllOleObjects');
};
/**
* Returns an array with all the chart objects from the current presentation.
* @memberof ApiPresentation
* @typeofeditors ["CPE"]
* @returns {ApiChart[]}
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/GetAllCharts.js
*/
ApiPresentation.prototype.GetAllCharts = function () {
return this._collectAllObjects('GetAllCharts');
};
/**
* Returns an array with all the shape objects from the current presentation.
* @memberof ApiPresentation
* @typeofeditors ["CPE"]
* @returns {ApiShape[]}
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/GetAllShapes.js
*/
ApiPresentation.prototype.GetAllShapes = function () {
return this._collectAllObjects('GetAllShapes');
};
/**
* Returns an array with all the image objects from the current presentation.
* @memberof ApiPresentation
* @typeofeditors ["CPE"]
* @returns {ApiImage[]}
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/GetAllImages.js
*/
ApiPresentation.prototype.GetAllImages = function () {
return this._collectAllObjects('GetAllImages');
};
/**
* Returns an array with all the drawing objects from the current presentation.
* @memberof ApiPresentation
* @typeofeditors ["CPE"]
* @returns {Drawing[]}
* @see office-js-api/Examples/{Editor}/ApiPresentation/Methods/GetAllDrawings.js
*/
ApiPresentation.prototype.GetAllDrawings = function () {
return this._collectAllObjects('GetAllDrawings');
};
/**
* Returns the document information:
* <b>Application</b> - the application the document has been created with.
@ -1547,6 +1653,21 @@
return "master";
};
/**
* Returns all layouts from the slide master
* @typeofeditors ["CPE"]
* @returns {ApiLayout[]} - returns an empty array if the slide master doesn't have layouts.
* @see office-js-api/Examples/{Editor}/ApiMaster/Methods/GetAllLayouts.js
*/
ApiMaster.prototype.GetAllLayouts = function () {
const aLayouts = this.Master.sldLayoutLst;
const aApiLayouts = [];
aLayouts.forEach(function (oLayout) {
aApiLayouts.push(new ApiLayout(oLayout));
});
return aApiLayouts;
};
/**
* Returns a layout of the specified slide master by its position.
* @typeofeditors ["CPE"]
@ -1877,7 +1998,7 @@
* Converts the ApiMaster object into the JSON object.
* @memberof ApiMaster
* @typeofeditors ["CPE"]
* @param {bool} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @param {boolean} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @returns {JSON}
* @see office-js-api/Examples/{Editor}/ApiMaster/Methods/ToJSON.js
*/
@ -2275,8 +2396,8 @@
* Converts the ApiLayout object into the JSON object.
* @memberof ApiLayout
* @typeofeditors ["CPE"]
* @param {bool} [bWriteMaster=false] - Specifies if the slide master will be written to the JSON object or not.
* @param {bool} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @param {boolean} [bWriteMaster=false] - Specifies if the slide master will be written to the JSON object or not.
* @param {boolean} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @returns {JSON}
* @see office-js-api/Examples/{Editor}/ApiLayout/Methods/ToJSON.js
*/
@ -3453,10 +3574,10 @@
* Converts the ApiSlide object into the JSON object.
* @memberof ApiSlide
* @typeofeditors ["CPE"]
* @param {bool} [bWriteLayout=false] - Specifies if the slide layout will be written to the JSON object or not.
* @param {bool} [bWriteMaster=false] - Specifies if the slide master will be written to the JSON object or not (bWriteMaster is false if bWriteLayout === false).
* @param {bool} [bWriteAllMasLayouts=false] - Specifies if all child layouts from the slide master will be written to the JSON object or not.
* @param {bool} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @param {boolean} [bWriteLayout=false] - Specifies if the slide layout will be written to the JSON object or not.
* @param {boolean} [bWriteMaster=false] - Specifies if the slide master will be written to the JSON object or not (bWriteMaster is false if bWriteLayout === false).
* @param {boolean} [bWriteAllMasLayouts=false] - Specifies if all child layouts from the slide master will be written to the JSON object or not.
* @param {boolean} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @returns {JSON}
* @see office-js-api/Examples/{Editor}/ApiSlide/Methods/ToJSON.js
*/
@ -3835,7 +3956,7 @@
* Returns the lock value for the specified lock type of the current drawing.
* @typeofeditors ["CPE"]
* @param {DrawingLockType} sType - Lock type in the string format.
* @returns {bool}
* @returns {boolean}
* @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/GetLockValue.js
*/
ApiDrawing.prototype.GetLockValue = function(sType)
@ -3855,8 +3976,8 @@
* Sets the lock value to the specified lock type of the current drawing.
* @typeofeditors ["CPE"]
* @param {DrawingLockType} sType - Lock type in the string format.
* @param {bool} bValue - Specifies if the specified lock is applied to the current drawing.
* @returns {bool}
* @param {boolean} bValue - Specifies if the specified lock is applied to the current drawing.
* @returns {boolean}
* @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/SetLockValue.js
*/
ApiDrawing.prototype.SetLockValue = function(sType, bValue)
@ -4458,7 +4579,7 @@
* Converts the ApiTable object into the JSON object.
* @memberof ApiTable
* @typeofeditors ["CPE"]
* @param {bool} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @param {boolean} [bWriteTableStyles=false] - Specifies whether to write used table styles to the JSON object (true) or not (false).
* @returns {JSON}
* @see office-js-api/Examples/{Editor}/ApiTable/Methods/ToJSON.js
*/
@ -4879,6 +5000,7 @@
ApiPresentation.prototype["GetCurSlideIndex"] = ApiPresentation.prototype.GetCurSlideIndex;
ApiPresentation.prototype["GetSlideByIndex"] = ApiPresentation.prototype.GetSlideByIndex;
ApiPresentation.prototype["GetCurrentSlide"] = ApiPresentation.prototype.GetCurrentSlide;
ApiPresentation.prototype["GetCurrentVisibleSlide"] = ApiPresentation.prototype.GetCurrentVisibleSlide;
ApiPresentation.prototype["AddSlide"] = ApiPresentation.prototype.AddSlide;
ApiPresentation.prototype["CreateNewHistoryPoint"] = ApiPresentation.prototype.CreateNewHistoryPoint;
ApiPresentation.prototype["SetSizes"] = ApiPresentation.prototype.SetSizes;
@ -4896,9 +5018,13 @@
ApiPresentation.prototype["GetHeight"] = ApiPresentation.prototype.GetHeight;
ApiPresentation.prototype["GetAllComments"] = ApiPresentation.prototype.GetAllComments;
ApiPresentation.prototype["GetDocumentInfo"] = ApiPresentation.prototype.GetDocumentInfo;
ApiPresentation.prototype["SlidesToJSON"] = ApiPresentation.prototype.SlidesToJSON;
ApiPresentation.prototype["ToJSON"] = ApiPresentation.prototype.ToJSON;
ApiPresentation.prototype["GetAllOleObjects"] = ApiPresentation.prototype.GetAllOleObjects;
ApiPresentation.prototype["GetAllCharts"] = ApiPresentation.prototype.GetAllCharts;
ApiPresentation.prototype["GetAllShapes"] = ApiPresentation.prototype.GetAllShapes;
ApiPresentation.prototype["GetAllImages"] = ApiPresentation.prototype.GetAllImages;
ApiPresentation.prototype["GetAllDrawings"] = ApiPresentation.prototype.GetAllDrawings;
ApiMaster.prototype["GetClassType"] = ApiMaster.prototype.GetClassType;
ApiMaster.prototype["GetLayout"] = ApiMaster.prototype.GetLayout;

View File

@ -1221,30 +1221,26 @@ function CHorRuler()
word_control.m_oOverlayApi.VertLine(pos);
break;
}
case AscWord.RULER_DRAG_TYPE.tab:
{
var newVal = RulerCorrectPosition(this, _x, _margin_left);
this.m_dCurrentTabNewPosition = newVal - _margin_left;
var pos = left + (_margin_left + this.m_dCurrentTabNewPosition) * dKoef_mm_to_pix;
if (_y <= 3 || _y > 5.6)
{
this.IsDrawingCurTab = false;
word_control.OnUpdateOverlay();
}
else
{
this.IsDrawingCurTab = true;
}
word_control.UpdateHorRulerBack();
if (this.IsDrawingCurTab)
word_control.m_oOverlayApi.VertLine(pos);
break;
}
case AscWord.RULER_DRAG_TYPE.tab:
{
let newVal = RulerCorrectPosition(this, _x, this.m_bRtl ? _margin_right : _margin_left);
this.m_dCurrentTabNewPosition = this.m_bRtl ? _margin_right - newVal : newVal - _margin_left;
if (_y <= 3 || _y > 5.6)
{
this.IsDrawingCurTab = false;
word_control.OnUpdateOverlay();
}
else
{
this.IsDrawingCurTab = true;
let offset = this.m_bRtl ? _margin_right - this.m_dCurrentTabNewPosition : _margin_left + this.m_dCurrentTabNewPosition;
let pos = left + offset * dKoef_mm_to_pix;
word_control.m_oOverlayApi.VertLine(pos);
}
word_control.UpdateHorRulerBack();
break;
}
case AscWord.RULER_DRAG_TYPE.table:
{
var newVal = RulerCorrectPosition(this, _x, this.TableMarginLeftTrackStart);
@ -1509,10 +1505,9 @@ function CHorRuler()
// tabs
if (y >= 3 && y <= _bottom)
{
var _count_tabs = this.m_arrTabs.length;
for (var i = 0; i < _count_tabs; i++)
for (let i = 0, tabCount = this.m_arrTabs.length; i < tabCount; ++i)
{
var _pos = _margin_left + this.m_arrTabs[i].pos;
var _pos = this.m_bRtl ? _margin_right - this.m_arrTabs[i].pos : _margin_left + this.m_arrTabs[i].pos;
if ((x >= (_pos - 1)) && (x <= (_pos + 1)))
{
if (true === isMouseDown)
@ -1928,13 +1923,14 @@ function CHorRuler()
this.m_dIndentRight_old = this.m_dIndentRight;
break;
}
case AscWord.RULER_DRAG_TYPE.tab:
{
var pos = left + (_margin_left + this.m_arrTabs[this.m_lCurrentTab].pos) * dKoef_mm_to_pix;
this.m_dCurrentTabNewPosition = this.m_arrTabs[this.m_lCurrentTab].pos;
word_control.m_oOverlayApi.VertLine(pos);
break;
}
case AscWord.RULER_DRAG_TYPE.tab:
{
let offset = this.m_bRtl ? (_margin_right - this.m_arrTabs[this.m_lCurrentTab].pos) : (_margin_left + this.m_arrTabs[this.m_lCurrentTab].pos);
let pos = left + offset * dKoef_mm_to_pix;
word_control.m_oOverlayApi.VertLine(pos);
this.m_dCurrentTabNewPosition = this.m_arrTabs[this.m_lCurrentTab].pos;
break;
}
case AscWord.RULER_DRAG_TYPE.table:
{
var markup = this.m_oTableMarkup;
@ -2019,49 +2015,40 @@ function CHorRuler()
break;
}
}
if (AscWord.RULER_DRAG_TYPE.none === this.DragType)
{
// посмотрим - может это добавляется таб
var _top = 1.8;
var _bottom = 5.2;
// tabs
if (_y >= 3 && _y <= _bottom && _x >= (_margin_left + this.m_dIndentLeft) && _x <= (_margin_right - this.m_dIndentRight))
{
var mm_1_4 = 10 / 4;
var mm_1_8 = mm_1_4 / 2;
var _new_tab_pos = RulerCorrectPosition(this, _x, _margin_left);
_new_tab_pos -= _margin_left;
this.m_arrTabs[this.m_arrTabs.length] = new CTab(_new_tab_pos, word_control.m_nTabsType);
//this.CorrectTabs();
word_control.UpdateHorRuler();
this.m_lCurrentTab = this.m_arrTabs.length - 1;
/*
var _len = this.m_arrTabs.length;
for (var i = 0; i < _len; i++)
{
if (this.m_arrTabs[i].pos == _new_tab_pos)
{
this.m_lCurrentTab = i;
break;
}
}
*/
this.DragType = AscWord.RULER_DRAG_TYPE.tab;
this.m_dCurrentTabNewPosition = _new_tab_pos;
var pos = left + (_margin_left + _new_tab_pos) * dKoef_mm_to_pix;
word_control.m_oOverlayApi.VertLine(pos);
}
}
word_control.m_oDrawingDocument.LockCursorTypeCur();
}
if (AscWord.RULER_DRAG_TYPE.none === this.DragType)
{
let posT = 3;
let posB = 5.2;
let posL = this.m_bRtl ? _margin_left + this.m_dIndentRight : _margin_left + this.m_dIndentLeft;
let posR = this.m_bRtl ? _margin_right - this.m_dIndentRight : _margin_right - this.m_dIndentLeft;
if (posT <= _y && _y <= posB && posL <= _x && _x <= posR)
{
let newVal = RulerCorrectPosition(this, _x, this.m_bRtl ? _margin_right : _margin_left);
let tabPos = this.m_bRtl ? _margin_right - newVal : newVal - _margin_left;
let tabType = word_control.m_nTabsType;
if (this.m_bRtl)
{
if (tab_Left === tabType)
tabType = tab_Right;
else if (tab_Right === tabType)
tabType = tab_Left;
}
this.m_arrTabs[this.m_arrTabs.length] = new CTab(tabPos, tabType);
word_control.UpdateHorRuler();
this.m_lCurrentTab = this.m_arrTabs.length - 1;
this.DragType = AscWord.RULER_DRAG_TYPE.tab;
this.m_dCurrentTabNewPosition = tabPos;
let pos = left + newVal * dKoef_mm_to_pix;
word_control.m_oOverlayApi.VertLine(pos);
}
}
word_control.m_oDrawingDocument.LockCursorTypeCur();
}
this.OnMouseUp = function(left, top, e)
{
var word_control = this.m_oWordControl;
@ -2109,17 +2096,17 @@ function CHorRuler()
case AscWord.RULER_DRAG_TYPE.tab:
{
// смотрим, сохраняем ли таб
var _y = (global_mouseEvent.Y - word_control.Y) * g_dKoef_pix_to_mm;
if (_y <= 3 || _y > 5.6 || this.m_dCurrentTabNewPosition < this.m_dIndentLeft || (this.m_dCurrentTabNewPosition + _margin_left) > (_margin_right - this.m_dIndentRight))
{
if (-1 != this.m_lCurrentTab)
var _y = (global_mouseEvent.Y - word_control.Y) * g_dKoef_pix_to_mm;
if (_y <= 3 || _y > 5.6 || this.m_dCurrentTabNewPosition < this.m_dIndentLeft || this.m_dCurrentTabNewPosition > _margin_right - _margin_left - this.m_dIndentRight)
{
if (-1 !== this.m_lCurrentTab)
this.m_arrTabs.splice(this.m_lCurrentTab, 1);
}
else
{
}
else
{
if (this.m_lCurrentTab < this.m_arrTabs.length)
this.m_arrTabs[this.m_lCurrentTab].pos = this.m_dCurrentTabNewPosition;
}
}
this.m_lCurrentTab = -1;
this.CorrectTabs();
@ -2203,9 +2190,9 @@ function CHorRuler()
{
// смотрим, сохраняем ли таб
var _y = (global_mouseEvent.Y - word_control.Y) * g_dKoef_pix_to_mm;
if (_y <= 3 || _y > 5.6 || this.m_dCurrentTabNewPosition < this.m_dIndentLeft || (this.m_dCurrentTabNewPosition + _margin_left) > (_margin_right - this.m_dIndentRight))
if (_y <= 3 || _y > 5.6 || this.m_dCurrentTabNewPosition < this.m_dIndentLeft || this.m_dCurrentTabNewPosition > _margin_right - _margin_left - this.m_dIndentRight)
{
if (-1 != this.m_lCurrentTab)
if (-1 !== this.m_lCurrentTab)
this.m_arrTabs.splice(this.m_lCurrentTab, 1);
}
else
@ -2425,8 +2412,6 @@ function CHorRuler()
var var2 = 0;
var var3 = 0;
var _positon_y = this.m_nBottom - 5 * dPR;
// не менять!!!
var2 = 5 * dPR;//(1.4 * g_dKoef_mm_to_pix) >> 0;
var3 = 3 * dPR;//(1 * g_dKoef_mm_to_pix) >> 0;
@ -2437,6 +2422,7 @@ function CHorRuler()
var _1mm_to_pix = g_dKoef_mm_to_pix * dPR;
let top = this.m_nTop;
let bottom = this.m_nBottom;
let isRtl = this.m_bRtl;
function blitLeftInd(ind, isRtl)
{
@ -2514,6 +2500,64 @@ function CHorRuler()
context.stroke();
}
function blitLeftTab(x, y)
{
context.beginPath();
context.moveTo(x, y);
context.lineTo(x, y + Math.round(5 * dPR));
context.lineTo(x + Math.round(5 * dPR), y + Math.round(5 * dPR));
context.stroke();
}
function blitRightTab(x, y)
{
context.beginPath();
context.moveTo(x, y);
context.lineTo(x, y + Math.round(5 * dPR));
context.lineTo(x - Math.round(5 * dPR), y + Math.round(5 * dPR));
context.stroke();
}
function blitCenterTab(x, y)
{
context.beginPath();
context.moveTo(x, y);
context.lineTo(x, y + Math.round(5 * dPR));
context.moveTo(x - Math.round(5 * dPR), y + Math.round(5 * dPR));
context.lineTo(x + Math.round(5 * dPR), y + Math.round(5 * dPR));
context.stroke();
}
function blitTab(tabPos, tabType)
{
let x = parseInt((isRtl ? (_margin_right - tabPos) : (_margin_left + tabPos)) * dKoef_mm_to_pix) + left;
let y = bottom - 5 * dPR;
let lineW = context.lineWidth;
context.lineWidth = 2 * roundDPR;
if (tab_Left === tabType)
{
if (isRtl)
blitRightTab(x, y);
else
blitLeftTab(x, y);
}
else if (tab_Right === tabType)
{
if (isRtl)
blitLeftTab(x, y);
else
blitRightTab(x, y);
}
else if (tab_Center === tab_Center)
{
blitCenterTab(x, y);
}
context.lineWidth = lineW;
}
// old position --------------------------------------
context.strokeStyle = GlobalSkin.RulerMarkersOutlineColorOld;
context.fillStyle = GlobalSkin.RulerMarkersFillColorOld;
@ -2525,51 +2569,13 @@ function CHorRuler()
if (-10000 !== this.m_dIndentRight_old && this.m_dIndentRight_old !== this.m_dIndentRight)
blitRightInd(this.m_dIndentRight_old, this.m_bRtl);
context.strokeStyle = GlobalSkin.RulerTabsColorOld;
if (-1 != this.m_lCurrentTab && this.m_lCurrentTab < this.m_arrTabs.length)
{
var _tab = this.m_arrTabs[this.m_lCurrentTab];
var _x = parseInt((_margin_left + _tab.pos) * dKoef_mm_to_pix) + left;
var _old_w = context.lineWidth;
context.lineWidth = 2 * roundDPR;
switch (_tab.type)
{
case tab_Left:
{
context.beginPath();
context.moveTo(_x, _positon_y);
context.lineTo(_x, _positon_y + Math.round(5 * dPR));
context.lineTo(_x + Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.stroke();
break;
}
case tab_Right:
{
context.beginPath();
context.moveTo(_x, _positon_y);
context.lineTo(_x, _positon_y + Math.round(5 * dPR));
context.lineTo(_x - Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.stroke();
break;
}
case tab_Center:
{
context.beginPath();
context.moveTo(_x, _positon_y);
context.lineTo(_x, _positon_y + Math.round(5 * dPR));
context.moveTo(_x - Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.lineTo(_x + Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.stroke();
break;
}
default:
break;
}
context.lineWidth = _old_w;
}
if (-1 !== this.m_lCurrentTab && this.m_lCurrentTab < this.m_arrTabs.length)
{
var _tab = this.m_arrTabs[this.m_lCurrentTab];
blitTab(_tab.pos, _tab.type);
}
// ---------------------------------------------------
@ -2597,7 +2603,7 @@ function CHorRuler()
// теперь рисуем табы ----------------------------------------
// default
var position_default_tab = this.m_dDefaultTab;
_positon_y = this.m_nBottom + Math.round(1.5 * dPR);
let _positon_y = this.m_nBottom + Math.round(1.5 * dPR);
var _min_default_value = Math.max(0, this.m_dMaxTab);
if (this.m_dDefaultTab > 0.01)
@ -2640,75 +2646,31 @@ function CHorRuler()
position_default_tab += this.m_dDefaultTab;
}
}
}
// custom tabs
var _len_tabs = this.m_arrTabs.length;
if (0 != _len_tabs)
{
context.strokeStyle = GlobalSkin.RulerTabsColor;
context.lineWidth = 2 * roundDPR;
_positon_y = this.m_nBottom - Math.round(5 * dPR);
for (var i = 0; i < _len_tabs; i++)
{
var tab = this.m_arrTabs[i];
var _x = 0;
if (i == this.m_lCurrentTab)
{
if (!this.IsDrawingCurTab)
continue;
// рисуем вместо него - позицию нового
_x = parseInt((_margin_left + this.m_dCurrentTabNewPosition) * dKoef_mm_to_pix) + left;
}
else
{
//if (tab.pos < 0 || tab.pos > this.m_dMarginRight)
if (tab.pos < this.m_dIndentLeft || (tab.pos + _margin_left) > (_margin_right - this.m_dIndentRight))
continue;
_x = parseInt((_margin_left + tab.pos) * dKoef_mm_to_pix) + left;
}
switch (tab.type)
{
case tab_Left:
{
context.beginPath();
context.moveTo(_x, _positon_y);
context.lineTo(_x, _positon_y + Math.round(5 * dPR));
context.lineTo(_x + Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.stroke();
break;
}
case tab_Right:
{
context.beginPath();
context.moveTo(_x, _positon_y);
context.lineTo(_x, _positon_y + Math.round(5 * dPR));
context.lineTo(_x - Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.stroke();
break;
}
case tab_Center:
{
context.beginPath();
context.moveTo(_x, _positon_y);
context.lineTo(_x, _positon_y + Math.round(5 * dPR));
context.moveTo(_x - Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.lineTo(_x + Math.round(5 * dPR), _positon_y + Math.round(5 * dPR));
context.stroke();
break;
}
default:
break;
}
}
}
// -----------------------------------------------------------
}
}
}
// custom tabs
context.strokeStyle = GlobalSkin.RulerTabsColor;
for (let i = 0, tabCount = this.m_arrTabs.length; i < tabCount; ++i)
{
let tab = this.m_arrTabs[i];
let tabPos = tab.pos;
if (i === this.m_lCurrentTab)
{
if (!this.IsDrawingCurTab)
continue;
// рисуем вместо него - позицию нового
tabPos = this.m_dCurrentTabNewPosition;
}
else if (tab.pos < this.m_dIndentLeft)
{
continue;
}
blitTab(tabPos, tab.type);
}
// -----------------------------------------------------------
}
}
this.UpdateParaInd = function(paraInd, isRtl)
{

View File

@ -6310,9 +6310,48 @@ CDocument.prototype.EditOleObject = function(oOleObject, sData, sImageUrl, fWidt
{
oOleObject.editExternal(sData, sImageUrl, fWidth, fHeight, nPixWidth, nPixHeight, arrImagesForAddToHistory);
};
CDocument.prototype.AddTextArt = function(nStyle)
CDocument.prototype.AddTextArt = function(textArtStyle)
{
this.Controller.AddTextArt(nStyle);
let curParagraph = this.GetCurrentParagraph();
if (!curParagraph)
return;
let drawing = new AscWord.ParaDrawing(1828800 / 36000, 1828800 / 36000, null, this.DrawingDocument, this, null);
let textArt = this.DrawingObjects.createTextArt(textArtStyle, true);
textArt.setParent(drawing);
drawing.Set_GraphicObject(textArt);
drawing.Set_DrawingType(drawing_Anchor);
drawing.Set_WrappingType(WRAPPING_TYPE_NONE);
drawing.Set_BehindDoc(false);
drawing.Set_Distance(3.2, 0, 3.2, 0);
drawing.Set_PositionV(Asc.c_oAscRelativeFromV.Paragraph, false, 0, false);
if (curParagraph.isRtlDirection())
drawing.Set_PositionH(Asc.c_oAscRelativeFromH.Column, true, Asc.c_oAscAlignH.Right, false);
else
drawing.Set_PositionH(Asc.c_oAscRelativeFromH.Column, false, 0, false);
let docContent = textArt.getDocContent();
let directParaPr = curParagraph.GetDirectParaPr(false);
if (undefined !== directParaPr.Bidi)
{
docContent.GetAllParagraphs().forEach(function(p){
p.SetParagraphBidi(directParaPr.Bidi);
});
}
this.RemoveBeforePaste();
this.AddToParagraph(drawing);
if (textArt.bSelectedText)
{
this.Select_DrawingObject(drawing.GetId());
}
else
{
docContent.SelectAll();
docContent.SetThisElementCurrent();
}
};
CDocument.prototype.AddSignatureLine = function(oSignatureDrawing){
@ -19756,42 +19795,6 @@ CDocument.prototype.controller_AddOleObject = function(W, H, nWidthPix, nHeightP
}
return Drawing;
};
CDocument.prototype.controller_AddTextArt = function(nStyle)
{
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
var Drawing = new ParaDrawing(1828800 / 36000, 1828800 / 36000, null, this.DrawingDocument, this, null);
var TextArt = this.DrawingObjects.createTextArt(nStyle, true);
TextArt.setParent(Drawing);
Drawing.Set_GraphicObject(TextArt);
Drawing.Set_DrawingType(drawing_Anchor);
Drawing.Set_WrappingType(WRAPPING_TYPE_NONE);
Drawing.Set_BehindDoc(false);
Drawing.Set_Distance(3.2, 0, 3.2, 0);
Drawing.Set_PositionH(Asc.c_oAscRelativeFromH.Column, false, 0, false);
Drawing.Set_PositionV(Asc.c_oAscRelativeFromV.Paragraph, false, 0, false);
if (true == this.Selection.Use)
this.Remove(1, true);
this.AddToParagraph(Drawing);
if (TextArt.bSelectedText)
{
this.Select_DrawingObject(Drawing.Get_Id());
}
else
{
var oContent = Drawing.GraphicObj.getDocContent();
oContent.Content[0].Document_SetThisElementCurrent(false);
this.SelectAll();
}
}
else
{
Item.AddTextArt(nStyle);
}
};
CDocument.prototype.controller_AddSignatureLine = function(oSignatureDrawing)
{
var Item = this.Content[this.CurPos.ContentPos];
@ -22447,9 +22450,13 @@ CDocument.prototype.controller_GetSelectionState = function()
var State;
if (true === this.Selection.Use)
{
if (this.controller_IsNumberingSelection() || this.controller_IsMovingTableBorder())
if (this.controller_IsMovingTableBorder())
{
State = [];
State = []
}
else if (this.controller_IsNumberingSelection())
{
State = [this.GetCurrentParagraph()];
}
else
{
@ -22484,19 +22491,25 @@ CDocument.prototype.controller_SetSelectionState = function(State, StateIndex)
{
if (true === this.Selection.Use)
{
// Выделение нумерации
if (selectionflag_Numbering == this.Selection.Flag)
if (selectionflag_Numbering === this.Selection.Flag)
{
if (type_Paragraph === this.Content[this.Selection.StartPos].Get_Type())
let curPara = State[StateIndex];
if (curPara && curPara.IsParagraph && curPara.IsParagraph())
{
var NumPr = this.Content[this.Selection.StartPos].GetNumPr();
if (undefined !== NumPr)
this.SelectNumbering(NumPr, this.Content[this.Selection.StartPos]);
let numPr = curPara.GetNumPr();
let prevNumPr = curPara.GetPrChangeNumPr();
if (numPr && numPr.IsValid())
this.SelectNumbering(numPr, curPara);
else if (prevNumPr && prevNumPr.IsValid())
this.SelectNumberingSingleParagraph(curPara);
else
this.RemoveSelection();
}
else
{
this.RemoveSelection();
}
}
else
{
@ -29227,6 +29240,7 @@ CDocumentNumberingInfoEngine.prototype.CheckParagraph = function(oPara)
var oNum = this.Numbering.GetNum(oParaNumPrPrev.NumId);
if (oNum)
{
let prevLvl = undefined === oParaNumPrPrev.Lvl || null === oParaNumPrPrev.Lvl ? 0 : oParaNumPrPrev.Lvl;
var oAbstractNum = oNum.GetAbstractNum();
if (oAbstractNum === this.AbstractNum)
{
@ -29235,7 +29249,7 @@ CDocumentNumberingInfoEngine.prototype.CheckParagraph = function(oPara)
if (reviewtype_Common === oReviewType)
{
this.private_UpdateCounter(this.SourceCounter, oNum, oParaNumPrPrev.Lvl);
this.private_UpdateCounter(this.SourceCounter, oNum, prevLvl);
}
else if (reviewtype_Add === oReviewType)
{
@ -29243,7 +29257,7 @@ CDocumentNumberingInfoEngine.prototype.CheckParagraph = function(oPara)
else if (reviewtype_Remove === oReviewType)
{
if (!oReviewInfo.GetPrevAdded())
this.private_UpdateCounter(this.SourceCounter, oNum, oParaNumPrPrev.Lvl);
this.private_UpdateCounter(this.SourceCounter, oNum, prevLvl);
}
}
}

View File

@ -7452,14 +7452,17 @@ CDocumentContent.prototype.GetSelectionState = function()
{
// Работаем с колонтитулом
if (docpostype_DrawingObjects === this.CurPos.Type)
{
State = this.LogicDocument.DrawingObjects.getSelectionState();
else if (docpostype_Content === this.CurPos.Type)
}
else// if (docpostype_Content === this.CurPos.Type)
{
if (true === this.Selection.Use)
{
// Выделение нумерации
if (selectionflag_Numbering == this.Selection.Flag)
State = [];
if (selectionflag_Numbering === this.Selection.Flag)
{
State = [this.GetCurrentParagraph()];
}
else
{
var StartPos = this.Selection.StartPos;
@ -7483,7 +7486,9 @@ CDocumentContent.prototype.GetSelectionState = function()
}
}
else
{
State = this.Content[this.CurPos.ContentPos].GetSelectionState();
}
}
}
@ -7534,7 +7539,7 @@ CDocumentContent.prototype.SetSelectionState = function(State, StateIndex)
var NewStateIndex = StateIndex - 1;
// Работаем с колонтитулом
if (docpostype_DrawingObjects == this.CurPos.Type)
if (docpostype_DrawingObjects === this.CurPos.Type)
{
this.LogicDocument.DrawingObjects.setSelectionState(State, NewStateIndex);
}
@ -7542,18 +7547,25 @@ CDocumentContent.prototype.SetSelectionState = function(State, StateIndex)
{
if (true === this.Selection.Use)
{
if (selectionflag_Numbering == this.Selection.Flag)
if (selectionflag_Numbering === this.Selection.Flag)
{
if (type_Paragraph === this.Content[this.Selection.StartPos].Get_Type())
let curPara = State[NewStateIndex];
if (curPara && curPara.IsParagraph && curPara.IsParagraph())
{
var NumPr = this.Content[this.Selection.StartPos].GetNumPr();
if (undefined !== NumPr)
this.SelectNumbering(NumPr, this.Content[this.Selection.StartPos]);
let numPr = curPara.GetNumPr();
let prevNumPr = curPara.GetPrChangeNumPr();
if (numPr && numPr.IsValid())
this.SelectNumbering(numPr, curPara);
else if (prevNumPr && prevNumPr.IsValid())
this.SelectNumberingSingleParagraph(curPara);
else
this.LogicDocument.RemoveSelection();
}
else
{
this.LogicDocument.RemoveSelection();
}
}
else
{

View File

@ -1781,6 +1781,41 @@ CDocumentContentBase.prototype.SelectNumbering = function(oNumPr, oPara)
oTopDocContent.SelectNumbering(oNumPr, oPara);
}
};
/**
* Select numbering in a single paragraph
* @param para {Paragraph} - current paragraph
*/
CDocumentContentBase.prototype.SelectNumberingSingleParagraph = function(para)
{
let topDocContent = this.GetTopDocumentContent();
if (topDocContent === this)
{
this.RemoveSelection();
para.Document_SetThisElementCurrent(false);
this.Selection.Use = true;
this.Selection.Flag = selectionflag_Numbering;
this.Selection.StartPos = this.CurPos.ContentPos;
this.Selection.EndPos = this.CurPos.ContentPos;
this.Selection.Data = {
Paragraphs : [para],
CurPara : para
};
para.SelectNumbering(true, true);
this.DrawingDocument.SelectEnabled(true);
let logicDocument = this.GetLogicDocument();
logicDocument.UpdateSelection();
logicDocument.UpdateInterface();
}
else
{
topDocContent.SelectNumberingSingleParagraph(para);
}
};
/**
* Проверяем является ли текущее выделение выделением нумерации
* @returns {boolean}

View File

@ -73,10 +73,6 @@ CLogicDocumentController.prototype.AddOleObject = function(nW, nH, nWidthPix, nH
{
return this.LogicDocument.controller_AddOleObject(nW, nH, nWidthPix, nHeightPix, oImage, oData, sApplicationId, bSelect, arrImagesForAddToHistory);
};
CLogicDocumentController.prototype.AddTextArt = function(nStyle)
{
this.LogicDocument.controller_AddTextArt(nStyle);
};
CLogicDocumentController.prototype.EditChart = function(Chart)
{
// Ничего не делаем

View File

@ -536,70 +536,54 @@ CNum.prototype.private_GetNumberedLvlText = function(nLvl, nNumShift, isForceAra
* @param oNumInfo
* @param oNumTextPr
* @param oTheme
* @param isRtl {boolean}
*/
CNum.prototype.Draw = function(nX, nY, oContext, nLvl, oNumInfo, oNumTextPr, oTheme)
CNum.prototype.Draw = function(nX, nY, oContext, nLvl, oNumInfo, oNumTextPr, oTheme, isRtl)
{
var oLvl = this.GetLvl(nLvl);
var arrText = oLvl.GetLvlText();
var dKoef = oNumTextPr.VertAlign !== AscCommon.vertalign_Baseline ? AscCommon.vaKSize : 1;
oContext.SetTextPr(oNumTextPr, oTheme);
oContext.SetFontSlot(AscWord.fontslot_ASCII, dKoef);
g_oTextMeasurer.SetTextPr(oNumTextPr, oTheme);
g_oTextMeasurer.SetFontSlot(AscWord.fontslot_ASCII, dKoef);
for (var nTextIndex = 0, nTextLen = arrText.length; nTextIndex < nTextLen; ++nTextIndex)
let numDraw = new AscWord.NumBidiDraw();
numDraw.begin(nX, nY, oContext, g_oTextMeasurer, oNumTextPr, isRtl);
for (let i = 0, count = arrText.length; i < count; ++i)
{
switch (arrText[nTextIndex].Type)
let element = arrText[i];
if (numbering_lvltext_Text === element.Type)
{
case numbering_lvltext_Text:
let strValue = element.Value;
let codePoint = strValue.charCodeAt(0);
let curCoef = dKoef;
let info;
if ((info = this.ApplyTextPrToCodePoint(codePoint, oNumTextPr)))
{
let strValue = arrText[nTextIndex].Value;
let codePoint = strValue.charCodeAt(0);
let curCoef = dKoef;
let info;
if ((info = this.ApplyTextPrToCodePoint(codePoint, oNumTextPr)))
{
curCoef *= info.FontCoef;
codePoint = info.CodePoint;
strValue = String.fromCodePoint(codePoint);
}
var FontSlot = AscWord.GetFontSlotByTextPr(codePoint, oNumTextPr);
oContext.SetFontSlot(FontSlot, curCoef);
g_oTextMeasurer.SetFontSlot(FontSlot, curCoef);
oContext.FillText(nX, nY, strValue);
nX += g_oTextMeasurer.Measure(strValue).Width;
break;
}
case numbering_lvltext_Num:
{
oContext.SetFontSlot(AscWord.fontslot_ASCII, dKoef);
g_oTextMeasurer.SetFontSlot(AscWord.fontslot_ASCII, dKoef);
var langForTextNumbering = oNumTextPr.Lang;
var nCurLvl = arrText[nTextIndex].Value;
var T = "";
if (nCurLvl < oNumInfo.length)
T = this.private_GetNumberedLvlText(nCurLvl, oNumInfo[nCurLvl], oLvl.IsLegalStyle() && nCurLvl < nLvl, langForTextNumbering);
for (var iter = T.getUnicodeIterator(); iter.check(); iter.next())
{
var CharCode = iter.value();
oContext.FillTextCode(nX, nY, CharCode);
nX += g_oTextMeasurer.MeasureCode(CharCode).Width;
}
break;
curCoef *= info.FontCoef;
codePoint = info.CodePoint;
strValue = String.fromCodePoint(codePoint);
}
numDraw.addTextString(strValue, curCoef);
}
else if (numbering_lvltext_Num === element.Type)
{
var langForTextNumbering = oNumTextPr.Lang;
var nCurLvl = element.Value;
var T = "";
if (nCurLvl < oNumInfo.length)
T = this.private_GetNumberedLvlText(nCurLvl, oNumInfo[nCurLvl], oLvl.IsLegalStyle() && nCurLvl < nLvl, langForTextNumbering);
numDraw.addTextString(T, dKoef);
}
}
numDraw.end();
};
/**
* Функция пересчета заданного уровня нумерации
@ -1115,6 +1099,71 @@ CLvlOverride.prototype.ReadFromBinary = function(oReader)
}
};
(function(){
/**
* Class for rendering num
* @constructor
*/
function NumBidiDraw()
{
this.bidiFlow = new AscWord.BidiFlow(this);
this.x = 0;
this.y = 0;
this.graphics = null;
this.measurer = null;
this.textPr = null;
}
NumBidiDraw.prototype.begin = function(x, y, graphics, measurer, textPr, isRtl)
{
this.x = x;
this.y = y;
this.graphics = graphics;
this.measurer = measurer;
this.textPr = textPr;
this.bidiFlow.begin(isRtl);
};
NumBidiDraw.prototype.addTextString = function(text, fontCoeff)
{
for (let iter = text.getUnicodeIterator(); iter.check(); iter.next())
{
this.addCodePoint(iter.value(), fontCoeff);
}
};
NumBidiDraw.prototype.addCodePoint = function(codePoint, fontCoeff)
{
this.bidiFlow.add([codePoint, fontCoeff], AscBidi.getType(codePoint));
};
NumBidiDraw.prototype.end = function()
{
this.bidiFlow.end();
};
NumBidiDraw.prototype.handleBidiFlow = function(data, direction)
{
let codePoint = data[0];
let fontCoeff = data[1];
if (AscBidi.DIRECTION.R === direction && AscBidi.isPairedBracket(codePoint))
codePoint = AscBidi.getPairedBracket(codePoint);
let fontSlot = AscWord.GetFontSlotByTextPr(codePoint, this.textPr);
this.graphics.SetFontSlot(fontSlot, fontCoeff);
this.graphics.FillTextCode(this.x, this.y, codePoint);
this.measurer.SetFontSlot(fontSlot, fontCoeff);
this.x += this.measurer.MeasureCode(codePoint).Width;
};
//--------------------------------------------------------export----------------------------------------------------
AscWord.NumBidiDraw = NumBidiDraw;
})();
//--------------------------------------------------------export--------------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].CNum = CNum;

View File

@ -263,10 +263,10 @@
return !!((AscWord.IsBulletedNumbering(format) && AscWord.IsBulletedNumbering(numFormat))
|| (AscWord.IsNumberedNumbering(format) && AscWord.IsNumberedNumbering(numFormat)));
};
CNumbering.prototype.Draw = function(sNumId, nLvl, nX, nY, oContext, oNumInfo, oTextPr, oTheme)
CNumbering.prototype.Draw = function(sNumId, nLvl, nX, nY, oContext, oNumInfo, oTextPr, oTheme, isRtl)
{
var oNum = this.GetNum(sNumId);
return oNum.Draw(nX, nY, oContext, nLvl, oNumInfo, oTextPr, oTheme);
return oNum.Draw(nX, nY, oContext, nLvl, oNumInfo, oTextPr, oTheme, isRtl);
};
CNumbering.prototype.Measure = function(sNumId, nLvl, oContext, oNumInfo, oTextPr, oTheme)
{

View File

@ -2459,7 +2459,8 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
//----------------------------------------------------------------------------------------------------------
// Заливка параграфа
//----------------------------------------------------------------------------------------------------------
var oShdColor = Pr.ParaPr.Shd.IsNil() ? null : Pr.ParaPr.Shd.GetSimpleColor(this.GetTheme(), this.GetColorMap());
let paraPr = Pr.ParaPr;
var oShdColor = paraPr.Shd.IsNil() ? null : paraPr.Shd.GetSimpleColor(this.GetTheme(), this.GetColorMap());
if ((_Range.W > 0.001 || true === this.IsEmpty() || true !== this.IsEmptyRange(CurLine, CurRange))
&& ((this.Pages.length - 1 === CurPage) || (CurLine < this.Pages[CurPage + 1].FirstLine))
&& oShdColor
@ -2467,12 +2468,6 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
{
pGraphics.Start_Command(AscFormat.DRAW_COMMAND_LINE, this.Lines[CurLine], CurLine, 4)
var TempX0 = this.Lines[CurLine].Ranges[CurRange].X;
if (0 === CurRange)
TempX0 = Math.min(TempX0, this.Pages[CurPage].X + Pr.ParaPr.Ind.Left, this.Pages[CurPage].X + Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine);
var TempX1 = this.Lines[CurLine].Ranges[CurRange].XEnd;
var TempTop = this.Lines[CurLine].Top;
var TempBottom = this.Lines[CurLine].Bottom;
@ -2482,29 +2477,36 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
// на странице, предыдущий параграф тоже имеет не пустой фон и у текущего и предыдущего
// параграфов совпадают правая и левая границы фонов.
var PrevEl = this.Get_DocumentPrev();
var PrevPr = null;
let prevEl = this.Get_DocumentPrev();
let prevPr = null;
var PrevLeft = 0;
var PrevRight = 0;
var CurLeft = Math.min(Pr.ParaPr.Ind.Left, Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine);
var CurRight = Pr.ParaPr.Ind.Right;
if (null != PrevEl && type_Paragraph === PrevEl.GetType())
let prevLeft = 0;
let prevRight = 0;
let curLeft = paraPr.Bidi ? paraPr.Ind.Right : Math.min(paraPr.Ind.Left, paraPr.Ind.Left + paraPr.Ind.FirstLine);
let curRight = paraPr.Bidi ? Math.min(paraPr.Ind.Left, paraPr.Ind.Left + paraPr.Ind.FirstLine) : paraPr.Ind.Right;
if (prevEl && prevEl.IsParagraph())
{
PrevPr = PrevEl.Get_CompiledPr2();
PrevLeft = Math.min(PrevPr.ParaPr.Ind.Left, PrevPr.ParaPr.Ind.Left + PrevPr.ParaPr.Ind.FirstLine);
PrevRight = PrevPr.ParaPr.Ind.Right;
prevPr = prevEl.Get_CompiledPr2().ParaPr;
prevLeft = prevPr.Bidi ? prevPr.Ind.Right : Math.min(prevPr.Ind.Left, prevPr.Ind.Left + prevPr.Ind.FirstLine);
prevRight = prevPr.Bidi ? Math.min(prevPr.Ind.Left, prevPr.Ind.Left + prevPr.Ind.FirstLine) : prevPr.Ind.Right;
}
// Если данный параграф находится в группе параграфов с одинаковыми границами(с хотябы одной
// непустой), и он не первый, тогда закрашиваем вместе с расстоянием до параграфа
if (true === Pr.ParaPr.Brd.First)
if (true === paraPr.Brd.First)
{
// Если следующий элемент таблица, тогда PrevPr = null
if (null === PrevEl || true === this.IsStartFromNewPage() || null === PrevPr || Asc.c_oAscShdNil === PrevPr.ParaPr.Shd.Value || PrevLeft != CurLeft || CurRight != PrevRight || false === this.Internal_Is_NullBorders(PrevPr.ParaPr.Brd) || false === this.Internal_Is_NullBorders(Pr.ParaPr.Brd))
// Если следующий элемент таблица, тогда prevPr = null
if (!prevEl
|| this.IsStartFromNewPage()
|| !prevPr
|| Asc.c_oAscShdNil === prevPr.Shd.Value
|| Math.abs(prevLeft - curLeft) > AscWord.EPSILON
|| Math.abs(curRight - prevRight) > AscWord.EPSILON
|| false === this.Internal_Is_NullBorders(prevPr.Brd)
|| false === this.Internal_Is_NullBorders(paraPr.Brd))
{
if (false === this.IsStartFromNewPage() || null === PrevEl)
TempTop += Pr.ParaPr.Spacing.Before;
if (false === this.IsStartFromNewPage() || !prevEl)
TempTop += paraPr.Spacing.Before;
}
}
}
@ -2515,50 +2517,67 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
// на странице, следующий параграф тоже имеет не пустой фон и у текущего и следующего
// параграфов совпадают правая и левая границы фонов.
var NextEl = this.Get_DocumentNext();
var NextPr = null;
let nextEl = this.Get_DocumentNext();
let nextPr = null;
var NextLeft = 0;
var NextRight = 0;
var CurLeft = Math.min(Pr.ParaPr.Ind.Left, Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine);
var CurRight = Pr.ParaPr.Ind.Right;
if (null != NextEl && type_Paragraph === NextEl.GetType())
let nextLeft = 0;
let nextRight = 0;
let curLeft = paraPr.Bidi ? paraPr.Ind.Right : Math.min(paraPr.Ind.Left, paraPr.Ind.Left + paraPr.Ind.FirstLine);
let curRight = paraPr.Bidi ? Math.min(paraPr.Ind.Left, paraPr.Ind.Left + paraPr.Ind.FirstLine) : paraPr.Ind.Right;
if (nextEl && nextEl.IsParagraph())
{
NextPr = NextEl.Get_CompiledPr2();
NextLeft = Math.min(NextPr.ParaPr.Ind.Left, NextPr.ParaPr.Ind.Left + NextPr.ParaPr.Ind.FirstLine);
NextRight = NextPr.ParaPr.Ind.Right;
nextPr = nextEl.Get_CompiledPr2().ParaPr;
nextLeft = nextPr.Bidi ? nextPr.Ind.Right : Math.min(nextPr.Ind.Left, nextPr.Ind.Left + nextPr.Ind.FirstLine);
nextRight = nextPr.Bidi ? Math.min(nextPr.Ind.Left, nextPr.Ind.Left + nextPr.Ind.FirstLine) : nextPr.Ind.Right;
}
if (null != NextEl && type_Paragraph === NextEl.GetType() && true === NextEl.IsStartFromNewPage())
if (nextEl && nextEl.IsParagraph() && nextEl.IsStartFromNewPage())
{
TempBottom = this.Lines[CurLine].Y + this.Lines[CurLine].Metrics.Descent + this.Lines[CurLine].Metrics.LineGap;
}
// Если данный параграф находится в группе параграфов с одинаковыми границами(с хотябы одной
// непустой), и он не последний, тогда закрашиваем вместе с расстоянием после параграфа
else if (true === Pr.ParaPr.Brd.Last)
else if (true === paraPr.Brd.Last)
{
// Если следующий элемент таблица, тогда NextPr = null
if (null === NextEl || true === NextEl.IsStartFromNewPage() || null === NextPr || Asc.c_oAscShdNil === NextPr.ParaPr.Shd.Value || NextLeft != CurLeft || CurRight != NextRight || false === this.Internal_Is_NullBorders(NextPr.ParaPr.Brd) || false === this.Internal_Is_NullBorders(Pr.ParaPr.Brd))
TempBottom -= Pr.ParaPr.Spacing.After;
// Если следующий элемент таблица, тогда nextPr = null
if (!nextEl
|| nextEl.IsStartFromNewPage()
|| !nextPr
|| Asc.c_oAscShdNil === nextPr.Shd.Value
|| Math.abs(nextLeft - curLeft) > AscWord.EPSILON
|| Math.abs(curRight - nextRight) > AscWord.EPSILON
|| false === this.Internal_Is_NullBorders(nextPr.Brd)
|| false === this.Internal_Is_NullBorders(paraPr.Brd))
TempBottom -= paraPr.Spacing.After;
}
}
if (0 === CurRange)
let isRtl = Pr.ParaPr.Bidi;
let x0 = this.Lines[CurLine].Ranges[CurRange].X;
let x1 = this.Lines[CurLine].Ranges[CurRange].getXEndOrigin();;
let rangeCount = this.Lines[CurLine].Ranges.length;
if ((0 === CurRange && isRtl) || (rangeCount - 1 === CurRange && !isRtl))
{
if (Pr.ParaPr.Brd.Left.Value === border_Single)
TempX0 -= 0.5 + Pr.ParaPr.Brd.Left.Size + Pr.ParaPr.Brd.Left.Space;
else
TempX0 -= 0.5;
}
if (this.Lines[CurLine].Ranges.length - 1 === CurRange)
{
TempX1 = this.Pages[CurPage].XLimit - Pr.ParaPr.Ind.Right;
let x_right = this.Pages[CurPage].XLimit - (isRtl ? Math.min(Pr.ParaPr.Ind.Left, Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine) : Pr.ParaPr.Ind.Right);
x1 = Math.max(x1, x_right);
if (Pr.ParaPr.Brd.Right.Value === border_Single)
TempX1 += 0.5 + Pr.ParaPr.Brd.Right.Size + Pr.ParaPr.Brd.Right.Space;
x1 += 0.5 + Pr.ParaPr.Brd.Right.Size + Pr.ParaPr.Brd.Right.Space;
else
TempX1 += 0.5;
x1 += 0.5;
}
if ((0 === CurRange && !isRtl) || (rangeCount - 1 === CurRange && isRtl))
{
let x_left = this.Pages[CurPage].X + (isRtl ? Pr.ParaPr.Ind.Right : Math.min(Pr.ParaPr.Ind.Left, Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine));
x0 = Math.min(x0, x_left);
if (Pr.ParaPr.Brd.Left.Value === border_Single)
x0 -= 0.5 + Pr.ParaPr.Brd.Left.Size + Pr.ParaPr.Brd.Left.Space;
else
x0 -= 0.5;
}
pGraphics.b_color1(oShdColor.r, oShdColor.g, oShdColor.b, 255);
@ -2566,7 +2585,7 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
if (pGraphics.SetShd)
pGraphics.SetShd(Pr.ParaPr.Shd);
pGraphics.rect(TempX0, this.Pages[CurPage].Y + TempTop, TempX1 - TempX0, TempBottom - TempTop);
pGraphics.rect(x0, this.Pages[CurPage].Y + TempTop, x1 - x0, TempBottom - TempTop);
pGraphics.df();
pGraphics.End_Command();
@ -2944,16 +2963,25 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
//----------------------------------------------------------------------------------------------------------
if (true === bDrawBorders && ( ( this.Pages.length - 1 === CurPage ) || ( CurLine < this.Pages[CurPage + 1].FirstLine ) ))
{
var TempX0 = Math.min(this.Lines[CurLine].Ranges[0].X, this.Pages[CurPage].X + Pr.ParaPr.Ind.Left, this.Pages[CurPage].X + Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine);
var TempX1 = this.Pages[CurPage].XLimit - Pr.ParaPr.Ind.Right;//this.Lines[CurLine].Ranges[this.Lines[CurLine].Ranges.length - 1].XEnd;
if (true === this.Is_LineDropCap())
let x0 = this.Lines[CurLine].Ranges[0].X;
let x1 = this.Lines[CurLine].Ranges[this.Lines[CurLine].Ranges.length - 1].getXEndOrigin();
if (Pr.ParaPr.Bidi)
{
TempX1 = TempX0 + this.Get_LineDropCapWidth();
x0 = Math.min(x0, this.Pages[CurPage].X + Pr.ParaPr.Ind.Right);
x1 = Math.max(x1, this.Pages[CurPage].XLimit - Pr.ParaPr.Ind.Left, this.Pages[CurPage].XLimit - Pr.ParaPr.Ind.Left - Pr.ParaPr.Ind.FirstLine);
}
else
{
x0 = Math.min(x0, this.Pages[CurPage].X + Pr.ParaPr.Ind.Left, this.Pages[CurPage].X + Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine);
x1 = Math.max(x1, this.Pages[CurPage].XLimit - Pr.ParaPr.Ind.Right);
}
var TempTop = this.Lines[CurLine].Top;
var TempBottom = this.Lines[CurLine].Bottom;
if (this.Is_LineDropCap())
x1 = x0 + this.Get_LineDropCapWidth();
let TempTop = this.Lines[CurLine].Top;
let TempBottom = this.Lines[CurLine].Bottom;
if (0 === CurLine)
{
@ -2967,7 +2995,7 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
if (this.Lines.length - 1 === CurLine)
{
var NextEl = this.GetNextDocumentElement();
let NextEl = this.GetNextDocumentElement();
while (NextEl && NextEl.IsBlockLevelSdt())
{
NextEl = NextEl.GetElement(0);
@ -2982,24 +3010,18 @@ Paragraph.prototype.drawRunHighlight = function(CurPage, pGraphics, Pr, drawStat
if (Pr.ParaPr.Brd.Right.Value === border_Single)
{
var RGBA = Pr.ParaPr.Brd.Right.Get_Color(this);
let RGBA = Pr.ParaPr.Brd.Right.Get_Color(this);
pGraphics.p_color(RGBA.r, RGBA.g, RGBA.b, 255);
if (pGraphics.SetBorder)
{
pGraphics.SetBorder(Pr.ParaPr.Brd.Right);
}
pGraphics.drawVerLine(c_oAscLineDrawingRule.Right, TempX1 + 0.5 + Pr.ParaPr.Brd.Right.Size + Pr.ParaPr.Brd.Right.Space, this.Pages[CurPage].Y + TempTop, this.Pages[CurPage].Y + TempBottom, Pr.ParaPr.Brd.Right.Size);
pGraphics.SetBorder(Pr.ParaPr.Brd.Right);
pGraphics.drawVerLine(c_oAscLineDrawingRule.Right, x1 + 0.5 + Pr.ParaPr.Brd.Right.Size + Pr.ParaPr.Brd.Right.Space, this.Pages[CurPage].Y + TempTop, this.Pages[CurPage].Y + TempBottom, Pr.ParaPr.Brd.Right.Size);
}
if (Pr.ParaPr.Brd.Left.Value === border_Single)
{
var RGBA = Pr.ParaPr.Brd.Left.Get_Color(this);
let RGBA = Pr.ParaPr.Brd.Left.Get_Color(this);
pGraphics.p_color(RGBA.r, RGBA.g, RGBA.b, 255);
if (pGraphics.SetBorder)
{
pGraphics.SetBorder(Pr.ParaPr.Brd.Left);
}
pGraphics.drawVerLine(c_oAscLineDrawingRule.Left, TempX0 - 0.5 - Pr.ParaPr.Brd.Left.Size - Pr.ParaPr.Brd.Left.Space, this.Pages[CurPage].Y + TempTop, this.Pages[CurPage].Y + TempBottom, Pr.ParaPr.Brd.Left.Size);
pGraphics.SetBorder(Pr.ParaPr.Brd.Left);
pGraphics.drawVerLine(c_oAscLineDrawingRule.Left, x0 - 0.5 - Pr.ParaPr.Brd.Left.Size - Pr.ParaPr.Brd.Left.Space, this.Pages[CurPage].Y + TempTop, this.Pages[CurPage].Y + TempBottom, Pr.ParaPr.Brd.Left.Size);
}
}
@ -3013,7 +3035,6 @@ Paragraph.prototype.drawRunContentElements = function(CurPage, pGraphics, drawSt
var StartLine = this.Pages[CurPage].StartLine;
var EndLine = this.Pages[CurPage].EndLine;
let BgColor = drawState.getBgColor();
let Theme = drawState.getTheme();
let ColorMap = drawState.getColorMap();
let Pr = drawState.getParagraphCompiledPr();
@ -3048,262 +3069,11 @@ Paragraph.prototype.drawRunContentElements = function(CurPage, pGraphics, drawSt
var StartPos = Range.StartPos;
var EndPos = Range.EndPos;
// Отрисовка нумерации
if (true === this.Numbering.checkRange(CurRange, CurLine))
{
var nReviewType = this.GetReviewType();
var oReviewColor = this.GetReviewColor();
var NumberingItem = this.Numbering;
if (para_Numbering === NumberingItem.Type)
{
var isHavePrChange = this.HavePrChange();
var oPrevNumPr = this.GetPrChangeNumPr();
var NumPr = Pr.ParaPr.NumPr;
var isHaveNumbering = false;
if ((undefined === this.Get_SectionPr()
|| true !== this.IsEmpty())
&& (!this.Parent || !this.Parent.IsEmptyParagraphAfterTableInTableCell(this.GetIndex()))
&& ((NumPr
&& undefined !== NumPr.NumId
&& 0 !== NumPr.NumId
&& "0" !== NumPr.NumId)
|| (oPrevNumPr
&& undefined !== oPrevNumPr.NumId
&& undefined !== oPrevNumPr.Lvl
&& 0 !== oPrevNumPr.NumId
&& "0" !== oPrevNumPr.NumId)))
{
isHaveNumbering = true;
}
if (!isHaveNumbering || (!NumPr && !oPrevNumPr))
{
// Ничего не делаем
}
else
{
var oNumbering = this.Parent.GetNumbering();
var oNumLvl = null;
if (NumPr)
oNumLvl = oNumbering.GetNum(NumPr.NumId).GetLvl(NumPr.Lvl);
else if (oPrevNumPr)
oNumLvl = oNumbering.GetNum(oPrevNumPr.NumId).GetLvl(oPrevNumPr.Lvl);
var nNumSuff = oNumLvl.GetSuff();
var nNumJc = oNumLvl.GetJc();
var oNumTextPr = this.GetNumberingTextPr();
var oPrevNumTextPr = oPrevNumPr ? this.Get_CompiledPr2(false).TextPr.Copy() : null;
if (oPrevNumTextPr && (oPrevNumPr
&& undefined !== oPrevNumPr.NumId
&& undefined !== oPrevNumPr.Lvl
&& 0 !== oPrevNumPr.NumId
&& "0" !== oPrevNumPr.NumId))
{
var oPrevNumLvl = oNumbering.GetNum(oPrevNumPr.NumId).GetLvl(oPrevNumPr.Lvl);
oPrevNumTextPr.Merge(this.TextPr.Value.Copy());
oPrevNumTextPr.Merge(oPrevNumLvl.GetTextPr());
}
var X_start = X;
if (align_Right === nNumJc)
X_start = X - NumberingItem.WidthNum;
else if (align_Center === nNumJc)
X_start = X - NumberingItem.WidthNum / 2;
var AutoColor = ( undefined != BgColor && false === BgColor.Check_BlackAutoColor() ? new CDocumentColor(255, 255, 255, false) : new CDocumentColor(0, 0, 0, false) );
var RGBA;
if (oNumTextPr.Unifill)
{
oNumTextPr.Unifill.check(PDSE.Theme, PDSE.ColorMap);
RGBA = oNumTextPr.Unifill.getRGBAColor();
pGraphics.b_color1(RGBA.R, RGBA.G, RGBA.B, 255);
}
else
{
if (true === oNumTextPr.Color.Auto)
{
if(oNumTextPr.FontRef && oNumTextPr.FontRef.Color)
{
oNumTextPr.FontRef.Color.check(Theme, ColorMap);
RGBA = oNumTextPr.FontRef.Color.RGBA;
pGraphics.b_color1(RGBA.R, RGBA.G, RGBA.B, 255);
}
else
{
pGraphics.b_color1(AutoColor.r, AutoColor.g, AutoColor.b, 255);
}
}
else
{
pGraphics.b_color1(oNumTextPr.Color.r, oNumTextPr.Color.g, oNumTextPr.Color.b, 255);
}
}
if (NumberingItem.HaveSourceNumbering() || reviewtype_Common !== nReviewType)
{
if (reviewtype_Common === nReviewType)
pGraphics.b_color1(REVIEW_NUMBERING_COLOR.r, REVIEW_NUMBERING_COLOR.g, REVIEW_NUMBERING_COLOR.b, 255);
else
pGraphics.b_color1(oReviewColor.r, oReviewColor.g, oReviewColor.b, 255);
}
else if (isHavePrChange && NumPr && !oPrevNumPr)
{
var oPrReviewColor = this.GetPrReviewColor();
pGraphics.b_color1(oPrReviewColor.r, oPrReviewColor.g, oPrReviewColor.b, 255);
}
var TempY = Y;
switch (oNumTextPr.VertAlign)
{
case AscCommon.vertalign_SubScript:
{
Y -= AscCommon.vaKSub * oNumTextPr.FontSize * g_dKoef_pt_to_mm;
break;
}
case AscCommon.vertalign_SuperScript:
{
Y -= AscCommon.vaKSuper * oNumTextPr.FontSize * g_dKoef_pt_to_mm;
break;
}
}
// Рисуется только сам символ нумерации
switch (nNumJc)
{
case align_Right:
NumberingItem.Draw(X - NumberingItem.WidthNum, Y, pGraphics, oNumbering, oNumTextPr, PDSE.Theme, oPrevNumTextPr);
break;
case align_Center:
NumberingItem.Draw(X - NumberingItem.WidthNum / 2, Y, pGraphics, oNumbering, oNumTextPr, PDSE.Theme, oPrevNumTextPr);
break;
case align_Left:
default:
NumberingItem.Draw(X, Y, pGraphics, oNumbering, oNumTextPr, PDSE.Theme, oPrevNumTextPr);
break;
}
if (true === oNumTextPr.Strikeout || true === oNumTextPr.Underline)
{
if (oNumTextPr.Unifill)
{
pGraphics.p_color(RGBA.R, RGBA.G, RGBA.B, 255);
}
else
{
if (true === oNumTextPr.Color.Auto)
pGraphics.p_color(AutoColor.r, AutoColor.g, AutoColor.b, 255);
else
pGraphics.p_color(oNumTextPr.Color.r, oNumTextPr.Color.g, oNumTextPr.Color.b, 255);
}
}
if (NumberingItem.HaveSourceNumbering() || reviewtype_Common !== nReviewType)
{
var nSourceWidth = NumberingItem.GetSourceWidth();
if (reviewtype_Common === nReviewType)
pGraphics.p_color(REVIEW_NUMBERING_COLOR.r, REVIEW_NUMBERING_COLOR.g, REVIEW_NUMBERING_COLOR.b, 255);
else
pGraphics.p_color(oReviewColor.r, oReviewColor.g, oReviewColor.b, 255);
// Либо у нас есть удаленная часть, либо у нас одновременно добавлен и удален параграф, тогда мы зачеркиваем суффикс
if (NumberingItem.HaveSourceNumbering() || (!NumberingItem.HaveSourceNumbering() && !NumberingItem.HaveFinalNumbering()))
{
if (NumberingItem.HaveFinalNumbering())
pGraphics.drawHorLine(0, (Y - oNumTextPr.FontSize * g_dKoef_pt_to_mm * 0.27), X_start, X_start + nSourceWidth, (oNumTextPr.FontSize / 18) * g_dKoef_pt_to_mm);
else
pGraphics.drawHorLine(0, (Y - oNumTextPr.FontSize * g_dKoef_pt_to_mm * 0.27), X_start, X_start + nSourceWidth + NumberingItem.WidthSuff, (oNumTextPr.FontSize / 18) * g_dKoef_pt_to_mm);
}
if (NumberingItem.HaveFinalNumbering())
pGraphics.drawHorLine(0, (Y + this.Lines[CurLine].Metrics.TextDescent * 0.4), X_start + nSourceWidth, X_start + NumberingItem.WidthNum + NumberingItem.WidthSuff, (oNumTextPr.FontSize / 18) * g_dKoef_pt_to_mm);
}
else if (isHavePrChange && NumPr && !oPrevNumPr)
{
var oPrReviewColor = this.GetPrReviewColor();
pGraphics.p_color(oPrReviewColor.r, oPrReviewColor.g, oPrReviewColor.b, 255);
pGraphics.drawHorLine(0, (Y + this.Lines[CurLine].Metrics.TextDescent * 0.4), X_start, X_start + NumberingItem.WidthNum + NumberingItem.WidthSuff, (oNumTextPr.FontSize / 18) * g_dKoef_pt_to_mm);
}
else
{
if (true === oNumTextPr.Strikeout)
pGraphics.drawHorLine(0, (Y - oNumTextPr.FontSize * g_dKoef_pt_to_mm * 0.27), X_start, X_start + NumberingItem.WidthNum, (oNumTextPr.FontSize / 18) * g_dKoef_pt_to_mm);
if (true === oNumTextPr.Underline)
pGraphics.drawHorLine(0, (Y + this.Lines[CurLine].Metrics.TextDescent * 0.4), X_start, X_start + NumberingItem.WidthNum, (oNumTextPr.FontSize / 18) * g_dKoef_pt_to_mm);
}
Y = TempY;
if (true === editor.ShowParaMarks && (Asc.c_oAscNumberingSuff.Tab === nNumSuff || oNumLvl.IsLegacy()))
{
var TempWidth = NumberingItem.WidthSuff;
var TempRealWidth = 3.143; // ширина символа "стрелка влево" в шрифте Wingding3,10
var X1 = X;
switch (nNumJc)
{
case align_Right:
break;
case align_Center:
X1 += NumberingItem.WidthNum / 2;
break;
case align_Left:
default:
X1 += NumberingItem.WidthNum;
break;
}
var X0 = TempWidth / 2 - TempRealWidth / 2;
pGraphics.SetFont({
FontFamily : {Name : "ASCW3", Index : -1},
FontSize : 10,
Italic : false,
Bold : false
});
if (X0 > 0)
pGraphics.FillText2(X1 + X0, Y, String.fromCharCode(tab_Symbol), 0, TempWidth);
else
pGraphics.FillText2(X1, Y, String.fromCharCode(tab_Symbol), TempRealWidth - TempWidth, TempWidth);
}
}
}
else if (para_PresentationNumbering === this.Numbering.Type)
{
var bIsEmpty = this.IsEmpty();
if (!bIsEmpty ||
this.IsThisElementCurrent() ||
this.Parent.IsSelectionUse() && this.Parent.IsSelectionEmpty() && this.Parent.Selection.StartPos === this.Index)
{
if (Pr.ParaPr.Ind.FirstLine < 0)
NumberingItem.Draw(X, Y, pGraphics, PDSE);
else
NumberingItem.Draw(this.Pages[CurPage].X + Pr.ParaPr.Ind.Left, Y, pGraphics, PDSE);
}
}
PDSE.X += NumberingItem.WidthVisible;
}
for (var Pos = StartPos; Pos <= EndPos; Pos++)
{
var Item = this.Content[Pos];
PDSE.CurPos.Update(Pos, 0);
Item.Draw_Elements(PDSE);
}
@ -3364,7 +3134,7 @@ Paragraph.prototype.drawRunContentLines = function(CurPage, pGraphics, drawState
var EndPos = Range.EndPos;
// TODO: Нумерация подчеркивается и зачеркивается в Draw_Elements, неплохо бы сюда перенести
if (true === this.Numbering.checkRange(CurRange, CurLine))
if (this.Numbering.checkRange(CurRange, CurLine) && !this.isRtlDirection())
PDSL.X += this.Numbering.WidthVisible;
for (var Pos = StartPos; Pos <= EndPos; Pos++)
@ -3635,32 +3405,78 @@ Paragraph.prototype.drawPolygons = function(graphics, areas, colors, lineWidth,
graphics.drawPolygonByRects(areas[i], lineWidth, shift);
}
};
Paragraph.prototype.drawHorizontalBorder = function(graphics, curLine, border, lineAlign, y, isEmptyPara, X_left, X_right, leftMW, rightMW)
{
let isRtl = this.isRtlDirection();
let RGBA = border.Get_Color(this);
graphics.p_color(RGBA.r, RGBA.g, RGBA.b, 255);
graphics.SetBorder(border);
graphics.Start_Command(AscFormat.DRAW_COMMAND_LINE, this.Lines[curLine], curLine, 1);
for (let curRange = 0, rangeCount = this.Lines[curLine].Ranges.length; curRange < rangeCount; ++curRange)
{
let lMW = 0;
let rMW = 0;
let x0 = this.Lines[curLine].Ranges[curRange].X;
let x1 = this.Lines[curLine].Ranges[curRange].XEnd;
if ((0 === curRange && isRtl) || (rangeCount - 1 === curRange && !isRtl))
{
x1 = X_right;
rMW = rightMW;
}
if ((0 === curRange && !isRtl) || (rangeCount - 1 === curRange && isRtl))
{
x0 = X_left;
lMW = leftMW;
}
if (!this.IsEmptyRange(curLine, curRange) || (isEmptyPara && 1 === rangeCount))
graphics.drawHorLineExt(lineAlign, y, x0, x1, border.Size, lMW, rMW);
}
graphics.End_Command();
}
Paragraph.prototype.Internal_Draw_6 = function(CurPage, pGraphics, Pr)
{
if (true !== this.Is_NeedDrawBorders())
return;
let paraPr = Pr.ParaPr;
let leftInd = paraPr.Ind.Left;
let rightInd = paraPr.Ind.Right;
let firstInd = paraPr.Ind.FirstLine;
var bEmpty = this.IsEmpty();
var X_left = Math.min(this.Pages[CurPage].X + Pr.ParaPr.Ind.Left, this.Pages[CurPage].X + Pr.ParaPr.Ind.Left + Pr.ParaPr.Ind.FirstLine);
var X_right = this.Pages[CurPage].XLimit - Pr.ParaPr.Ind.Right;
let X_left = this.Pages[CurPage].X + Math.min(leftInd, leftInd + firstInd);
let X_right = this.Pages[CurPage].XLimit - rightInd;
let isRtl = this.isRtlDirection();
if (isRtl)
{
X_left = this.Pages[CurPage].X + rightInd;
X_right = this.Pages[CurPage].XLimit - Math.min(leftInd, leftInd + firstInd);
}
if (true === this.Is_LineDropCap())
X_right = X_left + this.Get_LineDropCapWidth();
if (Pr.ParaPr.Brd.Left.Value === border_Single)
X_left -= 0.5 + Pr.ParaPr.Brd.Left.Space;
if (paraPr.Brd.Left.Value === border_Single)
X_left -= 0.5 + paraPr.Brd.Left.Space;
else
X_left -= 0.5;
if (Pr.ParaPr.Brd.Right.Value === border_Single)
X_right += 0.5 + Pr.ParaPr.Brd.Right.Space;
if (paraPr.Brd.Right.Value === border_Single)
X_right += 0.5 + paraPr.Brd.Right.Space;
else
X_right += 0.5;
var LeftMW = -( border_Single === Pr.ParaPr.Brd.Left.Value ? Pr.ParaPr.Brd.Left.Size : 0 );
var RightMW = ( border_Single === Pr.ParaPr.Brd.Right.Value ? Pr.ParaPr.Brd.Right.Size : 0 );
var RGBA;
let leftMW = -( border_Single === paraPr.Brd.Left.Value ? paraPr.Brd.Left.Size : 0 );
let rightMW = ( border_Single === paraPr.Brd.Right.Value ? paraPr.Brd.Right.Size : 0 );
var bEmptyPagesWithBreakBefore = false;
var bCurEmptyPageWithBreak = false;
@ -3692,14 +3508,14 @@ Paragraph.prototype.Internal_Draw_6 = function(CurPage, pGraphics, Pr)
bEmptyPageCurrent = this.IsEmptyPage(CurPage);
var bDrawTop = false;
if (border_Single === Pr.ParaPr.Brd.Top.Value
&& ((true === Pr.ParaPr.Brd.First
if (border_Single === paraPr.Brd.Top.Value
&& ((true === paraPr.Brd.First
&& false === bCurEmptyPageWithBreak
&& ((true === bEmptyPagesBefore
&& true !== bEmptyPageCurrent)
|| (true === bEmptyPagesWithBreakBefore
&& false === bCurEmptyPageWithBreak)))
|| (false === Pr.ParaPr.Brd.First
|| (false === paraPr.Brd.First
&& true === bEmptyPagesWithBreakBefore
&& false === bCurEmptyPageWithBreak)))
{
@ -3707,74 +3523,31 @@ Paragraph.prototype.Internal_Draw_6 = function(CurPage, pGraphics, Pr)
}
var bDrawBetween = false;
if (border_Single === Pr.ParaPr.Brd.Between.Value
if (border_Single === paraPr.Brd.Between.Value
&& false === bDrawTop
&& false === bEmptyPageCurrent
&& true === bEmptyPagesBefore
&& false === Pr.ParaPr.Brd.First)
&& false === paraPr.Brd.First)
{
bDrawBetween = true;
}
if (bDrawTop)
{
var Y_top = this.Pages[CurPage].Y;
let y = this.Pages[CurPage].Y;
if (this.private_CheckNeedBeforeSpacing(CurPage, this.Parent, this.GetAbsolutePage(CurPage), Pr.ParaPr))
Y_top += Pr.ParaPr.Spacing.Before;
RGBA = Pr.ParaPr.Brd.Top.Get_Color(this);
pGraphics.p_color(RGBA.r, RGBA.g, RGBA.b, 255);
if (pGraphics.SetBorder)
{
pGraphics.SetBorder(Pr.ParaPr.Brd.Top);
}
// Учтем разрывы из-за обтекания
var StartLine = this.Pages[CurPage].StartLine;
pGraphics.Start_Command(AscFormat.DRAW_COMMAND_LINE, this.Lines[StartLine], StartLine, 1);
var RangesCount = this.Lines[StartLine].Ranges.length;
for (var CurRange = 0; CurRange < RangesCount; CurRange++)
{
var X0 = ( 0 === CurRange ? X_left : this.Lines[StartLine].Ranges[CurRange].X );
var X1 = ( RangesCount - 1 === CurRange ? X_right : this.Lines[StartLine].Ranges[CurRange].XEnd );
if (false === this.IsEmptyRange(StartLine, CurRange) || ( true === bEmpty && 1 === RangesCount ))
pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top, Y_top, X0, X1, Pr.ParaPr.Brd.Top.Size, LeftMW, RightMW);
}
pGraphics.End_Command();
if (this.private_CheckNeedBeforeSpacing(CurPage, this.Parent, this.GetAbsolutePage(CurPage), paraPr))
y += paraPr.Spacing.Before;
let startLine = this.Pages[CurPage].StartLine;
this.drawHorizontalBorder(pGraphics, startLine, paraPr.Brd.Top, c_oAscLineDrawingRule.Top, y, bEmpty, X_left, X_right, leftMW, rightMW);
}
if (true === bDrawBetween)
if (bDrawBetween)
{
RGBA = Pr.ParaPr.Brd.Between.Get_Color(this);
pGraphics.p_color(RGBA.r, RGBA.g, RGBA.b, 255);
if (pGraphics.SetBorder)
{
pGraphics.SetBorder(Pr.ParaPr.Brd.Between);
}
var Size = Pr.ParaPr.Brd.Between.Size;
var Y = this.Pages[CurPage].Y + Pr.ParaPr.Spacing.Before;
// Учтем разрывы из-за обтекания
var StartLine = this.Pages[CurPage].StartLine;
var RangesCount = this.Lines[StartLine].Ranges.length;
pGraphics.Start_Command(AscFormat.DRAW_COMMAND_LINE, this.Lines[StartLine], StartLine, 1);
for (var CurRange = 0; CurRange < RangesCount; CurRange++)
{
var X0 = ( 0 === CurRange ? X_left : this.Lines[StartLine].Ranges[CurRange].X );
var X1 = ( RangesCount - 1 === CurRange ? X_right : this.Lines[StartLine].Ranges[CurRange].XEnd );
if (false === this.IsEmptyRange(StartLine, CurRange) || ( true === bEmpty && 1 === RangesCount ))
pGraphics.drawHorLineExt(c_oAscLineDrawingRule.Top, Y, X0, X1, Size, LeftMW, RightMW);
}
pGraphics.End_Command();
let y = this.Pages[CurPage].Y + paraPr.Spacing.Before;
let startLine = this.Pages[CurPage].StartLine;
this.drawHorizontalBorder(pGraphics, startLine, paraPr.Brd.Between, c_oAscLineDrawingRule.Top, y, bEmpty, X_left, X_right, leftMW, rightMW);
}
var CurLine = this.Pages[CurPage].EndLine;
@ -3787,9 +3560,9 @@ Paragraph.prototype.Internal_Draw_6 = function(CurPage, pGraphics, Pr)
NextEl = NextEl.GetElement(0);
}
if (border_Single === Pr.ParaPr.Brd.Bottom.Value
if (border_Single === paraPr.Brd.Bottom.Value
&& true === bEnd
&& (true === Pr.ParaPr.Brd.Last
&& (true === paraPr.Brd.Last
|| !NextEl
|| !NextEl.IsParagraph()
|| NextEl.private_IsEmptyPageWithBreak(0)))
@ -3797,42 +3570,22 @@ Paragraph.prototype.Internal_Draw_6 = function(CurPage, pGraphics, Pr)
bDrawBottom = true;
}
if (true === bDrawBottom)
if (bDrawBottom)
{
var TempY, DrawLineRule;
let y, lineAlign;
if (NextEl && NextEl.IsParagraph() && NextEl.IsStartFromNewPage())
{
TempY = this.Pages[CurPage].Y + this.Lines[CurLine].Y + this.Lines[CurLine].Metrics.Descent + this.Lines[CurLine].Metrics.LineGap;
DrawLineRule = c_oAscLineDrawingRule.Top;
y = this.Pages[CurPage].Y + this.Lines[CurLine].Y + this.Lines[CurLine].Metrics.Descent + this.Lines[CurLine].Metrics.LineGap;
lineAlign = c_oAscLineDrawingRule.Top;
}
else
{
TempY = this.Pages[CurPage].Y + this.Lines[CurLine].Bottom - Pr.ParaPr.Spacing.After;
DrawLineRule = c_oAscLineDrawingRule.Bottom;
y = this.Pages[CurPage].Y + this.Lines[CurLine].Bottom - paraPr.Spacing.After;
lineAlign = c_oAscLineDrawingRule.Bottom;
}
RGBA = Pr.ParaPr.Brd.Bottom.Get_Color(this);
pGraphics.p_color(RGBA.r, RGBA.g, RGBA.b, 255);
if (pGraphics.SetBorder)
{
pGraphics.SetBorder(Pr.ParaPr.Brd.Bottom);
}
// Учтем разрывы из-за обтекания
var EndLine = this.Pages[CurPage].EndLine;
var RangesCount = this.Lines[EndLine].Ranges.length;
pGraphics.Start_Command(AscFormat.DRAW_COMMAND_LINE, this.Lines[EndLine], EndLine, 1);
for (var CurRange = 0; CurRange < RangesCount; CurRange++)
{
var X0 = ( 0 === CurRange ? X_left : this.Lines[EndLine].Ranges[CurRange].X );
var X1 = ( RangesCount - 1 === CurRange ? X_right : this.Lines[EndLine].Ranges[CurRange].XEnd );
if (false === this.IsEmptyRange(EndLine, CurRange) || ( true === bEmpty && 1 === RangesCount ))
pGraphics.drawHorLineExt(DrawLineRule, TempY, X0, X1, Pr.ParaPr.Brd.Bottom.Size, LeftMW, RightMW);
}
pGraphics.End_Command();
let endLine = this.Pages[CurPage].EndLine;
this.drawHorizontalBorder(pGraphics, endLine, paraPr.Brd.Bottom, lineAlign, y, bEmpty, X_left, X_right, leftMW, rightMW);
}
};
/**
@ -8412,10 +8165,20 @@ Paragraph.prototype.Selection_SetStart = function(X, Y, CurPage, bTableBorder)
this.Set_ParaContentPos(pos2, true, line, range);
this.Set_SelectionContentPos(pos2, pos2, true, line, range, line, range);
if (SearchPosXY2.isNumbering() && undefined !== this.GetNumPr())
if (SearchPosXY2.isNumbering())
{
this.Set_ParaContentPos(this.Get_StartPos(), true, -1, -1);
this.Parent.SelectNumbering(this.GetNumPr(), this);
let numPr = this.GetNumPr();
let prevNumPr = this.GetPrChangeNumPr();
if (numPr && numPr.IsValid())
{
this.Set_ParaContentPos(this.Get_StartPos(), true, -1, -1);
this.Parent.SelectNumbering(numPr, this);
}
else if (prevNumPr && prevNumPr.IsValid())
{
this.Set_ParaContentPos(this.Get_StartPos(), true, -1, -1);
this.Parent.SelectNumberingSingleParagraph(this);
}
}
};
/**
@ -8900,42 +8663,68 @@ Paragraph.prototype.DrawSelectionOnPage = function(CurPage, clipInfo)
var SelectX = this.Lines[CurLine].Ranges[CurRange].XVisible;
var SelectW = ParaNum.WidthVisible;
var SelectH = this.Lines[CurLine].Bottom - this.Lines[CurLine].Top;
let SelectX2 = SelectX;
let SelectW2 = ParaNum.WidthNum;
var SelectW2 = SelectW;
var oNumPr = this.GetNumPr();
if (!oNumPr)
let numLvl = null;
let numPr = this.GetNumPr();
let prevNumPr = this.GetPrChangeNumPr();
if (numPr)
numLvl = this.Parent.GetNumbering().GetNum(numPr.NumId).GetLvl(numPr.Lvl);
else if (prevNumPr)
numLvl = this.Parent.GetNumbering().GetNum(prevNumPr.NumId).GetLvl(undefined !== prevNumPr.Lvl && null !== prevNumPr.Lvl ? prevNumPr.Lvl : 0);
if (!numLvl)
break;
var nNumJc = this.Parent.GetNumbering().GetNum(oNumPr.NumId).GetLvl(oNumPr.Lvl).GetJc();
switch (nNumJc)
let numJc = numLvl.GetJc();
if (this.isRtlDirection())
{
case align_Center:
let xEnd = this.Lines[CurLine].Ranges[CurRange].XEndVisible;
SelectX = xEnd - ParaNum.WidthVisible;
if (AscCommon.align_Center === numJc)
{
SelectX = this.Lines[CurLine].Ranges[CurRange].XVisible - ParaNum.WidthNum / 2;
SelectW = ParaNum.WidthVisible + ParaNum.WidthNum / 2;
SelectX2 = xEnd - ParaNum.WidthNum / 2;
}
else if (AscCommon.align_Right === numJc)
{
SelectW = ParaNum.WidthVisible + ParaNum.WidthNum;
SelectX2 = xEnd;
}
else // if (AscCommon.align_Left === numJc)
{
SelectW = ParaNum.WidthVisible;
SelectX2 = xEnd - ParaNum.WidthNum;
}
}
else
{
let xStart = this.Lines[CurLine].Ranges[CurRange].XVisible;
if (AscCommon.align_Center === numJc)
{
SelectX = xStart - ParaNum.WidthNum / 2;
SelectW = ParaNum.WidthVisible + ParaNum.WidthNum / 2;
break;
}
case align_Right:
else if (AscCommon.align_Right === numJc)
{
SelectX = this.Lines[CurLine].Ranges[CurRange].XVisible - ParaNum.WidthNum;
SelectX = xStart - ParaNum.WidthNum;
SelectW = ParaNum.WidthVisible + ParaNum.WidthNum;
break;
}
case align_Left:
default:
else // if (AscCommon.align_Left === numJc)
{
SelectX = this.Lines[CurLine].Ranges[CurRange].XVisible;
SelectX = xStart;
SelectW = ParaNum.WidthVisible;
break;
}
SelectX2 = SelectX;
}
AscWord.drawSelectionOnPage(drawingDocument, clipInfo, PageAbs, SelectX, SelectY, SelectW, SelectH);
if (selectionflag_NumberingCur === this.Selection.Flag && drawingDocument.AddPageSelection2)
AscWord.drawSelectionOnPage(drawingDocument, clipInfo, PageAbs, SelectX, SelectY, SelectW2, SelectH, true);
AscWord.drawSelectionOnPage(drawingDocument, clipInfo, PageAbs, SelectX2, SelectY, SelectW2, SelectH, true);
break;
}
@ -9086,9 +8875,9 @@ Paragraph.prototype.Selection_SelectNumbering = function()
this.Selection.Flag = selectionflag_Numbering;
}
};
Paragraph.prototype.SelectNumbering = function(isCurrent)
Paragraph.prototype.SelectNumbering = function(isCurrent, isForce)
{
if (this.HaveNumbering())
if (this.HaveNumbering() || isForce)
{
this.Selection.Use = true;
this.Selection.Flag = isCurrent ? selectionflag_NumberingCur : selectionflag_Numbering;
@ -16316,27 +16105,26 @@ Paragraph.prototype.Set_ParaPropsForVerticalTextInCell = function(isVerticalText
}
};
/**
* Проверяем можно ли объединить границы двух параграфов с заданными настройками Pr1, Pr2.
* Проверяем можно ли объединить границы двух параграфов с заданными настройками paraPr1, paraPr2
* @param paraPr1 {AscWord.CParaPr}
* @param paraPr2 {AscWord.CParaPr}
* @return {boolean}
*/
Paragraph.prototype.private_CompareBorderSettings = function(Pr1, Pr2)
Paragraph.prototype.private_CompareBorderSettings = function(paraPr1, paraPr2)
{
// Сначала сравним правую и левую границы параграфов
var Left_1 = Math.min(Pr1.Ind.Left, Pr1.Ind.Left + Pr1.Ind.FirstLine);
var Right_1 = Pr1.Ind.Right;
var Left_2 = Math.min(Pr2.Ind.Left, Pr2.Ind.Left + Pr2.Ind.FirstLine);
var Right_2 = Pr2.Ind.Right;
if (Math.abs(Left_1 - Left_2) > 0.001 || Math.abs(Right_1 - Right_2) > 0.001)
return false;
let l_1 = paraPr1.Bidi ? paraPr1.Ind.Right : Math.min(paraPr1.Ind.Left, paraPr1.Ind.Left + paraPr1.Ind.FirstLine);
let r_1 = paraPr1.Bidi ? Math.min(paraPr1.Ind.Left, paraPr1.Ind.Left + paraPr1.Ind.FirstLine) : paraPr1.Ind.Right;
let l_2 = paraPr2.Bidi ? paraPr2.Ind.Right : Math.min(paraPr2.Ind.Left, paraPr2.Ind.Left + paraPr2.Ind.FirstLine);
let r_2 = paraPr2.Bidi ? Math.min(paraPr2.Ind.Left, paraPr2.Ind.Left + paraPr2.Ind.FirstLine) : paraPr2.Ind.Right;
// Почему то Word не сравнивает границы между параграфами.
if (false === Pr1.Brd.Top.Compare(Pr2.Brd.Top)
|| false === Pr1.Brd.Bottom.Compare(Pr2.Brd.Bottom)
|| false === Pr1.Brd.Left.Compare(Pr2.Brd.Left)
|| false === Pr1.Brd.Right.Compare(Pr2.Brd.Right))
return false;
return true;
return (Math.abs(l_1 - l_2) < AscWord.EPSILON
&& Math.abs(r_1 - r_2) < AscWord.EPSILON
&& paraPr1.Brd.Top.Compare(paraPr2.Brd.Top)
&& paraPr1.Brd.Bottom.Compare(paraPr2.Brd.Bottom)
&& paraPr1.Brd.Left.Compare(paraPr2.Brd.Left)
&& paraPr1.Brd.Right.Compare(paraPr2.Brd.Right));
};
Paragraph.prototype.GetFootnotesList = function(oEngine)
{

View File

@ -4272,3 +4272,7 @@ CAnchorPosition.prototype.Calculate_Y_Value = function(RelativeFrom)
//--------------------------------------------------------export----------------------------------------------------
window['AscCommonWord'] = window['AscCommonWord'] || {};
window['AscCommonWord'].ParaDrawing = ParaDrawing;
window['AscWord'] = window['AscWord'] || {};
window['AscWord'].ParaDrawing = ParaDrawing;

View File

@ -1168,6 +1168,37 @@
var nFirstCharCode = sText.charCodeAt(0);
var sValue = sText.slice(0, sText.length - 1);
function _getDigit(code)
{
return ((48 <= code && code <= 57) ? code - 48 : -1);
}
function _getHindiDigit(code)
{
return ((0x0660 <= code && code <= 0x0669) ? code - 0x0660 : -1);
}
function _parseInt(text)
{
let val = 0;
let pos = 0;
for (; pos < text.length; ++pos)
{
let c = text.codePointAt(pos);
let d = _getDigit(c);
if (-1 === d)
d = _getHindiDigit(c);
if (-1 === d)
break;
val = val * 10 + d;
}
return 0 === pos ? null : val;
}
function private_ParseNextInt(sText, nPos)
{
@ -1188,16 +1219,16 @@
nEndPos = Math.min(nNextDotPos, nNextParaPos);
var sValue = sText.slice(nPos, nEndPos);
var nValue = parseInt(sValue);
var nValue = _parseInt(sValue);
if (isNaN(nValue))
if (null === nValue)
return null;
return {Value : nValue, Char : sText.charAt(nEndPos), Pos : nEndPos + 1};
}
// Проверяем, либо у нас все числовое, либо у нас все буквенное (все заглавные, либо все не заглавные)
if (48 <= nFirstCharCode && nFirstCharCode <= 57)
if ((48 <= nFirstCharCode && nFirstCharCode <= 57) || (0x0660 <= nFirstCharCode && nFirstCharCode <= 0x0669))
{
var arrResult = [], nPos = 0;

View File

@ -75,7 +75,7 @@
{
return true;
};
CRunBreak.prototype.Draw = function(X, Y, Context)
CRunBreak.prototype.Draw = function(X, Y, Context, drawState)
{
if (false === this.Flags.Use)
return;
@ -100,7 +100,8 @@
Italic : false,
Bold : false
});
Context.FillText(X, Y, String.fromCharCode(0x0038/*0x21B5*/));
let code = drawState.isRtlMainDirection() ? 0x0039 : 0x0038;
Context.FillText(X, Y, String.fromCharCode(code/*0x21B5*/));
break;
}
case break_Page:
@ -357,6 +358,10 @@
{
return AscWord.fontslot_Unknown;
};
CRunBreak.prototype.getBidiType = function()
{
return AscBidi.TYPE.PM;
};
//--------------------------------------------------------export----------------------------------------------------
window['AscWord'] = window['AscWord'] || {};

View File

@ -40,19 +40,20 @@ var tab_Num = Asc.c_oAscTabType.Num;
var tab_Right = Asc.c_oAscTabType.Right;
var tab_Left = Asc.c_oAscTabType.Left;
var tab_Symbol = 0x0022;//0x2192;
let tab_Symbol = 0x0022;//0x2192;
let tab_Symbol_Rtl = 0x0021;
(function(window)
{
let tabWidth = null;
function getTabActualWidth()
function getTabActualWidth(tabCode)
{
if (null !== tabWidth)
return tabWidth;
g_oTextMeasurer.SetFont({FontFamily : {Name : "ASCW3", Index : -1}, FontSize : 10, Italic : false, Bold : false});
tabWidth = g_oTextMeasurer.Measure(String.fromCharCode(tab_Symbol)).Width;
tabWidth = g_oTextMeasurer.Measure(String.fromCharCode(tabCode)).Width;
return tabWidth;
}
@ -80,7 +81,7 @@ var tab_Symbol = 0x0022;//0x2192;
{
return true;
};
CRunTab.prototype.Draw = function(X, Y, Context)
CRunTab.prototype.Draw = function(X, Y, Context, drawState)
{
if (this.Width > 0.01 && 0 !== this.LeaderCode)
{
@ -96,20 +97,24 @@ var tab_Symbol = 0x0022;//0x2192;
{
Context.CheckSpaceDraw();
}
if (editor && editor.ShowParaMarks)
{
let isRtl = drawState.isRtlMainDirection();
Context.p_color(0, 0, 0, 255);
Context.b_color1(0, 0, 0, 255);
let tabActualWidth = getTabActualWidth();
let tabCode = drawState.isRtlMainDirection() ? tab_Symbol_Rtl : tab_Symbol;
let tabActualWidth = getTabActualWidth(tabCode);
var X0 = this.Width / 2 - tabActualWidth / 2;
Context.SetFont({FontFamily : {Name : "ASCW3", Index : -1}, FontSize : 10, Italic : false, Bold : false});
if (X0 > 0)
Context.FillText2(X + X0, Y, String.fromCharCode(tab_Symbol), 0, this.Width);
Context.FillText2(X + X0, Y, String.fromCharCode(tabCode), 0, this.Width);
else
Context.FillText2(X, Y, String.fromCharCode(tab_Symbol), tabActualWidth - this.Width, this.Width);
Context.FillText2(X, Y, String.fromCharCode(tabCode), isRtl ? 0 : tabActualWidth - this.Width, this.Width);
}
};
CRunTab.prototype.Measure = function(Context)
@ -193,6 +198,10 @@ var tab_Symbol = 0x0022;//0x2192;
{
return AscWord.fontslot_Unknown;
};
CRunTab.prototype.getBidiType = function()
{
return AscBidi.TYPE.PM;
};
//--------------------------------------------------------export----------------------------------------------------
window['AscWord'] = window['AscWord'] || {};
window['AscWord'].CRunTab = CRunTab;

View File

@ -99,9 +99,14 @@
return AscWord.GetFontSlotByTextPr(nUnicode, oTextPr);
};
CParagraphTextShaper.prototype.GetLigaturesType = function()
CParagraphTextShaper.prototype.GetLigaturesType = function(textScript)
{
return this.Ligatures;
// bug-73560
let result = this.Ligatures;
if (AscFonts.HB_SCRIPT.HB_SCRIPT_ARABIC === textScript)
result |= Asc.LigaturesType.Standard;
return result;
};
CParagraphTextShaper.prototype.Shape = function(oParagraph)
{

View File

@ -86,7 +86,7 @@
this.x = this.paragraph.Lines[this.line].Ranges[this.range].XVisible;
if (this.paragraph.Numbering.checkRange(this.line, this.range))
if (this.paragraph.Numbering.checkRange(this.line, this.range) && !this.paragraph.isRtlDirection())
this.x += this.paragraph.Numbering.WidthVisible;
this.bidi.begin(this.paragraph.isRtlDirection());

View File

@ -118,11 +118,20 @@
this.Range = range;
this.X = x;
let isRtl = this.Paragraph.isRtlDirection();
if (this.Paragraph.Numbering.checkRange(this.Range, this.Line) && !isRtl)
this.handleNumbering();
this.bidiFlow.begin(this.Paragraph.isRtlDirection());
};
ParagraphContentDrawState.prototype.endRange = function()
{
this.bidiFlow.end();
let isRtl = this.Paragraph.isRtlDirection();
if (this.Paragraph.Numbering.checkRange(this.Range, this.Line) && isRtl)
this.handleNumbering();
};
/**
* @param element {AscWord.CRunElementBase}
@ -161,7 +170,7 @@
this.handleFieldChar(element);
break;
default:
this.handleRegularElement(element);
this.handleRegularElement(element, direction);
break;
}
};
@ -296,6 +305,7 @@
};
/**
* @param text {AscWord.CRunText}
* @param direction {AscBidi.DIRECTION}
*/
ParagraphContentDrawState.prototype.handleText = function(text, direction)
{
@ -395,6 +405,301 @@
this.handleRegularElement(fieldChar);
};
ParagraphContentDrawState.prototype.handleNumbering = function()
{
let graphics = this.Graphics;
let BgColor = this.drawState.getBgColor();
let Pr = this.drawState.getParagraphCompiledPr();
let isRtl = Pr.ParaPr.Bidi;
let X = this.X;
let Y = this.Y;
let CurLine = this.Line;
let CurPage = this.Page;
let para = this.Paragraph;
var nReviewType = para.GetReviewType();
var oReviewColor = para.GetReviewColor();
let numItem = para.Numbering;
if (para_Numbering === numItem.Type)
{
var isHavePrChange = para.HavePrChange();
let prevNumPr = para.GetPrChangeNumPr();
let numPr = Pr.ParaPr.NumPr;
if (prevNumPr && prevNumPr.IsValid())
{
prevNumPr = prevNumPr.Copy();
if (undefined === prevNumPr.Lvl)
prevNumPr.Lvl = 0;
}
else
{
prevNumPr = null;
}
var isHaveNumbering = false;
if ((undefined === para.Get_SectionPr() || true !== para.IsEmpty())
&& (!para.Parent || !para.Parent.IsEmptyParagraphAfterTableInTableCell(para.GetIndex()))
&& ((numPr && numPr.IsValid()) || (prevNumPr && prevNumPr.IsValid())))
{
isHaveNumbering = true;
}
if (!isHaveNumbering || (!numPr && !prevNumPr))
{
// Ничего не делаем
}
else
{
var oNumbering = para.Parent.GetNumbering();
var oNumLvl = null;
if (numPr)
oNumLvl = oNumbering.GetNum(numPr.NumId).GetLvl(numPr.Lvl);
else if (prevNumPr)
oNumLvl = oNumbering.GetNum(prevNumPr.NumId).GetLvl(prevNumPr.Lvl);
var nNumSuff = oNumLvl.GetSuff();
var nNumJc = oNumLvl.GetJc();
var oNumTextPr = para.GetNumberingTextPr();
var oPrevNumTextPr = prevNumPr ? para.Get_CompiledPr2(false).TextPr.Copy() : null;
if (oPrevNumTextPr && (prevNumPr && prevNumPr.IsValid()))
{
var oPrevNumLvl = oNumbering.GetNum(prevNumPr.NumId).GetLvl(prevNumPr.Lvl);
oPrevNumTextPr.Merge(para.TextPr.Value.Copy());
oPrevNumTextPr.Merge(oPrevNumLvl.GetTextPr());
}
var X_start = this.X;
let numWidth = numItem.getNumWidth();
let suffWidth = numItem.getSuffWidth();
if (isRtl)
{
X_start = this.X + numItem.getVisibleWidth();
if (align_Left === nNumJc)
X_start -= numWidth;
else if (align_Center === nNumJc)
X_start -= numWidth / 2;
}
else
{
if (align_Right === nNumJc)
X_start -= numWidth;
else if (align_Center === nNumJc)
X_start -= numWidth / 2;
}
var AutoColor = ( undefined !== BgColor && false === BgColor.Check_BlackAutoColor() ? new CDocumentColor(255, 255, 255, false) : new CDocumentColor(0, 0, 0, false) );
var RGBA;
if (oNumTextPr.Unifill)
{
oNumTextPr.Unifill.check(this.Theme, this.ColorMap);
RGBA = oNumTextPr.Unifill.getRGBAColor();
graphics.b_color1(RGBA.R, RGBA.G, RGBA.B, 255);
}
else
{
if (true === oNumTextPr.Color.Auto)
{
if(oNumTextPr.FontRef && oNumTextPr.FontRef.Color)
{
oNumTextPr.FontRef.Color.check(this.Theme, this.ColorMap);
RGBA = oNumTextPr.FontRef.Color.RGBA;
graphics.b_color1(RGBA.R, RGBA.G, RGBA.B, 255);
}
else
{
graphics.b_color1(AutoColor.r, AutoColor.g, AutoColor.b, 255);
}
}
else
{
graphics.b_color1(oNumTextPr.Color.r, oNumTextPr.Color.g, oNumTextPr.Color.b, 255);
}
}
if (numItem.havePrevNumbering() || reviewtype_Common !== nReviewType)
{
if (reviewtype_Common === nReviewType)
graphics.b_color1(REVIEW_NUMBERING_COLOR.r, REVIEW_NUMBERING_COLOR.g, REVIEW_NUMBERING_COLOR.b, 255);
else
graphics.b_color1(oReviewColor.r, oReviewColor.g, oReviewColor.b, 255);
}
else if (isHavePrChange && numPr && !prevNumPr)
{
var oPrReviewColor = para.GetPrReviewColor();
graphics.b_color1(oPrReviewColor.r, oPrReviewColor.g, oPrReviewColor.b, 255);
}
let baseY = Y;
switch (oNumTextPr.VertAlign)
{
case AscCommon.vertalign_SubScript:
{
baseY -= AscCommon.vaKSub * oNumTextPr.FontSize * g_dKoef_pt_to_mm;
break;
}
case AscCommon.vertalign_SuperScript:
{
baseY -= AscCommon.vaKSuper * oNumTextPr.FontSize * g_dKoef_pt_to_mm;
break;
}
}
// Рисуется только сам символ нумерации
switch (nNumJc)
{
case align_Right:
numItem.Draw(X_start, baseY, graphics, oNumbering, oNumTextPr, this.Theme, oPrevNumTextPr, isRtl);
break;
case align_Center:
numItem.Draw(X_start, baseY, graphics, oNumbering, oNumTextPr, this.Theme, oPrevNumTextPr, isRtl);
break;
case align_Left:
default:
numItem.Draw(X_start, baseY, graphics, oNumbering, oNumTextPr, this.Theme, oPrevNumTextPr, isRtl);
break;
}
if (true === oNumTextPr.Strikeout || true === oNumTextPr.Underline)
{
if (oNumTextPr.Unifill)
{
graphics.p_color(RGBA.R, RGBA.G, RGBA.B, 255);
}
else
{
if (true === oNumTextPr.Color.Auto)
graphics.p_color(AutoColor.r, AutoColor.g, AutoColor.b, 255);
else
graphics.p_color(oNumTextPr.Color.r, oNumTextPr.Color.g, oNumTextPr.Color.b, 255);
}
}
let lineW = (oNumTextPr.FontSize / 18) * g_dKoef_pt_to_mm;
let strikeoutY = (baseY - oNumTextPr.FontSize * g_dKoef_pt_to_mm * 0.27);
let underlineY = (baseY + para.Lines[CurLine].Metrics.TextDescent * 0.4);
if (numItem.havePrevNumbering() || reviewtype_Common !== nReviewType)
{
let prevNumWidth = numItem.getPrevNumWidth();
if (reviewtype_Common === nReviewType)
graphics.p_color(REVIEW_NUMBERING_COLOR.r, REVIEW_NUMBERING_COLOR.g, REVIEW_NUMBERING_COLOR.b, 255);
else
graphics.p_color(oReviewColor.r, oReviewColor.g, oReviewColor.b, 255);
// Либо у нас есть удаленная часть, либо у нас одновременно добавлен и удален параграф, тогда мы зачеркиваем суффикс
if (numItem.havePrevNumbering() || (!numItem.havePrevNumbering() && !numItem.haveFinalNumbering()))
{
if (numItem.haveFinalNumbering() || nReviewType !== reviewtype_Remove)
{
let x0 = X_start;
let x1 = X_start + prevNumWidth;
graphics.drawHorLine(0, strikeoutY, x0, x1, lineW);
}
else
{
let x0 = isRtl ? X_start - suffWidth : X_start;
let x1 = x0 + numWidth + suffWidth;
graphics.drawHorLine(0, strikeoutY, x0, x1, lineW);
}
}
if (numItem.haveFinalNumbering())
{
if (isRtl)
{
let x0 = X_start - suffWidth;
let x1 = X_start;
graphics.drawHorLine(0, underlineY, x0, x1, lineW);
x0 = X_start + prevNumWidth;
x1 = X_start + numWidth;
graphics.drawHorLine(0, underlineY, x0, x1, lineW);
}
else
{
let x0 = X_start + prevNumWidth;
let x1 = X_start + numWidth + suffWidth;
graphics.drawHorLine(0, underlineY, x0, x1, lineW);
}
}
}
else if (isHavePrChange && numPr && !prevNumPr)
{
let prevColor = para.GetPrReviewColor();
graphics.p_color(prevColor.r, prevColor.g, prevColor.b, 255);
let x0 = isRtl ? X_start - suffWidth : X_start;
let x1 = x0 + numWidth + suffWidth;
graphics.drawHorLine(0, underlineY, x0, x1, lineW);
}
else
{
let x0 = X_start;
let x1 = x0 + numWidth;
if (oNumTextPr.Strikeout)
graphics.drawHorLine(0, strikeoutY, x0, x1, lineW);
if (oNumTextPr.Underline)
graphics.drawHorLine(0, underlineY, x0, x1, lineW);
}
if (true === editor.ShowParaMarks && (Asc.c_oAscNumberingSuff.Tab === nNumSuff || oNumLvl.IsLegacy()))
{
let tabSymbolWidth = 3.143; // ширина символа "стрелка влево" в шрифте Wingding3,10
let tabX = this.X;
if (!isRtl)
{
if (AscCommon.align_Left === nNumJc)
tabX += numWidth;
else if (AscCommon.align_Center === nNumJc)
tabX += numWidth / 2;
}
graphics.SetFont({
FontFamily : {Name : "ASCW3", Index : -1},
FontSize : 10,
Italic : false,
Bold : false
});
let tabCode = isRtl ? tab_Symbol_Rtl : tab_Symbol;
if (suffWidth > tabSymbolWidth)
graphics.FillText2(tabX + suffWidth / 2 - tabSymbolWidth / 2, Y, String.fromCharCode(tabCode), 0, suffWidth);
else if (isRtl)
graphics.FillText2(tabX, Y, String.fromCharCode(tabCode), 0, suffWidth);
else
graphics.FillText2(tabX, Y, String.fromCharCode(tabCode), tabSymbolWidth - suffWidth, suffWidth);
}
}
}
else if (para_PresentationNumbering === numItem.Type)
{
var bIsEmpty = para.IsEmpty();
if (!bIsEmpty ||
para.IsThisElementCurrent() ||
para.Parent.IsSelectionUse() && para.Parent.IsSelectionEmpty() && para.Parent.Selection.StartPos === para.GetIndex())
{
if (Pr.ParaPr.Ind.FirstLine < 0)
numItem.Draw(X, Y, graphics, this);
else
numItem.Draw(para.Pages[CurPage].X + Pr.ParaPr.Ind.Left, Y, graphics, this);
}
}
this.X += numItem.getVisibleWidth();
};
ParagraphContentDrawState.prototype.calculateY = function(textPr)
{
let y = this.Y;
@ -414,6 +719,10 @@
{
return this.Graphics && this.Graphics.m_bIsTextDrawer;
};
ParagraphContentDrawState.prototype.isRtlMainDirection = function()
{
return this.Paragraph.isRtlDirection();
};
//--------------------------------------------------------export----------------------------------------------------
AscWord.ParagraphContentDrawState = ParagraphContentDrawState;

View File

@ -162,15 +162,6 @@
};
ParagraphHighlightDrawState.prototype.beginRange = function(range, X, spaceCount)
{
this.Range = range;
this.X = X;
this.checkNumbering();
this.spaces = spaceCount;
this.bidiFlow.begin(this.Paragraph.isRtlDirection());
this.InlineSdt = [];
this.High.Clear();
this.Coll.Clear();
this.Find.Clear();
@ -181,6 +172,17 @@
this.HyperCF.Clear();
this.Perm.Clear();
this.Range = range;
this.X = X;
if (!this.Paragraph.isRtlDirection())
this.checkNumbering(false);
this.spaces = spaceCount;
this.bidiFlow.begin(this.Paragraph.isRtlDirection());
this.InlineSdt = [];
this.run = null;
this.highlight = highlight_None;
this.shdColor = null;
@ -189,6 +191,9 @@
ParagraphHighlightDrawState.prototype.endRange = function()
{
this.bidiFlow.end();
if (this.Paragraph.isRtlDirection())
this.checkNumbering(true);
};
ParagraphHighlightDrawState.prototype.AddInlineSdt = function(oSdt)
{
@ -362,13 +367,15 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ParagraphHighlightDrawState.prototype.checkNumbering = function()
ParagraphHighlightDrawState.prototype.checkNumbering = function(isRtl)
{
let paraNumbering = this.Paragraph.Numbering;
if (!paraNumbering.checkRange(this.Range, this.Line))
return;
let x = this.X;
let w = paraNumbering.WidthNum + paraNumbering.WidthSuff;
this.X += paraNumbering.WidthVisible;
let numPr = this.drawState.getParagraphCompiledPr().ParaPr.NumPr;
@ -378,7 +385,7 @@
|| !numPr
|| !numPr.IsValid()
|| !paraParent
|| !paraParent.IsEmptyParagraphAfterTableInTableCell(this.Paragraph.GetIndex()))
|| paraParent.IsEmptyParagraphAfterTableInTableCell(this.Paragraph.GetIndex()))
return;
let numManager = paraParent.GetNumbering();
@ -386,13 +393,20 @@
let numJc = numLvl.GetJc();
let numTextPr = this.Paragraph.GetNumberingTextPr();
if (AscCommon.align_Right === numJc)
x -= paraNumbering.WidthNum;
else if (AscCommon.align_Center === numJc)
x -= paraNumbering.WidthNum / 2;
if (!isRtl)
{
if (AscCommon.align_Right === numJc)
x -= paraNumbering.WidthNum;
else if (AscCommon.align_Center === numJc)
x -= paraNumbering.WidthNum / 2;
}
if (highlight_None !== numTextPr.HighLight)
this.High.Add(this.Y0, this.Y1, x, x + paraNumbering.WidthNum + paraNumbering.WidthSuff, 0, numTextPr.HighLight.r, numTextPr.HighLight.g, numTextPr.HighLight.b, undefined, numTextPr);
this.High.Add(this.Y0, this.Y1, x, x + w, 0, numTextPr.HighLight.r, numTextPr.HighLight.g, numTextPr.HighLight.b, undefined, numTextPr);
let shdColor = (numTextPr.Shd && !numTextPr.Shd.IsNil() ? numTextPr.Shd.GetSimpleColor(this.drawState.getTheme(), this.drawState.getColorMap()) : null);
if (shdColor)
this.Shd.Add(this.Y0, this.Y1, x, x + w, 0, shdColor.r, shdColor.g, shdColor.b);
};
/**
* @param {string} commentId

View File

@ -101,7 +101,7 @@
this.startX = this.x;
if (p.Numbering.checkRange(range, line))
if (p.Numbering.checkRange(range, line) && !p.isRtlDirection())
this.x += p.Numbering.WidthVisible;
this.bidi.begin(this.paragraph.isRtlDirection());

View File

@ -65,7 +65,8 @@
this.bidiFlow = new AscWord.BidiFlow(this);
this.checkEmptyRun = true;
this.emptyRun = null;
this.emptyRunHandler = {};
// TODO: Unite with CRunWithPosition class
this.pos = null;
@ -93,7 +94,8 @@
ParagraphSearchPositionXY.prototype.reset = function()
{
this.bidiFlow.end();
this.checkEmptyRun = true;
this.emptyRun = null;
this.emptyRunHandler = {};
};
ParagraphSearchPositionXY.prototype.setDiff = function(diff)
{
@ -131,24 +133,13 @@
this.curX = paraRange.XVisible;
this.curY = 0;
this.checkNumbering();
let isRtl = para.isRtlDirection();
if (para.Numbering.checkRange(this.range, this.line) && !isRtl)
this.checkNumbering(isRtl);
let startPos = paraRange.StartPos;
let endPos = paraRange.EndPos;
// Do not enter to the run containing paragraphMark if we don't want to
if (true !== this.stepEnd && endPos === para.Content.length - 1 && endPos > startPos)
{
--endPos;
if (para.isRtlDirection())
{
let endRun = para.GetParaEndRun();
let paraMark = endRun ? endRun.GetParaEnd() : null;
if (paraMark)
this.curX += paraMark.GetWidthVisible();
}
}
for (let pos = startPos; pos <= endPos; ++pos)
{
para.Content[pos].getParagraphContentPosByXY(this);
@ -156,6 +147,9 @@
this.bidiFlow.end();
if (para.Numbering.checkRange(this.range, this.line) && isRtl)
this.checkNumbering(isRtl);
this.checkRangeBounds(x, paraRange);
this.checkInText()
@ -168,15 +162,16 @@
};
ParagraphSearchPositionXY.prototype.handleRun = function(run)
{
if (!this.checkEmptyRun)
if (this.emptyRun)
return;
if (!run.IsEmpty())
{
this.checkEmptyRun = false;
return;
}
this.emptyRun = null;
else
this.emptyRun = run;
};
ParagraphSearchPositionXY.prototype.handleEmptyRun = function(run)
{
let curX = this.curX;
if (run.IsMathRun())
{
@ -194,6 +189,12 @@
};
ParagraphSearchPositionXY.prototype.handleParaMath = function(math)
{
if (this.emptyRun)
{
this.handleEmptyRun(this.emptyRun);
this.emptyRun = null;
}
let curX = this.curX;
let mathW = math.Root.GetWidth(this.line, this.range);
@ -230,6 +231,12 @@
};
ParagraphSearchPositionXY.prototype.handleMathBase = function(base)
{
if (this.emptyRun)
{
this.handleEmptyRun(this.emptyRun);
this.emptyRun = null;
}
if (!base.Content.length)
return;
@ -294,6 +301,12 @@
if (!this.complexFields.checkRunElement(element))
return;
if (this.emptyRun)
{
this.emptyRunHandler[element] = this.emptyRun;
this.emptyRun = null;
}
this.bidiFlow.add([element, run, inRunPos], element.getBidiType());
};
ParagraphSearchPositionXY.prototype.handleBidiFlow = function(data, direction)
@ -302,6 +315,12 @@
let run = data[1];
let inRunPos = data[2];
if (this.emptyRunHandler[item] && direction === AscBidi.DIRECTION.L)
{
this.handleEmptyRun(this.emptyRunHandler[item]);
delete this.emptyRunHandler[item];
}
let w = 0;
if (!item.IsDrawing() || item.IsInline())
w = item.GetWidthVisible();
@ -353,8 +372,13 @@
}
}
this.curX += w;
if (this.emptyRunHandler[item] && direction === AscBidi.DIRECTION.R)
{
this.handleEmptyRun(this.emptyRunHandler[item]);
delete this.emptyRunHandler[item];
}
};
ParagraphSearchPositionXY.prototype.getPos = function()
{
@ -469,38 +493,59 @@
return Math.max(0, Math.min(range, rangeCount - 1));
};
ParagraphSearchPositionXY.prototype.checkNumbering = function()
ParagraphSearchPositionXY.prototype.checkNumbering = function(isRtl)
{
let p = this.paragraph;
if (!p.Numbering.checkRange(this.range, this.line))
return;
let numPr = p.GetNumPr();
if (para_Numbering === p.Numbering.Type && numPr && numPr.IsValid())
let prevNumPr = p.GetPrChangeNumPr();
let numLvl = null;
if (numPr && numPr.IsValid())
numLvl = p.Parent.GetNumbering().GetNum(numPr.NumId).GetLvl(numPr.Lvl);
else if (prevNumPr && prevNumPr.IsValid())
numLvl = p.Parent.GetNumbering().GetNum(prevNumPr.NumId).GetLvl(undefined !== prevNumPr.Lvl && null !== prevNumPr.Lvl ? prevNumPr.Lvl : 0);
let numWidthVisible = p.Numbering.WidthVisible;
if (para_Numbering === p.Numbering.Type && numLvl)
{
let numJc = p.Parent.GetNumbering().GetNum(numPr.NumId).GetLvl(numPr.Lvl).GetJc();
let numJc = numLvl.GetJc();
let numX0 = this.curX;
let numX1 = this.curX;
switch (numJc)
let numWidth = p.Numbering.WidthNum;
if (isRtl)
{
case align_Right:
numX0 += numWidthVisible;
numX1 += numWidthVisible;
if (AscCommon.align_Right === numJc)
{
numX0 -= p.Numbering.WidthNum;
break;
numX1 += numWidth;
}
case align_Center:
else if (AscCommon.align_Center === numJc)
{
numX0 -= p.Numbering.WidthNum / 2;
numX1 += p.Numbering.WidthNum / 2;
break;
numX0 -= numWidth / 2;
numX1 += numWidth / 2;
}
case align_Left:
default:
else// if (AscCommon.align_Left === numJc)
{
numX1 += p.Numbering.WidthNum;
break;
numX0 -= numWidth;
}
}
else
{
if (AscCommon.align_Right === numJc)
{
numX0 -= numWidth;
}
else if (AscCommon.align_Center === numJc)
{
numX0 -= numWidth / 2;
numX1 += numWidth / 2;
}
else// if (AscCommon.align_Left === numJc)
{
numX1 += numWidth;
}
}
@ -508,7 +553,7 @@
this.numbering = true;
}
this.curX += p.Numbering.WidthVisible;
this.curX += numWidthVisible;
};
ParagraphSearchPositionXY.prototype.checkPosition = function(diff)
{

View File

@ -112,18 +112,18 @@ ParaNumbering.prototype = Object.create(AscWord.CRunElementBase.prototype);
ParaNumbering.prototype.constructor = ParaNumbering;
ParaNumbering.prototype.Type = para_Numbering;
ParaNumbering.prototype.Draw = function(X, Y, oContext, oNumbering, oTextPr, oTheme, oPrevNumTextPr)
ParaNumbering.prototype.Draw = function(X, Y, oContext, oNumbering, oTextPr, oTheme, oPrevNumTextPr, isRtl)
{
var _X = X;
if (this.Internal.SourceNumInfo)
{
oNumbering.Draw(this.Internal.SourceNumId,this.Internal.SourceNumLvl, _X, Y, oContext, this.Internal.SourceNumInfo, oPrevNumTextPr ? oPrevNumTextPr : oTextPr, oTheme);
oNumbering.Draw(this.Internal.SourceNumId,this.Internal.SourceNumLvl, _X, Y, oContext, this.Internal.SourceNumInfo, oPrevNumTextPr ? oPrevNumTextPr : oTextPr, oTheme, isRtl);
_X += this.Internal.SourceWidth;
}
if (this.Internal.FinalNumInfo)
{
oNumbering.Draw(this.Internal.FinalNumId,this.Internal.FinalNumLvl, _X, Y, oContext, this.Internal.FinalNumInfo, oTextPr, oTheme);
oNumbering.Draw(this.Internal.FinalNumId,this.Internal.FinalNumLvl, _X, Y, oContext, this.Internal.FinalNumInfo, oTextPr, oTheme, isRtl);
}
};
ParaNumbering.prototype.Measure = function (oContext, oNumbering, oTextPr, oTheme, oFinalNumInfo, oFinalNumPr, oSourceNumInfo, oSourceNumPr)
@ -224,7 +224,7 @@ ParaNumbering.prototype.GetCalculatedNumId = function()
* Нужно ли отрисовывать исходную нумерацию
* @returns {boolean}
*/
ParaNumbering.prototype.HaveSourceNumbering = function()
ParaNumbering.prototype.havePrevNumbering = function()
{
return !!this.Internal.SourceNumInfo;
};
@ -232,7 +232,7 @@ ParaNumbering.prototype.HaveSourceNumbering = function()
* Нужно ли отрисовывать финальную нумерацию
* @returns {boolean}
*/
ParaNumbering.prototype.HaveFinalNumbering = function()
ParaNumbering.prototype.haveFinalNumbering = function()
{
return !!this.Internal.FinalNumInfo;
};
@ -240,10 +240,32 @@ ParaNumbering.prototype.HaveFinalNumbering = function()
* Получаем ширину исходной нумерации
* @returns {number}
*/
ParaNumbering.prototype.GetSourceWidth = function()
ParaNumbering.prototype.getPrevNumWidth = function()
{
return this.Internal.SourceWidth;
};
/**
* Get the full width of the numbering element (including prev and final numberings)
*/
ParaNumbering.prototype.getNumWidth = function()
{
return this.WidthNum;
};
/**
* Get the width of the suffix
*/
ParaNumbering.prototype.getSuffWidth = function()
{
return this.WidthSuff;
};
/**
* Get visible width of the current numbering element
* @return {number}
*/
ParaNumbering.prototype.getVisibleWidth = function()
{
return this.WidthVisible;
};
ParaNumbering.prototype.GetFontSlot = function(oTextPr)
{
return AscWord.fontslot_Unknown;
@ -305,3 +327,7 @@ ParaPresentationNumbering.prototype.checkRange = function(Range, Line)
return false;
};
ParaPresentationNumbering.prototype.getVisibleWidth = function()
{
return this.WidthVisible;
};

View File

@ -1648,18 +1648,26 @@ Paragraph.prototype.private_RecalculateLineBottomBound = function(CurLine, CurPa
Paragraph.prototype.private_RecalculateLineCheckRanges = function(CurLine, CurPage, PRS, ParaPr)
{
var Right = this.Pages[CurPage].XLimit - ParaPr.Ind.Right;
var Top = PRS.LineTop;
var Bottom = PRS.LineBottom;
var Top2 = PRS.LineTop2;
var Bottom2 = PRS.LineBottom2;
var Left;
if(true === PRS.MathNotInline)
Left = this.Pages[CurPage].X;
else
Left = false === PRS.UseFirstLine ? this.Pages[CurPage].X + ParaPr.Ind.Left : this.Pages[CurPage].X + ParaPr.Ind.Left + ParaPr.Ind.FirstLine;
var Left = this.Pages[CurPage].X;
var Right = this.Pages[CurPage].XLimit;
if (!PRS.MathNotInline)
{
if (ParaPr.Bidi)
{
Left += ParaPr.Ind.Right;
Right -= PRS.UseFirstLine ? ParaPr.Ind.Left + ParaPr.Ind.FirstLine : ParaPr.Ind.Left;
}
else
{
Right -= ParaPr.Ind.Right;
Left += PRS.UseFirstLine ? ParaPr.Ind.Left + ParaPr.Ind.FirstLine : ParaPr.Ind.Left;
}
}
var PageFields = null;
if (this.bFromDocument && PRS.GetTopDocument() === this.LogicDocument && !PRS.IsInTable())
@ -2315,56 +2323,72 @@ Paragraph.prototype.private_RecalculateRangeEndPos = function(PRS, PRP, Dept
Paragraph.prototype.private_RecalculateGetTabPos = function(PRS, X, ParaPr, CurPage, NumTab)
{
var PageStart = this.Parent.Get_PageContentStartPos2(this.PageNum, this.ColumnNum, CurPage, this.Index);
if ( undefined != this.Get_FramePr() )
PageStart.X = 0;
else if ( PRS.RangesCount > 0 && Math.abs(PRS.Ranges[0].X0 - PageStart.X) < 0.001 )
PageStart.X = PRS.Ranges[0].X1;
// Если у данного параграфа есть табы, тогда ищем среди них
var TabsCount = ParaPr.Tabs.Get_Count();
// Добавим в качестве таба левую границу
var TabsPos = [];
var bCheckLeft = true;
for ( var Index = 0; Index < TabsCount; Index++ )
{
var Tab = ParaPr.Tabs.Get(Index);
var TabPos = Tab.Pos + PageStart.X;
if ( true === bCheckLeft && TabPos > PageStart.X + ParaPr.Ind.Left )
{
TabsPos.push( new CParaTab(tab_Left, ParaPr.Ind.Left ) );
bCheckLeft = false;
}
if ( tab_Clear != Tab.Value )
TabsPos.push( Tab );
}
if ( true === bCheckLeft )
TabsPos.push( new CParaTab(tab_Left, ParaPr.Ind.Left ) );
TabsCount = TabsPos.length;
var Tab = null;
for ( var Index = 0; Index < TabsCount; Index++ )
{
var TempTab = TabsPos[Index];
// TODO: Пока здесь сделаем поправку на погрешность. Когда мы сделаем так, чтобы все наши значения хранились
// в тех же единицах, что и в формате Docx, тогда и здесь можно будет вернуть обычное сравнение (см. баг 22586)
// Разница с NumTab возникла из-за бага 22586, везде нестрогое оставлять нельзя из-за бага 32051.
var twX = AscCommon.MMToTwips(X);
var twTabPos = AscCommon.MMToTwips(TempTab.Pos + PageStart.X);
if ((true === NumTab && twX <= twTabPos) || (true !== NumTab && twX < twTabPos))
{
Tab = TempTab;
break;
}
}
let contentFrame = this.Parent.Get_PageContentStartPos2(this.PageNum, this.ColumnNum, CurPage, this.Index);
let startX = contentFrame.X;
let endX = contentFrame.XLimit;
let paraFrame = this.Get_FramePr();
if (paraFrame)
{
startX = 0;
endX = paraFrame.W;
}
if (PRS.RangesCount > 0 && Math.abs(PRS.Ranges[0].X0 - contentFrame.X) < 0.001)
startX = PRS.Ranges[0].X1;
if (this.isRtlDirection())
{
let pageRel = this.private_GetRelativePageIndex(CurPage);
let pageLimits = this.Parent.Get_PageLimits(pageRel);
let range = this.Lines[PRS.Line].Ranges[PRS.Range];
X = X - range.X + pageLimits.XLimit - range.XEnd;
startX = pageLimits.XLimit - endX;
}
// Если у данного параграфа есть табы, тогда ищем среди них
// Добавим в качестве таба левую границу
let tabs = [];
let addLefInd = true;
let paraTabs = ParaPr.Tabs;
for (let tabIndex = 0, tabCount = paraTabs.GetCount(); tabIndex < tabCount; ++tabIndex)
{
let tab = paraTabs.Get(tabIndex);
let tabPos = tab.Pos + startX;
if (addLefInd && tabPos > startX + ParaPr.Ind.Left)
{
tabs.push(new CParaTab(tab_Left, ParaPr.Ind.Left));
addLefInd = false;
}
if (tab_Clear !== tab.Value)
tabs.push(tab);
}
if (addLefInd)
tabs.push(new CParaTab(tab_Left, ParaPr.Ind.Left));
let customTab = null;
for (let tabIndex = 0, tabCount = tabs.length; tabIndex < tabCount; ++tabIndex)
{
let tab = tabs[tabIndex];
// TODO: Пока здесь сделаем поправку на погрешность. Когда мы сделаем так, чтобы все наши значения хранились
// в тех же единицах, что и в формате Docx, тогда и здесь можно будет вернуть обычное сравнение (см. баг 22586)
// Разница с NumTab возникла из-за бага 22586, везде нестрогое оставлять нельзя из-за бага 32051.
let twX = AscCommon.MMToTwips(X);
let twTabPos = AscCommon.MMToTwips(tab.Pos + startX);
if ((true === NumTab && twX <= twTabPos) || (true !== NumTab && twX < twTabPos))
{
customTab = tab;
break;
}
}
var isTabToRightEdge = false;
@ -2372,11 +2396,15 @@ Paragraph.prototype.private_RecalculateGetTabPos = function(PRS, X, ParaPr, CurP
// Если табов нет, либо их позиции левее текущей позиции ставим таб по умолчанию
var DefTab = ParaPr.DefaultTab != null ? ParaPr.DefaultTab : AscCommonWord.Default_Tab_Stop;
if ( null === Tab )
if (customTab)
{
NewX = customTab.Pos + startX;
}
else
{
if ( X < PageStart.X + ParaPr.Ind.Left )
if ( X < startX + ParaPr.Ind.Left )
{
NewX = PageStart.X + ParaPr.Ind.Left;
NewX = startX + ParaPr.Ind.Left;
}
else if (DefTab < 0.001)
{
@ -2384,7 +2412,7 @@ Paragraph.prototype.private_RecalculateGetTabPos = function(PRS, X, ParaPr, CurP
}
else
{
NewX = PageStart.X;
NewX = startX;
while ( X >= NewX - 0.001 )
NewX += DefTab;
}
@ -2393,28 +2421,24 @@ Paragraph.prototype.private_RecalculateGetTabPos = function(PRS, X, ParaPr, CurP
// то мы ограничиваем его правым полем документа, но только если правый отступ параграфа
// неположителен (<= 0). (смотри bug 32345)
var twX = AscCommon.MMToTwips(X);
var twEndPos = AscCommon.MMToTwips(PageStart.XLimit);
var twEndPos = AscCommon.MMToTwips(endX);
var twNewX = AscCommon.MMToTwips(NewX);
if (twX < twEndPos && twNewX >= twEndPos && AscCommon.MMToTwips(ParaPr.Ind.Right) <= 0)
{
NewX = PageStart.XLimit;
NewX = endX;
isTabToRightEdge = true;
}
}
else
{
NewX = Tab.Pos + PageStart.X;
}
return {
NewX : NewX,
TabValue : Tab ? Tab.Value : tab_Left,
DefaultTab : Tab ? false : true,
TabLeader : Tab ? Tab.Leader : Asc.c_oAscTabLeader.None,
TabWidth : NewX - X,
TabValue : customTab ? customTab.Value : tab_Left,
DefaultTab : !customTab,
TabLeader : customTab ? customTab.Leader : Asc.c_oAscTabLeader.None,
TabRightEdge : isTabToRightEdge,
PageX : PageStart.X,
PageXLimit : PageStart.XLimit
PageX : startX,
PageXLimit : endX
};
};
@ -3111,6 +3135,10 @@ CParaLineRange.prototype.IsZeroRange = function()
{
return ((this.XEnd - this.X) < 0.001);
};
CParaLineRange.prototype.getXEndOrigin = function()
{
return (undefined !== this.XEndOrigin ? this.XEndOrigin : this.XEnd);
};
AscWord.CParaLineRange = CParaLineRange;
function CParaPage(X, Y, XLimit, YLimit, FirstLine)
@ -3657,11 +3685,19 @@ CParagraphRecalculateStateWrap.prototype.Recalculate_Numbering = function(Item,
var NumPr = ParaPr.NumPr;
if (NumPr && (undefined === NumPr.NumId || 0 === NumPr.NumId || "0" === NumPr.NumId))
if (!NumPr || !NumPr.IsValid())
NumPr = undefined;
if (oPrevNumPr && (undefined === oPrevNumPr.NumId || 0 === oPrevNumPr.NumId || "0" === oPrevNumPr.NumId || undefined === oPrevNumPr.Lvl))
if (!oPrevNumPr || !oPrevNumPr.IsValid())
{
oPrevNumPr = undefined;
}
else
{
oPrevNumPr = oPrevNumPr.Copy();
if (undefined === oPrevNumPr.Lvl)
oPrevNumPr.Lvl = 0;
}
var isHaveNumbering = false;
if ((undefined === Para.Get_SectionPr() || true !== Para.IsEmpty()) && (NumPr || oPrevNumPr))
@ -3863,10 +3899,7 @@ CParagraphRecalculateStateWrap.prototype.Recalculate_Numbering = function(Item,
}
case Asc.c_oAscNumberingSuff.Tab:
{
var NewX = Para.private_RecalculateGetTabPos(this, X, ParaPr, CurPage, true).NewX;
NumberingItem.WidthSuff = NewX - X;
NumberingItem.WidthSuff = Para.private_RecalculateGetTabPos(this, X, ParaPr, CurPage, true).TabWidth;
break;
}
}

View File

@ -4514,7 +4514,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
WordLen = 0;
var TabPos = Para.private_RecalculateGetTabPos(PRS, X, ParaPr, PRS.Page, false);
var NewX = TabPos.NewX;
var NewX = X + TabPos.TabWidth;
var TabValue = TabPos.TabValue;
Item.SetLeader(TabPos.TabLeader, this.Get_CompiledPr(false));
@ -4535,8 +4535,11 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
// В Word2013 и раньше, если не левый таб заканчивается правее правой границы, тогда у параграфа
// правая граница имеет максимально возможное значение (55см)
if (AscCommon.MMToTwips(TabPos.NewX) > AscCommon.MMToTwips(XEnd) && nCompatibilityMode <= AscCommon.document_compatibility_mode_Word14)
if (AscCommon.MMToTwips(NewX) > AscCommon.MMToTwips(XEnd) && nCompatibilityMode <= AscCommon.document_compatibility_mode_Word14)
{
// TODO: Временно сделаем так. По-хорошему надо помечать промежуток, что в нем не учитывается границы при расчете переносов,
// а XEnd не менять
Para.Lines[PRS.Line].Ranges[PRS.Range].XEndOrigin = Para.Lines[PRS.Line].Ranges[PRS.Range].XEnd;
Para.Lines[PRS.Line].Ranges[PRS.Range].XEnd = 558.7;
XEnd = 558.7;
PRS.XEnd = XEnd;
@ -5751,7 +5754,7 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange,
case para_End:
{
Item.CheckMark(PRSA.Paragraph, PRSA.XEnd - PRSA.X);
PRSA.X += Item.GetWidth();
PRSA.X += Item.GetWidthVisible();
break;
}

View File

@ -11321,16 +11321,20 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curNot
this.ReadAsTable = function(OpenContent)
{
var oThis = this;
return this.bcr.ReadTable(function(t, l){
const res = this.bcr.ReadTable(function(t, l){
return oThis.ReadDocumentContent(t, l, OpenContent);
});
this.oReadResult.checkDocumentContentReviewType(OpenContent);
return res;
};
this.Read = function(length, OpenContent)
{
var oThis = this;
return this.bcr.Read1(length, function(t, l){
const res = this.bcr.Read1(length, function(t, l){
return oThis.ReadDocumentContent(t, l, OpenContent);
});
this.oReadResult.checkDocumentContentReviewType(OpenContent);
return res;
};
this.ReadDocumentContent = function(type, length, Content)
{
@ -11342,10 +11346,8 @@ function Binary_DocumentTableReader(doc, oReadResult, openParams, stream, curNot
res = this.bcr.Read1(length, function(t, l){
return oThis.ReadParagraph(t,l, oNewParagraph);
});
if (reviewtype_Common === oNewParagraph.GetReviewType() || this.oReadResult.checkReadRevisions()) {
oNewParagraph.Correct_Content();
Content.push(oNewParagraph);
}
}
else if ( c_oSerParType.Table === type )
{
@ -17695,6 +17697,28 @@ DocReadResult.prototype = {
else
elem.SetNumPr(numId, iLvl);
}
},
checkDocumentContentReviewType: function (arrContent) {
if (!arrContent.length) {
return;
}
if (this.disableRevisions) {
const oLastElement = arrContent[arrContent.length - 1];
if (oLastElement instanceof AscWord.Paragraph && oLastElement.GetReviewType() === reviewtype_Remove) {
oLastElement.SetReviewType(reviewtype_Common);
}
for (let i = arrContent.length - 2; i >= 0; i -= 1) {
const oPrevElement = arrContent[i];
const oNextElement = arrContent[i + 1];
if (oPrevElement instanceof AscWord.Paragraph && oPrevElement.GetReviewType() === reviewtype_Remove) {
oPrevElement.SetReviewType(reviewtype_Common);
if (oNextElement instanceof AscWord.Paragraph) {
oPrevElement.Concat(oNextElement);
arrContent.splice(i + 1, 1);
}
}
}
}
}
};
//---------------------------------------------------------export---------------------------------------------------

View File

@ -205,6 +205,7 @@ CInlineLevelSdt.prototype.private_CopyPrTo = function(oContentControl, oPr)
oContentControl.SetTag(this.GetTag());
oContentControl.SetAlias(this.GetAlias());
oContentControl.SetContentControlLock(this.GetContentControlLock());
oContentControl.SetContentControlId(this.GetContentControlId());
oContentControl.SetAppearance(this.GetAppearance());
oContentControl.SetColor(this.GetColor());

View File

@ -899,8 +899,6 @@
this.CollaborativeMarksShowType = c_oAscCollaborativeMarksShowType.All;
this.stylePainter = null;
this.forceSaveDisconnectRequest = false;
// объекты, нужные для отправки в тулбар (шрифты, стили)
this._gui_control_colors = null;
@ -2662,7 +2660,10 @@ background-repeat: no-repeat;\
// Принимаем чужие изменения
var HaveOtherChanges = AscCommon.CollaborativeEditing.Have_OtherChanges();
AscCommon.CollaborativeEditing.Apply_Changes();
// Собираем тут события, которые нужно послать на завершении сохранения
let onSaveEnd = [];
this.CoAuthoringApi.onUnSaveLock = function()
{
t.CoAuthoringApi.onUnSaveLock = null;
@ -2695,6 +2696,8 @@ background-repeat: no-repeat;\
if (t.canUnlockDocument) {
t._unlockDocument();
}
onSaveEnd.forEach(function(f){f();});
};
let cursorInfo = null;
@ -2724,18 +2727,30 @@ background-repeat: no-repeat;\
sendChanges();
this._sendForm();
}
else if (this.forceSaveOformRequest)
{
this.forceSaveOformRequest = false;
AscCommon.CollaborativeEditing.Set_GlobalLock(false);
sendChanges();
onSaveEnd.push(function(){
t.sendEvent("asc_onCompletePreparingOForm");
});
}
else
{
sendChanges();
if (this.forceSaveDisconnectRequest)
{
this.forceSaveDisconnectRequest = false;
AscCommon.CollaborativeEditing.Set_GlobalLock(false);
this.setViewModeDisconnect(true);
this.asc_coAuthoringDisconnect();
this.sendEvent("asc_onDisconnectEveryone");
}
}
// Этот флаг может быть включен дополнительно к любому другому
if (this.forceSaveDisconnectRequest)
{
this.forceSaveDisconnectRequest = false;
AscCommon.CollaborativeEditing.Set_GlobalLock(false);
this.setViewModeDisconnect(true);
this.asc_coAuthoringDisconnect();
onSaveEnd.push(function(){
t.sendEvent("asc_onDisconnectEveryone");
});
}
};
asc_docs_api.prototype._autoSaveInner = function () {
@ -11441,8 +11456,11 @@ background-repeat: no-repeat;\
{
this.forceSaveDisconnectRequest = true;
AscCommon.CollaborativeEditing.Set_GlobalLock(true);
this.asc_Save(false);
}
this.forceSaveOformRequest = true;
AscCommon.CollaborativeEditing.Set_GlobalLock(true);
this.asc_Save(false);
};

View File

@ -3092,7 +3092,7 @@
/**
* Class representing a document.
* @constructor
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @extends {ApiDocumentContent}
*/
function ApiDocument(Document)
@ -4374,6 +4374,11 @@
* @see office-js-api/Examples/Enumerations/WatermarkDirection.js
*/
/**
* @typedef {string} Base64Img Base64 image string
* @example "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgA..."
*/
/**
* Returns the main document.
* @memberof Api
@ -4575,9 +4580,9 @@
* @memberof Api
* @typeofeditors ["CDE"]
* @param {ChartType} [chartType="bar"] - The chart type used for the chart display.
* @param {Array} series - The array of the data used to build the chart from.
* @param {Array} seriesNames - The array of the names (the source table column names) used for the data which the chart will be build from.
* @param {Array} catNames - The array of the names (the source table row names) used for the data which the chart will be build from.
* @param {number[][]} series - The array of the data used to build the chart from.
* @param {number[] | string[]} seriesNames - The array of the names (the source table column names) used for the data which the chart will be build from.
* @param {number[] | string[]} catNames - The array of the names (the source table row names) used for the data which the chart will be build from.
* @param {EMU} width - The chart width in English measure units.
* @param {EMU} height - The chart height in English measure units.
* @param {number} styleIndex - The chart color style index (can be 1 - 48, as described in OOXML specification).
@ -4690,7 +4695,7 @@
* Creates a linear gradient fill to apply to the object using the selected linear gradient as the object background.
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {Array} gradientStops - The array of gradient color stops measured in 1000th of percent.
* @param {number[]} gradientStops - The array of gradient color stops measured in 1000th of percent.
* @param {PositiveFixedAngle} angle - The angle measured in 60000th of a degree that will define the gradient direction.
* @returns {ApiFill}
* @see office-js-api/Examples/{Editor}/Api/Methods/CreateLinearGradientFill.js
@ -4705,7 +4710,7 @@
* Creates a radial gradient fill to apply to the object using the selected radial gradient as the object background.
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {Array} gradientStops - The array of gradient color stops measured in 1000th of percent.
* @param {number[]} gradientStops - The array of gradient color stops measured in 1000th of percent.
* @returns {ApiFill}
* @see office-js-api/Examples/{Editor}/Api/Methods/CreateRadialGradientFill.js
*/
@ -4806,7 +4811,7 @@
/**
* Creates a bullet for a paragraph with the numbering character or symbol specified with the numType parameter.
* @memberof Api
* @typeofeditors ["CDE"]
* @typeofeditors ["CPE", "CSE"]
* @param {BulletType} numType - The numbering type the paragraphs will be numbered with.
* @param {number} startAt - The number the first numbered paragraph will start with.
* @returns {ApiBullet}
@ -5092,14 +5097,12 @@
var oResult = null;
if (oParsedObj["styles"])
oReader.StylesFromJSON(oParsedObj["styles"]);
if (oParsedObj["numbering"])
oReader.parsedNumbering = oParsedObj["numbering"];
switch (oParsedObj["type"])
{
case "document":
if (oParsedObj["numbering"])
{
oReader.parsedNumbering = oParsedObj["numbering"];
}
if (oParsedObj["textPr"])
{
var oNewTextPr = oReader.TextPrFromJSON(oParsedObj["textPr"]);
@ -5601,7 +5604,7 @@
* @memberof ApiDocumentContent
* @typeofeditors ["CDE"]
* @param {boolean} bGetCopies - Specifies if the copies of the document elements will be returned or not.
* @returns {Array}
* @returns {DocumentElement[]}
* @see office-js-api/Examples/{Editor}/ApiDocumentContent/Methods/GetContent.js
*/
ApiDocumentContent.prototype.GetContent = function(bGetCopies)
@ -6054,29 +6057,40 @@
};
/**
* Record of one comment.
* Represents a single comment record.
* @typedef {Object} CommentReportRecord
* @property {boolean} [IsAnswer=false] - Specifies whether this is an initial comment or a reply to another comment.
* @property {string} CommentMessage - The text of the current comment.
* @property {number} Date - The time when this change was made in local time.
* @property {number} DateUTC - The time when this change was made in UTC.
* @property {string} [QuoteText=undefined] - The text to which this comment is related.
* @see office-js-api/Examples/Enumerations/CommentReportRecord.js
* @property {boolean} IsAnswer Whether the comment is a response.
* @property {string} CommentMessage The comment text.
* @property {number} Date Local timestamp of the comment.
* @property {number} DateUTC UTC timestamp of the comment.
* @property {string} [QuoteText] The quoted text (if available).
*/
/**
* Report on all comments.
* This is a dictionary where the keys are usernames.
* @typedef {Object.<string, Array.<CommentReportRecord>>} CommentReport
* Represents a user's comment history.
* @typedef {Object} UserComments
* @property {CommentReportRecord[]} comments List of comments.
*/
/**
* A dictionary of users and their comments.
* @typedef {Object} CommentReport
* @property {UserComments} [username] Comments grouped by username.
* @example
* {
* "John Smith" : [{IsAnswer: false, CommentMessage: 'Good text', Date: 1688588002698, DateUTC: 1688570002698, QuoteText: 'Some text'},
* {IsAnswer: true, CommentMessage: "I don't think so", Date: 1688588012661, DateUTC: 1688570012661}],
*
* "Mark Pottato" : [{IsAnswer: false, CommentMessage: 'Need to change this part', Date: 1688587967245, DateUTC: 1688569967245, QuoteText: 'The quick brown fox jumps over the lazy dog'},
* {IsAnswer: false, CommentMessage: 'We need to add a link', Date: 1688587967245, DateUTC: 1688569967245, QuoteText: 'OnlyOffice'}]
* }
* @see office-js-api/Examples/Enumerations/CommentReport.js
* {
* "John Smith": {
* comments: [
* { IsAnswer: false, CommentMessage: "Good text", Date: 1688588002698, DateUTC: 1688570002698, QuoteText: "Some text" },
* { IsAnswer: true, CommentMessage: "I don't think so", Date: 1688588012661, DateUTC: 1688570012661 }
* ]
* },
* "Mark Pottato": {
* comments: [
* { IsAnswer: false, CommentMessage: "Need to change this part", Date: 1688587967245, DateUTC: 1688569967245, QuoteText: "The quick brown fox jumps over the lazy dog" },
* { IsAnswer: false, CommentMessage: "We need to add a link", Date: 1688587967245, DateUTC: 1688569967245, QuoteText: "OnlyOffice" }
* ]
* }
* }
*/
@ -6138,27 +6152,39 @@
*/
/**
* Record of one review change.
* Represents a single review change record.
* @typedef {Object} ReviewReportRecord
* @property {ReviewReportRecordType} Type - Review record type.
* @property {string} [Value=undefined] - Review change value that is set for the "TextAdd" and "TextRem" types only.
* @property {number} Date - The time when this change was made.
* @property {ApiParagraph | ApiTable} ReviewedElement - Element that has been reviewed.
* @see office-js-api/Examples/Enumerations/ReviewReportRecord.js
* @property {ReviewReportRecordType} Type Review record type.
* @property {string} [Value] Review change value (only for "TextAdd" and "TextRem" types).
* @property {number} Date Timestamp of when the change was made.
* @property {ApiParagraph | ApiTable} ReviewedElement The element that was reviewed.
*/
/**
* Report on all review changes.
* This is a dictionary where the keys are usernames.
* @typedef {Object.<string, Array.<ReviewReportRecord>>} ReviewReport
* Represents a user's review history.
* @typedef {Object} UserReviewChanges
* @property {ReviewReportRecord[]} reviews List of review records.
*/
/**
* A dictionary of users and their review changes.
* @typedef {Object} ReviewReport
* @property {UserReviewChanges} [username] Review changes grouped by username.
* @example
* {
* "John Smith" : [{Type: 'TextRem', Value: 'Hello, Mark!', Date: 1679941734161, Element: ApiParagraph},
* {Type: 'TextAdd', Value: 'Dear Mr. Pottato.', Date: 1679941736189, Element: ApiParagraph}],
* "Mark Pottato" : [{Type: 'ParaRem', Date: 1679941755942, ReviewedElement: ApiParagraph},
* {Type: 'TextPr', Date: 1679941757832, ReviewedElement: ApiParagraph}]
* }
* @see office-js-api/Examples/Enumerations/ReviewReport.js
* {
* "John Smith": {
* reviews: [
* { Type: "TextRem", Value: "Hello, Mark!", Date: 1679941734161, ReviewedElement: ApiParagraph },
* { Type: "TextAdd", Value: "Dear Mr. Pottato.", Date: 1679941736189, ReviewedElement: ApiParagraph }
* ]
* },
* "Mark Pottato": {
* reviews: [
* { Type: "ParaRem", Date: 1679941755942, ReviewedElement: ApiParagraph },
* { Type: "TextPr", Date: 1679941757832, ReviewedElement: ApiParagraph }
* ]
* }
* }
*/
/**
@ -6338,7 +6364,7 @@
/**
* Returns a list of all tags that are used for all forms in the document.
* @memberof ApiDocument
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @returns {String[]}
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/GetTagsOfAllForms.js
*/
@ -6390,9 +6416,9 @@
/**
* Returns a list of all forms in the document with the specified tag name.
* @memberof ApiDocument
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @param sTag {string} - Form tag.
* @returns {ApiBlockLvlSdt[] | ApiInlineLvlSdt[]}
* @returns {ApiForm[]}
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/GetFormsByTag.js
*/
ApiDocument.prototype.GetFormsByTag = function(sTag)
@ -6438,7 +6464,7 @@
* Returns the data from all forms present in the current document.
* If a form was created and not assigned to any part of the document, it won't appear in this list.
* @memberof ApiDocument
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @returns {Array.<FormData>}
* @since 8.0.0
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/GetFormsData.js
@ -6450,7 +6476,7 @@
/**
* Sets the data to the specified forms.
* @memberof ApiDocument
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @param {Array.<FormData>} arrData - An array of form data to set to the specified forms.
* @since 8.0.0
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/SetFormsData.js
@ -6765,9 +6791,9 @@
* Inserts a watermark on each document page.
* @memberof ApiDocument
* @typeofeditors ["CDE"]
* @param {?string} [sText="WATERMARK"] - Watermark text.
* @param {?boolean} [bIsDiagonal=false] - Specifies if the watermark is placed diagonally (true) or horizontally (false).
* @returns {?ApiDrawing} - The object which represents the inserted watermark. Returns null if the watermark type is "none".
* @param {string} [sText="WATERMARK"] - Watermark text.
* @param {boolean} [bIsDiagonal=false] - Specifies if the watermark is placed diagonally (true) or horizontally (false).
* @returns {boolean}
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/InsertWatermark.js
*/
ApiDocument.prototype.InsertWatermark = function(sText, bIsDiagonal){
@ -7024,7 +7050,7 @@
/**
* Returns all existing forms in the document.
* @memberof ApiDocument
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @returns {ApiForm[]}
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/GetAllForms.js
*/
@ -7046,7 +7072,7 @@
/**
* Clears all forms in the document.
* @memberof ApiDocument
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/ClearAllFields.js
*/
ApiDocument.prototype.ClearAllFields = function()
@ -7062,7 +7088,7 @@
* @param {byte} g - Green color component value.
* @param {byte} b - Blue color component value.
* @param {boolean} [bNone=false] - Defines that highlight will not be set.
* @typeofeditors ["CDE"]
* @typeofeditors ["CDE", "CFE"]
* @see office-js-api/Examples/{Editor}/ApiDocument/Methods/SetFormsHighlight.js
*/
ApiDocument.prototype.SetFormsHighlight = function(r, g, b, bNone)
@ -7462,7 +7488,12 @@
if (Array.isArray(oTocPr["BuildFrom"]["StylesLvls"]) && oTocPr["BuildFrom"]["StylesLvls"].length > 0)
{
oTargetPr.Styles = oTocPr["BuildFrom"]["StylesLvls"];
oTargetPr.Styles = oTocPr["BuildFrom"]["StylesLvls"].map(function(styleLvl) {
return {
Name: styleLvl['Name'],
Lvl: styleLvl['Lvl']
}
});
oTargetPr.OutlineEnd = -1;
oTargetPr.OutlineStart = -1;
}
@ -10501,7 +10532,7 @@
/**
* Sets a style to the current run.
* @memberof ApiRun
* @typeofeditors ["CDE", "CSE", "CPE"]
* @typeofeditors ["CDE"]
* @param {ApiStyle} oStyle - The style which must be applied to the text run.
* @returns {ApiTextPr}
* @see office-js-api/Examples/{Editor}/ApiRun/Methods/SetStyle.js
@ -12541,7 +12572,7 @@
* Removes a column containing the current cell.
* @memberof ApiTableCell
* @typeofeditors ["CDE"]
* @returns {bool | null} Is the table empty after removing. Returns null if parent table doesn't exist.
* @returns {?boolean} - removes null if table doen't exist
* @see office-js-api/Examples/{Editor}/ApiTableCell/Methods/RemoveColumn.js
*/
ApiTableCell.prototype.RemoveColumn = function()
@ -16122,7 +16153,7 @@
* Returns the lock value for the specified lock type of the current drawing.
* @typeofeditors ["CDE"]
* @param {DrawingLockType} sType - Lock type in the string format.
* @returns {bool}
* @returns {boolean}
* @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/GetLockValue.js
*/
ApiDrawing.prototype.GetLockValue = function(sType)
@ -16142,8 +16173,8 @@
* Sets the lock value to the specified lock type of the current drawing.
* @typeofeditors ["CDE"]
* @param {DrawingLockType} sType - Lock type in the string format.
* @param {bool} bValue - Specifies if the specified lock is applied to the current drawing.
* @returns {bool}
* @param {boolean} bValue - Specifies if the specified lock is applied to the current drawing.
* @returns {boolean}
* @see office-js-api/Examples/{Editor}/ApiDrawing/Methods/SetLockValue.js
*/
ApiDrawing.prototype.SetLockValue = function(sType, bValue)
@ -16553,7 +16584,7 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} sTitle - The title which will be displayed for the current chart.
* @param {pt} nFontSize - The text size value measured in points.
* @param {?bool} bIsBold - Specifies if the chart title is written in bold font or not.
* @param {?boolean} bIsBold - Specifies if the chart title is written in bold font or not.
* @see office-js-api/Examples/{Editor}/ApiChart/Methods/SetTitle.js
*/
ApiChart.prototype.SetTitle = function (sTitle, nFontSize, bIsBold)
@ -16567,7 +16598,7 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} sTitle - The title which will be displayed for the horizontal axis of the current chart.
* @param {pt} nFontSize - The text size value measured in points.
* @param {?bool} bIsBold - Specifies if the horizontal axis title is written in bold font or not.
* @param {?boolean} bIsBold - Specifies if the horizontal axis title is written in bold font or not.
* @see office-js-api/Examples/{Editor}/ApiChart/Methods/SetHorAxisTitle.js
*/
ApiChart.prototype.SetHorAxisTitle = function (sTitle, nFontSize, bIsBold)
@ -16581,7 +16612,7 @@
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {string} sTitle - The title which will be displayed for the vertical axis of the current chart.
* @param {pt} nFontSize - The text size value measured in points.
* @param {?bool} bIsBold - Specifies if the vertical axis title is written in bold font or not.
* @param {?boolean} bIsBold - Specifies if the vertical axis title is written in bold font or not.
* @see office-js-api/Examples/{Editor}/ApiChart/Methods/SetVerAxisTitle.js
*/
ApiChart.prototype.SetVerAxisTitle = function (sTitle, nFontSize, bIsBold)
@ -17701,12 +17732,18 @@
* @memberof ApiInlineLvlSdt
* @typeofeditors ["CDE"]
* @since 8.3.2
* @param {string} id - The id which will be specified to the current content control.
* @param {number} id - The numerical id which will be specified to the current content control.
* @returns {boolean}
* @see office-js-api/Examples/{Editor}/ApiInlineLvlSdt/Methods/SetId.js
*/
ApiInlineLvlSdt.prototype.SetId = function(id)
{
this.Sdt.SetContentControlId(id);
let _id = GetIntParameter(id, null);
if (null === _id)
return false;
this.Sdt.SetContentControlId(_id);
return true;
};
/**
@ -18447,7 +18484,7 @@
* Adds a new value to the combo box / dropdown list content control.
* @memberof ApiContentControlList
* @param {string} sText - The display text for the list item.
* @param {string} [sValue=sText] - The list item value.
* @param {string} sValue - The list item value. By default is equal to sText parameter
* @param {number} [nIndex=this.GetElementsCount()] - A position where a new value will be added.
* @typeofeditors ["CDE"]
* @returns {boolean}
@ -18775,13 +18812,10 @@
* @memberof ApiBlockLvlSdt
* @typeofeditors ["CDE"]
* @since 8.3.2
* @param {string} id - The id which will be specified to the current content control.
* @param {number} id - The numerical id which will be specified to the current content control.
* @see office-js-api/Examples/{Editor}/ApiBlockLvlSdt/Methods/SetId.js
*/
ApiBlockLvlSdt.prototype.SetId = function(id)
{
this.Sdt.SetContentControlId(id);
};
ApiBlockLvlSdt.prototype.SetId = ApiInlineLvlSdt.prototype.SetId;
/**
* Gets a unique ID for the current content control.
@ -20421,7 +20455,7 @@
* Returns an image in the base64 format from the current picture form.
* @memberof ApiPictureForm
* @typeofeditors ["CDE", "CFE"]
* @returns {base64img}
* @returns {Base64Img}
* @see office-js-api/Examples/{Editor}/ApiPictureForm/Methods/GetImage.js
*/
ApiPictureForm.prototype.GetImage = function()
@ -20908,7 +20942,7 @@
* Replaces each paragraph (or text in cell) in the select with the corresponding text from an array of strings.
* @memberof Api
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {Array} textStrings - An array of replacement strings.
* @param {string[]} textStrings - An array of replacement strings.
* @param {string} [tab="\t"] - A character which is used to specify the tab in the source text.
* @param {string} [newLine="\r\n"] - A character which is used to specify the line break character in the source text.
* @see office-js-api/Examples/{Editor}/Api/Methods/ReplaceTextSmart.js
@ -23304,6 +23338,14 @@
return defaultValue;
}
function GetIntParameter(parameter, defaultValue)
{
let result = parseInt(parameter);
if (isNaN(result) || ("" + result) !== ("" + parameter))
return defaultValue;
return result;
}
/**
* В проверке на лок, которую мы делаем после выполнения скрипта, нужно различать действия сделанные через
* разрешенные методы, и действия, которые пользователь пытался сам сделать с формами
@ -23322,6 +23364,7 @@
window['AscBuilder'].GetStringParameter = GetStringParameter;
window['AscBuilder'].GetBoolParameter = GetBoolParameter;
window['AscBuilder'].GetNumberParameter = GetNumberParameter;
window['AscBuilder'].GetIntParameter = GetIntParameter;
window['AscBuilder'].GetArrayParameter = GetArrayParameter;
window['AscBuilder'].executeNoFormLockCheck = executeNoFormLockCheck;

View File

@ -125,6 +125,13 @@
* @see office-js-api/Examples/Plugins/{Editor}/Enumeration/TextPartType.js
*/
/**
* Content control list element
* @typedef {Object} ContentControlListElement
* @property {string} Display - element display text
* @property {string} Value - element value
*/
var Api = window["asc_docs_api"];
/**
@ -136,7 +143,7 @@
* @param {string[]} fields - A list of field values.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/OpenFile.js
*/
window["asc_docs_api"].prototype["pluginMethod_OpenFile"] = function(binaryFile, fields)
Api.prototype["pluginMethod_OpenFile"] = function(binaryFile, fields)
{
this.asc_CloseFile();
@ -156,7 +163,7 @@
* @returns {string[]} - A list of field values.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetFields.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetFields"] = function()
Api.prototype["pluginMethod_GetFields"] = function()
{
return this.asc_GetBlockChainData();
};
@ -169,7 +176,7 @@
* @return {ContentControlProperties[]} - An array of created content control properties.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/InsertAndReplaceContentControls.js
*/
window["asc_docs_api"].prototype["pluginMethod_InsertAndReplaceContentControls"] = function(arrDocuments)
Api.prototype["pluginMethod_InsertAndReplaceContentControls"] = function(arrDocuments)
{
var _worker = new AscCommon.CContentControlPluginWorker(this, arrDocuments);
return _worker.start();
@ -182,7 +189,7 @@
* @param {ContentControl[]} arrDocuments - An array of content control internal IDs. Example: [{"InternalId": "5_556"}].
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveContentControls.js
*/
window["asc_docs_api"].prototype["pluginMethod_RemoveContentControls"] = function(arrDocuments)
Api.prototype["pluginMethod_RemoveContentControls"] = function(arrDocuments)
{
var _worker = new AscCommon.CContentControlPluginWorker(this, arrDocuments);
return _worker.delete();
@ -195,7 +202,7 @@
* @returns {ContentControl[]} - An array of content control objects.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetAllContentControls.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetAllContentControls"] = function()
Api.prototype["pluginMethod_GetAllContentControls"] = function()
{
var _blocks = this.WordControl.m_oLogicDocument.GetAllContentControls();
var _ret = [];
@ -226,7 +233,7 @@
* @returns {ContentControlParentPr} - An object which contains the following values: Parent - content control parent, Pos - content control position within the parent object, Count - a number of elements in the parent object.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveContentControl.js
*/
window["asc_docs_api"].prototype["pluginMethod_RemoveContentControl"] = function(InternalId)
Api.prototype["pluginMethod_RemoveContentControl"] = function(InternalId)
{
return this.asc_RemoveContentControlWrapper(InternalId);
};
@ -238,7 +245,7 @@
* @returns {string} - The content control internal ID.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetCurrentContentControl.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetCurrentContentControl"] = function()
Api.prototype["pluginMethod_GetCurrentContentControl"] = function()
{
return this.asc_GetCurrentContentControl();
};
@ -251,7 +258,7 @@
* @returns {ContentControlProperties} - The content control properties.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetCurrentContentControlPr.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetCurrentContentControlPr"] = function(contentFormat)
Api.prototype["pluginMethod_GetCurrentContentControlPr"] = function(contentFormat)
{
var oLogicDocument = this.private_GetLogicDocument();
@ -318,7 +325,7 @@
* @param {string} id - A unique internal identifier of the content control.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SelectContentControl.js
*/
window["asc_docs_api"].prototype["pluginMethod_SelectContentControl"] = function(id)
Api.prototype["pluginMethod_SelectContentControl"] = function(id)
{
var oLogicDocument = this.private_GetLogicDocument();
if (!oLogicDocument)
@ -335,7 +342,7 @@
* @param {boolean} [isBegin = false] - Defines if the cursor position changes in the content control. By default, a cursor will be placed to the content control begin (**false**).
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/MoveCursorToContentControl.js
*/
window["asc_docs_api"].prototype["pluginMethod_MoveCursorToContentControl"] = function(id, isBegin)
Api.prototype["pluginMethod_MoveCursorToContentControl"] = function(id, isBegin)
{
var oLogicDocument = this.private_GetLogicDocument();
if (!oLogicDocument)
@ -350,7 +357,7 @@
* @alias RemoveSelectedContent
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveSelectedContent.js
*/
window["asc_docs_api"].prototype["pluginMethod_RemoveSelectedContent"] = function()
Api.prototype["pluginMethod_RemoveSelectedContent"] = function()
{
var oLogicDocument = this.private_GetLogicDocument();
if (!oLogicDocument || !oLogicDocument.IsSelectionUse())
@ -393,7 +400,7 @@
* @return {string | null} - The comment ID in the string format or null if the comment cannot be added.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddComment.js
*/
window["asc_docs_api"].prototype["pluginMethod_AddComment"] = function(oCommentData)
Api.prototype["pluginMethod_AddComment"] = function(oCommentData)
{
var oCD = undefined;
if (oCommentData)
@ -413,7 +420,7 @@
* @param {boolean} isMoveToMainContent - This flag ignores the current position and always moves a cursor to the beginning of the document body.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/MoveCursorToStart.js
*/
window["asc_docs_api"].prototype["pluginMethod_MoveCursorToStart"] = function(isMoveToMainContent)
Api.prototype["pluginMethod_MoveCursorToStart"] = function(isMoveToMainContent)
{
var oLogicDocument = this.private_GetLogicDocument();
if (oLogicDocument)
@ -433,7 +440,7 @@
* @param {boolean} isMoveToMainContent - This flag ignores the current position and always moves a cursor to the end of the document body.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/MoveCursorToEnd.js
*/
window["asc_docs_api"].prototype["pluginMethod_MoveCursorToEnd"] = function(isMoveToMainContent)
Api.prototype["pluginMethod_MoveCursorToEnd"] = function(isMoveToMainContent)
{
var oLogicDocument = this.private_GetLogicDocument();
if (oLogicDocument)
@ -455,7 +462,7 @@
* @param {boolean} [oProperties.matchCase=true] - Case sensitive or not.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SearchAndReplace.js
*/
window["asc_docs_api"].prototype["pluginMethod_SearchAndReplace"] = function(oProperties)
Api.prototype["pluginMethod_SearchAndReplace"] = function(oProperties)
{
var sReplace = oProperties["replaceString"];
@ -481,7 +488,7 @@
* @returns {boolean} returns false if text was not found
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SearchNext.js
*/
window["asc_docs_api"].prototype["pluginMethod_SearchNext"] = function(oProperties, isForward)
Api.prototype["pluginMethod_SearchNext"] = function(oProperties, isForward)
{
let logicDocument = this.WordControl.m_oLogicDocument;
if (!logicDocument)
@ -507,7 +514,7 @@
* @return {string} - The HTML file content in the string format.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetFileHTML.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetFileHTML"] = function()
Api.prototype["pluginMethod_GetFileHTML"] = function()
{
return this.ContentToHTML(true);
};
@ -519,7 +526,7 @@
* @returns {comment[]} - An array of comment objects containing the comment data.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetAllComments.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetAllComments"] = function()
Api.prototype["pluginMethod_GetAllComments"] = function()
{
var oLogicDocument = this.private_GetLogicDocument();
if (!oLogicDocument)
@ -544,7 +551,7 @@
* @alias RemoveComments
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveComments.js
*/
window["asc_docs_api"].prototype["pluginMethod_RemoveComments"] = function(arrIds)
Api.prototype["pluginMethod_RemoveComments"] = function(arrIds)
{
this.asc_RemoveAllComments(false, false, arrIds);
};
@ -557,7 +564,7 @@
* @param {CommentData} oCommentData - An object which contains the new comment data.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ChangeComment.js
*/
window["asc_docs_api"].prototype["pluginMethod_ChangeComment"] = function(sId, oCommentData)
Api.prototype["pluginMethod_ChangeComment"] = function(sId, oCommentData)
{
var oCD = undefined;
if (oCommentData)
@ -588,7 +595,7 @@
* @param {string} sId - The comment ID.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/MoveToComment.js
*/
window["asc_docs_api"].prototype["pluginMethod_MoveToComment"] = function(sId)
Api.prototype["pluginMethod_MoveToComment"] = function(sId)
{
this.asc_selectComment(sId);
this.asc_showComment(sId);
@ -605,7 +612,7 @@
* <b>original</b> - all rejected changes are displayed.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SetDisplayModeInReview.js
*/
window["asc_docs_api"].prototype["pluginMethod_SetDisplayModeInReview"] = function(sMode)
Api.prototype["pluginMethod_SetDisplayModeInReview"] = function(sMode)
{
var oLogicDocument = this.private_GetLogicDocument();
if (!oLogicDocument)
@ -630,7 +637,7 @@
* @returns {ContentControl} - A JSON object containing the data about the created content control.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddContentControl.js
*/
window["asc_docs_api"].prototype["pluginMethod_AddContentControl"] = function(type, commonPr)
Api.prototype["pluginMethod_AddContentControl"] = function(type, commonPr)
{
var _content_control_pr = readContentControlCommonPr(new AscCommon.CContentControlPr(), commonPr);
@ -658,7 +665,7 @@
* @param {ContentControlProperties} [commonPr = {}] - The common content control properties.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddContentControlCheckBox.js
*/
window["asc_docs_api"].prototype["pluginMethod_AddContentControlCheckBox"] = function(checkBoxPr, commonPr)
Api.prototype["pluginMethod_AddContentControlCheckBox"] = function(checkBoxPr, commonPr)
{
var oPr;
if (checkBoxPr)
@ -685,7 +692,7 @@
* @param {ContentControlProperties} [commonPr = {}] - The common content control properties.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddContentControlPicture.js
*/
window["asc_docs_api"].prototype["pluginMethod_AddContentControlPicture"] = function(commonPr)
Api.prototype["pluginMethod_AddContentControlPicture"] = function(commonPr)
{
var _content_control_pr = private_ReadContentControlCommonPr(commonPr);
@ -697,11 +704,11 @@
* @typeofeditors ["CDE"]
* @alias AddContentControlList
* @param {ContentControlType} type - A numeric value that specifies the content control type. It can have one of the following values: <b>1</b> (combo box), <b>0</b> (dropdown list).
* @param {Array<String, String>} [List = [{Display, Value}]] - A list of the content control elements that consists of two items: <b>Display</b> - an item that will be displayed to the user in the content control list, <b>Value</b> - a value of each item from the content control list.
* @param {ContentControlListElement[]} [List] - A list of the content control elements that consists of two items: <b>Display</b> - an item that will be displayed to the user in the content control list, <b>Value</b> - a value of each item from the content control list.
* @param {ContentControlProperties} [commonPr = {}] - The common content control properties.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddContentControlList.js
*/
window["asc_docs_api"].prototype["pluginMethod_AddContentControlList"] = function(type, List, commonPr)
Api.prototype["pluginMethod_AddContentControlList"] = function(type, List, commonPr)
{
var oPr;
if (List)
@ -735,7 +742,7 @@
* @param {ContentControlProperties} [commonPr = {}] - The common content control properties.
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddContentControlDatePicker.js
*/
window["asc_docs_api"].prototype["pluginMethod_AddContentControlDatePicker"] = function(datePickerPr, commonPr)
Api.prototype["pluginMethod_AddContentControlDatePicker"] = function(datePickerPr, commonPr)
{
var oPr;
if (datePickerPr)
@ -788,7 +795,7 @@
* @since 7.1.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetAllOleObjects.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetAllOleObjects"] = function (sPluginId)
Api.prototype["pluginMethod_GetAllOleObjects"] = function (sPluginId)
{
let aDataObjects = [];
let oLogicDocument = this.private_GetLogicDocument();
@ -811,7 +818,7 @@
* @since 7.1.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveOleObject.js
*/
window["asc_docs_api"].prototype["pluginMethod_RemoveOleObject"] = function (sInternalId)
Api.prototype["pluginMethod_RemoveOleObject"] = function (sInternalId)
{
let oLogicDocument = this.private_GetLogicDocument();
if(!oLogicDocument)
@ -830,7 +837,7 @@
* @since 7.1.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveOleObjects.js
*/
window["asc_docs_api"].prototype["pluginMethod_RemoveOleObjects"] = function (arrObjects)
Api.prototype["pluginMethod_RemoveOleObjects"] = function (arrObjects)
{
let oLogicDocument = this.private_GetLogicDocument();
if(!oLogicDocument)
@ -855,7 +862,7 @@
* @since 7.1.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SelectOleObject.js
*/
window["asc_docs_api"].prototype["pluginMethod_SelectOleObject"] = function(id)
Api.prototype["pluginMethod_SelectOleObject"] = function(id)
{
var oLogicDocument = this.private_GetLogicDocument();
if (!oLogicDocument)
@ -879,7 +886,7 @@
* @since 7.1.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/InsertOleObject.js
*/
window["asc_docs_api"].prototype["pluginMethod_InsertOleObject"] = function(NewObject, bSelect)
Api.prototype["pluginMethod_InsertOleObject"] = function(NewObject, bSelect)
{
var oPluginData = {};
oPluginData["imgSrc"] = NewObject["ImageData"];
@ -904,7 +911,7 @@
* @since 7.1.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ChangeOleObject.js
*/
window["asc_docs_api"].prototype["pluginMethod_ChangeOleObject"] = function(ObjectData)
Api.prototype["pluginMethod_ChangeOleObject"] = function(ObjectData)
{
this["pluginMethod_ChangeOleObjects"]([ObjectData]);
};
@ -917,7 +924,7 @@
* @since 7.1.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ChangeOleObjects.js
*/
window["asc_docs_api"].prototype["pluginMethod_ChangeOleObjects"] = function(arrObjectData)
Api.prototype["pluginMethod_ChangeOleObjects"] = function(arrObjectData)
{
let oLogicDocument = this.private_GetLogicDocument();
if (!oLogicDocument)
@ -1013,7 +1020,7 @@
* @since 7.2.1
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AcceptReviewChanges.js
*/
window["asc_docs_api"].prototype["pluginMethod_AcceptReviewChanges"] = function(isAll)
Api.prototype["pluginMethod_AcceptReviewChanges"] = function(isAll)
{
if (isAll)
this.asc_AcceptAllChanges();
@ -1029,7 +1036,7 @@
* @since 7.2.1
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RejectReviewChanges.js
*/
window["asc_docs_api"].prototype["pluginMethod_RejectReviewChanges"] = function(isAll)
Api.prototype["pluginMethod_RejectReviewChanges"] = function(isAll)
{
if (isAll)
this.asc_RejectAllChanges();
@ -1045,7 +1052,7 @@
* @since 7.2.1
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/MoveToNextReviewChange.js
*/
window["asc_docs_api"].prototype["pluginMethod_MoveToNextReviewChange"] = function(isForward)
Api.prototype["pluginMethod_MoveToNextReviewChange"] = function(isForward)
{
if (undefined !== isForward && !isForward)
this.asc_GetPrevRevisionsChange();
@ -1061,7 +1068,7 @@
* @since 7.3.3
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetAllAddinFields.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetAllAddinFields"] = function()
Api.prototype["pluginMethod_GetAllAddinFields"] = function()
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument)
@ -1087,7 +1094,7 @@
* @since 7.3.3
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/UpdateAddinFields.js
*/
window["asc_docs_api"].prototype["pluginMethod_UpdateAddinFields"] = function(arrData)
Api.prototype["pluginMethod_UpdateAddinFields"] = function(arrData)
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument || !Array.isArray(arrData))
@ -1110,7 +1117,7 @@
* @since 7.3.3
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/AddAddinField.js
*/
window["asc_docs_api"].prototype["pluginMethod_AddAddinField"] = function(data)
Api.prototype["pluginMethod_AddAddinField"] = function(data)
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument)
@ -1127,7 +1134,7 @@
* @since 7.3.3
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/RemoveFieldWrapper.js
*/
window["asc_docs_api"].prototype["pluginMethod_RemoveFieldWrapper"] = function(fieldId)
Api.prototype["pluginMethod_RemoveFieldWrapper"] = function(fieldId)
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument)
@ -1144,7 +1151,7 @@
* @since 7.3.3
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/SetEditingRestrictions.js
*/
window["asc_docs_api"].prototype["pluginMethod_SetEditingRestrictions"] = function(restrictions)
Api.prototype["pluginMethod_SetEditingRestrictions"] = function(restrictions)
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument)
@ -1174,7 +1181,7 @@
* @since 7.4.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetCurrentWord.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetCurrentWord"] = function(type)
Api.prototype["pluginMethod_GetCurrentWord"] = function(type)
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument)
@ -1192,7 +1199,7 @@
* @since 7.4.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ReplaceCurrentWord.js
*/
window["asc_docs_api"].prototype["pluginMethod_ReplaceCurrentWord"] = function(replaceString, type)
Api.prototype["pluginMethod_ReplaceCurrentWord"] = function(replaceString, type)
{
let _replaceString = "" === replaceString ? "" : AscBuilder.GetStringParameter(replaceString, null);
@ -1212,7 +1219,7 @@
* @since 7.4.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/GetCurrentSentence.js
*/
window["asc_docs_api"].prototype["pluginMethod_GetCurrentSentence"] = function(type)
Api.prototype["pluginMethod_GetCurrentSentence"] = function(type)
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument)
@ -1230,7 +1237,7 @@
* @since 7.4.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/ReplaceCurrentSentence.js
*/
window["asc_docs_api"].prototype["pluginMethod_ReplaceCurrentSentence"] = function(replaceString, type)
Api.prototype["pluginMethod_ReplaceCurrentSentence"] = function(replaceString, type)
{
let _replaceString = "" === replaceString ? "" : AscBuilder.GetStringParameter(replaceString, null);
@ -1249,7 +1256,7 @@
* @since 8.2.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/Undo.js
*/
window["asc_docs_api"].prototype["pluginMethod_Undo"] = function()
Api.prototype["pluginMethod_Undo"] = function()
{
this.Undo();
};
@ -1261,7 +1268,7 @@
* @since 8.2.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/Redo.js
*/
window["asc_docs_api"].prototype["pluginMethod_Redo"] = function()
Api.prototype["pluginMethod_Redo"] = function()
{
this.Redo();
};
@ -1274,7 +1281,7 @@
* @since 8.2.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/CanUndo.js
*/
window["asc_docs_api"].prototype["pluginMethod_CanUndo"] = function()
Api.prototype["pluginMethod_CanUndo"] = function()
{
return this.asc_getCanUndo();
};
@ -1287,7 +1294,7 @@
* @since 8.2.0
* @see office-js-api/Examples/Plugins/{Editor}/Api/Methods/CanRedo.js
*/
window["asc_docs_api"].prototype["pluginMethod_CanRedo"] = function()
Api.prototype["pluginMethod_CanRedo"] = function()
{
return this.asc_getCanRedo();
};