devexpress-richedit 24.1.12-build-25107-0103 → 24.1.13-build-25142-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 (76) 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.css +1 -1
  9. package/dist/dx.richedit.d.ts +1 -1
  10. package/dist/dx.richedit.js +915 -833
  11. package/dist/dx.richedit.min.js +2 -2
  12. package/index.d.ts +1 -1
  13. package/index.js +1 -1
  14. package/lib/client/client-rich-edit.js +2 -2
  15. package/lib/client/commands/mail-merge-command.js +2 -1
  16. package/lib/client/formats/docx/export/data.d.ts +5 -1
  17. package/lib/client/formats/docx/export/data.js +3 -2
  18. package/lib/client/formats/docx/export/exporter.d.ts +2 -3
  19. package/lib/client/formats/docx/export/exporter.js +3 -3
  20. package/lib/client/formats/docx/export/exporters/base/sections.d.ts +0 -1
  21. package/lib/client/formats/docx/export/exporters/base/sections.js +2 -10
  22. package/lib/client/formats/docx/export/exporters/base/table/table.d.ts +1 -1
  23. package/lib/client/formats/docx/export/exporters/base/table/table.js +4 -4
  24. package/lib/client/formats/docx/import/destination/paragraph-properties/properties/paragraph-spacing-destination.js +6 -4
  25. package/lib/client/model-api/formats/exporter.js +2 -2
  26. package/lib/client/model-api/sub-document.js +1 -1
  27. package/lib/client/utils/focus-helper.js +22 -5
  28. package/lib/common/commands/layout/apply-style-command.d.ts +2 -2
  29. package/lib/common/commands/layout/apply-style-command.js +3 -4
  30. package/lib/common/commands/toc/set-paragraph-level-command.js +1 -1
  31. package/lib/common/formats/i-document-exporter.d.ts +3 -0
  32. package/lib/common/formats/rtf/export/exporter.d.ts +2 -3
  33. package/lib/common/formats/rtf/export/exporter.js +3 -3
  34. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.d.ts +4 -2
  35. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.js +13 -9
  36. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.d.ts +3 -2
  37. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.js +4 -4
  38. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.d.ts +2 -1
  39. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.js +2 -2
  40. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.d.ts +4 -2
  41. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.js +16 -9
  42. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.d.ts +2 -1
  43. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.js +2 -2
  44. package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -2
  45. package/lib/common/formats/rtf/importer-in-subdocument.js +4 -3
  46. package/lib/common/layout/document-layout.d.ts +3 -0
  47. package/lib/common/layout/document-layout.js +6 -0
  48. package/lib/common/layout/main-structures/layout-page-area.d.ts +3 -0
  49. package/lib/common/layout/main-structures/layout-page-area.js +6 -0
  50. package/lib/common/layout/main-structures/layout-page.d.ts +3 -0
  51. package/lib/common/layout/main-structures/layout-page.js +8 -0
  52. package/lib/common/layout/main-structures/layout-row.js +1 -2
  53. package/lib/common/layout-formatter/floating/position-calculators/horizontal.d.ts +1 -0
  54. package/lib/common/layout-formatter/floating/position-calculators/horizontal.js +16 -12
  55. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.d.ts +4 -1
  56. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.js +36 -2
  57. package/lib/common/layout-formatter/row/states.js +0 -2
  58. package/lib/common/layout-formatter/row/tab-info.js +5 -4
  59. package/lib/common/layout-formatter/table/info/table-info.d.ts +0 -1
  60. package/lib/common/layout-formatter/table/info/table-info.js +2 -18
  61. package/lib/common/layout-formatter/table/size-compressor.js +9 -2
  62. package/lib/common/layout-formatter/table/table-alignment-applier.js +0 -2
  63. package/lib/common/model/borders/border-info.js +1 -1
  64. package/lib/common/model/character/character-properties.d.ts +1 -1
  65. package/lib/common/model/character/character-properties.js +14 -2
  66. package/lib/common/model/history/items/character-properties-history-items.d.ts +2 -1
  67. package/lib/common/model/history/items/character-properties-history-items.js +3 -2
  68. package/lib/common/model/manipulators/character-properties-manipulator.js +2 -2
  69. package/lib/common/model/manipulators/i-properties-manipulator.d.ts +1 -1
  70. package/lib/common/model/paragraph/paragraph-style.d.ts +2 -1
  71. package/lib/common/model/paragraph/paragraph-style.js +5 -3
  72. package/lib/common/model/tables/secondary-structures/table-base-structures.d.ts +2 -1
  73. package/lib/common/model/tables/secondary-structures/table-base-structures.js +1 -0
  74. package/lib/common/rich-edit-core.js +1 -0
  75. package/lib/common/ui/ruler/controls/ruler.js +3 -7
  76. package/package.json +3 -3
@@ -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,6 +2,8 @@ import { DocumentModel } from '../model/document-model';
2
2
  import { PositionManager } from '../model/position/position-manager';
3
3
  import { LayoutAnchoredObjectBox } from './main-structures/layout-boxes/layout-anchored-object-box';
4
4
  import { LayoutPage } from './main-structures/layout-page';
5
+ import { Grid } from '../layout-formatter/table/grid-engine/grid';
6
+ import { Table } from '../model/tables/main-structures/table';
5
7
  export declare class ModelPositionHolder {
6
8
  private pos;
7
9
  private posManager;
@@ -25,6 +27,7 @@ export declare class DocumentLayout {
25
27
  isFullyFormatted: boolean;
26
28
  anchorObjectsPositionInfo: AnchorObjectsPositionInfo;
27
29
  pageColor: number;
30
+ get grids(): Map<Table, Grid>;
28
31
  constructor(anchorObjectsPositionInfo: AnchorObjectsPositionInfo);
29
32
  setEmptyLayout(pageColor: number): void;
30
33
  getLastValidPage(): LayoutPage;
@@ -41,6 +41,12 @@ export class DocumentLayout {
41
41
  this.anchorObjectsPositionInfo = anchorObjectsPositionInfo;
42
42
  this.setEmptyLayout(ColorHelper.NO_COLOR);
43
43
  }
44
+ get grids() {
45
+ return this.pages.reduce((res, page) => {
46
+ page.grids.forEach((grid, table) => res.set(table, grid));
47
+ return res;
48
+ }, new Map());
49
+ }
44
50
  setEmptyLayout(pageColor) {
45
51
  this.pages = [];
46
52
  this.validPageCount = 0;
@@ -1,10 +1,13 @@
1
1
  import { Rectangle } from '@devexpress/utils/lib/geometry/rectangle';
2
2
  import { SubDocument } from '../../model/sub-document';
3
3
  import { LayoutColumn } from './layout-column';
4
+ import { Grid } from '../../layout-formatter/table/grid-engine/grid';
5
+ import { Table } from '../../model/tables/main-structures/table';
4
6
  export declare class LayoutPageArea extends Rectangle {
5
7
  subDocument: SubDocument;
6
8
  columns: LayoutColumn[];
7
9
  pageOffset: number;
10
+ get grids(): Map<Table, Grid>;
8
11
  constructor(subDocument: SubDocument);
9
12
  getEndPosition(): number;
10
13
  getLastColumn(): LayoutColumn;
@@ -6,6 +6,12 @@ export class LayoutPageArea extends Rectangle {
6
6
  this.columns = [];
7
7
  this.subDocument = subDocument;
8
8
  }
9
+ get grids() {
10
+ return this.columns.reduce((res, column) => {
11
+ column.tablesInfo.forEach(tableInfo => res.set(tableInfo.logicInfo.grid.table, tableInfo.logicInfo.grid));
12
+ return res;
13
+ }, new Map());
14
+ }
9
15
  getEndPosition() {
10
16
  return this.pageOffset + ListUtils.last(this.columns).getEndPosition();
11
17
  }
@@ -8,6 +8,8 @@ import { AnchorObjectsPositionInfo } from '../document-layout';
8
8
  import { LayoutAnchoredObjectBox } from './layout-boxes/layout-anchored-object-box';
9
9
  import { LayoutPageArea } from './layout-page-area';
10
10
  import { TableAnchoredObjectsHolder } from '../../layout-formatter/table/utils/table-anchored-objects-holder';
11
+ import { Grid } from '../../layout-formatter/table/grid-engine/grid';
12
+ import { Table } from '../../model/tables/main-structures/table';
11
13
  export declare enum LayoutPageFlags {
12
14
  MustBeRendered = 1,
13
15
  ContentRendered = 2,
@@ -42,6 +44,7 @@ export declare class LayoutPage extends Rectangle {
42
44
  tableAnchoredObjectsHolder: TableAnchoredObjectsHolder;
43
45
  renderLevelCalculator: RenderLevelCalculator;
44
46
  private contentIntervals;
47
+ get grids(): Map<Table, Grid>;
45
48
  constructor();
46
49
  setRenderLevelCalculator(anchorObjectsPositionInfo: AnchorObjectsPositionInfo, compatibilityMode: CompatibilityMode): void;
47
50
  setAbsolutePosition(pos: number): void;
@@ -46,6 +46,14 @@ export class LayoutPage extends Rectangle {
46
46
  this.anchoredObjectHolder = new PageAnchoredObjectHolder(this);
47
47
  this.tableAnchoredObjectsHolder = new TableAnchoredObjectsHolder();
48
48
  }
49
+ get grids() {
50
+ const result = new Map();
51
+ for (let pageArea of this.mainSubDocumentPageAreas)
52
+ pageArea.grids.forEach((grid, table) => result.set(table, grid));
53
+ for (let pageArea of Object.values(this.otherPageAreas))
54
+ pageArea.grids.forEach((grid, table) => result.set(table, grid));
55
+ return result;
56
+ }
49
57
  setRenderLevelCalculator(anchorObjectsPositionInfo, compatibilityMode) {
50
58
  this.renderLevelCalculator = new RenderLevelCalculator();
51
59
  this.renderLevelCalculator.calcLevels(this.anchoredObjectHolder, anchorObjectsPositionInfo, compatibilityMode);
@@ -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 {
@@ -11,6 +11,7 @@ export declare class AnchorObjectHorizontalPositionCalculator extends AnchorObje
11
11
  private alignment;
12
12
  private getAlignPosition;
13
13
  private absolute;
14
+ private getAnchorXPosition;
14
15
  private bookLayout;
15
16
  private relative;
16
17
  }
@@ -41,7 +41,7 @@ export class AnchorObjectHorizontalPositionCalculator extends AnchorObjectPositi
41
41
  alignment(type, alignment) {
42
42
  switch (type) {
43
43
  case AnchorObjectHorizontalPositionType.Character:
44
- return this.getAlignPosition(alignment, 0);
44
+ return this.getAnchorXPosition() + this.getAlignPosition(alignment, 0);
45
45
  case AnchorObjectHorizontalPositionType.Column:
46
46
  return this.isRelativeCell ?
47
47
  this.relativeColumnPos() + this.lp.row.tableCellInfo.x +
@@ -90,17 +90,8 @@ export class AnchorObjectHorizontalPositionCalculator extends AnchorObjectPositi
90
90
  return this.isRelativeCell ? this.relativeColumnPos() + this.lp.row.tableCellInfo.x : 0;
91
91
  case AnchorObjectHorizontalPositionType.Column:
92
92
  return this.isRelativeCell ? this.relativeColumnPos() + this.lp.row.tableCellInfo.x + this.leftCellMargin : this.relativeColumnPos();
93
- case AnchorObjectHorizontalPositionType.Character: {
94
- const rowAbsPos = this.lp.getLogPosition(DocumentLayoutDetailsLevel.Row);
95
- const ancBoxAbsPos = this.obj.rowOffset;
96
- const boxIndex = SearchUtils.normedInterpolationIndexOf(this.lp.row.boxes, (box) => rowAbsPos + box.rowOffset, ancBoxAbsPos);
97
- const box = this.lp.row.boxes[boxIndex];
98
- if (!box)
99
- return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row);
100
- const symbolCount = Math.max(0, ancBoxAbsPos - rowAbsPos - box.rowOffset);
101
- return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row) + box.x +
102
- box.getCharOffsetXInPixels(this.manager.measurer, symbolCount);
103
- }
93
+ case AnchorObjectHorizontalPositionType.Character:
94
+ return this.getAnchorXPosition();
104
95
  case AnchorObjectHorizontalPositionType.Margin:
105
96
  return this.isRelativeCell ? this.relativeColumnPos() + this.lp.row.tableCellInfo.x + this.leftCellMargin :
106
97
  this.manager.boundsCalculator.marginLeft;
@@ -117,6 +108,19 @@ export class AnchorObjectHorizontalPositionCalculator extends AnchorObjectPositi
117
108
  throw new Error(Errors.InternalException);
118
109
  }
119
110
  }
111
+ getAnchorXPosition() {
112
+ const rowAbsPos = this.lp.getLogPosition(DocumentLayoutDetailsLevel.Row);
113
+ const ancBoxAbsPos = this.obj.rowOffset;
114
+ let boxIndex = SearchUtils.normedInterpolationIndexOf(this.lp.row.boxes, (box) => rowAbsPos + box.rowOffset, ancBoxAbsPos);
115
+ if (boxIndex < 0)
116
+ boxIndex = 0;
117
+ const box = this.lp.row.boxes[boxIndex];
118
+ if (!box)
119
+ return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row);
120
+ const symbolCount = Math.max(0, ancBoxAbsPos - rowAbsPos - box.rowOffset);
121
+ return this.lp.getLayoutX(null, DocumentLayoutDetailsLevel.Row) + box.x +
122
+ box.getCharOffsetXInPixels(this.manager.measurer, symbolCount);
123
+ }
120
124
  bookLayout() {
121
125
  return this.alignment(this.anchorInfo.horizontalPositionType, AnchorObjectHorizontalPositionCalculator.mapBookLayoutALignmentType[this.anchorInfo.horizontalPositionAlignment]);
122
126
  }
@@ -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);
@@ -21,8 +21,6 @@ export class RowBaseFormatterState {
21
21
  this.rowFormatter.finishRow();
22
22
  }
23
23
  addAnchorObject() {
24
- if (!this.rowFormatter.wordHolder.pushBoxes())
25
- return;
26
24
  this.rowFormatter.addAnchorObject();
27
25
  }
28
26
  addTextBox() {
@@ -31,7 +31,7 @@ export class RowTabInfo {
31
31
  const tab = this.tabPositions[ind];
32
32
  const oldTabPos = tab ? tab.position : Number.MAX_VALUE;
33
33
  if (oldTabPos != pos)
34
- this.tabPositions.splice(pos > oldTabPos ? ind + 1 : ind, 0, new TabInfo(pos, TabAlign.Left, TabLeaderType.None, false, false));
34
+ this.tabPositions.splice(pos > oldTabPos ? ind + 1 : ind, 0, new TabInfo(pos, TabAlign.Left, TabLeaderType.None, false, false, true));
35
35
  }
36
36
  for (let pos of this.tabPositions)
37
37
  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) {
@@ -5,7 +5,7 @@ import { BorderLineStyle } from './enums';
5
5
  import { LayoutBorder } from './layout-border';
6
6
  export class BorderInfo {
7
7
  constructor() {
8
- this.style = BorderLineStyle.None;
8
+ this.style = BorderLineStyle.Nil;
9
9
  this.color = ColorModelInfoCache.defaultItem;
10
10
  this.width = 0;
11
11
  this.offset = 0;
@@ -54,7 +54,7 @@ export declare class MaskedCharacterProperties extends CharacterProperties imple
54
54
  protected calculateHash(): number;
55
55
  getUseValue(value: CharacterPropertiesMask): boolean;
56
56
  setUseValue(mask: CharacterPropertiesMask, value: boolean): void;
57
- setUseValueFull(value: number): void;
57
+ setUseValueFull(value: number, onlyForDefault?: boolean): void;
58
58
  getLowPartUseValue(value: number): number;
59
59
  getHighPartUseValue(value: number): number;
60
60
  getUseValueFull(): number;
@@ -5,6 +5,7 @@ import { ColorHelper } from '../color/color';
5
5
  import { ColorModelInfo } from '../color/color-model-info';
6
6
  import { ShadingInfo } from '../shadings/shading-info';
7
7
  import { ShadingPattern } from '../shadings/shading-pattern';
8
+ import { CharacterPropertyDescriptor } from './character-property-descriptor';
8
9
  import { CompositeFontInfo } from './composite-font-info';
9
10
  import { CharacterFormattingScript, CharacterPropertiesMask, StrikeoutType, UnderlineType } from './enums';
10
11
  import { LangInfo } from './lang-info';
@@ -143,8 +144,19 @@ export class MaskedCharacterProperties extends CharacterProperties {
143
144
  this.useValueExt &= ~this.getHighPartUseValue(mask);
144
145
  }
145
146
  }
146
- setUseValueFull(value) {
147
- this.useValue = this.getLowPartUseValue(value);
147
+ setUseValueFull(value, onlyForDefault = false) {
148
+ const lowPartUseValue = this.getLowPartUseValue(value);
149
+ if (onlyForDefault) {
150
+ CharacterPropertyDescriptor.ALL_FIELDS.forEach((desc) => {
151
+ const prop = desc.getProp(this);
152
+ const mask = desc.maskValue();
153
+ if (desc.binaryEquals(prop, desc.defaultValue))
154
+ this.setUseValue(mask, !!(mask & lowPartUseValue));
155
+ });
156
+ }
157
+ else {
158
+ this.useValue = lowPartUseValue;
159
+ }
148
160
  this.useValueExt = this.getHighPartUseValue(value);
149
161
  }
150
162
  getLowPartUseValue(value) {
@@ -14,7 +14,8 @@ import { HistoryItemIntervalStateObject, HistoryItemIntervalUseStateObject } fro
14
14
  export declare class FontUseValueHistoryItem extends IntervalBasedHistoryItem {
15
15
  oldState: HistoryItemIntervalState<HistoryItemIntervalStateObject>;
16
16
  newValue: number;
17
- constructor(modelManipulator: ModelManipulator, subDocInterval: SubDocumentInterval, newValue: number);
17
+ keepCustomFormatting: boolean;
18
+ constructor(modelManipulator: ModelManipulator, subDocInterval: SubDocumentInterval, newValue: number, keepCustomFormatting?: boolean);
18
19
  redo(): void;
19
20
  undo(): void;
20
21
  }
@@ -1,12 +1,13 @@
1
1
  import { Errors } from '@devexpress/utils/lib/errors';
2
2
  import { IntervalBasedHistoryItem } from '../base/interval-based-history-item';
3
3
  export class FontUseValueHistoryItem extends IntervalBasedHistoryItem {
4
- constructor(modelManipulator, subDocInterval, newValue) {
4
+ constructor(modelManipulator, subDocInterval, newValue, keepCustomFormatting = false) {
5
5
  super(modelManipulator, subDocInterval);
6
6
  this.newValue = newValue;
7
+ this.keepCustomFormatting = keepCustomFormatting;
7
8
  }
8
9
  redo() {
9
- this.oldState = this.modelManipulator.characterProperties.useValue.setValue(this.boundSubDocument, this.interval, this.newValue);
10
+ this.oldState = this.modelManipulator.characterProperties.useValue.setValue(this.boundSubDocument, this.interval, this.newValue, this.keepCustomFormatting);
10
11
  }
11
12
  undo() {
12
13
  this.modelManipulator.characterProperties.useValue.restoreValue(this.boundSubDocument, this.oldState);
@@ -74,7 +74,7 @@ class CharacterPropertiesUseValueManipulator {
74
74
  constructor(manipulator) {
75
75
  this.manipulator = manipulator;
76
76
  }
77
- setValue(subDocument, interval, newValue) {
77
+ setValue(subDocument, interval, newValue, keepCustomFormatting = false) {
78
78
  var oldState = new HistoryItemIntervalState();
79
79
  if (!ControlOptions.isEnabled(subDocument.documentModel.options.characterFormatting))
80
80
  return oldState;
@@ -84,7 +84,7 @@ class CharacterPropertiesUseValueManipulator {
84
84
  var run = iterator.currentRun;
85
85
  oldState.register(new HistoryItemIntervalStateObject(iterator.currentInterval(), run.maskedCharacterProperties.getUseValueFull()));
86
86
  var properties = run.maskedCharacterProperties.clone();
87
- properties.setUseValueFull(newValue);
87
+ properties.setUseValueFull(newValue, keepCustomFormatting);
88
88
  run.setCharacterProperties(properties);
89
89
  run.onCharacterPropertiesChanged();
90
90
  }
@@ -8,7 +8,7 @@ export interface IIntervalPropertyWithUseValueManipulator<T> {
8
8
  restoreValue(subDocument: SubDocument, state: HistoryItemIntervalState<HistoryItemIntervalUseStateObject>): any;
9
9
  }
10
10
  export interface IIntervalPropertyManipulator<T> {
11
- setValue(subDocument: SubDocument, interval: FixedInterval, newValue: T): HistoryItemIntervalState<HistoryItemIntervalStateObject>;
11
+ setValue(subDocument: SubDocument, interval: FixedInterval, newValue: T, keepCustomFormatting?: boolean): HistoryItemIntervalState<HistoryItemIntervalStateObject>;
12
12
  restoreValue(subDocument: SubDocument, state: HistoryItemIntervalState<HistoryItemIntervalStateObject>): any;
13
13
  }
14
14
  export interface IListLevelPropertyManipulator<T> {
@@ -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
  }
@@ -94,5 +94,6 @@ export declare enum ConditionalTableStyleFormatting {
94
94
  TopRightCell = 8,
95
95
  TopLeftCell = 4,
96
96
  BottomRightCell = 2,
97
- BottomLeftCell = 1
97
+ BottomLeftCell = 1,
98
+ None = 0
98
99
  }