@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.
- package/README.md +2 -2
- package/base.d.ts +4 -0
- package/base.js +4 -0
- package/dist/ej2-docx-renderer.umd.min.js +2 -0
- package/dist/ej2-docx-renderer.umd.min.js.map +1 -0
- package/dist/es6/ej2-docx-renderer.es2015.js +52432 -0
- package/dist/es6/ej2-docx-renderer.es2015.js.map +1 -0
- package/dist/es6/ej2-docx-renderer.es5.js +54425 -0
- package/dist/es6/ej2-docx-renderer.es5.js.map +1 -0
- package/dist/global/ej2-docx-renderer.min.js +2 -0
- package/dist/global/ej2-docx-renderer.min.js.map +1 -0
- package/dist/global/index.d.ts +5 -0
- package/format.d.ts +4 -0
- package/format.js +4 -0
- package/helper.d.ts +4 -0
- package/helper.js +4 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/license +10 -0
- package/list.d.ts +4 -0
- package/list.js +4 -0
- package/package.json +26 -4
- package/parser.d.ts +4 -0
- package/parser.js +4 -0
- package/src/base/constants.d.ts +2 -0
- package/src/base/constants.js +2 -0
- package/src/base/dictionary.d.ts +52 -0
- package/src/base/dictionary.js +137 -0
- package/src/base/index.d.ts +9 -0
- package/src/base/index.js +9 -0
- package/src/base/keywords.d.ts +422 -0
- package/src/base/keywords.js +422 -0
- package/src/base/types.d.ts +2590 -0
- package/src/base/types.js +1056 -0
- package/src/base/unique-format.d.ts +87 -0
- package/src/base/unique-format.js +858 -0
- package/src/base/unique-formats.d.ts +32 -0
- package/src/base/unique-formats.js +87 -0
- package/src/document-canvas.d.ts +61 -0
- package/src/document-canvas.js +221 -0
- package/src/docx-renderer.d.ts +941 -0
- package/src/docx-renderer.js +2251 -0
- package/src/format/border.d.ts +53 -0
- package/src/format/border.js +600 -0
- package/src/format/borders.d.ts +44 -0
- package/src/format/borders.js +314 -0
- package/src/format/cell-format.d.ts +42 -0
- package/src/format/cell-format.js +309 -0
- package/src/format/character-format.d.ts +152 -0
- package/src/format/character-format.js +1224 -0
- package/src/format/index.d.ts +14 -0
- package/src/format/index.js +14 -0
- package/src/format/list-format.d.ts +32 -0
- package/src/format/list-format.js +238 -0
- package/src/format/paragraph-format.d.ts +103 -0
- package/src/format/paragraph-format.js +854 -0
- package/src/format/row-format.d.ts +119 -0
- package/src/format/row-format.js +545 -0
- package/src/format/section-format.d.ts +89 -0
- package/src/format/section-format.js +689 -0
- package/src/format/shading.d.ts +24 -0
- package/src/format/shading.js +137 -0
- package/src/format/style.d.ts +106 -0
- package/src/format/style.js +286 -0
- package/src/format/table-format.d.ts +51 -0
- package/src/format/table-format.js +395 -0
- package/src/global.js +1 -0
- package/src/helper/document-editor-helper.d.ts +515 -0
- package/src/helper/document-editor-helper.js +1302 -0
- package/src/helper/document-editor-settings.d.ts +293 -0
- package/src/helper/document-editor-settings.js +94 -0
- package/src/helper/index.d.ts +5 -0
- package/src/helper/index.js +5 -0
- package/src/helper/layout-helper-methods.d.ts +539 -0
- package/src/helper/layout-helper-methods.js +1065 -0
- package/src/helper/renderer-hooks.d.ts +74 -0
- package/src/helper/renderer-hooks.js +14 -0
- package/src/helper/revision-helper-methods.d.ts +199 -0
- package/src/helper/revision-helper-methods.js +362 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +18 -0
- package/src/layout-helper.d.ts +190 -0
- package/src/layout-helper.js +1368 -0
- package/src/layout.d.ts +779 -0
- package/src/layout.js +17232 -0
- package/src/list/abstract-list.d.ts +25 -0
- package/src/list/abstract-list.js +67 -0
- package/src/list/index.d.ts +7 -0
- package/src/list/index.js +7 -0
- package/src/list/level-override.d.ts +22 -0
- package/src/list/level-override.js +43 -0
- package/src/list/list-level.d.ts +57 -0
- package/src/list/list-level.js +249 -0
- package/src/list/list.d.ts +30 -0
- package/src/list/list.js +100 -0
- package/src/page.d.ts +4155 -0
- package/src/page.js +11342 -0
- package/src/parser/index.d.ts +1 -0
- package/src/parser/index.js +1 -0
- package/src/parser/sfdt-reader.d.ts +254 -0
- package/src/parser/sfdt-reader.js +4569 -0
- package/src/render.d.ts +226 -0
- package/src/render.js +4222 -0
- package/src/text-helper.d.ts +144 -0
- package/src/text-helper.js +1079 -0
- package/src/text-helpers/index.d.ts +2 -0
- package/src/text-helpers/index.js +2 -0
- package/src/text-helpers/optimized.d.ts +45 -0
- package/src/text-helpers/optimized.js +121 -0
- package/src/text-helpers/regular.d.ts +37 -0
- package/src/text-helpers/regular.js +93 -0
- package/src/themes/font-scheme.d.ts +28 -0
- package/src/themes/font-scheme.js +107 -0
- package/src/themes/index.d.ts +6 -0
- package/src/themes/index.js +6 -0
- package/src/themes/major-minor-font-scheme.d.ts +14 -0
- package/src/themes/major-minor-font-scheme.js +45 -0
- package/src/themes/themes.d.ts +11 -0
- package/src/themes/themes.js +31 -0
- package/src/utility/index.d.ts +1 -0
- package/src/utility/index.js +1 -0
- package/src/utility/path-util.d.ts +133 -0
- package/src/utility/path-util.js +639 -0
- package/text-helpers.d.ts +4 -0
- package/text-helpers.js +4 -0
- package/themes.d.ts +4 -0
- package/themes.js +4 -0
- package/utility.d.ts +4 -0
- package/utility.js +4 -0
package/src/render.js
ADDED
|
@@ -0,0 +1,4222 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { isNullOrUndefined, L10n, updateCSSText } from '@syncfusion/ej2-base';
|
|
13
|
+
import { BodyWidget, ParagraphWidget, TableWidget, LineWidget, TextElementBox, ImageElementBox, ListTextElementBox, TabElementBox, FieldElementBox, BookmarkElementBox, CommentCharacterElementBox, EditRangeStartElementBox, EditRangeEndElementBox, ShapeElementBox, GroupShapeElementBox, TableRowWidget, TableCellWidget, BlockWidget, HeaderFooterWidget, FieldTextElementBox } from './page';
|
|
14
|
+
import { LayoutHelperMethods } from './index';
|
|
15
|
+
import { Dictionary, Rect, Layout, FontScriptType, CharacterRangeType, Margin, ContentControl } from './index';
|
|
16
|
+
import { WebLayoutHelper, PageLayoutHelper } from './layout-helper';
|
|
17
|
+
import { ShapeBase, TextFrame } from './page';
|
|
18
|
+
import { getPathString, pathSegmentCollection, processPathData, splitArrayCollection, transformPath } from './utility/path-util';
|
|
19
|
+
import { DocumentCanvasElement } from './document-canvas';
|
|
20
|
+
/**
|
|
21
|
+
* Renderer class provides comprehensive rendering functionality for the Document Editor.
|
|
22
|
+
* Handles PDF export by rendering all widget types to canvas context operations.
|
|
23
|
+
*
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
var Renderer = /** @class */ (function () {
|
|
27
|
+
function Renderer(documentHelper) {
|
|
28
|
+
/**
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
this.commentMarkDictionary = new Dictionary();
|
|
32
|
+
this.isPrinting = false;
|
|
33
|
+
this.skipRenderWavyLine = false;
|
|
34
|
+
this.isExporting = false;
|
|
35
|
+
/**
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
this.pageLeft = 0;
|
|
39
|
+
/**
|
|
40
|
+
* @private
|
|
41
|
+
*/
|
|
42
|
+
this.pageTop = 0;
|
|
43
|
+
/**
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
this.pageIndex = -1;
|
|
47
|
+
this.isFieldCode = false;
|
|
48
|
+
this.isRenderHeader = false;
|
|
49
|
+
this.height = 0;
|
|
50
|
+
this.fieldStacks = [];
|
|
51
|
+
this.isRenderingCellBorders = false;
|
|
52
|
+
this.shapes = {
|
|
53
|
+
//<---------------- Basic Shapes ---------------->
|
|
54
|
+
'Rectangle': 'M0,0 L50,0 L50,50 L0,50 z',
|
|
55
|
+
'Oval': 'M80.5,12.5 C80.5,19.127417 62.59139,24.5 40.5,24.5 C18.40861,24.5 0.5,19.127417 0.5,12.5' +
|
|
56
|
+
'C0.5,5.872583 18.40861,0.5 40.5,0.5 C62.59139,0.5 80.5,5.872583 80.5,12.5 z',
|
|
57
|
+
'IsoscelesTriangle': 'M45,0 L90,45 L0,45 L45,0 z',
|
|
58
|
+
'RightTriangle': 'M836.293,292.9238 L776.293,292.9238 L776.293,254.8408 L836.293,292.9238 z',
|
|
59
|
+
'Parallelogram': 'M30,0 L60,0 L45,30 L15,30 z',
|
|
60
|
+
'Trapezoid': 'M 1873 358 l -506 1332 h -686 l -506 -1332 z',
|
|
61
|
+
'Diamond': 'M397.784,287.875 L369.5,316.159 L341.216,287.875 L369.5,259.591 L397.784,287.875 z',
|
|
62
|
+
'RegularPentagon': 'M30,0 L60,30 L50,70 L10,70 L0,30 L30,0 z',
|
|
63
|
+
'Hexagon': 'M30,0 L60,0 L90,30 L60,60 L30,60 L0,30 L30,0 z',
|
|
64
|
+
'Heptagon': 'M223.7783,195.7134 L207.1303,174.8364 L213.0713,148.8034 L237.1303,137.2174 L261.1883,148.8034 L267.1303,174.8364' +
|
|
65
|
+
'L250.4813,195.7134 L223.7783,195.7134 z',
|
|
66
|
+
'Octagon': 'M98.7319,196.4653 L81.1579,178.8923 L81.1579,154.0393 L98.7319,136.4653 L123.5849,136.4653' +
|
|
67
|
+
'L141.1579,154.0393 L141.1579,178.8923 L123.5849,196.4653 L98.7319,196.4653 z',
|
|
68
|
+
'Decagon': 'M657.3379,302.4141 L642.3369,291.5161 L636.6089,273.8821 L642.3369,256.2481 L657.3379,245.3511 L675.8789,245.3511' +
|
|
69
|
+
'L690.8789,256.2481 L696.6089,273.8821' +
|
|
70
|
+
'L690.8789,291.5161 L675.8789,302.4141 L657.3379,302.4141 z',
|
|
71
|
+
'Dodecagon': 'M-69.20000457763672,-17.685555555555553L-50.656966313962585,-48.31444444444445L-18.543038263674127,-66L18.543038263674134,-66L50.656966313962585,-48.31444444444445L69.20000457763672,-17.685555555555553L69.20000457763672,17.685555555555553L50.656966313962585,48.31444444444445L18.543038263674134,66L-18.543038263674127,66L-50.656966313962585,48.31444444444445L-69.20000457763672,17.685555555555553Z',
|
|
72
|
+
'Pie': 'M 1024 1894 q -120 0 -231 -31 q -111 -31 -208 -88 q -97 -57 -176 -136 q -79 -79 -136 -176 q -57 -97 -88 -208 q -31 -111 -31 -231 q 0 -109 26 -212 q 26 -102 75 -194 q 48 -92 117 -170 q 68 -78 153 -138 q 84 -59 183 -98 q 99 -39 207 -52 l 58 -7 v 922 h 922 l -7 58 q -13 109 -52 207 q -39 99 -98 183 q -60 85 -138 153 q -78 69 -170 117 q -92 49 -194 75 q -103 26 -212 26 z',
|
|
73
|
+
'Chord': 'M 1024 1894 q -120 0 -231 -31 q -111 -31 -208 -88 q -97 -57 -176 -136 q -79 -79 -136 -176 q -57 -97 -88 -208 q -31 -111 -31 -231 q 0 -116 29 -224 q 29 -108 82 -203 q 53 -94 128 -173 q 75 -79 167 -137 q 92 -57 198 -92 q 106 -34 222 -40 l 23 -1 l 891 891 l -1 23 q -6 116 -40 222 q -35 106 -92 198 q -58 92 -137 167 q -79 75 -173 128 q -95 53 -203 82 q -108 29 -224 29 z',
|
|
74
|
+
'Teardrop': 'M 1024 1894 q -120 0 -231 -31 q -111 -31 -208 -88 q -97 -57 -176 -136 q -79 -79 -136 -176 q -57 -97 -88 -208 q -31 -111 -31 -231 q 0 -120 31 -231 q 31 -111 88 -208 q 57 -97 136 -176 q 79 -79 176 -136 q 97 -57 208 -88 q 111 -31 231 -31 h 870 v 870 q 0 120 -31 231 q -31 111 -88 208 q -57 97 -136 176 q -79 79 -176 136 q -97 57 -208 88 q -111 31 -231 31 z',
|
|
75
|
+
'Frame': 'M 1894 154 v 1740 h -1740 v -1740 m 1433 307 h -1126 v 1126 h 1126 z',
|
|
76
|
+
'HalfFrame': 'M 154 154 h 1668 l -307 307 h -1054 v 1054 l -307 307 z',
|
|
77
|
+
'L_Shape': 'M 870 154 v 1024 h 1024 v 716 h -1740 v -1740 z',
|
|
78
|
+
'DiagonalStripe': 'M 154 943 l 789 -789 h 879 l -1668 1668 z',
|
|
79
|
+
'Cross': 'M 666 1894 v -512 h -512 v -716 h 512 v -512 h 716 v 512 h 512 v 716 h -512 v 512 z',
|
|
80
|
+
'Plaque': 'M 563 1894 v -51 q 0 -66 -31 -131 q -31 -64 -81 -115 q -51 -50 -115 -81 q -65 -31 -131 -31 h -51 v -922 h 51 q 66 0 131 -31 q 64 -31 115 -82 q 50 -50 81 -115 q 31 -64 31 -130 v -51 h 922 v 51 q 0 66 31 130 q 31 65 82 115 q 50 51 115 82 q 64 31 130 31 h 51 v 922 h -51 q -66 0 -130 31 q -65 31 -115 81 q -51 51 -82 115 q -31 65 -31 131 v 51 z',
|
|
81
|
+
// 'Can': 'M 1024 154 q 132 0 253 15 q 121 16 213 43 q 91 27 146 64 q 54 38 54 82 v 1332 q 0 44 -54 81 q -55 38 -146 65 q -92 27 -213 42 q -121 16 -253 16 q -132 0 -253 -16 q -121 -15 -212 -42 q -92 -27 -146 -65 q -55 -37 -55 -81 v -1332 q 0 -44 55 -82 q 54 -37 146 -64 q 91 -27 212 -43 q 121 -15 253 -15 z',
|
|
82
|
+
'Cube': 'M 1946 102 v 1280 l -564 564 h -1280 v -1280 l 564 -564 m 665 615 h -1126 v 1126 h 1126 m 51 -1229 l 410 -409 h -1075 l -410 409 m 1536 -307 l -409 410 v 1024 l 409 -410 z',
|
|
83
|
+
'Bevel': 'M 1946 102 v 1844 h -1844 v -1844 m 175 103 l 205 205 h 1084 l 205 -205 m -235 1331 v -1024 h -1024 v 1024 m -307 235 l 205 -205 v -1084 l -205 -205 m 1566 1566 l -205 -205 h -1084 l -205 205 m 1566 -1566 l -205 205 v 1084 l 205 205 z',
|
|
84
|
+
'Donut': 'M 1024 154 q 120 0 231 31 q 111 31 208 88 q 97 57 176 136 q 79 79 136 176 q 57 97 88 208 q 31 111 31 231 q 0 120 -31 231 q -31 111 -88 208 q -57 97 -136 176 q -79 79 -176 136 q -97 57 -208 88 q -111 31 -231 31 q -120 0 -231 -31 q -111 -31 -208 -88 q -97 -57 -176 -136 q -79 -79 -136 -176 q -57 -97 -88 -208 q -31 -111 -31 -231 q 0 -120 31 -231 q 31 -111 88 -208 q 57 -97 136 -176 q 79 -79 176 -136 q 97 -57 208 -88 q 111 -31 231 -31 m 0 1331 q 95 0 179 -37 q 84 -36 147 -99 q 62 -62 99 -146 q 36 -84 36 -179 q 0 -95 -36 -179 q -37 -84 -99 -147 q -63 -62 -147 -99 q -84 -36 -179 -36 q -95 0 -179 36 q -84 37 -146 99 q -63 63 -99 147 q -37 84 -37 179 q 0 95 37 179 q 36 84 99 146 q 62 63 146 99 q 84 37 179 37 z',
|
|
85
|
+
'NoSymbol': 'M 1024 154 q 124 0 237 30 q 112 30 209 85 q 96 56 175 134 q 78 79 134 175 q 55 97 85 209 q 30 113 30 237 q 0 124 -30 236 q -30 113 -85 209 q -56 97 -134 175 q -79 79 -175 134 q -97 56 -209 86 q -113 30 -237 30 q -124 0 -236 -30 q -113 -30 -209 -86 q -97 -55 -175 -134 q -79 -78 -134 -175 q -56 -96 -86 -209 q -30 -112 -30 -236 q 0 -124 30 -237 q 30 -112 86 -209 q 55 -96 134 -175 q 78 -78 175 -134 q 96 -55 209 -85 q 112 -30 236 -30 m 273 1369 l -772 -772 l -28 74 q -36 96 -36 199 q 0 116 45 218 q 44 103 121 179 q 76 77 179 121 q 102 45 218 45 q 103 0 199 -36 m 328 -328 q 36 -96 36 -199 q 0 -116 -44 -219 q -45 -102 -121 -179 q -77 -76 -179 -121 q -103 -44 -219 -44 q -103 0 -199 36 l -74 28 l 772 772 z',
|
|
86
|
+
'BlockArc': 'M 1485 1485 v -51 q 0 -96 -36 -180 q -37 -84 -99 -147 q -63 -62 -147 -98 q -84 -36 -179 -36 q -95 0 -179 36 q -84 36 -146 98 q -63 63 -99 147 q -37 84 -37 180 v 51 h -409 v -51 q 0 -120 31 -231 q 31 -111 88 -208 q 57 -97 136 -177 q 79 -79 176 -136 q 97 -57 208 -88 q 111 -31 231 -31 q 120 0 231 31 q 111 31 208 88 q 97 57 176 136 q 79 80 136 177 q 57 97 88 208 q 31 111 31 231 v 51 z',
|
|
87
|
+
'FoldedCorner': 'M 1946 102 v 1229 l -615 615 h -1229 v -1844 m 1229 1699 l 470 -470 h -470 m 512 -1126 h -1638 v 1638 h 1024 v -614 h 614 z' + 'M 154 1894 v -1740 h 1740 v 1156 l -584 584 z',
|
|
88
|
+
'SmileyFace': 'M 1024 102 q 127 0 245 33 q 118 33 221 93 q 102 60 186 144 q 84 84 144 186 q 60 103 93 221 q 33 118 33 245 q 0 127 -33 245 q -33 118 -93 220 q -60 103 -144 187 q -84 84 -186 144 q -103 60 -221 93 q -118 33 -245 33 q -127 0 -245 -33 q -118 -33 -220 -93 q -103 -60 -187 -144 q -84 -84 -144 -187 q -60 -102 -93 -220 q -33 -118 -33 -245 q 0 -127 33 -245 q 33 -118 93 -221 q 60 -102 144 -186 q 84 -84 187 -144 q 102 -60 220 -93 q 118 -33 245 -33 m 0 1741 q 113 0 218 -30 q 104 -29 195 -82 q 91 -53 166 -128 q 75 -75 128 -166 q 53 -91 83 -196 q 29 -104 29 -217 q 0 -113 -29 -218 q -30 -104 -83 -195 q -53 -91 -128 -166 q -75 -75 -166 -128 q -91 -53 -195 -83 q -105 -29 -218 -29 q -113 0 -217 29 q -105 30 -196 83 q -91 53 -166 128 q -75 75 -128 166 q -53 91 -82 195 q -30 105 -30 218 q 0 113 30 217 q 29 105 82 196 q 53 91 128 166 q 75 75 166 128 q 91 53 196 82 q 104 30 217 30 m 358 -1331 q 32 0 60 12 q 28 12 49 33 q 21 21 33 49 q 12 28 12 60 q 0 32 -12 59 q -12 28 -33 49 q -21 21 -49 33 q -28 12 -60 12 q -32 0 -59 -12 q -28 -12 -49 -33 q -21 -21 -33 -49 q -12 -27 -12 -59 q 0 -32 12 -60 q 12 -28 33 -49 q 21 -21 49 -33 q 27 -12 59 -12 m 52 102 h -103 v 103 h 103 m -768 -205 q 31 0 59 12 q 28 12 49 33 q 21 21 33 49 q 12 28 12 60 q 0 32 -12 59 q -12 28 -33 49 q -21 21 -49 33 q -28 12 -59 12 q -32 0 -60 -12 q -28 -12 -49 -33 q -21 -21 -33 -49 q -12 -27 -12 -59 q 0 -32 12 -60 q 12 -28 33 -49 q 21 -21 49 -33 q 28 -12 60 -12 m 51 102 h -103 v 103 h 103 m 823 512 q -18 87 -66 162 q -48 75 -117 130 q -69 55 -154 86 q -86 31 -179 31 q -93 0 -178 -31 q -86 -31 -155 -86 q -69 -55 -117 -130 q -48 -75 -66 -162 h 106 q 17 66 57 122 q 39 56 94 97 q 55 42 122 65 q 66 23 137 23 q 71 0 138 -23 q 66 -23 121 -65 q 55 -41 95 -97 q 39 -56 56 -122 z',
|
|
89
|
+
'Heart': 'M 997 1758 q -401 -286 -612 -551 q -212 -265 -231 -504 v -101 q 9 -106 45 -187 q 35 -80 87 -135 q 52 -55 114 -85 q 62 -30 122 -36 q 21 -2 41 -3 q 19 -1 38 -1 q 67 0 119 12 q 51 13 96 38 q 44 26 85 65 q 40 39 84 91 l 39 46 l 39 -46 q 44 -52 85 -91 q 40 -39 85 -65 q 44 -25 96 -38 q 51 -12 118 -12 q 19 0 39 1 q 19 1 40 3 q 60 6 122 36 q 62 31 114 86 q 51 56 87 137 q 36 82 45 189 v 100 q -19 240 -229 503 q -211 264 -609 548 l -30 21 z',
|
|
90
|
+
'LightningBolt': 'M-8,-55L7,-24L1,-20L19,6L13,11L36,55L-3,21L5,16L-19,-6L-11,-12L-36,-35Z',
|
|
91
|
+
'Sun': 'M69.60002899169922,0L41.51352437242167,8.416795119701419L41.51352437242167,-8.416795119701426ZM49.209798275982905,-41.47314036934465L36.41601824906962,-18.783766017986338L22.290725499983694,-30.686752034954836ZM0,-58.64998245239259L9.988224375410937,-34.982276749768076L-9.988224375410944,-34.982276749768076ZM-49.216242723111755,-41.47314036934465L-22.290725499983694,-30.686752034954836L-36.416018249069616,-18.783766017986338ZM-69.60002899169922,0L-41.51352437242167,-8.416795119701426L-41.51352437242167,8.416795119701419ZM-49.216242723111755,41.46770981541388L-36.416018249069616,18.783766017986338L-22.290725499983694,30.68675203495485ZM0,58.64998245239259L-9.988224375410944,34.98227674976806L9.988224375410937,34.98227674976806ZM49.209798275982905,41.46770981541388L22.290725499983694,30.68675203495485L36.41601824906962,18.783766017986338ZM-34.80001449584961,0Q-34.800014495849624,-12.14680908236253,-24.607326235405417,-20.735900154279413Q-14.414637974961238,-29.32499122619629,-1.4210854715202004e-14,-29.324991226196296Q14.414637974961224,-29.324991226196293,24.60732623540541,-20.735900154279413Q34.80001449584961,-12.146809082362545,34.80001449584961,-7.105427357601002e-15Q34.80001449584961,12.146809082362523,24.60732623540541,20.735900154279406Q14.414637974961224,29.32499122619629,0,29.32499122619629Q-14.414637974961217,29.32499122619629,-24.607326235405388,20.73590015427945Q-34.8000144958496,12.146809082362552,-34.80001449584961,7.105427357601002e-15Z',
|
|
92
|
+
'Moon': 'M36.80000305175781,60.90000915527344Q6.313882332939066,60.90000915527344,-15.243060359409363,43.06280944801668Q-36.80000305175781,25.22560974075992,-36.80000305175781,7.105427357601002e-15Q-36.800003051757834,-25.225609740759907,-15.243060359409384,-43.062809448016665Q6.3138823329390235,-60.90000915527342,36.8000030517578,-60.90000915527344Q6.313882332939052,-41.98080184970351,0.9246466598519447,-10.765702362004177Q-4.464589013235177,20.449397125695157,18.400001525878878,45.67500686645508Q26.28571646554125,54.375008174351294,36.800003051757784,60.90000915527344Z',
|
|
93
|
+
'Cloud': 'M 1024 1792 q -60 0 -115 -20 q -55 -19 -100 -54 q -46 -34 -79 -83 q -34 -48 -50 -106 l -24 -86 l -62 65 q -37 38 -83 58 q -47 21 -101 21 q -54 0 -101 -21 q -47 -20 -81 -55 q -35 -35 -54 -83 q -20 -47 -20 -100 q 0 -48 18 -91 q 18 -42 50 -78 l 25 -28 l -19 -32 q -38 -64 -56 -135 q -18 -71 -18 -145 q 0 -116 44 -219 q 44 -102 121 -179 q 76 -76 179 -121 q 102 -44 219 -44 q 106 0 206 38 q 99 39 177 113 l 39 37 l 35 -41 q 61 -72 140 -110 q 79 -37 171 -37 q 85 0 160 32 q 74 33 130 88 q 55 56 87 130 q 32 75 32 160 q 0 70 -23 135 q -23 66 -71 123 l -28 34 l 30 32 q 45 51 69 112 q 23 61 23 127 q 0 74 -28 139 q -28 65 -76 114 q -49 49 -114 77 q -66 28 -140 28 q -63 0 -126 -24 l -44 -17 l -20 43 q -23 47 -56 84 q -34 38 -76 64 q -42 27 -90 41 q -48 14 -100 14 z',
|
|
94
|
+
'Arc': 'M-1.4210854715202004e-14,-45.200008392333984Q15.408730615404892,-45.200008392334,26.304348523034477,-31.96123244390823Q37.19996643066406,-18.722456495482472,37.19996643066406,-2.1316282072803006e-14Q37.19996643066406,-1.4210854715202004e-14,37.19996643066406,-1.4210854715202004e-14',
|
|
95
|
+
'DoubleBracket': 'M 717 1843 v 103 h -307 q -63 0 -119 -25 q -56 -24 -98 -66 q -42 -42 -66 -98 q -25 -56 -25 -119 v -1228 q 0 -63 25 -119 q 24 -56 66 -98 q 42 -42 98 -67 q 56 -24 119 -24 h 307 v 103 h -307 q -42 0 -79 16 q -38 16 -66 44 q -28 28 -44 65 q -16 38 -16 80 v 1228 q 0 42 16 79 q 16 38 44 66 q 28 28 66 44 q 37 16 79 16 m 1228 -1741 q 63 0 119 24 q 56 25 98 67 q 42 42 67 98 q 24 56 24 119 v 1228 q 0 63 -24 119 q -25 56 -67 98 q -42 42 -98 66 q -56 25 -119 25 h -307 v -103 h 307 q 42 0 80 -16 q 37 -16 65 -44 q 28 -28 44 -66 q 16 -37 16 -79 v -1228 q 0 -42 -16 -80 q -16 -37 -44 -65 q -28 -28 -65 -44 q -38 -16 -80 -16 h -307 v -103 z',
|
|
96
|
+
'DoubleBrace': 'M 1843 1126 q -38 0 -75 8 q -37 9 -66 32 q -29 23 -46 62 q -18 40 -18 103 v 410 q 0 77 -22 118 q -23 42 -55 61 q -33 20 -68 23 q -35 3 -59 3 h -103 v -103 q 14 -1 25 -1 q 10 0 18 0 q 15 0 27 0 q 11 1 33 1 q 38 0 59 -16 q 20 -15 30 -35 q 11 -22 13 -51 v -410 q 0 -62 18 -113 q 17 -51 46 -90 q 29 -39 66 -66 q 36 -26 75 -38 q -39 -12 -75 -40 q -37 -27 -66 -67 q -29 -40 -46 -91 q -18 -50 -18 -109 v -410 q 0 -38 -16 -59 q -16 -20 -35 -30 q -23 -11 -51 -13 h -103 v -103 h 103 q 57 3 102 26 q 19 10 38 24 q 18 15 32 37 q 14 22 23 51 q 9 29 9 67 v 410 q 0 59 18 98 q 17 39 46 63 q 29 24 66 34 q 37 10 75 10 m -1638 0 q 38 0 75 -10 q 37 -10 66 -34 q 29 -24 47 -63 q 17 -39 17 -98 v -410 q 0 -38 9 -67 q 9 -29 23 -51 q 14 -22 33 -37 q 18 -14 37 -24 q 45 -23 102 -26 h 103 v 103 h -103 q -29 2 -51 13 q -20 10 -35 30 q -16 21 -16 59 v 410 q 0 59 -17 109 q -18 51 -47 91 q -29 40 -65 67 q -37 28 -76 40 q 39 12 76 38 q 36 27 65 66 q 29 39 47 90 q 17 51 17 113 v 410 q 2 29 13 51 q 10 20 31 35 q 20 16 58 16 q 22 0 33 -1 q 11 0 27 0 q 8 0 19 0 q 10 0 24 1 v 103 h -103 q -24 0 -59 -3 q -35 -3 -67 -23 q -33 -19 -55 -61 q -23 -41 -23 -118 v -410 q 0 -63 -17 -103 q -18 -39 -47 -62 q -29 -23 -66 -32 q -37 -8 -75 -8 z',
|
|
97
|
+
'LeftBracket': 'M 1331 1843 v 103 h -307 q -63 0 -119 -25 q -56 -24 -98 -66 q -42 -42 -66 -98 q -24 -56 -24 -119 v -1228 q 0 -63 24 -119 q 24 -56 66 -98 q 42 -42 98 -67 q 56 -24 119 -24 h 307 v 103 h -307 q -42 0 -79 16 q -38 16 -66 44 q -28 28 -44 65 q -16 38 -16 80 v 1228 q 0 42 16 79 q 16 38 44 66 q 28 28 66 44 q 37 16 79 16 z',
|
|
98
|
+
'RightBracket': 'M 1024 102 q 63 0 119 24 q 56 25 98 67 q 42 42 66 98 q 24 56 24 119 v 1228 q 0 63 -24 119 q -24 56 -66 98 q -42 42 -98 66 q -56 25 -119 25 h -307 v -103 h 307 q 42 0 80 -16 q 37 -16 65 -44 q 28 -28 44 -66 q 16 -37 16 -79 v -1228 q 0 -42 -16 -80 q -16 -37 -44 -65 q -28 -28 -65 -44 q -38 -16 -80 -16 h -307 v -103 z',
|
|
99
|
+
'LeftBrace': 'M 717 922 q 38 0 75 -10 q 37 -10 66 -34 q 29 -24 47 -63 q 17 -39 17 -98 v -410 q 0 -38 9 -67 q 9 -29 23 -51 q 14 -22 33 -37 q 18 -14 37 -24 q 45 -23 102 -26 h 103 v 103 h -103 q -29 2 -51 13 q -20 10 -35 30 q -16 21 -16 59 v 410 q 0 59 -17 109 q -18 51 -47 91 q -29 40 -65 67 q -37 28 -76 40 q 39 12 76 38 q 36 27 65 66 q 29 39 47 90 q 17 51 17 113 v 410 q 2 29 13 51 q 10 20 31 35 q 20 16 58 16 q 22 0 33 -1 q 11 0 27 0 q 8 0 19 0 q 10 0 24 1 v 103 h -103 q -24 0 -59 -3 q -35 -3 -67 -23 q -33 -19 -55 -61 q -23 -41 -23 -118 v -410 q 0 -63 -17 -103 q -18 -39 -47 -62 q -29 -23 -66 -32 q -37 -8 -75 -8 z',
|
|
100
|
+
'RightBrace': 'M 1229 1126 q -39 0 -75 8 q -37 9 -66 32 q -29 23 -46 62 q -18 40 -18 103 v 410 q 0 51 -10 86 q -11 35 -28 58 q -18 23 -40 35 q -22 13 -44 18 q -23 6 -45 7 q -22 1 -38 1 h -102 v -103 q 14 -1 25 -1 q 10 0 18 0 q 15 0 26 0 q 11 1 33 1 q 38 0 59 -16 q 21 -15 31 -35 q 11 -22 13 -51 v -410 q 0 -62 18 -113 q 17 -51 46 -90 q 28 -39 65 -66 q 36 -26 75 -38 q -39 -12 -75 -40 q -37 -27 -65 -67 q -29 -40 -46 -91 q -18 -50 -18 -109 v -410 q 0 -38 -16 -59 q -16 -20 -36 -30 q -23 -11 -51 -13 h -102 v -103 h 102 q 57 3 102 26 q 19 10 38 24 q 18 15 33 37 q 14 22 23 51 q 9 29 9 67 v 410 q 0 59 18 98 q 17 39 46 63 q 29 24 66 34 q 36 10 75 10 z',
|
|
101
|
+
'Plus': 'M696.6084,158.2656 L674.8074,158.2656 L674.8074,136.4656 L658.4084,136.4656 L658.4084,158.2656 L636.6084,158.2656' +
|
|
102
|
+
'L636.6084,174.6646 L658.4084,174.6646 L658.4084,196.4656 L674.8074,196.4656 L674.8074,174.6646 L696.6084,174.6646' +
|
|
103
|
+
'L696.6084,158.2656 z',
|
|
104
|
+
'Star': 'M540.3643,137.9336 L546.7973,159.7016 L570.3633,159.7296 L550.7723,171.9366 L558.9053,194.9966 L540.3643,179.4996' +
|
|
105
|
+
'L521.8223,194.9966 L529.9553,171.9366 L510.3633,159.7296 L533.9313,159.7016 L540.3643,137.9336 z',
|
|
106
|
+
'Can': 'M 542.802,362.009C 542.802,368.452 525.341,373.676 503.802,373.676C 482.263,373.676 464.802,368.452 464.802,362.009' +
|
|
107
|
+
'L 464.802,466.484C 464.802,472.928 482.263,478.151 503.802,478.151' +
|
|
108
|
+
'C 525.341,478.151 542.802,472.928 542.802,466.484L 542.802,362.016C 542.802,368.459 525.341,373.534 503.802,373.534' +
|
|
109
|
+
'C 482.263,373.534 464.802,368.31 464.802,361.867' +
|
|
110
|
+
'L 464.802,362.016C 464.802,355.572 482.263,350.349 503.802,350.349C 525.341,350.349 542.802,355.572 542.802,362.016',
|
|
111
|
+
//<---------------- Flowchart Shapes ---------------->
|
|
112
|
+
'FlowChartProcess': 'M419.511,76.687L359.511,76.687L359.511,43.086L419.511,43.086z',
|
|
113
|
+
'FlowChartAlternateProcess': 'M 456 1690 q -62 0 -117 -24 q -55 -24 -96 -65 q -41 -41 -65 -96 q -24 -55 -24 -118 v -726 q 0 -63 24 -118 q 24 -55 65 -96 q 41 -41 96 -65 q 55 -24 117 -24 h 1136 q 62 0 117 24 q 55 24 96 65 q 41 41 65 96 q 24 55 24 118 v 726 q 0 63 -24 118 q -24 55 -65 96 q -41 41 -96 65 q -55 24 -117 24 z',
|
|
114
|
+
'FlowChartPunchedTape': 'M 563 1894 q -94 0 -169 -15 q -76 -15 -129 -38 q -54 -23 -82 -50 q -29 -27 -29 -50 v -1276 q 69 45 175 71 q 105 27 234 27 q 109 0 203 -20 q 94 -19 163 -54 q 68 -34 107 -81 q 39 -46 39 -101 q 0 -23 29 -50 q 29 -27 83 -50 q 53 -23 129 -38 q 75 -15 169 -15 q 94 0 170 15 q 75 15 128 38 q 53 23 82 50 q 29 27 29 50 v 1276 q -69 -45 -174 -72 q -106 -26 -235 -26 q -110 0 -203 19 q -94 20 -162 54 q -69 35 -108 81 q -39 47 -39 102 q 0 23 -29 50 q -29 27 -82 50 q -54 23 -129 38 q -76 15 -170 15 Z',
|
|
115
|
+
'FlowChartDecision': 'M 253.005,115.687L 200.567,146.071L 148.097,115.687L 200.534,85.304L 253.005,115.687 Z',
|
|
116
|
+
'FlowChartDocument': 'M 60 31.9 c 0 0 -11 -7.7 -30 0 s -30 0 -30 0 V 0 h 60 V 31.9 Z',
|
|
117
|
+
'FlowChartPredefinedProcess': 'M 0,0 L 50,0 L 50,50 L 0,50 Z M 8.334,0 L 8.334,50 M 41.667,0 L 41.667,50',
|
|
118
|
+
'FlowChartTerminator': 'M 269.711,29.33C 269.71,44.061 257.77,56 243.04,56L 158.058,56C 143.33,56 131.39,44.061 131.39,29.33L 131.39,29.33' +
|
|
119
|
+
'C 131.391,14.6057 143.33,2.669 158.058,2.669L 243.044,2.669C 257.772,2.669 269.711,14.6057 269.711,29.333 Z',
|
|
120
|
+
'PaperTap': 'M0.0009,17.2042 L0.0009,47.165 C0.001,47.165 14.403,53.5455 25.00,47.165 C35.599,40.7852 44.403,43.5087 50.00,47.165' +
|
|
121
|
+
'L50.001,17.2042 M50.001,32.7987 L50.001,2.8405 C50.001,2.8405 35.599,-3.5427 25.001,2.8405' +
|
|
122
|
+
'C14.403,9.2237 5.599,6.494 0.0009,2.8405 L0.0009,32.7987',
|
|
123
|
+
'DirectData': 'M 132.62 0 L 17.38 0 C 7.78 0 0 13.43 0 30 C 0 46.57 7.78 60 17.38 60 L 132.62 60 M 132.62 0' +
|
|
124
|
+
'C 123.02 0 115.24 13.43 115.24 30 C 115.24 46.57 123.02 60 132.62 60 C 142.22 60 150 46.57 150 30 C 150 13.43 142.22 0 132.62 0 z ',
|
|
125
|
+
'SequentialData': 'M0.0029,24.999 C0.0029,11.1922 10.433,0.0021 23.295,0.0021 C36.159,0.00216 46.585,11.1922 46.585,24.999' +
|
|
126
|
+
'C46.585,38.8057 36.159,49.9979 23.295,49.9979 C10.433,49.9979 0.0029,38.8057 0.0029,24.999 z M23.294,49.999 L50.002,49.999',
|
|
127
|
+
'FlowChartSort': 'M50.001,24.9971 L25.001,49.9971 L0.00097,24.9971 L25.001,-0.00286865 L50.001,24.9971 z' +
|
|
128
|
+
' M0.000976562,24.9971 L50.001,24.9971',
|
|
129
|
+
'FlowChartMultiDocument': 'M43.6826,40 C44.8746,40.6183 45.8586,41.3502 46.8366,42.1122 L46.8366,4.74487 L3.09857,4.74487 L3.09857,10.9544' +
|
|
130
|
+
' M46.837,35.143 C48.027,35.765 49.025,36.604 50.003,37.369 L50.003,0.002 L6.264,0.002 L6.264,4.744 M43.682,47.113 L43.682,10.765' +
|
|
131
|
+
' L0.0025,10.7652 L0.0025,47.1132 C0.0025,47.1132 12.5846,53.6101 21.8426,47.1132 C31.1006,40.6163 38.792,43.393 43.6826,47.1132 z',
|
|
132
|
+
'FlowChartCollate': 'M50.001,0.0028 L25.001,25.0029 L0.00097,0.0028 L50.001,0.002 z M0.0009,50.002 L25.001,25.002' +
|
|
133
|
+
'L50.001,50.002 L0.0009,50.0029 z',
|
|
134
|
+
'FlowChartSummingJunction': 'M7.3252,42.6768 L42.6772,7.3247 M42.6768,42.6768 L7.3248,7.3247 M0.0009,25.001 ' +
|
|
135
|
+
'C0.0009,11.193 11.197,0.0009 25.001,0.0009' +
|
|
136
|
+
' C38.809,0.0009 50.001,11.193 50.001,25.001 C50.001,38.809 38.809,50.001 25.001,50.001 C11.197,50.00 0.0009,38.809 0.0009,25.00 z',
|
|
137
|
+
'FlowChartOr': 'M 0 50 L 100 50 M 50 100 L 50 0.0 M 0 50 C 0 22.384 22.392 0 50 0 C 77.616 0 100 22.384 100 50' +
|
|
138
|
+
' C 100 77.616 77.616 100 50 100 C 22.392 100 0 77.616 0 50 Z',
|
|
139
|
+
'FlowChartInternalStorage': 'M 0 3.81946A 2.5,3.81946 0 0,1 2.5,0L 47.5 0A 2.5,3.81946 0 0,1 50,3.81946' +
|
|
140
|
+
'L 50 45.836A 2.5,3.819446 0 0,1 47.5,49.652778' +
|
|
141
|
+
'L 2.5 49.652778A 2.5,3.819446 0 0,1 0,45.8336L 0 3.819446ZM 0 11.45834L 50 11.4583334M 12.5 0L 12.5 49.652778',
|
|
142
|
+
'FlowChartExtract': 'M0,35 L30,0 L60,35 Z',
|
|
143
|
+
'FlowChartManualOperation': 'M46.4,28.8 L14.8,28.8 L0,0 L60,0 Z',
|
|
144
|
+
'FlowChartMagneticDisk': 'M 1024 1690 q -128 0 -242 -13 q -115 -12 -211 -34 q -97 -22 -174 -52 q -78 -30 -131 -64 q -54 -34 -83 -71 q -29 -37 -29 -74 v -716 q 0 -36 29 -74 q 29 -37 83 -71 q 53 -34 131 -64 q 77 -30 174 -52 q 96 -22 211 -35 q 114 -12 242 -12 q 128 0 243 12 q 114 13 211 35 q 96 22 174 52 q 77 30 131 64 q 53 34 82 71 q 29 38 29 74 v 716 q 0 37 -29 74 q -29 37 -82 71 q -54 34 -131 64 q -78 30 -174 52 q -97 22 -211 34 q -115 13 -243 13 Z',
|
|
145
|
+
'FlowChartConnector': 'M 973 1792 q -113 0 -217 -30 q -105 -29 -196 -82 q -91 -53 -166 -128 q -75 -75 -128 -166 q -53 -91 -82 -196 q -30 -104 -30 -217 q 0 -113 30 -218 q 29 -104 82 -195 q 53 -91 128 -166 q 75 -75 166 -128 q 91 -53 196 -83 q 104 -29 217 -29 q 113 0 218 29 q 104 30 195 83 q 91 53 166 128 q 75 75 128 166 q 53 91 83 195 q 29 105 29 218 q 0 113 -29 217 q -30 105 -83 196 q -53 91 -128 166 q -75 75 -166 128 q -91 53 -195 82 q -105 30 -218 30 Z',
|
|
146
|
+
'FlowChartOffPageConnector': 'M 358 1407 v -1253 h 1332 v 1253 l -666 476 Z',
|
|
147
|
+
'FlowChartDirectAccessStorage': 'M 358 1024 q 0 -128 13 -243 q 12 -114 34 -211 q 22 -96 52 -174 q 30 -77 64 -131 q 34 -53 71 -82 q 37 -29 74 -29 h 716 q 36 0 74 29 q 37 29 71 82 q 34 54 64 131 q 30 78 52 174 q 22 97 35 211 q 12 115 12 243 q 0 128 -12 242 q -13 115 -35 211 q -22 97 -52 174 q -30 78 -64 131 q -34 54 -71 83 q -38 29 -74 29 h -716 q -37 0 -74 -29 q -37 -29 -71 -83 q -34 -53 -64 -131 q -30 -77 -52 -174 q -22 -96 -34 -211 q -13 -114 -13 -242 Z',
|
|
148
|
+
'FlowChartMerge': 'M60,0 L30,35 L0,0 Z',
|
|
149
|
+
'OffPageReference': 'M60,33.3 L30.1,39 L0,33.3 L0,0 L60,0 Z',
|
|
150
|
+
'FlowChartSequentialAccessStorage': 'M 60 30 C 60 13.4 46.6 0 30 0 S 0 13.4 0 30 s 13.4 30 30 30 h 28.6 v -6.5 h -9.9' +
|
|
151
|
+
'C 55.5 48 60 39.5 60 30 Z',
|
|
152
|
+
'Annotation': 'M49.9984,50.0029 L-0.00271199,50.0029 L-0.00271199,0.00286865 L49.9984,0.00286865',
|
|
153
|
+
'Annotation2': 'M49.9977,50.0029 L25.416,50.0029 L25.416,0.00286865 L49.9977,0.00286865 M25.4166,25.0029 L-0.00227869,25.0029',
|
|
154
|
+
'FlowChartData': 'M 10 0 L 40 0 L 30 40 L 0 40 Z',
|
|
155
|
+
'FlowChartCard': 'M275,60 L400,60 L400,110 L260,110 L260,75 Z',
|
|
156
|
+
'FlowChartDelay': 'M0,0 L12.029,0 C14.212999,0 16,1.7869979 16,3.9709952 C16,6.1549926 14.212999,7.9409904 12.029,7.9409904 L0,7.9409904 z',
|
|
157
|
+
'FlowChartPreparation': 'M 1048.17 572 C 1051.06 568.86 1055.17 567.05 1059.5 567 L 1094.51 567'
|
|
158
|
+
+ ' C 1098.84 567.05 1102.95 568.86 1105.84 572' +
|
|
159
|
+
' L 1126.43 595 C 1127.01 596.28 1127.01 597.72 1126.43 599 L 1105.84 622 C 1102.95 625.14 1098.84 626.95 1094.51 627' +
|
|
160
|
+
' L 1059.5 627 C 1055.17 626.95 1051.06 625.14 1048.17 622 L 1027.58 599 C 1027 597.72 1027 596.28 1027.58 595 L 1048.17 572 Z',
|
|
161
|
+
'FlowChartDisplay': 'M47.8809,19.2914 L32.7968,-0.00594145 L11.3902,-0.00594145 C7.93166,-0.00594145 0.00124586,11.187 0.00124586,24.9968' +
|
|
162
|
+
'C0.00124586,38.8032 7.93166,49.9962 11.3902,49.9962 L32.7968,49.99 L47.615,31.038 C47.615,31.0388 52.798,24.9968 47.880,19.2914 z',
|
|
163
|
+
'FlowChartManualInput': 'M 912 732 L 1006.85 707 C 1008.2 707 1009.5 707.53 1010.46 708.46 C 1011.41 709.4 1011.95 710.67 1011.95 712' +
|
|
164
|
+
' L 1011.95 762C 1012 764.41 1010.28 766.52 1007.87 767 L 917.1 767 C 915.75 767 914.45 766.47 913.49 765.54' +
|
|
165
|
+
' C 912.54 764.6 912 763.33 912 762 L 912 732 Z',
|
|
166
|
+
'LoopLimit': 'M 8 9 L 27 9 L 33 15 L 33 26 C 33 27 33 27 32 27 L 4 27 C 3 27 2 27 2 26 L 2 15 L 8 9 Z',
|
|
167
|
+
'FlowChartStoredData': 'M 5.55 0L 50 0A 1.5,30 0 0,1 50,0A 5.555,25 0 0,0 50,50A 1.5,30 0 0,1 50,50L 5.555 50A 5.55,25 0 0,1 5.555,0Z',
|
|
168
|
+
//<---------------- Block Arrow Shapes ---------------->
|
|
169
|
+
'RightArrow': 'M 1178 1382 h -1024 v -716 h 1024 v -338 l 695 696 l -695 696 z',
|
|
170
|
+
'LeftArrow': 'M 870 666 h 1024 v 716 h -1024 v 338 l -695 -696 l 695 -696 z',
|
|
171
|
+
'UpArrow': 'M 1382 870 v 1024 h -716 v -1024 h -338 l 696 -695 l 696 695 z',
|
|
172
|
+
'DownArrow': 'M 666 1178 v -1024 h 716 v 1024 h 338 l -696 695 l -696 -695 z',
|
|
173
|
+
'LeftRightArrow': 'M 1382 1280 h -716 v 235 l -491 -491 l 491 -491 v 235 h 716 v -235 l 491 491 l -491 491 z',
|
|
174
|
+
'UpDownArrow': 'M 768 1382 v -716 h -235 l 491 -491 l 491 491 h -235 v 716 h 235 l -491 491 l -491 -491 z',
|
|
175
|
+
'QuadArrow': 'M 738 1587 h 132 v -409 h -409 v 132 l -286 -286 l 286 -286 v 132 h 409 v -409 h -132 l 286 -286 l 286 286 h -132 v 409 h 409 v -132 l 286 286 l -286 286 v -132 h -409 v 409 h 132 l -286 286 z',
|
|
176
|
+
'LeftRightUpArrow': 'M 461 1485 v 132 l -286 -286 l 286 -286 v 133 h 409 v -615 h -132 l 286 -286 l 286 286 h -132 v 615 h 409 v -133 l 286 286 l -286 286 v -132 z',
|
|
177
|
+
'BentArrow': 'M 154 1894 v -1126 q 0 -63 24 -119 q 24 -56 66 -98 q 41 -42 97 -66 q 56 -24 120 -24 h 1024 v -235 l 388 388 l -388 389 v -235 h -768 q -53 0 -99 20 q -47 20 -82 55 q -35 35 -55 81 q -20 47 -20 100 v 870 z',
|
|
178
|
+
'UTurnArrow': 'M 154 1894 v -1075 q 0 -92 24 -177 q 24 -85 67 -159 q 43 -73 104 -134 q 61 -61 135 -104 q 73 -43 158 -67 q 85 -24 177 -24 h 103 q 92 0 177 24 q 85 24 159 67 q 73 43 134 104 q 61 61 104 134 q 43 74 67 159 q 24 85 24 177 v 359 h 235 l -388 388 l -389 -388 h 235 v -359 q 0 -74 -28 -139 q -28 -65 -77 -114 q -49 -49 -114 -77 q -65 -28 -139 -28 h -103 q -74 0 -139 28 q -65 28 -114 77 q -49 49 -77 114 q -28 65 -28 139 v 1075 z',
|
|
179
|
+
'LeftUpArrow': 'M 175 1434 l 388 -389 v 235 h 717 v -717 h -235 l 389 -388 l 388 388 h -235 v 1024 h -1024 v 235 z',
|
|
180
|
+
'BentUpArrow': 'M 154 1894 v -307 h 1126 v -1024 h -235 l 389 -388 l 388 388 h -235 v 1331 z',
|
|
181
|
+
'CurvedRightArrow': 'M 1280 1587 h -205 q -99 0 -190 -26 q -92 -25 -171 -72 q -80 -47 -145 -112 q -66 -65 -113 -145 q -47 -80 -72 -172 q -26 -91 -26 -190 q 0 -99 26 -191 q 25 -91 72 -171 q 47 -79 113 -145 q 65 -65 145 -112 q 79 -46 171 -72 q 91 -25 190 -25 h 205 v 307 h -205 q -108 0 -208 31 q -101 31 -187 88 q -87 57 -155 137 q -68 81 -110 180 l -10 25 l 14 23 q 50 79 116 141 q 66 62 144 105 q 78 43 166 66 q 87 23 179 23 h 256 v -235 l 388 389 l -388 388 z',
|
|
182
|
+
'CurvedLeftArrow': 'M 768 1822 l -388 -388 l 388 -389 v 235 h 256 q 92 0 180 -23 q 87 -23 165 -66 q 78 -43 144 -105 q 66 -62 116 -141 l 14 -23 l -10 -25 q -42 -99 -110 -180 q -68 -80 -154 -137 q -87 -57 -187 -88 q -101 -31 -209 -31 h -205 v -307 h 205 q 99 0 191 25 q 91 26 171 72 q 79 47 145 112 q 65 66 112 145 q 47 80 73 171 q 25 92 25 191 q 0 99 -25 190 q -26 92 -73 172 q -47 80 -112 145 q -66 65 -145 112 q -80 47 -171 72 q -92 26 -191 26 h -205 z',
|
|
183
|
+
'CurvedUpArrow': 'M 1587 768 v 205 q 0 99 -25 190 q -26 92 -73 171 q -47 80 -112 145 q -65 66 -145 113 q -80 47 -171 72 q -92 26 -191 26 q -99 0 -190 -26 q -92 -25 -171 -72 q -80 -47 -145 -113 q -66 -65 -112 -145 q -47 -79 -72 -171 q -26 -91 -26 -190 v -205 h 307 v 205 q 0 108 31 208 q 31 101 88 187 q 57 87 138 155 q 80 68 179 110 l 25 10 l 23 -14 q 79 -50 141 -116 q 62 -66 105 -144 q 43 -78 66 -166 q 23 -87 23 -179 v -256 h -235 l 389 -388 l 388 388 z',
|
|
184
|
+
'CurvedDownArrow': 'M 1822 1280 l -388 388 l -389 -388 h 235 v -256 q 0 -92 -23 -180 q -23 -87 -66 -165 q -43 -78 -105 -144 q -62 -66 -141 -116 l -23 -14 l -25 10 q -99 42 -179 110 q -81 68 -138 154 q -57 87 -88 187 q -31 101 -31 209 v 205 h -307 v -205 q 0 -99 26 -191 q 25 -91 72 -171 q 46 -79 112 -145 q 65 -65 145 -112 q 79 -47 171 -73 q 91 -25 190 -25 q 99 0 191 25 q 91 26 171 73 q 80 47 145 112 q 65 66 112 145 q 47 80 73 171 q 25 92 25 191 v 205 z',
|
|
185
|
+
'StripedRightArrow': 'M 102 614 h 103 v 820 h -103 m 205 -820 h 103 v 820 h -103 m 819 409 v -409 h -614 v -820 h 614 v -409 l 820 819 m -717 307 v 265 l 572 -572 l -572 -572 v 265 h -615 v 614 z',
|
|
186
|
+
'NotchedRightArrow': 'M 1126 1843 v -409 h -1024 l 512 -410 l -512 -410 h 1024 v -409 l 820 819 m -717 307 v 265 l 572 -572 l -572 -572 v 265 h -835 l 384 307 l -384 307 z',
|
|
187
|
+
'Pentagon': 'M 154 1690 v -1434 h 1002 l 717 717 l -717 717 z',
|
|
188
|
+
'Chevron': 'M 226 1690 l 717 -717 l -717 -717 h 930 l 717 717 l -717 717 z',
|
|
189
|
+
'RightArrowCallout': 'M 154 154 h 1024 v 716 h 307 v -234 l 388 388 l -388 388 v -234 h -307 v 716 h -1024 z',
|
|
190
|
+
'DownArrowCallout': 'M 154 154 h 1740 v 1024 h -716 v 307 h 234 l -388 388 l -388 -388 h 234 v -307 h -716 z',
|
|
191
|
+
'LeftArrowCallout': 'M 1894 154 v 1740 h -1024 v -716 h -307 v 234 l -388 -388 l 388 -388 v 234 h 307 v -716 z',
|
|
192
|
+
'UpArrowCallout': 'M 1894 1894 h -1740 v -1024 h 716 v -307 h -234 l 388 -388 l 388 388 h -234 v 307 h 716 z',
|
|
193
|
+
'LeftRightArrowCallout': 'M 666 1894 v -716 h -205 v 132 l -286 -286 l 286 -286 v 132 h 205 v -716 h 716 v 716 h 205 v -132 l 286 286 l -286 286 v -132 h -205 v 716 z',
|
|
194
|
+
'QuadArrowCallout': 'M 738 1587 h 132 v -205 h -204 v -204 h -205 v 132 l -286 -286 l 286 -286 v 132 h 205 v -204 h 204 v -205 h -132 l 286 -286 l 286 286 h -132 v 205 h 204 v 204 h 205 v -132 l 286 286 l -286 286 v -132 h -205 v 204 h -204 v 205 h 132 l -286 286 z',
|
|
195
|
+
'CircularArrow': 'M 1045 1382 h 235 v -460 q 0 -74 -28 -140 q -28 -65 -77 -114 q -49 -48 -114 -77 q -65 -28 -139 -28 h -103 q -74 0 -139 28 q -65 29 -114 77 q -49 49 -77 114 q -28 66 -28 140 v 665 h -307 v -665 q 0 -92 24 -177 q 24 -85 67 -159 q 43 -74 104 -135 q 61 -60 135 -104 q 73 -43 158 -67 q 85 -24 177 -24 h 103 q 92 0 177 24 q 85 24 159 67 q 73 44 134 104 q 61 61 104 135 q 43 74 67 159 q 24 85 24 177 v 460 h 235 l -388 389 z',
|
|
196
|
+
//<---------------- Stars and banners ---------------->
|
|
197
|
+
'Explosion1': 'M 833 1509 l -270 225 v -352 h -282 l 309 -193 l -374 -421 h 450 v -337 l 260 260 l 354 -443 v 418 h 361 l -226 317 l 381 297 h -394 l 228 457 l -479 -218 l -134 312 z',
|
|
198
|
+
'Explosion2': 'M 591 1480 l -324 -1 l 208 -249 l -270 -360 h 492 l -135 -270 l 247 82 l 39 -239 l 187 281 l 168 -418 l 35 281 l 417 -186 l -135 408 l 253 42 l -215 172 l 246 206 h -300 l 174 346 l -347 -173 v 353 l -305 -175 l -416 270 z',
|
|
199
|
+
'Star4Point': 'M 848 1200 l -572 -176 l 572 -176 l 176 -572 l 176 572 l 572 176 l -572 176 l -176 572 z',
|
|
200
|
+
'Star5Point': 'M 1219 768 h 603 l -446 446 l 175 612 l -527 -352 l -527 352 l 175 -612 l -446 -446 h 598 l 202 -521 z',
|
|
201
|
+
'Star6Point': 'M 786 1485 h -580 l 350 -461 l -350 -461 h 580 l 238 -367 l 238 367 h 580 l -350 461 l 350 461 h -580 l -238 367 z',
|
|
202
|
+
'Star7Point': 'M 1024 1541 l -395 307 l -42 -422 l -396 -176 l 314 -314 l -207 -373 h 461 l 265 -372 l 265 372 h 461 l -207 373 l 314 314 l -396 176 l -42 422 z',
|
|
203
|
+
'Star8Point': 'M 738 1587 h -277 v -277 l -286 -286 l 286 -286 v -277 h 282 l 281 -286 l 286 286 h 277 v 277 l 286 286 l -286 286 v 277 h -277 l -286 286 z',
|
|
204
|
+
'Star10Point': 'M 828 1635 l -367 48 v -286 l -277 -93 l 198 -280 l -198 -280 l 277 -93 v -286 l 367 48 l 196 -231 l 196 231 l 370 -48 v 286 l 274 92 l -198 281 l 198 280 l -277 93 v 286 l -367 -48 l -196 231 z',
|
|
205
|
+
'Star12Point': 'M 868 1611 l -305 231 v -357 h -357 l 231 -305 l -241 -156 l 241 -156 l -231 -305 h 357 v -357 l 305 231 l 156 -241 l 156 241 l 305 -231 v 357 h 357 l -231 305 l 241 156 l -241 156 l 231 305 h -357 v 357 l -305 -231 l -156 241 z',
|
|
206
|
+
'Star16Point': 'M-51.20001220703125,0L-37.66234497940063,-6.9061855534744225L-47.302667277832036,-18.06249483215332L-31.9284556123352,-19.667176728401184L-36.204040631713866,-33.375589842071534L-21.333893086395264,-29.434036096916195L-19.593220671386717,-43.60713318054199L-7.491457786102288,-34.71996375514984L0,-47.19999694824219L7.491457786102288,-34.71996375514984L19.593220671386717,-43.60713318054199L21.33389308639528,-29.434036096916195L36.20404063171388,-33.375589842071534L31.928455612335213,-19.667176728401184L47.30266727783204,-18.06249483215332L37.66234497940066,-6.9061855534744225L51.20001220703125,0L37.66234497940066,6.9061855534744225L47.30266727783204,18.06249483215332L31.928455612335213,19.667176728401188L36.20404063171388,33.37558984207155L21.33389308639528,29.434036096916202L19.593220671386717,43.60713318054199L7.491457786102288,34.71996375514985L0,47.19999694824219L-7.491457786102288,34.71996375514985L-19.593220671386717,43.60713318054199L-21.333893086395264,29.434036096916202L-36.204040631713866,33.37558984207155L-31.9284556123352,19.667176728401188L-47.302667277832036,18.06249483215332L-37.66234497940063,6.9061855534744225Z',
|
|
207
|
+
'Star24Point': 'M-51.20001220703125,0L-38.071305076904295,-4.620761701240539L-49.45541409708704,-12.216258138985935L-35.47700045837402,-13.546871124114986L-44.34051124536243,-23.599998474121094L-30.464647263336182,-21.55010260665893L-36.20387582842581,-33.3754379140864L-23.37638957336425,-28.084588184165955L-25.600006103515625,-40.87639641572571L-14.694915503540031,-32.70534988540649L-13.251538268661228,-45.59169605307234L-5.012353195037839,-35.096973730773925L0,-47.19999694824219L5.012353195037846,-35.096973730773925L13.251538268661236,-45.59169605307234L14.694915503540045,-32.70534988540649L25.600006103515625,-40.87639641572571L23.37638957336425,-28.084588184165955L36.20387582842582,-33.3754379140864L30.464647263336204,-21.55010260665893L44.340511245362435,-23.599998474121094L35.47700045837402,-13.546871124114986L49.45541409708704,-12.216258138985935L38.07130507690431,-4.620761701240539L51.20001220703125,0L38.07130507690431,4.620761701240539L49.45541409708704,12.216258138985935L35.47700045837402,13.546871124114993L44.340511245362435,23.599998474121094L30.464647263336204,21.550102606658925L36.20387582842582,33.375437914086405L23.37638957336425,28.084588184165966L25.600006103515625,40.87639641572571L14.694915503540045,32.70534988540649L13.251538268661236,45.59169605307234L5.012353195037846,35.096973730773925L0,47.19999694824219L-5.012353195037839,35.096973730773925L-13.251538268661228,45.59169605307234L-14.694915503540031,32.70534988540649L-25.600006103515625,40.87639641572571L-23.37638957336425,28.084588184165966L-36.20387582842581,33.375437914086405L-30.464647263336182,21.550102606658925L-44.34051124536243,23.599998474121094L-35.47700045837402,13.546871124114993L-49.45541409708704,12.216258138985935L-38.071305076904295,4.620761701240539Z',
|
|
208
|
+
'Star32Point': 'M-54,0L-40.30479,-3.52872L-52.96266,-9.36432L-38.75607,-10.45008L-49.889520000000005,-18.368640000000003L-35.71776,-16.9704L-44.89938,-26.667360000000002L-31.306905,-22.838040000000007L-38.18376618407357,-33.94112549695428L-25.692795000000004,-27.828360000000004L-30.00078,-39.910560000000004L-19.091700000000003,-31.749120000000005L-20.664719999999996,-44.34624L-11.756339999999994,-34.44984L-10.534859999999995,-47.077920000000006L-3.9698099999999954,-35.82648L0,-48L3.9698100000000025,-35.82648L10.534860000000009,-47.077920000000006L11.756340000000009,-34.44984L20.664720000000003,-44.34624L19.091700000000003,-31.749120000000005L30.000780000000006,-39.910560000000004L25.692795000000004,-27.828360000000004L38.183766184073576,-33.94112549695428L31.306905000000015,-22.838040000000007L44.89938000000001,-26.667360000000002L35.71776000000001,-16.9704L49.889520000000005,-18.368640000000003L38.75607000000001,-10.45008L52.962660000000014,-9.36432L40.30479000000001,-3.52872L54,0L40.30479000000001,3.52872L52.962660000000014,9.36432L38.75607000000001,10.45008L49.889520000000005,18.36864L35.71776000000001,16.970399999999998L44.89938000000001,26.667359999999988L31.306905000000015,22.838039999999992L38.183766184073576,33.941125496954285L25.692795000000004,27.828360000000004L30.000780000000006,39.91055999999999L19.091700000000003,31.749120000000005L20.664720000000003,44.346239999999995L11.756340000000009,34.449839999999995L10.534860000000009,47.077920000000006L3.9698100000000025,35.826480000000004L0,48L-3.9698099999999954,35.826480000000004L-10.534859999999995,47.077920000000006L-11.756339999999994,34.449839999999995L-20.664719999999996,44.346239999999995L-19.091700000000003,31.749120000000005L-30.00078,39.91055999999999L-25.692795000000004,27.828360000000004L-38.18376618407357,33.941125496954285L-31.306905,22.838039999999992L-44.89938,26.667359999999988L-35.71776,16.970399999999998L-49.889520000000005,18.36864L-38.75607,10.45008L-52.96266,9.36432L-40.30479,3.52872Z',
|
|
209
|
+
'UpRibbon': 'M 1741 1075 l 205 461 h -717 v -205 h -410 v 205 h -717 l 205 -461 l -205 -461 h 410 v -204 h 1024 v 204 h 410 m -512 615 v -717 h -820 v 717 m -102 -512 h -252 l 159 358 l -159 359 h 252 m 1117 -359 l 159 -358 h -252 v 717 h 252 m -1071 -103 h -103 v 103 h 103 m 717 0 v -103 h -103 v 103 z',
|
|
210
|
+
'DownRibbon': 'M 1946 410 l -205 460 l 205 461 h -410 v 205 h -1024 v -205 h -410 l 205 -461 l -205 -460 h 717 v 204 h 410 v -204 m -615 307 v 717 h 820 v -717 m 102 512 h 252 l -159 -359 l 159 -358 h -252 m -1117 358 l -159 359 h 252 v -717 h -252 m 1174 0 h -103 v 102 h 103 m -820 -102 v 102 h 103 v -102 z',
|
|
211
|
+
'CurvedUpRibbon': 'M 1741 1075 l 205 666 q -62 -57 -130 -102 q -29 -19 -62 -38 q -34 -18 -70 -33 q -36 -14 -73 -23 q -38 -9 -75 -9 h -307 v -256 q 0 -10 -16 -20 q -16 -9 -44 -16 q -28 -7 -65 -11 q -38 -4 -80 -4 q -42 0 -79 4 q -38 4 -66 11 q -28 7 -44 16 q -16 10 -16 20 v 256 h -307 q -38 0 -75 9 q -38 9 -74 23 q -36 15 -69 33 q -33 19 -62 38 q -69 45 -130 102 l 205 -666 l -205 -461 q 60 -75 122 -117 q 62 -41 119 -62 q 56 -20 104 -25 q 47 -4 78 -4 q 19 -43 65 -80 q 45 -37 111 -64 q 66 -27 149 -42 q 82 -15 174 -15 q 92 0 175 15 q 82 15 148 42 q 66 27 112 64 q 45 37 64 80 q 31 0 79 4 q 47 5 104 25 q 56 21 118 62 q 62 42 122 117 m -1659 876 q 116 -56 225 -56 v -926 l -8 -1 q -21 0 -51 4 q -30 4 -65 16 q -35 12 -73 34 q -39 22 -78 58 l 184 456 m 296 256 h -103 v 103 h 103 m 307 -308 q 72 0 124 8 q 52 9 87 23 q 35 15 55 33 q 20 19 30 39 h 114 v -773 l -4 -9 q -9 -21 -41 -46 q -32 -24 -83 -45 q -52 -21 -123 -35 q -71 -14 -159 -14 q -88 0 -159 14 q -71 14 -123 35 q -52 21 -83 45 q -32 25 -41 46 l -4 9 v 773 h 114 q 10 -20 30 -39 q 20 -18 55 -33 q 35 -14 87 -23 q 52 -8 124 -8 m 410 308 v -103 h -103 v 103 m 296 -380 l 184 -435 q -39 -36 -77 -58 q -39 -22 -74 -34 q -35 -12 -64 -16 q -30 -4 -51 -4 h -9 v 927 q 109 0 225 56 z',
|
|
212
|
+
'CurvedDownRibbon': 'M 307 870 l -205 -665 q 61 58 130 103 q 29 19 62 37 q 33 19 69 33 q 36 14 74 23 q 37 9 75 9 h 307 v 256 q 0 11 16 20 q 16 9 44 16 q 28 7 66 11 q 37 4 79 4 q 42 0 80 -4 q 37 -4 65 -11 q 28 -7 44 -16 q 16 -9 16 -20 v -256 h 307 q 37 0 75 -9 q 37 -9 73 -23 q 36 -14 70 -33 q 33 -18 62 -37 q 68 -45 130 -103 l -205 665 l 205 461 q -55 69 -112 110 q -57 41 -110 63 q -54 23 -100 30 q -47 7 -80 7 q -6 0 -11 -1 q -5 0 -10 0 q -19 43 -64 80 q -46 37 -112 64 q -66 27 -148 42 q -83 15 -175 15 q -92 0 -174 -15 q -83 -15 -149 -42 q -66 -27 -111 -64 q -46 -37 -65 -80 q -5 0 -10 0 q -6 1 -11 1 q -33 0 -79 -7 q -47 -7 -100 -30 q -54 -22 -111 -63 q -57 -41 -112 -110 m 1659 -875 q -120 56 -225 56 v 926 h 8 q 21 0 51 -4 q 30 -4 65 -16 q 35 -12 74 -34 q 38 -22 77 -58 l -184 -456 m -296 -256 h 103 v -102 h -103 m -307 307 q -72 0 -124 -9 q -52 -8 -87 -22 q -35 -14 -55 -33 q -20 -18 -30 -38 h -114 v 773 l 4 9 q 9 21 41 45 q 31 25 83 45 q 52 21 123 35 q 71 14 159 14 q 88 0 159 -14 q 71 -14 123 -35 q 51 -20 83 -45 q 32 -24 41 -45 l 4 -9 v -773 h -114 q -10 20 -30 38 q -20 19 -55 33 q -35 14 -87 22 q -52 9 -124 9 m -410 -307 v 102 h 103 v -102 m -296 380 l -184 434 q 39 36 78 58 q 38 22 73 34 q 35 12 65 16 q 29 4 50 4 h 9 v -926 q -105 0 -225 -56 z',
|
|
213
|
+
'VerticalScroll': 'M 1690 102 q 53 0 100 20 q 46 20 81 55 q 35 35 55 81 q 20 47 20 100 q 0 53 -20 100 q -20 47 -55 81 q -35 35 -81 55 q -47 20 -100 20 h -52 v 1178 q 0 32 -12 60 q -12 28 -32 49 q -21 21 -49 33 q -28 12 -60 12 h -1178 q -42 0 -79 -17 q -38 -16 -65 -44 q -28 -27 -44 -65 q -17 -37 -17 -79 q 0 -42 17 -80 q 16 -37 44 -65 q 27 -28 65 -44 q 37 -16 79 -16 h 103 v -1280 q 0 -32 12 -60 q 12 -28 33 -49 q 20 -21 48 -33 q 28 -12 60 -12 m 51 308 q 0 -41 16 -78 q 15 -36 42 -64 q 26 -28 62 -45 q 35 -16 76 -18 h -247 q -21 0 -36 15 q -15 15 -15 36 v 1587 h 973 q 21 0 36 -15 q 15 -15 15 -36 v -1178 h -717 q -42 0 -79 -16 q -38 -16 -66 -44 q -28 -27 -44 -65 q -16 -37 -16 -79 m 1076 102 q 31 0 59 -12 q 28 -12 49 -33 q 21 -21 33 -49 q 12 -28 12 -60 q 0 -31 -12 -59 q -12 -28 -33 -49 q -21 -21 -49 -33 q -28 -12 -59 -12 h -863 q 41 2 77 18 q 36 17 63 45 q 26 28 42 64 q 15 37 15 78 q 0 28 -7 53 q -7 26 -20 49 m -587 1126 h -103 q -21 0 -39 8 q -19 8 -33 22 q -14 14 -22 33 q -8 19 -8 40 q 0 21 8 39 q 8 19 22 33 q 14 14 33 22 q 18 8 39 8 h 103 m 409 -1331 q 21 0 40 -8 q 19 -8 33 -22 q 14 -14 22 -33 q 8 -18 8 -39 q 0 -21 -8 -40 q -8 -19 -22 -33 q -14 -14 -33 -22 q -19 -8 -40 -8 q -21 0 -39 8 q -19 8 -33 22 q -14 14 -22 33 q -8 19 -8 40 q 0 21 8 39 q 8 19 22 33 q 14 14 33 22 q 18 8 39 8 z',
|
|
214
|
+
'HorizontalScroll': 'M 1741 102 q 42 0 80 16 q 37 17 65 44 q 27 28 44 65 q 16 38 16 80 v 1178 q 0 32 -12 60 q -12 28 -33 48 q -21 21 -49 33 q -28 12 -60 12 h -1178 v 52 q 0 53 -20 99 q -20 47 -54 82 q -35 35 -82 55 q -47 20 -100 20 q -53 0 -99 -20 q -47 -20 -82 -55 q -35 -35 -55 -82 q -20 -46 -20 -99 v -1127 q 0 -32 12 -60 q 12 -28 33 -49 q 21 -20 49 -32 q 28 -12 60 -12 h 1280 v -103 q 0 -42 16 -80 q 16 -37 44 -65 q 28 -27 66 -44 q 37 -16 79 -16 m 102 410 h -1587 q -21 0 -36 15 q -15 15 -15 36 v 248 q 1 -41 18 -77 q 17 -36 45 -63 q 27 -26 64 -42 q 37 -15 78 -15 q 42 0 80 16 q 37 16 65 44 q 27 28 43 65 q 16 38 16 80 v 717 h 1178 q 21 0 36 -15 q 15 -15 15 -36 m -1433 -461 q -41 0 -78 -16 q -37 -15 -64 -42 q -28 -26 -45 -62 q -17 -35 -18 -76 v 862 q 0 32 12 59 q 12 28 33 49 q 21 21 49 33 q 27 12 59 12 q 32 0 60 -12 q 28 -12 49 -33 q 21 -21 33 -49 q 12 -27 12 -59 v -693 q -23 13 -48 20 q -26 7 -54 7 m 1433 -717 q 0 -21 -8 -40 q -8 -18 -22 -32 q -14 -14 -32 -22 q -19 -8 -40 -8 q -21 0 -40 8 q -19 8 -33 22 q -14 14 -22 32 q -8 19 -8 40 v 103 h 205 m -1331 409 q 0 -21 -8 -40 q -8 -18 -22 -32 q -14 -14 -32 -22 q -19 -8 -40 -8 q -21 0 -40 8 q -19 8 -33 22 q -14 14 -22 32 q -8 19 -8 40 q 0 21 8 40 q 8 19 22 33 q 14 14 33 22 q 19 8 40 8 q 21 0 40 -8 q 18 -8 32 -22 q 14 -14 22 -33 q 8 -19 8 -40 z',
|
|
215
|
+
'Wave': 'M 1383 1894 q -42 0 -84 -8 q -43 -7 -77 -16 q -34 -9 -55 -17 q -22 -7 -23 -7 q -8 -5 -26 -17 q -18 -11 -39 -25 q -21 -13 -41 -27 q -20 -13 -32 -24 l -38 -33 q -40 -35 -89 -76 q -49 -41 -106 -77 q -58 -35 -123 -59 q -66 -23 -138 -23 q -68 0 -122 10 q -55 10 -99 27 q -44 17 -78 39 q -34 23 -59 47 v -1275 q 24 -16 77 -47 q 52 -30 126 -59 q 73 -29 165 -51 q 91 -22 195 -22 q 72 0 130 17 q 57 18 104 47 q 46 29 85 65 q 38 37 74 75 q 35 39 70 75 q 34 37 72 66 q 38 29 83 46 q 44 18 99 18 q 78 0 147 -24 q 69 -23 127 -59 q 57 -36 104 -80 q 47 -44 82 -85 v 1356 q -16 18 -57 55 q -41 38 -105 75 q -64 37 -149 65 q -86 28 -191 28 z',
|
|
216
|
+
'DoubleWave': 'M 1690 1894 q -58 0 -100 -19 q -42 -19 -75 -48 q -33 -28 -62 -61 q -29 -33 -61 -62 q -32 -28 -71 -47 q -39 -19 -92 -19 q -51 0 -92 19 q -42 19 -77 47 q -35 29 -65 62 q -30 33 -59 61 q -29 29 -57 48 q -29 19 -60 19 q -35 0 -73 -19 q -39 -19 -79 -48 q -40 -28 -80 -61 q -40 -33 -79 -62 q -40 -28 -78 -47 q -38 -19 -72 -19 q -26 0 -52 10 q -27 11 -53 27 q -27 17 -52 38 q -25 22 -47 44 v -1480 q 19 -20 45 -42 q 26 -21 54 -39 q 27 -18 55 -30 q 27 -12 50 -12 q 24 0 55 19 q 31 19 67 47 q 36 29 77 62 q 41 33 84 61 q 43 29 88 48 q 45 19 90 19 q 48 0 87 -19 q 38 -19 71 -48 q 33 -28 63 -61 q 29 -33 59 -62 q 30 -28 62 -47 q 31 -19 68 -19 q 36 0 68 19 q 31 19 63 47 q 31 29 64 62 q 33 33 72 61 q 39 29 87 48 q 47 19 107 19 q 70 0 120 -17 q 50 -16 84 -40 v 1477 q -5 6 -17 17 q -12 11 -35 21 q -24 11 -61 18 q -37 8 -91 8 z',
|
|
217
|
+
//<---------------- Equation Shapes ---------------->
|
|
218
|
+
'MathPlus': 'M 1894 1280 h -614 v 614 h -512 v -614 h -614 v -512 h 614 v -614 h 512 v 614 h 614 z',
|
|
219
|
+
'MathMinus': 'M 154 768 h 1740 v 512 h -1740 z',
|
|
220
|
+
'MathMultiply': 'M 1409 1771 l -435 -435 l -434 435 l -362 -362 l 434 -435 l -434 -434 l 362 -362 l 434 434 l 435 -434 l 362 362 l -435 434 l 435 435 z',
|
|
221
|
+
'MathDivision': 'M 1024 1792 q -32 0 -60 -12 q -28 -12 -49 -33 q -21 -21 -33 -49 q -12 -28 -12 -60 q 0 -31 12 -59 q 12 -28 33 -49 q 21 -21 49 -33 q 28 -12 60 -12 q 32 0 60 12 q 28 12 49 33 q 21 21 33 49 q 12 28 12 59 q 0 32 -12 60 q -12 28 -33 49 q -21 21 -49 33 q -28 12 -60 12 m 0 -1229 q -32 0 -60 -12 q -28 -12 -49 -33 q -21 -21 -33 -49 q -12 -27 -12 -59 q 0 -32 12 -60 q 12 -28 33 -49 q 21 -21 49 -33 q 28 -12 60 -12 q 32 0 60 12 q 28 12 49 33 q 21 21 33 49 q 12 28 12 60 q 0 32 -12 59 q -12 28 -33 49 q -21 21 -49 33 q -28 12 -60 12 m -870 205 h 1740 v 512 h -1740 z',
|
|
222
|
+
'MathEqual': 'M 154 358 h 1740 v 512 h -1740 m 0 205 h 1740 v 512 h -1740 z',
|
|
223
|
+
'MathNotEqual': 'M 1372 870 l -136 205 h 658 v 512 h -1000 l -205 307 h -389 l 205 -307 h -351 v -512 h 693 l 136 -205 h -829 v -512 h 1170 l 137 -204 h 389 l -137 204 h 181 v 512 z',
|
|
224
|
+
//<---------------- Rectangle Shapes ---------------->
|
|
225
|
+
'RoundedRectangle': 'M 20,0 h 160 a 20,20 0 0 1 20,20 v 60 a 20,20 0 0 1 -20,20 h -160 a 20,20 0 0 1 -20,-20 v -60 a 20,20 0 0 1 20,-20 z',
|
|
226
|
+
'SnipSingleCornerRectangle': 'M 154 1690 v -1332 h 1258 l 482 482 v 850 z',
|
|
227
|
+
'SnipSameSideCornerRectangle': 'M 154 1690 v -850 l 482 -482 h 776 l 482 482 v 850 z',
|
|
228
|
+
'SnipDiagonalCornerRectangle': 'M 636 1690 l -482 -482 v -850 h 1258 l 482 482 v 850 z',
|
|
229
|
+
'SnipAndRoundSingleCornerRectangle': 'M 154 1690 v -1029 q 0 -63 24 -118 q 24 -55 65 -96 q 41 -41 96 -65 q 55 -24 117 -24 h 956 l 482 482 v 850 z',
|
|
230
|
+
'RoundSingleCornerRectangle': 'M 154 1690 v -1332 h 1438 q 62 0 117 24 q 55 24 96 65 q 41 41 65 96 q 24 55 24 118 v 1029 z',
|
|
231
|
+
'RoundSameSideCornerRectangle': 'M 154 1690 v -1029 q 0 -63 24 -118 q 24 -55 65 -96 q 41 -41 96 -65 q 55 -24 117 -24 h 1136 q 62 0 117 24 q 55 24 96 65 q 41 41 65 96 q 24 55 24 118 v 1029 z',
|
|
232
|
+
'RoundDiagonalCornerRectangle': 'M 200 0 L 1800 0 L 1800 1300 A 200 200 0 0 1 1600 1500 L 0 1500 L 0 200 A 200 200 0 0 1 200 0 Z'
|
|
233
|
+
//<---------------- umlActivityShapes Shapes ---------------->
|
|
234
|
+
// // Action,
|
|
235
|
+
// 'Action': 'M 90 82.895 C 90 86.819 86.776 90 82.8 90 H 7.2 C 3.224 90 0 86.819 0 82.895' +
|
|
236
|
+
// ' V 7.105 C 0 3.181 3.224 0 7.2 0 h 75.6 C 86.776 0 90 3.181 90 7.105 V 82.895 Z',
|
|
237
|
+
// // umlDecision,
|
|
238
|
+
// 'umlDecision': 'M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z',
|
|
239
|
+
// // MergeNode,
|
|
240
|
+
// 'MergeNode': 'M10,19.707L0.293,10L10,0.293L19.707,10L10,19.707z',
|
|
241
|
+
// // InitialNode,
|
|
242
|
+
// 'InitialNode': 'M10,19.5c-5.238,0-9.5-4.262-9.5-9.5S4.762,0.5,10,0.5s9.5,4.262,9.5,9.5S15.238,19.5,10,19.5z',
|
|
243
|
+
// // ForkNode,
|
|
244
|
+
// 'ForkNode': 'm0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z',
|
|
245
|
+
// // JoinNode,
|
|
246
|
+
// 'JoinNode': 'm0.75,0.75l636.00002,0l0,290l-636.00002,0l0,-290z',
|
|
247
|
+
// // TimeEvent,
|
|
248
|
+
// 'TimeEvent': 'M50.001,0.00286865 L25.001,25.0029 L0.000976562,0.00286865 L50.001,0.00286865 z' +
|
|
249
|
+
// ' M0.000976562,50.0029 L25.001,25.0029 L50.001,50.0029 L0.000976562,50.0029 z',
|
|
250
|
+
// // AcceptingEvent,
|
|
251
|
+
// 'AcceptingEvent': 'M17.8336 32.164 L29.64 24 L17.32 16 L48.1664 16 L48.5 32 Z',
|
|
252
|
+
// // SendSignal,
|
|
253
|
+
// 'SendSignal': 'M48.164 31.8336 L56 23.832 L47.836 16 L16.168 16 L16.1668 31.8336 Z',
|
|
254
|
+
// // ReceiveSignal,
|
|
255
|
+
// 'ReceiveSignal': 'M48.1664 31.8336 L39.836 24 L47.836 16 L16.168 16 L16.168 31.836 Z',
|
|
256
|
+
// // StructuredNode,
|
|
257
|
+
// 'StructuredNode': 'M0,0 L50,0 L50,50 L0,50 z',
|
|
258
|
+
// // Note,
|
|
259
|
+
// 'Note': 'M20 12 L4 12 L4 22 L22 22 L22 14 L20 14 L20 12 L22 14 Z'
|
|
260
|
+
};
|
|
261
|
+
this.documentHelper = documentHelper;
|
|
262
|
+
}
|
|
263
|
+
Object.defineProperty(Renderer.prototype, "pageCanvas", {
|
|
264
|
+
get: function () {
|
|
265
|
+
if (this.isPrinting) {
|
|
266
|
+
if (isNullOrUndefined(this.pageCanvasIn)) {
|
|
267
|
+
this.pageCanvasIn = document.createElement('canvas');
|
|
268
|
+
this.pageCanvasIn.getContext('2d').save();
|
|
269
|
+
}
|
|
270
|
+
return this.pageCanvasIn;
|
|
271
|
+
}
|
|
272
|
+
if (this.isExporting) {
|
|
273
|
+
if (isNullOrUndefined(this.exportPageCanvas)) {
|
|
274
|
+
this.exportPageCanvas = new DocumentCanvasElement();
|
|
275
|
+
}
|
|
276
|
+
return this.exportPageCanvas;
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
return isNullOrUndefined(this.viewer) ? undefined : this.documentHelper.containerCanvas;
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
enumerable: true,
|
|
283
|
+
configurable: true
|
|
284
|
+
});
|
|
285
|
+
Object.defineProperty(Renderer.prototype, "selectionCanvas", {
|
|
286
|
+
get: function () {
|
|
287
|
+
return isNullOrUndefined(this.viewer) ? undefined : this.documentHelper.selectionCanvas;
|
|
288
|
+
},
|
|
289
|
+
enumerable: true,
|
|
290
|
+
configurable: true
|
|
291
|
+
});
|
|
292
|
+
Object.defineProperty(Renderer.prototype, "pageContext", {
|
|
293
|
+
get: function () {
|
|
294
|
+
return this.pageCanvas.getContext('2d');
|
|
295
|
+
},
|
|
296
|
+
enumerable: true,
|
|
297
|
+
configurable: true
|
|
298
|
+
});
|
|
299
|
+
Object.defineProperty(Renderer.prototype, "selectionContext", {
|
|
300
|
+
get: function () {
|
|
301
|
+
return this.selectionCanvas.getContext('2d');
|
|
302
|
+
},
|
|
303
|
+
enumerable: true,
|
|
304
|
+
configurable: true
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(Renderer.prototype, "viewer", {
|
|
307
|
+
get: function () {
|
|
308
|
+
return this.documentHelper.viewer;
|
|
309
|
+
},
|
|
310
|
+
enumerable: true,
|
|
311
|
+
configurable: true
|
|
312
|
+
});
|
|
313
|
+
Renderer.prototype.renderWidgets = function (page, left, top, width, height) {
|
|
314
|
+
if (isNullOrUndefined(this.pageCanvas) || isNullOrUndefined(page) || isNullOrUndefined(page.bodyWidgets)
|
|
315
|
+
|| !this.documentHelper.enableLayout) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(this.documentHelper.backgroundColor);
|
|
319
|
+
this.pageContext.beginPath();
|
|
320
|
+
if (this.viewer instanceof WebLayoutHelper) {
|
|
321
|
+
height = height > this.documentHelper.visibleBounds.height ? height : this.documentHelper.visibleBounds.height;
|
|
322
|
+
var marginTop = top;
|
|
323
|
+
if (page.index === 0) {
|
|
324
|
+
marginTop = top - this.viewer.padding.top;
|
|
325
|
+
}
|
|
326
|
+
/* eslint-disable-next-line max-len */
|
|
327
|
+
this.pageContext.fillRect(left - this.viewer.padding.left, marginTop, width + this.viewer.padding.left, height + this.viewer.padding.top);
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.pageContext.fillRect(left, top, width, height);
|
|
331
|
+
}
|
|
332
|
+
this.pageContext.closePath();
|
|
333
|
+
if (this.viewer instanceof PageLayoutHelper) {
|
|
334
|
+
this.pageContext.strokeStyle = this.documentHelper.pageOutline;
|
|
335
|
+
this.pageContext.strokeRect(left, top, width, height);
|
|
336
|
+
}
|
|
337
|
+
this.pageLeft = left;
|
|
338
|
+
this.pageTop = top;
|
|
339
|
+
this.pageIndex = page.index;
|
|
340
|
+
if (this.isPrinting) {
|
|
341
|
+
this.setPageSize(page);
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
this.pageContext.beginPath();
|
|
345
|
+
this.pageContext.save();
|
|
346
|
+
this.pageContext.rect(left, top, width, height);
|
|
347
|
+
this.pageContext.clip();
|
|
348
|
+
}
|
|
349
|
+
this.height = height;
|
|
350
|
+
if (page.headerWidget) {
|
|
351
|
+
this.renderHFWidgets(page, page.headerWidgetIn, width, true);
|
|
352
|
+
}
|
|
353
|
+
if (page.footerWidget) {
|
|
354
|
+
this.renderHFWidgets(page, page.footerWidgetIn, width, false);
|
|
355
|
+
}
|
|
356
|
+
// Need to render the behind shape for all floating items in the page. So that it will not overlap with multiple body widgets.
|
|
357
|
+
/* eslint-disable */
|
|
358
|
+
for (var i = 0; i < page.bodyWidgets.length; i++) {
|
|
359
|
+
if (!isNullOrUndefined(page.bodyWidgets[i].floatingElements)) {
|
|
360
|
+
this.renderFloatingItems(page, page.bodyWidgets[i].floatingElements, 'Behind');
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/* eslint-enable */
|
|
364
|
+
for (var i = 0; i < page.bodyWidgets.length; i++) {
|
|
365
|
+
this.render(page, page.bodyWidgets[parseInt(i.toString(), 10)]);
|
|
366
|
+
if (page.footnoteWidget && this.documentHelper.layoutType === 'Pages') {
|
|
367
|
+
this.renderfootNoteWidget(page, page.footnoteWidget, width);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (page.endnoteWidget && this.documentHelper.layoutType === 'Pages') {
|
|
371
|
+
this.renderfootNoteWidget(page, page.endnoteWidget, width);
|
|
372
|
+
}
|
|
373
|
+
if (this.documentHelper.editorProperties.enableHeaderAndFooter && !this.isPrinting) {
|
|
374
|
+
this.renderHeaderSeparator(page, this.pageLeft, this.pageTop, page.headerWidgetIn);
|
|
375
|
+
}
|
|
376
|
+
this.pageLeft = 0;
|
|
377
|
+
this.pageTop = 0;
|
|
378
|
+
this.pageContext.restore();
|
|
379
|
+
};
|
|
380
|
+
Renderer.prototype.setPageSize = function (page) {
|
|
381
|
+
this.pageContext.clearRect(0, 0, this.pageCanvas.width, this.pageCanvas.height);
|
|
382
|
+
this.selectionContext.clearRect(0, 0, this.selectionCanvas.width, this.selectionCanvas.height);
|
|
383
|
+
this.pageContext.restore();
|
|
384
|
+
this.selectionContext.restore();
|
|
385
|
+
var width = page.boundingRectangle.width;
|
|
386
|
+
var height = page.boundingRectangle.height;
|
|
387
|
+
var dpr = Math.max(window.devicePixelRatio, this.documentHelper.documentEditorSettings.printDevicePixelRatio);
|
|
388
|
+
if (this.pageCanvas.width !== width * dpr || this.pageCanvas.height !== height * dpr) {
|
|
389
|
+
this.pageCanvas.height = height * dpr;
|
|
390
|
+
this.pageCanvas.width = width * dpr;
|
|
391
|
+
this.pageCanvas.style.height = height + 'px';
|
|
392
|
+
this.pageCanvas.style.width = width + 'px';
|
|
393
|
+
this.pageContext.globalAlpha = 1;
|
|
394
|
+
this.pageContext.scale(dpr, dpr);
|
|
395
|
+
}
|
|
396
|
+
this.pageContext.fillStyle = '#FFFFFF';
|
|
397
|
+
this.pageContext.fillRect(0, 0, this.pageCanvas.width, this.pageCanvas.height);
|
|
398
|
+
this.pageContext.fillStyle = '#000000';
|
|
399
|
+
};
|
|
400
|
+
Renderer.prototype.renderHFWidgets = function (page, widget, width, isHeader) {
|
|
401
|
+
if (this.isFieldCode) {
|
|
402
|
+
this.isFieldCode = false;
|
|
403
|
+
}
|
|
404
|
+
if (!this.isPrinting) {
|
|
405
|
+
this.pageContext.globalAlpha = this.documentHelper.editorProperties.enableHeaderAndFooter ? 1 : 0.65;
|
|
406
|
+
}
|
|
407
|
+
var cliped = false;
|
|
408
|
+
var height = 0;
|
|
409
|
+
// Calculating header/footer height based on Word 2013 mode.
|
|
410
|
+
var headerFooterHeight = this.documentHelper.compatibilityMode === 'Word2013'
|
|
411
|
+
&& page.headerWidget.height + page.footerWidget.height < page.boundingRectangle.height / 100 * 80 ?
|
|
412
|
+
page.boundingRectangle.height / 100 * 80 : page.boundingRectangle.height / 100 * 40;
|
|
413
|
+
if (this.documentHelper.compatibilityMode === 'Word2003') {
|
|
414
|
+
headerFooterHeight = this.getScaledValue(page.boundingRectangle.height) / 100 * 50;
|
|
415
|
+
}
|
|
416
|
+
if (isNullOrUndefined(page.bodyWidgets)
|
|
417
|
+
|| page.bodyWidgets.length === 0
|
|
418
|
+
|| isNullOrUndefined(page.bodyWidgets[0])
|
|
419
|
+
|| isNullOrUndefined(page.bodyWidgets[0].sectionFormat)) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
if (isHeader) {
|
|
423
|
+
var topMargin = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.topMargin);
|
|
424
|
+
var widgetHeight = Math.max((widget.y + widget.height), topMargin);
|
|
425
|
+
if (widgetHeight > headerFooterHeight) {
|
|
426
|
+
cliped = true;
|
|
427
|
+
this.pageContext.beginPath();
|
|
428
|
+
this.pageContext.save();
|
|
429
|
+
this.pageContext.rect(this.pageLeft, this.pageTop, width, this.getScaledValue(headerFooterHeight));
|
|
430
|
+
this.pageContext.clip();
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
var footerDistance = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.footerDistance);
|
|
435
|
+
var footerHeight = void 0;
|
|
436
|
+
if (isNullOrUndefined(page.footerWidgetIn.sectionFormat)) {
|
|
437
|
+
footerHeight = page.boundingRectangle.height -
|
|
438
|
+
/* eslint-disable-next-line max-len */
|
|
439
|
+
Math.max(page.footerWidgetIn.height + footerDistance, LayoutHelperMethods.convertPointToPixel(page.footerWidgetIn.sectionFormat.bottomMargin));
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
footerHeight = page.boundingRectangle.height -
|
|
443
|
+
/* eslint-disable-next-line max-len */
|
|
444
|
+
Math.max(page.footerWidgetIn.height + footerDistance, LayoutHelperMethods.convertPointToPixel(page.footerWidgetIn.sectionFormat.bottomMargin));
|
|
445
|
+
}
|
|
446
|
+
height = Math.max(page.boundingRectangle.height - headerFooterHeight, footerHeight);
|
|
447
|
+
}
|
|
448
|
+
this.renderFloatingItems(page, widget.floatingElements, 'Behind');
|
|
449
|
+
for (var i = 0; i < widget.childWidgets.length; i++) {
|
|
450
|
+
var block = widget.childWidgets[parseInt(i.toString(), 10)];
|
|
451
|
+
if (!isHeader) {
|
|
452
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
453
|
+
height += block.height;
|
|
454
|
+
}
|
|
455
|
+
// if (isHeader || !isHeader && this.getScaledValue(Math.round(height)) <= this.getScaledValue(Math.round(pageHt))) {
|
|
456
|
+
this.renderWidget(page, block);
|
|
457
|
+
// }
|
|
458
|
+
}
|
|
459
|
+
this.renderFloatingItems(page, widget.floatingElements, 'InFrontOfText');
|
|
460
|
+
if (cliped) {
|
|
461
|
+
this.pageContext.restore();
|
|
462
|
+
}
|
|
463
|
+
if (!this.isPrinting) {
|
|
464
|
+
this.pageContext.globalAlpha = this.documentHelper.editorProperties.enableHeaderAndFooter ? 0.50 : 1;
|
|
465
|
+
}
|
|
466
|
+
};
|
|
467
|
+
Renderer.prototype.renderHeaderSeparator = function (page, left, top, widget) {
|
|
468
|
+
//Header Widget
|
|
469
|
+
var topMargin = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.topMargin);
|
|
470
|
+
var y = this.getScaledValue(Math.max((widget.y + widget.height), Math.abs(topMargin)));
|
|
471
|
+
var pageWidth = this.getScaledValue(page.boundingRectangle.width);
|
|
472
|
+
var ctx = this.pageContext;
|
|
473
|
+
ctx.save();
|
|
474
|
+
ctx.globalAlpha = 0.85;
|
|
475
|
+
// calculating header/footer height based on Word 2013 mode.
|
|
476
|
+
var headerFooterHeight = this.documentHelper.compatibilityMode === 'Word2013'
|
|
477
|
+
&& page.headerWidget.height + page.footerWidget.height < page.boundingRectangle.height / 100 * 80 ?
|
|
478
|
+
this.getScaledValue(page.boundingRectangle.height) / 100 * 80 : this.getScaledValue(page.boundingRectangle.height) / 100 * 40;
|
|
479
|
+
if (this.documentHelper.compatibilityMode === 'Word2003') {
|
|
480
|
+
headerFooterHeight = this.getScaledValue(page.boundingRectangle.height) / 100 * 50;
|
|
481
|
+
}
|
|
482
|
+
//Maximum header height limit
|
|
483
|
+
y = Math.min(y, headerFooterHeight);
|
|
484
|
+
//Dash line Separator
|
|
485
|
+
this.renderDashLine(ctx, left, top + y, pageWidth, '#000000', false);
|
|
486
|
+
var type = this.getHeaderFooterType(page, true);
|
|
487
|
+
var index = this.viewer.getHeaderFooter(widget.headerFooterType);
|
|
488
|
+
var sectionIndex = page.sectionIndex;
|
|
489
|
+
var l10n = new L10n('documenteditor', this.documentHelper.defaultLocale);
|
|
490
|
+
l10n.setLocale(this.documentHelper.locale);
|
|
491
|
+
if (this.documentHelper.headersFooters.length > 1) {
|
|
492
|
+
var sectionMarkIndex = sectionIndex + 1;
|
|
493
|
+
type = type + ' -' + l10n.getConstant('Section') + ' ' + sectionMarkIndex + '-';
|
|
494
|
+
}
|
|
495
|
+
ctx.font = '9pt Arial';
|
|
496
|
+
ctx.letterSpacing = '0pt';
|
|
497
|
+
var width = ctx.measureText(type).width;
|
|
498
|
+
this.renderHeaderFooterMark(ctx, left + 5, top + y, width + 10, 20);
|
|
499
|
+
this.renderHeaderFooterMarkText(ctx, type, left + 10, y + top + 15);
|
|
500
|
+
var headerFooterWidget;
|
|
501
|
+
if (this.documentHelper.headersFooters[parseInt(sectionIndex.toString(), 10)]) {
|
|
502
|
+
headerFooterWidget = this.documentHelper.headersFooters[parseInt(sectionIndex.toString(), 10)][parseInt(index.toString(), 10)];
|
|
503
|
+
}
|
|
504
|
+
if (sectionIndex !== 0 && !headerFooterWidget) {
|
|
505
|
+
var content = l10n.getConstant('Same as Previous');
|
|
506
|
+
var width_1 = ctx.measureText(content).width;
|
|
507
|
+
var right = this.viewer.containerWidth - width_1 - 75 + left;
|
|
508
|
+
this.renderHeaderFooterMark(ctx, right, top + y, width_1 + 10, 20);
|
|
509
|
+
this.renderHeaderFooterMarkText(ctx, content, right + 5, y + top + 15);
|
|
510
|
+
}
|
|
511
|
+
if (page.footerWidget) {
|
|
512
|
+
//Footer Widget
|
|
513
|
+
var footerDistance = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.footerDistance);
|
|
514
|
+
var footerHeight = this.documentHelper.compatibilityMode === 'Word2013'
|
|
515
|
+
&& page.footerWidgetIn.y + page.footerWidgetIn.height > page.boundingRectangle.height ?
|
|
516
|
+
page.footerWidgetIn.y : this.getScaledValue(page.boundingRectangle.height) - this.getScaledValue(Math.max(page.footerWidgetIn.height + footerDistance, Math.abs(LayoutHelperMethods.convertPointToPixel(page.footerWidgetIn.sectionFormat.bottomMargin))));
|
|
517
|
+
//Maximum footer height limit
|
|
518
|
+
footerHeight = Math.max((this.getScaledValue(page.boundingRectangle.height) - headerFooterHeight), footerHeight);
|
|
519
|
+
this.renderDashLine(ctx, left, top + footerHeight, pageWidth, '#000000', false);
|
|
520
|
+
var type_1 = this.getHeaderFooterType(page, false);
|
|
521
|
+
var sectionIndex_1 = page.sectionIndex;
|
|
522
|
+
if (this.documentHelper.headersFooters.length > 1) {
|
|
523
|
+
var sectionMarkIndex = sectionIndex_1 + 1;
|
|
524
|
+
type_1 = type_1 + ' -' + l10n.getConstant('Section') + ' ' + sectionMarkIndex + '-';
|
|
525
|
+
}
|
|
526
|
+
width = ctx.measureText(type_1).width;
|
|
527
|
+
this.renderHeaderFooterMark(ctx, left + 5, top + footerHeight - 20, width + 10, 20);
|
|
528
|
+
this.renderHeaderFooterMarkText(ctx, type_1, left + 10, top + footerHeight - 5);
|
|
529
|
+
var index_1 = this.viewer.getHeaderFooter(page.footerWidget.headerFooterType);
|
|
530
|
+
var headerFooterWidget_1;
|
|
531
|
+
if (this.documentHelper.headersFooters[parseInt(sectionIndex_1.toString(), 10)]) {
|
|
532
|
+
headerFooterWidget_1 = this.documentHelper.headersFooters[parseInt(sectionIndex_1.toString(), 10)][parseInt(index_1.toString(), 10)];
|
|
533
|
+
}
|
|
534
|
+
if (sectionIndex_1 !== 0 && !headerFooterWidget_1) {
|
|
535
|
+
var content = l10n.getConstant('Same as Previous');
|
|
536
|
+
var width_2 = ctx.measureText(content).width;
|
|
537
|
+
var right = this.viewer.containerWidth - width_2 - 75 + left;
|
|
538
|
+
this.renderHeaderFooterMark(ctx, right, top + footerHeight - 20, width_2 + 10, 20);
|
|
539
|
+
this.renderHeaderFooterMarkText(ctx, content, right + 5, top + footerHeight - 5);
|
|
540
|
+
}
|
|
541
|
+
ctx.restore();
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
Renderer.prototype.getFooterHeight = function (page) {
|
|
545
|
+
var footerWidgetHeight = ((page.boundingRectangle.height) / 100) * 40;
|
|
546
|
+
var footerDistance = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.footerDistance);
|
|
547
|
+
var actualHeight = page.boundingRectangle.height -
|
|
548
|
+
Math.max(page.footerWidgetIn.height + footerDistance, LayoutHelperMethods.convertPointToPixel(page.footerWidgetIn.sectionFormat.bottomMargin));
|
|
549
|
+
return Math.max((page.boundingRectangle.height) - footerWidgetHeight, actualHeight);
|
|
550
|
+
};
|
|
551
|
+
Renderer.prototype.getHeaderFooterType = function (page, isHeader) {
|
|
552
|
+
var type;
|
|
553
|
+
var l10n = new L10n('documenteditor', this.documentHelper.defaultLocale);
|
|
554
|
+
l10n.setLocale(this.documentHelper.locale);
|
|
555
|
+
type = isHeader ? l10n.getConstant('Header') : l10n.getConstant('Footer');
|
|
556
|
+
if (page.bodyWidgets[0].sectionFormat.differentFirstPage &&
|
|
557
|
+
(isNullOrUndefined(page.previousPage) || page.sectionIndex !== page.previousPage.sectionIndex)) {
|
|
558
|
+
type = isHeader ? l10n.getConstant('First Page Header') : l10n.getConstant('First Page Footer');
|
|
559
|
+
}
|
|
560
|
+
else if (page.bodyWidgets[0].sectionFormat.differentOddAndEvenPages) {
|
|
561
|
+
if ((this.documentHelper.pages.indexOf(page) + 1) % 2 === 0) {
|
|
562
|
+
type = isHeader ? l10n.getConstant('Even Page Header') : l10n.getConstant('Even Page Footer');
|
|
563
|
+
}
|
|
564
|
+
else {
|
|
565
|
+
type = isHeader ? l10n.getConstant('Odd Page Header') : l10n.getConstant('Odd Page Footer');
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return type;
|
|
569
|
+
};
|
|
570
|
+
/* eslint-disable-next-line max-len */
|
|
571
|
+
Renderer.prototype.renderDashLine = function (context, x, y, width, fillStyle, isSmallDash) {
|
|
572
|
+
context.beginPath();
|
|
573
|
+
context.strokeStyle = fillStyle;
|
|
574
|
+
context.lineWidth = 1;
|
|
575
|
+
if (isSmallDash) {
|
|
576
|
+
context.setLineDash([3, 2]);
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
context.setLineDash([6, 4]);
|
|
580
|
+
}
|
|
581
|
+
context.moveTo(x, y);
|
|
582
|
+
context.lineTo(x + width, y);
|
|
583
|
+
context.stroke();
|
|
584
|
+
context.setLineDash([]);
|
|
585
|
+
context.closePath();
|
|
586
|
+
};
|
|
587
|
+
Renderer.prototype.renderSolidLine = function (context, x, y, width, fillStyle) {
|
|
588
|
+
context.beginPath();
|
|
589
|
+
context.strokeStyle = fillStyle;
|
|
590
|
+
context.lineWidth = 0.5;
|
|
591
|
+
context.moveTo(x, y);
|
|
592
|
+
context.lineTo(x + width, y);
|
|
593
|
+
context.stroke();
|
|
594
|
+
context.closePath();
|
|
595
|
+
};
|
|
596
|
+
Renderer.prototype.renderHeaderFooterMark = function (ctx, x, y, w, h) {
|
|
597
|
+
ctx.beginPath();
|
|
598
|
+
ctx.fillStyle = 'lightgray';
|
|
599
|
+
ctx.fillRect(x, y, w, h);
|
|
600
|
+
ctx.strokeStyle = 'black';
|
|
601
|
+
ctx.strokeRect(x, y, w, h);
|
|
602
|
+
ctx.closePath();
|
|
603
|
+
};
|
|
604
|
+
Renderer.prototype.renderHeaderFooterMarkText = function (ctx, content, x, y) {
|
|
605
|
+
ctx.beginPath();
|
|
606
|
+
ctx.fillStyle = '#000000';
|
|
607
|
+
ctx.textBaseline = 'alphabetic';
|
|
608
|
+
ctx.fillText(content, x, y);
|
|
609
|
+
ctx.closePath();
|
|
610
|
+
};
|
|
611
|
+
Renderer.prototype.render = function (page, bodyWidget) {
|
|
612
|
+
if (this.isFieldCode) {
|
|
613
|
+
this.isFieldCode = false;
|
|
614
|
+
}
|
|
615
|
+
var isClipped = false;
|
|
616
|
+
var nextColumnBody;
|
|
617
|
+
if (!isNullOrUndefined(bodyWidget.nextRenderedWidget)
|
|
618
|
+
&& bodyWidget.columnIndex + 1 === bodyWidget.nextRenderedWidget.columnIndex) {
|
|
619
|
+
nextColumnBody = bodyWidget.nextRenderedWidget;
|
|
620
|
+
}
|
|
621
|
+
var xPos;
|
|
622
|
+
var width;
|
|
623
|
+
if (!(this.viewer instanceof WebLayoutHelper) && bodyWidget.sectionFormat.columns.length > 1
|
|
624
|
+
&& !isNullOrUndefined(nextColumnBody)) {
|
|
625
|
+
var colIndex = page.bodyWidgets.indexOf(bodyWidget);
|
|
626
|
+
if (bodyWidget.columnIndex === 0) {
|
|
627
|
+
/* eslint-disable */
|
|
628
|
+
xPos = page.bodyWidgets[colIndex].x - LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[colIndex].sectionFormat.leftMargin);
|
|
629
|
+
width = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[colIndex].sectionFormat.leftMargin) + bodyWidget.sectionFormat.columns[bodyWidget.columnIndex].width + (bodyWidget.sectionFormat.columns[bodyWidget.columnIndex].space / 2);
|
|
630
|
+
/* eslint-enable */
|
|
631
|
+
}
|
|
632
|
+
else if (colIndex === bodyWidget.sectionFormat.columns.length - 1) {
|
|
633
|
+
/* eslint-disable */
|
|
634
|
+
xPos = page.bodyWidgets[colIndex].x - (bodyWidget.sectionFormat.columns[bodyWidget.columnIndex - 1].space / 2);
|
|
635
|
+
width = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[colIndex].sectionFormat.rightMargin) + bodyWidget.sectionFormat.columns[bodyWidget.columnIndex].width + (bodyWidget.sectionFormat.columns[bodyWidget.columnIndex - 1].space / 2);
|
|
636
|
+
/* eslint-enable */
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
/* eslint-disable */
|
|
640
|
+
xPos = page.bodyWidgets[colIndex].x - (bodyWidget.sectionFormat.columns[bodyWidget.columnIndex].space / 2);
|
|
641
|
+
width = bodyWidget.sectionFormat.columns[bodyWidget.columnIndex].width + bodyWidget.sectionFormat.columns[bodyWidget.columnIndex].space;
|
|
642
|
+
/* eslint-enable */
|
|
643
|
+
}
|
|
644
|
+
/* eslint-disable */
|
|
645
|
+
this.clipRect(xPos, page.bodyWidgets[colIndex].y, this.getScaledValue(width), this.getScaledValue(page.boundingRectangle.height));
|
|
646
|
+
/* eslint-enable */
|
|
647
|
+
isClipped = true;
|
|
648
|
+
}
|
|
649
|
+
for (var i = 0; i < bodyWidget.childWidgets.length; i++) {
|
|
650
|
+
var widget = bodyWidget.childWidgets[parseInt(i.toString(), 10)];
|
|
651
|
+
if (i === 0 && bodyWidget.childWidgets[0] instanceof TableWidget &&
|
|
652
|
+
(bodyWidget.childWidgets[0].childWidgets.length > 0) &&
|
|
653
|
+
page.repeatHeaderRowTableWidget) {
|
|
654
|
+
/* eslint-disable-next-line max-len */
|
|
655
|
+
this.renderHeader(page, widget, this.documentHelper.layout.getHeader(bodyWidget.childWidgets[0]));
|
|
656
|
+
}
|
|
657
|
+
if (isClipped && widget instanceof TableWidget && widget.wrapTextAround) {
|
|
658
|
+
this.pageContext.restore();
|
|
659
|
+
isClipped = false;
|
|
660
|
+
}
|
|
661
|
+
this.renderWidget(page, widget);
|
|
662
|
+
if (!isClipped && xPos && width) {
|
|
663
|
+
/* eslint-disable */
|
|
664
|
+
this.clipRect(xPos, page.bodyWidgets[page.bodyWidgets.indexOf(bodyWidget)].y, this.getScaledValue(width), this.getScaledValue(page.boundingRectangle.height));
|
|
665
|
+
/* eslint-enable */
|
|
666
|
+
isClipped = true;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
if (isClipped) {
|
|
670
|
+
this.pageContext.restore();
|
|
671
|
+
}
|
|
672
|
+
/* eslint-disable */
|
|
673
|
+
for (var i = 0; i < page.bodyWidgets.length; i++) {
|
|
674
|
+
if (!isNullOrUndefined(page.bodyWidgets[i].floatingElements)) {
|
|
675
|
+
this.renderFloatingItems(page, page.bodyWidgets[i].floatingElements, 'InFrontOfText');
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
/* eslint-enable */
|
|
679
|
+
for (var i = 0; i < page.bodyWidgets.length; i++) {
|
|
680
|
+
if (page.bodyWidgets[parseInt(i.toString(), 10)].sectionFormat.lineBetweenColumns === true) {
|
|
681
|
+
if (page.bodyWidgets[parseInt(i.toString(), 10)].columnIndex !== 0 && page.bodyWidgets.length > 1) {
|
|
682
|
+
var topMargin = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.topMargin);
|
|
683
|
+
var linestartY = this.getScaledValue(Math.max((page.headerWidgetIn.y + page.headerWidgetIn.height), topMargin));
|
|
684
|
+
var headerFooterHeight = (this.getScaledValue(page.boundingRectangle.height) / 100) * 40;
|
|
685
|
+
var footerDistance = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.footerDistance);
|
|
686
|
+
var footerHeight = this.getScaledValue(page.boundingRectangle.height) -
|
|
687
|
+
/* eslint-disable-next-line max-len */
|
|
688
|
+
this.getScaledValue(Math.max(page.footerWidgetIn.height + footerDistance, LayoutHelperMethods.convertPointToPixel(page.footerWidgetIn.sectionFormat.bottomMargin)));
|
|
689
|
+
footerHeight = Math.max((this.getScaledValue(page.boundingRectangle.height) - headerFooterHeight), footerHeight);
|
|
690
|
+
var inBetweenSpace = (page.bodyWidgets[parseInt(i.toString(), 10)].x
|
|
691
|
+
- (page.bodyWidgets[parseInt(i.toString(), 10)].previousRenderedWidget.x
|
|
692
|
+
+ page.bodyWidgets[parseInt(i.toString(), 10)].previousRenderedWidget.width)) / 2;
|
|
693
|
+
var startX = inBetweenSpace + (page.bodyWidgets[parseInt(i.toString(), 10)].previousRenderedWidget.x
|
|
694
|
+
+ page.bodyWidgets[parseInt(i.toString(), 10)].previousRenderedWidget.width);
|
|
695
|
+
var startY = linestartY / this.documentHelper.zoomFactor;
|
|
696
|
+
var endX = startX;
|
|
697
|
+
var endY = void 0;
|
|
698
|
+
if (page.footnoteWidget) {
|
|
699
|
+
endY = ((footerHeight - (page.footerWidgetIn.height / 2))
|
|
700
|
+
- page.footnoteWidget.height * this.documentHelper.zoomFactor) / this.documentHelper.zoomFactor;
|
|
701
|
+
}
|
|
702
|
+
else {
|
|
703
|
+
endY = (footerHeight - (page.footerWidgetIn.height / 2)) / this.documentHelper.zoomFactor;
|
|
704
|
+
}
|
|
705
|
+
var firstBody = this.documentHelper.layout.getBodyWidget(page.bodyWidgets[parseInt(i.toString(), 10)], true);
|
|
706
|
+
var height = this.documentHelper.layout.getNextWidgetHeight(firstBody);
|
|
707
|
+
startY = page.bodyWidgets[parseInt(i.toString(), 10)].y;
|
|
708
|
+
endY = height;
|
|
709
|
+
var color = '#000000';
|
|
710
|
+
this.renderSingleBorder(color, startX, startY, endX, endY, 0.5, 'Single');
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
Renderer.prototype.renderFloatingItems = function (page, floatingElements, wrappingType) {
|
|
716
|
+
if (!isNullOrUndefined(floatingElements) && floatingElements.length > 0) {
|
|
717
|
+
var overLappedShapeWidgets = new Dictionary();
|
|
718
|
+
/* eslint-disable */
|
|
719
|
+
floatingElements.sort(function (a, b) {
|
|
720
|
+
if (a instanceof TableWidget || b instanceof TableWidget) {
|
|
721
|
+
return 0;
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
return a.zOrderPosition - b.zOrderPosition;
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
for (var i = 0; i < floatingElements.length; i++) {
|
|
728
|
+
if (floatingElements[i] instanceof TableWidget) {
|
|
729
|
+
continue;
|
|
730
|
+
}
|
|
731
|
+
var shape = floatingElements[i];
|
|
732
|
+
if ((wrappingType === "Behind" && shape.textWrappingStyle !== "Behind") ||
|
|
733
|
+
(wrappingType !== "Behind" && shape.textWrappingStyle === "Behind")) {
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
if (!this.isOverLappedShapeWidget(shape) || overLappedShapeWidgets.containsKey(shape.zOrderPosition)) {
|
|
737
|
+
if (shape instanceof ImageElementBox) {
|
|
738
|
+
this.renderImageElementBox(shape, shape.x, shape.y, 0);
|
|
739
|
+
}
|
|
740
|
+
else if (shape instanceof ShapeElementBox) {
|
|
741
|
+
var shapeLeft = this.getScaledValue(shape.x, 1);
|
|
742
|
+
var shapeTop = this.getScaledValue(shape.y, 2);
|
|
743
|
+
this.renderShapeElementBox(shape, shapeLeft, shapeTop, page);
|
|
744
|
+
}
|
|
745
|
+
else if (shape instanceof GroupShapeElementBox) {
|
|
746
|
+
this.renderGroupShapeElementBox(shape, page);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
else if (!overLappedShapeWidgets.containsKey(shape.zOrderPosition)) {
|
|
750
|
+
overLappedShapeWidgets.add(shape.zOrderPosition, shape);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
if (overLappedShapeWidgets.length > 0) {
|
|
754
|
+
var sortedOverLappedShapeWidgets = overLappedShapeWidgets.keys.sort();
|
|
755
|
+
for (var j = 0; j < sortedOverLappedShapeWidgets.length; j++) {
|
|
756
|
+
var shape = overLappedShapeWidgets.get(sortedOverLappedShapeWidgets[j]);
|
|
757
|
+
if (shape instanceof ImageElementBox) {
|
|
758
|
+
this.renderImageElementBox(shape, shape.x, shape.y, 0);
|
|
759
|
+
}
|
|
760
|
+
else if (shape instanceof ShapeElementBox) {
|
|
761
|
+
var shapeLeft = this.getScaledValue(shape.x, 1);
|
|
762
|
+
var shapeTop = this.getScaledValue(shape.y, 2);
|
|
763
|
+
this.renderShapeElementBox(shape, shapeLeft, shapeTop, page);
|
|
764
|
+
}
|
|
765
|
+
else if (shape instanceof GroupShapeElementBox) {
|
|
766
|
+
this.renderGroupShapeElementBox(shape, page);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
/**
|
|
773
|
+
* @private
|
|
774
|
+
* @returns {boolean}
|
|
775
|
+
*/
|
|
776
|
+
Renderer.prototype.isOverLappedShapeWidget = function (floatingElement) {
|
|
777
|
+
return ((floatingElement instanceof ImageElementBox
|
|
778
|
+
&& floatingElement.textWrappingStyle !== 'Inline'
|
|
779
|
+
&& floatingElement.textWrappingStyle !== 'Behind'
|
|
780
|
+
&& !(this.documentHelper.compatibilityMode !== 'Word2013'
|
|
781
|
+
&& (floatingElement.isBelowText
|
|
782
|
+
&& floatingElement.textWrappingStyle !== 'InFrontOfText')))
|
|
783
|
+
|| ((floatingElement instanceof ShapeElementBox || floatingElement instanceof GroupShapeElementBox)
|
|
784
|
+
&& floatingElement.textWrappingStyle !== 'Inline'
|
|
785
|
+
&& floatingElement.textWrappingStyle !== 'Behind'
|
|
786
|
+
&& !(this.documentHelper.compatibilityMode !== 'Word2013'
|
|
787
|
+
&& (floatingElement.isBelowText
|
|
788
|
+
&& floatingElement.textWrappingStyle !== 'InFrontOfText'))));
|
|
789
|
+
};
|
|
790
|
+
Renderer.prototype.renderGroupShapeElementBox = function (groupShape, page) {
|
|
791
|
+
for (var i = 0; i < groupShape.childWidgets.length; i++) {
|
|
792
|
+
var shape = groupShape.childWidgets[i];
|
|
793
|
+
if (shape instanceof GroupShapeElementBox) {
|
|
794
|
+
this.renderGroupShapeElementBox(shape, page);
|
|
795
|
+
}
|
|
796
|
+
else if (shape instanceof ImageElementBox) {
|
|
797
|
+
this.renderImageElementBox(shape, shape.x, shape.y, 0);
|
|
798
|
+
}
|
|
799
|
+
else if (shape instanceof ShapeElementBox) {
|
|
800
|
+
var shapeLeft = this.getScaledValue(shape.x, 1);
|
|
801
|
+
var shapeTop = this.getScaledValue(shape.y, 2);
|
|
802
|
+
this.renderShapeElementBox(shape, shapeLeft, shapeTop, page);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
Renderer.prototype.renderShapeElementBox = function (shape, shapeLeft, shapeTop, page) {
|
|
807
|
+
var isZeroShapeHeight = (shape.height === 0) ? true : false;
|
|
808
|
+
var shapeType = shape.autoShapeType;
|
|
809
|
+
var blocks = shape.textFrame.childWidgets;
|
|
810
|
+
this.pageContext.beginPath();
|
|
811
|
+
var originalAlpha = this.pageContext.globalAlpha;
|
|
812
|
+
if (shape.fillFormat && shape.fillFormat.color && shape.fillFormat.fill && shapeType !== 'StraightConnector') {
|
|
813
|
+
this.pageContext.globalAlpha = 1;
|
|
814
|
+
this.pageContext.fillStyle = shape.fillFormat.color;
|
|
815
|
+
if (shapeType === 'Rectangle') {
|
|
816
|
+
this.pageContext.fillRect(shapeLeft, shapeTop, this.getScaledValue(shape.width), this.getScaledValue(shape.height));
|
|
817
|
+
}
|
|
818
|
+
else {
|
|
819
|
+
this.renderPathElement(shape, shapeLeft, shapeTop);
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
else if (shape.fillFormat && shape.fillFormat.color && shapeType === 'Oval') {
|
|
823
|
+
this.pageContext.fillStyle = shape.fillFormat.color;
|
|
824
|
+
this.renderPathElement(shape, shapeLeft, shapeTop);
|
|
825
|
+
}
|
|
826
|
+
this.pageContext.globalAlpha = originalAlpha;
|
|
827
|
+
if (!isNullOrUndefined(shapeType)) {
|
|
828
|
+
if (shape.lineFormat.line && shape.lineFormat.lineFormatType !== 'None') {
|
|
829
|
+
this.pageContext.lineWidth = shape.lineFormat.weight;
|
|
830
|
+
this.pageContext.strokeStyle = LayoutHelperMethods.getColor(shape.lineFormat.color);
|
|
831
|
+
this.setShapeLineDash(shape);
|
|
832
|
+
if (shapeType === 'Rectangle') {
|
|
833
|
+
this.pageContext.strokeRect(shapeLeft, shapeTop, this.getScaledValue(shape.width), this.getScaledValue(shape.height));
|
|
834
|
+
}
|
|
835
|
+
else if (shapeType === 'StraightConnector') {
|
|
836
|
+
this.pageContext.moveTo(shapeLeft, shapeTop);
|
|
837
|
+
this.pageContext.lineTo(shapeLeft + this.getScaledValue(shape.width), shapeTop + this.getScaledValue(shape.height));
|
|
838
|
+
this.pageContext.stroke();
|
|
839
|
+
}
|
|
840
|
+
this.pageContext.setLineDash([]);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
this.pageContext.closePath();
|
|
844
|
+
var isClipped = false;
|
|
845
|
+
if (shape.width != 0 && shape.height != 0) {
|
|
846
|
+
isClipped = true;
|
|
847
|
+
this.clipRect(shape.x, shape.y, this.getScaledValue(shape.width), this.getScaledValue(shape.height));
|
|
848
|
+
}
|
|
849
|
+
for (var i = 0; i < blocks.length; i++) {
|
|
850
|
+
this.renderWidget(page, blocks[i]);
|
|
851
|
+
if (isZeroShapeHeight && shapeType !== 'StraightConnector') {
|
|
852
|
+
shape.height = LayoutHelperMethods.round((shape.height + blocks[i].height), 5);
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
if (isZeroShapeHeight) {
|
|
856
|
+
isZeroShapeHeight = false;
|
|
857
|
+
}
|
|
858
|
+
if (isClipped) {
|
|
859
|
+
this.pageContext.restore();
|
|
860
|
+
}
|
|
861
|
+
};
|
|
862
|
+
Renderer.prototype.renderPathElement = function (shape, x, y) {
|
|
863
|
+
var pathData;
|
|
864
|
+
if (shape.autoShapeType && shape.autoShapeType != 'Unknown') {
|
|
865
|
+
switch (shape.autoShapeType) {
|
|
866
|
+
case 'ElbowConnector':
|
|
867
|
+
pathData = this.getConnectorPathData(shape);
|
|
868
|
+
break;
|
|
869
|
+
case 'CurvedConnector':
|
|
870
|
+
pathData = this.getCurvedPathData(shape);
|
|
871
|
+
break;
|
|
872
|
+
default:
|
|
873
|
+
pathData = this.getShape(shape.autoShapeType);
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
else if (shape.autoShapeType) {
|
|
878
|
+
pathData = this.constructPath(shape);
|
|
879
|
+
}
|
|
880
|
+
if (pathData) {
|
|
881
|
+
var bounds = this.calculatePathBounds(pathData);
|
|
882
|
+
var data = this.updatePath(pathData, bounds, shape);
|
|
883
|
+
this.drawPath(data, shape, x, y);
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
Renderer.prototype.renderWidget = function (page, widget) {
|
|
887
|
+
if (this.documentHelper.enableLockAndEdit) {
|
|
888
|
+
this.renderLockRegionBorder(page, widget);
|
|
889
|
+
}
|
|
890
|
+
if (this.documentHelper.compatibilityMode === 'Word2003') {
|
|
891
|
+
if (widget instanceof ParagraphWidget) {
|
|
892
|
+
if (widget.isRender === false) {
|
|
893
|
+
return;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
else if (widget instanceof TableWidget) {
|
|
897
|
+
if (widget.isRender === false) {
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
if (widget instanceof ParagraphWidget) {
|
|
903
|
+
this.renderParagraphWidget(page, widget);
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
this.renderTableWidget(page, widget);
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
Renderer.prototype.getConnectorPathData = function (shape) {
|
|
910
|
+
var startX = shape.distanceTop;
|
|
911
|
+
var startY = shape.distanceLeft;
|
|
912
|
+
var endX = shape.distanceTop + this.getScaledValue(shape.width);
|
|
913
|
+
var endY = shape.distanceLeft + this.getScaledValue(shape.height);
|
|
914
|
+
// Determine the mid points
|
|
915
|
+
var midX = startX + (endX - startX) / 2;
|
|
916
|
+
// const midY = startY + (endY - startY) / 2;
|
|
917
|
+
// Create the path data
|
|
918
|
+
var pathData = "M " + startX + "," + startY + " "; // Move to the start point
|
|
919
|
+
pathData += "L " + midX + "," + startY + " "; // Horizontal line to the middle X
|
|
920
|
+
pathData += "L " + midX + "," + endY + " "; // Vertical line to the end Y
|
|
921
|
+
pathData += "L " + endX + "," + endY; // Horizontal line to the end point
|
|
922
|
+
return pathData;
|
|
923
|
+
};
|
|
924
|
+
Renderer.prototype.getCurvedPathData = function (shape) {
|
|
925
|
+
var startX = shape.distanceTop;
|
|
926
|
+
var startY = shape.distanceLeft;
|
|
927
|
+
var endX = shape.distanceTop + this.getScaledValue(shape.width);
|
|
928
|
+
var endY = shape.distanceLeft + this.getScaledValue(shape.height);
|
|
929
|
+
// Control points for the Bezier curve
|
|
930
|
+
var controlPoint1X = startX + this.getScaledValue(shape.width) / 1.5;
|
|
931
|
+
var controlPoint1Y = startY;
|
|
932
|
+
var controlPoint2X = endX - this.getScaledValue(shape.width) / 1.5;
|
|
933
|
+
var controlPoint2Y = endY;
|
|
934
|
+
// Create the path data using cubic Bezier curve command
|
|
935
|
+
var pathData = "M " + startX + "," + startY + " C " + controlPoint1X + "," + controlPoint1Y + " " + controlPoint2X + "," + controlPoint2Y + " " + endX + "," + endY;
|
|
936
|
+
return pathData;
|
|
937
|
+
};
|
|
938
|
+
Renderer.prototype.constructPath = function (shape) {
|
|
939
|
+
var points = shape.editingPoints;
|
|
940
|
+
var coords = {};
|
|
941
|
+
for (var key in points) {
|
|
942
|
+
if (points.hasOwnProperty(key)) {
|
|
943
|
+
// Assigning key-value pairs to the new object
|
|
944
|
+
coords[key] = this.calculateCoord(points[key], 400, 400);
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
// Create path data using the coordinates
|
|
948
|
+
var pathData = "\n M " + coords.connsiteX0 + "," + coords.connsiteY0 + "\n L " + coords.connsiteX1 + "," + coords.connsiteY1 + "\n L " + coords.connsiteX2 + "," + coords.connsiteY2 + "\n L " + coords.connsiteX3 + "," + coords.connsiteY3 + "\n L " + coords.connsiteX4 + "," + coords.connsiteY4 + "\n Z\n ";
|
|
949
|
+
return pathData;
|
|
950
|
+
};
|
|
951
|
+
Renderer.prototype.calculateCoord = function (pointValue, w, h) {
|
|
952
|
+
var parts = pointValue.split(" ");
|
|
953
|
+
var operation = parts[0];
|
|
954
|
+
var numerator = parseFloat(parts[1]);
|
|
955
|
+
var dimension = parts[2] === 'w' ? w : h;
|
|
956
|
+
var denominator = parseFloat(parts[3]);
|
|
957
|
+
if (operation === "*/") {
|
|
958
|
+
return (numerator / denominator) * dimension;
|
|
959
|
+
}
|
|
960
|
+
return 0; // Default return value if operation is not recognized
|
|
961
|
+
};
|
|
962
|
+
Renderer.prototype.drawPath = function (data, shape, x, y) {
|
|
963
|
+
var collection = [];
|
|
964
|
+
collection = processPathData(data);
|
|
965
|
+
collection = pathSegmentCollection(collection);
|
|
966
|
+
this.setStyle(shape);
|
|
967
|
+
var ctx = this.pageContext;
|
|
968
|
+
if (ctx.translate) {
|
|
969
|
+
ctx.save();
|
|
970
|
+
ctx.beginPath();
|
|
971
|
+
//this.rotateContext(canvas, options.angle, pivotX, pivotY);
|
|
972
|
+
ctx.translate(x, y);
|
|
973
|
+
this.renderPath(ctx, collection);
|
|
974
|
+
ctx.fill();
|
|
975
|
+
if (shape.lineFormat.line && shape.lineFormat.lineFormatType !== 'None') {
|
|
976
|
+
ctx.translate(-x, -y);
|
|
977
|
+
ctx.stroke();
|
|
978
|
+
}
|
|
979
|
+
ctx.restore();
|
|
980
|
+
ctx.setLineDash([]);
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
Renderer.prototype.renderPath = function (canvas, collection) {
|
|
984
|
+
var ctx = canvas;
|
|
985
|
+
var x0;
|
|
986
|
+
var y0;
|
|
987
|
+
var x1;
|
|
988
|
+
var y1;
|
|
989
|
+
var x2;
|
|
990
|
+
var y2;
|
|
991
|
+
var x;
|
|
992
|
+
var y;
|
|
993
|
+
var length;
|
|
994
|
+
var i;
|
|
995
|
+
var segs = collection;
|
|
996
|
+
for (x = 0, y = 0, i = 0, length = segs.length; i < length; ++i) {
|
|
997
|
+
var obj = segs[parseInt(i.toString(), 10)];
|
|
998
|
+
var seg = obj;
|
|
999
|
+
var char = seg.command;
|
|
1000
|
+
if ('x1' in seg) {
|
|
1001
|
+
x1 = seg.x1;
|
|
1002
|
+
}
|
|
1003
|
+
if ('x2' in seg) {
|
|
1004
|
+
x2 = seg.x2;
|
|
1005
|
+
}
|
|
1006
|
+
if ('y1' in seg) {
|
|
1007
|
+
y1 = seg.y1;
|
|
1008
|
+
}
|
|
1009
|
+
if ('y2' in seg) {
|
|
1010
|
+
y2 = seg.y2;
|
|
1011
|
+
}
|
|
1012
|
+
if ('x' in seg) {
|
|
1013
|
+
x = seg.x;
|
|
1014
|
+
}
|
|
1015
|
+
if ('y' in seg) {
|
|
1016
|
+
y = seg.y;
|
|
1017
|
+
}
|
|
1018
|
+
switch (char) {
|
|
1019
|
+
case 'M':
|
|
1020
|
+
ctx.moveTo(x, y);
|
|
1021
|
+
seg.x = x;
|
|
1022
|
+
seg.y = y;
|
|
1023
|
+
break;
|
|
1024
|
+
case 'L':
|
|
1025
|
+
ctx.lineTo(x, y);
|
|
1026
|
+
seg.x = x;
|
|
1027
|
+
seg.y = y;
|
|
1028
|
+
break;
|
|
1029
|
+
case 'C':
|
|
1030
|
+
ctx.bezierCurveTo(x1, y1, x2, y2, x, y);
|
|
1031
|
+
seg.x = x;
|
|
1032
|
+
seg.y = y;
|
|
1033
|
+
seg.x1 = x1;
|
|
1034
|
+
seg.y1 = y1;
|
|
1035
|
+
seg.x2 = x2;
|
|
1036
|
+
seg.y2 = y2;
|
|
1037
|
+
break;
|
|
1038
|
+
case 'Q':
|
|
1039
|
+
ctx.quadraticCurveTo(x1, y1, x, y);
|
|
1040
|
+
seg.x = x;
|
|
1041
|
+
seg.y = y;
|
|
1042
|
+
seg.x1 = x1;
|
|
1043
|
+
seg.y1 = y1;
|
|
1044
|
+
break;
|
|
1045
|
+
case 'A':
|
|
1046
|
+
var curr = { x: x0, y: y0 };
|
|
1047
|
+
var rx = seg.r1;
|
|
1048
|
+
var ry = seg.r2;
|
|
1049
|
+
var xAxisRotation = seg.angle * (Math.PI / 180.0);
|
|
1050
|
+
var largeArc = seg.largeArc;
|
|
1051
|
+
var sweep = seg.sweep;
|
|
1052
|
+
var cp = { x: x, y: y };
|
|
1053
|
+
var currp = {
|
|
1054
|
+
x: Math.cos(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.sin(xAxisRotation) * (curr.y - cp.y) / 2.0,
|
|
1055
|
+
y: -Math.sin(xAxisRotation) * (curr.x - cp.x) / 2.0 + Math.cos(xAxisRotation) * (curr.y - cp.y) / 2.0
|
|
1056
|
+
};
|
|
1057
|
+
var l = Math.pow(currp.x, 2) / Math.pow(rx, 2) + Math.pow(currp.y, 2) / Math.pow(ry, 2);
|
|
1058
|
+
if (l > 1) {
|
|
1059
|
+
rx *= Math.sqrt(l);
|
|
1060
|
+
ry *= Math.sqrt(l);
|
|
1061
|
+
}
|
|
1062
|
+
var k = (Math.pow(ry, 2) * Math.pow(currp.x, 2));
|
|
1063
|
+
var s = (largeArc === sweep ? -1 : 1) * Math.sqrt(((Math.pow(rx, 2) * Math.pow(ry, 2)) - (Math.pow(rx, 2) * Math.pow(currp.y, 2)) - k) /
|
|
1064
|
+
(Math.pow(rx, 2) * Math.pow(currp.y, 2) + Math.pow(ry, 2) * Math.pow(currp.x, 2)));
|
|
1065
|
+
if (isNaN(s)) {
|
|
1066
|
+
s = 0;
|
|
1067
|
+
}
|
|
1068
|
+
var cpp = { x: s * rx * currp.y / ry, y: s * -ry * currp.x / rx };
|
|
1069
|
+
var centp = {
|
|
1070
|
+
x: (curr.x + cp.x) / 2.0 + Math.cos(xAxisRotation) * cpp.x - Math.sin(xAxisRotation) * cpp.y,
|
|
1071
|
+
y: (curr.y + cp.y) / 2.0 + Math.sin(xAxisRotation) * cpp.x + Math.cos(xAxisRotation) * cpp.y
|
|
1072
|
+
};
|
|
1073
|
+
var a1 = this.a([1, 0], [(currp.x - cpp.x) / rx, (currp.y - cpp.y) / ry]);
|
|
1074
|
+
var u = [(currp.x - cpp.x) / rx, (currp.y - cpp.y) / ry];
|
|
1075
|
+
var v = [(-currp.x - cpp.x) / rx, (-currp.y - cpp.y) / ry];
|
|
1076
|
+
var ad = this.a(u, v);
|
|
1077
|
+
if (this.r(u, v) <= -1) {
|
|
1078
|
+
ad = Math.PI;
|
|
1079
|
+
}
|
|
1080
|
+
if (this.r(u, v) >= 1) {
|
|
1081
|
+
ad = 0;
|
|
1082
|
+
}
|
|
1083
|
+
var dir = !sweep ? -1.0 : 1.0;
|
|
1084
|
+
var ah = a1 + dir * (ad / 2.0);
|
|
1085
|
+
var halfWay = {
|
|
1086
|
+
x: centp.x + rx * Math.cos(ah),
|
|
1087
|
+
y: centp.y + ry * Math.sin(ah)
|
|
1088
|
+
};
|
|
1089
|
+
seg.centp = centp;
|
|
1090
|
+
seg.xAxisRotation = xAxisRotation;
|
|
1091
|
+
seg.rx = rx;
|
|
1092
|
+
seg.ry = ry;
|
|
1093
|
+
seg.a1 = a1;
|
|
1094
|
+
seg.ad = ad;
|
|
1095
|
+
seg.sweep = sweep;
|
|
1096
|
+
if (ctx != null) {
|
|
1097
|
+
var ra = rx > ry ? rx : ry;
|
|
1098
|
+
var sx = rx > ry ? 1 : rx / ry;
|
|
1099
|
+
var sy = rx > ry ? ry / rx : 1;
|
|
1100
|
+
ctx.save();
|
|
1101
|
+
ctx.translate(centp.x, centp.y);
|
|
1102
|
+
ctx.rotate(xAxisRotation);
|
|
1103
|
+
ctx.scale(sx, sy);
|
|
1104
|
+
ctx.arc(0, 0, ra, a1, a1 + ad, !sweep);
|
|
1105
|
+
ctx.scale(1 / sx, 1 / sy);
|
|
1106
|
+
ctx.rotate(-xAxisRotation);
|
|
1107
|
+
ctx.translate(-centp.x, -centp.y);
|
|
1108
|
+
ctx.restore();
|
|
1109
|
+
}
|
|
1110
|
+
break;
|
|
1111
|
+
case 'Z':
|
|
1112
|
+
case 'z':
|
|
1113
|
+
ctx.closePath();
|
|
1114
|
+
x = x0;
|
|
1115
|
+
y = y0;
|
|
1116
|
+
break;
|
|
1117
|
+
}
|
|
1118
|
+
x0 = x;
|
|
1119
|
+
y0 = y;
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
// vector magnitude
|
|
1123
|
+
Renderer.prototype.m = function (v) { return Math.sqrt(Math.pow(v[0], 2) + Math.pow(v[1], 2)); };
|
|
1124
|
+
// ratio between two vectors
|
|
1125
|
+
Renderer.prototype.r = function (u, v) { return (u[0] * v[0] + u[1] * v[1]) / (this.m(u) * this.m(v)); };
|
|
1126
|
+
// angle between two vectors
|
|
1127
|
+
Renderer.prototype.a = function (u, v) { return (u[0] * v[1] < u[1] * v[0] ? -1 : 1) * Math.acos(this.r(u, v)); };
|
|
1128
|
+
Renderer.prototype.updatePath = function (pathData, bounds, shape) {
|
|
1129
|
+
var isScale = false;
|
|
1130
|
+
var newPathString = '';
|
|
1131
|
+
var scaleX = -bounds.x;
|
|
1132
|
+
var scaleY = -bounds.y;
|
|
1133
|
+
var arrayCollection = [];
|
|
1134
|
+
if (this.getScaledValue(shape.width) !== bounds.width || this.getScaledValue(shape.height) !== bounds.height) {
|
|
1135
|
+
scaleX = this.getScaledValue(shape.width) / Number(bounds.width ? bounds.width : 1);
|
|
1136
|
+
scaleY = this.getScaledValue(shape.height) / Number(bounds.height ? bounds.height : 1);
|
|
1137
|
+
isScale = true;
|
|
1138
|
+
}
|
|
1139
|
+
arrayCollection = processPathData(pathData);
|
|
1140
|
+
arrayCollection = splitArrayCollection(arrayCollection);
|
|
1141
|
+
if ((isScale)) {
|
|
1142
|
+
newPathString = transformPath(arrayCollection, scaleX, scaleY, isScale, bounds.x, bounds.y, 0, 0);
|
|
1143
|
+
}
|
|
1144
|
+
else {
|
|
1145
|
+
newPathString = getPathString(arrayCollection);
|
|
1146
|
+
}
|
|
1147
|
+
isScale = false;
|
|
1148
|
+
return newPathString;
|
|
1149
|
+
};
|
|
1150
|
+
Renderer.prototype.calculatePathBounds = function (data) {
|
|
1151
|
+
// Create an SVG element
|
|
1152
|
+
var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
|
1153
|
+
document.body.appendChild(svg); // Append to the DOM to ensure rendering context
|
|
1154
|
+
// Create a path element
|
|
1155
|
+
var path = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1156
|
+
path.setAttribute("d", data);
|
|
1157
|
+
svg.appendChild(path);
|
|
1158
|
+
// Get the bounding box of the path
|
|
1159
|
+
var bounds = path.getBBox();
|
|
1160
|
+
// Remove the temporary SVG element
|
|
1161
|
+
svg.remove();
|
|
1162
|
+
var svgBounds = new Rect(bounds.x, bounds.y, bounds.width, bounds.height);
|
|
1163
|
+
return svgBounds;
|
|
1164
|
+
};
|
|
1165
|
+
Renderer.prototype.setStyle = function (shape) {
|
|
1166
|
+
var ctx = this.pageContext;
|
|
1167
|
+
if (shape.lineFormat.color === 'none') {
|
|
1168
|
+
shape.lineFormat.color = 'transparent';
|
|
1169
|
+
}
|
|
1170
|
+
ctx.strokeStyle = LayoutHelperMethods.getColor(shape.lineFormat.color);
|
|
1171
|
+
ctx.lineWidth = shape.lineFormat.weight;
|
|
1172
|
+
if (shape.lineFormat.weight === 0) {
|
|
1173
|
+
ctx.strokeStyle = 'transparent';
|
|
1174
|
+
}
|
|
1175
|
+
this.setShapeLineDash(shape);
|
|
1176
|
+
//ctx.globalAlpha = style.opacity;
|
|
1177
|
+
};
|
|
1178
|
+
Renderer.prototype.setShapeLineDash = function (shape) {
|
|
1179
|
+
var w = shape.lineFormat.weight;
|
|
1180
|
+
var gap = 3 * w;
|
|
1181
|
+
var pattern = [];
|
|
1182
|
+
switch (shape.lineFormat.dashStyle) {
|
|
1183
|
+
case 'Dot':
|
|
1184
|
+
pattern = [1.25 * w, w];
|
|
1185
|
+
break;
|
|
1186
|
+
case 'DotGEL':
|
|
1187
|
+
pattern = [4.5 * w, 3 * w];
|
|
1188
|
+
break;
|
|
1189
|
+
case 'Dash':
|
|
1190
|
+
pattern = [4 * w, 1.5 * w];
|
|
1191
|
+
break;
|
|
1192
|
+
case 'DashGEL':
|
|
1193
|
+
pattern = [4.5 * w, 3.5 * w];
|
|
1194
|
+
break;
|
|
1195
|
+
case 'DashDot':
|
|
1196
|
+
case 'DashDotGEL':
|
|
1197
|
+
pattern = [4.5 * w, 1.25 * gap, w, 1.25 * gap];
|
|
1198
|
+
break;
|
|
1199
|
+
case 'DashDotDot':
|
|
1200
|
+
pattern = [4.5 * w, gap, w, gap, w, gap];
|
|
1201
|
+
break;
|
|
1202
|
+
case 'LongDashGEL':
|
|
1203
|
+
pattern = [9 * w, gap];
|
|
1204
|
+
break;
|
|
1205
|
+
case 'LongDashDotGEL':
|
|
1206
|
+
pattern = [9.5 * w, 1.25 * gap, w, 1.25 * gap];
|
|
1207
|
+
break;
|
|
1208
|
+
case 'LongDashDotDotGEL':
|
|
1209
|
+
pattern = [9.5 * w, gap, w, 1.25 * gap, w, 1.25 * gap];
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
this.pageContext.setLineDash(w > 0 ? pattern : []);
|
|
1213
|
+
};
|
|
1214
|
+
Renderer.prototype.renderLockRegionBorder = function (page, widget) {
|
|
1215
|
+
if (!widget.isInsideTable && widget instanceof BlockWidget && widget.locked) {
|
|
1216
|
+
var settinsModel = this.documentHelper.documentEditorSettings.collaborativeEditingSettings;
|
|
1217
|
+
var sectionFormat = page.bodyWidgets[0].sectionFormat;
|
|
1218
|
+
var leftPosition = LayoutHelperMethods.convertPointToPixel(sectionFormat.leftMargin) - 5;
|
|
1219
|
+
var pageWidth = sectionFormat.pageWidth - sectionFormat.leftMargin - sectionFormat.rightMargin;
|
|
1220
|
+
pageWidth = LayoutHelperMethods.convertPointToPixel(pageWidth) + 10;
|
|
1221
|
+
if (this.viewer instanceof WebLayoutHelper) {
|
|
1222
|
+
leftPosition = widget.x - 5;
|
|
1223
|
+
pageWidth = (this.documentHelper.visibleBounds.width - (this.viewer.padding.right * 5)) / this.documentHelper.zoomFactor;
|
|
1224
|
+
}
|
|
1225
|
+
var previousWidget = widget.previousRenderedWidget;
|
|
1226
|
+
var nextWidget = widget.nextRenderedWidget;
|
|
1227
|
+
var color = widget.lockedBy === this.documentHelper.editorProperties.currentUser ? settinsModel.editableRegionColor : settinsModel.lockedRegionColor;
|
|
1228
|
+
var topPosition = widget.y;
|
|
1229
|
+
var height = widget.y + widget.height;
|
|
1230
|
+
//Left border
|
|
1231
|
+
this.renderSingleBorder(color, leftPosition, topPosition, leftPosition, height, 1, "Single");
|
|
1232
|
+
//Top border
|
|
1233
|
+
if (isNullOrUndefined(previousWidget) || !previousWidget.locked || widget.lockedBy !== previousWidget.lockedBy) {
|
|
1234
|
+
this.renderSingleBorder(color, leftPosition, topPosition, leftPosition + pageWidth, topPosition, 1, "Single");
|
|
1235
|
+
}
|
|
1236
|
+
//Right border
|
|
1237
|
+
this.renderSingleBorder(color, leftPosition + pageWidth, topPosition, leftPosition + pageWidth, height, 1, "Single");
|
|
1238
|
+
if (isNullOrUndefined(nextWidget) || !nextWidget.locked || widget.lockedBy !== nextWidget.lockedBy) {
|
|
1239
|
+
// Bottom border
|
|
1240
|
+
this.renderSingleBorder(color, leftPosition, height, leftPosition + pageWidth, height, 1, "Single");
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
Renderer.prototype.renderHeader = function (page, widget, header) {
|
|
1245
|
+
if (isNullOrUndefined(header)) {
|
|
1246
|
+
return;
|
|
1247
|
+
}
|
|
1248
|
+
//Updated client area for current page
|
|
1249
|
+
page.viewer.updateClientArea(page.bodyWidgets[0], page);
|
|
1250
|
+
var isMultiColumn = false;
|
|
1251
|
+
if (widget.containerWidget instanceof BodyWidget && widget.containerWidget.sectionFormat.columns.length > 1) {
|
|
1252
|
+
isMultiColumn = true;
|
|
1253
|
+
}
|
|
1254
|
+
// In multi-column layout, the table is already positioned below the repeated header area, so the header starts at the top of the owning column.
|
|
1255
|
+
var top = isMultiColumn ? widget.containerWidget.y : page.viewer.clientArea.y;
|
|
1256
|
+
var parentTable = header.ownerTable.getSplitWidgets()[0];
|
|
1257
|
+
if (parentTable.childWidgets.length === 0) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
if (widget.childWidgets.indexOf(header) !== -1) {
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1263
|
+
var table = parentTable.clone(true);
|
|
1264
|
+
if (this.documentHelper.isEditorModule) {
|
|
1265
|
+
this.documentHelper.editorProperties.constructRevisionsForTable(table, true);
|
|
1266
|
+
}
|
|
1267
|
+
table.childWidgets = [];
|
|
1268
|
+
page.viewer.updateClientAreaLocation(table, new Rect(isMultiColumn ? widget.x : page.viewer.clientArea.x, top, table.width, table.height));
|
|
1269
|
+
this.updateTableHeaderRows(header, table, page, top, isMultiColumn ? widget.x : page.viewer.clientArea.x, isMultiColumn);
|
|
1270
|
+
this.isRenderHeader = true;
|
|
1271
|
+
for (var j = 0; j < table.childWidgets.length; j++) {
|
|
1272
|
+
var headerWidget = table.childWidgets[j];
|
|
1273
|
+
var cell = undefined;
|
|
1274
|
+
//Renders table cell outline rectangle - Border and background color.
|
|
1275
|
+
for (var j_1 = 0; j_1 < headerWidget.childWidgets.length; j_1++) {
|
|
1276
|
+
cell = headerWidget.childWidgets[j_1];
|
|
1277
|
+
this.renderTableCellWidget(page, cell);
|
|
1278
|
+
}
|
|
1279
|
+
top += headerWidget.height;
|
|
1280
|
+
}
|
|
1281
|
+
this.isRenderHeader = false;
|
|
1282
|
+
if (widget.y !== top) {
|
|
1283
|
+
//this.Location.Y = top;
|
|
1284
|
+
page.documentHelper.layout.updateChildLocationForTable(top, widget, undefined, false, isMultiColumn);
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
Renderer.prototype.updateClonedRowLocation = function (page, clonedRow, top, isMultiColumn) {
|
|
1288
|
+
var previousX = [];
|
|
1289
|
+
for (var i = 0; i < clonedRow.childWidgets.length; i++) {
|
|
1290
|
+
previousX.push(clonedRow.childWidgets[i].x);
|
|
1291
|
+
}
|
|
1292
|
+
page.documentHelper.layout.updateChildLocationForRow(top, clonedRow, undefined, false, isMultiColumn);
|
|
1293
|
+
if (!isMultiColumn || clonedRow.childWidgets.length === 0) {
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1296
|
+
// In multi-column layout, the cloned header cells are moved to the column of the current page.
|
|
1297
|
+
// The cells keep their left margin offset from the row, and their content moves along with them.
|
|
1298
|
+
var offset = clonedRow.x + clonedRow.childWidgets[0].margin.left - previousX[0];
|
|
1299
|
+
for (var i = 0; i < clonedRow.childWidgets.length; i++) {
|
|
1300
|
+
var cell = clonedRow.childWidgets[i];
|
|
1301
|
+
cell.x = previousX[i] + offset;
|
|
1302
|
+
for (var j = 0; j < cell.childWidgets.length; j++) {
|
|
1303
|
+
page.documentHelper.layout.shiftXPosition(cell.childWidgets[j], offset);
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1307
|
+
Renderer.prototype.updateTableHeaderRows = function (headerRow, clonedTable, page, top, left, isMultiColumn) {
|
|
1308
|
+
var table = headerRow.ownerTable;
|
|
1309
|
+
var rowSpan = 1;
|
|
1310
|
+
for (var i = 0; i < table.childWidgets.length; i++) {
|
|
1311
|
+
var row = table.childWidgets[i];
|
|
1312
|
+
if (row.rowFormat.isHeader) {
|
|
1313
|
+
var clonedRow = row.clone(true);
|
|
1314
|
+
if (this.documentHelper.isEditorModule) {
|
|
1315
|
+
this.documentHelper.editorProperties.constructRevisionFromID(clonedRow.rowFormat);
|
|
1316
|
+
}
|
|
1317
|
+
clonedTable.childWidgets.push(clonedRow);
|
|
1318
|
+
clonedRow.containerWidget = clonedTable;
|
|
1319
|
+
page.viewer.updateClientAreaLocation(clonedRow, new Rect(left, top, clonedRow.width, clonedRow.height));
|
|
1320
|
+
this.updateClonedRowLocation(page, clonedRow, top, isMultiColumn);
|
|
1321
|
+
top += clonedRow.height;
|
|
1322
|
+
if (row == headerRow) {
|
|
1323
|
+
for (var j = 0; j < headerRow.childWidgets.length; j++) {
|
|
1324
|
+
var cell = headerRow.childWidgets[j];
|
|
1325
|
+
rowSpan = Math.max(rowSpan, cell.cellFormat.rowSpan);
|
|
1326
|
+
}
|
|
1327
|
+
if (rowSpan > 1 && i + rowSpan < table.childWidgets.length) {
|
|
1328
|
+
for (var k = 1; k < rowSpan; k++) {
|
|
1329
|
+
var nextRow = table.childWidgets[i + k];
|
|
1330
|
+
if (!isNullOrUndefined(nextRow)) {
|
|
1331
|
+
var clonedRow_1 = nextRow.clone();
|
|
1332
|
+
if (this.documentHelper.isEditorModule) {
|
|
1333
|
+
this.documentHelper.editorProperties.constructRevisionFromID(clonedRow_1.rowFormat);
|
|
1334
|
+
}
|
|
1335
|
+
clonedTable.childWidgets.push(clonedRow_1);
|
|
1336
|
+
clonedRow_1.containerWidget = clonedTable;
|
|
1337
|
+
page.viewer.updateClientAreaLocation(clonedRow_1, new Rect(left, top, clonedRow_1.width, clonedRow_1.height));
|
|
1338
|
+
this.updateClonedRowLocation(page, clonedRow_1, top, isMultiColumn);
|
|
1339
|
+
top += clonedRow_1.height;
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
Renderer.prototype.renderParagraphWidget = function (page, paraWidget) {
|
|
1348
|
+
if (this.isFieldCode && paraWidget.isFieldCodeBlock) {
|
|
1349
|
+
return;
|
|
1350
|
+
}
|
|
1351
|
+
var top = paraWidget.y;
|
|
1352
|
+
var left = paraWidget.x;
|
|
1353
|
+
var isClipped = false;
|
|
1354
|
+
var firstLine = paraWidget.firstChild;
|
|
1355
|
+
var paddingLeft = 0;
|
|
1356
|
+
if (!isNullOrUndefined(firstLine)) {
|
|
1357
|
+
for (var i = 0; i < firstLine.children.length; i++) {
|
|
1358
|
+
var element = firstLine.children[i];
|
|
1359
|
+
if (element instanceof TextElementBox) {
|
|
1360
|
+
paddingLeft = element.padding.left;
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
if (paddingLeft > 0) {
|
|
1366
|
+
this.clipRect(paraWidget.x + paddingLeft, this.getScaledValue(page.boundingRectangle.y), this.getScaledValue(page.boundingRectangle.width), this.getScaledValue(page.boundingRectangle.height));
|
|
1367
|
+
isClipped = true;
|
|
1368
|
+
}
|
|
1369
|
+
if (!(paraWidget.containerWidget instanceof HeaderFooterWidget && paraWidget.containerWidget.isEmpty && !this.documentHelper.isSelectionInHeaderFooter)) {
|
|
1370
|
+
this.renderParagraphBorder(page, paraWidget);
|
|
1371
|
+
}
|
|
1372
|
+
if (isClipped) {
|
|
1373
|
+
this.pageContext.restore();
|
|
1374
|
+
}
|
|
1375
|
+
for (var i = 0; i < paraWidget.childWidgets.length; i++) {
|
|
1376
|
+
var widget = paraWidget.childWidgets[i];
|
|
1377
|
+
top += widget.marginTop;
|
|
1378
|
+
if (!widget.isFirstLine() && paraWidget.previousRenderedWidget && paraWidget.previousRenderedWidget instanceof ParagraphWidget && this.documentHelper.layout.isMergedWithNextParagraph(paraWidget.previousRenderedWidget)) {
|
|
1379
|
+
left = page.viewer.clientArea.x;
|
|
1380
|
+
}
|
|
1381
|
+
this.renderLine(widget, page, left, top);
|
|
1382
|
+
top += widget.height;
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
Renderer.prototype.renderParagraphBorder = function (page, paragraphWidet) {
|
|
1386
|
+
var leftBorder = paragraphWidet.paragraphFormat.borders.left;
|
|
1387
|
+
var topBorder = paragraphWidet.paragraphFormat.borders.top;
|
|
1388
|
+
var rightBorder = paragraphWidet.paragraphFormat.borders.right;
|
|
1389
|
+
var bottomBorder = paragraphWidet.paragraphFormat.borders.bottom;
|
|
1390
|
+
var startX = 0;
|
|
1391
|
+
var startY = 0;
|
|
1392
|
+
var endX = 0;
|
|
1393
|
+
var endY = 0;
|
|
1394
|
+
var lineWidth = 0;
|
|
1395
|
+
var firstLine = paragraphWidet.firstChild;
|
|
1396
|
+
var lastLine = paragraphWidet.lastChild;
|
|
1397
|
+
var bottomMargin = this.getBottomMargin(paragraphWidet);
|
|
1398
|
+
var sumOfLineHeights = 0;
|
|
1399
|
+
for (var i = 0; i < paragraphWidet.childWidgets.length; i++) {
|
|
1400
|
+
sumOfLineHeights += paragraphWidet.childWidgets[i].height;
|
|
1401
|
+
}
|
|
1402
|
+
var paraHeight = Number(paragraphWidet.height.toFixed(2));
|
|
1403
|
+
sumOfLineHeights = Number(sumOfLineHeights.toFixed(2));
|
|
1404
|
+
if (sumOfLineHeights > paraHeight) {
|
|
1405
|
+
var heightDifference = sumOfLineHeights - paraHeight;
|
|
1406
|
+
bottomMargin = bottomMargin - heightDifference;
|
|
1407
|
+
}
|
|
1408
|
+
var canRenderParagraphBorders = this.documentHelper.canRenderBorder(paragraphWidet);
|
|
1409
|
+
if (!isNullOrUndefined(leftBorder) && leftBorder.lineStyle !== 'None') {
|
|
1410
|
+
startX = this.documentHelper.getParagraphLeftPosition(paragraphWidet) - LayoutHelperMethods.convertPointToPixel(leftBorder.space + leftBorder.lineWidth);
|
|
1411
|
+
if (paragraphWidet.containerWidget instanceof TextFrame) {
|
|
1412
|
+
var shape = paragraphWidet.containerWidget.containerShape;
|
|
1413
|
+
if (shape.x > startX) {
|
|
1414
|
+
startX += LayoutHelperMethods.convertPointToPixel(leftBorder.lineWidth);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
endX = startX;
|
|
1418
|
+
endY = startY + paragraphWidet.height;
|
|
1419
|
+
if (topBorder.lineStyle !== 'None' && firstLine.isFirstLine() && !canRenderParagraphBorders.skipTopBorder) {
|
|
1420
|
+
startY = paragraphWidet.y + this.getTopMargin(paragraphWidet) - (LayoutHelperMethods.convertPointToPixel(topBorder.lineWidth + topBorder.space));
|
|
1421
|
+
endY = startY + paragraphWidet.height - (this.getTopMargin(paragraphWidet) - (LayoutHelperMethods.convertPointToPixel(topBorder.lineWidth + topBorder.space)));
|
|
1422
|
+
}
|
|
1423
|
+
else {
|
|
1424
|
+
startY = paragraphWidet.y;
|
|
1425
|
+
endY = startY + paragraphWidet.height;
|
|
1426
|
+
}
|
|
1427
|
+
if (bottomBorder.lineStyle !== 'None' && lastLine.isLastLine() && !canRenderParagraphBorders.skipBottomBorder) {
|
|
1428
|
+
endY = (endY + LayoutHelperMethods.convertPointToPixel(bottomBorder.lineWidth + bottomBorder.space)) - bottomMargin;
|
|
1429
|
+
}
|
|
1430
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(leftBorder.lineWidth);
|
|
1431
|
+
this.renderSingleBorder(leftBorder.color, startX, startY, endX, endY, lineWidth, leftBorder.lineStyle);
|
|
1432
|
+
}
|
|
1433
|
+
if (!isNullOrUndefined(topBorder) && topBorder.lineStyle !== 'None' && firstLine.isFirstLine() && !canRenderParagraphBorders.skipTopBorder) {
|
|
1434
|
+
startX = this.documentHelper.getParagraphLeftPosition(paragraphWidet);
|
|
1435
|
+
endX = startX + this.getContainerWidth(paragraphWidet, page);
|
|
1436
|
+
startY = paragraphWidet.y + this.getTopMargin(paragraphWidet) - (LayoutHelperMethods.convertPointToPixel(topBorder.lineWidth + topBorder.space));
|
|
1437
|
+
endY = startY;
|
|
1438
|
+
if (leftBorder.lineStyle !== 'None') {
|
|
1439
|
+
startX -= LayoutHelperMethods.convertPointToPixel(leftBorder.space + leftBorder.lineWidth);
|
|
1440
|
+
}
|
|
1441
|
+
if (rightBorder.lineStyle !== 'None') {
|
|
1442
|
+
endX += LayoutHelperMethods.convertPointToPixel(rightBorder.space + rightBorder.lineWidth);
|
|
1443
|
+
}
|
|
1444
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(topBorder.lineWidth);
|
|
1445
|
+
this.renderSingleBorder(topBorder.color, startX, startY, endX, endY, lineWidth, topBorder.lineStyle);
|
|
1446
|
+
}
|
|
1447
|
+
if (!isNullOrUndefined(rightBorder) && rightBorder.lineStyle !== 'None') {
|
|
1448
|
+
startX = this.documentHelper.getParagraphLeftPosition(paragraphWidet) + this.getContainerWidth(paragraphWidet, page) + LayoutHelperMethods.convertPointToPixel(rightBorder.space + rightBorder.lineWidth);
|
|
1449
|
+
if (paragraphWidet.containerWidget instanceof TextFrame) {
|
|
1450
|
+
var shape = paragraphWidet.containerWidget.containerShape;
|
|
1451
|
+
if (shape.x + shape.width < startX) {
|
|
1452
|
+
startX -= LayoutHelperMethods.convertPointToPixel(rightBorder.lineWidth);
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
startY = endY;
|
|
1456
|
+
endX = startX;
|
|
1457
|
+
endY = startY + paragraphWidet.height;
|
|
1458
|
+
if (topBorder.lineStyle !== 'None' && firstLine.isFirstLine() && !canRenderParagraphBorders.skipTopBorder) {
|
|
1459
|
+
startY = paragraphWidet.y + this.getTopMargin(paragraphWidet) - (LayoutHelperMethods.convertPointToPixel(topBorder.lineWidth + topBorder.space));
|
|
1460
|
+
endY = startY + paragraphWidet.height - (this.getTopMargin(paragraphWidet) - (LayoutHelperMethods.convertPointToPixel(topBorder.lineWidth + topBorder.space)));
|
|
1461
|
+
}
|
|
1462
|
+
else {
|
|
1463
|
+
startY = paragraphWidet.y;
|
|
1464
|
+
endY = startY + paragraphWidet.height;
|
|
1465
|
+
}
|
|
1466
|
+
if (bottomBorder.lineStyle !== 'None' && lastLine.isLastLine() && !canRenderParagraphBorders.skipBottomBorder) {
|
|
1467
|
+
endY = (endY + LayoutHelperMethods.convertPointToPixel(bottomBorder.lineWidth + bottomBorder.space)) - bottomMargin;
|
|
1468
|
+
}
|
|
1469
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(rightBorder.lineWidth);
|
|
1470
|
+
this.renderSingleBorder(rightBorder.color, startX, startY, endX, endY, lineWidth, rightBorder.lineStyle);
|
|
1471
|
+
}
|
|
1472
|
+
if (!isNullOrUndefined(bottomBorder) && bottomBorder.lineStyle !== 'None' && lastLine.isLastLine() && !canRenderParagraphBorders.skipBottomBorder) {
|
|
1473
|
+
startX = this.documentHelper.getParagraphLeftPosition(paragraphWidet);
|
|
1474
|
+
endX = startX + this.getContainerWidth(paragraphWidet, page);
|
|
1475
|
+
startY = (paragraphWidet.y + paragraphWidet.height + LayoutHelperMethods.convertPointToPixel(bottomBorder.lineWidth + bottomBorder.space)) - (bottomMargin);
|
|
1476
|
+
endY = startY;
|
|
1477
|
+
if (leftBorder.lineStyle !== 'None') {
|
|
1478
|
+
startX -= LayoutHelperMethods.convertPointToPixel(leftBorder.space + leftBorder.lineWidth);
|
|
1479
|
+
}
|
|
1480
|
+
if (rightBorder.lineStyle !== 'None') {
|
|
1481
|
+
endX += LayoutHelperMethods.convertPointToPixel(rightBorder.space + rightBorder.lineWidth);
|
|
1482
|
+
}
|
|
1483
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(bottomBorder.lineWidth);
|
|
1484
|
+
this.renderSingleBorder(bottomBorder.color, startX, startY, endX, endY, lineWidth, bottomBorder.lineStyle);
|
|
1485
|
+
}
|
|
1486
|
+
};
|
|
1487
|
+
/**
|
|
1488
|
+
* Renders the border around a TextElementBox.
|
|
1489
|
+
* @param elementBox - The TextElementBox for which the border is rendered.
|
|
1490
|
+
* @param left - The left position of the TextElementBox.
|
|
1491
|
+
* @param top - The top position of the TextElementBox.
|
|
1492
|
+
* @param color - The color of the border.
|
|
1493
|
+
* @param borderStyle - The style of the border (e.g., 'Single', 'Double').
|
|
1494
|
+
* @param borderWidth - The width of the border.
|
|
1495
|
+
* @param baselineAlignment - The baseline alignment of the TextElementBox.
|
|
1496
|
+
* @param revisionInfo - Revision information (optional).
|
|
1497
|
+
*/
|
|
1498
|
+
Renderer.prototype.renderImgBorder = function (elementBox, left, top, color, borderStyle, borderWidth, baselineAlignment, revisionInfo) {
|
|
1499
|
+
// Get the width dynamically based on the current text content
|
|
1500
|
+
var width = (elementBox.width) / this.documentHelper.zoomFactor;
|
|
1501
|
+
var lineWidth = LayoutHelperMethods.convertPointToPixel(borderWidth);
|
|
1502
|
+
var next = this.documentHelper.editorProperties.getNextTextElement(elementBox);
|
|
1503
|
+
var previous = this.documentHelper.editorProperties.getPreviousTextElement(elementBox);
|
|
1504
|
+
// Calculate top margin based on baseline alignment
|
|
1505
|
+
var topMargin = (baselineAlignment === 'Subscript') ? elementBox.margin.top + (elementBox.height - elementBox.height / 1.5) : elementBox.margin.top;
|
|
1506
|
+
// Apply top margin
|
|
1507
|
+
top += topMargin > 0 ? topMargin : 0;
|
|
1508
|
+
// Calculate rendered height based on baseline alignment
|
|
1509
|
+
var renderedHeight = (elementBox.height / (baselineAlignment === 'Normal' ? 1 : 1.5)) + 15;
|
|
1510
|
+
var startX = 0;
|
|
1511
|
+
var startY = 0;
|
|
1512
|
+
var endX = 0;
|
|
1513
|
+
var endY = 0;
|
|
1514
|
+
startX = left;
|
|
1515
|
+
startY = top;
|
|
1516
|
+
endX = left + width;
|
|
1517
|
+
endY = top;
|
|
1518
|
+
this.renderSingleBorder(color, startX, startY, endX, endY, lineWidth, borderStyle);
|
|
1519
|
+
// Render bottom border
|
|
1520
|
+
startY = top + renderedHeight;
|
|
1521
|
+
endY = startY;
|
|
1522
|
+
this.renderSingleBorder(color, startX, startY, endX, endY, lineWidth, borderStyle);
|
|
1523
|
+
//Render left border
|
|
1524
|
+
startY = top;
|
|
1525
|
+
endX = left;
|
|
1526
|
+
if (previous instanceof TextElementBox) {
|
|
1527
|
+
if (previous.line !== elementBox.line || previous.contentControlProperties == undefined) {
|
|
1528
|
+
borderStyle = 'Solid';
|
|
1529
|
+
}
|
|
1530
|
+
else {
|
|
1531
|
+
borderStyle = 'None';
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
this.renderSingleBorder(color, startX, startY, endX, endY, lineWidth, borderStyle);
|
|
1535
|
+
// Render right border
|
|
1536
|
+
startX = left + width;
|
|
1537
|
+
endX = startX;
|
|
1538
|
+
if (next instanceof TextElementBox) {
|
|
1539
|
+
if (next.line !== elementBox.line || next.contentControlProperties == undefined) {
|
|
1540
|
+
borderStyle = 'Solid';
|
|
1541
|
+
}
|
|
1542
|
+
else {
|
|
1543
|
+
borderStyle = 'None';
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
else {
|
|
1547
|
+
borderStyle = 'Solid';
|
|
1548
|
+
}
|
|
1549
|
+
this.renderSingleBorder(color, startX, startY, endX, endY, lineWidth, borderStyle);
|
|
1550
|
+
};
|
|
1551
|
+
Renderer.prototype.getContainerWidth = function (paraWidget, page) {
|
|
1552
|
+
var hangingIndent = 0;
|
|
1553
|
+
if (paraWidget.paragraphFormat.firstLineIndent < 0) {
|
|
1554
|
+
hangingIndent = Math.abs(paraWidget.paragraphFormat.firstLineIndent);
|
|
1555
|
+
}
|
|
1556
|
+
if (paraWidget.isInsideTable) {
|
|
1557
|
+
var cell = paraWidget.associatedCell;
|
|
1558
|
+
return (cell.width + cell.margin.left + cell.margin.right) - cell.leftBorderWidth;
|
|
1559
|
+
}
|
|
1560
|
+
else if (paraWidget.containerWidget instanceof TextFrame) {
|
|
1561
|
+
return paraWidget.width;
|
|
1562
|
+
}
|
|
1563
|
+
else {
|
|
1564
|
+
if (this.viewer instanceof WebLayoutHelper) {
|
|
1565
|
+
var indent = LayoutHelperMethods.convertPointToPixel(paraWidget.leftIndent + paraWidget.rightIndent);
|
|
1566
|
+
return (this.documentHelper.visibleBounds.width - (indent) - (this.viewer.padding.right * 4) - (this.viewer.padding.left * 2)) / this.documentHelper.zoomFactor;
|
|
1567
|
+
}
|
|
1568
|
+
else {
|
|
1569
|
+
var section = paraWidget.bodyWidget;
|
|
1570
|
+
if (section instanceof BodyWidget && section.sectionFormat.columns.length > 1) {
|
|
1571
|
+
var colIndex = section.columnIndex;
|
|
1572
|
+
return section.sectionFormat.columns[colIndex].width + LayoutHelperMethods.convertPointToPixel(hangingIndent - (paraWidget.rightIndent + paraWidget.leftIndent));
|
|
1573
|
+
}
|
|
1574
|
+
else {
|
|
1575
|
+
var width = section.sectionFormat.pageWidth - section.sectionFormat.leftMargin - section.sectionFormat.rightMargin;
|
|
1576
|
+
return LayoutHelperMethods.convertPointToPixel(width + hangingIndent - (paraWidget.rightIndent + paraWidget.leftIndent));
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1581
|
+
Renderer.prototype.getTopMargin = function (paragraph) {
|
|
1582
|
+
if (paragraph.isEmpty()) {
|
|
1583
|
+
return paragraph.childWidgets[0].margin.top;
|
|
1584
|
+
}
|
|
1585
|
+
else {
|
|
1586
|
+
var widget = paragraph.childWidgets[0];
|
|
1587
|
+
var topMargin = 0;
|
|
1588
|
+
if (!isNullOrUndefined(widget.margin)) {
|
|
1589
|
+
topMargin = widget.margin.top;
|
|
1590
|
+
}
|
|
1591
|
+
return topMargin;
|
|
1592
|
+
}
|
|
1593
|
+
};
|
|
1594
|
+
Renderer.prototype.getBottomMargin = function (paragarph) {
|
|
1595
|
+
var widget = paragarph.childWidgets[paragarph.childWidgets.length - 1];
|
|
1596
|
+
var bottomMargin = 0;
|
|
1597
|
+
if (!isNullOrUndefined(widget.margin)) {
|
|
1598
|
+
bottomMargin = widget.margin.bottom;
|
|
1599
|
+
}
|
|
1600
|
+
return bottomMargin;
|
|
1601
|
+
};
|
|
1602
|
+
Renderer.prototype.renderfootNoteWidget = function (page, footnote, width) {
|
|
1603
|
+
var isEmptyPage = footnote.page.bodyWidgets.length === 1 && ((footnote.page.bodyWidgets[0].childWidgets.length === 1
|
|
1604
|
+
&& footnote.page.bodyWidgets[0].childWidgets[0].isEmpty != undefined && footnote.page.bodyWidgets[0].childWidgets[0].isEmpty()) || footnote.page.bodyWidgets[0].childWidgets.length === 0);
|
|
1605
|
+
var footerY = this.getFooterHeight(page);
|
|
1606
|
+
var height = footnote.y + footnote.height;
|
|
1607
|
+
if (height > footerY) {
|
|
1608
|
+
height = (footerY - footnote.y);
|
|
1609
|
+
}
|
|
1610
|
+
this.pageContext.beginPath();
|
|
1611
|
+
this.pageContext.save();
|
|
1612
|
+
this.pageContext.rect(this.pageLeft, this.getScaledValue(footnote.y, 2), this.getScaledValue(width), this.getScaledValue(height));
|
|
1613
|
+
this.pageContext.clip();
|
|
1614
|
+
for (var i = 0; i < footnote.bodyWidgets.length; i++) {
|
|
1615
|
+
var bodyWidget = footnote.bodyWidgets[i];
|
|
1616
|
+
var footNoteReference = bodyWidget.footNoteReference;
|
|
1617
|
+
for (var j = 0; j < bodyWidget.childWidgets.length; j++) {
|
|
1618
|
+
var widget = bodyWidget.childWidgets[j];
|
|
1619
|
+
if (i === 0 && j === 0) {
|
|
1620
|
+
var ctx = this.pageContext;
|
|
1621
|
+
var xPos = page.bodyWidgets[0].x;
|
|
1622
|
+
if (page.bodyWidgets.length > 1 && !isNullOrUndefined(bodyWidget.nextWidget) && !(bodyWidget.nextWidget.sectionFormat.breakCode === 'NoBreak')) {
|
|
1623
|
+
var footWidth = page.bodyWidgets[0].width;
|
|
1624
|
+
this.renderSolidLine(ctx, this.getScaledValue(xPos, 1), this.getScaledValue(footnote.y + (footnote.margin.top / 2) + 1, 2), footWidth * this.documentHelper.zoomFactor, '#000000');
|
|
1625
|
+
}
|
|
1626
|
+
else {
|
|
1627
|
+
var footNoteRightAlign = false;
|
|
1628
|
+
if (this.documentHelper.footnotes.separator.length > 0 && this.documentHelper.footnotes.separator[0] instanceof ParagraphWidget) {
|
|
1629
|
+
var separatorPara = this.documentHelper.footnotes.separator[0];
|
|
1630
|
+
if (separatorPara.paragraphFormat.bidi || separatorPara.paragraphFormat.textAlignment === "Right") {
|
|
1631
|
+
footNoteRightAlign = true;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
var footNotePosition = footNoteRightAlign ? (xPos + page.bodyWidgets[0].width - (210 * this.documentHelper.zoomFactor)) : xPos;
|
|
1635
|
+
this.renderSolidLine(ctx, this.getScaledValue(footNotePosition, 1), this.getScaledValue(footnote.y + (footnote.margin.top / 2) + 1, 2), 210 * this.documentHelper.zoomFactor, '#000000');
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
if (!isNullOrUndefined(footNoteReference) && !isNullOrUndefined(this.documentHelper.editorProperties) && !this.documentHelper.editorProperties.isFootNoteInsert) {
|
|
1639
|
+
//if (j < 1 || (j > 0 && widget.footNoteReference !== (bodyWidget.childWidgets[j - 1] as BlockWidget).footNoteReference)) {
|
|
1640
|
+
var paragraph = this.documentHelper.getFirstParagraphBlock(widget);
|
|
1641
|
+
if (paragraph.firstChild.children[0] instanceof TextElementBox) {
|
|
1642
|
+
var footNoteElement = paragraph.firstChild.children[0];
|
|
1643
|
+
if (footNoteElement.text === '\u0002') {
|
|
1644
|
+
footNoteElement.text = footNoteElement.text.replace(footNoteElement.text, footNoteReference.text);
|
|
1645
|
+
footNoteElement.width = footNoteReference.width;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
//}
|
|
1649
|
+
}
|
|
1650
|
+
this.renderWidget(page, widget);
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
this.pageContext.restore();
|
|
1654
|
+
};
|
|
1655
|
+
Renderer.prototype.renderTableWidget = function (page, tableWidget) {
|
|
1656
|
+
if (this.isFieldCode || isNullOrUndefined(tableWidget)) {
|
|
1657
|
+
return;
|
|
1658
|
+
}
|
|
1659
|
+
for (var i = 0; i < tableWidget.childWidgets.length; i++) {
|
|
1660
|
+
var widget = tableWidget.childWidgets[i];
|
|
1661
|
+
this.renderTableRowWidget(page, widget);
|
|
1662
|
+
if (tableWidget.tableFormat.cellSpacing > 0) {
|
|
1663
|
+
this.renderTableOutline(page, tableWidget);
|
|
1664
|
+
}
|
|
1665
|
+
if (widget.isRenderBookmarkEnd && this.documentHelper.documentEditorSettings.showBookmarks) {
|
|
1666
|
+
var cellWidget = widget.lastChild;
|
|
1667
|
+
var border = cellWidget.ownerTable.isBidiTable ? TableCellWidget.getCellLeftBorder(cellWidget) : TableCellWidget.getCellRightBorder(cellWidget);
|
|
1668
|
+
var lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
1669
|
+
var lastPara = this.documentHelper.editorProperties.getLastParagraph(widget.lastChild);
|
|
1670
|
+
var height = lastPara.lastChild.height - lastPara.lastChild.margin.bottom;
|
|
1671
|
+
this.renderBookmark(this.getScaledValue((cellWidget.x + cellWidget.width + cellWidget.margin.right - lineWidth / 2) + this.documentHelper.textHelper.getParagraphMarkWidth(lastPara.characterFormat), 1), this.getScaledValue(cellWidget.y - cellWidget.margin.top, 2), this.getScaledValue(height), 1);
|
|
1672
|
+
}
|
|
1673
|
+
}
|
|
1674
|
+
};
|
|
1675
|
+
Renderer.prototype.renderTableRowWidget = function (page, rowWidget) {
|
|
1676
|
+
for (var i = 0; i < rowWidget.childWidgets.length; i++) {
|
|
1677
|
+
var widget = rowWidget.childWidgets[i];
|
|
1678
|
+
this.renderTableCellWidget(page, widget);
|
|
1679
|
+
if (widget.isRenderBookmarkEnd && this.documentHelper.documentEditorSettings.showBookmarks) {
|
|
1680
|
+
var lastPara = this.documentHelper.editorProperties.getLastParagraph(widget);
|
|
1681
|
+
var lastLine = lastPara.lastChild;
|
|
1682
|
+
var position = this.documentHelper.editorProperties.getEndPosition(lastPara);
|
|
1683
|
+
var yPosition = lastPara.y + lastLine.margin.top;
|
|
1684
|
+
this.renderBookmark(this.getScaledValue(position.x, 1), this.getScaledValue(yPosition, 2), (this.getScaledValue(lastLine.height - (lastLine.margin.bottom + lastLine.margin.top)) - 2), 1);
|
|
1685
|
+
}
|
|
1686
|
+
}
|
|
1687
|
+
};
|
|
1688
|
+
Renderer.prototype.renderTableCellWidget = function (page, cellWidget) {
|
|
1689
|
+
if (!this.isPrinting && !this.isExporting) {
|
|
1690
|
+
var cellTopMargin = 0;
|
|
1691
|
+
var cellBottomMargin = 0;
|
|
1692
|
+
cellTopMargin = cellWidget.margin.top - cellWidget.containerWidget.topBorderWidth;
|
|
1693
|
+
cellBottomMargin = cellWidget.margin.bottom - cellWidget.containerWidget.bottomBorderWidth;
|
|
1694
|
+
if ((this.getScaledValue(cellWidget.y, 2) + cellWidget.height + cellBottomMargin * this.documentHelper.zoomFactor < 0 ||
|
|
1695
|
+
(this.getScaledValue(cellWidget.y, 2) - cellTopMargin > this.documentHelper.visibleBounds.height)) &&
|
|
1696
|
+
!this.documentHelper.isSpellCheck) {
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
var widgetHeight = 0;
|
|
1701
|
+
this.renderSelectionHighlightOnTable(page, cellWidget);
|
|
1702
|
+
this.renderTableCellOutline(page.documentHelper, cellWidget);
|
|
1703
|
+
for (var i = 0; i < cellWidget.childWidgets.length; i++) {
|
|
1704
|
+
var widget = cellWidget.childWidgets[i];
|
|
1705
|
+
// MS word render the content in right margin also.
|
|
1706
|
+
// So, we need to add right margin value while cliping the content
|
|
1707
|
+
var width = (cellWidget.width + cellWidget.margin.left + cellWidget.margin.right) - cellWidget.leftBorderWidth;
|
|
1708
|
+
if (!this.isPrinting && !(widget instanceof TableWidget && width === widget.width && this.documentHelper.compatibilityMode === 'Word2007')) {
|
|
1709
|
+
this.clipRect(cellWidget.x - cellWidget.margin.left, cellWidget.y, this.getScaledValue(width), this.height);
|
|
1710
|
+
}
|
|
1711
|
+
this.renderWidget(page, widget);
|
|
1712
|
+
this.pageContext.restore();
|
|
1713
|
+
}
|
|
1714
|
+
if (cellWidget.isRenderEditRangeStart) {
|
|
1715
|
+
var firstPara = this.documentHelper.editorProperties.getFirstParagraph(cellWidget);
|
|
1716
|
+
var firstLine = firstPara.firstChild;
|
|
1717
|
+
var xLeft = firstLine.paragraph.x;
|
|
1718
|
+
if (firstLine.children.length > 0 && !isNullOrUndefined(firstLine.children[0].margin) && firstLine.children[0].margin.left > 0) {
|
|
1719
|
+
xLeft += firstLine.children[0].margin.left;
|
|
1720
|
+
}
|
|
1721
|
+
var ytop = firstLine.paragraph.y;
|
|
1722
|
+
if (this.documentHelper.documentEditorSettings.highlightEditableRanges) {
|
|
1723
|
+
var highlighters = this.documentHelper.editorProperties.editRegionHighlighters;
|
|
1724
|
+
var widgetInfo = !isNullOrUndefined(highlighters) ? highlighters.get(firstLine) : [];
|
|
1725
|
+
var color = !isNullOrUndefined(widgetInfo) && !isNullOrUndefined(widgetInfo[0]) ? widgetInfo[0].color : "ffff00";
|
|
1726
|
+
this.renderBookmark(this.getScaledValue(xLeft, 1), this.getScaledValue(ytop, 2), this.getScaledValue(firstLine.height - firstLine.margin.bottom), 0, color);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
//Commented out the following code as part of bug fix (BUG-935678):The Editable region start marker rendering issue when the paragraph has a left margin.
|
|
1730
|
+
//As per Microsoft Word behavior, when a cell, row, or table contains an editable element, the edit range end element should not be rendered for each cell.
|
|
1731
|
+
// To align with this behavior, we have disabled this logic.
|
|
1732
|
+
// if (cellWidget.isRenderEditRangeEnd) {
|
|
1733
|
+
// let lastPara: ParagraphWidget = this.documentHelper.selection.getLastParagraph(cellWidget) as ParagraphWidget;
|
|
1734
|
+
// let lastLine: LineWidget = lastPara.lastChild as LineWidget;
|
|
1735
|
+
// let position: Point = this.documentHelper.selection.getEndPosition(lastPara);
|
|
1736
|
+
// let xLeft = this.documentHelper.textHelper.getWidth(String.fromCharCode(164), lastLine.paragraph.characterFormat) + position.x;
|
|
1737
|
+
// if(this.documentHelper.documentEditorSettings.highlightEditableRanges){
|
|
1738
|
+
// let highlighters = this.documentHelper.selection.editRegionHighlighters;
|
|
1739
|
+
// let widgetInfo : SelectionWidgetInfo[]= !isNullOrUndefined(highlighters)? highlighters.get(lastLine) : [];
|
|
1740
|
+
// let color : string = !isNullOrUndefined(widgetInfo) && !isNullOrUndefined(widgetInfo[0])? widgetInfo[0].color : "ffff00";
|
|
1741
|
+
// this.renderBookmark(this.getScaledValue(xLeft, 1),this.getScaledValue(position.y, 2),this.getScaledValue(lastLine.height - lastLine.margin.bottom),0,color);
|
|
1742
|
+
// }
|
|
1743
|
+
// }
|
|
1744
|
+
};
|
|
1745
|
+
/**
|
|
1746
|
+
* The hierarchical index of a line inside a shape's text frame does not include the paragraph and line positions
|
|
1747
|
+
* within the frame, so every line of the frame shares one index. Compare those positions explicitly to match only the selected line.
|
|
1748
|
+
*/
|
|
1749
|
+
Renderer.prototype.isSameLinePositionInTextFrame = function (selectedLine, currentLine) {
|
|
1750
|
+
var selectedPara = selectedLine.paragraph;
|
|
1751
|
+
var currentPara = currentLine.paragraph;
|
|
1752
|
+
if (!(selectedPara.containerWidget instanceof TextFrame) || !(currentPara.containerWidget instanceof TextFrame)) {
|
|
1753
|
+
return true;
|
|
1754
|
+
}
|
|
1755
|
+
return selectedPara.childWidgets.indexOf(selectedLine) === currentPara.childWidgets.indexOf(currentLine)
|
|
1756
|
+
&& selectedPara.containerWidget.childWidgets.indexOf(selectedPara) === currentPara.containerWidget.childWidgets.indexOf(currentPara);
|
|
1757
|
+
};
|
|
1758
|
+
Renderer.prototype.checkHeaderFooterLineWidget = function (widget, keys) {
|
|
1759
|
+
var headerFooter;
|
|
1760
|
+
if (widget instanceof LineWidget) {
|
|
1761
|
+
headerFooter = widget.paragraph.bodyWidget;
|
|
1762
|
+
}
|
|
1763
|
+
else if (widget instanceof TableCellWidget) {
|
|
1764
|
+
headerFooter = widget.bodyWidget;
|
|
1765
|
+
}
|
|
1766
|
+
if (!isNullOrUndefined(headerFooter.parentHeaderFooter)) {
|
|
1767
|
+
headerFooter = headerFooter.parentHeaderFooter;
|
|
1768
|
+
for (var j = 0; j < keys.length; j++) {
|
|
1769
|
+
var selectedWidget = keys[j];
|
|
1770
|
+
if (selectedWidget instanceof LineWidget && widget instanceof LineWidget) {
|
|
1771
|
+
var parentIndex = selectedWidget.getHierarchicalIndex('');
|
|
1772
|
+
var currentLineIndex = widget.getHierarchicalIndex('');
|
|
1773
|
+
if (selectedWidget.paragraph.isInHeaderFooter && headerFooter === selectedWidget.paragraph.bodyWidget
|
|
1774
|
+
&& parentIndex.substring(parentIndex.indexOf(';')) === currentLineIndex.substring(currentLineIndex.indexOf(';'))
|
|
1775
|
+
&& this.isSameLinePositionInTextFrame(selectedWidget, widget)) {
|
|
1776
|
+
return selectedWidget;
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
else if (selectedWidget instanceof TableCellWidget && widget instanceof TableCellWidget) {
|
|
1780
|
+
var parentIndex = selectedWidget.getHierarchicalIndex('');
|
|
1781
|
+
var currentLineIndex = widget.getHierarchicalIndex('');
|
|
1782
|
+
if (selectedWidget.ownerTable.isInHeaderFooter && headerFooter === selectedWidget.ownerTable.bodyWidget
|
|
1783
|
+
&& parentIndex.substring(parentIndex.indexOf(';')) === currentLineIndex.substring(currentLineIndex.indexOf(';'))) {
|
|
1784
|
+
return selectedWidget;
|
|
1785
|
+
}
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
return undefined;
|
|
1790
|
+
};
|
|
1791
|
+
Renderer.prototype.renderContentControlBorder = function (page, lineWidget, top) {
|
|
1792
|
+
if (this.documentHelper.isEditorModule && !isNullOrUndefined(page.documentHelper.editorProperties.contentControleditRegionHighlighters)) {
|
|
1793
|
+
var contentControls = page.documentHelper.editorProperties.contentControls;
|
|
1794
|
+
if (!isNullOrUndefined(contentControls)) {
|
|
1795
|
+
for (var i = 0; i < contentControls.length; i++) {
|
|
1796
|
+
var contentControl = contentControls[i];
|
|
1797
|
+
var widgetInfo = this.documentHelper.editorProperties.contentControleditRegionHighlighters.get(contentControl);
|
|
1798
|
+
if (!isNullOrUndefined(widgetInfo)) {
|
|
1799
|
+
if (this.documentHelper.editorProperties.enableHeaderAndFooter) {
|
|
1800
|
+
var contentControlParent = contentControl.paragraph.containerWidget instanceof TableCellWidget
|
|
1801
|
+
? this.documentHelper.editorProperties.getContainerWidget(contentControl.paragraph.containerWidget)
|
|
1802
|
+
: contentControl.paragraph.containerWidget;
|
|
1803
|
+
var lineParent = lineWidget.paragraph.containerWidget instanceof TableCellWidget
|
|
1804
|
+
? this.documentHelper.editorProperties.getContainerWidget(lineWidget.paragraph.containerWidget)
|
|
1805
|
+
: lineWidget.paragraph.containerWidget;
|
|
1806
|
+
if (contentControlParent == lineParent.parentHeaderFooter && contentControl.paragraph.index == lineWidget.paragraph.index && contentControl.line.indexInOwner == lineWidget.indexInOwner) {
|
|
1807
|
+
lineWidget = contentControl.line;
|
|
1808
|
+
}
|
|
1809
|
+
}
|
|
1810
|
+
var lineIndex = widgetInfo.keys.indexOf(lineWidget);
|
|
1811
|
+
if (lineIndex !== -1) {
|
|
1812
|
+
var color = contentControl.contentControlProperties.color;
|
|
1813
|
+
if (color === '#00000000') {
|
|
1814
|
+
//Change color to grey if color is transparent
|
|
1815
|
+
color = '#939393';
|
|
1816
|
+
}
|
|
1817
|
+
var widget = widgetInfo.get(lineWidget);
|
|
1818
|
+
for (var j = 0; j < widget.length; j++) {
|
|
1819
|
+
var paragraph = lineWidget.paragraph;
|
|
1820
|
+
var startX = 0;
|
|
1821
|
+
var firstLineIndent = paragraph.firstChild === lineWidget ? LayoutHelperMethods.convertPointToPixel(paragraph.paragraphFormat.firstLineIndent) : 0;
|
|
1822
|
+
var leftIndent = LayoutHelperMethods.convertPointToPixel(paragraph.leftIndent);
|
|
1823
|
+
if (paragraph.paragraphFormat.listFormat.listId !== -1) {
|
|
1824
|
+
firstLineIndent = 0;
|
|
1825
|
+
}
|
|
1826
|
+
if (contentControl.line === lineWidget && (paragraph.x + firstLineIndent !== widget[j].left || (contentControl.reference && contentControl.reference.line === lineWidget))) {
|
|
1827
|
+
firstLineIndent = 0;
|
|
1828
|
+
leftIndent = 0;
|
|
1829
|
+
}
|
|
1830
|
+
startX = widget[j].left - leftIndent - firstLineIndent - 2;
|
|
1831
|
+
var endX = widget[j].left + widget[j].width + 2;
|
|
1832
|
+
if (widgetInfo.length - 1 > lineIndex) {
|
|
1833
|
+
endX = this.documentHelper.getParagraphLeftPosition(paragraph) + this.getContainerWidth(paragraph, page) + LayoutHelperMethods.convertPointToPixel(paragraph.paragraphFormat.borders.right.space);
|
|
1834
|
+
}
|
|
1835
|
+
var startY = top;
|
|
1836
|
+
var endY = top + lineWidget.height;
|
|
1837
|
+
//left
|
|
1838
|
+
this.renderSingleBorder(color, startX, startY, startX, endY, 1, 'single');
|
|
1839
|
+
if (lineIndex === 0 || lineWidget === contentControl.line) {
|
|
1840
|
+
//top
|
|
1841
|
+
this.renderSingleBorder(color, startX, startY, endX, startY, 1, 'single');
|
|
1842
|
+
//bottom
|
|
1843
|
+
if (widgetInfo.length === 1 || (isNullOrUndefined(paragraph.nextWidget) && lineWidget === paragraph.lastChild)) {
|
|
1844
|
+
this.renderSingleBorder(color, startX, endY, endX, endY, 1, 'single');
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
else if (lineWidget !== contentControl.line && lineWidget !== contentControl.reference.line) {
|
|
1848
|
+
//top
|
|
1849
|
+
if (isNullOrUndefined(paragraph.previousWidget) && lineWidget === paragraph.firstChild) {
|
|
1850
|
+
this.renderSingleBorder(color, startX, startY, endX, startY, 1, 'single');
|
|
1851
|
+
}
|
|
1852
|
+
else if (contentControl.contentControlWidgetType !== 'Block') {
|
|
1853
|
+
var widgets = widgetInfo.get(widgetInfo.keys[lineIndex - 1]);
|
|
1854
|
+
this.renderSingleBorder(color, startX, startY, widgets[j].left - 2, startY, 1, 'single');
|
|
1855
|
+
}
|
|
1856
|
+
//bottom
|
|
1857
|
+
if (isNullOrUndefined(paragraph.nextWidget) && lineWidget === paragraph.lastChild) {
|
|
1858
|
+
endX = this.documentHelper.getParagraphLeftPosition(paragraph) + this.getContainerWidth(paragraph, page) + LayoutHelperMethods.convertPointToPixel(paragraph.paragraphFormat.borders.right.space);
|
|
1859
|
+
this.renderSingleBorder(color, startX, endY, endX, endY, 1, 'single');
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
else if (lineIndex === widgetInfo.length - 1 && lineWidget === contentControl.reference.line) {
|
|
1863
|
+
//Top
|
|
1864
|
+
var widgets = widgetInfo.get(widgetInfo.keys[lineIndex - 1]);
|
|
1865
|
+
if (isNullOrUndefined(paragraph.previousWidget) && lineWidget === paragraph.firstChild) {
|
|
1866
|
+
endX = this.documentHelper.getParagraphLeftPosition(paragraph) + this.getContainerWidth(paragraph, page) + LayoutHelperMethods.convertPointToPixel(paragraph.paragraphFormat.borders.right.space);
|
|
1867
|
+
this.renderSingleBorder(color, startX, startY, endX, startY, 1, 'single');
|
|
1868
|
+
}
|
|
1869
|
+
else if (startX > widgets[j].left) {
|
|
1870
|
+
this.renderSingleBorder(color, widgets[j].left - 2, startY, startX, startY, 1, 'single');
|
|
1871
|
+
}
|
|
1872
|
+
var lastLine = paragraph.lastChild;
|
|
1873
|
+
if (!isNullOrUndefined(lastLine) && (!isNullOrUndefined(page.nextPage) || !isNullOrUndefined(paragraph.nextWidget)) && lineWidget === lastLine && lastLine.children[lastLine.children.length - 1] instanceof ContentControl && lastLine.children[lastLine.children.length - 1] === contentControl.reference && contentControl.contentControlWidgetType === 'Block') {
|
|
1874
|
+
//bottom
|
|
1875
|
+
endX = this.documentHelper.getParagraphLeftPosition(paragraph) + this.getContainerWidth(paragraph, page) + LayoutHelperMethods.convertPointToPixel(paragraph.paragraphFormat.borders.right.space);
|
|
1876
|
+
this.renderSingleBorder(color, startX, endY, endX, endY, 1, 'single');
|
|
1877
|
+
}
|
|
1878
|
+
else {
|
|
1879
|
+
//bottom
|
|
1880
|
+
this.renderSingleBorder(color, startX, endY, endX, endY, 1, 'single');
|
|
1881
|
+
//top
|
|
1882
|
+
if (widgetInfo.length > 1) {
|
|
1883
|
+
var widgets_1 = widgetInfo.get(widgetInfo.keys[lineIndex - 1]);
|
|
1884
|
+
var endUpdated = this.documentHelper.getParagraphLeftPosition(paragraph) + this.getContainerWidth(paragraph, page) + LayoutHelperMethods.convertPointToPixel(paragraph.paragraphFormat.borders.right.space);
|
|
1885
|
+
var updatedEndX = false;
|
|
1886
|
+
if (lineIndex === 1 && endX < widgets_1[j].left - 2) {
|
|
1887
|
+
updatedEndX = true;
|
|
1888
|
+
}
|
|
1889
|
+
this.renderSingleBorder(color, updatedEndX ? widgets_1[j].left - 2 : endX, startY, endUpdated, startY, 1, 'single');
|
|
1890
|
+
if (startX < widgets_1[j].left - 2 && contentControl.contentControlWidgetType !== 'Block') {
|
|
1891
|
+
this.renderSingleBorder(color, updatedEndX ? endX : widgets_1[j].left - 2, startY, startX, startY, 1, 'single');
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
//right
|
|
1897
|
+
this.renderSingleBorder(color, endX, startY, endX, endY, 1, 'single');
|
|
1898
|
+
if (lineWidget === contentControl.reference.line && !isNullOrUndefined(contentControl) && (contentControl.contentControlProperties.type === 'ComboBox' || contentControl.contentControlProperties.type === 'DropDownList' || contentControl.contentControlProperties.type === 'Date')) {
|
|
1899
|
+
var element = this.documentHelper.element.querySelector('#' + "contenticon");
|
|
1900
|
+
if (element) {
|
|
1901
|
+
element.style.display = 'block';
|
|
1902
|
+
startX = this.getScaledValue(endX, 1);
|
|
1903
|
+
startY = this.getScaledValue(startY, 2);
|
|
1904
|
+
element.style.left = startX + "px"; // Position to the right of the right border
|
|
1905
|
+
element.style.top = startY + "px"; // Align with the top of the border
|
|
1906
|
+
element.style.border = '0.5px solid #7F7F7F';
|
|
1907
|
+
element.style.backgroundColor = '#D3D3D3';
|
|
1908
|
+
element.style.height = lineWidget.height + 'px';
|
|
1909
|
+
}
|
|
1910
|
+
else {
|
|
1911
|
+
var contentMark = document.createElement('div');
|
|
1912
|
+
contentMark.id = "contenticon";
|
|
1913
|
+
contentMark.style.display = 'block';
|
|
1914
|
+
contentMark.style.position = 'sticky';
|
|
1915
|
+
startX = this.getScaledValue(endX, 1);
|
|
1916
|
+
startY = this.getScaledValue(startY, 2);
|
|
1917
|
+
contentMark.style.left = startX + "px"; // Position to the right of the right border
|
|
1918
|
+
contentMark.style.top = startY + "px"; // Align with the top of the border
|
|
1919
|
+
contentMark.style.border = '0.5px solid #7F7F7F';
|
|
1920
|
+
contentMark.style.backgroundColor = '#D3D3D3';
|
|
1921
|
+
contentMark.style.height = lineWidget.height + 'px';
|
|
1922
|
+
contentMark.classList.add('e-de-cmt-mark');
|
|
1923
|
+
var span = document.createElement('span');
|
|
1924
|
+
span.classList.add('e-icons');
|
|
1925
|
+
span.classList.add('e-chevron-down-fill');
|
|
1926
|
+
contentMark.appendChild(span);
|
|
1927
|
+
this.documentHelper.pageContainer.appendChild(contentMark);
|
|
1928
|
+
// Binded the event in document editor
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
};
|
|
1938
|
+
Renderer.prototype.renderEditRegionHighlight = function (page, lineWidget, top) {
|
|
1939
|
+
if (!this.isPrinting && !isNullOrUndefined(page.documentHelper.editorProperties.editRegionHighlighters)) {
|
|
1940
|
+
var renderHighlight = this.documentHelper.editorProperties.editRegionHighlighters.containsKey(lineWidget);
|
|
1941
|
+
if (!renderHighlight && lineWidget.paragraph.isInHeaderFooter) {
|
|
1942
|
+
var keys = this.documentHelper.editorProperties.editRegionHighlighters.keys;
|
|
1943
|
+
lineWidget = this.checkHeaderFooterLineWidget(lineWidget, keys);
|
|
1944
|
+
if (!isNullOrUndefined(lineWidget)) {
|
|
1945
|
+
renderHighlight = true;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
if (renderHighlight) {
|
|
1949
|
+
var widgetInfo = this.documentHelper.editorProperties.editRegionHighlighters.get(lineWidget);
|
|
1950
|
+
for (var i = 0; i < widgetInfo.length; i++) {
|
|
1951
|
+
this.pageContext.fillStyle = widgetInfo[i].color !== '' ? widgetInfo[i].color : '#add8e6';
|
|
1952
|
+
this.pageContext.fillRect(this.getScaledValue(widgetInfo[i].left, 1), this.getScaledValue(top, 2), this.getScaledValue(widgetInfo[i].width), this.getScaledValue(lineWidget.height));
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
}
|
|
1956
|
+
};
|
|
1957
|
+
Renderer.prototype.renderSearchHighlight = function (page, lineWidget, top) {
|
|
1958
|
+
if (this.documentHelper && !isNullOrUndefined(page.documentHelper.editorProperties.searchHighlighters)) {
|
|
1959
|
+
var renderHighlight = page.documentHelper.editorProperties.searchHighlighters.containsKey(lineWidget);
|
|
1960
|
+
this.validateRemoveSearchHighlighters(page);
|
|
1961
|
+
if (!renderHighlight && lineWidget.paragraph.isInHeaderFooter) {
|
|
1962
|
+
var keys = page.documentHelper.editorProperties.searchHighlighters.keys;
|
|
1963
|
+
lineWidget = this.checkHeaderFooterLineWidget(lineWidget, keys);
|
|
1964
|
+
if (!isNullOrUndefined(lineWidget)) {
|
|
1965
|
+
renderHighlight = true;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
if (renderHighlight) {
|
|
1969
|
+
var widgetInfo = page.documentHelper.editorProperties.searchHighlighters.get(lineWidget);
|
|
1970
|
+
for (var i = 0; i < widgetInfo.length; i++) {
|
|
1971
|
+
this.pageContext.fillStyle = this.documentHelper.documentEditorSettings.searchHighlightColor;
|
|
1972
|
+
this.pageContext.fillRect(this.getScaledValue(widgetInfo[i].left, 1), this.getScaledValue(top, 2), this.getScaledValue(widgetInfo[i].width), this.getScaledValue(lineWidget.height));
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
Renderer.prototype.validateRemoveSearchHighlighters = function (page) {
|
|
1978
|
+
var keys = page.documentHelper.editorProperties.searchHighlighters.keys;
|
|
1979
|
+
for (var j = keys.length - 1; j >= 0; j--) {
|
|
1980
|
+
var selectedWidget = keys[j];
|
|
1981
|
+
if (selectedWidget instanceof LineWidget && !isNullOrUndefined(selectedWidget.paragraph) &&
|
|
1982
|
+
!isNullOrUndefined(selectedWidget.paragraph.containerWidget)) {
|
|
1983
|
+
continue;
|
|
1984
|
+
}
|
|
1985
|
+
else {
|
|
1986
|
+
page.documentHelper.editorProperties.searchHighlighters.keys.splice(j, 1);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
};
|
|
1990
|
+
Renderer.prototype.renderSelectionHighlight = function (page, lineWidget, top) {
|
|
1991
|
+
if (!this.isPrinting && page.documentHelper && !this.documentHelper.editorProperties.isScrollToSpellCheck
|
|
1992
|
+
&& page.documentHelper.editorProperties && page.documentHelper.editorProperties.selectedWidgets
|
|
1993
|
+
&& page.documentHelper.editorProperties.selectedWidgets.length > 0) {
|
|
1994
|
+
var renderHighlight = page.documentHelper.editorProperties.selectedWidgets.containsKey(lineWidget);
|
|
1995
|
+
if (!renderHighlight && lineWidget.paragraph.isInHeaderFooter) {
|
|
1996
|
+
var keys = page.documentHelper.editorProperties.selectedWidgets.keys;
|
|
1997
|
+
lineWidget = this.checkHeaderFooterLineWidget(lineWidget, keys);
|
|
1998
|
+
if (!isNullOrUndefined(lineWidget)) {
|
|
1999
|
+
renderHighlight = true;
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
2002
|
+
// isUpdatedWhileLoadAsync is checked to avoid adding selection highlight again while loading the document asynchronously.
|
|
2003
|
+
if (renderHighlight && !page.documentHelper.isUpdatedWhileLoadAsync) {
|
|
2004
|
+
page.documentHelper.editorProperties.addSelectionHighlight(this.selectionContext, lineWidget, top, page);
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
};
|
|
2008
|
+
Renderer.prototype.renderSelectionHighlightOnTable = function (page, cellWidget) {
|
|
2009
|
+
if (!this.isPrinting && page.documentHelper && page.documentHelper.editorProperties.selectedWidgets.length > 0) {
|
|
2010
|
+
var renderHighlight = page.documentHelper.editorProperties.selectedWidgets.containsKey(cellWidget);
|
|
2011
|
+
if (!renderHighlight && cellWidget.ownerTable.isInHeaderFooter) {
|
|
2012
|
+
var keys = page.documentHelper.editorProperties.selectedWidgets.keys;
|
|
2013
|
+
cellWidget = this.checkHeaderFooterLineWidget(cellWidget, keys);
|
|
2014
|
+
if (!isNullOrUndefined(cellWidget)) {
|
|
2015
|
+
renderHighlight = true;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
if (renderHighlight) {
|
|
2019
|
+
page.documentHelper.editorProperties.addSelectionHighlightTable(this.selectionContext, cellWidget, page);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
};
|
|
2023
|
+
Renderer.prototype.renderLine = function (lineWidget, page, left, top) {
|
|
2024
|
+
if (isNullOrUndefined(lineWidget) || isNullOrUndefined(lineWidget.paragraph)) {
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
this.renderSelectionHighlight(page, lineWidget, top);
|
|
2028
|
+
var paraFormat = lineWidget.paragraph.paragraphFormat;
|
|
2029
|
+
var x = left;
|
|
2030
|
+
if (lineWidget.isFirstLine() && !paraFormat.bidi) {
|
|
2031
|
+
left += LayoutHelperMethods.convertPointToPixel(paraFormat.firstLineIndent);
|
|
2032
|
+
}
|
|
2033
|
+
if (this.documentHelper && this.documentHelper && !isNullOrUndefined(this.documentHelper.editorProperties.formFieldHighlighters)
|
|
2034
|
+
&& this.documentHelper.editorProperties.formFieldHighlighters.containsKey(lineWidget)) {
|
|
2035
|
+
if (this.documentHelper.documentEditorSettings
|
|
2036
|
+
&& this.documentHelper.documentEditorSettings.formFieldSettings.applyShading) {
|
|
2037
|
+
var widgetInfo = page.documentHelper.editorProperties.formFieldHighlighters.get(lineWidget);
|
|
2038
|
+
for (var i = 0; i < widgetInfo.length; i++) {
|
|
2039
|
+
this.pageContext.fillStyle = this.documentHelper.documentEditorSettings.formFieldSettings.shadingColor;
|
|
2040
|
+
var height_1 = lineWidget.height;
|
|
2041
|
+
var isAltered = false;
|
|
2042
|
+
var isLastLine = lineWidget.isLastLine();
|
|
2043
|
+
if (isLastLine) {
|
|
2044
|
+
height_1 = height_1 - LayoutHelperMethods.convertPointToPixel(this.documentHelper.layout.getAfterSpacing(lineWidget.paragraph));
|
|
2045
|
+
if (lineWidget.paragraph.paragraphFormat.lineSpacing > 1) {
|
|
2046
|
+
var formField = this.getFormfieldInLine(lineWidget);
|
|
2047
|
+
if (!isNullOrUndefined(formField)) {
|
|
2048
|
+
var sizeInfo = this.documentHelper.textHelper.getHeight(formField.characterFormat);
|
|
2049
|
+
var maxHeight = sizeInfo.Height;
|
|
2050
|
+
if (lineWidget.paragraph.paragraphFormat.lineSpacingType === 'Multiple') {
|
|
2051
|
+
height_1 = height_1 - LayoutHelperMethods.convertPointToPixel(this.documentHelper.layout.getLineSpacing(lineWidget.paragraph, maxHeight, true));
|
|
2052
|
+
}
|
|
2053
|
+
else {
|
|
2054
|
+
top = top + LayoutHelperMethods.convertPointToPixel(lineWidget.paragraph.paragraphFormat.beforeSpacing);
|
|
2055
|
+
height_1 = sizeInfo.Height;
|
|
2056
|
+
isAltered = true;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
this.pageContext.fillRect(this.getScaledValue(widgetInfo[i].left, 1), this.getScaledValue(top, 2), this.getScaledValue(widgetInfo[i].width), this.getScaledValue(height_1));
|
|
2062
|
+
if (isAltered) {
|
|
2063
|
+
isAltered = false;
|
|
2064
|
+
top = top - LayoutHelperMethods.convertPointToPixel(lineWidget.paragraph.paragraphFormat.beforeSpacing);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
}
|
|
2069
|
+
// Render search highlight
|
|
2070
|
+
this.renderSearchHighlight(page, lineWidget, top);
|
|
2071
|
+
// EditRegion highlight
|
|
2072
|
+
this.renderEditRegionHighlight(page, lineWidget, top);
|
|
2073
|
+
var commentIDList = [];
|
|
2074
|
+
var children = lineWidget.renderedElements;
|
|
2075
|
+
var underlineY = this.getUnderlineYPosition(lineWidget);
|
|
2076
|
+
var bookmarks = [];
|
|
2077
|
+
if (!isNullOrUndefined(lineWidget.paragraph.associatedCell) && lineWidget.paragraph.associatedCell.isRenderBookmarkStart) {
|
|
2078
|
+
var firstLineInFirstPara = lineWidget.paragraph.associatedCell.firstChild.firstChild;
|
|
2079
|
+
if (firstLineInFirstPara == lineWidget) {
|
|
2080
|
+
bookmarks.push({ x: left, y: top, height: lineWidget.height - lineWidget.margin.bottom, type: 0 });
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
for (var i = 0; i < children.length; i++) {
|
|
2084
|
+
var elementBox = children[i];
|
|
2085
|
+
if (elementBox instanceof ShapeBase && elementBox.textWrappingStyle !== 'Inline') {
|
|
2086
|
+
continue;
|
|
2087
|
+
}
|
|
2088
|
+
if (elementBox instanceof CommentCharacterElementBox || elementBox instanceof EditRangeStartElementBox) {
|
|
2089
|
+
var pageGap = 0;
|
|
2090
|
+
if (this.viewer instanceof PageLayoutHelper) {
|
|
2091
|
+
pageGap = this.viewer.pageGap;
|
|
2092
|
+
}
|
|
2093
|
+
var style = 'display:block;position:absolute;';
|
|
2094
|
+
var topPosition = this.getScaledValue((top) + (page.boundingRectangle.y -
|
|
2095
|
+
(pageGap * (page.index + 1)))) + (pageGap * (page.index + 1)) + 'px;';
|
|
2096
|
+
if (elementBox instanceof EditRangeStartElementBox && (this.documentHelper.editorProperties.currentUser === elementBox.user || (elementBox.group === "Everyone" && elementBox.user === ""))) {
|
|
2097
|
+
if (this.documentHelper.documentEditorSettings.highlightEditableRanges && elementBox.columnFirst == -1) {
|
|
2098
|
+
var height = elementBox.line.height - elementBox.line.margin.bottom;
|
|
2099
|
+
var xLeft = left;
|
|
2100
|
+
if (!isNullOrUndefined(elementBox.margin) && elementBox.margin.left > 0) {
|
|
2101
|
+
xLeft += elementBox.margin.left;
|
|
2102
|
+
}
|
|
2103
|
+
var yTop = top;
|
|
2104
|
+
var highlighters = this.documentHelper.editorProperties.editRegionHighlighters;
|
|
2105
|
+
var widgetInfo = !isNullOrUndefined(highlighters) ? highlighters.get(lineWidget) : [];
|
|
2106
|
+
var color = !isNullOrUndefined(widgetInfo) && !isNullOrUndefined(widgetInfo[0]) ? widgetInfo[0].color : "ffff00";
|
|
2107
|
+
this.renderBookmark(this.getScaledValue(xLeft, 1), this.getScaledValue(yTop, 2), this.getScaledValue(lineWidget.height - lineWidget.margin.bottom), 0, color);
|
|
2108
|
+
}
|
|
2109
|
+
if (this.documentHelper.enableLockAndEdit) {
|
|
2110
|
+
var l10n = new L10n('documenteditor', this.documentHelper.defaultLocale);
|
|
2111
|
+
l10n.setLocale(this.documentHelper.locale);
|
|
2112
|
+
this.renderLockMark(elementBox, this.documentHelper.editorProperties.currentUser, l10n);
|
|
2113
|
+
var settings = this.documentHelper.documentEditorSettings.collaborativeEditingSettings;
|
|
2114
|
+
var color = elementBox.user === this.documentHelper.editorProperties.currentUser ? settings.editableRegionColor : settings.lockedRegionColor;
|
|
2115
|
+
style += "color:" + color + ";";
|
|
2116
|
+
var leftMargin = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.leftMargin);
|
|
2117
|
+
var leftPosition = page.boundingRectangle.x + this.getScaledValue(leftMargin - 20) + 'px;';
|
|
2118
|
+
if (this.viewer instanceof WebLayoutHelper) {
|
|
2119
|
+
leftPosition = lineWidget.paragraph.x - 5 + 'px;';
|
|
2120
|
+
}
|
|
2121
|
+
style = style + 'left:' + leftPosition + 'top:' + topPosition;
|
|
2122
|
+
updateCSSText(elementBox.editRangeMark, style);
|
|
2123
|
+
}
|
|
2124
|
+
else {
|
|
2125
|
+
if (elementBox.editRangeMark) {
|
|
2126
|
+
var cssText = 'display:none';
|
|
2127
|
+
updateCSSText(elementBox.editRangeMark, cssText);
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
}
|
|
2131
|
+
else if (elementBox instanceof CommentCharacterElementBox &&
|
|
2132
|
+
elementBox.commentType === 0 && this.documentHelper) {
|
|
2133
|
+
if (this.documentHelper.enableComment) {
|
|
2134
|
+
var rightMargin = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.rightMargin);
|
|
2135
|
+
var pageWidth = LayoutHelperMethods.convertPointToPixel(page.bodyWidgets[0].sectionFormat.pageWidth);
|
|
2136
|
+
var leftPosition = page.boundingRectangle.x + this.getScaledValue((pageWidth - rightMargin) + (rightMargin / 4)) + 'px;';
|
|
2137
|
+
if (this.viewer instanceof WebLayoutHelper) {
|
|
2138
|
+
leftPosition = (page.boundingRectangle.width - (this.viewer.padding.right * 2) - (this.viewer.padding.left * 2)) + 'px;';
|
|
2139
|
+
}
|
|
2140
|
+
style = style + 'left:' + leftPosition + 'top:' + topPosition;
|
|
2141
|
+
if (commentIDList.indexOf(elementBox.commentId) === -1 && !isNullOrUndefined(elementBox.comment) && !elementBox.comment.isReply) {
|
|
2142
|
+
commentIDList.push(elementBox.commentId);
|
|
2143
|
+
elementBox.renderCommentMark(topPosition, leftPosition);
|
|
2144
|
+
updateCSSText(elementBox.commentMark, style);
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
else {
|
|
2148
|
+
if (elementBox.commentMark) {
|
|
2149
|
+
var cssText = 'display:none';
|
|
2150
|
+
updateCSSText(elementBox.commentMark, cssText);
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2155
|
+
if (elementBox instanceof EditRangeEndElementBox && !isNullOrUndefined(elementBox.editRangeStart) && (this.documentHelper.editorProperties.currentUser === elementBox.editRangeStart.user || (elementBox.editRangeStart.group === "Everyone" && elementBox.editRangeStart.user === ""))) {
|
|
2156
|
+
if (elementBox.editRangeStart.columnFirst == -1 && this.documentHelper.documentEditorSettings.highlightEditableRanges) {
|
|
2157
|
+
var height = elementBox.line.height - elementBox.line.margin.bottom;
|
|
2158
|
+
var xLeft = left;
|
|
2159
|
+
var yTop = top;
|
|
2160
|
+
var highlighters = this.documentHelper.editorProperties.editRegionHighlighters;
|
|
2161
|
+
var widgetInfo = !isNullOrUndefined(highlighters) ? highlighters.get(lineWidget) : [];
|
|
2162
|
+
var color = !isNullOrUndefined(widgetInfo) && !isNullOrUndefined(widgetInfo[0]) ? widgetInfo[0].color : "ffff00";
|
|
2163
|
+
this.renderBookmark(this.getScaledValue(xLeft, 1), this.getScaledValue(yTop, 2), this.getScaledValue(lineWidget.height - lineWidget.margin.bottom), 1, color);
|
|
2164
|
+
}
|
|
2165
|
+
}
|
|
2166
|
+
if (elementBox instanceof BookmarkElementBox && this.documentHelper.documentEditorSettings.showBookmarks && !LayoutHelperMethods.startsWith(elementBox.name, '_')) {
|
|
2167
|
+
if (isNullOrUndefined(elementBox.line.margin)) {
|
|
2168
|
+
elementBox.line.margin = new Margin(0, 0, 0, 0);
|
|
2169
|
+
}
|
|
2170
|
+
var height = elementBox.line.height - (elementBox.line.margin.bottom + elementBox.line.margin.top);
|
|
2171
|
+
var xLeft = left;
|
|
2172
|
+
if (!isNullOrUndefined(elementBox.margin) && elementBox.margin.left > 0) {
|
|
2173
|
+
xLeft += elementBox.margin.left;
|
|
2174
|
+
}
|
|
2175
|
+
var yTop = top + elementBox.line.margin.top;
|
|
2176
|
+
if (elementBox.bookmarkType == 1) {
|
|
2177
|
+
if (this.isBookmarkEndAtStart(elementBox) && isNullOrUndefined(elementBox.properties)) {
|
|
2178
|
+
var previousParaElement = elementBox.paragraph;
|
|
2179
|
+
var prevRenderableElement = void 0;
|
|
2180
|
+
var isRenderablePresent = false;
|
|
2181
|
+
while (!isRenderablePresent && !isNullOrUndefined(previousParaElement)) {
|
|
2182
|
+
var lineIndex = previousParaElement.childWidgets.indexOf(elementBox.line) >= 0 ? previousParaElement.childWidgets.indexOf(elementBox.line) : previousParaElement.childWidgets.length - 1;
|
|
2183
|
+
for (var i_1 = lineIndex; i_1 >= 0; i_1--) {
|
|
2184
|
+
var line = previousParaElement.childWidgets[i_1];
|
|
2185
|
+
var elementIndex = line.children.indexOf(elementBox) >= 0 ? line.children.indexOf(elementBox) : line.children.length - 1;
|
|
2186
|
+
for (var j = elementIndex; j >= 0; j--) {
|
|
2187
|
+
if (this.isRenderable(line.children[j])) {
|
|
2188
|
+
prevRenderableElement = line.children[j];
|
|
2189
|
+
isRenderablePresent = true;
|
|
2190
|
+
break;
|
|
2191
|
+
}
|
|
2192
|
+
if ((line.children[j] instanceof BookmarkElementBox && line.children[j].bookmarkType === 0
|
|
2193
|
+
&& line.children[j].name === elementBox.name)) {
|
|
2194
|
+
isRenderablePresent = true;
|
|
2195
|
+
break;
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
if (isRenderablePresent) {
|
|
2199
|
+
break;
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
if (!isRenderablePresent) {
|
|
2203
|
+
previousParaElement = this.documentHelper.editorProperties.getPreviousParagraphBlock(previousParaElement);
|
|
2204
|
+
}
|
|
2205
|
+
}
|
|
2206
|
+
if (!isNullOrUndefined(prevRenderableElement)) {
|
|
2207
|
+
if (previousParaElement.containerWidget instanceof TableCellWidget) {
|
|
2208
|
+
xLeft += previousParaElement.x + this.documentHelper.editorProperties.getWidth(prevRenderableElement.line, false) + this.documentHelper.textHelper.getParagraphMarkWidth(elementBox.line.paragraph.characterFormat);
|
|
2209
|
+
}
|
|
2210
|
+
else {
|
|
2211
|
+
if (!isNullOrUndefined(previousParaElement.paragraphFormat.listFormat.list)) {
|
|
2212
|
+
xLeft = previousParaElement.x + this.documentHelper.editorProperties.getWidth(prevRenderableElement.line, false) + this.documentHelper.textHelper.getParagraphMarkWidth(elementBox.line.paragraph.characterFormat);
|
|
2213
|
+
}
|
|
2214
|
+
else {
|
|
2215
|
+
xLeft += this.documentHelper.editorProperties.getWidth(prevRenderableElement.line, false) + this.documentHelper.textHelper.getParagraphMarkWidth(elementBox.line.paragraph.characterFormat);
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
yTop = this.documentHelper.editorProperties.getTop(prevRenderableElement.line) + prevRenderableElement.line.margin.top;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
if (!isNullOrUndefined(elementBox.properties)) {
|
|
2222
|
+
if (elementBox.properties['isAfterParagraphMark']) {
|
|
2223
|
+
xLeft += this.documentHelper.textHelper.getParagraphMarkWidth(elementBox.line.paragraph.characterFormat);
|
|
2224
|
+
}
|
|
2225
|
+
if (elementBox.properties['isAfterCellMark']) {
|
|
2226
|
+
xLeft += this.documentHelper.textHelper.getWidth(String.fromCharCode(164), lineWidget.paragraph.characterFormat);
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
if (elementBox.bookmarkType == 1) {
|
|
2231
|
+
if (!isNullOrUndefined(elementBox.reference)) {
|
|
2232
|
+
if (isNullOrUndefined(elementBox.reference.properties)) {
|
|
2233
|
+
if (!this.documentHelper.editorProperties.isRenderBookmarkAtEnd(elementBox)) {
|
|
2234
|
+
bookmarks.push({ x: xLeft, y: yTop, height: height, type: elementBox.bookmarkType });
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
else {
|
|
2238
|
+
var bookmarkEndCell = elementBox.paragraph.associatedCell;
|
|
2239
|
+
if (isNullOrUndefined(bookmarkEndCell)) {
|
|
2240
|
+
bookmarks.push({ x: xLeft, y: yTop, height: height, type: elementBox.bookmarkType });
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
else {
|
|
2246
|
+
if (isNullOrUndefined(elementBox.properties)) {
|
|
2247
|
+
bookmarks.push({ x: xLeft, y: yTop, height: height, type: elementBox.bookmarkType });
|
|
2248
|
+
}
|
|
2249
|
+
}
|
|
2250
|
+
}
|
|
2251
|
+
if (elementBox instanceof FieldElementBox || this.isFieldCode ||
|
|
2252
|
+
(elementBox.width === 0 && elementBox.height === 0)) {
|
|
2253
|
+
var width = elementBox.width;
|
|
2254
|
+
if (this.isFieldCode) {
|
|
2255
|
+
if (!(elementBox instanceof ImageElementBox)) {
|
|
2256
|
+
elementBox.width = 0;
|
|
2257
|
+
}
|
|
2258
|
+
width = 0;
|
|
2259
|
+
}
|
|
2260
|
+
left += width + elementBox.margin.left;
|
|
2261
|
+
this.toSkipFieldCode(elementBox);
|
|
2262
|
+
continue;
|
|
2263
|
+
}
|
|
2264
|
+
if (!this.isPrinting) {
|
|
2265
|
+
if (this.getScaledValue(top + elementBox.margin.top, 2) + elementBox.height * this.documentHelper.zoomFactor < 0 ||
|
|
2266
|
+
this.getScaledValue(top + elementBox.margin.top, 2) > this.documentHelper.visibleBounds.height) {
|
|
2267
|
+
left += elementBox.width + elementBox.margin.left;
|
|
2268
|
+
if (elementBox instanceof TextElementBox) {
|
|
2269
|
+
if (this.documentHelper.isSpellCheck) {
|
|
2270
|
+
elementBox.canTrigger = true;
|
|
2271
|
+
}
|
|
2272
|
+
elementBox.isVisible = false;
|
|
2273
|
+
if ((!elementBox.isSpellChecked && !elementBox.isSpellCheckTriggered) || elementBox.line.paragraph.isChangeDetected) {
|
|
2274
|
+
elementBox.isChangeDetected = true;
|
|
2275
|
+
}
|
|
2276
|
+
}
|
|
2277
|
+
if (!this.isExporting) {
|
|
2278
|
+
continue;
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
if (elementBox instanceof ListTextElementBox) {
|
|
2283
|
+
left += elementBox.padding.left;
|
|
2284
|
+
this.renderListTextElementBox(elementBox, left, top, underlineY);
|
|
2285
|
+
}
|
|
2286
|
+
else if (elementBox instanceof ImageElementBox) {
|
|
2287
|
+
left += elementBox.padding.left;
|
|
2288
|
+
this.renderImageElementBox(elementBox, left, top, underlineY);
|
|
2289
|
+
}
|
|
2290
|
+
else if (elementBox instanceof ShapeElementBox) {
|
|
2291
|
+
var shapeLeftMargin = elementBox.margin.left;
|
|
2292
|
+
var shapeTopMargin = elementBox.margin.top;
|
|
2293
|
+
var shapeLeft = this.getScaledValue(left + shapeLeftMargin, 1);
|
|
2294
|
+
var shapeTop = this.getScaledValue(top + shapeTopMargin, 2);
|
|
2295
|
+
this.renderShapeElementBox(elementBox, shapeLeft, shapeTop, page);
|
|
2296
|
+
}
|
|
2297
|
+
else if (elementBox instanceof GroupShapeElementBox) {
|
|
2298
|
+
this.renderGroupShapeElementBox(elementBox, page);
|
|
2299
|
+
}
|
|
2300
|
+
else {
|
|
2301
|
+
elementBox.isVisible = true;
|
|
2302
|
+
left += elementBox.padding.left;
|
|
2303
|
+
this.renderTextElementBox(elementBox, left, top, underlineY);
|
|
2304
|
+
}
|
|
2305
|
+
left += elementBox.width + elementBox.margin.left;
|
|
2306
|
+
if (lineWidget.paragraph.bidi) {
|
|
2307
|
+
x += (elementBox.margin.left);
|
|
2308
|
+
}
|
|
2309
|
+
else {
|
|
2310
|
+
x = left;
|
|
2311
|
+
}
|
|
2312
|
+
}
|
|
2313
|
+
// Content region border
|
|
2314
|
+
this.renderContentControlBorder(page, lineWidget, top);
|
|
2315
|
+
if (this.documentHelper.documentEditorSettings.showBookmarks && bookmarks.length > 0) {
|
|
2316
|
+
for (var i = 0; i < bookmarks.length; i++) {
|
|
2317
|
+
var bookmark = bookmarks[i];
|
|
2318
|
+
this.renderBookmark(this.getScaledValue(bookmark.x, 1), this.getScaledValue(bookmark.y, 2), (this.getScaledValue(bookmark.height) - 2), bookmark.type);
|
|
2319
|
+
}
|
|
2320
|
+
}
|
|
2321
|
+
var isEnableParaMark = false;
|
|
2322
|
+
var format = lineWidget.paragraph.paragraphFormat;
|
|
2323
|
+
var isEmptyHFWidget = lineWidget.paragraph.isInHeaderFooter && lineWidget.paragraph.isEmpty() && isNullOrUndefined(lineWidget.paragraph.nextWidget) && isNullOrUndefined(lineWidget.paragraph.previousWidget);
|
|
2324
|
+
isEnableParaMark = this.documentHelper.editorProperties.enableHeaderAndFooter || !isEmptyHFWidget || (isEmptyHFWidget && !isNullOrUndefined(format.uniqueParagraphFormat));
|
|
2325
|
+
if (this.documentHelper.documentEditorSettings.showHiddenMarks && !this.isPrinting) {
|
|
2326
|
+
var text = '';
|
|
2327
|
+
var currentCharFormat = lineWidget.paragraph.characterFormat;
|
|
2328
|
+
var y = 0;
|
|
2329
|
+
var characterFont = this.retriveCharacterformat(currentCharFormat);
|
|
2330
|
+
var l10n = new L10n('documenteditor', this.documentHelper.defaultLocale);
|
|
2331
|
+
l10n.setLocale(this.documentHelper.locale);
|
|
2332
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(currentCharFormat.fontColor);
|
|
2333
|
+
var pageIndex = 0;
|
|
2334
|
+
if (lineWidget.paragraph.bodyWidget && !(lineWidget.paragraph.bodyWidget instanceof HeaderFooterWidget)) {
|
|
2335
|
+
pageIndex = this.documentHelper.pages.indexOf(lineWidget.paragraph.bodyWidget.page);
|
|
2336
|
+
}
|
|
2337
|
+
if ((children.length == 0 && !lineWidget.isEndsWithLineBreak && !isNullOrUndefined(lineWidget.paragraph))) {
|
|
2338
|
+
y = lineWidget.paragraph.y + (this.documentHelper.textHelper.getHeight(currentCharFormat)).BaselineOffset + (!isNullOrUndefined(lineWidget.margin) ? lineWidget.margin.top : 0);
|
|
2339
|
+
if (!lineWidget.isEndsWithLineBreak && lineWidget.indexInOwner > 0 && children.length == 0) {
|
|
2340
|
+
y = top + lineWidget.previousLine.maxBaseLine;
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
else {
|
|
2344
|
+
if (lineWidget.paragraph.childWidgets.length === 1 && lineWidget.maxBaseLine == 0) {
|
|
2345
|
+
y = top + (this.documentHelper.textHelper.getHeight(currentCharFormat)).BaselineOffset + (!isNullOrUndefined(lineWidget.margin) ? lineWidget.margin.top : 0);
|
|
2346
|
+
}
|
|
2347
|
+
else {
|
|
2348
|
+
// for handling negative margin top
|
|
2349
|
+
if (lineWidget.margin && lineWidget.margin.top > 0) {
|
|
2350
|
+
y = top + lineWidget.maxBaseLine + lineWidget.margin.top;
|
|
2351
|
+
}
|
|
2352
|
+
else {
|
|
2353
|
+
y = top + lineWidget.maxBaseLine;
|
|
2354
|
+
}
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
if (currentCharFormat.revisionLength > 0) {
|
|
2358
|
+
//CharacterFormat Track changes is not supported., Hence only the Para mark changes are parsed and preserved in the charcterForamt.
|
|
2359
|
+
var revisionInfo = this.checkRevisionType(currentCharFormat);
|
|
2360
|
+
var color = revisionInfo.length > 0 ? this.getRevisionColor(revisionInfo) : currentCharFormat.fontColor;
|
|
2361
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(color);
|
|
2362
|
+
}
|
|
2363
|
+
if (lineWidget.isEndsWithColumnBreak) {
|
|
2364
|
+
characterFont = this.retriveCharacterformat(currentCharFormat, 0.7);
|
|
2365
|
+
text = "....." + l10n.getConstant('Column Break') + ".....";
|
|
2366
|
+
}
|
|
2367
|
+
else if (lineWidget.isEndsWithPageBreak) {
|
|
2368
|
+
characterFont = this.retriveCharacterformat(currentCharFormat, 0.7);
|
|
2369
|
+
text = this.getPageBreakText(lineWidget.paragraph, l10n);
|
|
2370
|
+
var textinfo = this.documentHelper.textHelper.getWidth(text, currentCharFormat, FontScriptType.English);
|
|
2371
|
+
if (this.viewer instanceof PageLayoutHelper) {
|
|
2372
|
+
if (lineWidget.paragraph.bidi) {
|
|
2373
|
+
if (x < (textinfo + this.viewer.clientActiveArea.x)) {
|
|
2374
|
+
text = '.....';
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
else {
|
|
2378
|
+
if (x > this.viewer.clientActiveArea.width) {
|
|
2379
|
+
text = '.....';
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
else {
|
|
2384
|
+
if (lineWidget.paragraph.bidi) {
|
|
2385
|
+
if ((x - textinfo) < this.viewer.clientActiveArea.x) {
|
|
2386
|
+
text = '.....';
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
else {
|
|
2390
|
+
if ((x + textinfo) > (this.viewer.clientActiveArea.width + this.viewer.clientActiveArea.x)) {
|
|
2391
|
+
text = '.....';
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
else if (lineWidget.isEndsWithLineBreak) {
|
|
2397
|
+
text = lineWidget.paragraph.bidi ? String.fromCharCode(8627) : String.fromCharCode(8629);
|
|
2398
|
+
}
|
|
2399
|
+
else if (lineWidget.paragraph.isInsideTable && isNullOrUndefined(lineWidget.nextLine) && isNullOrUndefined(lineWidget.paragraph.nextWidget)) {
|
|
2400
|
+
if (lineWidget.height != 0) { //The nested table parent cell mark is render the out bound ,So skip cell mark is linewidget height equal to zero
|
|
2401
|
+
text = String.fromCharCode(164);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
else if (isNullOrUndefined(lineWidget.nextLine) && isEnableParaMark) {
|
|
2405
|
+
text = String.fromCharCode(182);
|
|
2406
|
+
}
|
|
2407
|
+
if (lineWidget.paragraph.containerWidget instanceof BodyWidget && !isNullOrUndefined(lineWidget.paragraph.nextRenderedWidget)) {
|
|
2408
|
+
if (lineWidget.paragraph.containerWidget.sectionIndex !== lineWidget.paragraph.nextRenderedWidget.containerWidget.sectionIndex && lineWidget.isLastLine()) {
|
|
2409
|
+
if (lineWidget.paragraph.nextRenderedWidget.containerWidget.sectionFormat.breakCode === 'NoBreak' && lineWidget.paragraph.containerWidget.index !== lineWidget.paragraph.nextRenderedWidget.containerWidget.index) {
|
|
2410
|
+
text = ':::::' + l10n.getConstant('Section Break Continuous') + ':::::';
|
|
2411
|
+
}
|
|
2412
|
+
else {
|
|
2413
|
+
text = ':::::' + l10n.getConstant('Section Break Next Page') + ':::::';
|
|
2414
|
+
}
|
|
2415
|
+
characterFont = this.retriveCharacterformat(currentCharFormat, 0.7);
|
|
2416
|
+
var previousWidget = lineWidget.paragraph.previousRenderedWidget;
|
|
2417
|
+
// If the previous paragraph is ends with page break and current paragraph is section break then add the width of the page break.
|
|
2418
|
+
if (previousWidget instanceof ParagraphWidget && previousWidget.isEndsWithPageBreak && lineWidget.paragraph.isSectionBreak) {
|
|
2419
|
+
var pageBreakText = this.getPageBreakText(previousWidget, l10n);
|
|
2420
|
+
// Calculating the width of the Page break. And 0.7 is previously used in retrieveCharacterFormat
|
|
2421
|
+
x += (this.documentHelper.textHelper.getWidth(pageBreakText, previousWidget.characterFormat, FontScriptType.English) * 0.7);
|
|
2422
|
+
// In layouting itself mark is calculated and Updated in X property.
|
|
2423
|
+
var paragraphMarkSize = this.documentHelper.textHelper.getParagraphMarkSize(previousWidget.characterFormat);
|
|
2424
|
+
x -= paragraphMarkSize.Width;
|
|
2425
|
+
}
|
|
2426
|
+
else if (lineWidget.isEndsWithPageBreak) {
|
|
2427
|
+
if (lineWidget.paragraph.bidi) {
|
|
2428
|
+
text = text + String.fromCharCode(182) + '.....' + l10n.getConstant('Page Break') + '.....';
|
|
2429
|
+
}
|
|
2430
|
+
else {
|
|
2431
|
+
text = '.....' + l10n.getConstant('Page Break') + '.....' + String.fromCharCode(182) + text;
|
|
2432
|
+
}
|
|
2433
|
+
}
|
|
2434
|
+
var textinfo = this.documentHelper.textHelper.getWidth(text, currentCharFormat, FontScriptType.English);
|
|
2435
|
+
if (this.viewer instanceof PageLayoutHelper) {
|
|
2436
|
+
if (lineWidget.paragraph.bidi) {
|
|
2437
|
+
if (x < (textinfo + this.viewer.clientActiveArea.x)) {
|
|
2438
|
+
text = ':::::';
|
|
2439
|
+
if (lineWidget.isEndsWithPageBreak) {
|
|
2440
|
+
text = ':::::.....';
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
}
|
|
2444
|
+
else {
|
|
2445
|
+
if ((x + textinfo - this.viewer.clientActiveArea.x) > (this.viewer.clientActiveArea.width)) {
|
|
2446
|
+
text = ':::::';
|
|
2447
|
+
if (lineWidget.isEndsWithPageBreak) {
|
|
2448
|
+
text = '.....:::::';
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
2453
|
+
else {
|
|
2454
|
+
if (lineWidget.paragraph.bidi) {
|
|
2455
|
+
if ((x - textinfo) < this.viewer.clientActiveArea.x) {
|
|
2456
|
+
text = ':::::';
|
|
2457
|
+
if (lineWidget.isEndsWithPageBreak) {
|
|
2458
|
+
text = ':::::.....';
|
|
2459
|
+
}
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
else {
|
|
2463
|
+
if ((x + textinfo - this.documentHelper.pages[0].boundingRectangle.x) > (this.viewer.clientActiveArea.width)) {
|
|
2464
|
+
text = ':::::';
|
|
2465
|
+
if (lineWidget.isEndsWithPageBreak) {
|
|
2466
|
+
text = '.....:::::';
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
}
|
|
2473
|
+
if (text.length > 0 && !(lineWidget.paragraph.characterFormat.hidden && lineWidget.paragraph.height === 0)) {
|
|
2474
|
+
if (lineWidget.paragraph.bidi && !lineWidget.paragraph.isEmpty()) {
|
|
2475
|
+
x -= this.documentHelper.textHelper.getWidth(text, currentCharFormat, FontScriptType.English);
|
|
2476
|
+
}
|
|
2477
|
+
if (paraFormat.firstLineIndent > 0 || (paraFormat.firstLineIndent < 0 && lineWidget.paragraph.isEmpty() && isEnableParaMark)) {
|
|
2478
|
+
x = left;
|
|
2479
|
+
}
|
|
2480
|
+
this.pageContext.font = characterFont;
|
|
2481
|
+
var kernPairs = /(?:AV|VA|AW|WA|To|Ta|Te|Ty|Yo)/;
|
|
2482
|
+
this.pageContext.fontKerning = 'auto';
|
|
2483
|
+
if (!currentCharFormat.isKernFont && kernPairs.test(text)) {
|
|
2484
|
+
this.pageContext.fontKerning = 'none';
|
|
2485
|
+
}
|
|
2486
|
+
var scaleFactor = currentCharFormat.scaling < 100 ? 1 : currentCharFormat.scaling / 100;
|
|
2487
|
+
this.pageContext.letterSpacing = currentCharFormat.characterSpacing * this.documentHelper.zoomFactor + 'pt';
|
|
2488
|
+
this.pageContext.save();
|
|
2489
|
+
this.pageContext.scale(scaleFactor, 1);
|
|
2490
|
+
this.pageContext.fillText(text, this.getScaledValue(x, 1) / (scaleFactor), this.getScaledValue(y, 2));
|
|
2491
|
+
this.pageContext.restore();
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
Renderer.prototype.getPageBreakText = function (paragraph, l10n) {
|
|
2496
|
+
if (paragraph.bidi) {
|
|
2497
|
+
return String.fromCharCode(182) + '.....' + l10n.getConstant('Page Break') + '.....';
|
|
2498
|
+
}
|
|
2499
|
+
else {
|
|
2500
|
+
return '.....' + l10n.getConstant('Page Break') + '.....' + String.fromCharCode(182);
|
|
2501
|
+
}
|
|
2502
|
+
};
|
|
2503
|
+
/**
|
|
2504
|
+
*
|
|
2505
|
+
* @private
|
|
2506
|
+
*/
|
|
2507
|
+
Renderer.prototype.isBookmarkEndAtStart = function (bookmark) {
|
|
2508
|
+
var para = bookmark.paragraph;
|
|
2509
|
+
var index = 0;
|
|
2510
|
+
var firstLine = para.childWidgets[index];
|
|
2511
|
+
var isBookmarkAtStart = true;
|
|
2512
|
+
while (firstLine.children.indexOf(bookmark) == -1) {
|
|
2513
|
+
firstLine = para.childWidgets[++index];
|
|
2514
|
+
if (index == para.childWidgets.length) {
|
|
2515
|
+
break;
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
if (bookmark.line != firstLine) {
|
|
2519
|
+
return false;
|
|
2520
|
+
}
|
|
2521
|
+
var bookmarkIndex = firstLine.children.indexOf(bookmark) >= 0 ? firstLine.children.indexOf(bookmark) : -1;
|
|
2522
|
+
for (var i = bookmarkIndex; i >= 0; i--) {
|
|
2523
|
+
var element = firstLine.children[i];
|
|
2524
|
+
if (this.isRenderable(element)) {
|
|
2525
|
+
isBookmarkAtStart = false;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
if (isBookmarkAtStart) {
|
|
2529
|
+
return true;
|
|
2530
|
+
}
|
|
2531
|
+
else {
|
|
2532
|
+
return false;
|
|
2533
|
+
}
|
|
2534
|
+
};
|
|
2535
|
+
Renderer.prototype.isRenderable = function (element) {
|
|
2536
|
+
if (!(element instanceof BookmarkElementBox || element instanceof EditRangeStartElementBox || element instanceof EditRangeEndElementBox)) {
|
|
2537
|
+
return true;
|
|
2538
|
+
}
|
|
2539
|
+
return false;
|
|
2540
|
+
};
|
|
2541
|
+
Renderer.prototype.combineHexColors = function (color1, color2) {
|
|
2542
|
+
var hex1 = color1.replace("#", "");
|
|
2543
|
+
var hex2 = color2.replace("#", "");
|
|
2544
|
+
var r1 = parseInt(hex1.substring(0, 2), 16);
|
|
2545
|
+
var g1 = parseInt(hex1.substring(2, 4), 16);
|
|
2546
|
+
var b1 = parseInt(hex1.substring(4, 6), 16);
|
|
2547
|
+
var r2 = parseInt(hex2.substring(0, 2), 16);
|
|
2548
|
+
var g2 = parseInt(hex2.substring(2, 4), 16);
|
|
2549
|
+
var b2 = parseInt(hex2.substring(4, 6), 16);
|
|
2550
|
+
var r = Math.round((r1 * 0.35) + (r2 * 0.65));
|
|
2551
|
+
var g = Math.round((g1 * 0.35) + (g2 * 0.65));
|
|
2552
|
+
var b = Math.round((b1 * 0.35) + (b2 * 0.65));
|
|
2553
|
+
var mixedColor = "#" + r.toString(16) + g.toString(16) + b.toString(16);
|
|
2554
|
+
return mixedColor;
|
|
2555
|
+
};
|
|
2556
|
+
Renderer.prototype.renderBookmark = function (x, y, height, type, restrictColor) {
|
|
2557
|
+
if (this.isPrinting) {
|
|
2558
|
+
return;
|
|
2559
|
+
}
|
|
2560
|
+
this.pageContext.beginPath();
|
|
2561
|
+
this.pageContext.lineWidth = 1.5;
|
|
2562
|
+
var extensionLength = 3;
|
|
2563
|
+
if (type == 0) {
|
|
2564
|
+
this.pageContext.moveTo(x + extensionLength, y);
|
|
2565
|
+
this.pageContext.lineTo(x, y);
|
|
2566
|
+
this.pageContext.lineTo(x, y + height);
|
|
2567
|
+
this.pageContext.lineTo(x + extensionLength, y + height);
|
|
2568
|
+
}
|
|
2569
|
+
if (type == 1) {
|
|
2570
|
+
this.pageContext.moveTo(x - extensionLength, y);
|
|
2571
|
+
this.pageContext.lineTo(x, y);
|
|
2572
|
+
this.pageContext.lineTo(x, y + height);
|
|
2573
|
+
this.pageContext.lineTo(x - extensionLength, y + height);
|
|
2574
|
+
}
|
|
2575
|
+
this.pageContext.strokeStyle = "#7F7F7F";
|
|
2576
|
+
this.pageContext.stroke();
|
|
2577
|
+
this.pageContext.closePath();
|
|
2578
|
+
if (!isNullOrUndefined(restrictColor)) {
|
|
2579
|
+
var combinedColor = this.combineHexColors(restrictColor, "#7F7F7F");
|
|
2580
|
+
this.pageContext.fillStyle = combinedColor;
|
|
2581
|
+
this.pageContext.fillRect(x, y, 1.5, height);
|
|
2582
|
+
}
|
|
2583
|
+
};
|
|
2584
|
+
Renderer.prototype.retriveCharacterformat = function (character, fontSizeFactor) {
|
|
2585
|
+
if (isNullOrUndefined(fontSizeFactor)) {
|
|
2586
|
+
fontSizeFactor = 1;
|
|
2587
|
+
}
|
|
2588
|
+
var font = '';
|
|
2589
|
+
this.pageContext.textBaseline = 'alphabetic';
|
|
2590
|
+
var bold = '';
|
|
2591
|
+
var italic = '';
|
|
2592
|
+
var fontSize = 11;
|
|
2593
|
+
var fontFamily = '';
|
|
2594
|
+
bold = character.bold ? 'bold' : '';
|
|
2595
|
+
italic = character.italic ? 'italic' : '';
|
|
2596
|
+
fontSize = character.fontSize === 0 ? 0.5 : character.fontSize / (character.baselineAlignment === 'Normal' ? 1 : 1.5);
|
|
2597
|
+
fontSize = this.isPrinting ? fontSize * fontSizeFactor : fontSize * this.documentHelper.zoomFactor * fontSizeFactor;
|
|
2598
|
+
fontFamily = character.fontFamily;
|
|
2599
|
+
font = bold + ' ' + italic + ' ' + fontSize + 'pt' + ' ' + '"' + fontFamily + '"';
|
|
2600
|
+
return font;
|
|
2601
|
+
};
|
|
2602
|
+
Renderer.prototype.toSkipFieldCode = function (element) {
|
|
2603
|
+
if (element instanceof FieldElementBox) {
|
|
2604
|
+
if (element.fieldType === 0) {
|
|
2605
|
+
if (!this.isFieldCode && (!isNullOrUndefined(element.fieldEnd) || element.hasFieldEnd)) {
|
|
2606
|
+
this.fieldStacks.push(element);
|
|
2607
|
+
this.isFieldCode = true;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
else if (element.fieldType === 2 || element.fieldType === 1) {
|
|
2611
|
+
if (this.fieldStacks.length > 0 && element.fieldBegin === this.fieldStacks[this.fieldStacks.length - 1]) {
|
|
2612
|
+
this.fieldStacks.pop();
|
|
2613
|
+
this.isFieldCode = false;
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
};
|
|
2618
|
+
Renderer.prototype.getUnderlineYPosition = function (lineWidget) {
|
|
2619
|
+
var height = 0;
|
|
2620
|
+
var lineHeight = 0;
|
|
2621
|
+
for (var i = 0; i < lineWidget.children.length; i++) {
|
|
2622
|
+
var elementBox = lineWidget.children[i];
|
|
2623
|
+
if (elementBox instanceof FieldElementBox ||
|
|
2624
|
+
(elementBox.width === 0 && elementBox.height === 0)) {
|
|
2625
|
+
continue;
|
|
2626
|
+
}
|
|
2627
|
+
if (elementBox instanceof ShapeElementBox || (elementBox instanceof ImageElementBox && elementBox.textWrappingStyle !== 'Inline')) {
|
|
2628
|
+
continue;
|
|
2629
|
+
}
|
|
2630
|
+
else {
|
|
2631
|
+
if (height < elementBox.height + elementBox.margin.top) {
|
|
2632
|
+
height = elementBox.margin.top + elementBox.height;
|
|
2633
|
+
lineHeight = (elementBox instanceof ImageElementBox) ? 0.9 : elementBox.height / 20;
|
|
2634
|
+
}
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2637
|
+
return LayoutHelperMethods.containsUnderlinedImage(lineWidget) ? height + 2 * lineHeight : height - 2 * lineHeight;
|
|
2638
|
+
};
|
|
2639
|
+
Renderer.prototype.renderListTextElementBox = function (elementBox, left, top, underlineY) {
|
|
2640
|
+
var shift = elementBox.alignmentShift;
|
|
2641
|
+
if (shift > 0) {
|
|
2642
|
+
// Center and right aligned number is drawn to the left of its layout box with its actual width.
|
|
2643
|
+
elementBox.width += shift;
|
|
2644
|
+
this.renderListTextElement(elementBox, left - shift, top, underlineY);
|
|
2645
|
+
elementBox.width -= shift;
|
|
2646
|
+
}
|
|
2647
|
+
else {
|
|
2648
|
+
this.renderListTextElement(elementBox, left, top, underlineY);
|
|
2649
|
+
}
|
|
2650
|
+
};
|
|
2651
|
+
Renderer.prototype.renderListTextElement = function (elementBox, left, top, underlineY) {
|
|
2652
|
+
var topMargin = elementBox.margin.top;
|
|
2653
|
+
var leftMargin = elementBox.margin.left;
|
|
2654
|
+
var format = elementBox.listLevel.characterFormat;
|
|
2655
|
+
var breakCharacterFormat = elementBox.line.paragraph.characterFormat;
|
|
2656
|
+
var color = format.hasValue('fontColor') ? format.fontColor : breakCharacterFormat.fontColor;
|
|
2657
|
+
// To skip the underline for multi revision scenerio
|
|
2658
|
+
var skipUnderline = breakCharacterFormat.revisionLength > 1;
|
|
2659
|
+
if (breakCharacterFormat.revisionLength > 0) {
|
|
2660
|
+
var revisionInfo_1 = this.checkRevisionType(breakCharacterFormat);
|
|
2661
|
+
color = this.getRevisionColor(revisionInfo_1);
|
|
2662
|
+
}
|
|
2663
|
+
else if (breakCharacterFormat.revisionLength === 0 &&
|
|
2664
|
+
(elementBox.text.indexOf('\u001F') > -1
|
|
2665
|
+
|| (elementBox.previousElement instanceof ListTextElementBox && elementBox.previousElement.text.indexOf('\u001F') > -1 && elementBox.text === "\t"))) {
|
|
2666
|
+
color = "#0f3d57";
|
|
2667
|
+
}
|
|
2668
|
+
this.pageContext.textBaseline = 'alphabetic';
|
|
2669
|
+
var bold = '';
|
|
2670
|
+
var italic = '';
|
|
2671
|
+
var fontFamily = format.hasValue('fontFamily') ? format.fontFamily : breakCharacterFormat.fontFamily;
|
|
2672
|
+
if ((this.documentHelper.isIosDevice || this.documentHelper.isLinuxOS) && (elementBox.text === String.fromCharCode(9679) || elementBox.text === String.fromCharCode(9675))) {
|
|
2673
|
+
fontFamily = '';
|
|
2674
|
+
}
|
|
2675
|
+
var fontSize = format.hasValue('fontSize') ? format.fontSize : breakCharacterFormat.fontSize;
|
|
2676
|
+
var baselineAlignment = format.hasValue('baselineAlignment') ? format.baselineAlignment : breakCharacterFormat.baselineAlignment;
|
|
2677
|
+
bold = format.hasValue('bold') ? format.bold ? 'bold' : '' : breakCharacterFormat.bold ? 'bold' : '';
|
|
2678
|
+
italic = format.hasValue('italic') ? format.italic ? 'italic' : '' : breakCharacterFormat.italic ? 'italic' : '';
|
|
2679
|
+
if (!isNullOrUndefined(elementBox.paragraph.paragraphFormat.listFormat.listLevel) && elementBox.paragraph.paragraphFormat.listFormat.listLevel.listLevelPattern === "Bullet" && !format.bold) {
|
|
2680
|
+
bold = '';
|
|
2681
|
+
}
|
|
2682
|
+
if (!isNullOrUndefined(elementBox.paragraph.paragraphFormat.listFormat.listLevel) && elementBox.paragraph.paragraphFormat.listFormat.listLevel.listLevelPattern === "Bullet" && !format.italic) {
|
|
2683
|
+
italic = '';
|
|
2684
|
+
}
|
|
2685
|
+
fontSize = fontSize === 0 ? 0.5 : fontSize / (baselineAlignment === 'Normal' ? 1 : 1.5);
|
|
2686
|
+
fontSize = (this.isPrinting) ? fontSize : fontSize * this.documentHelper.zoomFactor;
|
|
2687
|
+
var strikethrough = format.hasValue('strikethrough') ? format.strikethrough : breakCharacterFormat.strikethrough;
|
|
2688
|
+
var highlightColor = format.hasValue('highlightColor') ? format.highlightColor : breakCharacterFormat.highlightColor;
|
|
2689
|
+
if (highlightColor !== 'NoColor') {
|
|
2690
|
+
if (highlightColor.substring(0, 1) !== '#') {
|
|
2691
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getHighlightColorCode(highlightColor);
|
|
2692
|
+
}
|
|
2693
|
+
else {
|
|
2694
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(highlightColor);
|
|
2695
|
+
}
|
|
2696
|
+
this.pageContext.fillRect(Math.floor(this.getScaledValue(left + leftMargin, 1)), Math.floor(this.getScaledValue(top + topMargin, 2) - 1), Math.ceil(this.getScaledValue(elementBox.width) + 1), Math.ceil(this.getScaledValue(elementBox.height) + 1));
|
|
2697
|
+
}
|
|
2698
|
+
this.pageContext.font = bold + ' ' + italic + ' ' + fontSize + 'pt' + ' ' + '"' + fontFamily + '"';
|
|
2699
|
+
var kernPairs = /(?:AV|VA|AW|WA|To|Ta|Te|Ty|Yo)/;
|
|
2700
|
+
this.pageContext.fontKerning = 'auto';
|
|
2701
|
+
if (!format.isKernFont && kernPairs.test(elementBox.text)) {
|
|
2702
|
+
this.pageContext.fontKerning = 'none';
|
|
2703
|
+
}
|
|
2704
|
+
if (baselineAlignment === 'Subscript') {
|
|
2705
|
+
topMargin += elementBox.height - elementBox.height / 1.5;
|
|
2706
|
+
}
|
|
2707
|
+
var baselineOffset = elementBox.baselineOffset;
|
|
2708
|
+
topMargin = (format.baselineAlignment === 'Normal') ? topMargin + baselineOffset : (topMargin + (baselineOffset / 1.5));
|
|
2709
|
+
var text = elementBox.text;
|
|
2710
|
+
var isParaBidi = elementBox.paragraph.paragraphFormat.bidi;
|
|
2711
|
+
if (isParaBidi) {
|
|
2712
|
+
this.pageContext.direction = 'rtl';
|
|
2713
|
+
left += elementBox.width;
|
|
2714
|
+
}
|
|
2715
|
+
// "empty" is old value used for auto color till v19.2.49. It is maintained for backward compatibility.
|
|
2716
|
+
if (color === "empty" || color === '#00000000') {
|
|
2717
|
+
var bgColor = this.getBackgroundColorHeirachy(elementBox);
|
|
2718
|
+
this.pageContext.fillStyle = this.getDefaultFontColor(bgColor);
|
|
2719
|
+
}
|
|
2720
|
+
else {
|
|
2721
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(color);
|
|
2722
|
+
}
|
|
2723
|
+
var scaleFactor = format.scaling < 100 ? 1 : format.scaling / 100;
|
|
2724
|
+
if (text && text.indexOf('\u001F') > -1 && !isNullOrUndefined(elementBox.dualWidths)) {
|
|
2725
|
+
var parts = text.split('\u001F');
|
|
2726
|
+
var w1 = elementBox.dualWidths.w1;
|
|
2727
|
+
var w2 = elementBox.dualWidths.w2;
|
|
2728
|
+
var baseLeft = isParaBidi ? (left - elementBox.width) + leftMargin : left + leftMargin;
|
|
2729
|
+
var currentLeft = baseLeft;
|
|
2730
|
+
this.pageContext.letterSpacing = format.characterSpacing * this.documentHelper.zoomFactor + 'pt';
|
|
2731
|
+
this.pageContext.save();
|
|
2732
|
+
this.pageContext.scale(scaleFactor, 1);
|
|
2733
|
+
for (var i = 0; i < parts.length; i++) {
|
|
2734
|
+
var partText = parts[i];
|
|
2735
|
+
var partWidth = (i === 0 ? w1 : w2);
|
|
2736
|
+
var isStrike = i === 0;
|
|
2737
|
+
var textX = void 0;
|
|
2738
|
+
if (isParaBidi) {
|
|
2739
|
+
textX = currentLeft + partWidth;
|
|
2740
|
+
}
|
|
2741
|
+
else {
|
|
2742
|
+
textX = currentLeft;
|
|
2743
|
+
}
|
|
2744
|
+
this.pageContext.fillText(partText, this.getScaledValue(textX, 1) / scaleFactor, this.getScaledValue(top + topMargin, 2));
|
|
2745
|
+
var decorLeft = currentLeft;
|
|
2746
|
+
if (isStrike) {
|
|
2747
|
+
this.renderStrikeThrough(__assign({}, elementBox, { width: partWidth }), decorLeft, top, format.strikethrough, color, baselineAlignment, { type: 'Deletion', color: color });
|
|
2748
|
+
}
|
|
2749
|
+
else {
|
|
2750
|
+
this.renderUnderline(__assign({}, elementBox, { width: partWidth }), decorLeft, top, underlineY, color, format.underline, baselineAlignment, { type: 'Insertion', color: color });
|
|
2751
|
+
}
|
|
2752
|
+
currentLeft += partWidth;
|
|
2753
|
+
}
|
|
2754
|
+
this.pageContext.restore();
|
|
2755
|
+
if (isParaBidi) {
|
|
2756
|
+
this.pageContext.direction = 'ltr';
|
|
2757
|
+
left -= elementBox.width;
|
|
2758
|
+
}
|
|
2759
|
+
return;
|
|
2760
|
+
}
|
|
2761
|
+
if (this.documentHelper.documentEditorSettings.showHiddenMarks && !this.isPrinting) {
|
|
2762
|
+
if (elementBox instanceof ListTextElementBox && elementBox.text === "\t") {
|
|
2763
|
+
this.tabMark(elementBox, format, left, top, leftMargin, topMargin);
|
|
2764
|
+
}
|
|
2765
|
+
this.pageContext.letterSpacing = format.characterSpacing * this.documentHelper.zoomFactor + 'pt';
|
|
2766
|
+
this.pageContext.save();
|
|
2767
|
+
this.pageContext.scale(scaleFactor, 1);
|
|
2768
|
+
this.pageContext.fillText(this.replaceSpace(text), this.getScaledValue(left + leftMargin, 1) / scaleFactor, this.getScaledValue(top + topMargin, 2), this.getScaledValue(elementBox.width));
|
|
2769
|
+
this.pageContext.restore();
|
|
2770
|
+
}
|
|
2771
|
+
else {
|
|
2772
|
+
this.pageContext.letterSpacing = format.characterSpacing * this.documentHelper.zoomFactor + 'pt';
|
|
2773
|
+
this.pageContext.save();
|
|
2774
|
+
this.pageContext.scale(scaleFactor, 1);
|
|
2775
|
+
this.pageContext.fillText(text, this.getScaledValue(left + leftMargin, 1) / scaleFactor, this.getScaledValue(top + topMargin, 2), this.getScaledValue(elementBox.width));
|
|
2776
|
+
this.pageContext.restore();
|
|
2777
|
+
}
|
|
2778
|
+
if (isParaBidi) {
|
|
2779
|
+
this.pageContext.direction = 'ltr';
|
|
2780
|
+
left -= elementBox.width;
|
|
2781
|
+
}
|
|
2782
|
+
var revisionInfo = this.checkRevisionType(breakCharacterFormat);
|
|
2783
|
+
var currentInfo = this.getRevisionType(revisionInfo, true);
|
|
2784
|
+
if (format.underline !== 'None' && !isNullOrUndefined(format.underline) || ((!isNullOrUndefined(currentInfo) && !skipUnderline && (currentInfo.type === 'Insertion' || currentInfo.type === 'MoveTo')) ||
|
|
2785
|
+
(elementBox.previousElement instanceof ListTextElementBox && elementBox.previousElement.text.indexOf('\u001F') > -1 && elementBox.text === "\t"))) {
|
|
2786
|
+
this.renderUnderline(elementBox, left, top, underlineY, color, format.underline, baselineAlignment, currentInfo);
|
|
2787
|
+
}
|
|
2788
|
+
currentInfo = this.getRevisionType(revisionInfo, false);
|
|
2789
|
+
if (strikethrough !== 'None' || (!isNullOrUndefined(currentInfo) && (currentInfo.type === 'Deletion' || currentInfo.type === 'MoveFrom'))) {
|
|
2790
|
+
this.renderStrikeThrough(elementBox, left, top, format.strikethrough, color, baselineAlignment, currentInfo);
|
|
2791
|
+
}
|
|
2792
|
+
};
|
|
2793
|
+
Renderer.prototype.getDefaultFontColor = function (backColor) {
|
|
2794
|
+
if (LayoutHelperMethods.isVeryDark(backColor)) {
|
|
2795
|
+
return "#FFFFFF";
|
|
2796
|
+
}
|
|
2797
|
+
else {
|
|
2798
|
+
return "#000000";
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
// Returns true when every character in the element is a word-split character
|
|
2802
|
+
Renderer.prototype.isElementAllWordSplit = function (elem) {
|
|
2803
|
+
if (isNullOrUndefined(elem) || isNullOrUndefined(elem.text)) {
|
|
2804
|
+
return false;
|
|
2805
|
+
}
|
|
2806
|
+
for (var i = 0; i < elem.text.length; i++) {
|
|
2807
|
+
if (!this.documentHelper.textHelper.isWordSplitChar(elem.text[i])) {
|
|
2808
|
+
return false;
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
return true;
|
|
2812
|
+
};
|
|
2813
|
+
// Returns true when the element should be ignored for RTL scanning
|
|
2814
|
+
// (e.g. all word-split characters or numeric-only runs).
|
|
2815
|
+
Renderer.prototype.isSkippableElement = function (elem) {
|
|
2816
|
+
if (isNullOrUndefined(elem) || isNullOrUndefined(elem.text)) {
|
|
2817
|
+
return false;
|
|
2818
|
+
}
|
|
2819
|
+
if (this.isElementAllWordSplit(elem)) {
|
|
2820
|
+
return true;
|
|
2821
|
+
}
|
|
2822
|
+
// treat numeric-only elements as skippable too
|
|
2823
|
+
if (this.documentHelper.textHelper.containsNumberAlone(elem.text)) {
|
|
2824
|
+
return true;
|
|
2825
|
+
}
|
|
2826
|
+
return false;
|
|
2827
|
+
};
|
|
2828
|
+
// Determines whether the nearest preceding (non-skippable) element is RTL.
|
|
2829
|
+
Renderer.prototype.prevIsRTL = function (prevElem) {
|
|
2830
|
+
if (isNullOrUndefined(prevElem)) {
|
|
2831
|
+
return false;
|
|
2832
|
+
}
|
|
2833
|
+
if (this.isSkippableElement(prevElem)) {
|
|
2834
|
+
var scan = prevElem.previousElement instanceof TextElementBox ? prevElem.previousElement : undefined;
|
|
2835
|
+
while (scan && this.isSkippableElement(scan)) {
|
|
2836
|
+
scan = scan.previousElement instanceof TextElementBox ? scan.previousElement : undefined;
|
|
2837
|
+
}
|
|
2838
|
+
return !isNullOrUndefined(scan) && this.documentHelper.textHelper.isRTLText(scan.text);
|
|
2839
|
+
}
|
|
2840
|
+
return this.documentHelper.textHelper.isRTLText(prevElem.text);
|
|
2841
|
+
};
|
|
2842
|
+
// Determines whether the nearest following (non-skippable) element is RTL.
|
|
2843
|
+
Renderer.prototype.nextIsRTL = function (nextElem) {
|
|
2844
|
+
if (isNullOrUndefined(nextElem)) {
|
|
2845
|
+
return false;
|
|
2846
|
+
}
|
|
2847
|
+
if (this.isSkippableElement(nextElem)) {
|
|
2848
|
+
var scan = nextElem.nextElement instanceof TextElementBox ? nextElem.nextElement : undefined;
|
|
2849
|
+
while (scan && this.isSkippableElement(scan)) {
|
|
2850
|
+
scan = scan.nextElement instanceof TextElementBox ? scan.nextElement : undefined;
|
|
2851
|
+
}
|
|
2852
|
+
return !isNullOrUndefined(scan) && this.documentHelper.textHelper.isRTLText(scan.text);
|
|
2853
|
+
}
|
|
2854
|
+
return this.documentHelper.textHelper.isRTLText(nextElem.text);
|
|
2855
|
+
};
|
|
2856
|
+
/**
|
|
2857
|
+
*
|
|
2858
|
+
* @private
|
|
2859
|
+
* @returns {boolean}
|
|
2860
|
+
*/
|
|
2861
|
+
Renderer.prototype.checkFormatToCombineText = function (currentFormat, previousFormat) {
|
|
2862
|
+
return (currentFormat.fontSize === previousFormat.fontSize
|
|
2863
|
+
&& currentFormat.fontFamily === previousFormat.fontFamily
|
|
2864
|
+
&& currentFormat.bold === previousFormat.bold
|
|
2865
|
+
&& currentFormat.italic === previousFormat.italic
|
|
2866
|
+
&& currentFormat.baselineAlignment === previousFormat.baselineAlignment
|
|
2867
|
+
&& currentFormat.bidi === previousFormat.bidi
|
|
2868
|
+
&& currentFormat.bdo === previousFormat.bdo
|
|
2869
|
+
&& currentFormat.allCaps === previousFormat.allCaps
|
|
2870
|
+
&& currentFormat.complexScript === previousFormat.complexScript
|
|
2871
|
+
&& currentFormat.fontFamilyAscii === previousFormat.fontFamilyAscii
|
|
2872
|
+
&& currentFormat.fontFamilyBidi === previousFormat.fontFamilyBidi
|
|
2873
|
+
&& currentFormat.fontFamilyFarEast === previousFormat.fontFamilyFarEast
|
|
2874
|
+
&& currentFormat.characterSpacing === previousFormat.characterSpacing
|
|
2875
|
+
&& currentFormat.scaling === previousFormat.scaling
|
|
2876
|
+
&& currentFormat.isKernFont === previousFormat.isKernFont
|
|
2877
|
+
&& currentFormat.kern === previousFormat.kern
|
|
2878
|
+
&& currentFormat.fontFamilyNonFarEast === previousFormat.fontFamilyNonFarEast
|
|
2879
|
+
&& currentFormat.hidden === previousFormat.hidden);
|
|
2880
|
+
};
|
|
2881
|
+
Renderer.prototype.renderTextElementBox = function (elementBox, left, top, underlineY) {
|
|
2882
|
+
var isHeightType = false;
|
|
2883
|
+
var containerWidget = elementBox.line.paragraph.containerWidget;
|
|
2884
|
+
if (containerWidget instanceof TableCellWidget) {
|
|
2885
|
+
isHeightType = (containerWidget.ownerRow.rowFormat.heightType === 'Exactly');
|
|
2886
|
+
if (containerWidget.cellFormat.rowSpan > 1 && containerWidget.ownerTable && containerWidget.ownerRow) {
|
|
2887
|
+
var row = containerWidget.ownerTable.childWidgets[containerWidget.ownerRow.index + containerWidget.cellFormat.rowSpan - 1];
|
|
2888
|
+
if (!isNullOrUndefined(row)) {
|
|
2889
|
+
isHeightType = row.rowFormat.heightType === 'Exactly';
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
}
|
|
2893
|
+
var topMargin = elementBox.margin.top;
|
|
2894
|
+
var leftMargin = elementBox.margin.left;
|
|
2895
|
+
if (isHeightType && containerWidget instanceof TableCellWidget) {
|
|
2896
|
+
var width = (containerWidget.width + containerWidget.margin.left + containerWidget.margin.right) - containerWidget.leftBorderWidth;
|
|
2897
|
+
this.clipRect(containerWidget.x - containerWidget.margin.left, containerWidget.y, this.getScaledValue(width), this.getScaledValue(containerWidget.height));
|
|
2898
|
+
}
|
|
2899
|
+
var format = elementBox.characterFormat;
|
|
2900
|
+
var doHighLight = true;
|
|
2901
|
+
if (format.highlightColor != "NoColor" && elementBox.text.trim() == "") {
|
|
2902
|
+
var firstLine = elementBox.line.paragraph.firstChild;
|
|
2903
|
+
var lastLine = elementBox.line.paragraph.lastChild;
|
|
2904
|
+
if (!isNullOrUndefined(firstLine) && firstLine instanceof LineWidget
|
|
2905
|
+
&& firstLine.children.length > 0 && elementBox === firstLine.children[0]) {
|
|
2906
|
+
doHighLight = false;
|
|
2907
|
+
}
|
|
2908
|
+
if (!isNullOrUndefined(lastLine) && lastLine instanceof LineWidget
|
|
2909
|
+
&& lastLine.children.length > 0 && elementBox === lastLine.children[lastLine.children.length - 1]) {
|
|
2910
|
+
doHighLight = false;
|
|
2911
|
+
}
|
|
2912
|
+
}
|
|
2913
|
+
var isInEditableRegion = !this.isPrinting && this.documentHelper &&
|
|
2914
|
+
!isNullOrUndefined(this.documentHelper.editorProperties.editRegionHighlighters) &&
|
|
2915
|
+
this.documentHelper.editorProperties.editRegionHighlighters.containsKey(elementBox.line);
|
|
2916
|
+
if (format.highlightColor !== 'NoColor' && doHighLight && !isInEditableRegion) {
|
|
2917
|
+
if (format.highlightColor.substring(0, 1) !== '#') {
|
|
2918
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getHighlightColorCode(format.highlightColor);
|
|
2919
|
+
}
|
|
2920
|
+
else {
|
|
2921
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(format.highlightColor);
|
|
2922
|
+
}
|
|
2923
|
+
this.pageContext.fillRect(Math.floor(this.getScaledValue(left + leftMargin, 1)), Math.floor(this.getScaledValue(top + topMargin, 2) - 1), Math.ceil(this.getScaledValue(elementBox.width) + 1), Math.ceil(this.getScaledValue(elementBox.height) + 1));
|
|
2924
|
+
}
|
|
2925
|
+
var revisionInfo = this.checkRevisionType(elementBox);
|
|
2926
|
+
var color = revisionInfo.length > 0 ? this.getRevisionColor(revisionInfo) : format.fontColor;
|
|
2927
|
+
this.pageContext.textBaseline = 'alphabetic';
|
|
2928
|
+
var isRTL = format.bidi || this.documentHelper.textHelper.isRTLText(elementBox.text);
|
|
2929
|
+
var isBidi = isRTL || format.complexScript;
|
|
2930
|
+
var bold = '';
|
|
2931
|
+
var italic = '';
|
|
2932
|
+
var fontSize = 11;
|
|
2933
|
+
bold = isBidi ? (format.boldBidi ? 'bold' : '') : (format.bold ? 'bold' : '');
|
|
2934
|
+
italic = isBidi ? (format.italicBidi ? 'italic' : '') : (format.italic ? 'italic' : '');
|
|
2935
|
+
fontSize = format.fontSize === 0 ? 0.5 : (isBidi ? format.fontSizeBidi : format.fontSize) / (format.baselineAlignment === 'Normal' ? 1 : 1.5);
|
|
2936
|
+
fontSize = this.isPrinting ? fontSize : fontSize * this.documentHelper.zoomFactor;
|
|
2937
|
+
var renderFontFamily = this.documentHelper.textHelper.getFontNameToRender(elementBox.scriptType, format);
|
|
2938
|
+
this.pageContext.font = bold + ' ' + italic + ' ' + fontSize + 'pt' + ' ' + '"' + renderFontFamily + '"';
|
|
2939
|
+
var kernPairs = /(?:AV|VA|AW|WA|To|Ta|Te|Ty|Yo)/;
|
|
2940
|
+
this.pageContext.fontKerning = 'auto';
|
|
2941
|
+
if (!format.isKernFont && kernPairs.test(elementBox.text)) {
|
|
2942
|
+
this.pageContext.fontKerning = 'none';
|
|
2943
|
+
}
|
|
2944
|
+
if (format.baselineAlignment === 'Subscript') {
|
|
2945
|
+
topMargin += elementBox.height - elementBox.height / 1.5;
|
|
2946
|
+
}
|
|
2947
|
+
var baselineOffset = elementBox.baselineOffset;
|
|
2948
|
+
topMargin = (format.baselineAlignment === 'Normal') ? topMargin + baselineOffset : (topMargin + (baselineOffset / 1.5));
|
|
2949
|
+
// "empty" is old value used for auto color till v19.2.49. It is maintained for backward compatibility.
|
|
2950
|
+
if (color === "empty" || color === '#00000000') {
|
|
2951
|
+
var bgColor = this.getBackgroundColorHeirachy(elementBox);
|
|
2952
|
+
this.pageContext.fillStyle = this.getDefaultFontColor(bgColor);
|
|
2953
|
+
}
|
|
2954
|
+
else {
|
|
2955
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(color);
|
|
2956
|
+
}
|
|
2957
|
+
var scaledWidth = this.getScaledValue(elementBox.width);
|
|
2958
|
+
var text = elementBox.text;
|
|
2959
|
+
if (elementBox instanceof TabElementBox) {
|
|
2960
|
+
var tabElement = elementBox;
|
|
2961
|
+
if (tabElement.tabText === '' && !isNullOrUndefined(tabElement.tabLeader) && tabElement.tabLeader !== 'None') {
|
|
2962
|
+
text = this.getTabLeader(elementBox);
|
|
2963
|
+
tabElement.tabText = text;
|
|
2964
|
+
}
|
|
2965
|
+
else if (tabElement.tabText !== '') {
|
|
2966
|
+
text = tabElement.tabText;
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
//this.pageContext.direction = 'ltr';
|
|
2970
|
+
text = this.documentHelper.textHelper.setText(text, isRTL, format.bdo, true);
|
|
2971
|
+
if (elementBox instanceof FieldTextElementBox && elementBox.isRtlPageNumber) {
|
|
2972
|
+
text = LayoutHelperMethods.reverseString(text);
|
|
2973
|
+
}
|
|
2974
|
+
var line = elementBox.line;
|
|
2975
|
+
var index = line.renderedElements.indexOf(elementBox);
|
|
2976
|
+
if (index > 0) {
|
|
2977
|
+
var previousElement = line.renderedElements[index - 1];
|
|
2978
|
+
if (previousElement && elementBox.scriptType !== FontScriptType.Hebrew && this.checkFormatToCombineText(elementBox.characterFormat, previousElement.characterFormat) &&
|
|
2979
|
+
!LayoutHelperMethods.startsWith(elementBox.text, ' ') && !LayoutHelperMethods.endsWith(previousElement.text)
|
|
2980
|
+
&& elementBox.characterFormat.bidi && previousElement.characterFormat.bidi
|
|
2981
|
+
&& elementBox.characterRange === CharacterRangeType.RightToLeft
|
|
2982
|
+
&& previousElement.characterRange === CharacterRangeType.RightToLeft) {
|
|
2983
|
+
text += '\u200D'; //Use ZWJ (Zero Width Joiner - \u200D) at the boundary to join RTL text.
|
|
2984
|
+
}
|
|
2985
|
+
}
|
|
2986
|
+
if (format.allCaps) {
|
|
2987
|
+
text = text.toUpperCase();
|
|
2988
|
+
}
|
|
2989
|
+
var characterRange = elementBox.characterRange;
|
|
2990
|
+
// True when the current element is flanked by RTL text on both sides;
|
|
2991
|
+
// used to decide contextual inversion / ligature handling.
|
|
2992
|
+
var isBetweenRTL = false;
|
|
2993
|
+
var prevElem = elementBox.previousElement instanceof TextElementBox ? elementBox.previousElement : undefined;
|
|
2994
|
+
var nextElem = elementBox.nextElement instanceof TextElementBox ? elementBox.nextElement : undefined;
|
|
2995
|
+
isBetweenRTL = this.prevIsRTL(prevElem) && (this.nextIsRTL(nextElem) || isNullOrUndefined(nextElem));
|
|
2996
|
+
if ((((characterRange == CharacterRangeType.WordSplit) ||
|
|
2997
|
+
(((characterRange & CharacterRangeType.WordSplit) == CharacterRangeType.WordSplit) &&
|
|
2998
|
+
((characterRange & CharacterRangeType.RightToLeft) == CharacterRangeType.RightToLeft))) && format.bidi) || (this.documentHelper.characterFormat.ligature === "StandardContextual" && isBetweenRTL)) {
|
|
2999
|
+
text = this.documentHelper.textHelper.inverseCharacter(text);
|
|
3000
|
+
}
|
|
3001
|
+
var scaleFactor = format.scaling < 100 ? 1 : format.scaling / 100;
|
|
3002
|
+
if (characterRange === CharacterRangeType.RightToLeft && !LayoutHelperMethods.startsWith(text, ' ')) {
|
|
3003
|
+
this.pageContext.direction = 'rtl';
|
|
3004
|
+
left += elementBox.width;
|
|
3005
|
+
}
|
|
3006
|
+
if (this.documentHelper.documentEditorSettings.showHiddenMarks && !this.isPrinting) {
|
|
3007
|
+
if ((elementBox instanceof TabElementBox || elementBox instanceof TextElementBox) && elementBox.text === "\t") {
|
|
3008
|
+
this.tabMark(elementBox, format, left, top, leftMargin, topMargin);
|
|
3009
|
+
}
|
|
3010
|
+
if (text === '\r') {
|
|
3011
|
+
text = String.fromCharCode(182);
|
|
3012
|
+
}
|
|
3013
|
+
this.pageContext.letterSpacing = format.characterSpacing * this.documentHelper.zoomFactor + 'pt';
|
|
3014
|
+
this.pageContext.save();
|
|
3015
|
+
this.pageContext.scale(scaleFactor, 1);
|
|
3016
|
+
this.pageContext.fillText(this.replaceSpace(text), this.getScaledValue(left + leftMargin, 1) / (scaleFactor), this.getScaledValue(top + topMargin, 2), scaledWidth);
|
|
3017
|
+
this.pageContext.restore();
|
|
3018
|
+
}
|
|
3019
|
+
else {
|
|
3020
|
+
this.pageContext.letterSpacing = format.characterSpacing * this.documentHelper.zoomFactor + 'pt';
|
|
3021
|
+
this.pageContext.save();
|
|
3022
|
+
this.pageContext.scale(scaleFactor, 1);
|
|
3023
|
+
// Text frame align position.
|
|
3024
|
+
if (elementBox.paragraph.containerWidget.containerShape && elementBox.paragraph.containerWidget.textVerticalAlignment == 'Center') {
|
|
3025
|
+
var shapeHeight = elementBox.paragraph.containerWidget.containerShape.height;
|
|
3026
|
+
var height = 0;
|
|
3027
|
+
if (elementBox.paragraph.containerWidget.childWidgets && elementBox.paragraph.containerWidget.childWidgets.length > 0) {
|
|
3028
|
+
for (var i = 0; i < elementBox.paragraph.containerWidget.childWidgets.length; i++) {
|
|
3029
|
+
height = height + elementBox.paragraph.containerWidget.childWidgets[i].height;
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
var rect = this.getScaledValue(shapeHeight) - (elementBox.paragraph.containerWidget.marginTop + elementBox.paragraph.containerWidget.marginBottom);
|
|
3033
|
+
var y = this.getScaledValue(top + topMargin, 2) + (rect - height) / 2;
|
|
3034
|
+
if (height < this.getScaledValue(shapeHeight)) {
|
|
3035
|
+
this.pageContext.fillText(text, this.getScaledValue(left + leftMargin, 1) / (scaleFactor), y, scaledWidth);
|
|
3036
|
+
}
|
|
3037
|
+
else {
|
|
3038
|
+
this.pageContext.fillText(text, this.getScaledValue(left + leftMargin, 1) / (scaleFactor), this.getScaledValue(top + topMargin, 2), scaledWidth);
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
else if (elementBox.paragraph.containerWidget.containerShape && elementBox.paragraph.containerWidget.textVerticalAlignment == 'Bottom') {
|
|
3042
|
+
var shapeHeight = elementBox.paragraph.containerWidget.containerShape.height;
|
|
3043
|
+
var y = this.getScaledValue(top + topMargin, 2) + (this.getScaledValue(shapeHeight) / 2);
|
|
3044
|
+
var height = 0;
|
|
3045
|
+
if (elementBox.paragraph.containerWidget.childWidgets && elementBox.paragraph.containerWidget.childWidgets.length > 0) {
|
|
3046
|
+
for (var i = 0; i < elementBox.paragraph.containerWidget.childWidgets.length; i++) {
|
|
3047
|
+
height = height + elementBox.paragraph.containerWidget.childWidgets[i].height;
|
|
3048
|
+
}
|
|
3049
|
+
}
|
|
3050
|
+
if ((height + this.getScaledValue(shapeHeight) / 2) < this.getScaledValue(shapeHeight)) {
|
|
3051
|
+
this.pageContext.fillText(text, this.getScaledValue(left + leftMargin, 1) / (scaleFactor), y, scaledWidth);
|
|
3052
|
+
}
|
|
3053
|
+
else {
|
|
3054
|
+
this.pageContext.fillText(text, this.getScaledValue(left + leftMargin, 1) / (scaleFactor), this.getScaledValue(top + topMargin, 2), scaledWidth);
|
|
3055
|
+
}
|
|
3056
|
+
}
|
|
3057
|
+
else {
|
|
3058
|
+
this.pageContext.fillText(text, this.getScaledValue(left + leftMargin, 1) / (scaleFactor), this.getScaledValue(top + topMargin, 2), scaledWidth);
|
|
3059
|
+
}
|
|
3060
|
+
this.pageContext.restore();
|
|
3061
|
+
}
|
|
3062
|
+
if (characterRange === CharacterRangeType.RightToLeft && !LayoutHelperMethods.startsWith(text, ' ')) {
|
|
3063
|
+
this.pageContext.direction = 'ltr';
|
|
3064
|
+
left -= elementBox.width;
|
|
3065
|
+
}
|
|
3066
|
+
if (this.documentHelper.isSpellCheck && this.documentHelper.hooks.onTriggerSpellChecker) {
|
|
3067
|
+
this.documentHelper.hooks.onTriggerSpellChecker(elementBox, containerWidget, isRTL, left, top, underlineY, format.baselineAlignment);
|
|
3068
|
+
}
|
|
3069
|
+
var currentInfo = this.getRevisionType(revisionInfo, true);
|
|
3070
|
+
if (format.underline !== 'None' && !isNullOrUndefined(format.underline) || (!isNullOrUndefined(currentInfo) && (currentInfo.type === 'Insertion' || currentInfo.type === 'MoveTo'))) {
|
|
3071
|
+
this.renderUnderline(elementBox, left, top, underlineY, color, format.underline, format.baselineAlignment, currentInfo);
|
|
3072
|
+
}
|
|
3073
|
+
currentInfo = this.getRevisionType(revisionInfo, false);
|
|
3074
|
+
if (format.strikethrough !== 'None' && !isNullOrUndefined(format.strikethrough) || (!isNullOrUndefined(currentInfo) && (currentInfo.type === 'Deletion' || currentInfo.type === 'MoveFrom'))) {
|
|
3075
|
+
this.renderStrikeThrough(elementBox, left, top, format.strikethrough, color, format.baselineAlignment, currentInfo);
|
|
3076
|
+
}
|
|
3077
|
+
if (isHeightType) {
|
|
3078
|
+
this.pageContext.restore();
|
|
3079
|
+
}
|
|
3080
|
+
};
|
|
3081
|
+
Renderer.prototype.tabMark = function (elementBox, format, left, top, leftMargin, topMargin) {
|
|
3082
|
+
var tabMarkString = elementBox.paragraph.bidi ? String.fromCharCode(8592) : String.fromCharCode(8594);
|
|
3083
|
+
var tabMarkWidth = this.documentHelper.textHelper.getWidth(tabMarkString, format, elementBox.scriptType);
|
|
3084
|
+
var availableSpaceWidth = elementBox.width / 2;
|
|
3085
|
+
var tabWidth = tabMarkWidth / 2;
|
|
3086
|
+
this.pageContext.font = this.retriveCharacterformat(elementBox.characterFormat);
|
|
3087
|
+
var kernPairs = /(?:AV|VA|AW|WA|To|Ta|Te|Ty|Yo)/;
|
|
3088
|
+
this.pageContext.fontKerning = 'auto';
|
|
3089
|
+
if (!format.isKernFont && kernPairs.test(elementBox.text)) {
|
|
3090
|
+
this.pageContext.fontKerning = 'none';
|
|
3091
|
+
}
|
|
3092
|
+
this.pageContext.letterSpacing = format.characterSpacing * this.documentHelper.zoomFactor + 'pt';
|
|
3093
|
+
this.pageContext.save();
|
|
3094
|
+
var scaleFactor = format.scaling < 100 ? 1 : format.scaling / 100;
|
|
3095
|
+
this.pageContext.scale(scaleFactor, 1);
|
|
3096
|
+
if (availableSpaceWidth > tabMarkWidth) {
|
|
3097
|
+
if (elementBox.paragraph.bidi) {
|
|
3098
|
+
this.pageContext.fillText(tabMarkString, this.getScaledValue(((left + leftMargin + tabWidth) - (availableSpaceWidth)), 1) / scaleFactor, this.getScaledValue(top + topMargin, 2));
|
|
3099
|
+
}
|
|
3100
|
+
else {
|
|
3101
|
+
this.pageContext.fillText(tabMarkString, this.getScaledValue(((left + leftMargin + availableSpaceWidth) - (tabWidth)), 1) / scaleFactor, this.getScaledValue(top + topMargin, 2));
|
|
3102
|
+
}
|
|
3103
|
+
}
|
|
3104
|
+
else {
|
|
3105
|
+
this.pageContext.fillText(tabMarkString, this.getScaledValue(left + leftMargin, 1) / scaleFactor, this.getScaledValue(top + topMargin, 2), this.getScaledValue(elementBox.width));
|
|
3106
|
+
}
|
|
3107
|
+
this.pageContext.restore();
|
|
3108
|
+
};
|
|
3109
|
+
Renderer.prototype.replaceSpace = function (text) {
|
|
3110
|
+
text = text.replace(new RegExp(String.fromCharCode(32), 'g'), String.fromCharCode(183));
|
|
3111
|
+
text = text.replace(new RegExp(String.fromCharCode(160), 'g'), String.fromCharCode(176));
|
|
3112
|
+
return text;
|
|
3113
|
+
};
|
|
3114
|
+
Renderer.prototype.inverseCharacter = function (ch) {
|
|
3115
|
+
switch (ch) {
|
|
3116
|
+
//Specify the '('
|
|
3117
|
+
case String.fromCharCode(40):
|
|
3118
|
+
//Specify the ')'
|
|
3119
|
+
return String.fromCharCode(41);
|
|
3120
|
+
//Specify the ')'
|
|
3121
|
+
case String.fromCharCode(41):
|
|
3122
|
+
//Specify the '('
|
|
3123
|
+
return String.fromCharCode(40);
|
|
3124
|
+
//Specify the '<'
|
|
3125
|
+
case String.fromCharCode(60):
|
|
3126
|
+
//Specify the '>'
|
|
3127
|
+
return String.fromCharCode(62);
|
|
3128
|
+
//Specify the '>'
|
|
3129
|
+
case String.fromCharCode(62):
|
|
3130
|
+
//Specify the '<'
|
|
3131
|
+
return String.fromCharCode(60);
|
|
3132
|
+
//Specify the '{'
|
|
3133
|
+
case String.fromCharCode(123):
|
|
3134
|
+
//Specify the '}'
|
|
3135
|
+
return String.fromCharCode(125);
|
|
3136
|
+
//Specify the '}'
|
|
3137
|
+
case String.fromCharCode(125):
|
|
3138
|
+
//Specify the '{'
|
|
3139
|
+
return String.fromCharCode(123);
|
|
3140
|
+
//Specify the '['
|
|
3141
|
+
case String.fromCharCode(91):
|
|
3142
|
+
//Specify the ']'
|
|
3143
|
+
return String.fromCharCode(93);
|
|
3144
|
+
//Specify the ']'
|
|
3145
|
+
case String.fromCharCode(93):
|
|
3146
|
+
//Specify the '['
|
|
3147
|
+
return String.fromCharCode(91);
|
|
3148
|
+
default:
|
|
3149
|
+
return ch;
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
Renderer.prototype.getBackgroundColorHeirachy = function (element) {
|
|
3153
|
+
var bgColor;
|
|
3154
|
+
// "empty" is old value used for auto color till v19.2.49. It is maintained for backward compatibility.
|
|
3155
|
+
if (element.paragraph.isInsideTable) {
|
|
3156
|
+
var cell = element.paragraph.containerWidget;
|
|
3157
|
+
bgColor = cell.cellFormat.shading.backgroundColor;
|
|
3158
|
+
var foreColor = cell.cellFormat.shading.foregroundColor;
|
|
3159
|
+
if (cell.cellFormat.shading.hasValue('textureStyle') && foreColor === 'empty' && (bgColor === "empty" || bgColor === '#00000000')) {
|
|
3160
|
+
return this.drawTextureStyle(cell.cellFormat.shading.textureStyle, LayoutHelperMethods.getColor(foreColor), LayoutHelperMethods.getColor(bgColor), true, true);
|
|
3161
|
+
}
|
|
3162
|
+
if (bgColor !== "empty" && bgColor !== '#00000000') {
|
|
3163
|
+
return bgColor;
|
|
3164
|
+
}
|
|
3165
|
+
bgColor = cell.ownerTable.tableFormat.shading.backgroundColor;
|
|
3166
|
+
if (bgColor !== "empty" && bgColor !== '#00000000') {
|
|
3167
|
+
return bgColor;
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
else if (element.paragraph.containerWidget instanceof TextFrame
|
|
3171
|
+
&& !isNullOrUndefined(element.paragraph.containerWidget.containerShape) && !isNullOrUndefined(element.paragraph.containerWidget.containerShape.fillFormat) && element.paragraph.containerWidget.containerShape.fillFormat.color === '#000000FF') {
|
|
3172
|
+
return element.paragraph.containerWidget.containerShape.fillFormat.color;
|
|
3173
|
+
}
|
|
3174
|
+
return this.documentHelper.backgroundColor;
|
|
3175
|
+
};
|
|
3176
|
+
Renderer.prototype.drawWavy = function (from, to, frequency, amplitude, step, color, height, backColor, negative) {
|
|
3177
|
+
this.pageContext.save();
|
|
3178
|
+
this.pageContext.fillStyle = (!isNullOrUndefined(backColor) && backColor !== "empty" ? backColor : this.documentHelper.backgroundColor);
|
|
3179
|
+
this.pageContext.fillRect(from.x, from.y - amplitude, (to.x - from.x), amplitude * 3);
|
|
3180
|
+
this.pageContext.restore();
|
|
3181
|
+
this.pageContext.lineWidth = 1;
|
|
3182
|
+
this.pageContext.lineCap = 'round';
|
|
3183
|
+
this.pageContext.strokeStyle = color;
|
|
3184
|
+
this.pageContext.beginPath();
|
|
3185
|
+
//this.pageContext.save();
|
|
3186
|
+
var cx = 0;
|
|
3187
|
+
var cy = 0;
|
|
3188
|
+
var fx = from.x;
|
|
3189
|
+
var fy = from.y;
|
|
3190
|
+
var tx = to.x;
|
|
3191
|
+
var ty = to.y;
|
|
3192
|
+
var i = 0;
|
|
3193
|
+
var waveOffsetLength = 0;
|
|
3194
|
+
var ang = Math.atan2(ty - fy, tx - fx);
|
|
3195
|
+
var distance = Math.sqrt((fx - tx) * (fx - tx) + (fy - ty) * (fy - ty));
|
|
3196
|
+
var a = amplitude * 1;
|
|
3197
|
+
var f = Math.PI * frequency;
|
|
3198
|
+
for (i; i <= distance; i += step) {
|
|
3199
|
+
waveOffsetLength = Math.sin((i / distance) * f) * a;
|
|
3200
|
+
cx = from.x + Math.cos(ang) * i + Math.cos(ang - Math.PI / 2) * waveOffsetLength;
|
|
3201
|
+
cy = from.y + Math.sin(ang) * i + Math.sin(ang - Math.PI / 2) * waveOffsetLength;
|
|
3202
|
+
i > 0 ? this.pageContext.lineTo(cx, cy) : this.pageContext.moveTo(cx, cy);
|
|
3203
|
+
}
|
|
3204
|
+
this.pageContext.stroke();
|
|
3205
|
+
};
|
|
3206
|
+
/**
|
|
3207
|
+
* @private
|
|
3208
|
+
*/
|
|
3209
|
+
Renderer.prototype.getTabLeader = function (elementBox) {
|
|
3210
|
+
var textWidth = 0;
|
|
3211
|
+
var tabString = this.getTabLeaderString(elementBox.tabLeader);
|
|
3212
|
+
var tabText = tabString;
|
|
3213
|
+
textWidth = this.documentHelper.textHelper.getWidth(tabText, elementBox.characterFormat, elementBox.scriptType);
|
|
3214
|
+
var count = Math.floor(elementBox.width / textWidth);
|
|
3215
|
+
if (textWidth == 0) {
|
|
3216
|
+
count = 0;
|
|
3217
|
+
}
|
|
3218
|
+
for (var i = 0; i <= count; i++) {
|
|
3219
|
+
tabText += tabString;
|
|
3220
|
+
}
|
|
3221
|
+
return tabText.slice(0, -1);
|
|
3222
|
+
};
|
|
3223
|
+
Renderer.prototype.getTabLeaderString = function (tabLeader) {
|
|
3224
|
+
var tabString = '';
|
|
3225
|
+
switch (tabLeader) {
|
|
3226
|
+
case 'Dot':
|
|
3227
|
+
tabString = '.';
|
|
3228
|
+
break;
|
|
3229
|
+
case 'Hyphen':
|
|
3230
|
+
tabString = '-';
|
|
3231
|
+
break;
|
|
3232
|
+
case 'Underscore':
|
|
3233
|
+
case 'Single':
|
|
3234
|
+
tabString = '_';
|
|
3235
|
+
break;
|
|
3236
|
+
}
|
|
3237
|
+
return tabString;
|
|
3238
|
+
};
|
|
3239
|
+
Renderer.prototype.clipRect = function (xPos, yPos, width, height) {
|
|
3240
|
+
this.pageContext.beginPath();
|
|
3241
|
+
this.pageContext.save();
|
|
3242
|
+
this.pageContext.rect(this.getScaledValue(xPos, 1), this.getScaledValue(yPos, 2), width, height);
|
|
3243
|
+
this.pageContext.clip();
|
|
3244
|
+
};
|
|
3245
|
+
Renderer.prototype.getTrimmedWidth = function (elementBox) {
|
|
3246
|
+
var width = elementBox.width;
|
|
3247
|
+
if (elementBox instanceof TextElementBox && !(elementBox instanceof TabElementBox) && isNullOrUndefined(elementBox.nextNode)) {
|
|
3248
|
+
width = this.documentHelper.textHelper.getWidth(LayoutHelperMethods.trimEnd(elementBox.text), elementBox.characterFormat, elementBox.scriptType);
|
|
3249
|
+
}
|
|
3250
|
+
return width;
|
|
3251
|
+
};
|
|
3252
|
+
Renderer.prototype.renderUnderline = function (elementBox, left, top, underlineY, color, underline, baselineAlignment, revisionInfo) {
|
|
3253
|
+
var renderedHeight = elementBox.height / (baselineAlignment === 'Normal' ? 1 : 1.5);
|
|
3254
|
+
var topMargin = elementBox.margin.top;
|
|
3255
|
+
var underlineHeight = renderedHeight / 20;
|
|
3256
|
+
var y = 0;
|
|
3257
|
+
var lineHeight = renderedHeight / 20;
|
|
3258
|
+
if (baselineAlignment === 'Subscript' || elementBox instanceof ListTextElementBox) {
|
|
3259
|
+
y = (renderedHeight - 2 * underlineHeight) + top;
|
|
3260
|
+
topMargin += elementBox.height - renderedHeight;
|
|
3261
|
+
y += topMargin > 0 ? topMargin : 0;
|
|
3262
|
+
}
|
|
3263
|
+
else {
|
|
3264
|
+
y = underlineY + top;
|
|
3265
|
+
}
|
|
3266
|
+
var lineCount = 0;
|
|
3267
|
+
if (!isNullOrUndefined(revisionInfo)) {
|
|
3268
|
+
underline = (revisionInfo.type === 'MoveTo') ? 'Double' : 'Single';
|
|
3269
|
+
}
|
|
3270
|
+
if (!(elementBox instanceof ImageElementBox) && underline === 'Double') {
|
|
3271
|
+
y -= lineHeight;
|
|
3272
|
+
}
|
|
3273
|
+
if (elementBox instanceof ImageElementBox) {
|
|
3274
|
+
lineHeight = underlineHeight = 0.9;
|
|
3275
|
+
}
|
|
3276
|
+
while (lineCount < (underline === 'Double' ? 2 : 1)) {
|
|
3277
|
+
lineCount++;
|
|
3278
|
+
var width = this.getTrimmedWidth(elementBox);
|
|
3279
|
+
this.pageContext.fillRect(this.getScaledValue(left + elementBox.margin.left, 1), this.getScaledValue(y, 2), this.getScaledValue(width), this.getScaledValue(underlineHeight));
|
|
3280
|
+
y += 2 * lineHeight;
|
|
3281
|
+
}
|
|
3282
|
+
};
|
|
3283
|
+
Renderer.prototype.renderStrikeThrough = function (elementBox, left, top, strikethrough, color, baselineAlignment, revisionInfo) {
|
|
3284
|
+
var renderedHeight = elementBox.height / (baselineAlignment === 'Normal' ? 1 : 1.5);
|
|
3285
|
+
var topMargin = elementBox.margin.top;
|
|
3286
|
+
if (baselineAlignment === 'Subscript') {
|
|
3287
|
+
topMargin += elementBox.height - renderedHeight;
|
|
3288
|
+
}
|
|
3289
|
+
top += topMargin > 0 ? topMargin : 0;
|
|
3290
|
+
var lineHeight = renderedHeight / 20;
|
|
3291
|
+
var y = (renderedHeight / 2) + (0.5 * lineHeight);
|
|
3292
|
+
var lineCount = 0;
|
|
3293
|
+
if (!isNullOrUndefined(revisionInfo)) {
|
|
3294
|
+
strikethrough = (revisionInfo.type === 'Deletion') ? 'SingleStrike' : 'DoubleStrike';
|
|
3295
|
+
}
|
|
3296
|
+
if (elementBox instanceof ImageElementBox) {
|
|
3297
|
+
lineHeight = 0.9;
|
|
3298
|
+
}
|
|
3299
|
+
if (strikethrough === 'DoubleStrike') {
|
|
3300
|
+
y -= lineHeight;
|
|
3301
|
+
}
|
|
3302
|
+
while (lineCount < (strikethrough === 'DoubleStrike' ? 2 : 1)) {
|
|
3303
|
+
lineCount++;
|
|
3304
|
+
var width = this.getTrimmedWidth(elementBox);
|
|
3305
|
+
this.pageContext.fillRect(this.getScaledValue(left + elementBox.margin.left, 1), this.getScaledValue(y + top, 2), this.getScaledValue(width), this.getScaledValue(lineHeight));
|
|
3306
|
+
y += 2 * lineHeight;
|
|
3307
|
+
}
|
|
3308
|
+
};
|
|
3309
|
+
Renderer.prototype.renderImageElementBox = function (elementBox, left, top, underlineY) {
|
|
3310
|
+
var _this = this;
|
|
3311
|
+
var topMargin = elementBox.margin.top;
|
|
3312
|
+
var leftMargin = elementBox.margin.left;
|
|
3313
|
+
var revisionInfo = this.checkRevisionType(elementBox);
|
|
3314
|
+
var color = revisionInfo.length > 0 ? this.getRevisionColor(revisionInfo) : 'black';
|
|
3315
|
+
this.pageContext.textBaseline = 'top';
|
|
3316
|
+
var widgetWidth = 0;
|
|
3317
|
+
var isClipped = false;
|
|
3318
|
+
var containerWid = elementBox.line.paragraph.containerWidget;
|
|
3319
|
+
var isHeightType = false;
|
|
3320
|
+
var imgX = this.getScaledValue(left + leftMargin, 1);
|
|
3321
|
+
var imgY = this.getScaledValue(top + topMargin, 2);
|
|
3322
|
+
var width = this.getScaledValue(elementBox.width);
|
|
3323
|
+
var height = this.getScaledValue(elementBox.height);
|
|
3324
|
+
if (containerWid instanceof TableCellWidget) {
|
|
3325
|
+
isHeightType = (containerWid.ownerRow.rowFormat.heightType === 'Exactly');
|
|
3326
|
+
}
|
|
3327
|
+
if (elementBox.textWrappingStyle === 'Inline') {
|
|
3328
|
+
//If the image width is greater than the paragraph width, then we clip the image based on the current linewidget position from the left(X-axis) and top(Y-axis).
|
|
3329
|
+
if ((topMargin < 0 || elementBox.line.paragraph.width < elementBox.width) && !isHeightType) {
|
|
3330
|
+
// if (containerWid instanceof BodyWidget) {
|
|
3331
|
+
// widgetWidth = containerWid.width + containerWid.x;
|
|
3332
|
+
// } else
|
|
3333
|
+
if (elementBox.line.paragraph.paragraphFormat.lineSpacingType === 'Exactly' && elementBox.line.paragraph.paragraphFormat.lineSpacing > 0) {
|
|
3334
|
+
if (!(containerWid instanceof TableCellWidget)) {
|
|
3335
|
+
isClipped = true;
|
|
3336
|
+
this.clipRect(elementBox.line.paragraph.x, elementBox.line.paragraph.y, this.getScaledValue(elementBox.line.paragraph.width), this.getScaledValue(elementBox.line.paragraph.height));
|
|
3337
|
+
}
|
|
3338
|
+
}
|
|
3339
|
+
else if (containerWid instanceof TableCellWidget) {
|
|
3340
|
+
var leftIndent = 0;
|
|
3341
|
+
if (containerWid.childWidgets[0] instanceof ParagraphWidget) {
|
|
3342
|
+
var paraAdv = containerWid.childWidgets[0];
|
|
3343
|
+
leftIndent = paraAdv.paragraphFormat.leftIndent;
|
|
3344
|
+
}
|
|
3345
|
+
widgetWidth = containerWid.width + containerWid.margin.left - containerWid.leftBorderWidth - leftIndent;
|
|
3346
|
+
isClipped = true;
|
|
3347
|
+
this.clipRect(left + leftMargin, top + topMargin, this.getScaledValue(widgetWidth), this.getScaledValue(containerWid.height));
|
|
3348
|
+
}
|
|
3349
|
+
// If the containterWidget's(TableCellWdiget) row height type is 'Exactly', then we clip the image based on the left(X-axis) and containerWid.y(Y-axis).
|
|
3350
|
+
}
|
|
3351
|
+
else if (isHeightType) {
|
|
3352
|
+
var leftIndent = 0;
|
|
3353
|
+
if (containerWid.childWidgets[0] instanceof ParagraphWidget) {
|
|
3354
|
+
var paraAdv = containerWid.childWidgets[0];
|
|
3355
|
+
leftIndent = paraAdv.paragraphFormat.leftIndent;
|
|
3356
|
+
}
|
|
3357
|
+
var width_3 = containerWid.width + containerWid.margin.left - containerWid.leftBorderWidth - leftIndent;
|
|
3358
|
+
isClipped = true;
|
|
3359
|
+
this.clipRect(left + leftMargin, containerWid.y, this.getScaledValue(width_3), this.getScaledValue(containerWid.height));
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
if (elementBox.isMetaFile && !isNullOrUndefined(elementBox.metaFileImageString)) {
|
|
3363
|
+
if (elementBox.isCrop && elementBox.cropWidth < width && elementBox.cropHeight < height) {
|
|
3364
|
+
this.pageContext.drawImage(elementBox.element, elementBox.cropX, elementBox.cropY, elementBox.cropWidth, elementBox.cropHeight, imgX, imgY, width, height);
|
|
3365
|
+
}
|
|
3366
|
+
else {
|
|
3367
|
+
this.pageContext.drawImage(elementBox.element, imgX, imgY, width, height);
|
|
3368
|
+
}
|
|
3369
|
+
}
|
|
3370
|
+
else {
|
|
3371
|
+
var fallbackImage_1 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAgVBMVEX///8AAADgAADY2Njl5eVcXFxjY2NZWVl/f3+wsLCmpqb4+PiioqKpqam7u7vV1dX2uLj2wsLhFRXzpKT3vb30sbHhCwv74+P40dH+9vbkIyO2trbBwcHLy8tsbGycnJz529v4zMzrbGzlLS3qZmblNzfrdXXoRkbvi4vvgYHlHh7CZsBOAAADpUlEQVR4nO3da1faQBSF4ekAUQlUEFs14AXxVv7/D6yaQiZx5mSEYXF2ut+PNKzyyK5diYDmR9czx34AB49C/CjE759w3jvvWr15Tdgz3atXE54f++EcIArxoxA/CvGjED8K8aMQPwrxoxA/CvGLEeZ9jPJdhfk4GyCUjb3ECGE/Q6m/q3DwfudjP0ERZYN9hKdn2hvd3+0jHJz5/kBVuTk96bbQUEjhYR9ckiikUH8UUqg/CinUH4UU6o9CCvVHIYX6o5BC/VFIof4opFB/FFKoPwop1B+FFOqPQgrjyxfjVC38Lxk9tnAxGqZqdKtSOE4GHA5/fuNJpDCtcNHbv4VqYYqPLjgfUViPQgrjozA2CptRSGF8/59w+Wrt+rr1btNna1cPzg0wwuXavncxabnX7PfHYYXzlYARvlobQZyUR9mXm+1NMEK7SSLONgcVV9vb8IQXv4J3KSeKKlxXxNCzONkeYp8AV3p9UT1+P3FWHVAsq5thhGZSEb1DrSZq7dS5HUdoLiuBZ6jORG3tCwAkNJfCUJ2Jrqe1P0ESCkMNTdSACYNDDU7UoAkDQw1P1MAJvUMVJmrwhJ6hShM1gMIvQxUnahCFjaHKEzWQQneoxR95ogZTWBuqPFEDKnSHKk/UoArdoYoTNbDC5lBDEzW4QjMpYiZqgIXG/S76JhwHK5zVVipcnkIVuv/RW/HyFKhwYhuFr6NiCmdNoDBUSGFjovJQEYXuRN9ahwoorJ8uSZenPsMTNk+X2q6jwgm/ntHL11HhhL4zenmoYEL/Gb04VCxh6KKTNFQoYfiikzBUJKF00Sk8VCChfF00OFQcYdt10dBQYYRT5xn0n9G7Q0X8GfCzNNEyZ6iPgD/HlydaVg11DfhajJaJlm2HugIUrlomWrYZKuJKHz6vHhbSM/hROdRnxNe1meuXYvW0DB6+aflYrB7dlzDiCM3N1dVN6GDhMCDhjlHYjEIK46MwNgqbUUhhfJ/vA07wO8N1vw94ONo/3e/lTpVOYfc/UyG//ZmqW52fi/FuTNW3/lZ+eguF+qOQQv1RSKH+KKRQfxRSqD8KKdQfhRTqj0IK9UchhfqjkEL9UUih/iikUH8UUqg/CmXh6Hsv3jlK+wnvD/vgkrSHMMuyu1P9ZdmuwnycDQYn+svG3n9KEUKT9zHyf6+IEWJHIX4U4kchfhTiRyF+FOJHIX4U4kchfnVhijeZa6sunCf4ZdPamteEHY5C/CjEr/vCv0ec0g+AtS1QAAAAAElFTkSuQmCC';
|
|
3372
|
+
try {
|
|
3373
|
+
var render_1 = this;
|
|
3374
|
+
elementBox.element.onload = function () {
|
|
3375
|
+
var lastLoaded = elementBox.element.getAttribute("lastLoaded");
|
|
3376
|
+
if (!isNullOrUndefined(render_1.documentHelper) && lastLoaded !== elementBox.element.src) {
|
|
3377
|
+
if (!elementBox.isCrop) {
|
|
3378
|
+
render_1.pageContext.drawImage(elementBox.element, imgX, imgY, width, height);
|
|
3379
|
+
if (render_1.documentHelper.editorProperties.enableHeaderAndFooter) {
|
|
3380
|
+
if (render_1.documentHelper.hooks.onUpdateScrollBars) {
|
|
3381
|
+
render_1.documentHelper.hooks.onUpdateScrollBars();
|
|
3382
|
+
}
|
|
3383
|
+
}
|
|
3384
|
+
}
|
|
3385
|
+
else {
|
|
3386
|
+
render_1.pageContext.drawImage(elementBox.element, elementBox.cropX, elementBox.cropY, elementBox.cropWidth, elementBox.cropHeight, imgX, imgY, width, height);
|
|
3387
|
+
}
|
|
3388
|
+
}
|
|
3389
|
+
};
|
|
3390
|
+
elementBox.element.onerror = function () {
|
|
3391
|
+
var srcImage = fallbackImage_1;
|
|
3392
|
+
var imageString = _this.documentHelper.getImageString(elementBox);
|
|
3393
|
+
if (imageString && (LayoutHelperMethods.startsWith(imageString, 'http://') || LayoutHelperMethods.startsWith(imageString, 'https://'))) {
|
|
3394
|
+
var imageStrings = _this.viewer.documentHelper.images.get(parseInt(elementBox.imageString));
|
|
3395
|
+
if (imageStrings && imageStrings.length > 1) {
|
|
3396
|
+
srcImage = imageStrings[1];
|
|
3397
|
+
}
|
|
3398
|
+
}
|
|
3399
|
+
elementBox.element.src = srcImage;
|
|
3400
|
+
};
|
|
3401
|
+
if (!elementBox.isCrop) {
|
|
3402
|
+
this.pageContext.drawImage(elementBox.element, imgX, //dx
|
|
3403
|
+
imgY, //dy
|
|
3404
|
+
width, //dw
|
|
3405
|
+
height); //dh
|
|
3406
|
+
}
|
|
3407
|
+
else {
|
|
3408
|
+
this.pageContext.drawImage(elementBox.element, elementBox.cropX, //sx
|
|
3409
|
+
elementBox.cropY, //sy
|
|
3410
|
+
elementBox.cropWidth, //sw
|
|
3411
|
+
elementBox.cropHeight, //sh
|
|
3412
|
+
imgX, //dx
|
|
3413
|
+
imgY, //dy
|
|
3414
|
+
width, //dw
|
|
3415
|
+
height); //dh
|
|
3416
|
+
}
|
|
3417
|
+
}
|
|
3418
|
+
catch (e) {
|
|
3419
|
+
var imageString = this.documentHelper.getImageString(elementBox);
|
|
3420
|
+
if (imageString && (LayoutHelperMethods.startsWith(imageString, 'http://') || LayoutHelperMethods.startsWith(imageString, 'https://'))) {
|
|
3421
|
+
var imageStrings = this.viewer.documentHelper.images.get(parseInt(elementBox.imageString));
|
|
3422
|
+
if (imageStrings && imageStrings.length > 1) {
|
|
3423
|
+
elementBox.element.src = imageStrings[1];
|
|
3424
|
+
}
|
|
3425
|
+
else {
|
|
3426
|
+
elementBox.element.src = fallbackImage_1;
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
3429
|
+
else {
|
|
3430
|
+
elementBox.imageString = fallbackImage_1;
|
|
3431
|
+
this.documentHelper.addBase64StringInCollection(elementBox);
|
|
3432
|
+
elementBox.element.src = this.documentHelper.getImageString(elementBox);
|
|
3433
|
+
}
|
|
3434
|
+
this.pageContext.drawImage(elementBox.element, this.getScaledValue(left + leftMargin, 1), this.getScaledValue(top + topMargin, 2), this.getScaledValue(elementBox.width), this.getScaledValue(elementBox.height));
|
|
3435
|
+
}
|
|
3436
|
+
}
|
|
3437
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(color);
|
|
3438
|
+
var currentRevision = this.getRevisionType(revisionInfo, false);
|
|
3439
|
+
if (!isNullOrUndefined(currentRevision) && (currentRevision.type === 'Deletion' || currentRevision.type === 'MoveFrom')) {
|
|
3440
|
+
this.renderStrikeThrough(elementBox, left, top, 'SingleStrike', color, 'Normal', currentRevision);
|
|
3441
|
+
}
|
|
3442
|
+
currentRevision = this.getRevisionType(revisionInfo, true);
|
|
3443
|
+
var format = elementBox.characterFormat;
|
|
3444
|
+
if (elementBox.textWrappingStyle === 'Inline' && format.underline !== 'None' && !isNullOrUndefined(format.underline) ||
|
|
3445
|
+
(!isNullOrUndefined(currentRevision) && (currentRevision.type === 'Insertion' || currentRevision.type === 'MoveTo'))) {
|
|
3446
|
+
var y = this.getUnderlineYPosition(elementBox.line);
|
|
3447
|
+
this.renderUnderline(elementBox, left, top, y, color, format.underline, format.baselineAlignment);
|
|
3448
|
+
}
|
|
3449
|
+
this.documentHelper.picturePositionY = this.getScaledValue(top + topMargin, 2);
|
|
3450
|
+
var contentControlImage = this.documentHelper.lockedPictureContentControl;
|
|
3451
|
+
if (!isNullOrUndefined(contentControlImage) && contentControlImage.line === elementBox.line && contentControlImage.contentControlProperties.type === 'Picture') {
|
|
3452
|
+
var format_1 = elementBox.characterFormat;
|
|
3453
|
+
var color_1 = contentControlImage.contentControlProperties.color;
|
|
3454
|
+
if (color_1 === '#00000000') {
|
|
3455
|
+
color_1 = '#939393';
|
|
3456
|
+
}
|
|
3457
|
+
this.renderImgBorder(elementBox, left, top, color_1, 'Solid', 0.5, format_1.baselineAlignment);
|
|
3458
|
+
}
|
|
3459
|
+
if (isClipped) {
|
|
3460
|
+
this.pageContext.restore();
|
|
3461
|
+
}
|
|
3462
|
+
};
|
|
3463
|
+
Renderer.prototype.renderTableOutline = function (page, tableWidget) {
|
|
3464
|
+
var layout = new Layout(this.documentHelper);
|
|
3465
|
+
var table = tableWidget;
|
|
3466
|
+
tableWidget.width = this.documentHelper.layout.getTableWidth(table);
|
|
3467
|
+
var borderValue = table.tableFormat.isRTFTable ? table.firstChild.rowFormat.borders : table.tableFormat.borders;
|
|
3468
|
+
var border = !table.isBidiTable ? layout.getTableLeftBorder(borderValue)
|
|
3469
|
+
: layout.getTableRightBorder(borderValue);
|
|
3470
|
+
var lineWidth = 0;
|
|
3471
|
+
//ToDo: Need to draw the borders based on the line style.
|
|
3472
|
+
// if (!isNullOrUndefined(border )) {
|
|
3473
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3474
|
+
var repeatedHeaderHeight = 0;
|
|
3475
|
+
var bodyWidget;
|
|
3476
|
+
if (table.containerWidget instanceof BodyWidget) {
|
|
3477
|
+
bodyWidget = table.containerWidget;
|
|
3478
|
+
}
|
|
3479
|
+
if (bodyWidget && bodyWidget.firstChild === tableWidget && (bodyWidget.childWidgets[0].childWidgets.length > 0) && page.repeatHeaderRowTableWidget) {
|
|
3480
|
+
var headerRow = this.documentHelper.layout.getHeader(bodyWidget.childWidgets[0]);
|
|
3481
|
+
while (headerRow) {
|
|
3482
|
+
if (headerRow.rowFormat.isHeader) {
|
|
3483
|
+
repeatedHeaderHeight += headerRow.height;
|
|
3484
|
+
}
|
|
3485
|
+
else {
|
|
3486
|
+
break;
|
|
3487
|
+
}
|
|
3488
|
+
headerRow = headerRow.previousWidget;
|
|
3489
|
+
}
|
|
3490
|
+
}
|
|
3491
|
+
this.renderSingleBorder(border.color, tableWidget.x - tableWidget.margin.left - lineWidth / 2, tableWidget.y - repeatedHeaderHeight, tableWidget.x - tableWidget.margin.left - lineWidth / 2, tableWidget.y + tableWidget.height, lineWidth, border.lineStyle);
|
|
3492
|
+
// }
|
|
3493
|
+
border = layout.getTableTopBorder(borderValue);
|
|
3494
|
+
lineWidth = 0;
|
|
3495
|
+
// if (!isNullOrUndefined(border )) {
|
|
3496
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3497
|
+
this.renderSingleBorder(border.color, tableWidget.x - tableWidget.margin.left - lineWidth, tableWidget.y - lineWidth / 2 - repeatedHeaderHeight, tableWidget.x + tableWidget.width + lineWidth + tableWidget.margin.right, tableWidget.y - lineWidth / 2 - repeatedHeaderHeight, lineWidth, border.lineStyle);
|
|
3498
|
+
// }
|
|
3499
|
+
border = !table.isBidiTable ? layout.getTableRightBorder(borderValue)
|
|
3500
|
+
: layout.getTableLeftBorder(borderValue);
|
|
3501
|
+
lineWidth = 0;
|
|
3502
|
+
// if (!isNullOrUndefined(border )) {
|
|
3503
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3504
|
+
this.renderSingleBorder(border.color, tableWidget.x + tableWidget.width + tableWidget.margin.right + lineWidth / 2, tableWidget.y - repeatedHeaderHeight, tableWidget.x + tableWidget.width + tableWidget.margin.right + lineWidth / 2, tableWidget.y + tableWidget.height, lineWidth, border.lineStyle);
|
|
3505
|
+
// }
|
|
3506
|
+
border = layout.getTableBottomBorder(borderValue);
|
|
3507
|
+
lineWidth = 0;
|
|
3508
|
+
// if (!isNullOrUndefined(border )) {
|
|
3509
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3510
|
+
this.renderSingleBorder(border.color, tableWidget.x - tableWidget.margin.left - lineWidth, tableWidget.y + tableWidget.height - lineWidth / 2, tableWidget.x + tableWidget.width + lineWidth + tableWidget.margin.right, tableWidget.y + tableWidget.height - lineWidth / 2, lineWidth, border.lineStyle);
|
|
3511
|
+
// }
|
|
3512
|
+
};
|
|
3513
|
+
/* eslint-disable */
|
|
3514
|
+
Renderer.prototype.renderTableCellOutline = function (documentHelper, cellWidget) {
|
|
3515
|
+
this.isRenderingCellBorders = true;
|
|
3516
|
+
try {
|
|
3517
|
+
this.renderTableCellOutlineBorders(documentHelper, cellWidget);
|
|
3518
|
+
}
|
|
3519
|
+
finally {
|
|
3520
|
+
this.isRenderingCellBorders = false;
|
|
3521
|
+
}
|
|
3522
|
+
this.renderCellMultiLineBorders(cellWidget);
|
|
3523
|
+
};
|
|
3524
|
+
Renderer.prototype.renderTableCellOutlineBorders = function (documentHelper, cellWidget) {
|
|
3525
|
+
var layout = documentHelper.layout;
|
|
3526
|
+
var borders = undefined;
|
|
3527
|
+
var tableCell = cellWidget;
|
|
3528
|
+
var cellTopMargin = 0;
|
|
3529
|
+
var cellBottomMargin = 0;
|
|
3530
|
+
var cellLeftMargin = 0;
|
|
3531
|
+
var cellRightMargin = 0;
|
|
3532
|
+
var height = 0;
|
|
3533
|
+
var isBidiTable = cellWidget.ownerTable.isBidiTable;
|
|
3534
|
+
borders = tableCell.cellFormat.borders;
|
|
3535
|
+
if (cellWidget.containerWidget instanceof TableRowWidget) {
|
|
3536
|
+
cellBottomMargin = cellWidget.margin.bottom - cellWidget.containerWidget.bottomBorderWidth;
|
|
3537
|
+
cellTopMargin = cellWidget.margin.top - cellWidget.containerWidget.topBorderWidth;
|
|
3538
|
+
}
|
|
3539
|
+
cellLeftMargin = cellWidget.margin.left - cellWidget.leftBorderWidth;
|
|
3540
|
+
cellRightMargin = cellWidget.margin.right - cellWidget.rightBorderWidth;
|
|
3541
|
+
if (!isNullOrUndefined(tableCell.ownerRow) && tableCell.ownerRow.rowFormat.heightType === 'Exactly') {
|
|
3542
|
+
height = LayoutHelperMethods.convertPointToPixel(tableCell.ownerRow.rowFormat.height) + cellTopMargin + cellBottomMargin;
|
|
3543
|
+
}
|
|
3544
|
+
else {
|
|
3545
|
+
height = cellWidget.height + cellTopMargin + cellBottomMargin;
|
|
3546
|
+
}
|
|
3547
|
+
var border = !isBidiTable ? TableCellWidget.getCellLeftBorder(tableCell) : TableCellWidget.getCellRightBorder(tableCell);
|
|
3548
|
+
var lineWidth = 0;
|
|
3549
|
+
// if (!isNullOrUndefined(border )) {
|
|
3550
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth()); //Renders the cell left border.
|
|
3551
|
+
this.renderCellBackground(height, cellWidget, cellLeftMargin, cellRightMargin, lineWidth);
|
|
3552
|
+
var leftBorderWidth = lineWidth;
|
|
3553
|
+
if (tableCell.index === 0 || tableCell.cellFormat.rowSpan === 1 || (tableCell.cellFormat.rowSpan > 1 && (isBidiTable ? tableCell.columnIndex === tableCell.ownerRow.childWidgets.length - 1 : tableCell.columnIndex === 0))) {
|
|
3554
|
+
this.renderSingleBorder(border.color, cellWidget.x - cellLeftMargin - lineWidth, cellWidget.y - cellWidget.margin.top, cellWidget.x - cellLeftMargin - lineWidth, cellWidget.y + cellWidget.height + cellBottomMargin, lineWidth, border.lineStyle);
|
|
3555
|
+
}
|
|
3556
|
+
else {
|
|
3557
|
+
for (var i = 0; i < tableCell.ownerTable.childWidgets.length; i++) {
|
|
3558
|
+
var row = tableCell.ownerTable.childWidgets[i];
|
|
3559
|
+
var cell = void 0;
|
|
3560
|
+
for (var j = 0; j < row.childWidgets.length; j++) {
|
|
3561
|
+
var currentCell = row.childWidgets[j];
|
|
3562
|
+
if (!isBidiTable ? (currentCell.columnIndex + currentCell.cellFormat.columnSpan - 1) === tableCell.columnIndex - 1 : currentCell.columnIndex === tableCell.columnIndex + tableCell.cellFormat.columnSpan) {
|
|
3563
|
+
cell = currentCell;
|
|
3564
|
+
break;
|
|
3565
|
+
}
|
|
3566
|
+
else if (!isBidiTable && currentCell.columnIndex >= tableCell.columnIndex && currentCell.previousWidget) {
|
|
3567
|
+
cell = currentCell.previousWidget;
|
|
3568
|
+
break;
|
|
3569
|
+
}
|
|
3570
|
+
}
|
|
3571
|
+
if (cell && (!isBidiTable ? (cell.columnIndex + cell.cellFormat.columnSpan - 1) === tableCell.columnIndex - 1 : cell.columnIndex === tableCell.columnIndex + tableCell.cellFormat.columnSpan)) {
|
|
3572
|
+
var border_1 = !isBidiTable ? TableCellWidget.getCellRightBorder(cell) : TableCellWidget.getCellLeftBorder(cell);
|
|
3573
|
+
var lineWidthInt = LayoutHelperMethods.convertPointToPixel(border_1.getLineWidth());
|
|
3574
|
+
cellLeftMargin = tableCell.margin.left - lineWidthInt;
|
|
3575
|
+
if (cell.y + cell.height < tableCell.y) {
|
|
3576
|
+
continue;
|
|
3577
|
+
}
|
|
3578
|
+
else if (cell.y < tableCell.y && cell.y + cell.height > tableCell.y) {
|
|
3579
|
+
this.renderSingleBorder(border_1.color, tableCell.x - cellLeftMargin - lineWidthInt, tableCell.y - cellTopMargin, tableCell.x - cellLeftMargin - lineWidthInt, cell.y + cell.height + cell.margin.bottom, lineWidthInt, border_1.lineStyle);
|
|
3580
|
+
}
|
|
3581
|
+
else if ((cell.y === tableCell.y) || (cell.y > tableCell.y && cell.y + cell.height < tableCell.y + tableCell.height)) {
|
|
3582
|
+
this.renderSingleBorder(border_1.color, tableCell.x - cellLeftMargin - lineWidthInt, cell.y - cell.margin.top, tableCell.x - cellLeftMargin - lineWidthInt, cell.y + cell.height + cell.margin.bottom, lineWidthInt, border_1.lineStyle);
|
|
3583
|
+
}
|
|
3584
|
+
else if (cell.y < tableCell.y + tableCell.height && cell.y + cell.height >= tableCell.y + tableCell.height) {
|
|
3585
|
+
this.renderSingleBorder(border_1.color, tableCell.x - cellLeftMargin - lineWidthInt, cell.y - cell.margin.top, tableCell.x - cellLeftMargin - lineWidthInt, cell.y + cell.height + cellBottomMargin, lineWidthInt, border_1.lineStyle);
|
|
3586
|
+
}
|
|
3587
|
+
else if (cell.y > tableCell.y + tableCell.height) {
|
|
3588
|
+
break;
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
// }
|
|
3594
|
+
if (tableCell.updatedTopBorders && tableCell.updatedTopBorders.length > 1) {
|
|
3595
|
+
var cellX = isBidiTable
|
|
3596
|
+
? cellWidget.x + cellWidget.width + cellWidget.margin.right - leftBorderWidth / 2
|
|
3597
|
+
: cellWidget.x - cellWidget.margin.left - leftBorderWidth / 2;
|
|
3598
|
+
var cellY = cellWidget.y - cellWidget.margin.top;
|
|
3599
|
+
for (var a = 0; a < tableCell.updatedTopBorders.length; a++) {
|
|
3600
|
+
var borderInfo = tableCell.updatedTopBorders[a];
|
|
3601
|
+
border = borderInfo.border;
|
|
3602
|
+
if (border.lineStyle !== 'None' && border.lineWidth < TableCellWidget.getCellTopBorder(tableCell).lineWidth) {
|
|
3603
|
+
border.lineWidth = TableCellWidget.getCellTopBorder(tableCell).lineWidth;
|
|
3604
|
+
}
|
|
3605
|
+
if (!isNullOrUndefined(border)) {
|
|
3606
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3607
|
+
this.renderSingleBorder(border.color, cellX, cellY + lineWidth / 2, cellX + (isBidiTable ? -borderInfo.width : borderInfo.width), cellY + lineWidth / 2, lineWidth, border.lineStyle);
|
|
3608
|
+
cellX += isBidiTable ? -borderInfo.width : borderInfo.width;
|
|
3609
|
+
}
|
|
3610
|
+
}
|
|
3611
|
+
}
|
|
3612
|
+
else {
|
|
3613
|
+
border = TableCellWidget.getCellTopBorder(tableCell);
|
|
3614
|
+
// if (!isNullOrUndefined(border )) { //Renders the cell top border.
|
|
3615
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3616
|
+
var width = 0;
|
|
3617
|
+
var topStartX = cellWidget.x - cellWidget.margin.left - leftBorderWidth / 2;
|
|
3618
|
+
if (!isBidiTable && tableCell.columnIndex === 0 && tableCell.ownerRow.rowIndex > 0) {
|
|
3619
|
+
topStartX += leftBorderWidth;
|
|
3620
|
+
}
|
|
3621
|
+
this.renderSingleBorder(border.color, topStartX, cellWidget.y - cellWidget.margin.top + lineWidth / 2, cellWidget.x + cellWidget.width + cellWidget.margin.right + width, cellWidget.y - cellWidget.margin.top + lineWidth / 2, lineWidth, border.lineStyle);
|
|
3622
|
+
// }
|
|
3623
|
+
}
|
|
3624
|
+
var isLastCell = false;
|
|
3625
|
+
if (!isBidiTable) {
|
|
3626
|
+
isLastCell = tableCell.cellIndex === tableCell.ownerRow.childWidgets.length - 1;
|
|
3627
|
+
}
|
|
3628
|
+
else {
|
|
3629
|
+
isLastCell = tableCell.columnIndex === 0;
|
|
3630
|
+
}
|
|
3631
|
+
var prevRowSpannedCells = tableCell.containerWidget.getPreviousRowSpannedCells();
|
|
3632
|
+
var isAffectedByRowSpan = false;
|
|
3633
|
+
for (var k = 0; k < prevRowSpannedCells.length; k++) {
|
|
3634
|
+
var spannedCell = prevRowSpannedCells[k];
|
|
3635
|
+
if (tableCell.rowIndex < spannedCell.rowIndex + spannedCell.cellFormat.rowSpan && tableCell.columnIndex < spannedCell.columnIndex) {
|
|
3636
|
+
isAffectedByRowSpan = true;
|
|
3637
|
+
break;
|
|
3638
|
+
}
|
|
3639
|
+
}
|
|
3640
|
+
if ((tableCell.ownerTable.tableFormat.cellSpacing > 0 || isLastCell) && (isBidiTable || tableCell.columnIndex + tableCell.cellFormat.columnSpan === tableCell.ownerTable.tableHolder.columns.length || !isAffectedByRowSpan)) {
|
|
3641
|
+
border = isBidiTable ? TableCellWidget.getCellLeftBorder(tableCell) : TableCellWidget.getCellRightBorder(tableCell);
|
|
3642
|
+
// if (!isNullOrUndefined(border )) { //Renders the cell right border.
|
|
3643
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3644
|
+
this.renderSingleBorder(border.color, cellWidget.x + cellWidget.width + cellWidget.margin.right - lineWidth / 2, cellWidget.y - cellWidget.margin.top, cellWidget.x + cellWidget.width + cellWidget.margin.right - lineWidth / 2, cellWidget.y + cellWidget.height + cellBottomMargin, lineWidth, border.lineStyle);
|
|
3645
|
+
// }
|
|
3646
|
+
}
|
|
3647
|
+
var nextRow = tableCell.ownerRow.nextWidget;
|
|
3648
|
+
//Specifies the next row is within the current table widget.
|
|
3649
|
+
//True means current row is not rendered at page end; Otherwise False.
|
|
3650
|
+
var nextRowIsInCurrentTableWidget = false;
|
|
3651
|
+
var previousCellIndex = undefined;
|
|
3652
|
+
if (!isNullOrUndefined(nextRow)) {
|
|
3653
|
+
if (nextRow.lastChild) {
|
|
3654
|
+
var lastCellWidget = nextRow.lastChild;
|
|
3655
|
+
previousCellIndex = lastCellWidget.columnIndex + lastCellWidget.cellFormat.columnSpan;
|
|
3656
|
+
}
|
|
3657
|
+
var nextRowWidget = undefined;
|
|
3658
|
+
// if (viewer.renderedElements.containsKey(nextRow) && viewer.renderedElements.get(nextRow).length > 0) {
|
|
3659
|
+
nextRowWidget = nextRow;
|
|
3660
|
+
// }
|
|
3661
|
+
if (nextRowWidget instanceof TableRowWidget) {
|
|
3662
|
+
if (cellWidget.containerWidget instanceof TableRowWidget && cellWidget.containerWidget.containerWidget instanceof TableWidget) {
|
|
3663
|
+
nextRowIsInCurrentTableWidget = cellWidget.containerWidget.containerWidget.childWidgets.indexOf(nextRowWidget) !== -1;
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
var allowButtomBorderRender = !isNullOrUndefined(nextRow) && isLastCell && (!(nextRow.rowFormat.gridAfter > 0 || nextRow.rowFormat.gridBefore > 0)
|
|
3668
|
+
&& nextRow.lastChild.columnIndex + nextRow.lastChild.cellFormat.columnSpan
|
|
3669
|
+
> tableCell.ownerRow.lastChild.columnIndex
|
|
3670
|
+
&& nextRow.lastChild.columnIndex + nextRow.lastChild.cellFormat.columnSpan
|
|
3671
|
+
< tableCell.ownerRow.lastChild.columnIndex
|
|
3672
|
+
+ tableCell.ownerRow.lastChild.cellFormat.columnSpan)
|
|
3673
|
+
&& !isNullOrUndefined(nextRow.childWidgets) && nextRow.childWidgets.length
|
|
3674
|
+
< tableCell.ownerRow.childWidgets.length + tableCell.cellFormat.columnSpan - 1
|
|
3675
|
+
&& cellWidget.x + cellWidget.width > (nextRow.lastChild.x + nextRow.lastChild.width + nextRow.lastChild.margin.right)
|
|
3676
|
+
&& tableCell.cellFormat.borders.bottom.lineStyle !== 'Cleared';
|
|
3677
|
+
if (tableCell.ownerTable.tableFormat.cellSpacing > 0 || tableCell.ownerRow.rowIndex === tableCell.ownerTable.childWidgets.length - 1
|
|
3678
|
+
|| (tableCell.cellFormat.rowSpan > 1
|
|
3679
|
+
&& tableCell.ownerRow.rowIndex + tableCell.cellFormat.rowSpan >= tableCell.ownerTable.childWidgets.length) ||
|
|
3680
|
+
!nextRowIsInCurrentTableWidget || this.isRenderHeader || previousCellIndex && nextRow.childWidgets.length < tableCell.ownerRow.childWidgets.length
|
|
3681
|
+
&& previousCellIndex < tableCell.columnIndex + tableCell.cellFormat.columnSpan ||
|
|
3682
|
+
((!isNullOrUndefined(tableCell.cellFormat.borders.bottom) && tableCell.cellFormat.borders.bottom.lineStyle !== 'Cleared' && tableCell.cellFormat.rowSpan === 1 && !isBidiTable) &&
|
|
3683
|
+
((!isNullOrUndefined(nextRow) && cellWidget.x < (nextRow.firstChild.x - nextRow.firstChild.margin.left) &&
|
|
3684
|
+
nextRow.rowFormat.gridBefore > 0 && (nextRow.rowFormat.beforeWidth !== 0 || nextRow.rowFormat.gridBeforeWidth !== 0)) ||
|
|
3685
|
+
(!isNullOrUndefined(nextRow) && cellWidget.x + cellWidget.width > (nextRow.lastChild.x + nextRow.lastChild.width + nextRow.lastChild.margin.right) &&
|
|
3686
|
+
nextRow.rowFormat.gridAfter > 0 && (nextRow.rowFormat.afterWidth !== 0 || nextRow.rowFormat.gridAfterWidth !== 0)))
|
|
3687
|
+
|| allowButtomBorderRender)) {
|
|
3688
|
+
var bottomBorder = tableCell.cellFormat.borders.bottom;
|
|
3689
|
+
if (!isNullOrUndefined(bottomBorder) && bottomBorder.lineStyle === 'Cleared') {
|
|
3690
|
+
border = TableCellWidget.getCellBottomBorder(tableCell);
|
|
3691
|
+
}
|
|
3692
|
+
else {
|
|
3693
|
+
border = (tableCell.cellFormat.rowSpan > 1 && tableCell.ownerRow.rowIndex + tableCell.cellFormat.rowSpan === tableCell.ownerTable.childWidgets.length) ?
|
|
3694
|
+
//true part for vertically merged cells specifically.
|
|
3695
|
+
tableCell.getBorderBasedOnPriority(tableCell.getBorderBasedOnPriority(tableCell.cellFormat.borders.bottom, tableCell.ownerRow.rowFormat.borders.bottom), tableCell.ownerTable.tableFormat.borders.bottom)
|
|
3696
|
+
//false part for remaining cases that has been handled inside method.
|
|
3697
|
+
: TableCellWidget.getCellBottomBorder(tableCell);
|
|
3698
|
+
}
|
|
3699
|
+
var startX = cellWidget.x - cellWidget.margin.left - leftBorderWidth / 2;
|
|
3700
|
+
var endX = cellWidget.x + cellWidget.width + cellWidget.margin.right;
|
|
3701
|
+
if (!(previousCellIndex && nextRow.childWidgets.length < tableCell.ownerRow.childWidgets.length && previousCellIndex < tableCell.columnIndex + tableCell.cellFormat.columnSpan) &&
|
|
3702
|
+
!isNullOrUndefined(nextRow) && !isBidiTable && nextRow.rowFormat.gridAfter > 0 && (nextRow.rowFormat.afterWidth !== 0 || nextRow.rowFormat.gridAfterWidth !== 0) && !isNullOrUndefined(nextRow.lastChild) && !isNullOrUndefined(TableCellWidget.getCellTopBorder(nextRow.lastChild)) && TableCellWidget.getCellTopBorder(nextRow.lastChild).lineStyle !== "None" && cellWidget.x < nextRow.lastChild.x + nextRow.lastChild.width + nextRow.lastChild.margin.right
|
|
3703
|
+
|| allowButtomBorderRender) {
|
|
3704
|
+
startX = nextRow.lastChild.x + nextRow.lastChild.width + nextRow.lastChild.margin.right;
|
|
3705
|
+
}
|
|
3706
|
+
if (!(previousCellIndex && nextRow.childWidgets.length < tableCell.ownerRow.childWidgets.length && previousCellIndex < tableCell.columnIndex + tableCell.cellFormat.columnSpan) &&
|
|
3707
|
+
!isNullOrUndefined(nextRow) && !isBidiTable && nextRow.rowFormat.gridBefore > 0 && (nextRow.rowFormat.beforeWidth !== 0 || nextRow.rowFormat.gridBeforeWidth !== 0) && !isNullOrUndefined(nextRow.firstChild) && !isNullOrUndefined(TableCellWidget.getCellTopBorder(nextRow.firstChild)) && TableCellWidget.getCellTopBorder(nextRow.firstChild).lineStyle !== "None" && cellWidget.x + cellWidget.width > nextRow.firstChild.x - nextRow.firstChild.margin.left) {
|
|
3708
|
+
endX = nextRow.firstChild.x - nextRow.firstChild.margin.left;
|
|
3709
|
+
}
|
|
3710
|
+
// if (!isNullOrUndefined(border )) {
|
|
3711
|
+
//Renders the cell bottom border.
|
|
3712
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3713
|
+
this.renderSingleBorder(border.color, startX, cellWidget.y + cellWidget.height + cellBottomMargin + lineWidth / 2, endX, cellWidget.y + cellWidget.height + cellBottomMargin + lineWidth / 2, lineWidth, border.lineStyle);
|
|
3714
|
+
// }
|
|
3715
|
+
}
|
|
3716
|
+
border = layout.getCellDiagonalUpBorder(tableCell);
|
|
3717
|
+
// if (!isNullOrUndefined(border )) {
|
|
3718
|
+
//Renders the cell diagonal up border.
|
|
3719
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3720
|
+
if (lineWidth > 0) {
|
|
3721
|
+
this.renderSingleBorder(border.color, cellWidget.x - cellLeftMargin, cellWidget.y + cellWidget.height + cellBottomMargin, cellWidget.x + cellWidget.width + cellRightMargin, cellWidget.y - cellTopMargin, lineWidth, border.lineStyle);
|
|
3722
|
+
// }
|
|
3723
|
+
}
|
|
3724
|
+
border = layout.getCellDiagonalDownBorder(tableCell);
|
|
3725
|
+
// if (!isNullOrUndefined(border )) {
|
|
3726
|
+
//Renders the cell diagonal down border.
|
|
3727
|
+
lineWidth = LayoutHelperMethods.convertPointToPixel(border.getLineWidth());
|
|
3728
|
+
if (lineWidth > 0) {
|
|
3729
|
+
this.renderSingleBorder(border.color, cellWidget.x - cellLeftMargin, cellWidget.y - cellTopMargin, cellWidget.x + cellWidget.width + cellRightMargin, cellWidget.y + cellWidget.height + cellBottomMargin, lineWidth, border.lineStyle);
|
|
3730
|
+
}
|
|
3731
|
+
// }
|
|
3732
|
+
};
|
|
3733
|
+
/**
|
|
3734
|
+
* Renders Double / Triple cell borders. Every edge of the cell owns a border band that is split into
|
|
3735
|
+
* parallel lines. The outermost line is drawn only on the edges that form the table perimeter (so it
|
|
3736
|
+
* surrounds the entire table); the remaining lines are drawn on every cell, so each cell is surrounded
|
|
3737
|
+
* by its own inner border.
|
|
3738
|
+
*/
|
|
3739
|
+
Renderer.prototype.renderCellMultiLineBorders = function (cellWidget) {
|
|
3740
|
+
var table = cellWidget.ownerTable;
|
|
3741
|
+
var isBidi = table.isBidiTable;
|
|
3742
|
+
var row = cellWidget.ownerRow;
|
|
3743
|
+
var columnCount = table.tableHolder.columns.length;
|
|
3744
|
+
var columnEnd = cellWidget.columnIndex + cellWidget.cellFormat.columnSpan;
|
|
3745
|
+
// Rows may start later (gridBefore) or end earlier (gridAfter) than the table grid.
|
|
3746
|
+
var isFirstColumn = cellWidget.columnIndex <= row.rowFormat.gridBefore;
|
|
3747
|
+
var isLastColumn = columnEnd >= columnCount - row.rowFormat.gridAfter;
|
|
3748
|
+
var rowEnd = row.rowIndex + cellWidget.cellFormat.rowSpan - 1;
|
|
3749
|
+
// A horizontal edge is on the table perimeter when no cell of the neighbouring row lies beside it.
|
|
3750
|
+
var left = cellWidget.x - cellWidget.margin.left;
|
|
3751
|
+
var right = cellWidget.x + cellWidget.width + cellWidget.margin.right;
|
|
3752
|
+
var overlappingCells = function (neighbour) {
|
|
3753
|
+
var cells = [];
|
|
3754
|
+
if (!isNullOrUndefined(neighbour)) {
|
|
3755
|
+
for (var i = 0; i < neighbour.childWidgets.length; i++) {
|
|
3756
|
+
var other = neighbour.childWidgets[i];
|
|
3757
|
+
if (Math.min(right, other.x + other.width + other.margin.right) - Math.max(left, other.x - other.margin.left) > 1) {
|
|
3758
|
+
cells.push(other);
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
}
|
|
3762
|
+
return cells;
|
|
3763
|
+
};
|
|
3764
|
+
// A cell owns a Double / Triple edge when the edge is defined on the cell itself or inherited from the row / table.
|
|
3765
|
+
// An explicit different style (for example Single or Cleared) means the border belongs to the adjacent cell.
|
|
3766
|
+
var ownsMultiLine = function (other, resolved, edgeName) {
|
|
3767
|
+
var own = other.cellFormat.borders[edgeName];
|
|
3768
|
+
var ownStyle = isNullOrUndefined(own) ? 'None' : own.lineStyle;
|
|
3769
|
+
return !isNullOrUndefined(resolved) && (resolved.lineStyle === 'Double' || resolved.lineStyle === 'Triple') &&
|
|
3770
|
+
(ownStyle === 'Double' || ownStyle === 'Triple' || ownStyle === 'None');
|
|
3771
|
+
};
|
|
3772
|
+
var isOutsideRow = function (neighbour, neighbourEdge, resolvedEdge) {
|
|
3773
|
+
var cells = overlappingCells(neighbour);
|
|
3774
|
+
for (var i = 0; i < cells.length; i++) {
|
|
3775
|
+
var resolved = neighbourEdge === 'top' ? TableCellWidget.getCellTopBorder(cells[i]) : TableCellWidget.getCellBottomBorder(cells[i]);
|
|
3776
|
+
if (ownsMultiLine(cells[i], resolved, neighbourEdge)) {
|
|
3777
|
+
return false;
|
|
3778
|
+
}
|
|
3779
|
+
}
|
|
3780
|
+
return true;
|
|
3781
|
+
};
|
|
3782
|
+
var bottomRow = rowEnd < table.childWidgets.length ? table.childWidgets[rowEnd].nextWidget : undefined;
|
|
3783
|
+
// Edge order: 0 - left, 1 - top, 2 - right, 3 - bottom.
|
|
3784
|
+
var bottomBorder = TableCellWidget.getCellBottomBorder(cellWidget);
|
|
3785
|
+
if (cellWidget.cellFormat.rowSpan > 1 && rowEnd === table.childWidgets.length - 1 &&
|
|
3786
|
+
!(cellWidget.cellFormat.borders.bottom && cellWidget.cellFormat.borders.bottom.lineStyle === 'Cleared')) {
|
|
3787
|
+
// Vertically merged cells at the end of the table resolve their bottom border by priority.
|
|
3788
|
+
bottomBorder = cellWidget.getBorderBasedOnPriority(cellWidget.getBorderBasedOnPriority(cellWidget.cellFormat.borders.bottom, row.rowFormat.borders.bottom), table.tableFormat.borders.bottom);
|
|
3789
|
+
}
|
|
3790
|
+
var borders = [
|
|
3791
|
+
isBidi ? TableCellWidget.getCellRightBorder(cellWidget) : TableCellWidget.getCellLeftBorder(cellWidget),
|
|
3792
|
+
TableCellWidget.getCellTopBorder(cellWidget),
|
|
3793
|
+
isBidi ? TableCellWidget.getCellLeftBorder(cellWidget) : TableCellWidget.getCellRightBorder(cellWidget),
|
|
3794
|
+
bottomBorder
|
|
3795
|
+
];
|
|
3796
|
+
var isPerimeter = [
|
|
3797
|
+
isBidi ? isLastColumn : isFirstColumn,
|
|
3798
|
+
isOutsideRow(row.previousWidget, 'bottom', 'top'),
|
|
3799
|
+
isBidi ? isFirstColumn : isLastColumn,
|
|
3800
|
+
isOutsideRow(bottomRow, 'top', 'bottom')
|
|
3801
|
+
];
|
|
3802
|
+
var lineCount = [];
|
|
3803
|
+
var bandWidth = [];
|
|
3804
|
+
var lineWidth = [];
|
|
3805
|
+
var hasMultiLine = false;
|
|
3806
|
+
for (var edge = 0; edge < 4; edge++) {
|
|
3807
|
+
var style = isNullOrUndefined(borders[edge]) ? 'None' : borders[edge].lineStyle;
|
|
3808
|
+
if ((edge === 1 || edge === 3) && !isPerimeter[edge] && !ownsMultiLine(cellWidget, borders[edge], edge === 1 ? 'top' : 'bottom')) {
|
|
3809
|
+
// The neighbouring cell owns this shared edge and draws all of its lines.
|
|
3810
|
+
style = 'None';
|
|
3811
|
+
}
|
|
3812
|
+
lineCount[edge] = style === 'Double' ? 2 : (style === 'Triple' ? 3 : 0);
|
|
3813
|
+
bandWidth[edge] = lineCount[edge] > 0 ? LayoutHelperMethods.convertPointToPixel(borders[edge].getLineWidth()) : 0;
|
|
3814
|
+
// Lines and the gaps between them have the same thickness.
|
|
3815
|
+
lineWidth[edge] = lineCount[edge] > 0 ? bandWidth[edge] / (2 * lineCount[edge] - 1) : 0;
|
|
3816
|
+
hasMultiLine = hasMultiLine || lineCount[edge] > 0;
|
|
3817
|
+
}
|
|
3818
|
+
if (!hasMultiLine) {
|
|
3819
|
+
return;
|
|
3820
|
+
}
|
|
3821
|
+
var bottomMargin = cellWidget.margin.bottom - (cellWidget.containerWidget instanceof TableRowWidget ? cellWidget.containerWidget.bottomBorderWidth : 0);
|
|
3822
|
+
// The edge shared with the next cell is measured with the left margin, as the next cell positions its own
|
|
3823
|
+
// left edge. This keeps merged cells, whose right margin differs, aligned with their neighbours.
|
|
3824
|
+
var rightEdge = cellWidget.x + cellWidget.width + cellWidget.margin.right;
|
|
3825
|
+
if (!isBidi && !isPerimeter[2]) {
|
|
3826
|
+
rightEdge = cellWidget.x + cellWidget.width + cellWidget.margin.left;
|
|
3827
|
+
}
|
|
3828
|
+
// Start of each edge band, positioned like the single line borders are.
|
|
3829
|
+
var bandStart = [
|
|
3830
|
+
// An edge shared with the previous cell reuses that cell's band, so both inner lines sit side by side.
|
|
3831
|
+
cellWidget.x - cellWidget.margin.left - (isPerimeter[0] ? bandWidth[0] / 2 : bandWidth[0]),
|
|
3832
|
+
cellWidget.y - cellWidget.margin.top,
|
|
3833
|
+
rightEdge - bandWidth[2],
|
|
3834
|
+
cellWidget.y + cellWidget.height + bottomMargin
|
|
3835
|
+
];
|
|
3836
|
+
var hasLine = function (edge, line) { return lineCount[edge] > line && (isPerimeter[edge] || line > 0); };
|
|
3837
|
+
// Centre of a line across its band; the outermost line is first.
|
|
3838
|
+
var lineCentre = function (edge, line) {
|
|
3839
|
+
var offset = (2 * line + 0.5) * lineWidth[edge];
|
|
3840
|
+
return edge < 2 ? bandStart[edge] + offset : bandStart[edge] + bandWidth[edge] - offset;
|
|
3841
|
+
};
|
|
3842
|
+
// Where a line ends against a perpendicular edge: at the matching line of that edge, or at the band edge.
|
|
3843
|
+
var lineLimit = function (edge, line) {
|
|
3844
|
+
var offset = hasLine(edge, line) ? 2 * line * lineWidth[edge] : 0;
|
|
3845
|
+
return edge < 2 ? bandStart[edge] + offset : bandStart[edge] + bandWidth[edge] - offset;
|
|
3846
|
+
};
|
|
3847
|
+
var context = this.pageContext;
|
|
3848
|
+
context.setLineDash([]);
|
|
3849
|
+
for (var edge = 0; edge < 4; edge++) {
|
|
3850
|
+
for (var line = 0; line < lineCount[edge]; line++) {
|
|
3851
|
+
if (!hasLine(edge, line)) {
|
|
3852
|
+
continue;
|
|
3853
|
+
}
|
|
3854
|
+
var centre = lineCentre(edge, line);
|
|
3855
|
+
var isVertical = edge % 2 === 0;
|
|
3856
|
+
var from = lineLimit(isVertical ? 1 : 0, line);
|
|
3857
|
+
var to = lineLimit(isVertical ? 3 : 2, line);
|
|
3858
|
+
context.beginPath();
|
|
3859
|
+
if (isVertical) {
|
|
3860
|
+
context.moveTo(this.getScaledValue(centre, 1), this.getScaledValue(from, 2));
|
|
3861
|
+
context.lineTo(this.getScaledValue(centre, 1), this.getScaledValue(to, 2));
|
|
3862
|
+
}
|
|
3863
|
+
else {
|
|
3864
|
+
context.moveTo(this.getScaledValue(from, 1), this.getScaledValue(centre, 2));
|
|
3865
|
+
context.lineTo(this.getScaledValue(to, 1), this.getScaledValue(centre, 2));
|
|
3866
|
+
}
|
|
3867
|
+
context.lineWidth = this.getScaledValue(lineWidth[edge]);
|
|
3868
|
+
context.strokeStyle = LayoutHelperMethods.getColor(borders[edge].color);
|
|
3869
|
+
context.stroke();
|
|
3870
|
+
context.closePath();
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
};
|
|
3874
|
+
Renderer.prototype.renderCellBackground = function (height, cellWidget, leftMargin, rightMargin, lineWidth) {
|
|
3875
|
+
var cellFormat = cellWidget.cellFormat;
|
|
3876
|
+
var left = cellWidget.x - leftMargin - lineWidth / 2;
|
|
3877
|
+
var topMargin = (cellWidget.margin.top - cellWidget.containerWidget.topBorderWidth);
|
|
3878
|
+
var top = cellWidget.y - topMargin;
|
|
3879
|
+
var width = cellWidget.width + leftMargin + rightMargin + lineWidth / 2;
|
|
3880
|
+
var tableBackgroundColor = cellWidget.ownerTable.tableFormat.shading.backgroundColor;
|
|
3881
|
+
var bgColor = cellFormat.shading.backgroundColor;
|
|
3882
|
+
if (cellWidget.ownerRow.rowFormat.revisionLength > 0) {
|
|
3883
|
+
var revision = cellWidget.ownerRow.rowFormat.getRevision(cellWidget.ownerRow.rowFormat.revisionLength - 1);
|
|
3884
|
+
bgColor = this.resolveRowRevisionFillColor(revision);
|
|
3885
|
+
}
|
|
3886
|
+
if (bgColor !== 'empty') {
|
|
3887
|
+
var cellLeftBorder = TableCellWidget.getCellLeftBorder(cellWidget);
|
|
3888
|
+
var cellTopBorder = TableCellWidget.getCellTopBorder(cellWidget);
|
|
3889
|
+
// If the current cell is not the last cell in the row, and the left border is either not styled (lineStyle is 'None') or has been explicitly cleared,
|
|
3890
|
+
// increase the width by 0.5 units to account for the visual gap.
|
|
3891
|
+
if (cellWidget !== cellWidget.ownerRow.lastChild && (cellLeftBorder.lineStyle === 'None' || cellLeftBorder.lineStyle === 'Cleared')) {
|
|
3892
|
+
width += 0.5;
|
|
3893
|
+
}
|
|
3894
|
+
// If the current row is not the last row in the table, and the top border is either not styled (lineStyle is 'None') or has been explicitly cleared,
|
|
3895
|
+
// increase the height by 0.5 units to account for the visual gap.
|
|
3896
|
+
if (cellWidget.ownerRow.ownerTable.lastChild !== cellWidget.ownerRow && (cellTopBorder.lineStyle === 'None' || cellTopBorder.lineStyle === 'Cleared')) {
|
|
3897
|
+
height += 0.5;
|
|
3898
|
+
}
|
|
3899
|
+
}
|
|
3900
|
+
if (cellWidget.ownerTable.tableFormat.cellSpacing > 0) {
|
|
3901
|
+
this.renderBackgroundColor(tableBackgroundColor, left, top, width, height);
|
|
3902
|
+
}
|
|
3903
|
+
this.renderBackgroundColor(bgColor, left, top, width, height);
|
|
3904
|
+
//Render foreground color
|
|
3905
|
+
if (cellFormat.shading.hasValue('foregroundColor') && cellFormat.shading.textureStyle !== 'TextureNone') {
|
|
3906
|
+
this.pageContext.beginPath();
|
|
3907
|
+
this.pageContext.fillStyle = this.drawTextureStyle(cellFormat.shading.textureStyle, LayoutHelperMethods.getColor(cellFormat.shading.foregroundColor), LayoutHelperMethods.getColor(cellFormat.shading.backgroundColor), cellFormat.shading.foregroundColor === 'empty', cellFormat.shading.backgroundColor === 'empty');
|
|
3908
|
+
this.pageContext.fillRect(this.getScaledValue(left, 1), this.getScaledValue(top, 2), this.getScaledValue(width), this.getScaledValue(height));
|
|
3909
|
+
this.pageContext.closePath();
|
|
3910
|
+
}
|
|
3911
|
+
};
|
|
3912
|
+
Renderer.prototype.renderBackgroundColor = function (bgColor, left, top, width, height) {
|
|
3913
|
+
this.pageContext.beginPath();
|
|
3914
|
+
if (bgColor !== 'empty') {
|
|
3915
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(bgColor);
|
|
3916
|
+
this.pageContext.fillRect(this.getScaledValue(left, 1), this.getScaledValue(top, 2), this.getScaledValue(width), this.getScaledValue(height));
|
|
3917
|
+
this.pageContext.closePath();
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3920
|
+
Renderer.prototype.drawTextureStyle = function (textureStyle, foreColor, backColor, isForeColorEmpty, isBackColorEmpty) {
|
|
3921
|
+
if (isBackColorEmpty) {
|
|
3922
|
+
backColor = '#ffffff';
|
|
3923
|
+
}
|
|
3924
|
+
if (isForeColorEmpty) {
|
|
3925
|
+
foreColor = '#000000';
|
|
3926
|
+
}
|
|
3927
|
+
if (textureStyle.indexOf('Percent') > -1) {
|
|
3928
|
+
var text = textureStyle.replace("Texture", "").replace("Percent", "").replace("Pt", ".");
|
|
3929
|
+
var percent = parseInt(text);
|
|
3930
|
+
return this.getForeColor(foreColor, backColor, percent, isForeColorEmpty, isBackColorEmpty);
|
|
3931
|
+
}
|
|
3932
|
+
if (textureStyle === 'TextureSolid') {
|
|
3933
|
+
return foreColor;
|
|
3934
|
+
}
|
|
3935
|
+
return '#FFFFFF';
|
|
3936
|
+
};
|
|
3937
|
+
Renderer.prototype.getForeColor = function (foreColor, backColor, percent, isForeColorEmpty, isBackColorEmpty) {
|
|
3938
|
+
var r = 0;
|
|
3939
|
+
var g = 0;
|
|
3940
|
+
var b = 0;
|
|
3941
|
+
var foreColorRgb = LayoutHelperMethods.convertHexToRgb(foreColor);
|
|
3942
|
+
var backColorRgb = LayoutHelperMethods.convertHexToRgb(backColor);
|
|
3943
|
+
r = this.getColorValue(foreColorRgb.r, backColorRgb.r, percent, isForeColorEmpty, isBackColorEmpty);
|
|
3944
|
+
g = this.getColorValue(foreColorRgb.g, backColorRgb.g, percent, isForeColorEmpty, isBackColorEmpty);
|
|
3945
|
+
b = this.getColorValue(foreColorRgb.b, backColorRgb.b, percent, isForeColorEmpty, isBackColorEmpty);
|
|
3946
|
+
return ('#' + LayoutHelperMethods.convertRgbToHex(r) + LayoutHelperMethods.convertRgbToHex(g) + LayoutHelperMethods.convertRgbToHex(b));
|
|
3947
|
+
};
|
|
3948
|
+
Renderer.prototype.getColorValue = function (foreColorValue, backColorValue, percent, isForeColorEmpty, isBackColorEmpty) {
|
|
3949
|
+
var colorValue = 0;
|
|
3950
|
+
if (percent == 100) {
|
|
3951
|
+
colorValue = foreColorValue;
|
|
3952
|
+
}
|
|
3953
|
+
else {
|
|
3954
|
+
if (isForeColorEmpty) {
|
|
3955
|
+
if (isBackColorEmpty) {
|
|
3956
|
+
colorValue = Math.round(255 * (1 - percent / 100));
|
|
3957
|
+
}
|
|
3958
|
+
else {
|
|
3959
|
+
colorValue = Math.round(backColorValue * (1 - percent / 100));
|
|
3960
|
+
}
|
|
3961
|
+
}
|
|
3962
|
+
else {
|
|
3963
|
+
if (isBackColorEmpty) {
|
|
3964
|
+
colorValue = Math.round(foreColorValue * (percent / 100));
|
|
3965
|
+
}
|
|
3966
|
+
else {
|
|
3967
|
+
colorValue = backColorValue + Math.round(foreColorValue * (percent / 100)) - Math.round(backColorValue * (percent / 100));
|
|
3968
|
+
}
|
|
3969
|
+
}
|
|
3970
|
+
}
|
|
3971
|
+
return colorValue;
|
|
3972
|
+
};
|
|
3973
|
+
Renderer.prototype.setLineDashBasedOnStyle = function (lineStyle, lineWidth) {
|
|
3974
|
+
var scaledLineWidth = this.getScaledValue(lineWidth);
|
|
3975
|
+
switch (lineStyle) {
|
|
3976
|
+
case 'Dot':
|
|
3977
|
+
this.pageContext.setLineDash([this.getScaledValue(1) * scaledLineWidth, this.getScaledValue(1) * scaledLineWidth]);
|
|
3978
|
+
break;
|
|
3979
|
+
case 'DashSmallGap':
|
|
3980
|
+
this.pageContext.setLineDash([this.getScaledValue(4) * scaledLineWidth, this.getScaledValue(2) * scaledLineWidth]);
|
|
3981
|
+
break;
|
|
3982
|
+
case 'DashLargeGap':
|
|
3983
|
+
this.pageContext.setLineDash([(this.getScaledValue(4) * scaledLineWidth), this.getScaledValue(4) * scaledLineWidth]);
|
|
3984
|
+
break;
|
|
3985
|
+
}
|
|
3986
|
+
};
|
|
3987
|
+
Renderer.prototype.renderMultipleLineBorder = function (color, startX, startY, endX, endY, lineWidth, lineCount) {
|
|
3988
|
+
var length = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));
|
|
3989
|
+
if (length === 0) {
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
// Each individual line is thinner than the configured border width.
|
|
3993
|
+
var subLineWidth = Math.max(lineWidth / (lineCount + 1), 0.5);
|
|
3994
|
+
var gap = Math.max(lineWidth, 2);
|
|
3995
|
+
// Unit normal to the border line, used to offset each parallel line.
|
|
3996
|
+
var normalX = -(endY - startY) / length;
|
|
3997
|
+
var normalY = (endX - startX) / length;
|
|
3998
|
+
var offsets = lineCount === 2 ? [-gap / 2, gap / 2] : [-gap, 0, gap];
|
|
3999
|
+
this.pageContext.setLineDash([]);
|
|
4000
|
+
for (var _i = 0, offsets_1 = offsets; _i < offsets_1.length; _i++) {
|
|
4001
|
+
var offset = offsets_1[_i];
|
|
4002
|
+
this.pageContext.beginPath();
|
|
4003
|
+
this.pageContext.moveTo(this.getScaledValue(startX + normalX * offset, 1), this.getScaledValue(startY + normalY * offset, 2));
|
|
4004
|
+
this.pageContext.lineTo(this.getScaledValue(endX + normalX * offset, 1), this.getScaledValue(endY + normalY * offset, 2));
|
|
4005
|
+
this.pageContext.lineWidth = this.getScaledValue(subLineWidth);
|
|
4006
|
+
this.pageContext.strokeStyle = LayoutHelperMethods.getColor(color);
|
|
4007
|
+
this.pageContext.stroke();
|
|
4008
|
+
this.pageContext.closePath();
|
|
4009
|
+
}
|
|
4010
|
+
};
|
|
4011
|
+
Renderer.prototype.renderSingleBorder = function (color, startX, startY, endX, endY, lineWidth, lineStyle) {
|
|
4012
|
+
if (lineStyle === 'Double' || lineStyle === 'Triple') {
|
|
4013
|
+
if (this.isRenderingCellBorders) {
|
|
4014
|
+
// Double and Triple cell borders are drawn together per cell by renderCellMultiLineBorders.
|
|
4015
|
+
return;
|
|
4016
|
+
}
|
|
4017
|
+
this.renderMultipleLineBorder(color, startX, startY, endX, endY, lineWidth, lineStyle === 'Double' ? 2 : 3);
|
|
4018
|
+
return;
|
|
4019
|
+
}
|
|
4020
|
+
this.setLineDashBasedOnStyle(lineStyle, lineWidth);
|
|
4021
|
+
this.pageContext.beginPath();
|
|
4022
|
+
this.pageContext.moveTo(this.getScaledValue(startX, 1), this.getScaledValue(startY, 2));
|
|
4023
|
+
this.pageContext.lineTo(this.getScaledValue(endX, 1), this.getScaledValue(endY, 2));
|
|
4024
|
+
this.pageContext.lineWidth = this.getScaledValue(lineWidth);
|
|
4025
|
+
// set line color
|
|
4026
|
+
this.pageContext.strokeStyle = LayoutHelperMethods.getColor(color);
|
|
4027
|
+
if (lineStyle !== "None" && lineStyle !== "Cleared") {
|
|
4028
|
+
this.pageContext.stroke();
|
|
4029
|
+
}
|
|
4030
|
+
this.pageContext.closePath();
|
|
4031
|
+
if (lineStyle === 'Dot' || lineStyle === 'DashSmallGap' || lineStyle === 'DashLargeGap') {
|
|
4032
|
+
this.pageContext.setLineDash([]);
|
|
4033
|
+
}
|
|
4034
|
+
};
|
|
4035
|
+
Renderer.prototype.getScaledValue = function (value, type) {
|
|
4036
|
+
// PDF export mirrors printing: 1:1 layout pixels, no zoom / viewport offset.
|
|
4037
|
+
if (this.isPrinting) {
|
|
4038
|
+
return value;
|
|
4039
|
+
}
|
|
4040
|
+
if (isNullOrUndefined(type)) {
|
|
4041
|
+
type = 0;
|
|
4042
|
+
}
|
|
4043
|
+
var x = value * this.documentHelper.zoomFactor;
|
|
4044
|
+
return x + (type === 1 ? this.pageLeft : (type === 2 ? this.pageTop : 0));
|
|
4045
|
+
};
|
|
4046
|
+
Renderer.prototype.checkRevisionType = function (elementBox) {
|
|
4047
|
+
var revisions = [];
|
|
4048
|
+
var count = elementBox.revisionLength;
|
|
4049
|
+
for (var i = 0; i < count; i++) {
|
|
4050
|
+
var currentRevision = elementBox.getRevision(i);
|
|
4051
|
+
var color = this.resolveRevisionDisplayColor(currentRevision);
|
|
4052
|
+
revisions.push({ 'type': currentRevision.revisionType, 'color': color });
|
|
4053
|
+
}
|
|
4054
|
+
return revisions;
|
|
4055
|
+
};
|
|
4056
|
+
/**
|
|
4057
|
+
* Resolves the display color for a revision using insertRevisionColor / deleteRevisionColor
|
|
4058
|
+
* when set to a fixed hex value; otherwise falls back to the author-specific color.
|
|
4059
|
+
*
|
|
4060
|
+
* @private
|
|
4061
|
+
* @param {RevisionBase} revision - The revision whose display color is needed.
|
|
4062
|
+
* @returns {string} Hex color string used for visual identification.
|
|
4063
|
+
*/
|
|
4064
|
+
Renderer.prototype.resolveRevisionDisplayColor = function (revision) {
|
|
4065
|
+
return this.resolveTypedRevisionColor(revision, false);
|
|
4066
|
+
};
|
|
4067
|
+
/**
|
|
4068
|
+
* Resolves the background color for table-row revisions using insertedRowColor / deletedRowColor
|
|
4069
|
+
* when set to a fixed hex value; otherwise falls back to the author-specific color.
|
|
4070
|
+
*
|
|
4071
|
+
* @private
|
|
4072
|
+
* @param {RevisionBase} revision - The row revision whose display color is needed.
|
|
4073
|
+
* @returns {string} Hex color string used for visual identification of the row.
|
|
4074
|
+
*/
|
|
4075
|
+
Renderer.prototype.resolveRowRevisionFillColor = function (revision) {
|
|
4076
|
+
// Row/cell fill uses the same base color as text revisions, then softens it
|
|
4077
|
+
// to 10% tint so the background remains readable behind content.
|
|
4078
|
+
return this.tintColor(this.resolveTypedRevisionColor(revision, true), 10);
|
|
4079
|
+
};
|
|
4080
|
+
/**
|
|
4081
|
+
* Mixes the given hex color with white at the specified percent intensity.
|
|
4082
|
+
* Example: 10% of #0e76b1 on white yields a light wash of that color.
|
|
4083
|
+
*
|
|
4084
|
+
* @param {string} color - Source hex color (e.g. `#0e76b1` or `0e76b1`).
|
|
4085
|
+
* @param {number} percent - Intensity of the source color (0–100).
|
|
4086
|
+
* @returns {string} Tinted hex color string.
|
|
4087
|
+
*/
|
|
4088
|
+
Renderer.prototype.tintColor = function (color, percent) {
|
|
4089
|
+
if (isNullOrUndefined(color) || color === '' || color === 'empty') {
|
|
4090
|
+
return color;
|
|
4091
|
+
}
|
|
4092
|
+
var normalized = color.charAt(0) === '#' ? color : ('#' + color);
|
|
4093
|
+
// Strip alpha channel if present (#AARRGGBB -> #RRGGBB).
|
|
4094
|
+
if (normalized.length === 9) {
|
|
4095
|
+
normalized = '#' + normalized.substring(3);
|
|
4096
|
+
}
|
|
4097
|
+
var rgb = LayoutHelperMethods.convertHexToRgb(normalized);
|
|
4098
|
+
if (isNullOrUndefined(rgb)) {
|
|
4099
|
+
return color;
|
|
4100
|
+
}
|
|
4101
|
+
var ratio = Math.max(0, Math.min(100, percent)) / 100;
|
|
4102
|
+
// Blend toward white: out = color * ratio + 255 * (1 - ratio)
|
|
4103
|
+
var r = Math.round(rgb.r * ratio + 255 * (1 - ratio));
|
|
4104
|
+
var g = Math.round(rgb.g * ratio + 255 * (1 - ratio));
|
|
4105
|
+
var b = Math.round(rgb.b * ratio + 255 * (1 - ratio));
|
|
4106
|
+
return ('#' + LayoutHelperMethods.convertRgbToHex(r) + LayoutHelperMethods.convertRgbToHex(g) + LayoutHelperMethods.convertRgbToHex(b));
|
|
4107
|
+
};
|
|
4108
|
+
/**
|
|
4109
|
+
* Shared resolver for type-based revision colors (content vs table-row).
|
|
4110
|
+
*
|
|
4111
|
+
* @param {RevisionBase} revision - The revision whose display color is needed.
|
|
4112
|
+
* @param {boolean} forTableRow - When true, uses insertedRowColor/deletedRowColor; otherwise insertRevisionColor/deleteRevisionColor.
|
|
4113
|
+
* @returns {string} Hex color string used for visual identification.
|
|
4114
|
+
*/
|
|
4115
|
+
Renderer.prototype.resolveTypedRevisionColor = function (revision, forTableRow) {
|
|
4116
|
+
var revisionSettings = this.documentHelper
|
|
4117
|
+
&& this.documentHelper.documentEditorSettings
|
|
4118
|
+
? this.documentHelper.documentEditorSettings.revisionSettings : undefined;
|
|
4119
|
+
var isInsert = revision.revisionType === 'Insertion' || revision.revisionType === 'MoveTo';
|
|
4120
|
+
var isDelete = revision.revisionType === 'Deletion' || revision.revisionType === 'MoveFrom';
|
|
4121
|
+
if (!isNullOrUndefined(revisionSettings)) {
|
|
4122
|
+
var insertColor = forTableRow
|
|
4123
|
+
? revisionSettings.insertedRowColor : revisionSettings.insertRevisionColor;
|
|
4124
|
+
var deleteColor = forTableRow
|
|
4125
|
+
? revisionSettings.deletedRowColor : revisionSettings.deleteRevisionColor;
|
|
4126
|
+
if (isInsert && !isNullOrUndefined(insertColor)
|
|
4127
|
+
&& insertColor !== ''
|
|
4128
|
+
&& insertColor.toLowerCase() !== 'byauthor') {
|
|
4129
|
+
return insertColor;
|
|
4130
|
+
}
|
|
4131
|
+
if (isDelete && !isNullOrUndefined(deleteColor)
|
|
4132
|
+
&& deleteColor !== ''
|
|
4133
|
+
&& deleteColor.toLowerCase() !== 'byauthor') {
|
|
4134
|
+
return deleteColor;
|
|
4135
|
+
}
|
|
4136
|
+
}
|
|
4137
|
+
var color = this.documentHelper.authors.get(revision.author);
|
|
4138
|
+
if (isNullOrUndefined(color)) {
|
|
4139
|
+
color = this.documentHelper.getAuthorColor(revision.author);
|
|
4140
|
+
}
|
|
4141
|
+
return color;
|
|
4142
|
+
};
|
|
4143
|
+
Renderer.prototype.getRevisionColor = function (revisionInfo) {
|
|
4144
|
+
if (revisionInfo.length === 1) {
|
|
4145
|
+
return revisionInfo[0].color;
|
|
4146
|
+
}
|
|
4147
|
+
for (var i = 0; i < revisionInfo.length; i++) {
|
|
4148
|
+
if (revisionInfo[i].type === 'Deletion' || revisionInfo[i].type === 'MoveFrom') {
|
|
4149
|
+
return revisionInfo[i].color;
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
if (revisionInfo.length > 0) {
|
|
4153
|
+
return revisionInfo[0].color;
|
|
4154
|
+
}
|
|
4155
|
+
return undefined;
|
|
4156
|
+
};
|
|
4157
|
+
Renderer.prototype.getRevisionType = function (revisionInfo, checkInsert) {
|
|
4158
|
+
if (revisionInfo.length === 0) {
|
|
4159
|
+
return undefined;
|
|
4160
|
+
}
|
|
4161
|
+
for (var i = 0; i < revisionInfo.length; i++) {
|
|
4162
|
+
var type = undefined;
|
|
4163
|
+
if (checkInsert && (revisionInfo[i].type === 'Insertion' || revisionInfo[i].type === 'MoveTo')) {
|
|
4164
|
+
type = revisionInfo[i];
|
|
4165
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(type.color);
|
|
4166
|
+
revisionInfo.splice(i, 1);
|
|
4167
|
+
return type;
|
|
4168
|
+
}
|
|
4169
|
+
if (!checkInsert && (revisionInfo[i].type === 'Deletion' || revisionInfo[i].type === 'MoveFrom')) {
|
|
4170
|
+
type = revisionInfo[i];
|
|
4171
|
+
this.pageContext.fillStyle = LayoutHelperMethods.getColor(type.color);
|
|
4172
|
+
revisionInfo.splice(i, 1);
|
|
4173
|
+
return type;
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
return undefined;
|
|
4177
|
+
};
|
|
4178
|
+
Renderer.prototype.getFormfieldInLine = function (line) {
|
|
4179
|
+
for (var i = 0; i < line.children.length; i++) {
|
|
4180
|
+
if (line.children[i] instanceof FieldElementBox && !isNullOrUndefined(line.children[i].formFieldData)) {
|
|
4181
|
+
return line.children[i];
|
|
4182
|
+
}
|
|
4183
|
+
}
|
|
4184
|
+
return undefined;
|
|
4185
|
+
};
|
|
4186
|
+
Renderer.prototype.renderLockMark = function (elementBox, currentUser, locale) {
|
|
4187
|
+
if (isNullOrUndefined(elementBox.editRangeMark)) {
|
|
4188
|
+
var user = currentUser === elementBox.user ? 'you' : elementBox.user;
|
|
4189
|
+
elementBox.editRangeMark = document.createElement('div');
|
|
4190
|
+
elementBox.editRangeMark.style.display = 'none';
|
|
4191
|
+
elementBox.editRangeMark.classList.add('e-de-lock-mark');
|
|
4192
|
+
var span = document.createElement('span');
|
|
4193
|
+
span.className = 'e-icons e-de-ctnr-lock';
|
|
4194
|
+
elementBox.editRangeMark.appendChild(span);
|
|
4195
|
+
elementBox.editRangeMark.title =
|
|
4196
|
+
locale.getConstant('This region is locked by') + ' ' + user;
|
|
4197
|
+
}
|
|
4198
|
+
if (elementBox.line && isNullOrUndefined(elementBox.editRangeMark.parentElement)) {
|
|
4199
|
+
var documentHelper = elementBox.line.paragraph.bodyWidget.page.documentHelper;
|
|
4200
|
+
documentHelper.pageContainer.appendChild(elementBox.editRangeMark);
|
|
4201
|
+
}
|
|
4202
|
+
};
|
|
4203
|
+
// Shape utility
|
|
4204
|
+
Renderer.prototype.getShape = function (shape) {
|
|
4205
|
+
return this.shapes[shape.toString()];
|
|
4206
|
+
};
|
|
4207
|
+
/**
|
|
4208
|
+
* Destroys the internal objects which is maintained.
|
|
4209
|
+
*
|
|
4210
|
+
* @returns {void}
|
|
4211
|
+
*/
|
|
4212
|
+
Renderer.prototype.destroy = function () {
|
|
4213
|
+
this.documentHelper = undefined;
|
|
4214
|
+
this.shapes = null;
|
|
4215
|
+
if (!isNullOrUndefined(this.pageCanvasIn)) {
|
|
4216
|
+
this.pageCanvasIn.innerHTML = '';
|
|
4217
|
+
}
|
|
4218
|
+
this.pageCanvasIn = undefined;
|
|
4219
|
+
};
|
|
4220
|
+
return Renderer;
|
|
4221
|
+
}());
|
|
4222
|
+
export { Renderer };
|