UNPKG

devexpress-richedit

Version:

DevExpress Rich Text Editor is an advanced word-processing tool designed for working with rich text documents.

228 lines (227 loc) 15.2 kB
import { MapCreator } from '../../../../../utils/map-creator'; import { StyleSheetDestination } from '../../destination/styles/style-sheet-destination'; import { DefaultDestination } from '../../destination/sub-document/default-destination'; import { addCommonCharacterKeywords, addCommonNumberingListsKeywords, addCommonParagraphKeywords, addCommonSymbolsAndObjectsKeywords, addCommonTabKeywords } from './sub-document-keywords'; import { appendTableKeywords } from './table-keywords'; const addDocumentPropertiesKeywords = new MapCreator() .add("paperw", DefaultDestination.onPaperWidthKeyword) .add("paperh", DefaultDestination.onPaperHeightKeyword) .add("psz", DefaultDestination.onPaperSizeKeyword) .add("landscape", DefaultDestination.onLandscapeKeyword) .add("gutter", DefaultDestination.onGutterKeyword) .add("margl", DefaultDestination.onLeftMarginKeyword) .add("margr", DefaultDestination.onRightMarginKeyword) .add("margt", DefaultDestination.onTopMarginKeyword) .add("margb", DefaultDestination.onBottomMarginKeyword) .add("rtlgutter", DefaultDestination.onGutterAtRight) .add("pgnstart", DefaultDestination.onPageNumberingStart) .add("facingp", DefaultDestination.onPageFacing) .add("endnotes", DefaultDestination.onFootNotePlacementEndOfSection) .add("enddoc", DefaultDestination.onFootNotePlacementEndOfDocument) .add("ftntj", DefaultDestination.onFootNotePlacementBelowText) .add("ftnbj", DefaultDestination.onFootNotePlacementPageBottom) .add("ftnstart", DefaultDestination.onFootNoteNumberingStart) .add("ftnrstpg", DefaultDestination.onFootNoteNumberingRestartEachPage) .add("ftnrestart", DefaultDestination.onFootNoteNumberingRestartEachSection) .add("ftnrstcont", DefaultDestination.onFootNoteNumberingRestartContinuous) .add("ftnnar", DefaultDestination.onFootNoteNumberingDecimal) .add("ftnnalc", DefaultDestination.onFootNoteNumberingLowerCaseLetter) .add("ftnnauc", DefaultDestination.onFootNoteNumberingUpperCaseLetter) .add("ftnnrlc", DefaultDestination.onFootNoteNumberingLowerCaseRoman) .add("ftnnruc", DefaultDestination.onFootNoteNumberingUpperCaseRoman) .add("ftnnchi", DefaultDestination.onFootNoteNumberingChicago) .add("ftnnchosung", DefaultDestination.onFootNoteNumberingChosung) .add("ftnncnum", DefaultDestination.onFootNoteNumberingDecimalEnclosedCircle) .add("ftnndbar", DefaultDestination.onFootNoteNumberingDecimalFullWidth) .add("ftnnganada", DefaultDestination.onFootNoteNumberingGanada) .add("aendnotes", DefaultDestination.onEndNotePlacementEndOfSection) .add("aenddoc", DefaultDestination.onEndNotePlacementEndOfDocument) .add("aftntj", DefaultDestination.onEndNotePlacementBelowText) .add("aftnbj", DefaultDestination.onEndNotePlacementPageBottom) .add("aftnstart", DefaultDestination.onEndNoteNumberingStart) .add("aftnrestart", DefaultDestination.onEndNoteNumberingRestartEachSection) .add("aftnrstcont", DefaultDestination.onEndNoteNumberingRestartContinuous) .add("aftnnar", DefaultDestination.onEndNoteNumberingDecimal) .add("aftnnalc", DefaultDestination.onEndNoteNumberingLowerCaseLetter) .add("aftnnauc", DefaultDestination.onEndNoteNumberingUpperCaseLetter) .add("aftnnrlc", DefaultDestination.onEndNoteNumberingLowerCaseRoman) .add("aftnnruc", DefaultDestination.onEndNoteNumberingUpperCaseRoman) .add("aftnnchi", DefaultDestination.onEndNoteNumberingChicago) .add("aftnnchosung", DefaultDestination.onEndNoteNumberingChosung) .add("aftnncnum", DefaultDestination.onEndNoteNumberingDecimalEnclosedCircle) .add("aftnndbar", DefaultDestination.onEndNoteNumberingDecimalFullWidth) .add("aftnnganada", DefaultDestination.onEndNoteNumberingGanada) .add("viewbksp", DefaultDestination.onDisplayBackgroundShape) .get(); const addDocumentCompatibilitiesKeywords = new MapCreator() .add("nocolbal", DefaultDestination.onNoColumnBalance) .add("alntblind", DefaultDestination.onDoNotAlignTableRowsIndependently) .add("expshrtn", DefaultDestination.onDoNotExpandShiftReturn) .add("spltpgpar", DefaultDestination.onSplitPageBreakAndParagraphMark) .add("nogrowautofit", DefaultDestination.onAllowTablesToExtendIntoMargin) .get(); const addDocumentProtectionKeywords = new MapCreator() .add("formprot", DefaultDestination.onFormProtection) .add("revprot", DefaultDestination.onRevisionProtection) .add("annotprot", DefaultDestination.onAnnotationProtection) .add("readprot", DefaultDestination.onReadOnlyProtection) .add("enforceprot", DefaultDestination.onEnforceDocumentProtection) .add("protlevel", DefaultDestination.onDocumentProtectionLevel) .get(); const addSectionKeywords = new MapCreator() .add("pgndec", DefaultDestination.onPageNumberingDecimal) .add("pgnucrm", DefaultDestination.onPageNumberingUpperRoman) .add("pgnlcrm", DefaultDestination.onPageNumberingLowerRoman) .add("pgnucltr", DefaultDestination.onPageNumberingUpperLetter) .add("pgnlcltr", DefaultDestination.onPageNumberingLowerLetter) .add("pgnbidia", DefaultDestination.onPageNumberingArabicAbjad) .add("pgnbidib", DefaultDestination.onPageNumberingArabicAlpha) .add("pgnchosung", DefaultDestination.onPageNumberingChosung) .add("pgncnum", DefaultDestination.onPageNumberingDecimalEnclosedCircle) .add("pgndecd", DefaultDestination.onPageNumberingDecimalFullWidth) .add("pgnganada", DefaultDestination.onPageNumberingGanada) .add("pgnhindia", DefaultDestination.onPageNumberingHindiVowels) .add("pgnhindib", DefaultDestination.onPageNumberingHindiConsonants) .add("pgnhindic", DefaultDestination.onPageNumberingHindiNumbers) .add("pgnhindid", DefaultDestination.onPageNumberingHindiDescriptive) .add("pgnthaia", DefaultDestination.onPageNumberingThaiLetters) .add("pgnthaib", DefaultDestination.onPageNumberingThaiNumbers) .add("pgnthaic", DefaultDestination.onPageNumberingThaiDescriptive) .add("pgnvieta", DefaultDestination.onPageNumberingVietnameseDescriptive) .add("pgnhn", DefaultDestination.onPageNumberingChapterHeaderStyle) .add("pgnhnsh", DefaultDestination.onPageNumberingChapterSeparatorHyphen) .add("pgnhnsp", DefaultDestination.onPageNumberingChapterSeparatorPeriod) .add("pgnhnsc", DefaultDestination.onPageNumberingChapterSeparatorColon) .add("pgnhnsm", DefaultDestination.onPageNumberingChapterSeparatorEmDash) .add("pgnhnsn", DefaultDestination.onPageNumberingChapterSeparatorEnDash) .add("vertal", DefaultDestination.onVerticalTextAlignmentBottom) .add("vertalb", DefaultDestination.onVerticalTextAlignmentBottom) .add("vertalt", DefaultDestination.onVerticalTextAlignmentTop) .add("vertalc", DefaultDestination.onVerticalTextAlignmentCenter) .add("vertalj", DefaultDestination.onVerticalTextAlignmentJustify) .add("pgnstarts", DefaultDestination.onSectionPageNumberingStart) .add("pgncont", DefaultDestination.onSectionPageNumberingContinuous) .add("pgnrestart", DefaultDestination.onSectionPageNumberingRestart) .add("stextflow", DefaultDestination.onSectionTextFlow) .add("linemod", DefaultDestination.onLineNumberingStep) .add("linex", DefaultDestination.onLineNumberingDistance) .add("linestarts", DefaultDestination.onLineNumberingStartingLineNumber) .add("linerestart", DefaultDestination.onLineNumberingRestart) .add("lineppage", DefaultDestination.onLineNumberingRestartOnEachPage) .add("linecont", DefaultDestination.onLineNumberingContinuous) .add("pgwsxn", DefaultDestination.onSectionPaperWidth) .add("pghsxn", DefaultDestination.onSectionPaperHeight) .add("lndscpsxn", DefaultDestination.onSectionLandscape) .add("marglsxn", DefaultDestination.onSectionLeftMargin) .add("margrsxn", DefaultDestination.onSectionRightMargin) .add("margtsxn", DefaultDestination.onSectionTopMargin) .add("margbsxn", DefaultDestination.onSectionBottomMargin) .add("guttersxn", DefaultDestination.onSectionGutter) .add("headery", DefaultDestination.onSectionHeaderOffset) .add("footery", DefaultDestination.onSectionFooterOffset) .add("binfsxn", DefaultDestination.onSectionFirstPagePaperSource) .add("binsxn", DefaultDestination.onSectionOtherPagePaperSource) .add("sectunlocked", DefaultDestination.onOnlyAllowEditingOfFormFields) .add("cols", DefaultDestination.onSectionColumnCount) .add("colsx", DefaultDestination.onSectionColumnSpace) .add("colno", DefaultDestination.onSectionCurrentColumnIndex) .add("colsr", DefaultDestination.onSectionCurrentColumnSpace) .add("colw", DefaultDestination.onSectionCurrentColumnWidth) .add("linebetcol", DefaultDestination.onSectionDrawVerticalSeparator) .add("sbknone", DefaultDestination.onSectionBreakNone) .add("sbkcol", DefaultDestination.onSectionBreakColumn) .add("sbkpage", DefaultDestination.onSectionBreakPage) .add("sbkeven", DefaultDestination.onSectionBreakEvenPage) .add("sbkodd", DefaultDestination.onSectionBreakOddPage) .add("sectd", DefaultDestination.onSectionDefault) .add("sect", DefaultDestination.onNewSection) .add("titlepg", DefaultDestination.onSectionDifferentFirstPage) .add("header", DefaultDestination.onHeaderKeyword) .add("headerl", DefaultDestination.onHeaderForLeftPagesKeyword) .add("headerr", DefaultDestination.onHeaderForRightPagesKeyword) .add("headerf", DefaultDestination.onHeaderForFirstPageKeyword) .add("footer", DefaultDestination.onFooterKeyword) .add("footerl", DefaultDestination.onFooterForLeftPagesKeyword) .add("footerr", DefaultDestination.onFooterForRightPagesKeyword) .add("footerf", DefaultDestination.onFooterForFirstPageKeyword) .add("ltrsect", DefaultDestination.onLtrSectionKeyword) .add("rtlsect", DefaultDestination.onRtlSectionKeyword) .add("sftntj", DefaultDestination.onSectionFootNotePlacementBelowText) .add("sftnbj", DefaultDestination.onSectionFootNotePlacementPageBottom) .add("sftnstart", DefaultDestination.onSectionFootNoteNumberingStart) .add("sftnrstpg", DefaultDestination.onSectionFootNoteNumberingRestartEachPage) .add("sftnrestart", DefaultDestination.onSectionFootNoteNumberingRestartEachSection) .add("sftnrstcont", DefaultDestination.onSectionFootNoteNumberingRestartContinuous) .add("sftnnar", DefaultDestination.onSectionFootNoteNumberingDecimal) .add("sftnnalc", DefaultDestination.onSectionFootNoteNumberingLowerCaseLetter) .add("sftnnauc", DefaultDestination.onSectionFootNoteNumberingUpperCaseLetter) .add("sftnnrlc", DefaultDestination.onSectionFootNoteNumberingLowerCaseRoman) .add("sftnnruc", DefaultDestination.onSectionFootNoteNumberingUpperCaseRoman) .add("sftnnchi", DefaultDestination.onSectionFootNoteNumberingChicago) .add("sftnnchosung", DefaultDestination.onSectionFootNoteNumberingChosung) .add("sftnncnum", DefaultDestination.onSectionFootNoteNumberingDecimalEnclosedCircle) .add("sftnndbar", DefaultDestination.onSectionFootNoteNumberingDecimalFullWidth) .add("sftnnganada", DefaultDestination.onSectionFootNoteNumberingGanada) .add("saftnstart", DefaultDestination.onSectionEndNoteNumberingStart) .add("saftnrestart", DefaultDestination.onSectionEndNoteNumberingRestartEachSection) .add("saftnrstcont", DefaultDestination.onSectionEndNoteNumberingRestartContinuous) .add("saftnnar", DefaultDestination.onSectionEndNoteNumberingDecimal) .add("saftnnalc", DefaultDestination.onSectionEndNoteNumberingLowerCaseLetter) .add("saftnnauc", DefaultDestination.onSectionEndNoteNumberingUpperCaseLetter) .add("saftnnrlc", DefaultDestination.onSectionEndNoteNumberingLowerCaseRoman) .add("saftnnruc", DefaultDestination.onSectionEndNoteNumberingUpperCaseRoman) .add("saftnnchi", DefaultDestination.onSectionEndNoteNumberingChicago) .add("saftnnchosung", DefaultDestination.onSectionEndNoteNumberingChosung) .add("saftnncnum", DefaultDestination.onSectionEndNoteNumberingDecimalEnclosedCircle) .add("saftnndbar", DefaultDestination.onSectionEndNoteNumberingDecimalFullWidth) .add("saftnnganada", DefaultDestination.onSectionEndNoteNumberingGanada) .add("linemod", DefaultDestination.onSectionLineNumberingCountBy) .add("linex", DefaultDestination.onSectionLineNumberingDistance) .add("linestarts", DefaultDestination.onSectionLineNumberingStart) .add("linerestart", DefaultDestination.onSectionLineNumberingNewSection) .add("lineppage", DefaultDestination.onSectionLineNumberingNewPage) .add("linecont", DefaultDestination.onSectionLineNumberingContinuous) .get(); const addFootNoteAndEndNoteKeywords = new MapCreator() .add("footnote", DefaultDestination.onFootNoteKeyword) .get(); const addCommentKeywords = new MapCreator() .add("atrfstart", DefaultDestination.onCommentStartPositionKeyword) .add("atrfend", DefaultDestination.onCommentEndPositionKeyword) .add("atnid", DefaultDestination.onCommentIdKeyword) .add("atnauthor", DefaultDestination.onCommentAuthorKeyword) .add("annotation", DefaultDestination.onCommentAnnotationKeyword) .get(); export const defaultDestinationKeywordHT = new MapCreator() .add("rtf", () => { }) .add("deff", DefaultDestination.onDeffKeyword) .add("info", DefaultDestination.onInfoKeyword) .add("userprops", DefaultDestination.onUserPropKeyword) .add("stylesheet", (data) => data.destination = new StyleSheetDestination(data)) .add("defchp", DefaultDestination.onDefaultCharacterPropertiesKeyword) .add("defpap", DefaultDestination.onDefaultParagraphPropertiesKeyword) .add("page", DefaultDestination.onPageBreakKeyword) .add("column", DefaultDestination.onColumnBreakKeyword) .add("deftab", DefaultDestination.onDefaultTabKeyword) .add("margmirror", DefaultDestination.onMirrorMargins) .add("rempersonalinfo", DefaultDestination.onRemovePersonalInformation) .add("listtable", DefaultDestination.onListTableKeyword) .add("listoverridetable", DefaultDestination.onListOverrideTableKeyword) .add("background", DefaultDestination.onPageBackground) .add("themedata", DefaultDestination.onThemeData) .add("colorschememapping", DefaultDestination.onColorsSchemeMapping) .add("nouicompat", DefaultDestination.onNoUICompat) .add("nofeaturethrottle", DefaultDestination.onNoFeatureThrottle) .append(addDocumentProtectionKeywords) .append(addCommonNumberingListsKeywords) .append(addCommonTabKeywords) .append(addDocumentCompatibilitiesKeywords) .append(addCommonCharacterKeywords) .append(addCommonParagraphKeywords) .append(appendTableKeywords) .append(addDocumentPropertiesKeywords) .append(addSectionKeywords) .append(addFootNoteAndEndNoteKeywords) .append(addCommentKeywords) .append(addCommonSymbolsAndObjectsKeywords) .get();