@syncfusion/ej2-docx-renderer 0.0.0-stage → 35.2.15

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 (129) hide show
  1. package/README.md +2 -2
  2. package/base.d.ts +4 -0
  3. package/base.js +4 -0
  4. package/dist/ej2-docx-renderer.umd.min.js +2 -0
  5. package/dist/ej2-docx-renderer.umd.min.js.map +1 -0
  6. package/dist/es6/ej2-docx-renderer.es2015.js +52432 -0
  7. package/dist/es6/ej2-docx-renderer.es2015.js.map +1 -0
  8. package/dist/es6/ej2-docx-renderer.es5.js +54425 -0
  9. package/dist/es6/ej2-docx-renderer.es5.js.map +1 -0
  10. package/dist/global/ej2-docx-renderer.min.js +2 -0
  11. package/dist/global/ej2-docx-renderer.min.js.map +1 -0
  12. package/dist/global/index.d.ts +5 -0
  13. package/format.d.ts +4 -0
  14. package/format.js +4 -0
  15. package/helper.d.ts +4 -0
  16. package/helper.js +4 -0
  17. package/index.d.ts +4 -0
  18. package/index.js +4 -0
  19. package/license +10 -0
  20. package/list.d.ts +4 -0
  21. package/list.js +4 -0
  22. package/package.json +26 -4
  23. package/parser.d.ts +4 -0
  24. package/parser.js +4 -0
  25. package/src/base/constants.d.ts +2 -0
  26. package/src/base/constants.js +2 -0
  27. package/src/base/dictionary.d.ts +52 -0
  28. package/src/base/dictionary.js +137 -0
  29. package/src/base/index.d.ts +9 -0
  30. package/src/base/index.js +9 -0
  31. package/src/base/keywords.d.ts +422 -0
  32. package/src/base/keywords.js +422 -0
  33. package/src/base/types.d.ts +2590 -0
  34. package/src/base/types.js +1056 -0
  35. package/src/base/unique-format.d.ts +87 -0
  36. package/src/base/unique-format.js +858 -0
  37. package/src/base/unique-formats.d.ts +32 -0
  38. package/src/base/unique-formats.js +87 -0
  39. package/src/document-canvas.d.ts +61 -0
  40. package/src/document-canvas.js +221 -0
  41. package/src/docx-renderer.d.ts +941 -0
  42. package/src/docx-renderer.js +2251 -0
  43. package/src/format/border.d.ts +53 -0
  44. package/src/format/border.js +600 -0
  45. package/src/format/borders.d.ts +44 -0
  46. package/src/format/borders.js +314 -0
  47. package/src/format/cell-format.d.ts +42 -0
  48. package/src/format/cell-format.js +309 -0
  49. package/src/format/character-format.d.ts +152 -0
  50. package/src/format/character-format.js +1224 -0
  51. package/src/format/index.d.ts +14 -0
  52. package/src/format/index.js +14 -0
  53. package/src/format/list-format.d.ts +32 -0
  54. package/src/format/list-format.js +238 -0
  55. package/src/format/paragraph-format.d.ts +103 -0
  56. package/src/format/paragraph-format.js +854 -0
  57. package/src/format/row-format.d.ts +119 -0
  58. package/src/format/row-format.js +545 -0
  59. package/src/format/section-format.d.ts +89 -0
  60. package/src/format/section-format.js +689 -0
  61. package/src/format/shading.d.ts +24 -0
  62. package/src/format/shading.js +137 -0
  63. package/src/format/style.d.ts +106 -0
  64. package/src/format/style.js +286 -0
  65. package/src/format/table-format.d.ts +51 -0
  66. package/src/format/table-format.js +395 -0
  67. package/src/global.js +1 -0
  68. package/src/helper/document-editor-helper.d.ts +515 -0
  69. package/src/helper/document-editor-helper.js +1302 -0
  70. package/src/helper/document-editor-settings.d.ts +293 -0
  71. package/src/helper/document-editor-settings.js +94 -0
  72. package/src/helper/index.d.ts +5 -0
  73. package/src/helper/index.js +5 -0
  74. package/src/helper/layout-helper-methods.d.ts +539 -0
  75. package/src/helper/layout-helper-methods.js +1065 -0
  76. package/src/helper/renderer-hooks.d.ts +74 -0
  77. package/src/helper/renderer-hooks.js +14 -0
  78. package/src/helper/revision-helper-methods.d.ts +199 -0
  79. package/src/helper/revision-helper-methods.js +362 -0
  80. package/src/index.d.ts +18 -0
  81. package/src/index.js +18 -0
  82. package/src/layout-helper.d.ts +190 -0
  83. package/src/layout-helper.js +1368 -0
  84. package/src/layout.d.ts +779 -0
  85. package/src/layout.js +17232 -0
  86. package/src/list/abstract-list.d.ts +25 -0
  87. package/src/list/abstract-list.js +67 -0
  88. package/src/list/index.d.ts +7 -0
  89. package/src/list/index.js +7 -0
  90. package/src/list/level-override.d.ts +22 -0
  91. package/src/list/level-override.js +43 -0
  92. package/src/list/list-level.d.ts +57 -0
  93. package/src/list/list-level.js +249 -0
  94. package/src/list/list.d.ts +30 -0
  95. package/src/list/list.js +100 -0
  96. package/src/page.d.ts +4155 -0
  97. package/src/page.js +11342 -0
  98. package/src/parser/index.d.ts +1 -0
  99. package/src/parser/index.js +1 -0
  100. package/src/parser/sfdt-reader.d.ts +254 -0
  101. package/src/parser/sfdt-reader.js +4569 -0
  102. package/src/render.d.ts +226 -0
  103. package/src/render.js +4222 -0
  104. package/src/text-helper.d.ts +144 -0
  105. package/src/text-helper.js +1079 -0
  106. package/src/text-helpers/index.d.ts +2 -0
  107. package/src/text-helpers/index.js +2 -0
  108. package/src/text-helpers/optimized.d.ts +45 -0
  109. package/src/text-helpers/optimized.js +121 -0
  110. package/src/text-helpers/regular.d.ts +37 -0
  111. package/src/text-helpers/regular.js +93 -0
  112. package/src/themes/font-scheme.d.ts +28 -0
  113. package/src/themes/font-scheme.js +107 -0
  114. package/src/themes/index.d.ts +6 -0
  115. package/src/themes/index.js +6 -0
  116. package/src/themes/major-minor-font-scheme.d.ts +14 -0
  117. package/src/themes/major-minor-font-scheme.js +45 -0
  118. package/src/themes/themes.d.ts +11 -0
  119. package/src/themes/themes.js +31 -0
  120. package/src/utility/index.d.ts +1 -0
  121. package/src/utility/index.js +1 -0
  122. package/src/utility/path-util.d.ts +133 -0
  123. package/src/utility/path-util.js +639 -0
  124. package/text-helpers.d.ts +4 -0
  125. package/text-helpers.js +4 -0
  126. package/themes.d.ts +4 -0
  127. package/themes.js +4 -0
  128. package/utility.d.ts +4 -0
  129. package/utility.js +4 -0
@@ -0,0 +1,1224 @@
1
+ import { TextElementBox, ParagraphWidget, ElementBox } from '../page';
2
+ import { Dictionary } from '../base/dictionary';
3
+ import { WUniqueFormat } from '../base/unique-format';
4
+ import { WUniqueFormats } from '../base/unique-formats';
5
+ import { WParagraphStyle, WCharacterStyle } from './style';
6
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
7
+ import { RevisionBase } from '../helper/revision-helper-methods';
8
+ /* eslint-disable */
9
+ /**
10
+ * @private
11
+ */
12
+ var WCharacterFormat = /** @class */ (function () {
13
+ function WCharacterFormat(node, owner) {
14
+ this.uniqueCharacterFormat = undefined;
15
+ this.ownerBase = undefined;
16
+ this.baseCharStyle = undefined;
17
+ this.owner = undefined;
18
+ /**
19
+ * @private
20
+ */
21
+ this.removedIds = [];
22
+ /**
23
+ * @private
24
+ */
25
+ this.revisions = [];
26
+ this.ownerBase = node;
27
+ // To optimize the performance to get the documentHelper instance used this logic.
28
+ if (!isNullOrUndefined(owner)) {
29
+ this.owner = owner;
30
+ }
31
+ else {
32
+ var paragraph = void 0;
33
+ if (this.ownerBase instanceof ElementBox) {
34
+ paragraph = this.ownerBase.paragraph;
35
+ }
36
+ else if (this.ownerBase instanceof ParagraphWidget) {
37
+ paragraph = this.ownerBase;
38
+ }
39
+ if (!isNullOrUndefined(paragraph)) {
40
+ var bodyWidget = paragraph.bodyWidget;
41
+ if (bodyWidget && bodyWidget.page && bodyWidget.page.documentHelper) {
42
+ this.owner = bodyWidget.page.documentHelper;
43
+ }
44
+ }
45
+ }
46
+ }
47
+ Object.defineProperty(WCharacterFormat.prototype, "bold", {
48
+ get: function () {
49
+ return this.getPropertyValue('bold');
50
+ },
51
+ set: function (value) {
52
+ this.setPropertyValue('bold', value);
53
+ },
54
+ enumerable: true,
55
+ configurable: true
56
+ });
57
+ Object.defineProperty(WCharacterFormat.prototype, "italic", {
58
+ get: function () {
59
+ return this.getPropertyValue('italic');
60
+ },
61
+ set: function (value) {
62
+ this.setPropertyValue('italic', value);
63
+ },
64
+ enumerable: true,
65
+ configurable: true
66
+ });
67
+ Object.defineProperty(WCharacterFormat.prototype, "fontSize", {
68
+ get: function () {
69
+ return this.getPropertyValue('fontSize');
70
+ },
71
+ set: function (value) {
72
+ this.setPropertyValue('fontSize', value);
73
+ },
74
+ enumerable: true,
75
+ configurable: true
76
+ });
77
+ Object.defineProperty(WCharacterFormat.prototype, "characterSpacing", {
78
+ get: function () {
79
+ return this.getPropertyValue('characterSpacing');
80
+ },
81
+ set: function (value) {
82
+ this.setPropertyValue('characterSpacing', value);
83
+ },
84
+ enumerable: true,
85
+ configurable: true
86
+ });
87
+ Object.defineProperty(WCharacterFormat.prototype, "scaling", {
88
+ get: function () {
89
+ return this.getPropertyValue('scaling');
90
+ },
91
+ set: function (value) {
92
+ this.setPropertyValue('scaling', value);
93
+ },
94
+ enumerable: true,
95
+ configurable: true
96
+ });
97
+ Object.defineProperty(WCharacterFormat.prototype, "fontFamily", {
98
+ get: function () {
99
+ return this.getPropertyValue('fontFamily');
100
+ },
101
+ set: function (value) {
102
+ this.setPropertyValue('fontFamily', value);
103
+ },
104
+ enumerable: true,
105
+ configurable: true
106
+ });
107
+ Object.defineProperty(WCharacterFormat.prototype, "underline", {
108
+ get: function () {
109
+ return this.getPropertyValue('underline');
110
+ },
111
+ set: function (value) {
112
+ this.setPropertyValue('underline', value);
113
+ },
114
+ enumerable: true,
115
+ configurable: true
116
+ });
117
+ Object.defineProperty(WCharacterFormat.prototype, "underlineColor", {
118
+ get: function () {
119
+ return this.getPropertyValue('underlineColor');
120
+ },
121
+ set: function (value) {
122
+ this.setPropertyValue('underlineColor', value);
123
+ },
124
+ enumerable: true,
125
+ configurable: true
126
+ });
127
+ Object.defineProperty(WCharacterFormat.prototype, "fontHintType", {
128
+ get: function () {
129
+ return this.getPropertyValue('fontHintType');
130
+ },
131
+ set: function (value) {
132
+ this.setPropertyValue('fontHintType', value);
133
+ },
134
+ enumerable: true,
135
+ configurable: true
136
+ });
137
+ Object.defineProperty(WCharacterFormat.prototype, "strikethrough", {
138
+ get: function () {
139
+ return this.getPropertyValue('strikethrough');
140
+ },
141
+ set: function (value) {
142
+ this.setPropertyValue('strikethrough', value);
143
+ },
144
+ enumerable: true,
145
+ configurable: true
146
+ });
147
+ Object.defineProperty(WCharacterFormat.prototype, "baselineAlignment", {
148
+ get: function () {
149
+ return this.getPropertyValue('baselineAlignment');
150
+ },
151
+ set: function (value) {
152
+ this.setPropertyValue('baselineAlignment', value);
153
+ },
154
+ enumerable: true,
155
+ configurable: true
156
+ });
157
+ Object.defineProperty(WCharacterFormat.prototype, "highlightColor", {
158
+ get: function () {
159
+ return this.getPropertyValue('highlightColor');
160
+ },
161
+ set: function (value) {
162
+ this.setPropertyValue('highlightColor', value);
163
+ },
164
+ enumerable: true,
165
+ configurable: true
166
+ });
167
+ Object.defineProperty(WCharacterFormat.prototype, "fontColor", {
168
+ get: function () {
169
+ return this.getPropertyValue('fontColor');
170
+ },
171
+ set: function (value) {
172
+ this.setPropertyValue('fontColor', value);
173
+ },
174
+ enumerable: true,
175
+ configurable: true
176
+ });
177
+ Object.defineProperty(WCharacterFormat.prototype, "ligature", {
178
+ get: function () {
179
+ return this.getPropertyValue('ligature');
180
+ },
181
+ set: function (value) {
182
+ this.setPropertyValue('ligature', value);
183
+ },
184
+ enumerable: true,
185
+ configurable: true
186
+ });
187
+ Object.defineProperty(WCharacterFormat.prototype, "bidi", {
188
+ get: function () {
189
+ return this.getPropertyValue('bidi');
190
+ },
191
+ set: function (value) {
192
+ this.setPropertyValue('bidi', value);
193
+ },
194
+ enumerable: true,
195
+ configurable: true
196
+ });
197
+ Object.defineProperty(WCharacterFormat.prototype, "localeIdBidi", {
198
+ get: function () {
199
+ return this.getPropertyValue('localeIdBidi');
200
+ },
201
+ set: function (value) {
202
+ this.setPropertyValue('localeIdBidi', value);
203
+ },
204
+ enumerable: true,
205
+ configurable: true
206
+ });
207
+ Object.defineProperty(WCharacterFormat.prototype, "localeIdFarEast", {
208
+ get: function () {
209
+ return this.getPropertyValue('localeIdFarEast');
210
+ },
211
+ set: function (value) {
212
+ this.setPropertyValue('localeIdFarEast', value);
213
+ },
214
+ enumerable: true,
215
+ configurable: true
216
+ });
217
+ Object.defineProperty(WCharacterFormat.prototype, "localeIdAscii", {
218
+ get: function () {
219
+ return this.getPropertyValue('localeIdAscii');
220
+ },
221
+ set: function (value) {
222
+ this.setPropertyValue('localeIdAscii', value);
223
+ },
224
+ enumerable: true,
225
+ configurable: true
226
+ });
227
+ Object.defineProperty(WCharacterFormat.prototype, "bdo", {
228
+ get: function () {
229
+ return this.getPropertyValue('bdo');
230
+ },
231
+ set: function (value) {
232
+ this.setPropertyValue('bdo', value);
233
+ },
234
+ enumerable: true,
235
+ configurable: true
236
+ });
237
+ Object.defineProperty(WCharacterFormat.prototype, "boldBidi", {
238
+ get: function () {
239
+ return this.getPropertyValue('boldBidi');
240
+ },
241
+ set: function (value) {
242
+ this.setPropertyValue('boldBidi', value);
243
+ },
244
+ enumerable: true,
245
+ configurable: true
246
+ });
247
+ Object.defineProperty(WCharacterFormat.prototype, "italicBidi", {
248
+ get: function () {
249
+ return this.getPropertyValue('italicBidi');
250
+ },
251
+ set: function (value) {
252
+ this.setPropertyValue('italicBidi', value);
253
+ },
254
+ enumerable: true,
255
+ configurable: true
256
+ });
257
+ Object.defineProperty(WCharacterFormat.prototype, "fontSizeBidi", {
258
+ get: function () {
259
+ return this.getPropertyValue('fontSizeBidi');
260
+ },
261
+ set: function (value) {
262
+ this.setPropertyValue('fontSizeBidi', value);
263
+ },
264
+ enumerable: true,
265
+ configurable: true
266
+ });
267
+ Object.defineProperty(WCharacterFormat.prototype, "fontFamilyBidi", {
268
+ get: function () {
269
+ return this.getPropertyValue('fontFamilyBidi');
270
+ },
271
+ set: function (value) {
272
+ this.setPropertyValue('fontFamilyBidi', value);
273
+ },
274
+ enumerable: true,
275
+ configurable: true
276
+ });
277
+ Object.defineProperty(WCharacterFormat.prototype, "allCaps", {
278
+ get: function () {
279
+ return this.getPropertyValue('allCaps');
280
+ },
281
+ set: function (value) {
282
+ this.setPropertyValue('allCaps', value);
283
+ },
284
+ enumerable: true,
285
+ configurable: true
286
+ });
287
+ Object.defineProperty(WCharacterFormat.prototype, "Lowercase", {
288
+ get: function () {
289
+ return this.getPropertyValue('Lowercase');
290
+ },
291
+ set: function (value) {
292
+ this.setPropertyValue('Lowercase', value);
293
+ },
294
+ enumerable: true,
295
+ configurable: true
296
+ });
297
+ Object.defineProperty(WCharacterFormat.prototype, "Uppercase", {
298
+ get: function () {
299
+ return this.getPropertyValue('Uppercase');
300
+ },
301
+ set: function (value) {
302
+ this.setPropertyValue('Uppercase', value);
303
+ },
304
+ enumerable: true,
305
+ configurable: true
306
+ });
307
+ Object.defineProperty(WCharacterFormat.prototype, "SentenceCase", {
308
+ get: function () {
309
+ return this.getPropertyValue('SentenceCase');
310
+ },
311
+ set: function (value) {
312
+ this.setPropertyValue('SentenceCase', value);
313
+ },
314
+ enumerable: true,
315
+ configurable: true
316
+ });
317
+ Object.defineProperty(WCharacterFormat.prototype, "ToggleCase", {
318
+ get: function () {
319
+ return this.getPropertyValue('ToggleCase');
320
+ },
321
+ set: function (value) {
322
+ this.setPropertyValue('ToggleCase', value);
323
+ },
324
+ enumerable: true,
325
+ configurable: true
326
+ });
327
+ Object.defineProperty(WCharacterFormat.prototype, "CapitalizeEachWord", {
328
+ get: function () {
329
+ return this.getPropertyValue('CapitalizeEachWord');
330
+ },
331
+ set: function (value) {
332
+ this.setPropertyValue('CapitalizeEachWord', value);
333
+ },
334
+ enumerable: true,
335
+ configurable: true
336
+ });
337
+ Object.defineProperty(WCharacterFormat.prototype, "complexScript", {
338
+ get: function () {
339
+ return this.getPropertyValue('complexScript');
340
+ },
341
+ set: function (value) {
342
+ this.setPropertyValue('complexScript', value);
343
+ },
344
+ enumerable: true,
345
+ configurable: true
346
+ });
347
+ Object.defineProperty(WCharacterFormat.prototype, "hidden", {
348
+ get: function () {
349
+ return this.getPropertyValue('hidden');
350
+ },
351
+ set: function (value) {
352
+ this.setPropertyValue('hidden', value);
353
+ },
354
+ enumerable: true,
355
+ configurable: true
356
+ });
357
+ Object.defineProperty(WCharacterFormat.prototype, "specVanish", {
358
+ /**
359
+ * @private
360
+ */
361
+ get: function () {
362
+ return this.getPropertyValue('specVanish');
363
+ },
364
+ /**
365
+ * @private
366
+ */
367
+ set: function (value) {
368
+ this.setPropertyValue('specVanish', value);
369
+ },
370
+ enumerable: true,
371
+ configurable: true
372
+ });
373
+ Object.defineProperty(WCharacterFormat.prototype, "kern", {
374
+ /**
375
+ * @private
376
+ */
377
+ get: function () {
378
+ return this.getPropertyValue('kern');
379
+ },
380
+ /**
381
+ * @private
382
+ */
383
+ set: function (value) {
384
+ this.setPropertyValue('kern', value);
385
+ },
386
+ enumerable: true,
387
+ configurable: true
388
+ });
389
+ Object.defineProperty(WCharacterFormat.prototype, "isKernFont", {
390
+ /**
391
+ * @private
392
+ */
393
+ get: function () {
394
+ return this.getPropertyValue('isKernFont');
395
+ },
396
+ /**
397
+ * @private
398
+ */
399
+ set: function (value) {
400
+ this.setPropertyValue('isKernFont', value);
401
+ },
402
+ enumerable: true,
403
+ configurable: true
404
+ });
405
+ Object.defineProperty(WCharacterFormat.prototype, "fontFamilyFarEast", {
406
+ get: function () {
407
+ return this.getPropertyValue('fontFamilyFarEast');
408
+ },
409
+ set: function (value) {
410
+ this.setPropertyValue('fontFamilyFarEast', value);
411
+ },
412
+ enumerable: true,
413
+ configurable: true
414
+ });
415
+ Object.defineProperty(WCharacterFormat.prototype, "fontFamilyAscii", {
416
+ get: function () {
417
+ return this.getPropertyValue('fontFamilyAscii');
418
+ },
419
+ set: function (value) {
420
+ this.setPropertyValue('fontFamilyAscii', value);
421
+ },
422
+ enumerable: true,
423
+ configurable: true
424
+ });
425
+ Object.defineProperty(WCharacterFormat.prototype, "fontFamilyNonFarEast", {
426
+ get: function () {
427
+ return this.getPropertyValue('fontFamilyNonFarEast');
428
+ },
429
+ set: function (value) {
430
+ this.setPropertyValue('fontFamilyNonFarEast', value);
431
+ },
432
+ enumerable: true,
433
+ configurable: true
434
+ });
435
+ WCharacterFormat.prototype.getPropertyValue = function (property) {
436
+ if (!this.hasValue(property)) {
437
+ var charStyleValue = this.checkCharacterStyle(property);
438
+ if (!isNullOrUndefined(charStyleValue)) {
439
+ return charStyleValue;
440
+ }
441
+ else {
442
+ if (!isNullOrUndefined(this.baseCharStyle)) {
443
+ var paragraph = undefined;
444
+ var line = undefined;
445
+ if (!isNullOrUndefined(this.ownerBase)) {
446
+ paragraph = this.ownerBase.paragraph;
447
+ line = this.ownerBase.line;
448
+ }
449
+ if (!isNullOrUndefined(paragraph) && !isNullOrUndefined(line)) {
450
+ var length_1 = line.children.length;
451
+ for (var i = 0; i < length_1; i++) {
452
+ var element = this.ownerBase.line.children[i];
453
+ if (element instanceof TextElementBox) {
454
+ var text = element.text;
455
+ if (text.startsWith('HYPERLINK') || text.startsWith(' HYPERLINK')) {
456
+ var index = text.indexOf('_Toc');
457
+ if (index !== -1) {
458
+ this.baseCharStyle = this.ownerBase.paragraph.paragraphFormat.baseStyle;
459
+ }
460
+ }
461
+ }
462
+ }
463
+ }
464
+ }
465
+ var baseStyleValue = this.checkBaseStyle(property);
466
+ if (!isNullOrUndefined(baseStyleValue)) {
467
+ return baseStyleValue;
468
+ }
469
+ }
470
+ }
471
+ else {
472
+ var propertyType = WUniqueFormat.getPropertyType(WCharacterFormat.uniqueFormatType, property);
473
+ if (!isNullOrUndefined(this.uniqueCharacterFormat) && this.uniqueCharacterFormat.propertiesHash.containsKey(propertyType)) {
474
+ return this.uniqueCharacterFormat.propertiesHash.get(propertyType);
475
+ }
476
+ }
477
+ return this.getDefaultValue(property);
478
+ };
479
+ WCharacterFormat.prototype.getDefaultValue = function (property) {
480
+ var propertyType = WUniqueFormat.getPropertyType(WCharacterFormat.uniqueFormatType, property);
481
+ var characterFormatInfo = this.documentCharacterFormat();
482
+ if (!isNullOrUndefined(characterFormatInfo)) {
483
+ var docCharacterFormat = characterFormatInfo.documentFormat;
484
+ if (!isNullOrUndefined(docCharacterFormat) && !isNullOrUndefined(docCharacterFormat.uniqueCharacterFormat) && docCharacterFormat.uniqueCharacterFormat.propertiesHash.containsKey(propertyType)) {
485
+ return docCharacterFormat.uniqueCharacterFormat.propertiesHash.get(propertyType);
486
+ }
487
+ else {
488
+ var editorFormat = characterFormatInfo.editorFormat;
489
+ if (!isNullOrUndefined(editorFormat) && editorFormat.hasOwnProperty(property)) {
490
+ var value = editorFormat[property];
491
+ return value;
492
+ }
493
+ else {
494
+ return WCharacterFormat.getPropertyDefaultValue(property);
495
+ }
496
+ }
497
+ }
498
+ else {
499
+ return WCharacterFormat.getPropertyDefaultValue(property);
500
+ }
501
+ };
502
+ WCharacterFormat.prototype.documentCharacterFormat = function () {
503
+ if (isNullOrUndefined(this.ownerBase)) {
504
+ return undefined;
505
+ }
506
+ if (!isNullOrUndefined(this.owner)) {
507
+ return { editorFormat: this.owner.editorCharacterFormat, documentFormat: this.owner.characterFormat };
508
+ }
509
+ var paragraph;
510
+ if (this.ownerBase instanceof ElementBox) {
511
+ paragraph = this.ownerBase.paragraph;
512
+ }
513
+ else if (this.ownerBase instanceof ParagraphWidget) {
514
+ paragraph = this.ownerBase;
515
+ }
516
+ if (paragraph) {
517
+ var bodyWidget = paragraph.bodyWidget;
518
+ if (bodyWidget && bodyWidget.page && bodyWidget.page.documentHelper) {
519
+ var documentHelper = bodyWidget.page.documentHelper;
520
+ this.owner = documentHelper;
521
+ return { editorFormat: documentHelper.editorCharacterFormat, documentFormat: documentHelper.characterFormat };
522
+ }
523
+ }
524
+ return undefined;
525
+ };
526
+ WCharacterFormat.prototype.checkBaseStyle = function (property) {
527
+ var baseStyle;
528
+ if (!isNullOrUndefined(this.ownerBase)) {
529
+ if (!isNullOrUndefined(this.ownerBase.paragraph) && !isNullOrUndefined(this.ownerBase.paragraph.paragraphFormat)) {
530
+ baseStyle = this.ownerBase.paragraph.paragraphFormat.baseStyle;
531
+ }
532
+ else {
533
+ if ((this.ownerBase instanceof ParagraphWidget) && !isNullOrUndefined(this.ownerBase.paragraphFormat)) {
534
+ baseStyle = this.ownerBase.paragraphFormat.baseStyle;
535
+ }
536
+ else {
537
+ if (!isNullOrUndefined(this.ownerBase instanceof WParagraphStyle)) {
538
+ baseStyle = this.ownerBase.basedOn;
539
+ }
540
+ }
541
+ }
542
+ }
543
+ while (!isNullOrUndefined(baseStyle)) {
544
+ if (baseStyle.characterFormat.hasValue(property)) {
545
+ break;
546
+ }
547
+ else if (!isNullOrUndefined(baseStyle.link) && isNullOrUndefined(baseStyle.basedOn) && baseStyle.link.type == 'Character' && baseStyle.link.characterFormat.hasValue(property) && baseStyle.name != "Normal") {
548
+ baseStyle = baseStyle.link;
549
+ break;
550
+ }
551
+ else {
552
+ baseStyle = baseStyle.basedOn;
553
+ }
554
+ }
555
+ if (!isNullOrUndefined(baseStyle)) {
556
+ var propertyType = WUniqueFormat.getPropertyType(WCharacterFormat.uniqueFormatType, property);
557
+ return baseStyle.characterFormat.uniqueCharacterFormat.propertiesHash.get(propertyType);
558
+ }
559
+ return undefined;
560
+ };
561
+ WCharacterFormat.prototype.checkCharacterStyle = function (property) {
562
+ var baseStyle = this.baseCharStyle;
563
+ if (!isNullOrUndefined(baseStyle)) {
564
+ while (!isNullOrUndefined(baseStyle) && baseStyle.name !== 'Default Paragraph Font') {
565
+ var hasKey = baseStyle.characterFormat.hasValue(property);
566
+ if (hasKey) {
567
+ if (property === 'bold' && !isNullOrUndefined(this.ownerBase) && this.ownerBase instanceof TextElementBox && !isNullOrUndefined(this.ownerBase.paragraph) &&
568
+ !isNullOrUndefined(this.ownerBase.paragraph.paragraphFormat.baseStyle) && this.ownerBase.paragraph.paragraphFormat.baseStyle instanceof WParagraphStyle &&
569
+ this.ownerBase.paragraph.paragraphFormat.baseStyle.characterFormat && baseStyle.name !== this.ownerBase.paragraph.paragraphFormat.baseStyle.name &&
570
+ baseStyle.characterFormat.hasValue(property) === this.ownerBase.paragraph.paragraphFormat.baseStyle.characterFormat.hasValue(property)) {
571
+ return this.hasValue(property);
572
+ }
573
+ var returnPropertyType = WUniqueFormat.getPropertyType(WCharacterFormat.uniqueFormatType, property);
574
+ return baseStyle.characterFormat.uniqueCharacterFormat.propertiesHash.get(returnPropertyType);
575
+ }
576
+ else {
577
+ baseStyle = baseStyle.basedOn;
578
+ }
579
+ }
580
+ }
581
+ return undefined;
582
+ };
583
+ WCharacterFormat.prototype.setPropertyValue = function (property, value) {
584
+ if (isNullOrUndefined(value) || value === '') {
585
+ value = WCharacterFormat.getPropertyDefaultValue(property);
586
+ }
587
+ if (isNullOrUndefined(this.uniqueCharacterFormat)
588
+ || (isNullOrUndefined(this.uniqueCharacterFormat.propertiesHash)
589
+ && isNullOrUndefined(this.uniqueCharacterFormat.uniqueFormatType)
590
+ && isNullOrUndefined(this.uniqueCharacterFormat.referenceCount))) {
591
+ this.initializeUniqueCharacterFormat(property, value);
592
+ }
593
+ else {
594
+ var propertyType = WUniqueFormat.getPropertyType(this.uniqueCharacterFormat.uniqueFormatType, property);
595
+ if (this.uniqueCharacterFormat.propertiesHash.containsKey(propertyType) &&
596
+ this.uniqueCharacterFormat.propertiesHash.get(propertyType) === value) { //Do nothing, since no change in property value and return
597
+ return;
598
+ }
599
+ this.uniqueCharacterFormat = WCharacterFormat.uniqueCharacterFormats.updateUniqueFormat(this.uniqueCharacterFormat, property, value);
600
+ }
601
+ };
602
+ WCharacterFormat.prototype.initializeUniqueCharacterFormat = function (property, propValue) {
603
+ var uniqueCharFormatTemp = new Dictionary();
604
+ this.addUniqueCharacterFormat('fontColor', property, propValue, uniqueCharFormatTemp);
605
+ this.addUniqueCharacterFormat('fontFamily', property, propValue, uniqueCharFormatTemp);
606
+ this.addUniqueCharacterFormat('fontSize', property, propValue, uniqueCharFormatTemp);
607
+ this.addUniqueCharacterFormat('bold', property, propValue, uniqueCharFormatTemp);
608
+ this.addUniqueCharacterFormat('italic', property, propValue, uniqueCharFormatTemp);
609
+ this.addUniqueCharacterFormat('underline', property, propValue, uniqueCharFormatTemp);
610
+ this.addUniqueCharacterFormat('underlineColor', property, propValue, uniqueCharFormatTemp);
611
+ this.addUniqueCharacterFormat('ligature', property, propValue, uniqueCharFormatTemp);
612
+ this.addUniqueCharacterFormat('fontHintType', property, propValue, uniqueCharFormatTemp);
613
+ this.addUniqueCharacterFormat('strikethrough', property, propValue, uniqueCharFormatTemp);
614
+ this.addUniqueCharacterFormat('baselineAlignment', property, propValue, uniqueCharFormatTemp);
615
+ this.addUniqueCharacterFormat('highlightColor', property, propValue, uniqueCharFormatTemp);
616
+ this.addUniqueCharacterFormat('styleName', property, propValue, uniqueCharFormatTemp);
617
+ this.addUniqueCharacterFormat('bidi', property, propValue, uniqueCharFormatTemp);
618
+ this.addUniqueCharacterFormat('bdo', property, propValue, uniqueCharFormatTemp);
619
+ this.addUniqueCharacterFormat('fontFamilyBidi', property, propValue, uniqueCharFormatTemp);
620
+ this.addUniqueCharacterFormat('fontSizeBidi', property, propValue, uniqueCharFormatTemp);
621
+ this.addUniqueCharacterFormat('boldBidi', property, propValue, uniqueCharFormatTemp);
622
+ this.addUniqueCharacterFormat('italicBidi', property, propValue, uniqueCharFormatTemp);
623
+ this.addUniqueCharacterFormat('allCaps', property, propValue, uniqueCharFormatTemp);
624
+ this.addUniqueCharacterFormat('Uppercase', property, propValue, uniqueCharFormatTemp);
625
+ this.addUniqueCharacterFormat('Lowercase', property, propValue, uniqueCharFormatTemp);
626
+ this.addUniqueCharacterFormat('SentenceCase', property, propValue, uniqueCharFormatTemp);
627
+ this.addUniqueCharacterFormat('ToggleCase', property, propValue, uniqueCharFormatTemp);
628
+ this.addUniqueCharacterFormat('CapitalizeEachWord', property, propValue, uniqueCharFormatTemp);
629
+ this.addUniqueCharacterFormat('localeIdAscii', property, propValue, uniqueCharFormatTemp);
630
+ this.addUniqueCharacterFormat('localeIdFarEast', property, propValue, uniqueCharFormatTemp);
631
+ this.addUniqueCharacterFormat('localeIdBidi', property, propValue, uniqueCharFormatTemp);
632
+ this.addUniqueCharacterFormat('fontFamilyFarEast', property, propValue, uniqueCharFormatTemp);
633
+ this.addUniqueCharacterFormat('fontFamilyAscii', property, propValue, uniqueCharFormatTemp);
634
+ this.addUniqueCharacterFormat('fontFamilyNonFarEast', property, propValue, uniqueCharFormatTemp);
635
+ this.addUniqueCharacterFormat('complexScript', property, propValue, uniqueCharFormatTemp);
636
+ this.addUniqueCharacterFormat('characterSpacing', property, propValue, uniqueCharFormatTemp);
637
+ this.addUniqueCharacterFormat('scaling', property, propValue, uniqueCharFormatTemp);
638
+ this.addUniqueCharacterFormat('hidden', property, propValue, uniqueCharFormatTemp);
639
+ this.addUniqueCharacterFormat('specVanish', property, propValue, uniqueCharFormatTemp);
640
+ this.addUniqueCharacterFormat('isKernFont', property, propValue, uniqueCharFormatTemp);
641
+ this.addUniqueCharacterFormat('kern', property, propValue, uniqueCharFormatTemp);
642
+ this.uniqueCharacterFormat = WCharacterFormat.uniqueCharacterFormats.addUniqueFormat(uniqueCharFormatTemp, WCharacterFormat.uniqueFormatType);
643
+ };
644
+ WCharacterFormat.prototype.addUniqueCharacterFormat = function (property, modifiedProperty, propValue, uniqueCharFormatTemp) {
645
+ var propertyType = WUniqueFormat.getPropertyType(WCharacterFormat.uniqueFormatType, property);
646
+ if (property === modifiedProperty) {
647
+ uniqueCharFormatTemp.add(propertyType, propValue);
648
+ }
649
+ };
650
+ WCharacterFormat.getPropertyDefaultValue = function (property) {
651
+ var value = undefined;
652
+ switch (property) {
653
+ case 'bold':
654
+ value = false;
655
+ break;
656
+ case 'italic':
657
+ value = false;
658
+ break;
659
+ case 'fontSize':
660
+ value = 11;
661
+ break;
662
+ case 'underline':
663
+ value = 'None';
664
+ break;
665
+ case 'underlineColor':
666
+ value = undefined;
667
+ break;
668
+ case 'ligature':
669
+ value = 'None';
670
+ break;
671
+ case 'fontHintType':
672
+ value = 'Default';
673
+ break;
674
+ case 'strikethrough':
675
+ value = 'None';
676
+ break;
677
+ case 'baselineAlignment':
678
+ value = 'Normal';
679
+ break;
680
+ case 'highlightColor':
681
+ value = 'NoColor';
682
+ break;
683
+ case 'fontColor':
684
+ value = '#00000000';
685
+ break;
686
+ case 'fontFamily':
687
+ value = 'Calibri';
688
+ break;
689
+ case 'styleName':
690
+ value = 'Default Paragraph Font';
691
+ break;
692
+ case 'bidi':
693
+ value = false;
694
+ break;
695
+ case 'bdo':
696
+ value = 'None';
697
+ break;
698
+ case 'boldBidi':
699
+ value = false;
700
+ break;
701
+ case 'italicBidi':
702
+ value = false;
703
+ break;
704
+ case 'fontSizeBidi':
705
+ value = 11;
706
+ break;
707
+ case 'fontFamilyBidi':
708
+ value = 'Calibri';
709
+ break;
710
+ case 'allCaps':
711
+ case 'Uppercase':
712
+ case 'Lowercase':
713
+ case 'CapitalizeEachWord':
714
+ case 'SentenceCase':
715
+ case 'ToggleCase':
716
+ value = false;
717
+ break;
718
+ case 'localeIdAscii':
719
+ case 'localeIdFarEast':
720
+ case 'localeIdBidi':
721
+ value = 0;
722
+ break;
723
+ case 'complexScript':
724
+ value = false;
725
+ break;
726
+ case 'hidden':
727
+ case 'specVanish':
728
+ case 'isKernFont':
729
+ value = false;
730
+ break;
731
+ case 'fontFamilyFarEast':
732
+ case 'fontFamilyAscii':
733
+ case 'fontFamilyNonFarEast':
734
+ value = undefined;
735
+ break;
736
+ case 'characterSpacing':
737
+ case 'kern':
738
+ value = 0;
739
+ break;
740
+ case 'scaling':
741
+ value = 100;
742
+ break;
743
+ }
744
+ return value;
745
+ };
746
+ WCharacterFormat.prototype.isEqualFormat = function (format) {
747
+ return (this.fontSize === format.fontSize
748
+ && this.fontFamily === format.fontFamily
749
+ && this.bold === format.bold
750
+ && this.italic === format.italic
751
+ && this.baselineAlignment === format.baselineAlignment
752
+ && this.underline === format.underline
753
+ && this.fontColor === format.fontColor
754
+ && this.strikethrough === format.strikethrough
755
+ && this.highlightColor === format.highlightColor && this.bidi === format.bidi
756
+ && this.bdo === format.bdo
757
+ && this.allCaps === format.allCaps
758
+ && this.Uppercase === format.Uppercase
759
+ && this.Lowercase === format.Lowercase
760
+ && this.ToggleCase === format.ToggleCase
761
+ && this.SentenceCase === format.SentenceCase
762
+ && this.CapitalizeEachWord === format.CapitalizeEachWord
763
+ && this.localeIdBidi === format.localeIdBidi
764
+ && this.localeIdAscii === format.localeIdAscii
765
+ && this.localeIdFarEast === format.localeIdFarEast
766
+ && this.complexScript === format.complexScript
767
+ && this.fontFamilyAscii === format.fontFamilyAscii
768
+ && this.fontFamilyBidi === format.fontFamilyBidi
769
+ && this.fontFamilyFarEast === format.fontFamilyFarEast
770
+ && this.characterSpacing === format.characterSpacing
771
+ && this.scaling === format.scaling
772
+ && this.fontFamilyNonFarEast === format.fontFamilyNonFarEast
773
+ && this.hidden === format.hidden
774
+ && this.specVanish === format.specVanish
775
+ && this.isKernFont === format.isKernFont
776
+ && this.kern === format.kern
777
+ && this.ligature === format.ligature);
778
+ };
779
+ WCharacterFormat.prototype.isSameFormat = function (format) {
780
+ return this.baseCharStyle === format.baseCharStyle &&
781
+ this.uniqueCharacterFormat === format.uniqueCharacterFormat;
782
+ };
783
+ WCharacterFormat.prototype.cloneFormat = function () {
784
+ var format = new WCharacterFormat(undefined, this.owner);
785
+ format.uniqueCharacterFormat = this.uniqueCharacterFormat;
786
+ format.baseCharStyle = this.baseCharStyle;
787
+ if (this.revisions.length > 0) {
788
+ format.removedIds = RevisionBase.cloneRevisions(this.revisions);
789
+ }
790
+ else {
791
+ format.removedIds = this.removedIds.slice();
792
+ }
793
+ return format;
794
+ };
795
+ WCharacterFormat.prototype.hasValue = function (property) {
796
+ if (!isNullOrUndefined(this.uniqueCharacterFormat) && !isNullOrUndefined(this.uniqueCharacterFormat.propertiesHash)) {
797
+ var propertyType = WUniqueFormat.getPropertyType(this.uniqueCharacterFormat.uniqueFormatType, property);
798
+ return this.uniqueCharacterFormat.propertiesHash.containsKey(propertyType);
799
+ }
800
+ return false;
801
+ };
802
+ WCharacterFormat.prototype.clearFormat = function () {
803
+ if (!isNullOrUndefined(this.uniqueCharacterFormat) && this.uniqueCharacterFormat.referenceCount === 0) {
804
+ WCharacterFormat.uniqueCharacterFormats.remove(this.uniqueCharacterFormat);
805
+ }
806
+ this.uniqueCharacterFormat = undefined;
807
+ this.baseCharStyle = undefined;
808
+ };
809
+ WCharacterFormat.prototype.destroy = function () {
810
+ if (!isNullOrUndefined(this.uniqueCharacterFormat)) {
811
+ WCharacterFormat.uniqueCharacterFormats.remove(this.uniqueCharacterFormat);
812
+ }
813
+ this.uniqueCharacterFormat = undefined;
814
+ this.baseCharStyle = undefined;
815
+ this.ownerBase = undefined;
816
+ this.owner = undefined;
817
+ };
818
+ WCharacterFormat.prototype.copyFormat = function (format) {
819
+ if (!isNullOrUndefined(format)) {
820
+ if (!isNullOrUndefined(format.uniqueCharacterFormat) && format.uniqueCharacterFormat.propertiesHash) {
821
+ this.updateUniqueCharacterFormat(format);
822
+ }
823
+ if (!isNullOrUndefined(format.baseCharStyle)) {
824
+ this.baseCharStyle = format.baseCharStyle;
825
+ }
826
+ if (format.revisions.length > 0) {
827
+ this.removedIds = RevisionBase.cloneRevisions(format.revisions);
828
+ }
829
+ else {
830
+ this.removedIds = format.removedIds.slice();
831
+ }
832
+ }
833
+ };
834
+ WCharacterFormat.prototype.isEqualTocFormat = function (format) {
835
+ return (this.fontFamily === format.fontFamily
836
+ && this.bold === format.bold
837
+ && this.italic === format.italic
838
+ && this.strikethrough === format.strikethrough
839
+ && this.highlightColor === format.highlightColor
840
+ && this.fontFamilyAscii === format.fontFamilyAscii
841
+ && this.fontFamilyFarEast === format.fontFamilyFarEast
842
+ && this.fontFamilyNonFarEast === format.fontFamilyNonFarEast);
843
+ };
844
+ WCharacterFormat.prototype.copyTocFormat = function (format) {
845
+ if (!isNullOrUndefined(format.bold)) {
846
+ this.bold = format.bold;
847
+ }
848
+ if (!isNullOrUndefined(format.italic)) {
849
+ this.italic = format.italic;
850
+ }
851
+ if (!isNullOrUndefined(format.strikethrough)) {
852
+ this.strikethrough = format.strikethrough;
853
+ }
854
+ if (!isNullOrUndefined(format.highlightColor)) {
855
+ this.highlightColor = format.highlightColor;
856
+ }
857
+ if (!isNullOrUndefined(format.fontFamily)) {
858
+ this.fontFamily = format.fontFamily;
859
+ this.fontFamilyAscii = format.fontFamily;
860
+ this.fontFamilyFarEast = format.fontFamily;
861
+ this.fontFamilyNonFarEast = format.fontFamily;
862
+ }
863
+ };
864
+ WCharacterFormat.prototype.updateUniqueCharacterFormat = function (format) {
865
+ var hash = undefined;
866
+ if (this.uniqueCharacterFormat) {
867
+ hash = this.uniqueCharacterFormat.mergeProperties(format.uniqueCharacterFormat);
868
+ if (this.uniqueCharacterFormat.referenceCount === 0) {
869
+ WCharacterFormat.uniqueCharacterFormats.remove(this.uniqueCharacterFormat);
870
+ this.uniqueCharacterFormat = undefined;
871
+ }
872
+ }
873
+ this.uniqueCharacterFormat = new WUniqueFormat(WCharacterFormat.uniqueFormatType);
874
+ if (isNullOrUndefined(hash)) {
875
+ hash = this.uniqueCharacterFormat.mergeProperties(format.uniqueCharacterFormat);
876
+ }
877
+ this.uniqueCharacterFormat = WCharacterFormat.uniqueCharacterFormats.addUniqueFormat(hash, WCharacterFormat.uniqueFormatType);
878
+ };
879
+ WCharacterFormat.clear = function () {
880
+ this.uniqueCharacterFormats.clear();
881
+ };
882
+ WCharacterFormat.prototype.applyStyle = function (baseCharStyle) {
883
+ this.baseCharStyle = baseCharStyle;
884
+ };
885
+ WCharacterFormat.prototype.getValue = function (property) {
886
+ return this.hasValue(property) ? this.getPropertyValue(property) : undefined;
887
+ };
888
+ WCharacterFormat.prototype.mergeFormat = function (format) {
889
+ if (isNullOrUndefined(this.getValue('bold'))) {
890
+ this.bold = format.getValue('bold');
891
+ }
892
+ if (isNullOrUndefined(this.getValue('italic'))) {
893
+ this.italic = format.getValue('italic');
894
+ }
895
+ if (isNullOrUndefined(this.getValue('fontSize'))) {
896
+ this.fontSize = format.getValue('fontSize');
897
+ }
898
+ if (isNullOrUndefined(this.getValue('boldBidi'))) {
899
+ this.boldBidi = format.getValue('boldBidi');
900
+ }
901
+ if (isNullOrUndefined(this.getValue('italicBidi'))) {
902
+ this.italicBidi = format.getValue('italicBidi');
903
+ }
904
+ if (isNullOrUndefined(this.getValue('fontSizeBidi'))) {
905
+ this.fontSizeBidi = format.getValue('fontSizeBidi');
906
+ }
907
+ if (isNullOrUndefined(this.getValue('characterSpacing'))) {
908
+ this.characterSpacing = format.getValue('characterSpacing');
909
+ }
910
+ if (isNullOrUndefined(this.getValue('scaling'))) {
911
+ this.scaling = format.getValue('scaling');
912
+ }
913
+ if (isNullOrUndefined(this.getValue('kern'))) {
914
+ this.kern = format.getValue('kern');
915
+ }
916
+ if (isNullOrUndefined(this.getValue('isKernFont'))) {
917
+ this.isKernFont = format.getValue('isKernFont');
918
+ }
919
+ if (isNullOrUndefined(this.getValue('fontFamily'))) {
920
+ this.fontFamily = format.getValue('fontFamily');
921
+ }
922
+ else {
923
+ if (isNullOrUndefined(this.getValue('fontFamilyAscii'))) {
924
+ this.fontFamilyAscii = format.getValue('fontFamily');
925
+ }
926
+ if (isNullOrUndefined(this.getValue('fontFamilyFarEast'))) {
927
+ this.fontFamilyFarEast = format.getValue('fontFamily');
928
+ }
929
+ if (isNullOrUndefined(this.getValue('fontFamilyNonFarEast'))) {
930
+ this.fontFamilyNonFarEast = format.getValue('fontFamily');
931
+ }
932
+ }
933
+ if (isNullOrUndefined(this.getValue('underline'))) {
934
+ this.underline = format.getValue('underline');
935
+ }
936
+ if (isNullOrUndefined(this.getValue('fontHintType'))) {
937
+ this.fontHintType = format.getValue('fontHintType');
938
+ }
939
+ if (isNullOrUndefined(this.getValue('strikethrough'))) {
940
+ this.strikethrough = format.getValue('strikethrough');
941
+ }
942
+ if (isNullOrUndefined(this.getValue('baselineAlignment'))) {
943
+ this.baselineAlignment = format.getValue('baselineAlignment');
944
+ }
945
+ if (isNullOrUndefined(this.getValue('highlightColor'))) {
946
+ this.highlightColor = format.getValue('highlightColor');
947
+ }
948
+ if (isNullOrUndefined(this.getValue('fontColor'))) {
949
+ this.fontColor = format.getValue('fontColor');
950
+ }
951
+ if (isNullOrUndefined(this.getValue('ligature'))) {
952
+ this.ligature = format.getValue('ligature');
953
+ }
954
+ if (isNullOrUndefined(this.getValue('bidi'))) {
955
+ this.bidi = format.getValue('bidi');
956
+ }
957
+ if (isNullOrUndefined(this.getValue('bdo'))) {
958
+ this.bdo = format.getValue('bdo');
959
+ }
960
+ if (isNullOrUndefined(this.getValue('allCaps'))) {
961
+ this.allCaps = format.getValue('allCaps');
962
+ }
963
+ if (isNullOrUndefined(this.getValue('Lowercase'))) {
964
+ this.Lowercase = format.getValue('Lowercase');
965
+ }
966
+ if (isNullOrUndefined(this.getValue('SentenceCase'))) {
967
+ this.SentenceCase = format.getValue('SentenceCase');
968
+ }
969
+ if (isNullOrUndefined(this.getValue('ToggleCase'))) {
970
+ this.ToggleCase = format.getValue('ToggleCase');
971
+ }
972
+ if (isNullOrUndefined(this.getValue('CapitalizeEachWord'))) {
973
+ this.CapitalizeEachWord = format.getValue('CapitalizeEachWord');
974
+ }
975
+ if (isNullOrUndefined(this.getValue('Uppercase'))) {
976
+ this.Uppercase = format.getValue('Uppercase');
977
+ }
978
+ if (isNullOrUndefined(this.getValue('localeIdBidi'))) {
979
+ this.localeIdBidi = format.getValue('localeIdBidi');
980
+ }
981
+ if (isNullOrUndefined(this.getValue('localeIdAscii'))) {
982
+ this.localeIdAscii = format.getValue('localeIdAscii');
983
+ }
984
+ if (isNullOrUndefined(this.getValue('localeIdFarEast'))) {
985
+ this.localeIdFarEast = format.getValue('localeIdFarEast');
986
+ }
987
+ if (isNullOrUndefined(this.getValue('complexScript'))) {
988
+ this.complexScript = format.getValue('complexScript');
989
+ }
990
+ if (isNullOrUndefined(this.getValue('fontFamilyAscii'))) {
991
+ this.fontFamilyAscii = format.getValue('fontFamilyAscii');
992
+ }
993
+ if (isNullOrUndefined(this.getValue('fontFamilyBidi'))) {
994
+ this.fontFamilyBidi = format.getValue('fontFamilyBidi');
995
+ }
996
+ if (isNullOrUndefined(this.getValue('fontFamilyFarEast'))) {
997
+ this.fontFamilyFarEast = format.getValue('fontFamilyFarEast');
998
+ }
999
+ if (isNullOrUndefined(this.getValue('fontFamilyNonFarEast'))) {
1000
+ this.fontFamilyNonFarEast = format.getValue('fontFamilyNonFarEast');
1001
+ }
1002
+ };
1003
+ /**
1004
+ * Assinging the value for style dialog
1005
+ * @private
1006
+ * @returns {void}
1007
+ */
1008
+ WCharacterFormat.prototype.assignFormat = function (format) {
1009
+ if (format.hasValue('bold')) {
1010
+ this.bold = format.getValue('bold');
1011
+ }
1012
+ if (format.hasValue('italic')) {
1013
+ this.italic = format.getValue('italic');
1014
+ }
1015
+ if (format.hasValue('fontSize')) {
1016
+ this.fontSize = format.getValue('fontSize');
1017
+ }
1018
+ if (format.hasValue('characterSpacing')) {
1019
+ this.characterSpacing = format.getValue('characterSpacing');
1020
+ }
1021
+ if (format.hasValue('scaling')) {
1022
+ this.scaling = format.getValue('scaling');
1023
+ }
1024
+ if (format.hasValue('kern')) {
1025
+ this.kern = format.getValue('kern');
1026
+ }
1027
+ if (format.hasValue('isKernFont')) {
1028
+ this.isKernFont = format.getValue('isKernFont');
1029
+ }
1030
+ if (format.hasValue('fontFamily')) {
1031
+ this.fontFamily = format.getValue('fontFamily');
1032
+ this.fontFamilyFarEast = format.getValue('fontFamily');
1033
+ this.fontFamilyAscii = format.getValue('fontFamily');
1034
+ this.fontFamilyNonFarEast = format.getValue('fontFamily');
1035
+ this.fontFamilyBidi = format.getValue('fontFamily');
1036
+ }
1037
+ if (format.hasValue('underline')) {
1038
+ this.underline = format.getValue('underline');
1039
+ }
1040
+ if (format.hasValue('fontHintType')) {
1041
+ this.fontHintType = format.getValue('fontHintType');
1042
+ }
1043
+ if (format.hasValue('strikethrough')) {
1044
+ this.strikethrough = format.getValue('strikethrough');
1045
+ }
1046
+ if (format.hasValue('baselineAlignment')) {
1047
+ this.baselineAlignment = format.getValue('baselineAlignment');
1048
+ }
1049
+ if (format.hasValue('highlightColor')) {
1050
+ this.highlightColor = format.getValue('highlightColor');
1051
+ }
1052
+ if (format.hasValue('fontColor')) {
1053
+ this.fontColor = format.getValue('fontColor');
1054
+ }
1055
+ if (format.hasValue('ligature')) {
1056
+ this.ligature = format.getValue('ligature');
1057
+ }
1058
+ if (format.hasValue('bidi')) {
1059
+ this.bidi = format.getValue('bidi');
1060
+ }
1061
+ if (format.hasValue('bdo')) {
1062
+ this.bdo = format.getValue('bdo');
1063
+ }
1064
+ if (format.hasValue('allCaps')) {
1065
+ this.allCaps = format.getValue('allCaps');
1066
+ }
1067
+ if (format.hasValue('Lowercase')) {
1068
+ this.Lowercase = format.getValue('Lowercase');
1069
+ }
1070
+ if (format.hasValue('SentenceCase')) {
1071
+ this.SentenceCase = format.getValue('SentenceCase');
1072
+ }
1073
+ if (format.hasValue('ToggleCase')) {
1074
+ this.ToggleCase = format.getValue('ToggleCase');
1075
+ }
1076
+ if (format.hasValue('CapitalizeEachWord')) {
1077
+ this.CapitalizeEachWord = format.getValue('CapitalizeEachWord');
1078
+ }
1079
+ if (format.hasValue('Uppercase')) {
1080
+ this.Uppercase = format.getValue('Uppercase');
1081
+ }
1082
+ if (format.hasValue('localeIdBidi')) {
1083
+ this.localeIdBidi = format.getValue('localeIdBidi');
1084
+ }
1085
+ if (format.hasValue('localeIdAscii')) {
1086
+ this.localeIdAscii = format.getValue('localeIdAscii');
1087
+ }
1088
+ if (format.hasValue('localeIdFarEast')) {
1089
+ this.localeIdFarEast = format.getValue('localeIdFarEast');
1090
+ }
1091
+ if (format.hasValue('complexScript')) {
1092
+ this.complexScript = format.getValue('complexScript');
1093
+ }
1094
+ };
1095
+ WCharacterFormat.prototype.hasValueWithParent = function (property) {
1096
+ // 2.1 Define direct VALUE
1097
+ var hasValue = this.hasValue(property);
1098
+ // 2.2 If SELF VALUE is NULL get BASE VALUE
1099
+ // if (!hasValue && this.BaseFormat != null && this.BaseFormat is WCharacterFormat)
1100
+ // hasValue = (this.BaseFormat as WCharacterFormat).HasValueWithParent(propertyKey);
1101
+ // 2.3 If VALUE not in hash, get CharStyle VALUE
1102
+ if (!hasValue && !isNullOrUndefined(this.baseCharStyle) && this.baseCharStyle instanceof WCharacterStyle) {
1103
+ hasValue = this.baseCharStyle.characterFormat.hasValue(property);
1104
+ }
1105
+ // 3. If VALUE is NULL get DEFAULT VALUE
1106
+ var defFormat = this.documentCharacterFormat();
1107
+ if (!hasValue && !isNullOrUndefined(defFormat) && !isNullOrUndefined(defFormat.documentFormat)) {
1108
+ hasValue = defFormat.documentFormat.hasValue(property);
1109
+ }
1110
+ return hasValue;
1111
+ };
1112
+ Object.defineProperty(WCharacterFormat.prototype, "revisionLength", {
1113
+ /**
1114
+ * @private
1115
+ */
1116
+ get: function () {
1117
+ if (!isNullOrUndefined(this.revisions)) {
1118
+ return this.revisions.length;
1119
+ }
1120
+ return 0;
1121
+ },
1122
+ enumerable: true,
1123
+ configurable: true
1124
+ });
1125
+ /**
1126
+ * @private
1127
+ */
1128
+ WCharacterFormat.prototype.getRevision = function (index) {
1129
+ if (!isNullOrUndefined(this.revisions)) {
1130
+ return this.revisions[index];
1131
+ }
1132
+ return undefined;
1133
+ };
1134
+ /**
1135
+ * Resolves the renderer that owns list definitions. The cached owner is often the
1136
+ * editor (DocumentEditor), whose documentHelper is not a DocxRenderer and has no
1137
+ * getListById. During undo a paragraph can also be detached from its page.
1138
+ */
1139
+ WCharacterFormat.prototype.getListDocumentHelper = function () {
1140
+ var bodyWidget = this.ownerBase instanceof ParagraphWidget ? this.ownerBase.bodyWidget : undefined;
1141
+ if (!isNullOrUndefined(bodyWidget) && !isNullOrUndefined(bodyWidget.page)
1142
+ && !isNullOrUndefined(bodyWidget.page.documentHelper)
1143
+ && typeof bodyWidget.page.documentHelper.getListById === 'function') {
1144
+ return bodyWidget.page.documentHelper;
1145
+ }
1146
+ if (!isNullOrUndefined(this.owner)) {
1147
+ if (typeof this.owner.getListById === 'function') {
1148
+ return this.owner;
1149
+ }
1150
+ if (!isNullOrUndefined(this.owner) && typeof this.owner.getListById === 'function') {
1151
+ return this.owner;
1152
+ }
1153
+ }
1154
+ return undefined;
1155
+ };
1156
+ /**
1157
+ * Marks followed-list layout when a numbered list paragraph's revision collection changes.
1158
+ */
1159
+ WCharacterFormat.prototype.markFollowedListLayout = function () {
1160
+ if (!(this.ownerBase instanceof ParagraphWidget) || isNullOrUndefined(this.ownerBase.paragraphFormat)
1161
+ || isNullOrUndefined(this.ownerBase.paragraphFormat.listFormat)) {
1162
+ return;
1163
+ }
1164
+ var listFormat = this.ownerBase.paragraphFormat.listFormat;
1165
+ var documentHelper = this.getListDocumentHelper();
1166
+ if (!isNullOrUndefined(documentHelper) && !isNullOrUndefined(documentHelper.getListById(listFormat.listId)) &&
1167
+ !isNullOrUndefined(listFormat.listLevel) && listFormat.listLevel.listLevelPattern !== 'Bullet') {
1168
+ documentHelper.isFollowedListLayoutRequired = true;
1169
+ }
1170
+ };
1171
+ /**
1172
+ * @private
1173
+ */
1174
+ WCharacterFormat.prototype.addRevision = function (revision) {
1175
+ if (this.revisions.indexOf(revision) === -1) {
1176
+ this.revisions.push(revision);
1177
+ }
1178
+ this.markFollowedListLayout();
1179
+ revision.hasChanges = true;
1180
+ };
1181
+ /**
1182
+ * @private
1183
+ */
1184
+ WCharacterFormat.prototype.insertRevisionAt = function (index, revision) {
1185
+ this.revisions.splice(index, 0, revision);
1186
+ this.markFollowedListLayout();
1187
+ revision.hasChanges = true;
1188
+ };
1189
+ /**
1190
+ * @private
1191
+ */
1192
+ WCharacterFormat.prototype.removeRevision = function (index) {
1193
+ var revision = this.revisions.splice(index, 1)[0];
1194
+ this.markFollowedListLayout();
1195
+ revision.hasChanges = true;
1196
+ return revision;
1197
+ };
1198
+ /**
1199
+ * @private
1200
+ */
1201
+ WCharacterFormat.prototype.getAllRevision = function () {
1202
+ return this.revisions;
1203
+ };
1204
+ /**
1205
+ * @private
1206
+ */
1207
+ WCharacterFormat.prototype.clearRevision = function () {
1208
+ this.revisions = [];
1209
+ };
1210
+ /**
1211
+ * @private
1212
+ */
1213
+ WCharacterFormat.prototype.getRevisionRange = function (revision) {
1214
+ var range = [];
1215
+ if (this.revisions.indexOf(revision) !== -1) {
1216
+ range.push(this);
1217
+ }
1218
+ return range;
1219
+ };
1220
+ WCharacterFormat.uniqueCharacterFormats = new WUniqueFormats();
1221
+ WCharacterFormat.uniqueFormatType = 2;
1222
+ return WCharacterFormat;
1223
+ }());
1224
+ export { WCharacterFormat };