devexpress-richedit 24.2.7 → 24.2.8-build-25135-0103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/bin/gulpfile.js +1 -1
  2. package/bin/index-custom.js +1 -1
  3. package/bin/localization-builder.js +1 -1
  4. package/bin/nspell-index.js +1 -1
  5. package/bin/nspell.webpack.config.js +1 -1
  6. package/bin/webpack-externals.js +1 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.d.ts +1 -1
  9. package/dist/dx.richedit.js +228 -198
  10. package/dist/dx.richedit.min.js +2 -2
  11. package/index.d.ts +1 -1
  12. package/index.js +1 -1
  13. package/lib/client/formats/docx/export/exporters/base/sections.d.ts +0 -1
  14. package/lib/client/formats/docx/export/exporters/base/sections.js +2 -10
  15. package/lib/client/model-api/formats/exporter.js +1 -1
  16. package/lib/client/model-api/sub-document.js +1 -1
  17. package/lib/common/formats/rtf/export/exporter.d.ts +2 -3
  18. package/lib/common/formats/rtf/export/exporter.js +3 -3
  19. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.d.ts +4 -2
  20. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.js +13 -9
  21. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.d.ts +3 -2
  22. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.js +4 -4
  23. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.d.ts +2 -1
  24. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.js +2 -2
  25. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.d.ts +4 -2
  26. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.js +16 -9
  27. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.d.ts +2 -1
  28. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.js +2 -2
  29. package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -2
  30. package/lib/common/formats/rtf/importer-in-subdocument.js +4 -3
  31. package/lib/common/layout/main-structures/layout-row.js +1 -2
  32. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.d.ts +4 -1
  33. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.js +36 -2
  34. package/lib/common/layout-formatter/row/tab-info.js +5 -4
  35. package/lib/common/layout-formatter/table/info/table-info.d.ts +0 -1
  36. package/lib/common/layout-formatter/table/info/table-info.js +2 -18
  37. package/lib/common/layout-formatter/table/size-compressor.js +9 -2
  38. package/lib/common/layout-formatter/table/table-alignment-applier.js +0 -2
  39. package/lib/common/model/paragraph/paragraph-style.d.ts +2 -1
  40. package/lib/common/model/paragraph/paragraph-style.js +5 -3
  41. package/lib/common/model/tables/secondary-structures/table-base-structures.d.ts +2 -1
  42. package/lib/common/model/tables/secondary-structures/table-base-structures.js +1 -0
  43. package/package.json +3 -3
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * DevExpress WebRichEdit (index.d.ts)
3
- * Version: 24.2.7
3
+ * Version: 24.2.8
4
4
  * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
5
5
  * License: https://www.devexpress.com/Support/EULAs
6
6
  */
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * DevExpress WebRichEdit (index.js)
3
- * Version: 24.2.7
3
+ * Version: 24.2.8
4
4
  * Copyright (c) 2012 - 2025 Developer Express Inc. ALL RIGHTS RESERVED
5
5
  * License: https://www.devexpress.com/Support/EULAs
6
6
  */
@@ -11,7 +11,6 @@ export declare class SectionExporter extends BaseExporter {
11
11
  private exportSectionHeadersFootersCore;
12
12
  private exportSectionPropertiesCore;
13
13
  private exportSectionPage;
14
- private shouldExportSectionPage;
15
14
  private exportSectionMargins;
16
15
  private exportSectionLineNumbering;
17
16
  private exportSectionPageNumbering;
@@ -75,21 +75,13 @@ export class SectionExporter extends BaseExporter {
75
75
  this.exportSectionGeneralSettings(props);
76
76
  }
77
77
  exportSectionPage(props) {
78
- if (!this.shouldExportSectionPage(props))
79
- return;
80
78
  this.writer.writeWpStartElement('pgSz');
81
- if (props.pageSize.width != SectionExporter.defaultProps.pageSize.width)
82
- this.writer.writeWpIntAttr('w', props.pageSize.width);
83
- if (props.pageSize.height != SectionExporter.defaultProps.pageSize.height)
84
- this.writer.writeWpIntAttr('h', props.pageSize.height);
79
+ this.writer.writeWpIntAttr('w', props.pageSize.width);
80
+ this.writer.writeWpIntAttr('h', props.pageSize.height);
85
81
  if (props.landscape)
86
82
  this.writer.writeWpStringAttr('orient', props.landscape ? 'landscape' : 'portrait');
87
83
  this.writer.endElement();
88
84
  }
89
- shouldExportSectionPage(props) {
90
- return !props.pageSize.equals(SectionExporter.defaultProps.pageSize) ||
91
- props.landscape != SectionExporter.defaultProps.landscape;
92
- }
93
85
  exportSectionMargins(props) {
94
86
  this.writer.writeWpStartElement('pgMar');
95
87
  this.writer.writeWpIntAttr('left', props.marginLeft);
@@ -16,7 +16,7 @@ function getExporter(exportModelOptions) {
16
16
  const { modelManipulator } = exportModelOptions.modelManager;
17
17
  switch (exportModelOptions.documentFormat) {
18
18
  case DocumentFormat.OpenXml: return new DocxExporter(exportModelOptions, new DocxExportOptions());
19
- case DocumentFormat.Rtf: return new RtfExporter(modelManipulator, new RtfDocumentExporterOptions());
19
+ case DocumentFormat.Rtf: return new RtfExporter(exportModelOptions, new RtfDocumentExporterOptions());
20
20
  case DocumentFormat.PlainText: return new TxtExporter(modelManipulator, new DocumentExporterOptions());
21
21
  case DocumentFormat.Html: return new HtmlDocumentExporter(exportModelOptions, new DocumentExporterOptions());
22
22
  default:
@@ -211,7 +211,7 @@ export class SubDocumentApi {
211
211
  }
212
212
  getRtf(interval) {
213
213
  const coreInterval = this._checkInterval(interval);
214
- return getRtfFromSubDocumentPublic(this._processor.modelManager.richOptions, this._subDocument, coreInterval);
214
+ return getRtfFromSubDocumentPublic(this._processor, this._subDocument, coreInterval);
215
215
  }
216
216
  insertContent(position, content, documentFormat, callback) {
217
217
  position = ApiParametersChecker.check(position, 1, false, [
@@ -1,7 +1,6 @@
1
- import { IDocumentExporter } from '../../i-document-exporter';
1
+ import { IDocumentExporter, IExportModelOptions } from '../../i-document-exporter';
2
2
  import { ColorModelInfo } from '../../../model/color/color-model-info';
3
3
  import { DocumentModel } from '../../../model/document-model';
4
- import { ModelManipulator } from '../../../model/manipulators/model-manipulator';
5
4
  import { RtfContentExporter } from './exporters/rtf-content-exporter';
6
5
  import { RtfExportHelper } from './helpers/rtf-export-helper';
7
6
  import { RtfBuilder } from './rtf-builder';
@@ -13,7 +12,7 @@ export declare class RtfExporter implements IDocumentExporter {
13
12
  contentExporter: RtfContentExporter;
14
13
  private modelManipulator;
15
14
  get documentModel(): DocumentModel;
16
- constructor(modelManipulator: ModelManipulator, options: RtfDocumentExporterOptions);
15
+ constructor(exportModelOptions: IExportModelOptions, options: RtfDocumentExporterOptions);
17
16
  exportToBlob(callback: (blob: Blob) => void): void;
18
17
  exportToBase64(callback: (base64: string) => void): void;
19
18
  exportAsString(): string;
@@ -11,11 +11,11 @@ import { RtfContentExporter } from './exporters/rtf-content-exporter';
11
11
  import { RtfExportHelper } from './helpers/rtf-export-helper';
12
12
  export class RtfExporter {
13
13
  get documentModel() { return this.modelManipulator.model; }
14
- constructor(modelManipulator, options) {
15
- this.modelManipulator = modelManipulator;
14
+ constructor(exportModelOptions, options) {
15
+ this.modelManipulator = exportModelOptions.modelManager.modelManipulator;
16
16
  this.options = options;
17
17
  this.rtfExportHelper = new RtfExportHelper();
18
- this.contentExporter = new RtfContentExporter(this.documentModel, options, this.rtfExportHelper);
18
+ this.contentExporter = new RtfContentExporter(exportModelOptions, options, this.rtfExportHelper);
19
19
  this.rtfBuilder = this.contentExporter.createRtfBuilder();
20
20
  }
21
21
  exportToBlob(callback) {
@@ -8,6 +8,7 @@ import { Section } from '../../../../model/section/section';
8
8
  import { SubDocument } from '../../../../model/sub-document';
9
9
  import { FooterSubDocumentInfo, HeaderSubDocumentInfo } from '../../../../model/sub-document-infos';
10
10
  import { ConditionalTableStyleFormatting } from '../../../../model/tables/secondary-structures/table-base-structures';
11
+ import { IExportModelOptions } from '../../../../formats/i-document-exporter';
11
12
  import { RtfExportHelper } from '../helpers/rtf-export-helper';
12
13
  import { PieceTableNumberingListCountersManager } from '../piece-table-numbering-list-counters-manager';
13
14
  import { RtfBuilder } from '../rtf-builder';
@@ -17,7 +18,7 @@ import { RtfParagraphPropertiesExporter } from './rtf-paragraph-properties-expor
17
18
  import { RtfSectionPropertiesExporter } from './rtf-section-properties-exporter';
18
19
  export type RunHandler = (run: RunBase, runText: string, absolutePosition: number) => void;
19
20
  export declare class RtfContentExporter {
20
- documentModel: DocumentModel;
21
+ exportModelOptions: IExportModelOptions;
21
22
  subDocument: SubDocument;
22
23
  currentSection: Section;
23
24
  static readonly verticalAlignmentTypes: Record<number, string>;
@@ -44,9 +45,10 @@ export declare class RtfContentExporter {
44
45
  private bookmarksIterator;
45
46
  private permissionsIterator;
46
47
  tableIterator: TableIterator;
48
+ get documentModel(): DocumentModel;
47
49
  private startSectionParagraphIndex;
48
50
  private shouldFourceUpdateIterators;
49
- constructor(documentModel: DocumentModel, options: RtfDocumentExporterOptions, rtfExportHelper: RtfExportHelper);
51
+ constructor(exportModelOptions: IExportModelOptions, options: RtfDocumentExporterOptions, rtfExportHelper: RtfExportHelper);
50
52
  createRtfBuilder(): RtfBuilder;
51
53
  export(): void;
52
54
  shouldSplitRuns(): boolean;
@@ -37,17 +37,18 @@ import { RtfTableExporter } from './table/rtf-table-exporter';
37
37
  export class RtfContentExporter {
38
38
  get shouldExportHiddenText() { return true; }
39
39
  ;
40
- constructor(documentModel, options, rtfExportHelper) {
40
+ get documentModel() { return this.exportModelOptions.modelManager.modelManipulator.model; }
41
+ constructor(exportModelOptions, options, rtfExportHelper) {
41
42
  this.shouldFourceUpdateIterators = false;
42
- this.documentModel = documentModel;
43
+ this.exportModelOptions = exportModelOptions;
43
44
  this.subDocument = this.documentModel.mainSubDocument;
44
45
  this.pieceTableNumberingListCounters = new PieceTableNumberingListCountersManager();
45
46
  this.rtfExportHelper = rtfExportHelper;
46
47
  this.options = options;
47
48
  this.rtfBuilder = this.createRtfBuilder();
48
- this.paragraphPropertiesExporter = new RtfParagraphPropertiesExporter(documentModel, rtfExportHelper, this.rtfBuilder);
49
- this.characterPropertiesExporter = new RtfCharacterPropertiesExporter(documentModel, rtfExportHelper, this.rtfBuilder, options);
50
- this.sectionPropertiesExporter = new RtfSectionPropertiesExporter(documentModel, rtfExportHelper, this.rtfBuilder);
49
+ this.paragraphPropertiesExporter = new RtfParagraphPropertiesExporter(this.documentModel, rtfExportHelper, this.rtfBuilder);
50
+ this.characterPropertiesExporter = new RtfCharacterPropertiesExporter(this.documentModel, rtfExportHelper, this.rtfBuilder, options);
51
+ this.sectionPropertiesExporter = new RtfSectionPropertiesExporter(this.documentModel, rtfExportHelper, this.rtfBuilder);
51
52
  this.runHandlerMap = new MapCreator()
52
53
  .add(RunType.TextRun, this.exportTextRun)
53
54
  .add(RunType.FieldCodeStartRun, this.fieldCodeStartRunHandler)
@@ -257,7 +258,7 @@ export class RtfContentExporter {
257
258
  value = "00000000";
258
259
  }
259
260
  else {
260
- const view = new DataView(hash, 0);
261
+ const view = new DataView(hash.buffer, 0);
261
262
  const hashValue = view.getInt32(0);
262
263
  value = this.documentModel.simpleFormattersManager.formatString("{0:x8}", hashValue);
263
264
  }
@@ -433,11 +434,14 @@ export class RtfContentExporter {
433
434
  this.exportSingleParagraph(paragraph);
434
435
  return paragraphIndex;
435
436
  }
436
- else
437
- return RtfTableExporter.exportTable(this, tablesInfo[0].table.getTopLevelParent()) - this.startSectionParagraphIndex;
437
+ else {
438
+ const table = tablesInfo[0].table.getTopLevelParent();
439
+ const grid = this.exportModelOptions.grids.get(table);
440
+ return RtfTableExporter.exportTable(this, table, grid) - this.startSectionParagraphIndex;
441
+ }
438
442
  }
439
443
  exportSingleParagraph(paragraph) {
440
- this.exportParagraphCore(paragraph, 0, 0, -1);
444
+ this.exportParagraphCore(paragraph, 0, ConditionalTableStyleFormatting.None, -1);
441
445
  this.finishParagraph(paragraph);
442
446
  }
443
447
  finishParagraph(paragraph) {
@@ -1,6 +1,7 @@
1
+ import { Grid } from '../../../../../layout-formatter/table/grid-engine/grid';
1
2
  import { Table } from '../../../../../model/tables/main-structures/table';
2
3
  import { RtfContentExporter } from '../rtf-content-exporter';
3
4
  export declare class RtfTableExporter {
4
- static exportTable(rtfContentExporter: RtfContentExporter, table: Table): number;
5
- static exportNestedTable(rtfContentExporter: RtfContentExporter, table: Table, nestingLevel: number): number;
5
+ static exportTable(rtfContentExporter: RtfContentExporter, table: Table, grid: Grid): number;
6
+ static exportNestedTable(rtfContentExporter: RtfContentExporter, table: Table, grid: Grid, nestingLevel: number): number;
6
7
  }
@@ -1,13 +1,13 @@
1
1
  import { RtfNestedTableExporterState } from './states/rtf-nested-table-exporter-state';
2
2
  import { RtfTableExporterState } from './states/rtf-table-exporter-state';
3
3
  export class RtfTableExporter {
4
- static exportTable(rtfContentExporter, table) {
5
- new RtfTableExporterState(rtfContentExporter, table).export();
4
+ static exportTable(rtfContentExporter, table, grid) {
5
+ new RtfTableExporterState(rtfContentExporter, table, grid).export();
6
6
  rtfContentExporter.tableIterator.update(table.getEndPosition());
7
7
  return rtfContentExporter.subDocument.getParagraphIndexByPosition(table.getEndPosition() - 1);
8
8
  }
9
- static exportNestedTable(rtfContentExporter, table, nestingLevel) {
10
- new RtfNestedTableExporterState(rtfContentExporter, table, nestingLevel).export();
9
+ static exportNestedTable(rtfContentExporter, table, grid, nestingLevel) {
10
+ new RtfNestedTableExporterState(rtfContentExporter, table, grid, nestingLevel).export();
11
11
  rtfContentExporter.tableIterator.update(table.getEndPosition());
12
12
  return rtfContentExporter.subDocument.getParagraphIndexByPosition(table.getEndPosition() - 1);
13
13
  }
@@ -1,9 +1,10 @@
1
+ import { Grid } from '../../../../../../layout-formatter/table/grid-engine/grid';
1
2
  import { Table } from '../../../../../../model/tables/main-structures/table';
2
3
  import { TableRow } from '../../../../../../model/tables/main-structures/table-row';
3
4
  import { RtfContentExporter } from '../../rtf-content-exporter';
4
5
  import { RtfTableExporterStateBase } from './rtf-table-exporter-state-base';
5
6
  export declare class RtfNestedTableExporterState extends RtfTableExporterStateBase {
6
- constructor(rtfExporter: RtfContentExporter, table: Table, nestingLevel: number);
7
+ constructor(rtfExporter: RtfContentExporter, table: Table, grid: Grid, nestingLevel: number);
7
8
  export(): void;
8
9
  protected writeParagraphEndMark(): void;
9
10
  protected exportRow(row: TableRow, rowIndex: number): void;
@@ -1,8 +1,8 @@
1
1
  import { RtfExportSR } from '../../../../translation-table/rtf-export-sr';
2
2
  import { RtfTableExporterStateBase } from './rtf-table-exporter-state-base';
3
3
  export class RtfNestedTableExporterState extends RtfTableExporterStateBase {
4
- constructor(rtfExporter, table, nestingLevel) {
5
- super(rtfExporter, table, nestingLevel);
4
+ constructor(rtfExporter, table, grid, nestingLevel) {
5
+ super(rtfExporter, table, grid, nestingLevel);
6
6
  }
7
7
  export() {
8
8
  super.exportBase();
@@ -6,6 +6,7 @@ import { TableCell } from '../../../../../../model/tables/main-structures/table-
6
6
  import { TableRow } from '../../../../../../model/tables/main-structures/table-row';
7
7
  import { ConditionalTableStyleFormatting } from '../../../../../../model/tables/secondary-structures/table-base-structures';
8
8
  import { TableWidthUnit } from '../../../../../../model/tables/secondary-structures/table-units';
9
+ import { Grid } from '../../../../../../layout-formatter/table/grid-engine/grid';
9
10
  import { RtfBuilder } from '../../../rtf-builder';
10
11
  import { RtfContentExporter } from '../../rtf-content-exporter';
11
12
  import { RtfTableCellPropertiesExporter } from '../rtf-table-cell-properties-exporter';
@@ -17,10 +18,11 @@ export declare abstract class RtfTableExporterStateBase {
17
18
  tableStyleIndex: number;
18
19
  rowLeftOffset: number;
19
20
  readonly table: Table;
21
+ readonly grid: Grid;
20
22
  readonly tableRowPropertiesExporter: RtfTableRowPropertiesExporter;
21
23
  readonly tableCellPropertiesExporter: RtfTableCellPropertiesExporter;
22
24
  readonly tablePropertiesExporter: RtfTablePropertiesExporter;
23
- protected constructor(rtfExporter: RtfContentExporter, table: Table, nestingLevel: number);
25
+ protected constructor(rtfExporter: RtfContentExporter, table: Table, grid: Grid, nestingLevel: number);
24
26
  protected get rtfBuilder(): RtfBuilder;
25
27
  protected get documentModel(): DocumentModel;
26
28
  protected get subDocument(): SubDocument;
@@ -36,7 +38,7 @@ export declare abstract class RtfTableExporterStateBase {
36
38
  protected abstract exportRow(row: TableRow, rowIndex: number): void;
37
39
  protected abstract writeParagraphEndMark(): void;
38
40
  exportRowProperties(row: TableRow, rowIndex: number): void;
39
- getCellWidth(virtualColumnIndex: number): number;
41
+ getCellWidth(leftSideIndex: number, columnSpan: number): number;
40
42
  calculateRowLeft(row: TableRow, indent: TableWidthUnit): number;
41
43
  protected calculateRowLeftOffset(row: TableRow): number;
42
44
  getActualWidth(unit: TableWidthUnit): number;
@@ -4,6 +4,7 @@ import { TableCellMergingState, TableLookTypes } from '../../../../../../model/t
4
4
  import { TableWidthUnitType } from '../../../../../../model/tables/secondary-structures/table-units';
5
5
  import { Errors } from '@devexpress/utils/lib/errors';
6
6
  import { ListUtils } from '@devexpress/utils/lib/utils/list';
7
+ import { UnitConverter } from '@devexpress/utils/lib/class/unit-converter';
7
8
  import { RtfExportSR } from '../../../../translation-table/rtf-export-sr';
8
9
  import { RtfTableCellPropertiesMerger } from '../../../../utils/mergers/rtf-table-cell-properties-merger';
9
10
  import { RtfTablePropertiesMerger } from '../../../../utils/mergers/rtf-table-properties-merger';
@@ -14,10 +15,11 @@ import { RtfTableExporter } from '../rtf-table-exporter';
14
15
  import { RtfTablePropertiesExporter } from '../rtf-table-properties-exporter';
15
16
  import { RtfTableRowPropertiesExporter } from '../rtf-table-row-properties-exporter';
16
17
  export class RtfTableExporterStateBase {
17
- constructor(rtfExporter, table, nestingLevel) {
18
+ constructor(rtfExporter, table, grid, nestingLevel) {
18
19
  this.rtfExporter = rtfExporter;
19
20
  this._nestingLevel = nestingLevel;
20
21
  this.table = table;
22
+ this.grid = grid;
21
23
  this.tableRowPropertiesExporter = new RtfTableRowPropertiesExporter(rtfExporter.documentModel, rtfExporter.rtfExportHelper, rtfExporter.rtfBuilder);
22
24
  this.tableCellPropertiesExporter = new RtfTableCellPropertiesExporter(rtfExporter.documentModel, rtfExporter.rtfExportHelper, rtfExporter.rtfBuilder);
23
25
  this.tablePropertiesExporter = new RtfTablePropertiesExporter(rtfExporter.documentModel, rtfExporter.rtfExportHelper, rtfExporter.rtfBuilder);
@@ -92,7 +94,7 @@ export class RtfTableExporterStateBase {
92
94
  while (parentCell !== nestedTable.parentCell) {
93
95
  nestedTable = nestedTable.parentCell.parentRow.parentTable;
94
96
  }
95
- return RtfTableExporter.exportNestedTable(this.rtfExporter, nestedTable, this.nestingLevel + 1);
97
+ return RtfTableExporter.exportNestedTable(this.rtfExporter, nestedTable, this.grid, this.nestingLevel + 1);
96
98
  }
97
99
  exportRowProperties(row, rowIndex) {
98
100
  const rowLeft = this.calculateRowLeft(row, row.parentTable.getActualTableIndent(this.documentModel.defaultTableProperties));
@@ -100,20 +102,25 @@ export class RtfTableExporterStateBase {
100
102
  let cellRightVirtualColInd = row.gridBefore;
101
103
  for (const cell of row.cells) {
102
104
  cellRightVirtualColInd += cell.columnSpan;
103
- const cellRight = rowLeft + this.getCellWidth(cellRightVirtualColInd);
105
+ const cellWidth = this.getCellWidth(row.gridBefore, cellRightVirtualColInd);
106
+ const cellRight = UnitConverter.pixelsToTwips(rowLeft + cellWidth);
104
107
  this.exportCellProperties(cell, cellRight);
105
108
  }
106
109
  }
107
- getCellWidth(virtualColumnIndex) {
108
- if (virtualColumnIndex < 0)
110
+ getCellWidth(leftSideIndex, columnSpan) {
111
+ if (leftSideIndex < 0 || columnSpan < 0)
109
112
  throw new Error(Errors.InternalException);
110
- const minVirtualColumnWidth = 10;
111
- return virtualColumnIndex * minVirtualColumnWidth;
113
+ let result = 0;
114
+ for (let i = 0; i < columnSpan; i++)
115
+ result += Math.max(this.grid.columns.width[i + leftSideIndex], 1);
116
+ return result;
112
117
  }
113
118
  calculateRowLeft(row, indent) {
114
- const widthBefore = row.gridBefore > 0 ? this.getCellWidth(row.gridBefore) : 0;
119
+ var _a;
120
+ const widthBefore = row.gridBefore > 0 ? this.getCellWidth(0, row.gridBefore) : 0;
115
121
  const offset = this.getActualWidth(indent) + widthBefore;
116
- return offset - (this.rowLeftOffset != null ? this.rowLeftOffset : this.calculateRowLeftOffset(row));
122
+ const rowLeftOffset = (_a = this.rowLeftOffset) !== null && _a !== void 0 ? _a : this.calculateRowLeftOffset(row);
123
+ return offset - rowLeftOffset;
117
124
  }
118
125
  calculateRowLeftOffset(row) {
119
126
  const borderWidth = row.cells[0].properties.borders.left.width;
@@ -1,9 +1,10 @@
1
+ import { Grid } from '../../../../../../layout-formatter/table/grid-engine/grid';
1
2
  import { Table } from '../../../../../../model/tables/main-structures/table';
2
3
  import { TableRow } from '../../../../../../model/tables/main-structures/table-row';
3
4
  import { RtfContentExporter } from '../../rtf-content-exporter';
4
5
  import { RtfTableExporterStateBase } from './rtf-table-exporter-state-base';
5
6
  export declare class RtfTableExporterState extends RtfTableExporterStateBase {
6
- constructor(rtfExporter: RtfContentExporter, table: Table);
7
+ constructor(rtfExporter: RtfContentExporter, table: Table, grid: Grid);
7
8
  export(): void;
8
9
  protected writeParagraphEndMark(): void;
9
10
  protected exportRow(row: TableRow, rowIndex: number): void;
@@ -1,8 +1,8 @@
1
1
  import { RtfExportSR } from '../../../../translation-table/rtf-export-sr';
2
2
  import { RtfTableExporterStateBase } from './rtf-table-exporter-state-base';
3
3
  export class RtfTableExporterState extends RtfTableExporterStateBase {
4
- constructor(rtfExporter, table) {
5
- super(rtfExporter, table, 1);
4
+ constructor(rtfExporter, table, grid) {
5
+ super(rtfExporter, table, grid, 1);
6
6
  }
7
7
  export() {
8
8
  super.exportBase();
@@ -1,6 +1,5 @@
1
1
  import { FixedInterval } from "@devexpress/utils/lib/intervals/fixed";
2
- import { RichOptions } from "../../model/options/rich-options";
3
2
  import { SubDocument } from "../../model/sub-document";
4
3
  import { IProcessor } from "../../processor";
5
- export declare function getRtfFromSubDocumentPublic(richOptions: RichOptions, subDocument: SubDocument, coreInterval: FixedInterval): string;
4
+ export declare function getRtfFromSubDocumentPublic(processor: IProcessor, subDocument: SubDocument, coreInterval: FixedInterval): string;
6
5
  export declare function insertRtfInSubDocumentPublic(processor: IProcessor, subDocument: SubDocument, position: number, rtf: string, callback: (interval: FixedInterval, isRtfValid: boolean) => void): void;
@@ -7,10 +7,11 @@ import { RtfDocumentExporterOptions } from "./export/rtf-document-exporter-optio
7
7
  import { RtfImporterOptions } from "./import/importer-options";
8
8
  import { RtfImporter } from "./import/rtf-importer";
9
9
  import { getAfterInsertCallback, getAfterInsertReject } from "../callback-helpers";
10
- export function getRtfFromSubDocumentPublic(richOptions, subDocument, coreInterval) {
10
+ export function getRtfFromSubDocumentPublic(processor, subDocument, coreInterval) {
11
11
  const rangeCopy = RangeCopy.create(new SubDocumentIntervals(subDocument, [coreInterval]));
12
- const newModelManager = new ClientModelManager(rangeCopy.model, richOptions, new EmptyBatchUpdatableObject());
13
- return new RtfExporter(newModelManager.modelManipulator, new RtfDocumentExporterOptions()).exportAsString();
12
+ const newModelManager = new ClientModelManager(rangeCopy.model, processor.modelManager.richOptions, new EmptyBatchUpdatableObject());
13
+ const exportModelOptions = processor.getExportModelOptions({ modelManager: newModelManager });
14
+ return new RtfExporter(exportModelOptions, new RtfDocumentExporterOptions()).exportAsString();
14
15
  }
15
16
  export function insertRtfInSubDocumentPublic(processor, subDocument, position, rtf, callback) {
16
17
  const options = new RtfImporterOptions(() => { });
@@ -2,7 +2,6 @@ import { Flag } from '@devexpress/utils/lib/class/flag';
2
2
  import { UnitConverter } from '@devexpress/utils/lib/class/unit-converter';
3
3
  import { Rectangle } from '@devexpress/utils/lib/geometry/rectangle';
4
4
  import { ListUtils } from '@devexpress/utils/lib/utils/list';
5
- import { LayoutBoxType } from './layout-boxes/layout-box';
6
5
  export var LayoutRowStateFlags;
7
6
  (function (LayoutRowStateFlags) {
8
7
  LayoutRowStateFlags[LayoutRowStateFlags["NormallyEnd"] = 0] = "NormallyEnd";
@@ -129,7 +128,7 @@ export class LayoutRow extends Rectangle {
129
128
  return lastBoxIndexWhatCanStrikeoutAndUnderline;
130
129
  }
131
130
  containsSpacesOnly() {
132
- return this.boxes.length > 0 && ListUtils.allOf(this.boxes, val => val.isWhitespace() || val.getType() === LayoutBoxType.ParagraphMark);
131
+ return this.boxes.length > 0 && ListUtils.allOf(this.boxes, val => val.isWhitespace());
133
132
  }
134
133
  }
135
134
  export class LayoutRowWithIndex extends LayoutRow {
@@ -25,7 +25,10 @@ export declare class RowFormattingInfo {
25
25
  get currInterval(): RowIntervalInfo;
26
26
  indexOfFreeInterval(width: number): number;
27
27
  indexOfIntervalContainsPositon(pos: number): number;
28
- calculate(): void;
28
+ calculate(outerHorizontalRowContentBounds?: FixedInterval): void;
29
+ private calculateFreeIntervals;
30
+ recalculate(outerHorizontalRowContentBounds?: FixedInterval): void;
31
+ private findIntervalIndexByPosition;
29
32
  canIncrementHeightTo(newHeight: number): boolean;
30
33
  findNextYPos(): void;
31
34
  findNextYPosWhatHasNeededSpace(requiredWidth: number): void;
@@ -45,10 +45,10 @@ export class RowFormattingInfo {
45
45
  const ind = ListUtils.indexBy(this.intervals, (curr) => curr.start > pos || pos < curr.end, this.currIndex + 1);
46
46
  return ind < 0 ? this.intervals.length - 1 : ind;
47
47
  }
48
- calculate() {
48
+ calculate(outerHorizontalRowContentBounds) {
49
49
  this.setIntersectObjects();
50
50
  this.busyIntervals = IntervalAlgorithms.getMergedIntervals(ListUtils.map(this.intersectsObjects, (objBnds) => new FixedInterval(objBnds.x, objBnds.width)), true);
51
- const freeIntervals = IntervalAlgorithms.reflectIntervals(this.busyIntervals, this.outerHorizontalRowContentBounds);
51
+ const freeIntervals = this.calculateFreeIntervals(this.busyIntervals, outerHorizontalRowContentBounds !== null && outerHorizontalRowContentBounds !== void 0 ? outerHorizontalRowContentBounds : this.outerHorizontalRowContentBounds);
52
52
  if (freeIntervals.length) {
53
53
  this.intervals = ListUtils.map(freeIntervals, (curr) => new RowIntervalInfo(curr.start, curr.length));
54
54
  return;
@@ -56,6 +56,40 @@ export class RowFormattingInfo {
56
56
  this.resetMinY(ListUtils.min);
57
57
  Log.print(LogSource.RowFormatter, "RowFormattingInfo.calculate ", `minY:${this.minY}, height:${this.height}, currIndex: ${this.currIndex} intervals:\n${Log.join("\n", ListUtils.map(this.intervals, (curr) => LogObjToStr.fixedInterval(curr)))}`);
58
58
  }
59
+ calculateFreeIntervals(busyIntervals, outerHorizontalRowContentBounds) {
60
+ const intervals = ListUtils.reducedMap(busyIntervals, val => IntervalAlgorithms.getIntersectionNonNullLength(val, outerHorizontalRowContentBounds));
61
+ if (!intervals.length)
62
+ return [outerHorizontalRowContentBounds.clone()];
63
+ const lastIntervalEnd = ListUtils.last(intervals).end;
64
+ const result = ListUtils.reducedMap(intervals, (curr, i) => FixedInterval.fromPositions(busyIntervals[i - 1].end, curr.start), 1);
65
+ if (outerHorizontalRowContentBounds.start < busyIntervals[0].start)
66
+ result.unshift(FixedInterval.fromPositions(outerHorizontalRowContentBounds.start, busyIntervals[0].start));
67
+ if (outerHorizontalRowContentBounds.end > lastIntervalEnd)
68
+ result.push(FixedInterval.fromPositions(lastIntervalEnd, outerHorizontalRowContentBounds.end));
69
+ return result;
70
+ }
71
+ recalculate(outerHorizontalRowContentBounds) {
72
+ const currInterval = this.currInterval;
73
+ this.calculate(outerHorizontalRowContentBounds);
74
+ const pos = currInterval.start + currInterval.busyWidth;
75
+ const index = this.findIntervalIndexByPosition(pos);
76
+ const interval = this.intervals[index];
77
+ if (interval && interval.start < pos) {
78
+ const avaliableWidth = interval.length - (pos - interval.start);
79
+ interval.avaliableWidth = avaliableWidth;
80
+ }
81
+ this.currIndex = index;
82
+ }
83
+ findIntervalIndexByPosition(position) {
84
+ let index = 0;
85
+ while (index < this.intervals.length) {
86
+ const interval = this.intervals[index];
87
+ if (interval.start <= position && position < interval.end || position < interval.start)
88
+ break;
89
+ index++;
90
+ }
91
+ return index;
92
+ }
59
93
  canIncrementHeightTo(newHeight) {
60
94
  const contentBounds = ListUtils.map(this.intervals, (c) => new Rectangle(c.start, this.minY, c.busyWidth, newHeight));
61
95
  const intersectedObjects = this.calcIntersectObjects(newHeight);
@@ -39,7 +39,7 @@ export class RowTabInfo {
39
39
  const tab = this.tabPositions[ind];
40
40
  const oldTabPos = tab ? tab.position : Number.MAX_VALUE;
41
41
  if (oldTabPos != pos)
42
- this.tabPositions.splice(pos > oldTabPos ? ind + 1 : ind, 0, new TabInfo(pos, TabAlign.Left, TabLeaderType.None, false, false));
42
+ this.tabPositions.splice(pos > oldTabPos ? ind + 1 : ind, 0, new TabInfo(pos, TabAlign.Left, TabLeaderType.None, false, false, true));
43
43
  }
44
44
  for (let pos of this.tabPositions)
45
45
  pos.position += this.paragraphHorizontalBoundsStart;
@@ -85,9 +85,10 @@ export class RowTabInfo {
85
85
  const lastInterval = ListUtils.last(this.rowFormatter.rowSizesManager.rowFormattingInfo.intervals);
86
86
  if (tabXPosRelativePage > lastInterval.end) {
87
87
  if (lastInterval.end < this.rowFormatter.paragraphHorizontalBounds.end) {
88
- if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013 && tabPosition !== null) {
89
- this.currInterval.avaliableWidth = Number.MAX_SAFE_INTEGER - this.currInterval.busyWidth;
90
- this.currInterval.length = Number.MAX_SAFE_INTEGER;
88
+ if (this.rowFormatter.manager.model.compatibilitySettings.compatibilityMode < CompatibilityMode.Word2013 && tabPosition && !tabPosition.isParagraphIndent) {
89
+ const interval = this.rowFormatter.rowSizesManager.rowFormattingInfo.outerHorizontalRowContentBounds;
90
+ interval.length = Number.MAX_SAFE_INTEGER - interval.start;
91
+ this.rowFormatter.rowSizesManager.rowFormattingInfo.recalculate(interval);
91
92
  this.row.width = Number.MAX_SAFE_INTEGER;
92
93
  this.row.flags.set(LayoutRowStateFlags.InfinityWidth, true);
93
94
  return this.addTabBox();
@@ -53,7 +53,6 @@ export declare class TableInfo {
53
53
  constructor(rowFormatter: RowFormatter, table: Table, tableMaxWidth: number, xPosition: number, yOffset: number, pageIndexFromWhichTableWasMoved: number | null);
54
54
  static checkIsTableCannotBePlacedOnCurrentPage(rowFormatter: RowFormatter, table: Table, yOffset: number, maxWidth: number): boolean;
55
55
  private init;
56
- private getShiftHorizontalPosition;
57
56
  private static getEstimatedTableWidth;
58
57
  private static getRelationByColumnY;
59
58
  private static getRelationByColumnX;
@@ -8,7 +8,7 @@ import { LayoutTableColumnInfo, LayoutTableInfo } from '../../../layout/table/la
8
8
  import { TablePosition, TablePositionIndexes } from '../../../model/tables/main-structures/table';
9
9
  import { TableCellPropertiesMergerMarginLeft, TableCellPropertiesMergerMarginRight } from '../../../model/tables/properties-mergers/table-cell-properties-merger';
10
10
  import { TablePropertiesMergerShadingInfo } from '../../../model/tables/properties-mergers/table-properties-merger';
11
- import { ConditionalTableStyleFormatting, TableLayoutType, TableRowAlignment } from '../../../model/tables/secondary-structures/table-base-structures';
11
+ import { ConditionalTableStyleFormatting, TableLayoutType } from '../../../model/tables/secondary-structures/table-base-structures';
12
12
  import { TableWidthUnitType } from '../../../model/tables/secondary-structures/table-units';
13
13
  import { BorderHelper } from '../borders/border-helper';
14
14
  import { createGrid } from '../grid-engine/creator';
@@ -79,25 +79,9 @@ export class TableInfo {
79
79
  tableIndent.value = 0;
80
80
  }
81
81
  const tableIndentInPixels = tableIndent.asNumberNoPercentType(UnitConverter.twipsToPixels);
82
- this.xPositionStart = xPosition + tableIndentInPixels + (diff.xDiff ? diff.xDiff : -firstCellLeftMargin) +
83
- this.getShiftHorizontalPosition(xPosition);
82
+ this.xPositionStart = xPosition + tableIndentInPixels + (diff.xDiff ? diff.xDiff : -firstCellLeftMargin);
84
83
  this.yPositionStart = yOffset + diff.yDiff;
85
84
  }
86
- getShiftHorizontalPosition(xPosition) {
87
- const freeSpaceFromTable = this.columnWidth - this.grid.commonWidth;
88
- if (freeSpaceFromTable >= 0)
89
- return 0;
90
- const tableAlignment = this.table.getActualTableAlignment();
91
- if (tableAlignment == TableRowAlignment.Center) {
92
- let result = freeSpaceFromTable / 2 - xPosition;
93
- if (result < 0 && this.isSimpleView)
94
- result = 0;
95
- return result;
96
- }
97
- else if (tableAlignment == TableRowAlignment.Right)
98
- return freeSpaceFromTable - xPosition;
99
- return 0;
100
- }
101
85
  static getEstimatedTableWidth(table, maxWidth) {
102
86
  const preferredWidth = table.preferredWidth;
103
87
  const minWidth = 3 * table.rows[0].getTotalCellsInRowConsiderGrid();
@@ -11,6 +11,12 @@ export class LayoutTableSizeCompressor {
11
11
  LayoutTableSizeCompressor.cellCompress(cell, cell.createRectangle());
12
12
  }
13
13
  static tableCompress(tableInfo, boundsRelativeColumn) {
14
+ const intersection = Rectangle.getIntersection(tableInfo, boundsRelativeColumn);
15
+ const headOffset = intersection.x - tableInfo.x;
16
+ if (headOffset > 0) {
17
+ tableInfo.verticalBorders.forEach(b => b.xPos -= headOffset);
18
+ tableInfo.verticalCursorBorders.forEach(b => b.xPos -= headOffset);
19
+ }
14
20
  LayoutTableSizeCompressor.compress(tableInfo, boundsRelativeColumn, true, false);
15
21
  const boundsRelativeTable = tableInfo.clone().moveRectangle(-tableInfo.x, -tableInfo.y);
16
22
  for (let row of tableInfo.tableRows)
@@ -79,8 +85,9 @@ export class LayoutTableSizeCompressor {
79
85
  }
80
86
  border.length = Math.min(border.yPos + border.length, bounds.bottom) - border.yPos;
81
87
  if (border.xPos < bounds.x)
82
- return true;
83
- border.xPos = bounds.right;
88
+ border.xPos = bounds.x;
89
+ else
90
+ border.xPos = bounds.right;
84
91
  border.borderInfo.width = 0;
85
92
  return false;
86
93
  }
@@ -33,8 +33,6 @@ export class TableAlignmentApplier {
33
33
  offset = 0;
34
34
  break;
35
35
  }
36
- if (offset <= 0)
37
- return;
38
36
  TableAlignmentApplier.moveAllTable(currTableColumnInfo, (rect) => rect.x += offset);
39
37
  }
40
38
  static applyCellsVerticalAlignment(defaultTableCellProps, grid, currTableColumnInfo, rowInfo) {
@@ -48,7 +48,8 @@ export declare class TabInfo implements IEquatable<TabInfo>, ICloneable<TabInfo>
48
48
  position: number;
49
49
  isDefault: boolean;
50
50
  deleted: boolean;
51
- constructor(position: number, alignment: TabAlign, leader: TabLeaderType, deleted: boolean, isDefault: boolean);
51
+ readonly isParagraphIndent: boolean;
52
+ constructor(position: number, alignment: TabAlign, leader: TabLeaderType, deleted: boolean, isDefault: boolean, isParagraphIndent?: boolean);
52
53
  clone(): TabInfo;
53
54
  equals(obj: TabInfo): boolean;
54
55
  }
@@ -107,15 +107,16 @@ export class TabProperties {
107
107
  }
108
108
  }
109
109
  export class TabInfo {
110
- constructor(position, alignment, leader, deleted, isDefault) {
110
+ constructor(position, alignment, leader, deleted, isDefault, isParagraphIndent = false) {
111
111
  this.position = position;
112
112
  this.alignment = alignment;
113
113
  this.leader = leader;
114
114
  this.isDefault = isDefault;
115
115
  this.deleted = deleted;
116
+ this.isParagraphIndent = isParagraphIndent;
116
117
  }
117
118
  clone() {
118
- return new TabInfo(this.position, this.alignment, this.leader, this.deleted, this.isDefault);
119
+ return new TabInfo(this.position, this.alignment, this.leader, this.deleted, this.isDefault, this.isParagraphIndent);
119
120
  }
120
121
  equals(obj) {
121
122
  if (!obj)
@@ -124,6 +125,7 @@ export class TabInfo {
124
125
  this.leader == obj.leader &&
125
126
  this.position == obj.position &&
126
127
  this.deleted == obj.deleted &&
127
- this.isDefault == obj.isDefault;
128
+ this.isDefault == obj.isDefault &&
129
+ this.isParagraphIndent == obj.isParagraphIndent;
128
130
  }
129
131
  }