public void GetTextRepresentation_MultiCharStylePara() { ITsIncStrBldr strBldr = m_footnotePara.Contents.GetIncBldr(); // run 1 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis"); strBldr.Append("Test Text"); // run 2 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); strBldr.Append("No char style"); // run 3 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Quoted Text"); strBldr.Append("Ahh!!!!!!"); // run 4 strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_wsDe); strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Untranslated Word"); strBldr.Append(" untranslated"); m_footnotePara.Contents = strBldr.GetString(); string result = m_footnote.TextRepresentation; Assert.AreEqual("<FN><M>a</M><P><PS>Note General Paragraph</PS>" + "<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" + "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" + "<RUN WS='de' CS='Untranslated Word'> untranslated</RUN></P></FN>", result); }
/// <summary> /// This method will use the current homograph-number settings to insert the homograph number into the string /// </summary> public static void InsertHomographNumber(ITsIncStrBldr tisb, int nHomograph, HomographConfiguration hc, HomographConfiguration.HeadwordVariant hv, LcmCache cache) { if (nHomograph > 0 && hc.ShowHomographNumber(hv)) { tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, HomographConfiguration.ksHomographNumberStyle); if (!string.IsNullOrEmpty(hc.WritingSystem)) { tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.WritingSystemFactory.GetWsFromStr(hc.WritingSystem)); } else { tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.DefaultVernWs); } var hnString = nHomograph.ToString(); if (hc.CustomHomographNumbers.Count == 10) { for (var i = 0; i < 10; ++i) { hnString = hnString.Replace(i.ToString(), hc.CustomHomographNumbers[i]); } } tisb.Append(hnString); tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the a text run from a string representation. /// </summary> /// <param name="owner">The owner of the paragraph (book).</param> /// <param name="strBldr">The structured string builder.</param> /// <param name="textNode">The text node which describes runs to be added to the /// paragraph or to the translation for a particular writing system</param> /// ------------------------------------------------------------------------------------ private static void CreateRunFromStringRep(CmObject owner, ITsIncStrBldr strBldr, XmlNode textNode) { XmlNode charStyle = textNode.Attributes.GetNamedItem("CS"); if (charStyle != null) { strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, charStyle.Value); } else { strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); } XmlNode wsICULocale = textNode.Attributes.GetNamedItem("WS"); if (wsICULocale != null) { ILgWritingSystemFactory wsf = owner.Cache.LanguageWritingSystemFactoryAccessor; int ws = wsf.GetWsFromStr(wsICULocale.Value); if (ws <= 0) { throw new ArgumentException("Unknown ICU locale encountered: '" + wsICULocale.Value + "'"); } strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, wsf.GetWsFromStr(wsICULocale.Value)); } else { throw new ArgumentException("Required attribute WS missing from RUN element."); } }
private static void InsertHomographNumber(ITsIncStrBldr tisb, int nHomograph, HomographConfiguration hc, HomographConfiguration.HeadwordVariant hv) { if (nHomograph > 0 && hc.ShowHomographNumber(hv)) { tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, HomographConfiguration.ksHomographNumberStyle); tisb.Append(nHomograph.ToString()); tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); } }
/// <summary> /// Returns a TsString with the entry headword and a sense number if there /// are more than one senses. /// </summary> public ITsString OwnerOutlineNameForWs(ILexSense sense, int wsVern, HomographConfiguration.HeadwordVariant hv) { var entry = sense.Entry; int hn; if (!m_homographNumbers.TryGetValue(entry.Hvo, out hn)) { hn = entry.HomographNumber; // unknown entry, use its own HN instead of our override } ITsIncStrBldr tisb = TsIncStrBldrClass.Create(); tisb.AppendTsString(StringServices.HeadWordForWsAndHn(entry, wsVern, hn, "", hv)); var hc = sense.Services.GetInstance <HomographConfiguration>(); if (hc.ShowSenseNumber(hv) && HasMoreThanOneSense(entry)) { // These int props may not be needed, but they're safe. tisb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, Cache.DefaultAnalWs); tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, HomographConfiguration.ksSenseReferenceNumberStyle); tisb.Append(" "); tisb.Append(GetSenseNumber(sense)); } return(tisb.GetString()); }
public void GetTextRepresentation_BT_MultiCharStylePara() { CheckDisposed(); SetupBackTrans(); ITsIncStrBldr strBldr = TsIncStrBldrClass.Create(); strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_vernWs); // run 1 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis"); strBldr.Append("Test Text"); // run 2 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); strBldr.Append("No char style"); // run 3 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Quoted Text"); strBldr.Append("Ahh!!!!!!"); m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString(); // Now add back translations with and without character styles. m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, "Spanish", null); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, m_vernWs, " back ", ScrStyleNames.UntranslatedWord); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, " translation!", "Emphasis"); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, "German!", "Emphasis"); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, m_vernWs, " back ", ScrStyleNames.UntranslatedWord); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, " translation", null); string result = m_footnote.GetTextRepresentation(); Assert.AreEqual(@"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" + @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" + "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" + "<TRANS WS='es'><RUN WS='es'>Spanish</RUN><RUN WS='fr' CS='Untranslated Word'> back </RUN><RUN WS='es' CS='Emphasis'> translation!</RUN></TRANS>" + "<TRANS WS='de'><RUN WS='de' CS='Emphasis'>German!</RUN><RUN WS='fr' CS='Untranslated Word'> back </RUN><RUN WS='de'> translation</RUN></TRANS>" + "</P></FN>", result); }
public void CreateFromStringRep_BT_MultiCharStylePara() { CheckDisposed(); SetupBackTrans(); ITsIncStrBldr strBldr = TsIncStrBldrClass.Create(); strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_vernWs); // Setup expected results for the footnote strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis"); // run 1 strBldr.Append("Test Text"); strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); // run 2 strBldr.Append("No char style"); strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Quoted Text"); // run 3 strBldr.Append("Ahh!!!!!!"); m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString(); // ... and now set up the expected results for the back translations of the footnote. m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, "Spanish", null); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, m_vernWs, " back ", ScrStyleNames.UntranslatedWord); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsEs, " translation!", "Emphasis"); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, "German!", "Emphasis"); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, m_vernWs, " back ", ScrStyleNames.UntranslatedWord); m_scrInMemoryCache.AddRunToMockedTrans(m_trans, m_wsDe, " translation", null); // Define text representation and create a footnote from it. string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" + @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" + "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" + "<TRANS WS='es'><RUN WS='es'>Spanish</RUN><RUN WS='fr' CS='Untranslated Word'> back </RUN>" + "<RUN WS='es' CS='Emphasis'> translation!</RUN></TRANS>" + "<TRANS WS='de'><RUN WS='de' CS='Emphasis'>German!</RUN>" + "<RUN WS='fr' CS='Untranslated Word'> back </RUN><RUN WS='de'> translation</RUN></TRANS></P></FN>"; StFootnote footnote = StFootnote.CreateFromStringRep(m_book, (int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker"); CompareFootnote(footnote); }
public static ITsString SpanStrToTsString(string source, int mainWs, ILgWritingSystemFactory wsf) { // How to build up an ITsString via an ITsIncStrBldr - // 1. Use SetIntPropValues or SetStrPropValues to set a property "to be applied to any subsequent append operations". // 2. THEN use Append(string s) to add a string, which will "pick up" the properties set in step 1. // See ScrFootnoteFactory.CreateRunFromStringRep() in FdoFactoryAdditions.cs for a good example. if (source == null) { return(null); } List <Run> runs = GetSpanRuns(source); ITsIncStrBldr builder = TsIncStrBldrClass.Create(); // Will become: ITsIncStrBldr builder = TsStringUtils.MakeIncStrBldr(); // Add "using SIL.CoreImpl;" when this line is uncommented. foreach (Run run in runs) { builder.ClearProps(); // Make sure there aren't leftover properties from previous run // To remove a string property, you set it to null, so we can just use StyleName directly whether or not it's null. builder.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, run.StyleName); int runWs = (run.Lang == null) ? mainWs : wsf.GetWsFromStr(run.Lang); builder.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, runWs); // We don't care about Guids in this function, so run.Guid is ignored // But we do need to set any other int or string properties that were in the original if (run.IntProperties != null) { foreach (KeyValuePair <int, IntProperty> prop in run.IntProperties) { builder.SetIntPropValues(prop.Key, prop.Value.Variation, prop.Value.Value); } } if (run.StringProperties != null) { foreach (KeyValuePair <int, string> prop in run.StringProperties) { builder.SetStrPropValue(prop.Key, prop.Value); } } builder.Append(run.Content); } return(builder.GetString()); }
public void GetTextRepresentation_charStylePara() { ITsIncStrBldr strBldr = m_footnotePara.Contents.GetIncBldr(); strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis"); strBldr.Append("Test Text"); m_footnotePara.Contents = strBldr.GetString(); Assert.AreEqual("<FN><M>a</M><P><PS>Note General Paragraph</PS>" + "<RUN WS='fr' CS='Emphasis'>Test Text</RUN></P></FN>", m_footnote.TextRepresentation); }
public void GetTextRepresentation_MultiCharStylePara() { CheckDisposed(); ITsIncStrBldr strBldr = TsIncStrBldrClass.Create(); strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_vernWs); // run 1 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis"); strBldr.Append("Test Text"); // run 2 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); strBldr.Append("No char style"); // run 3 strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Quoted Text"); strBldr.Append("Ahh!!!!!!"); // run 4 strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_wsDe); strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Untranslated Word"); strBldr.Append(" untranslated"); m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString(); string result = m_footnote.GetTextRepresentation(); Assert.AreEqual(@"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" + @"<RUN WS='fr' CS='Emphasis'>Test Text</RUN><RUN WS='fr'>No char style</RUN>" + "<RUN WS='fr' CS='Quoted Text'>Ahh!!!!!!</RUN>" + "<RUN WS='de' CS='Untranslated Word'> untranslated</RUN></P></FN>", result); }
public void GetTextRepresentation_charStylePara() { CheckDisposed(); ITsIncStrBldr strBldr = TsIncStrBldrClass.Create(); strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, "Emphasis"); strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, m_vernWs); strBldr.Append("Test Text"); m_footnotePara.Contents.UnderlyingTsString = strBldr.GetString(); string result = m_footnote.GetTextRepresentation(); Assert.AreEqual(@"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" + "<RUN WS='fr' CS='Emphasis'>Test Text</RUN></P></FN>", result); }
/// <summary> /// Append to the string builder text equivalent to CitationFormWithAffixTypeStatic, but /// with the correct writing systems. /// </summary> /// <param name="cache"></param> /// <param name="hvo"></param> /// <param name="tsb"></param> public static void CitationFormWithAffixTypeTss(FdoCache cache, int hvo, ITsIncStrBldr tsb) { ISilDataAccess sda = cache.MainCacheAccessor; int hvoType = 0; int hvoLexForm = sda.get_ObjectProp(hvo, (int)LexEntry.LexEntryTags.kflidLexemeForm); if (hvoLexForm != 0) { hvoType = sda.get_ObjectProp(hvoLexForm, (int)MoForm.MoFormTags.kflidMorphType); } else { // No type info...return simpler version of name. ShortName1Static(cache, hvo, tsb); return; } string prefix = string.Empty; string postfix = string.Empty; if (hvoType > 0) // It may be null. { prefix = sda.get_UnicodeProp(hvoType, (int)MoMorphType.MoMorphTypeTags.kflidPrefix); postfix = sda.get_UnicodeProp(hvoType, (int)MoMorphType.MoMorphTypeTags.kflidPostfix); } // The following code for setting Ws and FontFamily are to fix LT-6238. if (!String.IsNullOrEmpty(prefix)) { tsb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.DefaultVernWs); tsb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Doulos SIL"); tsb.Append(prefix); } ShortName1Static(cache, hvo, tsb); if (!String.IsNullOrEmpty(postfix)) { tsb.SetIntPropValues((int)FwTextPropType.ktptWs, 0, cache.DefaultVernWs); tsb.SetStrPropValue((int)FwTextPropType.ktptFontFamily, "Doulos SIL"); tsb.Append(postfix); } }
private static void InsertHomographNumber(ITsIncStrBldr tisb, int nHomograph, HomographConfiguration hc, HomographConfiguration.HeadwordVariant hv) { if (nHomograph > 0 && hc.ShowHomographNumber(hv)) { tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, HomographConfiguration.ksHomographNumberStyle); tisb.Append(nHomograph.ToString()); tisb.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates the a text run from a string representation. /// </summary> /// <param name="wsf">The writing system factory.</param> /// <param name="strBldr">The structured string builder.</param> /// <param name="textNode">The text node which describes runs to be added to the /// paragraph or to the translation for a particular writing system</param> /// ------------------------------------------------------------------------------------ private void CreateRunFromStringRep(ILgWritingSystemFactory wsf, ITsIncStrBldr strBldr, XmlNode textNode) { XmlNode charStyle = textNode.Attributes.GetNamedItem("CS"); if (charStyle != null) strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, charStyle.Value); else strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, null); XmlNode wsICULocale = textNode.Attributes.GetNamedItem("WS"); if (wsICULocale != null) { int ws = wsf.GetWsFromStr(wsICULocale.Value); if (ws <= 0) throw new ArgumentException("Unknown ICU locale encountered: '" + wsICULocale.Value + "'"); strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, (int)FwTextPropVar.ktpvDefault, wsf.GetWsFromStr(wsICULocale.Value)); } else throw new ArgumentException("Required attribute WS missing from RUN element."); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Gets the prop attributes for element and applies them to a string builder /// (to take effect on the next string added). /// </summary> /// <param name="xml">The XML.</param> /// <param name="lgwsf">The writing system factory.</param> /// <param name="strBldr"></param> /// <returns>Rather strangely, it returns a boolean indicating whether an ORC is needed if the /// text of the run is empty, that is, whether we set an objdata property</returns> /// ------------------------------------------------------------------------------------ internal static bool GetPropAttributesForElement(XElement xml, ILgWritingSystemFactory lgwsf, ITsIncStrBldr strBldr) { bool isOrcNeeded = false; strBldr.ClearProps(); foreach (XAttribute attr in xml.Attributes()) { switch (attr.Name.LocalName) { case "align": strBldr.SetIntPropValues((int)FwTextPropType.ktptAlign, (int)FwTextPropVar.ktpvEnum, GetAlignValueForStr(attr.Value)); break; case "backcolor": strBldr.SetIntPropValues((int)FwTextPropType.ktptBackColor, 0, GetColorValueForStr(attr.Value)); break; case "bold": strBldr.SetIntPropValues((int)FwTextPropType.ktptBold, (int)FwTextPropVar.ktpvEnum, GetToggleValueForStr(attr.Value)); break; case "borderBottom": strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderBottom, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "borderColor": strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderColor, 0, GetColorValueForStr(attr.Value)); break; case "borderLeading": strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderLeading, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "borderTop": strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderTop, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "borderTrailing": strBldr.SetIntPropValues((int)FwTextPropType.ktptBorderTrailing, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "bulNumScheme": strBldr.SetIntPropValues((int)FwTextPropType.ktptBulNumScheme, (int)FwTextPropVar.ktpvEnum, GetIntValueFromStr(attr.Value, false)); break; case "bulNumStartAt": strBldr.SetIntPropValues((int)FwTextPropType.ktptBulNumStartAt, 0, GetIntValueFromStr(attr.Value, false)); break; case "bulNumTxtAft": strBldr.SetStrPropValue((int)FwTextPropType.ktptBulNumTxtAft, attr.Value); break; case "bulNumTxtBef": strBldr.SetStrPropValue((int)FwTextPropType.ktptBulNumTxtBef, attr.Value); break; case "charStyle": Debug.Fail("We don't support the old charStyle attribute!"); break; case "contextString": AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtContextString); isOrcNeeded = true; break; case "embedded": strBldr.SetStrPropValue((int)FwTextPropType.ktptObjData, (char)FwObjDataTypes.kodtEmbeddedObjectData + attr.Value); break; case "externalLink": strBldr.SetStrPropValue((int)FwTextPropType.ktptObjData, (char)FwObjDataTypes.kodtExternalPathName + attr.Value); break; case "firstIndent": strBldr.SetIntPropValues((int)FwTextPropType.ktptFirstIndent, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, true)); break; case "fontFamily": strBldr.SetStrPropValue((int)FwTextPropType.ktptFontFamily, attr.Value); break; case "fontsize": AddSizePropertyToBldr(strBldr, attr.Value, (int)FwTextPropType.ktptFontSize, xml.Attribute("fontsizeUnit"), null); break; case "fontsizeUnit": break; // Ignore. Its handled in the fontsize. case "fontVariations": strBldr.SetStrPropValue((int)FwTextPropType.ktptFontVariations, attr.Value); break; case "forecolor": strBldr.SetIntPropValues((int)FwTextPropType.ktptForeColor, 0, GetColorValueForStr(attr.Value)); break; case "italic": strBldr.SetIntPropValues((int)FwTextPropType.ktptItalic, (int)FwTextPropVar.ktpvEnum, GetToggleValueForStr(attr.Value)); break; case "keepTogether": strBldr.SetIntPropValues((int)FwTextPropType.ktptKeepTogether, (int)FwTextPropVar.ktpvEnum, GetIntValueFromStr(attr.Value, false)); break; case "keepWithNext": strBldr.SetIntPropValues((int)FwTextPropType.ktptKeepWithNext, (int)FwTextPropVar.ktpvEnum, GetIntValueFromStr(attr.Value, false)); break; case "leadingIndent": strBldr.SetIntPropValues((int)FwTextPropType.ktptLeadingIndent, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "lineHeight": AddSizePropertyToBldr(strBldr, attr.Value, (int)FwTextPropType.ktptLineHeight, xml.Attribute("lineHeightUnit"), xml.Attribute("lineHeightType")); break; case "lineHeightType": break; // Ignore. Its handled in the lineHeight case "lineHeightUnit": break; // Ignore. Its handled in the lineHeight case "link": AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtNameGuidHot); isOrcNeeded = true; break; case "marginBottom": strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginBottom, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "marginLeading": strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginLeading, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "marginTop": strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginTop, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "marginTrailing": strBldr.SetIntPropValues((int)FwTextPropType.ktptMarginTrailing, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "moveableObj": AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtGuidMoveableObjDisp); isOrcNeeded = true; break; case "namedStyle": strBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, attr.Value); break; case "offset": AddSizePropertyToBldr(strBldr, attr.Value, (int)FwTextPropType.ktptOffset, xml.Attribute("offsetUnit"), null); break; case "offsetUnit": break; // Ignore. Its handled in the offset case "ownlink": AddObjDataToBldr(strBldr, attr, FwObjDataTypes.kodtOwnNameGuidHot); isOrcNeeded = true; break; case "padBottom": strBldr.SetIntPropValues((int)FwTextPropType.ktptPadBottom, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "padLeading": strBldr.SetIntPropValues((int)FwTextPropType.ktptPadLeading, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "padTop": strBldr.SetIntPropValues((int)FwTextPropType.ktptPadTop, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "padTrailing": strBldr.SetIntPropValues((int)FwTextPropType.ktptPadTrailing, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "paracolor": strBldr.SetIntPropValues((int)FwTextPropType.ktptParaColor, 0, GetColorValueForStr(attr.Value)); break; case "paraStyle": Debug.Fail("We don't support the old paraStyle attribute!"); break; case "rightToLeft": strBldr.SetIntPropValues((int)FwTextPropType.ktptRightToLeft, (int)FwTextPropVar.ktpvEnum, GetIntValueFromStr(attr.Value, false)); break; case "spaceAfter": strBldr.SetIntPropValues((int)FwTextPropType.ktptSpaceAfter, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, true)); break; case "spaceBefore": strBldr.SetIntPropValues((int)FwTextPropType.ktptSpaceBefore, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, true)); break; case "spellcheck": strBldr.SetIntPropValues((int)FwTextPropType.ktptSpellCheck, (int)FwTextPropVar.ktpvEnum, GetSpellCheckValueForStr(attr.Value)); break; case "superscript": strBldr.SetIntPropValues((int)FwTextPropType.ktptSuperscript, (int)FwTextPropVar.ktpvEnum, GetSuperscriptValueForStr(attr.Value)); break; case "tabDef": Debug.Fail("We don't support the tabDef property!"); break; case "tabList": Debug.Fail("We don't support the tabList property!"); break; case "tags": strBldr.SetStrPropValue((int)FwTextPropType.ktptTags, GetGuidValuesForStr(attr.Value)); break; case "trailingIndent": strBldr.SetIntPropValues((int)FwTextPropType.ktptTrailingIndent, (int)FwTextPropVar.ktpvMilliPoint, GetIntValueFromStr(attr.Value, false)); break; case "type": Debug.Assert(attr.Value == "chars", "Embedded pictures are not supported!"); break; case "undercolor": strBldr.SetIntPropValues((int)FwTextPropType.ktptUnderColor, 0, GetColorValueForStr(attr.Value)); break; case "underline": strBldr.SetIntPropValues((int)FwTextPropType.ktptUnderline, (int)FwTextPropVar.ktpvEnum, GetUnderlineTypeForStr(attr.Value)); break; case "widowOrphan": strBldr.SetIntPropValues((int)FwTextPropType.ktptWidowOrphanControl, (int)FwTextPropVar.ktpvEnum, GetIntValueFromStr(attr.Value, false)); break; case "ws": strBldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0, TsStringSerializer.GetWsForId(attr.Value, lgwsf)); break; case "wsBase": strBldr.SetIntPropValues((int)FwTextPropType.ktptBaseWs, 0, TsStringSerializer.GetWsForId(attr.Value, lgwsf)); break; case "wsStyle": Debug.Fail("We don't support the old wsStyle attribute!"); break; case "space": case "editable": break; default: throw new XmlSchemaException("Unknown Prop attribute: " + attr.Name.LocalName); } } return isOrcNeeded; }
/// <summary> /// Sets the specified property to the specified string value. /// </summary> public static void SetStringValue(this ITsIncStrBldr tisb, FwTextPropType tpt, string value) { tisb.SetStrPropValue((int)tpt, value); }