devexpress-richedit 24.1.1-alpha-24085-0102 → 24.1.2-beta

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 (200) 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 +3 -1
  7. package/bin/webpack.config.js +1 -1
  8. package/dist/dx.richedit.css +1 -0
  9. package/dist/dx.richedit.d.ts +17 -10
  10. package/dist/dx.richedit.js +52855 -51531
  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/bars/ribbon.js +2 -1
  15. package/lib/client/bars/rich-edit-ribbon/ribbon-items-data.js +2 -1
  16. package/lib/client/client-rich-edit.js +2 -1
  17. package/lib/client/commands/client-command-manager.js +2 -1
  18. package/lib/client/commands/commands.js +3 -0
  19. package/lib/client/commands/download-document-command.d.ts +3 -0
  20. package/lib/client/commands/download-document-command.js +13 -2
  21. package/lib/client/commands/export-document-command.js +4 -4
  22. package/lib/client/commands/mail-merge-command.js +7 -4
  23. package/lib/client/commands/open-document-command.d.ts +2 -1
  24. package/lib/client/commands/open-document-command.js +17 -12
  25. package/lib/client/default-localization.js +2 -1
  26. package/lib/client/dialogs/finish-and-merge-dialog.js +1 -0
  27. package/lib/client/document-processor/processor.d.ts +9 -2
  28. package/lib/client/document-processor/processor.js +18 -6
  29. package/lib/client/formats/docx/export/data.d.ts +4 -0
  30. package/lib/client/formats/docx/export/data.js +12 -0
  31. package/lib/client/formats/docx/export/exporter.d.ts +2 -0
  32. package/lib/client/formats/docx/export/exporter.js +15 -0
  33. package/lib/client/formats/docx/export/exporters/base/sections.js +5 -0
  34. package/lib/client/formats/docx/export/exporters/note-properties.d.ts +18 -0
  35. package/lib/client/formats/docx/export/exporters/note-properties.js +83 -0
  36. package/lib/client/formats/docx/export/exporters/settings.d.ts +2 -0
  37. package/lib/client/formats/docx/export/exporters/settings.js +11 -0
  38. package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.d.ts +15 -1
  39. package/lib/client/formats/docx/export/exporters/sub-document/base-sub-document.js +85 -3
  40. package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.d.ts +2 -2
  41. package/lib/client/formats/docx/export/exporters/sub-document/header-footer-sub-document-exporter.js +2 -2
  42. package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.d.ts +2 -2
  43. package/lib/client/formats/docx/export/exporters/sub-document/main-sub-document.js +2 -2
  44. package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.d.ts +37 -0
  45. package/lib/client/formats/docx/export/exporters/sub-document/note-sub-document-exporter.js +71 -0
  46. package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.d.ts +2 -2
  47. package/lib/client/formats/docx/export/exporters/sub-document/text-box-content-exporter.js +2 -2
  48. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.d.ts +16 -0
  49. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-properties-destination.js +48 -0
  50. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.d.ts +5 -0
  51. package/lib/client/formats/docx/import/destination/notes/endnotes/endnote-reference-destination.js +9 -0
  52. package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.d.ts +5 -0
  53. package/lib/client/formats/docx/import/destination/notes/endnotes/endnotes-destination.js +39 -0
  54. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.d.ts +18 -0
  55. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-properties-destination.js +49 -0
  56. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.d.ts +5 -0
  57. package/lib/client/formats/docx/import/destination/notes/footnotes/footnote-reference-destination.js +9 -0
  58. package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.d.ts +5 -0
  59. package/lib/client/formats/docx/import/destination/notes/footnotes/footnotes-destination.js +39 -0
  60. package/lib/client/formats/docx/import/destination/notes/note-destination.d.ts +18 -0
  61. package/lib/client/formats/docx/import/destination/notes/note-destination.js +45 -0
  62. package/lib/client/formats/docx/import/destination/notes/note-properties-destination.d.ts +32 -0
  63. package/lib/client/formats/docx/import/destination/notes/note-properties-destination.js +81 -0
  64. package/lib/client/formats/docx/import/destination/notes/note-reference-destination.d.ts +8 -0
  65. package/lib/client/formats/docx/import/destination/notes/note-reference-destination.js +21 -0
  66. package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.d.ts +5 -0
  67. package/lib/client/formats/docx/import/destination/notes/note-self-reference-destination.js +12 -0
  68. package/lib/client/formats/docx/import/destination/notes/note-separator-destination.d.ts +8 -0
  69. package/lib/client/formats/docx/import/destination/notes/note-separator-destination.js +20 -0
  70. package/lib/client/formats/docx/import/destination/paragraph-properties/paragraph-numbering-reference-destination.js +1 -1
  71. package/lib/client/formats/docx/import/destination/runs/run-destination.js +11 -5
  72. package/lib/client/formats/docx/import/destination/section/section-destination.js +5 -2
  73. package/lib/client/formats/docx/import/destination/settings/settings.js +4 -0
  74. package/lib/client/formats/docx/import/importer.d.ts +2 -0
  75. package/lib/client/formats/docx/import/importer.js +26 -0
  76. package/lib/client/formats/docx/import/importers/character-importer.d.ts +3 -0
  77. package/lib/client/formats/docx/import/importers/character-importer.js +12 -1
  78. package/lib/client/formats/docx/import/importers/end-notes-importer.d.ts +3 -4
  79. package/lib/client/formats/docx/import/importers/end-notes-importer.js +8 -3
  80. package/lib/client/formats/docx/import/importers/foot-notes-importer.d.ts +3 -5
  81. package/lib/client/formats/docx/import/importers/foot-notes-importer.js +8 -5
  82. package/lib/client/formats/docx/import/importers/notes-importer.d.ts +8 -0
  83. package/lib/client/formats/docx/import/importers/notes-importer.js +7 -0
  84. package/lib/client/formats/docx/translation-table/translation-tables.d.ts +7 -0
  85. package/lib/client/formats/docx/translation-table/translation-tables.js +27 -0
  86. package/lib/client/formats/docx/utils/constants.d.ts +2 -0
  87. package/lib/client/formats/docx/utils/constants.js +2 -0
  88. package/lib/client/model-api/formats/enum.d.ts +1 -0
  89. package/lib/client/model-api/formats/enum.js +1 -0
  90. package/lib/client/model-api/formats/exporter.d.ts +3 -4
  91. package/lib/client/model-api/formats/exporter.js +9 -6
  92. package/lib/client/model-api/formats/importer.js +2 -0
  93. package/lib/client/model-api/sub-document.d.ts +6 -2
  94. package/lib/client/model-api/sub-document.js +37 -35
  95. package/lib/client/model-api/table/table-borders.d.ts +1 -1
  96. package/lib/client/public/commands/enum.d.ts +1 -0
  97. package/lib/client/public/commands/enum.js +1 -0
  98. package/lib/client/public/document-processor.d.ts +3 -1
  99. package/lib/client/public/document-processor.js +2 -2
  100. package/lib/client/public/ribbon/item-ids.d.ts +1 -0
  101. package/lib/client/public/ribbon/item-ids.js +1 -0
  102. package/lib/client/public/rich-edit.d.ts +2 -1
  103. package/lib/client/public/rich-edit.js +16 -9
  104. package/lib/common/canvas/canvas-manager.js +2 -1
  105. package/lib/common/canvas/picture-renderer.d.ts +1 -1
  106. package/lib/common/canvas/renderes/common/document-renderer.d.ts +1 -1
  107. package/lib/common/canvas/renderes/common/document-renderer.js +6 -2
  108. package/lib/common/canvas/renderes/view-manager.js +3 -1
  109. package/lib/common/clipboard-content-inserter.js +2 -1
  110. package/lib/common/commands/client-command.d.ts +3 -1
  111. package/lib/common/commands/client-command.js +2 -0
  112. package/lib/common/commands/document/print-document-on-client-command.js +1 -1
  113. package/lib/common/commands/text/clipboard-commands.js +7 -5
  114. package/lib/common/document-format.d.ts +2 -0
  115. package/lib/common/document-format.js +2 -0
  116. package/lib/common/formats/document-importer-errors.d.ts +3 -1
  117. package/lib/common/formats/document-importer-errors.js +2 -0
  118. package/lib/common/formats/file-name-helper.d.ts +1 -0
  119. package/lib/common/formats/file-name-helper.js +7 -1
  120. package/lib/common/formats/html/export/get-html.d.ts +4 -0
  121. package/lib/common/formats/html/export/get-html.js +12 -0
  122. package/lib/common/formats/html/export/html-builder.d.ts +16 -0
  123. package/lib/common/formats/html/export/html-builder.js +98 -0
  124. package/lib/common/formats/html/export/html-document-exporter.d.ts +13 -0
  125. package/lib/common/formats/html/export/html-document-exporter.js +29 -0
  126. package/lib/common/formats/html/export/html-export.d.ts +25 -0
  127. package/lib/common/{html-export.js → formats/html/export/html-export.js} +115 -192
  128. package/lib/common/formats/html/import/html-document-importer.d.ts +15 -0
  129. package/lib/common/formats/html/import/html-document-importer.js +84 -0
  130. package/lib/common/formats/html/import/html-importer.d.ts +1 -0
  131. package/lib/common/formats/html/import/html-importer.js +13 -1
  132. package/lib/common/formats/html/import/insert-html.d.ts +4 -0
  133. package/lib/common/formats/html/import/insert-html.js +5 -0
  134. package/lib/common/formats/html/import/utils/paragraph-properties-utils.d.ts +1 -0
  135. package/lib/common/formats/html/import/utils/paragraph-properties-utils.js +17 -4
  136. package/lib/common/formats/i-document-exporter.d.ts +14 -0
  137. package/lib/common/formats/rtf/export/exporter.d.ts +1 -1
  138. package/lib/common/formats/rtf/export/exporter.js +1 -1
  139. package/lib/common/formats/rtf/importer-in-subdocument.d.ts +1 -1
  140. package/lib/common/formats/rtf/importer-in-subdocument.js +1 -1
  141. package/lib/common/formats/txt/txt-exporter.js +2 -1
  142. package/lib/common/input-controller.d.ts +2 -1
  143. package/lib/common/input-controller.js +5 -2
  144. package/lib/common/interfaces/i-rich-edit-core.d.ts +2 -0
  145. package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.d.ts +2 -1
  146. package/lib/common/layout/main-structures/layout-boxes/layout-anchored-picture-box.js +4 -3
  147. package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.d.ts +2 -1
  148. package/lib/common/layout/main-structures/layout-boxes/layout-picture-box.js +5 -4
  149. package/lib/common/layout/main-structures/layout-page.d.ts +1 -0
  150. package/lib/common/layout/main-structures/layout-page.js +5 -2
  151. package/lib/common/layout-formatter/box/generator/box-infos-generator.d.ts +1 -0
  152. package/lib/common/layout-formatter/box/generator/box-infos-generator.js +12 -2
  153. package/lib/common/layout-formatter/floating/page-anchored-object-holder.d.ts +5 -3
  154. package/lib/common/layout-formatter/floating/page-anchored-object-holder.js +7 -4
  155. package/lib/common/layout-formatter/formatter/base-formatter.js +0 -1
  156. package/lib/common/layout-formatter/formatter/main-formatter.js +1 -0
  157. package/lib/common/layout-formatter/managers/formatter-manager.d.ts +6 -2
  158. package/lib/common/layout-formatter/managers/formatter-manager.js +3 -1
  159. package/lib/common/layout-formatter/row/size-engine/row-sizes-manager.js +20 -4
  160. package/lib/common/measurer/measurer.js +2 -1
  161. package/lib/common/model/chunk.d.ts +1 -0
  162. package/lib/common/model/chunk.js +27 -2
  163. package/lib/common/model/document-model.d.ts +4 -0
  164. package/lib/common/model/document-model.js +4 -1
  165. package/lib/common/model/enums.d.ts +3 -1
  166. package/lib/common/model/enums.js +2 -0
  167. package/lib/common/model/footnotes/footnote.d.ts +46 -0
  168. package/lib/common/model/footnotes/footnote.js +100 -0
  169. package/lib/common/model/json/importers/sub-document/json-sub-document-importer.js +3 -3
  170. package/lib/common/model/json/importers/sub-document/run-importers.d.ts +6 -0
  171. package/lib/common/model/json/importers/sub-document/run-importers.js +9 -0
  172. package/lib/common/model/model-checks/position.d.ts +2 -1
  173. package/lib/common/model/model-checks/position.js +11 -2
  174. package/lib/common/model/numbering-lists/numbering-helper.d.ts +2 -1
  175. package/lib/common/model/numbering-lists/numbering-helper.js +3 -0
  176. package/lib/common/model/paragraph/paragraph-style.d.ts +1 -0
  177. package/lib/common/model/paragraph/paragraph-style.js +6 -2
  178. package/lib/common/model/properties-merger/paragraph-properties-merger.js +1 -1
  179. package/lib/common/model/runs/run-base.d.ts +1 -0
  180. package/lib/common/model/runs/simple-runs.d.ts +8 -2
  181. package/lib/common/model/runs/simple-runs.js +12 -6
  182. package/lib/common/model/section/section-properties.d.ts +3 -0
  183. package/lib/common/model/special-characters.d.ts +3 -0
  184. package/lib/common/model/special-characters.js +3 -0
  185. package/lib/common/model/sub-document-infos.d.ts +18 -0
  186. package/lib/common/model/sub-document-infos.js +39 -0
  187. package/lib/common/model/sub-document.d.ts +2 -0
  188. package/lib/common/model/sub-document.js +18 -16
  189. package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.d.ts +1 -0
  190. package/lib/common/mouse-handler/touch-handler/touch-handler-state-base.js +21 -13
  191. package/lib/common/processor.d.ts +2 -0
  192. package/lib/common/rich-edit-core.d.ts +6 -2
  193. package/lib/common/rich-edit-core.js +20 -1
  194. package/lib/common/selection/selection-intervals-info.js +1 -1
  195. package/lib/common/utils/_license.d.ts +1 -0
  196. package/lib/common/utils/_license.js +2 -0
  197. package/lib/common/utils/size-utils.d.ts +3 -0
  198. package/lib/common/utils/size-utils.js +17 -4
  199. package/package.json +3 -3
  200. package/lib/common/html-export.d.ts +0 -32
@@ -11,6 +11,7 @@ import { TranslationTables } from '../../translation-table/translation-tables';
11
11
  import { WordProcessingMLValue } from '../../translation-table/word-processing-mlvalue';
12
12
  import { DocxConstants, DocxNsType } from '../../utils/constants';
13
13
  import { ExporterBaseWithRootElement } from './base';
14
+ import { NotePropertiesExporter } from './note-properties';
14
15
  export class SettingsExporter extends ExporterBaseWithRootElement {
15
16
  get filePath() { return 'word/settings.xml'; }
16
17
  get rootElement() { return new WordProcessingMLValue('settings', 'docPr').openXmlValue; }
@@ -25,6 +26,8 @@ export class SettingsExporter extends ExporterBaseWithRootElement {
25
26
  this.writer.writeWpIntValue('defaultTabStop', this.data.model.defaultTabWidth);
26
27
  this.writer.writeWpBoolValue('autoHyphenation', false);
27
28
  this.writer.writeWpBoolValue('evenAndOddHeaders', this.data.model.differentOddAndEvenPages);
29
+ this.exportFootNoteProperties();
30
+ this.exportEndNoteProperties();
28
31
  this.exportCompatSettings();
29
32
  this.exportDocumentVariables();
30
33
  this.exportColorSchemeMapping();
@@ -115,4 +118,12 @@ export class SettingsExporter extends ExporterBaseWithRootElement {
115
118
  if (properties.passwordPrefix)
116
119
  this.writer.writeWpStringAttr('salt', Base64Utils.fromArrayBuffer(properties.passwordPrefix));
117
120
  }
121
+ exportFootNoteProperties() {
122
+ const footNoteProperties = this.data.model.sections[0].sectionProperties.footNote;
123
+ new NotePropertiesExporter(this.data).exportDocumentLevelFootNoteProperties(footNoteProperties);
124
+ }
125
+ exportEndNoteProperties() {
126
+ const endNoteProperties = this.data.model.sections[0].sectionProperties.endNote;
127
+ new NotePropertiesExporter(this.data).exportDocumentLevelEndNoteProperties(endNoteProperties);
128
+ }
118
129
  }
@@ -30,10 +30,11 @@ export declare abstract class BaseSubDocumentExporter extends ExporterBaseWithRo
30
30
  private paragraph;
31
31
  private firstIteration;
32
32
  private readonly predefinedGroupNames;
33
- constructor(data: Data, subDocument: SubDocument, filePath: string);
33
+ constructor(data: Data, filePath: string);
34
34
  protected fillWriter(): void;
35
35
  protected abstract createRelationExporter(): RelationCollectionExporter;
36
36
  protected abstract fillWriterCore(): any;
37
+ protected abstract isMainContent(): boolean;
37
38
  protected init(): void;
38
39
  protected endParagraph(pos: number, section: Section, allowInitNextParagraph: boolean): void;
39
40
  getCurrentParagraphRun(): RunBase | null;
@@ -54,9 +55,22 @@ export declare abstract class BaseSubDocumentExporter extends ExporterBaseWithRo
54
55
  private anchoredTextRunHandler;
55
56
  private inlinePictureRunHandler;
56
57
  private layoutDependentRunHandler;
58
+ private footNoteRunHandler;
59
+ private exportFootNoteReference;
60
+ private endNoteRunHandler;
61
+ private exportEndNoteReference;
62
+ private tryExportNoteCustomMarkReference;
63
+ private exportNoteReference;
64
+ private noteSeparatorRunHandler;
65
+ private noteContinuationSeparatorRun;
66
+ private exportNoteSeparator;
57
67
  private exportBookmark;
58
68
  private exportRangePermission;
59
69
  private getGroupName;
60
70
  private exportFieldChar;
61
71
  private writeHideByParent;
62
72
  }
73
+ export declare abstract class SingleSubDocumentExoprter extends BaseSubDocumentExporter {
74
+ constructor(data: Data, subDocument: SubDocument, filePath: string);
75
+ protected isMainContent(): boolean;
76
+ }
@@ -3,6 +3,7 @@ import { CrossExistingIterator } from '../../../../../../common/formats/utils/cr
3
3
  import { Field } from '../../../../../../common/model/fields/field';
4
4
  import { ModelIterator } from '../../../../../../common/model/model-iterator';
5
5
  import { RunType } from '../../../../../../common/model/runs/run-type';
6
+ import { SubDocument } from '../../../../../../common/model/sub-document';
6
7
  import { Stack } from '@devexpress/utils/lib/class/stack';
7
8
  import { BoundaryInterval } from '@devexpress/utils/lib/intervals/boundary';
8
9
  import { Comparers } from '@devexpress/utils/lib/utils/comparers';
@@ -13,8 +14,9 @@ import { AnchoredDrawingPictureObject, AnchoredDrawingTextObject, InlineDrawingO
13
14
  import { ExporterBaseWithRootElement } from '../base';
14
15
  import { DrawingExporter } from '../base/drawing';
15
16
  import { TableExporter } from '../base/table/table';
17
+ import { isDefined } from '@devexpress/utils/lib/utils/common';
16
18
  export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
17
- constructor(data, subDocument, filePath) {
19
+ constructor(data, filePath) {
18
20
  super(data);
19
21
  this.fieldCodeDepth = 0;
20
22
  this.paragraph = null;
@@ -27,7 +29,6 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
27
29
  .add("Contributors", "contributors")
28
30
  .add("Administrators", "administrators")
29
31
  .get();
30
- this.subDocument = subDocument;
31
32
  this._filePath = filePath;
32
33
  this.hyperlinkRelationsTable = {};
33
34
  this.fieldsStack = new Stack();
@@ -43,6 +44,10 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
43
44
  [RunType.InlinePictureRun]: this.inlinePictureRunHandler,
44
45
  [RunType.InlineTextBoxRun]: null,
45
46
  [RunType.LayoutDependentRun]: this.layoutDependentRunHandler,
47
+ [RunType.FootNoteRun]: this.footNoteRunHandler,
48
+ [RunType.EndNoteRun]: this.endNoteRunHandler,
49
+ [RunType.NoteSeparatorRun]: this.noteSeparatorRunHandler,
50
+ [RunType.NoteContinuationSeparatorRun]: this.noteContinuationSeparatorRun,
46
51
  };
47
52
  this.tableExporter = new TableExporter(this.data);
48
53
  }
@@ -54,7 +59,7 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
54
59
  this.registerNamespaces();
55
60
  this.data.pushRelationExporter(this.createRelationExporter());
56
61
  this.fillWriterCore();
57
- if (!this.subDocument.isMain())
62
+ if (!this.isMainContent())
58
63
  this.data.popRelationExporter();
59
64
  this.data.subDocumentExporterStack.pop();
60
65
  }
@@ -160,6 +165,7 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
160
165
  textRunHandler(runText) {
161
166
  this.writer.writeWpStartElement('r');
162
167
  this.data.charPropsExporter.exportRunProperties(this.run);
168
+ this.tryExportNoteCustomMarkReference();
163
169
  this.data.textExporter.exportTextRunCore(runText);
164
170
  this.writer.endElement();
165
171
  }
@@ -186,6 +192,7 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
186
192
  anchoredPictureRunHandler() {
187
193
  this.writer.writeWpStartElement('r');
188
194
  this.data.charPropsExporter.exportRunProperties(this.run);
195
+ this.tryExportNoteCustomMarkReference();
189
196
  const picRun = this.run;
190
197
  if (this.shouldExportPicture(picRun.cacheInfo))
191
198
  new DrawingExporter(this.data).writeFloatingObjectDrawing(new AnchoredDrawingPictureObject(picRun), picRun.cacheInfo.currId);
@@ -194,6 +201,7 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
194
201
  anchoredTextRunHandler() {
195
202
  this.writer.writeWpStartElement('r');
196
203
  this.data.charPropsExporter.exportRunProperties(this.run);
204
+ this.tryExportNoteCustomMarkReference();
197
205
  const textBoxRun = this.run;
198
206
  new DrawingExporter(this.data).writeFloatingObjectTextBoxContent2010(new AnchoredDrawingTextObject(textBoxRun), this.data.model.subDocuments[textBoxRun.subDocId]);
199
207
  this.writer.endElement();
@@ -201,6 +209,7 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
201
209
  inlinePictureRunHandler() {
202
210
  this.writer.writeWpStartElement('r');
203
211
  this.data.charPropsExporter.exportRunProperties(this.run);
212
+ this.tryExportNoteCustomMarkReference();
204
213
  const picRun = this.run;
205
214
  if (this.shouldExportPicture(picRun.cacheInfo))
206
215
  new DrawingExporter(this.data).writeFloatingObjectDrawing(new InlineDrawingObject(picRun), picRun.cacheInfo.currId);
@@ -208,6 +217,70 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
208
217
  }
209
218
  layoutDependentRunHandler() {
210
219
  }
220
+ footNoteRunHandler() {
221
+ this.writer.writeWpStartElement('r');
222
+ this.data.charPropsExporter.exportRunProperties(this.run);
223
+ const subDocId = this.run.noteDocumentId;
224
+ if (isDefined(subDocId) && subDocId > SubDocument.MAIN_SUBDOCUMENT_ID)
225
+ this.exportFootNoteReference(subDocId, false);
226
+ else {
227
+ this.writer.writeWpStartElement('footnoteRef');
228
+ this.writer.endElement();
229
+ }
230
+ this.writer.endElement();
231
+ }
232
+ exportFootNoteReference(subDocId, isCustomMark) {
233
+ const note = this.data.model.subDocuments[subDocId];
234
+ const id = this.data.addFootNote(note);
235
+ this.exportNoteReference('footnoteReference', id, isCustomMark);
236
+ }
237
+ endNoteRunHandler() {
238
+ this.writer.writeWpStartElement('r');
239
+ this.data.charPropsExporter.exportRunProperties(this.run);
240
+ const subDocId = this.run.noteDocumentId;
241
+ if (isDefined(subDocId) && subDocId > SubDocument.MAIN_SUBDOCUMENT_ID)
242
+ this.exportEndNoteReference(subDocId, false);
243
+ else {
244
+ this.writer.writeWpStartElement('endnoteRef');
245
+ this.writer.endElement();
246
+ }
247
+ this.writer.endElement();
248
+ }
249
+ exportEndNoteReference(subDocId, isCustomMark) {
250
+ const note = this.data.model.subDocuments[subDocId];
251
+ const id = this.data.addEndNote(note);
252
+ this.exportNoteReference('endnoteReference', id, isCustomMark);
253
+ }
254
+ tryExportNoteCustomMarkReference() {
255
+ const subDocId = this.run.noteDocumentId;
256
+ if (!isDefined(subDocId))
257
+ return;
258
+ const note = this.data.model.subDocuments[subDocId];
259
+ if (note.isFootNote())
260
+ this.exportFootNoteReference(subDocId, true);
261
+ else
262
+ this.exportEndNoteReference(subDocId, true);
263
+ }
264
+ exportNoteReference(rootElement, id, isCustomMark) {
265
+ this.writer.writeWpStartElement(rootElement);
266
+ if (isCustomMark)
267
+ this.writer.writeWpBoolAttr('customMarkFollows', true);
268
+ this.writer.writeWpIntAttr('id', id);
269
+ this.writer.endElement();
270
+ }
271
+ noteSeparatorRunHandler() {
272
+ this.exportNoteSeparator('separator');
273
+ }
274
+ noteContinuationSeparatorRun() {
275
+ this.exportNoteSeparator('continuationSeparator');
276
+ }
277
+ exportNoteSeparator(separator) {
278
+ this.writer.writeWpStartElement('r');
279
+ this.data.charPropsExporter.exportRunProperties(this.run);
280
+ this.writer.writeWpStartElement(separator);
281
+ this.writer.endElement();
282
+ this.writer.endElement();
283
+ }
211
284
  exportBookmark(bookmarksIterator) {
212
285
  for (const state of bookmarksIterator.addedObjects) {
213
286
  this.writer.writeWpStartElement('bookmarkStart');
@@ -259,3 +332,12 @@ export class BaseSubDocumentExporter extends ExporterBaseWithRootElement {
259
332
  writeHideByParent() {
260
333
  }
261
334
  }
335
+ export class SingleSubDocumentExoprter extends BaseSubDocumentExporter {
336
+ constructor(data, subDocument, filePath) {
337
+ super(data, filePath);
338
+ this.subDocument = subDocument;
339
+ }
340
+ isMainContent() {
341
+ return this.subDocument.isMain();
342
+ }
343
+ }
@@ -1,8 +1,8 @@
1
1
  import { SubDocument } from '../../../../../../common/model/sub-document';
2
2
  import { Data } from '../../data';
3
3
  import { RelationCollectionExporter } from '../relations/relation-collection';
4
- import { BaseSubDocumentExporter } from './base-sub-document';
5
- export declare class HeaderFooterSubDocumentExporter extends BaseSubDocumentExporter {
4
+ import { SingleSubDocumentExoprter } from './base-sub-document';
5
+ export declare class HeaderFooterSubDocumentExporter extends SingleSubDocumentExoprter {
6
6
  private relsFilePath;
7
7
  get rootElement(): string;
8
8
  constructor(data: Data, subDocument: SubDocument, filePath: string, relsFilePath: string);
@@ -1,7 +1,7 @@
1
1
  import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
2
2
  import { RelationCollectionExporter } from '../relations/relation-collection';
3
- import { BaseSubDocumentExporter } from './base-sub-document';
4
- export class HeaderFooterSubDocumentExporter extends BaseSubDocumentExporter {
3
+ import { SingleSubDocumentExoprter } from './base-sub-document';
4
+ export class HeaderFooterSubDocumentExporter extends SingleSubDocumentExoprter {
5
5
  constructor(data, subDocument, filePath, relsFilePath) {
6
6
  super(data, subDocument, filePath);
7
7
  this.relsFilePath = relsFilePath;
@@ -1,6 +1,6 @@
1
1
  import { RelationCollectionExporter } from '../relations/relation-collection';
2
- import { BaseSubDocumentExporter } from './base-sub-document';
3
- export declare class MainSubDocumentExporter extends BaseSubDocumentExporter {
2
+ import { SingleSubDocumentExoprter as SingleSubDocumentExporter } from './base-sub-document';
3
+ export declare class MainSubDocumentExporter extends SingleSubDocumentExporter {
4
4
  protected createRelationExporter(): RelationCollectionExporter;
5
5
  get rootElement(): string;
6
6
  protected fillWriterCore(): void;
@@ -4,8 +4,8 @@ import { ThemeColorIndexConstants } from '../../../../../../common/model/color/e
4
4
  import { ListUtils } from '@devexpress/utils/lib/utils/list';
5
5
  import { SectionExporter } from '../base/sections';
6
6
  import { DocumentRelationsExporter } from '../relations/document-relations';
7
- import { BaseSubDocumentExporter } from './base-sub-document';
8
- export class MainSubDocumentExporter extends BaseSubDocumentExporter {
7
+ import { SingleSubDocumentExoprter as SingleSubDocumentExporter } from './base-sub-document';
8
+ export class MainSubDocumentExporter extends SingleSubDocumentExporter {
9
9
  createRelationExporter() { return new DocumentRelationsExporter(this.data); }
10
10
  get rootElement() { return 'document'; }
11
11
  fillWriterCore() {
@@ -0,0 +1,37 @@
1
+ import { SubDocument } from "../../../../../../common/model/sub-document";
2
+ import { Data } from "../../data";
3
+ import { RelationCollectionExporter } from "../relations/relation-collection";
4
+ import { BaseSubDocumentExporter } from "./base-sub-document";
5
+ declare abstract class NoteExporter extends BaseSubDocumentExporter {
6
+ private relsFilePath;
7
+ private fileName;
8
+ abstract get childElement(): string;
9
+ abstract get noteToIdMap(): Map<SubDocument, number>;
10
+ abstract get contentType(): string;
11
+ constructor(data: Data, fileName: string);
12
+ protected createRelationExporter(): RelationCollectionExporter;
13
+ protected isMainContent(): boolean;
14
+ protected fillWriterCore(): void;
15
+ private exportNotes;
16
+ private exportNoteContent;
17
+ private pushSubDocument;
18
+ private popSubDocument;
19
+ protected abstract addRels(fileName: string): any;
20
+ }
21
+ export declare class FootNoteExporter extends NoteExporter {
22
+ constructor(data: Data);
23
+ get rootElement(): string;
24
+ get childElement(): string;
25
+ get contentType(): string;
26
+ get noteToIdMap(): Map<SubDocument, number>;
27
+ protected addRels(fileName: string): void;
28
+ }
29
+ export declare class EndNoteExporter extends NoteExporter {
30
+ constructor(data: Data);
31
+ get rootElement(): string;
32
+ get childElement(): string;
33
+ get contentType(): string;
34
+ get noteToIdMap(): Map<SubDocument, number>;
35
+ protected addRels(fileName: string): void;
36
+ }
37
+ export {};
@@ -0,0 +1,71 @@
1
+ import { FixedInterval } from "@devexpress/utils/lib/intervals/fixed";
2
+ import { RelationCollectionExporter } from "../relations/relation-collection";
3
+ import { BaseSubDocumentExporter } from "./base-sub-document";
4
+ import { NoteType } from "../../../../../../common/model/footnotes/footnote";
5
+ import { TranslationTables } from "../../../translation-table/translation-tables";
6
+ import { ContentType } from "../../../utils/constants";
7
+ class NoteExporter extends BaseSubDocumentExporter {
8
+ constructor(data, fileName) {
9
+ super(data, `word/${fileName}`);
10
+ this.relsFilePath = `word/_rels/${fileName}.rels`;
11
+ this.fileName = fileName;
12
+ }
13
+ createRelationExporter() { return new RelationCollectionExporter(this.data, this.relsFilePath); }
14
+ isMainContent() {
15
+ return false;
16
+ }
17
+ fillWriterCore() {
18
+ this.exportNotes();
19
+ this.addRels(this.fileName);
20
+ this.data.contentTypesExporter.registerContentTypeOverride(`/word/${this.fileName}`, this.contentType);
21
+ }
22
+ exportNotes() {
23
+ for (const [note, id] of this.noteToIdMap.entries()) {
24
+ this.pushSubDocument(note);
25
+ this.writer.writeWpStartElement(this.childElement);
26
+ const type = note.info.noteType;
27
+ if (type !== NoteType.Normal)
28
+ this.writer.writeWpStringAttr('type', TranslationTables.noteTypeTable.exportMap[type].mlValue.openXmlValue);
29
+ this.writer.writeWpIntAttr('id', id);
30
+ this.exportNoteContent();
31
+ this.writer.endElement();
32
+ this.popSubDocument();
33
+ }
34
+ }
35
+ exportNoteContent() {
36
+ this.init();
37
+ this.exportSection(this.data.model.sections[0], new FixedInterval(0, this.subDocument.getDocumentEndPosition()));
38
+ }
39
+ pushSubDocument(subDocument) {
40
+ this.subDocument = subDocument;
41
+ }
42
+ popSubDocument() {
43
+ const subDocument = this.subDocument;
44
+ this.subDocument = null;
45
+ return subDocument;
46
+ }
47
+ }
48
+ export class FootNoteExporter extends NoteExporter {
49
+ constructor(data) {
50
+ super(data, 'footnotes.xml');
51
+ }
52
+ get rootElement() { return 'footnotes'; }
53
+ get childElement() { return 'footnote'; }
54
+ get contentType() { return ContentType.footnotes; }
55
+ get noteToIdMap() { return this.data.footNotes; }
56
+ addRels(fileName) {
57
+ this.data.mainSubDocumentRelations.footNoteRelationsTable['RelFootnotes'] = fileName;
58
+ }
59
+ }
60
+ export class EndNoteExporter extends NoteExporter {
61
+ constructor(data) {
62
+ super(data, 'endnotes.xml');
63
+ }
64
+ get rootElement() { return 'endnotes'; }
65
+ get childElement() { return 'endnote'; }
66
+ get contentType() { return ContentType.endnotes; }
67
+ get noteToIdMap() { return this.data.endNotes; }
68
+ addRels(fileName) {
69
+ this.data.mainSubDocumentRelations.endNoteRelationsTable['RelEndnotes'] = fileName;
70
+ }
71
+ }
@@ -1,8 +1,8 @@
1
1
  import { SubDocument } from '../../../../../../common/model/sub-document';
2
2
  import { Data } from '../../data';
3
3
  import { RelationCollectionExporter } from '../relations/relation-collection';
4
- import { BaseSubDocumentExporter } from './base-sub-document';
5
- export declare class TextBoxSubDocumentExporter extends BaseSubDocumentExporter {
4
+ import { SingleSubDocumentExoprter } from './base-sub-document';
5
+ export declare class TextBoxSubDocumentExporter extends SingleSubDocumentExoprter {
6
6
  get rootElement(): string;
7
7
  constructor(data: Data, subDocument: SubDocument);
8
8
  exportTextBoxContent(): void;
@@ -1,7 +1,7 @@
1
1
  import { Errors } from '@devexpress/utils/lib/errors';
2
2
  import { FixedInterval } from '@devexpress/utils/lib/intervals/fixed';
3
- import { BaseSubDocumentExporter } from './base-sub-document';
4
- export class TextBoxSubDocumentExporter extends BaseSubDocumentExporter {
3
+ import { SingleSubDocumentExoprter } from './base-sub-document';
4
+ export class TextBoxSubDocumentExporter extends SingleSubDocumentExoprter {
5
5
  get rootElement() { throw new Error(Errors.NotImplemented); }
6
6
  constructor(data, subDocument) {
7
7
  super(data, subDocument, '');
@@ -0,0 +1,16 @@
1
+ import { XmlReader } from "../../../../../../../client/formats/docx/zip/xml-reader";
2
+ import { NoteProperties } from "../../../../../../../common/model/footnotes/footnote";
3
+ import { Data } from "../../../data";
4
+ import { ElementHandlerTable } from "../../destination";
5
+ import { NotePropertiesDestination } from "../note-properties-destination";
6
+ export declare class SectionLevelEndNotePropertiesDestination extends NotePropertiesDestination {
7
+ constructor(data: Data);
8
+ protected setProperties(notes: NoteProperties): void;
9
+ }
10
+ export declare class DocumentLevelEndNotePropertiesDestination extends NotePropertiesDestination {
11
+ static handlerTable: ElementHandlerTable;
12
+ constructor(data: Data);
13
+ protected get elementHandlerTable(): ElementHandlerTable;
14
+ protected setProperties(notes: NoteProperties): void;
15
+ processElementClose(reader: XmlReader): Promise<void>;
16
+ }
@@ -0,0 +1,48 @@
1
+ import { __awaiter } from "tslib";
2
+ import { NotePosition } from "../../../../../../../common/model/footnotes/footnote";
3
+ import { NumberingFormat } from "../../../../../../../common/model/numbering-lists/list-level-properties";
4
+ import { MapCreator } from "../../../../../../../common/utils/map-creator";
5
+ import { StringUtils } from "@devexpress/utils/lib/utils/string";
6
+ import { LeafElementDestination } from "../../destination";
7
+ import { NotePropertiesDestination } from "../note-properties-destination";
8
+ export class SectionLevelEndNotePropertiesDestination extends NotePropertiesDestination {
9
+ constructor(data) {
10
+ super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal);
11
+ }
12
+ setProperties(notes) {
13
+ this.data.sectionImporter.properties.endNote = notes;
14
+ }
15
+ }
16
+ export class DocumentLevelEndNotePropertiesDestination extends NotePropertiesDestination {
17
+ constructor(data) {
18
+ super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal);
19
+ }
20
+ get elementHandlerTable() {
21
+ return DocumentLevelEndNotePropertiesDestination.handlerTable;
22
+ }
23
+ setProperties(notes) {
24
+ this.data.documentModel.sections[0].sectionProperties.endNote = notes;
25
+ }
26
+ processElementClose(reader) {
27
+ const _super = Object.create(null, {
28
+ processElementClose: { get: () => super.processElementClose }
29
+ });
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ _super.processElementClose.call(this, reader);
32
+ this.data.documentModel.documentEndNotePosition = this.notes.position;
33
+ });
34
+ }
35
+ }
36
+ DocumentLevelEndNotePropertiesDestination.handlerTable = new MapCreator()
37
+ .append(NotePropertiesDestination.handlerTable)
38
+ .add('endnote', (data) => new EndNoteSeparatorDestination(data))
39
+ .get();
40
+ class EndNoteSeparatorDestination extends LeafElementDestination {
41
+ processElementOpen(reader) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const id = reader.getAttributeNS("id", this.data.constants.wordProcessingNamespaceConst);
44
+ if (!StringUtils.isNullOrEmpty(id))
45
+ this.data.endNotesImporter.separatorIds.push(id);
46
+ });
47
+ }
48
+ }
@@ -0,0 +1,5 @@
1
+ import { NoteReferenceDestination } from "../note-reference-destination";
2
+ export declare class EndNoteReferenceDestination extends NoteReferenceDestination {
3
+ protected get notes(): Record<string, number>;
4
+ protected insertNoteRun(subDocId: number): void;
5
+ }
@@ -0,0 +1,9 @@
1
+ import { NoteReferenceDestination } from "../note-reference-destination";
2
+ export class EndNoteReferenceDestination extends NoteReferenceDestination {
3
+ get notes() {
4
+ return this.data.endNotesImporter.notes;
5
+ }
6
+ insertNoteRun(subDocId) {
7
+ this.data.endNotesImporter.insertRun(subDocId);
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ import { ElementDestination, ElementHandlerTable } from "../../destination";
2
+ export declare class EndNotesDestination extends ElementDestination {
3
+ static handlerTable: ElementHandlerTable;
4
+ protected get elementHandlerTable(): ElementHandlerTable;
5
+ }
@@ -0,0 +1,39 @@
1
+ import { MapCreator } from "../../../../../../../common/utils/map-creator";
2
+ import { ElementDestination } from "../../destination";
3
+ import { SubDocumentInfoType } from "../../../../../../../common/model/enums";
4
+ import { NoteType } from "../../../../../../../common/model/footnotes/footnote";
5
+ import { StringUtils } from "@devexpress/utils/lib/utils/string";
6
+ import { NoteDestination } from "../note-destination";
7
+ export class EndNotesDestination extends ElementDestination {
8
+ get elementHandlerTable() {
9
+ return EndNotesDestination.handlerTable;
10
+ }
11
+ }
12
+ EndNotesDestination.handlerTable = new MapCreator()
13
+ .add('endnote', (data) => new EndNoteDestination(data))
14
+ .get();
15
+ class EndNoteDestination extends NoteDestination {
16
+ get SubDocumentType() {
17
+ return SubDocumentInfoType.EndNote;
18
+ }
19
+ addNote(id, subDocId, type) {
20
+ if (!this.canAddEndNote(id, type))
21
+ return false;
22
+ if (type == NoteType.Normal)
23
+ this.data.endNotesImporter.notes[id] = subDocId;
24
+ else
25
+ this.documentModel.endNoteSeparators.setSeparator(subDocId, type);
26
+ return true;
27
+ }
28
+ canAddEndNote(id, type) {
29
+ if (StringUtils.isNullOrEmpty(id))
30
+ return false;
31
+ if (type == NoteType.Normal)
32
+ return !(id in this.data.endNotesImporter.notes);
33
+ else {
34
+ if (this.documentModel.endNoteSeparators.getSeparator(type) != null)
35
+ return false;
36
+ return this.data.endNotesImporter.separatorIds.includes(id);
37
+ }
38
+ }
39
+ }
@@ -0,0 +1,18 @@
1
+ import { Data } from "../../../data";
2
+ import { ElementHandlerTable, LeafElementDestination } from "../../destination";
3
+ import { NoteProperties } from "../../../../../../../common/model/footnotes/footnote";
4
+ import { XmlReader } from "../../../../zip/xml-reader";
5
+ import { NotePropertiesDestination } from "../note-properties-destination";
6
+ export declare class SectionLevelFootNotePropertiesDestination extends NotePropertiesDestination {
7
+ constructor(data: Data);
8
+ protected setProperties(notes: NoteProperties): void;
9
+ }
10
+ export declare class DocumentLevelFootNotePropertiesDestination extends NotePropertiesDestination {
11
+ static handlerTable: ElementHandlerTable;
12
+ constructor(data: Data);
13
+ protected get elementHandlerTable(): ElementHandlerTable;
14
+ protected setProperties(notes: NoteProperties): void;
15
+ }
16
+ export declare class SectionFootNoteColumnsCountDestination extends LeafElementDestination {
17
+ processElementOpen(reader: XmlReader): Promise<void>;
18
+ }
@@ -0,0 +1,49 @@
1
+ import { __awaiter } from "tslib";
2
+ import { MapCreator } from "../../../../../../../common/utils/map-creator";
3
+ import { LeafElementDestination } from "../../destination";
4
+ import { NoteProperties, NotePosition } from "../../../../../../../common/model/footnotes/footnote";
5
+ import { NumberingFormat } from "../../../../../../../common/model/numbering-lists/list-level-properties";
6
+ import { StringUtils } from "@devexpress/utils/lib/utils/string";
7
+ import { NotePropertiesDestination } from "../note-properties-destination";
8
+ export class SectionLevelFootNotePropertiesDestination extends NotePropertiesDestination {
9
+ constructor(data) {
10
+ super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal);
11
+ }
12
+ setProperties(notes) {
13
+ this.data.sectionImporter.properties.footNote = notes;
14
+ }
15
+ }
16
+ export class DocumentLevelFootNotePropertiesDestination extends NotePropertiesDestination {
17
+ constructor(data) {
18
+ super(data, NotePosition.BottomOfPage, NumberingFormat.Decimal);
19
+ }
20
+ get elementHandlerTable() {
21
+ return DocumentLevelFootNotePropertiesDestination.handlerTable;
22
+ }
23
+ setProperties(notes) {
24
+ this.data.documentModel.sections[0].sectionProperties.footNote = notes;
25
+ }
26
+ }
27
+ DocumentLevelFootNotePropertiesDestination.handlerTable = new MapCreator()
28
+ .append(NotePropertiesDestination.handlerTable)
29
+ .add('footnote', (data) => new FootNoteSeparatorDestination(data))
30
+ .get();
31
+ class FootNoteSeparatorDestination extends LeafElementDestination {
32
+ processElementOpen(reader) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const id = reader.getAttributeNS("id", this.data.constants.wordProcessingNamespaceConst);
35
+ if (!StringUtils.isNullOrEmpty(id))
36
+ this.data.footNotesImporter.separatorIds.push(id);
37
+ });
38
+ }
39
+ }
40
+ export class SectionFootNoteColumnsCountDestination extends LeafElementDestination {
41
+ processElementOpen(reader) {
42
+ var _a;
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const noteProps = (_a = this.data.sectionImporter.properties.footNote) !== null && _a !== void 0 ? _a : new NoteProperties();
45
+ noteProps.columnCount = this.data.readerHelper.getWpSTIntegerValue(reader, "val", 1);
46
+ this.data.sectionImporter.properties.footNote = noteProps;
47
+ });
48
+ }
49
+ }
@@ -0,0 +1,5 @@
1
+ import { NoteReferenceDestination } from "../note-reference-destination";
2
+ export declare class FootNoteReferenceDestination extends NoteReferenceDestination {
3
+ protected get notes(): Record<string, number>;
4
+ protected insertNoteRun(subDocId: number): void;
5
+ }
@@ -0,0 +1,9 @@
1
+ import { NoteReferenceDestination } from "../note-reference-destination";
2
+ export class FootNoteReferenceDestination extends NoteReferenceDestination {
3
+ get notes() {
4
+ return this.data.footNotesImporter.notes;
5
+ }
6
+ insertNoteRun(subDocId) {
7
+ this.data.footNotesImporter.insertRun(subDocId);
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ import { ElementDestination, ElementHandlerTable } from "../../destination";
2
+ export declare class FootNotesDestination extends ElementDestination {
3
+ static handlerTable: ElementHandlerTable;
4
+ protected get elementHandlerTable(): ElementHandlerTable;
5
+ }