本文整理汇总了C#中IVwStylesheet.GetContext方法的典型用法代码示例。如果您正苦于以下问题:C# IVwStylesheet.GetContext方法的具体用法?C# IVwStylesheet.GetContext怎么用?C# IVwStylesheet.GetContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVwStylesheet
的用法示例。
在下文中一共展示了IVwStylesheet.GetContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDefaultDomainForStyle
/// ------------------------------------------------------------------------------------
/// <summary>
/// Get the default marker domain for the given style name
/// </summary>
/// <param name="styleSheet">style sheet to use for determining the domain</param>
/// <param name="styleName">The style name</param>
/// <returns>the default marker domain</returns>
/// ------------------------------------------------------------------------------------
public static MarkerDomain GetDefaultDomainForStyle(IVwStylesheet styleSheet,
string styleName)
{
try
{
// Footnote target ref and marker styles are always footnote domain
if (styleName == ScrStyleNames.FootnoteTargetRef ||
styleName == ScrStyleNames.FootnoteMarker)
return MarkerDomain.Footnote;
// Chapter and verse numbers are always Default domain
if (styleName == ScrStyleNames.ChapterNumber ||
styleName == ScrStyleNames.VerseNumber)
return MarkerDomain.Default;
if (styleSheet == null)
{
// REVIEW: JohnW - Seems like this should not be valid since we won't get
// the mapping right. Tried putting a Debug.Fail here to see if
// I could eliminate this check, but tests will have to be
// changed and the code to update existing settings will need
// to be changed.
return MarkerDomain.Default;
}
// Base the domain on the style context
switch ((ContextValues)styleSheet.GetContext(styleName))
{
case ContextValues.Note:
return MarkerDomain.Footnote;
case ContextValues.Annotation:
return MarkerDomain.Note;
default:
return MarkerDomain.Default;
}
}
catch
{
// This is probably in a test, so we don't care. (Or maybe something really
// bad happened, like the style was deleted or renamed.)
return MarkerDomain.Default;
}
}