本文整理汇总了C#中SIL.FieldWorks.FDO.Cellar.StTxtPara.DeleteAnyBtMarkersForFootnote方法的典型用法代码示例。如果您正苦于以下问题:C# StTxtPara.DeleteAnyBtMarkersForFootnote方法的具体用法?C# StTxtPara.DeleteAnyBtMarkersForFootnote怎么用?C# StTxtPara.DeleteAnyBtMarkersForFootnote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.Cellar.StTxtPara
的用法示例。
在下文中一共展示了StTxtPara.DeleteAnyBtMarkersForFootnote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjDeleted
// this code was added back when we were trying to display some special UI for editing
// verse numbers, rather than allowing normal editing.
///// ------------------------------------------------------------------------------------
///// <summary>
///// Changes the mouse cursor if we are over a verse number
///// </summary>
///// <param name="sel">The selection</param>
///// <returns>True if we set a cursor, false otherwise</returns>
///// ------------------------------------------------------------------------------------
//protected override bool SetCustomCursor(IVwSelection sel)
//{
// if (Callbacks.EditedRootBox == null)
// return false;
// SelectionHelper helper = SelectionHelper.Create(sel, Callbacks.EditedRootBox.Site);
// if (helper == null || helper.SelProps == null)
// return false;
// string styleName =
// helper.SelProps.GetStrPropValue((int)FwTextPropType.ktptNamedStyle);
// if (styleName == ScrStyleNames.VerseNumber)
// {
// Control.Cursor = Cursors.Arrow;
// return true;
// }
// return false;
//}
/// ------------------------------------------------------------------------------------
/// <summary>
/// This method is used to get a notification when an owning object-replacement character
/// (ORC) is deleted. ORCs are used to mark locations in the text of things like pictures
/// or footnotes. In the case of footnotes, when an owning footnote ORC is deleted, we
/// need to find the corresponding footnote and delete it.
/// </summary>
/// <param name="guid">The GUID of the footnote being deleted.</param>
/// ------------------------------------------------------------------------------------
public override void ObjDeleted(ref Guid guid)
{
CheckDisposed();
if (PreventObjDeletions)
return;
// This is a check to avoid fallout from a time when we incorrectly imported BT
// footnote ORCs as owning.
if (IsBackTranslation)
return;
int footnoteHvo = m_cache.GetIdFromGuid(guid);
if (footnoteHvo == 0)
return;
int clsid = m_cache.GetClassOfObject(footnoteHvo);
if (clsid == 0)
return;
// Delete the footnote.
if (clsid == StFootnote.kClassId)
{
using (new WaitCursor(Control))
{
ScrFootnote footnote = new ScrFootnote(m_cache, footnoteHvo);
int paraHvo = footnote.ContainingParagraphHvo;
// If there's no (vernacular) paragraph with an ORC that references this footnote,
// there can't be a translation either.
if (paraHvo > 0)
{
StTxtPara para = new StTxtPara(m_cache, paraHvo);
para.DeleteAnyBtMarkersForFootnote(guid);
}
ScrFootnote.DeleteFootnote(footnote);
}
}
}
示例2: DeleteFootnotes
/// ------------------------------------------------------------------------------------
/// <summary>
/// Delete all footnotes between firstFootnoteToDelete and lastFootnoteToDelete. Clean
/// up BT ORCs for the paragraphs specified.
/// </summary>
/// <param name="book">Book that contains the sections to delete</param>
/// <param name="firstFootnoteToDelete">First footnote that will be deleted
/// (might be null).</param>
/// <param name="lastFootnoteToDelete">Last footnote that will be deleted
/// (might be null).</param>
/// <param name="hvoFirstPara">First (possibly partial) paragraph being deleted that
/// might contain ORCs for the first footnotes. Any footnotes being deleted whose ORCs
/// are in this paragraph will have their corresponding BT ORCs removed as well.
/// If zero, we don't bother to remove any corresponding BT ORCs in the first para.</param>
/// <param name="hvoLastPara">Last (possibly partial) paragraph being deleted that
/// might contain ORCs for the last footnotes. Any footnotes being deleted whose ORCs
/// are in this paragraph will have their corresponding BT ORCs removed as well.
/// If zero, we don't bother to remove any corresponding BT ORCs in the last para.</param>
/// ------------------------------------------------------------------------------------
private void DeleteFootnotes(IScrBook book, ScrFootnote firstFootnoteToDelete,
ScrFootnote lastFootnoteToDelete, int hvoFirstPara, int hvoLastPara)
{
Debug.Assert((firstFootnoteToDelete == null && lastFootnoteToDelete == null)
|| (firstFootnoteToDelete != null && lastFootnoteToDelete != null));
if (firstFootnoteToDelete != null)
{
bool fDeleteFootnote = false;
int[] hvos = book.FootnotesOS.HvoArray;
for (int i = hvos.Length - 1; i >= 0; i--)
{
if (hvos[i] == lastFootnoteToDelete.Hvo)
fDeleteFootnote = true; // we are now in the range of footnotes to delete
if (fDeleteFootnote)
{
// This code fixes TE-4882.
ScrFootnote footnote = new ScrFootnote(m_cache, hvos[i]);
int hvoPara = footnote.ContainingParagraphHvo;
Debug.Assert(hvoPara > 0);
if ((hvoPara == hvoFirstPara || hvoPara == hvoLastPara) && hvoPara > 0)
{
StTxtPara para = new StTxtPara(m_cache, hvoPara);
para.DeleteAnyBtMarkersForFootnote(footnote.Guid);
}
m_cache.DeleteObject(hvos[i]);
}
if (hvos[i] == firstFootnoteToDelete.Hvo)
break;
}
}
}
示例3: DeleteFootnoteAndMarker
/// ------------------------------------------------------------------------------------
/// <summary>
/// Deletes a footnote along with its marker in the text. This also recalculates the
/// footnote markers of following footnotes.
/// </summary>
/// <param name="footnote"></param>
/// ------------------------------------------------------------------------------------
public static void DeleteFootnoteAndMarker(ScrFootnote footnote)
{
// Paragraph changes are not monitored by cache - refresh cache for book before
// doing deletion
IScrBook book = new ScrBook(footnote.Cache, footnote.OwnerHVO);
// REVIEW: Probably not needed now??? ((ScrBook)book).RefreshFootnoteRefs();
// Get paragraph containing footnote and search for run having footnote ref.
int hvoPara = footnote.ContainingParagraphHvo;
if (hvoPara != 0)
{
StTxtPara para = new StTxtPara(footnote.Cache, hvoPara);
para.DeleteAnyBtMarkersForFootnote(footnote.Guid);
ITsString tssContent = para.Contents.UnderlyingTsString;
TsRunInfo runInfo = new TsRunInfo();
int i;
for (i = 0; i < tssContent.RunCount; i++)
{
ITsTextProps textProps = tssContent.FetchRunInfo(i, out runInfo);
string strGuid =
textProps.GetStrPropValue((int)FwTextPropType.ktptObjData);
if (strGuid != null)
{
Guid guid = MiscUtils.GetGuidFromObjData(strGuid.Substring(1));
if (footnote.Guid == guid)
break;
}
}
System.Diagnostics.Debug.Assert(i < tssContent.RunCount, "Footnote marker not found in text");
// Remove footnote ref from paragraph - then delete the footnote
ITsStrBldr bldr = tssContent.GetBldr();
bldr.Replace(runInfo.ichMin, runInfo.ichLim, string.Empty, null);
para.Contents.UnderlyingTsString = bldr.GetString();
}
DeleteFootnote(footnote);
}