private Style method_14(int A_0) { Style style = null; int num = this.binaryReader_0.ReadUInt16(); StyleIdentifier identifier = ((StyleIdentifier)num) & StyleIdentifier.Nil; bool flag = (num & 0x2000) != 0; bool flag2 = (num & 0x4000) != 0; num = this.binaryReader_0.ReadUInt16(); StyleType type = ((StyleType)num) & ((StyleType)15); if (type <= StyleType.ListStyle) { style = Style.smethod_2(type, A_0, identifier, null, this.styleCollection_0.Document); style.BasedOnIstd = (num >> 4) & 0xfff; style.bool_7 = flag; style.bool_8 = flag2; num = this.binaryReader_0.ReadUInt16(); style.NextIstd = (num >> 4) & 0xfff; this.binaryReader_0.ReadUInt16(); num = this.binaryReader_0.ReadUInt16(); style.AutomaticallyUpdate = (num & 1) != 0; style.Hidden = (num & 2) != 0; style.LidsSet = (num & 12) != 0; style.PersonalCompose = (num & 0x10) != 0; style.PersonalReply = (num & 0x20) != 0; style.Personal = (num & 0x40) != 0; style.IsSemiHidden = (num & 0x100) != 0; style.Locked = (num & 0x200) != 0; style.bool_9 = (num & 0x400) != 0; style.UnhideWhenUsed = (num & 0x800) != 0; style.QuickFormat = (num & 0x1000) != 0; } return(style); }
private void GetArgsList() { Help = (bool)ArgsList[0]; DisplayMessages = (bool)ArgsList[1]; MessagesTitle = (string)ArgsList[2]; OldMessagesTitle = (string)ArgsList[3]; Messages = (string)ArgsList[4]; OldMessages = (string)ArgsList[5]; HideSpawnerList = (ArrayList)ArgsList[6]; FileName = (string)ArgsList[7]; PageInfoList = (ArrayList)ArgsList[12]; MSGCheckBoxesList = (ArrayList)ArgsList[13]; FMCheckBoxesList = (ArrayList)ArgsList[15]; PersonalConfigList = (ArrayList)ArgsList[28]; cpg = (int)PageInfoList[6]; pg = (int)PageInfoList[7]; StyleTypeConfig = (StyleType)PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType)PersonalConfigList[1]; DefaultTextColor = (TextColor)PersonalConfigList[4]; TitleTextColor = (TextColor)PersonalConfigList[5]; MessagesTextColor = (TextColor)PersonalConfigList[6]; CommandButtonsTextColor = (TextColor)PersonalConfigList[7]; PageNumberTextColor = (int)PersonalConfigList[8]; }
/// <summary> /// Extends the base WriteXml with additional properties managed by this class. /// </summary> /// <param name="writer">The XmlWriter used by the serializer.</param> public override void WriteXml(XmlWriter writer) { base.WriteXml(writer); writer.WriteAttributeString("applyColors", ApplyColors.ToString().ToLower()); writer.WriteAttributeString("styleType", StyleType.ToString()); }
private void GetArgsList() { Help = (bool)ArgsList[0]; DisplayMessages = (bool)ArgsList[1]; MessagesTitle = (string)ArgsList[2]; OldMessagesTitle = (string)ArgsList[3]; Messages = (string)ArgsList[4]; OldMessages = (string)ArgsList[5]; PageInfoList = (ArrayList)ArgsList[12]; PersonalConfigList = (ArrayList)ArgsList[28]; cpg = (int)PageInfoList[36]; pg = (int)PageInfoList[37]; StyleTypeConfig = (StyleType)PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType)PersonalConfigList[1]; ActiveTEBGTypeConfig = (BackgroundType)PersonalConfigList[2]; DefaultTextColor = (TextColor)PersonalConfigList[4]; TitleTextColor = (TextColor)PersonalConfigList[5]; MessagesTextColor = (TextColor)PersonalConfigList[6]; CommandButtonsTextColor = (TextColor)PersonalConfigList[7]; PageNumberTextColor = (int)PersonalConfigList[8]; ActiveTextEntryTextColor = (int)PersonalConfigList[9]; sortSearchFor = (string)PersonalConfigList[15]; sortSearchType = (SortSearchType)PersonalConfigList[16]; sortOrder = (SortOrder)PersonalConfigList[17]; sortType = (SortSearchType)PersonalConfigList[18]; sortSearchCaseSensitive = (bool)PersonalConfigList[19]; sortSearchFlagged = (bool)PersonalConfigList[20]; sortSearchBadLocation = (bool)PersonalConfigList[21]; sortSearchDupeSpawners = (bool)PersonalConfigList[22]; }
private StyleType CreateHeaderTableCellTextboxStyle(bool isNumeric) { StyleType headerTableCellTextboxStyle = new StyleType(); headerTableCellTextboxStyle.Items = new object[] { "700", "14pt", (isNumeric ? "Right" : "Left"), "5pt", "5pt", "5pt", "5pt", }; headerTableCellTextboxStyle.ItemsElementName = new ItemsChoiceType5[] { ItemsChoiceType5.FontWeight, ItemsChoiceType5.FontSize, ItemsChoiceType5.TextAlign, ItemsChoiceType5.PaddingTop, ItemsChoiceType5.PaddingBottom, ItemsChoiceType5.PaddingLeft, ItemsChoiceType5.PaddingRight, }; return(headerTableCellTextboxStyle); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Construct a dummy RTF style with the given name and type. Everything else is /// inherited/default. /// </summary> /// ------------------------------------------------------------------------------------ public DummyRtfStyle(string styleName, StyleType styleType) : base(-1) { m_name = styleName; m_usage = null; m_styleType = styleType; }
public override bool Equals(System.Object obj) { if (obj == null) { return(false); } if (this == obj) { return(true); } if (obj.GetType() != this.GetType()) { return(false); } StyleType s = (StyleType)obj; return(this.Name.Equals(s.Name) && this.Title.Equals(s.Title) && this.Abstract.Equals(s.Abstract) && this.StyleUri.Equals(s.StyleUri) && this.StyleSheetUri.Equals(s.StyleSheetUri) && this.LegendUri.Equals(s.LegendUri)); }
private Run ProcessStyleType(StyleType style) { return(new Run() { Text = $"{style.Text}", FontWeight = FontWeights.Bold }); }
private void GetArgsList() { Help = (bool)ArgsList[0]; DisplayMessages = (bool)ArgsList[1]; MessagesTitle = (string)ArgsList[2]; OldMessagesTitle = (string)ArgsList[3]; Messages = (string)ArgsList[4]; OldMessages = (string)ArgsList[5]; PageInfoList = (ArrayList)ArgsList[12]; SCGArgsList = (ArrayList)ArgsList[24]; SCGSetList = (ArrayList)ArgsList[25]; PersonalConfigList = (ArrayList)ArgsList[28]; cpg = (int)PageInfoList[18]; pg = (int)PageInfoList[19]; ConfigRead = (bool)SCGArgsList[0]; timerTypeSwitch = (TimerType)SCGArgsList[1]; debugSwitch = (bool)SCGArgsList[2]; staffTriggerEventSwitch = (bool)SCGArgsList[3]; TimerConfigClicked = (bool)SCGSetList[0]; MiscConfigClicked = (bool)SCGSetList[1]; StyleTypeConfig = (StyleType)PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType)PersonalConfigList[1]; ActiveTEBGTypeConfig = (BackgroundType)PersonalConfigList[2]; DefaultTextColor = (TextColor)PersonalConfigList[4]; TitleTextColor = (TextColor)PersonalConfigList[5]; MessagesTextColor = (TextColor)PersonalConfigList[6]; CommandButtonsTextColor = (TextColor)PersonalConfigList[7]; PageNumberTextColor = (int)PersonalConfigList[8]; ActiveTextEntryTextColor = (int)PersonalConfigList[9]; }
public Style(string name, StyleType type, RenderRule defaultRule) { this.name = name; this.styletype = type; rulelist = new List <RenderRule>(); this.defaultRule = defaultRule; }
public Phase NextPhase(StyleType phaseChosen) { CurrentPhase = PossiblePhases(phaseChosen).Single(); PhaseDescisionInputRequired = false; return(CurrentPhase); }
/// <summary> /// Initializes a new instance of the <see cref="Style"/> class. /// </summary> /// <param name="category">The category.</param> /// <param name="categoryNumber">The category number.</param> /// <param name="styleLetter">The style letter.</param> /// <param name="styleGuide">The style guide.</param> /// <param name="type">The type.</param> /// <param name="ogMax">The og maximum.</param> /// <param name="ogMin">The og minimum.</param> /// <param name="ibuMin">The ibu minimum.</param> /// <param name="ibuMax">The ibu maximum.</param> /// <param name="colorMin">The color minimum.</param> /// <param name="colorMax">The color maximum.</param> /// <param name="name">The name.</param> /// <param name="version">The version.</param> public Style( string category, string categoryNumber, string styleLetter, string styleGuide, StyleType type, double ogMax, double ogMin, double ibuMin, double ibuMax, double colorMin, double colorMax, string name, int version = Constants.DEFAULT_BEER_XML_VERSION) : base(name, version) { Validation.ValidateGreaterThanZero(ogMax); Validation.ValidateGreaterThanZero(ogMin); Validation.ValidateGreaterThanZero(ibuMin); Validation.ValidateGreaterThanZero(ibuMax); Validation.ValidateGreaterThanZero(colorMin); Validation.ValidateGreaterThanZero(colorMax); this.Category = category; this.Category_Number = categoryNumber; this.Style_Letter = styleLetter; this.Style_Guide = styleGuide; this.Type = type; this.OG_Min = ogMin; this.OG_Max = ogMax; this.IBU_Min = ibuMin; this.IBU_Max = ibuMax; this.Color_Min = colorMin; this.Color_Max = colorMax; }
public static string GetShortName(StyleType type) { switch (type) { case StyleType.LineSolid: return(Localize.LineStyle_SolidShort); case StyleType.LineDashed: return(Localize.LineStyle_DashedShort); case StyleType.LineDoubleSolid: return(Localize.LineStyle_DoubleSolidShort); case StyleType.LineDoubleDashed: return(Localize.LineStyle_DoubleDashedShort); case StyleType.LineSolidAndDashed: return(Localize.LineStyle_SolidAndDashedShort); case StyleType.StopLineSolid: return(Localize.LineStyle_StopShort); case StyleType.StopLineDashed: return(Localize.LineStyle_StopDashedShort); case StyleType.StopLineDoubleSolid: return(Localize.LineStyle_StopDoubleShort); case StyleType.StopLineDoubleDashed: return(Localize.LineStyle_StopDoubleDashedShort); case StyleType.FillerStripe: return(Localize.FillerStyle_StripeShort); case StyleType.FillerGrid: return(Localize.FillerStyle_GridShort); case StyleType.FillerSolid: return(Localize.FillerStyle_SolidShort); default: return(null); } }
private void GetArgsList() { Help = (bool)ArgsList[0]; DisplayMessages = (bool)ArgsList[1]; MessagesTitle = (string)ArgsList[2]; OldMessagesTitle = (string)ArgsList[3]; Messages = (string)ArgsList[4]; OldMessages = (string)ArgsList[5]; PageInfoList = (ArrayList)ArgsList[12]; PersonalConfigList = (ArrayList)ArgsList[28]; EAGArgsList = (ArrayList)ArgsList[29]; cpg = (int)PageInfoList[28]; pg = (int)PageInfoList[29]; index = (int)EAGArgsList[0]; AddAccount = (bool)EAGArgsList[1]; accessSwitch = (Access)EAGArgsList[2]; accountsMgmtSwitch = (bool)EAGArgsList[3]; systemConfigSwitch = (bool)EAGArgsList[4]; accountName = (string)EAGArgsList[5]; StyleTypeConfig = (StyleType)PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType)PersonalConfigList[1]; ActiveTEBGTypeConfig = (BackgroundType)PersonalConfigList[2]; InactiveTEBGTypeConfig = (BackgroundType)PersonalConfigList[3]; DefaultTextColor = (TextColor)PersonalConfigList[4]; TitleTextColor = (TextColor)PersonalConfigList[5]; MessagesTextColor = (TextColor)PersonalConfigList[6]; CommandButtonsTextColor = (TextColor)PersonalConfigList[7]; PageNumberTextColor = (int)PersonalConfigList[8]; ActiveTextEntryTextColor = (int)PersonalConfigList[9]; InactiveTextEntryTextColor = (int)PersonalConfigList[10]; FlagTextColor = (TextColor)PersonalConfigList[14]; }
/// <summary> /// Get the preselection for either id or classes from the current linked stylesheet, if any. /// </summary> /// <param name="context">Context from which the editor is called.</param> /// <returns></returns> public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { MemberInfo[] methods = context.Instance.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public); MethodInfo mi = null; foreach (MethodInfo info in methods) { if (info.IsDefined(typeof(DropAttribute), true)) { Attribute[] attributes = (Attribute[])info.GetCustomAttributes(typeof(DropAttribute), true); if (attributes != null && attributes.Length > 0) { mi = info; break; } } } if (mi != null) { StyleType st = (StyleType)Enum.Parse(typeof(StyleType), context.PropertyDescriptor.Name, true); object rawColl = mi.Invoke(context.Instance, new object[] { st }); //(Convert.ChangeType(context.Instance, t)).GetDocumentStyleSelectors(context.PropertyDescriptor.Name); if (rawColl != null) { object[] collection = (object[])rawColl; if (collection.Length > 0) { return(new StandardValuesCollection(collection)); } } } return(base.GetStandardValues(context)); }
private StyleType CreateTableCellTextboxStyle(bool isNumeric) { StyleType style = new StyleType(); style.Items = new object[] { "500", "10pt", "=iif(RowNumber(Nothing) mod 2, \"#f9f9f9\", \"White\")", (isNumeric ? "Right" : "Left"), "5pt", "5pt", "5pt", "5pt", }; style.ItemsElementName = new ItemsChoiceType5[] { ItemsChoiceType5.FontWeight, ItemsChoiceType5.FontSize, ItemsChoiceType5.BackgroundColor, ItemsChoiceType5.TextAlign, ItemsChoiceType5.PaddingTop, ItemsChoiceType5.PaddingBottom, ItemsChoiceType5.PaddingLeft, ItemsChoiceType5.PaddingRight, }; return(style); }
public RectangleViewer() { DataContext = this; InitializeComponent(); Rectangles = new BindingList <SelectableBoundingBox>(); StyleTemplate = StyleType.PrefabRecognized; }
public void SetLayerStyleType(FeatureLayer layer, StyleType layerStyleType) { layer.FeatureSource.Open(); if (layerStyleType == StyleType.Text) { List <string> columnNameList = new List <string>(); Collection <FeatureSourceColumn> columns = layer.FeatureSource.GetColumns(); foreach (FeatureSourceColumn myColumn in columns) { columnNameList.Add(myColumn.ColumnName); } this.CurrentStyleType = StyleType.Text; this.ColumnNames = columnNameList.ToArray(); } else { Feature firstFeature = layer.FeatureSource.GetFeatureById("1", ReturningColumnsType.AllColumns); BaseShape shape = firstFeature.GetShape(); if (shape is LineBaseShape) { this.CurrentStyleType = StyleType.Line; } else if (shape is PointBaseShape) { this.CurrentStyleType = StyleType.Point; } else if (shape is AreaBaseShape) { this.CurrentStyleType = StyleType.Area; } } layer.FeatureSource.Close(); }
public StyleHtml(string name, StyleType type, string value) { this.Id = Guid.NewGuid(); this.Name = name; this.Type = type; this.Value = value; }
private void GetArgsList() { Help = (bool)ArgsList[0]; DisplayMessages = (bool)ArgsList[1]; MessagesTitle = (string)ArgsList[2]; OldMessagesTitle = (string)ArgsList[3]; Messages = (string)ArgsList[4]; OldMessages = (string)ArgsList[5]; PageInfoList = (ArrayList)ArgsList[12]; SettingsCheckBoxesList = (ArrayList)ArgsList[17]; megaSpawner = (MegaSpawner)ArgsList[19]; AVSArgsList = (ArrayList)ArgsList[22]; AVSSetList = (ArrayList)ArgsList[23]; PersonalConfigList = (ArrayList)ArgsList[28]; cpg = (int)PageInfoList[12]; pg = (int)PageInfoList[13]; StyleTypeConfig = (StyleType)PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType)PersonalConfigList[1]; DefaultTextColor = (TextColor)PersonalConfigList[4]; TitleTextColor = (TextColor)PersonalConfigList[5]; MessagesTextColor = (TextColor)PersonalConfigList[6]; CommandButtonsTextColor = (TextColor)PersonalConfigList[7]; PageNumberTextColor = (int)PersonalConfigList[8]; FlagTextColor = (TextColor)PersonalConfigList[14]; }
private static IEnumerable <TextRunType> CreateTextRun(string text) { var resultStyle = new StyleType { Items = new object[] { "Calibri", "16pt", "#1b75cd" }, ItemsElementName = new[] { ItemsChoiceType4.FontFamily, ItemsChoiceType4.FontSize, ItemsChoiceType4.Color, } }; return(new List <TextRunType> { new TextRunType { Items = new object[] { new LocIDStringWithDataTypeAttribute { Value = text }, resultStyle }, ItemsElementName = new [] { ItemsChoiceType11.Value, ItemsChoiceType11.Style, } } }); }
/// <summary> /// 静态方法:获得样式文件路径 /// </summary> public static string GetPath(StyleType type, string fileName) { string _stylePath = GetDirectoryPath(type); string filePath = Path.Combine(_stylePath, fileName + ".sdStyle"); return(filePath); }
public ChangeHairstyleEntry(int gid, int tooltip, StyleType type, int itemid) { GumpID = gid; Tooltip = tooltip; Type = type; ItemID = itemid; }
public AlphabetSet(string name, string[] data, StyleType styleType, LetterCaseType caseType) { Name = name; Data = data; StyleType = styleType; LetterCaseType = caseType; }
private void GetArgsList() { Help = (bool)ArgsList[0]; DisplayMessages = (bool)ArgsList[1]; MessagesTitle = (string)ArgsList[2]; OldMessagesTitle = (string)ArgsList[3]; Messages = (string)ArgsList[4]; OldMessages = (string)ArgsList[5]; PageInfoList = (ArrayList)ArgsList[12]; AVSArgsList = (ArrayList)ArgsList[22]; PersonalConfigList = (ArrayList)ArgsList[28]; AITCCheckBoxesList = (ArrayList)ArgsList[31]; SEGArgsList = (ArrayList)ArgsList[32]; cpg = (int)PageInfoList[30]; pg = (int)PageInfoList[31]; StyleTypeConfig = (StyleType)PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType)PersonalConfigList[1]; ActiveTEBGTypeConfig = (BackgroundType)PersonalConfigList[2]; InactiveTEBGTypeConfig = (BackgroundType)PersonalConfigList[3]; DefaultTextColor = (TextColor)PersonalConfigList[4]; TitleTextColor = (TextColor)PersonalConfigList[5]; MessagesTextColor = (TextColor)PersonalConfigList[6]; CommandButtonsTextColor = (TextColor)PersonalConfigList[7]; PageNumberTextColor = (int)PersonalConfigList[8]; ActiveTextEntryTextColor = (int)PersonalConfigList[9]; InactiveTextEntryTextColor = (int)PersonalConfigList[10]; addItem = (string)AVSArgsList[23]; InsideItemList = (ArrayList)AVSArgsList[27]; }
public StyleModifier(GUIStyleName name, StyleType styleType, Color value, GUIState state = GUIState.Normal) { this.name = name; this.styleType = styleType; this.state = state; this.colorValue = value; }
public StyleModifier(StylePropertyName name, StyleType styleType, string value, GUIState state = GUIState.Normal) { this.name = name; this.styleType = styleType; this.state = state; this.stringValue = value; }
public StyleModifier(GUIStyleName name, StyleType styleType, double value, GUIState state = GUIState.Normal) { this.name = name; this.styleType = styleType; this.state = state; this.doubleValue = value; }
/// <summary> /// Exports this <see cref="Style" /> instance into an XML object. /// </summary> /// <returns>An XML <see cref="StyleType" /> object.</returns> internal StyleType Export() { var newStyle = new StyleType { Name = Name, Inherits = Inherits?.Name, MarginBottomSpecified = MarginBottom.HasValue, MarginLeftSpecified = MarginLeft.HasValue, MarginRightSpecified = MarginRight.HasValue, MarginTopSpecified = MarginTop.HasValue }; if (MarginBottom.HasValue) { newStyle.MarginBottom = MarginBottom.Value; } if (MarginLeft.HasValue) { newStyle.MarginLeft = MarginLeft.Value; } if (MarginRight.HasValue) { newStyle.MarginRight = MarginRight.Value; } if (MarginTop.HasValue) { newStyle.MarginTop = MarginTop.Value; } return(newStyle); }
public static void AddToRTB(RichTextBox rtb, string strText, StyleType style, enumIcon icon) { switch (style) { case StyleType.bodyBlack: AddToRTB(rtb, strText, Color.Black, 8, false, icon); break; case StyleType.bodyBlackBold: AddToRTB(rtb, strText, Color.Black, 8, true, icon); break; case StyleType.bodyBlue: AddToRTB(rtb, strText, Color.Blue, 8, false, icon); break; case StyleType.bodyBlueBold: AddToRTB(rtb, strText, Color.Blue, 8, true, icon); break; case StyleType.bodyChocolate: AddToRTB(rtb, strText, Color.Chocolate, 8, false, icon); break; case StyleType.bodyChocolateBold: AddToRTB(rtb, strText, Color.Chocolate, 8, true, icon); break; case StyleType.bodyDarkGray: AddToRTB(rtb, strText, Color.DarkGray, 8, false, icon); break; case StyleType.bodyMidnightBlue: AddToRTB(rtb, strText, Color.MidnightBlue, 8, false, icon); break; case StyleType.bodyOrange: AddToRTB(rtb, strText, Color.Orange, 8, false, icon); break; case StyleType.bodyPurple: AddToRTB(rtb, strText, Color.Purple, 8, false, icon); break; case StyleType.bodyRed: AddToRTB(rtb, strText, Color.Red, 8, false, icon); break; case StyleType.bodySeaGreen: AddToRTB(rtb, strText, Color.SeaGreen, 8, false, icon); break; case StyleType.bodySeaGreenBold: AddToRTB(rtb, strText, Color.SeaGreen, 8, true, icon); break; case StyleType.titleBlack: AddToRTB(rtb, strText, Color.Black, 14, true, icon); break; case StyleType.titleBlue: AddToRTB(rtb, strText, Color.Blue, 14, true, icon); break; case StyleType.titleChocolate: AddToRTB(rtb, strText, Color.Chocolate, 14, true, icon); break; case StyleType.titleSeagreen: AddToRTB(rtb, strText, Color.SeaGreen, 14, true, icon); break; default: AddToRTB(rtb, strText, Color.Black, 8, false, icon); break; } }
private void GetArgsList() { Help = (bool)ArgsList[0]; DisplayMessages = (bool)ArgsList[1]; MessagesTitle = (string)ArgsList[2]; OldMessagesTitle = (string)ArgsList[3]; Messages = (string)ArgsList[4]; OldMessages = (string)ArgsList[5]; PageInfoList = (ArrayList)ArgsList[12]; ESGArgsList = (ArrayList)ArgsList[21]; AVSArgsList = (ArrayList)ArgsList[22]; PersonalConfigList = (ArrayList)ArgsList[28]; FromWhere = (FromGump)ArgsList[30]; SEGArgsList = (ArrayList)ArgsList[32]; cpg = (int)PageInfoList[22]; pg = (int)PageInfoList[23]; entryType = (string)ESGArgsList[6]; addItem = (string)AVSArgsList[23]; InsideItemList = (ArrayList)AVSArgsList[27]; insideIndex = (int)AVSArgsList[28]; StyleTypeConfig = (StyleType)PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType)PersonalConfigList[1]; DefaultTextColor = (TextColor)PersonalConfigList[4]; TitleTextColor = (TextColor)PersonalConfigList[5]; MessagesTextColor = (TextColor)PersonalConfigList[6]; CommandButtonsTextColor = (TextColor)PersonalConfigList[7]; PageNumberTextColor = (int)PersonalConfigList[8]; searchType = (SearchType)SEGArgsList[0]; SearchFor = (string)SEGArgsList[1]; }
public static Style CreateStyle(StyleType styleType) { var styleCard = new StyleCard(); styleCard._styleType = styleType; styleCard.ShowDialog(); return styleCard._style; }
protected override void ApplyStyleEx(TextRowVisualStyle style, StyleType[] css) { foreach (StyleType cs in css) { style.ApplyStyle(SuperGrid.BaseVisualStyles.FooterStyles[cs]); style.ApplyStyle(SuperGrid.DefaultVisualStyles.FooterStyles[cs]); style.ApplyStyle(GridPanel.DefaultVisualStyles.FooterStyles[cs]); } }
public static Style ChooseStyle(StyleType? styleType = null) { var stylesDictForm = new StylesDictForm(); stylesDictForm._styleType = styleType; if (stylesDictForm.ShowDialog() != DialogResult.OK) { return null; } return stylesDictForm._style; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="StyleInfo"/> class. Creates a new /// style of a given type. /// </summary> /// <param name="name">new style name</param> /// <param name="basedOnStyle">style to be based on</param> /// <param name="styleType"></param> /// <param name="cache">FDO cache</param> /// ------------------------------------------------------------------------------------ public StyleInfo(string name, StyleInfo basedOnStyle, StyleType styleType, FdoCache cache) : base(cache) { Name = name; m_styleType = styleType; m_basedOnStyle = basedOnStyle; if (basedOnStyle != null) m_basedOnStyleName = basedOnStyle.Name; else if (styleType == StyleType.kstParagraph) { throw new ArgumentNullException("basedOnStyle", "New paragraph styles are required to be based on an existing style."); } m_nextStyleName = name; }
public Image GetImageWithCache(Rectangle r, StyleType style, StyleType? overlayStyle = null) { var key = new CacheKey { OverlayStyle = overlayStyle, Rectangle = r, Style = style }; Image img; if (cachedImages.TryGetValue(key, out img)) return img; var bmp = new Bitmap(r.Width, r.Height); using (var g = Graphics.FromImage(bmp)) { RenderToGraphics(g, r, style); if (overlayStyle != null) RenderToGraphics(g, r, overlayStyle.Value); } cachedImages[key] = bmp; return bmp; }
public Style(RTF rtf) { num = -1; type = StyleType.Paragraph; based_on = NoStyleNum; next_par = -1; lock (rtf) { if (rtf.Styles == null) { rtf.Styles = this; } else { Style s = rtf.Styles; while (s.next != null) s = s.next; s.next = this; } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Construct a dummy RTF style with everything fully specified. /// </summary> /// ------------------------------------------------------------------------------------ public DummyRtfStyle(string styleName, StyleType styleType, bool bold, bool italic, FwSuperscriptVal superSub, FwTextAlign paraAlign, int lineSpacing, bool fLineSpacingRelative, int spaceBefore, int spaceAfter, int firstLineIndent, int leadingIndent, int trailingIndent, string fontName, // Pass null to leave as inherited int fontSize, Color fontColor, // Pass Color.Empty to leave as inherited int borderTop, int borderBottom, int borderLeading, int borderTrailing, Color borderColor, // Pass Color.Empty to leave as inherited string basedOnStyleName, string nextStyleName) : this(styleName, styleType, spaceBefore, spaceAfter, firstLineIndent, leadingIndent, trailingIndent, basedOnStyleName, nextStyleName) { m_defaultFontInfo.m_bold.ExplicitValue = bold; if (fontName != null) m_defaultFontInfo.m_fontName.ExplicitValue = fontName; if (fontColor != Color.Empty) m_defaultFontInfo.m_fontColor.ExplicitValue = fontColor; m_defaultFontInfo.m_fontSize.ExplicitValue = fontSize; m_defaultFontInfo.m_italic.ExplicitValue = italic; m_defaultFontInfo.m_superSub.ExplicitValue = superSub; // TODO(TE-4649): Implement unlerline property for RTF export m_defaultFontInfo.m_underline = new InheritableStyleProp<FwUnderlineType>(FwUnderlineType.kuntNone); m_alignment.ExplicitValue = paraAlign; m_lineSpacing.ExplicitValue = new LineHeightInfo(lineSpacing, fLineSpacingRelative); m_border.ExplicitValue = new BorderThicknesses(borderLeading, borderTrailing, borderTop, borderBottom); if (borderColor != Color.Empty) m_borderColor.ExplicitValue = borderColor; }
public void RenderToGraphics(Graphics g, Rectangle r, StyleType styleType) { FrameStyle style = Styles[styleType]; TextureBrush northBrush; TextureBrush southBrush; TextureBrush eastBrush; TextureBrush westBrush; Size nw = style.NW.Size; Size ne = style.NE.Size; Size n = style.N.Size; Size sw = style.SW.Size; Size se = style.SE.Size; Size s = style.S.Size; Size e = style.E.Size; Size w = style.W.Size; double downScale = Math.Min(1.0, (double)r.Width/(nw.Width + ne.Width + n.Width)); downScale = Math.Min(downScale, (double)r.Height/(nw.Height + sw.Height + w.Height)); if (downScale < 1) { nw = SizeMult(nw, downScale); ne = SizeMult(ne, downScale); sw = SizeMult(sw, downScale); se = SizeMult(se, downScale); n = SizeMult(n, downScale); s = SizeMult(s, downScale); e = SizeMult(e, downScale); w = SizeMult(w, downScale); northBrush = new TextureBrush(style.N.GetResizedWithCache(n.Width, n.Height, style.Interpolation), WrapMode.TileFlipY); southBrush = new TextureBrush(style.S.GetResizedWithCache(s.Width, s.Height, style.Interpolation), WrapMode.TileFlipY); eastBrush = new TextureBrush(style.E.GetResizedWithCache(e.Width, e.Height, style.Interpolation), WrapMode.TileFlipX); westBrush = new TextureBrush(style.W.GetResizedWithCache(w.Width, w.Height, style.Interpolation), WrapMode.TileFlipX); } else { northBrush = new TextureBrush(style.N, WrapMode.TileFlipY); southBrush = new TextureBrush(style.S, WrapMode.TileFlipY); eastBrush = new TextureBrush(style.E, WrapMode.TileFlipX); westBrush = new TextureBrush(style.W, WrapMode.TileFlipX); } using (northBrush) using (southBrush) using (eastBrush) using (westBrush) { g.InterpolationMode = style.Interpolation; g.DrawImage(style.NW, 0, 0, nw.Width, nw.Height); g.DrawImage(style.NE, r.Width - ne.Width - 1, 0, ne.Width, ne.Height); g.DrawImage(style.SE, r.Width - se.Width - 1, r.Height - se.Height - 1, se.Width, se.Height); g.DrawImage(style.SW, 0, r.Height - sw.Height - 1, sw.Width, sw.Height); FillRectangleTiled(g, northBrush, nw.Width, 0, r.Width - nw.Width - ne.Width - 1, n.Height); FillRectangleTiled(g, southBrush, sw.Width, r.Height - s.Height - 1, r.Width - sw.Width - se.Width - 1, s.Height); FillRectangleTiled(g, westBrush, 0, nw.Height, w.Width, r.Height - nw.Height - sw.Height - 1); FillRectangleTiled(g, eastBrush, r.Width - e.Width - 1, ne.Height, e.Width, r.Height - ne.Height - se.Height - 1); Brush final; if (style.FillBrush is LinearGradientBrush) { final = (LinearGradientBrush)style.FillBrush.Clone(); // linear gradient, adjust scaling ((LinearGradientBrush)final).ScaleTransform(r.Height, r.Width); } else final = style.FillBrush; Size tl = SizeMult(style.FillOffsetTopLeft, downScale); Size br = SizeMult(style.FillOffsetBottomRight, downScale); g.FillRectangle(final, nw.Width + tl.Width, nw.Height + tl.Height, r.Width - nw.Width - ne.Width - 1 - br.Width - tl.Width, r.Height - sw.Height - nw.Height - 1 - br.Height - tl.Height); if (final != style.FillBrush) final.Dispose(); } }
partial void DeleteStyleType(StyleType instance);
protected virtual void ApplyStyleEx(TextRowVisualStyle style, StyleType[] css) { }
private TextRowVisualStyle GetStyleEx(StyleType e) { if (_EffectiveRowStyles.IsValid(e) == false) { TextRowVisualStyle style = GetNewVisualStyle(); StyleType[] css = style.GetApplyStyleTypes(e); if (css != null) ApplyStyleEx(style, css); SuperGrid.DoGetTextRowStyleEvent(this, e, ref style); if (style.Background == null || style.Background.IsEmpty == true) style.Background = new Background(Color.White); if (style.Font == null) style.Font = SystemFonts.CaptionFont; _EffectiveRowStyles[e] = style; } return (_EffectiveRowStyles[e]); }
private void GetArgsList() { MessagesTitle = (string) ArgsList[2]; Messages = (string) ArgsList[4]; FileName = (string) ArgsList[7]; Changed = (bool) ArgsList[10]; ChangedSpawnerList = (ArrayList) ArgsList[11]; PersonalConfigList = (ArrayList) ArgsList[28]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; }
public static void AddToRTB(RichTextBox rtb, string strText, StyleType style) { AddToRTB(rtb, strText, style, enumIcon.no_icon); }
public Style(String name, StyleType type) { this.Name = name; this.Type = type; }
public static void DisplayImage( Gump gump, StyleType style ) { switch ( style ) { case StyleType.Scroll:{ break; } default:{ gump.AddImage( 30, 50, 10440 ); gump.AddImage( 648, 50, 10441 ); break; } } }
public static void DisplayStyle( Gump gump, StyleType style, int x, int y, int width, int height ) { switch ( style ) { case StyleType.OriginalBlack:{ gump.AddBackground( x, y, width, height, 0 ); gump.AddImageTiled( x, y, width, height, 2624 ); break; } case StyleType.DistroGray:{ gump.AddBackground( x, y, width, height, 5054 ); break; } case StyleType.Marble:{ gump.AddBackground( x, y, width, height, 5100 ); break; } case StyleType.BlackBorder:{ gump.AddBackground( x, y, width, height, 2620 ); break; } case StyleType.GrayEmbroidered:{ gump.AddBackground( x, y, width, height, 2600 ); break; } case StyleType.Offwhite:{ gump.AddBackground( x, y, width, height, 3000 ); break; } case StyleType.OffwhiteBorder:{ gump.AddBackground( x, y, width, height, 3500 ); break; } case StyleType.GrayMultiBorder:{ gump.AddBackground( x, y, width, height, 3600 ); break; } case StyleType.DarkGray:{ gump.AddBackground( x, y, width, height, 5120 ); break; } case StyleType.Scroll:{ gump.AddBackground( x - 17, y, width + 34, height, 5170 ); break; } } }
public void RenderToGraphics(Graphics g, Rectangle r, StyleType styleType) { g.TranslateTransform(r.X, r.Y); var style = Styles[styleType]; TextureBrush northBrush = null; TextureBrush southBrush = null; TextureBrush eastBrush = null; TextureBrush westBrush = null; var nw = style.NW?.Size ?? Size.Empty; var ne = style.NE?.Size ?? Size.Empty; var n = style.N?.Size ?? Size.Empty; var sw = style.SW?.Size ?? Size.Empty; var se = style.SE?.Size ?? Size.Empty; var s = style.S?.Size ?? Size.Empty; var e = style.E?.Size ?? Size.Empty; var w = style.W?.Size ?? Size.Empty; var downScale = Math.Min(1.0, (double)r.Width/(nw.Width + ne.Width + n.Width)); downScale = Math.Min(downScale, (double)r.Height/(nw.Height + sw.Height + w.Height)); if (downScale < 1) { nw = SizeMult(nw, downScale); ne = SizeMult(ne, downScale); sw = SizeMult(sw, downScale); se = SizeMult(se, downScale); n = SizeMult(n, downScale); s = SizeMult(s, downScale); e = SizeMult(e, downScale); w = SizeMult(w, downScale); if (style.N != null) northBrush = new TextureBrush(style.N.GetResizedWithCache(n.Width, n.Height, style.Interpolation), WrapMode.TileFlipY); if (style.S != null) southBrush = new TextureBrush(style.S.GetResizedWithCache(s.Width, s.Height, style.Interpolation), WrapMode.TileFlipY); if (style.E != null) eastBrush = new TextureBrush(style.E.GetResizedWithCache(e.Width, e.Height, style.Interpolation), WrapMode.TileFlipX); if (style.W != null) westBrush = new TextureBrush(style.W.GetResizedWithCache(w.Width, w.Height, style.Interpolation), WrapMode.TileFlipX); } else { if (style.N != null) northBrush = new TextureBrush(style.N, WrapMode.TileFlipY); if (style.S != null) southBrush = new TextureBrush(style.S, WrapMode.TileFlipY); if (style.E != null) eastBrush = new TextureBrush(style.E, WrapMode.TileFlipX); if (style.W != null) westBrush = new TextureBrush(style.W, WrapMode.TileFlipX); } using (northBrush) { using (southBrush) { using (eastBrush) { using (westBrush) { g.InterpolationMode = style.Interpolation; if (style.NW != null) g.DrawImage(style.NW, 0, 0, nw.Width, nw.Height); if (style.NE != null) g.DrawImage(style.NE, r.Width - ne.Width - 1, 0, ne.Width, ne.Height); if (style.SE != null) g.DrawImage(style.SE, r.Width - se.Width - 1, r.Height - se.Height - 1, se.Width, se.Height); if (style.SW != null) g.DrawImage(style.SW, 0, r.Height - sw.Height - 1, sw.Width, sw.Height); if (northBrush != null) FillRectangleTiled(g, northBrush, nw.Width, 0, r.Width - nw.Width - ne.Width - 1, n.Height); if (southBrush != null) FillRectangleTiled(g, southBrush, sw.Width, r.Height - s.Height - 1, r.Width - sw.Width - se.Width - 1, s.Height); if (westBrush != null) FillRectangleTiled(g, westBrush, 0, nw.Height, w.Width, r.Height - nw.Height - sw.Height - 1); if (eastBrush != null) FillRectangleTiled(g, eastBrush, r.Width - e.Width - 1, ne.Height, e.Width, r.Height - ne.Height - se.Height - 1); Brush final; if (style.FillBrush is LinearGradientBrush) { final = (LinearGradientBrush)style.FillBrush.Clone(); // linear gradient, adjust scaling ((LinearGradientBrush)final).ScaleTransform(r.Height, r.Width); } else final = style.FillBrush; var tl = SizeMult(style.FillOffsetTopLeft, downScale); var br = SizeMult(style.FillOffsetBottomRight, downScale); g.FillRectangle( final, nw.Width + tl.Width, nw.Height + tl.Height, r.Width - nw.Width - ne.Width - 1 - br.Width - tl.Width, r.Height - sw.Height - nw.Height - 1 - br.Height - tl.Height); if (final != style.FillBrush) final.Dispose(); } } } } g.TranslateTransform(-r.X, -r.Y); }
private void GetArgsList() { Help = (bool) ArgsList[0]; DisplayMessages = (bool) ArgsList[1]; MessagesTitle = (string) ArgsList[2]; OldMessagesTitle = (string) ArgsList[3]; Messages = (string) ArgsList[4]; OldMessages = (string) ArgsList[5]; PageInfoList = (ArrayList) ArgsList[12]; AVSArgsList = (ArrayList) ArgsList[22]; PersonalConfigList = (ArrayList) ArgsList[28]; AITCCheckBoxesList = (ArrayList) ArgsList[31]; SEGArgsList = (ArrayList) ArgsList[32]; cpg = (int) PageInfoList[30]; pg = (int) PageInfoList[31]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; ActiveTEBGTypeConfig = (BackgroundType) PersonalConfigList[2]; InactiveTEBGTypeConfig = (BackgroundType) PersonalConfigList[3]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; MessagesTextColor = (TextColor) PersonalConfigList[6]; CommandButtonsTextColor = (TextColor) PersonalConfigList[7]; PageNumberTextColor = (int) PersonalConfigList[8]; ActiveTextEntryTextColor = (int) PersonalConfigList[9]; InactiveTextEntryTextColor = (int) PersonalConfigList[10]; addItem = (string) AVSArgsList[23]; InsideItemList = (ArrayList) AVSArgsList[27]; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor with ContextValues and MarkerDomain as a parameters. /// </summary> /// <param name="sStyleName">Name of the style.</param> /// <param name="styleType">kstCharacter or kstParagraph</param> /// <param name="ws">character or paragraph writing system</param> /// <param name="context">Context that will be used if this is a new style (otherwise existing /// context in DB will be used), see ContextValues for possible types</param> /// <param name="domain">The marker domain to use</param> /// <param name="styleSheet">The style sheet</param> /// ------------------------------------------------------------------------------------ public ImportStyleProxy(string sStyleName, StyleType styleType, int ws, ContextValues context, MarkerDomain domain, FwStyleSheet styleSheet) { m_FwStyleSheet = styleSheet; m_domain = domain; Debug.Assert(m_FwStyleSheet != null); m_ttpFormattingProps = null; m_fIsScriptureStyle = true; //default m_sEndMarker = null; //default if (context == ContextValues.EndMarker) { // this proxy represents an end marker - not a style; set bogus info sStyleName = "End"; //name does not matter styleType = StyleType.kstCharacter; } else if (sStyleName != null) { // Determine whether style exists in the StyleSheet Debug.Assert(ws != 0); m_style = m_FwStyleSheet.FindStyle(sStyleName); if (m_style != null) { // If this is an existing style, the actual type, context, structure, and // function always override the requested values. styleType = m_style.Type; context = (ContextValues)m_style.Context; m_structure = (StructureValues)m_style.Structure; m_function = (FunctionValues)m_style.Function; } } m_sStyleName = sStyleName; m_StyleType = styleType; m_ws = ws; m_Context = context; // //force StartOfFootnote marker to be processed as a para style proxy having para props // if (context == StyleRole.StartOfFootnote) // m_StyleType = StyleType.kstParagraph; //set the text property vars for this proxy SetTextProps(); }
private void GetArgsList() { Help = (bool) ArgsList[0]; DisplayMessages = (bool) ArgsList[1]; MessagesTitle = (string) ArgsList[2]; OldMessagesTitle = (string) ArgsList[3]; Messages = (string) ArgsList[4]; OldMessages = (string) ArgsList[5]; HideSpawnerList = (ArrayList) ArgsList[6]; FileName = (string) ArgsList[7]; Changed = (bool) ArgsList[10]; ChangedSpawnerList = (ArrayList) ArgsList[11]; PageInfoList = (ArrayList) ArgsList[12]; MSGCheckBoxesList = (ArrayList) ArgsList[13]; PCGArgsList = (ArrayList) ArgsList[26]; PCGSetList = (ArrayList) ArgsList[27]; PersonalConfigList = (ArrayList) ArgsList[28]; RefreshSpawnerLists = (bool) ArgsList[34]; SpawnerList = (ArrayList) ArgsList[35]; MasterSpawnerList = (ArrayList) ArgsList[36]; ModHideSpawnerList = (ArrayList) ArgsList[37]; GotoLocation = (bool) ArgsList[38]; cpg = (int) PageInfoList[0]; pg = (int) PageInfoList[1]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; MessagesTextColor = (TextColor) PersonalConfigList[6]; CommandButtonsTextColor = (TextColor) PersonalConfigList[7]; PageNumberTextColor = (int) PersonalConfigList[8]; sortSearchFor = (string) PersonalConfigList[15]; sortSearchType = (SortSearchType) PersonalConfigList[16]; sortOrder = (SortOrder) PersonalConfigList[17]; sortType = (SortSearchType) PersonalConfigList[18]; sortSearchCaseSensitive = (bool) PersonalConfigList[19]; sortSearchFlagged = (bool) PersonalConfigList[20]; sortSearchBadLocation = (bool) PersonalConfigList[21]; sortSearchDupeSpawners = (bool) PersonalConfigList[22]; }
private void GetArgsList() { MessagesTitle = (string) ArgsList[2]; Messages = (string) ArgsList[4]; HideSpawnerList = (ArrayList) ArgsList[6]; MSGCheckBoxesList = (ArrayList) ArgsList[13]; megaSpawner = (MegaSpawner) ArgsList[19]; fromSpawnerList = (bool) ArgsList[20]; PersonalConfigList = (ArrayList) ArgsList[28]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; }
private void GetArgsList() { MessagesTitle = (string) ArgsList[2]; Messages = (string) ArgsList[4]; MSGCheckBoxesList = (ArrayList) ArgsList[13]; PersonalConfigList = (ArrayList) ArgsList[28]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; }
private void GetArgsList() { Help = (bool) ArgsList[0]; DisplayMessages = (bool) ArgsList[1]; MessagesTitle = (string) ArgsList[2]; OldMessagesTitle = (string) ArgsList[3]; Messages = (string) ArgsList[4]; OldMessages = (string) ArgsList[5]; PageInfoList = (ArrayList) ArgsList[12]; SCGArgsList = (ArrayList) ArgsList[24]; SCGSetList = (ArrayList) ArgsList[25]; PersonalConfigList = (ArrayList) ArgsList[28]; cpg = (int) PageInfoList[24]; pg = (int) PageInfoList[25]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; MessagesTextColor = (TextColor) PersonalConfigList[6]; CommandButtonsTextColor = (TextColor) PersonalConfigList[7]; PageNumberTextColor = (int) PersonalConfigList[8]; }
internal TextRowVisualStyle GetEffectiveStyle(StyleType type) { ValidateRowStyle(); return (GetStyleEx(type)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Constructor with ContextValues as a parameter. /// </summary> /// <param name="sStyleName">Name of the style.</param> /// <param name="styleType">kstCharacter or kstParagraph</param> /// <param name="ws">character or paragraph writing system</param> /// <param name="context">Context that will be used if this is a new style (otherwise existing /// context in DB will be used), see ContextValues for possible types</param> /// <param name="styleSheet">The style sheet</param> /// ------------------------------------------------------------------------------------ public ImportStyleProxy(string sStyleName, StyleType styleType, int ws, ContextValues context, FwStyleSheet styleSheet) : this(sStyleName, styleType, ws, context, MarkerDomain.Default, styleSheet) { }
private void GetArgsList() { MessagesTitle = (string) ArgsList[2]; Messages = (string) ArgsList[4]; MSEGCheckBoxesList = (ArrayList) ArgsList[14]; megaSpawner = (MegaSpawner) ArgsList[19]; ESGArgsList = (ArrayList) ArgsList[21]; PersonalConfigList = (ArrayList) ArgsList[28]; index = (int) ESGArgsList[1]; StyleTypeConfig = (StyleType) PersonalConfigList[0]; BackgroundTypeConfig = (BackgroundType) PersonalConfigList[1]; DefaultTextColor = (TextColor) PersonalConfigList[4]; TitleTextColor = (TextColor) PersonalConfigList[5]; }
private void AddToRtbLocal(string strText, StyleType style) { SmartStepUtil.AddToRTB(rtbDisplay, strText, style); }
/// <summary> /// Converts FB2 simple text /// ( simple text is normal text or text with one of the "styles") /// </summary> /// <param name="styletypeItem">item to convert</param> /// <param name="simpleTextElementConverterParams"></param> /// <returns></returns> public List<IHTMLItem> Convert(StyleType styletypeItem,SimpleTextElementConverterParamsV2 simpleTextElementConverterParams) { if (styletypeItem == null) { throw new ArgumentNullException("styletypeItem"); } var list = new List<IHTMLItem>(); if (styletypeItem is SimpleText) { var text = styletypeItem as SimpleText; switch (text.Style) { case FB2Library.Elements.TextStyles.Normal: if (text.HasChildren) { list.AddRange(text.Children.SelectMany(x=>Convert(x,simpleTextElementConverterParams))); } else { if (simpleTextElementConverterParams.NeedToInsertDrop && text.Text.Length > 0) { AddAsDrop(list,text); } else { list.Add(new SimpleHTML5Text(HTMLElementType.XHTML11) { Text = text.Text }); } } break; case FB2Library.Elements.TextStyles.Code: var code = new CodeText(HTMLElementType.XHTML11); if (text.HasChildren) { foreach (var item in text.Children.SelectMany(x=>Convert(x,simpleTextElementConverterParams))) { code.Add(item); } } else { code.Add(new SimpleHTML5Text(HTMLElementType.XHTML11) { Text = text.Text }); } list.Add(code); break; case FB2Library.Elements.TextStyles.Emphasis: var emph = new EmphasisedText(HTMLElementType.XHTML11); if (text.HasChildren) { foreach (var item in text.Children.SelectMany(x=>Convert(x,simpleTextElementConverterParams))) { emph.Add(item); } } else { emph.Add(new SimpleHTML5Text(HTMLElementType.XHTML11) { Text = text.Text }); } list.Add(emph); break; case FB2Library.Elements.TextStyles.Strong: var str = new Strong(HTMLElementType.XHTML11); if (text.HasChildren) { foreach (var child in text.Children) { foreach (var item in Convert(child, simpleTextElementConverterParams)) { str.Add(item); } } } else { str.Add(new SimpleHTML5Text(HTMLElementType.XHTML11) { Text = text.Text }); } list.Add(str); break; case FB2Library.Elements.TextStyles.Sub: var sub = new Sub(HTMLElementType.XHTML11); if (text.HasChildren) { foreach (var child in text.Children) { foreach (var item in Convert(child,simpleTextElementConverterParams)) { sub.Add(item); } } } else { sub.Add(new SimpleHTML5Text(HTMLElementType.XHTML11) { Text = text.Text }); } list.Add(sub); break; case FB2Library.Elements.TextStyles.Sup: var sup = new Sup(HTMLElementType.XHTML11); if (text.HasChildren) { foreach (var child in text.Children) { foreach (var item in Convert(child,simpleTextElementConverterParams)) { sup.Add(item); } } } else { sup.Add(new SimpleHTML5Text(HTMLElementType.XHTML11) { Text = text.Text }); } list.Add(sup); break; case FB2Library.Elements.TextStyles.Strikethrough: var strike = new DeletedText(HTMLElementType.XHTML11); if (text.HasChildren) { foreach (var child in text.Children) { foreach (var item in Convert(child,simpleTextElementConverterParams)) { strike.Add(item); } } } else { strike.Add(new SimpleHTML5Text(HTMLElementType.XHTML11) { Text = text.Text }); } list.Add(strike); break; } } else if (styletypeItem is InternalLinkItem) { var linkConverter = new InternalLinkConverterV2(); list.AddRange(linkConverter.Convert(styletypeItem as InternalLinkItem, new InternalLinkConverterParamsV2 { NeedToInsertDrop = simpleTextElementConverterParams.NeedToInsertDrop, Settings = simpleTextElementConverterParams.Settings, })); } else if (styletypeItem is InlineImageItem) { var inlineItem = styletypeItem as InlineImageItem; if (simpleTextElementConverterParams.Settings.Images.IsImageIdReal(inlineItem.HRef)) { var inlineImageConverter = new InlineImageConverterV2(); list.Add(inlineImageConverter.Convert(styletypeItem as InlineImageItem, new InlineImageConverterParamsV2 {Settings = simpleTextElementConverterParams.Settings})); simpleTextElementConverterParams.Settings.Images.ImageIdUsed(inlineItem.HRef); } } return list; }