@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
|
@@ -0,0 +1,854 @@
|
|
|
1
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
2
|
+
import { Dictionary } from '../base/dictionary';
|
|
3
|
+
import { WBorders } from './borders';
|
|
4
|
+
import { WUniqueFormat } from '../base/unique-format';
|
|
5
|
+
import { WUniqueFormats } from '../base/unique-formats';
|
|
6
|
+
import { WListFormat } from './list-format';
|
|
7
|
+
import { ParagraphWidget, TableCellWidget, BlockContainer, TextFrame } from '../page';
|
|
8
|
+
import { WParagraphStyle } from './style';
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
/**
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
var WTabStop = /** @class */ (function () {
|
|
14
|
+
function WTabStop() {
|
|
15
|
+
}
|
|
16
|
+
Object.defineProperty(WTabStop.prototype, "position", {
|
|
17
|
+
get: function () {
|
|
18
|
+
return this.positionIn;
|
|
19
|
+
},
|
|
20
|
+
set: function (value) {
|
|
21
|
+
this.positionIn = value;
|
|
22
|
+
},
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(WTabStop.prototype, "deletePosition", {
|
|
27
|
+
get: function () {
|
|
28
|
+
return this.deletePositionIn;
|
|
29
|
+
},
|
|
30
|
+
set: function (value) {
|
|
31
|
+
this.deletePositionIn = value;
|
|
32
|
+
},
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(WTabStop.prototype, "tabJustification", {
|
|
37
|
+
get: function () {
|
|
38
|
+
return this.justification;
|
|
39
|
+
},
|
|
40
|
+
set: function (value) {
|
|
41
|
+
this.justification = value;
|
|
42
|
+
},
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(WTabStop.prototype, "tabLeader", {
|
|
47
|
+
get: function () {
|
|
48
|
+
return this.leader;
|
|
49
|
+
},
|
|
50
|
+
set: function (value) {
|
|
51
|
+
this.leader = value;
|
|
52
|
+
},
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true
|
|
55
|
+
});
|
|
56
|
+
WTabStop.prototype.clone = function () {
|
|
57
|
+
var tabStop = new WTabStop();
|
|
58
|
+
tabStop.deletePosition = this.deletePosition;
|
|
59
|
+
tabStop.position = this.position;
|
|
60
|
+
tabStop.tabJustification = this.tabJustification;
|
|
61
|
+
tabStop.tabLeader = this.tabLeader;
|
|
62
|
+
return tabStop;
|
|
63
|
+
};
|
|
64
|
+
WTabStop.prototype.equals = function (tab) {
|
|
65
|
+
if (this.position === tab.position &&
|
|
66
|
+
this.deletePosition === tab.deletePosition &&
|
|
67
|
+
this.tabJustification === tab.tabJustification &&
|
|
68
|
+
this.tabLeader === tab.tabLeader) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
WTabStop.prototype.destroy = function () {
|
|
76
|
+
this.position = undefined;
|
|
77
|
+
this.deletePosition = undefined;
|
|
78
|
+
this.tabJustification = undefined;
|
|
79
|
+
this.leader = undefined;
|
|
80
|
+
};
|
|
81
|
+
return WTabStop;
|
|
82
|
+
}());
|
|
83
|
+
export { WTabStop };
|
|
84
|
+
/**
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
var WParagraphFormat = /** @class */ (function () {
|
|
88
|
+
function WParagraphFormat(node) {
|
|
89
|
+
this.uniqueParagraphFormat = undefined;
|
|
90
|
+
this.ownerBase = undefined;
|
|
91
|
+
this.baseStyle = undefined;
|
|
92
|
+
this.tabs = undefined;
|
|
93
|
+
this.ownerBase = node;
|
|
94
|
+
this.listFormat = new WListFormat(this);
|
|
95
|
+
this.borders = new WBorders(this);
|
|
96
|
+
this.tabs = [];
|
|
97
|
+
}
|
|
98
|
+
WParagraphFormat.prototype.getUpdatedTabs = function () {
|
|
99
|
+
var inTabs = [];
|
|
100
|
+
var tabStops = new Dictionary();
|
|
101
|
+
var tabsInListFormat = this.getTabStopsFromListFormat();
|
|
102
|
+
for (var _i = 0, tabsInListFormat_1 = tabsInListFormat; _i < tabsInListFormat_1.length; _i++) {
|
|
103
|
+
var tabStop = tabsInListFormat_1[_i];
|
|
104
|
+
if (!tabStops.containsKey(tabStop.position)) {
|
|
105
|
+
tabStops.add(tabStop.position, tabStop);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (!isNullOrUndefined(this.baseStyle) && this.baseStyle instanceof WParagraphStyle) {
|
|
109
|
+
var baseStyle = this.baseStyle;
|
|
110
|
+
while (!isNullOrUndefined(baseStyle)) {
|
|
111
|
+
for (var _a = 0, _b = baseStyle.paragraphFormat.tabs; _a < _b.length; _a++) {
|
|
112
|
+
var tab = _b[_a];
|
|
113
|
+
if (!tabStops.containsKey(tab.position)) {
|
|
114
|
+
tabStops.add(tab.position, tab);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
baseStyle = baseStyle.basedOn;
|
|
118
|
+
}
|
|
119
|
+
var tabsCollection_1 = [];
|
|
120
|
+
tabStops.keys.forEach(function (key) { tabsCollection_1.push(tabStops.get(key)); });
|
|
121
|
+
for (var i = 0; i < tabsCollection_1.length; i++) {
|
|
122
|
+
var tabStop = tabsCollection_1[i];
|
|
123
|
+
if (!this.isValidTabStop(tabsCollection_1, tabStop)) {
|
|
124
|
+
tabStops.remove(tabStop.position);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for (var _c = 0, _d = tabStops.keys; _c < _d.length; _c++) {
|
|
128
|
+
var key = _d[_c];
|
|
129
|
+
if (!this.hasTabStop(parseFloat(key.toFixed(4)))) {
|
|
130
|
+
inTabs.push(tabStops.get(key));
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
inTabs = inTabs.concat(this.tabs.filter(function (a) { return (a.position !== 0 && a.deletePosition === 0); }));
|
|
135
|
+
inTabs = inTabs.sort(function (a, b) { return a.position - b.position; });
|
|
136
|
+
return inTabs;
|
|
137
|
+
};
|
|
138
|
+
WParagraphFormat.prototype.getTabStopsFromListFormat = function () {
|
|
139
|
+
if (this.listFormat.listId > -1 && this.listFormat.listLevelNumber > -1) {
|
|
140
|
+
var level = this.listFormat.listLevel;
|
|
141
|
+
if (level && level.paragraphFormat) {
|
|
142
|
+
return level.paragraphFormat.tabs;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return [];
|
|
146
|
+
};
|
|
147
|
+
WParagraphFormat.prototype.isValidTabStop = function (tabs, tabStop) {
|
|
148
|
+
for (var i = 0; i < tabs.length; i++) {
|
|
149
|
+
if (!isNullOrUndefined(tabs[i].position) && !isNullOrUndefined(tabs[i].deletePosition) && !isNullOrUndefined(tabStop.position)) {
|
|
150
|
+
if (tabStop != tabs[i] && (parseFloat(tabs[i].position.toFixed(4)) === parseFloat(tabStop.position.toFixed(4)) ||
|
|
151
|
+
(parseFloat(tabs[i].deletePosition.toFixed(4)) !== 0 && parseFloat(tabs[i].deletePosition.toFixed(4)) === parseFloat(tabStop.position.toFixed(4))))) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
};
|
|
158
|
+
WParagraphFormat.prototype.hasTabStop = function (position) {
|
|
159
|
+
for (var i = 0; i < this.tabs.length; i++) {
|
|
160
|
+
if (!isNullOrUndefined(this.tabs[i].position) && !isNullOrUndefined(this.tabs[i].deletePosition)) {
|
|
161
|
+
if (parseFloat(this.tabs[i].position.toFixed(4)) === position ||
|
|
162
|
+
parseFloat(this.tabs[i].deletePosition.toFixed(4)) === position) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return false;
|
|
168
|
+
};
|
|
169
|
+
Object.defineProperty(WParagraphFormat.prototype, "leftIndent", {
|
|
170
|
+
get: function () {
|
|
171
|
+
return this.getPropertyValue('leftIndent');
|
|
172
|
+
},
|
|
173
|
+
set: function (value) {
|
|
174
|
+
this.setPropertyValue('leftIndent', value);
|
|
175
|
+
},
|
|
176
|
+
enumerable: true,
|
|
177
|
+
configurable: true
|
|
178
|
+
});
|
|
179
|
+
Object.defineProperty(WParagraphFormat.prototype, "rightIndent", {
|
|
180
|
+
get: function () {
|
|
181
|
+
return this.getPropertyValue('rightIndent');
|
|
182
|
+
},
|
|
183
|
+
set: function (value) {
|
|
184
|
+
this.setPropertyValue('rightIndent', value);
|
|
185
|
+
},
|
|
186
|
+
enumerable: true,
|
|
187
|
+
configurable: true
|
|
188
|
+
});
|
|
189
|
+
Object.defineProperty(WParagraphFormat.prototype, "firstLineIndent", {
|
|
190
|
+
get: function () {
|
|
191
|
+
return this.getPropertyValue('firstLineIndent');
|
|
192
|
+
},
|
|
193
|
+
set: function (value) {
|
|
194
|
+
this.setPropertyValue('firstLineIndent', value);
|
|
195
|
+
},
|
|
196
|
+
enumerable: true,
|
|
197
|
+
configurable: true
|
|
198
|
+
});
|
|
199
|
+
Object.defineProperty(WParagraphFormat.prototype, "beforeSpacing", {
|
|
200
|
+
get: function () {
|
|
201
|
+
return this.getPropertyValue('beforeSpacing');
|
|
202
|
+
},
|
|
203
|
+
set: function (value) {
|
|
204
|
+
this.setPropertyValue('beforeSpacing', value);
|
|
205
|
+
},
|
|
206
|
+
enumerable: true,
|
|
207
|
+
configurable: true
|
|
208
|
+
});
|
|
209
|
+
Object.defineProperty(WParagraphFormat.prototype, "afterSpacing", {
|
|
210
|
+
get: function () {
|
|
211
|
+
return this.getPropertyValue('afterSpacing');
|
|
212
|
+
},
|
|
213
|
+
set: function (value) {
|
|
214
|
+
this.setPropertyValue('afterSpacing', value);
|
|
215
|
+
},
|
|
216
|
+
enumerable: true,
|
|
217
|
+
configurable: true
|
|
218
|
+
});
|
|
219
|
+
Object.defineProperty(WParagraphFormat.prototype, "spaceBeforeAuto", {
|
|
220
|
+
get: function () {
|
|
221
|
+
return this.getPropertyValue('spaceBeforeAuto');
|
|
222
|
+
},
|
|
223
|
+
set: function (value) {
|
|
224
|
+
this.setPropertyValue('spaceBeforeAuto', value);
|
|
225
|
+
},
|
|
226
|
+
enumerable: true,
|
|
227
|
+
configurable: true
|
|
228
|
+
});
|
|
229
|
+
Object.defineProperty(WParagraphFormat.prototype, "spaceAfterAuto", {
|
|
230
|
+
get: function () {
|
|
231
|
+
return this.getPropertyValue('spaceAfterAuto');
|
|
232
|
+
},
|
|
233
|
+
set: function (value) {
|
|
234
|
+
this.setPropertyValue('spaceAfterAuto', value);
|
|
235
|
+
},
|
|
236
|
+
enumerable: true,
|
|
237
|
+
configurable: true
|
|
238
|
+
});
|
|
239
|
+
Object.defineProperty(WParagraphFormat.prototype, "lineSpacing", {
|
|
240
|
+
get: function () {
|
|
241
|
+
return this.getPropertyValue('lineSpacing');
|
|
242
|
+
},
|
|
243
|
+
set: function (value) {
|
|
244
|
+
this.setPropertyValue('lineSpacing', value);
|
|
245
|
+
},
|
|
246
|
+
enumerable: true,
|
|
247
|
+
configurable: true
|
|
248
|
+
});
|
|
249
|
+
Object.defineProperty(WParagraphFormat.prototype, "lineSpacingType", {
|
|
250
|
+
get: function () {
|
|
251
|
+
return this.getPropertyValue('lineSpacingType');
|
|
252
|
+
},
|
|
253
|
+
set: function (value) {
|
|
254
|
+
this.setPropertyValue('lineSpacingType', value);
|
|
255
|
+
},
|
|
256
|
+
enumerable: true,
|
|
257
|
+
configurable: true
|
|
258
|
+
});
|
|
259
|
+
Object.defineProperty(WParagraphFormat.prototype, "textAlignment", {
|
|
260
|
+
get: function () {
|
|
261
|
+
var value = this.getPropertyValue('textAlignment');
|
|
262
|
+
if (this.bidi) {
|
|
263
|
+
if (value === 'Left') {
|
|
264
|
+
value = 'Right';
|
|
265
|
+
}
|
|
266
|
+
else if (value === 'Right') {
|
|
267
|
+
value = 'Left';
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return value;
|
|
271
|
+
},
|
|
272
|
+
set: function (value) {
|
|
273
|
+
this.setPropertyValue('textAlignment', value);
|
|
274
|
+
},
|
|
275
|
+
enumerable: true,
|
|
276
|
+
configurable: true
|
|
277
|
+
});
|
|
278
|
+
Object.defineProperty(WParagraphFormat.prototype, "keepWithNext", {
|
|
279
|
+
get: function () {
|
|
280
|
+
return this.getPropertyValue('keepWithNext');
|
|
281
|
+
},
|
|
282
|
+
set: function (value) {
|
|
283
|
+
this.setPropertyValue('keepWithNext', value);
|
|
284
|
+
},
|
|
285
|
+
enumerable: true,
|
|
286
|
+
configurable: true
|
|
287
|
+
});
|
|
288
|
+
Object.defineProperty(WParagraphFormat.prototype, "keepLinesTogether", {
|
|
289
|
+
get: function () {
|
|
290
|
+
return this.getPropertyValue('keepLinesTogether');
|
|
291
|
+
},
|
|
292
|
+
set: function (value) {
|
|
293
|
+
this.setPropertyValue('keepLinesTogether', value);
|
|
294
|
+
},
|
|
295
|
+
enumerable: true,
|
|
296
|
+
configurable: true
|
|
297
|
+
});
|
|
298
|
+
Object.defineProperty(WParagraphFormat.prototype, "widowControl", {
|
|
299
|
+
get: function () {
|
|
300
|
+
return this.getPropertyValue('widowControl');
|
|
301
|
+
},
|
|
302
|
+
set: function (value) {
|
|
303
|
+
this.setPropertyValue('widowControl', value);
|
|
304
|
+
},
|
|
305
|
+
enumerable: true,
|
|
306
|
+
configurable: true
|
|
307
|
+
});
|
|
308
|
+
Object.defineProperty(WParagraphFormat.prototype, "outlineLevel", {
|
|
309
|
+
get: function () {
|
|
310
|
+
return this.getPropertyValue('outlineLevel');
|
|
311
|
+
},
|
|
312
|
+
set: function (value) {
|
|
313
|
+
this.setPropertyValue('outlineLevel', value);
|
|
314
|
+
},
|
|
315
|
+
enumerable: true,
|
|
316
|
+
configurable: true
|
|
317
|
+
});
|
|
318
|
+
Object.defineProperty(WParagraphFormat.prototype, "bidi", {
|
|
319
|
+
get: function () {
|
|
320
|
+
return this.getPropertyValue('bidi');
|
|
321
|
+
},
|
|
322
|
+
set: function (value) {
|
|
323
|
+
this.setPropertyValue('bidi', value);
|
|
324
|
+
},
|
|
325
|
+
enumerable: true,
|
|
326
|
+
configurable: true
|
|
327
|
+
});
|
|
328
|
+
Object.defineProperty(WParagraphFormat.prototype, "contextualSpacing", {
|
|
329
|
+
get: function () {
|
|
330
|
+
return this.getPropertyValue('contextualSpacing');
|
|
331
|
+
},
|
|
332
|
+
set: function (value) {
|
|
333
|
+
this.setPropertyValue('contextualSpacing', value);
|
|
334
|
+
},
|
|
335
|
+
enumerable: true,
|
|
336
|
+
configurable: true
|
|
337
|
+
});
|
|
338
|
+
WParagraphFormat.prototype.getListFormatParagraphFormat = function (property) {
|
|
339
|
+
var paragraphFormat = this.getListPargaraphFormat(property);
|
|
340
|
+
if (!isNullOrUndefined(paragraphFormat)) {
|
|
341
|
+
return paragraphFormat.uniqueParagraphFormat.propertiesHash.get(WUniqueFormat.getPropertyType(WParagraphFormat.uniqueFormatType, property));
|
|
342
|
+
}
|
|
343
|
+
return undefined;
|
|
344
|
+
};
|
|
345
|
+
/**
|
|
346
|
+
* @private
|
|
347
|
+
*/
|
|
348
|
+
WParagraphFormat.prototype.getListPargaraphFormat = function (property) {
|
|
349
|
+
if (this.listFormat.hasValue('listId') && this.listFormat.listId > -1 && this.listFormat.listLevelNumber > -1) {
|
|
350
|
+
var level = this.listFormat.listLevel;
|
|
351
|
+
var propertyType = WUniqueFormat.getPropertyType(WParagraphFormat.uniqueFormatType, property);
|
|
352
|
+
if (!isNullOrUndefined(level) && !isNullOrUndefined(level.paragraphFormat.uniqueParagraphFormat) &&
|
|
353
|
+
level.paragraphFormat.uniqueParagraphFormat.propertiesHash.containsKey(propertyType)) {
|
|
354
|
+
return level.paragraphFormat;
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
return undefined;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
else if (this.listFormat.hasValue('listId') && this.listFormat.listId === -1
|
|
361
|
+
&& (property === 'leftIndent' || property === 'firstLineIndent')) {
|
|
362
|
+
var paraFormat = new WParagraphFormat();
|
|
363
|
+
if (!this.hasValue('leftIndent')) {
|
|
364
|
+
paraFormat.leftIndent = 0;
|
|
365
|
+
}
|
|
366
|
+
if (!this.hasValue('firstLineIndent')) {
|
|
367
|
+
paraFormat.firstLineIndent = 0;
|
|
368
|
+
}
|
|
369
|
+
return paraFormat;
|
|
370
|
+
}
|
|
371
|
+
return undefined;
|
|
372
|
+
};
|
|
373
|
+
WParagraphFormat.prototype.getPropertyValue = function (property) {
|
|
374
|
+
if (!this.hasValue(property)) {
|
|
375
|
+
var formatInList = this.getListFormatParagraphFormat(property);
|
|
376
|
+
var hasInvalidListForIndent = this.listFormat.hasValue('listId') && this.listFormat.listId === -1
|
|
377
|
+
&& (property === 'leftIndent' || property === 'firstLineIndent');
|
|
378
|
+
if (this.baseStyle instanceof WParagraphStyle && !hasInvalidListForIndent) {
|
|
379
|
+
var currentFormat = this;
|
|
380
|
+
var baseStyle = this.baseStyle;
|
|
381
|
+
while (!isNullOrUndefined(baseStyle)) {
|
|
382
|
+
var listParaFormat = void 0;
|
|
383
|
+
if (!this.listFormat.hasValue('listId')) {
|
|
384
|
+
listParaFormat = baseStyle.paragraphFormat.getListPargaraphFormat(property);
|
|
385
|
+
}
|
|
386
|
+
if (baseStyle.paragraphFormat.hasValue(property)) {
|
|
387
|
+
currentFormat = baseStyle.paragraphFormat;
|
|
388
|
+
break;
|
|
389
|
+
}
|
|
390
|
+
else if (!isNullOrUndefined(listParaFormat) && listParaFormat.hasValue(property)) {
|
|
391
|
+
if (baseStyle.paragraphFormat.listFormat.listLevelNumber !== this.listFormat.listLevelNumber) {
|
|
392
|
+
var level = this.listFormat.listLevel;
|
|
393
|
+
var propertyType = WUniqueFormat.getPropertyType(WParagraphFormat.uniqueFormatType, property);
|
|
394
|
+
if (!isNullOrUndefined(level) && !isNullOrUndefined(level.paragraphFormat.uniqueParagraphFormat) &&
|
|
395
|
+
level.paragraphFormat.uniqueParagraphFormat.propertiesHash.containsKey(propertyType)) {
|
|
396
|
+
currentFormat = level.paragraphFormat;
|
|
397
|
+
break;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
currentFormat = listParaFormat;
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
baseStyle = baseStyle.basedOn;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (!isNullOrUndefined(baseStyle)) {
|
|
408
|
+
if (!isNullOrUndefined(formatInList) && this.listFormat.hasValue('listId')
|
|
409
|
+
&& currentFormat.listFormat.listId === -1 && currentFormat.listFormat.listLevelNumber <= 1
|
|
410
|
+
|| !isNullOrUndefined(formatInList) && this.listFormat.listId !== currentFormat.listFormat.listId
|
|
411
|
+
&& currentFormat.listFormat.listLevelNumber <= 1) {
|
|
412
|
+
return formatInList;
|
|
413
|
+
}
|
|
414
|
+
var propertyType = WUniqueFormat.getPropertyType(WParagraphFormat.uniqueFormatType, property);
|
|
415
|
+
return currentFormat.uniqueParagraphFormat.propertiesHash.get(propertyType);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (!isNullOrUndefined(formatInList)) {
|
|
419
|
+
return formatInList;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
var propertyType = WUniqueFormat.getPropertyType(WParagraphFormat.uniqueFormatType, property);
|
|
424
|
+
if (!isNullOrUndefined(this.uniqueParagraphFormat) && this.uniqueParagraphFormat.propertiesHash.containsKey(propertyType)) {
|
|
425
|
+
return this.uniqueParagraphFormat.propertiesHash.get(propertyType);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
return this.getDefaultValue(property);
|
|
429
|
+
};
|
|
430
|
+
WParagraphFormat.prototype.getDefaultValue = function (property) {
|
|
431
|
+
var propertyType = WUniqueFormat.getPropertyType(WParagraphFormat.uniqueFormatType, property);
|
|
432
|
+
var paragraphFormatInfo = this.getDocumentParagraphFormat();
|
|
433
|
+
var docParagraphFormat = paragraphFormatInfo.docParagraphFormat;
|
|
434
|
+
var editorFormat = paragraphFormatInfo.editorFormat;
|
|
435
|
+
if (isNullOrUndefined(docParagraphFormat) || isNullOrUndefined(docParagraphFormat.uniqueParagraphFormat)) {
|
|
436
|
+
return !isNullOrUndefined(editorFormat) && editorFormat.hasOwnProperty(property) ? editorFormat[property] : WParagraphFormat.getPropertyDefaultValue(property);
|
|
437
|
+
}
|
|
438
|
+
var ownerBase = this.ownerBase;
|
|
439
|
+
var isInsideBodyWidget = false;
|
|
440
|
+
if (ownerBase && ownerBase instanceof ParagraphWidget) {
|
|
441
|
+
var containerWidget = ownerBase.containerWidget;
|
|
442
|
+
isInsideBodyWidget = containerWidget instanceof BlockContainer || containerWidget instanceof TextFrame || containerWidget instanceof TableCellWidget;
|
|
443
|
+
}
|
|
444
|
+
// Check and return property value early
|
|
445
|
+
if (isInsideBodyWidget) {
|
|
446
|
+
var propValue = docParagraphFormat.uniqueParagraphFormat.propertiesHash.get(propertyType);
|
|
447
|
+
if (!isNullOrUndefined(propValue)) {
|
|
448
|
+
return propValue;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
return !isNullOrUndefined(editorFormat) && editorFormat.hasOwnProperty(property) ? editorFormat[property] : WParagraphFormat.getPropertyDefaultValue(property);
|
|
452
|
+
};
|
|
453
|
+
/**
|
|
454
|
+
* @private
|
|
455
|
+
*/
|
|
456
|
+
WParagraphFormat.prototype.getDocumentParagraphFormat = function () {
|
|
457
|
+
var docParagraphFormat = new WParagraphFormat();
|
|
458
|
+
var isPasteAction = false;
|
|
459
|
+
var editorFormat;
|
|
460
|
+
if (!isNullOrUndefined(this.ownerBase)) {
|
|
461
|
+
var documentHelper = this.getDocumentHelperObject();
|
|
462
|
+
if (!isNullOrUndefined(documentHelper)) {
|
|
463
|
+
docParagraphFormat = documentHelper.paragraphFormat;
|
|
464
|
+
if (!isNullOrUndefined(documentHelper) && documentHelper.isEditorModule) {
|
|
465
|
+
isPasteAction = documentHelper.editorProperties.isPaste;
|
|
466
|
+
editorFormat = documentHelper.editorParagraphFormat;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
docParagraphFormat: docParagraphFormat,
|
|
472
|
+
editorFormat: editorFormat,
|
|
473
|
+
isPaste: isPasteAction
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
/**
|
|
477
|
+
* @private
|
|
478
|
+
*/
|
|
479
|
+
WParagraphFormat.prototype.getDocumentHelperObject = function () {
|
|
480
|
+
var documentHelper;
|
|
481
|
+
if (this.ownerBase instanceof ParagraphWidget) {
|
|
482
|
+
var bodyWidget = this.ownerBase.bodyWidget;
|
|
483
|
+
if (!isNullOrUndefined(bodyWidget) && !isNullOrUndefined(bodyWidget.page) && !isNullOrUndefined(bodyWidget.page.documentHelper)) {
|
|
484
|
+
documentHelper = bodyWidget.page.documentHelper;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
return documentHelper;
|
|
488
|
+
};
|
|
489
|
+
WParagraphFormat.prototype.setPropertyValue = function (property, value, clearProperty) {
|
|
490
|
+
if (isNullOrUndefined(value) || value === '' && !clearProperty) {
|
|
491
|
+
value = WParagraphFormat.getPropertyDefaultValue(property);
|
|
492
|
+
}
|
|
493
|
+
if (isNullOrUndefined(this.uniqueParagraphFormat)
|
|
494
|
+
|| (isNullOrUndefined(this.uniqueParagraphFormat.propertiesHash)
|
|
495
|
+
&& isNullOrUndefined(this.uniqueParagraphFormat.uniqueFormatType)
|
|
496
|
+
&& isNullOrUndefined(this.uniqueParagraphFormat.referenceCount))) {
|
|
497
|
+
this.initializeUniqueParagraphFormat(property, value);
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
var propertyType = WUniqueFormat.getPropertyType(this.uniqueParagraphFormat.uniqueFormatType, property);
|
|
501
|
+
if (this.uniqueParagraphFormat.propertiesHash.containsKey(propertyType) &&
|
|
502
|
+
this.uniqueParagraphFormat.propertiesHash.get(propertyType) === value) {
|
|
503
|
+
//Do nothing, since no change in property value and return
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
506
|
+
this.uniqueParagraphFormat = WParagraphFormat.uniqueParagraphFormats.updateUniqueFormat(this.uniqueParagraphFormat, property, value);
|
|
507
|
+
}
|
|
508
|
+
};
|
|
509
|
+
WParagraphFormat.prototype.initializeUniqueParagraphFormat = function (property, propValue) {
|
|
510
|
+
var uniqueParaFormatTemp = new Dictionary();
|
|
511
|
+
this.addUniqueParaFormat('leftIndent', property, propValue, uniqueParaFormatTemp);
|
|
512
|
+
this.addUniqueParaFormat('rightIndent', property, propValue, uniqueParaFormatTemp);
|
|
513
|
+
this.addUniqueParaFormat('firstLineIndent', property, propValue, uniqueParaFormatTemp);
|
|
514
|
+
this.addUniqueParaFormat('textAlignment', property, propValue, uniqueParaFormatTemp);
|
|
515
|
+
this.addUniqueParaFormat('beforeSpacing', property, propValue, uniqueParaFormatTemp);
|
|
516
|
+
this.addUniqueParaFormat('afterSpacing', property, propValue, uniqueParaFormatTemp);
|
|
517
|
+
this.addUniqueParaFormat('spaceBeforeAuto', property, propValue, uniqueParaFormatTemp);
|
|
518
|
+
this.addUniqueParaFormat('spaceAfterAuto', property, propValue, uniqueParaFormatTemp);
|
|
519
|
+
this.addUniqueParaFormat('lineSpacing', property, propValue, uniqueParaFormatTemp);
|
|
520
|
+
this.addUniqueParaFormat('lineSpacingType', property, propValue, uniqueParaFormatTemp);
|
|
521
|
+
this.addUniqueParaFormat('outlineLevel', property, propValue, uniqueParaFormatTemp);
|
|
522
|
+
this.addUniqueParaFormat('bidi', property, propValue, uniqueParaFormatTemp);
|
|
523
|
+
this.addUniqueParaFormat('contextualSpacing', property, propValue, uniqueParaFormatTemp);
|
|
524
|
+
this.addUniqueParaFormat('keepWithNext', property, propValue, uniqueParaFormatTemp);
|
|
525
|
+
this.addUniqueParaFormat('keepLinesTogether', property, propValue, uniqueParaFormatTemp);
|
|
526
|
+
this.addUniqueParaFormat('widowControl', property, propValue, uniqueParaFormatTemp);
|
|
527
|
+
this.uniqueParagraphFormat = WParagraphFormat.uniqueParagraphFormats.addUniqueFormat(uniqueParaFormatTemp, WParagraphFormat.uniqueFormatType);
|
|
528
|
+
};
|
|
529
|
+
WParagraphFormat.prototype.addUniqueParaFormat = function (property, modifiedProperty, propValue, uniqueParaFormatTemp) {
|
|
530
|
+
var propertyType = WUniqueFormat.getPropertyType(WParagraphFormat.uniqueFormatType, property);
|
|
531
|
+
if (property === modifiedProperty) {
|
|
532
|
+
uniqueParaFormatTemp.add(propertyType, propValue);
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
WParagraphFormat.getPropertyDefaultValue = function (property) {
|
|
536
|
+
var value = undefined;
|
|
537
|
+
switch (property) {
|
|
538
|
+
case 'leftIndent':
|
|
539
|
+
value = 0;
|
|
540
|
+
break;
|
|
541
|
+
case 'rightIndent':
|
|
542
|
+
value = 0;
|
|
543
|
+
break;
|
|
544
|
+
case 'firstLineIndent':
|
|
545
|
+
value = 0;
|
|
546
|
+
break;
|
|
547
|
+
case 'textAlignment':
|
|
548
|
+
value = 'Left';
|
|
549
|
+
break;
|
|
550
|
+
case 'beforeSpacing':
|
|
551
|
+
value = 0;
|
|
552
|
+
break;
|
|
553
|
+
case 'afterSpacing':
|
|
554
|
+
value = 0;
|
|
555
|
+
break;
|
|
556
|
+
case 'spaceBeforeAuto':
|
|
557
|
+
value = false;
|
|
558
|
+
break;
|
|
559
|
+
case 'spaceAfterAuto':
|
|
560
|
+
value = false;
|
|
561
|
+
break;
|
|
562
|
+
case 'lineSpacing':
|
|
563
|
+
value = 1;
|
|
564
|
+
break;
|
|
565
|
+
case 'lineSpacingType':
|
|
566
|
+
value = 'Multiple';
|
|
567
|
+
break;
|
|
568
|
+
case 'styleName':
|
|
569
|
+
value = 'Normal';
|
|
570
|
+
break;
|
|
571
|
+
case 'outlineLevel':
|
|
572
|
+
value = 'BodyText';
|
|
573
|
+
break;
|
|
574
|
+
case 'bidi':
|
|
575
|
+
value = false;
|
|
576
|
+
break;
|
|
577
|
+
case 'contextualSpacing':
|
|
578
|
+
value = false;
|
|
579
|
+
break;
|
|
580
|
+
case 'keepWithNext':
|
|
581
|
+
value = false;
|
|
582
|
+
break;
|
|
583
|
+
case 'keepLinesTogether':
|
|
584
|
+
value = false;
|
|
585
|
+
break;
|
|
586
|
+
case 'widowControl':
|
|
587
|
+
value = true;
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
return value;
|
|
591
|
+
};
|
|
592
|
+
WParagraphFormat.prototype.clearIndent = function () {
|
|
593
|
+
this.clearPropertyValue('leftIndent');
|
|
594
|
+
this.clearPropertyValue('firstLineIndent');
|
|
595
|
+
};
|
|
596
|
+
WParagraphFormat.prototype.clearPropertyValue = function (property) {
|
|
597
|
+
this.setPropertyValue(property, undefined, true);
|
|
598
|
+
if (!isNullOrUndefined(this.uniqueParagraphFormat)) {
|
|
599
|
+
var key = WUniqueFormat.getPropertyType(this.uniqueParagraphFormat.uniqueFormatType, property);
|
|
600
|
+
var currentUniqueParagraphFormat = new WUniqueFormat(this.uniqueParagraphFormat.uniqueFormatType);
|
|
601
|
+
var value = WParagraphFormat.getPropertyDefaultValue(property);
|
|
602
|
+
currentUniqueParagraphFormat.cloneItems(this.uniqueParagraphFormat, property, value, this.uniqueParagraphFormat.uniqueFormatType);
|
|
603
|
+
if (currentUniqueParagraphFormat.propertiesHash.containsKey(key)) {
|
|
604
|
+
currentUniqueParagraphFormat.propertiesHash.remove(key);
|
|
605
|
+
}
|
|
606
|
+
this.uniqueParagraphFormat = currentUniqueParagraphFormat;
|
|
607
|
+
}
|
|
608
|
+
};
|
|
609
|
+
WParagraphFormat.prototype.clearFormat = function () {
|
|
610
|
+
if (!isNullOrUndefined(this.listFormat)) {
|
|
611
|
+
this.listFormat.clearFormat();
|
|
612
|
+
}
|
|
613
|
+
if (!isNullOrUndefined(this.borders)) {
|
|
614
|
+
this.borders.clearFormat();
|
|
615
|
+
}
|
|
616
|
+
if (!isNullOrUndefined(this.uniqueParagraphFormat) && this.uniqueParagraphFormat.referenceCount === 0) {
|
|
617
|
+
WParagraphFormat.uniqueParagraphFormats.remove(this.uniqueParagraphFormat);
|
|
618
|
+
}
|
|
619
|
+
this.uniqueParagraphFormat = undefined;
|
|
620
|
+
if (!isNullOrUndefined(this.getDocumentHelperObject())) {
|
|
621
|
+
this.baseStyle = this.getDocumentHelperObject().styles.findByName('Normal');
|
|
622
|
+
}
|
|
623
|
+
};
|
|
624
|
+
WParagraphFormat.prototype.destroy = function () {
|
|
625
|
+
if (!isNullOrUndefined(this.uniqueParagraphFormat)) {
|
|
626
|
+
WParagraphFormat.uniqueParagraphFormats.remove(this.uniqueParagraphFormat);
|
|
627
|
+
}
|
|
628
|
+
this.uniqueParagraphFormat = undefined;
|
|
629
|
+
if (!isNullOrUndefined(this.listFormat)) {
|
|
630
|
+
this.listFormat.destroy();
|
|
631
|
+
}
|
|
632
|
+
this.listFormat = undefined;
|
|
633
|
+
if (this.tabs && this.tabs.length > 0) {
|
|
634
|
+
for (var i = 0; i < this.tabs.length; i++) {
|
|
635
|
+
this.tabs[i].destroy();
|
|
636
|
+
}
|
|
637
|
+
this.tabs = [];
|
|
638
|
+
this.tabs = undefined;
|
|
639
|
+
}
|
|
640
|
+
if (!isNullOrUndefined(this.borders)) {
|
|
641
|
+
this.borders.destroy();
|
|
642
|
+
}
|
|
643
|
+
this.borders = undefined;
|
|
644
|
+
this.baseStyle = undefined;
|
|
645
|
+
this.ownerBase = undefined;
|
|
646
|
+
};
|
|
647
|
+
WParagraphFormat.prototype.copyFormat = function (format) {
|
|
648
|
+
if (!isNullOrUndefined(format)) {
|
|
649
|
+
if (!isNullOrUndefined(format.uniqueParagraphFormat)) {
|
|
650
|
+
this.updateUniqueParagraphFormat(format);
|
|
651
|
+
}
|
|
652
|
+
if (!isNullOrUndefined(format.borders)) {
|
|
653
|
+
if (isNullOrUndefined(this.borders)) {
|
|
654
|
+
this.borders = new WBorders(this);
|
|
655
|
+
}
|
|
656
|
+
this.borders.copyFormat(format.borders);
|
|
657
|
+
}
|
|
658
|
+
if (!isNullOrUndefined(format.listFormat)) {
|
|
659
|
+
if (isNullOrUndefined(this.listFormat)) {
|
|
660
|
+
this.listFormat = new WListFormat(this);
|
|
661
|
+
}
|
|
662
|
+
this.listFormat.copyFormat(format.listFormat);
|
|
663
|
+
}
|
|
664
|
+
if (!isNullOrUndefined(format.baseStyle)) {
|
|
665
|
+
this.baseStyle = format.baseStyle;
|
|
666
|
+
}
|
|
667
|
+
if (!isNullOrUndefined(format.tabs)) {
|
|
668
|
+
for (var i = 0; i < format.tabs.length; i++) {
|
|
669
|
+
this.tabs[i] = format.tabs[i];
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
};
|
|
674
|
+
WParagraphFormat.prototype.updateUniqueParagraphFormat = function (format) {
|
|
675
|
+
var hash = undefined;
|
|
676
|
+
if (this.uniqueParagraphFormat) {
|
|
677
|
+
hash = this.uniqueParagraphFormat.mergeProperties(format.uniqueParagraphFormat);
|
|
678
|
+
if (this.uniqueParagraphFormat.referenceCount === 0) {
|
|
679
|
+
WParagraphFormat.uniqueParagraphFormats.remove(this.uniqueParagraphFormat);
|
|
680
|
+
this.uniqueParagraphFormat = undefined;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
this.uniqueParagraphFormat = new WUniqueFormat(WParagraphFormat.uniqueFormatType);
|
|
684
|
+
if (isNullOrUndefined(hash)) {
|
|
685
|
+
hash = this.uniqueParagraphFormat.mergeProperties(format.uniqueParagraphFormat);
|
|
686
|
+
}
|
|
687
|
+
this.uniqueParagraphFormat = WParagraphFormat.uniqueParagraphFormats.addUniqueFormat(hash, WParagraphFormat.uniqueFormatType);
|
|
688
|
+
};
|
|
689
|
+
WParagraphFormat.prototype.cloneFormat = function () {
|
|
690
|
+
var format = new WParagraphFormat(undefined);
|
|
691
|
+
format.uniqueParagraphFormat = this.uniqueParagraphFormat;
|
|
692
|
+
format.baseStyle = this.baseStyle;
|
|
693
|
+
if (isNullOrUndefined(this.listFormat)) {
|
|
694
|
+
format.listFormat = undefined;
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
format.listFormat = this.listFormat.cloneListFormat();
|
|
698
|
+
format.listFormat.ownerBase = format;
|
|
699
|
+
}
|
|
700
|
+
format.borders = isNullOrUndefined(this.borders) ? undefined : this.borders.cloneFormat();
|
|
701
|
+
if (!isNullOrUndefined(this.tabs) && this.tabs.length > 0) {
|
|
702
|
+
format.tabs = [];
|
|
703
|
+
for (var i = 0; i < this.tabs.length; i++) {
|
|
704
|
+
format.tabs.push(this.tabs[i].clone());
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return format;
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
*
|
|
711
|
+
* @private
|
|
712
|
+
*/
|
|
713
|
+
WParagraphFormat.prototype.hasValue = function (property) {
|
|
714
|
+
if (!isNullOrUndefined(this.uniqueParagraphFormat) && !isNullOrUndefined(this.uniqueParagraphFormat.propertiesHash)) {
|
|
715
|
+
var propertyType = WUniqueFormat.getPropertyType(this.uniqueParagraphFormat.uniqueFormatType, property);
|
|
716
|
+
return this.uniqueParagraphFormat.propertiesHash.containsKey(propertyType);
|
|
717
|
+
}
|
|
718
|
+
return false;
|
|
719
|
+
};
|
|
720
|
+
WParagraphFormat.clear = function () {
|
|
721
|
+
this.uniqueParagraphFormats.clear();
|
|
722
|
+
};
|
|
723
|
+
WParagraphFormat.prototype.applyStyle = function (baseStyle) {
|
|
724
|
+
this.baseStyle = baseStyle;
|
|
725
|
+
this.listFormat.applyStyle(this.baseStyle);
|
|
726
|
+
};
|
|
727
|
+
WParagraphFormat.prototype.getValue = function (property) {
|
|
728
|
+
return this.hasValue(property) ? this.getPropertyValue(property) : undefined;
|
|
729
|
+
};
|
|
730
|
+
//This method logic is not correct for changing the style dialog. Instead of this created assign format method and used it..
|
|
731
|
+
// public mergeFormat(format: WParagraphFormat, isStyle?: boolean): void {
|
|
732
|
+
// isStyle = isNullOrUndefined(isStyle) ? false : isStyle;
|
|
733
|
+
// if (isNullOrUndefined(this.getValue('leftIndent'))) {
|
|
734
|
+
// this.leftIndent = format.getValue('leftIndent') as number;
|
|
735
|
+
// }
|
|
736
|
+
// if (isNullOrUndefined(this.getValue('rightIndent'))) {
|
|
737
|
+
// this.rightIndent = format.getValue('rightIndent') as number;
|
|
738
|
+
// }
|
|
739
|
+
// if (isNullOrUndefined(this.getValue('firstLineIndent'))) {
|
|
740
|
+
// this.firstLineIndent = format.getValue('firstLineIndent') as number;
|
|
741
|
+
// }
|
|
742
|
+
// if (isNullOrUndefined(this.getValue('beforeSpacing'))) {
|
|
743
|
+
// this.beforeSpacing = format.getValue('beforeSpacing') as number;
|
|
744
|
+
// }
|
|
745
|
+
// if (isNullOrUndefined(this.getValue('afterSpacing'))) {
|
|
746
|
+
// this.afterSpacing = format.getValue('afterSpacing') as number;
|
|
747
|
+
// }
|
|
748
|
+
// if (isNullOrUndefined(this.getValue('spaceBeforeAuto'))) {
|
|
749
|
+
// this.spaceBeforeAuto = format.getValue('spaceBeforeAuto') as boolean;
|
|
750
|
+
// }
|
|
751
|
+
// if (isNullOrUndefined(this.getValue('spaceAfterAuto'))) {
|
|
752
|
+
// this.spaceAfterAuto = format.getValue('spaceAfterAuto') as boolean;
|
|
753
|
+
// }
|
|
754
|
+
// if (isNullOrUndefined(this.getValue('lineSpacing'))) {
|
|
755
|
+
// this.lineSpacing = format.getValue('lineSpacing') as number;
|
|
756
|
+
// }
|
|
757
|
+
// if (isNullOrUndefined(this.getValue('lineSpacingType'))) {
|
|
758
|
+
// this.lineSpacingType = format.getValue('lineSpacingType') as LineSpacingType;
|
|
759
|
+
// }
|
|
760
|
+
// if (isNullOrUndefined(this.getValue('textAlignment'))) {
|
|
761
|
+
// this.textAlignment = format.getValue('textAlignment') as TextAlignment;
|
|
762
|
+
// }
|
|
763
|
+
// if (isNullOrUndefined(this.getValue('outlineLevel'))) {
|
|
764
|
+
// this.outlineLevel = format.getValue('outlineLevel') as OutlineLevel;
|
|
765
|
+
// }
|
|
766
|
+
// if (!isStyle && isNullOrUndefined(this.getValue('bidi'))) {
|
|
767
|
+
// this.bidi = format.getValue('bidi') as boolean;
|
|
768
|
+
// }
|
|
769
|
+
// if (isNullOrUndefined(this.getValue('contextualSpacing'))) {
|
|
770
|
+
// this.contextualSpacing = format.getValue('contextualSpacing') as boolean;
|
|
771
|
+
// }
|
|
772
|
+
// if (isNullOrUndefined(this.getValue('keepWithNext'))) {
|
|
773
|
+
// this.keepWithNext = format.getValue('keepWithNext') as boolean;
|
|
774
|
+
// }
|
|
775
|
+
// if (isNullOrUndefined(this.getValue('keepLinesTogether'))) {
|
|
776
|
+
// this.keepLinesTogether = format.getValue('keepLinesTogether') as boolean;
|
|
777
|
+
// }
|
|
778
|
+
// if (isNullOrUndefined(this.getValue('widowControl'))) {
|
|
779
|
+
// this.widowControl = format.getValue('widowControl') as boolean;
|
|
780
|
+
// }
|
|
781
|
+
// if (isNullOrUndefined(this.listFormat)) {
|
|
782
|
+
// this.listFormat.mergeFormat(format.listFormat);
|
|
783
|
+
// }
|
|
784
|
+
// }
|
|
785
|
+
/**
|
|
786
|
+
* Assinging the value for style dialog
|
|
787
|
+
* @private
|
|
788
|
+
* @returns {void}
|
|
789
|
+
*/
|
|
790
|
+
WParagraphFormat.prototype.assignFormat = function (format, isStyle) {
|
|
791
|
+
isStyle = isNullOrUndefined(isStyle) ? false : isStyle;
|
|
792
|
+
if (format.hasValue('leftIndent')) {
|
|
793
|
+
this.leftIndent = format.getValue('leftIndent');
|
|
794
|
+
}
|
|
795
|
+
if (format.hasValue('rightIndent')) {
|
|
796
|
+
this.rightIndent = format.getValue('rightIndent');
|
|
797
|
+
}
|
|
798
|
+
if (format.hasValue('firstLineIndent')) {
|
|
799
|
+
this.firstLineIndent = format.getValue('firstLineIndent');
|
|
800
|
+
}
|
|
801
|
+
if (format.hasValue('beforeSpacing')) {
|
|
802
|
+
this.beforeSpacing = format.getValue('beforeSpacing');
|
|
803
|
+
}
|
|
804
|
+
if (format.hasValue('afterSpacing')) {
|
|
805
|
+
this.afterSpacing = format.getValue('afterSpacing');
|
|
806
|
+
}
|
|
807
|
+
if (format.hasValue('spaceBeforeAuto')) {
|
|
808
|
+
this.spaceBeforeAuto = format.getValue('spaceBeforeAuto');
|
|
809
|
+
}
|
|
810
|
+
if (format.hasValue('spaceAfterAuto')) {
|
|
811
|
+
this.spaceAfterAuto = format.getValue('spaceAfterAuto');
|
|
812
|
+
}
|
|
813
|
+
if (format.hasValue('lineSpacing')) {
|
|
814
|
+
this.lineSpacing = format.getValue('lineSpacing');
|
|
815
|
+
}
|
|
816
|
+
if (format.hasValue('lineSpacingType')) {
|
|
817
|
+
this.lineSpacingType = format.getValue('lineSpacingType');
|
|
818
|
+
}
|
|
819
|
+
if (format.hasValue('textAlignment')) {
|
|
820
|
+
this.textAlignment = format.getValue('textAlignment');
|
|
821
|
+
}
|
|
822
|
+
if (format.hasValue('outlineLevel')) {
|
|
823
|
+
this.outlineLevel = format.getValue('outlineLevel');
|
|
824
|
+
}
|
|
825
|
+
if (!isStyle && format.hasValue('bidi')) {
|
|
826
|
+
this.bidi = format.getValue('bidi');
|
|
827
|
+
}
|
|
828
|
+
if (format.hasValue('contextualSpacing')) {
|
|
829
|
+
this.contextualSpacing = format.getValue('contextualSpacing');
|
|
830
|
+
}
|
|
831
|
+
if (format.hasValue('keepWithNext')) {
|
|
832
|
+
this.keepWithNext = format.getValue('keepWithNext');
|
|
833
|
+
}
|
|
834
|
+
if (format.hasValue('keepLinesTogether')) {
|
|
835
|
+
this.keepLinesTogether = format.getValue('keepLinesTogether');
|
|
836
|
+
}
|
|
837
|
+
if (format.hasValue('widowControl')) {
|
|
838
|
+
this.widowControl = format.getValue('widowControl');
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
/**
|
|
842
|
+
* Returns true if both paragraph formats are equal
|
|
843
|
+
* @private
|
|
844
|
+
* @returns {boolean}
|
|
845
|
+
*/
|
|
846
|
+
WParagraphFormat.prototype.isSameFormat = function (format) {
|
|
847
|
+
return this.baseStyle === format.baseStyle &&
|
|
848
|
+
this.uniqueParagraphFormat === format.uniqueParagraphFormat;
|
|
849
|
+
};
|
|
850
|
+
WParagraphFormat.uniqueParagraphFormats = new WUniqueFormats();
|
|
851
|
+
WParagraphFormat.uniqueFormatType = 3;
|
|
852
|
+
return WParagraphFormat;
|
|
853
|
+
}());
|
|
854
|
+
export { WParagraphFormat };
|