///<remarks>The first letter for the context is supposed to be lower case</remarks> private static string GetStyleContext(ExportStyleInfo style) { var contextString = style.Context.ToString(); if (string.IsNullOrEmpty(contextString)) { throw new ArgumentException("The context in the style is invalid", "style"); } return(contextString.Substring(0, 1).ToLowerInvariant() + contextString.Substring(1)); }
private static string GetStyleType(ExportStyleInfo style) { switch (style.RealStyle.Type) { case StyleType.kstCharacter: return("character"); case StyleType.kstParagraph: return("paragraph"); } return(style.RealStyle.Type.ToString()); }
private void WriteFontAndParagraphRulesXml(ExportStyleInfo style, XmlWriter writer, string basedOnStyle, BaseStyleInfo nextStyle) { if (style.FontInfoForWs(-1) == null) { writer.WriteStartElement("font"); writer.WriteEndElement(); return; } // Generate the font info (the font element is required by the DTD even if it has no attributes) writer.WriteStartElement("font"); IEnumerable <Tuple <string, string> > fontProps = CollectFontProps(style.FontInfoForWs(-1)); if (fontProps.Any()) { foreach (var prop in fontProps) { writer.WriteAttributeString(prop.Item1, prop.Item2); } } foreach (var writingSystem in Cache.LangProject.AllWritingSystems) { var wsOverrideProps = CollectFontProps(style.FontInfoForWs(writingSystem.Handle)); if (wsOverrideProps.Any()) { writer.WriteStartElement("override"); writer.WriteAttributeString("wsId", writingSystem.RFC5646); foreach (var prop in wsOverrideProps) { writer.WriteAttributeString(prop.Item1, prop.Item2); } writer.WriteEndElement(); } } writer.WriteEndElement(); // font IEnumerable <Tuple <string, string> > paragraphProps = CollectParagraphProps(style, basedOnStyle, nextStyle); if (paragraphProps.Any()) { writer.WriteStartElement("paragraph"); foreach (var prop in paragraphProps) { writer.WriteAttributeString(prop.Item1, prop.Item2); } writer.WriteEndElement(); // paragraph } }
public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("DTDver", DtdRequiredVersion); writer.WriteAttributeString("label", "Flex Dictionary"); writer.WriteAttributeString("date", DateTime.UtcNow.ToString("yyyy-MM-dd")); writer.WriteStartElement("markup"); writer.WriteAttributeString("version", GetVersion(m_sourceStyles).ToString()); foreach (var style in StyleCollection) { if (DictionaryConfigurationImportController.UnsupportedStyles.Contains(style.Name)) { continue; } var exportStyle = new ExportStyleInfo(style, style.Rules); WriteStyleXml(exportStyle, writer); } writer.WriteEndElement(); // markup }
private void WriteStyleXml(ExportStyleInfo style, XmlWriter writer) { writer.WriteStartElement("tag"); writer.WriteAttributeString("id", GetStyleId(style)); writer.WriteAttributeString("guid", style.RealStyle.Guid.ToString()); writer.WriteAttributeString("userlevel", style.UserLevel.ToString()); writer.WriteAttributeString("context", GetStyleContext(style)); writer.WriteAttributeString("type", GetStyleType(style)); if (GetStyleType(style) == "character" && style.InheritsFrom != null) { // LT-18267 Character styles put their basedOn in a different place // than paragraph styles. writer.WriteAttributeString("basedOn", GetStyleId(style.InheritsFrom)); } WriteUsageElement(style.RealStyle.Usage, writer); WriteFontAndParagraphRulesXml(style, writer, style.InheritsFrom, style.NextStyle); writer.WriteEndElement(); // tag }
/// <summary> /// Collects the paragraph info for the style in tuples of attribute name, attribute value /// </summary> private IEnumerable <Tuple <string, string> > CollectParagraphProps(ExportStyleInfo styleRules, string basedOnStyle, BaseStyleInfo nextStyle) { var paragraphProps = new List <Tuple <string, string> >(); GetPointPropAttribute((int)FwTextPropType.ktptSpaceBefore, "spaceBefore", styleRules.RealStyle.Rules, paragraphProps); GetPointPropAttribute((int)FwTextPropType.ktptSpaceAfter, "spaceAfter", styleRules.RealStyle.Rules, paragraphProps); GetPointPropAttribute((int)FwTextPropType.ktptLeadingIndent, "indentLeft", styleRules.RealStyle.Rules, paragraphProps); GetPointPropAttribute((int)FwTextPropType.ktptTrailingIndent, "indentRight", styleRules.RealStyle.Rules, paragraphProps); GetColorValueAttribute((int)FwTextPropType.ktptBackColor, "background", styleRules.RealStyle.Rules, paragraphProps); if (basedOnStyle != null) { paragraphProps.Add(new Tuple <string, string>("basedOn", GetStyleId(basedOnStyle))); } if (nextStyle != null) { paragraphProps.Add(new Tuple <string, string>("next", GetStyleId(nextStyle))); } if (styleRules.HasFirstLineIndent) { // hanging and firstLine are stored in an overloaded property value, negative for hanging, positive for firstline if (styleRules.FirstLineIndent < 0) { paragraphProps.Add(new Tuple <string, string>("hanging", -(styleRules.FirstLineIndent / 1000) + " pt")); } else { paragraphProps.Add(new Tuple <string, string>("firstLine", styleRules.FirstLineIndent / 1000 + " pt")); } } if (styleRules.HasAlignment) { var alignment = styleRules.Alignment; string alignValue = "none"; switch (alignment) { case FwTextAlign.ktalCenter: alignValue = "center"; break; case FwTextAlign.ktalLeft: alignValue = "left"; break; case FwTextAlign.ktalRight: alignValue = "right"; break; case FwTextAlign.ktalJustify: alignValue = "full"; break; } paragraphProps.Add(new Tuple <string, string>("alignment", alignValue)); } if (styleRules.HasLineSpacing) { string lineSpaceType; // relative is used for single, 1.5, double space if (styleRules.LineSpacing.m_relative) { lineSpaceType = "rel"; } else if (styleRules.LineSpacing.m_lineHeight <= 0) { // for historical reasons negative values mean exact, and positive mean at least // (see: Framework\StylesXmlAccessor.cs SetParagraphProperties()) lineSpaceType = "exact"; } else { lineSpaceType = "atleast"; } var lineSpace = Math.Abs(styleRules.LineSpacing.m_lineHeight) / 1000 + " pt"; paragraphProps.Add(new Tuple <string, string>("lineSpacing", lineSpace)); paragraphProps.Add(new Tuple <string, string>("lineSpacingType", lineSpaceType)); } return(paragraphProps); }
private void WriteFontAndParagraphRulesXml(ExportStyleInfo style, XmlWriter writer, string basedOnStyle, BaseStyleInfo nextStyle) { if (style.FontInfoForWs(-1) == null) { writer.WriteStartElement("font"); writer.WriteEndElement(); return; } // Generate the font info (the font element is required by the DTD even if it has no attributes) writer.WriteStartElement("font"); IEnumerable <Tuple <string, string> > fontProps = CollectFontProps(style.FontInfoForWs(-1)); if (fontProps.Any()) { foreach (var prop in fontProps) { writer.WriteAttributeString(prop.Item1, prop.Item2); } } foreach (var writingSystem in Cache.LangProject.AllWritingSystems) { var wsOverrideProps = CollectFontProps(style.FontInfoForWs(writingSystem.Handle)); if (wsOverrideProps.Any()) { writer.WriteStartElement("override"); writer.WriteAttributeString("wsId", writingSystem.LanguageTag); foreach (var prop in wsOverrideProps) { writer.WriteAttributeString(prop.Item1, prop.Item2); } writer.WriteEndElement(); } } writer.WriteEndElement(); // font IEnumerable <Tuple <string, string> > paragraphProps = CollectParagraphProps(style, basedOnStyle, nextStyle); if (paragraphProps.Any()) { writer.WriteStartElement("paragraph"); foreach (var prop in paragraphProps) { writer.WriteAttributeString(prop.Item1, prop.Item2); } //Bullet/Number FontInfo try { IEnumerable <Tuple <string, string> > bulNumParaProperty = CollectBulletProps(style.BulletInfo); foreach (var prop in bulNumParaProperty) { string propName = prop.Item1; if (BulletPropertyMap.ContainsKey(propName.ToLower())) { propName = BulletPropertyMap[propName.ToLower()]; } writer.WriteAttributeString(propName, prop.Item2); } // Generate the font info (the font element is required by the DTD even if it has no attributes) writer.WriteStartElement("BulNumFontInfo"); IEnumerable <Tuple <string, string> > bulletFontInfoProperties = CollectFontProps(style.BulletInfo.FontInfo); if (bulletFontInfoProperties.Any()) { foreach (var prop in bulletFontInfoProperties) { writer.WriteAttributeString(prop.Item1, prop.Item2); } } writer.WriteEndElement(); // bullet } catch {} writer.WriteEndElement(); // paragraph } }
private void WriteParaStyleInfoToCss(ExportStyleInfo esi, bool hangingIndent, bool entryOrMinorEntry = false) { if (esi == null) return; // If the style was not defined in our stylesheet, we can't write anything for it. string sLeading; string sTrailing; WriteHorizontalPaddingValues(esi, hangingIndent, out sLeading, out sTrailing); if (esi.HasAlignment) { switch (esi.Alignment) { case FwTextAlign.ktalCenter: m_writer.WriteLine(" text-align: center;"); break; case FwTextAlign.ktalJustify: m_writer.WriteLine(" text-align: justify;"); break; case FwTextAlign.ktalLeft: m_writer.WriteLine(" text-align: left;"); break; case FwTextAlign.ktalRight: m_writer.WriteLine(" text-align: right;"); break; case FwTextAlign.ktalLeading: m_writer.WriteLine(" /*text-align: leading;*/"); m_writer.WriteLine(" text-align: {0};", sLeading); break; case FwTextAlign.ktalTrailing: m_writer.WriteLine(" /*text-align: trailing;*/"); m_writer.WriteLine(" text-align: {0};", sTrailing); break; } } if (esi.HasBorder) { m_writer.WriteLine(" border-style: solid;"); m_writer.WriteLine(" border-top-width: {0}pt;", ConvertMptToPt(esi.BorderTop)); m_writer.WriteLine(" border-bottom-width: {0}pt;", ConvertMptToPt(esi.BorderBottom)); m_writer.WriteLine(" border-left-width: {0}pt;", ConvertMptToPt(esi.BorderLeading)); m_writer.WriteLine(" border-right-width: {0}pt;", ConvertMptToPt(esi.BorderTrailing)); } if (esi.HasBorderColor) m_writer.WriteLine(" border-color: rgb({0},{1},{2});", esi.BorderColor.R, esi.BorderColor.G, esi.BorderColor.B); if (hangingIndent) { // Indent is allowed, write it out if specified; otherwise, allow it to be inherited. if (esi.HasFirstLineIndent) { var firstLineIndentAdjusted = esi.FirstLineIndent; if (entryOrMinorEntry) //LT-14757 Need to reduce indent for cell phone devices. firstLineIndentAdjusted = firstLineIndentAdjusted/3; m_writer.WriteLine(" text-indent: {0}pt;", ConvertMptToPt(firstLineIndentAdjusted)); m_writer.Write(" margin-{0}: ", sLeading); if (esi.FirstLineIndent < 0) m_writer.WriteLine("{0}pt;", ConvertMptToPt(-firstLineIndentAdjusted)); else m_writer.WriteLine("0pt;"); } } else { // LT-12658 suppress indentation (even inherited) inside paragraphs (entries). m_writer.WriteLine(" text-indent: 0pt;"); m_writer.WriteLine(" margin-{0}: 0pt;", sLeading); } if (esi.HasLineSpacing) { LineHeightInfo lhi = esi.LineSpacing; if (lhi.m_relative) m_writer.WriteLine(" line-height: {0}%;", lhi.m_lineHeight / 100); else if (lhi.m_lineHeight < 0) m_writer.WriteLine(" line-height: {0}pt;", ConvertMptToPt(-lhi.m_lineHeight)); else m_writer.WriteLine(" line-height: normal;"); // "at least" semantics?? } if (esi.HasSpaceAfter) m_writer.WriteLine(" padding-bottom: {0}pt;", ConvertMptToPt(esi.SpaceAfter)); if (esi.HasSpaceBefore) m_writer.WriteLine(" padding-top: {0}pt;", ConvertMptToPt(esi.SpaceBefore)); if (esi.HasWidowOrphanControl) { m_writer.WriteLine(" orphans: {0};", esi.WidowOrphanControl ? "2" : "1"); m_writer.WriteLine(" widows: {0};", esi.WidowOrphanControl ? "2" : "1"); } // esi.KeepTogether; // esi.KeepWithNext; }
private void WriteHorizontalPaddingValues(ExportStyleInfo esi, bool hangingIndent, out string sLeading, out string sTrailing) { sLeading = esi.DirectionIsRightToLeft == TriStateBool.triTrue ? "right" : "left"; sTrailing = esi.DirectionIsRightToLeft == TriStateBool.triTrue ? "left" : "right"; if (esi.HasLeadingIndent && hangingIndent) // LT-12658 suppress indentation inside paragraphs m_writer.WriteLine(" padding-{0}: {1}pt;", sLeading, ConvertMptToPt(esi.LeadingIndent)); if (esi.HasTrailingIndent) m_writer.WriteLine(" padding-{0}: {1}pt;", sTrailing, ConvertMptToPt(esi.TrailingIndent)); }
private void WriteParaStyleInfoToCss(ExportStyleInfo esi) { WriteParaStyleInfoToCss(esi, AllowDictionaryParagraphIndent); }
private bool WriteFontAttr(int ws, string sAttr, ExportStyleInfo esi, string sCss, bool fTopLevel) { FontInfo fi = esi.FontInfoForWs(ws); bool fInherited = false; string sInheritance = String.Empty; if (sCss == null && !fTopLevel) sInheritance = "\t/* inherited through cascaded environment */"; if (sCss == null) sInheritance = "\t/* cascaded environment */"; else if (!fTopLevel) sInheritance = "\t/* inherited */"; switch (sAttr) { case "font-family": if (fi.m_fontName.ValueIsSet) { string sFontName = esi.RealFontNameForWs(ws); if (String.IsNullOrEmpty(sFontName)) m_writer.WriteLine(" font-family: \"{0}\", serif;{1}", fi.m_fontName.Value, sInheritance); else m_writer.WriteLine(" font-family: \"{0}\", serif;{1}", sFontName, sInheritance); return true; } fInherited = fi.m_fontName.IsInherited; break; case "font-size": bool superSub = fi.m_superSub.ValueIsSet && fi.m_superSub.Value != FwSuperscriptVal.kssvOff; if (fi.m_fontSize.ValueIsSet) { var pointSize = fi.m_fontSize.Value; if (superSub) pointSize = pointSize*55/100; m_writer.WriteLine(" font-size: {0}pt;{1}", ConvertMptToPt(pointSize), sInheritance); return true; } if (superSub) { m_writer.WriteLine(" font-size: 55%;{0}", sInheritance); return true; } fInherited = fi.m_fontSize.IsInherited; break; case "font-weight": if (fi.m_bold.ValueIsSet) { m_writer.WriteLine(" font-weight: {0};{1}", fi.m_bold.Value ? "bold" : "normal", sInheritance); return true; } fInherited = fi.m_bold.IsInherited; break; case "font-style": if (fi.m_italic.ValueIsSet) { m_writer.WriteLine(" font-style: {0};{1}", fi.m_italic.Value ? "italic" : "normal", sInheritance); return true; } fInherited = fi.m_italic.IsInherited; break; case "color": if (fi.m_fontColor.ValueIsSet) { //Black as a font color is a default setting, we will ignore it (LT-10891) //however, if it is explicitly set we need to include it. if (fi.m_fontColor.Value != Color.Black || fi.m_fontColor.IsExplicit) { m_writer.WriteLine(" color: rgb({0},{1},{2});{3}", fi.m_fontColor.Value.R, fi.m_fontColor.Value.G, fi.m_fontColor.Value.B, sInheritance); } return true; } fInherited = fi.m_fontColor.IsInherited; break; case "background-color": if (fi.m_backColor.ValueIsSet) { //White as a background color is a default setting, we will ignore it (LT-10891) //however, if it is explicitly set we need to include it. if (fi.m_backColor.Value != Color.White || fi.m_fontColor.IsExplicit) { m_writer.WriteLine(" background-color: rgb({0},{1},{2});{3}", fi.m_backColor.Value.R, fi.m_backColor.Value.G, fi.m_backColor.Value.B, sInheritance); } return true; } fInherited = fi.m_backColor.IsInherited; break; case "vertical-align": if (fi.m_superSub.ValueIsSet) { m_writer.WriteLine(" vertical-align: {0};{1}", GetVerticalAlign(fi.m_superSub.Value), sInheritance); return true; } if (fi.m_offset.ValueIsSet) { m_writer.WriteLine(" vertical-align: {0}pt;{1}", ConvertMptToPt(fi.m_offset.Value), sInheritance); return true; } fInherited = fi.m_offset.IsInherited || fi.m_superSub.IsInherited; break; case "text-decoration": if (fi.m_underline.ValueIsSet) { m_writer.WriteLine(" text-decoration: {0};{1}", (fi.m_underline.Value == FwUnderlineType.kuntNone ? "none" : "underline"), sInheritance); return true; } fInherited = fi.m_underline.IsInherited; break; } if (fInherited) { string sBaseStyle = esi.InheritsFrom; BaseStyleInfo bsiBase; if (!String.IsNullOrEmpty(sBaseStyle) && m_styleTable.TryGetValue(GetValidCssClassName(sBaseStyle), out bsiBase)) { if (WriteFontAttr(ws, sAttr, bsiBase as ExportStyleInfo, sCss, false)) return true; } if (!String.IsNullOrEmpty(sCss)) { List<string> rgsStyles; if (m_mapCssToStyleEnv.TryGetValue(sCss, out rgsStyles)) { foreach (string sParaStyle in rgsStyles) { BaseStyleInfo bsiPara; if (m_styleTable.TryGetValue(GetValidCssClassName(sParaStyle), out bsiPara) && WriteFontAttr(ws, sAttr, bsiPara as ExportStyleInfo, null, false)) { return true; } } } } } return false; }
private void ReadStyles(IVwStylesheet vss) { string normalStyleName = vss.GetDefaultBasedOnStyleName(); m_styleTable = new StyleInfoTable(normalStyleName, m_cache.ServiceLocator.WritingSystemManager); int cStyles = vss.CStyles; for (int i = 0; i < cStyles; ++i) { int hvo = vss.get_NthStyle(i); var sty = m_cache.ServiceLocator.GetInstance<IStStyleRepository>().GetObject(hvo); // CSS does not implement the kind of inheritance our styles use. To get the style // definitions we want in the CSS, we must create these styles using the 'net effect' of // each style and all the ones it is based on. Happily the VwStyleSheet knows exactly // how to do this. var props = vss.GetStyleRgch(sty.Name.Length, sty.Name); var exportStyleInfo = new ExportStyleInfo(sty, props); m_styleTable.Add(GetValidCssClassName(sty.Name), exportStyleInfo); } }
private void WriteParaStyleInfoToCss(ExportStyleInfo esi) { string sLeading = esi.DirectionIsRightToLeft == TriStateBool.triTrue ? "right" : "left"; string sTrailing = esi.DirectionIsRightToLeft == TriStateBool.triTrue ? "left" : "right"; if (esi.HasAlignment) { FwTextAlign fta = esi.Alignment; switch (esi.Alignment) { case FwTextAlign.ktalCenter: m_writer.WriteLine(" text-align: center;"); break; case FwTextAlign.ktalJustify: m_writer.WriteLine(" text-align: justify;"); break; case FwTextAlign.ktalLeft: m_writer.WriteLine(" text-align: left;"); break; case FwTextAlign.ktalRight: m_writer.WriteLine(" text-align: right;"); break; case FwTextAlign.ktalLeading: m_writer.WriteLine(" /*text-align: leading;*/"); m_writer.WriteLine(" text-align: {0};", sLeading); break; case FwTextAlign.ktalTrailing: m_writer.WriteLine(" /*text-align: trailing;*/"); m_writer.WriteLine(" text-align: {0};", sTrailing); break; } } if (esi.HasBorder) { m_writer.WriteLine(" border-style: solid;"); m_writer.WriteLine(" border-top-width: {0}pt;", ConvertMptToPt(esi.BorderTop)); m_writer.WriteLine(" border-bottom-width: {0}pt;", ConvertMptToPt(esi.BorderBottom)); m_writer.WriteLine(" border-left-width: {0}pt;", ConvertMptToPt(esi.BorderLeading)); m_writer.WriteLine(" border-right-width: {0}pt;", ConvertMptToPt(esi.BorderTrailing)); } if (esi.HasBorderColor) m_writer.WriteLine(" border-color: rgb({0},{1},{2});", esi.BorderColor.R, esi.BorderColor.G, esi.BorderColor.B); if (esi.HasFirstLineIndent) { m_writer.WriteLine(" text-indent: {0}pt;", ConvertMptToPt(esi.FirstLineIndent)); m_writer.Write(" margin-{0}: ", sLeading); if (esi.FirstLineIndent < 0) m_writer.WriteLine("{0}pt;", ConvertMptToPt(-esi.FirstLineIndent)); else m_writer.WriteLine("0pt;"); } else { m_writer.WriteLine(" text-indent: 0pt;"); m_writer.WriteLine(" margin-{0}: 0pt;", sLeading); } if (esi.HasLeadingIndent) m_writer.WriteLine(" padding-{0}: {1}pt;", sLeading, ConvertMptToPt(esi.LeadingIndent)); if (esi.HasTrailingIndent) m_writer.WriteLine(" padding-{0}: {1}pt;", sTrailing, ConvertMptToPt(esi.TrailingIndent)); if (esi.HasLineSpacing) { LineHeightInfo lhi = esi.LineSpacing; if (lhi.m_relative) m_writer.WriteLine(" line-height: {0}%;", lhi.m_lineHeight / 100); else if (lhi.m_lineHeight < 0) m_writer.WriteLine(" line-height: {0}pt;", ConvertMptToPt(-lhi.m_lineHeight)); else m_writer.WriteLine(" line-height: normal;"); // "at least" semantics?? } if (esi.HasSpaceAfter) m_writer.WriteLine(" padding-bottom: {0}pt;", ConvertMptToPt(esi.SpaceAfter)); if (esi.HasSpaceBefore) m_writer.WriteLine(" padding-top: {0}pt;", ConvertMptToPt(esi.SpaceBefore)); if (esi.HasWidowOrphanControl) { m_writer.WriteLine(" orphans: {0};", esi.WidowOrphanControl ? "2" : "1"); m_writer.WriteLine(" widows: {0};", esi.WidowOrphanControl ? "2" : "1"); } // esi.KeepTogether; // esi.KeepWithNext; }
private bool WriteFontAttr(int ws, string sAttr, ExportStyleInfo esi, string sCss, bool fTopLevel) { FontInfo fi = esi.FontInfoForWs(ws); bool fExplicit = false; bool fInherited = false; string sInheritance = String.Empty; if (sCss == null && !fTopLevel) sInheritance = "\t/* inherited through cascaded environment */"; if (sCss == null) sInheritance = "\t/* cascaded environment */"; else if (!fTopLevel) sInheritance = "\t/* inherited */"; switch (sAttr) { case "font-family": if (fi.m_fontName.ValueIsSet) { string sFontName = esi.RealFontNameForWs(ws); if (String.IsNullOrEmpty(sFontName)) m_writer.WriteLine(" font-family: \"{0}\", serif;{1}", fi.m_fontName.Value, sInheritance); else m_writer.WriteLine(" font-family: \"{0}\", serif;{1}", sFontName, sInheritance); return true; } fExplicit = fi.m_fontName.IsExplicit; fInherited = fi.m_fontName.IsInherited; break; case "font-size": if (fi.m_fontSize.ValueIsSet) { m_writer.WriteLine(" font-size: {0}pt;{1}", ConvertMptToPt(fi.m_fontSize.Value), sInheritance); return true; } fExplicit = fi.m_fontSize.IsExplicit; fInherited = fi.m_fontSize.IsInherited; break; case "font-weight": if (fi.m_bold.ValueIsSet) { m_writer.WriteLine(" font-weight: {0};{1}", fi.m_bold.Value ? "bold" : "normal", sInheritance); return true; } fExplicit = fi.m_bold.IsExplicit; fInherited = fi.m_bold.IsInherited; break; case "font-style": if (fi.m_italic.ValueIsSet) { m_writer.WriteLine(" font-style: {0};{1}", fi.m_italic.Value ? "italic" : "normal", sInheritance); return true; } fExplicit = fi.m_italic.IsExplicit; fInherited = fi.m_italic.IsInherited; break; case "color": if (fi.m_fontColor.ValueIsSet) { m_writer.WriteLine(" color: rgb({0},{1},{2});{3}", fi.m_fontColor.Value.R, fi.m_fontColor.Value.G, fi.m_fontColor.Value.B, sInheritance); return true; } fExplicit = fi.m_fontColor.IsExplicit; fInherited = fi.m_fontColor.IsInherited; break; case "background-color": if (fi.m_backColor.ValueIsSet) { m_writer.WriteLine(" background-color: rgb({0},{1},{2});{3}", fi.m_backColor.Value.R, fi.m_backColor.Value.G, fi.m_backColor.Value.B, sInheritance); return true; } fExplicit = fi.m_backColor.IsExplicit; fInherited = fi.m_backColor.IsInherited; break; case "vertical-align": if (fi.m_superSub.ValueIsSet) { m_writer.WriteLine(" vertical-align: {0};{1}", GetVerticalAlign(fi.m_superSub.Value), sInheritance); return true; } if (fi.m_offset.ValueIsSet) { m_writer.WriteLine(" vertical-align: {0}pt;{1}", ConvertMptToPt(fi.m_offset.Value), sInheritance); return true; } fExplicit = fi.m_offset.IsExplicit || fi.m_superSub.IsExplicit; fInherited = fi.m_offset.IsInherited || fi.m_superSub.IsInherited; break; case "text-decoration": if (fi.m_underline.ValueIsSet) { m_writer.WriteLine(" text-decoration: {0};{1}", (fi.m_underline.Value == FwUnderlineType.kuntNone ? "none" : "underline"), sInheritance); return true; } fExplicit = fi.m_underline.IsExplicit; fInherited = fi.m_underline.IsInherited; break; } if (fInherited) { string sBaseStyle = esi.InheritsFrom; BaseStyleInfo bsiBase; if (!String.IsNullOrEmpty(sBaseStyle) && m_styleTable.TryGetValue(sBaseStyle, out bsiBase)) { if (WriteFontAttr(ws, sAttr, bsiBase as ExportStyleInfo, sCss, false)) return true; } if (!String.IsNullOrEmpty(sCss)) { List<string> rgsStyles; if (m_mapCssToStyleEnv.TryGetValue(sCss, out rgsStyles)) { foreach (string sParaStyle in rgsStyles) { BaseStyleInfo bsiPara; if (m_styleTable.TryGetValue(sParaStyle, out bsiPara) && WriteFontAttr(ws, sAttr, bsiPara as ExportStyleInfo, null, false)) { return true; } } } } } return false; }