public static void CountTextUnitsInRange(TextPatternRange rangeToCount, TextUnit[] supportedTextUnits, ref int[] numberOfTextUnits) { // Validate arrays if (supportedTextUnits.Length != (((int)TextUnit.Document) + 1)) { throw new ArgumentException("supportedTextUnits array is of incorrect length"); } if (numberOfTextUnits.Length != (((int)TextUnit.Document) + 1)) { throw new ArgumentException("numberOfTextUnits array is of incorrect length"); } // Determine supported text units numberOfTextUnits[(int)TextUnit.Character] = TextLibraryCount.CountTextUnit(TextUnit.Character, rangeToCount); numberOfTextUnits[(int)TextUnit.Format] = TextLibraryCount.CountTextUnit(TextUnit.Format, rangeToCount); numberOfTextUnits[(int)TextUnit.Word] = TextLibraryCount.CountTextUnit(TextUnit.Word, rangeToCount); numberOfTextUnits[(int)TextUnit.Line] = TextLibraryCount.CountTextUnit(TextUnit.Line, rangeToCount); numberOfTextUnits[(int)TextUnit.Paragraph] = TextLibraryCount.CountTextUnit(TextUnit.Paragraph, rangeToCount); numberOfTextUnits[(int)TextUnit.Page] = TextLibraryCount.CountTextUnit(TextUnit.Page, rangeToCount); numberOfTextUnits[(int)TextUnit.Document] = TextLibraryCount.CountTextUnit(TextUnit.Document, rangeToCount); }
///--------------------------------------------------------------------------- /// <summary> /// Gets ClassName and LocalizedControlType properties /// </summary> ///--------------------------------------------------------------------------- public static void GetClassName(AutomationElement autoElement, out string className, out string localizedControlType) { TextLibraryCount.GetClassName(autoElement, out className, out localizedControlType); }
//------------------------------------------------------------------- // Identify supported TextUnits in Win32 //------------------------------------------------------------------- internal static TextUnit win32_IdentifySupportedTextUnits(AutomationElement element, TextUnit targetUnit) { return(TextLibraryCount.win32_IdentifySupportedTextUnits(element, targetUnit)); }
/// --------------------------------------------------------------------------- /// <summary> /// Identify if we're on RichEdit control or not /// </summary> /// --------------------------------------------------------------------------- public static bool IsRichEdit(AutomationElement autoElement) { return(TextLibraryCount.IsRichEdit(autoElement)); }
/// ------------------------------------------------------------------- /// <summary> /// Identifies supported text units. Some units will map upwards /// TextUnit.Page, for example, maps up to a Document for all /// controls/providers except Word/Office /// </summary> /// ------------------------------------------------------------------- public static void IdentifySupportedTextUnits(AutomationElement element, ref TextUnit[] supportedTextUnits) { TextLibraryCount.IdentifySupportedTextUnits(element, ref supportedTextUnits); }
/// ------------------------------------------------------------------- /// <summary> /// Count # of LF within a TextPatternRange (provide agnostic... for now) /// </summary> /// ------------------------------------------------------------------- public static int CountParagraphs(string actualText) { return(TextLibraryCount.CountParagraphs(actualText)); }
/// ------------------------------------------------------------------- /// Count # of lines within a TextPatternRange (win32 specific) /// ------------------------------------------------------------------- public static int Win32CountLines(AutomationElement element) { return(TextLibraryCount.Win32CountLines(element)); }
public static int CountTextUnit(TextUnit tu, TextPatternRange rangeToCount) { return(TextLibraryCount.CountTextUnit(tu, rangeToCount)); }
///--------------------------------------------------------------------------- /// <summary> /// Gets ClassName property /// </summary> ///--------------------------------------------------------------------------- public static string GetClassName(AutomationElement autoElement) { return(TextLibraryCount.GetClassName(autoElement)); }