本文整理汇总了C#中IVwStylesheet.GetNextStyle方法的典型用法代码示例。如果您正苦于以下问题:C# IVwStylesheet.GetNextStyle方法的具体用法?C# IVwStylesheet.GetNextStyle怎么用?C# IVwStylesheet.GetNextStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwStylesheet
的用法示例。
在下文中一共展示了IVwStylesheet.GetNextStyle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertNew
/// <summary>
/// Insert chvo new objects after the one at ihvo, which functions as a pattern.
/// Typically used when splitting a paragraph at ihvo.
/// The new objects should generally be similar to the one at ihvo, except that
/// the main text property that forms the paragraph body should be empty.
/// If the object has a paragraph style property, the new objects should have
/// the same style as the one at ihvo, except that, if a stylesheet is passed,
/// each successive paragraph inserted should have the appropriate next style
/// for the one named in the previous paragraph.
/// The caller should also call PropChanged to notify interested parties.
///</summary>
/// <param name='hvoObj'> </param>
/// <param name='tag'> </param>
/// <param name='ihvo'> </param>
/// <param name='chvo'> </param>
/// <param name='ss'> </param>
public void InsertNew(int hvoObj, int tag, int ihvo, int chvo, IVwStylesheet ss)
{
if (chvo != 1 || tag != StTextTags.kflidParagraphs)
throw new NotImplementedException("'InsertNew' not implemented yet except for adding one paragraph to a text.");
IStText text = m_cmObjectRepository.GetObject(hvoObj) as IStText;
if (text == null)
throw new InvalidOperationException("'InsertNew' asked to add a paragraph to something that is not an StText");
IStTxtPara oldPara = text[ihvo];
int clid = oldPara.ClassID;
int hvoNew = MakeNewObject(clid, hvoObj, tag, ihvo + 1);
IStTxtPara newPara = (IStTxtPara)m_cmObjectRepository.GetObject(hvoNew);
string newStyleName = oldPara.StyleName;
if (ss != null && !string.IsNullOrEmpty(newStyleName))
{
string nextStyleName = ss.GetNextStyle(oldPara.StyleName);
if (!string.IsNullOrEmpty(nextStyleName))
newStyleName = nextStyleName;
}
if (!string.IsNullOrEmpty(newStyleName))
newPara.StyleName = newStyleName;
}