UNPKG

devexpress-richedit

Version:

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

451 lines (450 loc) 15.2 kB
import { Equals } from '@devexpress/utils/lib/utils/comparers'; import { ColorModelInfo } from '../color/color-model-info'; import { FontBoldHistoryItem, FontCapsHistoryItem, FontCompositeFontInfoHistoryItem, FontHiddenHistoryItem, FontHighlightColorHistoryItem, FontItalicHistoryItem, FontLangInfoHistoryItem, FontNameHistoryItem, FontNoProofHistoryItem, FontScriptHistoryItem, FontShadingInfoHistoryItem, FontSizeHistoryItem, FontSmallCapsHistoryItem, FontStrikeoutColorHistoryItem, FontStrikeoutTypeHistoryItem, FontStrikeoutWordsOnlyHistoryItem, FontTextColorHistoryItem, FontUnderlineColorHistoryItem, FontUnderlineTypeHistoryItem, FontUnderlineWordsOnlyHistoryItem } from '../history/items/character-properties-history-items'; import { JSONCharacterFormattingProperty } from '../json/enums/json-character-enums'; import { ShadingInfo } from '../shadings/shading-info'; import { CompositeFontInfo } from './composite-font-info'; import { CharacterFormattingScript, CharacterPropertiesMask, StrikeoutType, UnderlineType } from './enums'; import { LangInfo } from './lang-info'; export class CharacterPropertiesAllCapsDescriptor { setProp(props, newValue) { props.allCaps = newValue; } getProp(props) { return props.allCaps; } maskValue() { return CharacterPropertiesMask.UseAllCaps; } getHistoryItemConstructor() { return FontCapsHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.AllCaps; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesSmallCapsDescriptor { setProp(props, newValue) { props.smallCaps = newValue; } getProp(props) { return props.smallCaps; } maskValue() { return CharacterPropertiesMask.UseSmallCaps; } getHistoryItemConstructor() { return FontSmallCapsHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.SmallCaps; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesFontSizeDescriptor { setProp(props, newValue) { props.fontSize = newValue; } getProp(props) { return props.fontSize; } maskValue() { return CharacterPropertiesMask.UseDoubleFontSize; } getHistoryItemConstructor() { return FontSizeHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.Size; } binaryEquals = Equals.simpleType; defaultValue = 11; } export class CharacterPropertiesFontBoldDescriptor { setProp(props, newValue) { props.fontBold = newValue; } getProp(props) { return props.fontBold; } maskValue() { return CharacterPropertiesMask.UseFontBold; } getHistoryItemConstructor() { return FontBoldHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.Bold; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesFontItalicDescriptor { setProp(props, newValue) { props.fontItalic = newValue; } getProp(props) { return props.fontItalic; } maskValue() { return CharacterPropertiesMask.UseFontItalic; } getHistoryItemConstructor() { return FontItalicHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.Italic; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesFontInfoDescriptor { setProp(props, newValue) { props.fontInfo = newValue; } getProp(props) { return props.fontInfo; } maskValue() { return CharacterPropertiesMask.UseFontName; } getHistoryItemConstructor() { return FontNameHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.FontName; } binaryEquals = Equals.object; defaultValue = undefined; } export class CharacterPropertiesScriptDescriptor { setProp(props, newValue) { props.script = newValue; } getProp(props) { return props.script; } maskValue() { return CharacterPropertiesMask.UseScript; } getHistoryItemConstructor() { return FontScriptHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.Script; } binaryEquals = Equals.simpleType; defaultValue = CharacterFormattingScript.Normal; } export class CharacterPropertiesStrikeoutTypeDescriptor { setProp(props, newValue) { props.fontStrikeoutType = newValue; } getProp(props) { return props.fontStrikeoutType; } maskValue() { return CharacterPropertiesMask.UseFontStrikeoutType; } getHistoryItemConstructor() { return FontStrikeoutTypeHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.StrikeoutType; } binaryEquals = Equals.simpleType; defaultValue = StrikeoutType.None; } export class CharacterPropertiesUnderlineTypeDescriptor { setProp(props, newValue) { props.fontUnderlineType = newValue; } getProp(props) { return props.fontUnderlineType; } maskValue() { return CharacterPropertiesMask.UseFontUnderlineType; } getHistoryItemConstructor() { return FontUnderlineTypeHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.UnderlineType; } binaryEquals = Equals.simpleType; defaultValue = UnderlineType.None; } export class CharacterPropertiesUnderlineWordsOnlyDescriptor { setProp(props, newValue) { props.underlineWordsOnly = newValue; } getProp(props) { return props.underlineWordsOnly; } maskValue() { return CharacterPropertiesMask.UseUnderlineWordsOnly; } getHistoryItemConstructor() { return FontUnderlineWordsOnlyHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.UnderlineWordsOnly; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesStrikeoutWordsOnlyDescriptor { setProp(props, newValue) { props.strikeoutWordsOnly = newValue; } getProp(props) { return props.strikeoutWordsOnly; } maskValue() { return CharacterPropertiesMask.UseStrikeoutWordsOnly; } getHistoryItemConstructor() { return FontStrikeoutWordsOnlyHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.StrikeoutWordsOnly; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesNoProofDescriptor { setProp(props, newValue) { props.noProof = newValue; } getProp(props) { return props.noProof; } maskValue() { return CharacterPropertiesMask.UseNoProof; } getHistoryItemConstructor() { return FontNoProofHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.NoProof; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesHiddenDescriptor { setProp(props, newValue) { props.hidden = newValue; } getProp(props) { return props.hidden; } maskValue() { return CharacterPropertiesMask.UseHidden; } getHistoryItemConstructor() { return FontHiddenHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.Hidden; } binaryEquals = Equals.simpleType; defaultValue = false; } export class CharacterPropertiesTextColorDescriptor { setProp(props, newValue) { props.textColor = newValue; } getProp(props) { return props.textColor; } maskValue() { return CharacterPropertiesMask.UseForeColorIndex; } getHistoryItemConstructor() { return FontTextColorHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.TextColor; } binaryEquals = Equals.object; defaultValue = ColorModelInfo.autoColor; } export class CharacterPropertiesShadingInfoColorDescriptor { setProp(props, newValue) { props.shadingInfo = newValue; } getProp(props) { return props.shadingInfo; } maskValue() { return CharacterPropertiesMask.UseShadingInfoIndex; } getHistoryItemConstructor() { return FontShadingInfoHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.ShadingInfo; } binaryEquals = Equals.object; defaultValue = ShadingInfo.noColor; } export class CharacterPropertiesStrikeoutColorDescriptor { setProp(props, newValue) { props.strikeoutColor = newValue; } getProp(props) { return props.strikeoutColor; } maskValue() { return CharacterPropertiesMask.UseStrikeoutColorIndex; } getHistoryItemConstructor() { return FontStrikeoutColorHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.StrikeoutColor; } binaryEquals = Equals.object; defaultValue = ColorModelInfo.noColor; } export class CharacterPropertiesUnderlineColorDescriptor { setProp(props, newValue) { props.underlineColor = newValue; } getProp(props) { return props.underlineColor; } maskValue() { return CharacterPropertiesMask.UseUnderlineColorIndex; } getHistoryItemConstructor() { return FontUnderlineColorHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.UnderlineColor; } binaryEquals = Equals.object; defaultValue = ColorModelInfo.noColor; } export class CharacterPropertiesHighlightColorDescriptor { setProp(props, newValue) { props.highlightColor = newValue; } getProp(props) { return props.highlightColor; } maskValue() { return CharacterPropertiesMask.UseHighlightColorIndex; } getHistoryItemConstructor() { return FontHighlightColorHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.HighlightColor; } binaryEquals = Equals.object; defaultValue = ColorModelInfo.noColor; } export class CharacterPropertiesLangInfoDescriptor { setProp(props, newValue) { props.langInfo = newValue; } getProp(props) { return props.langInfo; } maskValue() { return CharacterPropertiesMask.UseLangInfo; } getHistoryItemConstructor() { return FontLangInfoHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.LangInfo; } binaryEquals = Equals.object; defaultValue = new LangInfo(); } export class CharacterPropertiesCompositeFontInfoDescriptor { setProp(props, newValue) { props.compositeFontInfo = newValue; } getProp(props) { return props.compositeFontInfo; } maskValue() { return CharacterPropertiesMask.UseCompositeFontInfo; } getHistoryItemConstructor() { return FontCompositeFontInfoHistoryItem; } getJSONProperty() { return JSONCharacterFormattingProperty.CompositeFontInfo; } binaryEquals = Equals.object; defaultValue = new CompositeFontInfo(); } export class CharacterPropertyDescriptor { static allCaps = new CharacterPropertiesAllCapsDescriptor(); static size = new CharacterPropertiesFontSizeDescriptor(); static bold = new CharacterPropertiesFontBoldDescriptor(); static italic = new CharacterPropertiesFontItalicDescriptor(); static fontInfo = new CharacterPropertiesFontInfoDescriptor(); static script = new CharacterPropertiesScriptDescriptor(); static strikeoutType = new CharacterPropertiesStrikeoutTypeDescriptor(); static underlineType = new CharacterPropertiesUnderlineTypeDescriptor(); static underlineWordsOnly = new CharacterPropertiesUnderlineWordsOnlyDescriptor(); static strikeoutWordsOnly = new CharacterPropertiesStrikeoutWordsOnlyDescriptor(); static noProof = new CharacterPropertiesNoProofDescriptor(); static hidden = new CharacterPropertiesHiddenDescriptor(); static langInfo = new CharacterPropertiesLangInfoDescriptor(); static compositeFontInfo = new CharacterPropertiesCompositeFontInfoDescriptor(); static textColor = new CharacterPropertiesTextColorDescriptor(); static shadingInfo = new CharacterPropertiesShadingInfoColorDescriptor(); static highlightColor = new CharacterPropertiesHighlightColorDescriptor(); static strikeoutColor = new CharacterPropertiesStrikeoutColorDescriptor(); static underlineColor = new CharacterPropertiesUnderlineColorDescriptor(); static smallCaps = new CharacterPropertiesSmallCapsDescriptor(); static ALL_FIELDS = [ CharacterPropertyDescriptor.allCaps, CharacterPropertyDescriptor.size, CharacterPropertyDescriptor.bold, CharacterPropertyDescriptor.italic, CharacterPropertyDescriptor.fontInfo, CharacterPropertyDescriptor.script, CharacterPropertyDescriptor.strikeoutType, CharacterPropertyDescriptor.underlineType, CharacterPropertyDescriptor.underlineWordsOnly, CharacterPropertyDescriptor.strikeoutWordsOnly, CharacterPropertyDescriptor.noProof, CharacterPropertyDescriptor.hidden, CharacterPropertyDescriptor.langInfo, CharacterPropertyDescriptor.compositeFontInfo, CharacterPropertyDescriptor.textColor, CharacterPropertyDescriptor.shadingInfo, CharacterPropertyDescriptor.highlightColor, CharacterPropertyDescriptor.strikeoutColor, CharacterPropertyDescriptor.underlineColor, CharacterPropertyDescriptor.smallCaps ]; static whatNeedSetWhenCreateHyperlinkField = [ CharacterPropertyDescriptor.size, CharacterPropertyDescriptor.bold, CharacterPropertyDescriptor.italic, CharacterPropertyDescriptor.fontInfo, CharacterPropertyDescriptor.script, CharacterPropertyDescriptor.strikeoutType, CharacterPropertyDescriptor.allCaps, CharacterPropertyDescriptor.underlineWordsOnly, CharacterPropertyDescriptor.strikeoutWordsOnly, CharacterPropertyDescriptor.noProof, CharacterPropertyDescriptor.hidden, CharacterPropertyDescriptor.shadingInfo, CharacterPropertyDescriptor.strikeoutColor, CharacterPropertyDescriptor.underlineColor, CharacterPropertyDescriptor.langInfo, CharacterPropertyDescriptor.smallCaps ]; }