@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,4569 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { isNullOrUndefined } from '@syncfusion/ej2-base';
|
|
3
|
+
import { WList } from '../list/list';
|
|
4
|
+
import { WListLevel } from '../list/list-level';
|
|
5
|
+
import { WAbstractList } from '../list/abstract-list';
|
|
6
|
+
import { WLevelOverride } from '../list/level-override';
|
|
7
|
+
import { WCharacterFormat } from '../format/character-format';
|
|
8
|
+
import { WListFormat } from '../format/list-format';
|
|
9
|
+
import { WParagraphFormat } from '../format/paragraph-format';
|
|
10
|
+
import { WCellFormat } from '../format/cell-format';
|
|
11
|
+
import { WSectionFormat, WColumnFormat } from '../format/section-format';
|
|
12
|
+
import { WRowFormat } from '../format/row-format';
|
|
13
|
+
import { WCharacterStyle, WParagraphStyle, WTableStyle } from '../format/style';
|
|
14
|
+
import { WTabStop } from '../format/paragraph-format';
|
|
15
|
+
import { LineWidget, ParagraphWidget, ImageElementBox, BodyWidget, TextElementBox, TableCellWidget, TableRowWidget, TableWidget, FieldElementBox, HeaderFooterWidget, BookmarkElementBox, FieldTextElementBox, TabElementBox, EditRangeStartElementBox, EditRangeEndElementBox, ChartElementBox, ChartDataFormat, ChartCategory, ChartData, ChartSeries, ChartDataLabels, ChartTrendLines, ChartSeriesFormat, ElementBox, CommentCharacterElementBox, CommentElementBox, TextFormField, CheckBoxFormField, DropDownFormField, ShapeElementBox, LineFormat, TextFrame, ContentControlProperties, ContentControlListItems, ContentControl, CheckBoxState, XmlMapping, CustomXmlPart, Footnote, FootnoteElementBox, FillFormat, TablePosition, BreakElementBox, FootnoteEndnoteMarkerElementBox, GroupShapeElementBox } from '../page';
|
|
16
|
+
import { LayoutHelperMethods } from '../helper/layout-helper-methods';
|
|
17
|
+
import { Dictionary } from '../base/dictionary';
|
|
18
|
+
import { FontSchemeStruct } from '../themes/index';
|
|
19
|
+
import { sectionsProperty, hiddenProperty, specVanishProperty, isKernFontProperty, kernProperty, imagesProperty, paraStyleNameProperty, fontSubstitutionTableProperty, characterFormatProperty, paragraphFormatProperty, listsProperty, abstractListsProperty, backgroundProperty, stylesProperty, commentsProperty, revisionsProperty, customXmlProperty, defaultTabWidthProperty, formattingProperty, trackChangesProperty, protectionTypeProperty, enforcementProperty, hashValueProperty, saltValueProperty, cryptAlgorithmClassProperty, cryptAlgorithmTypeProperty, cryptAlgorithmSidProperty, doNotUseHTMLParagraphAutoSpacingProperty, alignTablesRowByRowProperty, formFieldShadingProperty, lastParagraphMarkCopiedProperty, footnotesProperty, endnotesProperty, compatibilityModeProperty, themeFontLanguagesProperty, themesProperty, nameProperty, basedOnProperty, nextProperty, linkProperty, localeIdProperty, localeIdFarEastProperty, localeIdBidiProperty, boldProperty, italicProperty, underlineProperty, fontHintTypeProperty, baselineAlignmentProperty, strikethroughProperty, highlightColorProperty, fontSizeProperty, fontColorProperty, fontFamilyProperty, styleNameProperty, bidiProperty, bdoProperty, fontSizeBidiProperty, fontFamilyBidiProperty, boldBidiProperty, italicBidiProperty, allCapsProperty, complexScriptProperty, fontFamilyAsciiProperty, fontFamilyFarEastProperty, fontFamilyNonFarEastProperty, revisionIdsProperty, listIdProperty, listLevelNumberProperty, leftIndentProperty, rightIndentProperty, firstLineIndentProperty, textAlignmentProperty, afterSpacingProperty, beforeSpacingProperty, spaceAfterAutoProperty, spaceBeforeAutoProperty, lineSpacingProperty, lineSpacingTypeProperty, listFormatProperty, keepWithNextProperty, widowControlProperty, keepLinesTogetherProperty, outlineLevelProperty, contextualSpacingProperty, bordersProperty, tabsProperty, headerDistanceProperty, footerDistanceProperty, differentFirstPageProperty, differentOddAndEvenPagesProperty, pageWidthProperty, pageHeightProperty, leftMarginProperty, rightMarginProperty, topMarginProperty, bottomMarginProperty, restartPageNumberingProperty, pageStartingNumberProperty, endnoteNumberFormatProperty, footNoteNumberFormatProperty, restartIndexForFootnotesProperty, restartIndexForEndnotesProperty, initialFootNoteNumberProperty, initialEndNoteNumberProperty, pageNumberStyleProperty, columnsProperty, numberOfColumnsProperty, equalWidthProperty, lineBetweenColumnsProperty, breakCodeProperty, cellWidthProperty, columnSpanProperty, rowSpanProperty, verticalAlignmentProperty, allowBreakAcrossPagesProperty, isHeaderProperty, heightTypeProperty, gridBeforeProperty, gridBeforeWidthProperty, gridBeforeWidthTypeProperty, gridAfterProperty, gridAfterWidthProperty, gridAfterWidthTypeProperty, allowAutoFitProperty, cellSpacingProperty, shadingProperty, tableAlignmentProperty, preferredWidthProperty, preferredWidthTypeProperty, horizontalPositionAbsProperty, textureProperty, backgroundColorProperty, foregroundColorProperty, shadowProperty, hasNoneStyleProperty, verticalProperty, horizontalProperty, diagonalUpProperty, diagonalDownProperty, lineStyleProperty, lineWidthProperty, layoutProperty, dataFormatProperty, yValueProperty, chartDataProperty, categoryXNameProperty, lineProperty, foreColorProperty, layoutXProperty, layoutYProperty, directionProperty, endStyleProperty, numberValueProperty, markerStyleProperty, markerColorProperty, markerSizeProperty, forwardProperty, backwardProperty, interceptProperty, isDisplayRSquaredProperty, isDisplayEquationProperty, seriesNameProperty, dataLabelProperty, errorBarProperty, seriesFormatProperty, trendLinesProperty, dataPointsProperty, firstSliceAngleProperty, holeSizeProperty, isLegendKeyProperty, isBubbleSizeProperty, isCategoryNameProperty, isSeriesNameProperty, isValueProperty, isPercentageProperty, isLeaderLinesProperty, showSeriesKeysProperty, hasHorizontalBorderProperty, hasVerticalBorderProperty, hasBordersProperty, categoryTypeProperty, chartCategoryProperty, chartSeriesProperty, chartAreaProperty, chartTitleAreaProperty, plotAreaProperty, chartLegendProperty, chartPrimaryCategoryAxisProperty, chartPrimaryValueAxisProperty, chartTitleProperty, chartTypeProperty, gapWidthProperty, overlapProperty, chartDataTableProperty, textProperty, shapeIdProperty, alternativeTextProperty, visibleProperty, widthProperty, heightProperty, widthScaleProperty, heightScaleProperty, lineFormatProperty, fillFormatProperty, textWrappingStyleProperty, textWrappingTypeProperty, verticalRelativePercentProperty, horizontalRelativePercentProperty, heightRelativePercentProperty, widthRelativePercentProperty, zOrderPositionProperty, layoutInCellProperty, lockAnchorProperty, autoShapeTypeProperty, textFrameProperty, colorProperty, fillProperty, textVerticalAlignmentProperty, imageStringProperty, metaFileImageStringProperty, isInlineImageProperty, isMetaFileProperty, topProperty, bottomProperty, rightProperty, leftProperty, getImageHeightProperty, getImageWidthProperty, hasFieldEndProperty, formFieldDataProperty, fieldTypeProperty, enabledProperty, helpTextProperty, statusTextProperty, textInputProperty, checkBoxProperty, dropDownListProperty, maxLengthProperty, defaultValueProperty, formatProperty, sizeTypeProperty, sizeProperty, checkedProperty, dropDownItemsProperty, selectedIndexProperty, commentIdProperty, commentCharacterTypeProperty, authorProperty, initialProperty, dateProperty, doneProperty, replyCommentsProperty, revisionTypeProperty, revisionIdProperty, itemIDProperty, xmlProperty, footnoteTypeProperty, symbolCodeProperty, symbolFontNameProperty, customMarkerProperty, inlinesProperty, contentControlPropertiesProperty, lockContentControlProperty, lockContentsProperty, tagProperty, titleProperty, hasPlaceHolderTextProperty, multiLineProperty, isTemporaryProperty, dateCalendarTypeProperty, dateStorageFormatProperty, dateDisplayLocaleProperty, dateDisplayFormatProperty, isCheckedProperty, uncheckedStateProperty, checkedStateProperty, contentControlListItemsProperty, xmlMappingProperty, fontProperty, valueProperty, displayTextProperty, isMappedProperty, isWordMlProperty, prefixMappingProperty, xPathProperty, storeItemIdProperty, customXmlPartProperty, idProperty, cellFormatProperty, rowFormatProperty, cellsProperty, rowsProperty, descriptionProperty, wrapTextAroundProperty, positioningProperty, tableFormatProperty, allowOverlapProperty, distanceTopProperty, distanceRightProperty, distanceLeftProperty, distanceBottomProperty, verticalOriginProperty, verticalPositionProperty, horizontalOriginProperty, horizontalAlignmentProperty, horizontalPositionProperty, blocksProperty, headerProperty, footerProperty, evenHeaderProperty, evenFooterProperty, firstPageHeaderProperty, firstPageFooterProperty, headersFootersProperty, sectionFormatProperty, listLevelPatternProperty, followCharacterProperty, startAtProperty, restartLevelProperty, levelNumberProperty, numberFormatProperty, abstractListIdProperty, levelsProperty, overrideListLevelProperty, levelOverridesProperty, separatorProperty, continuationSeparatorProperty, continuationNoticeProperty, bookmarkTypeProperty, propertiesProperty, tabJustificationProperty, positionProperty, deletePositionProperty, tabLeaderProperty, editRangeIdProperty, columnFirstProperty, columnLastProperty, userProperty, groupProperty, editableRangeStartProperty, spaceProperty, fontSchemeProperty, fontSchemeNameProperty, majorFontSchemeProperty, minorFontSchemeProperty, fontSchemeListProperty, fontTypefaceProperty, typefaceProperty, panoseProperty, typeProperty, majorUnitProperty, maximumValueProperty, minimumValueProperty, hasMajorGridLinesProperty, hasMinorGridLinesProperty, majorTickMarkProperty, minorTickMarkProperty, tickLabelPositionProperty, rgbProperty, appearanceProperty, lineFormatTypeProperty, allowSpaceOfSameStyleInTableProperty, weightProperty, inlineFormatProperty, fontNameProperty, isCompressedProperty, columnIndexProperty, isAfterParagraphMarkProperty, isAfterRowMarkProperty, isAfterCellMarkProperty, isAfterTableMarkProperty, belowTextProperty, breakClearTypeProperty, characterSpacingProperty, scalingProperty, nsidProperty, incrementalOps, isLegalStyleNumberingProperty, horizontalRuleProperty, isAutoMajorProperty, underlineColorProperty, editingPointsProperty, childShapeProperty, offsetXValue, offsetYValue, extentXValue, extentYValue, customDataProperty, hasImageReferenceProperty, ligatureProperty, verticallyMergedCellsKeepWithNext, verticallyMergedCellsLeftMarginProperty, verticallyMergedCellsRightMarginProperty, verticallyMergedCellsTopMarginProperty, verticallyMergedCellsBottomMarginProperty, is2007Shape, coordinateXOrigin, coordinateYOrigin, coordinateSize, isDefaultFillProperty, fillTypeProperty, lineFromXPosition, lineFromYPosition, lineToXPosition, lineToYPosition, authorNameProperty, revDateTimeProperty, isInsertRevisionProperty, isDeleteRevisionProperty, cellContentControlProperty, numberAlignmentProperty } from '../base/index';
|
|
20
|
+
import { DocxRevision, RevisionHelperMethods } from '../helper/revision-helper-methods';
|
|
21
|
+
import { ChartComponent } from '@syncfusion/ej2-office-chart';
|
|
22
|
+
/**
|
|
23
|
+
* @private
|
|
24
|
+
*/
|
|
25
|
+
var SfdtReader = /** @class */ (function () {
|
|
26
|
+
function SfdtReader(documentHelper) {
|
|
27
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
28
|
+
this.documentHelper = undefined;
|
|
29
|
+
/**
|
|
30
|
+
* @private
|
|
31
|
+
*/
|
|
32
|
+
this.commentStarts = undefined;
|
|
33
|
+
/**
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
this.commentEnds = undefined;
|
|
37
|
+
/**
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
this.commentsCollection = undefined;
|
|
41
|
+
/**
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
this.revisionCollection = undefined;
|
|
45
|
+
this.isPageBreakInsideTable = false;
|
|
46
|
+
this.isParseHeader = false;
|
|
47
|
+
this.footnotes = undefined;
|
|
48
|
+
this.endnotes = undefined;
|
|
49
|
+
this.keywordIndex = undefined;
|
|
50
|
+
this.themes = undefined;
|
|
51
|
+
this.stylesCollection = [];
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
this.isCutPerformed = false;
|
|
56
|
+
/**
|
|
57
|
+
* @private
|
|
58
|
+
*/
|
|
59
|
+
this.isPaste = false;
|
|
60
|
+
/**
|
|
61
|
+
* @private
|
|
62
|
+
*/
|
|
63
|
+
this.isContextBasedPaste = false;
|
|
64
|
+
/**
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
this.isHtmlPaste = false;
|
|
68
|
+
this.hasFieldSeparator = false;
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
* Optional factory so the editor can replace a renderer DocxRevision with its Revision
|
|
72
|
+
* before the instance is stored in editor collections. Renderer callers leave this unset.
|
|
73
|
+
*/
|
|
74
|
+
this.revisionFactory = undefined;
|
|
75
|
+
this.documentHelper = documentHelper;
|
|
76
|
+
this.revisionHelper = new RevisionHelperMethods(this.documentHelper);
|
|
77
|
+
this.editableRanges = new Dictionary();
|
|
78
|
+
}
|
|
79
|
+
Object.defineProperty(SfdtReader.prototype, "viewer", {
|
|
80
|
+
get: function () {
|
|
81
|
+
return this.documentHelper.viewer;
|
|
82
|
+
},
|
|
83
|
+
enumerable: true,
|
|
84
|
+
configurable: true
|
|
85
|
+
});
|
|
86
|
+
SfdtReader.prototype.convertJsonToDocument = function (json, incrementalOperations) {
|
|
87
|
+
this.commentStarts = new Dictionary();
|
|
88
|
+
this.commentEnds = new Dictionary();
|
|
89
|
+
this.commentsCollection = new Dictionary();
|
|
90
|
+
this.revisionCollection = new Dictionary();
|
|
91
|
+
this.fontInfoCollection = new Dictionary();
|
|
92
|
+
this.keywordIndex = 0;
|
|
93
|
+
this.footnotes = new Footnote();
|
|
94
|
+
this.endnotes = new Footnote();
|
|
95
|
+
var sections = [];
|
|
96
|
+
var jsonObject = LayoutHelperMethods.getSfdtDocument(json);
|
|
97
|
+
if (!isNullOrUndefined(jsonObject.optimizeSfdt) && jsonObject.optimizeSfdt) {
|
|
98
|
+
this.keywordIndex = 1;
|
|
99
|
+
}
|
|
100
|
+
if (!isNullOrUndefined(jsonObject[fontSubstitutionTableProperty[this.keywordIndex]])) {
|
|
101
|
+
this.parseFontSubstitutionTable(jsonObject[fontSubstitutionTableProperty[this.keywordIndex]]);
|
|
102
|
+
}
|
|
103
|
+
if (isNullOrUndefined(jsonObject[characterFormatProperty[this.keywordIndex]])) {
|
|
104
|
+
this.parseCharacterFormat(0, this.documentHelper.editorCharacterFormat, this.documentHelper.characterFormat);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.documentHelper.characterFormat.clearFormat();
|
|
108
|
+
this.parseCharacterFormat(this.keywordIndex, jsonObject[characterFormatProperty[this.keywordIndex]], this.documentHelper.characterFormat);
|
|
109
|
+
}
|
|
110
|
+
if (!isNullOrUndefined(this.documentHelper.documentCharacterFormat)) {
|
|
111
|
+
this.parseCharacterFormat(0, this.documentHelper.documentCharacterFormat, this.documentHelper.characterFormat);
|
|
112
|
+
}
|
|
113
|
+
if (isNullOrUndefined(jsonObject[paragraphFormatProperty[this.keywordIndex]])) {
|
|
114
|
+
this.parseParagraphFormat(0, this.documentHelper.editorParagraphFormat, this.documentHelper.paragraphFormat);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.documentHelper.paragraphFormat.clearFormat();
|
|
118
|
+
this.parseParagraphFormat(this.keywordIndex, jsonObject[paragraphFormatProperty[this.keywordIndex]], this.documentHelper.paragraphFormat);
|
|
119
|
+
}
|
|
120
|
+
if (!isNullOrUndefined(this.documentHelper.documentParagraphFormat)) {
|
|
121
|
+
this.parseParagraphFormat(0, this.documentHelper.documentParagraphFormat, this.documentHelper.paragraphFormat);
|
|
122
|
+
}
|
|
123
|
+
if (!isNullOrUndefined(jsonObject[themeFontLanguagesProperty[this.keywordIndex]])) {
|
|
124
|
+
this.parseCharacterFormat(this.keywordIndex, jsonObject[themeFontLanguagesProperty[this.keywordIndex]], this.documentHelper.themeFontLanguage);
|
|
125
|
+
}
|
|
126
|
+
this.parseDocumentProtection(jsonObject);
|
|
127
|
+
if (!isNullOrUndefined(jsonObject[defaultTabWidthProperty[this.keywordIndex]])) {
|
|
128
|
+
this.documentHelper.defaultTabWidth = jsonObject[defaultTabWidthProperty[this.keywordIndex]];
|
|
129
|
+
}
|
|
130
|
+
if (!isNullOrUndefined(jsonObject[trackChangesProperty[this.keywordIndex]])) {
|
|
131
|
+
//when new document is open in collaborative editing, again building operation for enable track changes. So skipping it.
|
|
132
|
+
if (this.documentHelper.enableTrackChanges !== LayoutHelperMethods.parseBoolValue(jsonObject[trackChangesProperty[this.keywordIndex]])) {
|
|
133
|
+
this.documentHelper.skipSettingsOps = true;
|
|
134
|
+
}
|
|
135
|
+
this.documentHelper.enableTrackChanges = LayoutHelperMethods.parseBoolValue(jsonObject[trackChangesProperty[this.keywordIndex]]);
|
|
136
|
+
}
|
|
137
|
+
if (!isNullOrUndefined(jsonObject[doNotUseHTMLParagraphAutoSpacingProperty[this.keywordIndex]])) {
|
|
138
|
+
this.documentHelper.dontUseHtmlParagraphAutoSpacing = LayoutHelperMethods.parseBoolValue(jsonObject[doNotUseHTMLParagraphAutoSpacingProperty[this.keywordIndex]]);
|
|
139
|
+
}
|
|
140
|
+
if (!isNullOrUndefined(jsonObject[allowSpaceOfSameStyleInTableProperty[this.keywordIndex]])) {
|
|
141
|
+
this.documentHelper.allowSpaceOfSameStyleInTable = LayoutHelperMethods.parseBoolValue(jsonObject[allowSpaceOfSameStyleInTableProperty[this.keywordIndex]]);
|
|
142
|
+
}
|
|
143
|
+
if (!isNullOrUndefined(jsonObject[alignTablesRowByRowProperty[this.keywordIndex]])) {
|
|
144
|
+
this.documentHelper.alignTablesRowByRow = LayoutHelperMethods.parseBoolValue(jsonObject[alignTablesRowByRowProperty[this.keywordIndex]]);
|
|
145
|
+
}
|
|
146
|
+
if (!isNullOrUndefined(jsonObject[backgroundProperty[this.keywordIndex]])) {
|
|
147
|
+
this.documentHelper.backgroundColor = this.getColor(jsonObject[backgroundProperty[this.keywordIndex]][colorProperty[this.keywordIndex]]);
|
|
148
|
+
}
|
|
149
|
+
if (!isNullOrUndefined(jsonObject[compatibilityModeProperty[this.keywordIndex]])) {
|
|
150
|
+
this.documentHelper.compatibilityMode = this.getCompatibilityMode(jsonObject[compatibilityModeProperty[this.keywordIndex]]);
|
|
151
|
+
if (!isNullOrUndefined(this.documentHelper.documentSettings)) {
|
|
152
|
+
this.documentHelper.documentSettings.compatibilityMode = this.getCompatibilityMode(jsonObject[compatibilityModeProperty[this.keywordIndex]]);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
if (!isNullOrUndefined(jsonObject[abstractListsProperty[this.keywordIndex]])) {
|
|
156
|
+
this.parseAbstractList(jsonObject, this.documentHelper.abstractLists);
|
|
157
|
+
}
|
|
158
|
+
if (!isNullOrUndefined(jsonObject[listsProperty[this.keywordIndex]])) {
|
|
159
|
+
this.parseList(jsonObject, this.documentHelper.lists);
|
|
160
|
+
}
|
|
161
|
+
if (!isNullOrUndefined(jsonObject[stylesProperty[this.keywordIndex]])) {
|
|
162
|
+
this.parseStyles(jsonObject, this.documentHelper.styles);
|
|
163
|
+
}
|
|
164
|
+
if (!isNullOrUndefined(jsonObject[commentsProperty[this.keywordIndex]])) {
|
|
165
|
+
this.parseComments(jsonObject, this.documentHelper.comments);
|
|
166
|
+
}
|
|
167
|
+
if (!isNullOrUndefined(jsonObject[revisionsProperty[this.keywordIndex]])) {
|
|
168
|
+
this.parseRevisions(jsonObject, []);
|
|
169
|
+
}
|
|
170
|
+
if (!isNullOrUndefined(jsonObject[imagesProperty[this.keywordIndex]])) {
|
|
171
|
+
this.parseImages(jsonObject[imagesProperty[this.keywordIndex]]);
|
|
172
|
+
}
|
|
173
|
+
if (!isNullOrUndefined(jsonObject[sectionsProperty[this.keywordIndex]])) {
|
|
174
|
+
this.parseSections(jsonObject[sectionsProperty[this.keywordIndex]], sections);
|
|
175
|
+
}
|
|
176
|
+
if (!isNullOrUndefined(jsonObject[customXmlProperty[this.keywordIndex]])) {
|
|
177
|
+
this.parseCustomXml(jsonObject);
|
|
178
|
+
}
|
|
179
|
+
if (!isNullOrUndefined(jsonObject[formFieldShadingProperty[this.keywordIndex]])) {
|
|
180
|
+
this.documentHelper.documentEditorSettings.formFieldSettings.applyShading = LayoutHelperMethods.parseBoolValue(jsonObject[formFieldShadingProperty[this.keywordIndex]]);
|
|
181
|
+
}
|
|
182
|
+
if (!isNullOrUndefined(jsonObject[footnotesProperty[this.keywordIndex]])) {
|
|
183
|
+
this.parseFootnotes(jsonObject[footnotesProperty[this.keywordIndex]], this.documentHelper.footnotes);
|
|
184
|
+
}
|
|
185
|
+
if (!isNullOrUndefined(jsonObject[endnotesProperty[this.keywordIndex]])) {
|
|
186
|
+
this.parseEndtnotes(jsonObject[endnotesProperty[this.keywordIndex]], this.documentHelper.endnotes);
|
|
187
|
+
}
|
|
188
|
+
if (!isNullOrUndefined(jsonObject[themesProperty[this.keywordIndex]])) {
|
|
189
|
+
this.parseThemes(jsonObject[themesProperty[this.keywordIndex]], this.documentHelper.themes);
|
|
190
|
+
}
|
|
191
|
+
this.removeUnmappedBookmark();
|
|
192
|
+
if (!isNullOrUndefined(jsonObject[incrementalOps[0]])) {
|
|
193
|
+
incrementalOperations[incrementalOps[0]] = (jsonObject[incrementalOps[0]]);
|
|
194
|
+
}
|
|
195
|
+
if (this.documentHelper.fieldStacks && this.documentHelper.fieldStacks.length > 0) {
|
|
196
|
+
for (var i = this.documentHelper.fieldStacks.length - 1; i >= 0; i--) {
|
|
197
|
+
var orphanedFieldBegin = this.documentHelper.fieldStacks[i];
|
|
198
|
+
if (isNullOrUndefined(orphanedFieldBegin.fieldSeparator) && isNullOrUndefined(orphanedFieldBegin.fieldEnd)) {
|
|
199
|
+
if (!isNullOrUndefined(orphanedFieldBegin.line)) {
|
|
200
|
+
var fieldBeginIndex = orphanedFieldBegin.line.children.indexOf(orphanedFieldBegin);
|
|
201
|
+
if (fieldBeginIndex !== -1) {
|
|
202
|
+
orphanedFieldBegin.line.children.splice(fieldBeginIndex, 1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
var fieldIndex = this.documentHelper.fields.indexOf(orphanedFieldBegin);
|
|
206
|
+
if (fieldIndex !== -1) {
|
|
207
|
+
this.documentHelper.fields.splice(fieldIndex, 1);
|
|
208
|
+
}
|
|
209
|
+
var stackIndex = this.documentHelper.fieldStacks.indexOf(orphanedFieldBegin);
|
|
210
|
+
if (stackIndex !== -1) {
|
|
211
|
+
this.documentHelper.fieldStacks.splice(stackIndex, 1);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
this.documentHelper.fieldStacks = [];
|
|
216
|
+
}
|
|
217
|
+
if (this.revisionMap) {
|
|
218
|
+
this.revisionMap.clear();
|
|
219
|
+
this.revisionMap = undefined;
|
|
220
|
+
}
|
|
221
|
+
if (this.revisionCollection) {
|
|
222
|
+
this.revisionCollection.clear();
|
|
223
|
+
this.revisionMap = undefined;
|
|
224
|
+
}
|
|
225
|
+
return sections;
|
|
226
|
+
};
|
|
227
|
+
SfdtReader.prototype.parseFontSubstitutionTable = function (fontSubstitutionTable) {
|
|
228
|
+
if (!isNullOrUndefined(this.documentHelper) && !isNullOrUndefined(this.documentHelper.fontSubstitutionTable)) {
|
|
229
|
+
if (Object.keys(fontSubstitutionTable).length > 0) {
|
|
230
|
+
var keys = Object.keys(fontSubstitutionTable);
|
|
231
|
+
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
|
|
232
|
+
var key = keys_1[_i];
|
|
233
|
+
this.documentHelper.fontSubstitutionTable.add(key, fontSubstitutionTable[key]);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
SfdtReader.prototype.removeUnmappedBookmark = function () {
|
|
239
|
+
var bookmarkKeys = this.documentHelper.bookmarks.keys;
|
|
240
|
+
var endBookmark = this.documentHelper.endBookmarksUpdated;
|
|
241
|
+
for (var i = 0; i < bookmarkKeys.length; i++) {
|
|
242
|
+
if (endBookmark.indexOf(bookmarkKeys[i]) === -1) {
|
|
243
|
+
var bookmark = this.documentHelper.bookmarks.get(bookmarkKeys[i]);
|
|
244
|
+
if (bookmark) {
|
|
245
|
+
bookmark.line.children.splice(bookmark.line.children.indexOf(bookmark), 1);
|
|
246
|
+
}
|
|
247
|
+
this.documentHelper.bookmarks.remove(bookmarkKeys[i]);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
this.documentHelper.endBookmarksUpdated = [];
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* @private
|
|
254
|
+
*/
|
|
255
|
+
SfdtReader.prototype.parseFootnotes = function (data, footnote) {
|
|
256
|
+
if (!isNullOrUndefined(data[separatorProperty[this.keywordIndex]])) {
|
|
257
|
+
this.parseBody(data[separatorProperty[this.keywordIndex]], footnote.separator);
|
|
258
|
+
}
|
|
259
|
+
if (!isNullOrUndefined(data[continuationNoticeProperty[this.keywordIndex]])) {
|
|
260
|
+
this.parseBody(data[continuationNoticeProperty[this.keywordIndex]], footnote.continuationNotice);
|
|
261
|
+
}
|
|
262
|
+
if (!isNullOrUndefined(data[continuationSeparatorProperty[this.keywordIndex]])) {
|
|
263
|
+
this.parseBody(data[continuationSeparatorProperty[this.keywordIndex]], footnote.continuationSeparator);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* @private
|
|
268
|
+
*/
|
|
269
|
+
SfdtReader.prototype.parseImages = function (data) {
|
|
270
|
+
for (var img in data) {
|
|
271
|
+
if (Array.isArray(data["" + img])) {
|
|
272
|
+
this.documentHelper.images.add(parseInt(img), data["" + img]);
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
var images = [];
|
|
276
|
+
images.push(data["" + img]);
|
|
277
|
+
this.documentHelper.images.add(parseInt(img), images);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
SfdtReader.prototype.parseEndtnotes = function (data, endnote) {
|
|
282
|
+
if (!isNullOrUndefined(data[separatorProperty[this.keywordIndex]])) {
|
|
283
|
+
this.parseBody(data[separatorProperty[this.keywordIndex]], endnote.separator);
|
|
284
|
+
}
|
|
285
|
+
if (!isNullOrUndefined(data[continuationNoticeProperty[this.keywordIndex]])) {
|
|
286
|
+
this.parseBody(data[continuationNoticeProperty[this.keywordIndex]], endnote.continuationNotice);
|
|
287
|
+
}
|
|
288
|
+
if (!isNullOrUndefined(data[continuationSeparatorProperty[this.keywordIndex]])) {
|
|
289
|
+
this.parseBody(data[continuationSeparatorProperty[this.keywordIndex]], endnote.continuationSeparator);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* @private
|
|
294
|
+
*/
|
|
295
|
+
SfdtReader.prototype.parseCustomXml = function (data) {
|
|
296
|
+
for (var i = 0; i < data[customXmlProperty[this.keywordIndex]].length; i++) {
|
|
297
|
+
var xmlData = data[customXmlProperty[this.keywordIndex]][i];
|
|
298
|
+
if (!this.documentHelper.customXmlData.containsKey(xmlData[itemIDProperty[this.keywordIndex]])) {
|
|
299
|
+
this.documentHelper.customXmlData.add(xmlData[itemIDProperty[this.keywordIndex]], xmlData[xmlProperty[this.keywordIndex]]);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
SfdtReader.prototype.parseDocumentProtection = function (data) {
|
|
304
|
+
if (!isNullOrUndefined(data[formattingProperty[this.keywordIndex]])) {
|
|
305
|
+
this.documentHelper.restrictFormatting = LayoutHelperMethods.parseBoolValue(data[formattingProperty[this.keywordIndex]]);
|
|
306
|
+
}
|
|
307
|
+
if (!isNullOrUndefined(data[enforcementProperty[this.keywordIndex]])) {
|
|
308
|
+
this.documentHelper.isDocumentProtected = LayoutHelperMethods.parseBoolValue(data[enforcementProperty[this.keywordIndex]]);
|
|
309
|
+
}
|
|
310
|
+
if (!isNullOrUndefined(data[protectionTypeProperty[this.keywordIndex]])) {
|
|
311
|
+
this.documentHelper.protectionType = this.getProtectionType(data[protectionTypeProperty[this.keywordIndex]]);
|
|
312
|
+
}
|
|
313
|
+
if (!isNullOrUndefined(data[hashValueProperty[this.keywordIndex]])) {
|
|
314
|
+
this.documentHelper.hashValue = data[hashValueProperty[this.keywordIndex]];
|
|
315
|
+
}
|
|
316
|
+
if (!isNullOrUndefined(data[saltValueProperty[this.keywordIndex]])) {
|
|
317
|
+
this.documentHelper.saltValue = data[saltValueProperty[this.keywordIndex]];
|
|
318
|
+
}
|
|
319
|
+
if (!isNullOrUndefined(data[cryptAlgorithmSidProperty[this.keywordIndex]])) {
|
|
320
|
+
this.documentHelper.cryptAlgorithmSid = data[cryptAlgorithmSidProperty[this.keywordIndex]];
|
|
321
|
+
}
|
|
322
|
+
if (!isNullOrUndefined(data[cryptAlgorithmTypeProperty[this.keywordIndex]])) {
|
|
323
|
+
this.documentHelper.cryptAlgorithmType = data[cryptAlgorithmTypeProperty[this.keywordIndex]];
|
|
324
|
+
}
|
|
325
|
+
if (!isNullOrUndefined(data[cryptAlgorithmClassProperty[this.keywordIndex]])) {
|
|
326
|
+
this.documentHelper.cryptAlgorithmClass = data[cryptAlgorithmClassProperty[this.keywordIndex]];
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* @private
|
|
331
|
+
*/
|
|
332
|
+
SfdtReader.prototype.parseStyles = function (data, styles) {
|
|
333
|
+
for (var i = 0; i < data[stylesProperty[this.keywordIndex]].length; i++) {
|
|
334
|
+
var editor = this.documentHelper.isEditorModule;
|
|
335
|
+
var style = this.documentHelper.styles.findByName(data[stylesProperty[this.keywordIndex]][i][nameProperty[this.keywordIndex]]);
|
|
336
|
+
// As per MS Word Behaaviour we need to replace the existing style with same name & same type with incoming style.
|
|
337
|
+
if (!isNullOrUndefined(style) && this.stylesCollection.indexOf(data[stylesProperty[this.keywordIndex]][i]) < 0 && style.type === this.getStyleType(style[typeProperty[this.keywordIndex]])) {
|
|
338
|
+
styles.remove(style);
|
|
339
|
+
}
|
|
340
|
+
if ((!isNullOrUndefined(editor) && this.documentHelper.editorProperties.isRemoteAction) || !styles.contains(style)) {
|
|
341
|
+
this.parseStyle(data, data[stylesProperty[this.keywordIndex]][i], styles);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
this.stylesCollection = [];
|
|
345
|
+
};
|
|
346
|
+
SfdtReader.prototype.toEditorRevision = function (revision) {
|
|
347
|
+
if (!isNullOrUndefined(this.revisionFactory) && !isNullOrUndefined(revision)) {
|
|
348
|
+
return this.revisionFactory(revision);
|
|
349
|
+
}
|
|
350
|
+
return revision;
|
|
351
|
+
};
|
|
352
|
+
SfdtReader.prototype.parseRevisions = function (data, revisions) {
|
|
353
|
+
for (var i = 0; i < data[revisionsProperty[this.keywordIndex]].length; i++) {
|
|
354
|
+
var revisionData = data[revisionsProperty[this.keywordIndex]][i];
|
|
355
|
+
if (!isNullOrUndefined(revisionData[revisionIdProperty[this.keywordIndex]]) && !isNullOrUndefined(revisionData[revisionTypeProperty[this.keywordIndex]])) {
|
|
356
|
+
var revision = this.toEditorRevision(this.parseRevision(revisionData));
|
|
357
|
+
var revisionCheck = true;
|
|
358
|
+
if (!this.documentHelper.copyWithTrackChange && this.isPaste) {
|
|
359
|
+
if (this.getRevisionType(revisionData[revisionTypeProperty[this.keywordIndex]]) === 'Insertion' && this.isPaste && this.documentHelper.enableTrackChanges && !this.documentHelper.editorProperties.isRemoteAction) {
|
|
360
|
+
// var editor = this.documentHelper.editor;
|
|
361
|
+
// if (this.documentHelper.editorProperties.isRemoteAction) {
|
|
362
|
+
// this.documentHelper.editor.revisionData.push(this.documentHelper.editor.getMarkerData(undefined, undefined, revision));
|
|
363
|
+
// }
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
if (!this.revisionCollection.containsKey(revisionData[revisionIdProperty[this.keywordIndex]])) {
|
|
368
|
+
this.revisionCollection.add(revisionData[revisionIdProperty[this.keywordIndex]], revision);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
this.revisionCollection.add(revisionData[revisionIdProperty[this.keywordIndex]], revision);
|
|
374
|
+
}
|
|
375
|
+
for (var j = 0; j < revisions.length; j++) {
|
|
376
|
+
if (revisions[j].revisionID === revision.revisionID) {
|
|
377
|
+
revisionCheck = false;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
if (revisionCheck && !this.documentHelper.editorProperties.isRemoteAction) {
|
|
381
|
+
revisions.push(revision);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
if (this.documentHelper.isSfdtExportModule) {
|
|
386
|
+
this.documentHelper.copyWithTrackChange = false;
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
SfdtReader.prototype.parseRevision = function (data) {
|
|
390
|
+
if (!isNullOrUndefined(data)) {
|
|
391
|
+
var revision = new DocxRevision(this.documentHelper, data[authorProperty[this.keywordIndex]], data[dateProperty[this.keywordIndex]]);
|
|
392
|
+
revision.revisionID = data[revisionIdProperty[this.keywordIndex]];
|
|
393
|
+
revision.revisionType = this.getRevisionType(data[revisionTypeProperty[this.keywordIndex]]);
|
|
394
|
+
revision.customData = data[customDataProperty[this.keywordIndex]];
|
|
395
|
+
return revision;
|
|
396
|
+
}
|
|
397
|
+
else {
|
|
398
|
+
return undefined;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
SfdtReader.prototype.checkAndApplyRevision = function (keyIndex, inline, item, owner) {
|
|
402
|
+
var revisionIds = inline[revisionIdsProperty[keyIndex]];
|
|
403
|
+
if (!revisionIds || revisionIds.length === 0) {
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
var isRemotePasteRow = this.isPaste && this.documentHelper.editorProperties.isRemoteAction && item instanceof WRowFormat;
|
|
407
|
+
if (!isNullOrUndefined(revisionIds) && revisionIds.length > 0) {
|
|
408
|
+
for (var i = 0; i < revisionIds.length; i++) {
|
|
409
|
+
var id = revisionIds[i];
|
|
410
|
+
var revision = this.revisionCollection.get(id);
|
|
411
|
+
if (revision) {
|
|
412
|
+
// This logic is added for Compatibility issue (Revisions are not added more than once for the same item if the author and revision type are the same).
|
|
413
|
+
if (item.revisionLength > 0 && item.getRevision(0).author == revision.author && item.getRevision(0).revisionType == revision.revisionType) {
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
var changes = this.documentHelper.editorProperties.revisionsInternal
|
|
418
|
+
? this.documentHelper.editorProperties.revisionsInternal.changes
|
|
419
|
+
: undefined;
|
|
420
|
+
if (!isNullOrUndefined(changes) && changes.indexOf(revision) === -1) {
|
|
421
|
+
changes.push(revision);
|
|
422
|
+
this.documentHelper.revisionsInternal.add(id, revision);
|
|
423
|
+
}
|
|
424
|
+
revision = this.checkAndCreateNewRevision(revision, owner, item);
|
|
425
|
+
if (!isNullOrUndefined(revision)) {
|
|
426
|
+
item.revisions.push(revision);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
if (isRemotePasteRow) {
|
|
430
|
+
this.documentHelper.editorProperties.remotePasteRevision.push(revision);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
};
|
|
436
|
+
SfdtReader.prototype.checkAndCreateNewRevision = function (revision, owner, item) {
|
|
437
|
+
if (isNullOrUndefined(this.revisionMap)) {
|
|
438
|
+
this.revisionMap = new Dictionary();
|
|
439
|
+
}
|
|
440
|
+
var parentRevisionId = revision.revisionID;
|
|
441
|
+
var mapRevision = this.revisionMap.get(owner);
|
|
442
|
+
var ownerMap = mapRevision ? mapRevision : undefined;
|
|
443
|
+
var hasRevision = ownerMap ? ownerMap.get(parentRevisionId) : undefined;
|
|
444
|
+
//Start of first compatibility check logic
|
|
445
|
+
//This logic is added for Compatibility issue (revisions are not splitted properly for different user/type).
|
|
446
|
+
var canAddNewRevision = false;
|
|
447
|
+
var previousElement;
|
|
448
|
+
if (item instanceof ElementBox && !isNullOrUndefined(item.previousElement) && !isNullOrUndefined(hasRevision)) {
|
|
449
|
+
previousElement = item.previousElement;
|
|
450
|
+
if (previousElement instanceof TextElementBox || previousElement instanceof CommentCharacterElementBox) {
|
|
451
|
+
if (previousElement.revisionLength === 0) {
|
|
452
|
+
canAddNewRevision = true;
|
|
453
|
+
}
|
|
454
|
+
for (var i = 0; i < previousElement.revisionLength; i++) {
|
|
455
|
+
var itemRevision = previousElement.getRevision(i);
|
|
456
|
+
if (itemRevision.revisionType !== revision.revisionType || itemRevision.author !== revision.author) {
|
|
457
|
+
canAddNewRevision = true;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
// End of first compatibility check logic
|
|
463
|
+
if (!isNullOrUndefined(revision.ownerNode) && revision.ownerNode !== owner || canAddNewRevision) {
|
|
464
|
+
if (!isNullOrUndefined(hasRevision) && !canAddNewRevision) {
|
|
465
|
+
revision = hasRevision;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
//Create new revision id for next paragraph
|
|
469
|
+
var revisionId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
470
|
+
//Clone the revision
|
|
471
|
+
revision = this.toEditorRevision(revision.cloneRevision());
|
|
472
|
+
revision.revisionID = revisionId;
|
|
473
|
+
var currentRevisionIndex = this.revisionCollection.values.indexOf(revision);
|
|
474
|
+
this.revisionCollection.keys.splice(currentRevisionIndex + 1, 0, revisionId);
|
|
475
|
+
this.revisionCollection.values.splice(currentRevisionIndex + 1, 0, revision);
|
|
476
|
+
var changes = this.documentHelper.editorProperties.revisionsInternal
|
|
477
|
+
? this.documentHelper.editorProperties.revisionsInternal.changes
|
|
478
|
+
: undefined;
|
|
479
|
+
if (!isNullOrUndefined(changes) && changes.indexOf(revision) === -1) {
|
|
480
|
+
changes.push(revision);
|
|
481
|
+
this.documentHelper.revisionsInternal.add(revision.revisionID, revision);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (isNullOrUndefined(ownerMap) || (ownerMap && isNullOrUndefined(hasRevision))) {
|
|
486
|
+
if (mapRevision) {
|
|
487
|
+
mapRevision.add(parentRevisionId, revision);
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
var splittedRevison = new Dictionary();
|
|
491
|
+
splittedRevison.add(parentRevisionId, revision);
|
|
492
|
+
this.revisionMap.add(owner, splittedRevison);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
//Start of second compatibility check logic
|
|
496
|
+
//The revision already inserted & new revision is created for the previousItem & the current item map's with older revision which is already added, we need to set current revision as previousItem's revision.
|
|
497
|
+
if (!canAddNewRevision && previousElement && previousElement.revisionLength > 0) {
|
|
498
|
+
var previousRevision = this.revisionHelper.retrieveRevisionByType(previousElement, revision.revisionType);
|
|
499
|
+
if (this.documentHelper.revisionsInternal.containsKey(revision.revisionID) && !isNullOrUndefined(previousRevision) && previousRevision !== revision) {
|
|
500
|
+
revision = this.revisionCollection.get(previousRevision.revisionID);
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
//End of second compatibility check logic
|
|
504
|
+
revision.ownerNode = owner;
|
|
505
|
+
return revision;
|
|
506
|
+
};
|
|
507
|
+
SfdtReader.prototype.parseComments = function (data, comments) {
|
|
508
|
+
var count = 0;
|
|
509
|
+
for (var i = 0; i < data[commentsProperty[this.keywordIndex]].length; i++) {
|
|
510
|
+
var commentData = data[commentsProperty[this.keywordIndex]][i];
|
|
511
|
+
var commentElement = undefined;
|
|
512
|
+
commentElement = this.parseComment(commentData, commentElement);
|
|
513
|
+
while (count < commentData[replyCommentsProperty[this.keywordIndex]].length) {
|
|
514
|
+
var replyComment = undefined;
|
|
515
|
+
replyComment = this.parseComment(commentData[replyCommentsProperty[this.keywordIndex]][count], replyComment);
|
|
516
|
+
replyComment.ownerComment = commentElement;
|
|
517
|
+
replyComment.isReply = true;
|
|
518
|
+
commentElement.replyComments.push(replyComment);
|
|
519
|
+
this.commentsCollection.add(replyComment.commentId, replyComment);
|
|
520
|
+
count++;
|
|
521
|
+
}
|
|
522
|
+
this.commentsCollection.add(commentElement.commentId, commentElement);
|
|
523
|
+
comments.push(commentElement);
|
|
524
|
+
count = 0;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
SfdtReader.prototype.parseComment = function (commentData, commentElement) {
|
|
528
|
+
commentElement = new CommentElementBox(commentData[dateProperty[this.keywordIndex]]);
|
|
529
|
+
commentElement.author = commentData[authorProperty[this.keywordIndex]];
|
|
530
|
+
commentElement.initial = commentData[initialProperty[this.keywordIndex]];
|
|
531
|
+
commentElement.commentId = commentData[commentIdProperty[this.keywordIndex]];
|
|
532
|
+
commentElement.isResolved = LayoutHelperMethods.parseBoolValue(commentData[doneProperty[this.keywordIndex]]);
|
|
533
|
+
commentElement.text = this.parseCommentText(commentData[blocksProperty[this.keywordIndex]]);
|
|
534
|
+
commentElement.mentions = this.parseCommentMentions(commentData[blocksProperty[this.keywordIndex]]);
|
|
535
|
+
commentElement.isPosted = true;
|
|
536
|
+
return commentElement;
|
|
537
|
+
};
|
|
538
|
+
SfdtReader.prototype.parseCommentText = function (blocks) {
|
|
539
|
+
var text = '';
|
|
540
|
+
var isFieldDisplayText = false;
|
|
541
|
+
for (var i = 0; i < blocks.length; i++) {
|
|
542
|
+
if (i !== 0) {
|
|
543
|
+
text += '<div>';
|
|
544
|
+
}
|
|
545
|
+
if (blocks[i][inlinesProperty[this.keywordIndex]].length > 0) {
|
|
546
|
+
var inlines = blocks[i][inlinesProperty[this.keywordIndex]];
|
|
547
|
+
for (var j = 0; j < inlines.length; j++) {
|
|
548
|
+
var inline = inlines[j];
|
|
549
|
+
if ((inline[fieldTypeProperty[this.keywordIndex]] === 0) || (inline[fieldTypeProperty[this.keywordIndex]] === 1) || (inline[fieldTypeProperty[this.keywordIndex]] === 2)) {
|
|
550
|
+
if (inline[fieldTypeProperty[this.keywordIndex]] === 0) {
|
|
551
|
+
j++;
|
|
552
|
+
}
|
|
553
|
+
else if (inline[fieldTypeProperty[this.keywordIndex]] === 2) {
|
|
554
|
+
isFieldDisplayText = true;
|
|
555
|
+
}
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
var textValue = inline[textProperty[this.keywordIndex]];
|
|
559
|
+
if (isFieldDisplayText) {
|
|
560
|
+
var encodedFieldText = textValue ? textValue.replace(/</g, "<").replace(/>/g, ">") : textValue;
|
|
561
|
+
text = text + '<span contenteditable="false" class="e-mention-chip">' + encodedFieldText + '</span>';
|
|
562
|
+
isFieldDisplayText = false;
|
|
563
|
+
}
|
|
564
|
+
else if (textValue) {
|
|
565
|
+
text = text + textValue.replace(/</g, "<").replace(/>/g, ">");
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
text += i === 0 ? '<div><br></div>' : '<br>';
|
|
571
|
+
}
|
|
572
|
+
if (i !== 0) {
|
|
573
|
+
text += '</div>';
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return text;
|
|
577
|
+
};
|
|
578
|
+
SfdtReader.prototype.parseCommentMentions = function (blocks) {
|
|
579
|
+
var data = [];
|
|
580
|
+
var isFieldCode = false;
|
|
581
|
+
var isFieldDisplayText = false;
|
|
582
|
+
for (var i = 0; i < blocks.length; i++) {
|
|
583
|
+
var inlines = blocks[i][inlinesProperty[this.keywordIndex]];
|
|
584
|
+
var mention = {};
|
|
585
|
+
for (var j = 0; j < inlines.length; j++) {
|
|
586
|
+
var inline = inlines[j];
|
|
587
|
+
if ((inline[fieldTypeProperty[this.keywordIndex]] === 0) || (inline[fieldTypeProperty[this.keywordIndex]] === 1) || (inline[fieldTypeProperty[this.keywordIndex]] === 2)) {
|
|
588
|
+
if (inline[fieldTypeProperty[this.keywordIndex]] === 0) {
|
|
589
|
+
isFieldCode = true;
|
|
590
|
+
}
|
|
591
|
+
else if (inline[fieldTypeProperty[this.keywordIndex]] === 2) {
|
|
592
|
+
isFieldDisplayText = true;
|
|
593
|
+
}
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
var textValue = inline[textProperty[this.keywordIndex]];
|
|
597
|
+
if (isFieldCode) {
|
|
598
|
+
var updatedText = textValue.replace(/.*"(.*)".*/, '$1');
|
|
599
|
+
updatedText = updatedText.replace('mailto:', '');
|
|
600
|
+
mention.value = updatedText;
|
|
601
|
+
isFieldCode = false;
|
|
602
|
+
}
|
|
603
|
+
else if (isFieldDisplayText) {
|
|
604
|
+
mention.text = textValue;
|
|
605
|
+
isFieldDisplayText = false;
|
|
606
|
+
data.push(mention);
|
|
607
|
+
mention = {};
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return data;
|
|
612
|
+
};
|
|
613
|
+
SfdtReader.prototype.parseStyle = function (data, style, styles, resetKeyIndex) {
|
|
614
|
+
var wStyle;
|
|
615
|
+
var keyIndex = 0;
|
|
616
|
+
var editor = this.documentHelper.isEditorModule;
|
|
617
|
+
if (!isNullOrUndefined(resetKeyIndex) && resetKeyIndex) {
|
|
618
|
+
keyIndex = this.keywordIndex;
|
|
619
|
+
this.keywordIndex = 0;
|
|
620
|
+
}
|
|
621
|
+
if (!isNullOrUndefined(style) && !isNullOrUndefined(style[typeProperty[this.keywordIndex]])) {
|
|
622
|
+
if (this.getStyleType(style[typeProperty[this.keywordIndex]]) === 'Paragraph') {
|
|
623
|
+
wStyle = new WParagraphStyle();
|
|
624
|
+
wStyle.type = 'Paragraph';
|
|
625
|
+
}
|
|
626
|
+
if (this.getStyleType(style[typeProperty[this.keywordIndex]]) === 'Character') {
|
|
627
|
+
wStyle = new WCharacterStyle();
|
|
628
|
+
wStyle.type = 'Character';
|
|
629
|
+
}
|
|
630
|
+
if (this.getStyleType(style[typeProperty[this.keywordIndex]]) === 'Table') {
|
|
631
|
+
wStyle = new WTableStyle();
|
|
632
|
+
wStyle.type = 'Table';
|
|
633
|
+
}
|
|
634
|
+
if (!isNullOrUndefined(style[nameProperty[this.keywordIndex]])) {
|
|
635
|
+
wStyle.name = style[nameProperty[this.keywordIndex]];
|
|
636
|
+
}
|
|
637
|
+
styles.push(wStyle);
|
|
638
|
+
this.stylesCollection.push(style);
|
|
639
|
+
if (!isNullOrUndefined(style[basedOnProperty[this.keywordIndex]])) {
|
|
640
|
+
var basedOn = void 0;
|
|
641
|
+
if (editor && this.documentHelper.editorProperties.isRemoteAction) {
|
|
642
|
+
basedOn = this.documentHelper.styles.findByName(style[basedOnProperty[this.keywordIndex]]);
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
basedOn = styles.findByName(style[basedOnProperty[this.keywordIndex]]);
|
|
646
|
+
}
|
|
647
|
+
if (!isNullOrUndefined(basedOn)) {
|
|
648
|
+
if (basedOn.type === wStyle.type && basedOn.name !== wStyle.name) {
|
|
649
|
+
wStyle.basedOn = basedOn;
|
|
650
|
+
var baseStyle = this.getStyle(style[basedOnProperty[this.keywordIndex]], data);
|
|
651
|
+
if (this.isPaste && !isNullOrUndefined(baseStyle)) {
|
|
652
|
+
if (wStyle.type === 'Paragraph' && this.getStyleType(baseStyle[typeProperty[this.keywordIndex]]) === 'Paragraph') {
|
|
653
|
+
this.updateParagraphFormatFromBaseStyle(style, baseStyle);
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
var basedStyle = this.getStyle(style[basedOnProperty[this.keywordIndex]], data);
|
|
660
|
+
var styleString = void 0;
|
|
661
|
+
if (!isNullOrUndefined(basedStyle) && this.getStyleType(basedStyle[typeProperty[this.keywordIndex]]) === wStyle.type) {
|
|
662
|
+
styleString = basedStyle;
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
if (wStyle.type === 'Paragraph') {
|
|
666
|
+
styleString = JSON.parse('{"type":"Paragraph","name":"Normal","next":"Normal"}');
|
|
667
|
+
}
|
|
668
|
+
else if (wStyle.type === 'Character') {
|
|
669
|
+
styleString = JSON.parse('{"type": "Character","name": "Default Paragraph Font"}');
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
this.parseStyle(data, styleString, styles);
|
|
673
|
+
if (editor && this.documentHelper.editorProperties.isRemoteAction) {
|
|
674
|
+
wStyle.basedOn = this.documentHelper.styles.findByName(styleString[nameProperty[this.keywordIndex]]);
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
if (!isNullOrUndefined(styleString) && wStyle !== styles.findByName(styleString[nameProperty[this.keywordIndex]]).basedOn) {
|
|
678
|
+
wStyle.basedOn = styles.findByName(styleString[nameProperty[this.keywordIndex]]);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
if (!isNullOrUndefined(style[linkProperty[this.keywordIndex]])) {
|
|
684
|
+
var link = styles.findByName(style[linkProperty[this.keywordIndex]]);
|
|
685
|
+
var linkStyle = this.getStyle(style[linkProperty[this.keywordIndex]], data);
|
|
686
|
+
if (editor && this.documentHelper.editorProperties.isRemoteAction) {
|
|
687
|
+
link = this.documentHelper.styles.findByName(style[linkProperty[this.keywordIndex]]);
|
|
688
|
+
}
|
|
689
|
+
var styleString = void 0;
|
|
690
|
+
if (isNullOrUndefined(link)) {
|
|
691
|
+
if (isNullOrUndefined(linkStyle)) {
|
|
692
|
+
//Construct the CharacterStyle string
|
|
693
|
+
var charaStyle = {};
|
|
694
|
+
charaStyle[characterFormatProperty[this.keywordIndex]] = style[characterFormatProperty[this.keywordIndex]];
|
|
695
|
+
charaStyle[nameProperty[this.keywordIndex]] = style[nameProperty[this.keywordIndex]] + ' Char';
|
|
696
|
+
charaStyle[typeProperty[this.keywordIndex]] = 'Character';
|
|
697
|
+
//TODO: Implement basedOn
|
|
698
|
+
charaStyle[basedOnProperty[this.keywordIndex]] = style[basedOnProperty[this.keywordIndex]] === 'Normal' ? 'Default Paragraph Font' : (style[basedOnProperty[this.keywordIndex]] + ' Char');
|
|
699
|
+
styleString = charaStyle;
|
|
700
|
+
}
|
|
701
|
+
else {
|
|
702
|
+
styleString = linkStyle;
|
|
703
|
+
}
|
|
704
|
+
this.parseStyle(data, styleString, styles);
|
|
705
|
+
var linkedStyle = void 0;
|
|
706
|
+
if (editor && this.documentHelper.editorProperties.isRemoteAction) {
|
|
707
|
+
linkedStyle = this.documentHelper.styles.findByName(styleString[nameProperty[this.keywordIndex]]);
|
|
708
|
+
wStyle.link = isNullOrUndefined(linkedStyle) ? style[linkProperty[this.keywordIndex]] : linkedStyle;
|
|
709
|
+
}
|
|
710
|
+
else {
|
|
711
|
+
linkedStyle = styles.findByName(styleString[nameProperty[this.keywordIndex]]);
|
|
712
|
+
wStyle.link = isNullOrUndefined(linkedStyle) ? style[linkProperty[this.keywordIndex]] : linkedStyle;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
wStyle.link = link;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
if (!isNullOrUndefined(style[characterFormatProperty[this.keywordIndex]])) {
|
|
720
|
+
this.parseCharacterFormat(this.keywordIndex, style[characterFormatProperty[this.keywordIndex]], wStyle.characterFormat);
|
|
721
|
+
}
|
|
722
|
+
if (!isNullOrUndefined(style[paragraphFormatProperty[this.keywordIndex]])) {
|
|
723
|
+
this.parseParagraphFormat(this.keywordIndex, style[paragraphFormatProperty[this.keywordIndex]], wStyle.paragraphFormat);
|
|
724
|
+
}
|
|
725
|
+
if (!isNullOrUndefined(style[nextProperty[this.keywordIndex]])) {
|
|
726
|
+
if (style[nextProperty[this.keywordIndex]] === style[nameProperty[this.keywordIndex]]) {
|
|
727
|
+
wStyle.next = wStyle;
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
var next = void 0;
|
|
731
|
+
if (editor && this.documentHelper.editorProperties.isRemoteAction) {
|
|
732
|
+
next = this.documentHelper.styles.findByName(style[nextProperty[this.keywordIndex]]);
|
|
733
|
+
}
|
|
734
|
+
else {
|
|
735
|
+
next = styles.findByName(style[nextProperty[this.keywordIndex]]);
|
|
736
|
+
}
|
|
737
|
+
if (!isNullOrUndefined(next) && next.type === wStyle.type) {
|
|
738
|
+
wStyle.next = next;
|
|
739
|
+
}
|
|
740
|
+
else {
|
|
741
|
+
var nextStyleString = this.getStyle(style[nextProperty[this.keywordIndex]], data);
|
|
742
|
+
if (!isNullOrUndefined(nextStyleString)) {
|
|
743
|
+
this.parseStyle(data, nextStyleString, styles);
|
|
744
|
+
if (editor && this.documentHelper.editorProperties.isRemoteAction) {
|
|
745
|
+
wStyle.next = this.documentHelper.styles.findByName(nextStyleString.name);
|
|
746
|
+
}
|
|
747
|
+
else {
|
|
748
|
+
wStyle.next = styles.findByName(nextStyleString.name);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
wStyle.next = wStyle;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
if (!isNullOrUndefined(resetKeyIndex) && resetKeyIndex) {
|
|
759
|
+
this.keywordIndex = keyIndex;
|
|
760
|
+
}
|
|
761
|
+
if (!isNullOrUndefined(wStyle) && wStyle.type !== 'Table') {
|
|
762
|
+
this.documentHelper.addToStylesMap(wStyle);
|
|
763
|
+
}
|
|
764
|
+
};
|
|
765
|
+
SfdtReader.prototype.updateParagraphFormatFromBaseStyle = function (style, baseStyle) {
|
|
766
|
+
if (!isNullOrUndefined(style[paragraphFormatProperty[this.keywordIndex]]) && !isNullOrUndefined(baseStyle[paragraphFormatProperty[this.keywordIndex]])) {
|
|
767
|
+
var paragraphFormat = style[paragraphFormatProperty[this.keywordIndex]];
|
|
768
|
+
var baseParagraphFormat = baseStyle[paragraphFormatProperty[this.keywordIndex]];
|
|
769
|
+
if (!paragraphFormat.hasOwnProperty(leftIndentProperty[this.keywordIndex])
|
|
770
|
+
&& baseParagraphFormat.hasOwnProperty(leftIndentProperty[this.keywordIndex])) {
|
|
771
|
+
paragraphFormat[leftIndentProperty[this.keywordIndex]] = baseParagraphFormat[leftIndentProperty[this.keywordIndex]];
|
|
772
|
+
}
|
|
773
|
+
if (!paragraphFormat.hasOwnProperty(rightIndentProperty[this.keywordIndex])
|
|
774
|
+
&& baseParagraphFormat.hasOwnProperty(rightIndentProperty[this.keywordIndex])) {
|
|
775
|
+
paragraphFormat[rightIndentProperty[this.keywordIndex]] = baseParagraphFormat[rightIndentProperty[this.keywordIndex]];
|
|
776
|
+
}
|
|
777
|
+
if (!paragraphFormat.hasOwnProperty(beforeSpacingProperty[this.keywordIndex])
|
|
778
|
+
&& baseParagraphFormat.hasOwnProperty(beforeSpacingProperty[this.keywordIndex])) {
|
|
779
|
+
paragraphFormat[beforeSpacingProperty[this.keywordIndex]] = baseParagraphFormat[beforeSpacingProperty[this.keywordIndex]];
|
|
780
|
+
}
|
|
781
|
+
if (!paragraphFormat.hasOwnProperty(afterSpacingProperty[this.keywordIndex])
|
|
782
|
+
&& baseParagraphFormat.hasOwnProperty(afterSpacingProperty[this.keywordIndex])) {
|
|
783
|
+
paragraphFormat[afterSpacingProperty[this.keywordIndex]] = baseParagraphFormat[afterSpacingProperty[this.keywordIndex]];
|
|
784
|
+
}
|
|
785
|
+
if (!paragraphFormat.hasOwnProperty(lineSpacingProperty[this.keywordIndex])
|
|
786
|
+
&& baseParagraphFormat.hasOwnProperty(lineSpacingProperty[this.keywordIndex])) {
|
|
787
|
+
paragraphFormat[lineSpacingProperty[this.keywordIndex]] = baseParagraphFormat[lineSpacingProperty[this.keywordIndex]];
|
|
788
|
+
}
|
|
789
|
+
if (!paragraphFormat.hasOwnProperty(lineSpacingTypeProperty[this.keywordIndex])
|
|
790
|
+
&& baseParagraphFormat.hasOwnProperty(lineSpacingTypeProperty[this.keywordIndex])) {
|
|
791
|
+
paragraphFormat[lineSpacingTypeProperty[this.keywordIndex]] = baseParagraphFormat[lineSpacingTypeProperty[this.keywordIndex]];
|
|
792
|
+
}
|
|
793
|
+
if (!paragraphFormat.hasOwnProperty(textAlignmentProperty[this.keywordIndex])
|
|
794
|
+
&& baseParagraphFormat.hasOwnProperty(textAlignmentProperty[this.keywordIndex])) {
|
|
795
|
+
paragraphFormat[textAlignmentProperty[this.keywordIndex]] = baseParagraphFormat[textAlignmentProperty[this.keywordIndex]];
|
|
796
|
+
}
|
|
797
|
+
if (!paragraphFormat.hasOwnProperty(outlineLevelProperty[this.keywordIndex])
|
|
798
|
+
&& baseParagraphFormat.hasOwnProperty(outlineLevelProperty[this.keywordIndex])) {
|
|
799
|
+
paragraphFormat[outlineLevelProperty[this.keywordIndex]] = baseParagraphFormat[outlineLevelProperty[this.keywordIndex]];
|
|
800
|
+
}
|
|
801
|
+
if (!paragraphFormat.hasOwnProperty(contextualSpacingProperty[this.keywordIndex])
|
|
802
|
+
&& baseParagraphFormat.hasOwnProperty(contextualSpacingProperty[this.keywordIndex])) {
|
|
803
|
+
paragraphFormat[contextualSpacingProperty[this.keywordIndex]] = baseParagraphFormat[contextualSpacingProperty[this.keywordIndex]];
|
|
804
|
+
}
|
|
805
|
+
if (!paragraphFormat.hasOwnProperty(keepWithNextProperty[this.keywordIndex])
|
|
806
|
+
&& baseParagraphFormat.hasOwnProperty(keepWithNextProperty[this.keywordIndex])) {
|
|
807
|
+
paragraphFormat[keepWithNextProperty[this.keywordIndex]] = baseParagraphFormat[keepWithNextProperty[this.keywordIndex]];
|
|
808
|
+
}
|
|
809
|
+
if (!paragraphFormat.hasOwnProperty(keepLinesTogetherProperty[this.keywordIndex])
|
|
810
|
+
&& baseParagraphFormat.hasOwnProperty(keepLinesTogetherProperty[this.keywordIndex])) {
|
|
811
|
+
paragraphFormat[keepLinesTogetherProperty[this.keywordIndex]] = baseParagraphFormat[keepLinesTogetherProperty[this.keywordIndex]];
|
|
812
|
+
}
|
|
813
|
+
if (!paragraphFormat.hasOwnProperty(widowControlProperty[this.keywordIndex])
|
|
814
|
+
&& baseParagraphFormat.hasOwnProperty(widowControlProperty[this.keywordIndex])) {
|
|
815
|
+
paragraphFormat[widowControlProperty[this.keywordIndex]] = baseParagraphFormat[widowControlProperty[this.keywordIndex]];
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
SfdtReader.prototype.getStyle = function (name, data) {
|
|
820
|
+
for (var i = 0; i < data[stylesProperty[this.keywordIndex]].length; i++) {
|
|
821
|
+
if (data[stylesProperty[this.keywordIndex]][i][nameProperty[this.keywordIndex]] === name) {
|
|
822
|
+
return data[stylesProperty[this.keywordIndex]][i];
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return undefined;
|
|
826
|
+
};
|
|
827
|
+
SfdtReader.prototype.parseAbstractList = function (data, abstractLists) {
|
|
828
|
+
var abstractListMap = new Dictionary();
|
|
829
|
+
for (var i = 0; i < data[abstractListsProperty[this.keywordIndex]].length; i++) {
|
|
830
|
+
var abstractList = new WAbstractList();
|
|
831
|
+
var abstract = data[abstractListsProperty[this.keywordIndex]][i];
|
|
832
|
+
if (!isNullOrUndefined(abstract)) {
|
|
833
|
+
if (!isNullOrUndefined(abstract[abstractListIdProperty[this.keywordIndex]])) {
|
|
834
|
+
abstractList.abstractListId = abstract[abstractListIdProperty[this.keywordIndex]];
|
|
835
|
+
}
|
|
836
|
+
if (!isNullOrUndefined(abstract[nsidProperty])) {
|
|
837
|
+
abstractList.nsid = abstract[nsidProperty];
|
|
838
|
+
}
|
|
839
|
+
if (!isNullOrUndefined(abstract[levelsProperty[this.keywordIndex]])) {
|
|
840
|
+
for (var j = 0; j < abstract[levelsProperty[this.keywordIndex]].length; j++) {
|
|
841
|
+
var level = abstract[levelsProperty[this.keywordIndex]][j];
|
|
842
|
+
if (!isNullOrUndefined(level)) {
|
|
843
|
+
var listLevel = this.parseListLevel(level, abstractList);
|
|
844
|
+
abstractList.levels.push(listLevel);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
if (abstractListMap.containsKey(abstractList.abstractListId)) {
|
|
850
|
+
var index = abstractLists.indexOf(abstractListMap.get(abstractList.abstractListId));
|
|
851
|
+
if (index >= 0) {
|
|
852
|
+
abstractLists.splice(index, 1);
|
|
853
|
+
abstractListMap.remove(abstractList.abstractListId);
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
abstractListMap.add(abstractList.abstractListId, abstractList);
|
|
857
|
+
abstractLists.push(abstractList);
|
|
858
|
+
}
|
|
859
|
+
};
|
|
860
|
+
SfdtReader.prototype.parseListLevel = function (data, owner) {
|
|
861
|
+
var listLevel = new WListLevel(owner);
|
|
862
|
+
if (this.getListLevelPattern(data[listLevelPatternProperty[this.keywordIndex]]) === 'Bullet') {
|
|
863
|
+
listLevel.listLevelPattern = 'Bullet';
|
|
864
|
+
listLevel.numberFormat = !isNullOrUndefined(data[numberFormatProperty[this.keywordIndex]]) ? data[numberFormatProperty[this.keywordIndex]] : '';
|
|
865
|
+
}
|
|
866
|
+
else {
|
|
867
|
+
listLevel.listLevelPattern = this.getListLevelPattern(data[listLevelPatternProperty[this.keywordIndex]]);
|
|
868
|
+
listLevel.startAt = data[startAtProperty[this.keywordIndex]];
|
|
869
|
+
listLevel.numberFormat = !isNullOrUndefined(data[numberFormatProperty[this.keywordIndex]]) ? data[numberFormatProperty[this.keywordIndex]] : '';
|
|
870
|
+
if (data[restartLevelProperty[this.keywordIndex]] >= 0) {
|
|
871
|
+
listLevel.restartLevel = data[restartLevelProperty[this.keywordIndex]];
|
|
872
|
+
}
|
|
873
|
+
else {
|
|
874
|
+
listLevel.restartLevel = data[levelNumberProperty[this.keywordIndex]];
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
listLevel.paraStyleName = !isNullOrUndefined(data[paraStyleNameProperty[this.keywordIndex]]) ? data[paraStyleNameProperty[this.keywordIndex]] : '';
|
|
878
|
+
listLevel.isLegalStyleNumbering = !isNullOrUndefined(data[isLegalStyleNumberingProperty[this.keywordIndex]]) ? LayoutHelperMethods.parseBoolValue(data[isLegalStyleNumberingProperty[this.keywordIndex]]) : false;
|
|
879
|
+
listLevel.followCharacter = this.getFollowCharacterType(data[followCharacterProperty[this.keywordIndex]]);
|
|
880
|
+
listLevel.numberAlignment = this.getListNumberAlignment(data[numberAlignmentProperty[this.keywordIndex]]);
|
|
881
|
+
this.parseCharacterFormat(this.keywordIndex, data[characterFormatProperty[this.keywordIndex]], listLevel.characterFormat);
|
|
882
|
+
this.parseParagraphFormat(this.keywordIndex, data[paragraphFormatProperty[this.keywordIndex]], listLevel.paragraphFormat);
|
|
883
|
+
return listLevel;
|
|
884
|
+
};
|
|
885
|
+
SfdtReader.prototype.parseList = function (data, listCollection) {
|
|
886
|
+
for (var i = 0; i < data[listsProperty[this.keywordIndex]].length; i++) {
|
|
887
|
+
var list = new WList();
|
|
888
|
+
var lists = data[listsProperty[this.keywordIndex]][i];
|
|
889
|
+
if (!isNullOrUndefined(lists[abstractListIdProperty[this.keywordIndex]])) {
|
|
890
|
+
list.abstractListId = lists[abstractListIdProperty[this.keywordIndex]];
|
|
891
|
+
list.abstractList = this.documentHelper.getAbstractListById(lists[abstractListIdProperty[this.keywordIndex]]);
|
|
892
|
+
}
|
|
893
|
+
listCollection.push(list);
|
|
894
|
+
if (!isNullOrUndefined(lists[listIdProperty[this.keywordIndex]])) {
|
|
895
|
+
list.listId = lists[listIdProperty[this.keywordIndex]];
|
|
896
|
+
}
|
|
897
|
+
if (!isNullOrUndefined(lists[nsidProperty])) {
|
|
898
|
+
list.nsid = lists[nsidProperty];
|
|
899
|
+
}
|
|
900
|
+
else {
|
|
901
|
+
list.nsid = list.abstractList.nsid;
|
|
902
|
+
}
|
|
903
|
+
if (lists.hasOwnProperty(levelOverridesProperty[this.keywordIndex])) {
|
|
904
|
+
this.parseLevelOverride(lists[levelOverridesProperty[this.keywordIndex]], list);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
};
|
|
908
|
+
SfdtReader.prototype.parseLevelOverride = function (data, list) {
|
|
909
|
+
if (isNullOrUndefined(data)) {
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
for (var i = 0; i < data.length; i++) {
|
|
913
|
+
var levelOverrides = new WLevelOverride();
|
|
914
|
+
var levelOverride = data[i];
|
|
915
|
+
levelOverrides.startAt = levelOverride[startAtProperty[this.keywordIndex]];
|
|
916
|
+
levelOverrides.levelNumber = levelOverride[levelNumberProperty[this.keywordIndex]];
|
|
917
|
+
if (!isNullOrUndefined(levelOverride[overrideListLevelProperty[this.keywordIndex]])) {
|
|
918
|
+
levelOverrides.overrideListLevel = this.parseListLevel(levelOverride[overrideListLevelProperty[this.keywordIndex]], levelOverrides);
|
|
919
|
+
}
|
|
920
|
+
list.levelOverrides.push(levelOverrides);
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
SfdtReader.prototype.parseSections = function (data, sections) {
|
|
924
|
+
for (var i = 0; i < data.length; i++) {
|
|
925
|
+
var section = new BodyWidget();
|
|
926
|
+
section.sectionFormat = new WSectionFormat(section);
|
|
927
|
+
section.index = i;
|
|
928
|
+
var item = data[i];
|
|
929
|
+
var breakCode = '';
|
|
930
|
+
var nextItem = data[i + 1];
|
|
931
|
+
var sectionFormat = nextItem && nextItem[sectionFormatProperty[this.keywordIndex]] ? nextItem[sectionFormatProperty[this.keywordIndex]] : undefined;
|
|
932
|
+
breakCode = sectionFormat && sectionFormat[breakCodeProperty[this.keywordIndex]] ? sectionFormat[breakCodeProperty[this.keywordIndex]] : 'NewPage';
|
|
933
|
+
if (!isNullOrUndefined(item[sectionFormatProperty[this.keywordIndex]])) {
|
|
934
|
+
this.parseSectionFormat(this.keywordIndex, item[sectionFormatProperty[this.keywordIndex]], section.sectionFormat);
|
|
935
|
+
}
|
|
936
|
+
if (isNullOrUndefined(item[headersFootersProperty[this.keywordIndex]])) {
|
|
937
|
+
item[headersFootersProperty[this.keywordIndex]] = {};
|
|
938
|
+
}
|
|
939
|
+
this.documentHelper.headersFooters.push(this.parseHeaderFooter(item[headersFootersProperty[this.keywordIndex]], this.documentHelper.headersFooters));
|
|
940
|
+
this.isParseHeader = false;
|
|
941
|
+
this.parseTextBody(item[blocksProperty[this.keywordIndex]], section, i + 1 < data.length, breakCode);
|
|
942
|
+
for (var i_1 = 0; i_1 < section.childWidgets.length; i_1++) {
|
|
943
|
+
section.childWidgets[i_1].containerWidget = section;
|
|
944
|
+
}
|
|
945
|
+
sections.push(section);
|
|
946
|
+
}
|
|
947
|
+
};
|
|
948
|
+
SfdtReader.prototype.parseHeaderFooter = function (data, headersFooters) {
|
|
949
|
+
this.isParseHeader = true;
|
|
950
|
+
var hfs = {};
|
|
951
|
+
if (!isNullOrUndefined(data[headerProperty[this.keywordIndex]])) {
|
|
952
|
+
var oddHeader = new HeaderFooterWidget('OddHeader');
|
|
953
|
+
hfs[0] = oddHeader;
|
|
954
|
+
this.parseTextBody(data[headerProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]], oddHeader);
|
|
955
|
+
}
|
|
956
|
+
if (!isNullOrUndefined(data[footerProperty[this.keywordIndex]])) {
|
|
957
|
+
var oddFooter = new HeaderFooterWidget('OddFooter');
|
|
958
|
+
hfs[1] = oddFooter;
|
|
959
|
+
this.parseTextBody(data[footerProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]], oddFooter);
|
|
960
|
+
}
|
|
961
|
+
if (!isNullOrUndefined(data[evenHeaderProperty[this.keywordIndex]])) {
|
|
962
|
+
var evenHeader = new HeaderFooterWidget('EvenHeader');
|
|
963
|
+
hfs[2] = evenHeader;
|
|
964
|
+
this.parseTextBody(data[evenHeaderProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]], evenHeader);
|
|
965
|
+
}
|
|
966
|
+
if (!isNullOrUndefined(data[evenFooterProperty[this.keywordIndex]])) {
|
|
967
|
+
var evenFooter = new HeaderFooterWidget('EvenFooter');
|
|
968
|
+
hfs[3] = evenFooter;
|
|
969
|
+
this.parseTextBody(data[evenFooterProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]], evenFooter);
|
|
970
|
+
}
|
|
971
|
+
if (!isNullOrUndefined(data[firstPageHeaderProperty[this.keywordIndex]])) {
|
|
972
|
+
var firstPageHeader = new HeaderFooterWidget('FirstPageHeader');
|
|
973
|
+
hfs[4] = firstPageHeader;
|
|
974
|
+
this.parseTextBody(data[firstPageHeaderProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]], firstPageHeader);
|
|
975
|
+
}
|
|
976
|
+
if (!isNullOrUndefined(data[firstPageFooterProperty[this.keywordIndex]])) {
|
|
977
|
+
var firstPageFooter = new HeaderFooterWidget('FirstPageFooter');
|
|
978
|
+
hfs[5] = firstPageFooter;
|
|
979
|
+
this.parseTextBody(data[firstPageFooterProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]], firstPageFooter);
|
|
980
|
+
}
|
|
981
|
+
return hfs;
|
|
982
|
+
};
|
|
983
|
+
SfdtReader.prototype.parseTextBody = function (data, section, isSectionBreak, breakCode) {
|
|
984
|
+
this.parseBody(data, section.childWidgets, section, isSectionBreak, undefined, undefined, breakCode);
|
|
985
|
+
};
|
|
986
|
+
SfdtReader.prototype.addCustomStyles = function (data) {
|
|
987
|
+
if (!isNullOrUndefined(data[stylesProperty[this.keywordIndex]])) {
|
|
988
|
+
for (var i = 0; i < data[stylesProperty[this.keywordIndex]].length; i++) {
|
|
989
|
+
var style = this.documentHelper.styles.findByName(data[stylesProperty[this.keywordIndex]][i][nameProperty[this.keywordIndex]]);
|
|
990
|
+
if (style === undefined && !(this.isPaste && data[stylesProperty[this.keywordIndex]][i][nameProperty[this.keywordIndex]] === 'Normal (Web)')) {
|
|
991
|
+
this.parseStyle(data, data[stylesProperty[this.keywordIndex]][i], this.documentHelper.styles);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
};
|
|
996
|
+
/**
|
|
997
|
+
* The HTML to SFDT conversion adds a bare "Normal (Web)" style (without character format) to the pasted content.
|
|
998
|
+
* An internal copy exports the full "Normal (Web)" style definition, which has to be retained as it is.
|
|
999
|
+
*/
|
|
1000
|
+
SfdtReader.prototype.isHtmlConvertedWebStyle = function (styles) {
|
|
1001
|
+
if (isNullOrUndefined(styles)) {
|
|
1002
|
+
return true;
|
|
1003
|
+
}
|
|
1004
|
+
for (var i = 0; i < styles.length; i++) {
|
|
1005
|
+
if (styles[i][nameProperty[this.keywordIndex]] === 'Normal (Web)') {
|
|
1006
|
+
var charFormat = styles[i][characterFormatProperty[this.keywordIndex]];
|
|
1007
|
+
return isNullOrUndefined(charFormat) || Object.keys(charFormat).length === 0;
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
return true;
|
|
1011
|
+
};
|
|
1012
|
+
SfdtReader.prototype.parseBody = function (data, blocks, container, isSectionBreak, contentControlProperties, styles, breakCode, isFootnoteEndnote) {
|
|
1013
|
+
if (!isNullOrUndefined(data)) {
|
|
1014
|
+
for (var i = 0; i < data.length; i++) {
|
|
1015
|
+
var block = data[i];
|
|
1016
|
+
var hasValidElmts = false;
|
|
1017
|
+
if (block.hasOwnProperty(inlinesProperty[this.keywordIndex])) {
|
|
1018
|
+
var writeInlineFormat = false;
|
|
1019
|
+
//writeInlineFormat = this.isPasting && i === data.length - 1;
|
|
1020
|
+
var paragraph = new ParagraphWidget();
|
|
1021
|
+
paragraph.characterFormat = new WCharacterFormat(paragraph, this.documentHelper);
|
|
1022
|
+
paragraph.paragraphFormat = new WParagraphFormat(paragraph);
|
|
1023
|
+
var line = this.documentHelper.layout.addLineWidget(paragraph);
|
|
1024
|
+
if (block[inlinesProperty[this.keywordIndex]].length > 0) {
|
|
1025
|
+
hasValidElmts = this.parseParagraph(block[inlinesProperty[this.keywordIndex]], paragraph, writeInlineFormat, line, isFootnoteEndnote && i === 0);
|
|
1026
|
+
}
|
|
1027
|
+
var sourceFormat = block[characterFormatProperty[this.keywordIndex]];
|
|
1028
|
+
if (!(isSectionBreak && block === data[data.length - 1] && block[inlinesProperty[this.keywordIndex]].length === 0 && !hasValidElmts)) {
|
|
1029
|
+
this.parseCharacterFormat(this.keywordIndex, sourceFormat, paragraph.characterFormat);
|
|
1030
|
+
this.parseParagraphFormat(this.keywordIndex, block[paragraphFormatProperty[this.keywordIndex]], paragraph.paragraphFormat);
|
|
1031
|
+
var styleObj = void 0;
|
|
1032
|
+
var styleName = 'Normal';
|
|
1033
|
+
var isParaHasStyleName = false;
|
|
1034
|
+
if (!isNullOrUndefined(block[paragraphFormatProperty[this.keywordIndex]]) && !isNullOrUndefined(block[paragraphFormatProperty[this.keywordIndex]][styleNameProperty[this.keywordIndex]])) {
|
|
1035
|
+
//Default value to link style object.
|
|
1036
|
+
styleName = block[paragraphFormatProperty[this.keywordIndex]][styleNameProperty[this.keywordIndex]];
|
|
1037
|
+
isParaHasStyleName = true;
|
|
1038
|
+
}
|
|
1039
|
+
styleObj = this.documentHelper.styles.findByName(styleName, 'Paragraph');
|
|
1040
|
+
// While pasting, the "Normal (Web)" style (added by the HTML to SFDT conversion) is not parsed.
|
|
1041
|
+
// So the paragraph preserves the base style of the selected paragraph, else uses the "Normal" style object.
|
|
1042
|
+
if (this.isPaste && styleName === 'Normal (Web)' && this.isHtmlConvertedWebStyle(styles)) {
|
|
1043
|
+
styleObj = this.selectedBaseStyle instanceof WParagraphStyle ? this.selectedBaseStyle :
|
|
1044
|
+
this.documentHelper.styles.findByName('Normal', 'Paragraph');
|
|
1045
|
+
}
|
|
1046
|
+
else if (this.isPaste && isNullOrUndefined(styleObj) && styleName === 'Normal (Web)') {
|
|
1047
|
+
styleObj = this.documentHelper.styles.findByName('Normal', 'Paragraph');
|
|
1048
|
+
}
|
|
1049
|
+
if (!isNullOrUndefined(styleObj)) {
|
|
1050
|
+
// The below lines are disabled because they cause a break for this task: 870732
|
|
1051
|
+
// if (this.isPaste && styles && isParaHasStyleName) {
|
|
1052
|
+
// for (let j = 0; j < styles.length; j++) {
|
|
1053
|
+
// if (styles[j][nameProperty[this.keywordIndex]] === styleName) {
|
|
1054
|
+
// var fontColor = styles[j][characterFormatProperty[this.keywordIndex]];
|
|
1055
|
+
// if (isNullOrUndefined(fontColor) || fontColor[fontColorProperty[this.keywordIndex]] !== (styleObj as WCharacterStyle).characterFormat.fontColor) {
|
|
1056
|
+
// const charFormat: WCharacterFormat = new WCharacterFormat();
|
|
1057
|
+
// this.parseCharacterFormat(this.keywordIndex, styles[j][characterFormatProperty[this.keywordIndex]], charFormat);
|
|
1058
|
+
// (styleObj as WCharacterStyle).characterFormat.copyFormat(charFormat);
|
|
1059
|
+
// break;
|
|
1060
|
+
// }
|
|
1061
|
+
// }
|
|
1062
|
+
// }
|
|
1063
|
+
// }
|
|
1064
|
+
paragraph.paragraphFormat.applyStyle(styleObj);
|
|
1065
|
+
}
|
|
1066
|
+
blocks.push(paragraph);
|
|
1067
|
+
}
|
|
1068
|
+
else {
|
|
1069
|
+
if (!isNullOrUndefined(sourceFormat)) {
|
|
1070
|
+
if (!isNullOrUndefined(sourceFormat[revisionIdsProperty[this.keywordIndex]]) && sourceFormat[revisionIdsProperty[this.keywordIndex]].length > 0) {
|
|
1071
|
+
this.checkAndApplyRevision(this.keywordIndex, sourceFormat, paragraph.characterFormat, paragraph.characterFormat);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
if (!(isSectionBreak && data.length === 1)) {
|
|
1075
|
+
// If section last paragraph is empty then we need to layout the paragraph in the previous widget which is handled similar to MS word.
|
|
1076
|
+
paragraph.isSectionBreak = true;
|
|
1077
|
+
}
|
|
1078
|
+
blocks.push(paragraph);
|
|
1079
|
+
}
|
|
1080
|
+
paragraph.index = blocks.length - 1;
|
|
1081
|
+
paragraph.containerWidget = container;
|
|
1082
|
+
}
|
|
1083
|
+
else if (block.hasOwnProperty(rowsProperty[this.keywordIndex])) {
|
|
1084
|
+
this.parseTable(block, blocks, blocks.length, container);
|
|
1085
|
+
}
|
|
1086
|
+
else if (block.hasOwnProperty(contentControlPropertiesProperty[this.keywordIndex])) {
|
|
1087
|
+
var blockStartContentControl = new ContentControl('Block');
|
|
1088
|
+
var blockEndContentControl = new ContentControl('Block');
|
|
1089
|
+
this.parseContentControlProperties(block[contentControlPropertiesProperty[this.keywordIndex]], blockStartContentControl.contentControlProperties);
|
|
1090
|
+
blockEndContentControl.contentControlProperties = blockStartContentControl.contentControlProperties;
|
|
1091
|
+
blockStartContentControl.type = 0;
|
|
1092
|
+
blockEndContentControl.type = 1;
|
|
1093
|
+
if (block.hasOwnProperty(authorNameProperty[this.keywordIndex])) {
|
|
1094
|
+
blockStartContentControl.authorName = block[authorNameProperty[this.keywordIndex]];
|
|
1095
|
+
blockEndContentControl.authorName = block[authorNameProperty[this.keywordIndex]];
|
|
1096
|
+
}
|
|
1097
|
+
if (block.hasOwnProperty(revDateTimeProperty[this.keywordIndex])) {
|
|
1098
|
+
blockStartContentControl.revDateTime = block[revDateTimeProperty[this.keywordIndex]];
|
|
1099
|
+
blockEndContentControl.revDateTime = block[revDateTimeProperty[this.keywordIndex]];
|
|
1100
|
+
}
|
|
1101
|
+
if (block.hasOwnProperty(isInsertRevisionProperty[this.keywordIndex])) {
|
|
1102
|
+
blockStartContentControl.isInsertRevision = LayoutHelperMethods.parseBoolValue(block[isInsertRevisionProperty[this.keywordIndex]]);
|
|
1103
|
+
blockEndContentControl.isInsertRevision = LayoutHelperMethods.parseBoolValue(block[isInsertRevisionProperty[this.keywordIndex]]);
|
|
1104
|
+
}
|
|
1105
|
+
if (block.hasOwnProperty(isDeleteRevisionProperty[this.keywordIndex])) {
|
|
1106
|
+
blockStartContentControl.isDeleteRevision = LayoutHelperMethods.parseBoolValue(block[isDeleteRevisionProperty[this.keywordIndex]]);
|
|
1107
|
+
blockEndContentControl.isDeleteRevision = LayoutHelperMethods.parseBoolValue(block[isDeleteRevisionProperty[this.keywordIndex]]);
|
|
1108
|
+
}
|
|
1109
|
+
// Only the last block of the section can be the section break paragraph; a content control followed by other blocks cannot.
|
|
1110
|
+
this.parseBody(block[blocksProperty[this.keywordIndex]], blocks, container, isSectionBreak && i === data.length - 1, blockStartContentControl.contentControlProperties);
|
|
1111
|
+
for (var j = 0; j < 2; j++) {
|
|
1112
|
+
var para = (blocks.length < block[blocksProperty[this.keywordIndex]].length) ? blocks[0] : j === 0 ? blocks[blocks.length - block[blocksProperty[this.keywordIndex]].length] : blocks[blocks.length - 1];
|
|
1113
|
+
var blockWidget = void 0;
|
|
1114
|
+
if (para instanceof ParagraphWidget) {
|
|
1115
|
+
blockWidget = para;
|
|
1116
|
+
}
|
|
1117
|
+
else if (para instanceof TableWidget) {
|
|
1118
|
+
if (j === 0) {
|
|
1119
|
+
blockWidget = para.firstChild.firstChild.firstChild;
|
|
1120
|
+
}
|
|
1121
|
+
else {
|
|
1122
|
+
var cell = para.lastChild.lastChild;
|
|
1123
|
+
blockWidget = cell.lastChild;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
if (!isNullOrUndefined(blockWidget) && blockWidget.childWidgets.length === 0) {
|
|
1127
|
+
var lineWidget = new LineWidget(blockWidget);
|
|
1128
|
+
blockWidget.childWidgets.push(lineWidget);
|
|
1129
|
+
}
|
|
1130
|
+
if (j === 0 && !isNullOrUndefined(blockWidget) && !isNullOrUndefined(blockWidget.firstChild) && !isNullOrUndefined(blockWidget.firstChild.children)) {
|
|
1131
|
+
blockWidget.firstChild.children.splice(0, 0, blockStartContentControl);
|
|
1132
|
+
blockStartContentControl.line = blockWidget.firstChild;
|
|
1133
|
+
}
|
|
1134
|
+
else {
|
|
1135
|
+
if (!isNullOrUndefined(blockWidget) && !isNullOrUndefined(blockWidget.lastChild) && !isNullOrUndefined(blockWidget.lastChild.children)) {
|
|
1136
|
+
blockWidget.lastChild.children.push(blockEndContentControl);
|
|
1137
|
+
blockEndContentControl.line = blockWidget.lastChild;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
if (!isNullOrUndefined(contentControlProperties)) {
|
|
1143
|
+
blocks[blocks.length - 1].contentControlProperties = contentControlProperties;
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
SfdtReader.prototype.parseTable = function (block, blocks, index, section) {
|
|
1149
|
+
var table = new TableWidget();
|
|
1150
|
+
var hasSfdtColumnIndex = false;
|
|
1151
|
+
table.index = index;
|
|
1152
|
+
if (!isNullOrUndefined(block[tableFormatProperty[this.keywordIndex]])) {
|
|
1153
|
+
this.parseTableFormat(block[tableFormatProperty[this.keywordIndex]], table.tableFormat, this.keywordIndex);
|
|
1154
|
+
}
|
|
1155
|
+
table.tableFormat.title = block[titleProperty[this.keywordIndex]];
|
|
1156
|
+
table.tableFormat.description = block[descriptionProperty[this.keywordIndex]];
|
|
1157
|
+
this.parseTablePositioning(block, table);
|
|
1158
|
+
for (var i = 0; i < block[rowsProperty[this.keywordIndex]].length; i++) {
|
|
1159
|
+
var row = new TableRowWidget();
|
|
1160
|
+
row.rowFormat = new WRowFormat(row);
|
|
1161
|
+
var tableRow = block[rowsProperty[this.keywordIndex]][i];
|
|
1162
|
+
if (!isNullOrUndefined(tableRow[contentControlPropertiesProperty[this.keywordIndex]])) {
|
|
1163
|
+
row.contentControlProperties = new ContentControlProperties('Row');
|
|
1164
|
+
this.parseContentControlProperties(tableRow[contentControlPropertiesProperty[this.keywordIndex]], row.contentControlProperties);
|
|
1165
|
+
}
|
|
1166
|
+
if (tableRow.hasOwnProperty(rowFormatProperty[this.keywordIndex])) {
|
|
1167
|
+
this.parseRowFormat(tableRow[rowFormatProperty[this.keywordIndex]], row.rowFormat, this.keywordIndex);
|
|
1168
|
+
row.index = i;
|
|
1169
|
+
for (var j = 0; j < tableRow[cellsProperty[this.keywordIndex]].length; j++) {
|
|
1170
|
+
var cell = new TableCellWidget();
|
|
1171
|
+
cell.cellFormat = new WCellFormat(cell);
|
|
1172
|
+
var tableCell = tableRow[cellsProperty[this.keywordIndex]][j];
|
|
1173
|
+
if (!isNullOrUndefined(tableCell[contentControlPropertiesProperty[this.keywordIndex]])) {
|
|
1174
|
+
cell.contentControlProperties = new ContentControlProperties('Cell');
|
|
1175
|
+
this.parseContentControlProperties(tableCell[contentControlPropertiesProperty[this.keywordIndex]], cell.contentControlProperties);
|
|
1176
|
+
}
|
|
1177
|
+
row.childWidgets.push(cell);
|
|
1178
|
+
cell.containerWidget = row;
|
|
1179
|
+
cell.index = j;
|
|
1180
|
+
cell.rowIndex = i;
|
|
1181
|
+
if (tableCell.hasOwnProperty(columnIndexProperty[this.keywordIndex])
|
|
1182
|
+
&& !isNullOrUndefined(tableCell[columnIndexProperty[this.keywordIndex]])) {
|
|
1183
|
+
cell.columnIndex = tableCell[columnIndexProperty[this.keywordIndex]];
|
|
1184
|
+
hasSfdtColumnIndex = true;
|
|
1185
|
+
}
|
|
1186
|
+
else {
|
|
1187
|
+
cell.columnIndex = j;
|
|
1188
|
+
}
|
|
1189
|
+
if (tableCell.hasOwnProperty(cellFormatProperty[this.keywordIndex])) {
|
|
1190
|
+
this.parseCellFormat(tableCell[cellFormatProperty[this.keywordIndex]], cell.cellFormat, this.keywordIndex);
|
|
1191
|
+
}
|
|
1192
|
+
var item = tableCell[blocksProperty[this.keywordIndex]];
|
|
1193
|
+
for (var k = 0; k < item.length; k++) {
|
|
1194
|
+
if (item[k].hasOwnProperty([rowsProperty[this.keywordIndex]])) {
|
|
1195
|
+
table.isContainInsideTable = true;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
this.isPageBreakInsideTable = true;
|
|
1199
|
+
this.parseTextBody(tableCell[blocksProperty[this.keywordIndex]], cell, false);
|
|
1200
|
+
if (!isNullOrUndefined(cell.contentControlProperties)) {
|
|
1201
|
+
var cellStartContentControl = new ContentControl('Cell');
|
|
1202
|
+
var cellEndContentControl = new ContentControl('Cell');
|
|
1203
|
+
cellStartContentControl.contentControlProperties = cell.contentControlProperties;
|
|
1204
|
+
cellEndContentControl.contentControlProperties = cell.contentControlProperties;
|
|
1205
|
+
var cellContentControl = tableCell[cellContentControlProperty[this.keywordIndex]];
|
|
1206
|
+
if (cellContentControl && cellContentControl.hasOwnProperty(authorNameProperty[this.keywordIndex])) {
|
|
1207
|
+
cellStartContentControl.authorName = cellContentControl[authorNameProperty[this.keywordIndex]];
|
|
1208
|
+
cellEndContentControl.authorName = cellContentControl[authorNameProperty[this.keywordIndex]];
|
|
1209
|
+
}
|
|
1210
|
+
if (cellContentControl && cellContentControl.hasOwnProperty(revDateTimeProperty[this.keywordIndex])) {
|
|
1211
|
+
cellStartContentControl.revDateTime = cellContentControl[revDateTimeProperty[this.keywordIndex]];
|
|
1212
|
+
cellEndContentControl.revDateTime = cellContentControl[revDateTimeProperty[this.keywordIndex]];
|
|
1213
|
+
}
|
|
1214
|
+
if (cellContentControl && cellContentControl.hasOwnProperty(isInsertRevisionProperty[this.keywordIndex])) {
|
|
1215
|
+
cellStartContentControl.isInsertRevision = cellContentControl[isInsertRevisionProperty[this.keywordIndex]];
|
|
1216
|
+
cellEndContentControl.isInsertRevision = cellContentControl[isInsertRevisionProperty[this.keywordIndex]];
|
|
1217
|
+
}
|
|
1218
|
+
if (cellContentControl && cellContentControl.hasOwnProperty(isDeleteRevisionProperty[this.keywordIndex])) {
|
|
1219
|
+
cellStartContentControl.isDeleteRevision = cellContentControl[isDeleteRevisionProperty[this.keywordIndex]];
|
|
1220
|
+
cellEndContentControl.isDeleteRevision = cellContentControl[isDeleteRevisionProperty[this.keywordIndex]];
|
|
1221
|
+
}
|
|
1222
|
+
cellStartContentControl.type = 0;
|
|
1223
|
+
cellEndContentControl.type = 1;
|
|
1224
|
+
if (cell.firstChild.childWidgets.length === 0) {
|
|
1225
|
+
var lineWidget = new LineWidget(cell.firstChild);
|
|
1226
|
+
cell.firstChild.childWidgets.push(lineWidget);
|
|
1227
|
+
}
|
|
1228
|
+
cellStartContentControl.line = cell.firstChild.firstChild;
|
|
1229
|
+
cell.firstChild.firstChild.children.splice(0, 0, cellStartContentControl);
|
|
1230
|
+
if (cell.lastChild.childWidgets.length === 0) {
|
|
1231
|
+
var lineWidget = new LineWidget(cell.lastChild);
|
|
1232
|
+
cell.lastChild.childWidgets.push(lineWidget);
|
|
1233
|
+
}
|
|
1234
|
+
cellEndContentControl.line = cell.lastChild.lastChild;
|
|
1235
|
+
cell.lastChild.lastChild.children.push(cellEndContentControl);
|
|
1236
|
+
}
|
|
1237
|
+
if (!isNullOrUndefined(row.contentControlProperties)) {
|
|
1238
|
+
if (row.firstChild === cell) {
|
|
1239
|
+
var rowStartContentControl = new ContentControl('Row');
|
|
1240
|
+
rowStartContentControl.contentControlProperties = row.contentControlProperties;
|
|
1241
|
+
rowStartContentControl.type = 0;
|
|
1242
|
+
if (cell.firstChild.childWidgets.length === 0) {
|
|
1243
|
+
var lineWidget = new LineWidget(cell.firstChild);
|
|
1244
|
+
cell.firstChild.childWidgets.push(lineWidget);
|
|
1245
|
+
}
|
|
1246
|
+
rowStartContentControl.line = cell.firstChild.firstChild;
|
|
1247
|
+
cell.firstChild.firstChild.children.splice(0, 0, rowStartContentControl);
|
|
1248
|
+
}
|
|
1249
|
+
else if (row.lastChild === cell) {
|
|
1250
|
+
var rowEndContentControl = new ContentControl('Row');
|
|
1251
|
+
rowEndContentControl.contentControlProperties = row.contentControlProperties;
|
|
1252
|
+
rowEndContentControl.type = 1;
|
|
1253
|
+
if (cell.lastChild.childWidgets.length === 0) {
|
|
1254
|
+
var lineWidget = new LineWidget(cell.lastChild);
|
|
1255
|
+
cell.lastChild.childWidgets.push(lineWidget);
|
|
1256
|
+
}
|
|
1257
|
+
rowEndContentControl.line = cell.lastChild.lastChild;
|
|
1258
|
+
cell.lastChild.lastChild.children.push(rowEndContentControl);
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
this.isPageBreakInsideTable = false;
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
if (row.childWidgets.length > 0) {
|
|
1265
|
+
table.childWidgets.push(row);
|
|
1266
|
+
row.containerWidget = table;
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
table.containerWidget = section;
|
|
1270
|
+
if (table.childWidgets.length > 0) {
|
|
1271
|
+
blocks.push(table);
|
|
1272
|
+
}
|
|
1273
|
+
table.isGridUpdated = false;
|
|
1274
|
+
table.updateRowSpan();
|
|
1275
|
+
if (!hasSfdtColumnIndex) {
|
|
1276
|
+
table.assignCellColumnIndexes();
|
|
1277
|
+
}
|
|
1278
|
+
};
|
|
1279
|
+
SfdtReader.prototype.parseTablePositioning = function (block, table) {
|
|
1280
|
+
table.wrapTextAround = !isNullOrUndefined(block[wrapTextAroundProperty[this.keywordIndex]]) ? LayoutHelperMethods.parseBoolValue(block[wrapTextAroundProperty[this.keywordIndex]]) : false;
|
|
1281
|
+
if (table.wrapTextAround) {
|
|
1282
|
+
table.positioning = new TablePosition();
|
|
1283
|
+
table.positioning.allowOverlap = LayoutHelperMethods.parseBoolValue(block[positioningProperty[this.keywordIndex]][allowOverlapProperty[this.keywordIndex]]);
|
|
1284
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][distanceBottomProperty[this.keywordIndex]])) {
|
|
1285
|
+
table.positioning.distanceBottom = LayoutHelperMethods.convertPointToPixel(block[positioningProperty[this.keywordIndex]][distanceBottomProperty[this.keywordIndex]]);
|
|
1286
|
+
}
|
|
1287
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][distanceLeftProperty[this.keywordIndex]])) {
|
|
1288
|
+
table.positioning.distanceLeft = LayoutHelperMethods.convertPointToPixel(block[positioningProperty[this.keywordIndex]][distanceLeftProperty[this.keywordIndex]]);
|
|
1289
|
+
}
|
|
1290
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][distanceRightProperty[this.keywordIndex]])) {
|
|
1291
|
+
table.positioning.distanceRight = LayoutHelperMethods.convertPointToPixel(block[positioningProperty[this.keywordIndex]][distanceRightProperty[this.keywordIndex]]);
|
|
1292
|
+
}
|
|
1293
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][distanceTopProperty[this.keywordIndex]])) {
|
|
1294
|
+
table.positioning.distanceTop = LayoutHelperMethods.convertPointToPixel(block[positioningProperty[this.keywordIndex]][distanceTopProperty[this.keywordIndex]]);
|
|
1295
|
+
}
|
|
1296
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][verticalAlignmentProperty[this.keywordIndex]])) {
|
|
1297
|
+
table.positioning.verticalAlignment = this.getTableVerticalPosition(block[positioningProperty[this.keywordIndex]][verticalAlignmentProperty[this.keywordIndex]]);
|
|
1298
|
+
}
|
|
1299
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][verticalOriginProperty[this.keywordIndex]])) {
|
|
1300
|
+
table.positioning.verticalOrigin = this.getTableVerticalRelation(block[positioningProperty[this.keywordIndex]][verticalOriginProperty[this.keywordIndex]]);
|
|
1301
|
+
}
|
|
1302
|
+
table.positioning.verticalPosition = block[positioningProperty[this.keywordIndex]][verticalPositionProperty[this.keywordIndex]];
|
|
1303
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][horizontalAlignmentProperty[this.keywordIndex]])) {
|
|
1304
|
+
table.positioning.horizontalAlignment = this.getTableHorizontalPosition(block[positioningProperty[this.keywordIndex]][horizontalAlignmentProperty[this.keywordIndex]]);
|
|
1305
|
+
}
|
|
1306
|
+
if (!isNullOrUndefined(block[positioningProperty[this.keywordIndex]][horizontalOriginProperty[this.keywordIndex]])) {
|
|
1307
|
+
table.positioning.horizontalOrigin = this.getTableHorizontalRelation(block[positioningProperty[this.keywordIndex]][horizontalOriginProperty[this.keywordIndex]]);
|
|
1308
|
+
}
|
|
1309
|
+
table.positioning.horizontalPosition = block[positioningProperty[this.keywordIndex]][horizontalPositionProperty[this.keywordIndex]];
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
SfdtReader.prototype.parseRowGridValues = function (data, rowFormat, keyIndex) {
|
|
1313
|
+
if (!isNullOrUndefined(data[gridBeforeProperty[keyIndex]])) {
|
|
1314
|
+
rowFormat.gridBefore = data[gridBeforeProperty[keyIndex]];
|
|
1315
|
+
}
|
|
1316
|
+
if (!isNullOrUndefined(data[gridBeforeWidthProperty[keyIndex]])) {
|
|
1317
|
+
rowFormat.gridBeforeWidth = data[gridBeforeWidthProperty[keyIndex]];
|
|
1318
|
+
}
|
|
1319
|
+
if (!isNullOrUndefined(data[gridBeforeWidthTypeProperty[keyIndex]])) {
|
|
1320
|
+
rowFormat.gridBeforeWidthType = this.getWidthType(data[gridBeforeWidthTypeProperty[keyIndex]]);
|
|
1321
|
+
}
|
|
1322
|
+
if (!isNullOrUndefined(data[gridAfterProperty[keyIndex]])) {
|
|
1323
|
+
rowFormat.gridAfter = data[gridAfterProperty[keyIndex]];
|
|
1324
|
+
}
|
|
1325
|
+
if (!isNullOrUndefined(data[gridAfterWidthProperty[keyIndex]])) {
|
|
1326
|
+
rowFormat.gridAfterWidth = data[gridAfterWidthProperty[keyIndex]];
|
|
1327
|
+
}
|
|
1328
|
+
if (!isNullOrUndefined(data[gridAfterWidthTypeProperty[keyIndex]])) {
|
|
1329
|
+
rowFormat.gridAfterWidthType = this.getWidthType(data[gridAfterWidthTypeProperty[keyIndex]]);
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
/**
|
|
1333
|
+
* @private
|
|
1334
|
+
*/
|
|
1335
|
+
SfdtReader.prototype.parseContentControlProperties = function (wContentControlProperties, contentControlProperties, keywordIndex) {
|
|
1336
|
+
if (isNullOrUndefined(keywordIndex)) {
|
|
1337
|
+
keywordIndex = this.keywordIndex;
|
|
1338
|
+
}
|
|
1339
|
+
if (!isNullOrUndefined(wContentControlProperties[lockContentControlProperty[keywordIndex]])) {
|
|
1340
|
+
contentControlProperties.lockContentControl = LayoutHelperMethods.parseBoolValue(wContentControlProperties[lockContentControlProperty[keywordIndex]]);
|
|
1341
|
+
}
|
|
1342
|
+
if (!isNullOrUndefined(wContentControlProperties[lockContentsProperty[keywordIndex]])) {
|
|
1343
|
+
contentControlProperties.lockContents = LayoutHelperMethods.parseBoolValue(wContentControlProperties[lockContentsProperty[keywordIndex]]);
|
|
1344
|
+
}
|
|
1345
|
+
if (!isNullOrUndefined(wContentControlProperties[tagProperty[keywordIndex]])) {
|
|
1346
|
+
contentControlProperties.tag = wContentControlProperties[tagProperty[keywordIndex]];
|
|
1347
|
+
}
|
|
1348
|
+
else {
|
|
1349
|
+
//Updating for undo/redo content control properties
|
|
1350
|
+
contentControlProperties.tag = undefined;
|
|
1351
|
+
}
|
|
1352
|
+
if (!isNullOrUndefined(wContentControlProperties[colorProperty[keywordIndex]])) {
|
|
1353
|
+
contentControlProperties.color = wContentControlProperties[colorProperty[keywordIndex]];
|
|
1354
|
+
}
|
|
1355
|
+
if (!isNullOrUndefined(wContentControlProperties[titleProperty[keywordIndex]])) {
|
|
1356
|
+
contentControlProperties.title = wContentControlProperties[titleProperty[keywordIndex]];
|
|
1357
|
+
}
|
|
1358
|
+
else {
|
|
1359
|
+
//Updating for undo/redo content control properties
|
|
1360
|
+
contentControlProperties.title = undefined;
|
|
1361
|
+
}
|
|
1362
|
+
if (!isNullOrUndefined(wContentControlProperties[appearanceProperty[keywordIndex]])) {
|
|
1363
|
+
contentControlProperties.appearance = this.getContentControlAppearance(wContentControlProperties[appearanceProperty[keywordIndex]]);
|
|
1364
|
+
}
|
|
1365
|
+
if (!isNullOrUndefined(wContentControlProperties[typeProperty[keywordIndex]])) {
|
|
1366
|
+
contentControlProperties.type = this.getContentControlType(wContentControlProperties[typeProperty[keywordIndex]]);
|
|
1367
|
+
}
|
|
1368
|
+
if (!isNullOrUndefined(wContentControlProperties[hasPlaceHolderTextProperty[keywordIndex]])) {
|
|
1369
|
+
contentControlProperties.hasPlaceHolderText = LayoutHelperMethods.parseBoolValue(wContentControlProperties[hasPlaceHolderTextProperty[keywordIndex]]);
|
|
1370
|
+
}
|
|
1371
|
+
if (!isNullOrUndefined(wContentControlProperties[multiLineProperty[keywordIndex]])) {
|
|
1372
|
+
contentControlProperties.multiline = LayoutHelperMethods.parseBoolValue(wContentControlProperties[multiLineProperty[keywordIndex]]);
|
|
1373
|
+
}
|
|
1374
|
+
if (!isNullOrUndefined(wContentControlProperties[isTemporaryProperty[keywordIndex]])) {
|
|
1375
|
+
contentControlProperties.isTemporary = LayoutHelperMethods.parseBoolValue(wContentControlProperties[isTemporaryProperty[keywordIndex]]);
|
|
1376
|
+
}
|
|
1377
|
+
if (!isNullOrUndefined(wContentControlProperties[characterFormatProperty[keywordIndex]])) {
|
|
1378
|
+
this.parseCharacterFormat(keywordIndex, wContentControlProperties[characterFormatProperty[keywordIndex]], contentControlProperties.characterFormat);
|
|
1379
|
+
}
|
|
1380
|
+
if (contentControlProperties.type === 'CheckBox') {
|
|
1381
|
+
if (!isNullOrUndefined(wContentControlProperties[isCheckedProperty[keywordIndex]])) {
|
|
1382
|
+
contentControlProperties.isChecked = LayoutHelperMethods.parseBoolValue(wContentControlProperties[isCheckedProperty[keywordIndex]]);
|
|
1383
|
+
}
|
|
1384
|
+
if (!isNullOrUndefined(wContentControlProperties[uncheckedStateProperty[keywordIndex]])) {
|
|
1385
|
+
contentControlProperties.uncheckedState = new CheckBoxState();
|
|
1386
|
+
contentControlProperties.uncheckedState.font = wContentControlProperties[uncheckedStateProperty[keywordIndex]][fontProperty[keywordIndex]];
|
|
1387
|
+
contentControlProperties.uncheckedState.value = wContentControlProperties[uncheckedStateProperty[keywordIndex]][valueProperty[keywordIndex]];
|
|
1388
|
+
}
|
|
1389
|
+
if (!isNullOrUndefined(wContentControlProperties[checkedStateProperty[keywordIndex]])) {
|
|
1390
|
+
contentControlProperties.checkedState = new CheckBoxState();
|
|
1391
|
+
contentControlProperties.checkedState.font = wContentControlProperties[checkedStateProperty[keywordIndex]][fontProperty[keywordIndex]];
|
|
1392
|
+
contentControlProperties.checkedState.value = wContentControlProperties[checkedStateProperty[keywordIndex]][valueProperty[keywordIndex]];
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
else if (contentControlProperties.type === 'Date') {
|
|
1396
|
+
if (!isNullOrUndefined(wContentControlProperties[dateCalendarTypeProperty[keywordIndex]])) {
|
|
1397
|
+
contentControlProperties.dateCalendarType = this.getDateCalendarType(wContentControlProperties[dateCalendarTypeProperty[keywordIndex]]);
|
|
1398
|
+
}
|
|
1399
|
+
if (!isNullOrUndefined(wContentControlProperties[dateStorageFormatProperty[keywordIndex]])) {
|
|
1400
|
+
contentControlProperties.dateStorageFormat = this.getDateStorageFormat(wContentControlProperties[dateStorageFormatProperty[keywordIndex]]);
|
|
1401
|
+
}
|
|
1402
|
+
if (!isNullOrUndefined(wContentControlProperties[dateDisplayLocaleProperty[keywordIndex]])) {
|
|
1403
|
+
contentControlProperties.dateDisplayLocale = wContentControlProperties[dateDisplayLocaleProperty[keywordIndex]];
|
|
1404
|
+
}
|
|
1405
|
+
if (!isNullOrUndefined(wContentControlProperties[dateDisplayFormatProperty[keywordIndex]])) {
|
|
1406
|
+
contentControlProperties.dateDisplayFormat = wContentControlProperties[dateDisplayFormatProperty[keywordIndex]];
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
else if (contentControlProperties.type === 'ComboBox' || contentControlProperties.type === 'DropDownList') {
|
|
1410
|
+
if (!isNullOrUndefined(wContentControlProperties[contentControlListItemsProperty[keywordIndex]])) {
|
|
1411
|
+
//Updating for undo/redo content control properties
|
|
1412
|
+
contentControlProperties.contentControlListItems = [];
|
|
1413
|
+
for (var i = 0; i < wContentControlProperties[contentControlListItemsProperty[keywordIndex]].length; i++) {
|
|
1414
|
+
var contentControlListItem = new ContentControlListItems();
|
|
1415
|
+
contentControlListItem.displayText = wContentControlProperties[contentControlListItemsProperty[keywordIndex]][i][displayTextProperty[keywordIndex]];
|
|
1416
|
+
contentControlListItem.value = wContentControlProperties[contentControlListItemsProperty[keywordIndex]][i][valueProperty[keywordIndex]];
|
|
1417
|
+
contentControlProperties.contentControlListItems.push(contentControlListItem);
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
if (!isNullOrUndefined(wContentControlProperties[xmlMappingProperty[keywordIndex]])) {
|
|
1422
|
+
contentControlProperties.xmlMapping = new XmlMapping();
|
|
1423
|
+
contentControlProperties.xmlMapping.isMapped = LayoutHelperMethods.parseBoolValue(wContentControlProperties[xmlMappingProperty[keywordIndex]][isMappedProperty[keywordIndex]]);
|
|
1424
|
+
contentControlProperties.xmlMapping.isWordMl = LayoutHelperMethods.parseBoolValue(wContentControlProperties[xmlMappingProperty[keywordIndex]][isWordMlProperty[keywordIndex]]);
|
|
1425
|
+
if (!isNullOrUndefined(wContentControlProperties[xmlMappingProperty[keywordIndex]][prefixMappingProperty[keywordIndex]])) {
|
|
1426
|
+
contentControlProperties.xmlMapping.prefixMapping = wContentControlProperties[xmlMappingProperty[keywordIndex]][prefixMappingProperty[keywordIndex]];
|
|
1427
|
+
}
|
|
1428
|
+
contentControlProperties.xmlMapping.xPath = wContentControlProperties[xmlMappingProperty[keywordIndex]][xPathProperty[keywordIndex]];
|
|
1429
|
+
contentControlProperties.xmlMapping.storeItemId = wContentControlProperties[xmlMappingProperty[keywordIndex]][storeItemIdProperty[keywordIndex]];
|
|
1430
|
+
if (!isNullOrUndefined(wContentControlProperties[xmlMappingProperty[keywordIndex]][customXmlPartProperty[keywordIndex]])) {
|
|
1431
|
+
contentControlProperties.xmlMapping.customXmlPart = new CustomXmlPart();
|
|
1432
|
+
contentControlProperties.xmlMapping.customXmlPart.id = wContentControlProperties[xmlMappingProperty[keywordIndex]][customXmlPartProperty[keywordIndex]][idProperty[keywordIndex]];
|
|
1433
|
+
contentControlProperties.xmlMapping.customXmlPart.xml = wContentControlProperties[xmlMappingProperty[keywordIndex]][customXmlPartProperty[keywordIndex]][xmlProperty[keywordIndex]];
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
SfdtReader.prototype.parseSymbol = function (fieldCode, lineWidget) {
|
|
1438
|
+
var code = fieldCode.split(' ');
|
|
1439
|
+
var indexOf = code.indexOf('SYMBOL');
|
|
1440
|
+
if (indexOf !== -1) {
|
|
1441
|
+
var characterCode = code[indexOf + 1];
|
|
1442
|
+
var textElement = new TextElementBox();
|
|
1443
|
+
textElement.characterFormat = new WCharacterFormat(textElement, this.documentHelper);
|
|
1444
|
+
textElement.text = String.fromCharCode(parseInt(characterCode));
|
|
1445
|
+
var fontIndex = code.indexOf('\\f');
|
|
1446
|
+
if (fontIndex !== -1) {
|
|
1447
|
+
var fontName = "";
|
|
1448
|
+
for (var j = fontIndex + 1; j < code.length; j++) {
|
|
1449
|
+
if (code[j] === '\\s') {
|
|
1450
|
+
break;
|
|
1451
|
+
}
|
|
1452
|
+
fontName += code[j] + ' ';
|
|
1453
|
+
}
|
|
1454
|
+
if (fontName !== null) {
|
|
1455
|
+
fontName = fontName.replace(/"/g, '');
|
|
1456
|
+
fontName = fontName.trim();
|
|
1457
|
+
textElement.characterFormat.fontFamily = fontName;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
var sizeIndex = code.indexOf('\\s');
|
|
1461
|
+
if (sizeIndex !== -1) {
|
|
1462
|
+
textElement.characterFormat.fontSize = parseInt(code[sizeIndex + 1]);
|
|
1463
|
+
}
|
|
1464
|
+
textElement.line = lineWidget;
|
|
1465
|
+
lineWidget.children.push(textElement);
|
|
1466
|
+
}
|
|
1467
|
+
};
|
|
1468
|
+
/* eslint-disable */
|
|
1469
|
+
SfdtReader.prototype.parseParagraph = function (data, paragraph, writeInlineFormat, lineWidget, isFootnoteEndnote) {
|
|
1470
|
+
var isContentControl = false;
|
|
1471
|
+
if (isNullOrUndefined(lineWidget)) {
|
|
1472
|
+
lineWidget = new LineWidget(paragraph);
|
|
1473
|
+
}
|
|
1474
|
+
else {
|
|
1475
|
+
isContentControl = true;
|
|
1476
|
+
}
|
|
1477
|
+
var hasValidElmts = false;
|
|
1478
|
+
var revision;
|
|
1479
|
+
var trackChange = this.documentHelper.enableTrackChanges;
|
|
1480
|
+
var isCreateTextEleBox = false;
|
|
1481
|
+
var isCreateField = false;
|
|
1482
|
+
var fieldCode = undefined;
|
|
1483
|
+
for (var i = 0; i < data.length; i++) {
|
|
1484
|
+
var inline = data[i];
|
|
1485
|
+
isCreateTextEleBox = false;
|
|
1486
|
+
if (inline.hasOwnProperty([fieldTypeProperty[this.keywordIndex]])) {
|
|
1487
|
+
if (inline[fieldTypeProperty[this.keywordIndex]] === 2 && (i === data.length - 1 || !data[i + 1].hasOwnProperty(textProperty[this.keywordIndex]))) {
|
|
1488
|
+
this.hasFieldSeparator = true;
|
|
1489
|
+
}
|
|
1490
|
+
if (inline[fieldTypeProperty[this.keywordIndex]] === 1 && this.hasFieldSeparator) {
|
|
1491
|
+
isCreateTextEleBox = true;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
if (isCreateTextEleBox && this.documentHelper.isPageField) {
|
|
1495
|
+
var textElement = new FieldTextElementBox();
|
|
1496
|
+
textElement.characterFormat = new WCharacterFormat(textElement, this.documentHelper);
|
|
1497
|
+
textElement.text = "";
|
|
1498
|
+
textElement.line = lineWidget;
|
|
1499
|
+
lineWidget.children.push(textElement);
|
|
1500
|
+
this.hasFieldSeparator = false;
|
|
1501
|
+
hasValidElmts = true;
|
|
1502
|
+
i--;
|
|
1503
|
+
continue;
|
|
1504
|
+
}
|
|
1505
|
+
else if (isCreateTextEleBox && !isNullOrUndefined(fieldCode) && fieldCode.indexOf('SYMBOL') !== -1) {
|
|
1506
|
+
this.parseSymbol(fieldCode, lineWidget);
|
|
1507
|
+
fieldCode = undefined;
|
|
1508
|
+
isCreateTextEleBox = false;
|
|
1509
|
+
}
|
|
1510
|
+
if ((inline.hasOwnProperty(textProperty[this.keywordIndex]) || inline.hasOwnProperty(breakClearTypeProperty[this.keywordIndex])) && !(inline.hasOwnProperty(footnoteTypeProperty[this.keywordIndex]))) {
|
|
1511
|
+
var textElement = undefined;
|
|
1512
|
+
if (this.documentHelper.isPageField) {
|
|
1513
|
+
var currentFieldBegin = this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length - 1];
|
|
1514
|
+
var lastChild = lineWidget.children[lineWidget.children.length - 1];
|
|
1515
|
+
// In header/footer, a page field result split into multiple runs must produce a single result element, otherwise the page number is rendered once per run.
|
|
1516
|
+
if (this.isParseHeader && lastChild instanceof FieldTextElementBox && lastChild.fieldBegin === currentFieldBegin) {
|
|
1517
|
+
continue;
|
|
1518
|
+
}
|
|
1519
|
+
textElement = new FieldTextElementBox();
|
|
1520
|
+
textElement.fieldBegin = currentFieldBegin;
|
|
1521
|
+
}
|
|
1522
|
+
else if (inline[textProperty[this.keywordIndex]] === '\t') {
|
|
1523
|
+
textElement = new TabElementBox();
|
|
1524
|
+
}
|
|
1525
|
+
else if (inline[textProperty[this.keywordIndex]] === '\f' && this.isPageBreakInsideTable) {
|
|
1526
|
+
continue;
|
|
1527
|
+
}
|
|
1528
|
+
else {
|
|
1529
|
+
if (inline.hasOwnProperty(breakClearTypeProperty[this.keywordIndex])) {
|
|
1530
|
+
textElement = new BreakElementBox();
|
|
1531
|
+
textElement.breakClearType = this.getBreakClearType(inline[breakClearTypeProperty[this.keywordIndex]]);
|
|
1532
|
+
}
|
|
1533
|
+
else if (inline[textProperty[this.keywordIndex]] === '\u0002'
|
|
1534
|
+
|| (LayoutHelperMethods.checkTextFormat(inline[textProperty[this.keywordIndex]]) && lineWidget.children.length === 0 && i === 0 && isFootnoteEndnote)) {
|
|
1535
|
+
textElement = new FootnoteEndnoteMarkerElementBox();
|
|
1536
|
+
}
|
|
1537
|
+
else {
|
|
1538
|
+
textElement = new TextElementBox();
|
|
1539
|
+
if ((inline[textProperty[this.keywordIndex]]).length === 0 && !isNullOrUndefined(inline[revisionIdsProperty[this.keywordIndex]])) {
|
|
1540
|
+
continue;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
textElement.characterFormat = new WCharacterFormat(textElement, this.documentHelper);
|
|
1545
|
+
this.parseCharacterFormat(this.keywordIndex, inline[characterFormatProperty[this.keywordIndex]], textElement.characterFormat, writeInlineFormat);
|
|
1546
|
+
this.applyCharacterStyle(inline, textElement);
|
|
1547
|
+
textElement.text = textElement instanceof BreakElementBox ? "\v" : inline[textProperty[this.keywordIndex]].replace(/\n/g, ' ');
|
|
1548
|
+
fieldCode = textElement.text;
|
|
1549
|
+
if (this.isHtmlPaste && (textElement instanceof TextElementBox || textElement instanceof BreakElementBox)) {
|
|
1550
|
+
var previousElement = void 0;
|
|
1551
|
+
if (lineWidget.children.length > 0) {
|
|
1552
|
+
previousElement = lineWidget.children[lineWidget.children.length - 1];
|
|
1553
|
+
}
|
|
1554
|
+
// In html content, text bidi property is not present in the file level
|
|
1555
|
+
// Hence bidi property is false for RTL content
|
|
1556
|
+
// So, For html pasting we need to check and content and enable bidi to order the content similar to MS Word
|
|
1557
|
+
if (this.documentHelper.textHelper.isRTLText(textElement.text)) {
|
|
1558
|
+
textElement.characterFormat.bidi = true;
|
|
1559
|
+
if (previousElement instanceof TextElementBox && previousElement.text === ' ') {
|
|
1560
|
+
previousElement.characterFormat.bidi = true;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
//If previous element is RTL element, the we need to enable bidi for space character
|
|
1564
|
+
else if (textElement.text === ' ' && previousElement && previousElement.characterFormat.bidi) {
|
|
1565
|
+
textElement.characterFormat.bidi = true;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
textElement.line = lineWidget;
|
|
1569
|
+
// handling in case the previous element is bookmark with isAfterParagraph true
|
|
1570
|
+
var lineChildren = lineWidget.children;
|
|
1571
|
+
var lastIndex = lineChildren.length - 1;
|
|
1572
|
+
while (lineChildren.length > 0
|
|
1573
|
+
&& lineChildren[lastIndex] instanceof BookmarkElementBox
|
|
1574
|
+
&& !isNullOrUndefined(lineChildren[lastIndex].properties)
|
|
1575
|
+
&& lineChildren[lastIndex].properties['isAfterParagraphMark'] === true) {
|
|
1576
|
+
lastIndex--;
|
|
1577
|
+
}
|
|
1578
|
+
if (lastIndex !== lineChildren.length - 1) {
|
|
1579
|
+
lineChildren.splice(lastIndex + 1, 0, textElement);
|
|
1580
|
+
}
|
|
1581
|
+
else {
|
|
1582
|
+
lineChildren.push(textElement);
|
|
1583
|
+
}
|
|
1584
|
+
if (this.documentHelper.parser.isPaste && !(this.isCutPerformed)) {
|
|
1585
|
+
if (!isNullOrUndefined(inline[revisionIdsProperty[this.keywordIndex]])) {
|
|
1586
|
+
for (var j = 0; j < inline[revisionIdsProperty[this.keywordIndex]].length; j++) {
|
|
1587
|
+
if (this.revisionCollection.containsKey(inline[revisionIdsProperty[this.keywordIndex]][j])) {
|
|
1588
|
+
if (trackChange) {
|
|
1589
|
+
revision = this.revisionCollection.get(inline[revisionIdsProperty[this.keywordIndex]][j]);
|
|
1590
|
+
}
|
|
1591
|
+
if (!isNullOrUndefined(revision) && lineWidget.children.length > 1 && !isNullOrUndefined(lineWidget.children[i - 1].getRevision(j)) && ((!trackChange) || (trackChange && (revision.revisionType === 'Deletion')))) {
|
|
1592
|
+
if (revision.revisionID === inline[revisionIdsProperty[this.keywordIndex]][j]) {
|
|
1593
|
+
inline[revisionIdsProperty[this.keywordIndex]][j] = lineWidget.children[i - 1].getRevision(j).revisionID;
|
|
1594
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, textElement, paragraph);
|
|
1595
|
+
continue;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
if (!trackChange) {
|
|
1599
|
+
if (this.documentHelper.revisionsInternal.containsKey(inline[revisionIdsProperty[this.keywordIndex]][j])) {
|
|
1600
|
+
revision = this.documentHelper.revisionsInternal.get(inline[revisionIdsProperty[this.keywordIndex]][j]);
|
|
1601
|
+
}
|
|
1602
|
+
else {
|
|
1603
|
+
revision = this.revisionCollection.get(inline[revisionIdsProperty[this.keywordIndex]][j]);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
if (this.documentHelper.isEditorModule && this.documentHelper.editorProperties.isRemoteAction) {
|
|
1607
|
+
this.revisionHelper.insertRevision(textElement, revision.revisionType, revision.author, undefined, undefined, false, revision.revisionID);
|
|
1608
|
+
}
|
|
1609
|
+
else {
|
|
1610
|
+
this.revisionHelper.insertRevision(textElement, revision.revisionType, revision.author, undefined, undefined, false);
|
|
1611
|
+
}
|
|
1612
|
+
inline[revisionIdsProperty[this.keywordIndex]][j] = textElement.revisions[j].revisionID;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
if (this.documentHelper.textHelper.isRTLText(textElement.text)) {
|
|
1617
|
+
this.documentHelper.layout.isDocumentContainsRtl = true;
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
else {
|
|
1621
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, textElement, paragraph);
|
|
1622
|
+
}
|
|
1623
|
+
if (textElement instanceof TextElementBox && textElement.text.length > 90) {
|
|
1624
|
+
// Here, the text is split based on the maximum character length of 90.
|
|
1625
|
+
LayoutHelperMethods.splitWordByMaxLength(textElement, lineWidget, true);
|
|
1626
|
+
}
|
|
1627
|
+
hasValidElmts = true;
|
|
1628
|
+
}
|
|
1629
|
+
else if (inline.hasOwnProperty(footnoteTypeProperty[this.keywordIndex])) {
|
|
1630
|
+
var footnoteElement = new FootnoteElementBox();
|
|
1631
|
+
footnoteElement.line = lineWidget;
|
|
1632
|
+
footnoteElement.footnoteType = this.getFootnoteType(inline[footnoteTypeProperty[this.keywordIndex]]);
|
|
1633
|
+
if (footnoteElement.footnoteType === 'Footnote') {
|
|
1634
|
+
this.documentHelper.footnoteCollection.push(footnoteElement);
|
|
1635
|
+
}
|
|
1636
|
+
else {
|
|
1637
|
+
this.documentHelper.endnoteCollection.push(footnoteElement);
|
|
1638
|
+
}
|
|
1639
|
+
footnoteElement.symbolCode = inline[symbolCodeProperty[this.keywordIndex]];
|
|
1640
|
+
footnoteElement.symbolFontName = inline[symbolFontNameProperty[this.keywordIndex]];
|
|
1641
|
+
footnoteElement.customMarker = inline[customMarkerProperty[this.keywordIndex]];
|
|
1642
|
+
footnoteElement.characterFormat = new WCharacterFormat(footnoteElement, this.documentHelper);
|
|
1643
|
+
this.parseCharacterFormat(this.keywordIndex, inline[characterFormatProperty[this.keywordIndex]], footnoteElement.characterFormat, writeInlineFormat);
|
|
1644
|
+
this.applyCharacterStyle(inline, footnoteElement);
|
|
1645
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, footnoteElement, paragraph);
|
|
1646
|
+
this.parseBody(inline[blocksProperty[this.keywordIndex]], footnoteElement.bodyWidget.childWidgets, footnoteElement.bodyWidget, false, undefined, undefined, undefined, true);
|
|
1647
|
+
lineWidget.children.push(footnoteElement);
|
|
1648
|
+
hasValidElmts = true;
|
|
1649
|
+
}
|
|
1650
|
+
else if (inline.hasOwnProperty(chartTypeProperty[this.keywordIndex])) {
|
|
1651
|
+
// chartPreservation
|
|
1652
|
+
if (this.documentHelper.isEditorModule) {
|
|
1653
|
+
this.documentHelper.editorProperties.chartType = true;
|
|
1654
|
+
}
|
|
1655
|
+
this.parseChart(inline, lineWidget, false);
|
|
1656
|
+
hasValidElmts = true;
|
|
1657
|
+
}
|
|
1658
|
+
else if (inline.hasOwnProperty(imageStringProperty[this.keywordIndex])) {
|
|
1659
|
+
var image = new ImageElementBox(LayoutHelperMethods.parseBoolValue(inline[isInlineImageProperty[this.keywordIndex]]));
|
|
1660
|
+
image = this.parseImage(inline, lineWidget, false);
|
|
1661
|
+
if (this.getTextWrappingStyle(image.textWrappingStyle) !== 'Inline') {
|
|
1662
|
+
paragraph.floatingElements.push(image);
|
|
1663
|
+
}
|
|
1664
|
+
this.parseCharacterFormat(this.keywordIndex, inline[characterFormatProperty[this.keywordIndex]], image.characterFormat);
|
|
1665
|
+
hasValidElmts = true;
|
|
1666
|
+
}
|
|
1667
|
+
else if (inline.hasOwnProperty(hasFieldEndProperty[this.keywordIndex]) || (inline.hasOwnProperty(fieldTypeProperty[this.keywordIndex]) && inline[fieldTypeProperty[this.keywordIndex]] === 0)) {
|
|
1668
|
+
isCreateField = true;
|
|
1669
|
+
var fieldBegin = new FieldElementBox(0);
|
|
1670
|
+
this.parseCharacterFormat(this.keywordIndex, inline[characterFormatProperty[this.keywordIndex]], fieldBegin.characterFormat, writeInlineFormat);
|
|
1671
|
+
this.applyCharacterStyle(inline, fieldBegin);
|
|
1672
|
+
fieldBegin.fieldCodeType = inline.fieldCodeType;
|
|
1673
|
+
fieldBegin.hasFieldEnd = inline[hasFieldEndProperty[this.keywordIndex]];
|
|
1674
|
+
if (inline.hasOwnProperty(formFieldDataProperty[this.keywordIndex])) {
|
|
1675
|
+
var formFieldData = void 0;
|
|
1676
|
+
formFieldData = this.parseFormFieldData(this.keywordIndex, inline, formFieldData);
|
|
1677
|
+
fieldBegin.formFieldData = formFieldData;
|
|
1678
|
+
if (!this.isContextBasedPaste) {
|
|
1679
|
+
this.documentHelper.formFields.push(fieldBegin);
|
|
1680
|
+
}
|
|
1681
|
+
}
|
|
1682
|
+
this.documentHelper.fieldStacks.push(fieldBegin);
|
|
1683
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, fieldBegin, paragraph);
|
|
1684
|
+
fieldBegin.line = lineWidget;
|
|
1685
|
+
if (!this.isContextBasedPaste) {
|
|
1686
|
+
this.documentHelper.fields.push(fieldBegin);
|
|
1687
|
+
}
|
|
1688
|
+
lineWidget.children.push(fieldBegin);
|
|
1689
|
+
}
|
|
1690
|
+
else if (inline.hasOwnProperty([fieldTypeProperty[this.keywordIndex]])) {
|
|
1691
|
+
var field = undefined;
|
|
1692
|
+
if (inline[fieldTypeProperty[this.keywordIndex]] === 2 || (inline[fieldTypeProperty[this.keywordIndex]] === 1 && isCreateField)) {
|
|
1693
|
+
field = new FieldElementBox(2);
|
|
1694
|
+
this.parseCharacterFormat(this.keywordIndex, inline[characterFormatProperty[this.keywordIndex]], field.characterFormat, writeInlineFormat);
|
|
1695
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, field, paragraph);
|
|
1696
|
+
this.fieldSeparator = field;
|
|
1697
|
+
if (this.documentHelper.fieldStacks.length > 0) {
|
|
1698
|
+
field.fieldBegin = this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length - 1];
|
|
1699
|
+
field.fieldBegin.fieldSeparator = field;
|
|
1700
|
+
//finds the whether the field is page filed or not
|
|
1701
|
+
var lineWidgetCount = lineWidget.children.length;
|
|
1702
|
+
if (lineWidgetCount >= 2) {
|
|
1703
|
+
var fieldTextElement = this.containsFieldBegin(lineWidget);
|
|
1704
|
+
if (!isNullOrUndefined(fieldTextElement) && fieldTextElement instanceof TextElementBox && (fieldTextElement.text.match('PAGE') || fieldTextElement.text.match('page'))) {
|
|
1705
|
+
var textField = fieldTextElement.text.replace(/^\s+/g, '');
|
|
1706
|
+
if (!textField.startsWith('HYPERLINK')) {
|
|
1707
|
+
this.documentHelper.isPageField = true;
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
if (inline[fieldTypeProperty[this.keywordIndex]] === 1 && isCreateField) {
|
|
1713
|
+
i--;
|
|
1714
|
+
this.hasFieldSeparator = true;
|
|
1715
|
+
}
|
|
1716
|
+
isCreateField = false;
|
|
1717
|
+
}
|
|
1718
|
+
else if (inline[fieldTypeProperty[this.keywordIndex]] === 1) {
|
|
1719
|
+
field = new FieldElementBox(1);
|
|
1720
|
+
this.parseCharacterFormat(this.keywordIndex, inline[characterFormatProperty[this.keywordIndex]], field.characterFormat, writeInlineFormat);
|
|
1721
|
+
this.applyCharacterStyle(inline, field);
|
|
1722
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, field, paragraph);
|
|
1723
|
+
//For Field End Updated begin and separator.
|
|
1724
|
+
if (this.documentHelper.fieldStacks.length > 0) {
|
|
1725
|
+
field.fieldBegin = this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length - 1];
|
|
1726
|
+
field.fieldBegin.fieldEnd = field;
|
|
1727
|
+
}
|
|
1728
|
+
if (!isNullOrUndefined(field.fieldBegin) && field.fieldBegin.fieldSeparator) {
|
|
1729
|
+
field.fieldSeparator = field.fieldBegin.fieldSeparator;
|
|
1730
|
+
field.fieldBegin.fieldSeparator.fieldEnd = field;
|
|
1731
|
+
hasValidElmts = true;
|
|
1732
|
+
}
|
|
1733
|
+
//After setting all the property clear the field values
|
|
1734
|
+
this.documentHelper.fieldStacks.splice(this.documentHelper.fieldStacks.length - 1, 1);
|
|
1735
|
+
this.fieldSeparator = undefined;
|
|
1736
|
+
this.documentHelper.isPageField = false;
|
|
1737
|
+
if (!this.isContextBasedPaste) {
|
|
1738
|
+
this.documentHelper.fieldCollection.push(field.fieldBegin);
|
|
1739
|
+
}
|
|
1740
|
+
fieldCode = undefined;
|
|
1741
|
+
}
|
|
1742
|
+
field.line = lineWidget;
|
|
1743
|
+
lineWidget.children.push(field);
|
|
1744
|
+
}
|
|
1745
|
+
else if (inline.hasOwnProperty([bookmarkTypeProperty[this.keywordIndex]])) {
|
|
1746
|
+
var bookmark = undefined;
|
|
1747
|
+
bookmark = new BookmarkElementBox(inline[bookmarkTypeProperty[this.keywordIndex]]);
|
|
1748
|
+
bookmark.name = inline[nameProperty[this.keywordIndex]];
|
|
1749
|
+
if (!isNullOrUndefined(this.documentHelper) && !this.documentHelper.documentEditorSettings.allowHyphensInBookmarkNames) {
|
|
1750
|
+
var bookmarkName = bookmark.name.replace('-', '_');
|
|
1751
|
+
bookmark.name = bookmarkName;
|
|
1752
|
+
}
|
|
1753
|
+
bookmark.properties = inline[propertiesProperty[this.keywordIndex]];
|
|
1754
|
+
if (!isNullOrUndefined(inline[propertiesProperty[this.keywordIndex]])) {
|
|
1755
|
+
if (!isNullOrUndefined(inline[propertiesProperty[this.keywordIndex]][isAfterParagraphMarkProperty[this.keywordIndex]])) {
|
|
1756
|
+
bookmark.properties['isAfterParagraphMark'] = LayoutHelperMethods.parseBoolValue(inline[propertiesProperty[this.keywordIndex]][isAfterParagraphMarkProperty[this.keywordIndex]]);
|
|
1757
|
+
}
|
|
1758
|
+
if (!isNullOrUndefined(inline[propertiesProperty[this.keywordIndex]][isAfterTableMarkProperty[this.keywordIndex]])) {
|
|
1759
|
+
bookmark.properties['isAfterTableMark'] = LayoutHelperMethods.parseBoolValue(inline[propertiesProperty[this.keywordIndex]][isAfterTableMarkProperty[this.keywordIndex]]);
|
|
1760
|
+
}
|
|
1761
|
+
if (!isNullOrUndefined(inline[propertiesProperty[this.keywordIndex]][isAfterRowMarkProperty[this.keywordIndex]])) {
|
|
1762
|
+
bookmark.properties['isAfterRowMark'] = LayoutHelperMethods.parseBoolValue(inline[propertiesProperty[this.keywordIndex]][isAfterRowMarkProperty[this.keywordIndex]]);
|
|
1763
|
+
}
|
|
1764
|
+
if (!isNullOrUndefined(inline[propertiesProperty[this.keywordIndex]][isAfterCellMarkProperty[this.keywordIndex]])) {
|
|
1765
|
+
bookmark.properties['isAfterCellMark'] = LayoutHelperMethods.parseBoolValue(inline[propertiesProperty[this.keywordIndex]][isAfterCellMarkProperty[this.keywordIndex]]);
|
|
1766
|
+
}
|
|
1767
|
+
if (!isNullOrUndefined(inline[propertiesProperty[this.keywordIndex]][columnFirstProperty[this.keywordIndex]])) {
|
|
1768
|
+
bookmark.properties['columnFirst'] = inline[propertiesProperty[this.keywordIndex]][columnFirstProperty[this.keywordIndex]];
|
|
1769
|
+
}
|
|
1770
|
+
if (!isNullOrUndefined(inline[propertiesProperty[this.keywordIndex]][columnLastProperty[this.keywordIndex]])) {
|
|
1771
|
+
bookmark.properties['columnLast'] = inline[propertiesProperty[this.keywordIndex]][columnLastProperty[this.keywordIndex]];
|
|
1772
|
+
}
|
|
1773
|
+
}
|
|
1774
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, bookmark, paragraph);
|
|
1775
|
+
lineWidget.children.push(bookmark);
|
|
1776
|
+
bookmark.line = lineWidget;
|
|
1777
|
+
if (!this.isParseHeader || this.isPaste) {
|
|
1778
|
+
var isBookmarkSelected = false;
|
|
1779
|
+
if (this.isPaste) {
|
|
1780
|
+
// if bookmark start & end is selected and a bookmark with same name pasted, need to replace existing with pasted bookmark.
|
|
1781
|
+
var selectionBookmark = this.documentHelper.editorProperties.selectedBookmarks;
|
|
1782
|
+
isBookmarkSelected = selectionBookmark.indexOf(bookmark.name) !== -1;
|
|
1783
|
+
}
|
|
1784
|
+
if (inline[bookmarkTypeProperty[this.keywordIndex]] === 0) {
|
|
1785
|
+
var isAdd = this.isPaste && !this.documentHelper.bookmarks.containsKey(bookmark.name);
|
|
1786
|
+
if (!this.isPaste) {
|
|
1787
|
+
this.documentHelper.bookmarks.add(bookmark.name, bookmark);
|
|
1788
|
+
}
|
|
1789
|
+
else if (!isAdd && !isBookmarkSelected) {
|
|
1790
|
+
lineWidget.children.splice(lineWidget.children.indexOf(bookmark), 1);
|
|
1791
|
+
}
|
|
1792
|
+
}
|
|
1793
|
+
else if (inline[bookmarkTypeProperty[this.keywordIndex]] === 1) {
|
|
1794
|
+
if (this.documentHelper.bookmarks.containsKey(bookmark.name)) {
|
|
1795
|
+
var bookmarkStart = this.documentHelper.bookmarks.get(bookmark.name);
|
|
1796
|
+
var isConsider = this.isPaste && isNullOrUndefined(bookmarkStart.reference);
|
|
1797
|
+
if (!this.isPaste || (isConsider && !this.isContextBasedPaste)) {
|
|
1798
|
+
bookmarkStart.reference = bookmark;
|
|
1799
|
+
bookmark.reference = bookmarkStart;
|
|
1800
|
+
this.documentHelper.endBookmarksUpdated.push(bookmark.name);
|
|
1801
|
+
}
|
|
1802
|
+
else if (!isConsider && !isBookmarkSelected) {
|
|
1803
|
+
lineWidget.children.splice(lineWidget.children.indexOf(bookmark), 1);
|
|
1804
|
+
}
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
if (bookmark.name.indexOf('_') !== 0) {
|
|
1809
|
+
hasValidElmts = true;
|
|
1810
|
+
}
|
|
1811
|
+
}
|
|
1812
|
+
else if (inline.hasOwnProperty([editRangeIdProperty[this.keywordIndex]])) {
|
|
1813
|
+
if (inline.hasOwnProperty(editableRangeStartProperty[this.keywordIndex])) {
|
|
1814
|
+
var permEnd = new EditRangeEndElementBox();
|
|
1815
|
+
if (this.editableRanges.containsKey(inline[editRangeIdProperty[this.keywordIndex]])) {
|
|
1816
|
+
var start = this.editableRanges.get(inline[editRangeIdProperty[this.keywordIndex]]);
|
|
1817
|
+
permEnd.editRangeStart = start;
|
|
1818
|
+
start.editRangeEnd = permEnd;
|
|
1819
|
+
if (!isNullOrUndefined(inline[editRangeIdProperty[this.keywordIndex]])) {
|
|
1820
|
+
permEnd.editRangeId = inline[editRangeIdProperty[this.keywordIndex]];
|
|
1821
|
+
}
|
|
1822
|
+
this.editableRanges.remove(inline[editRangeIdProperty[this.keywordIndex]]);
|
|
1823
|
+
}
|
|
1824
|
+
lineWidget.children.push(permEnd);
|
|
1825
|
+
permEnd.line = lineWidget;
|
|
1826
|
+
}
|
|
1827
|
+
else {
|
|
1828
|
+
var permStart = this.parseEditableRangeStart(inline);
|
|
1829
|
+
lineWidget.children.push(permStart);
|
|
1830
|
+
permStart.line = lineWidget;
|
|
1831
|
+
if (!this.editableRanges.containsKey(inline[editRangeIdProperty[this.keywordIndex]])) {
|
|
1832
|
+
this.editableRanges.add(inline[editRangeIdProperty[this.keywordIndex]], permStart);
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
hasValidElmts = true;
|
|
1836
|
+
}
|
|
1837
|
+
else if (inline.hasOwnProperty([commentIdProperty[this.keywordIndex]]) && !this.isParseHeader) {
|
|
1838
|
+
var commentID = inline[commentIdProperty[this.keywordIndex]];
|
|
1839
|
+
var commentStart = undefined;
|
|
1840
|
+
var comment = void 0;
|
|
1841
|
+
if (this.commentStarts.containsKey(commentID)) {
|
|
1842
|
+
commentStart = this.commentStarts.get(commentID);
|
|
1843
|
+
}
|
|
1844
|
+
var commentEnd = undefined;
|
|
1845
|
+
if (this.commentEnds.containsKey(commentID)) {
|
|
1846
|
+
commentEnd = this.commentEnds.get(commentID);
|
|
1847
|
+
}
|
|
1848
|
+
if (inline.hasOwnProperty([commentCharacterTypeProperty[this.keywordIndex]])) {
|
|
1849
|
+
if (inline[commentCharacterTypeProperty[this.keywordIndex]] === 0) {
|
|
1850
|
+
var commentStartElement = new CommentCharacterElementBox(0);
|
|
1851
|
+
commentStartElement.commentId = commentID;
|
|
1852
|
+
if (!this.commentStarts.containsKey(commentID)) {
|
|
1853
|
+
this.commentStarts.add(commentID, commentStartElement);
|
|
1854
|
+
}
|
|
1855
|
+
commentStartElement.line = lineWidget;
|
|
1856
|
+
lineWidget.children.push(commentStartElement);
|
|
1857
|
+
comment = this.commentsCollection.get(commentID);
|
|
1858
|
+
if (!isNullOrUndefined(comment)) {
|
|
1859
|
+
comment.commentStart = commentStartElement;
|
|
1860
|
+
commentStartElement.comment = comment;
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
else {
|
|
1864
|
+
var commentEndElement = new CommentCharacterElementBox(1);
|
|
1865
|
+
commentEndElement.commentId = commentID;
|
|
1866
|
+
if (!this.commentEnds.containsKey(commentID)) {
|
|
1867
|
+
this.commentEnds.add(commentID, commentEndElement);
|
|
1868
|
+
}
|
|
1869
|
+
commentEndElement.line = lineWidget;
|
|
1870
|
+
lineWidget.children.push(commentEndElement);
|
|
1871
|
+
comment = this.commentsCollection.get(commentID);
|
|
1872
|
+
if (!isNullOrUndefined(comment)) {
|
|
1873
|
+
comment.commentEnd = commentEndElement;
|
|
1874
|
+
commentEndElement.comment = comment;
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
if (!isNullOrUndefined(comment) && comment.isReply) {
|
|
1878
|
+
if (isNullOrUndefined(comment.ownerComment.commentStart)) {
|
|
1879
|
+
comment.ownerComment.commentStart = comment.commentStart;
|
|
1880
|
+
}
|
|
1881
|
+
if (isNullOrUndefined(comment.ownerComment.commentEnd)) {
|
|
1882
|
+
comment.ownerComment.commentEnd = comment.commentEnd;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
else if (inline.hasOwnProperty([shapeIdProperty[this.keywordIndex]])) {
|
|
1888
|
+
var shape = this.parseShape(inline, lineWidget);
|
|
1889
|
+
shape.line = lineWidget;
|
|
1890
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, shape, paragraph);
|
|
1891
|
+
lineWidget.children.push(shape);
|
|
1892
|
+
paragraph.floatingElements.push(shape);
|
|
1893
|
+
}
|
|
1894
|
+
else if (inline.hasOwnProperty(contentControlPropertiesProperty[this.keywordIndex])) {
|
|
1895
|
+
var inlineStartContentControl = new ContentControl('Inline');
|
|
1896
|
+
var inlineEndContentControl = new ContentControl('Inline');
|
|
1897
|
+
this.parseContentControlProperties(inline[contentControlPropertiesProperty[this.keywordIndex]], inlineStartContentControl.contentControlProperties);
|
|
1898
|
+
inlineEndContentControl.contentControlProperties = inlineStartContentControl.contentControlProperties;
|
|
1899
|
+
inlineStartContentControl.line = lineWidget;
|
|
1900
|
+
inlineEndContentControl.line = lineWidget;
|
|
1901
|
+
inlineStartContentControl.type = 0;
|
|
1902
|
+
inlineEndContentControl.type = 1;
|
|
1903
|
+
if (inline.hasOwnProperty(authorNameProperty[this.keywordIndex])) {
|
|
1904
|
+
inlineStartContentControl.authorName = inline[authorNameProperty[this.keywordIndex]];
|
|
1905
|
+
inlineEndContentControl.authorName = inline[authorNameProperty[this.keywordIndex]];
|
|
1906
|
+
}
|
|
1907
|
+
if (inline.hasOwnProperty(revDateTimeProperty[this.keywordIndex])) {
|
|
1908
|
+
inlineStartContentControl.revDateTime = inline[revDateTimeProperty[this.keywordIndex]];
|
|
1909
|
+
inlineEndContentControl.revDateTime = inline[revDateTimeProperty[this.keywordIndex]];
|
|
1910
|
+
}
|
|
1911
|
+
if (inline.hasOwnProperty(isInsertRevisionProperty[this.keywordIndex])) {
|
|
1912
|
+
inlineStartContentControl.isInsertRevision = LayoutHelperMethods.parseBoolValue(inline[isInsertRevisionProperty[this.keywordIndex]]);
|
|
1913
|
+
inlineEndContentControl.isInsertRevision = LayoutHelperMethods.parseBoolValue(inline[isInsertRevisionProperty[this.keywordIndex]]);
|
|
1914
|
+
}
|
|
1915
|
+
if (inline.hasOwnProperty(isDeleteRevisionProperty[this.keywordIndex])) {
|
|
1916
|
+
inlineStartContentControl.isDeleteRevision = LayoutHelperMethods.parseBoolValue(inline[isDeleteRevisionProperty[this.keywordIndex]]);
|
|
1917
|
+
inlineEndContentControl.isDeleteRevision = LayoutHelperMethods.parseBoolValue(inline[isDeleteRevisionProperty[this.keywordIndex]]);
|
|
1918
|
+
}
|
|
1919
|
+
lineWidget.children.push(inlineStartContentControl);
|
|
1920
|
+
this.parseParagraph(inline[inlinesProperty[this.keywordIndex]], paragraph, writeInlineFormat, lineWidget);
|
|
1921
|
+
var element = lineWidget.children[lineWidget.children.length - 1];
|
|
1922
|
+
while (!(element instanceof ContentControl)) {
|
|
1923
|
+
element.contentControlProperties = inlineStartContentControl.contentControlProperties;
|
|
1924
|
+
element = element.previousElement;
|
|
1925
|
+
}
|
|
1926
|
+
lineWidget.children.push(inlineEndContentControl);
|
|
1927
|
+
hasValidElmts = true;
|
|
1928
|
+
}
|
|
1929
|
+
}
|
|
1930
|
+
this.isCutPerformed = false;
|
|
1931
|
+
if (!isContentControl) {
|
|
1932
|
+
paragraph.childWidgets.push(lineWidget);
|
|
1933
|
+
}
|
|
1934
|
+
return hasValidElmts;
|
|
1935
|
+
};
|
|
1936
|
+
SfdtReader.prototype.parseShape = function (inline, lineWidget) {
|
|
1937
|
+
var shape;
|
|
1938
|
+
if (inline.hasOwnProperty(imageStringProperty[this.keywordIndex])) {
|
|
1939
|
+
var imageShape = this.parseImage(inline, lineWidget, true);
|
|
1940
|
+
return imageShape;
|
|
1941
|
+
}
|
|
1942
|
+
else if (inline.hasOwnProperty(chartTypeProperty[this.keywordIndex])) {
|
|
1943
|
+
var chartShape = this.parseChart(inline, lineWidget, true);
|
|
1944
|
+
return chartShape;
|
|
1945
|
+
}
|
|
1946
|
+
else {
|
|
1947
|
+
if (inline[childShapeProperty[this.keywordIndex]]) {
|
|
1948
|
+
shape = new GroupShapeElementBox();
|
|
1949
|
+
}
|
|
1950
|
+
else {
|
|
1951
|
+
shape = new ShapeElementBox();
|
|
1952
|
+
}
|
|
1953
|
+
shape = this.ParseChildShape(inline, shape);
|
|
1954
|
+
}
|
|
1955
|
+
if (shape instanceof GroupShapeElementBox) {
|
|
1956
|
+
for (var i = 0; i < inline[childShapeProperty[this.keywordIndex]].length; i++) {
|
|
1957
|
+
var childInline = inline[childShapeProperty[this.keywordIndex]][i];
|
|
1958
|
+
var childShape = this.parseShape(childInline, lineWidget);
|
|
1959
|
+
childShape.line = lineWidget;
|
|
1960
|
+
childShape.containerShape = shape;
|
|
1961
|
+
if (!(childShape instanceof GroupShapeElementBox)) {
|
|
1962
|
+
childShape.shapeX = LayoutHelperMethods.convertPointToPixel(childInline['x']);
|
|
1963
|
+
childShape.shapeY = LayoutHelperMethods.convertPointToPixel(childInline['y']);
|
|
1964
|
+
childShape.shapeWidth = LayoutHelperMethods.convertPointToPixel(childInline[widthProperty[this.keywordIndex]]);
|
|
1965
|
+
childShape.shapeHeight = LayoutHelperMethods.convertPointToPixel(childInline[heightProperty[this.keywordIndex]]);
|
|
1966
|
+
}
|
|
1967
|
+
this.checkAndApplyRevision(this.keywordIndex, childInline, childShape, lineWidget.paragraph);
|
|
1968
|
+
shape.childWidgets.push(childShape);
|
|
1969
|
+
}
|
|
1970
|
+
shape.shapeX = LayoutHelperMethods.convertPointToPixel(inline['x']);
|
|
1971
|
+
shape.shapeY = LayoutHelperMethods.convertPointToPixel(inline['y']);
|
|
1972
|
+
shape.shapeWidth = LayoutHelperMethods.convertPointToPixel(inline[widthProperty[this.keywordIndex]]);
|
|
1973
|
+
shape.shapeHeight = LayoutHelperMethods.convertPointToPixel(inline[heightProperty[this.keywordIndex]]);
|
|
1974
|
+
shape.offsetXValue = LayoutHelperMethods.convertPointToPixel(inline[offsetXValue[this.keywordIndex]]);
|
|
1975
|
+
shape.offsetYValue = LayoutHelperMethods.convertPointToPixel(inline[offsetYValue[this.keywordIndex]]);
|
|
1976
|
+
shape.extentXValue = LayoutHelperMethods.convertPointToPixel(inline[extentXValue[this.keywordIndex]]);
|
|
1977
|
+
shape.extentYValue = LayoutHelperMethods.convertPointToPixel(inline[extentYValue[this.keywordIndex]]);
|
|
1978
|
+
shape.is2007Shape = LayoutHelperMethods.parseBoolValue(inline[is2007Shape[this.keywordIndex]]);
|
|
1979
|
+
shape.coordinateSize = inline[coordinateSize[this.keywordIndex]];
|
|
1980
|
+
shape.coordinateXOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateXOrigin[this.keywordIndex]]);
|
|
1981
|
+
shape.coordinateYOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateYOrigin[this.keywordIndex]]);
|
|
1982
|
+
shape.leftMargin = LayoutHelperMethods.convertPointToPixel(inline[leftMarginProperty[this.keywordIndex]]);
|
|
1983
|
+
shape.topMargin = LayoutHelperMethods.convertPointToPixel(inline[topMarginProperty[this.keywordIndex]]);
|
|
1984
|
+
}
|
|
1985
|
+
return shape;
|
|
1986
|
+
};
|
|
1987
|
+
SfdtReader.prototype.ParseChildShape = function (inline, shape) {
|
|
1988
|
+
shape.shapeId = inline[shapeIdProperty[this.keywordIndex]];
|
|
1989
|
+
shape.name = inline[nameProperty[this.keywordIndex]];
|
|
1990
|
+
shape.alternateText = inline[alternativeTextProperty[this.keywordIndex]];
|
|
1991
|
+
shape.title = inline[titleProperty[this.keywordIndex]];
|
|
1992
|
+
shape.visible = LayoutHelperMethods.parseBoolValue(inline[visibleProperty[this.keywordIndex]]);
|
|
1993
|
+
shape.width = LayoutHelperMethods.convertPointToPixel(inline[widthProperty[this.keywordIndex]]);
|
|
1994
|
+
shape.height = LayoutHelperMethods.convertPointToPixel(inline[heightProperty[this.keywordIndex]]);
|
|
1995
|
+
shape.is2007Shape = LayoutHelperMethods.parseBoolValue(inline[is2007Shape[this.keywordIndex]]);
|
|
1996
|
+
shape.coordinateSize = inline[coordinateSize[this.keywordIndex]];
|
|
1997
|
+
shape.coordinateXOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateXOrigin[this.keywordIndex]]);
|
|
1998
|
+
shape.coordinateYOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateYOrigin[this.keywordIndex]]);
|
|
1999
|
+
shape.leftMargin = LayoutHelperMethods.convertPointToPixel(inline[leftMarginProperty[this.keywordIndex]]);
|
|
2000
|
+
shape.topMargin = LayoutHelperMethods.convertPointToPixel(inline[topMarginProperty[this.keywordIndex]]);
|
|
2001
|
+
shape.lineFromXPosition = inline[lineFromXPosition[this.keywordIndex]];
|
|
2002
|
+
shape.lineFromYPosition = inline[lineFromYPosition[this.keywordIndex]];
|
|
2003
|
+
shape.lineToXPosition = inline[lineToXPosition[this.keywordIndex]];
|
|
2004
|
+
shape.lineToYPosition = inline[lineToYPosition[this.keywordIndex]];
|
|
2005
|
+
if (shape.height === 0) {
|
|
2006
|
+
shape.isZeroHeight = true;
|
|
2007
|
+
}
|
|
2008
|
+
shape.widthScale = inline[widthScaleProperty[this.keywordIndex]];
|
|
2009
|
+
shape.heightScale = inline[heightScaleProperty[this.keywordIndex]];
|
|
2010
|
+
shape.verticalPosition = LayoutHelperMethods.convertPointToPixel(inline[verticalPositionProperty[this.keywordIndex]]);
|
|
2011
|
+
shape.verticalOrigin = this.getVerticalOrigin(inline[verticalOriginProperty[this.keywordIndex]]);
|
|
2012
|
+
shape.verticalAlignment = this.getShapeVerticalAlignment(inline[verticalAlignmentProperty[this.keywordIndex]]);
|
|
2013
|
+
shape.verticalRelativePercent = inline[verticalRelativePercentProperty[this.keywordIndex]];
|
|
2014
|
+
shape.horizontalPosition = LayoutHelperMethods.convertPointToPixel(inline[horizontalPositionProperty[this.keywordIndex]]);
|
|
2015
|
+
shape.horizontalOrigin = this.getHorizontalOrigin(inline[horizontalOriginProperty[this.keywordIndex]]);
|
|
2016
|
+
shape.horizontalAlignment = this.getShapeHorizontalAlignment(inline[horizontalAlignmentProperty[this.keywordIndex]]);
|
|
2017
|
+
shape.horizontalRelativePercent = inline[horizontalRelativePercentProperty[this.keywordIndex]];
|
|
2018
|
+
shape.heightRelativePercent = inline[heightRelativePercentProperty[this.keywordIndex]];
|
|
2019
|
+
shape.widthRelativePercent = inline[widthRelativePercentProperty[this.keywordIndex]];
|
|
2020
|
+
shape.zOrderPosition = inline[zOrderPositionProperty[this.keywordIndex]];
|
|
2021
|
+
shape.allowOverlap = LayoutHelperMethods.parseBoolValue(inline[allowOverlapProperty[this.keywordIndex]]);
|
|
2022
|
+
shape.textWrappingStyle = this.getTextWrappingStyle(inline[textWrappingStyleProperty[this.keywordIndex]]);
|
|
2023
|
+
shape.textWrappingType = this.getTextWrappingType(inline[textWrappingTypeProperty[this.keywordIndex]]);
|
|
2024
|
+
shape.isBelowText = LayoutHelperMethods.parseBoolValue(inline[belowTextProperty[this.keywordIndex]]);
|
|
2025
|
+
shape.isHorizontalRule = LayoutHelperMethods.parseBoolValue(inline[horizontalRuleProperty[this.keywordIndex]]);
|
|
2026
|
+
if (!isNullOrUndefined(inline[distanceBottomProperty[this.keywordIndex]])) {
|
|
2027
|
+
shape.distanceBottom = LayoutHelperMethods.convertPointToPixel(inline[distanceBottomProperty[this.keywordIndex]]);
|
|
2028
|
+
}
|
|
2029
|
+
if (!isNullOrUndefined(inline[distanceLeftProperty[this.keywordIndex]])) {
|
|
2030
|
+
shape.distanceLeft = LayoutHelperMethods.convertPointToPixel(inline[distanceLeftProperty[this.keywordIndex]]);
|
|
2031
|
+
}
|
|
2032
|
+
if (!isNullOrUndefined(inline[distanceRightProperty[this.keywordIndex]])) {
|
|
2033
|
+
shape.distanceRight = LayoutHelperMethods.convertPointToPixel(inline[distanceRightProperty[this.keywordIndex]]);
|
|
2034
|
+
}
|
|
2035
|
+
if (!isNullOrUndefined(inline[distanceTopProperty[this.keywordIndex]])) {
|
|
2036
|
+
shape.distanceTop = LayoutHelperMethods.convertPointToPixel(inline[distanceTopProperty[this.keywordIndex]]);
|
|
2037
|
+
}
|
|
2038
|
+
shape.layoutInCell = LayoutHelperMethods.parseBoolValue(inline[layoutInCellProperty[this.keywordIndex]]);
|
|
2039
|
+
shape.lockAnchor = LayoutHelperMethods.parseBoolValue(inline[lockAnchorProperty[this.keywordIndex]]);
|
|
2040
|
+
shape.autoShapeType = this.getAutoShapeType(inline[autoShapeTypeProperty[this.keywordIndex]]);
|
|
2041
|
+
shape.editingPoints = inline[editingPointsProperty[this.keywordIndex]];
|
|
2042
|
+
if (inline.hasOwnProperty(lineFormatProperty[this.keywordIndex])) {
|
|
2043
|
+
var lineFormat = new LineFormat();
|
|
2044
|
+
lineFormat.line = LayoutHelperMethods.parseBoolValue(inline[lineFormatProperty[this.keywordIndex]][lineProperty[this.keywordIndex]]);
|
|
2045
|
+
lineFormat.lineFormatType = this.getLineFormatType(inline[lineFormatProperty[this.keywordIndex]][lineFormatTypeProperty[this.keywordIndex]]);
|
|
2046
|
+
lineFormat.color = inline[lineFormatProperty[this.keywordIndex]][colorProperty[this.keywordIndex]];
|
|
2047
|
+
lineFormat.weight = inline[lineFormatProperty[this.keywordIndex]][weightProperty[this.keywordIndex]];
|
|
2048
|
+
lineFormat.dashStyle = this.getLineDashStyle(inline[lineFormatProperty[this.keywordIndex]][lineStyleProperty[this.keywordIndex]]);
|
|
2049
|
+
shape.lineFormat = lineFormat;
|
|
2050
|
+
}
|
|
2051
|
+
if (inline.hasOwnProperty(fillFormatProperty[this.keywordIndex])) {
|
|
2052
|
+
var fillFormat = new FillFormat();
|
|
2053
|
+
fillFormat.color = inline[fillFormatProperty[this.keywordIndex]][colorProperty[this.keywordIndex]];
|
|
2054
|
+
fillFormat.fill = LayoutHelperMethods.parseBoolValue(inline[fillFormatProperty[this.keywordIndex]][fillProperty[this.keywordIndex]]);
|
|
2055
|
+
fillFormat.isDefaultFill = LayoutHelperMethods.parseBoolValue(inline[fillFormatProperty[this.keywordIndex]][isDefaultFillProperty[this.keywordIndex]]);
|
|
2056
|
+
fillFormat.foreColor = inline[fillFormatProperty[this.keywordIndex]][foreColorProperty[this.keywordIndex]];
|
|
2057
|
+
fillFormat.fillType = this.getFillType(inline[fillFormatProperty[this.keywordIndex]][fillTypeProperty[this.keywordIndex]]);
|
|
2058
|
+
shape.fillFormat = fillFormat;
|
|
2059
|
+
}
|
|
2060
|
+
if (shape instanceof ShapeElementBox && inline.hasOwnProperty(textFrameProperty[this.keywordIndex])) {
|
|
2061
|
+
var textFrame = new TextFrame();
|
|
2062
|
+
textFrame.textVerticalAlignment = this.getTextVerticalAlignment(inline[textFrameProperty[this.keywordIndex]][textVerticalAlignmentProperty[this.keywordIndex]]);
|
|
2063
|
+
textFrame.marginLeft = LayoutHelperMethods.convertPointToPixel(inline[textFrameProperty[this.keywordIndex]][leftMarginProperty[this.keywordIndex]]);
|
|
2064
|
+
textFrame.marginRight = LayoutHelperMethods.convertPointToPixel(inline[textFrameProperty[this.keywordIndex]][rightMarginProperty[this.keywordIndex]]);
|
|
2065
|
+
textFrame.marginTop = LayoutHelperMethods.convertPointToPixel(inline[textFrameProperty[this.keywordIndex]][topMarginProperty[this.keywordIndex]]);
|
|
2066
|
+
textFrame.marginBottom = LayoutHelperMethods.convertPointToPixel(inline[textFrameProperty[this.keywordIndex]][bottomMarginProperty[this.keywordIndex]]);
|
|
2067
|
+
if (inline[textFrameProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]].length == 0) {
|
|
2068
|
+
var block = { i: [] };
|
|
2069
|
+
inline[textFrameProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]].push(block);
|
|
2070
|
+
}
|
|
2071
|
+
this.parseBody(inline[textFrameProperty[this.keywordIndex]][blocksProperty[this.keywordIndex]], textFrame.childWidgets, textFrame);
|
|
2072
|
+
shape.textFrame = textFrame;
|
|
2073
|
+
textFrame.containerShape = shape;
|
|
2074
|
+
}
|
|
2075
|
+
return shape;
|
|
2076
|
+
};
|
|
2077
|
+
SfdtReader.prototype.parseImage = function (inline, lineWidget, isGroupShape) {
|
|
2078
|
+
var _this = this;
|
|
2079
|
+
var image = new ImageElementBox(LayoutHelperMethods.parseBoolValue(inline[isInlineImageProperty[this.keywordIndex]]));
|
|
2080
|
+
image.isMetaFile = LayoutHelperMethods.parseBoolValue(inline[isMetaFileProperty[this.keywordIndex]]);
|
|
2081
|
+
image.isCompressed = inline[isCompressedProperty[this.keywordIndex]];
|
|
2082
|
+
image.metaFileImageString = inline[metaFileImageStringProperty[this.keywordIndex]];
|
|
2083
|
+
image.characterFormat = new WCharacterFormat(image, this.documentHelper);
|
|
2084
|
+
image.line = lineWidget;
|
|
2085
|
+
if (!(isGroupShape)) {
|
|
2086
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, image, lineWidget.paragraph);
|
|
2087
|
+
lineWidget.children.push(image);
|
|
2088
|
+
}
|
|
2089
|
+
var imageString = LayoutHelperMethods.formatClippedString(inline[imageStringProperty[this.keywordIndex]]).formatClippedString;
|
|
2090
|
+
var isValidImage = this.validateImageUrl(imageString);
|
|
2091
|
+
if (!isValidImage) {
|
|
2092
|
+
image.imageString = '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';
|
|
2093
|
+
}
|
|
2094
|
+
else {
|
|
2095
|
+
if (this.isPaste && !isNullOrUndefined(this.documentHelper.editorProperties.pasteImageIndex)) {
|
|
2096
|
+
image.imageString = this.documentHelper.editorProperties.pasteImageIndex.get(inline[imageStringProperty[this.keywordIndex]]);
|
|
2097
|
+
if (!isNullOrUndefined(inline[metaFileImageStringProperty[this.keywordIndex]])) {
|
|
2098
|
+
image.metaFileImageString = this.documentHelper.editorProperties.pasteImageIndex.get(inline[metaFileImageStringProperty[this.keywordIndex]]);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
else {
|
|
2102
|
+
image.imageString = inline[imageStringProperty[this.keywordIndex]];
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
// Before 21.1 duplicate images are preserved as inline images with direct base64 string in the image string property. TO provide backward compatibility we are checking both the index based retrieval from images collections and inline image string.
|
|
2106
|
+
var imgStrValue = parseInt(inline[imageStringProperty[this.keywordIndex]]);
|
|
2107
|
+
if (imgStrValue.toString() === "NaN" ? true : false) {
|
|
2108
|
+
this.documentHelper.addBase64StringInCollection(image);
|
|
2109
|
+
}
|
|
2110
|
+
image.width = LayoutHelperMethods.convertPointToPixel(inline[widthProperty[this.keywordIndex]]);
|
|
2111
|
+
image.height = LayoutHelperMethods.convertPointToPixel(inline[heightProperty[this.keywordIndex]]);
|
|
2112
|
+
if (!this.isContextBasedPaste) {
|
|
2113
|
+
var imgStr = this.documentHelper.getImageString(image);
|
|
2114
|
+
if (!isNullOrUndefined(imgStr) && (LayoutHelperMethods.startsWith(imgStr, 'http://') || LayoutHelperMethods.startsWith(imgStr, 'https://'))) {
|
|
2115
|
+
// Generate fall back image for URL images.
|
|
2116
|
+
image.element.crossOrigin = 'Anonymous';
|
|
2117
|
+
this.viewer.documentHelper.getBase64(imgStr, image.width, image.height).then(function (imageUrlString) {
|
|
2118
|
+
_this.viewer.documentHelper.images.get(parseInt(image.imageString))[1] = imageUrlString;
|
|
2119
|
+
image.element.src = imageUrlString;
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
2122
|
+
image.element.src = imgStr;
|
|
2123
|
+
}
|
|
2124
|
+
image.top = inline[topProperty[this.keywordIndex]];
|
|
2125
|
+
image.left = inline[leftProperty[this.keywordIndex]];
|
|
2126
|
+
image.bottom = inline[bottomProperty[this.keywordIndex]];
|
|
2127
|
+
image.right = inline[rightProperty[this.keywordIndex]];
|
|
2128
|
+
image.cropHeightScale = inline[getImageHeightProperty[this.keywordIndex]];
|
|
2129
|
+
image.cropWidthScale = inline[getImageWidthProperty[this.keywordIndex]];
|
|
2130
|
+
image.name = inline[nameProperty[this.keywordIndex]];
|
|
2131
|
+
image.alternateText = inline[alternativeTextProperty[this.keywordIndex]];
|
|
2132
|
+
image.title = inline[titleProperty[this.keywordIndex]];
|
|
2133
|
+
image.visible = LayoutHelperMethods.parseBoolValue(inline[visibleProperty[this.keywordIndex]]);
|
|
2134
|
+
image.widthScale = inline[widthScaleProperty[this.keywordIndex]];
|
|
2135
|
+
image.heightScale = inline[heightScaleProperty[this.keywordIndex]];
|
|
2136
|
+
image.verticalPosition = LayoutHelperMethods.convertPointToPixel(inline[verticalPositionProperty[this.keywordIndex]]);
|
|
2137
|
+
image.verticalOrigin = this.getVerticalOrigin(inline[verticalOriginProperty[this.keywordIndex]]);
|
|
2138
|
+
image.verticalAlignment = this.getShapeVerticalAlignment(inline[verticalAlignmentProperty[this.keywordIndex]]);
|
|
2139
|
+
image.horizontalPosition = LayoutHelperMethods.convertPointToPixel(inline[horizontalPositionProperty[this.keywordIndex]]);
|
|
2140
|
+
image.horizontalOrigin = this.getHorizontalOrigin(inline[horizontalOriginProperty[this.keywordIndex]]);
|
|
2141
|
+
image.horizontalAlignment = this.getShapeHorizontalAlignment(inline[horizontalAlignmentProperty[this.keywordIndex]]);
|
|
2142
|
+
image.allowOverlap = LayoutHelperMethods.parseBoolValue(inline[allowOverlapProperty[this.keywordIndex]]);
|
|
2143
|
+
if (!isNullOrUndefined(inline[hasImageReferenceProperty[this.keywordIndex]])) {
|
|
2144
|
+
image.hasImageReference = LayoutHelperMethods.parseBoolValue(inline[hasImageReferenceProperty[this.keywordIndex]]);
|
|
2145
|
+
}
|
|
2146
|
+
if (!isNullOrUndefined(inline[textWrappingStyleProperty[this.keywordIndex]])) {
|
|
2147
|
+
image.textWrappingStyle = this.getTextWrappingStyle(inline[textWrappingStyleProperty[this.keywordIndex]]);
|
|
2148
|
+
}
|
|
2149
|
+
if (!isNullOrUndefined(inline[textWrappingTypeProperty[this.keywordIndex]])) {
|
|
2150
|
+
image.textWrappingType = this.getTextWrappingType(inline[textWrappingTypeProperty[this.keywordIndex]]);
|
|
2151
|
+
}
|
|
2152
|
+
image.isBelowText = LayoutHelperMethods.parseBoolValue(inline[belowTextProperty[this.keywordIndex]]);
|
|
2153
|
+
if (!isNullOrUndefined(inline[distanceBottomProperty[this.keywordIndex]])) {
|
|
2154
|
+
image.distanceBottom = LayoutHelperMethods.convertPointToPixel(inline[distanceBottomProperty[this.keywordIndex]]);
|
|
2155
|
+
}
|
|
2156
|
+
if (!isNullOrUndefined(inline[distanceLeftProperty[this.keywordIndex]])) {
|
|
2157
|
+
image.distanceLeft = LayoutHelperMethods.convertPointToPixel(inline[distanceLeftProperty[this.keywordIndex]]);
|
|
2158
|
+
}
|
|
2159
|
+
if (!isNullOrUndefined(inline[distanceRightProperty[this.keywordIndex]])) {
|
|
2160
|
+
image.distanceRight = LayoutHelperMethods.convertPointToPixel(inline[distanceRightProperty[this.keywordIndex]]);
|
|
2161
|
+
}
|
|
2162
|
+
if (!isNullOrUndefined(inline[distanceTopProperty[this.keywordIndex]])) {
|
|
2163
|
+
image.distanceTop = LayoutHelperMethods.convertPointToPixel(inline[distanceTopProperty[this.keywordIndex]]);
|
|
2164
|
+
}
|
|
2165
|
+
image.is2007Shape = LayoutHelperMethods.parseBoolValue(inline[is2007Shape[this.keywordIndex]]);
|
|
2166
|
+
image.coordinateSize = inline[coordinateSize[this.keywordIndex]];
|
|
2167
|
+
image.coordinateXOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateXOrigin[this.keywordIndex]]);
|
|
2168
|
+
image.coordinateYOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateYOrigin[this.keywordIndex]]);
|
|
2169
|
+
image.leftMargin = LayoutHelperMethods.convertPointToPixel(inline[leftMarginProperty[this.keywordIndex]]);
|
|
2170
|
+
image.topMargin = LayoutHelperMethods.convertPointToPixel(inline[topMarginProperty[this.keywordIndex]]);
|
|
2171
|
+
image.lineFromXPosition = inline[lineFromXPosition[this.keywordIndex]];
|
|
2172
|
+
image.lineFromYPosition = inline[lineFromYPosition[this.keywordIndex]];
|
|
2173
|
+
image.lineToXPosition = inline[lineToXPosition[this.keywordIndex]];
|
|
2174
|
+
image.lineToYPosition = inline[lineToYPosition[this.keywordIndex]];
|
|
2175
|
+
image.zOrderPosition = inline[zOrderPositionProperty[this.keywordIndex]];
|
|
2176
|
+
image.layoutInCell = LayoutHelperMethods.parseBoolValue(inline[layoutInCellProperty[this.keywordIndex]]);
|
|
2177
|
+
image.is2007Shape = LayoutHelperMethods.parseBoolValue(inline[is2007Shape[this.keywordIndex]]);
|
|
2178
|
+
image.coordinateSize = inline[coordinateSize[this.keywordIndex]];
|
|
2179
|
+
image.coordinateXOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateXOrigin[this.keywordIndex]]);
|
|
2180
|
+
image.coordinateYOrigin = LayoutHelperMethods.convertPointToPixel(inline[coordinateYOrigin[this.keywordIndex]]);
|
|
2181
|
+
image.leftMargin = LayoutHelperMethods.convertPointToPixel(inline[leftMarginProperty[this.keywordIndex]]);
|
|
2182
|
+
image.topMargin = LayoutHelperMethods.convertPointToPixel(inline[topMarginProperty[this.keywordIndex]]);
|
|
2183
|
+
image.lineFromXPosition = inline[lineFromXPosition[this.keywordIndex]];
|
|
2184
|
+
image.lineFromYPosition = inline[lineFromYPosition[this.keywordIndex]];
|
|
2185
|
+
image.lineToXPosition = inline[lineToXPosition[this.keywordIndex]];
|
|
2186
|
+
image.lineToYPosition = inline[lineToYPosition[this.keywordIndex]];
|
|
2187
|
+
if (!isNullOrUndefined(inline[topProperty[this.keywordIndex]]) && inline[topProperty[this.keywordIndex]] !== 0 ||
|
|
2188
|
+
!isNullOrUndefined(inline[bottomProperty[this.keywordIndex]]) && inline[bottomProperty[this.keywordIndex]] !== 0 ||
|
|
2189
|
+
!isNullOrUndefined(inline[leftProperty[this.keywordIndex]]) && inline[leftProperty[this.keywordIndex]] !== 0 ||
|
|
2190
|
+
!isNullOrUndefined(inline[rightProperty[this.keywordIndex]]) && inline[rightProperty[this.keywordIndex]] !== 0) {
|
|
2191
|
+
image.isCrop = true;
|
|
2192
|
+
}
|
|
2193
|
+
return image;
|
|
2194
|
+
};
|
|
2195
|
+
SfdtReader.prototype.parseChart = function (inline, linewidget, isGroupShape) {
|
|
2196
|
+
var chartElement = new ChartElementBox();
|
|
2197
|
+
chartElement.line = linewidget;
|
|
2198
|
+
if (!isGroupShape) {
|
|
2199
|
+
this.checkAndApplyRevision(this.keywordIndex, inline, chartElement, linewidget.paragraph);
|
|
2200
|
+
linewidget.children.push(chartElement);
|
|
2201
|
+
}
|
|
2202
|
+
chartElement.title = inline[chartTitleProperty[this.keywordIndex]];
|
|
2203
|
+
chartElement.type = inline[chartTypeProperty[this.keywordIndex]];
|
|
2204
|
+
chartElement.chartGapWidth = inline[gapWidthProperty[this.keywordIndex]];
|
|
2205
|
+
chartElement.chartOverlap = inline[overlapProperty[this.keywordIndex]];
|
|
2206
|
+
this.parseChartTitleArea(inline[chartTitleAreaProperty[this.keywordIndex]], chartElement.chartTitleArea);
|
|
2207
|
+
this.parseChartArea(inline[chartAreaProperty[this.keywordIndex]], chartElement.chartArea);
|
|
2208
|
+
this.parseChartArea(inline[plotAreaProperty[this.keywordIndex]], chartElement.chartPlotArea);
|
|
2209
|
+
this.parseChartLegend(inline[chartLegendProperty[this.keywordIndex]], chartElement.chartLegend);
|
|
2210
|
+
this.parseChartData(inline, chartElement);
|
|
2211
|
+
this.parseChartCategoryAxis(inline[chartPrimaryCategoryAxisProperty[this.keywordIndex]], chartElement.chartPrimaryCategoryAxis);
|
|
2212
|
+
this.parseChartCategoryAxis(inline[chartPrimaryValueAxisProperty[this.keywordIndex]], chartElement.chartPrimaryValueAxis);
|
|
2213
|
+
if (inline[chartDataTableProperty[this.keywordIndex]] != null) {
|
|
2214
|
+
this.parseChartDataTable(inline[chartDataTableProperty[this.keywordIndex]], chartElement.chartDataTable);
|
|
2215
|
+
}
|
|
2216
|
+
chartElement.height = LayoutHelperMethods.convertPointToPixel(inline[heightProperty[this.keywordIndex]]);
|
|
2217
|
+
chartElement.width = LayoutHelperMethods.convertPointToPixel(inline[widthProperty[this.keywordIndex]]);
|
|
2218
|
+
var officeChart = new ChartComponent();
|
|
2219
|
+
officeChart.chartRender(inline, this.keywordIndex);
|
|
2220
|
+
chartElement.officeChart = officeChart;
|
|
2221
|
+
officeChart.chart.appendTo(chartElement.targetElement);
|
|
2222
|
+
return chartElement;
|
|
2223
|
+
};
|
|
2224
|
+
/**
|
|
2225
|
+
* @private
|
|
2226
|
+
*/
|
|
2227
|
+
SfdtReader.prototype.parseFormFieldData = function (keywordIndex, sourceData, formFieldData) {
|
|
2228
|
+
if (formFieldData instanceof TextFormField || formFieldData instanceof CheckBoxFormField || formFieldData instanceof DropDownFormField) {
|
|
2229
|
+
if (formFieldData instanceof CheckBoxFormField) {
|
|
2230
|
+
formFieldData.sizeType = sourceData.sizeType;
|
|
2231
|
+
formFieldData.size = sourceData.size;
|
|
2232
|
+
formFieldData.defaultValue = sourceData.defaultValue;
|
|
2233
|
+
formFieldData.checked = sourceData.checked;
|
|
2234
|
+
}
|
|
2235
|
+
else if (formFieldData instanceof TextFormField) {
|
|
2236
|
+
formFieldData.type = sourceData.type;
|
|
2237
|
+
formFieldData.maxLength = sourceData.maxLength;
|
|
2238
|
+
formFieldData.defaultValue = sourceData.defaultValue;
|
|
2239
|
+
formFieldData.format = sourceData.format;
|
|
2240
|
+
}
|
|
2241
|
+
else {
|
|
2242
|
+
formFieldData.dropdownItems = sourceData.dropdownItems;
|
|
2243
|
+
formFieldData.selectedIndex = sourceData.selectedIndex;
|
|
2244
|
+
}
|
|
2245
|
+
formFieldData.name = sourceData.name;
|
|
2246
|
+
formFieldData.enabled = sourceData.enabled;
|
|
2247
|
+
formFieldData.helpText = sourceData.helpText;
|
|
2248
|
+
formFieldData.statusText = sourceData.statusText;
|
|
2249
|
+
}
|
|
2250
|
+
else {
|
|
2251
|
+
if (sourceData[formFieldDataProperty[keywordIndex]].hasOwnProperty(textInputProperty[keywordIndex])) {
|
|
2252
|
+
formFieldData = new TextFormField();
|
|
2253
|
+
formFieldData.type = this.getTextFormFieldType(sourceData[formFieldDataProperty[keywordIndex]][textInputProperty[keywordIndex]][typeProperty[keywordIndex]]);
|
|
2254
|
+
formFieldData.maxLength = sourceData[formFieldDataProperty[keywordIndex]][textInputProperty[keywordIndex]][maxLengthProperty[keywordIndex]];
|
|
2255
|
+
formFieldData.defaultValue = sourceData[formFieldDataProperty[keywordIndex]][textInputProperty[keywordIndex]][defaultValueProperty[keywordIndex]];
|
|
2256
|
+
formFieldData.format = this.getTextFormFieldFormat(sourceData[formFieldDataProperty[keywordIndex]][textInputProperty[keywordIndex]][formatProperty[keywordIndex]]);
|
|
2257
|
+
}
|
|
2258
|
+
else if (sourceData[formFieldDataProperty[keywordIndex]].hasOwnProperty(checkBoxProperty[keywordIndex])) {
|
|
2259
|
+
formFieldData = new CheckBoxFormField();
|
|
2260
|
+
formFieldData.sizeType = this.getCheckBoxSizeType(sourceData[formFieldDataProperty[keywordIndex]][checkBoxProperty[keywordIndex]][sizeTypeProperty[keywordIndex]]);
|
|
2261
|
+
formFieldData.size = sourceData[formFieldDataProperty[keywordIndex]][checkBoxProperty[keywordIndex]][sizeProperty[keywordIndex]];
|
|
2262
|
+
formFieldData.defaultValue = LayoutHelperMethods.parseBoolValue(sourceData[formFieldDataProperty[keywordIndex]][checkBoxProperty[keywordIndex]][defaultValueProperty[keywordIndex]]);
|
|
2263
|
+
formFieldData.checked = LayoutHelperMethods.parseBoolValue(sourceData[formFieldDataProperty[keywordIndex]][checkBoxProperty[keywordIndex]][checkedProperty[keywordIndex]]);
|
|
2264
|
+
}
|
|
2265
|
+
else {
|
|
2266
|
+
formFieldData = new DropDownFormField();
|
|
2267
|
+
var sourceItems = sourceData[formFieldDataProperty[keywordIndex]][dropDownListProperty[keywordIndex]][dropDownItemsProperty[keywordIndex]];
|
|
2268
|
+
for (var i = 0; i < sourceItems.length; i++) {
|
|
2269
|
+
if (formFieldData.dropdownItems.length > 24) {
|
|
2270
|
+
break;
|
|
2271
|
+
}
|
|
2272
|
+
formFieldData.dropdownItems.push(sourceItems[i]);
|
|
2273
|
+
}
|
|
2274
|
+
var value = sourceData[formFieldDataProperty[keywordIndex]][dropDownListProperty[keywordIndex]][selectedIndexProperty[keywordIndex]];
|
|
2275
|
+
if (typeof value === 'string' && sourceItems.indexOf(value) !== -1) {
|
|
2276
|
+
formFieldData.selectedIndex = sourceItems.indexOf(value);
|
|
2277
|
+
}
|
|
2278
|
+
else if (value >= 0 && value < formFieldData.dropdownItems.length) {
|
|
2279
|
+
formFieldData.selectedIndex = value;
|
|
2280
|
+
}
|
|
2281
|
+
else {
|
|
2282
|
+
formFieldData.selectedIndex = 0;
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
formFieldData.name = sourceData[formFieldDataProperty[keywordIndex]][nameProperty[keywordIndex]];
|
|
2286
|
+
formFieldData.enabled = LayoutHelperMethods.parseBoolValue(sourceData[formFieldDataProperty[keywordIndex]][enabledProperty[keywordIndex]]);
|
|
2287
|
+
formFieldData.helpText = sourceData[formFieldDataProperty[keywordIndex]][helpTextProperty[keywordIndex]];
|
|
2288
|
+
formFieldData.statusText = sourceData[formFieldDataProperty[keywordIndex]][statusTextProperty[keywordIndex]];
|
|
2289
|
+
}
|
|
2290
|
+
return formFieldData;
|
|
2291
|
+
};
|
|
2292
|
+
SfdtReader.prototype.applyCharacterStyle = function (inline, elementbox) {
|
|
2293
|
+
if (!isNullOrUndefined(inline[characterFormatProperty[this.keywordIndex]]) && !isNullOrUndefined(inline[characterFormatProperty[this.keywordIndex]][styleNameProperty[this.keywordIndex]])) {
|
|
2294
|
+
var charStyle = this.documentHelper.styles.findByName(inline[characterFormatProperty[this.keywordIndex]][styleNameProperty[this.keywordIndex]], 'Character');
|
|
2295
|
+
elementbox.characterFormat.applyStyle(charStyle);
|
|
2296
|
+
}
|
|
2297
|
+
};
|
|
2298
|
+
SfdtReader.prototype.parseEditableRangeStart = function (data) {
|
|
2299
|
+
var permStart = new EditRangeStartElementBox();
|
|
2300
|
+
if (!isNullOrUndefined(data[columnFirstProperty[this.keywordIndex]])) {
|
|
2301
|
+
permStart.columnFirst = data[columnFirstProperty[this.keywordIndex]];
|
|
2302
|
+
}
|
|
2303
|
+
if (!isNullOrUndefined(data[columnLastProperty[this.keywordIndex]])) {
|
|
2304
|
+
permStart.columnLast = data[columnLastProperty[this.keywordIndex]];
|
|
2305
|
+
}
|
|
2306
|
+
if (!isNullOrUndefined(data[editRangeIdProperty[this.keywordIndex]])) {
|
|
2307
|
+
permStart.editRangeId = data[editRangeIdProperty[this.keywordIndex]];
|
|
2308
|
+
}
|
|
2309
|
+
var userName = !isNullOrUndefined(data[userProperty[this.keywordIndex]]) ? data[userProperty[this.keywordIndex]] : '';
|
|
2310
|
+
var groupName = !isNullOrUndefined(data[groupProperty[this.keywordIndex]])
|
|
2311
|
+
? data[groupProperty[this.keywordIndex]] : '';
|
|
2312
|
+
if (groupName === 'everyone') {
|
|
2313
|
+
groupName = 'Everyone';
|
|
2314
|
+
}
|
|
2315
|
+
if (userName !== '') {
|
|
2316
|
+
permStart.user = userName;
|
|
2317
|
+
if (this.documentHelper.userCollection.indexOf(permStart.user) === -1) {
|
|
2318
|
+
this.documentHelper.userCollection.push(permStart.user);
|
|
2319
|
+
}
|
|
2320
|
+
this.addEditRangeCollection(permStart.user, permStart);
|
|
2321
|
+
}
|
|
2322
|
+
if (groupName !== '') {
|
|
2323
|
+
permStart.group = groupName;
|
|
2324
|
+
if (this.documentHelper.userCollection.indexOf(permStart.group) === -1) {
|
|
2325
|
+
this.documentHelper.userCollection.push(permStart.group);
|
|
2326
|
+
}
|
|
2327
|
+
this.addEditRangeCollection(permStart.group, permStart);
|
|
2328
|
+
}
|
|
2329
|
+
if (userName === '' && groupName === '') {
|
|
2330
|
+
permStart.group = 'Everyone';
|
|
2331
|
+
if (this.documentHelper.userCollection.indexOf('Everyone') === -1) {
|
|
2332
|
+
this.documentHelper.userCollection.push('Everyone');
|
|
2333
|
+
}
|
|
2334
|
+
this.addEditRangeCollection('Everyone', permStart);
|
|
2335
|
+
}
|
|
2336
|
+
return permStart;
|
|
2337
|
+
};
|
|
2338
|
+
SfdtReader.prototype.addEditRangeCollection = function (name, permStart) {
|
|
2339
|
+
if (this.documentHelper.editRanges.containsKey(name)) {
|
|
2340
|
+
var editStartCollection = this.documentHelper.editRanges.get(name);
|
|
2341
|
+
editStartCollection.push(permStart);
|
|
2342
|
+
}
|
|
2343
|
+
else {
|
|
2344
|
+
var newEditStartCollection = [];
|
|
2345
|
+
newEditStartCollection.push(permStart);
|
|
2346
|
+
this.documentHelper.editRanges.add(name, newEditStartCollection);
|
|
2347
|
+
}
|
|
2348
|
+
};
|
|
2349
|
+
SfdtReader.prototype.parseChartTitleArea = function (titleArea, chartTitleArea) {
|
|
2350
|
+
chartTitleArea.chartfontName = titleArea[fontNameProperty[this.keywordIndex]];
|
|
2351
|
+
chartTitleArea.chartFontSize = titleArea[fontSizeProperty[this.keywordIndex]];
|
|
2352
|
+
this.parseChartDataFormat(titleArea[dataFormatProperty[this.keywordIndex]], chartTitleArea.dataFormat);
|
|
2353
|
+
this.parseChartLayout(titleArea[layoutProperty[this.keywordIndex]], chartTitleArea.layout);
|
|
2354
|
+
};
|
|
2355
|
+
SfdtReader.prototype.parseChartDataFormat = function (format, dataFormat) {
|
|
2356
|
+
dataFormat.fill.color = format[fillProperty[this.keywordIndex]][foreColorProperty[this.keywordIndex]];
|
|
2357
|
+
dataFormat.fill.rgb = format[fillProperty[this.keywordIndex]][rgbProperty[this.keywordIndex]];
|
|
2358
|
+
dataFormat.line.color = format[lineProperty[this.keywordIndex]][colorProperty[this.keywordIndex]];
|
|
2359
|
+
dataFormat.line.rgb = format[lineProperty[this.keywordIndex]][rgbProperty[this.keywordIndex]];
|
|
2360
|
+
};
|
|
2361
|
+
SfdtReader.prototype.parseChartLayout = function (layout, chartLayout) {
|
|
2362
|
+
chartLayout.chartLayoutLeft = layout[layoutXProperty[this.keywordIndex]];
|
|
2363
|
+
chartLayout.chartLayoutTop = layout[layoutYProperty[this.keywordIndex]];
|
|
2364
|
+
};
|
|
2365
|
+
SfdtReader.prototype.parseChartLegend = function (legend, chartLegend) {
|
|
2366
|
+
chartLegend.chartLegendPostion = legend[positionProperty[this.keywordIndex]];
|
|
2367
|
+
this.parseChartTitleArea(legend[chartTitleAreaProperty[this.keywordIndex]], chartLegend.chartTitleArea);
|
|
2368
|
+
};
|
|
2369
|
+
SfdtReader.prototype.parseChartCategoryAxis = function (categoryAxis, primaryAxis) {
|
|
2370
|
+
primaryAxis.categoryAxisType = categoryAxis[categoryTypeProperty[this.keywordIndex]];
|
|
2371
|
+
primaryAxis.categoryNumberFormat = categoryAxis[numberFormatProperty[this.keywordIndex]];
|
|
2372
|
+
if (categoryAxis.hasOwnProperty(isAutoMajorProperty[this.keywordIndex])) {
|
|
2373
|
+
primaryAxis.isAutoInternal = LayoutHelperMethods.parseBoolValue(categoryAxis[isAutoMajorProperty[this.keywordIndex]]);
|
|
2374
|
+
}
|
|
2375
|
+
primaryAxis.interval = categoryAxis[majorUnitProperty[this.keywordIndex]];
|
|
2376
|
+
primaryAxis.axisFontSize = categoryAxis[fontSizeProperty[this.keywordIndex]];
|
|
2377
|
+
primaryAxis.axisFontName = categoryAxis[fontNameProperty[this.keywordIndex]];
|
|
2378
|
+
primaryAxis.max = categoryAxis[maximumValueProperty[this.keywordIndex]];
|
|
2379
|
+
primaryAxis.min = categoryAxis[minimumValueProperty[this.keywordIndex]];
|
|
2380
|
+
primaryAxis.majorGridLines = LayoutHelperMethods.parseBoolValue(categoryAxis[hasMajorGridLinesProperty[this.keywordIndex]]);
|
|
2381
|
+
primaryAxis.minorGridLines = LayoutHelperMethods.parseBoolValue(categoryAxis[hasMinorGridLinesProperty[this.keywordIndex]]);
|
|
2382
|
+
primaryAxis.majorTick = categoryAxis[majorTickMarkProperty[this.keywordIndex]];
|
|
2383
|
+
primaryAxis.minorTick = categoryAxis[minorTickMarkProperty[this.keywordIndex]];
|
|
2384
|
+
primaryAxis.tickPosition = categoryAxis[tickLabelPositionProperty[this.keywordIndex]];
|
|
2385
|
+
primaryAxis.categoryAxisTitle = categoryAxis[chartTitleProperty[this.keywordIndex]];
|
|
2386
|
+
if (categoryAxis[chartTitleProperty[this.keywordIndex]] != null) {
|
|
2387
|
+
this.parseChartTitleArea(categoryAxis[chartTitleAreaProperty[this.keywordIndex]], primaryAxis.chartTitleArea);
|
|
2388
|
+
}
|
|
2389
|
+
};
|
|
2390
|
+
SfdtReader.prototype.parseChartDataTable = function (dataTable, chartDataTable) {
|
|
2391
|
+
chartDataTable.showSeriesKeys = LayoutHelperMethods.parseBoolValue(dataTable[showSeriesKeysProperty[this.keywordIndex]]);
|
|
2392
|
+
chartDataTable.hasHorzBorder = LayoutHelperMethods.parseBoolValue(dataTable[hasHorizontalBorderProperty[this.keywordIndex]]);
|
|
2393
|
+
chartDataTable.hasVertBorder = LayoutHelperMethods.parseBoolValue(dataTable[hasVerticalBorderProperty[this.keywordIndex]]);
|
|
2394
|
+
chartDataTable.hasBorders = LayoutHelperMethods.parseBoolValue(dataTable[hasBordersProperty[this.keywordIndex]]);
|
|
2395
|
+
};
|
|
2396
|
+
SfdtReader.prototype.parseChartArea = function (area, chartArea) {
|
|
2397
|
+
chartArea.chartForeColor = area[foreColorProperty[this.keywordIndex]];
|
|
2398
|
+
};
|
|
2399
|
+
SfdtReader.prototype.parseChartData = function (inline, chart) {
|
|
2400
|
+
for (var i = 0; i < inline[chartCategoryProperty[this.keywordIndex]].length; i++) {
|
|
2401
|
+
var chartCategory = new ChartCategory();
|
|
2402
|
+
var xData = inline[chartCategoryProperty[this.keywordIndex]][i];
|
|
2403
|
+
if (xData.hasOwnProperty(categoryXNameProperty[this.keywordIndex])) {
|
|
2404
|
+
chartCategory.xName = xData[categoryXNameProperty[this.keywordIndex]];
|
|
2405
|
+
}
|
|
2406
|
+
for (var j = 0; j < xData[chartDataProperty[this.keywordIndex]].length; j++) {
|
|
2407
|
+
var chartData = new ChartData();
|
|
2408
|
+
var yData = xData[chartDataProperty[this.keywordIndex]][j];
|
|
2409
|
+
chartData.yAxisValue = yData[yValueProperty[this.keywordIndex]];
|
|
2410
|
+
if (inline[chartTypeProperty[this.keywordIndex]] === 'Bubble') {
|
|
2411
|
+
chartData.bubbleSize = yData[sizeProperty[this.keywordIndex]];
|
|
2412
|
+
}
|
|
2413
|
+
chartCategory.chartData.push(chartData);
|
|
2414
|
+
}
|
|
2415
|
+
chart.chartCategory.push(chartCategory);
|
|
2416
|
+
}
|
|
2417
|
+
this.parseChartSeries(inline, chart);
|
|
2418
|
+
};
|
|
2419
|
+
SfdtReader.prototype.parseChartSeries = function (inline, chart) {
|
|
2420
|
+
var chartType = inline[chartTypeProperty[this.keywordIndex]];
|
|
2421
|
+
var isPieType = (chartType === 'Pie' || chartType === 'Doughnut');
|
|
2422
|
+
for (var i = 0; i < inline[chartSeriesProperty[this.keywordIndex]].length; i++) {
|
|
2423
|
+
var chartSeries = new ChartSeries();
|
|
2424
|
+
var xData = inline[chartSeriesProperty[this.keywordIndex]][i];
|
|
2425
|
+
if (xData.hasOwnProperty(seriesNameProperty[this.keywordIndex])) {
|
|
2426
|
+
chartSeries.seriesName = xData[seriesNameProperty[this.keywordIndex]];
|
|
2427
|
+
if (isPieType) {
|
|
2428
|
+
if (xData.hasOwnProperty(firstSliceAngleProperty[this.keywordIndex])) {
|
|
2429
|
+
chartSeries.firstSliceAngle = xData[firstSliceAngleProperty[this.keywordIndex]];
|
|
2430
|
+
}
|
|
2431
|
+
if (chartType === 'Doughnut') {
|
|
2432
|
+
chartSeries.doughnutHoleSize = xData[holeSizeProperty[this.keywordIndex]];
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
if (xData.hasOwnProperty(dataLabelProperty[this.keywordIndex])) {
|
|
2436
|
+
this.parseChartDataLabels(xData[dataLabelProperty[this.keywordIndex]], chartSeries);
|
|
2437
|
+
}
|
|
2438
|
+
if (xData.hasOwnProperty(seriesFormatProperty[this.keywordIndex])) {
|
|
2439
|
+
var seriesFormat = new ChartSeriesFormat();
|
|
2440
|
+
var format = xData[seriesFormatProperty[this.keywordIndex]];
|
|
2441
|
+
seriesFormat.markerStyle = format[markerStyleProperty[this.keywordIndex]];
|
|
2442
|
+
seriesFormat.markerColor = format[markerColorProperty[this.keywordIndex]];
|
|
2443
|
+
seriesFormat.numberValue = format[markerSizeProperty[this.keywordIndex]];
|
|
2444
|
+
chartSeries.seriesFormat = seriesFormat;
|
|
2445
|
+
}
|
|
2446
|
+
if (xData.hasOwnProperty(errorBarProperty[this.keywordIndex])) {
|
|
2447
|
+
var errorBar = chartSeries.errorBar;
|
|
2448
|
+
errorBar.errorType = xData[errorBarProperty[this.keywordIndex]][typeProperty[this.keywordIndex]];
|
|
2449
|
+
errorBar.errorDirection = xData[errorBarProperty[this.keywordIndex]][directionProperty[this.keywordIndex]];
|
|
2450
|
+
errorBar.errorEndStyle = xData[errorBarProperty[this.keywordIndex]][endStyleProperty[this.keywordIndex]];
|
|
2451
|
+
errorBar.numberValue = xData[errorBarProperty[this.keywordIndex]][numberValueProperty[this.keywordIndex]];
|
|
2452
|
+
}
|
|
2453
|
+
if (xData.hasOwnProperty(trendLinesProperty[this.keywordIndex])) {
|
|
2454
|
+
this.parseChartTrendLines(xData[trendLinesProperty[this.keywordIndex]], chartSeries);
|
|
2455
|
+
}
|
|
2456
|
+
this.parseChartSeriesDataPoints(xData[dataPointsProperty[this.keywordIndex]], chartSeries);
|
|
2457
|
+
}
|
|
2458
|
+
chart.chartSeries.push(chartSeries);
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2461
|
+
SfdtReader.prototype.parseChartDataLabels = function (dataLabels, series) {
|
|
2462
|
+
var dataLabel = new ChartDataLabels();
|
|
2463
|
+
dataLabel.labelPosition = dataLabels[positionProperty[this.keywordIndex]];
|
|
2464
|
+
dataLabel.fontName = dataLabels[fontNameProperty[this.keywordIndex]];
|
|
2465
|
+
dataLabel.fontColor = dataLabels[fontColorProperty[this.keywordIndex]];
|
|
2466
|
+
dataLabel.fontSize = dataLabels[fontSizeProperty[this.keywordIndex]];
|
|
2467
|
+
dataLabel.isLegendKey = LayoutHelperMethods.parseBoolValue(dataLabels[isLegendKeyProperty[this.keywordIndex]]);
|
|
2468
|
+
dataLabel.isBubbleSize = LayoutHelperMethods.parseBoolValue(dataLabels[isBubbleSizeProperty[this.keywordIndex]]);
|
|
2469
|
+
dataLabel.isCategoryName = LayoutHelperMethods.parseBoolValue(dataLabels[isCategoryNameProperty[this.keywordIndex]]);
|
|
2470
|
+
dataLabel.isSeriesName = LayoutHelperMethods.parseBoolValue(dataLabels[isSeriesNameProperty[this.keywordIndex]]);
|
|
2471
|
+
dataLabel.isValue = LayoutHelperMethods.parseBoolValue(dataLabels[isValueProperty[this.keywordIndex]]);
|
|
2472
|
+
dataLabel.isPercentage = LayoutHelperMethods.parseBoolValue(dataLabels[isPercentageProperty[this.keywordIndex]]);
|
|
2473
|
+
dataLabel.isLeaderLines = LayoutHelperMethods.parseBoolValue(dataLabels[isLeaderLinesProperty[this.keywordIndex]]);
|
|
2474
|
+
series.dataLabels = dataLabel;
|
|
2475
|
+
};
|
|
2476
|
+
SfdtReader.prototype.parseChartSeriesDataPoints = function (dataPoints, series) {
|
|
2477
|
+
for (var i = 0; i < dataPoints.length; i++) {
|
|
2478
|
+
var chartFormat = new ChartDataFormat();
|
|
2479
|
+
if (dataPoints[i].hasOwnProperty(idProperty[this.keywordIndex])) {
|
|
2480
|
+
chartFormat.id = dataPoints[i][idProperty[this.keywordIndex]];
|
|
2481
|
+
}
|
|
2482
|
+
this.parseChartDataFormat(dataPoints[i], chartFormat);
|
|
2483
|
+
series.chartDataFormat.push(chartFormat);
|
|
2484
|
+
}
|
|
2485
|
+
};
|
|
2486
|
+
SfdtReader.prototype.parseChartTrendLines = function (trendLines, series) {
|
|
2487
|
+
for (var i = 0; i < trendLines.length; i++) {
|
|
2488
|
+
var data = trendLines[i];
|
|
2489
|
+
var trendLine = new ChartTrendLines();
|
|
2490
|
+
trendLine.trendLineName = data[nameProperty[this.keywordIndex]];
|
|
2491
|
+
trendLine.trendLineType = data[typeProperty[this.keywordIndex]];
|
|
2492
|
+
trendLine.forwardValue = data[forwardProperty[this.keywordIndex]];
|
|
2493
|
+
trendLine.backwardValue = data[backwardProperty[this.keywordIndex]];
|
|
2494
|
+
trendLine.interceptValue = data[interceptProperty[this.keywordIndex]];
|
|
2495
|
+
trendLine.isDisplayEquation = LayoutHelperMethods.parseBoolValue(data[isDisplayEquationProperty[this.keywordIndex]]);
|
|
2496
|
+
trendLine.isDisplayRSquared = LayoutHelperMethods.parseBoolValue(data[isDisplayRSquaredProperty[this.keywordIndex]]);
|
|
2497
|
+
series.trendLines.push(trendLine);
|
|
2498
|
+
}
|
|
2499
|
+
};
|
|
2500
|
+
/**
|
|
2501
|
+
* @private
|
|
2502
|
+
*/
|
|
2503
|
+
SfdtReader.prototype.parseTableFormat = function (sourceFormat, tableFormat, keywordIndex) {
|
|
2504
|
+
this.parseBorders(keywordIndex, sourceFormat[bordersProperty[keywordIndex]], tableFormat.borders);
|
|
2505
|
+
if (!isNullOrUndefined(sourceFormat[allowAutoFitProperty[keywordIndex]])) {
|
|
2506
|
+
tableFormat.allowAutoFit = LayoutHelperMethods.parseBoolValue(sourceFormat[allowAutoFitProperty[keywordIndex]]);
|
|
2507
|
+
}
|
|
2508
|
+
if (!isNullOrUndefined(sourceFormat[cellSpacingProperty[keywordIndex]])) {
|
|
2509
|
+
tableFormat.cellSpacing = sourceFormat[cellSpacingProperty[keywordIndex]];
|
|
2510
|
+
}
|
|
2511
|
+
if (!isNullOrUndefined(sourceFormat[leftMarginProperty[keywordIndex]])) {
|
|
2512
|
+
tableFormat.leftMargin = sourceFormat[leftMarginProperty[keywordIndex]];
|
|
2513
|
+
}
|
|
2514
|
+
if (!isNullOrUndefined(sourceFormat[topMarginProperty[keywordIndex]])) {
|
|
2515
|
+
tableFormat.topMargin = sourceFormat[topMarginProperty[keywordIndex]];
|
|
2516
|
+
}
|
|
2517
|
+
if (!isNullOrUndefined(sourceFormat[rightMarginProperty[keywordIndex]])) {
|
|
2518
|
+
tableFormat.rightMargin = sourceFormat[rightMarginProperty[keywordIndex]];
|
|
2519
|
+
}
|
|
2520
|
+
if (!isNullOrUndefined(sourceFormat[bottomMarginProperty[keywordIndex]])) {
|
|
2521
|
+
tableFormat.bottomMargin = sourceFormat[bottomMarginProperty[keywordIndex]];
|
|
2522
|
+
}
|
|
2523
|
+
if (!isNullOrUndefined(sourceFormat[leftIndentProperty[keywordIndex]])) {
|
|
2524
|
+
tableFormat.leftIndent = sourceFormat[leftIndentProperty[keywordIndex]];
|
|
2525
|
+
}
|
|
2526
|
+
this.parseShading(sourceFormat[shadingProperty[keywordIndex]], tableFormat.shading, keywordIndex);
|
|
2527
|
+
if (!isNullOrUndefined(sourceFormat[tableAlignmentProperty[keywordIndex]])) {
|
|
2528
|
+
tableFormat.tableAlignment = this.getTableAlignment(sourceFormat[tableAlignmentProperty[keywordIndex]]);
|
|
2529
|
+
}
|
|
2530
|
+
if (!isNullOrUndefined(sourceFormat[preferredWidthProperty[keywordIndex]])) {
|
|
2531
|
+
tableFormat.preferredWidth = sourceFormat[preferredWidthProperty[keywordIndex]];
|
|
2532
|
+
}
|
|
2533
|
+
if (!isNullOrUndefined(sourceFormat[preferredWidthTypeProperty[keywordIndex]])) {
|
|
2534
|
+
tableFormat.preferredWidthType = this.getWidthType(sourceFormat[preferredWidthTypeProperty[keywordIndex]]);
|
|
2535
|
+
}
|
|
2536
|
+
if (!isNullOrUndefined(sourceFormat[bidiProperty[keywordIndex]])) {
|
|
2537
|
+
tableFormat.bidi = LayoutHelperMethods.parseBoolValue(sourceFormat[bidiProperty[keywordIndex]]);
|
|
2538
|
+
}
|
|
2539
|
+
if (!isNullOrUndefined(sourceFormat[horizontalPositionAbsProperty[keywordIndex]])) {
|
|
2540
|
+
tableFormat.horizontalPositionAbs = this.getHorizontalPositionAbs(sourceFormat[horizontalPositionAbsProperty[keywordIndex]]);
|
|
2541
|
+
}
|
|
2542
|
+
if (!isNullOrUndefined(sourceFormat[horizontalPositionProperty[keywordIndex]])) {
|
|
2543
|
+
tableFormat.horizontalPosition = sourceFormat[horizontalPositionProperty[keywordIndex]];
|
|
2544
|
+
}
|
|
2545
|
+
if (!isNullOrUndefined(sourceFormat[styleNameProperty[keywordIndex]])) {
|
|
2546
|
+
tableFormat.styleName = sourceFormat[styleNameProperty[keywordIndex]];
|
|
2547
|
+
}
|
|
2548
|
+
if (this.documentHelper.editorProperties.enableCollaborativeEditing && !isNullOrUndefined(sourceFormat[titleProperty[keywordIndex]])) {
|
|
2549
|
+
tableFormat.title = sourceFormat[titleProperty[keywordIndex]];
|
|
2550
|
+
}
|
|
2551
|
+
if (this.documentHelper.editorProperties.enableCollaborativeEditing && !isNullOrUndefined(sourceFormat[descriptionProperty[keywordIndex]])) {
|
|
2552
|
+
tableFormat.description = sourceFormat[descriptionProperty[keywordIndex]];
|
|
2553
|
+
}
|
|
2554
|
+
if (this.isPaste && !isNullOrUndefined(this.documentHelper.isEditorModule) && !isNullOrUndefined(sourceFormat[lastParagraphMarkCopiedProperty[keywordIndex]])) {
|
|
2555
|
+
this.documentHelper.editorProperties.isLastParaMarkCopied = sourceFormat[lastParagraphMarkCopiedProperty[keywordIndex]];
|
|
2556
|
+
}
|
|
2557
|
+
};
|
|
2558
|
+
/**
|
|
2559
|
+
* @private
|
|
2560
|
+
*/
|
|
2561
|
+
SfdtReader.prototype.parseCellFormat = function (sourceFormat, cellFormat, keyIndex) {
|
|
2562
|
+
if (!isNullOrUndefined(sourceFormat)) {
|
|
2563
|
+
this.parseBorders(keyIndex, sourceFormat[bordersProperty[keyIndex]], cellFormat.borders);
|
|
2564
|
+
if (!sourceFormat.isSamePaddingAsTable) {
|
|
2565
|
+
// cellFormat.ClearMargins();
|
|
2566
|
+
//else
|
|
2567
|
+
this.parseCellMargin(sourceFormat, cellFormat, keyIndex);
|
|
2568
|
+
}
|
|
2569
|
+
if (!isNullOrUndefined(sourceFormat[cellWidthProperty[keyIndex]])) {
|
|
2570
|
+
cellFormat.cellWidth = sourceFormat[cellWidthProperty[keyIndex]];
|
|
2571
|
+
}
|
|
2572
|
+
if (!isNullOrUndefined(sourceFormat[columnSpanProperty[keyIndex]])) {
|
|
2573
|
+
cellFormat.columnSpan = sourceFormat[columnSpanProperty[keyIndex]];
|
|
2574
|
+
}
|
|
2575
|
+
if (!isNullOrUndefined(sourceFormat[rowSpanProperty[keyIndex]])) {
|
|
2576
|
+
cellFormat.rowSpan = sourceFormat[rowSpanProperty[keyIndex]];
|
|
2577
|
+
}
|
|
2578
|
+
this.parseShading(sourceFormat[shadingProperty[keyIndex]], cellFormat.shading, keyIndex);
|
|
2579
|
+
if (!isNullOrUndefined(sourceFormat[verticalAlignmentProperty[keyIndex]])) {
|
|
2580
|
+
cellFormat.verticalAlignment = this.getCellVerticalAlignment(sourceFormat[verticalAlignmentProperty[keyIndex]]);
|
|
2581
|
+
}
|
|
2582
|
+
if (!isNullOrUndefined(sourceFormat[preferredWidthTypeProperty[keyIndex]])) {
|
|
2583
|
+
cellFormat.preferredWidthType = this.getWidthType(sourceFormat[preferredWidthTypeProperty[keyIndex]]);
|
|
2584
|
+
}
|
|
2585
|
+
if (!isNullOrUndefined(sourceFormat[preferredWidthProperty[keyIndex]])) {
|
|
2586
|
+
cellFormat.preferredWidth = sourceFormat[preferredWidthProperty[keyIndex]];
|
|
2587
|
+
}
|
|
2588
|
+
if (!isNullOrUndefined(sourceFormat[verticallyMergedCellsKeepWithNext[keyIndex]])) {
|
|
2589
|
+
cellFormat.verticallyMergedCellsKeepWithNext = sourceFormat[verticallyMergedCellsKeepWithNext[keyIndex]];
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2592
|
+
};
|
|
2593
|
+
SfdtReader.prototype.parseCellMargin = function (sourceFormat, cellFormat, keyIndex) {
|
|
2594
|
+
if (!isNullOrUndefined(sourceFormat[leftMarginProperty[keyIndex]])) {
|
|
2595
|
+
cellFormat.leftMargin = sourceFormat[leftMarginProperty[keyIndex]];
|
|
2596
|
+
}
|
|
2597
|
+
if (!isNullOrUndefined(sourceFormat[rightMarginProperty[keyIndex]])) {
|
|
2598
|
+
cellFormat.rightMargin = sourceFormat[rightMarginProperty[keyIndex]];
|
|
2599
|
+
}
|
|
2600
|
+
if (!isNullOrUndefined(sourceFormat[topMarginProperty[keyIndex]])) {
|
|
2601
|
+
cellFormat.topMargin = sourceFormat[topMarginProperty[keyIndex]];
|
|
2602
|
+
}
|
|
2603
|
+
if (!isNullOrUndefined(sourceFormat[bottomMarginProperty[keyIndex]])) {
|
|
2604
|
+
cellFormat.bottomMargin = sourceFormat[bottomMarginProperty[keyIndex]];
|
|
2605
|
+
}
|
|
2606
|
+
};
|
|
2607
|
+
/**
|
|
2608
|
+
* @private
|
|
2609
|
+
*/
|
|
2610
|
+
SfdtReader.prototype.parseRowFormat = function (sourceFormat, rowFormat, keyIndex) {
|
|
2611
|
+
if (!isNullOrUndefined(sourceFormat)) {
|
|
2612
|
+
if (!isNullOrUndefined(sourceFormat[allowBreakAcrossPagesProperty[keyIndex]])) {
|
|
2613
|
+
rowFormat.allowBreakAcrossPages = LayoutHelperMethods.parseBoolValue(sourceFormat[allowBreakAcrossPagesProperty[this.keywordIndex]]);
|
|
2614
|
+
}
|
|
2615
|
+
if (!isNullOrUndefined(sourceFormat[isHeaderProperty[keyIndex]])) {
|
|
2616
|
+
rowFormat.isHeader = LayoutHelperMethods.parseBoolValue(sourceFormat[isHeaderProperty[keyIndex]]);
|
|
2617
|
+
}
|
|
2618
|
+
if (!isNullOrUndefined(sourceFormat[heightTypeProperty[keyIndex]])) {
|
|
2619
|
+
rowFormat.heightType = this.getHeightType(sourceFormat[heightTypeProperty[keyIndex]]);
|
|
2620
|
+
}
|
|
2621
|
+
if (!isNullOrUndefined(sourceFormat[heightProperty[keyIndex]])) {
|
|
2622
|
+
rowFormat.height = sourceFormat[heightProperty[keyIndex]];
|
|
2623
|
+
}
|
|
2624
|
+
if (!isNullOrUndefined(sourceFormat[leftMarginProperty[keyIndex]])) {
|
|
2625
|
+
rowFormat.leftMargin = sourceFormat[leftMarginProperty[keyIndex]];
|
|
2626
|
+
}
|
|
2627
|
+
if (!isNullOrUndefined(sourceFormat[topMarginProperty[keyIndex]])) {
|
|
2628
|
+
rowFormat.topMargin = sourceFormat[topMarginProperty[keyIndex]];
|
|
2629
|
+
}
|
|
2630
|
+
if (!isNullOrUndefined(sourceFormat[rightMarginProperty[keyIndex]])) {
|
|
2631
|
+
rowFormat.rightMargin = sourceFormat[rightMarginProperty[keyIndex]];
|
|
2632
|
+
}
|
|
2633
|
+
if (!isNullOrUndefined(sourceFormat[bottomMarginProperty[keyIndex]])) {
|
|
2634
|
+
rowFormat.bottomMargin = sourceFormat[bottomMarginProperty[keyIndex]];
|
|
2635
|
+
}
|
|
2636
|
+
if (!isNullOrUndefined(sourceFormat[leftIndentProperty[keyIndex]])) {
|
|
2637
|
+
rowFormat.leftIndent = sourceFormat[leftIndentProperty[keyIndex]];
|
|
2638
|
+
}
|
|
2639
|
+
if (!isNullOrUndefined(sourceFormat[verticallyMergedCellsLeftMarginProperty[keyIndex]])) {
|
|
2640
|
+
rowFormat.verticallyMergedCellsLeftMargin = sourceFormat[verticallyMergedCellsLeftMarginProperty[keyIndex]];
|
|
2641
|
+
}
|
|
2642
|
+
if (!isNullOrUndefined(sourceFormat[verticallyMergedCellsRightMarginProperty[keyIndex]])) {
|
|
2643
|
+
rowFormat.verticallyMergedCellsRightMargin = sourceFormat[verticallyMergedCellsRightMarginProperty[keyIndex]];
|
|
2644
|
+
}
|
|
2645
|
+
if (!isNullOrUndefined(sourceFormat[verticallyMergedCellsTopMarginProperty[keyIndex]])) {
|
|
2646
|
+
rowFormat.verticallyMergedCellsTopMargin = sourceFormat[verticallyMergedCellsTopMarginProperty[keyIndex]];
|
|
2647
|
+
}
|
|
2648
|
+
if (!isNullOrUndefined(sourceFormat[verticallyMergedCellsBottomMarginProperty[keyIndex]])) {
|
|
2649
|
+
rowFormat.verticallyMergedCellsBottomMargin = sourceFormat[verticallyMergedCellsBottomMarginProperty[keyIndex]];
|
|
2650
|
+
}
|
|
2651
|
+
if (!isNullOrUndefined(sourceFormat[revisionIdsProperty[keyIndex]]) && sourceFormat[revisionIdsProperty[keyIndex]].length > 0) {
|
|
2652
|
+
this.checkAndApplyRevision(keyIndex, sourceFormat, rowFormat, rowFormat);
|
|
2653
|
+
}
|
|
2654
|
+
this.parseRowGridValues(sourceFormat, rowFormat, keyIndex);
|
|
2655
|
+
this.parseBorders(keyIndex, sourceFormat[bordersProperty[keyIndex]], rowFormat.borders);
|
|
2656
|
+
}
|
|
2657
|
+
};
|
|
2658
|
+
SfdtReader.prototype.parseBorders = function (keyIndex, sourceBorders, destBorder) {
|
|
2659
|
+
if (!isNullOrUndefined(sourceBorders)) {
|
|
2660
|
+
destBorder.isParsing = true;
|
|
2661
|
+
this.parseBorder(keyIndex, sourceBorders[leftProperty[keyIndex]], destBorder.left);
|
|
2662
|
+
this.parseBorder(keyIndex, sourceBorders[rightProperty[keyIndex]], destBorder.right);
|
|
2663
|
+
this.parseBorder(keyIndex, sourceBorders[topProperty[keyIndex]], destBorder.top);
|
|
2664
|
+
this.parseBorder(keyIndex, sourceBorders[bottomProperty[keyIndex]], destBorder.bottom);
|
|
2665
|
+
this.parseBorder(keyIndex, sourceBorders[verticalProperty[keyIndex]], destBorder.vertical);
|
|
2666
|
+
this.parseBorder(keyIndex, sourceBorders[horizontalProperty[keyIndex]], destBorder.horizontal);
|
|
2667
|
+
this.parseBorder(keyIndex, sourceBorders[diagonalDownProperty[keyIndex]], destBorder.diagonalDown);
|
|
2668
|
+
this.parseBorder(keyIndex, sourceBorders[diagonalUpProperty[keyIndex]], destBorder.diagonalUp);
|
|
2669
|
+
destBorder.isParsing = false;
|
|
2670
|
+
}
|
|
2671
|
+
};
|
|
2672
|
+
SfdtReader.prototype.parseBorder = function (keyIndex, sourceBorder, destBorder) {
|
|
2673
|
+
if (!isNullOrUndefined(sourceBorder)) {
|
|
2674
|
+
if (!isNullOrUndefined(sourceBorder[colorProperty[keyIndex]])) {
|
|
2675
|
+
destBorder.color = this.getColor(sourceBorder[colorProperty[keyIndex]]);
|
|
2676
|
+
}
|
|
2677
|
+
if (!isNullOrUndefined(sourceBorder[lineStyleProperty[keyIndex]])) {
|
|
2678
|
+
destBorder.lineStyle = this.getLineStyle(sourceBorder[lineStyleProperty[keyIndex]]);
|
|
2679
|
+
}
|
|
2680
|
+
if (!isNullOrUndefined(sourceBorder[lineWidthProperty[keyIndex]])) {
|
|
2681
|
+
destBorder.lineWidth = sourceBorder[lineWidthProperty[keyIndex]];
|
|
2682
|
+
}
|
|
2683
|
+
if (!isNullOrUndefined(sourceBorder[hasNoneStyleProperty[keyIndex]])) {
|
|
2684
|
+
destBorder.hasNoneStyle = LayoutHelperMethods.parseBoolValue(sourceBorder[hasNoneStyleProperty[keyIndex]]);
|
|
2685
|
+
}
|
|
2686
|
+
if (!isNullOrUndefined(sourceBorder[spaceProperty[keyIndex]])) {
|
|
2687
|
+
destBorder.space = sourceBorder[spaceProperty[keyIndex]];
|
|
2688
|
+
}
|
|
2689
|
+
if (!isNullOrUndefined(sourceBorder[shadowProperty[keyIndex]])) {
|
|
2690
|
+
destBorder.shadow = LayoutHelperMethods.parseBoolValue(sourceBorder[shadowProperty[keyIndex]]);
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
SfdtReader.prototype.parseShading = function (sourceShading, destShading, keyIndex) {
|
|
2695
|
+
if (!isNullOrUndefined(sourceShading)) {
|
|
2696
|
+
if (!isNullOrUndefined(sourceShading[backgroundColorProperty[keyIndex]])) {
|
|
2697
|
+
destShading.backgroundColor = this.getColor(sourceShading[backgroundColorProperty[keyIndex]]);
|
|
2698
|
+
}
|
|
2699
|
+
if (!isNullOrUndefined(sourceShading[foregroundColorProperty[keyIndex]])) {
|
|
2700
|
+
destShading.foregroundColor = this.getColor(sourceShading[foregroundColorProperty[keyIndex]]);
|
|
2701
|
+
}
|
|
2702
|
+
if (!isNullOrUndefined(sourceShading[textureProperty[keyIndex]]) || !isNullOrUndefined(sourceShading.textureStyle)) {
|
|
2703
|
+
destShading.textureStyle = !isNullOrUndefined(sourceShading[textureProperty[keyIndex]]) ? this.getTextureStyle(sourceShading[textureProperty[keyIndex]]) : this.getTextureStyle(sourceShading.textureStyle);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
};
|
|
2707
|
+
/**
|
|
2708
|
+
* @private
|
|
2709
|
+
*/
|
|
2710
|
+
SfdtReader.prototype.parseCharacterFormat = function (keyIndex, sourceFormat, characterFormat, writeInlineFormat) {
|
|
2711
|
+
if (!isNullOrUndefined(sourceFormat)) {
|
|
2712
|
+
if (writeInlineFormat && sourceFormat.hasOwnProperty(inlineFormatProperty[keyIndex])) {
|
|
2713
|
+
this.parseCharacterFormat(keyIndex, sourceFormat.inlineFormat, characterFormat);
|
|
2714
|
+
return;
|
|
2715
|
+
}
|
|
2716
|
+
if (!isNullOrUndefined(sourceFormat[baselineAlignmentProperty[keyIndex]])) {
|
|
2717
|
+
characterFormat.baselineAlignment = this.getBaseAlignment(sourceFormat[baselineAlignmentProperty[keyIndex]]);
|
|
2718
|
+
}
|
|
2719
|
+
if (!isNullOrUndefined(sourceFormat[underlineProperty[keyIndex]])) {
|
|
2720
|
+
characterFormat.underline = this.getUnderline(sourceFormat[underlineProperty[keyIndex]]);
|
|
2721
|
+
}
|
|
2722
|
+
if (!isNullOrUndefined(sourceFormat[underlineColorProperty[keyIndex]])) {
|
|
2723
|
+
characterFormat.underlineColor = this.getColor(sourceFormat[underlineColorProperty[keyIndex]]);
|
|
2724
|
+
}
|
|
2725
|
+
if (!isNullOrUndefined(sourceFormat[fontHintTypeProperty[keyIndex]])) {
|
|
2726
|
+
characterFormat.fontHintType = this.getFontHintType(sourceFormat[fontHintTypeProperty[keyIndex]]);
|
|
2727
|
+
}
|
|
2728
|
+
if (!isNullOrUndefined(sourceFormat[strikethroughProperty[keyIndex]])) {
|
|
2729
|
+
characterFormat.strikethrough = this.getStrikethrough(sourceFormat[strikethroughProperty[keyIndex]]);
|
|
2730
|
+
}
|
|
2731
|
+
if (!isNullOrUndefined(sourceFormat[fontSizeProperty[keyIndex]])) {
|
|
2732
|
+
sourceFormat[fontSizeProperty[keyIndex]] = parseFloat(sourceFormat[fontSizeProperty[keyIndex]]);
|
|
2733
|
+
var number = sourceFormat[fontSizeProperty[keyIndex]] * 10;
|
|
2734
|
+
if (number % 10 !== 0) {
|
|
2735
|
+
number = sourceFormat[fontSizeProperty[keyIndex]].toFixed(1) * 10;
|
|
2736
|
+
//to check worst case scenerio like 8.2 or 8.7 like these to round off
|
|
2737
|
+
if (number % 5 === 0) {
|
|
2738
|
+
sourceFormat[fontSizeProperty[keyIndex]] = sourceFormat[fontSizeProperty[keyIndex]].toFixed(1);
|
|
2739
|
+
}
|
|
2740
|
+
else {
|
|
2741
|
+
sourceFormat[fontSizeProperty[keyIndex]] = Math.round(sourceFormat[fontSizeProperty[keyIndex]]);
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
var fontSize = parseFloat(sourceFormat[fontSizeProperty[keyIndex]]);
|
|
2745
|
+
characterFormat.fontSize = fontSize < 0 ? 0 : fontSize;
|
|
2746
|
+
}
|
|
2747
|
+
if (!isNullOrUndefined(sourceFormat[fontFamilyProperty[keyIndex]])) {
|
|
2748
|
+
if (sourceFormat[fontFamilyProperty[keyIndex]].indexOf('"') !== -1) {
|
|
2749
|
+
sourceFormat[fontFamilyProperty[keyIndex]] = sourceFormat[fontFamilyProperty[keyIndex]].replace('"', '');
|
|
2750
|
+
}
|
|
2751
|
+
var fontFamily = sourceFormat[fontFamilyProperty[keyIndex]];
|
|
2752
|
+
if (!isNullOrUndefined(this.documentHelper.fontSubstitutionTable) && this.documentHelper.fontSubstitutionTable.containsKey(fontFamily) && !this.isFontInstalled(fontFamily)) {
|
|
2753
|
+
fontFamily = this.documentHelper.fontSubstitutionTable.get(fontFamily);
|
|
2754
|
+
}
|
|
2755
|
+
characterFormat.fontFamily = fontFamily;
|
|
2756
|
+
if (isNullOrUndefined(sourceFormat[fontFamilyAsciiProperty[keyIndex]])) {
|
|
2757
|
+
characterFormat.fontFamilyAscii = fontFamily;
|
|
2758
|
+
}
|
|
2759
|
+
if (isNullOrUndefined(sourceFormat[fontFamilyNonFarEastProperty[keyIndex]])) {
|
|
2760
|
+
characterFormat.fontFamilyNonFarEast = fontFamily;
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
if (!isNullOrUndefined(sourceFormat[boldProperty[keyIndex]])) {
|
|
2764
|
+
characterFormat.bold = LayoutHelperMethods.parseBoolValue(sourceFormat[boldProperty[keyIndex]]);
|
|
2765
|
+
}
|
|
2766
|
+
if (!isNullOrUndefined(sourceFormat[italicProperty[keyIndex]])) {
|
|
2767
|
+
characterFormat.italic = LayoutHelperMethods.parseBoolValue(sourceFormat[italicProperty[keyIndex]]);
|
|
2768
|
+
}
|
|
2769
|
+
if (!isNullOrUndefined(sourceFormat[highlightColorProperty[keyIndex]])) {
|
|
2770
|
+
characterFormat.highlightColor = this.getHighlightColor(sourceFormat[highlightColorProperty[keyIndex]]);
|
|
2771
|
+
}
|
|
2772
|
+
if (!isNullOrUndefined(sourceFormat[fontColorProperty[keyIndex]])) {
|
|
2773
|
+
characterFormat.fontColor = this.getColor(sourceFormat[fontColorProperty[keyIndex]]);
|
|
2774
|
+
}
|
|
2775
|
+
if (!isNullOrUndefined(sourceFormat[bidiProperty[keyIndex]])) {
|
|
2776
|
+
characterFormat.bidi = LayoutHelperMethods.parseBoolValue(sourceFormat[bidiProperty[keyIndex]]);
|
|
2777
|
+
}
|
|
2778
|
+
if (!isNullOrUndefined(sourceFormat[bdoProperty[keyIndex]])) {
|
|
2779
|
+
characterFormat.bdo = this.getBiDirectionalOverride(sourceFormat[bdoProperty[keyIndex]]);
|
|
2780
|
+
}
|
|
2781
|
+
if (!isNullOrUndefined(sourceFormat[fontSizeBidiProperty[keyIndex]])) {
|
|
2782
|
+
var fontSize = parseFloat(sourceFormat[fontSizeBidiProperty[keyIndex]]);
|
|
2783
|
+
characterFormat.fontSizeBidi = fontSize < 0 ? 0 : fontSize;
|
|
2784
|
+
}
|
|
2785
|
+
if (!isNullOrUndefined(sourceFormat[fontFamilyBidiProperty[keyIndex]])) {
|
|
2786
|
+
if (sourceFormat[fontFamilyBidiProperty[keyIndex]].indexOf('"') !== -1) {
|
|
2787
|
+
sourceFormat[fontFamilyBidiProperty[keyIndex]] = sourceFormat[fontFamilyBidiProperty[keyIndex]].replace('"', '');
|
|
2788
|
+
}
|
|
2789
|
+
var fontFamilyBidi = sourceFormat[fontFamilyBidiProperty[keyIndex]];
|
|
2790
|
+
if (!isNullOrUndefined(this.documentHelper.fontSubstitutionTable) && this.documentHelper.fontSubstitutionTable.containsKey(fontFamilyBidi) && !this.isFontInstalled(fontFamilyBidi)) {
|
|
2791
|
+
fontFamilyBidi = this.documentHelper.fontSubstitutionTable.get(fontFamilyBidi);
|
|
2792
|
+
}
|
|
2793
|
+
characterFormat.fontFamilyBidi = fontFamilyBidi;
|
|
2794
|
+
}
|
|
2795
|
+
if (!isNullOrUndefined(sourceFormat[boldBidiProperty[keyIndex]])) {
|
|
2796
|
+
characterFormat.boldBidi = LayoutHelperMethods.parseBoolValue(sourceFormat[boldBidiProperty[keyIndex]]);
|
|
2797
|
+
}
|
|
2798
|
+
if (!isNullOrUndefined(sourceFormat[italicBidiProperty[keyIndex]])) {
|
|
2799
|
+
characterFormat.italicBidi = LayoutHelperMethods.parseBoolValue(sourceFormat[italicBidiProperty[keyIndex]]);
|
|
2800
|
+
}
|
|
2801
|
+
if (!isNullOrUndefined(sourceFormat[revisionIdsProperty[keyIndex]]) && sourceFormat[revisionIdsProperty[keyIndex]].length > 0) {
|
|
2802
|
+
this.checkAndApplyRevision(keyIndex, sourceFormat, characterFormat, characterFormat);
|
|
2803
|
+
}
|
|
2804
|
+
if (!isNullOrUndefined(sourceFormat[allCapsProperty[keyIndex]])) {
|
|
2805
|
+
characterFormat.allCaps = LayoutHelperMethods.parseBoolValue(sourceFormat[allCapsProperty[keyIndex]]);
|
|
2806
|
+
}
|
|
2807
|
+
if (!isNullOrUndefined(sourceFormat[localeIdBidiProperty[keyIndex]])) {
|
|
2808
|
+
characterFormat.localeIdBidi = sourceFormat[localeIdBidiProperty[keyIndex]];
|
|
2809
|
+
}
|
|
2810
|
+
if (!isNullOrUndefined(sourceFormat[localeIdProperty[keyIndex]])) {
|
|
2811
|
+
characterFormat.localeIdAscii = sourceFormat[localeIdProperty[keyIndex]];
|
|
2812
|
+
}
|
|
2813
|
+
if (!isNullOrUndefined(sourceFormat[localeIdFarEastProperty[keyIndex]])) {
|
|
2814
|
+
characterFormat.localeIdFarEast = sourceFormat[localeIdFarEastProperty[keyIndex]];
|
|
2815
|
+
}
|
|
2816
|
+
if (!isNullOrUndefined(sourceFormat[ligatureProperty[keyIndex]])) {
|
|
2817
|
+
characterFormat.ligature = this.getLigature(sourceFormat[ligatureProperty[keyIndex]]);
|
|
2818
|
+
}
|
|
2819
|
+
if (!isNullOrUndefined(sourceFormat[complexScriptProperty[keyIndex]])) {
|
|
2820
|
+
characterFormat.complexScript = LayoutHelperMethods.parseBoolValue(sourceFormat[complexScriptProperty[keyIndex]]);
|
|
2821
|
+
}
|
|
2822
|
+
if (!isNullOrUndefined(sourceFormat[hiddenProperty[keyIndex]])) {
|
|
2823
|
+
characterFormat.hidden = LayoutHelperMethods.parseBoolValue(sourceFormat[hiddenProperty[keyIndex]]);
|
|
2824
|
+
}
|
|
2825
|
+
if (!isNullOrUndefined(sourceFormat[specVanishProperty[keyIndex]])) {
|
|
2826
|
+
characterFormat.specVanish = LayoutHelperMethods.parseBoolValue(sourceFormat[specVanishProperty[keyIndex]]);
|
|
2827
|
+
}
|
|
2828
|
+
if (!isNullOrUndefined(sourceFormat[kernProperty[keyIndex]])) {
|
|
2829
|
+
characterFormat.kern = sourceFormat[kernProperty[keyIndex]];
|
|
2830
|
+
}
|
|
2831
|
+
if (!isNullOrUndefined(sourceFormat[isKernFontProperty[keyIndex]])) {
|
|
2832
|
+
characterFormat.isKernFont = LayoutHelperMethods.parseBoolValue(sourceFormat[isKernFontProperty[keyIndex]]);
|
|
2833
|
+
}
|
|
2834
|
+
if (!isNullOrUndefined(sourceFormat[fontFamilyFarEastProperty[keyIndex]])) {
|
|
2835
|
+
if (sourceFormat[fontFamilyFarEastProperty[keyIndex]].indexOf('"') !== -1) {
|
|
2836
|
+
sourceFormat[fontFamilyFarEastProperty[keyIndex]] = sourceFormat[fontFamilyFarEastProperty[keyIndex]].replace('"', '');
|
|
2837
|
+
}
|
|
2838
|
+
var fontFamilyFarEast = sourceFormat[fontFamilyFarEastProperty[keyIndex]];
|
|
2839
|
+
if (!isNullOrUndefined(this.documentHelper.fontSubstitutionTable) && this.documentHelper.fontSubstitutionTable.containsKey(fontFamilyFarEast) && !this.isFontInstalled(fontFamilyFarEast)) {
|
|
2840
|
+
fontFamilyFarEast = this.documentHelper.fontSubstitutionTable.get(fontFamilyFarEast);
|
|
2841
|
+
}
|
|
2842
|
+
characterFormat.fontFamilyFarEast = fontFamilyFarEast;
|
|
2843
|
+
}
|
|
2844
|
+
if (!isNullOrUndefined(sourceFormat[fontFamilyAsciiProperty[keyIndex]])) {
|
|
2845
|
+
if (sourceFormat[fontFamilyAsciiProperty[keyIndex]].indexOf('"') !== -1) {
|
|
2846
|
+
sourceFormat[fontFamilyAsciiProperty[keyIndex]] = sourceFormat[fontFamilyAsciiProperty[keyIndex]].replace('"', '');
|
|
2847
|
+
}
|
|
2848
|
+
var fontFamilyAscii = sourceFormat[fontFamilyAsciiProperty[keyIndex]];
|
|
2849
|
+
if (!isNullOrUndefined(this.documentHelper.fontSubstitutionTable) && this.documentHelper.fontSubstitutionTable.containsKey(fontFamilyAscii) && !this.isFontInstalled(fontFamilyAscii)) {
|
|
2850
|
+
fontFamilyAscii = this.documentHelper.fontSubstitutionTable.get(fontFamilyAscii);
|
|
2851
|
+
}
|
|
2852
|
+
characterFormat.fontFamilyAscii = fontFamilyAscii;
|
|
2853
|
+
}
|
|
2854
|
+
if (!isNullOrUndefined(sourceFormat[fontFamilyNonFarEastProperty[keyIndex]])) {
|
|
2855
|
+
if (sourceFormat[fontFamilyNonFarEastProperty[keyIndex]].indexOf('"') !== -1) {
|
|
2856
|
+
sourceFormat[fontFamilyNonFarEastProperty[keyIndex]] = sourceFormat[fontFamilyNonFarEastProperty[keyIndex]].replace('"', '');
|
|
2857
|
+
}
|
|
2858
|
+
var fontFamilyNonFarEast = sourceFormat[fontFamilyNonFarEastProperty[keyIndex]];
|
|
2859
|
+
if (!isNullOrUndefined(this.documentHelper.fontSubstitutionTable) && this.documentHelper.fontSubstitutionTable.containsKey(fontFamilyNonFarEast) && !this.isFontInstalled(fontFamilyNonFarEast)) {
|
|
2860
|
+
fontFamilyNonFarEast = this.documentHelper.fontSubstitutionTable.get(fontFamilyNonFarEast);
|
|
2861
|
+
}
|
|
2862
|
+
characterFormat.fontFamilyNonFarEast = fontFamilyNonFarEast;
|
|
2863
|
+
}
|
|
2864
|
+
if (!isNullOrUndefined(sourceFormat[characterSpacingProperty[keyIndex]])) {
|
|
2865
|
+
characterFormat.characterSpacing = sourceFormat[characterSpacingProperty[keyIndex]];
|
|
2866
|
+
}
|
|
2867
|
+
if (!isNullOrUndefined(sourceFormat[scalingProperty[keyIndex]])) {
|
|
2868
|
+
characterFormat.scaling = sourceFormat[scalingProperty[keyIndex]];
|
|
2869
|
+
}
|
|
2870
|
+
}
|
|
2871
|
+
};
|
|
2872
|
+
// Bug 864876: Here, we have checking whether the font is installed or not. If not installed, then we have changed the font name from the font substitution table.
|
|
2873
|
+
// The below code is implemented by refering the following link. (https://www.samclarke.com/javascript-is-font-available/#:~:text=Then%20to%20check%20a%20font,otherwise%20another%20fallback%20is%20tried.)
|
|
2874
|
+
/**
|
|
2875
|
+
* @private
|
|
2876
|
+
* @returns {boolean}
|
|
2877
|
+
*/
|
|
2878
|
+
SfdtReader.prototype.isFontInstalled = function (fontFamily) {
|
|
2879
|
+
if (this.fontInfoCollection && this.fontInfoCollection.containsKey(fontFamily)) {
|
|
2880
|
+
return this.fontInfoCollection.get(fontFamily);
|
|
2881
|
+
}
|
|
2882
|
+
var monoWidth = this.getWidth('monospace');
|
|
2883
|
+
var sansWidth = this.getWidth('sans-serif');
|
|
2884
|
+
var serifWidth = this.getWidth('serif');
|
|
2885
|
+
var isFontInstalled = monoWidth !== this.getWidth(fontFamily + ', monospace', monoWidth) ||
|
|
2886
|
+
sansWidth !== this.getWidth(fontFamily + ', sans-serif', sansWidth) ||
|
|
2887
|
+
serifWidth !== this.getWidth(fontFamily + ', serif', serifWidth);
|
|
2888
|
+
if (this.fontInfoCollection) {
|
|
2889
|
+
this.fontInfoCollection.add(fontFamily, isFontInstalled);
|
|
2890
|
+
}
|
|
2891
|
+
return isFontInstalled;
|
|
2892
|
+
};
|
|
2893
|
+
SfdtReader.prototype.getWidth = function (fontFamily, defaultWidth) {
|
|
2894
|
+
var width;
|
|
2895
|
+
var container = document.createElement('span');
|
|
2896
|
+
container.innerHTML = Array(100).join('wi');
|
|
2897
|
+
container.style.cssText = [
|
|
2898
|
+
'position:absolute',
|
|
2899
|
+
'width:auto',
|
|
2900
|
+
'font-size:128px',
|
|
2901
|
+
'left:-99999px'
|
|
2902
|
+
].join(' !important;');
|
|
2903
|
+
container.style.fontFamily = fontFamily;
|
|
2904
|
+
document.body.appendChild(container);
|
|
2905
|
+
width = container.clientWidth;
|
|
2906
|
+
if (container.style.fontFamily === "" && !isNullOrUndefined(defaultWidth)) {
|
|
2907
|
+
width = defaultWidth;
|
|
2908
|
+
}
|
|
2909
|
+
document.body.removeChild(container);
|
|
2910
|
+
return width;
|
|
2911
|
+
};
|
|
2912
|
+
SfdtReader.prototype.getColor = function (color) {
|
|
2913
|
+
var convertColor = color;
|
|
2914
|
+
return convertColor || '#ffffff';
|
|
2915
|
+
};
|
|
2916
|
+
SfdtReader.prototype.parseThemes = function (sourceFormat, themes) {
|
|
2917
|
+
this.parseFontScheme(sourceFormat[fontSchemeProperty[this.keywordIndex]], themes);
|
|
2918
|
+
};
|
|
2919
|
+
SfdtReader.prototype.parseFontScheme = function (sourceFormat, themes) {
|
|
2920
|
+
if (!isNullOrUndefined(sourceFormat[fontSchemeNameProperty[this.keywordIndex]]))
|
|
2921
|
+
themes.fontScheme.fontSchemeName = sourceFormat[fontSchemeNameProperty[this.keywordIndex]];
|
|
2922
|
+
if (!isNullOrUndefined(sourceFormat[majorFontSchemeProperty[this.keywordIndex]])) {
|
|
2923
|
+
this.parseMajorMinorFontScheme(sourceFormat[majorFontSchemeProperty[this.keywordIndex]], themes.fontScheme.majorFontScheme);
|
|
2924
|
+
}
|
|
2925
|
+
if (!isNullOrUndefined(sourceFormat[minorFontSchemeProperty[this.keywordIndex]])) {
|
|
2926
|
+
this.parseMajorMinorFontScheme(sourceFormat[minorFontSchemeProperty[this.keywordIndex]], themes.fontScheme.minorFontScheme);
|
|
2927
|
+
}
|
|
2928
|
+
};
|
|
2929
|
+
SfdtReader.prototype.parseMajorMinorFontScheme = function (sourceFormat, majorMinor) {
|
|
2930
|
+
if (!isNullOrUndefined(sourceFormat[fontTypefaceProperty[this.keywordIndex]]) && Object.keys(sourceFormat[fontTypefaceProperty[this.keywordIndex]]).length > 0) {
|
|
2931
|
+
var keys = Object.keys(sourceFormat[fontTypefaceProperty[this.keywordIndex]]);
|
|
2932
|
+
for (var _i = 0, keys_2 = keys; _i < keys_2.length; _i++) {
|
|
2933
|
+
var key = keys_2[_i];
|
|
2934
|
+
majorMinor.fontTypeface.add(key, sourceFormat[fontTypefaceProperty[this.keywordIndex]][key]);
|
|
2935
|
+
}
|
|
2936
|
+
this.documentHelper.hasThemes = true;
|
|
2937
|
+
}
|
|
2938
|
+
if (!isNullOrUndefined(sourceFormat[fontSchemeListProperty[this.keywordIndex]]) && sourceFormat[fontSchemeListProperty[this.keywordIndex]].length > 0) {
|
|
2939
|
+
for (var j = 0; j < sourceFormat[fontSchemeListProperty[this.keywordIndex]].length; j++) {
|
|
2940
|
+
var data = sourceFormat[fontSchemeListProperty[this.keywordIndex]][j];
|
|
2941
|
+
var fontList = new FontSchemeStruct();
|
|
2942
|
+
fontList.name = !isNullOrUndefined(data.fontName) ? data[fontNameProperty[this.keywordIndex]] : data[nameProperty[this.keywordIndex]];
|
|
2943
|
+
fontList.typeface = !isNullOrUndefined(data.fontTypeface) ? data.fontTypeface : data[typefaceProperty[this.keywordIndex]];
|
|
2944
|
+
fontList.panose = !isNullOrUndefined(data.pnose) ? data.pnose : data[panoseProperty[this.keywordIndex]];
|
|
2945
|
+
majorMinor.fontSchemeList.push(fontList);
|
|
2946
|
+
}
|
|
2947
|
+
this.documentHelper.hasThemes = true;
|
|
2948
|
+
}
|
|
2949
|
+
};
|
|
2950
|
+
SfdtReader.prototype.parseParagraphFormat = function (keyIndex, sourceFormat, paragraphFormat) {
|
|
2951
|
+
if (!isNullOrUndefined(sourceFormat)) {
|
|
2952
|
+
if (!isNullOrUndefined(sourceFormat[bordersProperty[keyIndex]])) {
|
|
2953
|
+
this.parseBorders(keyIndex, sourceFormat[bordersProperty[keyIndex]], paragraphFormat.borders);
|
|
2954
|
+
}
|
|
2955
|
+
if (!isNullOrUndefined(sourceFormat[bidiProperty[keyIndex]])) {
|
|
2956
|
+
paragraphFormat.bidi = LayoutHelperMethods.parseBoolValue(sourceFormat[bidiProperty[keyIndex]]);
|
|
2957
|
+
}
|
|
2958
|
+
if (!isNullOrUndefined(sourceFormat[leftIndentProperty[keyIndex]])) {
|
|
2959
|
+
paragraphFormat.leftIndent = sourceFormat[leftIndentProperty[keyIndex]];
|
|
2960
|
+
}
|
|
2961
|
+
if (!isNullOrUndefined(sourceFormat[rightIndentProperty[keyIndex]])) {
|
|
2962
|
+
paragraphFormat.rightIndent = sourceFormat[rightIndentProperty[keyIndex]];
|
|
2963
|
+
}
|
|
2964
|
+
if (!isNullOrUndefined(sourceFormat[firstLineIndentProperty[keyIndex]])) {
|
|
2965
|
+
paragraphFormat.firstLineIndent = sourceFormat[firstLineIndentProperty[keyIndex]];
|
|
2966
|
+
}
|
|
2967
|
+
if (!isNullOrUndefined(sourceFormat[afterSpacingProperty[keyIndex]])) {
|
|
2968
|
+
paragraphFormat.afterSpacing = sourceFormat[afterSpacingProperty[keyIndex]];
|
|
2969
|
+
}
|
|
2970
|
+
else if (this.isPaste && !isNullOrUndefined(sourceFormat[inlineFormatProperty[keyIndex]]) &&
|
|
2971
|
+
!isNullOrUndefined(sourceFormat[inlineFormatProperty[keyIndex]][afterSpacingProperty[keyIndex]])) {
|
|
2972
|
+
paragraphFormat.afterSpacing = sourceFormat[inlineFormatProperty[keyIndex]][afterSpacingProperty[keyIndex]];
|
|
2973
|
+
}
|
|
2974
|
+
if (!isNullOrUndefined(sourceFormat[beforeSpacingProperty[keyIndex]])) {
|
|
2975
|
+
paragraphFormat.beforeSpacing = sourceFormat[beforeSpacingProperty[keyIndex]];
|
|
2976
|
+
}
|
|
2977
|
+
else if (this.isPaste && !isNullOrUndefined(sourceFormat[inlineFormatProperty[keyIndex]]) &&
|
|
2978
|
+
!isNullOrUndefined(sourceFormat[inlineFormatProperty[keyIndex]][beforeSpacingProperty[keyIndex]])) {
|
|
2979
|
+
paragraphFormat.beforeSpacing = sourceFormat[inlineFormatProperty[keyIndex]][beforeSpacingProperty[keyIndex]];
|
|
2980
|
+
}
|
|
2981
|
+
if (!isNullOrUndefined(sourceFormat[spaceBeforeAutoProperty[keyIndex]])) {
|
|
2982
|
+
paragraphFormat.spaceBeforeAuto = LayoutHelperMethods.parseBoolValue(sourceFormat[spaceBeforeAutoProperty[keyIndex]]);
|
|
2983
|
+
}
|
|
2984
|
+
if (!isNullOrUndefined(sourceFormat[spaceAfterAutoProperty[keyIndex]])) {
|
|
2985
|
+
paragraphFormat.spaceAfterAuto = LayoutHelperMethods.parseBoolValue(sourceFormat[spaceAfterAutoProperty[keyIndex]]);
|
|
2986
|
+
}
|
|
2987
|
+
if (!isNullOrUndefined(sourceFormat[lineSpacingProperty[keyIndex]])) {
|
|
2988
|
+
paragraphFormat.lineSpacing = sourceFormat[lineSpacingProperty[keyIndex]];
|
|
2989
|
+
}
|
|
2990
|
+
if (!isNullOrUndefined(sourceFormat[lineSpacingTypeProperty[keyIndex]])) {
|
|
2991
|
+
paragraphFormat.lineSpacingType = this.getLineSpacingType(sourceFormat[lineSpacingTypeProperty[keyIndex]]);
|
|
2992
|
+
}
|
|
2993
|
+
else {
|
|
2994
|
+
if (!isNullOrUndefined(sourceFormat[lineSpacingProperty[keyIndex]])) {
|
|
2995
|
+
paragraphFormat.lineSpacingType = 'Multiple';
|
|
2996
|
+
}
|
|
2997
|
+
}
|
|
2998
|
+
if (!isNullOrUndefined(sourceFormat[textAlignmentProperty[keyIndex]])) {
|
|
2999
|
+
paragraphFormat.textAlignment = this.getTextAlignment(sourceFormat[textAlignmentProperty[keyIndex]]);
|
|
3000
|
+
}
|
|
3001
|
+
if (!isNullOrUndefined(sourceFormat[outlineLevelProperty[keyIndex]])) {
|
|
3002
|
+
paragraphFormat.outlineLevel = this.getOutlineLevel(sourceFormat[outlineLevelProperty[keyIndex]]);
|
|
3003
|
+
}
|
|
3004
|
+
if (!isNullOrUndefined(sourceFormat[contextualSpacingProperty[keyIndex]])) {
|
|
3005
|
+
paragraphFormat.contextualSpacing = LayoutHelperMethods.parseBoolValue(sourceFormat[contextualSpacingProperty[keyIndex]]);
|
|
3006
|
+
}
|
|
3007
|
+
if (!isNullOrUndefined(sourceFormat[keepWithNextProperty[keyIndex]])) {
|
|
3008
|
+
paragraphFormat.keepWithNext = LayoutHelperMethods.parseBoolValue(sourceFormat[keepWithNextProperty[keyIndex]]);
|
|
3009
|
+
}
|
|
3010
|
+
if (!isNullOrUndefined(sourceFormat[keepLinesTogetherProperty[keyIndex]])) {
|
|
3011
|
+
paragraphFormat.keepLinesTogether = LayoutHelperMethods.parseBoolValue(sourceFormat[keepLinesTogetherProperty[keyIndex]]);
|
|
3012
|
+
}
|
|
3013
|
+
if (!isNullOrUndefined(sourceFormat[widowControlProperty[keyIndex]])) {
|
|
3014
|
+
paragraphFormat.widowControl = LayoutHelperMethods.parseBoolValue(sourceFormat[widowControlProperty[keyIndex]]);
|
|
3015
|
+
}
|
|
3016
|
+
paragraphFormat.listFormat = new WListFormat(paragraphFormat);
|
|
3017
|
+
if (sourceFormat.hasOwnProperty(listFormatProperty[keyIndex])) {
|
|
3018
|
+
this.parseListFormat(keyIndex, sourceFormat, paragraphFormat.listFormat);
|
|
3019
|
+
}
|
|
3020
|
+
if (sourceFormat.hasOwnProperty(tabsProperty[keyIndex])) {
|
|
3021
|
+
this.parseTabStop(keyIndex, sourceFormat[tabsProperty[keyIndex]], paragraphFormat.tabs);
|
|
3022
|
+
}
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
SfdtReader.prototype.parseListFormat = function (keyIndex, block, listFormat) {
|
|
3026
|
+
if (!isNullOrUndefined(block[listFormatProperty[keyIndex]])) {
|
|
3027
|
+
if (!isNullOrUndefined(block[listFormatProperty[keyIndex]][listIdProperty[keyIndex]])) {
|
|
3028
|
+
var listId = block[listFormatProperty[keyIndex]][listIdProperty[keyIndex]];
|
|
3029
|
+
var list = this.documentHelper.getListById(listId);
|
|
3030
|
+
if (!isNullOrUndefined(list) || listId === -1) {
|
|
3031
|
+
listFormat.listId = listId;
|
|
3032
|
+
listFormat.list = list;
|
|
3033
|
+
}
|
|
3034
|
+
}
|
|
3035
|
+
if (!isNullOrUndefined(block[listFormatProperty[keyIndex]][nsidProperty])) {
|
|
3036
|
+
listFormat.nsid = block[listFormatProperty[keyIndex]][nsidProperty];
|
|
3037
|
+
}
|
|
3038
|
+
else if (!isNullOrUndefined(listFormat.list)) {
|
|
3039
|
+
// Backward compatibility
|
|
3040
|
+
listFormat.nsid = listFormat.list.nsid;
|
|
3041
|
+
}
|
|
3042
|
+
if (!isNullOrUndefined(block[listFormatProperty[keyIndex]][listLevelNumberProperty[keyIndex]])) {
|
|
3043
|
+
listFormat.listLevelNumber = block[listFormatProperty[keyIndex]][listLevelNumberProperty[keyIndex]];
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
};
|
|
3047
|
+
SfdtReader.prototype.parseSectionFormat = function (keyIndex, data, sectionFormat, isNotInitialLoad) {
|
|
3048
|
+
if (!isNullOrUndefined(data[pageWidthProperty[keyIndex]])) {
|
|
3049
|
+
sectionFormat.pageWidth = data[pageWidthProperty[keyIndex]];
|
|
3050
|
+
}
|
|
3051
|
+
if (!isNullOrUndefined(data[pageHeightProperty[keyIndex]])) {
|
|
3052
|
+
sectionFormat.pageHeight = data[pageHeightProperty[keyIndex]];
|
|
3053
|
+
}
|
|
3054
|
+
if (!isNullOrUndefined(data[leftMarginProperty[keyIndex]])) {
|
|
3055
|
+
sectionFormat.leftMargin = data[leftMarginProperty[keyIndex]];
|
|
3056
|
+
}
|
|
3057
|
+
if (!isNullOrUndefined(data[topMarginProperty[keyIndex]])) {
|
|
3058
|
+
sectionFormat.topMargin = data[topMarginProperty[keyIndex]];
|
|
3059
|
+
}
|
|
3060
|
+
if (!isNullOrUndefined(data[rightMarginProperty[keyIndex]])) {
|
|
3061
|
+
sectionFormat.rightMargin = data[rightMarginProperty[keyIndex]];
|
|
3062
|
+
}
|
|
3063
|
+
if (!isNullOrUndefined(data[bottomMarginProperty[keyIndex]])) {
|
|
3064
|
+
sectionFormat.bottomMargin = data[bottomMarginProperty[keyIndex]];
|
|
3065
|
+
}
|
|
3066
|
+
if (!isNullOrUndefined(data[headerDistanceProperty[keyIndex]])) {
|
|
3067
|
+
sectionFormat.headerDistance = data[headerDistanceProperty[keyIndex]];
|
|
3068
|
+
}
|
|
3069
|
+
if (!isNullOrUndefined(data[footerDistanceProperty[keyIndex]])) {
|
|
3070
|
+
sectionFormat.footerDistance = data[footerDistanceProperty[keyIndex]];
|
|
3071
|
+
}
|
|
3072
|
+
if (!isNullOrUndefined(data[differentFirstPageProperty[keyIndex]])) {
|
|
3073
|
+
sectionFormat.differentFirstPage = LayoutHelperMethods.parseBoolValue(data[differentFirstPageProperty[keyIndex]]);
|
|
3074
|
+
}
|
|
3075
|
+
if (!isNullOrUndefined(data[differentOddAndEvenPagesProperty[keyIndex]])) {
|
|
3076
|
+
sectionFormat.differentOddAndEvenPages = LayoutHelperMethods.parseBoolValue(data[differentOddAndEvenPagesProperty[keyIndex]]);
|
|
3077
|
+
}
|
|
3078
|
+
if (!isNullOrUndefined(data[bidiProperty[keyIndex]])) {
|
|
3079
|
+
sectionFormat.bidi = LayoutHelperMethods.parseBoolValue(data[bidiProperty[keyIndex]]);
|
|
3080
|
+
}
|
|
3081
|
+
if (!isNullOrUndefined(data[restartPageNumberingProperty[keyIndex]])) {
|
|
3082
|
+
sectionFormat.restartPageNumbering = LayoutHelperMethods.parseBoolValue(data[restartPageNumberingProperty[keyIndex]]);
|
|
3083
|
+
}
|
|
3084
|
+
if (!isNullOrUndefined(data[pageStartingNumberProperty[keyIndex]])) {
|
|
3085
|
+
sectionFormat.pageStartingNumber = data[pageStartingNumberProperty[keyIndex]];
|
|
3086
|
+
}
|
|
3087
|
+
if (!isNullOrUndefined(data[endnoteNumberFormatProperty[keyIndex]])) {
|
|
3088
|
+
sectionFormat.endnoteNumberFormat = this.getFootEndNoteNumberFormat(data[endnoteNumberFormatProperty[keyIndex]]);
|
|
3089
|
+
}
|
|
3090
|
+
if (!isNullOrUndefined(data[footNoteNumberFormatProperty[keyIndex]])) {
|
|
3091
|
+
sectionFormat.footNoteNumberFormat = this.getFootEndNoteNumberFormat(data[footNoteNumberFormatProperty[keyIndex]]);
|
|
3092
|
+
}
|
|
3093
|
+
if (!isNullOrUndefined(data[restartIndexForFootnotesProperty[keyIndex]])) {
|
|
3094
|
+
sectionFormat.restartIndexForFootnotes = this.getFootnoteRestartIndex(data[restartIndexForFootnotesProperty[keyIndex]]);
|
|
3095
|
+
}
|
|
3096
|
+
if (!isNullOrUndefined(data[restartIndexForEndnotesProperty[keyIndex]])) {
|
|
3097
|
+
sectionFormat.restartIndexForEndnotes = this.getFootnoteRestartIndex(data[restartIndexForEndnotesProperty[keyIndex]]);
|
|
3098
|
+
}
|
|
3099
|
+
if (!isNullOrUndefined(data[initialFootNoteNumberProperty[keyIndex]])) {
|
|
3100
|
+
sectionFormat.initialFootNoteNumber = data[initialFootNoteNumberProperty[keyIndex]];
|
|
3101
|
+
}
|
|
3102
|
+
if (!isNullOrUndefined(data[initialEndNoteNumberProperty[keyIndex]])) {
|
|
3103
|
+
sectionFormat.initialEndNoteNumber = data[initialEndNoteNumberProperty[keyIndex]];
|
|
3104
|
+
}
|
|
3105
|
+
if (!isNullOrUndefined(data[pageNumberStyleProperty[keyIndex]])) {
|
|
3106
|
+
sectionFormat.pageNumberStyle = data[pageNumberStyleProperty[keyIndex]];
|
|
3107
|
+
}
|
|
3108
|
+
if (!isNullOrUndefined(data[columnsProperty[keyIndex]]) && !isNullOrUndefined(data[numberOfColumnsProperty[keyIndex]]) && data[numberOfColumnsProperty[keyIndex]] > 1) {
|
|
3109
|
+
sectionFormat.numberOfColumns = data[numberOfColumnsProperty[keyIndex]];
|
|
3110
|
+
sectionFormat.equalWidth = LayoutHelperMethods.parseBoolValue(data[equalWidthProperty[keyIndex]]);
|
|
3111
|
+
sectionFormat.lineBetweenColumns = LayoutHelperMethods.parseBoolValue(data[lineBetweenColumnsProperty[keyIndex]]);
|
|
3112
|
+
if (data[columnsProperty[keyIndex]]) {
|
|
3113
|
+
for (var i = 0; i < data[columnsProperty[keyIndex]].length; i++) {
|
|
3114
|
+
var newCol = new WColumnFormat();
|
|
3115
|
+
if (isNotInitialLoad) {
|
|
3116
|
+
newCol.width = data[columnsProperty[keyIndex]][i][widthProperty[keyIndex]];
|
|
3117
|
+
newCol.space = data[columnsProperty[keyIndex]][i][spaceProperty[keyIndex]];
|
|
3118
|
+
}
|
|
3119
|
+
else {
|
|
3120
|
+
newCol.width = LayoutHelperMethods.convertPointToPixel(data[columnsProperty[keyIndex]][i][widthProperty[keyIndex]]);
|
|
3121
|
+
newCol.space = LayoutHelperMethods.convertPointToPixel(data[columnsProperty[keyIndex]][i][spaceProperty[keyIndex]]);
|
|
3122
|
+
}
|
|
3123
|
+
newCol.index = i;
|
|
3124
|
+
sectionFormat.columns.push(newCol);
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
}
|
|
3128
|
+
if (!isNullOrUndefined(data[breakCodeProperty[keyIndex]])) {
|
|
3129
|
+
sectionFormat.breakCode = data[breakCodeProperty[keyIndex]];
|
|
3130
|
+
}
|
|
3131
|
+
};
|
|
3132
|
+
SfdtReader.prototype.parseColumns = function (wCols, columns) {
|
|
3133
|
+
columns = [];
|
|
3134
|
+
if (wCols) {
|
|
3135
|
+
for (var i = 0; i < wCols.length; i++) {
|
|
3136
|
+
var newCol = new WColumnFormat();
|
|
3137
|
+
newCol.width = LayoutHelperMethods.convertPointToPixel(wCols[i][widthProperty[this.keywordIndex]]);
|
|
3138
|
+
newCol.space = LayoutHelperMethods.convertPointToPixel(wCols[i][spaceProperty[this.keywordIndex]]);
|
|
3139
|
+
newCol.index = i;
|
|
3140
|
+
columns.push(newCol);
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
};
|
|
3144
|
+
SfdtReader.prototype.parseTabStop = function (keyIndex, wTabs, tabs) {
|
|
3145
|
+
if (wTabs) {
|
|
3146
|
+
for (var i = 0; i < wTabs.length; i++) {
|
|
3147
|
+
var isDuplicate = false;
|
|
3148
|
+
var tab = wTabs[i];
|
|
3149
|
+
if (Object.keys(tab).length > 0) {
|
|
3150
|
+
var tabStop = new WTabStop();
|
|
3151
|
+
tabStop.position = tab[positionProperty[keyIndex]];
|
|
3152
|
+
tabStop.tabLeader = this.getTabLeader(tab[tabLeaderProperty[keyIndex]]);
|
|
3153
|
+
tabStop.deletePosition = tab[deletePositionProperty[keyIndex]];
|
|
3154
|
+
tabStop.tabJustification = this.getTabJustification(tab[tabJustificationProperty[keyIndex]]);
|
|
3155
|
+
for (var j = 0; j < tabs.length; j++) {
|
|
3156
|
+
var existingTab = tabs[j];
|
|
3157
|
+
if (existingTab.position === tabStop.position &&
|
|
3158
|
+
existingTab.tabLeader === tabStop.tabLeader &&
|
|
3159
|
+
existingTab.deletePosition === tabStop.deletePosition &&
|
|
3160
|
+
existingTab.tabJustification === tabStop.tabJustification) {
|
|
3161
|
+
isDuplicate = true;
|
|
3162
|
+
break;
|
|
3163
|
+
}
|
|
3164
|
+
}
|
|
3165
|
+
if (!isDuplicate) {
|
|
3166
|
+
tabs.push(tabStop);
|
|
3167
|
+
}
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
};
|
|
3172
|
+
SfdtReader.prototype.validateImageUrl = function (imagestr) {
|
|
3173
|
+
var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
|
|
3174
|
+
imagestr = imagestr.replace(/[^A-Za-z0-9\+\/\=]/g, '');
|
|
3175
|
+
var totalLength = imagestr.length * 3 / 4;
|
|
3176
|
+
if (imagestr.charAt(imagestr.length - 1) === keyStr.charAt(64)) {
|
|
3177
|
+
totalLength--;
|
|
3178
|
+
}
|
|
3179
|
+
if (imagestr.charAt(imagestr.length - 2) === keyStr.charAt(64)) {
|
|
3180
|
+
totalLength--;
|
|
3181
|
+
}
|
|
3182
|
+
if (totalLength % 1 !== 0) {
|
|
3183
|
+
// totalLength is not an integer, the length does not match a valid
|
|
3184
|
+
// base64 content. That can happen if:
|
|
3185
|
+
// - the imagestr is not a base64 content
|
|
3186
|
+
// - the imagestr is *almost* a base64 content, with a extra chars at the
|
|
3187
|
+
// beginning or at the end
|
|
3188
|
+
// - the imagestr uses a base64 variant (base64url for example)
|
|
3189
|
+
return false;
|
|
3190
|
+
}
|
|
3191
|
+
return true;
|
|
3192
|
+
};
|
|
3193
|
+
SfdtReader.prototype.containsFieldBegin = function (line) {
|
|
3194
|
+
var element = undefined;
|
|
3195
|
+
for (var i = line.children.length - 1; i >= 0; i--) {
|
|
3196
|
+
element = line.children[i];
|
|
3197
|
+
if (element instanceof FieldElementBox && element.hasFieldEnd && element.nextElement instanceof TextElementBox) {
|
|
3198
|
+
return element.nextElement;
|
|
3199
|
+
}
|
|
3200
|
+
else if (element instanceof FieldElementBox) {
|
|
3201
|
+
return undefined;
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
return element;
|
|
3205
|
+
};
|
|
3206
|
+
SfdtReader.prototype.getBaseAlignment = function (baselineAlignment) {
|
|
3207
|
+
switch (baselineAlignment) {
|
|
3208
|
+
case 0:
|
|
3209
|
+
return 'Normal';
|
|
3210
|
+
case 1:
|
|
3211
|
+
return 'Superscript';
|
|
3212
|
+
case 2:
|
|
3213
|
+
return 'Subscript';
|
|
3214
|
+
default:
|
|
3215
|
+
return baselineAlignment;
|
|
3216
|
+
}
|
|
3217
|
+
};
|
|
3218
|
+
SfdtReader.prototype.getUnderline = function (underline) {
|
|
3219
|
+
switch (underline) {
|
|
3220
|
+
case 0:
|
|
3221
|
+
return 'None';
|
|
3222
|
+
case 1:
|
|
3223
|
+
return 'Single';
|
|
3224
|
+
case 2:
|
|
3225
|
+
return 'Words';
|
|
3226
|
+
case 3:
|
|
3227
|
+
return 'Double';
|
|
3228
|
+
case 4:
|
|
3229
|
+
return 'Dotted';
|
|
3230
|
+
case 5:
|
|
3231
|
+
return 'Thick';
|
|
3232
|
+
case 6:
|
|
3233
|
+
return 'Dash';
|
|
3234
|
+
case 7:
|
|
3235
|
+
return 'DashLong';
|
|
3236
|
+
case 8:
|
|
3237
|
+
return 'DotDash';
|
|
3238
|
+
case 9:
|
|
3239
|
+
return 'DotDotDash';
|
|
3240
|
+
case 10:
|
|
3241
|
+
return 'Wavy';
|
|
3242
|
+
case 11:
|
|
3243
|
+
return 'DottedHeavy';
|
|
3244
|
+
case 12:
|
|
3245
|
+
return 'DashHeavy';
|
|
3246
|
+
case 13:
|
|
3247
|
+
return 'DashLongHeavy';
|
|
3248
|
+
case 14:
|
|
3249
|
+
return 'DotDashHeavy';
|
|
3250
|
+
case 15:
|
|
3251
|
+
return 'DotDotDashHeavy';
|
|
3252
|
+
case 16:
|
|
3253
|
+
return 'WavyHeavy';
|
|
3254
|
+
case 17:
|
|
3255
|
+
return 'WavyDouble';
|
|
3256
|
+
default:
|
|
3257
|
+
return underline;
|
|
3258
|
+
}
|
|
3259
|
+
};
|
|
3260
|
+
SfdtReader.prototype.getFontHintType = function (fontHintType) {
|
|
3261
|
+
switch (fontHintType) {
|
|
3262
|
+
case 0:
|
|
3263
|
+
return 'Default';
|
|
3264
|
+
case 1:
|
|
3265
|
+
return 'EastAsia';
|
|
3266
|
+
case 2:
|
|
3267
|
+
return 'CS';
|
|
3268
|
+
default:
|
|
3269
|
+
return fontHintType;
|
|
3270
|
+
}
|
|
3271
|
+
};
|
|
3272
|
+
SfdtReader.prototype.getStrikethrough = function (strikethrough) {
|
|
3273
|
+
switch (strikethrough) {
|
|
3274
|
+
case 0:
|
|
3275
|
+
return 'None';
|
|
3276
|
+
case 1:
|
|
3277
|
+
return 'SingleStrike';
|
|
3278
|
+
case 2:
|
|
3279
|
+
return 'DoubleStrike';
|
|
3280
|
+
default:
|
|
3281
|
+
return strikethrough;
|
|
3282
|
+
}
|
|
3283
|
+
};
|
|
3284
|
+
SfdtReader.prototype.getHighlightColor = function (highlightColor) {
|
|
3285
|
+
switch (highlightColor) {
|
|
3286
|
+
case 0:
|
|
3287
|
+
return 'NoColor';
|
|
3288
|
+
case 1:
|
|
3289
|
+
return 'Yellow';
|
|
3290
|
+
case 2:
|
|
3291
|
+
return 'BrightGreen';
|
|
3292
|
+
case 3:
|
|
3293
|
+
return 'Turquoise';
|
|
3294
|
+
case 4:
|
|
3295
|
+
return 'Pink';
|
|
3296
|
+
case 5:
|
|
3297
|
+
return 'Blue';
|
|
3298
|
+
case 6:
|
|
3299
|
+
return 'Red';
|
|
3300
|
+
case 7:
|
|
3301
|
+
return 'DarkBlue';
|
|
3302
|
+
case 8:
|
|
3303
|
+
return 'Teal';
|
|
3304
|
+
case 9:
|
|
3305
|
+
return 'Green';
|
|
3306
|
+
case 10:
|
|
3307
|
+
return 'Violet';
|
|
3308
|
+
case 11:
|
|
3309
|
+
return 'DarkRed';
|
|
3310
|
+
case 12:
|
|
3311
|
+
return 'DarkYellow';
|
|
3312
|
+
case 13:
|
|
3313
|
+
return 'Gray50';
|
|
3314
|
+
case 14:
|
|
3315
|
+
return 'Gray25';
|
|
3316
|
+
case 15:
|
|
3317
|
+
return 'Black';
|
|
3318
|
+
default:
|
|
3319
|
+
return highlightColor;
|
|
3320
|
+
}
|
|
3321
|
+
};
|
|
3322
|
+
SfdtReader.prototype.getLineSpacingType = function (lineSpacingType) {
|
|
3323
|
+
switch (lineSpacingType) {
|
|
3324
|
+
case 0:
|
|
3325
|
+
return 'Multiple';
|
|
3326
|
+
case 1:
|
|
3327
|
+
return 'AtLeast';
|
|
3328
|
+
case 2:
|
|
3329
|
+
return 'Exactly';
|
|
3330
|
+
default:
|
|
3331
|
+
return lineSpacingType;
|
|
3332
|
+
}
|
|
3333
|
+
};
|
|
3334
|
+
SfdtReader.prototype.getOutlineLevel = function (outlineLevel) {
|
|
3335
|
+
switch (outlineLevel) {
|
|
3336
|
+
case 0:
|
|
3337
|
+
return 'BodyText';
|
|
3338
|
+
case 1:
|
|
3339
|
+
return 'Level1';
|
|
3340
|
+
case 2:
|
|
3341
|
+
return 'Level2';
|
|
3342
|
+
case 3:
|
|
3343
|
+
return 'Level3';
|
|
3344
|
+
case 4:
|
|
3345
|
+
return 'Level4';
|
|
3346
|
+
case 5:
|
|
3347
|
+
return 'Level5';
|
|
3348
|
+
case 6:
|
|
3349
|
+
return 'Level6';
|
|
3350
|
+
case 7:
|
|
3351
|
+
return 'Level7';
|
|
3352
|
+
case 8:
|
|
3353
|
+
return 'Level8';
|
|
3354
|
+
case 9:
|
|
3355
|
+
return 'Level9';
|
|
3356
|
+
default:
|
|
3357
|
+
return outlineLevel;
|
|
3358
|
+
}
|
|
3359
|
+
};
|
|
3360
|
+
SfdtReader.prototype.getTextAlignment = function (textAlignment) {
|
|
3361
|
+
switch (textAlignment) {
|
|
3362
|
+
case 0:
|
|
3363
|
+
return 'Left';
|
|
3364
|
+
case 1:
|
|
3365
|
+
return 'Center';
|
|
3366
|
+
case 2:
|
|
3367
|
+
return 'Right';
|
|
3368
|
+
case 3:
|
|
3369
|
+
return 'Justify';
|
|
3370
|
+
default:
|
|
3371
|
+
return textAlignment;
|
|
3372
|
+
}
|
|
3373
|
+
};
|
|
3374
|
+
SfdtReader.prototype.getWidthType = function (widthType) {
|
|
3375
|
+
switch (widthType) {
|
|
3376
|
+
case 0:
|
|
3377
|
+
return 'Auto';
|
|
3378
|
+
case 1:
|
|
3379
|
+
return 'Percent';
|
|
3380
|
+
case 2:
|
|
3381
|
+
return 'Point';
|
|
3382
|
+
default:
|
|
3383
|
+
return widthType;
|
|
3384
|
+
}
|
|
3385
|
+
};
|
|
3386
|
+
SfdtReader.prototype.getTableAlignment = function (tableAlignment) {
|
|
3387
|
+
switch (tableAlignment) {
|
|
3388
|
+
case 0:
|
|
3389
|
+
return 'Left';
|
|
3390
|
+
case 1:
|
|
3391
|
+
return 'Center';
|
|
3392
|
+
case 2:
|
|
3393
|
+
return 'Right';
|
|
3394
|
+
default:
|
|
3395
|
+
return tableAlignment;
|
|
3396
|
+
}
|
|
3397
|
+
};
|
|
3398
|
+
SfdtReader.prototype.getLineStyle = function (lineStyle) {
|
|
3399
|
+
switch (lineStyle) {
|
|
3400
|
+
case 0:
|
|
3401
|
+
return 'Single';
|
|
3402
|
+
case 1:
|
|
3403
|
+
return 'None';
|
|
3404
|
+
case 2:
|
|
3405
|
+
return 'Dot';
|
|
3406
|
+
case 3:
|
|
3407
|
+
return 'DashSmallGap';
|
|
3408
|
+
case 4:
|
|
3409
|
+
return 'DashLargeGap';
|
|
3410
|
+
case 5:
|
|
3411
|
+
return 'DashDot';
|
|
3412
|
+
case 6:
|
|
3413
|
+
return 'DashDotDot';
|
|
3414
|
+
case 7:
|
|
3415
|
+
return 'Double';
|
|
3416
|
+
case 8:
|
|
3417
|
+
return 'Triple';
|
|
3418
|
+
case 9:
|
|
3419
|
+
return 'ThinThickSmallGap';
|
|
3420
|
+
case 10:
|
|
3421
|
+
return 'ThickThinSmallGap';
|
|
3422
|
+
case 11:
|
|
3423
|
+
return 'ThinThickThinSmallGap';
|
|
3424
|
+
case 12:
|
|
3425
|
+
return 'ThinThickMediumGap';
|
|
3426
|
+
case 13:
|
|
3427
|
+
return 'ThickThinMediumGap';
|
|
3428
|
+
case 14:
|
|
3429
|
+
return 'ThinThickThinMediumGap';
|
|
3430
|
+
case 15:
|
|
3431
|
+
return 'ThinThickLargeGap';
|
|
3432
|
+
case 16:
|
|
3433
|
+
return 'ThickThinLargeGap';
|
|
3434
|
+
case 17:
|
|
3435
|
+
return 'ThinThickThinLargeGap';
|
|
3436
|
+
case 18:
|
|
3437
|
+
return 'SingleWavy';
|
|
3438
|
+
case 19:
|
|
3439
|
+
return 'DoubleWavy';
|
|
3440
|
+
case 20:
|
|
3441
|
+
return 'DashDotStroked';
|
|
3442
|
+
case 21:
|
|
3443
|
+
return 'Emboss3D';
|
|
3444
|
+
case 22:
|
|
3445
|
+
return 'Engrave3D';
|
|
3446
|
+
case 23:
|
|
3447
|
+
return 'Outset';
|
|
3448
|
+
case 24:
|
|
3449
|
+
return 'Inset';
|
|
3450
|
+
case 25:
|
|
3451
|
+
return 'Thick';
|
|
3452
|
+
case 26:
|
|
3453
|
+
return 'Cleared';
|
|
3454
|
+
default:
|
|
3455
|
+
return lineStyle;
|
|
3456
|
+
}
|
|
3457
|
+
};
|
|
3458
|
+
SfdtReader.prototype.getTextureStyle = function (textureStyle) {
|
|
3459
|
+
switch (textureStyle) {
|
|
3460
|
+
case 0:
|
|
3461
|
+
return 'TextureNone';
|
|
3462
|
+
case 1:
|
|
3463
|
+
return 'Texture2Pt5Percent';
|
|
3464
|
+
case 2:
|
|
3465
|
+
return 'Texture5Percent';
|
|
3466
|
+
case 3:
|
|
3467
|
+
return 'Texture7Pt5Percent';
|
|
3468
|
+
case 4:
|
|
3469
|
+
return 'Texture10Percent';
|
|
3470
|
+
case 5:
|
|
3471
|
+
return 'Texture12Pt5Percent';
|
|
3472
|
+
case 6:
|
|
3473
|
+
return 'Texture15Percent';
|
|
3474
|
+
case 7:
|
|
3475
|
+
return 'Texture17Pt5Percent';
|
|
3476
|
+
case 8:
|
|
3477
|
+
return 'Texture20Percent';
|
|
3478
|
+
case 9:
|
|
3479
|
+
return 'Texture22Pt5Percent';
|
|
3480
|
+
case 10:
|
|
3481
|
+
return 'Texture25Percent';
|
|
3482
|
+
case 11:
|
|
3483
|
+
return 'Texture27Pt5Percent';
|
|
3484
|
+
case 12:
|
|
3485
|
+
return 'Texture30Percent';
|
|
3486
|
+
case 13:
|
|
3487
|
+
return 'Texture32Pt5Percent';
|
|
3488
|
+
case 14:
|
|
3489
|
+
return 'Texture35Percent';
|
|
3490
|
+
case 15:
|
|
3491
|
+
return 'Texture37Pt5Percent';
|
|
3492
|
+
case 16:
|
|
3493
|
+
return 'Texture40Percent';
|
|
3494
|
+
case 17:
|
|
3495
|
+
return 'Texture42Pt5Percent';
|
|
3496
|
+
case 18:
|
|
3497
|
+
return 'Texture45Percent';
|
|
3498
|
+
case 19:
|
|
3499
|
+
return 'Texture47Pt5Percent';
|
|
3500
|
+
case 20:
|
|
3501
|
+
return 'Texture50Percent';
|
|
3502
|
+
case 21:
|
|
3503
|
+
return 'Texture52Pt5Percent';
|
|
3504
|
+
case 22:
|
|
3505
|
+
return 'Texture55Percent';
|
|
3506
|
+
case 23:
|
|
3507
|
+
return 'Texture57Pt5Percent';
|
|
3508
|
+
case 24:
|
|
3509
|
+
return 'Texture60Percent';
|
|
3510
|
+
case 25:
|
|
3511
|
+
return 'Texture62Pt5Percent';
|
|
3512
|
+
case 26:
|
|
3513
|
+
return 'Texture65Percent';
|
|
3514
|
+
case 27:
|
|
3515
|
+
return 'Texture67Pt5Percent';
|
|
3516
|
+
case 28:
|
|
3517
|
+
return 'Texture70Percent';
|
|
3518
|
+
case 29:
|
|
3519
|
+
return 'Texture72Pt5Percent';
|
|
3520
|
+
case 30:
|
|
3521
|
+
return 'Texture75Percent';
|
|
3522
|
+
case 31:
|
|
3523
|
+
return 'Texture77Pt5Percent';
|
|
3524
|
+
case 32:
|
|
3525
|
+
return 'Texture80Percent';
|
|
3526
|
+
case 33:
|
|
3527
|
+
return 'Texture82Pt5Percent';
|
|
3528
|
+
case 34:
|
|
3529
|
+
return 'Texture85Percent';
|
|
3530
|
+
case 35:
|
|
3531
|
+
return 'Texture87Pt5Percent';
|
|
3532
|
+
case 36:
|
|
3533
|
+
return 'Texture90Percent';
|
|
3534
|
+
case 37:
|
|
3535
|
+
return 'Texture92Pt5Percent';
|
|
3536
|
+
case 38:
|
|
3537
|
+
return 'Texture95Percent';
|
|
3538
|
+
case 39:
|
|
3539
|
+
return 'Texture97Pt5Percent';
|
|
3540
|
+
case 40:
|
|
3541
|
+
return 'TextureSolid';
|
|
3542
|
+
case 41:
|
|
3543
|
+
return 'TextureDarkHorizontal';
|
|
3544
|
+
case 42:
|
|
3545
|
+
return 'TextureDarkVertical';
|
|
3546
|
+
case 43:
|
|
3547
|
+
return 'TextureDarkDiagonalDown';
|
|
3548
|
+
case 44:
|
|
3549
|
+
return 'TextureDarkDiagonalUp';
|
|
3550
|
+
case 45:
|
|
3551
|
+
return 'TextureDarkCross';
|
|
3552
|
+
case 46:
|
|
3553
|
+
return 'TextureDarkDiagonalCross';
|
|
3554
|
+
case 47:
|
|
3555
|
+
return 'TextureHorizontal';
|
|
3556
|
+
case 48:
|
|
3557
|
+
return 'TextureVertical';
|
|
3558
|
+
case 49:
|
|
3559
|
+
return 'TextureDiagonalDown';
|
|
3560
|
+
case 50:
|
|
3561
|
+
return 'TextureDiagonalUp';
|
|
3562
|
+
case 51:
|
|
3563
|
+
return 'TextureCross';
|
|
3564
|
+
case 52:
|
|
3565
|
+
return 'TextureDiagonalCross';
|
|
3566
|
+
default:
|
|
3567
|
+
return textureStyle;
|
|
3568
|
+
}
|
|
3569
|
+
};
|
|
3570
|
+
SfdtReader.prototype.getLigature = function (ligature) {
|
|
3571
|
+
switch (ligature) {
|
|
3572
|
+
case 0:
|
|
3573
|
+
return 'None';
|
|
3574
|
+
case 1:
|
|
3575
|
+
return 'Standard';
|
|
3576
|
+
case 2:
|
|
3577
|
+
return 'Contextual';
|
|
3578
|
+
case 3:
|
|
3579
|
+
return 'StandardContextual';
|
|
3580
|
+
case 4:
|
|
3581
|
+
return 'Historical';
|
|
3582
|
+
case 5:
|
|
3583
|
+
return 'StandardHistorical';
|
|
3584
|
+
case 6:
|
|
3585
|
+
return 'ContextualHistorical';
|
|
3586
|
+
case 7:
|
|
3587
|
+
return 'StandardContextualHistorical';
|
|
3588
|
+
case 8:
|
|
3589
|
+
return 'Discretional';
|
|
3590
|
+
case 9:
|
|
3591
|
+
return 'StandardDiscretional';
|
|
3592
|
+
case 10:
|
|
3593
|
+
return 'ContextualDiscretional';
|
|
3594
|
+
case 11:
|
|
3595
|
+
return 'StandardContextualDiscretional';
|
|
3596
|
+
case 12:
|
|
3597
|
+
return 'HistoricalDiscretional';
|
|
3598
|
+
case 13:
|
|
3599
|
+
return 'StandardHistoricalDiscretional';
|
|
3600
|
+
case 14:
|
|
3601
|
+
return 'ContextualHistoricalDiscretional';
|
|
3602
|
+
case 15:
|
|
3603
|
+
return 'All';
|
|
3604
|
+
default:
|
|
3605
|
+
return ligature;
|
|
3606
|
+
}
|
|
3607
|
+
};
|
|
3608
|
+
SfdtReader.prototype.getHeightType = function (heightType) {
|
|
3609
|
+
switch (heightType) {
|
|
3610
|
+
case 0:
|
|
3611
|
+
return 'AtLeast';
|
|
3612
|
+
case 1:
|
|
3613
|
+
return 'Exactly';
|
|
3614
|
+
default:
|
|
3615
|
+
return heightType;
|
|
3616
|
+
}
|
|
3617
|
+
};
|
|
3618
|
+
SfdtReader.prototype.getCellVerticalAlignment = function (cellVerticalAlignment) {
|
|
3619
|
+
switch (cellVerticalAlignment) {
|
|
3620
|
+
case 0:
|
|
3621
|
+
return 'Top';
|
|
3622
|
+
case 1:
|
|
3623
|
+
return 'Center';
|
|
3624
|
+
case 2:
|
|
3625
|
+
return 'Bottom';
|
|
3626
|
+
default:
|
|
3627
|
+
return cellVerticalAlignment;
|
|
3628
|
+
}
|
|
3629
|
+
};
|
|
3630
|
+
/**
|
|
3631
|
+
* @private
|
|
3632
|
+
*/
|
|
3633
|
+
SfdtReader.prototype.getListLevelPattern = function (listLevelPattern) {
|
|
3634
|
+
switch (listLevelPattern) {
|
|
3635
|
+
case 0:
|
|
3636
|
+
return 'None';
|
|
3637
|
+
case 1:
|
|
3638
|
+
// In online Ms Word, the Arabic pattern is applied for unsupported list level pattern.
|
|
3639
|
+
case 13:
|
|
3640
|
+
case 'KanjiDigit':
|
|
3641
|
+
return 'Arabic';
|
|
3642
|
+
case 2:
|
|
3643
|
+
return 'UpRoman';
|
|
3644
|
+
case 3:
|
|
3645
|
+
return 'LowRoman';
|
|
3646
|
+
case 4:
|
|
3647
|
+
return 'UpLetter';
|
|
3648
|
+
case 5:
|
|
3649
|
+
return 'LowLetter';
|
|
3650
|
+
case 6:
|
|
3651
|
+
return 'Ordinal';
|
|
3652
|
+
case 7:
|
|
3653
|
+
return 'Number';
|
|
3654
|
+
case 8:
|
|
3655
|
+
return 'OrdinalText';
|
|
3656
|
+
case 9:
|
|
3657
|
+
return 'LeadingZero';
|
|
3658
|
+
case 10:
|
|
3659
|
+
return 'Bullet';
|
|
3660
|
+
case 11:
|
|
3661
|
+
return 'FarEast';
|
|
3662
|
+
case 12:
|
|
3663
|
+
return 'Special';
|
|
3664
|
+
case 14:
|
|
3665
|
+
return 'Hebrew1';
|
|
3666
|
+
case 15:
|
|
3667
|
+
return 'Hebrew2';
|
|
3668
|
+
case 16:
|
|
3669
|
+
return 'Arabic1';
|
|
3670
|
+
case 17:
|
|
3671
|
+
return 'Arabic2';
|
|
3672
|
+
default:
|
|
3673
|
+
return listLevelPattern;
|
|
3674
|
+
}
|
|
3675
|
+
};
|
|
3676
|
+
SfdtReader.prototype.getListNumberAlignment = function (numberAlignment) {
|
|
3677
|
+
switch (numberAlignment) {
|
|
3678
|
+
case 1:
|
|
3679
|
+
return 'Center';
|
|
3680
|
+
case 2:
|
|
3681
|
+
return 'Right';
|
|
3682
|
+
case 'Center':
|
|
3683
|
+
case 'Right':
|
|
3684
|
+
return numberAlignment;
|
|
3685
|
+
default:
|
|
3686
|
+
return 'Left';
|
|
3687
|
+
}
|
|
3688
|
+
};
|
|
3689
|
+
SfdtReader.prototype.getFollowCharacterType = function (followCharacterType) {
|
|
3690
|
+
switch (followCharacterType) {
|
|
3691
|
+
case 0:
|
|
3692
|
+
return 'Tab';
|
|
3693
|
+
case 1:
|
|
3694
|
+
return 'Space';
|
|
3695
|
+
case 2:
|
|
3696
|
+
return 'None';
|
|
3697
|
+
default:
|
|
3698
|
+
return followCharacterType;
|
|
3699
|
+
}
|
|
3700
|
+
};
|
|
3701
|
+
SfdtReader.prototype.getStyleType = function (styleType) {
|
|
3702
|
+
switch (styleType) {
|
|
3703
|
+
case 0:
|
|
3704
|
+
return 'Paragraph';
|
|
3705
|
+
case 1:
|
|
3706
|
+
return 'Character';
|
|
3707
|
+
case 2:
|
|
3708
|
+
return 'Table';
|
|
3709
|
+
default:
|
|
3710
|
+
return styleType;
|
|
3711
|
+
}
|
|
3712
|
+
};
|
|
3713
|
+
SfdtReader.prototype.getProtectionType = function (protectionType) {
|
|
3714
|
+
switch (protectionType) {
|
|
3715
|
+
case 0:
|
|
3716
|
+
return 'NoProtection';
|
|
3717
|
+
case 1:
|
|
3718
|
+
return 'ReadOnly';
|
|
3719
|
+
case 2:
|
|
3720
|
+
return 'FormFieldsOnly';
|
|
3721
|
+
case 3:
|
|
3722
|
+
return 'CommentsOnly';
|
|
3723
|
+
case 4:
|
|
3724
|
+
return 'RevisionsOnly';
|
|
3725
|
+
default:
|
|
3726
|
+
return protectionType;
|
|
3727
|
+
}
|
|
3728
|
+
};
|
|
3729
|
+
SfdtReader.prototype.getRevisionType = function (revisionType) {
|
|
3730
|
+
switch (revisionType) {
|
|
3731
|
+
case 1:
|
|
3732
|
+
return 'Insertion';
|
|
3733
|
+
case 2:
|
|
3734
|
+
return 'Deletion';
|
|
3735
|
+
case 3:
|
|
3736
|
+
return 'MoveTo';
|
|
3737
|
+
case 4:
|
|
3738
|
+
return 'MoveFrom';
|
|
3739
|
+
default:
|
|
3740
|
+
return revisionType;
|
|
3741
|
+
}
|
|
3742
|
+
};
|
|
3743
|
+
SfdtReader.prototype.getFootnoteType = function (footnoteType) {
|
|
3744
|
+
switch (footnoteType) {
|
|
3745
|
+
case 0:
|
|
3746
|
+
return 'Footnote';
|
|
3747
|
+
case 1:
|
|
3748
|
+
return 'Endnote';
|
|
3749
|
+
default:
|
|
3750
|
+
return footnoteType;
|
|
3751
|
+
}
|
|
3752
|
+
};
|
|
3753
|
+
SfdtReader.prototype.getFootnoteRestartIndex = function (footnoteRestartIndex) {
|
|
3754
|
+
switch (footnoteRestartIndex) {
|
|
3755
|
+
case 0:
|
|
3756
|
+
return 'DoNotRestart';
|
|
3757
|
+
case 1:
|
|
3758
|
+
return 'RestartForEachSection';
|
|
3759
|
+
case 2:
|
|
3760
|
+
return 'RestartForEachPage';
|
|
3761
|
+
default:
|
|
3762
|
+
return footnoteRestartIndex;
|
|
3763
|
+
}
|
|
3764
|
+
};
|
|
3765
|
+
SfdtReader.prototype.getFootEndNoteNumberFormat = function (footEndNoteNumberFormat) {
|
|
3766
|
+
switch (footEndNoteNumberFormat) {
|
|
3767
|
+
case 0:
|
|
3768
|
+
return 'Arabic';
|
|
3769
|
+
case 1:
|
|
3770
|
+
return 'UpperCaseRoman';
|
|
3771
|
+
case 2:
|
|
3772
|
+
return 'LowerCaseRoman';
|
|
3773
|
+
case 3:
|
|
3774
|
+
return 'UpperCaseLetter';
|
|
3775
|
+
case 4:
|
|
3776
|
+
return 'LowerCaseLetter';
|
|
3777
|
+
default:
|
|
3778
|
+
return footEndNoteNumberFormat;
|
|
3779
|
+
}
|
|
3780
|
+
};
|
|
3781
|
+
SfdtReader.prototype.getBiDirectionalOverride = function (biDirectionalOverride) {
|
|
3782
|
+
switch (biDirectionalOverride) {
|
|
3783
|
+
case 0:
|
|
3784
|
+
return 'None';
|
|
3785
|
+
case 1:
|
|
3786
|
+
return 'LTR';
|
|
3787
|
+
case 2:
|
|
3788
|
+
return 'RTL';
|
|
3789
|
+
default:
|
|
3790
|
+
return biDirectionalOverride;
|
|
3791
|
+
}
|
|
3792
|
+
};
|
|
3793
|
+
SfdtReader.prototype.getBreakClearType = function (breakClearType) {
|
|
3794
|
+
switch (breakClearType) {
|
|
3795
|
+
case 0:
|
|
3796
|
+
return 'None';
|
|
3797
|
+
case 1:
|
|
3798
|
+
return 'Left';
|
|
3799
|
+
case 2:
|
|
3800
|
+
return 'Right';
|
|
3801
|
+
case 3:
|
|
3802
|
+
return 'All';
|
|
3803
|
+
default:
|
|
3804
|
+
return breakClearType;
|
|
3805
|
+
}
|
|
3806
|
+
};
|
|
3807
|
+
SfdtReader.prototype.getTextVerticalAlignment = function (textVerticalAlignment) {
|
|
3808
|
+
switch (textVerticalAlignment) {
|
|
3809
|
+
case 0:
|
|
3810
|
+
return 'Top';
|
|
3811
|
+
case 1:
|
|
3812
|
+
return 'Center';
|
|
3813
|
+
case 2:
|
|
3814
|
+
return 'Bottom';
|
|
3815
|
+
default:
|
|
3816
|
+
return textVerticalAlignment;
|
|
3817
|
+
}
|
|
3818
|
+
};
|
|
3819
|
+
SfdtReader.prototype.getShapeVerticalAlignment = function (shapeVerticalAlignment) {
|
|
3820
|
+
switch (shapeVerticalAlignment) {
|
|
3821
|
+
case 0:
|
|
3822
|
+
return 'None';
|
|
3823
|
+
case 1:
|
|
3824
|
+
return 'Top';
|
|
3825
|
+
case 2:
|
|
3826
|
+
return 'Center';
|
|
3827
|
+
case 3:
|
|
3828
|
+
return 'Bottom';
|
|
3829
|
+
case 4:
|
|
3830
|
+
return 'Inline';
|
|
3831
|
+
case 5:
|
|
3832
|
+
return 'Inside';
|
|
3833
|
+
case 6:
|
|
3834
|
+
return 'Outside';
|
|
3835
|
+
default:
|
|
3836
|
+
return shapeVerticalAlignment;
|
|
3837
|
+
}
|
|
3838
|
+
};
|
|
3839
|
+
SfdtReader.prototype.getShapeHorizontalAlignment = function (shapeHorizontalAlignment) {
|
|
3840
|
+
switch (shapeHorizontalAlignment) {
|
|
3841
|
+
case 0:
|
|
3842
|
+
return 'None';
|
|
3843
|
+
case 1:
|
|
3844
|
+
return 'Center';
|
|
3845
|
+
case 2:
|
|
3846
|
+
return 'Inside';
|
|
3847
|
+
case 3:
|
|
3848
|
+
return 'Left';
|
|
3849
|
+
case 4:
|
|
3850
|
+
return 'Outside';
|
|
3851
|
+
case 5:
|
|
3852
|
+
return 'Right';
|
|
3853
|
+
default:
|
|
3854
|
+
return shapeHorizontalAlignment;
|
|
3855
|
+
}
|
|
3856
|
+
};
|
|
3857
|
+
SfdtReader.prototype.getVerticalOrigin = function (verticalOrigin) {
|
|
3858
|
+
switch (verticalOrigin) {
|
|
3859
|
+
case 0:
|
|
3860
|
+
return 'Paragraph';
|
|
3861
|
+
case 1:
|
|
3862
|
+
return 'BottomMargin';
|
|
3863
|
+
case 2:
|
|
3864
|
+
return 'InsideMargin';
|
|
3865
|
+
case 3:
|
|
3866
|
+
return 'Line';
|
|
3867
|
+
case 4:
|
|
3868
|
+
return 'Margin';
|
|
3869
|
+
case 5:
|
|
3870
|
+
return 'OutsideMargin';
|
|
3871
|
+
case 6:
|
|
3872
|
+
return 'Page';
|
|
3873
|
+
case 7:
|
|
3874
|
+
return 'TopMargin';
|
|
3875
|
+
default:
|
|
3876
|
+
return verticalOrigin;
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
SfdtReader.prototype.getHorizontalOrigin = function (horizontalOrigin) {
|
|
3880
|
+
switch (horizontalOrigin) {
|
|
3881
|
+
case 0:
|
|
3882
|
+
return 'Column';
|
|
3883
|
+
case 1:
|
|
3884
|
+
return 'Character';
|
|
3885
|
+
case 2:
|
|
3886
|
+
return 'InsideMargin';
|
|
3887
|
+
case 3:
|
|
3888
|
+
return 'LeftMargin';
|
|
3889
|
+
case 4:
|
|
3890
|
+
return 'Margin';
|
|
3891
|
+
case 5:
|
|
3892
|
+
return 'OutsideMargin';
|
|
3893
|
+
case 6:
|
|
3894
|
+
return 'Page';
|
|
3895
|
+
case 7:
|
|
3896
|
+
return 'RightMargin';
|
|
3897
|
+
default:
|
|
3898
|
+
return horizontalOrigin;
|
|
3899
|
+
}
|
|
3900
|
+
};
|
|
3901
|
+
SfdtReader.prototype.getTableVerticalRelation = function (tableRelation) {
|
|
3902
|
+
switch (tableRelation) {
|
|
3903
|
+
case 0:
|
|
3904
|
+
return 'Paragraph';
|
|
3905
|
+
case 1:
|
|
3906
|
+
return 'Margin';
|
|
3907
|
+
case 2:
|
|
3908
|
+
return 'Page';
|
|
3909
|
+
default:
|
|
3910
|
+
return tableRelation;
|
|
3911
|
+
}
|
|
3912
|
+
};
|
|
3913
|
+
SfdtReader.prototype.getTableHorizontalRelation = function (tableRelation) {
|
|
3914
|
+
switch (tableRelation) {
|
|
3915
|
+
case 0:
|
|
3916
|
+
return 'Column';
|
|
3917
|
+
case 1:
|
|
3918
|
+
return 'Margin';
|
|
3919
|
+
case 2:
|
|
3920
|
+
return 'Page';
|
|
3921
|
+
default:
|
|
3922
|
+
return tableRelation;
|
|
3923
|
+
}
|
|
3924
|
+
};
|
|
3925
|
+
SfdtReader.prototype.getTableVerticalPosition = function (tableVerticalPosition) {
|
|
3926
|
+
switch (tableVerticalPosition) {
|
|
3927
|
+
case 0:
|
|
3928
|
+
return 'None';
|
|
3929
|
+
case 1:
|
|
3930
|
+
return 'Top';
|
|
3931
|
+
case 2:
|
|
3932
|
+
return 'Center';
|
|
3933
|
+
case 3:
|
|
3934
|
+
return 'Bottom';
|
|
3935
|
+
case 4:
|
|
3936
|
+
return 'Inside';
|
|
3937
|
+
case 5:
|
|
3938
|
+
return 'Outside';
|
|
3939
|
+
default:
|
|
3940
|
+
return tableVerticalPosition;
|
|
3941
|
+
}
|
|
3942
|
+
};
|
|
3943
|
+
SfdtReader.prototype.getTableHorizontalPosition = function (tableHorizontalPosition) {
|
|
3944
|
+
switch (tableHorizontalPosition) {
|
|
3945
|
+
case 0:
|
|
3946
|
+
return 'Left';
|
|
3947
|
+
case 1:
|
|
3948
|
+
return 'Center';
|
|
3949
|
+
case 2:
|
|
3950
|
+
return 'Inside';
|
|
3951
|
+
case 3:
|
|
3952
|
+
return 'Outside';
|
|
3953
|
+
case 4:
|
|
3954
|
+
return 'Right';
|
|
3955
|
+
default:
|
|
3956
|
+
return tableHorizontalPosition;
|
|
3957
|
+
}
|
|
3958
|
+
};
|
|
3959
|
+
SfdtReader.prototype.getLineDashStyle = function (lineDashStyle) {
|
|
3960
|
+
switch (lineDashStyle) {
|
|
3961
|
+
case 0:
|
|
3962
|
+
return 'Solid';
|
|
3963
|
+
case 1:
|
|
3964
|
+
return 'Dash';
|
|
3965
|
+
case 2:
|
|
3966
|
+
return 'DashDot';
|
|
3967
|
+
case 3:
|
|
3968
|
+
return 'DashDotDot';
|
|
3969
|
+
case 4:
|
|
3970
|
+
return 'DashDotGEL';
|
|
3971
|
+
case 5:
|
|
3972
|
+
return 'DashGEL';
|
|
3973
|
+
case 6:
|
|
3974
|
+
return 'Dot';
|
|
3975
|
+
case 7:
|
|
3976
|
+
return 'DotGEL';
|
|
3977
|
+
case 8:
|
|
3978
|
+
return 'LongDashDotDotGEL';
|
|
3979
|
+
case 9:
|
|
3980
|
+
return 'LongDashDotGEL';
|
|
3981
|
+
case 10:
|
|
3982
|
+
return 'LongDashGEL';
|
|
3983
|
+
default:
|
|
3984
|
+
return lineDashStyle;
|
|
3985
|
+
}
|
|
3986
|
+
};
|
|
3987
|
+
SfdtReader.prototype.getFillType = function (value) {
|
|
3988
|
+
switch (value) {
|
|
3989
|
+
case 0:
|
|
3990
|
+
return 'FillSolid';
|
|
3991
|
+
case 1:
|
|
3992
|
+
return 'FillPatterned';
|
|
3993
|
+
case 2:
|
|
3994
|
+
return 'FillGradient';
|
|
3995
|
+
case 3:
|
|
3996
|
+
return 'FillTextured';
|
|
3997
|
+
case 4:
|
|
3998
|
+
return 'FillBackground';
|
|
3999
|
+
case 5:
|
|
4000
|
+
return 'FillPicture';
|
|
4001
|
+
case 6:
|
|
4002
|
+
return 'None';
|
|
4003
|
+
case 7:
|
|
4004
|
+
return 'FillMixed';
|
|
4005
|
+
default:
|
|
4006
|
+
return value;
|
|
4007
|
+
}
|
|
4008
|
+
};
|
|
4009
|
+
SfdtReader.prototype.getHorizontalPositionAbs = function (horizontalPositionAbs) {
|
|
4010
|
+
switch (horizontalPositionAbs) {
|
|
4011
|
+
case 0:
|
|
4012
|
+
return 'Left';
|
|
4013
|
+
case 1:
|
|
4014
|
+
return 'Center';
|
|
4015
|
+
case 2:
|
|
4016
|
+
return 'Right';
|
|
4017
|
+
case 3:
|
|
4018
|
+
return 'Inside';
|
|
4019
|
+
case 4:
|
|
4020
|
+
return 'Outside';
|
|
4021
|
+
default:
|
|
4022
|
+
return horizontalPositionAbs;
|
|
4023
|
+
}
|
|
4024
|
+
};
|
|
4025
|
+
SfdtReader.prototype.getTabJustification = function (tabJustification) {
|
|
4026
|
+
switch (tabJustification) {
|
|
4027
|
+
case 0:
|
|
4028
|
+
return 'Left';
|
|
4029
|
+
case 1:
|
|
4030
|
+
return 'Bar';
|
|
4031
|
+
case 2:
|
|
4032
|
+
return 'Center';
|
|
4033
|
+
case 3:
|
|
4034
|
+
return 'Decimal';
|
|
4035
|
+
case 4:
|
|
4036
|
+
return 'List';
|
|
4037
|
+
case 5:
|
|
4038
|
+
return 'Right';
|
|
4039
|
+
default:
|
|
4040
|
+
return tabJustification;
|
|
4041
|
+
}
|
|
4042
|
+
};
|
|
4043
|
+
SfdtReader.prototype.getTabLeader = function (tabLeader) {
|
|
4044
|
+
switch (tabLeader) {
|
|
4045
|
+
case 0:
|
|
4046
|
+
return 'None';
|
|
4047
|
+
case 1:
|
|
4048
|
+
return 'Single';
|
|
4049
|
+
case 2:
|
|
4050
|
+
return 'Dot';
|
|
4051
|
+
case 3:
|
|
4052
|
+
return 'Hyphen';
|
|
4053
|
+
case 4:
|
|
4054
|
+
return 'Underscore';
|
|
4055
|
+
default:
|
|
4056
|
+
return tabLeader;
|
|
4057
|
+
}
|
|
4058
|
+
};
|
|
4059
|
+
SfdtReader.prototype.getTextFormFieldType = function (textFormFieldType) {
|
|
4060
|
+
switch (textFormFieldType) {
|
|
4061
|
+
case 0:
|
|
4062
|
+
return 'Text';
|
|
4063
|
+
case 1:
|
|
4064
|
+
return 'Number';
|
|
4065
|
+
case 2:
|
|
4066
|
+
return 'Date';
|
|
4067
|
+
case 3:
|
|
4068
|
+
return 'Calculation';
|
|
4069
|
+
default:
|
|
4070
|
+
return textFormFieldType;
|
|
4071
|
+
}
|
|
4072
|
+
};
|
|
4073
|
+
SfdtReader.prototype.getTextFormFieldFormat = function (textFormFieldFormat) {
|
|
4074
|
+
switch (textFormFieldFormat) {
|
|
4075
|
+
case 0:
|
|
4076
|
+
return 'None';
|
|
4077
|
+
case 1:
|
|
4078
|
+
return 'FirstCapital';
|
|
4079
|
+
case 2:
|
|
4080
|
+
return 'Lowercase';
|
|
4081
|
+
case 3:
|
|
4082
|
+
return 'Uppercase';
|
|
4083
|
+
case 4:
|
|
4084
|
+
return 'Titlecase';
|
|
4085
|
+
default:
|
|
4086
|
+
return textFormFieldFormat;
|
|
4087
|
+
}
|
|
4088
|
+
};
|
|
4089
|
+
SfdtReader.prototype.getCheckBoxSizeType = function (checkBoxSizeType) {
|
|
4090
|
+
switch (checkBoxSizeType) {
|
|
4091
|
+
case 0:
|
|
4092
|
+
return 'Auto';
|
|
4093
|
+
case 1:
|
|
4094
|
+
return 'Exactly';
|
|
4095
|
+
default:
|
|
4096
|
+
return checkBoxSizeType;
|
|
4097
|
+
}
|
|
4098
|
+
};
|
|
4099
|
+
SfdtReader.prototype.getContentControlAppearance = function (contentControlAppearance) {
|
|
4100
|
+
switch (contentControlAppearance) {
|
|
4101
|
+
case 1:
|
|
4102
|
+
return 'BoundingBox';
|
|
4103
|
+
case 2:
|
|
4104
|
+
return 'Hidden';
|
|
4105
|
+
case 3:
|
|
4106
|
+
return 'Tags';
|
|
4107
|
+
default:
|
|
4108
|
+
return contentControlAppearance;
|
|
4109
|
+
}
|
|
4110
|
+
};
|
|
4111
|
+
SfdtReader.prototype.getContentControlType = function (contentControlType) {
|
|
4112
|
+
switch (contentControlType) {
|
|
4113
|
+
case 0:
|
|
4114
|
+
return 'RichText';
|
|
4115
|
+
case 1:
|
|
4116
|
+
return 'BuildingBlockGallery';
|
|
4117
|
+
case 2:
|
|
4118
|
+
return 'CheckBox';
|
|
4119
|
+
case 3:
|
|
4120
|
+
return 'ComboBox';
|
|
4121
|
+
case 4:
|
|
4122
|
+
return 'Date';
|
|
4123
|
+
case 5:
|
|
4124
|
+
return 'DropDownList';
|
|
4125
|
+
case 6:
|
|
4126
|
+
return 'Group';
|
|
4127
|
+
case 7:
|
|
4128
|
+
return 'Picture';
|
|
4129
|
+
case 8:
|
|
4130
|
+
return 'RepeatingSection';
|
|
4131
|
+
case 9:
|
|
4132
|
+
return 'Text';
|
|
4133
|
+
default:
|
|
4134
|
+
return contentControlType;
|
|
4135
|
+
}
|
|
4136
|
+
};
|
|
4137
|
+
SfdtReader.prototype.getDateCalendarType = function (dateCalendarType) {
|
|
4138
|
+
switch (dateCalendarType) {
|
|
4139
|
+
case 0:
|
|
4140
|
+
return 'Gregorian';
|
|
4141
|
+
case 1:
|
|
4142
|
+
return 'GregorianArabic';
|
|
4143
|
+
case 2:
|
|
4144
|
+
return 'GregorianEnglish';
|
|
4145
|
+
case 3:
|
|
4146
|
+
return 'GregorianMiddleEastFrench';
|
|
4147
|
+
case 4:
|
|
4148
|
+
return 'GregorianTransliteratedEnglish';
|
|
4149
|
+
case 5:
|
|
4150
|
+
return 'GregorianTransliteratedFrench';
|
|
4151
|
+
case 6:
|
|
4152
|
+
return 'Hebrew';
|
|
4153
|
+
case 7:
|
|
4154
|
+
return 'Hijri';
|
|
4155
|
+
case 8:
|
|
4156
|
+
return 'Japan';
|
|
4157
|
+
case 9:
|
|
4158
|
+
return 'Korean';
|
|
4159
|
+
case 10:
|
|
4160
|
+
return 'Saka';
|
|
4161
|
+
case 11:
|
|
4162
|
+
return 'Taiwan';
|
|
4163
|
+
case 12:
|
|
4164
|
+
return 'Thai';
|
|
4165
|
+
default:
|
|
4166
|
+
return dateCalendarType;
|
|
4167
|
+
}
|
|
4168
|
+
};
|
|
4169
|
+
SfdtReader.prototype.getDateStorageFormat = function (dateStorageFormat) {
|
|
4170
|
+
switch (dateStorageFormat) {
|
|
4171
|
+
case 1:
|
|
4172
|
+
return 'DateStorageDate';
|
|
4173
|
+
case 2:
|
|
4174
|
+
return 'DateStorageDateTime';
|
|
4175
|
+
case 3:
|
|
4176
|
+
return 'DateStorageText';
|
|
4177
|
+
default:
|
|
4178
|
+
return dateStorageFormat;
|
|
4179
|
+
}
|
|
4180
|
+
};
|
|
4181
|
+
SfdtReader.prototype.getTextWrappingStyle = function (textWrappingStyle) {
|
|
4182
|
+
switch (textWrappingStyle) {
|
|
4183
|
+
case 0:
|
|
4184
|
+
return 'Inline';
|
|
4185
|
+
case 1:
|
|
4186
|
+
return 'InFrontOfText';
|
|
4187
|
+
case 2:
|
|
4188
|
+
return 'Square';
|
|
4189
|
+
case 3:
|
|
4190
|
+
return 'TopAndBottom';
|
|
4191
|
+
case 4:
|
|
4192
|
+
return 'Behind';
|
|
4193
|
+
default:
|
|
4194
|
+
return textWrappingStyle;
|
|
4195
|
+
}
|
|
4196
|
+
};
|
|
4197
|
+
SfdtReader.prototype.getTextWrappingType = function (textWrappingType) {
|
|
4198
|
+
switch (textWrappingType) {
|
|
4199
|
+
case 0:
|
|
4200
|
+
return 'Both';
|
|
4201
|
+
case 1:
|
|
4202
|
+
return 'Left';
|
|
4203
|
+
case 2:
|
|
4204
|
+
return 'Right';
|
|
4205
|
+
case 3:
|
|
4206
|
+
return 'Largest';
|
|
4207
|
+
default:
|
|
4208
|
+
return textWrappingType;
|
|
4209
|
+
}
|
|
4210
|
+
};
|
|
4211
|
+
SfdtReader.prototype.getCompatibilityMode = function (compatibilityMode) {
|
|
4212
|
+
switch (compatibilityMode) {
|
|
4213
|
+
case 0:
|
|
4214
|
+
return 'Word2013';
|
|
4215
|
+
case 1:
|
|
4216
|
+
return 'Word2003';
|
|
4217
|
+
case 2:
|
|
4218
|
+
return 'Word2007';
|
|
4219
|
+
case 3:
|
|
4220
|
+
return 'Word2010';
|
|
4221
|
+
default:
|
|
4222
|
+
return compatibilityMode;
|
|
4223
|
+
}
|
|
4224
|
+
};
|
|
4225
|
+
SfdtReader.prototype.getLineFormatType = function (lineFormatType) {
|
|
4226
|
+
switch (lineFormatType) {
|
|
4227
|
+
case 0:
|
|
4228
|
+
return 'Solid';
|
|
4229
|
+
case 1:
|
|
4230
|
+
return 'Patterned';
|
|
4231
|
+
case 2:
|
|
4232
|
+
return 'Gradient';
|
|
4233
|
+
case 3:
|
|
4234
|
+
return 'None';
|
|
4235
|
+
default:
|
|
4236
|
+
return lineFormatType;
|
|
4237
|
+
}
|
|
4238
|
+
};
|
|
4239
|
+
SfdtReader.prototype.getAutoShapeType = function (autoShapeType) {
|
|
4240
|
+
switch (autoShapeType) {
|
|
4241
|
+
case 1:
|
|
4242
|
+
return 'Rectangle';
|
|
4243
|
+
case 2:
|
|
4244
|
+
return 'RoundedRectangle';
|
|
4245
|
+
case 3:
|
|
4246
|
+
return 'StraightConnector';
|
|
4247
|
+
case 4:
|
|
4248
|
+
return "Oval";
|
|
4249
|
+
case 5:
|
|
4250
|
+
return "IsoscelesTriangle";
|
|
4251
|
+
case 6:
|
|
4252
|
+
return "RightTriangle";
|
|
4253
|
+
case 7:
|
|
4254
|
+
return "Parallelogram";
|
|
4255
|
+
case 8:
|
|
4256
|
+
return "Trapezoid";
|
|
4257
|
+
case 9:
|
|
4258
|
+
return "Diamond";
|
|
4259
|
+
case 10:
|
|
4260
|
+
return "RegularPentagon";
|
|
4261
|
+
case 11:
|
|
4262
|
+
return "Hexagon";
|
|
4263
|
+
case 12:
|
|
4264
|
+
return "Heptagon";
|
|
4265
|
+
case 13:
|
|
4266
|
+
return "Octagon";
|
|
4267
|
+
case 14:
|
|
4268
|
+
return "Decagon";
|
|
4269
|
+
case 15:
|
|
4270
|
+
return "Dodecagon";
|
|
4271
|
+
case 16:
|
|
4272
|
+
return "Chord";
|
|
4273
|
+
case 17:
|
|
4274
|
+
return "Teardrop";
|
|
4275
|
+
case 18:
|
|
4276
|
+
return "Frame";
|
|
4277
|
+
case 19:
|
|
4278
|
+
return "HalfFrame";
|
|
4279
|
+
case 20:
|
|
4280
|
+
return "L_Shape";
|
|
4281
|
+
case 21:
|
|
4282
|
+
return "Pie";
|
|
4283
|
+
case 22:
|
|
4284
|
+
return "DiagonalStripe";
|
|
4285
|
+
case 23:
|
|
4286
|
+
return "Cross";
|
|
4287
|
+
case 24:
|
|
4288
|
+
return "Plaque";
|
|
4289
|
+
case 25:
|
|
4290
|
+
return "Can";
|
|
4291
|
+
case 26:
|
|
4292
|
+
return "Cube";
|
|
4293
|
+
case 27:
|
|
4294
|
+
return "Bevel";
|
|
4295
|
+
case 28:
|
|
4296
|
+
return "Donut";
|
|
4297
|
+
case 29:
|
|
4298
|
+
return "NoSymbol";
|
|
4299
|
+
case 30:
|
|
4300
|
+
return "BlockArc";
|
|
4301
|
+
case 31:
|
|
4302
|
+
return "FoldedCorner";
|
|
4303
|
+
case 32:
|
|
4304
|
+
return "SmileyFace";
|
|
4305
|
+
case 33:
|
|
4306
|
+
return "Heart";
|
|
4307
|
+
case 34:
|
|
4308
|
+
return "LightningBolt";
|
|
4309
|
+
case 35:
|
|
4310
|
+
return "Sun";
|
|
4311
|
+
case 36:
|
|
4312
|
+
return "Moon";
|
|
4313
|
+
case 37:
|
|
4314
|
+
return "Cloud";
|
|
4315
|
+
case 38:
|
|
4316
|
+
return "Arc";
|
|
4317
|
+
case 39:
|
|
4318
|
+
return "DoubleBracket";
|
|
4319
|
+
case 40:
|
|
4320
|
+
return "DoubleBrace";
|
|
4321
|
+
case 41:
|
|
4322
|
+
return "LeftBracket";
|
|
4323
|
+
case 42:
|
|
4324
|
+
return "RightBracket";
|
|
4325
|
+
case 43:
|
|
4326
|
+
return "LeftBrace";
|
|
4327
|
+
case 44:
|
|
4328
|
+
return "RightBrace";
|
|
4329
|
+
case 45:
|
|
4330
|
+
return "FlowChartProcess";
|
|
4331
|
+
case 46:
|
|
4332
|
+
return "FlowChartAlternateProcess";
|
|
4333
|
+
case 47:
|
|
4334
|
+
return "FlowChartDecision";
|
|
4335
|
+
case 48:
|
|
4336
|
+
return "FlowChartData";
|
|
4337
|
+
case 49:
|
|
4338
|
+
return "FlowChartPredefinedProcess";
|
|
4339
|
+
case 50:
|
|
4340
|
+
return "FlowChartInternalStorage";
|
|
4341
|
+
case 51:
|
|
4342
|
+
return "FlowChartDocument";
|
|
4343
|
+
case 52:
|
|
4344
|
+
return "FlowChartMultiDocument";
|
|
4345
|
+
case 53:
|
|
4346
|
+
return "FlowChartTerminator";
|
|
4347
|
+
case 54:
|
|
4348
|
+
return "FlowChartPreparation";
|
|
4349
|
+
case 55:
|
|
4350
|
+
return "FlowChartManualInput";
|
|
4351
|
+
case 56:
|
|
4352
|
+
return "FlowChartManualOperation";
|
|
4353
|
+
case 57:
|
|
4354
|
+
return "FlowChartConnector";
|
|
4355
|
+
case 58:
|
|
4356
|
+
return "FlowChartOffPageConnector";
|
|
4357
|
+
case 59:
|
|
4358
|
+
return "FlowChartCard";
|
|
4359
|
+
case 60:
|
|
4360
|
+
return "FlowChartPunchedTape";
|
|
4361
|
+
case 61:
|
|
4362
|
+
return "FlowChartSummingJunction";
|
|
4363
|
+
case 62:
|
|
4364
|
+
return "FlowChartOr";
|
|
4365
|
+
case 63:
|
|
4366
|
+
return "FlowChartCollate";
|
|
4367
|
+
case 64:
|
|
4368
|
+
return "FlowChartSort";
|
|
4369
|
+
case 65:
|
|
4370
|
+
return "FlowChartExtract";
|
|
4371
|
+
case 66:
|
|
4372
|
+
return "FlowChartMerge";
|
|
4373
|
+
case 67:
|
|
4374
|
+
return "FlowChartStoredData";
|
|
4375
|
+
case 68:
|
|
4376
|
+
return "FlowChartDelay";
|
|
4377
|
+
case 69:
|
|
4378
|
+
return "FlowChartSequentialAccessStorage";
|
|
4379
|
+
case 70:
|
|
4380
|
+
return "FlowChartMagneticDisk";
|
|
4381
|
+
case 71:
|
|
4382
|
+
return "FlowChartDirectAccessStorage";
|
|
4383
|
+
case 72:
|
|
4384
|
+
return "FlowChartDisplay";
|
|
4385
|
+
case 73:
|
|
4386
|
+
return "RightArrow";
|
|
4387
|
+
case 74:
|
|
4388
|
+
return "LeftArrow";
|
|
4389
|
+
case 75:
|
|
4390
|
+
return "UpArrow";
|
|
4391
|
+
case 76:
|
|
4392
|
+
return "DownArrow";
|
|
4393
|
+
case 77:
|
|
4394
|
+
return "LeftRightArrow";
|
|
4395
|
+
case 78:
|
|
4396
|
+
return "UpDownArrow";
|
|
4397
|
+
case 79:
|
|
4398
|
+
return "QuadArrow";
|
|
4399
|
+
case 80:
|
|
4400
|
+
return "LeftRightUpArrow";
|
|
4401
|
+
case 81:
|
|
4402
|
+
return "BentArrow";
|
|
4403
|
+
case 82:
|
|
4404
|
+
return "UTurnArrow";
|
|
4405
|
+
case 83:
|
|
4406
|
+
return "LeftUpArrow";
|
|
4407
|
+
case 84:
|
|
4408
|
+
return "BentUpArrow";
|
|
4409
|
+
case 85:
|
|
4410
|
+
return "CurvedRightArrow";
|
|
4411
|
+
case 86:
|
|
4412
|
+
return "CurvedLeftArrow";
|
|
4413
|
+
case 87:
|
|
4414
|
+
return "CurvedUpArrow";
|
|
4415
|
+
case 88:
|
|
4416
|
+
return "CurvedDownArrow";
|
|
4417
|
+
case 89:
|
|
4418
|
+
return "StripedRightArrow";
|
|
4419
|
+
case 90:
|
|
4420
|
+
return "NotchedRightArrow";
|
|
4421
|
+
case 91:
|
|
4422
|
+
return "Pentagon";
|
|
4423
|
+
case 92:
|
|
4424
|
+
return "Chevron";
|
|
4425
|
+
case 93:
|
|
4426
|
+
return "RightArrowCallout";
|
|
4427
|
+
case 94:
|
|
4428
|
+
return "DownArrowCallout";
|
|
4429
|
+
case 95:
|
|
4430
|
+
return "LeftArrowCallout";
|
|
4431
|
+
case 96:
|
|
4432
|
+
return "UpArrowCallout";
|
|
4433
|
+
case 97:
|
|
4434
|
+
return "LeftRightArrowCallout";
|
|
4435
|
+
case 98:
|
|
4436
|
+
return "QuadArrowCallout";
|
|
4437
|
+
case 99:
|
|
4438
|
+
return "CircularArrow";
|
|
4439
|
+
case 100:
|
|
4440
|
+
return "MathPlus";
|
|
4441
|
+
case 101:
|
|
4442
|
+
return "MathMinus";
|
|
4443
|
+
case 102:
|
|
4444
|
+
return "MathMultiply";
|
|
4445
|
+
case 103:
|
|
4446
|
+
return "MathDivision";
|
|
4447
|
+
case 104:
|
|
4448
|
+
return "MathEqual";
|
|
4449
|
+
case 105:
|
|
4450
|
+
return "MathNotEqual";
|
|
4451
|
+
case 106:
|
|
4452
|
+
return "Explosion1";
|
|
4453
|
+
case 107:
|
|
4454
|
+
return "Explosion2";
|
|
4455
|
+
case 108:
|
|
4456
|
+
return "Star4Point";
|
|
4457
|
+
case 109:
|
|
4458
|
+
return "Star5Point";
|
|
4459
|
+
case 110:
|
|
4460
|
+
return "Star6Point";
|
|
4461
|
+
case 111:
|
|
4462
|
+
return "Star7Point";
|
|
4463
|
+
case 112:
|
|
4464
|
+
return "Star8Point";
|
|
4465
|
+
case 113:
|
|
4466
|
+
return "Star10Point";
|
|
4467
|
+
case 114:
|
|
4468
|
+
return "Star12Point";
|
|
4469
|
+
case 115:
|
|
4470
|
+
return "Star16Point";
|
|
4471
|
+
case 116:
|
|
4472
|
+
return "Star24Point";
|
|
4473
|
+
case 117:
|
|
4474
|
+
return "Star32Point";
|
|
4475
|
+
case 118:
|
|
4476
|
+
return "UpRibbon";
|
|
4477
|
+
case 119:
|
|
4478
|
+
return "DownRibbon";
|
|
4479
|
+
case 120:
|
|
4480
|
+
return "CurvedUpRibbon";
|
|
4481
|
+
case 121:
|
|
4482
|
+
return "CurvedDownRibbon";
|
|
4483
|
+
case 122:
|
|
4484
|
+
return "VerticalScroll";
|
|
4485
|
+
case 123:
|
|
4486
|
+
return "HorizontalScroll";
|
|
4487
|
+
case 124:
|
|
4488
|
+
return "Wave";
|
|
4489
|
+
case 125:
|
|
4490
|
+
return "DoubleWave";
|
|
4491
|
+
case 126:
|
|
4492
|
+
return "SnipSingleCornerRectangle";
|
|
4493
|
+
case 127:
|
|
4494
|
+
return "SnipSameSideCornerRectangle";
|
|
4495
|
+
case 128:
|
|
4496
|
+
return "SnipDiagonalCornerRectangle";
|
|
4497
|
+
case 129:
|
|
4498
|
+
return "SnipAndRoundSingleCornerRectangle";
|
|
4499
|
+
case 130:
|
|
4500
|
+
return "RoundSingleCornerRectangle";
|
|
4501
|
+
case 131:
|
|
4502
|
+
return "RoundSameSideCornerRectangle";
|
|
4503
|
+
case 132:
|
|
4504
|
+
return "RoundDiagonalCornerRectangle";
|
|
4505
|
+
case 133:
|
|
4506
|
+
return "Unknown";
|
|
4507
|
+
case 134:
|
|
4508
|
+
return "ElbowConnector";
|
|
4509
|
+
case 135:
|
|
4510
|
+
return "CurvedConnector";
|
|
4511
|
+
case 136:
|
|
4512
|
+
return "RectangularCallout";
|
|
4513
|
+
case 137:
|
|
4514
|
+
return 'CloudCallout';
|
|
4515
|
+
case 138:
|
|
4516
|
+
return 'LineCallout1NoBorder';
|
|
4517
|
+
default:
|
|
4518
|
+
return autoShapeType;
|
|
4519
|
+
}
|
|
4520
|
+
};
|
|
4521
|
+
/**
|
|
4522
|
+
* @private
|
|
4523
|
+
* @returns {void}
|
|
4524
|
+
*/
|
|
4525
|
+
SfdtReader.prototype.destroy = function () {
|
|
4526
|
+
if (this.footnotes) {
|
|
4527
|
+
this.footnotes.destroy();
|
|
4528
|
+
}
|
|
4529
|
+
this.footnotes = undefined;
|
|
4530
|
+
if (this.endnotes) {
|
|
4531
|
+
this.endnotes.destroy();
|
|
4532
|
+
}
|
|
4533
|
+
this.endnotes = undefined;
|
|
4534
|
+
if (this.editableRanges) {
|
|
4535
|
+
this.editableRanges.destroy();
|
|
4536
|
+
}
|
|
4537
|
+
this.editableRanges = undefined;
|
|
4538
|
+
if (this.commentEnds) {
|
|
4539
|
+
this.commentEnds.destroy();
|
|
4540
|
+
}
|
|
4541
|
+
this.commentEnds = undefined;
|
|
4542
|
+
if (this.commentStarts) {
|
|
4543
|
+
this.commentStarts.destroy();
|
|
4544
|
+
}
|
|
4545
|
+
this.commentStarts = undefined;
|
|
4546
|
+
if (this.commentsCollection) {
|
|
4547
|
+
this.commentsCollection.destroy();
|
|
4548
|
+
}
|
|
4549
|
+
this.commentsCollection = undefined;
|
|
4550
|
+
if (this.revisionCollection) {
|
|
4551
|
+
this.revisionCollection.destroy();
|
|
4552
|
+
}
|
|
4553
|
+
this.revisionCollection = undefined;
|
|
4554
|
+
if (this.fontInfoCollection) {
|
|
4555
|
+
this.fontInfoCollection.destroy();
|
|
4556
|
+
}
|
|
4557
|
+
if (this.revisionMap) {
|
|
4558
|
+
this.revisionMap.destroy();
|
|
4559
|
+
}
|
|
4560
|
+
this.revisionHelper = undefined;
|
|
4561
|
+
this.revisionMap = undefined;
|
|
4562
|
+
this.stylesCollection = undefined;
|
|
4563
|
+
this.fontInfoCollection = undefined;
|
|
4564
|
+
this.documentHelper = undefined;
|
|
4565
|
+
this.keywordIndex = undefined;
|
|
4566
|
+
};
|
|
4567
|
+
return SfdtReader;
|
|
4568
|
+
}());
|
|
4569
|
+
export { SfdtReader };
|