public void MoreWritingSystemLists() { ILgWritingSystemFactory factWs = Cache.ServiceLocator.GetInstance <ILgWritingSystemFactory>(); char[] rgchSplit = new char[] { ' ' }; string sVern = factWs.GetStrFromWs(Cache.DefaultVernWs); Assert.IsTrue(Cache.LangProject.CurVernWss.Contains(sVern)); Assert.IsTrue(Cache.LangProject.VernWss.Contains(sVern)); Set <string> setVern = new Set <string>(); setVern.AddRange(Cache.LangProject.VernWss.Split(rgchSplit)); Assert.Less(0, setVern.Count, "should be at least one Vernacular WS"); Set <string> setCurVern = new Set <string>(); setCurVern.AddRange(Cache.LangProject.CurVernWss.Split(rgchSplit)); Assert.Less(0, setCurVern.Count, "should be at least one Current Vernacular WS"); Assert.LessOrEqual(setCurVern.Count, setVern.Count, "at least as many Current Vernacular as Vernacular"); foreach (string x in setCurVern) { Assert.IsTrue(setVern.Contains(x), "Vernacular contains everything in Current Vernacular"); int ws = factWs.GetWsFromStr(x); Assert.AreNotEqual(0, ws, "factory should contain everything in Current Vernacular"); } foreach (string x in setVern) { int ws = factWs.GetWsFromStr(x); Assert.AreNotEqual(0, ws, "factory should contain everything in Vernacular"); } string sAnal = factWs.GetStrFromWs(Cache.DefaultAnalWs); Assert.IsTrue(Cache.LangProject.CurAnalysisWss.Contains(sAnal)); Assert.IsTrue(Cache.LangProject.AnalysisWss.Contains(sAnal)); Set <string> setAnal = new Set <string>(); setAnal.AddRange(Cache.LangProject.AnalysisWss.Split(rgchSplit)); Assert.Less(0, setAnal.Count, "should be at least one Analysis WS"); Set <string> setCurAnal = new Set <string>(); setCurAnal.AddRange(Cache.LangProject.CurAnalysisWss.Split(rgchSplit)); Assert.Less(0, setCurAnal.Count, "should be at least one Current Analysis WS"); Assert.LessOrEqual(setCurAnal.Count, setAnal.Count, "at least as many Current Analysis as Analysis"); foreach (string x in setCurAnal) { Assert.IsTrue(setAnal.Contains(x), "Analysis contains everything in Current Analysis"); int ws = factWs.GetWsFromStr(x); Assert.AreNotEqual(0, ws, "factory should contain everything in Current Analysis"); } foreach (string x in setAnal) { int ws = factWs.GetWsFromStr(x); Assert.AreNotEqual(0, ws, "factory should contain everything in Analysis"); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlScrAnnotationsList"/> class based on /// the given collection of Scripture notes. /// </summary> /// <param name="cache">The cache.</param> /// ------------------------------------------------------------------------------------ public XmlScrAnnotationsList(FdoCache cache) { m_cache = cache; m_lgwsf = m_cache.LanguageWritingSystemFactoryAccessor; VernacularIcuLocale = m_lgwsf.GetStrFromWs(m_cache.DefaultVernWs); DefaultIcuLocale = m_lgwsf.GetStrFromWs(m_cache.DefaultAnalWs); DateTimeExported = DateTime.Now; ProjectName = m_cache.ProjectId.Name; using (WindowsIdentity whoami = WindowsIdentity.GetCurrent()) ExportedBy = whoami.Name.Normalize(); }
/// <summary> /// Gets the character render properties for the given style name and writing system. /// </summary> /// <param name="styleName">The style name.</param> /// <param name="styleSheet">The stylesheet.</param> /// <param name="hvoWs">The HVO of the WS.</param> /// <param name="writingSystemFactory">The writing system factory.</param> /// <returns>The character render properties.</returns> public static LgCharRenderProps GetChrpForStyle(string styleName, IVwStylesheet styleSheet, int hvoWs, ILgWritingSystemFactory writingSystemFactory) { if (string.IsNullOrEmpty(writingSystemFactory.GetStrFromWs(hvoWs))) { try { throw new ArgumentException("This is a hard-to-reproduce scenario (TE-6891) where writing system (" + hvoWs + ") and factory are inconsistent. Call an expert (JohnT)"); } catch (ArgumentException e) { Logger.WriteError(e); Debug.Fail("This is a hard-to-reproduce scenario (TE-6891) where writing system and factory are inconsistent. Call an expert (JohnT) while you have this Assert active!"); hvoWs = writingSystemFactory.UserWs; } } IVwPropertyStore vwps = VwPropertyStoreClass.Create(); vwps.Stylesheet = styleSheet; vwps.WritingSystemFactory = writingSystemFactory; ITsPropsBldr ttpBldr = TsPropsBldrClass.Create(); ttpBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, styleName); ttpBldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0, hvoWs); ITsTextProps ttp = ttpBldr.GetTextProps(); LgCharRenderProps chrps = vwps.get_ChrpFor(ttp); IWritingSystem ws = writingSystemFactory.get_EngineOrNull(hvoWs); ws.InterpretChrp(ref chrps); return(chrps); }
public static LfMultiText FromMultiITsString(ITsMultiString value, ILgWritingSystemFactory wsManager) { if (value == null || value.StringCount == 0) { return(null); } LfMultiText mt = new LfMultiText(); for (int index = 0; index < value.StringCount; index++) { int wsId; ITsString tss = value.GetStringFromIndex(index, out wsId); string wsStr = wsManager.GetStrFromWs(wsId); if (!string.IsNullOrEmpty(wsStr)) { string valueStr = LfMerge.Core.DataConverters.ConvertLcmToMongoTsStrings.TextFromTsString(tss, wsManager); LfStringField field = LfStringField.FromString(valueStr); if (field != null) { mt.Add(wsStr, field); } } //MainClass.Logger.Warning("Adding multistring ws: {0}, str {1}", wsStr, valueStr); } return(mt); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlNotePara"/> class based on the given /// StTxtPara. /// </summary> /// <param name="stTxtPara">The FDO paragraph.</param> /// <param name="wsDefault">The default (analysis) writing system.</param> /// <param name="lgwsf">The writing system factory.</param> /// ------------------------------------------------------------------------------------ public XmlNotePara(IStTxtPara stTxtPara, int wsDefault, ILgWritingSystemFactory lgwsf) { // REVIEW: Ask TomB about this. The only paragraph style allowed in // TE for notes is "Remark" so is it necessary to write it to the XML? // It causes a problem for the OXES validator. //StyleName = stTxtPara.StyleName; ITsString tssParaContents = stTxtPara.Contents; if (tssParaContents.RunCount == 0) { return; } int dummy; int wsFirstRun = tssParaContents.get_Properties(0).GetIntPropValues( (int)FwTextPropType.ktptWs, out dummy); //if (wsFirstRun != wsDefault) IcuLocale = lgwsf.GetStrFromWs(wsFirstRun); for (int iRun = 0; iRun < tssParaContents.RunCount; iRun++) { ITsTextProps props = tssParaContents.get_Properties(iRun); string text = tssParaContents.get_RunText(iRun); if (TsStringUtils.IsHyperlink(props)) { Runs.Add(new XmlHyperlinkRun(wsFirstRun, lgwsf, text, props)); } else { Runs.Add(new XmlTextRun(wsFirstRun, lgwsf, text, props)); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ private void UpdateLanguageCombos() { ILgWritingSystemFactory wsf = LgWritingSystemFactoryClass.Create(); string userLocale = wsf.GetStrFromWs(wsf.UserWs); // Get the set of writing systems. Set <NamedWritingSystem> writingSystems = LangProject.GetAllNamedWritingSystemsFromLDFs(wsf, userLocale); NamedWritingSystem wsSaveVern = (NamedWritingSystem)m_cbVernWrtSys.SelectedItem; NamedWritingSystem wsSaveAnal = (NamedWritingSystem)m_cbAnalWrtSys.SelectedItem; m_cbAnalWrtSys.Items.Clear(); m_cbVernWrtSys.Items.Clear(); m_cbAnalWrtSys.BeginUpdate(); m_cbVernWrtSys.BeginUpdate(); foreach (NamedWritingSystem nws in writingSystems) { m_cbAnalWrtSys.Items.Add(nws); m_cbVernWrtSys.Items.Add(nws); } int i = (wsSaveVern == null ? 0 : m_cbVernWrtSys.FindString(wsSaveVern.Name)); m_cbVernWrtSys.SelectedIndex = (i >= 0 ? i : 0); m_cbVernWrtSys.EndUpdate(); i = (wsSaveAnal == null ? 0 : m_cbAnalWrtSys.FindString(wsSaveAnal.Name)); m_cbAnalWrtSys.SelectedIndex = (i >= 0 ? i : 0); m_cbAnalWrtSys.EndUpdate(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlTextRun"/> class, based on the given /// run information /// </summary> /// <param name="wsDefault">The default writing system of the paragraph.</param> /// <param name="lgwsf">The writing system factory.</param> /// <param name="text">The text of the run.</param> /// <param name="props">The properties of the run.</param> /// ------------------------------------------------------------------------------------ public XmlTextRun(int wsDefault, ILgWritingSystemFactory lgwsf, string text, ITsTextProps props) { int dummy; int wsRun = props.GetIntPropValues((int)FwTextPropType.ktptWs, out dummy); if (wsRun != wsDefault) { IcuLocale = lgwsf.GetStrFromWs(wsRun); } StyleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle); m_text = text; }
public string Persist(ILgWritingSystemFactory wsf) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetType().Name); foreach (InterlinLineSpec spec in m_specs) { builder.Append(","); builder.Append(spec.Flid); builder.Append("%"); builder.Append(wsf.GetStrFromWs(spec.WritingSystem)); } return(builder.ToString()); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlKeyWord"/> class, based on the given /// run information /// </summary> /// ------------------------------------------------------------------------------------ public XmlKeyWord(IChkTerm term) { ITsString origLangTerm = term.OccurrencesOS.First().KeyWord; Debug.Assert(origLangTerm.RunCount == 1); int ws = origLangTerm.get_WritingSystem(0); string icuLocale; if (!s_mapWsToIcuLocale.TryGetValue(ws, out icuLocale)) { ILgWritingSystemFactory lgwsf = term.Cache.LanguageWritingSystemFactoryAccessor; s_mapWsToIcuLocale[ws] = icuLocale = lgwsf.GetStrFromWs(ws); } IcuLocale = icuLocale; Text = origLangTerm.Text; }
public static LfMultiText FromLcmMultiString(IMultiAccessorBase other, ILgWritingSystemFactory wsManager) { LfMultiText newInstance = new LfMultiText(); foreach (int wsid in other.AvailableWritingSystemIds) { string wsstr = wsManager.GetStrFromWs(wsid); ITsString value = other.get_String(wsid); string text = LfMerge.Core.DataConverters.ConvertLcmToMongoTsStrings.TextFromTsString(value, wsManager); LfStringField field = LfStringField.FromString(text); if (field != null) { newInstance.Add(wsstr, field); } } return(newInstance); }
public static LfMultiText FromSingleITsString(ITsString value, ILgWritingSystemFactory wsManager) { if (value == null || value.Text == null) { return(null); } int wsId = value.get_WritingSystem(0); string wsStr = wsManager.GetStrFromWs(wsId); string text = LfMerge.Core.DataConverters.ConvertLcmToMongoTsStrings.TextFromTsString(value, wsManager); LfStringField field = LfStringField.FromString(text); if (field == null) { return(null); } return(new LfMultiText { { wsStr, field } }); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes categories in the hierarchy. /// </summary> /// <param name="categoryList">The list of categories for a Scripture note.</param> /// <param name="lgwsf">The language writing system factory.</param> /// <exception cref="ArgumentOutOfRangeException">thrown when the category list is empty. /// </exception> /// ------------------------------------------------------------------------------------ private void InitializeCategory(List <CategoryNode> categoryList, ILgWritingSystemFactory lgwsf) { XmlNoteCategory curCategory = this; CategoryNode node = null; for (int i = 0; i < categoryList.Count; i++) { node = categoryList[i]; curCategory.CategoryName = node.CategoryName; curCategory.IcuLocale = lgwsf.GetStrFromWs(node.Ws); if (categoryList.Count > i + 1) { curCategory.SubCategory = new XmlNoteCategory(); curCategory = curCategory.SubCategory; } else { curCategory.SubCategory = null; } } }
/// <summary> /// LT-11603 was traced in part to calls to Dictionary.Exists which never return, possibly because /// the OS has become confused and thinks the file is locked. To guard against this we run the test in a background /// thread with a timeout. Not sure whether this is enough protection, other calls may be at risk also, but if /// we can confirm the dictionary exists at least it isn't spuriously locked when we first consider it. /// </summary> private static bool DictionaryExists(string wsId, int ws, ILgWritingSystemFactory wsf) { bool result; if (s_existingDictionaries.TryGetValue(wsId, out result)) { return(result); } if (!ValidEnchantId(wsId)) { var wsName = wsf.GetStrFromWs(ws); var form = Form.ActiveForm; var msg = string.Format(FwUtilsStrings.kstidInvalidDictId, wsName, wsId); MessageBox.Show(form, msg, FwUtilsStrings.kstidCantDoDictExistsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } var tester = new ExistsTester() { WsId = wsId }; var newThread = new Thread(tester.Test); newThread.Start(); if (newThread.Join(4000)) { result = tester.Result; } else { result = false; var form = Form.ActiveForm; MessageBox.Show(form, String.Format(FwUtilsStrings.kstIdCantDoDictExists, wsId), FwUtilsStrings.kstidCantDoDictExistsCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning); } s_existingDictionaries[wsId] = result; return(result); }
/// <summary> /// Gets the character render properties for the given style name and writing system. /// </summary> /// <param name="styleName">The style name.</param> /// <param name="styleSheet">The stylesheet.</param> /// <param name="hvoWs">The HVO of the WS.</param> /// <param name="writingSystemFactory">The writing system factory.</param> /// <returns>The character render properties.</returns> public static LgCharRenderProps GetChrpForStyle(string styleName, IVwStylesheet styleSheet, int hvoWs, ILgWritingSystemFactory writingSystemFactory) { if (string.IsNullOrEmpty(writingSystemFactory.GetStrFromWs(hvoWs))) { try { //You may have forgotten to set the WritingSystemFactory in a recently added custom control? throw new ArgumentException("This is a hard-to-reproduce scenario (TE-6891) where writing system (" + hvoWs + ") and factory are inconsistent."); } catch (ArgumentException e) { Logger.WriteError(e); var msg = e.Message + " If we aren't called from a Widget, " + "call an expert (JohnT) while you have this Assert active!"; Debug.Fail(msg); hvoWs = writingSystemFactory.UserWs; } } IVwPropertyStore vwps = VwPropertyStoreClass.Create(); vwps.Stylesheet = styleSheet; vwps.WritingSystemFactory = writingSystemFactory; ITsPropsBldr ttpBldr = TsStringUtils.MakePropsBldr(); ttpBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, styleName); ttpBldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0, hvoWs); ITsTextProps ttp = ttpBldr.GetTextProps(); LgCharRenderProps chrps = vwps.get_ChrpFor(ttp); ILgWritingSystem ws = writingSystemFactory.get_EngineOrNull(hvoWs); ws.InterpretChrp(ref chrps); return(chrps); }
/// <summary> /// Write the integer text property as an XML attribute. /// </summary> /// <param name="writer"></param> /// <param name="wsf"></param> /// <param name="tpt"></param> /// <param name="nVar"></param> /// <param name="nVal"></param> public void WriteIntTextProp(TextWriter writer, ILgWritingSystemFactory wsf, int tpt, int nVar, int nVal) { Debug.Assert(writer != null); Debug.Assert(wsf != null); switch (tpt) { case (int)FwTextPropType.ktptBackColor: writer.Write(" backcolor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptBold: writer.Write(" bold=\"{0}\"", ToggleValueName((byte)nVal)); break; case (int)FwTextPropType.ktptWs: if (nVal != 0) { string sWs = wsf.GetStrFromWs(nVal); if (String.IsNullOrEmpty(sWs)) { throw new Exception("Invalid writing system for <Run ws=\"...\">."); } writer.Write(" ws=\"{0}\"", XmlUtils.MakeSafeXmlAttribute(sWs)); } break; case (int)FwTextPropType.ktptBaseWs: if (nVal != 0) { string sWs = wsf.GetStrFromWs(nVal); if (String.IsNullOrEmpty(sWs)) { throw new Exception("Invalid writing system for <Run wsBase=\"...\">."); } writer.Write(" wsBase=\"{0}\"", XmlUtils.MakeSafeXmlAttribute(sWs)); } break; case (int)FwTextPropType.ktptFontSize: writer.Write(" fontsize=\"{0}\"", nVal); if (nVar != (int)FwTextPropVar.ktpvDefault) { writer.Write(" fontsizeUnit=\"{0}\"", PropVarName(nVar)); } break; case (int)FwTextPropType.ktptForeColor: writer.Write(" forecolor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptItalic: writer.Write(" italic=\"{0}\"", ToggleValueName((byte)nVal)); break; case (int)FwTextPropType.ktptOffset: writer.Write(" offset=\"{0}\"", nVal); writer.Write(" offsetUnit=\"{0}\"", PropVarName(nVar)); break; case (int)FwTextPropType.ktptSuperscript: writer.Write(" superscript=\"{0}\"", SuperscriptValName((byte)nVal)); break; case (int)FwTextPropType.ktptUnderColor: writer.Write(" undercolor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptUnderline: writer.Write(" underline=\"{0}\"", UnderlineTypeName((byte)nVal)); break; case (int)FwTextPropType.ktptSpellCheck: writer.Write(" spellcheck=\"{0}\"", SpellingModeName((byte)nVal)); break; // Paragraph level properties. case (int)FwTextPropType.ktptAlign: writer.Write(" align=\"{0}\"", AlignmentTypeName((byte)nVal)); break; case (int)FwTextPropType.ktptFirstIndent: writer.Write(" firstIndent=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptLeadingIndent: writer.Write(" leadingIndent=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptTrailingIndent: writer.Write(" trailingIndent=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptSpaceBefore: writer.Write(" spaceBefore=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptSpaceAfter: writer.Write(" spaceAfter=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptTabDef: writer.Write(" tabDef=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptLineHeight: writer.Write(" lineHeight=\"{0}\"", Math.Abs(nVal)); writer.Write(" lineHeightUnit=\"{0}\"", PropVarName(nVar)); Debug.Assert(nVal >= 0 || nVar == (int)FwTextPropVar.ktpvMilliPoint); if (nVar == (int)FwTextPropVar.ktpvMilliPoint) { // negative means "exact" internally. See FWC-20. writer.Write(" lineHeightType=\"{0}\"", nVal < 0 ? "exact" : "atLeast"); } break; case (int)FwTextPropType.ktptParaColor: writer.Write(" paracolor=\"{0}\"", ColorName(nVal)); break; // Properties from the views subsystem: case (int)FwTextPropType.ktptRightToLeft: writer.Write(" rightToLeft=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadLeading: writer.Write(" padLeading=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadTrailing: writer.Write(" padTrailing=\"{0}\"", nVal); break; // Not the other margins: they are duplicated by FirstIndent etc. case (int)FwTextPropType.ktptMarginTop: writer.Write(" MarginTop=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadTop: writer.Write(" padTop=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadBottom: writer.Write(" padBottom=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderTop: writer.Write(" borderTop=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderBottom: writer.Write(" borderBottom=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderLeading: writer.Write(" borderLeading=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderTrailing: writer.Write(" borderTrailing=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderColor: writer.Write(" borderColor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptBulNumScheme: writer.Write(" bulNumScheme=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBulNumStartAt: writer.Write(" bulNumStartAt=\"{0}\"", nVal == Int32.MinValue ? 0 : nVal); break; case (int)FwTextPropType.ktptDirectionDepth: writer.Write(" directionDepth=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptKeepWithNext: writer.Write(" keepWithNext=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptKeepTogether: writer.Write(" keepTogether=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptHyphenate: writer.Write(" hyphenate=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptWidowOrphanControl: writer.Write(" widowOrphan=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptMaxLines: writer.Write(" maxLines=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptCellBorderWidth: writer.Write(" cellBorderWidth=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptCellSpacing: writer.Write(" cellSpacing=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptCellPadding: writer.Write(" cellPadding=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptEditable: writer.Write(" editable=\"{0}\"", EditableName(nVal)); break; case (int)FwTextPropType.ktptSetRowDefaults: writer.Write(" setRowDefaults=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptRelLineHeight: writer.Write(" relLineHeight=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptTableRule: // Ignore this view-only property. break; default: break; } }
public static string TextFromTsString(ITsString tss, ILgWritingSystemFactory wsf) { // This will replace SafeTsStringText, and will actually deal with <span> elements // Spec: the TsString properties ktptWs (an int property) and ktptNamedStyle (a string property) // will be replaced with lang="(wsStr)" and class="styleName_PropValue". Other properties, that // LF doesn't process, will be preserved in the class attribute as well, as follows: // // 1) Determine whether the property is an int property or a string property. // 2) Call either IntPropertyName() or StringPropertyName() to get its name. // 3) Create a class string in format "propC_N_NAME_VALUE" where: // - C is "i" for int props or "s" for string props // - N is the property number // - NAME is, of course, the property name // - VALUE is the property's value, with two special cases: // * in string properties, spaces are first replaced by "_SPACE_" // * in int properties, there's a value and a "variation", and VALUE is both of them separated by _ // // Result: class="propi_1_ktptWs_1_0 props_1_ktptFontFamily_Times_SPACE_New_SPACE_Roman" if (tss == null) return null; int[] intPropsToSkip = new int[] { (int)FwTextPropType.ktptWs }; int[] strPropsToSkip = new int[] { (int)FwTextPropType.ktptNamedStyle }; int mainWs = tss.get_WritingSystem(0); var resultBuilder = new StringBuilder(); foreach (TsRunPart run in tss.Runs()) { string runText = run.Text; ITsTextProps props = run.Props; int ws = props.GetWs(); string namedStyle = props.Style(); List<string> classes = ClassesFromTsTextProps(props, intPropsToSkip, strPropsToSkip); bool needSpan = false; string langAttr = null; string classAttr = null; if (ws != mainWs) { needSpan = true; langAttr = String.Format(" lang=\"{0}\"", wsf.GetStrFromWs(ws)); } if (namedStyle != null) { needSpan = true; classes.Insert(0, String.Format("styleName_{0}", namedStyle.Replace(" ", "_SPACE_"))); } if (classes.Count > 0) { needSpan = true; classAttr = String.Format(" class=\"{0}\"", String.Join(" ", classes)); } if (needSpan) { var spanBuilder = new StringBuilder(); spanBuilder.Append("<span"); if (langAttr != null) spanBuilder.Append(langAttr); if (classAttr != null) spanBuilder.Append(classAttr); spanBuilder.Append(">"); spanBuilder.Append(runText); spanBuilder.Append("</span>"); resultBuilder.Append(spanBuilder.ToString()); } else resultBuilder.Append(runText); } return resultBuilder.ToString(); }
protected void LoadKeyTerms(IProgress dlg, ICmPossibilityList oldKtPossList, ICmPossibilityList biblicalTermsPossList, BiblicalTermsList list, List <BiblicalTermsLocalization> localizations) { FdoCache cache = biblicalTermsPossList.Cache; Debug.Assert(cache != null); EnsureGreekAndHebrewWsExist(); m_wsDefault = m_servLoc.WritingSystemManager.GetWsFromStr("en"); Dictionary <string, ICmPossibility> categories = new Dictionary <string, ICmPossibility>(5); List <Term> terms = list.KeyTerms; string message = null; if (dlg != null) { dlg.Position = 0; dlg.Minimum = 0; dlg.Maximum = terms.Count + ((oldKtPossList != null) ? oldKtPossList.PossibilitiesOS.Count : 0); dlg.Title = TeResourceHelper.GetResourceString("kstidLoadKeyTermsInDBCaption"); message = TeResourceHelper.GetResourceString("kstidLoadKeyTermsInDBStatus"); } // TODO (TE-2901): Load any existing categories into the hashtable (needed when upgrading) //foreach (biblicalTerms.PossibilitiesOS // Load all of the keyterms foreach (Term term in terms) { // Update dialog message. if (dlg != null) { dlg.Message = string.Format(message, term.Gloss); } ICmPossibility cat; if (!categories.TryGetValue(term.Category, out cat)) { cat = m_servLoc.GetInstance <ICmPossibilityFactory>().Create(); biblicalTermsPossList.PossibilitiesOS.Add(cat); cat.Abbreviation.set_String(m_wsDefault, term.Category); foreach (BiblicalTermsLocalization loc in localizations) { string name = loc.GetCategoryName(term.Category); if (name != null) { cat.Name.set_String(loc.WritingSystemHvo, name); } } categories.Add(term.Category, cat); } AddTerm(cat, term, localizations); if (dlg != null) { dlg.Step(1); } } if (oldKtPossList != null) { if (dlg != null) { dlg.Message = TeResourceHelper.GetResourceString("kstidMigratingKeyTermReferences"); } if (categories.ContainsKey("KT")) { CopyRenderingsFromOldCheckRefs(categories["KT"], oldKtPossList.PossibilitiesOS, dlg); } } // Finally, update biblical terms list version (and versions of localizations) // in the database. SetNewResourceVersion(GetVersion(list)); foreach (BiblicalTermsLocalization localization in localizations) { SetNewResourceVersion(GetLocalizationResourceName(m_wsf.GetStrFromWs(localization.WritingSystemHvo)), localization.Version); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes categories in the hierarchy. /// </summary> /// <param name="categoryList">The list of categories for a Scripture note.</param> /// <param name="lgwsf">The language writing system factory.</param> /// <exception cref="ArgumentOutOfRangeException">thrown when the category list is empty. /// </exception> /// ------------------------------------------------------------------------------------ private void InitializeCategory(List<CategoryNode> categoryList, ILgWritingSystemFactory lgwsf) { XmlNoteCategory curCategory = this; CategoryNode node = null; for (int i = 0; i < categoryList.Count; i++) { node = categoryList[i]; curCategory.CategoryName = node.CategoryName; curCategory.IcuLocale = lgwsf.GetStrFromWs(node.Ws); if (categoryList.Count > i + 1) { curCategory.SubCategory = new XmlNoteCategory(); curCategory = curCategory.SubCategory; } else { curCategory.SubCategory = null; } } }
public string Persist(ILgWritingSystemFactory wsf) { StringBuilder builder = new StringBuilder(); builder.Append(this.GetType().Name); foreach (InterlinLineSpec spec in m_specs) { builder.Append(","); builder.Append(spec.Flid); builder.Append("%"); builder.Append(wsf.GetStrFromWs(spec.WritingSystem)); } return builder.ToString(); }
/// <summary> /// Gets the character render properties for the given style name and writing system. /// </summary> /// <param name="styleName">The style name.</param> /// <param name="styleSheet">The stylesheet.</param> /// <param name="hvoWs">The HVO of the WS.</param> /// <param name="writingSystemFactory">The writing system factory.</param> /// <returns>The character render properties.</returns> public static LgCharRenderProps GetChrpForStyle(string styleName, IVwStylesheet styleSheet, int hvoWs, ILgWritingSystemFactory writingSystemFactory) { if (string.IsNullOrEmpty(writingSystemFactory.GetStrFromWs(hvoWs))) { try { throw new ArgumentException("This is a hard-to-reproduce scenario (TE-6891) where writing system (" + hvoWs + ") and factory are inconsistent. Call an expert (JohnT)"); } catch (ArgumentException e) { Logger.WriteError(e); Debug.Fail("This is a hard-to-reproduce scenario (TE-6891) where writing system and factory are inconsistent. Call an expert (JohnT) while you have this Assert active!"); hvoWs = writingSystemFactory.UserWs; } } IVwPropertyStore vwps = VwPropertyStoreClass.Create(); vwps.Stylesheet = styleSheet; vwps.WritingSystemFactory = writingSystemFactory; ITsPropsBldr ttpBldr = TsPropsBldrClass.Create(); ttpBldr.SetStrPropValue((int)FwTextPropType.ktptNamedStyle, styleName); ttpBldr.SetIntPropValues((int)FwTextPropType.ktptWs, 0, hvoWs); ITsTextProps ttp = ttpBldr.GetTextProps(); LgCharRenderProps chrps = vwps.get_ChrpFor(ttp); IWritingSystem ws = writingSystemFactory.get_EngineOrNull(hvoWs); ws.InterpretChrp(ref chrps); return chrps; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlNotePara"/> class based on the given /// StTxtPara. /// </summary> /// <param name="stTxtPara">The FDO paragraph.</param> /// <param name="wsDefault">The default (analysis) writing system.</param> /// <param name="lgwsf">The writing system factory.</param> /// ------------------------------------------------------------------------------------ public XmlNotePara(IStTxtPara stTxtPara, int wsDefault, ILgWritingSystemFactory lgwsf) { // REVIEW: Ask TomB about this. The only paragraph style allowed in // TE for notes is "Remark" so is it necessary to write it to the XML? // It causes a problem for the OXES validator. //StyleName = stTxtPara.StyleName; ITsString tssParaContents = stTxtPara.Contents.UnderlyingTsString; if (tssParaContents.RunCount == 0) return; int dummy; int wsFirstRun = tssParaContents.get_Properties(0).GetIntPropValues( (int)FwTextPropType.ktptWs, out dummy); //if (wsFirstRun != wsDefault) IcuLocale = lgwsf.GetStrFromWs(wsFirstRun); for (int iRun = 0; iRun < tssParaContents.RunCount; iRun++) { ITsTextProps props = tssParaContents.get_Properties(iRun); string text = tssParaContents.get_RunText(iRun); if (StringUtils.IsHyperlink(props)) Runs.Add(new XmlHyperlinkRun(wsFirstRun, lgwsf, text, props)); else Runs.Add(new XmlTextRun(wsFirstRun, lgwsf, text, props)); } }
/// <summary> /// Serializes the <see cref="ITsString"/> to XML. /// </summary> public static string SerializeTsStringToXml(ITsString tss, ILgWritingSystemFactory lgwsf, int ws = 0, bool writeObjData = true, bool indent = false) { // We export only the NFSC form (NFC with exceptions for the parallel style information) ITsString normalizedTss = tss.get_NormalizedForm(FwNormalizationMode.knmNFSC); var xml = new StringBuilder(); var settings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true, IndentChars = indent ? " " : string.Empty, NewLineChars = Environment.NewLine }; using (var writer = XmlWriter.Create(xml, settings)) { if (ws > 0) { string id = lgwsf.GetStrFromWs(ws); writer.WriteStartElement("AStr"); writer.WriteAttributeString("ws", Icu.Normalize(id, Icu.UNormalizationMode.UNORM_NFC)); } else { writer.WriteStartElement("Str"); } // Write the properties and text for each run string fieldName = null; for (int i = 0; i < normalizedTss.RunCount; i++) { TsRunInfo tri; ITsTextProps textProps = normalizedTss.FetchRunInfo(i, out tri); string objDataStr; if (textProps.TryGetStringValue(FwTextPropType.ktptObjData, out objDataStr) && !writeObjData) { var chType = (FwObjDataTypes)objDataStr[0]; if (chType == FwObjDataTypes.kodtPictEvenHot || chType == FwObjDataTypes.kodtPictOddHot || chType == FwObjDataTypes.kodtNameGuidHot || chType == FwObjDataTypes.kodtOwnNameGuidHot) { continue; } } string runFieldName; if (textProps.TryGetStringValue(FwTextPropType.ktptFieldName, out runFieldName) && fieldName != runFieldName) { if (!string.IsNullOrEmpty(fieldName)) { writer.WriteEndElement(); } if (!string.IsNullOrEmpty(runFieldName)) { writer.WriteStartElement("Field"); writer.WriteAttributeString("name", runFieldName); } fieldName = runFieldName; } bool markItem; FwTextPropVar var; int markItemValue; if (textProps.TryGetIntValue(FwTextPropType.ktptMarkItem, out var, out markItemValue) && var == FwTextPropVar.ktpvEnum && markItemValue == (int)FwTextToggleVal.kttvForceOn) { writer.WriteStartElement("Item"); writer.WriteStartElement("Run"); markItem = true; } else { writer.WriteStartElement("Run"); markItem = false; } for (int j = 0; j < textProps.IntPropCount; j++) { FwTextPropType tpt; int value = textProps.GetIntProperty(j, out tpt, out var); if (tpt != FwTextPropType.ktptMarkItem) { TsPropsSerializer.WriteIntProperty(writer, lgwsf, tpt, var, value); } } byte[] pict = null; bool hotGuid = false; for (int j = 0; j < textProps.StrPropCount; j++) { FwTextPropType tpt; string value = textProps.GetStringProperty(j, out tpt); TsPropsSerializer.WriteStringProperty(writer, tpt, value); if (tpt == FwTextPropType.ktptObjData && !string.IsNullOrEmpty(value)) { switch ((FwObjDataTypes)value[0]) { // The element data associated with a picture is the actual picture data // since it is much too large to want embedded as an XML attribute value. // (This is an antique kludge that isn't really used in practice, but some // of our test data still exercises it.) case FwObjDataTypes.kodtPictEvenHot: case FwObjDataTypes.kodtPictOddHot: pict = Encoding.Unicode.GetBytes(value.Substring(1)); break; // The generated XML contains both the link value as an attribute and the // (possibly edited) display string as the run's element data. case FwObjDataTypes.kodtExternalPathName: break; // used ONLY in the clipboard...contains XML representation of (currently) a footnote. case FwObjDataTypes.kodtEmbeddedObjectData: break; // The string data associated with this run is assumed to be a dummy magic // character that flags (redundantly for XML) that the actual data to // display is based on the ktptObjData attribute. case FwObjDataTypes.kodtNameGuidHot: case FwObjDataTypes.kodtOwnNameGuidHot: case FwObjDataTypes.kodtContextString: case FwObjDataTypes.kodtGuidMoveableObjDisp: hotGuid = true; break; } } } if (pict != null) { // Write the bytes of the picture data var sb = new StringBuilder(); for (int j = 0; j < pict.Length; j++) { sb.Append(pict[j].ToString("X2")); if (j % 32 == 31) { sb.AppendLine(); } } writer.WriteString(sb.ToString()); } else if (hotGuid) { writer.WriteString(string.Empty); } else { string runText = normalizedTss.get_RunText(i) ?? string.Empty; if (runText != string.Empty && runText.All(char.IsWhiteSpace)) { writer.WriteAttributeString("xml", "space", "", "preserve"); } // TODO: should we escape quotation marks? this is not necessary but different than the behavior of the C++ implementation writer.WriteString(Icu.Normalize(runText, Icu.UNormalizationMode.UNORM_NFC)); } writer.WriteEndElement(); if (markItem) { writer.WriteEndElement(); } } if (!string.IsNullOrEmpty(fieldName)) { writer.WriteEndElement(); } writer.WriteEndElement(); } return(xml.ToString()); }
public static string TextFromTsString(ITsString tss, ILgWritingSystemFactory wsf) { // This will replace SafeTsStringText, and will actually deal with <span> elements // Spec: the TsString properties ktptWs (an int property) and ktptNamedStyle (a string property) // will be replaced with lang="(wsStr)" and class="styleName_PropValue". Other properties, that // LF doesn't process, will be preserved in the class attribute as well, as follows: // // 1) Determine whether the property is an int property or a string property. // 2) Call either IntPropertyName() or StringPropertyName() to get its name. // 3) Create a class string in format "propC_N_NAME_VALUE" where: // - C is "i" for int props or "s" for string props // - N is the property number // - NAME is, of course, the property name // - VALUE is the property's value, with two special cases: // * in string properties, spaces are first replaced by "_SPACE_" // * in int properties, there's a value and a "variation", and VALUE is both of them separated by _ // // Result: class="propi_1_ktptWs_1_0 props_1_ktptFontFamily_Times_SPACE_New_SPACE_Roman" if (tss == null) { return(null); } int[] intPropsToSkip = new int[] { (int)FwTextPropType.ktptWs }; int[] strPropsToSkip = new int[] { (int)FwTextPropType.ktptNamedStyle }; int mainWs = tss.get_WritingSystem(0); var resultBuilder = new StringBuilder(); for (int i = 0, n = tss.RunCount; i < n; i++) { string runText = HtmlEncode(tss.get_RunText(i)); ITsTextProps props = tss.get_Properties(i); // int ignored; // int ws = props.GetIntPropValues((int)FwTextPropType.ktptWs, out ignored); int ws = tss.get_WritingSystem(i); // Simpler than GetIntPropValues((int)FwTextPropType.ktptWs) string namedStyle = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle); List <string> classes = ClassesFromTsTextProps(props, intPropsToSkip, strPropsToSkip); bool needSpan = false; string langAttr = null; string classAttr = null; if (ws != mainWs) { needSpan = true; langAttr = String.Format(" lang=\"{0}\"", wsf.GetStrFromWs(ws)); } if (namedStyle != null) { needSpan = true; classes.Insert(0, String.Format("styleName_{0}", namedStyle.Replace(" ", "_SPACE_"))); } if (classes.Count > 0) { needSpan = true; classAttr = String.Format(" class=\"{0}\"", String.Join(" ", classes)); } if (needSpan) { var spanBuilder = new StringBuilder(); spanBuilder.Append("<span"); if (langAttr != null) { spanBuilder.Append(langAttr); } if (classAttr != null) { spanBuilder.Append(classAttr); } spanBuilder.Append(">"); spanBuilder.Append(runText); spanBuilder.Append("</span>"); resultBuilder.Append(spanBuilder.ToString()); } else { resultBuilder.Append(runText); } } string result = resultBuilder.ToString(); if (String.IsNullOrEmpty(result)) { return(null); // We prefer nulls rather than empty strings } else { return(result.Normalize(NormalizationForm.FormC)); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlScrAnnotationsList"/> class based on /// the given collection of Scripture notes. /// </summary> /// <param name="cache">The cache.</param> /// ------------------------------------------------------------------------------------ public XmlScrAnnotationsList(FdoCache cache) { m_cache = cache; m_lgwsf = m_cache.LanguageWritingSystemFactoryAccessor; VernacularIcuLocale = m_lgwsf.GetStrFromWs(m_cache.DefaultVernWs); DefaultIcuLocale = m_lgwsf.GetStrFromWs(m_cache.DefaultAnalWs); DateTimeExported = DateTime.Now; ProjectName = m_cache.LangProject.Name.GetAlternative(SpecialWritingSystemCodes.BestAnalysis); WindowsIdentity whoami = WindowsIdentity.GetCurrent(); ExportedBy = whoami.Name.Normalize(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="XmlTextRun"/> class, based on the given /// run information /// </summary> /// <param name="wsDefault">The default writing system of the paragraph.</param> /// <param name="lgwsf">The writing system factory.</param> /// <param name="text">The text of the run.</param> /// <param name="props">The properties of the run.</param> /// ------------------------------------------------------------------------------------ public XmlTextRun(int wsDefault, ILgWritingSystemFactory lgwsf, string text, ITsTextProps props) { int dummy; int wsRun = props.GetIntPropValues((int)FwTextPropType.ktptWs, out dummy); if (wsRun != wsDefault) IcuLocale = lgwsf.GetStrFromWs(wsRun); StyleName = props.GetStrPropValue((int)FwTextPropType.ktptNamedStyle); m_text = text; }
/// <summary> /// Write the integer text property as an XML attribute. /// </summary> /// <param name="writer"></param> /// <param name="wsf"></param> /// <param name="tpt"></param> /// <param name="nVar"></param> /// <param name="nVal"></param> public void WriteIntTextProp(TextWriter writer, ILgWritingSystemFactory wsf, int tpt, int nVar, int nVal) { Debug.Assert(writer != null); Debug.Assert(wsf != null); switch (tpt) { case (int)FwTextPropType.ktptBackColor: writer.Write(" backcolor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptBold: writer.Write(" bold=\"{0}\"", ToggleValueName((byte)nVal)); break; case (int)FwTextPropType.ktptWs: if (nVal != 0) { string sWs = wsf.GetStrFromWs(nVal); if (String.IsNullOrEmpty(sWs)) throw new Exception("Invalid writing system for <Run ws=\"...\">."); writer.Write(" ws=\"{0}\"", XmlUtils.MakeSafeXmlAttribute(sWs)); } break; case (int)FwTextPropType.ktptBaseWs: if (nVal != 0) { string sWs = wsf.GetStrFromWs(nVal); if (String.IsNullOrEmpty(sWs)) throw new Exception("Invalid writing system for <Run wsBase=\"...\">."); writer.Write(" wsBase=\"{0}\"", XmlUtils.MakeSafeXmlAttribute(sWs)); } break; case (int)FwTextPropType.ktptFontSize: writer.Write(" fontsize=\"{0}\"", nVal); if (nVar != (int)FwTextPropVar.ktpvDefault) writer.Write(" fontsizeUnit=\"{0}\"", PropVarName(nVar)); break; case (int)FwTextPropType.ktptForeColor: writer.Write(" forecolor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptItalic: writer.Write(" italic=\"{0}\"", ToggleValueName((byte)nVal)); break; case (int)FwTextPropType.ktptOffset: writer.Write(" offset=\"{0}\"", nVal); writer.Write(" offsetUnit=\"{0}\"", PropVarName(nVar)); break; case (int)FwTextPropType.ktptSuperscript: writer.Write(" superscript=\"{0}\"", SuperscriptValName((byte)nVal)); break; case (int)FwTextPropType.ktptUnderColor: writer.Write(" undercolor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptUnderline: writer.Write(" underline=\"{0}\"", UnderlineTypeName((byte)nVal)); break; case (int)FwTextPropType.ktptSpellCheck: writer.Write(" spellcheck=\"{0}\"", SpellingModeName((byte)nVal)); break; // Paragraph level properties. case (int)FwTextPropType.ktptAlign: writer.Write(" align=\"{0}\"", AlignmentTypeName((byte)nVal)); break; case (int)FwTextPropType.ktptFirstIndent: writer.Write(" firstIndent=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptLeadingIndent: writer.Write(" leadingIndent=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptTrailingIndent: writer.Write(" trailingIndent=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptSpaceBefore: writer.Write(" spaceBefore=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptSpaceAfter: writer.Write(" spaceAfter=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptTabDef: writer.Write(" tabDef=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptLineHeight: writer.Write(" lineHeight=\"{0}\"", Math.Abs(nVal)); writer.Write(" lineHeightUnit=\"{0}\"", PropVarName(nVar)); Debug.Assert(nVal >= 0 || nVar == (int)FwTextPropVar.ktpvMilliPoint); if (nVar == (int)FwTextPropVar.ktpvMilliPoint) { // negative means "exact" internally. See FWC-20. writer.Write(" lineHeightType=\"{0}\"", nVal < 0 ? "exact" : "atLeast"); } break; case (int)FwTextPropType.ktptParaColor: writer.Write(" paracolor=\"{0}\"", ColorName(nVal)); break; // Properties from the views subsystem: case (int)FwTextPropType.ktptRightToLeft: writer.Write(" rightToLeft=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadLeading: writer.Write(" padLeading=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadTrailing: writer.Write(" padTrailing=\"{0}\"", nVal); break; // Not the other margins: they are duplicated by FirstIndent etc. case (int)FwTextPropType.ktptMarginTop: writer.Write(" MarginTop=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadTop: writer.Write(" padTop=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptPadBottom: writer.Write(" padBottom=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderTop: writer.Write(" borderTop=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderBottom: writer.Write(" borderBottom=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderLeading: writer.Write(" borderLeading=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderTrailing: writer.Write(" borderTrailing=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBorderColor: writer.Write(" borderColor=\"{0}\"", ColorName(nVal)); break; case (int)FwTextPropType.ktptBulNumScheme: writer.Write(" bulNumScheme=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptBulNumStartAt: writer.Write(" bulNumStartAt=\"{0}\"", nVal == Int32.MinValue ? 0 : nVal); break; case (int)FwTextPropType.ktptDirectionDepth: writer.Write(" directionDepth=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptKeepWithNext: writer.Write(" keepWithNext=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptKeepTogether: writer.Write(" keepTogether=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptHyphenate: writer.Write(" hyphenate=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptWidowOrphanControl: writer.Write(" widowOrphan=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptMaxLines: writer.Write(" maxLines=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptCellBorderWidth: writer.Write(" cellBorderWidth=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptCellSpacing: writer.Write(" cellSpacing=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptCellPadding: writer.Write(" cellPadding=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptEditable: writer.Write(" editable=\"{0}\"", EditableName(nVal)); break; case (int)FwTextPropType.ktptSetRowDefaults: writer.Write(" setRowDefaults=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptRelLineHeight: writer.Write(" relLineHeight=\"{0}\"", nVal); break; case (int)FwTextPropType.ktptTableRule: // Ignore this view-only property. break; default: break; } }