devexpress-richedit 25.1.1-alpha → 25.1.3

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 (132) 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 -2
  10. package/dist/dx.richedit.js +1732 -1362
  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 +3 -3
  15. package/lib/client/commands/commands.js +0 -3
  16. package/lib/client/commands/mail-merge-command.js +2 -1
  17. package/lib/client/formats/docx/export/data.d.ts +5 -1
  18. package/lib/client/formats/docx/export/data.js +3 -2
  19. package/lib/client/formats/docx/export/exporter.d.ts +2 -3
  20. package/lib/client/formats/docx/export/exporter.js +3 -3
  21. package/lib/client/formats/docx/export/exporters/base/sections.d.ts +0 -1
  22. package/lib/client/formats/docx/export/exporters/base/sections.js +2 -10
  23. package/lib/client/formats/docx/export/exporters/base/table/table.d.ts +1 -1
  24. package/lib/client/formats/docx/export/exporters/base/table/table.js +4 -4
  25. package/lib/client/formats/docx/import/destination/paragraph-properties/properties/paragraph-spacing-destination.js +6 -4
  26. package/lib/client/model-api/character-properties.js +13 -17
  27. package/lib/client/model-api/document.js +2 -0
  28. package/lib/client/model-api/formats/exporter.js +2 -2
  29. package/lib/client/model-api/images/images.js +1 -1
  30. package/lib/client/model-api/sub-document.js +1 -1
  31. package/lib/client/public/commands/enum.d.ts +1 -2
  32. package/lib/client/public/commands/enum.js +0 -1
  33. package/lib/client/public/options.d.ts +1 -0
  34. package/lib/client/public/rich-edit.js +2 -2
  35. package/lib/client/utils/focus-helper.js +22 -5
  36. package/lib/common/canvas/canvas-manager.js +38 -24
  37. package/lib/common/canvas/canvas-scroll-info.d.ts +6 -3
  38. package/lib/common/canvas/canvas-scroll-info.js +9 -4
  39. package/lib/common/canvas/canvas-scroll-manager.d.ts +4 -1
  40. package/lib/common/canvas/canvas-scroll-manager.js +28 -20
  41. package/lib/common/canvas/canvas-size-info.d.ts +4 -2
  42. package/lib/common/canvas/canvas-size-info.js +3 -5
  43. package/lib/common/canvas/renderes/canvas-listener/print-layout-view-canvas-listener.js +2 -2
  44. package/lib/common/canvas/renderes/common/document-renderer.d.ts +4 -1
  45. package/lib/common/canvas/renderes/common/document-renderer.js +15 -12
  46. package/lib/common/canvas/renderes/view-manager.d.ts +5 -1
  47. package/lib/common/canvas/renderes/view-manager.js +16 -7
  48. package/lib/common/commands/client-command.d.ts +1 -2
  49. package/lib/common/commands/client-command.js +0 -1
  50. package/lib/common/commands/command-manager.js +0 -2
  51. package/lib/common/commands/document/print-document-on-client-command.d.ts +2 -0
  52. package/lib/common/commands/document/print-document-on-client-command.js +46 -18
  53. package/lib/common/commands/layout/apply-style-command.d.ts +2 -2
  54. package/lib/common/commands/layout/apply-style-command.js +3 -4
  55. package/lib/common/commands/toc/set-paragraph-level-command.js +1 -1
  56. package/lib/common/formats/i-document-exporter.d.ts +3 -0
  57. package/lib/common/formats/rtf/export/exporter.d.ts +2 -3
  58. package/lib/common/formats/rtf/export/exporter.js +3 -3
  59. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.d.ts +4 -2
  60. package/lib/common/formats/rtf/export/exporters/rtf-content-exporter.js +13 -9
  61. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.d.ts +3 -2
  62. package/lib/common/formats/rtf/export/exporters/table/rtf-table-exporter.js +4 -4
  63. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.d.ts +2 -1
  64. package/lib/common/formats/rtf/export/exporters/table/states/rtf-nested-table-exporter-state.js +2 -2
  65. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.d.ts +4 -2
  66. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state-base.js +16 -9
  67. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.d.ts +2 -1
  68. package/lib/common/formats/rtf/export/exporters/table/states/rtf-table-exporter-state.js +2 -2
  69. package/lib/common/formats/rtf/import/table/normalization/apply-use-values.d.ts +6 -0
  70. package/lib/common/formats/rtf/import/table/normalization/apply-use-values.js +90 -0
  71. package/lib/common/formats/rtf/import/table/table-converter.js +7 -2
  72. package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -2
  73. package/lib/common/formats/rtf/importer-in-subdocument.js +4 -3
  74. package/lib/common/input-controller.d.ts +5 -5
  75. package/lib/common/input-controller.js +16 -12
  76. package/lib/common/layout/document-layout.d.ts +5 -0
  77. package/lib/common/layout/document-layout.js +13 -0
  78. package/lib/common/layout/main-structures/layout-page-area.d.ts +3 -0
  79. package/lib/common/layout/main-structures/layout-page-area.js +6 -0
  80. package/lib/common/layout/main-structures/layout-page.d.ts +3 -0
  81. package/lib/common/layout/main-structures/layout-page.js +8 -0
  82. package/lib/common/layout/main-structures/layout-row.js +1 -2
  83. package/lib/common/layout-formatter/floating/position-calculators/horizontal.d.ts +1 -0
  84. package/lib/common/layout-formatter/floating/position-calculators/horizontal.js +16 -12
  85. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.d.ts +4 -1
  86. package/lib/common/layout-formatter/row/size-engine/row-formatting-info.js +36 -2
  87. package/lib/common/layout-formatter/row/states.js +0 -2
  88. package/lib/common/layout-formatter/row/tab-info.js +5 -4
  89. package/lib/common/layout-formatter/row/word-holder.js +1 -1
  90. package/lib/common/layout-formatter/table/info/table-info.d.ts +0 -1
  91. package/lib/common/layout-formatter/table/info/table-info.js +2 -18
  92. package/lib/common/layout-formatter/table/size-compressor.js +9 -2
  93. package/lib/common/layout-formatter/table/table-alignment-applier.js +0 -2
  94. package/lib/common/model/borders/border-info.js +1 -1
  95. package/lib/common/model/caches/images.d.ts +4 -1
  96. package/lib/common/model/caches/images.js +6 -2
  97. package/lib/common/model/changes/change.d.ts +2 -1
  98. package/lib/common/model/changes/enums.d.ts +2 -1
  99. package/lib/common/model/changes/enums.js +1 -0
  100. package/lib/common/model/changes/model/zoom-level.d.ts +8 -0
  101. package/lib/common/model/changes/model/zoom-level.js +8 -0
  102. package/lib/common/model/character/character-properties.d.ts +1 -1
  103. package/lib/common/model/character/character-properties.js +14 -2
  104. package/lib/common/model/creator/creator.js +6 -0
  105. package/lib/common/model/fields/field.d.ts +1 -1
  106. package/lib/common/model/fields/field.js +4 -3
  107. package/lib/common/model/fields/tree-creator.js +1 -1
  108. package/lib/common/model/history/items/character-properties-history-items.d.ts +2 -1
  109. package/lib/common/model/history/items/character-properties-history-items.js +3 -2
  110. package/lib/common/model/manipulators/character-properties-manipulator.js +2 -2
  111. package/lib/common/model/manipulators/i-properties-manipulator.d.ts +1 -1
  112. package/lib/common/model/manipulators/model-manipulator.d.ts +2 -1
  113. package/lib/common/model/manipulators/model-manipulator.js +4 -0
  114. package/lib/common/model/manipulators/picture-manipulator/picture-manipulator.js +2 -2
  115. package/lib/common/model/options/fonts.d.ts +1 -1
  116. package/lib/common/model/paragraph/paragraph-style.d.ts +2 -1
  117. package/lib/common/model/paragraph/paragraph-style.js +2 -1
  118. package/lib/common/model/tables/secondary-structures/table-base-structures.d.ts +2 -1
  119. package/lib/common/model/tables/secondary-structures/table-base-structures.js +1 -0
  120. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.d.ts +1 -1
  121. package/lib/common/mouse-handler/mouse-handler/mouse-handler-default-state.js +22 -25
  122. package/lib/common/rich-edit-core.js +18 -18
  123. package/lib/common/ui/ruler/controls/ruler.js +3 -7
  124. package/lib/common/ui/ruler/controls/vertical-line.js +2 -1
  125. package/lib/common/ui/ruler/ruler.js +2 -0
  126. package/lib/common/utils/mixed-size.d.ts +27 -0
  127. package/lib/common/utils/mixed-size.js +91 -0
  128. package/lib/common/utils/size-utils.d.ts +14 -7
  129. package/lib/common/utils/size-utils.js +43 -18
  130. package/package.json +3 -3
  131. package/lib/common/commands/layout/toggle-allow-zoom-command.d.ts +0 -7
  132. package/lib/common/commands/layout/toggle-allow-zoom-command.js +0 -17
@@ -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() {
@@ -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) {
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();
@@ -25,7 +25,7 @@ export class WordHolderInfo {
25
25
  }
26
26
  if (res == null)
27
27
  return false;
28
- if (this.rowFormatter.row.isEmpty()) {
28
+ if (this.rowFormatter.row.isEmpty() || this.rowFormatter.row.containsSpacesOnly()) {
29
29
  if (this.rowFormatter.rowSizesManager.rowFormattingInfo.isFloatingIntersectRow) {
30
30
  this.rowFormatter.rowSizesManager.rowFormattingInfo.findNextYPosWhatHasNeededSpace(res.requiredWidth);
31
31
  return this.pushBoxes();
@@ -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;
@@ -8,12 +8,15 @@ export declare class CacheImageInfo {
8
8
  private _convertedBase64?;
9
9
  private _size?;
10
10
  private _isLoaded;
11
+ private _isSizeDefined;
11
12
  tmpId?: number;
12
13
  actualId?: number;
13
14
  imageUrl?: string;
14
15
  file?: File;
15
16
  get isLoaded(): boolean;
16
17
  set isLoaded(val: boolean);
18
+ get isSizeDefined(): boolean;
19
+ set isSizeDefined(val: boolean);
17
20
  get size(): Size;
18
21
  set size(val: Size);
19
22
  get currId(): number;
@@ -22,7 +25,7 @@ export declare class CacheImageInfo {
22
25
  get pdfCompatibleBase64(): string | undefined;
23
26
  get referenceInfo(): CacheImageInfo | undefined;
24
27
  set referenceInfo(val: CacheImageInfo | undefined);
25
- constructor(base64?: string, actualId?: number, tmpId?: number, imageUrl?: string, file?: File, referenceInfo?: CacheImageInfo, size?: Size, isLoaded?: boolean);
28
+ constructor(base64?: string, actualId?: number, tmpId?: number, imageUrl?: string, file?: File, referenceInfo?: CacheImageInfo, size?: Size, isLoaded?: boolean, isActualSize?: boolean);
26
29
  equals(obj: CacheImageInfo): boolean;
27
30
  clone(): CacheImageInfo;
28
31
  shouldMakeImagePdfCompatible(): boolean;
@@ -7,6 +7,8 @@ export class CacheImageInfo {
7
7
  static get emptyPictureSize() { return new Size(CacheImageInfo.emptyPicDimension, CacheImageInfo.emptyPicDimension); }
8
8
  get isLoaded() { return this._referenceInfo ? this._referenceInfo._isLoaded : this._isLoaded; }
9
9
  set isLoaded(val) { this._isLoaded = val; }
10
+ get isSizeDefined() { return this._referenceInfo ? this._referenceInfo._isSizeDefined : this._isSizeDefined; }
11
+ set isSizeDefined(val) { this._isSizeDefined = val; }
10
12
  get size() { return this._referenceInfo ? this._referenceInfo._size : this._size; }
11
13
  set size(val) { this._size = val; }
12
14
  get currId() { return this.actualId !== undefined ? this.actualId : this.tmpId; }
@@ -19,15 +21,17 @@ export class CacheImageInfo {
19
21
  this._base64 = undefined;
20
22
  this._size = undefined;
21
23
  this._isLoaded = undefined;
24
+ this._isSizeDefined = undefined;
22
25
  this.file = undefined;
23
26
  }
24
- constructor(base64, actualId, tmpId, imageUrl, file, referenceInfo, size, isLoaded) {
27
+ constructor(base64, actualId, tmpId, imageUrl, file, referenceInfo, size, isLoaded, isActualSize) {
25
28
  this._base64 = base64 !== undefined ? Base64Utils.normalizeToDataUrl(base64, "image/png") : undefined;
26
29
  this.actualId = actualId;
27
30
  this.tmpId = tmpId;
28
31
  this._referenceInfo = referenceInfo;
29
32
  this._size = size ? size : CacheImageInfo.emptyPictureSize;
30
33
  this._isLoaded = isLoaded !== undefined ? isLoaded : false;
34
+ this._isSizeDefined = isActualSize ? isActualSize : !!size;
31
35
  this.imageUrl = imageUrl;
32
36
  this.file = file;
33
37
  }
@@ -41,7 +45,7 @@ export class CacheImageInfo {
41
45
  this.size.equals(obj.size);
42
46
  }
43
47
  clone() {
44
- return new CacheImageInfo(this._base64, this.actualId, this.tmpId, this.imageUrl, this.file, this._referenceInfo, this._size, this._isLoaded);
48
+ return new CacheImageInfo(this._base64, this.actualId, this.tmpId, this.imageUrl, this.file, this._referenceInfo, this._size, this._isLoaded, this._isSizeDefined);
45
49
  }
46
50
  shouldMakeImagePdfCompatible() {
47
51
  if (isDefined(this._convertedBase64))
@@ -17,6 +17,7 @@ import { LoadFontInfoModelChange } from './model/load-font';
17
17
  import { PageColorModelChange } from './model/page-color';
18
18
  import { SectionsFormattingChangedModelChange } from './model/section-formatting-changed';
19
19
  import { SectionMergedSubDocumentChange } from './model/section-merged';
20
+ import { ZoomLevelChange } from './model/zoom-level';
20
21
  import { AnchorInfoPropertyChangedSubDocumentChange } from './sub-document/anchor/anchor-info-property-changed';
21
22
  import { AnchoredTextBoxPropertiesChangedSubDocumentChange } from './sub-document/anchor/anchored-text-box-properties-changed';
22
23
  import { AnchoredTextBoxSizeChangedSubDocumentChange } from './sub-document/anchor/anchored-text-box-size-changed';
@@ -66,4 +67,4 @@ import { ParagraphMergedSubDocumentChange } from './sub-document/text/paragraph-
66
67
  import { SectionInsertedSubDocumentChange } from './sub-document/text/section-inserted';
67
68
  import { SimpleRunInsertedSubDocumentChange } from './sub-document/text/simple-run-inserted';
68
69
  import { TextBufferChangedSubDocumentChange } from './sub-document/text/text-buffer-changed';
69
- export type ModelChange = PageColorModelChange | DefaultTabWidthModelChange | DifferentOddAndEvenPagesModelChange | HeaderFooterCreatedModelChange | HeaderFooterIndexChangedModelChange | LoadFontInfoModelChange | SectionsFormattingChangedModelChange | CreateStyleLinkModelChange | DeleteStyleLinkModelChange | DocumentProtectionChangedModelChange | AbstractNumberingListAddedModelChange | AbstractNumberingListDeletedModelChange | NumberingListAddedModelChange | NumberingListDeletedModelChange | ListLevelPropertyChangedModelChange | ListLevelParagraphPropertyChangedModelChange | ListLevelCharacterPropertyChangedModelChange | IOverrideListLevelChangedModelChange | BookmarkCreatedSubDocumentChange | BookmarkDeletedSubDocumentChange | TabInsertedSubDocumentChange | TabDeletedSubDocumentChange | LoadPicturesInfoSubDocumentChange | InlinePictureInsertedSubDocumentChange | InlinePicturesUpdatedSubDocumentChange | AnchoredPictureInsertedSubDocumentChange | AnchoredPictureSizeChangedSubDocumentChange | InlineObjectRunPropertyChangedSubDocumentChange | FieldInsertedSubDocumentChange | FieldDeletedSubDocumentChange | HyperlinkInfoChangedSubDocumentChange | FieldsShowCodeChangedSubDocumentChange | SimpleRunInsertedSubDocumentChange | TextBufferChangedSubDocumentChange | ParagraphInsertedSubDocumentChange | SectionInsertedSubDocumentChange | AnchoredTextBoxInsertedSubDocumentChange | AnchorObjectRemovedSubDocumentChange | IntervalRemovedSubDocumentChange | ParagraphMergedSubDocumentChange | SectionMergedSubDocumentChange | CharacterFormattingChangedSubDocumentChange | CharacterPropertiesChangedSubDocumentChange | ParagraphFormattingChangedSubDocumentChange | ParagraphPropertiesChangedSubDocumentChange | ParagraphAndCharacterMergedPropertiesResetSubDocumentChange | AnchoredTextBoxSizeChangedSubDocumentChange | AnchoredTextBoxPropertiesChangedSubDocumentChange | AnchorInfoPropertyChangedSubDocumentChange | ShapeChangedSubDocumentChange | ShapePropertyChangedSubDocumentChange | CharacterStyleAppliedSubDocumentChange | ParagraphStyleAppliedSubDocumentChange | TableStyleChangedSubDocumentChange | ParagraphNumberingListChangedSubDocumentChange | TableCreatedSubDocumentChange | TableRemovedSubDocumentChange | TableStartPositionShiftedSubDocumentChange | TableCellPropertyChangedSubDocumentChange | TablePropertyChangedSubDocumentChange | TableRowPropertyChangedSubDocumentChange | TableCellSplittedHorizontallySubDocumentChange | TableCellMergedHorizontallySubDocumentChange | TableRowInsertedSubDocumentChange | TableRowRemovedSubDocumentChange | TableCellRemovedSubDocumentChange | TableCellInsertedSubDocumentChange | RangePermissionsChangedSubDocumentChange | RangePermissionsPropertiesChange;
70
+ export type ModelChange = PageColorModelChange | DefaultTabWidthModelChange | DifferentOddAndEvenPagesModelChange | HeaderFooterCreatedModelChange | HeaderFooterIndexChangedModelChange | LoadFontInfoModelChange | SectionsFormattingChangedModelChange | CreateStyleLinkModelChange | DeleteStyleLinkModelChange | DocumentProtectionChangedModelChange | AbstractNumberingListAddedModelChange | AbstractNumberingListDeletedModelChange | NumberingListAddedModelChange | NumberingListDeletedModelChange | ListLevelPropertyChangedModelChange | ListLevelParagraphPropertyChangedModelChange | ListLevelCharacterPropertyChangedModelChange | IOverrideListLevelChangedModelChange | BookmarkCreatedSubDocumentChange | BookmarkDeletedSubDocumentChange | TabInsertedSubDocumentChange | TabDeletedSubDocumentChange | LoadPicturesInfoSubDocumentChange | InlinePictureInsertedSubDocumentChange | InlinePicturesUpdatedSubDocumentChange | AnchoredPictureInsertedSubDocumentChange | AnchoredPictureSizeChangedSubDocumentChange | InlineObjectRunPropertyChangedSubDocumentChange | FieldInsertedSubDocumentChange | FieldDeletedSubDocumentChange | HyperlinkInfoChangedSubDocumentChange | FieldsShowCodeChangedSubDocumentChange | SimpleRunInsertedSubDocumentChange | TextBufferChangedSubDocumentChange | ParagraphInsertedSubDocumentChange | SectionInsertedSubDocumentChange | AnchoredTextBoxInsertedSubDocumentChange | AnchorObjectRemovedSubDocumentChange | IntervalRemovedSubDocumentChange | ParagraphMergedSubDocumentChange | SectionMergedSubDocumentChange | CharacterFormattingChangedSubDocumentChange | CharacterPropertiesChangedSubDocumentChange | ParagraphFormattingChangedSubDocumentChange | ParagraphPropertiesChangedSubDocumentChange | ParagraphAndCharacterMergedPropertiesResetSubDocumentChange | AnchoredTextBoxSizeChangedSubDocumentChange | AnchoredTextBoxPropertiesChangedSubDocumentChange | AnchorInfoPropertyChangedSubDocumentChange | ShapeChangedSubDocumentChange | ShapePropertyChangedSubDocumentChange | CharacterStyleAppliedSubDocumentChange | ParagraphStyleAppliedSubDocumentChange | TableStyleChangedSubDocumentChange | ParagraphNumberingListChangedSubDocumentChange | TableCreatedSubDocumentChange | TableRemovedSubDocumentChange | TableStartPositionShiftedSubDocumentChange | TableCellPropertyChangedSubDocumentChange | TablePropertyChangedSubDocumentChange | TableRowPropertyChangedSubDocumentChange | TableCellSplittedHorizontallySubDocumentChange | TableCellMergedHorizontallySubDocumentChange | TableRowInsertedSubDocumentChange | TableRowRemovedSubDocumentChange | TableCellRemovedSubDocumentChange | TableCellInsertedSubDocumentChange | RangePermissionsChangedSubDocumentChange | RangePermissionsPropertiesChange | ZoomLevelChange;
@@ -67,5 +67,6 @@ export declare enum ModelChangeType {
67
67
  TableCellRemoved = 65,
68
68
  TableCellInserted = 66,
69
69
  RangePermissionsChanged = 67,
70
- RangePermissionsPropertiesChanged = 68
70
+ RangePermissionsPropertiesChanged = 68,
71
+ ZoomLevelChanged = 69
71
72
  }
@@ -69,4 +69,5 @@ export var ModelChangeType;
69
69
  ModelChangeType[ModelChangeType["TableCellInserted"] = 66] = "TableCellInserted";
70
70
  ModelChangeType[ModelChangeType["RangePermissionsChanged"] = 67] = "RangePermissionsChanged";
71
71
  ModelChangeType[ModelChangeType["RangePermissionsPropertiesChanged"] = 68] = "RangePermissionsPropertiesChanged";
72
+ ModelChangeType[ModelChangeType["ZoomLevelChanged"] = 69] = "ZoomLevelChanged";
72
73
  })(ModelChangeType || (ModelChangeType = {}));
@@ -0,0 +1,8 @@
1
+ import { ModelChangeBase } from '../change-base';
2
+ import { ModelChangeType } from '../enums';
3
+ export declare class ZoomLevelChange implements ModelChangeBase {
4
+ zoomLevel: number;
5
+ prevZoomLevel: number;
6
+ readonly type = ModelChangeType.ZoomLevelChanged;
7
+ constructor(zoomLevel: number, prevZoomLevel: number);
8
+ }
@@ -0,0 +1,8 @@
1
+ import { ModelChangeType } from '../enums';
2
+ export class ZoomLevelChange {
3
+ constructor(zoomLevel, prevZoomLevel) {
4
+ this.zoomLevel = zoomLevel;
5
+ this.prevZoomLevel = prevZoomLevel;
6
+ this.type = ModelChangeType.ZoomLevelChanged;
7
+ }
8
+ }
@@ -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) {
@@ -27,6 +27,7 @@ import { TableRowProperties, TableRowPropertiesMask } from '../tables/properties
27
27
  import { TableConditionalStyle } from '../tables/styles/table-conditional-style';
28
28
  import { TableStyle } from '../tables/styles/table-style';
29
29
  import { SystemColorValues } from '../themes/enums';
30
+ import { TableWidthUnitType } from '../tables/secondary-structures/table-units';
30
31
  export class ModelCreator {
31
32
  constructor(options) {
32
33
  this.options = options;
@@ -122,6 +123,11 @@ export class ModelCreator {
122
123
  }
123
124
  if (this.options.fillTableStyles) {
124
125
  const tableConditionalStyle = new TableConditionalStyle(templateTableProp, templateTableRowProp, templateTableCellProp, templateParProp, templateCharProps, templateTabProp);
126
+ tableConditionalStyle.tableProperties.cellMargins.left.type = TableWidthUnitType.ModelUnits;
127
+ tableConditionalStyle.tableProperties.cellMargins.left.value = 108;
128
+ tableConditionalStyle.tableProperties.cellMargins.right.type = TableWidthUnitType.ModelUnits;
129
+ tableConditionalStyle.tableProperties.cellMargins.right.value = 108;
130
+ tableConditionalStyle.tableProperties.mask = TablePropertiesMask.UseLeftMargin | TablePropertiesMask.UseRightMargin;
125
131
  model.stylesManager.addTableStyle(new TableStyle(TableStyle.DEFAULT_STYLENAME, TableStyle.DEFAULT_STYLENAME, false, false, false, true, {}, tableConditionalStyle, null));
126
132
  }
127
133
  if (this.options.initOfficeTheme)
@@ -99,7 +99,7 @@ export declare class Field {
99
99
  static correctIntervalDueToFieldsWithoutUiChecks(subDocument: SubDocument, newInterval: FixedInterval): FixedInterval;
100
100
  private static correctIntervalDueToFieldsCaseSelectionCollapsed;
101
101
  static correctIntervalDueToFields(subDocument: SubDocument, newInterval: FixedInterval): number;
102
- private static isFloatingObjectSelected;
102
+ private static isResizableObjectSelected;
103
103
  static correctWhenPositionInStartCode(fields: Field[], position: number): number;
104
104
  clone(subDocument: SubDocument): Field;
105
105
  }
@@ -287,15 +287,16 @@ export class Field {
287
287
  return newInterval.start = Field.correctIntervalDueToFieldsCaseSelectionCollapsed(subDocument.fields, newInterval.start);
288
288
  const indexesInterval = Field.correctIntervalDueToFieldsWithoutUiChecks(subDocument, newInterval);
289
289
  ListUtils.forEach(fields, (field) => {
290
- if (field.getResultInterval().equals(newInterval) && !this.isFloatingObjectSelected(subDocument, newInterval))
290
+ if (field.getResultInterval().equals(newInterval) && !this.isResizableObjectSelected(subDocument, newInterval))
291
291
  newInterval.expand(field.getAllFieldInterval());
292
292
  }, indexesInterval.start, indexesInterval.end);
293
293
  }
294
- static isFloatingObjectSelected(subDocument, interval) {
294
+ static isResizableObjectSelected(subDocument, interval) {
295
295
  if (interval.length !== 1)
296
296
  return false;
297
297
  const run = subDocument.getRunByPosition(interval.start);
298
- return run && (run.getType() == RunType.AnchoredPictureRun || run.getType() == RunType.AnchoredTextBoxRun);
298
+ const runType = run && run.getType();
299
+ return runType == RunType.AnchoredPictureRun || runType == RunType.AnchoredTextBoxRun || runType == RunType.InlinePictureRun;
299
300
  }
300
301
  static correctWhenPositionInStartCode(fields, position) {
301
302
  if (fields.length < 1)
@@ -104,7 +104,7 @@ export class FieldsWaitingForUpdate {
104
104
  }
105
105
  if (!fieldParser.update(response)) {
106
106
  someFieldInCurrentInfoNotUpdated = true;
107
- info.parsers.push(fieldParser);
107
+ info.parsers.unshift(fieldParser);
108
108
  }
109
109
  else
110
110
  fieldParser.destructor();
@@ -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> {
@@ -62,10 +62,11 @@ export declare class ModelManipulator {
62
62
  textBox: TextBoxManipulator;
63
63
  paragraph: ParagraphManipulator;
64
64
  documentMerger: DocumentMerger;
65
- modelListeners: IModelChangesListener[];
65
+ private modelListeners;
66
66
  onFontsChanged: EventDispatcher<IFontsChangesListener>;
67
67
  constructor(modelManager: IModelManager, batchUpdatableObject: IBatchUpdatableObject);
68
68
  notifyModelChanged(change: ModelChange): void;
69
+ addModelListener(listener: IModelChangesListener): void;
69
70
  removeModelListener(listener: IModelChangesListener): void;
70
71
  raiseFontAdded(newFontInfo: FontInfo | null): void;
71
72
  raiseFontRemoved(font: FontInfo | null): void;
@@ -61,6 +61,10 @@ export class ModelManipulator {
61
61
  notifyModelChanged(change) {
62
62
  this.modelListeners.forEach(listener => listener.modelChanged(change));
63
63
  }
64
+ addModelListener(listener) {
65
+ if (this.modelListeners.indexOf(listener) < 0)
66
+ this.modelListeners.push(listener);
67
+ }
64
68
  removeModelListener(listener) {
65
69
  const index = this.modelListeners.indexOf(listener);
66
70
  if (index >= 0)
@@ -88,7 +88,7 @@ export class PictureManipulator extends RunsBaseManipulator {
88
88
  this.history.addTransaction(() => {
89
89
  this.modelManipulator.range.removeInterval(new SubDocumentInterval(subDocument, interval), true, false);
90
90
  const newInfo = new InlinePictureInfo(pictureRun.size.clone(), new Shape(), -1, pictureRun.info.containerProperties, pictureRun.info.nonVisualDrawingProperties);
91
- this.modelManipulator.picture.insertInlinePictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo);
91
+ this.modelManipulator.picture.insertInlinePictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo, new ImageLoadingOptions(!pictureRun.cacheInfo.isSizeDefined));
92
92
  });
93
93
  }
94
94
  }
@@ -103,7 +103,7 @@ export class PictureManipulator extends RunsBaseManipulator {
103
103
  anchorInfo.zOrder = this.modelManipulator.floatingObject.zOrder.getNewZOrder(subDocument);
104
104
  this.modelManipulator.range.removeInterval(new SubDocumentInterval(subDocument, interval), true, false);
105
105
  const newInfo = new AnchorPictureInfo(pictureRun.size.clone(), new Shape(), anchorInfo, pictureRun.info.containerProperties, pictureRun.info.nonVisualDrawingProperties);
106
- this.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo, new ImageLoadingOptions(false));
106
+ this.modelManipulator.picture.insertAnchoredPictureViaHistory(new SubDocumentPosition(subDocument, interval.start), charPropsBundle, newInfo, new ImageLoadingOptions(!pictureRun.cacheInfo.isSizeDefined));
107
107
  run = subDocument.getRunByPosition(interval.start);
108
108
  }
109
109
  let anchoredRun = run.getType() == RunType.AnchoredPictureRun ? run : run;
@@ -9,7 +9,7 @@ export interface IFontSettings {
9
9
  name: string;
10
10
  fontFamily: string;
11
11
  googleFontsResponse?: string;
12
- useGoogleFonts?: string;
12
+ useGoogleFonts?: boolean;
13
13
  italicFontUri?: string;
14
14
  boldFontUri?: string;
15
15
  boldItalicFontUri?: string;