/// ------------------------------------------------------------------------------------ /// <summary> /// Write the first paragraph in the given footnote. (TE allows only 1 paragraph in /// footnotes!) /// </summary> /// ------------------------------------------------------------------------------------ private void ExportFootnote(ScrFootnote foot) { IStTxtPara para = foot.ParagraphsOS[0] as IStTxtPara; string sStyle = para.StyleName; if (String.IsNullOrEmpty(sStyle)) sStyle = "scrFootnote"; else sStyle = m_xhtml.GetValidCssClassName(sStyle); ITsStrBldr bldr = foot.MakeFootnoteMarker(m_cache.DefaultVernWs); string sFootnoteMarker = bldr.Text; ITsString tssPara = para.Contents.UnderlyingTsString; m_writer.WriteLine("<span class=\"{0}\" id=\"{1}\" title=\"{2}\">", sStyle, "F" + foot.Guid.ToString().ToUpperInvariant(), sFootnoteMarker); m_xhtml.MapCssToLang(sStyle, LanguageCode(StringUtils.GetWsAtOffset(tssPara, 0))); WriteTsStringAsXml(tssPara, 4); m_writer.WriteLine("</span>"); // The following class is inserted by the XSLT processing. m_xhtml.MapCssToLang("scrFootnoteMarker", LanguageCode(m_cache.DefaultVernWs)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Display the footnote marker. /// </summary> /// <param name="vwenv">View environment</param> /// <param name="footnote">The footnote.</param> /// ------------------------------------------------------------------------------------ private void DisplayFootnoteMarker(IVwEnv vwenv, ScrFootnote footnote) { vwenv.NoteDependency(new int[] { footnote.Hvo }, new int[] { (int)StFootnote.StFootnoteTags.kflidFootnoteMarker }, 1); // The footnote marker is not editable. vwenv.set_IntProperty((int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); ITsStrBldr strBldr = footnote.MakeFootnoteMarker(DefaultWs); strBldr.Replace(strBldr.Length, strBldr.Length, " ", null); vwenv.AddString(strBldr.GetString()); }
/// ----------------------------------------------------------------------------------- /// <summary> /// Get the string that should be displayed in place of an object character associated /// with the specified GUID. /// </summary> /// <param name="bstrGuid"></param> /// <returns></returns> /// ----------------------------------------------------------------------------------- public override ITsString GetStrForGuid(string bstrGuid) { CheckDisposed(); Debug.Assert(Cache != null); Debug.Assert(bstrGuid.Length == 8); Guid guid = MiscUtils.GetGuidFromObjData(bstrGuid); int hvoObj = Cache.GetIdFromGuid(guid); if (hvoObj != 0) { if (Cache.GetClassOfObject(hvoObj) == StFootnote.kclsidStFootnote) { ScrFootnote footnote = new ScrFootnote(Cache, hvoObj); ITsStrBldr bldr = footnote.MakeFootnoteMarker(DefaultWs); if (bldr.Length == 0 && Options.ShowMarkerlessIconsSetting) { // Use the restore window icon character from Marlett as the // footnote marker. ITsPropsBldr propsBldr = bldr.get_Properties(0).GetBldr(); propsBldr.SetStrPropValue((int) FwTextPropType.ktptFontFamily, "Marlett"); if (PrintLayout) // don't display markerless icon in print layout view bldr.Replace(0, 0, string.Empty, propsBldr.GetTextProps()); else bldr.Replace(0, 0, "\u0032", propsBldr.GetTextProps()); } else if (bldr.Length > 0) { // This is to prevent the word-wrap from wrapping at the beginning of // a footnote marker. // REVIEW (TimS): \uFEFF is deprecated as a non-break character in Unicode now. Should // use \u2060 but no fonts/renderers seem to have it defined. Should // maybe change this eventually. string directionIndicator = (RightToLeft) ? "\u200F" : "\u200E"; bldr.Replace(0, 0, directionIndicator + "\uFEFF" + directionIndicator, null); } bldr.SetIntPropValues(0, bldr.Length, (int)FwTextPropType.ktptEditable, (int)FwTextPropVar.ktpvEnum, (int)TptEditable.ktptNotEditable); return bldr.GetString(); } } // If the GUID was not found then return a missing object string ITsStrFactory tsf = TsStrFactoryClass.Create(); return tsf.MakeString("<missing object>", Cache.DefaultUserWs); }