using System.Runtime.InteropServices.ComTypes;
namespace Vanara.PInvoke;
public static partial class MsftEdit
{
private const ComInterfaceType dualIntType =
#if NETCOREAPP3_1
ComInterfaceType.InterfaceIsIUnknown;
#else
ComInterfaceType.InterfaceIsDual;
#endif
///
/// Retrieves the Unicode Transformation Format (UTF)-32 math alphanumeric character that corresponds to the specified Basic Multilingual
/// Plane (BMP) character and math style.
///
///
/// [in] Type: LONG
/// A BMP character.
///
///
/// [in] Type: DWORD
/// Math style. This parameter can be one of the values from the MANCODE enumeration.
///
///
/// Type:
/// Returns the corresponding UTF-32 math alphanumeric character, or 0 if no such character exists.
///
/// This function is exported by the RichEdit 6.0 or later msftedit.dll.
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/hh780353(v=vs.85) GetMathAlphanumeric( _In_Â LONG
// Â ch, _In_Â DWORD MathStyle );
[PInvokeData("Tom.h")]
[DllImport(Lib_msftedit, SetLastError = false, ExactSpelling = true)]
public static extern uint GetMathAlphanumeric([In] int ch, [In] uint MathStyle);
///
/// Retrieves the math style and the upright Basic Multilingual Plane (BMP) character code that corresponds to the specified trailing
/// byte of a math surrogate pair.
///
///
/// [in] Type: DWORD
///
/// The trailing byte of the math surrogate pair. It can be a surrogate trail code (0xDC00â0xDFFF), a letter-like character
/// (0x2102â0x2134), or the UTF-32 value of a higher-plane character such as 0x1D44E.
///
///
///
/// [out] Type: WCHAR*
/// A buffer that receives the upright BMP character code. If no such character exists, pch receives 0.
///
///
/// Type:
///
/// Returns the math style, which consists of a pair of values from the MANCODE enumeration. It can be one of the following values:
///
/// 0
/// MBOLD
/// MITAL
/// MGREEK
/// combined with one of following values:
/// MROMN
/// MSCRP
/// MFRAK
/// MOPEN
/// MSANS
/// MMONO
///
/// This function is exported by the RichEdit 6.0 or later msftedit.dll.
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/hh780354(v=vs.85) GetMathAlphanumericCode( _In_Â
// Â DWORD chTrail, _Out_Â WCHAR *pch );
[PInvokeData("Tom.h")]
[DllImport(Lib_msftedit, SetLastError = false, ExactSpelling = true, CharSet = CharSet.Unicode)]
public static extern MANCODE GetMathAlphanumericCode([In] uint chTrail, out char pch);
/// Translates the built-up math, ruby, and other inline objects in the specified range to linear form.
///
/// [in, out]
/// Type: ITextRange2*
///
/// On input, a text range object that contains the built-up math objects to convert to linear form. On output, the object contains the
/// linear form.
///
///
///
/// [in]
/// Type: ITextStrings*
/// Strings collection used for manipulations.
///
///
/// [in]
/// Type: long
/// A combination of the following flags.
/// tomMathAlphabetics
/// tomMathBuildDownOutermost
/// tomMathBuildUpArgOrZone
/// tomMathRemoveOutermost
/// tomPlain
/// tomTeX
///
///
/// Type: HRESULT
/// See Remarks.
///
///
/// If the linearization is successful, the originally selected range is replaced by the linearized version.
///
/// If the tomMathRemoveOutermost or tomMathBuildDownOutermost build down mode is specified, the build down operation can
/// be affected by the tomMathChangeMask values. The main purpose of these build-down modes is to facilitate transformations of
/// the build-up math object as exposed by math context menus.
///
///
/// For example, to convert a stacked fraction to a linear fraction as in (a+b/c)/(u+x/y)â((a+b/c))â((u+x/y)), parentheses must be
/// inserted; otherwise, you get a transformation that looks incorrect, as in (a+b/c)/(u+x/y)â(a+b/c)â(u+x/y), even though internally
/// the linear fraction still has the original numerator and denominator.
///
///
/// The build-down process automatically inserts the parentheses, because the linear format for this case has parentheses, and the
/// special change is made to replace the stacked-fraction operator U+002F by the linear fraction operator U+2215. Build up doesn't
/// discard the parentheses for U+2215, but it does for U+002F.
///
/// This function is exported by the RichEdit 6.0 or later msftedit.dll.
///
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/hh780443(v=vs.85) HRESULT MathBuildDown( _Inout_Â
// ITextRange2  *prg, _In_    ITextStrings *pstrs, _In_    long  Â
// Â Â Â Â Â Â Flags );
[PInvokeData("Tom.h")]
[DllImport(Lib_msftedit, SetLastError = false, ExactSpelling = true)]
public static extern HRESULT MathBuildDown([In, Out] ITextRange2 prg, [In] ITextStrings pstrs, long Flags);
/// Converts the linear-format math in a range to a built-up form, or modifies the current built-up form.
///
/// [in, out]
/// Type: ITextRange2*
///
/// On input, a text range object that contains the linearly formatted math expressions to be converted into built-up math. On output,
/// the object contains the built-up math.
///
///
///
/// [in]
/// Type: ITextStrings*
/// Strings collection used for manipulations.
///
///
/// [in]
/// Type: long
/// A combination of the following flags.
/// tomChemicalFormula
/// tomHaveDelimiter
/// tomMathAlphabetics
/// tomMathApplyTemplate
/// tomMathArabicAlphabetics
/// tomMathAutoCorrect
/// tomMathAutoCorrectExt
/// tomMathAutoCorrectOpPairs
/// tomMathBackspace
/// tomMathBuildDown
/// tomMathBuildDownOutermost
/// tomMathBuildUpArgOrZone
/// tomMathBuildUpRecurse
/// tomMathChangeMask
/// tomMathCollapseSel
/// tomMathDeleteArg
/// tomMathDeleteArg1
/// tomMathDeleteArg2
/// tomMathDeleteCol
/// tomMathDeleteRow
/// tomMathEnter
/// tomMathInsColAfter
/// tomMathInsColBefore
/// tomMathInsRowAfter
/// tomMathInsRowBefore
/// tomMathMakeFracLinear
/// tomMathMakeFracSlashed
/// tomMathMakeFracStacked
/// tomMathMakeLeftSubSup
/// tomMathMakeSubSup
/// tomMathRemoveOutermost
/// tomMathRichEdit
/// tomMathShiftTab
/// tomMathSingleChar
/// tomMathSubscript
/// tomMathSuperscript
/// tomMathTab
/// tomNeedTermOp
/// tomPlain
/// tomShowEmptyArgPlaceholders
/// tomTeX
///
///
/// Type: HRESULT
/// See Remarks.
///
///
///
/// If the MathBuildUp method is called on a nondegenerate range, the method checks the text for math italic conversions (if
/// tomMathAlphabetics is specified) and math autocorrect conversions (if tomMathAutoCorrect or
/// tomMathAutoCorrectExt is specified). Then, the method attempts to build up the selected text. If successful, the method
/// replaces the previous text in the range with the built-up text. If the method makes any changes to the range, the function returns
/// NOERROR and the range selects the result. If the method does change the range, it returns S_FALSE or a Component Object
/// Model (COM) error code.
///
///
/// If the MathBuildUp method is called on a degenerate range, the MathBuildUp method treats the range as an insertion
/// point (IP) immediately following the last character input. The method converts that character, possibly along with some preceding
/// characters, to math italic (if tomMathAlphabetics is specified), internal math autocorrect (if tomMathAutoCorrect is
/// specified), negated operators, and some operator pairs (if tomMathAutoCorrectOpPairs is specified). If the IP is inside an
/// argument, the method scans a range of text from the IP back to the start of a math object argument; otherwise, the method scans to
/// the start of the current math zone. The scan is terminated by a hard carriage return or a soft end-of-paragraph mark, because math
/// zones are terminated by these marks. A scan forward from start of the math object argument or math zone bypasses text that has no
/// chance of being built up. If the scan reaches the original entry IP, one of the following outcomes can occur:
///
///
/// -
/// If the method made any changes, the function returns NOERROR and the range updated with the changed text.
///
/// -
/// If the method made no changes, the function returns S_FALSE and leaves the range unchanged.
///
///
///
/// If the scan finds text that might get built up, the MathBuildUp method attempts to build up the text up to the insertion
/// point. If successful, the method returns NOERROR, and the range is updated with the corresponding built-up text.
///
///
/// If this full build-up attempt fails, the MathBuildUp method does a partial build-up check for the expression immediately
/// preceding the IP. If this succeeds, the method returns NOERROR and the range contains the linear text to be replaced by the
/// built-up text.
///
///
/// If full and partial build-up attempts fail, the function returns as described previously for the cases where no build-up text was
/// found. Other possible return values include E_INVALIDARG (if either interface pointer is NULL) and E_OUTOFMEMORY.
///
///
/// You should set the tomNeedTermOp flag should for formula autobuildup unless autocorrection has occurred that deletes the
/// terminating blank. Autocorrection can occur when correcting text like \alpha when the user types a blank to force autocorrection.
///
/// This function is exported by the RichEdit 6.0 or later msftedit.dll.
///
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/hh780445(v=vs.85) HRESULT MathBuildUp( _Inout_Â
// ITextRange2  *prg, _In_    ITextStrings *pstrs, _In_    long  Â
// Â Â Â Â Â Â Flags );
[PInvokeData("Tom.h")]
[DllImport(Lib_msftedit, SetLastError = false, ExactSpelling = true)]
public static extern HRESULT MathBuildUp([In, Out] ITextRange2 prg, [In] ITextStrings pstrs, [In] long Flags);
/// Translates the math characters in the specified range.
///
/// [in, out] Type: ITextRange2*
///
/// On entry, this parameter specifies the text range that contains the math characters to translate. On successful exit, the characters
/// in the range have been translated as specified
///
///
///
/// [in] Type: long
/// The translation flags, which can be one or more of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomConvertMathChar
///
/// Converts to/from math italic and/or math bold according to the status of italic and bold retrieved by the
/// ITextFont2::GetEffects method.
///
///
/// -
/// tomFoldMathAlpha
/// Converts from math alphanumerics back to ASCII and Basic Multilingual Plane (BMP) Greek.
///
/// -
/// tomMathAlphabetics
/// Converts to math italic.
///
///
/// Â
/// Other flags are ignored and must be zero.
///
///
/// Type: HRESULT
/// If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// This function is exported by the RichEdit 6.0 or later msftedit.dll.
// https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/hh780446(v=vs.85) HRESULT MathTranslate( _Inout_Â
// ITextRange2 *prg, _In_    long        Flags );
[PInvokeData("Tom.h")]
[DllImport(Lib_msftedit, SetLastError = false, ExactSpelling = true)]
public static extern HRESULT MathTranslate([In, Out] ITextRange2 prg, [In] long Flags);
/// Represents mathematical alphanumeric codes.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/ne-tom-mancode typedef enum __MIDL___MIDL_itf_tom_0000_0000_0003 { MBOLD =
// 0x10, MITAL = 0x20, MGREEK = 0x40, MROMN = 0, MSCRP = 1, MFRAK = 2, MOPEN = 3, MSANS = 4, MMONO = 5, MMATH = 6, MISOL = 7, MINIT = 8,
// MTAIL = 9, MSTRCH = 10, MLOOP = 11, MOPENA = 12 } MANCODE;
[PInvokeData("tom.h", MSDNShortId = "NE:tom.__MIDL___MIDL_itf_tom_0000_0000_0003")]
public enum MANCODE
{
///
/// Value:
/// 0x10
/// Bold
///
MBOLD,
///
/// Value:
/// 0x20
/// Italics
///
MITAL,
///
/// Value:
/// 0x40
/// Greek
///
MGREEK,
///
/// Value:
/// 0
/// Roman
///
MROMN,
///
/// Value:
/// 1
/// Script
///
MSCRP,
///
/// Value:
/// 2
/// Fraktur
///
MFRAK,
///
/// Value:
/// 3
/// Double struck
///
MOPEN,
///
/// Value:
/// 4
/// Sans-serif
///
MSANS,
///
/// Value:
/// 5
/// Monospaced
///
MMONO,
///
/// Value:
/// 6
/// Math
///
MMATH,
///
/// Value:
/// 7
/// Isolated
///
MISOL,
///
/// Value:
/// 8
/// Initial
///
MINIT,
///
/// Value:
/// 9
/// Tailed
///
MTAIL,
///
/// Value:
/// 10
/// Stretched
///
MSTRCH,
///
/// Value:
/// 11
/// Looped
///
MLOOP,
///
/// Value:
/// 12
/// Arabic double-struck
///
MOPENA,
}
/// Defines values that identify object types in the Text Object Model (TOM) content.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/ne-tom-objecttype typedef enum __MIDL___MIDL_itf_tom_0000_0000_0002 {
// tomSimpleText = 0, tomRuby, tomHorzVert, tomWarichu, tomEq = 9, tomMath = 10, tomAccent = tomMath, tomBox, tomBoxedFormula,
// tomBrackets, tomBracketsWithSeps, tomEquationArray, tomFraction, tomFunctionApply, tomLeftSubSup, tomLowerLimit, tomMatrix, tomNary,
// tomOpChar, tomOverbar, tomPhantom, tomRadical, tomSlashedFraction, tomStack, tomStretchStack, tomSubscript, tomSubSup, tomSuperscript,
// tomUnderbar, tomUpperLimit, tomObjectMax } OBJECTTYPE;
[PInvokeData("tom.h", MSDNShortId = "NE:tom.__MIDL___MIDL_itf_tom_0000_0000_0002")]
public enum OBJECTTYPE
{
///
/// Value:
/// 0
/// Not an inline function.
///
tomSimpleText = 0,
/// Base text with ruby annotation.
tomRuby,
/// Text flows horizontally in a vertically oriented document.
tomHorzVert,
/// A Warichu "2 lines in one" comment.
tomWarichu,
///
/// Value:
/// 9
/// An RTF Eq (equation) field.
///
tomEq = 9,
///
/// Value:
/// 10
/// Math.
///
tomMath,
///
/// Value:
/// tomMath
/// Accent (combining mark).
///
tomAccent = tomMath,
/// Abstract box with properties.
tomBox,
/// Encloses the argument in a rectangle.
tomBoxedFormula,
/// Encloses the argument in brackets, parentheses, and so on.
tomBrackets,
/// Encloses the argument in brackets, parentheses, and so on, and with separators.
tomBracketsWithSeps,
/// Column of aligned equations.
tomEquationArray,
/// Fraction.
tomFraction,
/// Function apply.
tomFunctionApply,
/// Left subscript or superscript.
tomLeftSubSup,
/// Second argument below the first.
tomLowerLimit,
/// Matrix.
tomMatrix,
///
/// General
/// n
/// -ary expression.
///
tomNary,
/// Internal use for no-build operators.
tomOpChar,
/// Overscores argument.
tomOverbar,
/// Special spacing.
tomPhantom,
/// Square root, and so on.
tomRadical,
/// Skewed and built-up linear fractions.
tomSlashedFraction,
/// "Fraction" with no divide bar.
tomStack,
/// Stretch character horizontally over or under argument.
tomStretchStack,
/// Subscript.
tomSubscript,
/// Subscript and superscript combination.
tomSubSup,
/// Superscript.
tomSuperscript,
/// Underscores the argument.
tomUnderbar,
/// Second argument above the first.
tomUpperLimit,
///
/// The maximum value in the
/// OBJECTTYPE
/// enumeration.
///
tomObjectMax,
}
/// Defines values that are used with the Text Object Model (TOM) API.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/ne-tom-tomconstants typedef enum __MIDL___MIDL_itf_tom_0000_0000_0001 {
// tomFalse = 0, tomTrue = -1, tomUndefined = -9999999, tomToggle = -9999998, tomAutoColor = -9999997, tomDefault = -9999996, tomSuspend
// = -9999995, tomResume = -9999994, tomApplyNow = 0, tomApplyLater = 1, tomTrackParms = 2, tomCacheParms = 3, tomApplyTmp = 4,
// tomDisableSmartFont = 8, tomEnableSmartFont = 9, tomUsePoints = 10, tomUseTwips = 11, tomBackward = 0xc0000001, tomForward =
// 0x3fffffff, tomMove = 0, tomExtend = 1, tomNoSelection = 0, tomSelectionIP = 1, tomSelectionNormal = 2, tomSelectionFrame = 3,
// tomSelectionColumn = 4, tomSelectionRow = 5, tomSelectionBlock = 6, tomSelectionInlineShape = 7, tomSelectionShape = 8,
// tomSelStartActive = 1, tomSelAtEOL = 2, tomSelOvertype = 4, tomSelActive = 8, tomSelReplace = 16, tomEnd = 0, tomStart = 32,
// tomCollapseEnd = 0, tomCollapseStart = 1, tomClientCoord = 256, tomAllowOffClient = 512, tomTransform = 1024, tomObjectArg = 2048,
// tomAtEnd = 4096, tomNone = 0, tomSingle = 1, tomWords = 2, tomDouble = 3, tomDotted = 4, tomDash = 5, tomDashDot = 6, tomDashDotDot =
// 7, tomWave = 8, tomThick = 9, tomHair = 10, tomDoubleWave = 11, tomHeavyWave = 12, tomLongDash = 13, tomThickDash = 14,
// tomThickDashDot = 15, tomThickDashDotDot = 16, tomThickDotted = 17, tomThickLongDash = 18, tomLineSpaceSingle = 0, tomLineSpace1pt5 =
// 1, tomLineSpaceDouble = 2, tomLineSpaceAtLeast = 3, tomLineSpaceExactly = 4, tomLineSpaceMultiple = 5, tomLineSpacePercent = 6,
// tomAlignLeft = 0, tomAlignCenter = 1, tomAlignRight = 2, tomAlignJustify = 3, tomAlignDecimal = 3, tomAlignBar = 4, tomDefaultTab = 5,
// tomAlignInterWord = 3, tomAlignNewspaper = 4, tomAlignInterLetter = 5, tomAlignScaled = 6, tomSpaces = 0, tomDots = 1, tomDashes = 2,
// tomLines = 3, tomThickLines = 4, tomEquals = 5, tomTabBack = -3, tomTabNext = -2, tomTabHere = -1, tomListNone = 0, tomListBullet = 1,
// tomListNumberAsArabic = 2, tomListNumberAsLCLetter = 3, tomListNumberAsUCLetter = 4, tomListNumberAsLCRoman = 5,
// tomListNumberAsUCRoman = 6, tomListNumberAsSequence = 7, tomListNumberedCircle = 8, tomListNumberedBlackCircleWingding = 9,
// tomListNumberedWhiteCircleWingding = 10, tomListNumberedArabicWide = 11, tomListNumberedChS = 12, tomListNumberedChT = 13,
// tomListNumberedJpnChS = 14, tomListNumberedJpnKor = 15, tomListNumberedArabic1 = 16, tomListNumberedArabic2 = 17,
// tomListNumberedHebrew = 18, tomListNumberedThaiAlpha = 19, tomListNumberedThaiNum = 20, tomListNumberedHindiAlpha = 21,
// tomListNumberedHindiAlpha1 = 22, tomListNumberedHindiNum = 23, tomListParentheses = 0x10000, tomListPeriod = 0x20000, tomListPlain =
// 0x30000, tomListNoNumber = 0x40000, tomListMinus = 0x80000, tomIgnoreNumberStyle = 0x1000000, tomParaStyleNormal = -1,
// tomParaStyleHeading1 = -2, tomParaStyleHeading2 = -3, tomParaStyleHeading3 = -4, tomParaStyleHeading4 = -5, tomParaStyleHeading5 = -6,
// tomParaStyleHeading6 = -7, tomParaStyleHeading7 = -8, tomParaStyleHeading8 = -9, tomParaStyleHeading9 = -10, tomCharacter = 1, tomWord
// = 2, tomSentence = 3, tomParagraph = 4, tomLine = 5, tomStory = 6, tomScreen = 7, tomSection = 8, tomTableColumn = 9, tomColumn = 9,
// tomRow = 0xc, tomWindow = 11, tomCell = 12, tomCharFormat = 13, tomParaFormat = 14, tomTable = 15, tomObject = 16, tomPage = 17,
// tomHardParagraph = 18, tomCluster = 19, tomInlineObject = 20, tomInlineObjectArg = 21, tomLeafLine = 22, tomLayoutColumn = 23,
// tomProcessId = 0x40000001, tomMatchWord = 2, tomMatchCase = 4, tomMatchPattern = 8, tomUnknownStory = 0, tomMainTextStory = 1,
// tomFootnotesStory = 2, tomEndnotesStory = 3, tomCommentsStory = 4, tomTextFrameStory = 5, tomEvenPagesHeaderStory = 6,
// tomPrimaryHeaderStory = 7, tomEvenPagesFooterStory = 8, tomPrimaryFooterStory = 9, tomFirstPageHeaderStory = 10,
// tomFirstPageFooterStory = 11, tomScratchStory = 127, tomFindStory = 128, tomReplaceStory = 129, tomStoryInactive = 0,
// tomStoryActiveDisplay = 1, tomStoryActiveUI = 2, tomStoryActiveDisplayUI = 3, tomNoAnimation = 0, tomLasVegasLights = 1,
// tomBlinkingBackground = 2, tomSparkleText = 3, tomMarchingBlackAnts = 4, tomMarchingRedAnts = 5, tomShimmer = 6, tomWipeDown = 7,
// tomWipeRight = 8, tomAnimationMax = 8, tomLowerCase = 0, tomUpperCase = 1, tomTitleCase = 2, tomSentenceCase = 4, tomToggleCase = 5,
// tomReadOnly = 0x100, tomShareDenyRead = 0x200, tomShareDenyWrite = 0x400, tomPasteFile = 0x1000, tomCreateNew = 0x10, tomCreateAlways
// = 0x20, tomOpenExisting = 0x30, tomOpenAlways = 0x40, tomTruncateExisting = 0x50, tomRTF = 0x1, tomText = 0x2, tomHTML = 0x3,
// tomWordDocument = 0x4, tomBold = 0x80000001, tomItalic = 0x80000002, tomUnderline = 0x80000004, tomStrikeout = 0x80000008,
// tomProtected = 0x80000010, tomLink = 0x80000020, tomSmallCaps = 0x80000040, tomAllCaps = 0x80000080, tomHidden = 0x80000100,
// tomOutline = 0x80000200, tomShadow = 0x80000400, tomEmboss = 0x80000800, tomImprint = 0x80001000, tomDisabled = 0x80002000, tomRevised
// = 0x80004000, tomSubscriptCF = 0x80010000, tomSuperscriptCF = 0x80020000, tomFontBound = 0x80100000, tomLinkProtected = 0x80800000,
// tomInlineObjectStart = 0x81000000, tomExtendedChar = 0x82000000, tomAutoBackColor = 0x84000000, tomMathZoneNoBuildUp = 0x88000000,
// tomMathZone = 0x90000000, tomMathZoneOrdinary = 0xa0000000, tomAutoTextColor = 0xc0000000, tomMathZoneDisplay = 0x40000,
// tomParaEffectRTL = 0x1, tomParaEffectKeep = 0x2, tomParaEffectKeepNext = 0x4, tomParaEffectPageBreakBefore = 0x8,
// tomParaEffectNoLineNumber = 0x10, tomParaEffectNoWidowControl = 0x20, tomParaEffectDoNotHyphen = 0x40, tomParaEffectSideBySide = 0x80,
// tomParaEffectCollapsed = 0x100, tomParaEffectOutlineLevel = 0x200, tomParaEffectBox = 0x400, tomParaEffectTableRowDelimiter = 0x1000,
// tomParaEffectTable = 0x4000, tomModWidthPairs = 0x1, tomModWidthSpace = 0x2, tomAutoSpaceAlpha = 0x4, tomAutoSpaceNumeric = 0x8,
// tomAutoSpaceParens = 0x10, tomEmbeddedFont = 0x20, tomDoublestrike = 0x40, tomOverlapping = 0x80, tomNormalCaret = 0,
// tomKoreanBlockCaret = 0x1, tomNullCaret = 0x2, tomIncludeInset = 0x1, tomUnicodeBiDi = 0x1, tomMathCFCheck = 0x4, tomUnlink = 0x8,
// tomUnhide = 0x10, tomCheckTextLimit = 0x20, tomIgnoreCurrentFont = 0, tomMatchCharRep = 0x1, tomMatchFontSignature = 0x2,
// tomMatchAscii = 0x4, tomGetHeightOnly = 0x8, tomMatchMathFont = 0x10, tomCharset = 0x80000000, tomCharRepFromLcid = 0x40000000,
// tomAnsi = 0, tomEastEurope = 1, tomCyrillic = 2, tomGreek = 3, tomTurkish = 4, tomHebrew = 5, tomArabic = 6, tomBaltic = 7,
// tomVietnamese = 8, tomDefaultCharRep = 9, tomSymbol = 10, tomThai = 11, tomShiftJIS = 12, tomGB2312 = 13, tomHangul = 14, tomBIG5 =
// 15, tomPC437 = 16, tomOEM = 17, tomMac = 18, tomArmenian = 19, tomSyriac = 20, tomThaana = 21, tomDevanagari = 22, tomBengali = 23,
// tomGurmukhi = 24, tomGujarati = 25, tomOriya = 26, tomTamil = 27, tomTelugu = 28, tomKannada = 29, tomMalayalam = 30, tomSinhala = 31,
// tomLao = 32, tomTibetan = 33, tomMyanmar = 34, tomGeorgian = 35, tomJamo = 36, tomEthiopic = 37, tomCherokee = 38, tomAboriginal = 39,
// tomOgham = 40, tomRunic = 41, tomKhmer = 42, tomMongolian = 43, tomBraille = 44, tomYi = 45, tomLimbu = 46, tomTaiLe = 47,
// tomNewTaiLue = 48, tomSylotiNagri = 49, tomKharoshthi = 50, tomKayahli = 51, tomUsymbol = 52, tomEmoji = 53, tomGlagolitic = 54,
// tomLisu = 55, tomVai = 56, tomNKo = 57, tomOsmanya = 58, tomPhagsPa = 59, tomGothic = 60, tomDeseret = 61, tomTifinagh = 62,
// tomCharRepMax = 63, tomRE10Mode = 0x1, tomUseAtFont = 0x2, tomTextFlowMask = 0xc, tomTextFlowES = 0, tomTextFlowSW = 0x4,
// tomTextFlowWN = 0x8, tomTextFlowNE = 0xc, tomNoIME = 0x80000, tomSelfIME = 0x40000, tomNoUpScroll = 0x10000, tomNoVpScroll = 0x40000,
// tomNoLink = 0, tomClientLink = 1, tomFriendlyLinkName = 2, tomFriendlyLinkAddress = 3, tomAutoLinkURL = 4, tomAutoLinkEmail = 5,
// tomAutoLinkPhone = 6, tomAutoLinkPath = 7, tomCompressNone = 0, tomCompressPunctuation = 1, tomCompressPunctuationAndKana = 2,
// tomCompressMax = 2, tomUnderlinePositionAuto = 0, tomUnderlinePositionBelow = 1, tomUnderlinePositionAbove = 2,
// tomUnderlinePositionMax = 2, tomFontAlignmentAuto = 0, tomFontAlignmentTop = 1, tomFontAlignmentBaseline = 2, tomFontAlignmentBottom =
// 3, tomFontAlignmentCenter = 4, tomFontAlignmentMax = 4, tomRubyBelow = 0x80, tomRubyAlignCenter = 0, tomRubyAlign010 = 1,
// tomRubyAlign121 = 2, tomRubyAlignLeft = 3, tomRubyAlignRight = 4, tomLimitsDefault = 0, tomLimitsUnderOver = 1, tomLimitsSubSup = 2,
// tomUpperLimitAsSuperScript = 3, tomLimitsOpposite = 4, tomShowLLimPlaceHldr = 8, tomShowULimPlaceHldr = 16, tomDontGrowWithContent =
// 64, tomGrowWithContent = 128, tomSubSupAlign = 1, tomLimitAlignMask = 3, tomLimitAlignCenter = 0, tomLimitAlignLeft = 1,
// tomLimitAlignRight = 2, tomShowDegPlaceHldr = 8, tomAlignDefault = 0, tomAlignMatchAscentDescent = 2, tomMathVariant = 0x20,
// tomStyleDefault = 0, tomStyleScriptScriptCramped = 1, tomStyleScriptScript = 2, tomStyleScriptCramped = 3, tomStyleScript = 4,
// tomStyleTextCramped = 5, tomStyleText = 6, tomStyleDisplayCramped = 7, tomStyleDisplay = 8, tomMathRelSize = 0x40, tomDecDecSize =
// 0xfe, tomDecSize = 0xff, tomIncSize, tomIncIncSize, tomGravityUI = 0, tomGravityBack = 1, tomGravityFore = 2, tomGravityIn = 3,
// tomGravityOut = 4, tomGravityBackward = 0x20000000, tomGravityForward = 0x40000000, tomAdjustCRLF = 1, tomUseCRLF = 2, tomTextize = 4,
// tomAllowFinalEOP = 8, tomFoldMathAlpha = 16, tomNoHidden = 32, tomIncludeNumbering = 64, tomTranslateTableCell = 128,
// tomNoMathZoneBrackets = 0x100, tomConvertMathChar = 0x200, tomNoUCGreekItalic = 0x400, tomAllowMathBold = 0x800, tomLanguageTag =
// 0x1000, tomConvertRTF = 0x2000, tomApplyRtfDocProps = 0x4000, tomPhantomShow = 1, tomPhantomZeroWidth = 2, tomPhantomZeroAscent = 4,
// tomPhantomZeroDescent = 8, tomPhantomTransparent = 16, tomPhantomASmash, tomPhantomDSmash, tomPhantomHSmash, tomPhantomSmash,
// tomPhantomHorz, tomPhantomVert, tomBoxHideTop = 1, tomBoxHideBottom = 2, tomBoxHideLeft = 4, tomBoxHideRight = 8, tomBoxStrikeH = 16,
// tomBoxStrikeV = 32, tomBoxStrikeTLBR = 64, tomBoxStrikeBLTR = 128, tomBoxAlignCenter = 1, tomSpaceMask = 0x1c, tomSpaceDefault = 0,
// tomSpaceUnary = 4, tomSpaceBinary = 8, tomSpaceRelational = 12, tomSpaceSkip = 16, tomSpaceOrd = 20, tomSpaceDifferential = 24,
// tomSizeText = 32, tomSizeScript = 64, tomSizeScriptScript = 96, tomNoBreak = 128, tomTransparentForPositioning = 256,
// tomTransparentForSpacing = 512, tomStretchCharBelow = 0, tomStretchCharAbove = 1, tomStretchBaseBelow = 2, tomStretchBaseAbove = 3,
// tomMatrixAlignMask = 3, tomMatrixAlignCenter = 0, tomMatrixAlignTopRow = 1, tomMatrixAlignBottomRow = 3, tomShowMatPlaceHldr = 8,
// tomEqArrayLayoutWidth = 1, tomEqArrayAlignMask = 0xc, tomEqArrayAlignCenter = 0, tomEqArrayAlignTopRow = 4, tomEqArrayAlignBottomRow =
// 0xc, tomMathManualBreakMask = 0x7f, tomMathBreakLeft = 0x7d, tomMathBreakCenter = 0x7e, tomMathBreakRight = 0x7f, tomMathEqAlign =
// 0x80, tomMathArgShadingStart = 0x251, tomMathArgShadingEnd = 0x252, tomMathObjShadingStart = 0x253, tomMathObjShadingEnd = 0x254,
// tomFunctionTypeNone = 0, tomFunctionTypeTakesArg = 1, tomFunctionTypeTakesLim = 2, tomFunctionTypeTakesLim2 = 3, tomFunctionTypeIsLim
// = 4, tomMathParaAlignDefault = 0, tomMathParaAlignCenterGroup = 1, tomMathParaAlignCenter = 2, tomMathParaAlignLeft = 3,
// tomMathParaAlignRight = 4, tomMathDispAlignMask = 3, tomMathDispAlignCenterGroup = 0, tomMathDispAlignCenter = 1, tomMathDispAlignLeft
// = 2, tomMathDispAlignRight = 3, tomMathDispIntUnderOver = 4, tomMathDispFracTeX = 8, tomMathDispNaryGrow = 0x10,
// tomMathDocEmptyArgMask = 0x60, tomMathDocEmptyArgAuto = 0, tomMathDocEmptyArgAlways = 0x20, tomMathDocEmptyArgNever = 0x40,
// tomMathDocSbSpOpUnchanged = 0x80, tomMathDocDiffMask = 0x300, tomMathDocDiffDefault = 0, tomMathDocDiffUpright = 0x100,
// tomMathDocDiffItalic = 0x200, tomMathDocDiffOpenItalic = 0x300, tomMathDispNarySubSup = 0x400, tomMathDispDef = 0x800,
// tomMathEnableRtl = 0x1000, tomMathBrkBinMask = 0x30000, tomMathBrkBinBefore = 0, tomMathBrkBinAfter = 0x10000, tomMathBrkBinDup =
// 0x20000, tomMathBrkBinSubMask = 0xc0000, tomMathBrkBinSubMM = 0, tomMathBrkBinSubPM = 0x40000, tomMathBrkBinSubMP = 0x80000,
// tomSelRange = 0x255, tomHstring = 0x254, tomFontPropTeXStyle = 0x33c, tomFontPropAlign = 0x33d, tomFontStretch = 0x33e, tomFontStyle =
// 0x33f, tomFontStyleUpright = 0, tomFontStyleOblique = 1, tomFontStyleItalic = 2, tomFontStretchDefault = 0,
// tomFontStretchUltraCondensed = 1, tomFontStretchExtraCondensed = 2, tomFontStretchCondensed = 3, tomFontStretchSemiCondensed = 4,
// tomFontStretchNormal = 5, tomFontStretchSemiExpanded = 6, tomFontStretchExpanded = 7, tomFontStretchExtraExpanded = 8,
// tomFontStretchUltraExpanded = 9, tomFontWeightDefault = 0, tomFontWeightThin = 100, tomFontWeightExtraLight = 200, tomFontWeightLight
// = 300, tomFontWeightNormal = 400, tomFontWeightRegular = 400, tomFontWeightMedium = 500, tomFontWeightSemiBold = 600,
// tomFontWeightBold = 700, tomFontWeightExtraBold = 800, tomFontWeightBlack = 900, tomFontWeightHeavy = 900, tomFontWeightExtraBlack =
// 950, tomParaPropMathAlign = 0x437, tomDocMathBuild = 0x80, tomMathLMargin = 0x81, tomMathRMargin = 0x82, tomMathWrapIndent = 0x83,
// tomMathWrapRight = 0x84, tomMathPostSpace = 0x86, tomMathPreSpace = 0x85, tomMathInterSpace = 0x87, tomMathIntraSpace = 0x88,
// tomCanCopy = 0x89, tomCanRedo = 0x8a, tomCanUndo = 0x8b, tomUndoLimit = 0x8c, tomDocAutoLink = 0x8d, tomEllipsisMode = 0x8e,
// tomEllipsisState = 0x8f, tomEllipsisNone = 0, tomEllipsisEnd = 1, tomEllipsisWord = 3, tomEllipsisPresent = 1, tomVTopCell = 1,
// tomVLowCell = 2, tomHStartCell = 4, tomHContCell = 8, tomRowUpdate = 1, tomRowApplyDefault = 0, tomCellStructureChangeOnly = 1,
// tomRowHeightActual = 0x80b } tomConstants;
[PInvokeData("tom.h", MSDNShortId = "NE:tom.__MIDL___MIDL_itf_tom_0000_0000_0001")]
[Flags]
public enum tomConstants : int
{
/// A tomBool value that indicates false.
tomFalse = 0,
/// A tomBool value that indicates true.
tomTrue = -1,
///
/// A tomBool value that indicates a no-input, no-change value that works with long, float, and COLORREF parameters. For strings,
/// tomUndefined (or NINCH) is represented by the null string. For Set operations, using tomUndefined does not change the target
/// property. For Get operations, tomUndefined means that the characters in the range have different values (it gives the grayed
/// check box in property dialog boxes).
///
tomUndefined = -9999999,
/// A tomBool value that toggles the state of a property.
tomToggle = -9999998,
/// Allow the rich edit control to select the appropriate color.
tomAutoColor = -9999997,
///
/// Set to the document default format for objects that are attached to a range, or to the basic TOM engine default for objects that
/// are not attached to a range.
///
tomDefault = -9999996,
/// Suspend an operation.
tomSuspend = -9999995,
/// Resume an operation.
tomResume = -9999994,
/// Apply the current properties to the attached range.
tomApplyNow = 0,
/// Allow setting property definitions, but don’t apply them to a range yet.
tomApplyLater = 1,
/// Update the current font with the attached range properties.
tomTrackParms = 2,
/// Don’t update the current font with the attached range properties.
tomCacheParms = 3,
/// Apply temporary formatting.
tomApplyTmp = 4,
/// Do not apply smart fonts.
tomDisableSmartFont = 8,
/// Do apply smart fonts.
tomEnableSmartFont = 9,
/// Use points for floating-point measurements.
tomUsePoints = 10,
/// Use twips for floating-point measurements.
tomUseTwips = 11,
/// Move backward toward the start of a story.
tomBackward = unchecked((int)0xc0000001),
/// Move foreward toward the end of a story.
tomForward = 0x3fffffff,
/// Collapse the selection or range to an insertion point and then move the insertion point.
tomMove = 0,
/// Extend a selection or range by moving one of the endpoints.
tomExtend = 1,
/// There is no selection and no insertion point.
tomNoSelection = 0,
/// The selection insertion point.
tomSelectionIP = 1,
/// The selection is a single, nondegenerate text range.
tomSelectionNormal = 2,
/// A frame is selected.
tomSelectionFrame = 3,
/// One or more table columns is selected.
tomSelectionColumn = 4,
/// One or more table rows is selected.
tomSelectionRow = 5,
/// A block is selected.
tomSelectionBlock = 6,
/// The selection is a picture.
tomSelectionInlineShape = 7,
/// A shape is selected.
tomSelectionShape = 8,
/// The starting position of the selection is active.
tomSelStartActive = 1,
///
/// For degenerate selections, the ambiguous character position corresponding to both the beginning of a line and the end of the
/// preceding line should have the caret displayed at the end of the preceding line.
///
tomSelAtEOL = 2,
/// Insert/overtype mode is set to overtype.
tomSelOvertype = 4,
/// Selection is active.
tomSelActive = 8,
/// Typing and pasting replaces the selection.
tomSelReplace = 16,
/// The end of a text range.
tomEnd = 0,
/// The start of range.
tomStart = 32,
/// Collapse to the end position of a range or selection.
tomCollapseEnd = 0,
/// Collapse to the start position of a range or selection.
tomCollapseStart = 1,
/// Use client coordinates instead of screen coordinates.
tomClientCoord = 256,
/// Allow points outside of the client area.
tomAllowOffClient = 512,
/// Transform coordinates using a world transform (XFORM) supplied by the host application.
tomTransform = 1024,
/// Get a point inside an inline object argument; for example, inside the numerator of a fraction.
tomObjectArg = 2048,
/// The end of the specified unit.
tomAtEnd = 4096,
/// No underlining.
tomNone = 0,
/// Single underline.
tomSingle = 1,
/// Underline words only.
tomWords = 2,
/// Double underline.
tomDouble = 3,
/// Dotted underline.
tomDotted = 4,
/// Dash underline.
tomDash = 5,
/// Dash dot underline.
tomDashDot = 6,
/// Dash dot dot underline.
tomDashDotDot = 7,
/// Wave underline.
tomWave = 8,
/// Thick underline.
tomThick = 9,
/// Hair underline.
tomHair = 10,
/// Double wave underline.
tomDoubleWave = 11,
/// Heavy wave underline.
tomHeavyWave = 12,
/// Long dash underline.
tomLongDash = 13,
/// Thick dash underline.
tomThickDash = 14,
/// Thick dash dot underline.
tomThickDashDot = 15,
/// Thick dash dot dot underline.
tomThickDashDotDot = 16,
/// Thick dotted underline.
tomThickDotted = 17,
/// Thick long dash underline.
tomThickLongDash = 18,
/// Single space. The line-spacing value is ignored.
tomLineSpaceSingle = 0,
/// One-and-a-half line spacing. The line-spacing value is ignored.
tomLineSpace1pt5 = 1,
/// Double line spacing. The line-spacing value is ignored.
tomLineSpaceDouble = 2,
///
/// The line-spacing value specifies the spacing from one line to the next. However, if the value is less than single spacing, text
/// is single-spaced.
///
tomLineSpaceAtLeast = 3,
///
/// The line-spacing value specifies the exact spacing from one line to the next, even if the value is less than single spacing.
///
tomLineSpaceExactly = 4,
/// The line-spacing value specifies the line spacing, in lines.
tomLineSpaceMultiple = 5,
/// The line-spacing value specifies the line spacing by percent of line height.
tomLineSpacePercent = 6,
/// Text aligns with the left margin.
tomAlignLeft = 0,
/// Text is centered between the margins.
tomAlignCenter = 1,
/// Text aligns with the right margin.
tomAlignRight = 2,
///
/// Text starts at the left margin and, if the line extends beyond the right margin, all the spaces in the line are adjusted to be even.
///
tomAlignJustify = 3,
/// The decimal point is set at the tab position. This is useful for aligning a column of decimal numbers.
tomAlignDecimal = 3,
///
/// A vertical bar is positioned at the tab position. Text is not affected. Alignment bars on nearby lines at the same position form
/// a continuous vertical line.
///
tomAlignBar = 4,
/// Position at a default tab stop.
tomDefaultTab = 5,
/// Same as tomAlignJustify.
tomAlignInterWord = 3,
/// Same as tomAlignInterLetter, but uses East Asian metrics.
tomAlignNewspaper = 4,
///
/// The first and last characters of each line (except the last line) are aligned to the left and right margins, and lines are filled
/// by adding or subtracting the same amount from each character.
///
tomAlignInterLetter = 5,
/// Same as tomAlignInterLetter, but uses East Asian metrics, and scales the spacing by the width of characters.
tomAlignScaled = 6,
/// Use spaces to fill the spaces taken by a tab character.
tomSpaces = 0,
/// Use dots to fill the spaces taken by a tab character.
tomDots = 1,
/// Use dashes to fill the spaces taken by a tab character.
tomDashes = 2,
/// Use solid lines to fill the spaces taken by a tab character.
tomLines = 3,
/// Use thick solid lines to fill the spaces taken by a tab character.
tomThickLines = 4,
/// Use equal signs to fill the spaces taken by a tab character.
tomEquals = 5,
/// The tab preceding the specified location.
tomTabBack = -3,
/// The next tab following the specified location.
tomTabNext = -2,
/// The tab at the specified location.
tomTabHere = -1,
/// Not a list paragraph.
tomListNone = 0,
/// List uses bullets (0x2022); other bullets are given by > 32.
tomListBullet = 1,
/// List is numbered with Arabic numerals (0, 1, 2, ...).
tomListNumberAsArabic = 2,
/// List is ordered with lowercase letters (a, b, c, ...).
tomListNumberAsLCLetter = 3,
/// List is ordered with uppercase Arabic letters (A, B, C, ...).
tomListNumberAsUCLetter = 4,
/// List is ordered with lowercase Roman letters (i, ii, iii, ...).
tomListNumberAsLCRoman = 5,
/// List is ordered with uppercase Roman letters (I, II, III, ...).
tomListNumberAsUCRoman = 6,
/// The value returned by ITextPara::GetListStart is treated as the first code in a Unicode sequence.
tomListNumberAsSequence = 7,
/// List is ordered with Unicode circled numbers
tomListNumberedCircle = 8,
/// List is ordered with Wingdings black circled digits
tomListNumberedBlackCircleWingding = 9,
/// List is ordered with Wingdings white circled digits:
tomListNumberedWhiteCircleWingding = 10,
/// Full-width ASCII (0, 1, 2, 3, …).
tomListNumberedArabicWide = 11,
/// Chinese with 十 only in items 10 through 99 (一, 二, 三, 四…).
tomListNumberedChS = 12,
/// Chinese with 十 only in items 10 through 19.
tomListNumberedChT = 13,
/// Chinese with a full-width period, no 十.
tomListNumberedJpnChS = 14,
/// Chinese with no 十.
tomListNumberedJpnKor = 15,
/// Arabic alphabetic ( أ ,ب ,ت ,ث ,…).
tomListNumberedArabic1 = 16,
/// Arabic abjadi ( أ ,ب ,ج ,د ,…).
tomListNumberedArabic2 = 17,
/// Hebrew alphabet (א, ב, ג, ד, …).
tomListNumberedHebrew = 18,
/// Thai alphabetic (ก, ข,ค, ง, …).
tomListNumberedThaiAlpha = 19,
/// Thai numbers (๑, ๒,๓, ๔…).
tomListNumberedThaiNum = 20,
/// Hindi vowels (अ, आ, इ, ई, …).
tomListNumberedHindiAlpha = 21,
/// Hindi consonants (क, ख, ग, घ, …).
tomListNumberedHindiAlpha1 = 22,
/// Hindi numbers (१, २, ३, ४, …).
tomListNumberedHindiNum = 23,
/// Encloses the number in parentheses, as in: (1).
tomListParentheses = 0x10000,
/// Follows the number with a period.
tomListPeriod = 0x20000,
/// Uses the number alone.
tomListPlain = 0x30000,
/// Uses no numbers.
tomListNoNumber = 0x40000,
/// Follows the number with a hyphen (-).
tomListMinus = 0x80000,
/// Suppress the numbering style for list items.
tomIgnoreNumberStyle = 0x1000000,
/// The normal paragraph style.
tomParaStyleNormal = -1,
/// The style for level 1 paragraph headings.
tomParaStyleHeading1 = -2,
/// The style for level 2 paragraph headings.
tomParaStyleHeading2 = -3,
/// The style for level 3 paragraph headings.
tomParaStyleHeading3 = -4,
/// The style for level 4 paragraph headings.
tomParaStyleHeading4 = -5,
/// The style for level 5 paragraph headings.
tomParaStyleHeading5 = -6,
/// The style for level 6 paragraph headings.
tomParaStyleHeading6 = -7,
/// The style for level 7 paragraph headings.
tomParaStyleHeading7 = -8,
/// The style for level 8 paragraph headings.
tomParaStyleHeading8 = -9,
/// The style for level 9 paragraph headings.
tomParaStyleHeading9 = -10,
/// The unit is a single character.
tomCharacter = 1,
/// The unit is a word.
tomWord = 2,
/// The unit is a sentence.
tomSentence = 3,
/// The unit is a paragraph.
tomParagraph = 4,
/// The unit is a line.
tomLine = 5,
///
/// The unit is a story; that is, a contiguous range of text that represent a part of a document, such as the main text of the
/// document, headers and footers, footnotes, annotations, and so on.
///
tomStory = 6,
/// The unit is a screenful.
tomScreen = 7,
/// The unit is a section.
tomSection = 8,
/// The unit is a table column.
tomTableColumn = 9,
/// The unit is a text column.
tomColumn = 9,
/// The unit is a table row
tomRow = 0xc,
/// The unit is a window.
tomWindow = 11,
/// The unit is a spreadsheet cell.
tomCell = 12,
/// The unit is a run of constant character formatting.
tomCharFormat = 13,
/// The unit is a run of constant paragraph formatting.
tomParaFormat = 14,
/// The unit is a table.
tomTable = 15,
/// The unit is an embedded object.
tomObject = 16,
/// The unit is a page.
tomPage = 17,
/// The unit is a hard paragraph.
tomHardParagraph = 18,
/// The unit is a cluster of characters.
tomCluster = 19,
/// The unit is an inline object.
tomInlineObject = 20,
/// The unit is an inline object argument.
tomInlineObjectArg = 21,
/// The unit is a leaf-level line.
tomLeafLine = 22,
/// A layout column.
tomLayoutColumn = 23,
/// The identifier of the current process.
tomProcessId = 0x40000001,
/// Match on whole words when doing a text search.
tomMatchWord = 2,
/// A case-sensitive a text search.
tomMatchCase = 4,
/// Match regular expressions when doing a text search.
tomMatchPattern = 8,
/// No special type.
tomUnknownStory = 0,
/// The main story always exists for a rich edit control.
tomMainTextStory = 1,
/// The story used for footnotes.
tomFootnotesStory = 2,
/// The story used for endnotes.
tomEndnotesStory = 3,
/// The story used for comments.
tomCommentsStory = 4,
/// The story used for a text box.
tomTextFrameStory = 5,
/// The story containing headers for even pages.
tomEvenPagesHeaderStory = 6,
/// The story containing headers for odd pages.
tomPrimaryHeaderStory = 7,
/// The story containing footers for even pages.
tomEvenPagesFooterStory = 8,
/// The story containing footers for odd pages.
tomPrimaryFooterStory = 9,
/// The story containing the header for the first page.
tomFirstPageHeaderStory = 10,
/// The story containing the footer for the first page.
tomFirstPageFooterStory = 11,
/// The scratch story.
tomScratchStory = 127,
/// The story used for a Find dialog.
tomFindStory = 128,
/// The story used for a Replace dialog.
tomReplaceStory = 129,
/// Story is inactive.
tomStoryInactive = 0,
/// Story has display, but no UI.
tomStoryActiveDisplay = 1,
/// Story is UI active; that is, it receives keyboard and mouse input.
tomStoryActiveUI = 2,
/// Story has display and UI activity.
tomStoryActiveDisplayUI = 3,
/// Do not apply text animation.
tomNoAnimation = 0,
/// Text is bordered by marquee lights that blink between the colors red, yellow, green, and blue.
tomLasVegasLights = 1,
/// Text has a black background that blinks on and off.
tomBlinkingBackground = 2,
/// Text is overlaid with multicolored stars that blink on and off at regular intervals
tomSparkleText = 3,
///
/// Text is surrounded by a black dashed-line border. The border is animated so that the individual dashes appear to move clockwise
/// around the text.
///
tomMarchingBlackAnts = 4,
/// Text is surrounded by a red dashed-line border that is animated to appear to move clockwise around the text.
tomMarchingRedAnts = 5,
/// Text is alternately blurred and unblurred at regular intervals, to give the appearance of shimmering.
tomShimmer = 6,
/// Text appears gradually from the top down.
tomWipeDown = 7,
/// Text appears gradually from the bottom up.
tomWipeRight = 8,
/// Defines the maximum animation flag value.
tomAnimationMax = 8,
/// Set text to lowercase.
tomLowerCase = 0,
/// Set text to uppercase.
tomUpperCase = 1,
/// Capitalize the first letter of each word.
tomTitleCase = 2,
/// Capitalize the first letter of each sentence.
tomSentenceCase = 4,
/// Toggle the case of each letter.
tomToggleCase = 5,
/// Read only.
tomReadOnly = 0x100,
/// Other programs cannot read.
tomShareDenyRead = 0x200,
/// Other programs cannot write.
tomShareDenyWrite = 0x400,
/// Replace the selection with a file.
tomPasteFile = 0x1000,
/// Create a new file. Fail if the file already exists.
tomCreateNew = 0x10,
/// Create a new file. Destroy the existing file if it exists.
tomCreateAlways = 0x20,
/// Open an existing file. Fail if the file does not exist.
tomOpenExisting = 0x30,
/// Open an existing file. Create a new file if the file does not exist.
tomOpenAlways = 0x40,
/// Open an existing file, but truncate it to zero length.
tomTruncateExisting = 0x50,
/// Open as RTF.
tomRTF = 0x1,
/// Open as text ANSI or Unicode.
tomText = 0x2,
/// Open as HTML.
tomHTML = 0x3,
/// Open as Word document.
tomWordDocument = 0x4,
/// Boldface.
tomBold = unchecked((int)0x80000001),
/// Italic.
tomItalic = unchecked((int)0x80000002),
/// Underline.
tomUnderline = unchecked((int)0x80000004),
/// Strikeout.
tomStrikeout = unchecked((int)0x80000008),
/// Protected.
tomProtected = unchecked((int)0x80000010),
/// Hyperlink.
tomLink = unchecked((int)0x80000020),
/// Small caps.
tomSmallCaps = unchecked((int)0x80000040),
/// All caps.
tomAllCaps = unchecked((int)0x80000080),
/// Hidden.
tomHidden = unchecked((int)0x80000100),
/// Outline.
tomOutline = unchecked((int)0x80000200),
/// Shadow.
tomShadow = unchecked((int)0x80000400),
/// Emboss.
tomEmboss = unchecked((int)0x80000800),
/// Imprint.
tomImprint = unchecked((int)0x80001000),
/// Disabled.
tomDisabled = unchecked((int)0x80002000),
/// Revised.
tomRevised = unchecked((int)0x80004000),
/// Subscript character format.
tomSubscriptCF = unchecked((int)0x80010000),
/// Superscript character format.
tomSuperscriptCF = unchecked((int)0x80020000),
/// Font bound (uses font binding).
tomFontBound = unchecked((int)0x80100000),
/// The link is protected (friendly name link).
tomLinkProtected = unchecked((int)0x80800000),
/// The start delimiter of an inline object.
tomInlineObjectStart = unchecked((int)0x81000000),
///
/// The characters are less common members of a script. A font that supports a script should check if it has glyphs for such characters.
///
tomExtendedChar = unchecked((int)0x82000000),
/// Use system back color.
tomAutoBackColor = unchecked((int)0x84000000),
/// Don't build up operator.
tomMathZoneNoBuildUp = unchecked((int)0x88000000),
/// Math zone.
tomMathZone = unchecked((int)0x90000000),
/// Math zone ordinary text.
tomMathZoneOrdinary = unchecked((int)0xa0000000),
/// Use system text color.
tomAutoTextColor = unchecked((int)0xc0000000),
/// Display math zone.
tomMathZoneDisplay = 0x40000,
/// Right-to-left paragraph
tomParaEffectRTL = 0x1,
/// Keep the paragraph together.
tomParaEffectKeep = 0x2,
/// Keep with next the paragraph.
tomParaEffectKeepNext = 0x4,
/// Put a page break before this paragraph.
tomParaEffectPageBreakBefore = 0x8,
/// No line number for this paragraph.
tomParaEffectNoLineNumber = 0x10,
/// No widow control.
tomParaEffectNoWidowControl = 0x20,
/// Don't hyphenate this paragraph.
tomParaEffectDoNotHyphen = 0x40,
/// Side by side.
tomParaEffectSideBySide = 0x80,
/// Heading contents are collapsed (in outline view).
tomParaEffectCollapsed = 0x100,
/// Outline view nested level.
tomParaEffectOutlineLevel = 0x200,
/// Paragraph has boxed effect (is not displayed).
tomParaEffectBox = 0x400,
/// At or inside table delimiter.
tomParaEffectTableRowDelimiter = 0x1000,
/// Inside or at the start of a table.
tomParaEffectTable = 0x4000,
/// Use East Asian character-pair-width modification.
tomModWidthPairs = 0x1,
/// Use East Asian space-width modification.
tomModWidthSpace = 0x2,
/// Use East Asian auto spacing between alphabetics.
tomAutoSpaceAlpha = 0x4,
/// Use East Asian auto spacing for digits.
tomAutoSpaceNumeric = 0x8,
/// Use East Asian automatic spacing for parentheses or brackets.
tomAutoSpaceParens = 0x10,
/// Embedded font (CLIP_EMBEDDED).
tomEmbeddedFont = 0x20,
/// Double strikeout.
tomDoublestrike = 0x40,
/// Run has overlapping text.
tomOverlapping = 0x80,
/// Normal caret.
tomNormalCaret = 0,
/// The Korean block caret.
tomKoreanBlockCaret = 0x1,
/// NULL caret (caret suppressed).
tomNullCaret = 0x2,
/// Add left/top insets to the client rectangle, and subtract right/bottom insets from the client rectangle.
tomIncludeInset = 0x1,
/// Use the Unicode bidirectional (bidi) algorithm.
tomUnicodeBiDi = 0x1,
/// Check math-zone character formatting.
tomMathCFCheck = 0x4,
/// Don't include text as part of a hyperlink.
tomUnlink = 0x8,
/// Don't insert as hidden text.
tomUnhide = 0x10,
/// Obey the current text limit instead of increasing the text to fit.
tomCheckTextLimit = 0x20,
/// Ignore the font that is active at a particular character position.
tomIgnoreCurrentFont = 0,
/// Match the current character repertoire.
tomMatchCharRep = 0x1,
/// Match the current font signature.
tomMatchFontSignature = 0x2,
/// Use the current font if its character repertoire is tomAnsi.
tomMatchAscii = 0x4,
/// Gets the height.
tomGetHeightOnly = 0x8,
/// Match a math font.
tomMatchMathFont = 0x10,
/// Set the character repertoire based on the specified character set.
tomCharset = unchecked((int)0x80000000),
/// Set the character repertoire based on the specified LCID.
tomCharRepFromLcid = 0x40000000,
/// Latin 1
tomAnsi = 0,
/// From Latin 1 and 2
tomEastEurope = 1,
/// Cyrillic
tomCyrillic = 2,
/// Greek
tomGreek = 3,
/// Turkish (Latin 1 + dotless i, ...)
tomTurkish = 4,
/// Hebrew
tomHebrew = 5,
/// Arabic
tomArabic = 6,
/// From Latin 1 and 2
tomBaltic = 7,
/// Latin 1 with some combining marks
tomVietnamese = 8,
/// Default character repertoire
tomDefaultCharRep = 9,
/// Symbol character set (not Unicode)
tomSymbol = 10,
/// Thai
tomThai = 11,
/// Japanese
tomShiftJIS = 12,
/// Simplified Chinese
tomGB2312 = 13,
/// Hangul
tomHangul = 14,
/// Traditional Chinese
tomBIG5 = 15,
/// PC437 character set (DOS)
tomPC437 = 16,
/// OEM character set (original PC)
tomOEM = 17,
/// Main Macintosh character repertoire
tomMac = 18,
/// Armenian
tomArmenian = 19,
/// Syriac
tomSyriac = 20,
/// Thaana
tomThaana = 21,
/// Devanagari
tomDevanagari = 22,
/// Bangla (formerly Bengali)
tomBengali = 23,
/// Gurmukhi
tomGurmukhi = 24,
/// Gujarati
tomGujarati = 25,
/// Odia (formerly Oriya)
tomOriya = 26,
/// Tamil
tomTamil = 27,
/// Telugu
tomTelugu = 28,
/// Kannada
tomKannada = 29,
/// Malayalam
tomMalayalam = 30,
/// Sinhala
tomSinhala = 31,
/// Lao
tomLao = 32,
/// Tibetan
tomTibetan = 33,
/// Myanmar
tomMyanmar = 34,
/// Georgian
tomGeorgian = 35,
/// Jamo
tomJamo = 36,
/// Ethiopic
tomEthiopic = 37,
/// Cherokee
tomCherokee = 38,
/// Aboriginal
tomAboriginal = 39,
/// Ogham
tomOgham = 40,
/// Runic
tomRunic = 41,
/// Khmer
tomKhmer = 42,
/// Mongolian
tomMongolian = 43,
/// Braille
tomBraille = 44,
/// Yi
tomYi = 45,
/// Limbu
tomLimbu = 46,
/// TaiLe
tomTaiLe = 47,
/// TaiLue
tomNewTaiLue = 48,
/// Syloti Nagri
tomSylotiNagri = 49,
/// Kharoshthi
tomKharoshthi = 50,
/// Kayah Li
tomKayahli = 51,
/// Unicode symbol
tomUsymbol = 52,
/// Emoji
tomEmoji = 53,
/// Glagolitic
tomGlagolitic = 54,
/// Lisu
tomLisu = 55,
/// Vai
tomVai = 56,
/// N'Ko
tomNKo = 57,
/// Osmanya
tomOsmanya = 58,
/// Phags-pa
tomPhagsPa = 59,
/// Gothic
tomGothic = 60,
/// Deseret
tomDeseret = 61,
/// Tifinagh
tomTifinagh = 62,
/// The maximum character repertoire flag value.
tomCharRepMax = 63,
/// Use Microsoft Rich Edit 1.0 mode.
tomRE10Mode = 0x1,
///
/// Use a font with a name that starts with @, for CJK vertical text. When rendered vertically, the characters in such a font are
/// rotated 90 degrees so that they look upright instead of sideways.
///
tomUseAtFont = 0x2,
/// Mask for the following four text orientations.
tomTextFlowMask = 0xc,
/// Ordinary left-to-right horizontal text.
tomTextFlowES = 0,
/// Ordinary East Asian vertical text.
tomTextFlowSW = 0x4,
/// Alternative orientation.
tomTextFlowWN = 0x8,
/// Alternative orientation.
tomTextFlowNE = 0xc,
/// Disables the IME operation (see ES_NOIME).
tomNoIME = 0x80000,
/// Directs the rich edit control to allow the application to handle all IME operations (see ES_SELFIME).
tomSelfIME = 0x40000,
/// Horizontal scrolling is disabled.
tomNoUpScroll = 0x10000,
/// Vertical scrolling is disabled.
tomNoVpScroll = 0x40000,
/// Not a link.
tomNoLink = 0,
/// The URL only; that is, no friendly name.
tomClientLink = 1,
/// The name of friendly name link.
tomFriendlyLinkName = 2,
/// The URL of a friendly name link.
tomFriendlyLinkAddress = 3,
/// The URL of an automatic link.
tomAutoLinkURL = 4,
/// An automatic link to an email address.
tomAutoLinkEmail = 5,
/// An automatic link to a phone number.
tomAutoLinkPhone = 6,
/// An automatic link to a storage location.
tomAutoLinkPath = 7,
/// No compression.
tomCompressNone = 0,
/// Compress punctuation.
tomCompressPunctuation = 1,
/// Compress punctuation and kana.
tomCompressPunctuationAndKana = 2,
/// The maximum compression flag value.
tomCompressMax = 2,
/// Automatically set the underline position.
tomUnderlinePositionAuto = 0,
/// Render underline below text.
tomUnderlinePositionBelow = 1,
/// Render underline above text.
tomUnderlinePositionAbove = 2,
/// The maximum underline position flag value.
tomUnderlinePositionMax = 2,
/// For horizontal layout, align CJK characters on the baseline. For vertical layout, center align CJK characters.
tomFontAlignmentAuto = 0,
/// For horizontal layout, top align CJK characters. For vertical layout, right align CJK characters.
tomFontAlignmentTop = 1,
/// For horizontal or vertical layout, align CJK characters on the baseline.
tomFontAlignmentBaseline = 2,
/// For horizontal layout, bottom align CJK characters. For vertical layout, left align CJK characters.
tomFontAlignmentBottom = 3,
/// For horizontal layout, center CJK characters vertically. For vertical layout, center align CJK characters horizontally.
tomFontAlignmentCenter = 4,
/// The maximum font alignment flag value.
tomFontAlignmentMax = 4,
///
tomRubyBelow = 0x80,
///
tomRubyAlignCenter = 0,
///
tomRubyAlign010 = 1,
///
tomRubyAlign121 = 2,
///
tomRubyAlignLeft = 3,
///
tomRubyAlignRight = 4,
/// Limit locations use document default.
tomLimitsDefault = 0,
/// Limits are placed under and over the operator.
tomLimitsUnderOver = 1,
/// Limits are operator subscript and superscript.
tomLimitsSubSup = 2,
/// The upper limit is a superscript.
tomUpperLimitAsSuperScript = 3,
/// Switch between tomLimitsSubSup and tomLimitsUnderOver.
tomLimitsOpposite = 4,
/// Show empty lower limit placeholder.
tomShowLLimPlaceHldr = 8,
/// Show empty upper limit placeholder.
tomShowULimPlaceHldr = 16,
/// Don't grow the n-ary operator with the argument.
tomDontGrowWithContent = 64,
/// Grow the n-ary operator with the argument.
tomGrowWithContent = 128,
/// Align subscript under superscript.
tomSubSupAlign = 1,
/// Mask for tomLimitAlignCenter, tomLimitAlignLeft, and tomLimitAlignRight.
tomLimitAlignMask = 3,
/// Center limit under base.
tomLimitAlignCenter = 0,
/// Align left ends of limit and base.
tomLimitAlignLeft = 1,
/// Align right ends of limit and base.
tomLimitAlignRight = 2,
/// Show empty radical degree placeholder.
tomShowDegPlaceHldr = 8,
/// Center brackets at baseline.
tomAlignDefault = 0,
/// Use brackets that match the argument ascent and descent.
tomAlignMatchAscentDescent = 2,
/// Bits 7, 6 can have TeX variant enumeration values:
tomMathVariant = 0x20,
/// The math handler determines the style.
tomStyleDefault = 0,
/// The 2nd and higher level subscript superscript size, cramped.
tomStyleScriptScriptCramped = 1,
/// The 2nd and higher level subscript superscript size.
tomStyleScriptScript = 2,
/// The 1st level subscript superscript size, cramped.
tomStyleScriptCramped = 3,
/// The 1st level subscript superscript size.
tomStyleScript = 4,
/// Text size cramped, for example, inside a square root.
tomStyleTextCramped = 5,
/// The standard inline text size.
tomStyleText = 6,
/// Display style cramped.
tomStyleDisplayCramped = 7,
/// Display style.
tomStyleDisplay = 8,
///
/// Indicates one of these is active: tomDecDecSize, tomDecSize, tomIncSize, tomIncIncSize. Note that the maximum size is
/// tomStyleText size, and the minimum size is tomStyleScriptScript size.
///
tomMathRelSize = 0x40,
/// Two sizes smaller than the default.
tomDecDecSize = 0xfe,
/// One size smaller than the default.
tomDecSize = 0xff,
/// One size bigger than the default.
tomIncSize = 1 | tomMathRelSize,
/// Two sizes bigger than the default.
tomIncIncSize = 2 | tomMathRelSize,
/// Use selection user interface rules.
tomGravityUI = 0,
/// Both ends have backward gravity.
tomGravityBack = 1,
/// Both ends have forward gravity.
tomGravityFore = 2,
/// Inward gravity; that is, the start is forward, and the end is backward.
tomGravityIn = 3,
/// Outward gravity; that is, the start is backward, and the end is forward.
tomGravityOut = 4,
///
tomGravityBackward = 0x20000000,
///
tomGravityForward = 0x40000000,
/// Adjust CR/LFs at the start.
tomAdjustCRLF = 1,
/// Use CR/LF in place of a carriage return or a line feed.
tomUseCRLF = 2,
/// Copy up to 0xFFFC (OLE object).
tomTextize = 4,
/// Allow a final end-of-paragraph (EOP) marker.
tomAllowFinalEOP = 8,
/// Fold math alphanumerics to ASCII/Greek.
tomFoldMathAlpha = 16,
/// Don't include hidden text.
tomNoHidden = 32,
/// Include list numbers.
tomIncludeNumbering = 64,
/// Replace table row delimiter characters with spaces.
tomTranslateTableCell = 128,
/// Don't include math zone brackets.
tomNoMathZoneBrackets = 0x100,
///
/// Convert to or from math italic and/or math bold according to the status of italic and bold retrieved by the
/// ITextFont2::GetEffects method.
///
tomConvertMathChar = 0x200,
/// Don’t use math italics for upper-case Greek letters. This value is used with tomConvertMathChar.
tomNoUCGreekItalic = 0x400,
/// Allow math bold. This value is used with tomConvertMathChar.
tomAllowMathBold = 0x800,
/// Get the BCP-47 language tag for this range.
tomLanguageTag = 0x1000,
/// Get text in RTF.
tomConvertRTF = 0x2000,
/// Apply RTF document default properties.
tomApplyRtfDocProps = 0x4000,
/// Display the phantom object's argument.
tomPhantomShow = 1,
/// The phantom object has zero width.
tomPhantomZeroWidth = 2,
/// The phantom object has zero ascent.
tomPhantomZeroAscent = 4,
/// The phantom object has zero descent.
tomPhantomZeroDescent = 8,
/// Space the phantom object as if only the argument is present.
tomPhantomTransparent = 16,
/// Ascent smash.
tomPhantomASmash = tomPhantomShow | tomPhantomZeroAscent,
/// Descent smash.
tomPhantomDSmash = tomPhantomShow | tomPhantomZeroDescent,
/// Horizontal smash.
tomPhantomHSmash = tomPhantomShow | tomPhantomZeroWidth,
/// Full smash.
tomPhantomSmash = tomPhantomShow | tomPhantomZeroAscent | tomPhantomZeroDescent,
/// Horizontal phantom.
tomPhantomHorz = tomPhantomZeroAscent | tomPhantomZeroDescent,
/// Vertical phantom.
tomPhantomVert = tomPhantomZeroWidth,
/// Hide top border.
tomBoxHideTop = 1,
/// Hide bottom border.
tomBoxHideBottom = 2,
/// Hide left border.
tomBoxHideLeft = 4,
/// Hide right border.
tomBoxHideRight = 8,
/// Display horizontal strikethrough.
tomBoxStrikeH = 16,
/// Display vertical strikethrough.
tomBoxStrikeV = 32,
/// Display diagonal strikethrough from the top left to the lower right.
tomBoxStrikeTLBR = 64,
/// Display diagonal strikethrough from the lower left to the top right.
tomBoxStrikeBLTR = 128,
/// Vertically align with center on baseline.
tomBoxAlignCenter = 1,
/// Mask for tomSpaceDefault, tomSpaceUnary, tomSpaceBinary, tomSpaceRelational, tomSpaceSkip, tomSpaceOrd, and tomSpaceDifferential.
tomSpaceMask = 0x1c,
/// Default spacing
tomSpaceDefault = 0,
/// Space the object as if it were a unary operator.
tomSpaceUnary = 4,
/// Space the object as if it were a binary operator.
tomSpaceBinary = 8,
/// Space the object as if it were a relational operator.
tomSpaceRelational = 12,
/// Space the object as if it were a unary operator.
tomSpaceSkip = 16,
/// Space the object as if it were an ordinal operator.
tomSpaceOrd = 20,
/// Space the object as if it were a differential operator.
tomSpaceDifferential = 24,
/// Treat as text size.
tomSizeText = 32,
/// Treat as script size (approximately 73% of text size).
tomSizeScript = 64,
/// Treat as subscript size (approximately 60% of text size).
tomSizeScriptScript = 96,
/// Do not break arguments across a line.
tomNoBreak = 128,
/// Position as if only the argument appears.
tomTransparentForPositioning = 256,
/// Space according to argument properties.
tomTransparentForSpacing = 512,
/// Stretch character below base.
tomStretchCharBelow = 0,
/// Stretch character above base.
tomStretchCharAbove = 1,
/// Stretch base below character.
tomStretchBaseBelow = 2,
/// Stretch base above character.
tomStretchBaseAbove = 3,
/// Mask for tomMatrixAlignCenter, tomMatrixAlignTopRow, and tomMatrixAlignBottomRow.
tomMatrixAlignMask = 3,
/// Align the matrix center on baseline.
tomMatrixAlignCenter = 0,
/// Align the matrix top row on the baseline.
tomMatrixAlignTopRow = 1,
/// Align the matrix bottom row on the baseline.
tomMatrixAlignBottomRow = 3,
/// Show empty element placeholder (a dotted box).
tomShowMatPlaceHldr = 8,
/// Expand the right size to the layout width (for equation number)
tomEqArrayLayoutWidth = 1,
/// Mask for tomEqArrayAlignCenter, tomEqArrayAlignTopRow, and tomEqArrayBottomRow.
tomEqArrayAlignMask = 0xc,
/// Align the center of the equation array on the baseline.
tomEqArrayAlignCenter = 0,
/// Align the top row of the equation on the baseline.
tomEqArrayAlignTopRow = 4,
/// Align the bottom row of the equation on the baseline.
tomEqArrayAlignBottomRow = 0xc,
/// Mask for tomMathBreakLeft, tomMathBreakCenter, and tomMathBreakRight.
tomMathManualBreakMask = 0x7f,
/// Align text following a manual break to the left.
tomMathBreakLeft = 0x7d,
/// Center text following a manual break.
tomMathBreakCenter = 0x7e,
/// Align text following a manual break to the right.
tomMathBreakRight = 0x7f,
/// Math equation alignment.
tomMathEqAlign = 0x80,
/// Start shading math arguments.
tomMathArgShadingStart = 0x251,
/// End shading math arguments.
tomMathArgShadingEnd = 0x252,
/// Start shading math objects.
tomMathObjShadingStart = 0x253,
/// End shading math objects.
tomMathObjShadingEnd = 0x254,
/// Not in the function list.
tomFunctionTypeNone = 0,
/// An ordinary math function that takes arguments.
tomFunctionTypeTakesArg = 1,
/// Use the lower limit for _, and so on.
tomFunctionTypeTakesLim = 2,
/// Turn the preceding FA into an NBSP.
tomFunctionTypeTakesLim2 = 3,
/// A "lim" function.
tomFunctionTypeIsLim = 4,
/// The default alignment for math paragraphs.
tomMathParaAlignDefault = 0,
/// Center math paragraphs as a group.
tomMathParaAlignCenterGroup = 1,
/// Center math paragraphs.
tomMathParaAlignCenter = 2,
/// Left-align math paragraphs.
tomMathParaAlignLeft = 3,
/// Right-align math paragraphs.
tomMathParaAlignRight = 4,
///
/// Mask for tomMathDispAlignCenterGroup, tomMathDispAlignCenter, tomMathDispAlignLeft, tomMathDispAlignRight,
/// tomMathDispIntUnderOver, and tomMathDispNaryGrow.
///
tomMathDispAlignMask = 3,
/// Center a math paragraph as a group.
tomMathDispAlignCenterGroup = 0,
/// Center all equations in a math paragraph.
tomMathDispAlignCenter = 1,
/// Left justify all equations in a math paragraph.
tomMathDispAlignLeft = 2,
/// Right justify all equations in a math paragraph.
tomMathDispAlignRight = 3,
/// Display-mode integral limits location.
tomMathDispIntUnderOver = 4,
/// Indicates whether to use display-mode nested fraction script size.
tomMathDispFracTeX = 8,
/// Indicates whether to use math-paragraph n-ary grow.
tomMathDispNaryGrow = 0x10,
/// Empty arguments display mask.
tomMathDocEmptyArgMask = 0x60,
/// Dotted square, if necessary.
tomMathDocEmptyArgAuto = 0,
/// Dotted square, always.
tomMathDocEmptyArgAlways = 0x20,
/// Nothing.
tomMathDocEmptyArgNever = 0x40,
/// Do not display the underscore (_) as subscripted, or the caret (^) as superscripted.
tomMathDocSbSpOpUnchanged = 0x80,
/// Style mask for the tomMathDocDiffUpright, tomMathDocDiffItalic, tomMathDocDiffOpenItalic options.
tomMathDocDiffMask = 0x300,
/// Use default glyphs for math differentials.
tomMathDocDiffDefault = 0,
/// Use upright glyphs for math differentials.
tomMathDocDiffUpright = 0x100,
/// Use italic glyphs for math differentials.
tomMathDocDiffItalic = 0x200,
/// No glyph change.
tomMathDocDiffOpenItalic = 0x300,
/// Math-paragraph non-integral n-ary limits location.
tomMathDispNarySubSup = 0x400,
/// Math-paragraph spacing defaults. Use math paragraph offsets instead of regular paragraph offsets.
tomMathDispDef = 0x800,
/// Enable right-to-left (RTL) math zones in RTL paragraphs.
tomMathEnableRtl = 0x1000,
/// Equation line break mask.
tomMathBrkBinMask = 0x30000,
/// Break before binary/relational operator.
tomMathBrkBinBefore = 0,
/// Break after binary/relational operator.
tomMathBrkBinAfter = 0x10000,
/// Duplicate binary/relational before/after.
tomMathBrkBinDup = 0x20000,
/// Duplicate mask for minus operator.
tomMathBrkBinSubMask = 0xc0000,
/// -- (minus on both lines).
tomMathBrkBinSubMM = 0,
/// + -
tomMathBrkBinSubPM = 0x40000,
/// - +
tomMathBrkBinSubMP = 0x80000,
/// Set the selection character position and character count to range values.
tomSelRange = 0x255,
/// Use a string handle (HSTRING) instead of a binary string (BSTR).
tomHstring = 0x254,
/// Gets the TeX style of the font.
tomFontPropTeXStyle = 0x33c,
///
/// Use tomFontPropAlign to get the Align property of an operator in a math zone. Here are how the values are assigned:
///
/// - Value 0 implies no special alignment.
/// - Values 1 through 127 align the operator with the (n – 1)st operator on the first line of an equation.
/// - Value 128 identifies operators to be vertically aligned with respect to one another ("Align at =").
/// - Other values are illegal.
///
///
tomFontPropAlign = 0x33d,
///
/// The type of font stretching. It can have one of the following values.
///
/// - tomFontStretchDefault
/// - tomFontStretchUltraCondensed
/// - tomFontStretchExtraCondensed
/// - tomFontStretchCondensed
/// - tomFontStretchNormal
/// - tomFontStretchSemiExpanded
/// - tomFontStretchExpanded
/// - tomFontStretchExtraExpanded
/// - tomFontStretchUltraExpanded
///
///
tomFontStretch = 0x33e,
///
/// The font style. It can have one of the following values.
///
/// - tomFontStyleUpright
/// - tomFontStyleItalic
/// - tomFontStyleOblique
///
///
tomFontStyle = 0x33f,
/// Represents the normal upright font style.
tomFontStyleUpright = 0,
/// Represents an oblique font style.
tomFontStyleOblique = 1,
/// Represents an italic font style.
tomFontStyleItalic = 2,
/// No defined font stretch.
tomFontStretchDefault = 0,
/// An ultra-condensed font stretch (50% of normal).
tomFontStretchUltraCondensed = 1,
/// An extra-condensed font stretch (62.5% of normal).
tomFontStretchExtraCondensed = 2,
/// A condensed font stretch (75% of normal).
tomFontStretchCondensed = 3,
/// A semi-condensed font stretch (87.5% of normal).
tomFontStretchSemiCondensed = 4,
/// The normal font stretch that all other font stretch values relate to (100%).
tomFontStretchNormal = 5,
/// A semi-expanded font stretch (112.5% of normal).
tomFontStretchSemiExpanded = 6,
/// An expanded font stretch (125% of normal).
tomFontStretchExpanded = 7,
/// An extra-expanded font stretch (150% of normal).
tomFontStretchExtraExpanded = 8,
/// An ultra-expanded font stretch (200% of normal).
tomFontStretchUltraExpanded = 9,
/// The default font weight.
tomFontWeightDefault = 0,
/// Thin font weight.
tomFontWeightThin = 100,
/// Extra light font weight.
tomFontWeightExtraLight = 200,
/// Light font weight.
tomFontWeightLight = 300,
/// Normal font weight.
tomFontWeightNormal = 400,
/// Same as tomFontWeightNormal.
tomFontWeightRegular = 400,
/// Medium font weight.
tomFontWeightMedium = 500,
/// Semi bold font weight.
tomFontWeightSemiBold = 600,
/// Bold font weight.
tomFontWeightBold = 700,
/// Extra bold font weight.
tomFontWeightExtraBold = 800,
/// Heavy font weight.
tomFontWeightBlack = 900,
/// Same as tomFontWeightBlack.
tomFontWeightHeavy = 900,
/// Extra heavy font weight.
tomFontWeightExtraBlack = 950,
/// Alignment properties for a math paragraph.
tomParaPropMathAlign = 0x437,
/// Used with the ITextDocument2::SetProperty method to set any combination of tomMathAutoCorrect, tomTeX, or tomMathAlphabetics.
tomDocMathBuild = 0x80,
/// Left margin for display math.
tomMathLMargin = 0x81,
/// Right margin for display math.
tomMathRMargin = 0x82,
/// Equation wrap indent for display math.
tomMathWrapIndent = 0x83,
/// Equation right wrap indent for display math (in a left-to-right (LTR) math zone).
tomMathWrapRight = 0x84,
/// Space after a display math equation.
tomMathPostSpace = 0x86,
/// Space before a display math equation.
tomMathPreSpace = 0x85,
/// Space between equations in math paragraphs.
tomMathInterSpace = 0x87,
/// Space between lines in a display math equation.
tomMathIntraSpace = 0x88,
/// Indicates whether data can be copied to the clipboard.
tomCanCopy = 0x89,
/// Indicates whether one or more redo operations exist.
tomCanRedo = 0x8a,
/// Indicates whether one or more undo operations exist.
tomCanUndo = 0x8b,
/// The undo stack count limit.
tomUndoLimit = 0x8c,
/// A document automatic link.
tomDocAutoLink = 0x8d,
/// The ellipsis mode.
tomEllipsisMode = 0x8e,
/// The ellipsis state.
tomEllipsisState = 0x8f,
/// Ellipsis is disabled.
tomEllipsisNone = 0,
/// An ellipsis forces a break anywhere in the line.
tomEllipsisEnd = 1,
/// An ellipsis forces a break between words.
tomEllipsisWord = 3,
/// Ellipsis is present.
tomEllipsisPresent = 1,
/// The top cell in vertically merged cell set.
tomVTopCell = 1,
/// Any cell except the top cell in a vertically merged cell set.
tomVLowCell = 2,
/// Start a cell in a horizontally merged cell set.
tomHStartCell = 4,
/// Any cell except the start in a horizontally merged cell set.
tomHContCell = 8,
/// Update the row to have the properties of the table row identified by the associated text range.
tomRowUpdate = 1,
///
tomRowApplyDefault = 0,
///
/// Changes cell width(s) or cell count (for changing column widths and inserting/deleting columns without changing cell border
/// properties, and so forth.)
///
tomCellStructureChangeOnly = 1,
/// The actual height of a table row.
tomRowHeightActual = 0x80b,
}
/// Represents the displays collection for this Text Object Model (TOM) engine instance.
/// This interface is currently undefined.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextdisplays
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextDisplays")]
[ComImport, Guid("C241F5F2-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextDisplays
{
}
///
///
/// The ITextDocument interface is the Text Object Model (TOM) top-level interface, which retrieves the active selection and range
/// objects for any story in the documentâwhether active or not. It enables the application to:
///
///
/// -
/// Open and save documents.
///
/// -
/// Control undo behavior and screen updating.
///
/// -
/// Find a range from a screen position.
///
/// -
/// Get an ITextStoryRanges story enumerator.
///
///
/// When to Implement
///
/// Applications typically do not implement the ITextDocument interface. Microsoft text solutions, such as rich edit controls,
/// implement ITextDocument as part of their TOM implementation.
///
/// When to Use
///
/// Applications can retrieve an ITextDocument pointer from a rich edit control. To do this, send an EM_GETOLEINTERFACE message to
/// retrieve an IRichEditOle object from a rich edit control. Then, call the object's IUnknown::QueryInterface method to retrieve an
/// ITextDocument pointer.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextdocument
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextDocument")]
[ComImport, Guid("8CC497C0-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)]
public interface ITextDocument
{
/// Gets the file name of this document. This is the ITextDocument default property.
///
/// Type: BSTR*
/// The file name.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getname HRESULT GetName( BSTR *pName );
string GetName();
/// Gets the active selection.
///
/// Type: ITextSelection**
/// The active selection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getselection HRESULT GetSelection( ITextSelection
// **ppSel );
ITextSelection GetSelection();
/// Gets the count of stories in this document.
///
/// Type: LONG*
/// The number of stories in the document.
///
///
/// Rich edit controls have only one story and do not implement the ITextDocument::GetStoryRanges method. To avoid getting an error
/// when there is only one story, use ITextDocument::GetStoryCount to check the story count. If the story count is greater
/// than one, then call ITextDocument::GetStoryRanges.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getstorycount HRESULT GetStoryCount( long *pCount );
int GetStoryCount();
/// Gets the story collection object used to enumerate the stories in a document.
///
/// Type: ITextStoryRanges**
/// The ITextStoryRanges pointer.
///
/// Invoke this method only if ITextDocument::GetStoryCount returns a value greater than 1.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getstoryranges HRESULT GetStoryRanges(
// ITextStoryRanges **ppStories );
ITextStoryRanges GetStoryRanges();
/// Gets a value that indicates whether changes have been made since the file was last saved.
///
/// Type: long*
///
/// The value tomTrue if no changes have been made since the file was last saved, or the value tomFalse if there are
/// unsaved changes.
///
///
/// To set the saved property, call the ITextDocument::SetSaved method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getsaved HRESULT GetSaved( long *pValue );
tomConstants GetSaved();
/// Sets the document Saved property.
///
/// Type: long
/// New value of the Saved property. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// No changes to the file since the last time it was saved.
///
/// -
/// tomFalse
/// There are changes to the file.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-setsaved HRESULT SetSaved( [in] long Value );
void SetSaved(tomConstants Value);
/// Gets the default tab width.
///
/// Type: float*
/// The default tab width.
///
///
/// The default tab width is used whenever no tab exists beyond the current display position. The default width is given in
/// floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getdefaulttabstop HRESULT GetDefaultTabStop( float
// *pValue );
float GetDefaultTabStop();
/// Sets the default tab stop, which is used when no tab exists beyond the current display position.
///
/// Type: float
/// New default tab setting, in floating-point points. Default value is 36.0 points, that is, 0.5 inches.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-setdefaulttabstop HRESULT SetDefaultTabStop( [in]
// float Value );
void SetDefaultTabStop(float Value);
/// Opens a new document.
///
/// If another document is open, this method saves any current changes and closes the current document before opening a new one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-new HRESULT New();
void New();
///
/// Opens a specified document. There are parameters to specify access and sharing privileges, creation and conversion of the file,
/// as well as the code page for the file.
///
///
/// Type: VARIANT*
/// A VARIANT that specifies the name of the file to open.
///
///
/// Type: long
///
/// The file creation, open, share, and conversion flags. Default value is zero, which gives read/write access and read/write
/// sharing, open always, and automatic recognition of the file format (unrecognized file formats are treated as text). Other values
/// are defined in the following groups.
///
/// Any combination of these values may be used.
/// tomReadOnly
/// tomShareDenyRead
/// tomShareDenyWrite
/// tomPasteFile
/// These values are mutually exclusive.
/// tomCreateNew
/// tomCreateAlways
/// tomOpenExisting
/// tomOpenAlways
/// tomTruncateExisting
/// tomRTF
/// tomText
/// tomHTML
/// tomWordDocument
///
///
/// Type: long
///
/// The code page to use for the file. Zero (the default value) means CP_ACP (ANSI code page) unless the file begins with a
/// Unicode BOM 0xfeff, in which case the file is considered to be Unicode. Note that code page 1200 is Unicode, CP_UTF8 is UTF-8.
///
///
///
///
/// If a document is created with the ITextDocument::New method and the zero values are used, then the Text Object Model (TOM) engine
/// has to choose which flags and code page to use. UTF-8Â Rich Text Format (RTF) (defined below) is an attractive default.
///
///
/// Microsoft Rich Edit 3.0 defines a control word, \urtf8, which should be used instead of \rtf1. This means the file is encoded in
/// UTF-8. On input, RTF files contain the relevant code-page information, but this can be changed for saving purposes, thereby
/// allowing one version to be translated to another.
///
///
/// If the tomPasteFile flag is not set in the Flags parameter, the method first closes the current document after saving any
/// unsaved changes.
///
///
/// A file is recognized as a Unicode text file if it starts with the Unicode BOM 0xfeff. The ITextDocument::Open method
/// strips off this Unicode BOM on input and ITextDocument::Save applies it on output. See the comments on the
/// ITextDocument::Save method, which discuss putting the Unicode BOM at the beginning of Unicode plain-text files. The
/// conversion values tomRTF, tomHTML, and tomWordDocument are used primarily for the ITextDocument::Save
/// method, since these formats are easily recognized on input.
///
///
/// Errors are reported by negative values, but because file operations have many kinds of errors, you may not need all of the error
/// information provided. In particular, you may not care (or you may already know) which file facility is used, namely Windows () or
/// OLE storage for IStorage. By masking off bit 18 of an HRESULT value, you can ignore the difference and compare to its
/// STG_E_xxx value. For example:
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-open HRESULT Open( [in] VARIANT *pVar, long Flags,
// long CodePage );
void Open([In] object pVar, [Optional] tomConstants Flags, [Optional] uint CodePage);
/// Saves the document.
///
/// Type: VARIANT*
/// The save target. This parameter is a VARIANT, which can be a file name, or NULL.
///
///
/// Type: long
/// File creation, open, share, and conversion flags. For a list of possible values, see ITextDocument::Open.
///
///
/// Type: long
/// The specified code page. Common values are CP_ACP (zero: system ANSI code page), 1200 (Unicode), and 1208 (UTF-8).
///
///
/// To use the parameters that were specified for opening the file, use zero values for the parameters.
///
/// If pVar is null or missing, the file name given by this document's name is used. If both of these are missing or null, the
/// method fails.
///
///
/// If pVar specifies a file name, that name should replace the current Name property. Similarly, the Flags and
/// CodePage arguments can overrule those supplied in the ITextDocument::Open method and define the values to use for files
/// created with the ITextDocument::New method.
///
///
/// Unicode plain-text files should be saved with the Unicode byte-order mark (0xFEFF) as the first character. This character should
/// be removed when the file is read in; that is, it is only used for import/export to identify the plain text as Unicode and to
/// identify the byte order of that text. Microsoft Notepad adopted this convention, which is now recommended by the Unicode standard.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-save HRESULT Save( [in] VARIANT *pVar, [in] long
// Flags, [in] long CodePage );
void Save([In] object pVar, tomConstants Flags, uint CodePage);
/// Increments the freeze count.
///
/// Type: long*
/// The updated freeze count.
///
///
/// If the freeze count is nonzero, screen updating is disabled. This allows a sequence of editing operations to be performed without
/// the performance loss and flicker of screen updating. To decrement the freeze count, call the ITextDocument::Unfreeze method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-freeze HRESULT Freeze( long *pCount );
int Freeze();
/// Decrements the freeze count.
///
/// Type: long*
/// The updated freeze count.
///
///
///
/// If the freeze count goes to zero, screen updating is enabled. This method cannot decrement the count below zero, and no error
/// occurs if it is executed with a zero freeze count.
///
/// Note, if edit collection is active, screen updating is suppressed, even if the freeze count is zero.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-unfreeze HRESULT Unfreeze( long *pCount );
int Unfreeze();
/// Turns on edit collection (also called undo grouping).
/// A single Undo command undoes all changes made while edit collection is turned on.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-begineditcollection HRESULT BeginEditCollection();
void BeginEditCollection();
/// Turns off edit collection (also called undo grouping).
/// The screen is unfrozen unless the freeze count is nonzero.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-endeditcollection HRESULT EndEditCollection();
void EndEditCollection();
/// Performs a specified number of undo operations.
///
/// Type: long
///
/// The specified number of undo operations. If the value of this parameter is tomFalse, undo processing is suspended. If this
/// parameter is tomTrue, undo processing is restored.
///
///
///
/// Type: long*
/// The actual count of undo operations performed. This parameter can be NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-undo HRESULT Undo( long Count, long *pCount );
int Undo(int Count);
/// Performs a specified number of redo operations.
///
/// Type: long
/// The number of redo operations specified.
///
///
/// Type: long*
/// The actual count of redo operations performed. This parameter can be NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-redo HRESULT Redo( long Count, long *pCount );
int Redo(int Count);
/// Retrieves a text range object for a specified range of content in the active story of the document.
///
/// Type: long
/// The start position of new range. The default value is zero, which represents the start of the document.
///
///
/// Type: long
/// The end position of new range. The default value is zero.
///
///
/// Type: ITextRange**
/// Address of a pointer to a variable of type ITextRange that receives a pointer to the specified text range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-range HRESULT Range( long cpActive, long cpAnchor,
// ITextRange **ppRange );
ITextRange Range(int cpActive, int cpAnchor);
/// Retrieves a range for the content at or nearest to the specified point on the screen.
///
/// Type: long
/// The horizontal coordinate of the specified point, in screen coordinates.
///
///
/// Type: long
/// The vertical coordinate of the specified point, in screen coordinates.
///
///
/// Type: ITextRange**
/// The text range that corresponds to the specified point.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-rangefrompoint HRESULT RangeFromPoint( long x, long
// y, ITextRange **ppRange );
ITextRange RangeFromPoint(int x, int y);
}
///
///
/// Extends the ITextDocument interface, adding methods that enable the Input Method Editor (IME) to drive the rich edit control, and
/// methods to retrieve other interfaces such as ITextDisplays, ITextRange2, ITextFont2, ITextPara2, and so on.
///
///
/// Some ITextDocument2 methods used with the IME need access to the current window handle ( HWND). Use the
/// ITextDocument2::GetWindow method to retrieve the handle.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextdocument2
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextDocument2")]
[ComImport, Guid("C241F5E0-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsDual)]
public interface ITextDocument2 : ITextDocument
{
/// Gets the file name of this document. This is the ITextDocument default property.
///
/// Type: BSTR*
/// The file name.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getname HRESULT GetName( BSTR *pName );
new string GetName();
/// Gets the active selection.
///
/// Type: ITextSelection**
/// The active selection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getselection HRESULT GetSelection( ITextSelection
// **ppSel );
new ITextSelection GetSelection();
/// Gets the count of stories in this document.
///
/// Type: LONG*
/// The number of stories in the document.
///
///
/// Rich edit controls have only one story and do not implement the ITextDocument::GetStoryRanges method. To avoid getting an error
/// when there is only one story, use ITextDocument::GetStoryCount to check the story count. If the story count is greater
/// than one, then call ITextDocument::GetStoryRanges.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getstorycount HRESULT GetStoryCount( long *pCount );
new int GetStoryCount();
/// Gets the story collection object used to enumerate the stories in a document.
///
/// Type: ITextStoryRanges**
/// The ITextStoryRanges pointer.
///
/// Invoke this method only if ITextDocument::GetStoryCount returns a value greater than 1.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getstoryranges HRESULT GetStoryRanges(
// ITextStoryRanges **ppStories );
new ITextStoryRanges GetStoryRanges();
/// Gets a value that indicates whether changes have been made since the file was last saved.
///
/// Type: long*
///
/// The value tomTrue if no changes have been made since the file was last saved, or the value tomFalse if there are
/// unsaved changes.
///
///
/// To set the saved property, call the ITextDocument::SetSaved method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getsaved HRESULT GetSaved( long *pValue );
new tomConstants GetSaved();
/// Sets the document Saved property.
///
/// Type: long
/// New value of the Saved property. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// No changes to the file since the last time it was saved.
///
/// -
/// tomFalse
/// There are changes to the file.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-setsaved HRESULT SetSaved( [in] long Value );
new void SetSaved(tomConstants Value);
/// Gets the default tab width.
///
/// Type: float*
/// The default tab width.
///
///
/// The default tab width is used whenever no tab exists beyond the current display position. The default width is given in
/// floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-getdefaulttabstop HRESULT GetDefaultTabStop( float
// *pValue );
new float GetDefaultTabStop();
/// Sets the default tab stop, which is used when no tab exists beyond the current display position.
///
/// Type: float
/// New default tab setting, in floating-point points. Default value is 36.0 points, that is, 0.5 inches.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-setdefaulttabstop HRESULT SetDefaultTabStop( [in]
// float Value );
new void SetDefaultTabStop(float Value);
/// Opens a new document.
///
/// If another document is open, this method saves any current changes and closes the current document before opening a new one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-new HRESULT New();
new void New();
///
/// Opens a specified document. There are parameters to specify access and sharing privileges, creation and conversion of the file,
/// as well as the code page for the file.
///
///
/// Type: VARIANT*
/// A VARIANT that specifies the name of the file to open.
///
///
/// Type: long
///
/// The file creation, open, share, and conversion flags. Default value is zero, which gives read/write access and read/write
/// sharing, open always, and automatic recognition of the file format (unrecognized file formats are treated as text). Other values
/// are defined in the following groups.
///
/// Any combination of these values may be used.
/// tomReadOnly
/// tomShareDenyRead
/// tomShareDenyWrite
/// tomPasteFile
/// These values are mutually exclusive.
/// tomCreateNew
/// tomCreateAlways
/// tomOpenExisting
/// tomOpenAlways
/// tomTruncateExisting
/// tomRTF
/// tomText
/// tomHTML
/// tomWordDocument
///
///
/// Type: long
///
/// The code page to use for the file. Zero (the default value) means CP_ACP (ANSI code page) unless the file begins with a
/// Unicode BOM 0xfeff, in which case the file is considered to be Unicode. Note that code page 1200 is Unicode, CP_UTF8 is UTF-8.
///
///
///
///
/// If a document is created with the ITextDocument::New method and the zero values are used, then the Text Object Model (TOM) engine
/// has to choose which flags and code page to use. UTF-8Â Rich Text Format (RTF) (defined below) is an attractive default.
///
///
/// Microsoft Rich Edit 3.0 defines a control word, \urtf8, which should be used instead of \rtf1. This means the file is encoded in
/// UTF-8. On input, RTF files contain the relevant code-page information, but this can be changed for saving purposes, thereby
/// allowing one version to be translated to another.
///
///
/// If the tomPasteFile flag is not set in the Flags parameter, the method first closes the current document after saving any
/// unsaved changes.
///
///
/// A file is recognized as a Unicode text file if it starts with the Unicode BOM 0xfeff. The ITextDocument::Open method
/// strips off this Unicode BOM on input and ITextDocument::Save applies it on output. See the comments on the
/// ITextDocument::Save method, which discuss putting the Unicode BOM at the beginning of Unicode plain-text files. The
/// conversion values tomRTF, tomHTML, and tomWordDocument are used primarily for the ITextDocument::Save
/// method, since these formats are easily recognized on input.
///
///
/// Errors are reported by negative values, but because file operations have many kinds of errors, you may not need all of the error
/// information provided. In particular, you may not care (or you may already know) which file facility is used, namely Windows () or
/// OLE storage for IStorage. By masking off bit 18 of an HRESULT value, you can ignore the difference and compare to its
/// STG_E_xxx value. For example:
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-open HRESULT Open( [in] VARIANT *pVar, long Flags,
// long CodePage );
new void Open([In] object pVar, tomConstants Flags, uint CodePage);
/// Saves the document.
///
/// Type: VARIANT*
/// The save target. This parameter is a VARIANT, which can be a file name, or NULL.
///
///
/// Type: long
/// File creation, open, share, and conversion flags. For a list of possible values, see ITextDocument::Open.
///
///
/// Type: long
/// The specified code page. Common values are CP_ACP (zero: system ANSI code page), 1200 (Unicode), and 1208 (UTF-8).
///
///
/// To use the parameters that were specified for opening the file, use zero values for the parameters.
///
/// If pVar is null or missing, the file name given by this document's name is used. If both of these are missing or null, the
/// method fails.
///
///
/// If pVar specifies a file name, that name should replace the current Name property. Similarly, the Flags and
/// CodePage arguments can overrule those supplied in the ITextDocument::Open method and define the values to use for files
/// created with the ITextDocument::New method.
///
///
/// Unicode plain-text files should be saved with the Unicode byte-order mark (0xFEFF) as the first character. This character should
/// be removed when the file is read in; that is, it is only used for import/export to identify the plain text as Unicode and to
/// identify the byte order of that text. Microsoft Notepad adopted this convention, which is now recommended by the Unicode standard.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-save HRESULT Save( [in] VARIANT *pVar, [in] long
// Flags, [in] long CodePage );
new void Save([In] object pVar, tomConstants Flags, uint CodePage);
/// Increments the freeze count.
///
/// Type: long*
/// The updated freeze count.
///
///
/// If the freeze count is nonzero, screen updating is disabled. This allows a sequence of editing operations to be performed without
/// the performance loss and flicker of screen updating. To decrement the freeze count, call the ITextDocument::Unfreeze method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-freeze HRESULT Freeze( long *pCount );
new int Freeze();
/// Decrements the freeze count.
///
/// Type: long*
/// The updated freeze count.
///
///
///
/// If the freeze count goes to zero, screen updating is enabled. This method cannot decrement the count below zero, and no error
/// occurs if it is executed with a zero freeze count.
///
/// Note, if edit collection is active, screen updating is suppressed, even if the freeze count is zero.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-unfreeze HRESULT Unfreeze( long *pCount );
new int Unfreeze();
/// Turns on edit collection (also called undo grouping).
/// A single Undo command undoes all changes made while edit collection is turned on.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-begineditcollection HRESULT BeginEditCollection();
new void BeginEditCollection();
/// Turns off edit collection (also called undo grouping).
/// The screen is unfrozen unless the freeze count is nonzero.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-endeditcollection HRESULT EndEditCollection();
new void EndEditCollection();
/// Performs a specified number of undo operations.
///
/// Type: long
///
/// The specified number of undo operations. If the value of this parameter is tomFalse, undo processing is suspended. If this
/// parameter is tomTrue, undo processing is restored.
///
///
///
/// Type: long*
/// The actual count of undo operations performed. This parameter can be NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-undo HRESULT Undo( long Count, long *pCount );
new int Undo(int Count);
/// Performs a specified number of redo operations.
///
/// Type: long
/// The number of redo operations specified.
///
///
/// Type: long*
/// The actual count of redo operations performed. This parameter can be NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-redo HRESULT Redo( long Count, long *pCount );
new int Redo(int Count);
/// Retrieves a text range object for a specified range of content in the active story of the document.
///
/// Type: long
/// The start position of new range. The default value is zero, which represents the start of the document.
///
///
/// Type: long
/// The end position of new range. The default value is zero.
///
///
/// Type: ITextRange**
/// Address of a pointer to a variable of type ITextRange that receives a pointer to the specified text range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-range HRESULT Range( long cpActive, long cpAnchor,
// ITextRange **ppRange );
new ITextRange Range(int cpActive, int cpAnchor);
/// Retrieves a range for the content at or nearest to the specified point on the screen.
///
/// Type: long
/// The horizontal coordinate of the specified point, in screen coordinates.
///
///
/// Type: long
/// The vertical coordinate of the specified point, in screen coordinates.
///
///
/// Type: ITextRange**
/// The text range that corresponds to the specified point.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument-rangefrompoint HRESULT RangeFromPoint( long x, long
// y, ITextRange **ppRange );
new ITextRange RangeFromPoint(int x, int y);
/// Gets the caret type.
///
/// Type: long*
/// The caret type. It can be one of the following values:
/// tomKoreanBlockCaret
/// tomNormalCaret
/// tomNullCaret
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getcarettype HRESULT GetCaretType( [out, retval]
// long *pValue );
tomConstants GetCaretType();
/// Sets the caret type.
///
/// Type: long
/// The new caret type. It can be one of the following values:
/// tomKoreanBlockCaret
/// tomNormalCaret
/// tomNullCaret
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setcarettype HRESULT SetCaretType( [in] long Value );
void SetCaretType(tomConstants Value);
/// Gets the displays collection for this Text Object Model (TOM) engine instance.
///
/// Type: ITextDisplays**
/// The displays collection.
///
/// The rich edit control doesn't implement this method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getdisplays HRESULT GetDisplays( [out, retval]
// ITextDisplays **ppDisplays );
ITextDisplays GetDisplays();
///
/// Gets an object that provides the default character format information for this instance of the Text Object Model (TOM) engine.
///
///
/// Type: ITextFont2**
/// The object that provides the default character format information.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getdocumentfont HRESULT GetDocumentFont( [out,
// retval] ITextFont2 **ppFont );
ITextFont2 GetDocumentFont();
/// Sets the default character formatting for this instance of the Text Object Model (TOM) engine.
///
/// Type: ITextFont2*
/// The font object that provides the default character formatting.
///
/// You can also set the default character formatting by calling ITextFont::Reset(tomDefault).
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setdocumentfont HRESULT SetDocumentFont( [in]
// ITextFont2 *pFont );
void SetDocumentFont([In, Optional] ITextFont2? pFont);
///
/// Gets an object that provides the default paragraph format information for this instance of the Text Object Model (TOM) engine.
///
///
/// Type: ITextPara2**
/// The object that provides the default paragraph format information.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getdocumentpara HRESULT GetDocumentPara( [out,
// retval] ITextPara2 **ppPara );
ITextPara2 GetDocumentPara();
/// Sets the default paragraph formatting for this instance of the Text Object Model (TOM) engine.
///
/// Type: ITextPara2*
/// The paragraph object that provides the default paragraph formatting
///
/// You can also set the default paragraph formatting by calling ITextPara::Reset(tomDefault).
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setdocumentpara HRESULT SetDocumentPara( [in]
// ITextPara2 *pPara );
void SetDocumentPara([In, Optional] ITextPara2? pPara);
/// Gets the East Asian flags.
///
/// Type: long*
/// The East Asian flags. This parameter can be a combination of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomRE10Mode
/// TOM version 1.0 emulation mode.
///
/// -
/// tomUseAtFont
/// Use @ fonts for CJK vertical text.
///
/// -
/// tomTextFlowMask
///
/// A mask for the following four text orientations: tomTextFlowES Ordinary left-to-right horizontal text.
/// tomTextFlowSW Ordinary East Asian vertical text. tomTextFlowWN An alternative orientation. tomTextFlowNE An
/// alternative orientation.
///
///
/// -
/// tomUsePassword
/// Use password control.
///
/// -
/// tomNoIME
/// Turn off IME operation (see ES_NOIME).
///
/// -
/// tomSelfIME
/// The rich edit host handles IME operation (see ES_SELFIME) .
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-geteastasianflags HRESULT GetEastAsianFlags( [out,
// retval] long *pFlags );
tomConstants GetEastAsianFlags();
/// Gets the name of the Text Object Model (TOM) engine.
///
/// Type: BSTR*
/// The name of the TOM engine.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getgenerator HRESULT GetGenerator( [out, retval]
// BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
string GetGenerator();
/// Sets the state of the Input Method Editor (IME) in-progress flag.
///
/// Type: long
/// Use tomTrue to turn on the IME in-progress flag, or tomFalse to turn it off.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setimeinprogress HRESULT SetIMEInProgress( [in] long
// Value );
void SetIMEInProgress(tomConstants Value);
/// Gets the notification mode.
///
/// Type: long*
/// The notification mode. This parameter is set to tomTrue if notifications are active, or tomFalse if not.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getnotificationmode HRESULT GetNotificationMode(
// [out, retval] long *pValue );
tomConstants GetNotificationMode();
/// Sets the notification mode.
///
/// Type: long
/// The notification mode. Use tomTrue to turn on notifications, or tomFalse to turn them off.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setnotificationmode HRESULT SetNotificationMode(
// [in] long Value );
void SetNotificationMode(tomConstants Value);
/// Gets the active selection.
///
/// Type: ITextSelection2**
/// The active selection. This parameter is NULL if the rich edit control is not in-place active.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getselection2 HRESULT GetSelection2( [out, retval]
// ITextSelection2 **ppSel );
ITextSelection2 GetSelection2();
/// Gets an object for enumerating the stories in a document.
///
/// Type: ITextStoryRanges2**
/// The object for enumerating stories.
///
/// Call this method only if the ITextDocument::GetStoryCount method returns a value that is greater than one.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getstoryranges2 HRESULT GetStoryRanges2( [out,
// retval] ITextStoryRanges2 **ppStories );
ITextStoryRanges2 GetStoryRanges2();
/// Gets the typography options.
///
/// Type: long*
/// A combination of the following typography options.
///
///
/// Value
/// Meaning
///
/// -
/// TO_ADVANCEDTYPOGRAPHY
/// Advanced typography (special line breaking and line formatting) is turned on.
///
/// -
/// TO_SIMPLELINEBREAK
/// Normal line breaking and formatting is used.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-gettypographyoptions HRESULT GetTypographyOptions(
// [out, retval] long *pOptions );
TO GetTypographyOptions();
/// Gets the version number of the Text Object Model (TOM) engine.
///
/// Type: long*
///
/// The version number. Byte 3 gives the major version number, byte 2 the minor version number, and the low-order 16 bits give the
/// build number.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getversion HRESULT GetVersion( [out, retval] long
// *pValue );
int GetVersion();
/// Gets the handle of the window that the Text Object Model (TOM) engine is using to display output.
///
/// Type: __int64*
/// The handle of the window that the TOM engine is using.
///
///
///
/// A rich edit control doesn't need to own the window that the TOM engine is using. For example, the rich edit control might be windowless.
///
///
/// The Input Method Editor (IME) needs the handle of the window that is receiving keyboard messages. This method retrieves that handle.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getwindow HRESULT GetWindow( [out, retval] __int64
// *pHwnd );
HWND GetWindow();
///
/// Attaches a new message filter to the edit instance. All window messages that the edit instance receives are forwarded to the
/// message filter.
///
///
/// Type: IUnknown*
/// The message filter.
///
/// The message filter must be bound to the document before it can be used.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-attachmsgfilter HRESULT AttachMsgFilter( [in]
// IUnknown *pFilter );
void AttachMsgFilter([In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pFilter);
/// Checks whether the number of characters to be added would exceed the maximum text limit.
///
/// Type: long
/// The number of characters to be added.
///
///
/// Type: long*
///
/// The number of characters that exceed the maximum text limit. This parameter is 0 if the number of characters does not exceed the limit.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-checktextlimit HRESULT CheckTextLimit( [in] long
// cch, [out] long *pcch );
void CheckTextLimit(int cch, out int pcch);
/// Gets the call manager.
///
/// Type: IUnknown**
/// The call manager object.
///
///
/// The call manager object is opaque to the caller. The Text Object Model (TOM) engine uses the object to handle internal
/// notifications for particular scenarios.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getcallmanager HRESULT GetCallManager( [out, retval]
// IUnknown **ppVoid );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetCallManager();
/// Retrieves the client rectangle of the rich edit control.
///
/// Type: long
/// The client rectangle retrieval options. It can be a combination of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomClientCoord
///
/// Retrieve the rectangle in client coordinates. If this value isn't specified, the function retrieves screen coordinates.
///
///
/// -
/// tomIncludeInset
///
/// Add left and top insets to the left and top coordinates of the client rectangle, and subtract right and bottom insets from the
/// right and bottom coordinates.
///
///
/// -
/// tomTransform
/// Use a world transform (XFORM) provided by the host application to transform the retrieved rectangle coordinates.
///
///
///
///
/// Type: long*
/// The x-coordinate of the upper-left corner of the rectangle.
///
///
/// Type: long*
/// The y-coordinate of the upper-left corner of the rectangle.
///
///
/// Type: long*
/// The x-coordinate of the lower-right corner of the rectangle.
///
///
/// Type: long*
/// The y-coordinate of the lower-right corner of the rectangle.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getclientrect HRESULT GetClientRect( [in] long Type,
// [out] long *pLeft, [out] long *pTop, [out] long *pRight, [out] long *pBottom );
void GetClientRect(tomConstants Type, out int pLeft, out int pTop, out int pRight, out int pBottom);
/// Retrieves the color used for special text attributes.
///
/// Type: long
/// The index of the color to retrieve. It can be one of the following values.
///
///
/// Index
/// Meaning
///
/// -
/// 0
/// Text color.
///
/// -
/// 1
/// RGB(0, 0, 0)
///
/// -
/// 2
/// RGB(0, 0, 255)
///
/// -
/// 3
/// RGB(0, 255, 255)
///
/// -
/// 4
/// RGB(0, 255, 0)
///
/// -
/// 5
/// RGB(255, 0, 255)
///
/// -
/// 6
/// RGB(255, 0, 0)
///
/// -
/// 7
/// RGB(255, 255, 0)
///
/// -
/// 8
/// RGB(255, 255, 255)
///
/// -
/// 9
/// RGB(0, 0, 128)
///
/// -
/// 10
/// RGB(0, 128, 128)
///
/// -
/// 11
/// RGB(0, 128, 0)
///
/// -
/// 12
/// RGB(128, 0, 128)
///
/// -
/// 13
/// RGB(128, 0, 0)
///
/// -
/// 14
/// RGB(128, 128, 0)
///
/// -
/// 15
/// RGB(128, 128, 128)
///
/// -
/// 16
/// RGB(192, 192, 192)
///
///
///
///
/// Type: long*
/// The color that corresponds to the specified index.
///
///
/// The first 16 index values are for special underline colors. If an index between 1 and 16 hasn't been defined by a call to the
/// ITextDocument2:SetEffectColor method, GetEffectColor returns the corresponding Microsoft Word default color.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-geteffectcolor HRESULT GetEffectColor( [in] long
// Index, [out] long *pValue );
COLORREF GetEffectColor(int Index);
/// Gets the Input Method Manager (IMM) input context from the Text Object Model (TOM) host.
///
/// Type: __int64*
/// The IMM input context.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getimmcontext HRESULT GetImmContext( [out, retval]
// __int64 *pContext );
int GetImmContext();
/// Retrieves the preferred font for a particular character repertoire and character position.
///
/// Type: long
/// The character position for the preferred font.
///
///
/// Type: long
/// The character repertoire index for the preferred font. It can be one of the following values.
/// tomAboriginal
/// tomAnsi
/// tomArabic
/// tomArmenian
/// tomBaltic
/// tomBengali
/// tomBIG5
/// tomBraille
/// tomCherokee
/// tomCyrillic
/// tomDefaultCharRep
/// tomDevanagari
/// tomEastEurope
/// tomEmoji
/// tomEthiopic
/// tomGB2312
/// tomGeorgian
/// tomGreek
/// tomGujarati
/// tomGurmukhi
/// tomHangul
/// tomHebrew
/// tomJamo
/// tomKannada
/// tomKayahli
/// tomKharoshthi
/// tomKhmer
/// tomLao
/// tomLimbu
/// tomMac
/// tomMalayalam
/// tomMongolian
/// tomMyanmar
/// tomNewTaiLu
/// tomOEM
/// tomOgham
/// tomOriya
/// tomPC437
/// tomRunic
/// tomShiftJIS
/// tomSinhala
/// tomSylotinagr
/// tomSymbol
/// tomSyriac
/// tomTaiLe
/// tomTamil
/// tomTelugu
/// tomThaana
/// tomThai
/// tomTibetan
/// tomTurkish
/// tomUsymbol
/// tomVietnamese
/// tomYi
///
///
/// Type: long
/// The preferred font options. The low-order word can be a combination of the following values.
/// tomIgnoreCurrentFont
/// tomMatchCharRep
/// tomMatchFontSignature
/// tomMatchAscii
/// tomGetHeightOnly
/// tomMatchMathFont
/// If the high-order word of Options is tomUseTwips, the font heights are given in twips.
///
///
/// Type: long
/// The index of the current character repertoire.
///
///
/// Type: long
/// The current font size.
///
///
/// Type: BSTR*
/// The name of the font.
///
///
/// Type: long*
/// The font pitch and family.
///
///
/// Type: long*
/// The new font size.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getpreferredfont HRESULT GetPreferredFont( [in] long
// cp, [in] long CharRep, [in] long Options, [in] long curCharRep, [in] long curFontSize, [out] BSTR *pbstr, [out] long
// *pPitchAndFamily, [out] long *pNewFontSize );
void GetPreferredFont(int cp, tomConstants CharRep, tomConstants Options, int curCharRep, int curFontSize,
[MarshalAs(UnmanagedType.BStr)] out string pbstr, out int pPitchAndFamily, out int pNewFontSize);
/// Retrieves the value of a property.
///
/// Type: long
/// The identifier of the property to retrieve. It can be one of the following property IDs.
/// tomCanCopy
/// tomCanRedo
/// tomCanUndo
/// tomDocMathBuild
/// tomMathInterSpace
/// tomMathIntraSpace
/// tomMathLMargin
/// tomMathPostSpace
/// tomMathPreSpace
/// tomMathRMargin
/// tomMathWrapIndent
/// tomMathWrapRight
/// tomUndoLimit
/// tomEllipsisMode
/// tomEllipsisState
///
///
/// Type: long*
/// The value of the property.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getproperty HRESULT GetProperty( [in] long Type,
// [out] long *pValue );
int GetProperty(tomConstants Type);
/// Gets a collection of rich-text strings.
///
/// Type: ITextStrings**
/// The collection of rich-text strings.
///
///
/// The collection is useful for manipulating rich text, particularly for transforming mathematical text from linear to built-up
/// form, or vice versa.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getstrings HRESULT GetStrings( [out] ITextStrings
// **ppStrs );
ITextStrings GetStrings();
/// Notifies the Text Object Model (TOM) engine client of particular Input Method Editor (IME) events.
///
/// Type: long
/// An IME notification code.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-notify HRESULT Notify( [in] long Notify );
void Notify(int Notify);
/// Retrieves a new text range for the active story of the document.
///
/// Type: long
/// The active end of the new text range. The default value is 0; that is, the beginning of the story.
///
///
/// Type: long
/// The anchor end of the new text range. The default value is 0.
///
///
/// Type: ITextRange2**
/// The new text range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-range2 HRESULT Range2( [in] long cpActive, [in] long
// cpAnchor, [out, retval] ITextRange2 **ppRange );
ITextRange2 Range2(int cpActive, int cpAnchor);
/// Retrieves the degenerate range at (or nearest to) a particular point on the screen.
///
/// Type: long
/// The x-coordinate of a point, in screen coordinates.
///
///
/// Type: long
/// The y-coordinate of a point, in screen coordinates.
///
///
/// Type: long
/// The alignment type of the specified point. For a list of valid values, see ITextRange::GetPoint.
///
/// Type: ITextRange2**
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-rangefrompoint2 HRESULT RangeFromPoint2( [in] long
// x, [in] long y, [in] long Type, [out, retval] ITextRange2 **ppRange );
ITextRange2 RangeFromPoint2(int x, int y, int Type);
/// Releases the call manager.
///
/// Type: IUnknown*
/// The call manager object to release.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-releasecallmanager HRESULT ReleaseCallManager( [in]
// IUnknown *pVoid );
void ReleaseCallManager([In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pVoid);
/// Releases an Input Method Manager (IMM) input context.
///
/// Type: int64
/// The IMM input context to release.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-releaseimmcontext HRESULT ReleaseImmContext( [in]
// __int64 Context );
void ReleaseImmContext(int Context);
/// Specifies the color to use for special text attributes.
///
/// Type: long
/// The index of the color to retrieve. For a list of values, see GetEffectColor.
///
///
/// Type: long
/// The new color for the specified index.
///
///
/// The first 16 index values are for special underline colors. If an index between 1 and 16 hasn't been defined by a call to the
/// ITextDocument2:SetEffectColor method, the corresponding Microsoft Word default color is used.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-seteffectcolor HRESULT SetEffectColor( [in] long
// Index, [in] long Value );
void SetEffectColor(int Index, COLORREF Value);
/// Specifies a new value for a property.
///
/// Type: long
/// The identifier of the property. For a list of possible property identifiers, see GetProperty.
///
///
/// Type: long
/// The new property value.
///
///
/// Type: HRESULT
/// If the method succeeds, it returns NOERROR. Otherwise, it returns an HRESULT error code.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setproperty HRESULT SetProperty( [in] long Type,
// [in] long Value );
void SetProperty(int Type, int Value);
/// Specifies the typography options for the document.
///
/// Type: long
/// The typography options to set. For a list of possible options, see GetTypographyOptions.
///
///
/// Type: long
///
/// A mask identifying the options to set. For example, to turn on TO_ADVANCEDTYPOGRAPHY, call
/// ITextDocument2::SetTypographyOptions (TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-settypographyoptions HRESULT SetTypographyOptions(
// [in] long Options, [in] long Mask );
void SetTypographyOptions(int Options, int Mask);
/// Generates a system beep.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-sysbeep HRESULT SysBeep();
void SysBeep();
/// Updates the selection and caret.
///
/// Type: long
/// Scroll flag. Use tomTrue to scroll the caret into view.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-update HRESULT Update( [in] long Value );
void Update(tomConstants Value);
///
/// Notifies the client that the view has changed and the client should update the view if the Text Object Model (TOM) engine is
/// in-place active.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-updatewindow HRESULT UpdateWindow();
void UpdateWindow();
/// Gets the math properties for the document.
///
/// Type: long*
/// A combination of the following math properties.
///
///
/// Property
/// Meaning
///
/// -
/// tomMathDispAlignMask
/// Display-mode alignment mask.
///
/// -
/// tomMathDispAlignCenter
/// Center (default) alignment.
///
/// -
/// tomMathDispAlignLeft
/// Left alignment.
///
/// -
/// tomMathDispAlignRight
/// Right alignment.
///
/// -
/// tomMathDispIntUnderOver
/// Display-mode integral limits location.
///
/// -
/// tomMathDispFracTeX
/// Display-mode nested fraction script size.
///
/// -
/// tomMathDispNaryGrow
/// Math-paragraph n-ary grow.
///
/// -
/// tomMathDocEmptyArgMask
/// Empty arguments display mask.
///
/// -
/// tomMathDocEmptyArgAuto
/// Automatically use a dotted square to denote empty arguments, if necessary.
///
/// -
/// tomMathDocEmptyArgAlways
/// Always use a dotted square to denote empty arguments..
///
/// -
/// tomMathDocEmptyArgNever
/// Don't denote empty arguments.
///
/// -
/// tomMathDocSbSpOpUnchanged
/// Display the underscore (_) and caret (^) as themselves.
///
/// -
/// tomMathDocDiffMask
///
/// Style mask for the tomMathDocDiffUpright, tomMathDocDiffItalic, tomMathDocDiffOpenItalic options.
///
///
/// -
/// tomMathDocDiffItalic
/// Use italic (default) for math differentials.
///
/// -
/// tomMathDocDiffUpright
/// Use an upright font for math differentials.
///
/// -
/// tomMathDocDiffOpenItalic
/// Use open italic (default) for math differentials.
///
/// -
/// tomMathDispNarySubSup
/// Math-paragraph non-integral n-ary limits location.
///
/// -
/// tomMathDispDef
/// Math-paragraph spacing defaults.
///
/// -
/// tomMathEnableRtl
/// Enable right-to-left (RTL) math zones in RTL paragraphs.
///
/// -
/// tomMathBrkBinMask
/// Equation line break mask.
///
/// -
/// tomMathBrkBinBefore
/// Break before binary/relational operator.
///
/// -
/// tomMathBrkBinAfter
/// Break after binary/relational operator.
///
/// -
/// tomMathBrkBinDup
/// Duplicate binary/relational before/after.
///
/// -
/// tomMathBrkBinSubMask
/// Duplicate mask for minus operator.
///
/// -
/// tomMathBrkBinSubMM
/// - - (minus on both lines).
///
/// -
/// tomMathBrkBinSubPM
/// + -
///
/// -
/// tomMathBrkBinSubMP
/// - +
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getmathproperties HRESULT GetMathProperties( [out]
// long *pOptions );
tomConstants GetMathProperties();
/// Specifies the math properties to use for the document.
///
/// Type: long
/// The math properties to set. For a list of possible properties, see GetMathProperties.
///
///
/// Type: long
/// The math mask. For a list of possible masks, see GetMathProperties
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setmathproperties HRESULT SetMathProperties( [in]
// long Options, [in] long Mask );
void SetMathProperties(tomConstants Options, tomConstants Mask);
/// Gets the active story; that is, the story that receives keyboard and mouse input.
///
/// Type: ITextStory**
/// The active story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getactivestory HRESULT GetActiveStory( [out, retval]
// ITextStory **ppStory );
ITextStory GetActiveStory();
/// Sets the active story; that is, the story that receives keyboard and mouse input.
///
/// Type: ITextStory*
/// The story to set as active.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-setactivestory HRESULT SetActiveStory( [in]
// ITextStory *pStory );
void SetActiveStory([In, Optional] ITextStory? pStory);
/// Gets the main story.
///
/// Type: ITextStory**
/// The main story.
///
///
/// A rich edit control automatically includes the main story; a call to the ITextDocument2::GetNewStory method is not required.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getmainstory HRESULT GetMainStory( [out, retval]
// ITextStory **ppStory );
ITextStory GetMainStory();
///
/// Not implemented.
/// Gets a new story.
///
///
/// Type: ITextStory**
/// The new story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getnewstory HRESULT GetNewStory( [out, retval]
// ITextStory **ppStory );
ITextStory GetNewStory();
/// Retrieves the story that corresponds to a particular index.
///
/// Type: long
/// The index of the story to retrieve.
///
///
/// Type: ITextStory**
/// The story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextdocument2-getstory HRESULT GetStory( [in] long Index, [out,
// retval] ITextStory **ppStory );
ITextStory GetStory(int Index);
}
///
/// Text Object Model (TOM) rich text-range attributes are accessed through a pair of dual interfaces, ITextFont and ITextPara.
///
///
///
/// The ITextFont and ITextPara interfaces encapsulate the functionality of the Microsoft Word Format Font and
/// Paragraph dialog boxes, respectively. Both interfaces include a duplicate ( Value) property that can return a duplicate
/// of the attributes in a range object or transfer a set of attributes to a range. As such, they act like programmable format painters.
/// For example, you could transfer all attributes from range r1 to range r2 except for making r2 bold and the font size 12 points by
/// using the following subroutine.
///
/// See SetFont for a similar example written in C++.
///
/// The ITextFont attribute interface represents the traditional Microsoft Visual Basic for Applications (VBA) way of setting
/// properties and it gives the desired VBA notation.
///
///
/// ITextFont uses the "tomBool" type for rich-text attributes that have binary states. For more information, see The tomBool Type.
///
///
/// The rich edit control is able to accept and return all ITextFont properties intact, that is, without modification, both
/// through TOM and through its Rich Text Format (RTF) converters. However, it cannot display the All Caps, Animation, Embossed, Imprint,
/// Shadow, Small Caps, Hidden, Kerning, Outline, and Style font properties.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextfont
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextFont")]
[ComImport, Guid("8CC497C3-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)]
public interface ITextFont
{
/// Gets a duplicate of this text font object.
///
/// Type: ITextFont**
/// The duplicate text font object.
///
///
/// The duplicate property is the default property of an ITextFont object.
/// For an example of how to use font duplicates, see SetFont.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getduplicate HRESULT GetDuplicate( ITextFont **ppFont );
ITextFont GetDuplicate();
/// Sets the character formatting by copying another text font object.
///
/// Type: ITextFont*
/// The text font object to apply to this font object.
///
///
/// Values with the tomUndefined attribute have no effect.
/// For an example of how to use font duplicates, see SetFont.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setduplicate HRESULT SetDuplicate( [in] ITextFont *pFont );
void SetDuplicate([In, Optional] ITextFont? pFont);
/// Determines whether the font can be changed.
///
/// Type: long*
///
/// A variable that is tomTrue if the font can be changed or tomFalse if it cannot be changed. This parameter can be NULL.
///
///
///
/// Type: HRESULT
///
/// If the font can change, the method returns S_OK. If the method fails, it returns the following COM error code. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// S_FALSE
/// The font cannot change.
///
///
///
///
/// The * pbCanChange returns tomTrue only if the font can be changed. That is, no part of an associated range is
/// protected and an associated document is not read-only. If this ITextFont object is a duplicate, no protection rules apply.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-canchange HRESULT CanChange( [retval] long *pValue );
[PreserveSig]
HRESULT CanChange(out tomConstants pValue);
/// Determines whether this text font object has the same properties as the specified text font object.
///
/// Type: ITextFont*
/// The text font object to compare against.
///
///
/// Type: long*
///
/// A variable that is tomTrue if the font objects have the same properties or tomFalse if they do not. This parameter
/// can be NULL.
///
///
///
/// Type: HRESULT
///
/// If the text font objects have the same properties, the method succeeds and returns S_OK. If the text font objects do not
/// have the same properties, the method fails and returns S_FALSE. For more information about COM error codes, see Error
/// Handling in COM.
///
///
///
/// The text font objects are equal only if pFont belongs to the same Text Object Model (TOM) object as the current font
/// object. The ITextFont::IsEqual method ignores entries for which either font object has an tomUndefined.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-isequal HRESULT IsEqual( ITextFont *pFont, long *pValue );
[PreserveSig]
HRESULT IsEqual([In, Optional] ITextFont? pFont, out tomConstants pValue);
/// Resets the character formatting to the specified values.
///
/// Type: long
/// The kind of reset. This parameter can be a combination of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomDefault
///
/// Set to the document default character format if this font object is attached to a range; otherwise, set the defaults to the basic
/// TOM engine defaults.
///
///
/// -
/// tomUndefined
/// Sets all properties to undefined values. This value is valid only for a duplicate (clone) font object.
///
/// -
/// tomApplyLater
/// Allow property values to be set, but donât apply them to the attached range yet.
///
/// -
/// tomApplyNow
/// Apply the current properties to attached range.
///
/// -
/// tomCacheParms
/// Do not update the current font with the attached range properties.
///
/// -
/// tomTrackParms
/// Update the current font with the attached range properties.
///
/// -
/// tomApplyTmp
/// Apply temporary formatting.
///
/// -
/// tomDisableSmartFont
/// Do not apply smart fonts.
///
/// -
/// tomEnableSmartFont
/// Do apply smart fonts.
///
/// -
/// tomUsePoints
/// Use points for floating-point measurements.
///
/// -
/// tomUseTwips
/// Use twips for floating-point measurements.
///
///
///
///
/// Type: HRESULT
///
/// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// S_FALSE
/// Protected from change.
///
/// -
/// E_INVALIDARG
/// Invalid argument.
///
/// -
/// CO_E_RELEASED
/// The font object is attached to a range that has been deleted.
///
///
///
///
/// Calling ITextFont::Reset with tomUndefined sets all properties to undefined values. Thus, applying the font object
/// to a range changes nothing. This applies to a font object that is obtained by the ITextFont::GetDuplicate method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-reset HRESULT Reset( [in] long Value );
void Reset(tomConstants Value);
/// Gets the character style handle of the characters in a range.
///
/// Type: long*
/// The character style handle.
///
///
/// The Text Object Model (TOM) version 1.0 does not specify the meanings of the style handles. The meanings depend on other
/// facilities of the text system that implements TOM.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getstyle HRESULT GetStyle( long *pValue );
int GetStyle();
/// Sets the character style handle of the characters in a range.
///
/// Type: long
/// The new character style handle.
///
///
/// The Text Object Model (TOM) version 1.0 does not specify the meanings of the style handles. The meanings depend on other
/// facilities of the text system that implements TOM.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setstyle HRESULT SetStyle( [in] long Value );
void SetStyle(int Value);
/// Gets whether the characters are all uppercase.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are all uppercase.
///
/// -
/// tomFalse
/// Characters are not all uppercase.
///
/// -
/// tomUndefined
/// The AllCaps property is undefined.
///
///
///
/// This property corresponds to the CFE_ALLCAPS effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getallcaps HRESULT GetAllCaps( long *pValue );
tomConstants GetAllCaps();
/// Sets whether the characters are all uppercase.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are all uppercase.
///
/// -
/// tomFalse
/// Characters are not all uppercase.
///
/// -
/// tomToggle
/// Toggle the state of the AllCaps property.
///
/// -
/// tomUndefined
/// The AllCaps property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setallcaps HRESULT SetAllCaps( [in] long Value );
void SetAllCaps(tomConstants Value);
/// Gets the animation type.
///
/// Type: long*
/// One of the following animation types.
///
/// tomNoAnimation tomLasVegasLights tomBlinkingBackground tomSparkleText tomMarchingBlackAnts tomMarchingRedAnts tomShimmer
/// tomWipeDown tomWipeRight
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getanimation HRESULT GetAnimation( long *pValue );
tomConstants GetAnimation();
/// Sets the animation type.
///
/// Type: long
/// The animation type. It can be one of the following values.
///
///
/// Animation type
/// Value
///
/// -
/// tomNoAnimation
/// 0
///
/// -
/// tomLasVegasLights
/// 1
///
/// -
/// tomBlinkingBackground
/// 2
///
/// -
/// tomSparkleText
/// 3
///
/// -
/// tomMarchingBlackAnts
/// 4
///
/// -
/// tomMarchingRedAnts
/// 5
///
/// -
/// tomShimmer
/// 6
///
/// -
/// tomWipeDown
/// 7
///
/// -
/// tomWipeRight
/// 8
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setanimation HRESULT SetAnimation( [in] long Value );
void SetAnimation(tomConstants Value);
/// Gets the text background (highlight) color.
///
/// Type: long*
/// The text background color. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// A value
/// The high-order byte is zero, and the three low-order bytes specify an RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// The high-order byte is 1, and the LOWORD specifies the index of a logical-color palette entry.
///
/// -
/// tomAutocolor (-9999997)
/// Indicates the range uses the default system background color.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getbackcolor HRESULT GetBackColor( long *pValue );
int GetBackColor();
/// Sets the background color.
///
/// Type: long
/// The new background color. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// A COLORREF value.
/// An RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// A palette index.
///
/// -
/// tomUndefined
/// No change.
///
/// -
/// tomAutoColor
/// Use the default background color.
///
///
/// If Value contains an RGB color, generate the COLORREF by using the RGB macro.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setbackcolor HRESULT SetBackColor( [in] long Value );
void SetBackColor(int Value);
/// Gets whether the characters are bold.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are bold.
///
/// -
/// tomFalse
/// Characters are not bold.
///
/// -
/// tomUndefined
/// The Bold property is undefined.
///
///
///
///
/// You can use the ITextFont::SetWeight and ITextFont::GetWeight methods to set or retrieve the font weight more precisely than the
/// ITextFont::SetBold and ITextFont::GetBold methods.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getbold HRESULT GetBold( long *pValue );
tomConstants GetBold();
/// Sets whether characters are bold.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are bold.
///
/// -
/// tomFalse
/// Characters are not bold.
///
/// -
/// tomToggle
/// Toggle the state of the Bold property.
///
/// -
/// tomUndefined
/// The Bold property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setbold HRESULT SetBold( [in] long Value );
void SetBold(tomConstants Value);
/// Gets whether characters are embossed.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are embossed.
///
/// -
/// tomFalse
/// Characters are not embossed.
///
/// -
/// tomUndefined
/// The Emboss property is undefined.
///
///
///
/// This property corresponds to the CFE_EMBOSS effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getemboss HRESULT GetEmboss( long *pValue );
tomConstants GetEmboss();
/// Sets whether characters are embossed.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are embossed.
///
/// -
/// tomFalse
/// Characters are not embossed.
///
/// -
/// tomToggle
/// Toggle the state of the Emboss property.
///
/// -
/// tomUndefined
/// The Emboss property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setemboss HRESULT SetEmboss( [in] long Value );
void SetEmboss(tomConstants Value);
/// Gets the foreground, or text, color.
///
/// Type: long*
/// The foreground color. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// A COLORREF value
/// The high-order byte is zero, and the three low-order bytes specify an RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// The high-order byte is 1, and the LOWORD specifies the index of a logical-color palette entry.
///
/// -
/// tomAutocolor (-9999997)
/// Indicates that the range uses the default system foreground color.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getforecolor HRESULT GetForeColor( long *pValue );
int GetForeColor();
/// Sets the foreground (text) color.
///
/// Type: long
/// The new foreground color. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// A COLORREF value.
/// An RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// A palette index.
///
/// -
/// tomUndefined
/// No change.
///
/// -
/// tomAutoColor
/// Use the default foreground color.
///
///
/// Â
/// If Value contains an RGB color, generate the COLORREF by using the RGB macro.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setforecolor HRESULT SetForeColor( [in] long Value );
void SetForeColor(int Value);
/// Gets whether characters are hidden.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are hidden.
///
/// -
/// tomFalse
/// Characters are not hidden.
///
/// -
/// tomUndefined
/// The Hidden property is undefined.
///
///
///
/// This property corresponds to the CFE_HIDDEN effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-gethidden HRESULT GetHidden( long *pValue );
tomConstants GetHidden();
/// Sets whether characters are hidden.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are hidden.
///
/// -
/// tomFalse
/// Characters are not hidden.
///
/// -
/// tomToggle
/// Toggle the state of the Hidden property.
///
/// -
/// tomUndefined
/// The Hidden property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-sethidden HRESULT SetHidden( [in] long Value );
void SetHidden(tomConstants Value);
/// Gets whether characters are displayed as imprinted characters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as imprinted characters.
///
/// -
/// tomFalse
/// Characters are not displayed as imprinted characters.
///
/// -
/// tomUndefined
/// The Engrave property is undefined.
///
///
///
/// This property corresponds to the CFE_IMPRINT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getengrave HRESULT GetEngrave( long *pValue );
tomConstants GetEngrave();
/// Sets whether characters are displayed as imprinted characters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are imprinted.
///
/// -
/// tomFalse
/// Characters are not imprinted.
///
/// -
/// tomToggle
/// Toggle the state of the Engrave property.
///
/// -
/// tomUndefined
/// The Engrave property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setengrave HRESULT SetEngrave( [in] long Value );
void SetEngrave(tomConstants Value);
/// Gets whether characters are in italics.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in italics.
///
/// -
/// tomFalse
/// Characters are not in italics.
///
/// -
/// tomUndefined
/// The Italic property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getitalic HRESULT GetItalic( long *pValue );
tomConstants GetItalic();
/// Sets whether characters are in italics.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in italics.
///
/// -
/// tomFalse
/// Characters are not in italics.
///
/// -
/// tomToggle
/// Toggle the state of the Italic property.
///
/// -
/// tomUndefined
/// The Italic property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setitalic HRESULT SetItalic( [in] long Value );
void SetItalic(tomConstants Value);
/// Gets the minimum font size at which kerning occurs.
///
/// Type: float*
/// The minimum font size at which kerning occurs, in floating-point points.
///
///
/// If the value pointed to by pValue is zero, kerning is off. Positive values turn on pair kerning for font point sizes
/// greater than or equal to the kerning value. For example, the value 1 turns on kerning for all legible sizes, whereas 16 turns on
/// kerning only for font sizes of 16 points and larger.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getkerning HRESULT GetKerning( float *pValue );
float GetKerning();
/// Sets the minimum font size at which kerning occurs.
///
/// Type: float
/// The new value of the minimum kerning size, in floating-point points.
///
///
/// If this value is zero, kerning is turned off. Positive values turn on pair kerning for font sizes greater than this kerning
/// value. For example, the value 1 turns on kerning for all legible sizes, whereas 16 turns on kerning only for font sizes of 16
/// points and larger.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setkerning HRESULT SetKerning( [in] float Value );
void SetKerning(float Value);
/// Gets the language ID or language code identifier (LCID).
///
/// Type: long*
///
/// The language ID or LCID. The low word contains the language identifier. The high word is either zero or it contains the high word
/// of the LCID. To retrieve the language identifier, mask out the high word. For more information, see Locale Identifiers.
///
///
///
/// To get the BCP-47 language tag, such as "en-US", call ITextRange2::GetText2(pBstr, tomLanguageTag), where pBstr
/// specifies the desired language tag.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getlanguageid HRESULT GetLanguageID( long *pValue );
LCID GetLanguageID();
/// Sets the language ID or language code identifier (LCID).
///
/// Type: long
///
/// The new language identifier. The low word contains the language identifier. The high word is either zero or it contains the high
/// word of the locale identifier LCID. For more information, see Locale Identifiers.
///
///
///
///
/// If the high nibble of Value is tomCharset, set the charrep from the charset in the low byte and the pitch
/// and family from the next byte. See also ITextFont2::SetCharRep.
///
///
/// If the high nibble of Value is tomCharRepFromLcid, set the charrep from the LCID and set the LCID as well. See
/// ITextFont::GetLanguageID for more information.
///
///
/// To set the BCP-47 language tag, such as "en-US", call ITextRange2::SetText2 and set the tomLanguageTag and bstr with the
/// language tag.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setlanguageid HRESULT SetLanguageID( [in] long Value );
void SetLanguageID(LCID Value);
/// Gets the font name.
///
/// Type: BSTR*
/// The font name.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getname HRESULT GetName( BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
string GetName();
/// Sets the font name.
///
/// Type: BSTR
/// The new font name.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setname HRESULT SetName( [in] BSTR bstr );
void SetName([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Gets whether characters are displayed as outlined characters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as outlined characters.
///
/// -
/// tomFalse
/// Characters are not displayed as outlined characters.
///
/// -
/// tomUndefined
/// The Outline property is undefined.
///
///
///
/// This property corresponds to the CFE_OUTLINE effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getoutline HRESULT GetOutline( long *pValue );
tomConstants GetOutline();
/// Sets whether characters are displayed as outlined characters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are outlined.
///
/// -
/// tomFalse
/// Characters are not outlined.
///
/// -
/// tomToggle
/// Toggle the state of the Outline property.
///
/// -
/// tomUndefined
/// The Outline property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setoutline HRESULT SetOutline( [in] long Value );
void SetOutline(tomConstants Value);
/// Gets the amount that characters are offset vertically relative to the baseline.
///
/// Type: float*
/// The amount of vertical offset, in floating-point points.
///
///
/// Displayed text typically has a zero value for this property. Positive values raise the text, and negative values lower it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getposition HRESULT GetPosition( float *pValue );
float GetPosition();
/// Sets the amount that characters are offset vertically relative to the baseline.
///
/// Type: float
/// The new amount of vertical offset, in floating-point points.
///
///
/// Displayed text typically has a zero value for this property. Positive values raise the text, and negative values lower it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setposition HRESULT SetPosition( [in] float Value );
void SetPosition(float Value);
/// Gets whether characters are protected against attempts to modify them.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are protected.
///
/// -
/// tomFalse
/// Characters are not protected.
///
/// -
/// tomUndefined
/// The Protected property is undefined.
///
///
///
///
/// In general, Text Object Model (TOM) methods that attempt to change the formatting or content of a range fail with
/// E_ACCESSDENIED if any part of that range is protected, or if the document is read only. To make a change in protected
/// text, the TOM client should attempt to turn off the protection of the text to be modified. The owner of the document may permit
/// this to happen. For example in rich edit controls, attempts to change protected text result in an EN_PROTECTED notification code
/// to the creator of the document, who then can refuse or grant permission for the change. The creator is the client that created a
/// windowed rich edit control through the CreateWindow function or the ITextHost object that called the CreateTextServices function
/// to create a windowless rich edit control.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getprotected HRESULT GetProtected( long *pValue );
tomConstants GetProtected();
/// Sets whether characters are protected against attempts to modify them.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are protected.
///
/// -
/// tomFalse
/// Characters are not protected.
///
/// -
/// tomToggle
/// Toggle the state of the Protected property.
///
/// -
/// tomUndefined
/// The Protected property is undefined.
///
///
///
///
/// In general, Text Object Model (TOM) methods that attempt to change the formatting or content of a range will fail with
/// E_ACCESSDENIED if any part of that range is protected or if the document is read-only. To make a change in protected text,
/// the TOM client should attempt to turn off the protection of the text to be modified. The owner of the document may permit this to
/// happen. For example in rich edit controls, attempts to change protected text result in an EN_PROTECTED notification code to the
/// creator of the document, who then can refuse or grant permission for the change. The creator is the client that created a
/// windowed rich-edit control through the CreateWindow function or the ITextHost object that called the CreateTextServices function
/// to create a windowless rich edit control.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setprotected HRESULT SetProtected( [in] long Value );
void SetProtected(tomConstants Value);
/// Gets whether characters are displayed as shadowed characters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as shadowed characters.
///
/// -
/// tomFalse
/// Characters are not displayed as shadowed characters.
///
/// -
/// tomUndefined
/// The Shadow property is undefined.
///
///
///
/// This property corresponds to the CFE_SHADOW effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getshadow HRESULT GetShadow( long *pValue );
tomConstants GetShadow();
/// Sets whether characters are displayed as shadowed characters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are shadowed.
///
/// -
/// tomFalse
/// Characters are not shadowed.
///
/// -
/// tomToggle
/// Toggle the state of the Shadow property.
///
/// -
/// tomUndefined
/// The Shadow property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setshadow HRESULT SetShadow( [in] long Value );
void SetShadow(tomConstants Value);
/// Gets the font size.
///
/// Type: float*
/// The font size, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsize HRESULT GetSize( float *pValue );
float GetSize();
/// Sets the font size.
///
/// Type: float
/// The new font size, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsize HRESULT SetSize( [in] float Value );
void SetSize(float Value);
/// Gets whether characters are in small capital letters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in small capital letters.
///
/// -
/// tomFalse
/// Characters are not in small capital letters.
///
/// -
/// tomUndefined
/// The SmallCaps property is undefined.
///
///
///
/// This property corresponds to the CFE_SMALLCAPS effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsmallcaps HRESULT GetSmallCaps( long *pValue );
tomConstants GetSmallCaps();
/// Sets whether characters are in small capital letters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in small capital letters.
///
/// -
/// tomFalse
/// Characters are not in small capital letters.
///
/// -
/// tomToggle
/// Toggle the state of the SmallCaps property.
///
/// -
/// tomUndefined
/// The SmallCaps property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsmallcaps HRESULT SetSmallCaps( [in] long Value );
void SetSmallCaps(tomConstants Value);
/// Gets the amount of horizontal spacing between characters.
///
/// Type: float*
/// The amount of horizontal spacing between characters, in floating-point points.
///
///
/// Displayed text typically has an intercharacter spacing value of zero. Positive values expand the spacing, and negative values
/// compress it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getspacing HRESULT GetSpacing( float *pValue );
float GetSpacing();
/// Sets the amount of horizontal spacing between characters.
///
/// Type: float
/// The new amount of horizontal spacing between characters, in floating-point points.
///
///
/// Displayed text typically has an intercharacter spacing value of zero. Positive values expand the spacing, and negative values
/// compress it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setspacing HRESULT SetSpacing( [in] float Value );
void SetSpacing(float Value);
/// Gets whether characters are displayed with a horizontal line through the center.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed with a horizontal line through the center.
///
/// -
/// tomFalse
/// Characters are not displayed with a horizontal line through the center.
///
/// -
/// tomUndefined
/// The StrikeThrough property is undefined.
///
///
///
/// This property corresponds to the CFE_STRIKEOUT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getstrikethrough HRESULT GetStrikeThrough( long *pValue );
tomConstants GetStrikeThrough();
/// Sets whether characters are displayed with a horizontal line through the center.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters have a horizontal line through the center.
///
/// -
/// tomFalse
/// Characters do not have a horizontal line through the center.
///
/// -
/// tomToggle
/// Toggle the state of the StrikeThrough property.
///
/// -
/// tomUndefined
/// The StrikeThrough property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setstrikethrough HRESULT SetStrikeThrough( [in] long
// Value );
void SetStrikeThrough(tomConstants Value);
/// Gets whether characters are displayed as subscript.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as subscript.
///
/// -
/// tomFalse
/// Characters are not displayed as subscript.
///
/// -
/// tomUndefined
/// The Subscript property is undefined.
///
///
///
/// This property corresponds to the CFE_SUBSCRIPT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsubscript HRESULT GetSubscript( long *pValue );
tomConstants GetSubscript();
/// Sets whether characters are displayed as subscript.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as subscript.
///
/// -
/// tomFalse
/// Characters are not displayed as subscript.
///
/// -
/// tomToggle
/// Toggle the state of the Subscript property.
///
/// -
/// tomUndefined
/// The Subscript property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsubscript HRESULT SetSubscript( [in] long Value );
void SetSubscript(tomConstants Value);
/// Gets whether characters are displayed as superscript.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as superscript.
///
/// -
/// tomFalse
/// Characters are not displayed as superscript.
///
/// -
/// tomUndefined
/// The Superscript property is undefined.
///
///
///
/// This property corresponds to the CFE_SUPERSCRIPT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsuperscript HRESULT GetSuperscript( long *pValue );
tomConstants GetSuperscript();
/// Sets whether characters are displayed as superscript.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as superscript.
///
/// -
/// tomFalse
/// Characters are not displayed as superscript.
///
/// -
/// tomToggle
/// Toggle the state of the Superscript property.
///
/// -
/// tomUndefined
/// The Superscript property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsuperscript HRESULT SetSuperscript( [in] long Value );
void SetSuperscript(tomConstants Value);
/// Gets the type of underlining for the characters in a range.
///
/// Type: long*
/// The type of underlining. It can be one of the following values.
/// tomNone
/// tomSingle
/// tomWords
/// tomDouble
/// tomDotted
/// tomDash
/// tomDashDot
/// tomDashDotDot
/// tomWave
/// tomThick
/// tomHair
/// tomDoubleWave
/// tomHeavyWave
/// tomLongDash
/// tomThickDash
/// tomThickDashDot
/// tomThickDashDotDot
/// tomThickDotted
/// tomThickLongDash
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getunderline HRESULT GetUnderline( long *pValue );
tomConstants GetUnderline();
/// Sets thevtype of underlining for the characters in a range.
///
/// Type: long
/// The type of underlining. It can be one of the following values.
/// tomNone
/// tomSingle
/// tomWords
/// tomDouble
/// tomDotted
/// tomDash
/// tomDashDot
/// tomDashDotDot
/// tomWave
/// tomThick
/// tomHair
/// tomDoubleWave
/// tomHeavyWave
/// tomLongDash
/// tomThickDash
/// tomThickDashDot
/// tomThickDashDotDot
/// tomThickDotted
/// tomThickLongDash
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setunderline HRESULT SetUnderline( [in] long Value );
void SetUnderline(tomConstants Value);
/// Gets the font weight for the characters in a range.
///
/// Type: long*
///
/// The font weight. The Bold property is a binary version of the Weight property that sets the weight to FW_BOLD. The font
/// weight exists in the LOGFONT structure and the IFont interface. Windows defines the following degrees of font weight.
///
///
///
/// Font weight
/// Value
///
/// -
/// FW_DONTCARE
/// 0
///
/// -
/// FW_THIN
/// 100
///
/// -
/// FW_EXTRALIGHT
/// 200
///
/// -
/// FW_LIGHT
/// 300
///
/// -
/// FW_NORMAL
/// 400
///
/// -
/// FW_MEDIUM
/// 500
///
/// -
/// FW_SEMIBOLD
/// 600
///
/// -
/// FW_BOLD
/// 700
///
/// -
/// FW_EXTRABOLD
/// 800
///
/// -
/// FW_HEAVY
/// 900
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getweight HRESULT GetWeight( long *pValue );
int GetWeight();
/// Sets the font weight for the characters in a range.
///
/// Type: long
///
/// The new font weight. The Bold property is a binary version of the Weight property that sets the weight to FW_BOLD. The
/// font weight exists in the LOGFONT structure and the IFont interface. Windows defines the following degrees of font weight.
///
///
///
/// Font weight
/// Value
///
/// -
/// FW_DONTCARE
/// 0
///
/// -
/// FW_THIN
/// 100
///
/// -
/// FW_EXTRALIGHT
/// 200
///
/// -
/// FW_LIGHT
/// 300
///
/// -
/// FW_NORMAL
/// 400
///
/// -
/// FW_MEDIUM
/// 500
///
/// -
/// FW_SEMIBOLD
/// 600
///
/// -
/// FW_BOLD
/// 700
///
/// -
/// FW_EXTRABOLD
/// 800
///
/// -
/// FW_HEAVY
/// 900
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setweight HRESULT SetWeight( [in] long Value );
void SetWeight(int Value);
}
///
///
/// In the Text Object Model (TOM), applications access text-range attributes by using a pair of dual interfaces, ITextFont and ITextPara.
///
/// The ITextFont2 interface extends ITextFont, providing the programming equivalent of the Microsoft Word format-font dialog.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextfont2
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextFont2")]
[ComImport, Guid("C241F5E3-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextFont2 : ITextFont
{
/// Gets a duplicate of this text font object.
///
/// Type: ITextFont**
/// The duplicate text font object.
///
///
/// The duplicate property is the default property of an ITextFont object.
/// For an example of how to use font duplicates, see SetFont.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getduplicate HRESULT GetDuplicate( ITextFont **ppFont );
new ITextFont GetDuplicate();
/// Sets the character formatting by copying another text font object.
///
/// Type: ITextFont*
/// The text font object to apply to this font object.
///
///
/// Values with the tomUndefined attribute have no effect.
/// For an example of how to use font duplicates, see SetFont.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setduplicate HRESULT SetDuplicate( [in] ITextFont *pFont );
new void SetDuplicate([In, Optional] ITextFont? pFont);
/// Determines whether the font can be changed.
///
/// Type: long*
///
/// A variable that is tomTrue if the font can be changed or tomFalse if it cannot be changed. This parameter can be NULL.
///
///
///
/// Type: HRESULT
///
/// If the font can change, the method returns S_OK. If the method fails, it returns the following COM error code. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// S_FALSE
/// The font cannot change.
///
///
///
///
/// The * pbCanChange returns tomTrue only if the font can be changed. That is, no part of an associated range is
/// protected and an associated document is not read-only. If this ITextFont object is a duplicate, no protection rules apply.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-canchange HRESULT CanChange( [retval] long *pValue );
[PreserveSig]
new HRESULT CanChange(out tomConstants pValue);
/// Determines whether this text font object has the same properties as the specified text font object.
///
/// Type: ITextFont*
/// The text font object to compare against.
///
///
/// Type: long*
///
/// A variable that is tomTrue if the font objects have the same properties or tomFalse if they do not. This parameter
/// can be NULL.
///
///
///
/// Type: HRESULT
///
/// If the text font objects have the same properties, the method succeeds and returns S_OK. If the text font objects do not
/// have the same properties, the method fails and returns S_FALSE. For more information about COM error codes, see Error
/// Handling in COM.
///
///
///
/// The text font objects are equal only if pFont belongs to the same Text Object Model (TOM) object as the current font
/// object. The ITextFont::IsEqual method ignores entries for which either font object has an tomUndefined.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-isequal HRESULT IsEqual( ITextFont *pFont, long *pValue );
[PreserveSig]
new HRESULT IsEqual([In, Optional] ITextFont? pFont, out tomConstants pValue);
/// Resets the character formatting to the specified values.
///
/// Type: long
/// The kind of reset. This parameter can be a combination of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomDefault
///
/// Set to the document default character format if this font object is attached to a range; otherwise, set the defaults to the basic
/// TOM engine defaults.
///
///
/// -
/// tomUndefined
/// Sets all properties to undefined values. This value is valid only for a duplicate (clone) font object.
///
/// -
/// tomApplyLater
/// Allow property values to be set, but donât apply them to the attached range yet.
///
/// -
/// tomApplyNow
/// Apply the current properties to attached range.
///
/// -
/// tomCacheParms
/// Do not update the current font with the attached range properties.
///
/// -
/// tomTrackParms
/// Update the current font with the attached range properties.
///
/// -
/// tomApplyTmp
/// Apply temporary formatting.
///
/// -
/// tomDisableSmartFont
/// Do not apply smart fonts.
///
/// -
/// tomEnableSmartFont
/// Do apply smart fonts.
///
/// -
/// tomUsePoints
/// Use points for floating-point measurements.
///
/// -
/// tomUseTwips
/// Use twips for floating-point measurements.
///
///
///
///
/// Type: HRESULT
///
/// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// S_FALSE
/// Protected from change.
///
/// -
/// E_INVALIDARG
/// Invalid argument.
///
/// -
/// CO_E_RELEASED
/// The font object is attached to a range that has been deleted.
///
///
///
///
/// Calling ITextFont::Reset with tomUndefined sets all properties to undefined values. Thus, applying the font object
/// to a range changes nothing. This applies to a font object that is obtained by the ITextFont::GetDuplicate method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-reset HRESULT Reset( [in] long Value );
new void Reset(tomConstants Value);
/// Gets the character style handle of the characters in a range.
///
/// Type: long*
/// The character style handle.
///
///
/// The Text Object Model (TOM) version 1.0 does not specify the meanings of the style handles. The meanings depend on other
/// facilities of the text system that implements TOM.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getstyle HRESULT GetStyle( long *pValue );
new int GetStyle();
/// Sets the character style handle of the characters in a range.
///
/// Type: long
/// The new character style handle.
///
///
/// The Text Object Model (TOM) version 1.0 does not specify the meanings of the style handles. The meanings depend on other
/// facilities of the text system that implements TOM.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setstyle HRESULT SetStyle( [in] long Value );
new void SetStyle(int Value);
/// Gets whether the characters are all uppercase.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are all uppercase.
///
/// -
/// tomFalse
/// Characters are not all uppercase.
///
/// -
/// tomUndefined
/// The AllCaps property is undefined.
///
///
///
/// This property corresponds to the CFE_ALLCAPS effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getallcaps HRESULT GetAllCaps( long *pValue );
new tomConstants GetAllCaps();
/// Sets whether the characters are all uppercase.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are all uppercase.
///
/// -
/// tomFalse
/// Characters are not all uppercase.
///
/// -
/// tomToggle
/// Toggle the state of the AllCaps property.
///
/// -
/// tomUndefined
/// The AllCaps property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setallcaps HRESULT SetAllCaps( [in] long Value );
new void SetAllCaps(tomConstants Value);
/// Gets the animation type.
///
/// Type: long*
/// One of the following animation types.
///
/// tomNoAnimation tomLasVegasLights tomBlinkingBackground tomSparkleText tomMarchingBlackAnts tomMarchingRedAnts tomShimmer
/// tomWipeDown tomWipeRight
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getanimation HRESULT GetAnimation( long *pValue );
new tomConstants GetAnimation();
/// Sets the animation type.
///
/// Type: long
/// The animation type. It can be one of the following values.
///
///
/// Animation type
/// Value
///
/// -
/// tomNoAnimation
/// 0
///
/// -
/// tomLasVegasLights
/// 1
///
/// -
/// tomBlinkingBackground
/// 2
///
/// -
/// tomSparkleText
/// 3
///
/// -
/// tomMarchingBlackAnts
/// 4
///
/// -
/// tomMarchingRedAnts
/// 5
///
/// -
/// tomShimmer
/// 6
///
/// -
/// tomWipeDown
/// 7
///
/// -
/// tomWipeRight
/// 8
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setanimation HRESULT SetAnimation( [in] long Value );
new void SetAnimation(tomConstants Value);
/// Gets the text background (highlight) color.
///
/// Type: long*
/// The text background color. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// A value
/// The high-order byte is zero, and the three low-order bytes specify an RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// The high-order byte is 1, and the LOWORD specifies the index of a logical-color palette entry.
///
/// -
/// tomAutocolor (-9999997)
/// Indicates the range uses the default system background color.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getbackcolor HRESULT GetBackColor( long *pValue );
new int GetBackColor();
/// Sets the background color.
///
/// Type: long
/// The new background color. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// A COLORREF value.
/// An RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// A palette index.
///
/// -
/// tomUndefined
/// No change.
///
/// -
/// tomAutoColor
/// Use the default background color.
///
///
/// If Value contains an RGB color, generate the COLORREF by using the RGB macro.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setbackcolor HRESULT SetBackColor( [in] long Value );
new void SetBackColor(int Value);
/// Gets whether the characters are bold.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are bold.
///
/// -
/// tomFalse
/// Characters are not bold.
///
/// -
/// tomUndefined
/// The Bold property is undefined.
///
///
///
///
/// You can use the ITextFont::SetWeight and ITextFont::GetWeight methods to set or retrieve the font weight more precisely than the
/// ITextFont::SetBold and ITextFont::GetBold methods.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getbold HRESULT GetBold( long *pValue );
new tomConstants GetBold();
/// Sets whether characters are bold.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are bold.
///
/// -
/// tomFalse
/// Characters are not bold.
///
/// -
/// tomToggle
/// Toggle the state of the Bold property.
///
/// -
/// tomUndefined
/// The Bold property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setbold HRESULT SetBold( [in] long Value );
new void SetBold(tomConstants Value);
/// Gets whether characters are embossed.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are embossed.
///
/// -
/// tomFalse
/// Characters are not embossed.
///
/// -
/// tomUndefined
/// The Emboss property is undefined.
///
///
///
/// This property corresponds to the CFE_EMBOSS effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getemboss HRESULT GetEmboss( long *pValue );
new tomConstants GetEmboss();
/// Sets whether characters are embossed.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are embossed.
///
/// -
/// tomFalse
/// Characters are not embossed.
///
/// -
/// tomToggle
/// Toggle the state of the Emboss property.
///
/// -
/// tomUndefined
/// The Emboss property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setemboss HRESULT SetEmboss( [in] long Value );
new void SetEmboss(tomConstants Value);
/// Gets the foreground, or text, color.
///
/// Type: long*
/// The foreground color. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// A COLORREF value
/// The high-order byte is zero, and the three low-order bytes specify an RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// The high-order byte is 1, and the LOWORD specifies the index of a logical-color palette entry.
///
/// -
/// tomAutocolor (-9999997)
/// Indicates that the range uses the default system foreground color.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getforecolor HRESULT GetForeColor( long *pValue );
new int GetForeColor();
/// Sets the foreground (text) color.
///
/// Type: long
/// The new foreground color. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// A COLORREF value.
/// An RGB color.
///
/// -
/// A value returned by PALETTEINDEX
/// A palette index.
///
/// -
/// tomUndefined
/// No change.
///
/// -
/// tomAutoColor
/// Use the default foreground color.
///
///
/// Â
/// If Value contains an RGB color, generate the COLORREF by using the RGB macro.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setforecolor HRESULT SetForeColor( [in] long Value );
new void SetForeColor(int Value);
/// Gets whether characters are hidden.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are hidden.
///
/// -
/// tomFalse
/// Characters are not hidden.
///
/// -
/// tomUndefined
/// The Hidden property is undefined.
///
///
///
/// This property corresponds to the CFE_HIDDEN effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-gethidden HRESULT GetHidden( long *pValue );
new tomConstants GetHidden();
/// Sets whether characters are hidden.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are hidden.
///
/// -
/// tomFalse
/// Characters are not hidden.
///
/// -
/// tomToggle
/// Toggle the state of the Hidden property.
///
/// -
/// tomUndefined
/// The Hidden property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-sethidden HRESULT SetHidden( [in] long Value );
new void SetHidden(tomConstants Value);
/// Gets whether characters are displayed as imprinted characters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as imprinted characters.
///
/// -
/// tomFalse
/// Characters are not displayed as imprinted characters.
///
/// -
/// tomUndefined
/// The Engrave property is undefined.
///
///
///
/// This property corresponds to the CFE_IMPRINT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getengrave HRESULT GetEngrave( long *pValue );
new tomConstants GetEngrave();
/// Sets whether characters are displayed as imprinted characters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are imprinted.
///
/// -
/// tomFalse
/// Characters are not imprinted.
///
/// -
/// tomToggle
/// Toggle the state of the Engrave property.
///
/// -
/// tomUndefined
/// The Engrave property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setengrave HRESULT SetEngrave( [in] long Value );
new void SetEngrave(tomConstants Value);
/// Gets whether characters are in italics.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in italics.
///
/// -
/// tomFalse
/// Characters are not in italics.
///
/// -
/// tomUndefined
/// The Italic property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getitalic HRESULT GetItalic( long *pValue );
new tomConstants GetItalic();
/// Sets whether characters are in italics.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in italics.
///
/// -
/// tomFalse
/// Characters are not in italics.
///
/// -
/// tomToggle
/// Toggle the state of the Italic property.
///
/// -
/// tomUndefined
/// The Italic property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setitalic HRESULT SetItalic( [in] long Value );
new void SetItalic(tomConstants Value);
/// Gets the minimum font size at which kerning occurs.
///
/// Type: float*
/// The minimum font size at which kerning occurs, in floating-point points.
///
///
/// If the value pointed to by pValue is zero, kerning is off. Positive values turn on pair kerning for font point sizes
/// greater than or equal to the kerning value. For example, the value 1 turns on kerning for all legible sizes, whereas 16 turns on
/// kerning only for font sizes of 16 points and larger.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getkerning HRESULT GetKerning( float *pValue );
new float GetKerning();
/// Sets the minimum font size at which kerning occurs.
///
/// Type: float
/// The new value of the minimum kerning size, in floating-point points.
///
///
/// If this value is zero, kerning is turned off. Positive values turn on pair kerning for font sizes greater than this kerning
/// value. For example, the value 1 turns on kerning for all legible sizes, whereas 16 turns on kerning only for font sizes of 16
/// points and larger.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setkerning HRESULT SetKerning( [in] float Value );
new void SetKerning(float Value);
/// Gets the language ID or language code identifier (LCID).
///
/// Type: long*
///
/// The language ID or LCID. The low word contains the language identifier. The high word is either zero or it contains the high word
/// of the LCID. To retrieve the language identifier, mask out the high word. For more information, see Locale Identifiers.
///
///
///
/// To get the BCP-47 language tag, such as "en-US", call ITextRange2::GetText2(pBstr, tomLanguageTag), where pBstr
/// specifies the desired language tag.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getlanguageid HRESULT GetLanguageID( long *pValue );
new LCID GetLanguageID();
/// Sets the language ID or language code identifier (LCID).
///
/// Type: long
///
/// The new language identifier. The low word contains the language identifier. The high word is either zero or it contains the high
/// word of the locale identifier LCID. For more information, see Locale Identifiers.
///
///
///
///
/// If the high nibble of Value is tomCharset, set the charrep from the charset in the low byte and the pitch
/// and family from the next byte. See also ITextFont2::SetCharRep.
///
///
/// If the high nibble of Value is tomCharRepFromLcid, set the charrep from the LCID and set the LCID as well. See
/// ITextFont::GetLanguageID for more information.
///
///
/// To set the BCP-47 language tag, such as "en-US", call ITextRange2::SetText2 and set the tomLanguageTag and bstr with the
/// language tag.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setlanguageid HRESULT SetLanguageID( [in] long Value );
new void SetLanguageID(LCID Value);
/// Gets the font name.
///
/// Type: BSTR*
/// The font name.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getname HRESULT GetName( BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
new string GetName();
/// Sets the font name.
///
/// Type: BSTR
/// The new font name.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setname HRESULT SetName( [in] BSTR bstr );
new void SetName([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Gets whether characters are displayed as outlined characters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as outlined characters.
///
/// -
/// tomFalse
/// Characters are not displayed as outlined characters.
///
/// -
/// tomUndefined
/// The Outline property is undefined.
///
///
///
/// This property corresponds to the CFE_OUTLINE effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getoutline HRESULT GetOutline( long *pValue );
new tomConstants GetOutline();
/// Sets whether characters are displayed as outlined characters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are outlined.
///
/// -
/// tomFalse
/// Characters are not outlined.
///
/// -
/// tomToggle
/// Toggle the state of the Outline property.
///
/// -
/// tomUndefined
/// The Outline property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setoutline HRESULT SetOutline( [in] long Value );
new void SetOutline(tomConstants Value);
/// Gets the amount that characters are offset vertically relative to the baseline.
///
/// Type: float*
/// The amount of vertical offset, in floating-point points.
///
///
/// Displayed text typically has a zero value for this property. Positive values raise the text, and negative values lower it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getposition HRESULT GetPosition( float *pValue );
new float GetPosition();
/// Sets the amount that characters are offset vertically relative to the baseline.
///
/// Type: float
/// The new amount of vertical offset, in floating-point points.
///
///
/// Displayed text typically has a zero value for this property. Positive values raise the text, and negative values lower it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setposition HRESULT SetPosition( [in] float Value );
new void SetPosition(float Value);
/// Gets whether characters are protected against attempts to modify them.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are protected.
///
/// -
/// tomFalse
/// Characters are not protected.
///
/// -
/// tomUndefined
/// The Protected property is undefined.
///
///
///
///
/// In general, Text Object Model (TOM) methods that attempt to change the formatting or content of a range fail with
/// E_ACCESSDENIED if any part of that range is protected, or if the document is read only. To make a change in protected
/// text, the TOM client should attempt to turn off the protection of the text to be modified. The owner of the document may permit
/// this to happen. For example in rich edit controls, attempts to change protected text result in an EN_PROTECTED notification code
/// to the creator of the document, who then can refuse or grant permission for the change. The creator is the client that created a
/// windowed rich edit control through the CreateWindow function or the ITextHost object that called the CreateTextServices function
/// to create a windowless rich edit control.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getprotected HRESULT GetProtected( long *pValue );
new tomConstants GetProtected();
/// Sets whether characters are protected against attempts to modify them.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are protected.
///
/// -
/// tomFalse
/// Characters are not protected.
///
/// -
/// tomToggle
/// Toggle the state of the Protected property.
///
/// -
/// tomUndefined
/// The Protected property is undefined.
///
///
///
///
/// In general, Text Object Model (TOM) methods that attempt to change the formatting or content of a range will fail with
/// E_ACCESSDENIED if any part of that range is protected or if the document is read-only. To make a change in protected text,
/// the TOM client should attempt to turn off the protection of the text to be modified. The owner of the document may permit this to
/// happen. For example in rich edit controls, attempts to change protected text result in an EN_PROTECTED notification code to the
/// creator of the document, who then can refuse or grant permission for the change. The creator is the client that created a
/// windowed rich-edit control through the CreateWindow function or the ITextHost object that called the CreateTextServices function
/// to create a windowless rich edit control.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setprotected HRESULT SetProtected( [in] long Value );
new void SetProtected(tomConstants Value);
/// Gets whether characters are displayed as shadowed characters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as shadowed characters.
///
/// -
/// tomFalse
/// Characters are not displayed as shadowed characters.
///
/// -
/// tomUndefined
/// The Shadow property is undefined.
///
///
///
/// This property corresponds to the CFE_SHADOW effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getshadow HRESULT GetShadow( long *pValue );
new tomConstants GetShadow();
/// Sets whether characters are displayed as shadowed characters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are shadowed.
///
/// -
/// tomFalse
/// Characters are not shadowed.
///
/// -
/// tomToggle
/// Toggle the state of the Shadow property.
///
/// -
/// tomUndefined
/// The Shadow property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setshadow HRESULT SetShadow( [in] long Value );
new void SetShadow(tomConstants Value);
/// Gets the font size.
///
/// Type: float*
/// The font size, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsize HRESULT GetSize( float *pValue );
new float GetSize();
/// Sets the font size.
///
/// Type: float
/// The new font size, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsize HRESULT SetSize( [in] float Value );
new void SetSize(float Value);
/// Gets whether characters are in small capital letters.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in small capital letters.
///
/// -
/// tomFalse
/// Characters are not in small capital letters.
///
/// -
/// tomUndefined
/// The SmallCaps property is undefined.
///
///
///
/// This property corresponds to the CFE_SMALLCAPS effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsmallcaps HRESULT GetSmallCaps( long *pValue );
new tomConstants GetSmallCaps();
/// Sets whether characters are in small capital letters.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are in small capital letters.
///
/// -
/// tomFalse
/// Characters are not in small capital letters.
///
/// -
/// tomToggle
/// Toggle the state of the SmallCaps property.
///
/// -
/// tomUndefined
/// The SmallCaps property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsmallcaps HRESULT SetSmallCaps( [in] long Value );
new void SetSmallCaps(tomConstants Value);
/// Gets the amount of horizontal spacing between characters.
///
/// Type: float*
/// The amount of horizontal spacing between characters, in floating-point points.
///
///
/// Displayed text typically has an intercharacter spacing value of zero. Positive values expand the spacing, and negative values
/// compress it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getspacing HRESULT GetSpacing( float *pValue );
new float GetSpacing();
/// Sets the amount of horizontal spacing between characters.
///
/// Type: float
/// The new amount of horizontal spacing between characters, in floating-point points.
///
///
/// Displayed text typically has an intercharacter spacing value of zero. Positive values expand the spacing, and negative values
/// compress it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setspacing HRESULT SetSpacing( [in] float Value );
new void SetSpacing(float Value);
/// Gets whether characters are displayed with a horizontal line through the center.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed with a horizontal line through the center.
///
/// -
/// tomFalse
/// Characters are not displayed with a horizontal line through the center.
///
/// -
/// tomUndefined
/// The StrikeThrough property is undefined.
///
///
///
/// This property corresponds to the CFE_STRIKEOUT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getstrikethrough HRESULT GetStrikeThrough( long *pValue );
new tomConstants GetStrikeThrough();
/// Sets whether characters are displayed with a horizontal line through the center.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters have a horizontal line through the center.
///
/// -
/// tomFalse
/// Characters do not have a horizontal line through the center.
///
/// -
/// tomToggle
/// Toggle the state of the StrikeThrough property.
///
/// -
/// tomUndefined
/// The StrikeThrough property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setstrikethrough HRESULT SetStrikeThrough( [in] long
// Value );
new void SetStrikeThrough(tomConstants Value);
/// Gets whether characters are displayed as subscript.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as subscript.
///
/// -
/// tomFalse
/// Characters are not displayed as subscript.
///
/// -
/// tomUndefined
/// The Subscript property is undefined.
///
///
///
/// This property corresponds to the CFE_SUBSCRIPT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsubscript HRESULT GetSubscript( long *pValue );
new tomConstants GetSubscript();
/// Sets whether characters are displayed as subscript.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as subscript.
///
/// -
/// tomFalse
/// Characters are not displayed as subscript.
///
/// -
/// tomToggle
/// Toggle the state of the Subscript property.
///
/// -
/// tomUndefined
/// The Subscript property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsubscript HRESULT SetSubscript( [in] long Value );
new void SetSubscript(tomConstants Value);
/// Gets whether characters are displayed as superscript.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as superscript.
///
/// -
/// tomFalse
/// Characters are not displayed as superscript.
///
/// -
/// tomUndefined
/// The Superscript property is undefined.
///
///
///
/// This property corresponds to the CFE_SUPERSCRIPT effect described in the CHARFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getsuperscript HRESULT GetSuperscript( long *pValue );
new tomConstants GetSuperscript();
/// Sets whether characters are displayed as superscript.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed as superscript.
///
/// -
/// tomFalse
/// Characters are not displayed as superscript.
///
/// -
/// tomToggle
/// Toggle the state of the Superscript property.
///
/// -
/// tomUndefined
/// The Superscript property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setsuperscript HRESULT SetSuperscript( [in] long Value );
new void SetSuperscript(tomConstants Value);
/// Gets the type of underlining for the characters in a range.
///
/// Type: long*
/// The type of underlining. It can be one of the following values.
/// tomNone
/// tomSingle
/// tomWords
/// tomDouble
/// tomDotted
/// tomDash
/// tomDashDot
/// tomDashDotDot
/// tomWave
/// tomThick
/// tomHair
/// tomDoubleWave
/// tomHeavyWave
/// tomLongDash
/// tomThickDash
/// tomThickDashDot
/// tomThickDashDotDot
/// tomThickDotted
/// tomThickLongDash
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getunderline HRESULT GetUnderline( long *pValue );
new tomConstants GetUnderline();
/// Sets thevtype of underlining for the characters in a range.
///
/// Type: long
/// The type of underlining. It can be one of the following values.
/// tomNone
/// tomSingle
/// tomWords
/// tomDouble
/// tomDotted
/// tomDash
/// tomDashDot
/// tomDashDotDot
/// tomWave
/// tomThick
/// tomHair
/// tomDoubleWave
/// tomHeavyWave
/// tomLongDash
/// tomThickDash
/// tomThickDashDot
/// tomThickDashDotDot
/// tomThickDotted
/// tomThickLongDash
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setunderline HRESULT SetUnderline( [in] long Value );
new void SetUnderline(tomConstants Value);
/// Gets the font weight for the characters in a range.
///
/// Type: long*
///
/// The font weight. The Bold property is a binary version of the Weight property that sets the weight to FW_BOLD. The font
/// weight exists in the LOGFONT structure and the IFont interface. Windows defines the following degrees of font weight.
///
///
///
/// Font weight
/// Value
///
/// -
/// FW_DONTCARE
/// 0
///
/// -
/// FW_THIN
/// 100
///
/// -
/// FW_EXTRALIGHT
/// 200
///
/// -
/// FW_LIGHT
/// 300
///
/// -
/// FW_NORMAL
/// 400
///
/// -
/// FW_MEDIUM
/// 500
///
/// -
/// FW_SEMIBOLD
/// 600
///
/// -
/// FW_BOLD
/// 700
///
/// -
/// FW_EXTRABOLD
/// 800
///
/// -
/// FW_HEAVY
/// 900
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-getweight HRESULT GetWeight( long *pValue );
new int GetWeight();
/// Sets the font weight for the characters in a range.
///
/// Type: long
///
/// The new font weight. The Bold property is a binary version of the Weight property that sets the weight to FW_BOLD. The
/// font weight exists in the LOGFONT structure and the IFont interface. Windows defines the following degrees of font weight.
///
///
///
/// Font weight
/// Value
///
/// -
/// FW_DONTCARE
/// 0
///
/// -
/// FW_THIN
/// 100
///
/// -
/// FW_EXTRALIGHT
/// 200
///
/// -
/// FW_LIGHT
/// 300
///
/// -
/// FW_NORMAL
/// 400
///
/// -
/// FW_MEDIUM
/// 500
///
/// -
/// FW_SEMIBOLD
/// 600
///
/// -
/// FW_BOLD
/// 700
///
/// -
/// FW_EXTRABOLD
/// 800
///
/// -
/// FW_HEAVY
/// 900
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont-setweight HRESULT SetWeight( [in] long Value );
new void SetWeight(int Value);
/// Gets the count of extra properties in this character formatting collection.
///
/// Type: long*
/// The count of extra properties in this collection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getcount HRESULT GetCount( [out, retval] long *pCount );
int GetCount();
/// Gets whether support for automatic ligatures is active.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Automatic ligature support is active.
///
/// -
/// tomFalse
/// Automatic ligature support is not active.
///
/// -
/// tomUndefined
/// The AutoLigatures property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getautoligatures HRESULT GetAutoLigatures( [out, retval]
// long *pValue );
tomConstants GetAutoLigatures();
/// Sets whether support for automatic ligatures is active.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Automatic ligature support is active.
///
/// -
/// tomFalse
/// Automatic ligature support is not active.
///
/// -
/// tomToggle
/// Toggle the AutoLigatures property.
///
/// -
/// tomUndefined
/// The AutoLigatures property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setautoligatures HRESULT SetAutoLigatures( [in] long
// Value );
void SetAutoLigatures(tomConstants Value);
/// Gets the East Asian "autospace alphabetics" state.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Use East Asian autospace alphabetics.
///
/// -
/// tomFalse
/// Do not use East Asian autospace alphabetics.
///
/// -
/// tomUndefined
/// The AutospaceAlpha property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getautospacealpha HRESULT GetAutospaceAlpha( [out,
// retval] long *pValue );
tomConstants GetAutospaceAlpha();
/// Sets the East Asian "autospace alpha" state.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Use East Asian autospace alphabetics.
///
/// -
/// tomFalse
/// Do not use East Asian autospace alphabetics.
///
/// -
/// tomToggle
/// Toggle the AutospaceAlpha property.
///
/// -
/// tomUndefined
/// The AutospaceAlpha property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setautospacealpha HRESULT SetAutospaceAlpha( [in] long
// Value );
void SetAutospaceAlpha(tomConstants Value);
/// Gets the East Asian "autospace numeric" state.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Use East Asian autospace numerics.
///
/// -
/// tomFalse
/// Do not use East Asian autospace numerics.
///
/// -
/// tomUndefined
/// The AutospaceNumeric property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getautospacenumeric HRESULT GetAutospaceNumeric( [out,
// retval] long *pValue );
tomConstants GetAutospaceNumeric();
/// Sets the East Asian "autospace numeric" state.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Use East Asian autospace numerics.
///
/// -
/// tomFalse
/// Do not use East Asian autospace numerics.
///
/// -
/// tomToggle
/// Toggle the AutospaceNumeric property.
///
/// -
/// tomUndefined
/// The AutospaceNumeric property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setautospacenumeric HRESULT SetAutospaceNumeric( [in]
// long Value );
void SetAutospaceNumeric(tomConstants Value);
/// Gets the East Asian "autospace parentheses" state.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Use East Asian autospace parentheses.
///
/// -
/// tomFalse
/// Do not use East Asian autospace parentheses.
///
/// -
/// tomUndefined
/// The AutospaceParens property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getautospaceparens HRESULT GetAutospaceParens( [out,
// retval] long *pValue );
tomConstants GetAutospaceParens();
/// Sets the East Asian "autospace parentheses" state.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Use East Asian autospace parentheses.
///
/// -
/// tomFalse
/// Do not use East Asian autospace parentheses.
///
/// -
/// tomToggle
/// Toggle the AutospaceParens property.
///
/// -
/// tomUndefined
/// The AutospaceParens property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setautospaceparens HRESULT SetAutospaceParens( [in] long
// Value );
void SetAutospaceParens(tomConstants Value);
/// Gets the character repertoire (writing system).
///
/// Type: long*
/// The character repertoire. It can be one of the following values.
/// tomAboriginal
/// tomAnsi
/// tomArabic
/// tomArmenian
/// tomBaltic
/// tomBengali
/// tomBIG5
/// tomBraille
/// tomCherokee
/// tomCyrillic
/// tomDefaultCharRep
/// tomDevanagari
/// tomEastEurope
/// tomEmoji
/// tomEthiopic
/// tomGB2312
/// tomGeorgian
/// tomGreek
/// tomGujarati
/// tomGurmukhi
/// tomHangul
/// tomHebrew
/// tomJamo
/// tomKannada
/// tomKayahli
/// tomKharoshthi
/// tomKhmer
/// tomLao
/// tomLimbu
/// tomMac
/// tomMalayalam
/// tomMongolian
/// tomMyanmar
/// tomNewTaiLu
/// tomOEM
/// tomOgham
/// tomOriya
/// tomPC437
/// tomRunic
/// tomShiftJIS
/// tomSinhala
/// tomSylotinagr
/// tomSymbol
/// tomSyriac
/// tomTaiLe
/// tomTamil
/// tomTelugu
/// tomThaana
/// tomThai
/// tomTibetan
/// tomTurkish
/// tomVietnamese
/// tomUsymbol
/// tomYi
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getcharrep HRESULT GetCharRep( [out, retval] long
// *pValue );
tomConstants GetCharRep();
/// Sets the character repertoire (writing system).
///
/// Type: long
/// The new character repertoire. For a list of possible values, see ITextFont2::GetCharRep.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setcharrep HRESULT SetCharRep( [in] long Value );
void SetCharRep(tomConstants Value);
/// Gets the East Asian compression mode.
///
/// Type: long*
/// The compression mode, which can be one of these values:
/// tomCompressNone (default)
/// tomCompressPunctuation
/// tomCompressPunctuationAndKana
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getcompressionmode HRESULT GetCompressionMode( [out,
// retval] long *pValue );
tomConstants GetCompressionMode();
/// Sets the East Asian compression mode.
///
/// Type: long
/// The compression mode, which can be one of these values:
/// tomCompressNone (default)
/// tomCompressPunctuation
/// tomCompressPunctuationAndKana
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setcompressionmode HRESULT SetCompressionMode( [in] long
// Value );
void SetCompressionMode(tomConstants Value);
/// Gets the client cookie.
///
/// Type: long*
/// The client cookie.
///
///
/// This value is purely for the use of the client and has no meaning to the Text Object Model (TOM) engine. There are exceptions
/// where different values correspond to different character format runs.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getcookie HRESULT GetCookie( [out, retval] long *pValue );
int GetCookie();
/// Sets the client cookie.
///
/// Type: long
/// The client cookie.
///
///
/// This value is purely for the use of the client. It has no meaning to the Text Object Model (TOM) engine except that different
/// values correspond to different character format runs.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setcookie HRESULT SetCookie( [in] long Value );
void SetCookie(int Value);
/// Gets whether characters are displayed with double horizontal lines through the center.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed with double horizontal lines.
///
/// -
/// tomFalse
/// Characters are not displayed with double horizontal lines.
///
/// -
/// tomUndefined
/// The DoubleStrike property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getdoublestrike HRESULT GetDoubleStrike( [out, retval]
// long *pValue );
tomConstants GetDoubleStrike();
/// Sets whether characters are displayed with double horizontal lines through the center.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Characters are displayed with double horizontal lines.
///
/// -
/// tomFalse
/// Characters are not displayed with double horizontal lines.
///
/// -
/// tomToggle
/// Toggle the DoubleStrike property.
///
/// -
/// tomUndefined
/// The DoubleStrike property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setdoublestrike HRESULT SetDoubleStrike( [in] long Value );
void SetDoubleStrike(tomConstants Value);
/// Gets a duplicate of this character format object.
///
/// Type: ITextFont2**
/// The duplicate character format object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getduplicate2 HRESULT GetDuplicate2( [out, retval]
// ITextFont2 **ppFont );
ITextFont2 GetDuplicate2();
/// Sets the properties of this object by copying the properties of another text font object.
///
/// Type: ITextFont2*
/// The text font object to copy from.
///
///
/// Values with the tomUndefined attribute have no effect.
/// For an example of how to use font duplicates, see ITextRange::SetFont.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setduplicate2 HRESULT SetDuplicate2( [in] ITextFont2
// *pFont );
void SetDuplicate2([In, Optional] ITextFont2? pFont);
/// Gets the link type.
///
/// Type: long*
/// The link type. It can be one of the following values.
/// tomNoLink
/// tomClientLink
/// tomFriendlyLinkName
/// tomFriendlyLinkAddress
/// tomAutoLinkURL
/// tomAutoLinkEmail
/// tomAutoLinkPhone
/// tomAutoLinkPath
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getlinktype HRESULT GetLinkType( [out, retval] long
// *pValue );
tomConstants GetLinkType();
/// Gets whether a math zone is active.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// A math zone is active.
///
/// -
/// tomFalse
/// A math zone is not active.
///
/// -
/// tomUndefined
/// The MathZone property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getmathzone HRESULT GetMathZone( [out, retval] long
// *pValue );
tomConstants GetMathZone();
/// Sets whether a math zone is active.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// A math zone is active.
///
/// -
/// tomFalse
/// A math zone is not active.
///
/// -
/// tomToggle
/// Toggle the MathZone property.
///
/// -
/// tomUndefined
/// The MathZone property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setmathzone HRESULT SetMathZone( [in] long Value );
void SetMathZone(tomConstants Value);
/// Gets whether "decrease widths on pairs" is active.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Decrease widths on pairs is active.
///
/// -
/// tomFalse
/// Decrease widths on pairs is not active.
///
/// -
/// tomUndefined
/// The ModWidthPairs property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getmodwidthpairs HRESULT GetModWidthPairs( [out, retval]
// long *pValue );
tomConstants GetModWidthPairs();
/// Sets whether "decrease widths on pairs" is active.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Decrease widths on pairs is active.
///
/// -
/// tomFalse
/// Decrease widths on pairs is not active.
///
/// -
/// tomToggle
/// Toggle the ModWidthPairs property.
///
/// -
/// tomUndefined
/// The ModWidthPairs property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setmodwidthpairs HRESULT SetModWidthPairs( [in] long
// Value );
void SetModWidthPairs(tomConstants Value);
/// Gets whether "increase width of whitespace" is active.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Increase width of whitespace is active.
///
/// -
/// tomFalse
/// Increase width of whitespace is not active.
///
/// -
/// tomUndefined
/// The ModWidthSpace property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getmodwidthspace HRESULT GetModWidthSpace( [out, retval]
// long *pValue );
tomConstants GetModWidthSpace();
/// Sets whether "increase width of whitespace" is active.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Increase width of whitespace is active.
///
/// -
/// tomFalse
/// Increase width of whitespace is not active.
///
/// -
/// tomToggle
/// Toggle the ModWidthSpace property.
///
/// -
/// tomUndefined
/// The ModWidthSpace property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setmodwidthspace HRESULT SetModWidthSpace( [in] long
// Value );
void SetModWidthSpace(tomConstants Value);
/// Gets whether old-style numbers are active.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Old-style numbers are active.
///
/// -
/// tomFalse
/// Old-style numbers are not active.
///
/// -
/// tomUndefined
/// The OldNumbers property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getoldnumbers HRESULT GetOldNumbers( [out, retval] long
// *pValue );
tomConstants GetOldNumbers();
/// Sets whether old-style numbers are active.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Old-style numbers are active.
///
/// -
/// tomFalse
/// Old-style numbers are not active.
///
/// -
/// tomToggle
/// Toggle the OldNumbers property.
///
/// -
/// tomUndefined
/// The OldNumbers property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setoldnumbers HRESULT SetOldNumbers( [in] long Value );
void SetOldNumbers(tomConstants Value);
/// Gets whether overlapping text is active.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Overlapping text is active.
///
/// -
/// tomFalse
/// Overlapping text is not active.
///
/// -
/// tomUndefined
/// The Overlapping property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getoverlapping HRESULT GetOverlapping( [out, retval]
// long *pValue );
tomConstants GetOverlapping();
/// Sets whether overlapping text is active.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Overlapping text is active.
///
/// -
/// tomFalse
/// Overlapping text is not active.
///
/// -
/// tomToggle
/// Toggle the Overlapping property.
///
/// -
/// tomUndefined
/// The Overlapping property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setoverlapping HRESULT SetOverlapping( [in] long Value );
void SetOverlapping(tomConstants Value);
/// Gets the subscript or superscript position relative to the baseline.
///
/// Type: long*
/// The subscript or superscript position relative to the baseline.
///
///
/// The subscript or superscript position is relative to the baseline as a percent of the font height.
///
/// Subscripts and superscripts in math zones are handled using the tomSubscript, tomSuperscript, tomSubSup, and tomLeftSubSup
/// mathematical objects. See ITextRange2::GetInlineObject.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getpositionsubsuper HRESULT GetPositionSubSuper( [out,
// retval] long *pValue );
int GetPositionSubSuper();
/// Sets the position of a subscript or superscript relative to the baseline, as a percentage of the font height.
///
/// Type: long
/// The new subscript or superscript position.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setpositionsubsuper HRESULT SetPositionSubSuper( [in]
// long Value );
void SetPositionSubSuper(int Value);
/// Gets the font horizontal scaling percentage.
///
/// Type: long*
/// The scaling percentage.
///
///
/// The font horizontal scaling percentage can range from 200, which doubles the widths of characters, to 0, where no scaling is
/// performed. When the percentage is increased the height does not change.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getscaling HRESULT GetScaling( [out, retval] long
// *pValue );
int GetScaling();
/// Sets the font horizontal scaling percentage.
///
/// Type: long
///
/// The scaling percentage. Values from 0 through 255 are valid. For example, a value of 200 doubles the widths of characters while
/// retaining the same height. A value of 0 has the same effect as a value of 100; that is, it turns scaling off.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setscaling HRESULT SetScaling( [in] long Value );
void SetScaling(int Value);
/// Gets the East Asian space extension value.
///
/// Type: float*
/// The space extension, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getspaceextension HRESULT GetSpaceExtension( [out,
// retval] float *pValue );
float GetSpaceExtension();
/// Sets the East Asian space extension value.
///
/// Type: float
/// The new space extension, in floating-points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setspaceextension HRESULT SetSpaceExtension( [in] float
// Value );
void SetSpaceExtension(float Value);
/// Gets the underline position mode.
///
/// Type: long*
/// The underline position mode. It can be one of the following values.
/// tomUnderlinePositionAuto tomUnderlinePositionBelow tomUnderlinePositionAbove
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getunderlinepositionmode HRESULT
// GetUnderlinePositionMode( [out, retval] long *pValue );
tomConstants GetUnderlinePositionMode();
/// Sets the underline position mode.
///
/// Type: long
/// The new underline position mode. It can be one of the following values.
///
/// -
/// tomUnderlinePositionAuto (the default)
///
/// -
/// tomUnderlinePositionBelow
///
/// -
/// tomUnderlinePositionAbove
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setunderlinepositionmode HRESULT
// SetUnderlinePositionMode( [in] long Value );
void SetUnderlinePositionMode(tomConstants Value);
/// Gets the character format effects.
///
/// Type: long*
/// A combination of the following character format values.
/// tomAllCaps
/// tomBold
/// tomDisabled
/// tomEmboss
/// tomHidden
/// tomImprint
/// tomInlineObjectStart
/// tomItalic
/// tomLink
/// tomLinkProtected
/// tomMathZone
/// tomMathZoneDisplay
/// tomMathZoneNoBuildUp
/// tomMathZoneOrdinary
/// tomOutline
/// tomProtected
/// tomRevised
/// tomShadow
/// tomSmallCaps
/// tomStrikeout
/// tomUnderline
/// If the tomInlineObjectStart flag is set, you might want to call GetInlineObject for more inline object properties.
///
///
/// Type: long*
///
/// The differences in these flags over the range. A value of zero indicates that the properties are the same over the range. For an
/// insertion point, this value is always zero.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-geteffects HRESULT GetEffects( [out] long *pValue, [out]
// long *pMask );
void GetEffects(out tomConstants pValue, out tomConstants pMask);
/// Gets the additional character format effects.
///
/// Type: long*
/// A combination of the following character format flags.
/// tomAutoSpaceAlpha
/// tomAutoSpaceNumeric
/// tomAutoSpaceParens
/// tomDoublestrike
/// tomEmbeddedFont
/// tomModWidthPairs
/// tomModWidthSpace
/// tomOverlapping
///
///
/// Type: long*
///
/// The differences in these flags over the range. Zero values indicate that the properties are the same over the range. For an
/// insertion point, this value is always zero.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-geteffects2 HRESULT GetEffects2( [out] long *pValue,
// [out] long *pMask );
void GetEffects2(out tomConstants pValue, out tomConstants pMask);
/// Gets the value of the specified property.
///
/// Type: long
/// The property ID of the value to return. See Remarks.
///
///
/// Type: long*
/// The property value.
///
/// Property IDs are defined by the Text Object Model (TOM). Here are how some of the TOM values are obtained:
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getproperty HRESULT GetProperty( [in] long Type, [out]
// long *pValue );
int GetProperty(int Type);
/// Gets the property type and value of the specified extra property.
///
/// Type: long
/// The collection index of the extra property.
///
///
/// Type: long*
/// The property ID.
///
///
/// Type: long*
/// The property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-getpropertyinfo HRESULT GetPropertyInfo( [in] long
// Index, [out] long *pType, [out] long *pValue );
void GetPropertyInfo(int Index, out int pType, out int pValue);
/// Determines whether this text font object has the same properties as the specified text font object.
///
/// Type: ITextFont2*
/// The text font object to compare against.
///
///
/// Type: long*
///
/// A tomBool value that is tomTrue if the font objects have the same properties, or tomFalse if they don't. This
/// parameter can be NULL.
///
///
///
/// For two text font objects to be equal, both must belong to the same Text Object Model (TOM) object.
/// The ITextFont::IsEqual2 method ignores entries for which either font object has a tomUndefined value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-isequal2 HRESULT IsEqual2( [in] ITextFont2 *pFont, [out]
// long *pB );
tomConstants IsEqual2([In, Optional] ITextFont2? pFont);
/// Sets the character format effects.
///
/// Type: long
/// A combination of the following character format values.
/// tomAllCaps
/// tomBold
/// tomDisabled
/// tomEmboss
/// tomHidden
/// tomImprint
/// tomInlineObjectStart
/// tomItalic
/// tomLink
/// tomLinkProtected
/// tomMathZone
/// tomMathZoneDisplay
/// tomMathZoneNoBuildUp
/// tomMathZoneOrdinary
/// tomOutline
/// tomProtected
/// tomRevised
/// tomShadow
/// tomSmallCaps
/// tomStrikeout
/// tomUnderline
///
///
/// Type: long
///
/// The desired mask, which can be a combination of the Value flags. Only effects with the corresponding mask flag set are modified.
///
///
/// Only effects with the corresponding mask flag set are modified.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-seteffects HRESULT SetEffects( [in] long Value, [in]
// long Mask );
void SetEffects(tomConstants Value, tomConstants Mask);
/// Sets the additional character format effects.
///
/// Type: long
/// A combination of the following character format flags.
/// tomAutoSpaceAlpha
/// tomAutoSpaceNumeric
/// tomAutoSpaceParens
/// tomDoublestrike
/// tomEmbeddedFont
/// tomModWidthPairs
/// tomModWidthSpace
/// tomOverlapping
///
///
/// Type: long
///
/// The desired mask, which can be a combination of the Value flags. Only effects with the corresponding mask flag set are modified.
///
///
/// Only effects with the corresponding mask flag set are modified.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-seteffects2 HRESULT SetEffects2( [in] long Value, [in]
// long Mask );
void SetEffects2(tomConstants Value, tomConstants Mask);
/// Sets the value of the specified property.
///
/// Type: long
/// The ID of the property value to set. Types are defined by TOM. For a list of types, see ITextFont2::GetProperty.
///
///
/// Type: long
/// The new property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextfont2-setproperty HRESULT SetProperty( [in] long Type, [in]
// long Value );
void SetProperty(int Type, int Value);
}
/// Text Object Model (TOM) rich text-range attributes are accessed through a pair of dual interfaces, ITextFont and ITextPara.
///
///
/// The ITextFont and ITextPara interfaces encapsulate the functionality of the Microsoft Word Format Font and
/// Paragraph dialog boxes, respectively. Both interfaces include a duplicate ( Value) property that can return a duplicate
/// of the attributes in a range object or transfer a set of attributes to a range. As such, they act like programmable format painters.
/// For example, you could transfer all attributes from range r1 to range r2 except for making r2 bold and the font size 12 points by
/// using the following subroutine.
///
/// See SetFont for a similar example written in C++.
///
/// The ITextPara interface encapsulates the Word Paragraph dialog box. All measurements are given in floating-point points. The
/// rich edit control is able to accept and return all ITextPara properties intact (that is, without modification), both through
/// TOM and through its Rich Text Format (RTF) converters. However, the following properties have no effect on what the control displays:
///
///
/// -
/// DoNotHyphen
///
/// -
/// KeepTogether
///
/// -
/// KeepWithNext
///
/// -
/// LineSpacing
///
/// -
/// LineSpacingRule
///
/// -
/// NoLineNumber
///
/// -
/// PageBreakBefore
///
/// -
/// Tab alignments
///
/// -
/// Tab styles (other than tomAlignLeft and tomSpaces)
///
/// -
/// Style WidowControl
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextpara
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextPara")]
[ComImport, Guid("8CC497C4-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)]
public interface ITextPara
{
///
/// Creates a duplicate of the specified paragraph format object. The duplicate property is the default property of an ITextPara object.
///
///
/// Type: ITextPara**
/// The duplicate ITextPara object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getduplicate HRESULT GetDuplicate( ITextPara **ppPara );
ITextPara GetDuplicate();
/// Sets the formatting for an existing paragraph by copying a given format.
///
/// Type: ITextPara*
/// The ITextPara range that contains the new paragraph formatting.
///
/// The tomUndefined values have no effect, that is, they will not change the target values.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setduplicate HRESULT SetDuplicate( [in] ITextPara *pPara );
void SetDuplicate([In, Optional] ITextPara? pPara);
/// Determines whether the paragraph formatting can be changed.
///
/// Type: long*
///
/// A variable that is tomTrue if the paragraph formatting can be changed or tomFalse if it cannot be changed. This
/// parameter can be null.
///
///
///
/// Type: HRESULT
///
/// If paragraph formatting can change, ITextPara::CanChange succeeds and returns S_OK. If paragraph formatting cannot
/// change, the method fails and returns S_FALSE. For more information about COM error codes, see Error Handling in COM.
///
///
///
/// The * pbCanChange parameter returns tomTrue only if the paragraph formatting can be changed (that is, if no part of
/// an associated range is protected and an associated document is not read-only). If this ITextPara object is a duplicate, no
/// protection rules apply.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-canchange HRESULT CanChange( [retval] long *pValue );
[PreserveSig]
HRESULT CanChange(out tomConstants pValue);
/// Determines if the current range has the same properties as a specified range.
///
/// Type: ITextPara*
/// The ITextPara range that is compared to the current range.
///
///
/// Type: long*
/// The comparison result. The value can be null.
///
///
/// Type: HRESULT
///
/// If the objects are equal, ITextPara::IsEqual succeeds and returns S_OK. If the objects are not equal, the method
/// fails and returns S_FALSE. For more information about COM error codes, see Error Handling in COM.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-isequal HRESULT IsEqual( ITextPara *pPara, long *pValue );
[PreserveSig]
HRESULT IsEqual([In, Optional] ITextPara? pPara, out int pValue);
/// Resets the paragraph formatting to a choice of default values.
///
/// Type: long
/// Type of reset. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomDefault
/// Used for paragraph formatting that is defined by the RTF \pard, that is, the paragraph default control word.
///
/// -
/// tomUndefined
/// Used for all undefined values. The tomUndefined value is only valid for duplicate (clone) ITextPara objects.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-reset HRESULT Reset( [in] long Value );
void Reset(tomConstants Value);
/// Retrieves the style handle to the paragraphs in the specified range.
///
/// Type: long*
/// The paragraph style handle. For more information, see the Remarks.
///
///
///
/// The Text Object Model (TOM) version 1.0 has no way to specify the meanings of user-defined style handles. They depend on other
/// facilities of the text system implementing TOM. Negative style handles are reserved for built-in character and paragraph styles.
/// Currently defined values are listed in the following table. For a description of the following styles, see the Microsoft Word documentation.
///
///
///
/// Style
/// Value
/// Style
/// Value
///
/// -
/// StyleNormal
/// â1
/// StyleTableofAuthorities
/// â45
///
/// -
/// StyleHeading1
/// â2
/// StyleMacroText
/// â46
///
/// -
/// StyleHeading2
/// â3
/// StyleTOAHeading
/// â47
///
/// -
/// StyleHeading3
/// â4
/// StyleList
/// â48
///
/// -
/// StyleHeading4
/// â5
/// StyleListBullet
/// â49
///
/// -
/// StyleHeading5
/// â6
/// StyleListNumber
/// â50
///
/// -
/// StyleHeading6
/// â7
/// StyleList2
/// â51
///
/// -
/// StyleHeading7
/// â8
/// StyleList3
/// â52
///
/// -
/// StyleHeading8
/// â9
/// StyleList4
/// â53
///
/// -
/// StyleHeading9
/// â10
/// StyleList5
/// â54
///
/// -
/// StyleIndex1
/// â11
/// StyleListBullet2
/// â55
///
/// -
/// StyleIndex2
/// â12
/// StyleListBullet3
/// â56
///
/// -
/// StyleIndex3
/// â13
/// StyleListBullet4
/// â57
///
/// -
/// StyleIndex4
/// â14
/// StyleListBullet5
/// â58
///
/// -
/// StyleIndex5
/// â15
/// StyleListNumber2
/// â59
///
/// -
/// StyleIndex6
/// â16
/// StyleListNumber3
/// â60
///
/// -
/// StyleIndex7
/// â17
/// StyleListNumber4
/// â61
///
/// -
/// StyleIndex8
/// â18
/// StyleListNumber5
/// â62
///
/// -
/// StyleIndex9
/// â19
/// StyleTitle
/// â63
///
/// -
/// StyleTOC1
/// â20
/// StyleClosing
/// â64
///
/// -
/// StyleTOC2
/// â21
/// StyleSignature
/// â65
///
/// -
/// StyleTOC3
/// â22
/// StyleDefaultParagraphFont
/// â66
///
/// -
/// StyleTOC4
/// â23
/// StyleBodyText
/// â67
///
/// -
/// StyleTOC5
/// â24
/// StyleBodyTextIndent
/// â68
///
/// -
/// StyleTOC6
/// â25
/// StyleListContinue
/// â69
///
/// -
/// StyleTOC7
/// â26
/// StyleListContinue2
/// â70
///
/// -
/// StyleTOC8
/// â27
/// StyleListContinue3
/// â71
///
/// -
/// StyleTOC9
/// â28
/// StyleListContinue4
/// â72
///
/// -
/// StyleNormalIndent
/// â29
/// StyleListContinue5
/// â73
///
/// -
/// StyleFootnoteText
/// â30
/// StyleMessageHeader
/// â74
///
/// -
/// StyleAnnotationText
/// â31
/// StyleSubtitle
/// â75
///
/// -
/// StyleHeader
/// â32
/// StyleSalutation
/// â76
///
/// -
/// StyleFooter
/// â33
/// StyleDate
/// â77
///
/// -
/// StyleIndexHeading
/// â34
/// StyleBodyTextFirstIndent
/// â78
///
/// -
/// StyleCaption
/// â35
/// StyleBodyTextFirstIndent2
/// â79
///
/// -
/// StyleTableofFigures
/// â36
/// StyleNoteHeading
/// â80
///
/// -
/// StyleEnvelopeAddress
/// â37
/// StyleBodyText2
/// â81
///
/// -
/// StyleEnvelopeReturn
/// â38
/// StyleBodyText3
/// â82
///
/// -
/// StyleFootnoteReference
/// â39
/// StyleBodyTextIndent2
/// â83
///
/// -
/// StyleAnnotationReference
/// â40
/// StyleBodyTextIndent3
/// â84
///
/// -
/// StyleLineNumber
/// â41
/// StyleBlockQuotation
/// â85
///
/// -
/// StylePageNumber
/// â42
/// StyleHyperlink
/// â86
///
/// -
/// StyleEndnoteReference
/// â43
/// StyleHyperlinkFollowed
/// â87
///
/// -
/// StyleEndnoteText
/// â44
/// Â
/// Â
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getstyle HRESULT GetStyle( long *pValue );
int GetStyle();
/// Sets the paragraph style for the paragraphs in a range.
///
/// Type: long
/// New paragraph style handle. For a list of styles, see the Remarks section of ITextPara::GetStyle.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setstyle HRESULT SetStyle( [in] long Value );
void SetStyle(int Value);
/// Retrieves the current paragraph alignment value.
///
/// Type: long*
/// The paragraph alignment, which can be one of the following values.
/// tomAlignLeft
/// tomAlignCenter
/// tomAlignRight
/// tomAlignJustify
/// tomAlignInterWord
/// tomAlignNewspaper
/// tomAlignInterLetter
/// tomAlignScaled
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getalignment HRESULT GetAlignment( long *pValue );
tomConstants GetAlignment();
/// Sets the paragraph alignment.
///
/// Type: long
/// New paragraph alignment. For a list of possible values, see the ITextPara::GetAlignment method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setalignment HRESULT SetAlignment( [in] long Value );
void SetAlignment(tomConstants Value);
/// Determines whether automatic hyphenation is enabled for the range.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Automatic hyphenation is enabled.
///
/// -
/// tomFalse
/// Automatic hyphenation is disabled.
///
/// -
/// tomUndefined
/// The hyphenation property is undefined.
///
///
///
/// This property corresponds to the PFE_DONOTHYPHEN effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gethyphenation HRESULT GetHyphenation( long *pValue );
tomConstants GetHyphenation();
/// Controls hyphenation for the paragraphs in the range.
///
/// Type: long
/// Indicates how hyphenation is controlled. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Automatic hyphenation is enabled.
///
/// -
/// tomFalse
/// Automatic hyphenation is disabled.
///
/// -
/// tomUndefined
/// The hyphenation property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-sethyphenation HRESULT SetHyphenation( [in] long Value );
void SetHyphenation(tomConstants Value);
///
/// Retrieves the amount used to indent the first line of a paragraph relative to the left indent. The left indent is the indent for
/// all lines of the paragraph except the first line.
///
///
/// Type: float*
/// The first-line indentation amount in floating-point points.
///
///
/// To set the first line indentation amount, call the ITextPara::SetIndents method.
///
/// To get and set the indent for all other lines of the paragraph (that is, the left indent), use ITextPara::GetLeftIndent and ITextPara::SetIndents.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getfirstlineindent HRESULT GetFirstLineIndent( float
// *pValue );
float GetFirstLineIndent();
/// Determines whether page breaks are allowed within paragraphs.
///
/// Type: long*
/// A variable that is one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed within a paragraph.
///
/// -
/// tomFalse
/// Page breaks are allowed within a paragraph.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEP effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getkeeptogether HRESULT GetKeepTogether( long *pValue );
tomConstants GetKeepTogether();
/// Controls whether page breaks are allowed within a paragraph in a range.
///
/// Type: long
/// Indicates whether page breaks are allowed within a paragraph in a range. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed within a paragraph.
///
/// -
/// tomFalse
/// Page breaks are allowed within a paragraph.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEP effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setkeeptogether HRESULT SetKeepTogether( [in] long Value );
void SetKeepTogether(tomConstants Value);
/// Determines whether page breaks are allowed between paragraphs in the range.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed between paragraphs.
///
/// -
/// tomFalse
/// Page breaks are allowed between paragraphs.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getkeepwithnext HRESULT GetKeepWithNext( long *pValue );
int GetKeepWithNext();
/// Controls whether page breaks are allowed between the paragraphs in a range.
///
/// Type: long
/// Indicates if page breaks can be used between the paragraphs of a range. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed between paragraphs.
///
/// -
/// tomFalse
/// Page breaks are allowed between paragraphs.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setkeepwithnext HRESULT SetKeepWithNext( [in] long Value );
void SetKeepWithNext(tomConstants Value);
///
/// Retrieves the distance used to indent all lines except the first line of a paragraph. The distance is relative to the left margin.
///
///
/// Type: float*
/// The left indentation, in floating-point points.
///
///
/// To set the left indentation amount, call the ITextPara::SetIndents method.
/// To get the first-line indent, call ITextPara::GetFirstLineIndent.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getleftindent HRESULT GetLeftIndent( float *pValue );
float GetLeftIndent();
/// Retrieves the line-spacing value for the text range.
///
/// Type: float*
/// The line-spacing value. The following table shows how this value is interpreted for the different line-spacing rules.
///
///
/// Line spacing rule
/// Meaning
///
/// -
/// tomLineSpaceSingle
/// The line-spacing value is ignored.
///
/// -
/// tomLineSpace1pt5
/// The line-spacing value is ignored.
///
/// -
/// tomLineSpaceDouble
/// The line-spacing value is ignored.
///
/// -
/// tomLineSpaceAtLeast
///
/// The line-spacing value specifies the spacing, in floating-point points, from one line to the next. However, if the value is less
/// than single spacing, the control displays single-spaced text.
///
///
/// -
/// tomLineSpaceExactly
///
/// The line-spacing value specifies the exact spacing, in floating-point points, from one line to the next (even if the value is
/// less than single spacing).
///
///
/// -
/// tomLineSpaceMultiple
/// The line-spacing value specifies the line spacing, in lines.
///
///
///
/// To retrieve the line-spacing rule, call the ITextPara::GetLineSpacingRule method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacing HRESULT GetLineSpacing( float *pValue );
float GetLineSpacing();
/// Retrieves the line-spacing rule for the text range.
///
/// Type: long*
/// A variable that is one of the following values to indicate the line-spacing rule.
/// tomLineSpaceSingle
/// tomLineSpace1pt5
/// tomLineSpaceDouble
/// tomLineSpaceAtLeast
/// tomLineSpaceExactly
/// tomLineSpaceMultiple
/// tomLineSpacePercent
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacingrule HRESULT GetLineSpacingRule( long
// *pValue );
tomConstants GetLineSpacingRule();
/// Retrieves the kind of alignment to use for bulleted and numbered lists.
///
/// Type: long*
/// A variable that is one of the following values to indicate the kind of bullet and numbering alignment.
///
///
/// Value
/// Meaning
///
/// -
/// tomAlignLeft
/// Text is left aligned.
///
/// -
/// tomAlignCenter
/// Text is centered in the line.
///
/// -
/// tomAlignRight
/// Text is right aligned.
///
///
///
/// For a description of the different types of lists, see the ITextPara::GetListType method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistalignment HRESULT GetListAlignment( long *pValue );
tomConstants GetListAlignment();
/// Sets the alignment of bulleted or numbered text used for paragraphs.
///
/// Type: long
/// New list alignment value. For possible values, see ITextPara::GetListAlignment.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistalignment HRESULT SetListAlignment( [in] long
// Value );
void SetListAlignment(tomConstants Value);
/// Retrieves the list level index used with paragraphs.
///
/// Type: long*
/// A variable that is the list level index. The value of pValue can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// 0
/// No list.
///
/// -
/// 1
/// First-level (outermost) list.
///
/// -
/// 2
/// Second-level (nested) list. This is nested under a level 1 list item.
///
/// -
/// 3
/// Third-level (nested) list. This is nested under a level 2 list item.
///
/// -
/// and so forth
/// Nesting continues similarly.
///
///
/// Â
/// Up to three levels are common in HTML documents.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistlevelindex HRESULT GetListLevelIndex( long *pValue );
int GetListLevelIndex();
/// Sets the list level index used for paragraphs.
///
/// Type: long
/// New list level index value. For possible values, see ITextPara::GetListLevelIndex.
///
/// Setting the list level index does not automatically change a list's indentation and other paragraph properties.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistlevelindex HRESULT SetListLevelIndex( [in] long
// Value );
void SetListLevelIndex(int Value);
/// Retrieves the starting value or code of a list numbering sequence.
///
/// Type: long*
/// The starting value or code of a list numbering sequence. For the possible values, see the ITextPara::GetListType method.
///
/// For a discussion on which sequence to use, see the ITextPara::GetListType method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getliststart HRESULT GetListStart( long *pValue );
tomConstants GetListStart();
/// Sets the starting number or Unicode value for a numbered list.
///
/// Type: long
/// New starting number or Unicode value for a numbered list.
///
/// Other characteristics of a list are specified by ITextPara::SetListType.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setliststart HRESULT SetListStart( [in] long Value );
void SetListStart(tomConstants Value);
///
/// Retrieves the list tab setting, which is the distance between the first-line indent and the text on the first line. The numbered
/// or bulleted text is left-justified, centered, or right-justified at the first-line indent value.
///
///
/// Type: float*
/// The list tab setting. The list tab value is in floating-point points.
///
/// To determine whether the numbered or bulleted text is left-justified, centered, or right-justified, call ITextPara::GetListAlignment.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttab HRESULT GetListTab( float *pValue );
float GetListTab();
///
/// Sets the list tab setting, which is the distance between the first indent and the start of the text on the first line.
///
///
/// Type: float
/// New list tab value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttab HRESULT SetListTab( [in] float Value );
void SetListTab(float Value);
/// Retrieves the kind of numbering to use with paragraphs.
///
/// Type: long*
/// A variable that is of the following values to indicate the kind of list numbering.
/// tomListNone
/// tomListBullet
/// tomListNumberAsArabic
/// tomListNumberAsLCLetter
/// tomListNumberAsUCLetter
/// tomListNumberAsLCRoman
/// tomListNumberAsUCRoman
/// tomListNumberAsSequence
/// tomListNumberedCircle
/// tomListNumberedBlackCircleWingding
/// tomListNumberedWhiteCircleWingding
/// tomListNumberedArabicWide
/// tomListNumberedChS
/// tomListNumberedChT
/// tomListNumberedJpnChs
/// tomListNumberedJpnKor
/// tomListNumberedArabic1
/// tomListNumberedArabic2
/// tomListNumberedHebrew
/// tomListNumberedThaiAlpha
/// tomListNumberedThaiNum
/// tomListNumberedHindiAlpha
/// tomListNumberedHindiAlpha1
/// tomListNumberedHindiNum
///
/// By default, numbers are followed by a right parenthesis, for example: 1). However, pValue can include one of the following
/// flags to indicate a different formatting.
///
/// tomListMinus
/// tomListParentheses
/// tomListPeriod
/// tomListPlain
///
///
/// Values above 32 correspond to Unicode values for bullets.
/// The mobile Microsoft Office version of the rich edit control uses tomIgnoreNumberStyle to suppress setting the style.
///
/// The following Microsoft Visual Basic for Applications (VBA) example numbers the paragraphs in a range, starting with the number 2
/// and following the numbers with a period.
///
///
/// For an example of tomListNumberAsSequence, set to 0x2780, which gives you circled numbers. The Unicode Standard has examples of
/// many more numbering sequences.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttype HRESULT GetListType( long *pValue );
tomConstants GetListType();
/// Sets the type of list to be used for paragraphs.
///
/// Type: long
/// New list type. For possible list types, see the ITextPara::GetListType method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttype HRESULT SetListType( [in] long Value );
void SetListType(tomConstants Value);
/// Determines whether paragraph numbering is enabled.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Line numbering is disabled.
///
/// -
/// tomFalse
/// Line numbering is enabled.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// Paragraph numbering is when the paragraphs of a range are numbered. The number appears on the first line of a paragraph.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getnolinenumber HRESULT GetNoLineNumber( long *pValue );
tomConstants GetNoLineNumber();
/// Determines whether to suppress line numbering of paragraphs in a range.
///
/// Type: long
/// Indicates if line numbering is suppressed. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Line numbering is disabled.
///
/// -
/// tomFalse
/// Line numbering is enabled.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
///
/// This property concerns the numbering of paragraphs in a range. If Value is tomFalse, the number of the paragraph
/// appears on the first line of the paragraph.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setnolinenumber HRESULT SetNoLineNumber( [in] long Value );
void SetNoLineNumber(tomConstants Value);
/// Determines whether each paragraph in the range must begin on a new page.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Each paragraph in this range must begin on a new page.
///
/// -
/// tomFalse
/// The paragraphs in this range do not need to begin on a new page.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getpagebreakbefore HRESULT GetPageBreakBefore( long
// *pValue );
tomConstants GetPageBreakBefore();
/// Controls whether there is a page break before each paragraph in a range.
///
/// Type: long
/// A tomBool value that controls page breaks before paragraphs. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Paragraphs in this range must begin on a new page.
///
/// -
/// tomFalse
/// Paragraphs in this range do not need to begin on a new page.
///
/// -
/// tomToggle
/// Toggle the property value.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
///
/// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setpagebreakbefore HRESULT SetPageBreakBefore( [in] long
// Value );
void SetPageBreakBefore(tomConstants Value);
/// Retrieves the size of the right margin indent of a paragraph.
///
/// Type: float*
/// The right indentation, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getrightindent HRESULT GetRightIndent( float *pValue );
float GetRightIndent();
/// Sets the right margin of paragraph.
///
/// Type: float
/// Right indent, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setrightindent HRESULT SetRightIndent( [in] float Value );
void SetRightIndent(float Value);
/// Sets the first-line indent, the left indent, and the right indent for a paragraph.
///
/// Type: float
///
/// Indent of the first line in a paragraph, relative to the left indent. The value is in floating-point points and can be positive
/// or negative.
///
///
///
/// Type: float
///
/// Left indent of all lines except the first line in a paragraph, relative to left margin. The value is in floating-point points and
/// can be positive or negative.
///
///
///
/// Type: float
///
/// Right indent of all lines in paragraph, relative to the right margin. The value is in floating-point points and can be positive
/// or negative. This value is optional.
///
///
///
/// Line indents are not allowed to position text in the margins. If the first-line indent is set to a negative value (for an
/// outdented paragraph) while the left indent is zero, the first-line indent is reset to zero. To avoid this problem while retaining
/// property sets, set the first-line indent value equal to zero either explicitly or by calling the ITextPara::Reset method. Then,
/// call ITextPara::SetIndents to set a nonnegative, left-indent value and set the desired first-line indent.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setindents HRESULT SetIndents( [in] float First, [in]
// float Left, [in] float Right );
void SetIndents(float First, float Left, float Right);
/// Sets the paragraph line-spacing rule and the line spacing for a paragraph.
///
/// Type: long
///
/// Value of new line-spacing rule. For a list of possible rule values and further discussion, see the ITextPara::GetLineSpacingRule method.
///
///
///
/// Type: float
///
/// Value of new line spacing. If the line-spacing rule treats the Spacing value as a linear dimension, then Spacing is
/// given in floating-point points.
///
///
///
/// The line-spacing rule and line spacing work together, and as a result, they must be set together, much as the first and left
/// indents need to be set together.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlinespacing HRESULT SetLineSpacing( [in] long Rule,
// [in] float Spacing );
void SetLineSpacing(tomConstants Rule, float Spacing);
/// Retrieves the amount of vertical space below a paragraph.
///
/// Type: float*
/// The space-after value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspaceafter HRESULT GetSpaceAfter( float *pValue );
float GetSpaceAfter();
/// Sets the amount of space that follows a paragraph.
///
/// Type: float
/// New space-after value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspaceafter HRESULT SetSpaceAfter( [in] float Value );
void SetSpaceAfter(float Value);
/// Retrieves the amount of vertical space above a paragraph.
///
/// Type: float*
/// The space-before value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspacebefore HRESULT GetSpaceBefore( float *pValue );
float GetSpaceBefore();
/// Sets the amount of space preceding a paragraph.
///
/// Type: float
/// New space-before value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspacebefore HRESULT SetSpaceBefore( [in] float Value );
void SetSpaceBefore(float Value);
/// Retrieves the widow and orphan control state for the paragraphs in a range.
///
/// Type: long*
/// A tomBool value that indicates the state of widow and orphan control. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Prevents the printing of a widow or orphan
///
/// -
/// tomFalse
/// Allows the printing of a widow or orphan.
///
/// -
/// tomUndefined
/// The widow-control property is undefined.
///
///
///
///
/// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line
/// of a paragraph is printed by itself at the bottom of a page.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getwidowcontrol HRESULT GetWidowControl( long *pValue );
tomConstants GetWidowControl();
/// Controls the suppression of widows and orphans.
///
/// Type: long
/// A tomBool value that controls the suppression of widows and orphans. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Prevents printing of widows and orphans.
///
/// -
/// tomFalse
/// Allows printing of widows and orphans.
///
/// -
/// tomToggle
/// The value is toggled.
///
/// -
/// tomUndefined
/// No change.
///
///
///
///
/// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text.
///
/// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line
/// of a paragraph is printed by itself at the bottom of a page.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setwidowcontrol HRESULT SetWidowControl( [in] long Value );
void SetWidowControl(tomConstants Value);
/// Retrieves the tab count.
///
/// Type: long*
/// The tab count.
///
///
/// The tab count of a new instance can be nonzero, depending on the underlying text engine. For example, Microsoft Word stories
/// begin with no explicit tabs defined, while rich edit instances start with a single explicit tab. To be sure there are no explicit
/// tabs (that is, to set the tab count to zero), call ITextPara::ClearAllTabs.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettabcount HRESULT GetTabCount( long *pCount );
int GetTabCount();
/// Adds a tab at the displacement tbPos, with type tbAlign, and leader style, tbLeader.
///
/// Type: float
/// New tab displacement, in floating-point points.
///
///
/// Type: long
/// Alignment options for the tab position. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomAlignLeft
/// Text is left justified from the tab position. This is the default.
///
/// -
/// tomAlignCenter
/// Text is centered on the tab position.
///
/// -
/// tomAlignRight
/// Text is right justified from the tab position.
///
/// -
/// tomAlignDecimal
/// The decimal point is set at the tab position. This is useful for aligning a column of decimal numbers.
///
/// -
/// tomAlignBar
///
/// A vertical bar is positioned at the tab position. Text is not affected. Alignment bars on nearby lines at the same position form
/// a continuous vertical line.
///
///
///
///
///
/// Type: long
///
/// Leader character style. A leader character is the character that is used to fill the space taken by a tab character. It can be
/// one of the following.
///
///
///
/// Value
/// Meaning
///
/// -
/// tomSpaces
/// Spaces are used. This is the default.
///
/// -
/// tomDots
/// Dots are used.
///
/// -
/// tomDashes
/// A dashed line is used.
///
/// -
/// tomLines
/// A solid line is used.
///
///
///
///
/// It is assumed that there is never a tab at position zero. If multiple paragraphs are described, the common subset of tabs will be
/// returned with 0x8000 in the upper word of the tab type.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-addtab HRESULT AddTab( [in] float tbPos, [in] long
// tbAlign, [in] long tbLeader );
void AddTab(float tbPos, tomConstants tbAlign, tomConstants tbLeader);
/// Clears all tabs, reverting to equally spaced tabs with the default tab spacing.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-clearalltabs HRESULT ClearAllTabs();
void ClearAllTabs();
/// Deletes a tab at a specified displacement.
///
/// Type: float
/// Displacement, in floating-point points, at which a tab should be deleted.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-deletetab HRESULT DeleteTab( float tbPos );
void DeleteTab(float tbPos);
/// Retrieves tab parameters (displacement, alignment, and leader style) for a specified tab.
///
/// Type: long
///
/// Index of tab for which to retrieve info. It can be either a numerical index or a special value (see the following table). Since
/// tab indexes are zero-based, iTab = zero gets the first tab defined, iTab = 1 gets the second tab defined, and so
/// forth. The following table summarizes all of the possible values of iTab.
///
///
///
/// iTab
/// Value
/// Meaning
///
/// -
/// tomTabBack
/// â3
/// Get tab previous to * ptbPos
///
/// -
/// tomTabNext
/// â2
/// Get tab following * ptbPos
///
/// -
/// tomTabHere
/// â1
/// Get tab at * ptbPos
///
/// -
///
/// >= 0
/// Get tab with index of iTab (and ignore ptbPos).
///
///
///
///
/// Type: float*
///
/// The tab displacement, in floating-point points. The value of * ptbPos is zero if the tab does not exist and the value of *
/// ptbPos is tomUndefined if there are multiple values in the associated range.
///
///
///
/// Type: long*
/// The tab alignment. For more information, see ITextPara::AddTab.
///
///
/// Type: long*
/// The tab leader-character style. For more information, see ITextPara::AddTab.
///
///
/// Type: HRESULT
///
/// If ITextPara::GetTab succeeds, it returns S_OK. If the method fails, it returns one of the following COM error
/// codes. For more information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// Value
/// Meaning
///
/// -
/// E_INVALIDARG
/// Invalid argument.
///
/// -
/// CO_E_RELEASED
/// The paragraph formatting object is attached to a range that has been deleted.
///
/// -
/// S_FALSE
/// There is no tab corresponding to iTab.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettab HRESULT GetTab( long iTab, float *ptbPos, long
// *ptbAlign, long *ptbLeader );
[PreserveSig]
HRESULT GetTab(int iTab, out float ptbPos, out int ptbAlign, out int ptbLeader);
}
///
/// Text Object Model (TOM) rich text-range attributes are accessed through a pair of dual interfaces, ITextFont and ITextPara.
/// The ITextPara2 interface extends ITextPara, providing the equivalent of the Microsoft Word format-paragraph dialog.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextpara2
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextPara2")]
[ComImport, Guid("C241F5E4-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextPara2 : ITextPara
{
///
/// Creates a duplicate of the specified paragraph format object. The duplicate property is the default property of an ITextPara object.
///
///
/// Type: ITextPara**
/// The duplicate ITextPara object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getduplicate HRESULT GetDuplicate( ITextPara **ppPara );
new ITextPara GetDuplicate();
/// Sets the formatting for an existing paragraph by copying a given format.
///
/// Type: ITextPara*
/// The ITextPara range that contains the new paragraph formatting.
///
/// The tomUndefined values have no effect, that is, they will not change the target values.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setduplicate HRESULT SetDuplicate( [in] ITextPara *pPara );
new void SetDuplicate([In, Optional] ITextPara? pPara);
/// Determines whether the paragraph formatting can be changed.
///
/// Type: long*
///
/// A variable that is tomTrue if the paragraph formatting can be changed or tomFalse if it cannot be changed. This
/// parameter can be null.
///
///
///
/// Type: HRESULT
///
/// If paragraph formatting can change, ITextPara::CanChange succeeds and returns S_OK. If paragraph formatting cannot
/// change, the method fails and returns S_FALSE. For more information about COM error codes, see Error Handling in COM.
///
///
///
/// The * pbCanChange parameter returns tomTrue only if the paragraph formatting can be changed (that is, if no part of
/// an associated range is protected and an associated document is not read-only). If this ITextPara object is a duplicate, no
/// protection rules apply.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-canchange HRESULT CanChange( [retval] long *pValue );
[PreserveSig]
new HRESULT CanChange(out tomConstants pValue);
/// Determines if the current range has the same properties as a specified range.
///
/// Type: ITextPara*
/// The ITextPara range that is compared to the current range.
///
///
/// Type: long*
/// The comparison result. The value can be null.
///
///
/// Type: HRESULT
///
/// If the objects are equal, ITextPara::IsEqual succeeds and returns S_OK. If the objects are not equal, the method
/// fails and returns S_FALSE. For more information about COM error codes, see Error Handling in COM.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-isequal HRESULT IsEqual( ITextPara *pPara, long *pValue );
[PreserveSig]
new HRESULT IsEqual([In, Optional] ITextPara? pPara, out int pValue);
/// Resets the paragraph formatting to a choice of default values.
///
/// Type: long
/// Type of reset. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomDefault
/// Used for paragraph formatting that is defined by the RTF \pard, that is, the paragraph default control word.
///
/// -
/// tomUndefined
/// Used for all undefined values. The tomUndefined value is only valid for duplicate (clone) ITextPara objects.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-reset HRESULT Reset( [in] long Value );
new void Reset(tomConstants Value);
/// Retrieves the style handle to the paragraphs in the specified range.
///
/// Type: long*
/// The paragraph style handle. For more information, see the Remarks.
///
///
///
/// The Text Object Model (TOM) version 1.0 has no way to specify the meanings of user-defined style handles. They depend on other
/// facilities of the text system implementing TOM. Negative style handles are reserved for built-in character and paragraph styles.
/// Currently defined values are listed in the following table. For a description of the following styles, see the Microsoft Word documentation.
///
///
///
/// Style
/// Value
/// Style
/// Value
///
/// -
/// StyleNormal
/// â1
/// StyleTableofAuthorities
/// â45
///
/// -
/// StyleHeading1
/// â2
/// StyleMacroText
/// â46
///
/// -
/// StyleHeading2
/// â3
/// StyleTOAHeading
/// â47
///
/// -
/// StyleHeading3
/// â4
/// StyleList
/// â48
///
/// -
/// StyleHeading4
/// â5
/// StyleListBullet
/// â49
///
/// -
/// StyleHeading5
/// â6
/// StyleListNumber
/// â50
///
/// -
/// StyleHeading6
/// â7
/// StyleList2
/// â51
///
/// -
/// StyleHeading7
/// â8
/// StyleList3
/// â52
///
/// -
/// StyleHeading8
/// â9
/// StyleList4
/// â53
///
/// -
/// StyleHeading9
/// â10
/// StyleList5
/// â54
///
/// -
/// StyleIndex1
/// â11
/// StyleListBullet2
/// â55
///
/// -
/// StyleIndex2
/// â12
/// StyleListBullet3
/// â56
///
/// -
/// StyleIndex3
/// â13
/// StyleListBullet4
/// â57
///
/// -
/// StyleIndex4
/// â14
/// StyleListBullet5
/// â58
///
/// -
/// StyleIndex5
/// â15
/// StyleListNumber2
/// â59
///
/// -
/// StyleIndex6
/// â16
/// StyleListNumber3
/// â60
///
/// -
/// StyleIndex7
/// â17
/// StyleListNumber4
/// â61
///
/// -
/// StyleIndex8
/// â18
/// StyleListNumber5
/// â62
///
/// -
/// StyleIndex9
/// â19
/// StyleTitle
/// â63
///
/// -
/// StyleTOC1
/// â20
/// StyleClosing
/// â64
///
/// -
/// StyleTOC2
/// â21
/// StyleSignature
/// â65
///
/// -
/// StyleTOC3
/// â22
/// StyleDefaultParagraphFont
/// â66
///
/// -
/// StyleTOC4
/// â23
/// StyleBodyText
/// â67
///
/// -
/// StyleTOC5
/// â24
/// StyleBodyTextIndent
/// â68
///
/// -
/// StyleTOC6
/// â25
/// StyleListContinue
/// â69
///
/// -
/// StyleTOC7
/// â26
/// StyleListContinue2
/// â70
///
/// -
/// StyleTOC8
/// â27
/// StyleListContinue3
/// â71
///
/// -
/// StyleTOC9
/// â28
/// StyleListContinue4
/// â72
///
/// -
/// StyleNormalIndent
/// â29
/// StyleListContinue5
/// â73
///
/// -
/// StyleFootnoteText
/// â30
/// StyleMessageHeader
/// â74
///
/// -
/// StyleAnnotationText
/// â31
/// StyleSubtitle
/// â75
///
/// -
/// StyleHeader
/// â32
/// StyleSalutation
/// â76
///
/// -
/// StyleFooter
/// â33
/// StyleDate
/// â77
///
/// -
/// StyleIndexHeading
/// â34
/// StyleBodyTextFirstIndent
/// â78
///
/// -
/// StyleCaption
/// â35
/// StyleBodyTextFirstIndent2
/// â79
///
/// -
/// StyleTableofFigures
/// â36
/// StyleNoteHeading
/// â80
///
/// -
/// StyleEnvelopeAddress
/// â37
/// StyleBodyText2
/// â81
///
/// -
/// StyleEnvelopeReturn
/// â38
/// StyleBodyText3
/// â82
///
/// -
/// StyleFootnoteReference
/// â39
/// StyleBodyTextIndent2
/// â83
///
/// -
/// StyleAnnotationReference
/// â40
/// StyleBodyTextIndent3
/// â84
///
/// -
/// StyleLineNumber
/// â41
/// StyleBlockQuotation
/// â85
///
/// -
/// StylePageNumber
/// â42
/// StyleHyperlink
/// â86
///
/// -
/// StyleEndnoteReference
/// â43
/// StyleHyperlinkFollowed
/// â87
///
/// -
/// StyleEndnoteText
/// â44
/// Â
/// Â
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getstyle HRESULT GetStyle( long *pValue );
new int GetStyle();
/// Sets the paragraph style for the paragraphs in a range.
///
/// Type: long
/// New paragraph style handle. For a list of styles, see the Remarks section of ITextPara::GetStyle.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setstyle HRESULT SetStyle( [in] long Value );
new void SetStyle(int Value);
/// Retrieves the current paragraph alignment value.
///
/// Type: long*
/// The paragraph alignment, which can be one of the following values.
/// tomAlignLeft
/// tomAlignCenter
/// tomAlignRight
/// tomAlignJustify
/// tomAlignInterWord
/// tomAlignNewspaper
/// tomAlignInterLetter
/// tomAlignScaled
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getalignment HRESULT GetAlignment( long *pValue );
new tomConstants GetAlignment();
/// Sets the paragraph alignment.
///
/// Type: long
/// New paragraph alignment. For a list of possible values, see the ITextPara::GetAlignment method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setalignment HRESULT SetAlignment( [in] long Value );
new void SetAlignment(tomConstants Value);
/// Determines whether automatic hyphenation is enabled for the range.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Automatic hyphenation is enabled.
///
/// -
/// tomFalse
/// Automatic hyphenation is disabled.
///
/// -
/// tomUndefined
/// The hyphenation property is undefined.
///
///
///
/// This property corresponds to the PFE_DONOTHYPHEN effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gethyphenation HRESULT GetHyphenation( long *pValue );
new tomConstants GetHyphenation();
/// Controls hyphenation for the paragraphs in the range.
///
/// Type: long
/// Indicates how hyphenation is controlled. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Automatic hyphenation is enabled.
///
/// -
/// tomFalse
/// Automatic hyphenation is disabled.
///
/// -
/// tomUndefined
/// The hyphenation property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-sethyphenation HRESULT SetHyphenation( [in] long Value );
new void SetHyphenation(tomConstants Value);
///
/// Retrieves the amount used to indent the first line of a paragraph relative to the left indent. The left indent is the indent for
/// all lines of the paragraph except the first line.
///
///
/// Type: float*
/// The first-line indentation amount in floating-point points.
///
///
/// To set the first line indentation amount, call the ITextPara::SetIndents method.
///
/// To get and set the indent for all other lines of the paragraph (that is, the left indent), use ITextPara::GetLeftIndent and ITextPara::SetIndents.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getfirstlineindent HRESULT GetFirstLineIndent( float
// *pValue );
new float GetFirstLineIndent();
/// Determines whether page breaks are allowed within paragraphs.
///
/// Type: long*
/// A variable that is one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed within a paragraph.
///
/// -
/// tomFalse
/// Page breaks are allowed within a paragraph.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEP effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getkeeptogether HRESULT GetKeepTogether( long *pValue );
new tomConstants GetKeepTogether();
/// Controls whether page breaks are allowed within a paragraph in a range.
///
/// Type: long
/// Indicates whether page breaks are allowed within a paragraph in a range. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed within a paragraph.
///
/// -
/// tomFalse
/// Page breaks are allowed within a paragraph.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEP effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setkeeptogether HRESULT SetKeepTogether( [in] long Value );
new void SetKeepTogether(tomConstants Value);
/// Determines whether page breaks are allowed between paragraphs in the range.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed between paragraphs.
///
/// -
/// tomFalse
/// Page breaks are allowed between paragraphs.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getkeepwithnext HRESULT GetKeepWithNext( long *pValue );
new int GetKeepWithNext();
/// Controls whether page breaks are allowed between the paragraphs in a range.
///
/// Type: long
/// Indicates if page breaks can be used between the paragraphs of a range. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Page breaks are not allowed between paragraphs.
///
/// -
/// tomFalse
/// Page breaks are allowed between paragraphs.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// This property corresponds to the PFE_KEEPNEXT effect described in the PARAFORMAT2 structure.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setkeepwithnext HRESULT SetKeepWithNext( [in] long Value );
new void SetKeepWithNext(tomConstants Value);
///
/// Retrieves the distance used to indent all lines except the first line of a paragraph. The distance is relative to the left margin.
///
///
/// Type: float*
/// The left indentation, in floating-point points.
///
///
/// To set the left indentation amount, call the ITextPara::SetIndents method.
/// To get the first-line indent, call ITextPara::GetFirstLineIndent.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getleftindent HRESULT GetLeftIndent( float *pValue );
new float GetLeftIndent();
/// Retrieves the line-spacing value for the text range.
///
/// Type: float*
/// The line-spacing value. The following table shows how this value is interpreted for the different line-spacing rules.
///
///
/// Line spacing rule
/// Meaning
///
/// -
/// tomLineSpaceSingle
/// The line-spacing value is ignored.
///
/// -
/// tomLineSpace1pt5
/// The line-spacing value is ignored.
///
/// -
/// tomLineSpaceDouble
/// The line-spacing value is ignored.
///
/// -
/// tomLineSpaceAtLeast
///
/// The line-spacing value specifies the spacing, in floating-point points, from one line to the next. However, if the value is less
/// than single spacing, the control displays single-spaced text.
///
///
/// -
/// tomLineSpaceExactly
///
/// The line-spacing value specifies the exact spacing, in floating-point points, from one line to the next (even if the value is
/// less than single spacing).
///
///
/// -
/// tomLineSpaceMultiple
/// The line-spacing value specifies the line spacing, in lines.
///
///
///
/// To retrieve the line-spacing rule, call the ITextPara::GetLineSpacingRule method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacing HRESULT GetLineSpacing( float *pValue );
new float GetLineSpacing();
/// Retrieves the line-spacing rule for the text range.
///
/// Type: long*
/// A variable that is one of the following values to indicate the line-spacing rule.
/// tomLineSpaceSingle
/// tomLineSpace1pt5
/// tomLineSpaceDouble
/// tomLineSpaceAtLeast
/// tomLineSpaceExactly
/// tomLineSpaceMultiple
/// tomLineSpacePercent
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlinespacingrule HRESULT GetLineSpacingRule( long
// *pValue );
new tomConstants GetLineSpacingRule();
/// Retrieves the kind of alignment to use for bulleted and numbered lists.
///
/// Type: long*
/// A variable that is one of the following values to indicate the kind of bullet and numbering alignment.
///
///
/// Value
/// Meaning
///
/// -
/// tomAlignLeft
/// Text is left aligned.
///
/// -
/// tomAlignCenter
/// Text is centered in the line.
///
/// -
/// tomAlignRight
/// Text is right aligned.
///
///
///
/// For a description of the different types of lists, see the ITextPara::GetListType method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistalignment HRESULT GetListAlignment( long *pValue );
new tomConstants GetListAlignment();
/// Sets the alignment of bulleted or numbered text used for paragraphs.
///
/// Type: long
/// New list alignment value. For possible values, see ITextPara::GetListAlignment.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistalignment HRESULT SetListAlignment( [in] long
// Value );
new void SetListAlignment(tomConstants Value);
/// Retrieves the list level index used with paragraphs.
///
/// Type: long*
/// A variable that is the list level index. The value of pValue can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// 0
/// No list.
///
/// -
/// 1
/// First-level (outermost) list.
///
/// -
/// 2
/// Second-level (nested) list. This is nested under a level 1 list item.
///
/// -
/// 3
/// Third-level (nested) list. This is nested under a level 2 list item.
///
/// -
/// and so forth
/// Nesting continues similarly.
///
///
/// Â
/// Up to three levels are common in HTML documents.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlistlevelindex HRESULT GetListLevelIndex( long *pValue );
new int GetListLevelIndex();
/// Sets the list level index used for paragraphs.
///
/// Type: long
/// New list level index value. For possible values, see ITextPara::GetListLevelIndex.
///
/// Setting the list level index does not automatically change a list's indentation and other paragraph properties.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlistlevelindex HRESULT SetListLevelIndex( [in] long
// Value );
new void SetListLevelIndex(int Value);
/// Retrieves the starting value or code of a list numbering sequence.
///
/// Type: long*
/// The starting value or code of a list numbering sequence. For the possible values, see the ITextPara::GetListType method.
///
/// For a discussion on which sequence to use, see the ITextPara::GetListType method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getliststart HRESULT GetListStart( long *pValue );
new tomConstants GetListStart();
/// Sets the starting number or Unicode value for a numbered list.
///
/// Type: long
/// New starting number or Unicode value for a numbered list.
///
/// Other characteristics of a list are specified by ITextPara::SetListType.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setliststart HRESULT SetListStart( [in] long Value );
new void SetListStart(tomConstants Value);
///
/// Retrieves the list tab setting, which is the distance between the first-line indent and the text on the first line. The numbered
/// or bulleted text is left-justified, centered, or right-justified at the first-line indent value.
///
///
/// Type: float*
/// The list tab setting. The list tab value is in floating-point points.
///
/// To determine whether the numbered or bulleted text is left-justified, centered, or right-justified, call ITextPara::GetListAlignment.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttab HRESULT GetListTab( float *pValue );
new float GetListTab();
///
/// Sets the list tab setting, which is the distance between the first indent and the start of the text on the first line.
///
///
/// Type: float
/// New list tab value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttab HRESULT SetListTab( [in] float Value );
new void SetListTab(float Value);
/// Retrieves the kind of numbering to use with paragraphs.
///
/// Type: long*
/// A variable that is of the following values to indicate the kind of list numbering.
/// tomListNone
/// tomListBullet
/// tomListNumberAsArabic
/// tomListNumberAsLCLetter
/// tomListNumberAsUCLetter
/// tomListNumberAsLCRoman
/// tomListNumberAsUCRoman
/// tomListNumberAsSequence
/// tomListNumberedCircle
/// tomListNumberedBlackCircleWingding
/// tomListNumberedWhiteCircleWingding
/// tomListNumberedArabicWide
/// tomListNumberedChS
/// tomListNumberedChT
/// tomListNumberedJpnChs
/// tomListNumberedJpnKor
/// tomListNumberedArabic1
/// tomListNumberedArabic2
/// tomListNumberedHebrew
/// tomListNumberedThaiAlpha
/// tomListNumberedThaiNum
/// tomListNumberedHindiAlpha
/// tomListNumberedHindiAlpha1
/// tomListNumberedHindiNum
///
/// By default, numbers are followed by a right parenthesis, for example: 1). However, pValue can include one of the following
/// flags to indicate a different formatting.
///
/// tomListMinus
/// tomListParentheses
/// tomListPeriod
/// tomListPlain
///
///
/// Values above 32 correspond to Unicode values for bullets.
/// The mobile Microsoft Office version of the rich edit control uses tomIgnoreNumberStyle to suppress setting the style.
///
/// The following Microsoft Visual Basic for Applications (VBA) example numbers the paragraphs in a range, starting with the number 2
/// and following the numbers with a period.
///
///
/// For an example of tomListNumberAsSequence, set to 0x2780, which gives you circled numbers. The Unicode Standard has examples of
/// many more numbering sequences.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getlisttype HRESULT GetListType( long *pValue );
new tomConstants GetListType();
/// Sets the type of list to be used for paragraphs.
///
/// Type: long
/// New list type. For possible list types, see the ITextPara::GetListType method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlisttype HRESULT SetListType( [in] long Value );
new void SetListType(tomConstants Value);
/// Determines whether paragraph numbering is enabled.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Line numbering is disabled.
///
/// -
/// tomFalse
/// Line numbering is enabled.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
/// Paragraph numbering is when the paragraphs of a range are numbered. The number appears on the first line of a paragraph.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getnolinenumber HRESULT GetNoLineNumber( long *pValue );
new tomConstants GetNoLineNumber();
/// Determines whether to suppress line numbering of paragraphs in a range.
///
/// Type: long
/// Indicates if line numbering is suppressed. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Line numbering is disabled.
///
/// -
/// tomFalse
/// Line numbering is enabled.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
///
/// This property concerns the numbering of paragraphs in a range. If Value is tomFalse, the number of the paragraph
/// appears on the first line of the paragraph.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setnolinenumber HRESULT SetNoLineNumber( [in] long Value );
new void SetNoLineNumber(tomConstants Value);
/// Determines whether each paragraph in the range must begin on a new page.
///
/// Type: long*
/// A variable that is one of the following values:
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Each paragraph in this range must begin on a new page.
///
/// -
/// tomFalse
/// The paragraphs in this range do not need to begin on a new page.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getpagebreakbefore HRESULT GetPageBreakBefore( long
// *pValue );
new tomConstants GetPageBreakBefore();
/// Controls whether there is a page break before each paragraph in a range.
///
/// Type: long
/// A tomBool value that controls page breaks before paragraphs. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Paragraphs in this range must begin on a new page.
///
/// -
/// tomFalse
/// Paragraphs in this range do not need to begin on a new page.
///
/// -
/// tomToggle
/// Toggle the property value.
///
/// -
/// tomUndefined
/// The property is undefined.
///
///
///
///
/// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setpagebreakbefore HRESULT SetPageBreakBefore( [in] long
// Value );
new void SetPageBreakBefore(tomConstants Value);
/// Retrieves the size of the right margin indent of a paragraph.
///
/// Type: float*
/// The right indentation, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getrightindent HRESULT GetRightIndent( float *pValue );
new float GetRightIndent();
/// Sets the right margin of paragraph.
///
/// Type: float
/// Right indent, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setrightindent HRESULT SetRightIndent( [in] float Value );
new void SetRightIndent(float Value);
/// Sets the first-line indent, the left indent, and the right indent for a paragraph.
///
/// Type: float
///
/// Indent of the first line in a paragraph, relative to the left indent. The value is in floating-point points and can be positive
/// or negative.
///
///
///
/// Type: float
///
/// Left indent of all lines except the first line in a paragraph, relative to left margin. The value is in floating-point points and
/// can be positive or negative.
///
///
///
/// Type: float
///
/// Right indent of all lines in paragraph, relative to the right margin. The value is in floating-point points and can be positive
/// or negative. This value is optional.
///
///
///
/// Line indents are not allowed to position text in the margins. If the first-line indent is set to a negative value (for an
/// outdented paragraph) while the left indent is zero, the first-line indent is reset to zero. To avoid this problem while retaining
/// property sets, set the first-line indent value equal to zero either explicitly or by calling the ITextPara::Reset method. Then,
/// call ITextPara::SetIndents to set a nonnegative, left-indent value and set the desired first-line indent.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setindents HRESULT SetIndents( [in] float First, [in]
// float Left, [in] float Right );
new void SetIndents(float First, float Left, float Right);
/// Sets the paragraph line-spacing rule and the line spacing for a paragraph.
///
/// Type: long
///
/// Value of new line-spacing rule. For a list of possible rule values and further discussion, see the ITextPara::GetLineSpacingRule method.
///
///
///
/// Type: float
///
/// Value of new line spacing. If the line-spacing rule treats the Spacing value as a linear dimension, then Spacing is
/// given in floating-point points.
///
///
///
/// The line-spacing rule and line spacing work together, and as a result, they must be set together, much as the first and left
/// indents need to be set together.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setlinespacing HRESULT SetLineSpacing( [in] long Rule,
// [in] float Spacing );
new void SetLineSpacing(tomConstants Rule, float Spacing);
/// Retrieves the amount of vertical space below a paragraph.
///
/// Type: float*
/// The space-after value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspaceafter HRESULT GetSpaceAfter( float *pValue );
new float GetSpaceAfter();
/// Sets the amount of space that follows a paragraph.
///
/// Type: float
/// New space-after value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspaceafter HRESULT SetSpaceAfter( [in] float Value );
new void SetSpaceAfter(float Value);
/// Retrieves the amount of vertical space above a paragraph.
///
/// Type: float*
/// The space-before value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getspacebefore HRESULT GetSpaceBefore( float *pValue );
new float GetSpaceBefore();
/// Sets the amount of space preceding a paragraph.
///
/// Type: float
/// New space-before value, in floating-point points.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setspacebefore HRESULT SetSpaceBefore( [in] float Value );
new void SetSpaceBefore(float Value);
/// Retrieves the widow and orphan control state for the paragraphs in a range.
///
/// Type: long*
/// A tomBool value that indicates the state of widow and orphan control. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Prevents the printing of a widow or orphan
///
/// -
/// tomFalse
/// Allows the printing of a widow or orphan.
///
/// -
/// tomUndefined
/// The widow-control property is undefined.
///
///
///
///
/// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line
/// of a paragraph is printed by itself at the bottom of a page.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-getwidowcontrol HRESULT GetWidowControl( long *pValue );
new tomConstants GetWidowControl();
/// Controls the suppression of widows and orphans.
///
/// Type: long
/// A tomBool value that controls the suppression of widows and orphans. It can be one of the following possible values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Prevents printing of widows and orphans.
///
/// -
/// tomFalse
/// Allows printing of widows and orphans.
///
/// -
/// tomToggle
/// The value is toggled.
///
/// -
/// tomUndefined
/// No change.
///
///
///
///
/// This method is included for compatibility with Microsoft Word; it does not affect how the rich edit control displays text.
///
/// A widow is created when the last line of a paragraph is printed by itself at the top of a page. An orphan is when the first line
/// of a paragraph is printed by itself at the bottom of a page.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-setwidowcontrol HRESULT SetWidowControl( [in] long Value );
new void SetWidowControl(tomConstants Value);
/// Retrieves the tab count.
///
/// Type: long*
/// The tab count.
///
///
/// The tab count of a new instance can be nonzero, depending on the underlying text engine. For example, Microsoft Word stories
/// begin with no explicit tabs defined, while rich edit instances start with a single explicit tab. To be sure there are no explicit
/// tabs (that is, to set the tab count to zero), call ITextPara::ClearAllTabs.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettabcount HRESULT GetTabCount( long *pCount );
new int GetTabCount();
/// Adds a tab at the displacement tbPos, with type tbAlign, and leader style, tbLeader.
///
/// Type: float
/// New tab displacement, in floating-point points.
///
///
/// Type: long
/// Alignment options for the tab position. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomAlignLeft
/// Text is left justified from the tab position. This is the default.
///
/// -
/// tomAlignCenter
/// Text is centered on the tab position.
///
/// -
/// tomAlignRight
/// Text is right justified from the tab position.
///
/// -
/// tomAlignDecimal
/// The decimal point is set at the tab position. This is useful for aligning a column of decimal numbers.
///
/// -
/// tomAlignBar
///
/// A vertical bar is positioned at the tab position. Text is not affected. Alignment bars on nearby lines at the same position form
/// a continuous vertical line.
///
///
///
///
///
/// Type: long
///
/// Leader character style. A leader character is the character that is used to fill the space taken by a tab character. It can be
/// one of the following.
///
///
///
/// Value
/// Meaning
///
/// -
/// tomSpaces
/// Spaces are used. This is the default.
///
/// -
/// tomDots
/// Dots are used.
///
/// -
/// tomDashes
/// A dashed line is used.
///
/// -
/// tomLines
/// A solid line is used.
///
///
///
///
/// It is assumed that there is never a tab at position zero. If multiple paragraphs are described, the common subset of tabs will be
/// returned with 0x8000 in the upper word of the tab type.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-addtab HRESULT AddTab( [in] float tbPos, [in] long
// tbAlign, [in] long tbLeader );
new void AddTab(float tbPos, tomConstants tbAlign, tomConstants tbLeader);
/// Clears all tabs, reverting to equally spaced tabs with the default tab spacing.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-clearalltabs HRESULT ClearAllTabs();
new void ClearAllTabs();
/// Deletes a tab at a specified displacement.
///
/// Type: float
/// Displacement, in floating-point points, at which a tab should be deleted.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-deletetab HRESULT DeleteTab( float tbPos );
new void DeleteTab(float tbPos);
/// Retrieves tab parameters (displacement, alignment, and leader style) for a specified tab.
///
/// Type: long
///
/// Index of tab for which to retrieve info. It can be either a numerical index or a special value (see the following table). Since
/// tab indexes are zero-based, iTab = zero gets the first tab defined, iTab = 1 gets the second tab defined, and so
/// forth. The following table summarizes all of the possible values of iTab.
///
///
///
/// iTab
/// Value
/// Meaning
///
/// -
/// tomTabBack
/// â3
/// Get tab previous to * ptbPos
///
/// -
/// tomTabNext
/// â2
/// Get tab following * ptbPos
///
/// -
/// tomTabHere
/// â1
/// Get tab at * ptbPos
///
/// -
///
/// >= 0
/// Get tab with index of iTab (and ignore ptbPos).
///
///
///
///
/// Type: float*
///
/// The tab displacement, in floating-point points. The value of * ptbPos is zero if the tab does not exist and the value of *
/// ptbPos is tomUndefined if there are multiple values in the associated range.
///
///
///
/// Type: long*
/// The tab alignment. For more information, see ITextPara::AddTab.
///
///
/// Type: long*
/// The tab leader-character style. For more information, see ITextPara::AddTab.
///
///
/// Type: HRESULT
///
/// If ITextPara::GetTab succeeds, it returns S_OK. If the method fails, it returns one of the following COM error
/// codes. For more information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// Value
/// Meaning
///
/// -
/// E_INVALIDARG
/// Invalid argument.
///
/// -
/// CO_E_RELEASED
/// The paragraph formatting object is attached to a range that has been deleted.
///
/// -
/// S_FALSE
/// There is no tab corresponding to iTab.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara-gettab HRESULT GetTab( long iTab, float *ptbPos, long
// *ptbAlign, long *ptbLeader );
[PreserveSig]
new HRESULT GetTab(int iTab, out float ptbPos, out int ptbAlign, out int ptbLeader);
///
/// Not implemented.
/// Gets the borders collection.
///
///
/// Type: IUnknown**
/// The borders collection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getborders HRESULT GetBorders( [out, retval] IUnknown
// **ppBorders );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetBorders();
/// Gets a duplicate of this text paragraph format object.
///
/// Type: ITextPara2**
/// The duplicate text paragraph format object
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getduplicate2 HRESULT GetDuplicate2( [out, retval]
// ITextPara2 **ppPara );
ITextPara2 GetDuplicate2();
/// Sets the properties of this object by copying the properties of another text paragraph object.
///
/// Type: ITextPara2*
/// The text paragraph object to copy from.
///
/// tomUndefined values have no effect.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setduplicate2 HRESULT SetDuplicate2( [in] ITextPara2
// *pPara );
void SetDuplicate2([In, Optional] ITextPara2? pPara);
/// Gets the paragraph font alignment state.
///
/// Type: long*
/// The paragraph font alignment state. It can be one of the following values.
///
///
/// Font Alignment States
///
/// -
/// tomFontAlignmentAuto (default)
///
/// -
/// tomFontAlignmentTop
///
/// -
/// tomFontAlignmentBaseline
///
/// -
/// tomFontAlignmentBottom
///
/// -
/// tomFontAlignmentCenter
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getfontalignment HRESULT GetFontAlignment( [out, retval]
// long *pValue );
tomConstants GetFontAlignment();
/// Sets the paragraph font alignment for Chinese, Japanese, Korean text.
///
/// Type: long
/// The paragraph font alignment. It can be one of the following values.
///
///
/// Font Alignment States
///
/// -
/// tomFontAlignmentAuto (default)
///
/// -
/// tomFontAlignmentTop
///
/// -
/// tomFontAlignmentBaseline
///
/// -
/// tomFontAlignmentBottom
///
/// -
/// tomFontAlignmentCenter
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setfontalignment HRESULT SetFontAlignment( [in] long
// Value );
void SetFontAlignment(tomConstants Value);
/// Gets whether to hang punctuation symbols on the right margin when the paragraph is justified.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Hang punctuation symbols on the right margin.
///
/// -
/// tomFalse
/// Do not hang punctuation symbols on the right margin.
///
/// -
/// tomUndefined
/// The HangingPunctuation property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-gethangingpunctuation HRESULT GetHangingPunctuation(
// [out, retval] long *pValue );
tomConstants GetHangingPunctuation();
/// Sets whether to hang punctuation symbols on the right margin when the paragraph is justified.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Hang punctuation symbols on the right margin.
///
/// -
/// tomFalse
/// Do not hang punctuation symbols on the right margin.
///
/// -
/// tomToggle
/// Toggle the HangingPunctuation property.
///
/// -
/// tomUndefined
/// The HangingPunctuation property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-sethangingpunctuation HRESULT SetHangingPunctuation(
// [in] long Value );
void SetHangingPunctuation(tomConstants Value);
/// Gets whether paragraph lines snap to a vertical grid that could be defined for the whole document.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Paragraph lines snap to a vertical grid.
///
/// -
/// tomFalse
/// Paragraph lines do not snap to a grid.
///
/// -
/// tomUndefined
/// The SnapToGrid property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getsnaptogrid HRESULT GetSnapToGrid( [out, retval] long
// *pValue );
tomConstants GetSnapToGrid();
/// Sets whether paragraph lines snap to a vertical grid that could be defined for the whole document.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Paragraph lines snap to a vertical grid.
///
/// -
/// tomFalse
/// Paragraph lines do not snap to a grid.
///
/// -
/// tomToggle
/// Toggle the SnapToGrid property.
///
/// -
/// tomUndefined
/// The SnapToGrid property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setsnaptogrid HRESULT SetSnapToGrid( [in] long Value );
void SetSnapToGrid(tomConstants Value);
/// Gets whether to trim the leading space of a punctuation symbol at the start of a line.
///
/// Type: long*
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Trim the leading space of a punctuation symbol at the start of a line.
///
/// -
/// tomFalse
/// Do not trim the leading space of a punctuation symbol at the start of a line.
///
/// -
/// tomUndefined
/// The TrimPunctuationAtStart property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-gettrimpunctuationatstart HRESULT
// GetTrimPunctuationAtStart( [out, retval] long *pValue );
tomConstants GetTrimPunctuationAtStart();
/// Sets whether to trim the leading space of a punctuation symbol at the start of a line.
///
/// Type: long
/// A tomBool that indicates whether to trim the leading space of a punctuation symbol. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Trim the leading space of a punctuation symbol at the start of a line.
///
/// -
/// tomFalse
/// Do not trim the leading space of a punctuation symbol at the start of a line.
///
/// -
/// tomToggle
/// Toggle the TrimPunctuationAtStart property.
///
/// -
/// tomUndefined
/// The TrimPunctuationAtStart property is undefined.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-settrimpunctuationatstart HRESULT
// SetTrimPunctuationAtStart( [in] long Value );
void SetTrimPunctuationAtStart(tomConstants Value);
/// Gets the paragraph format effects.
///
/// Type: long*
/// The paragraph effects. This value can be a combination of the following flags.
/// tomParaEffectRTL
/// tomParaEffectKeep
/// tomParaEffectKeepNext
/// tomParaEffectPageBreakBefore
/// tomParaEffectNoLineNumber
/// tomParaEffectNoWidowControl
/// tomParaEffectDoNotHyphen
/// tomParaEffectSideBySide
/// tomParaEffectCollapsed
/// tomParaEffectOutlineLevel
/// tomParaEffectBox
/// tomParaEffectTableRowDelimiter
/// tomParaEffectTable
///
///
/// Type: long*
///
/// The differences in the flags over the range. A value of 1 indicates that the corresponding effect is the same over the range. For
/// an insertion point, the values equal 1 for all defined effects.
///
///
/// If the tomTable flag is set, you can use the ITextRange2::GetTable method to get more table properties.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-geteffects HRESULT GetEffects( [out] long *pValue, [out]
// long *pMask );
void GetEffects(out tomConstants pValue, out tomConstants pMask);
/// Gets the value of the specified property.
///
/// Type: long
/// The ID of the property value to retrieve.
///
///
/// Type: long*
/// The property value.
///
///
///
/// The tomParaPropMathAlign property sets the math alignment for math paragraphs in a text paragraph. It can have one of the
/// following values.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-getproperty HRESULT GetProperty( [in] long Type, [out]
// long *pValue );
tomConstants GetProperty(int Type);
/// Determines whether this text paragraph object has the same properties as the specified text paragraph object.
///
/// Type: ITextPara2*
/// The text paragraph object to compare against.
///
///
/// Type: long*
///
/// A tomBool value that is tomTrue if the text paragraph objects have the same properties, or tomFalse if they don't.
/// This parameter can be NULL.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-isequal2 HRESULT IsEqual2( [in] ITextPara2 *pPara, [out,
// retval] long *pB );
tomConstants IsEqual2([In, Optional] ITextPara2? pPara);
/// Sets the paragraph format effects.
///
/// Type: long
/// The paragraph effects value.
/// This value can be a combination of the flags defined in the table for ITextPara2::GetEffects.
///
///
/// Type: long
/// The desired mask.
/// This value can be a combination of the flags defined in the table for ITextPara2::GetEffects.
/// Only effects with the corresponding mask flag set are modified.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-seteffects HRESULT SetEffects( [in] long Value, [in]
// long Mask );
void SetEffects(tomConstants Value, tomConstants Mask);
/// Sets the property value.
///
/// Type: long
/// The property ID of the property value to set. See ITextPara2::GetProperty for a list of defined properties.
///
///
/// Type: long
/// The property value to set.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextpara2-setproperty HRESULT SetProperty( [in] long Type, [in]
// long Value );
void SetProperty(int Type, int Value);
}
///
/// The ITextRange objects are powerful editing and data-binding tools that allow a program to select text in a story and then
/// examine or change that text.
///
///
///
/// Multiple text ranges can be active and work cooperatively on the same story and evolve with the story. For example, if one text range
/// deletes specified text before another text range, the latter tracks the change. In this sense, text ranges are similar to Microsoft
/// Word bookmarks, which also track editing changes. However, bookmarks cannot edit text, while text ranges can. In addition, ranges let
/// you manipulate text without changing the selection or Clipboard, both of which are valuable to end users. The ITextSelection
/// interface inherits from ITextRange and adds some UI-oriented methods and properties as described in the section on ITextSelection.
///
/// You can look at a text range using methods based on character positions. Specifically, a text range is characterized by:
///
/// -
///
/// The first character position, cpFirst, which points at an insertion point immediately preceding the first character
/// (relative to the beginning of the story) in the range.
///
///
/// -
///
/// The limit position, cpLim, which points at an insertion point immediately following the last character in the range.
///
///
///
///
/// The first character in a story has cpFirst = zero. If a cp argument has a value greater than the number of characters
/// in the story, the number of characters in the story is used instead. If a cp argument is negative, zero is used instead. For
/// those familiar with Microsoft Visual Basic for Applications, call the cpFirst property Start and the cpLim
/// property End (even though the starting position of a range is also an end).
///
///
/// In the following figure, character positions are represented by the lines separating the letters. The corresponding character
/// position values are given beneath the lines. The range starting at cpFirst = 5 and ending at cpLim = 7 contains the
/// two-letter word is. If this figure depicts the complete text in a story, the story length is 30.
///
///
/// The length of a range is given by cpLim - cpFirst or equivalently by End - Start. A range with zero length is
/// called a degenerate or empty range and has equal cp* values, that is, cpFirst = cpLim. An example
/// of a degenerate range is the current insertion point. A non-null selection is an example of a nondegenerate range.
///
///
/// Suppose that the range from 5 to 7 indicated by shaded cells in the preceding figure is told to delete its text (see Delete), thereby
/// turning itself into an insertion point. The range from 25 to 29 would automatically track its contents, namely the word text. The
/// following figure shows the result.
///
///
/// In this figure, the range for text now has been automatically adjusted to have cpFirst = 23 and cpLim = 27. The
/// owner of the range does not have to worry about updating the range character position values in the face of editing.
///
///
/// The names of the move methods indicate which end to move, but note that if any method attempts to move one range end past the other,
/// both ends get moved to the target position. As a result, the insertion point is at the target position. The concept is that
/// cpFirst and cpLim always have to obey the fundamental condition
///
/// 0 <= cpFirst <= cpLim <= # characters in story
///
/// or equivalently for a range r, 0 <= r.Start <= r.End <= r.StoryLength, which is what you would
/// expect from the names of these quantities.
///
///
/// Another important feature is that all stories contain an undeletable final CR (0xD) character at the end. So even an empty story has
/// a single character, namely the final CR. A range can select this character, but cannot become an insertion point beyond it. To see
/// how this works, try selecting the final CR in a Word document and then press the RIGHT ARROW key to collapse it. The directory tree
/// will collapse before the final CR, but the CR cannot be deleted. The Text Object Model (TOM) functions the same way. So, if
/// r.Start <= r.End, then r.End <= ( r.StoryLength â 1). For a discussion about deleting a CR, see Delete.
///
/// Some methods depend on a Unit argument, which can take on the predefined values listed in the following table.
///
///
/// Unit
/// Value
/// Meaning
///
/// -
/// tomCharacter
/// 1
/// Character.
///
/// -
/// tomWord
/// 2
/// Word.
///
/// -
/// tomSentence
/// 3
/// Sentence.
///
/// -
/// tomParagraph
/// 4
/// Paragraph.
///
/// -
/// tomLine
/// 5
/// Line (on display).
///
/// -
/// tomStory
/// 6
/// Story.
///
/// -
/// tomScreen
/// 7
/// Screen (as for PAGE UP/PAGE DOWN).
///
/// -
/// tomSection
/// 8
/// Section.
///
/// -
/// tomColumn
/// 9
/// Table column.
///
/// -
/// tomRow
/// 10
/// Table row.
///
/// -
/// tomWindow
/// 11
/// Upper-left or lower-right of the window.
///
/// -
/// tomCell
/// 12
/// Table cell.
///
/// -
/// tomCharFormat
/// 13
/// Run of constant character formatting.
///
/// -
/// tomParaFormat
/// 14
/// Run of constant paragraph formatting.
///
/// -
/// tomTable
/// 15
/// Table.
///
/// -
/// tomObject
/// 16
/// Embedded object.
///
///
/// Â
/// Most of the Unit values are self-explanatory. However the following descriptions are provided for additional clarity.
/// tomWord
///
/// The tomWord constant is an end of paragraph or a span of alphanumerics or punctuation including any blanks that follow. To get an
/// on-screen feel for tomWord, watch how the caret moves when you press CTRL+RIGHT ARROW (â>) or CTRL+LEFT ARROW (<â) in a
/// Word document.
///
/// tomSentence
///
/// The tomSentence constant describes a string of text that ends with a period, question mark, or exclamation mark and is followed
/// either by one or more ASCII white space characters (9 through 0xd and 0x20), or the Unicode paragraph separator (0x2029). The
/// trailing white space is part of the sentence. The last sentence in a story does not need to have a period, question mark, or
/// exclamation mark. The start of a story qualifies as the start of a tomSentence, even if the string there does not qualify as a
/// sentence grammatically. Other sentences must follow a sentence end and cannot begin with a period, question mark, or exclamation mark.
///
/// tomParagraph
///
/// The tomParagraph constant is a string of text terminated by an end-of-paragraph mark (CRLF, CR, VT (for SHIFT+ENTER), LF, FF, or
/// 0x2029). TOM engines always have an undeletable end-of-paragraph mark at the end of a story. Thus, all TOM stories automatically have
/// at least one tomWord, one tomSentence, and one tomParagraph.
///
/// tomLine
///
/// The tomLine constant corresponds to one line of text on a display, provided that a display is associated with the range. If no
/// display is associated with a range, tomLine is treated as tomParagraph. A selection automatically has a display and a range that is a
/// duplicate (see GetDuplicate). Other ranges may not have a display, depending on the TOM engine and context.
///
///
/// Methods that move one or both ends in terms of Unit, such as Move, MoveEnd, and MoveStart, depend on the signed Count
/// argument. Except for the ITextSelection geometrical movement commands, if Count is greater than zero, the ends to be moved are
/// moved forward (toward the end of the story), and if Count is less than zero, the ends are moved backward (toward the
/// beginning). The default value of Count for these Move methods is 1. These methods attempt to move Count Units,
/// but movement is never beyond the ends of the story.
///
///
/// Methods that move one or both ends by matching character strings or string patterns, such as MoveWhile, MoveEndWhile, and
/// MoveStartWhile, can move up to a maximum number of characters given by the signed Count argument. If Count is greater
/// than zero, the ends to be moved are moved forward, and if Count is less than zero, the ends are moved backward. Two special
/// Count values, tomForward and tomBackward, are defined. These values are guaranteed to reach the end and the start of the
/// story, respectively. The default value of Count is tomForward.
///
///
/// In Move* methods that turn a nondegenerate range into a degenerate one, such as Move, MoveWhile, and MoveUntil, cpFirst
/// is changed if Count is negative and cpLim is changed if Count is positive. After this movement, the other end of
/// the range is also moved to the new location. See the individual methods for more specific Count information. For nondegenerate
/// ranges, the methods MoveStart, MoveEnd, MoveStartWhile, MoveEndWhile, MoveStartUntil and MoveEndUntil move either the starting
/// position (Start) or the ending position (End).
///
///
/// To select a unit that corresponds to a contiguous range, such as a tomWord, tomSentence, and tomParagraph, use the MoveEnd method. To
/// select a unit that corresponds to a noncontiguous range, such as tomObject, use the EndOf method, since the next object may occur
/// after substantial intermediate text, if at all. To select a tomCell unit, the range must be inside a table.
///
///
/// Examples and further explanation of the Count and Unit arguments follow. Note that TOM engines may not support all of
/// the units in the table above. For example, rich edit controls do not offer the concepts of sections, but rather return E_NOTIMPL when
/// given tomSection. However if a TOM engine does support a unit, it has the index value given in the table.
///
///
/// Applications typically do not implement the ITextRange interface. Microsoft text solutions, such as rich edit controls,
/// implement ITextRange as part of their TOM implementation.
///
/// Applications can retrieve an ITextRange pointer by calling the Range method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextrange
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextRange")]
[ComImport, Guid("8CC497C2-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)]
public interface ITextRange
{
/// Gets the plain text in this range. The Text property is the default property of the ITextRange interface.
///
/// Type: BSTR*
/// The text.
///
///
///
/// The ITextRange::GetText method returns the plain text in the range. The Text property is the default property for
/// ITextRange; this is, it is automatically invoked for a range, as in the following Microsoft Visual Basic for Applications (VBA) example.
///
///
/// Some of the examples below use this fact. The ITextRange::SetText method substitutes bstr for the range text. For
/// processing a single character, the Char property is more efficient than the Text property and does not require creating a single
/// character range for storing a character. If the range is degenerate, the Text property lets you insert text easily. You can also
/// delete the text in a range, as shown in the following VBA examples.
///
///
/// You can use the Text property to copy plain text from one place to another, simply by setting one range equal to another.
/// (This is quite different from the Duplicate property; for more information, see ITextRange::GetDuplicate). The following
/// Microsoft Visual Basic example statement sets the text in the range1 to that in range2.
///
///
/// The ranges can be in different stories or even in different applications. However, they do imply copying the text first into a
/// BSTR and then from that string to the target location. For large amounts of text, the ITextRange::Copy and
/// ITextRange::Paste methods can be faster, since they can perform the copy directly from source to target and with any format
/// supported by the source and target.
///
///
/// The text returned by the Text property is given in Unicode. The end-of-paragraph mark may be given by 0x2029 (the Unicode
/// Paragraph Separator), or by carriage return/line feed (CR/LF) (0xd, 0xa), or by a carriage return alone, depending on the
/// original file. Microsoft Word uses a carriage return alone, unless it reads another choice in from a file, the clipboard, or an
/// IDataObject. The placeholder for an embedded object is given by the special character, WCH_EMBEDDING, which has the
/// Unicode value 0xFFFC.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-gettext HRESULT GetText( BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
string GetText();
/// Sets the text in this range.
///
/// Type: BSTR
/// Text that replaces the current text in this range. If null, the current text is deleted.
///
///
///
/// ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with
/// the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed
/// the text in. For UI selection behavior, see TypeText.
///
///
/// If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the
/// ITextRange::SetText method (unless some other range has changed that text in between the calls).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-settext HRESULT SetText( [in] BSTR bstr );
void SetText([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Gets the character at the start position of the range.
///
/// Type: long*
/// The start character position of the range.
///
///
/// The following Microsoft Visual Basic example sets ch equal to the character at the start of the range.
///
/// Similarly, ITextRange::SetChar overwrites the character at the start of the range with the specified character. The characters
/// retrieved and set by these methods are LONG variables, which hide the way that they are stored in the backing store (as
/// bytes, words, variable-length, and so forth), and they do not require using a BSTR.
///
/// The Char property, which can do most things that a characters collection can, has two big advantages:
///
/// -
/// It can reference any character in the parent story instead of being limited to the parent range.
///
/// -
/// It is significantly faster, since LONG s are involved instead of range objects.
///
///
/// Accordingly, the Text Object Model (TOM) does not support a characters collection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getchar HRESULT GetChar( long *pChar );
int GetChar();
/// Sets the character at the starting position of the range.
///
/// Type: long
/// New value for character at the starting position.
///
///
///
/// ITextRange::SetChar lets you specify the precise character code to use. However, string literals with similar looking
/// glyphs can be misleading.
///
///
/// The characters set by this method are LONG instead of a BSTR. This hides the way that they are stored in the
/// backing store, (as bytes, words, variable-length, and so forth).
///
///
/// Frequently on systems that do not have automatic word-wrapping, documents have hard carriage returns inserted just for line
/// breaks. The following code shows a simple, but not perfect, way to convert such hard carriage returns back to blanks for the
/// story that is associated with the range r.
///
/// Alternatively, you could use the following inside the IF loop.
///
/// This approach enables you to wrap the text to other widths. However, the algorithm isn't perfect: it assumes that a hard carriage
/// return that is followed by anything other than white space (blank, tab, line feed, carriage return, and so forth) should be
/// replaced by a blank. The algorithm also assumes that the carriage return character is a single character like carriage return or
/// the Unicode end-of-paragraph (EOP) 0x2029 character. And, the combination carriage return and line feed isn't matched and would
/// require writing and executing more code (or use ). Another caution is that there are other cases, such as mixed code and
/// documentation, where the algorithm does not work correctly.
///
///
/// However, ITextRange::SetChar is more efficient than a replace operation that is accomplished by a delete followed by an
/// insertion. Thus, rewriting the code without using ITextRange::SetChar would probably be much slower.
///
///
/// The Char property, which can do most things that a characters collection can, has two big advantages: it can reference any
/// character in the parent story instead of being limited to the parent range, and it's significantly faster, since LONG s
/// rather than range objects are involved. Because of these advantages, the Text Object Model (TOM) does not support a characters collection.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setchar HRESULT SetChar( long Char );
void SetChar(int Char);
/// Gets a duplicate of this range object.
///
/// Type: ITextRange**
/// The duplicate of the range.
///
///
///
/// To create an insertion point in order to traverse a range, first duplicate the range and then collapse the duplicate at its start
/// character position. Note, a range is characterized by start and end character positions, and the story it belongs to.
///
///
/// Even if the range is actually an ITextSelection, the duplicate returned is an ITextRange. For an example, see the
/// ITextRange::FindText method.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getduplicate HRESULT GetDuplicate( ITextRange **ppRange );
ITextRange GetDuplicate();
/// Gets an ITextRange object with the specified range's formatted text.
///
/// Type: ITextRange**
/// The ITextRange object with the formatted text.
///
///
///
/// This method, which amounts to an alias for the ITextRange::GetDuplicate method, is included to be Microsoft Visual Basic for
/// Applications (VBA)-friendly. The method returns the formatted text in a range. If the ITextRange does not belong to the same Text
/// Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be
/// used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in a range2, by the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getformattedtext HRESULT GetFormattedText( ITextRange
// **ppRange );
ITextRange GetFormattedText();
/// Sets the formatted text of this range text to the formatted text of the specified range.
///
/// Type: ITextRange*
/// The formatted text to replace this range's text.
///
///
///
/// If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by the IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to
/// reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in range2 with the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setformattedtext HRESULT SetFormattedText( [in]
// ITextRange *pRange );
void SetFormattedText([In, Optional] ITextRange? pRange);
/// Gets the start character position of the range.
///
/// Type: long*
/// The start character position.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstart HRESULT GetStart( long *pcpFirst );
int GetStart();
/// Sets the character position for the start of this range.
///
/// Type: long
/// The new character position for the start of the range.
///
///
///
/// Note that if cpFirst is greater than the range's end position, this method sets the end position equal to cpFirst,
/// making the range an insertion point. If this range is the selection, the start position becomes the active end and is scrolled
/// into view if the display isn't frozen.
///
///
/// ITextRange::SetEnd sets the range's end position, and ITextRange::SetRange sets both range ends simultaneously. The following
/// example shows how to convert a nondegenerate range into a degenerate one (insertion point).
///
/// Similarly, converts the range into an insertion point at the end position.
/// The following example adds 1 to the end position, if it is not at the end of the story.
/// This also makes the end position the active end of the range, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setstart HRESULT SetStart( [in] long cpFirst );
void SetStart(int cpFirst);
/// Gets the end character position of the range.
///
/// Type: long*
/// The end character position.
///
///
///
/// Although a pointer to a range remains valid when the text is edited, this is not the case for the character position. A character
/// position is volatile; that is, it becomes invalid as soon as text is inserted or deleted before the character position. Be
/// careful about using methods that return character position values, especially if the values are to be stored for any duration.
///
/// This method is similar to the ITextRange::GetStart method which gets the start character position of the range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getend HRESULT GetEnd( long *pcpLim );
int GetEnd();
/// Sets the end position of the range.
///
/// Type: long
/// The new end position.
///
///
///
/// If the new end position is less than the start position, this method also sets the start position to cp; that is, the
/// range becomes an insertion point.
///
///
/// If this range is actually the selection, the end position becomes the active end and, if the display is not frozen, it is
/// scrolled into view.
///
///
/// ITextRange::SetStart sets the range's start position and ITextRange::SetRange sets both range ends simultaneously. To convert a
/// nondegenerate range, r, into a degenerate one (insertion point) at the start position, use
///
/// Similarly, r.Start = r.End converts r into an insertion point at the end position.
/// To add 1 to the end position, unless it is at the end of the story, use:
/// This also makes end position the active end, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setend HRESULT SetEnd( long cpLim );
void SetEnd(int cpLim);
/// Gets an ITextFont object with the character attributes of the specified range.
///
/// Type: ITextFont**
/// The pointer to an ITextFont object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextFont for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getfont HRESULT GetFont( ITextFont **ppFont );
ITextFont GetFont();
/// Sets this range's character attributes to those of the specified ITextFont object.
///
/// Type: ITextFont*
/// A font object with the desired character format.
///
///
/// For occasional format changes, use the ITextRange::SetFont method. However, to make a number of character formatting
/// changes, it is more efficient to use a font duplicate. This is because every time you execute a statement like range.font.bold
/// = tomTrue, a font object is allocated and freed. However, a font duplicate can be allocated once and used many times.
/// Furthermore, you can save the font duplicate, reset it to the default or undefined states with the Reset method, and give it
/// values as needed for your rich-text processing. For sample code that shows how to use font duplicates, see Using a Font Duplicate.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setfont HRESULT SetFont( [in] ITextFont *pFont );
void SetFont([In, Optional] ITextFont? pFont);
/// Gets an ITextPara object with the paragraph attributes of the specified range.
///
/// Type: ITextPara**
/// The pointer to the ITextPara object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextPara for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpara HRESULT GetPara( ITextPara **ppPara );
ITextPara GetPara();
/// Sets the paragraph attributes of this range to those of the specified ITextPara object.
///
/// Type: ITextPara*
/// The paragraph object with the desired paragraph format.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpara HRESULT SetPara( [in] ITextPara *pPara );
void SetPara([In, Optional] ITextPara? pPara);
/// Gets the count of characters in the range's story.
///
/// Type: long*
/// The count of characters in the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorylength HRESULT GetStoryLength( long *pCount );
int GetStoryLength();
/// Get the type of the range's story.
///
/// Type: long*
/// The type of the range's story. The pValue value can be one of the following values.
///
///
/// Story type
/// Value
/// Story type
/// Value
///
/// -
/// tomUnknownStory
/// 0
/// tomEvenPagesHeaderStory
/// 6
///
/// -
/// tomMainTextStory
/// 1
/// tomPrimaryHeaderStory
/// 7
///
/// -
/// tomFootnotesStory
/// 2
/// tomEvenPagesFooterStory
/// 8
///
/// -
/// tomEndnotesStory
/// 3
/// tomPrimaryFooterStory
/// 9
///
/// -
/// tomCommentsStory
/// 4
/// tomFirstPageHeaderStory
/// 10
///
/// -
/// tomTextFrameStory
/// 5
/// tomFirstPageFooterStory
/// 11
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorytype HRESULT GetStoryType( long *pValue );
tomConstants GetStoryType();
/// Collapses the specified text range into a degenerate point at either the beginning or end of the range.
///
/// Type: long
/// Flag specifying the end to collapse at. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomStart or tomTrue
/// Range is collapsed to the start of the range. This is the default.
///
/// -
/// tomEnd or tomFalse
/// Range is collapsed to the end of the range.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-collapse HRESULT Collapse( [in] long bStart );
void Collapse(tomConstants bStart);
/// Expands this range so that any partial units it contains are completely contained.
///
/// Type: long
///
/// Unit to include, if it is partially within the range. The default value is . For a list of the other Unit values, see the
/// discussion under ITextRange.
///
///
///
/// Type: long*
/// The count of characters added to the range. The value can be null.
///
///
/// For example, if an insertion point is at the beginning, the end, or within a word, ITextRange::Expand expands the range to
/// include that word. If the range already includes one word and part of another, ITextRange::Expand expands the range to
/// include both words. ITextRange::Expand expands the range to include the visible portion of the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-expand HRESULT Expand( long Unit, long *pDelta );
int Expand(int Unit);
///
/// Retrieves the story index of the Unit parameter at the specified range Start character position. The first Unit in
/// a story has an index value of 1. The index of a Unit is the same for all character positions from that immediately
/// preceding the Unit up to the last character in the Unit.
///
///
/// Type: long
/// Unit that is indexed. For a list of possible Unit values, see the discussion under ITextRange.
///
///
/// Type: long*
/// The index value. The value is zero if Unit does not exist.
///
///
///
/// The ITextRange::GetIndex method retrieves the story index of a word, line, sentence, paragraph, and so forth, at the range
/// Start. Unit specifies which kind of entity to index, such as words ( tomWord), lines ( tomLine), sentences (
/// tomSentence), or paragraphs ( tomParagraph). For example, ITextRange::GetIndex sets pIndex equal to
/// the line number of the first line in the range. For a range at the end of the story, ITextRange::GetIndex, returns the
/// number of Unit s in the story. Thus, you can get the number of words, lines, objects, and so forth, in a story.
///
///
/// The index value returned by the ITextRange::GetIndex method is not valid if the text is subsequently edited. Thus, users
/// should be careful about using methods that return index values, especially if the values are to be stored for any duration. This
/// is in contrast to a pointer to a range, which does remain valid when the text is edited.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getindex HRESULT GetIndex( long Unit, long *pIndex );
int GetIndex(int Unit);
/// Changes this range to the specified unit of the story.
///
/// Type: long
/// Unit used to index the range. For a list of unit values, see ITextRange.
///
///
/// Type: long
///
/// Index for the Unit. This range is relocated to the Unit that has this index number. If positive, the numbering of
/// Unit s begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story
/// and proceeds backward. The start of the story corresponds to an Index of 1 for all units that exist, and the last unit in
/// the story corresponds to an Index of -1.
///
///
///
/// Type: long
///
/// Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start
/// position of the specified Unit. If nonzero, the range is set to the entire Unit.
///
///
///
/// This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, converts a
/// range to an insertion point at the start of the tenth line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setindex HRESULT SetIndex( [in] long Unit, [in] long
// Index, [in] long Extend );
void SetIndex(int Unit, int Index, int Extend);
/// Adjusts the range endpoints to the specified values.
///
/// Type: long
/// The character position for the anchor end of the range.
///
///
/// Type: long
/// The character position for the active end of the range.
///
///
///
/// This method sets the range's start position to , and the end position to . If the range is a nondegenerate selection,
/// cpAnchor is the active end, and cpAnchor is the anchor end. If the range is a degenerate selection, the selection
/// is displayed at the start of the line, rather than at the end of the previous line.
///
/// This method removes any other subranges this range may have. To preserve the current subranges, use ITextRange2::SetActiveSubrange.
/// If the text range is a selection, you can set the attributes of the selection by using the ITextSelection::SetFlags method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setrange HRESULT SetRange( long cpAnchor, long cpActive );
void SetRange(int cpAnchor, int cpActive);
/// Determines whether this range is within or at the same text as a specified range.
///
/// Type: ITextRange*
/// Text that is compared to the current range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The method returns pB is tomTrue only if the range is in or at the
/// same text as pRange.
///
///
///
///
/// For range2 to be contained in range1, both ranges must be in the same story, and the limits of range2 must satisfy either of the
/// following statements.
///
///
/// -
///
/// The start and end character positions of range1 are the same as range2. That is, both ranges are degenerate and have identical
/// insertion points.
///
///
/// -
/// Range2 is a nondegenerate range with start and end character positions at or within those of range1.
///
///
/// The following example shows how to walk one range with another.
///
/// When the ITextRange::FindText, ITextRange::MoveWhile, and ITextRange::MoveUntil method families are used, you can use one range
/// to walk another by specifying the appropriate limit count of characters (for an example, see the Remarks in ITextRange::Find).
///
///
/// ITextRange::IsEqual is a special case of ITextRange::InRange that returns pBtomTrue if the pRange has
/// the same start and end character positions and belongs to the same story.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-inrange HRESULT InRange( ITextRange *pRange, long
// *pValue );
tomConstants InRange([In, Optional] ITextRange? pRange);
/// Determines whether this range's story is the same as a specified range's story.
///
/// Type: ITextRange*
/// The ITextRange object whose story is compared to this range's story.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range's story is the same
/// as that of the pRange; otherwise it receives tomFalse.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-instory HRESULT InStory( ITextRange *pRange, long
// *pValue );
tomConstants InStory([In, Optional] ITextRange? pRange);
/// Determines whether this range has the same character positions and story as those of a specified range.
///
/// Type: ITextRange*
/// The ITextRange object that is compared to this range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range points at the same
/// text (has the same start and end character positions and story) as pRange; otherwise it returns tomFalse.
///
///
///
/// The ITextRange::IsEqual method returns tomTrue only if the range points at the same text as pRange. See
/// Finding Rich Text for code that compares two different pieces of text to see if they contain the same plain text and the same
/// character formatting.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-isequal HRESULT IsEqual( ITextRange *pRange, long
// *pValue );
tomConstants IsEqual([In, Optional] ITextRange? pRange);
/// Sets the start and end positions, and story values of the active selection, to those of this range.
///
/// The active end of the new selection is at the end position.
/// The caret for an ambiguous character position is displayed at the beginning of the line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-select HRESULT Select();
void Select();
/// Moves the range ends to the start of the first overlapping Unit in the range.
///
/// Type: long
/// Unit to use in the move operation. For a list of Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// How to move the ends of the range. It can be one of the following values.
///
///
/// 0 (or tomMove)
/// Collapses a nondegenerate range to the start position by moving the insertion point. This is the default.
///
/// -
/// 1 (or tomExtend)
/// Moves the start position to the beginning of the overlapping Unit. Does not move the end position.
///
///
///
///
/// Type: long*
///
/// Pointer to a variable that receives the number of characters that the start position is moved. It can be null. On return,
/// pDelta is the signed number of characters that the insertion point or start position is moved. This value is always less
/// than or equal to zero, because the motion is always toward the beginning of the story.
///
///
///
///
/// If the range is an insertion point on a boundary between Unit s, ITextRange::StartOf does not change the start position.
///
///
/// The ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend
/// from the active end, whereas ITextRange::StartOf extends from the start position and ITextRange::EndOf extends from
/// the end position.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-startof HRESULT StartOf( long Unit, long Extend, long
// *pDelta );
tomConstants StartOf(tomConstants Unit, tomConstants Extend);
/// Moves this range's ends to the end of the last overlapping Unit in the range.
///
/// Type: long
/// Unit to use. Default value: tomWord. For a list of the other Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// Indicator of how the shifting of the range ends is to proceed. It can be one of the following.
///
///
/// 0 or tomMove
///
/// Collapses a nondegenerate range to the End of the original range by moving the insertion point. This is the default.
///
///
/// -
/// 1 (or tomExtend)
/// Moves End to the end of the overlapping Unit. Does not move Start.
///
///
///
///
/// Type: long*
///
/// The count of characters that End is moved past. The value of the pointer can be null. On return, the value of pDelta is
/// the number of characters the insertion point or End is moved plus 1 if a collapse occurs to the entry End. If the range
/// includes the final CR (carriage return) (at the end of the story) and Extend = tomMove, then pDelta is set to â1,
/// to indicate that the collapse occurred before the end of the range (because an insertion point cannot exist beyond the
/// final CR).
///
///
///
/// For comparison, the ITextRange::StartOf method moves the range ends to the beginning of the first overlapping Unit in the
/// range. Note, the ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in
/// that the latter extend from the active end, whereas ITextRange::StartOf extends from Start and ITextRange::EndOf
/// extends from End. If the range is an insertion point on a boundary between Unit s, ITextRange::EndOf does not
/// change End. In particular, calling ITextRange::EndOf ( tomCharacter, *, *) does not change End except for an
/// insertion point at the beginning of a story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-endof HRESULT EndOf( long Unit, long Extend, long
// *pDelta );
tomConstants EndOf(tomConstants Unit, tomConstants Extend);
///
/// Moves the insertion point forward or backward a specified number of units. If the range is nondegenerate, the range is collapsed
/// to an insertion point at either end, depending on Count, and then is moved.
///
///
/// Type: long
/// Unit to use. The default value is tomCharacter. For information on other values, see the discussion in ITextRange.
///
///
/// Type: long
///
/// Number of Unit s to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward
/// the end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero,
/// the range is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of Unit s the insertion point moves past. The pointer can be NULL. For more information, see the
/// Remarks section.
///
///
///
///
/// If the range is degenerate (an insertion point), this method tries to move the insertion point Count  Unit s.
///
///
/// If the range is nondegenerate and Count is greater than zero, this method collapses the range at the end character
/// position, moves the resulting insertion point forward to a Unit boundary (if it is not already at one), and then tries to
/// move Count - 1 Unit s forward. If the range is nondegenerate and Count is less than zero, this method
/// collapses the range at the start character position, moves the resulting insertion point backward to a Unit boundary (if
/// it isn't already at one), and then tries to move | Count| - 1 Unit s backward. Thus, in both cases, collapsing a
/// nondegenerate range to an insertion point, whether moving to the start or end of the Unit following the collapse, counts
/// as a Unit.
///
///
/// The ITextRange::Move method returns pDelta = number of Unit s actually moved. This method never moves the
/// insertion point beyond the story of this range. If CountUnit s would move the insertion point before the beginning
/// of the story, it is moved to the story beginning and pDelta is set accordingly. Similarly, if Count  Unit s
/// would move it beyond the end of the story, it is moved to the story end.
///
///
/// The ITextRange::Move method works similarly to the UI-oriented MoveLeft and MoveRight methods, except that the direction
/// of motion is logical rather than geometrical. That is, with ITextRange::Move the direction is either toward the end or
/// toward the start of the story. Depending on the language, moving toward the end of the story could be moving to the left or to
/// the right. To get a feel for Count, press Ctrl+Right Arrow in a Microsoft Word document for a variety of selections. In
/// left-to-right text, this keystroke behaves the same as , and . Count corresponds to the number of times you press
/// Ctrl+Right Arrow.
///
///
/// For example, if you press Ctrl+Right Arrow for the selections shown in both of the following figures, you end up with an
/// insertion point at character position 8, since this command collapses the selections at their end character positions (7 and 8,
/// respectively) and moves to the next tomWord boundary.
///
///
/// The first selection does not include the blank space at character position 7, so Ctrl+Right Arrow moves past the space to the
/// tomWord boundary at character position 8. The end character position is already at a tomWord boundary for the
/// second selection, so Ctrl+Right Arrow just collapses the selection at that boundary. Similarly, Ctrl+Left Arrow, which for this
/// text acts like , and collapses the first selection at character position 5, which is already at a tomWord boundary, so no
/// more motion occurs. But Ctrl+Left Arrow collapses the second selection at character position 4 and then moves to zero, since
/// that's the next tomWord boundary in the direction of motion.
///
///
/// The return argument, pDelta, is set equal to the number of Unit s that the insertion point is moved including one
/// Unit for collapsing a nondegenerate range and moving it to a Unit boundary. So, if no motion and no collapse occur,
/// as when the range is an insertion point at the end of the story, pDelta is set equal to zero. This approach is useful for
/// controlling program loops that process a whole story.
///
///
/// In both of the cases mentioned above, calling sets pDelta equal to 1 because the ranges were collapsed. Similarly, calling
/// sets pDelta equal to -1 for both cases. Collapsing, with or without moving part of a Unit to a Unit
/// boundary, counts as a Unit moved.
///
///
/// The direction of motion refers to the logical character ordering in the plain-text backing store. This approach avoids the
/// problems of geometrical ordering, such as left versus right and up versus down, in international software. Such geometrical
/// methods are still needed in the edit engine, of course, since keyboards have arrow keys to invoke them. If the range is really an
/// ITextSelection object, then methods like MoveLeft and MoveRight can be used.
///
///
/// If Unit specifies characters ( tomCharacter), the Text Object Model (TOM) uses the Unicode character set. To
/// convert between Unicode and multibyte character sets the MultiByteToWideChar and WideCharToMultiByte functions provide easy ways
/// to convert between Unicode and multibyte character sets on import and export, respectively. For more information, see Open. In
/// this connection, the use of a carriage return/line feed (CR/LF) to separate paragraphs is as problematic as double-byte character
/// set (DBCS). The ITextSelection UI methods back up over a CR/LF as if it were a single character, but the ITextRange::Move
/// methods count CR/LFs as two characters. It's clearly better to use a single character as a paragraph separator, which in TOM is
/// represented by a character return, although the Unicode paragraph separator character, 0x2029, is accepted. In general, TOM
/// engines should support CR/LF, carriage return (CR), line feed (LF), vertical tab, form feed, and 0x2029. Microsoft Rich Edit 2.0
/// also supports CR/CR/LF for backward compatibility.
///
///
/// See also the ITextRange::MoveStart and ITextRange::MoveEnd methods, which move the range Start or End position Count Â
/// Unit s, respectively.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-move HRESULT Move( long Unit, long Count, long *pDelta );
tomConstants Move(tomConstants Unit, int Count);
/// Moves the start position of the range the specified number of units in the specified direction.
///
/// Type: long
///
/// Unit used in the move. The default value is tomCharacter. For a list of the other Unit values, see the discussion
/// under ITextRange.
///
///
///
/// Type: long
///
/// Number of units to move. The default value is 1. If Count is greater than zero, motion is forwardâtoward the end of the
/// storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the start
/// position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end is moved. The value can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStart is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestart HRESULT MoveStart( long Unit, long Count, long
// *pDelta );
tomConstants MoveStart(tomConstants Unit, int Count);
/// Moves the end position of the range.
///
/// Type: long
///
/// The units by which to move the end of the range. The default value is tomCharacter. For a list of the other unit values,
/// see ITextRange.
///
///
///
/// Type: long
///
/// The number of units to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward the
/// end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the
/// end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end position of the range is moved past. The value can be null.
///
///
///
/// If the new end position precedes the old start position, the new start position is set equal to the new end position; that is, it
/// becomes a degenerate range or an insertion point.
///
///
/// The motion described by ITextRange::MoveEnd is logical rather than geometric. That is, motion is toward the end or toward
/// the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveend HRESULT MoveEnd( long Unit, long Count, long
// *pDelta );
tomConstants MoveEnd(tomConstants Unit, int Count);
///
/// Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the
/// number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching
/// character is found.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search starts at the start position and goes backward â toward the beginning of the story.
/// If Count is greater than zero, the search starts at the end position and goes forward â toward the end of the story.
///
///
///
/// Type: long*
/// The actual count of characters end is moved. This parameter can be null.
///
///
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the
/// start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveWhile method is similar to ITextRange::MoveUntil, but MoveWhile searches as long as it finds
/// members of the set specified by Cset, and there is no additional increment to the value pDelta.
///
///
/// The ITextRange::MoveStartWhile and ITextRange::MoveEndWhile methods move the start and end, respectively, just past all
/// contiguous characters that are found in set of characters specified by the Cset parameter.
///
///
/// The VARIANT type is primarily intended to be used with IDispatch scenarios like Microsoft Visual Basic for
/// Applications (VBA), but it can be readily used from C or C++ as well. The following C++ code illustrates how to initialize and
/// use the VARIANT argument for matching a span of digits in the range r.
///
/// Alternatively, an explicit string could be used, as in the following sample.
///
/// The following VBA example code matches the body of the next Standard Generalized Markup Language (SGML) entry in a range, r. SGML
/// entries start with < > and end with </ >.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movewhile HRESULT MoveWhile( VARIANT *Cset, long Count,
// long *pDelta );
int MoveWhile([In] object Cset, int Count);
///
/// Moves the start position of the range either Count characters, or just past all contiguous characters that are found in
/// the set of characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
/// The actual count of characters that the start position is moved. This parameter can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartwhile HRESULT MoveStartWhile( VARIANT *Cset,
// long Count, long *pDelta );
int MoveStartWhile([In] object Cset, int Count);
///
/// Moves the end of the range either Count characters or just past all contiguous characters that are found in the set of
/// characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of characters that the end is moved. The value can be null.
///
///
/// If the new end precedes the old start, the new start is set equal to the new end.
///
/// The motion described by ITextRange::MoveEndWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveendwhile HRESULT MoveEndWhile( VARIANT *Cset, long
// Count, long *pDelta );
int MoveEndWhile([In] object Cset, int Count);
///
/// Searches up to Count characters for the first character in the set of characters specified by Cset. If a character
/// is found, the range is collapsed to that point. The start of the search and the direction are also specified by Count.
///
///
/// Type: VARIANT*
///
/// The character set used in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search is backward starting at the start position. If Count is greater than zero, the
/// search is forward starting at the end.
///
///
///
/// Type: long*
///
/// The number of characters the insertion point is moved, plus 1 for a match if Count is greater than zero, and â1 for a
/// match if Count less than zero. The pointer can be null.
///
///
///
/// If no character is matched, the range is unchanged.
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveStartUntil and ITextRange::MoveEndUntil methods move the start and end, respectively, until it finds the
/// first character that is also in the set specified by the Cset parameter.
///
///
/// The ITextRange::MoveUntil method is similar to ITextRange::MoveWhile, but there are two differences. First,
/// MoveUntil moves an insertion point until it finds the first character that belongs to the character set specified
/// by Cset. Second, in MoveUntil the character matched counts as an additional character in the value returned in
/// pDelta. This lets you know that the character at one end of the range or the other belongs to the Cset even though
/// the insertion point stays at one of the range ends.
///
///
/// For example, suppose the range, r, is an insertion point. To see if the character at r (that is, given by r.GetChar()) is in
/// Cset, call
///
///
/// If the character is in Cset, the return value is 1 and the insertion point does not move. Similarly, to see if the
/// character preceding r is in Cset, call
///
/// If the character is in Cset, the return value is â1.
///
/// The following Microsoft Visual Basic for Applications (VBA) subroutine prints all numbers in the story identified by the range, r.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveuntil HRESULT MoveUntil( VARIANT *Cset, long Count,
// long *pDelta );
int MoveUntil([In] object Cset, int Count);
///
/// Moves the start position of the range the position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the start position.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters the start of the range is moved, plus 1 for a match if Count is greater than zero, and
/// â1 for a match if Count is less than zero. The value can be null.
///
///
///
/// If no character from Cset is found within Count positions of the start position, the range is left unchanged.
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartuntil HRESULT MoveStartUntil( VARIANT *Cset,
// long Count, long *pDelta );
int MoveStartUntil([In] object Cset, int Count);
///
/// Moves the range's end to the character position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the range's end.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters that the range end is moved, plus 1 for a match if Count is greater than zero, and â1
/// for a match if Count is less than zero. The value can be null.
///
///
///
///
/// If no character from the set specified by Cset is found within Count positions of the range's end, the range is
/// left unchanged. If the new end precedes the old start, the new start is set equal to the new end.
///
///
/// The motion described by ITextRange::MoveEndUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveenduntil HRESULT MoveEndUntil( VARIANT *Cset, long
// Count, long *pDelta );
int MoveEndUntil([In] object Cset, int Count);
///
/// Searches up to Count characters for the text given by bstr. The starting position and direction are also specified
/// by Count, and the matching criteria are given by Flags.
///
///
/// Type: BSTR
/// String to find.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Searches to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
///
/// Searches forward for n chars, starting from cpFirst. If the range itself matches bstr, another search is
/// attempted from cpFirst + 1.
///
///
/// -
/// n(less than 0)
///
/// Searches backward for n chars, starting from cpLim. If the range itself matches bstr, another search is
/// attempted from cpLim â 1.
///
///
/// -
/// 0 (degenerate range)
/// Search begins after the range.
///
/// -
/// 0 (nondegenerate range)
/// Search is limited to the range.
///
///
/// Â
///
/// In all cases, if a string is found, the range limits are changed to be those of the matched string and pLength is set
/// equal to the length of the string. If the string is not found, the range remains unchanged and pLength is set equal to zero.
///
///
///
/// Type: long
/// Flags governing comparisons. It can be 0 (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
///
///
/// The ITextRange::FindText method can also match special characters by using a caret (^) followed by a special letter. For a
/// list of special characters, see the Special list available in the Microsoft Word Find and Replace dialog box. For
/// example, matches the next paragraph mark. Note, can be used to represent the Clipboard contents in the string to be replaced.
/// Thus, using in the find string enables you to search for rich text. For more details, see the Word Help files.
///
///
/// As a comparison with the ITextRange::FindText method, the ITextRange::FindTextStart method searches forward or backward
/// from the range's Start cp, and the ITextRange::FindTextEnd method searches forward or backward from the range's End
/// cp. For more details, see the descriptions of these methods.
///
/// The following are several code snippets that show the ITextRange::FindText methods.
///
/// Example #1. The following Microsoft Visual Basic for Applications (VBA) program prints all the /* ... */ comments in a story
/// identified by the range r.
///
///
/// Instead of these comments being printed, they could be inserted into another edit instance and saved to a file, or they could be
/// inserted into separate cells in a table or spreadsheet.
///
/// To print all lines containing one or more occurrences of the word "laser", replace the loop by the following code:
///
/// Example #2. The following program prints a telephone list, given a story that contains an address list. The address list entries
/// are separated by two or more paragraph marks, and each entry has the following form.
///
/// Note the use of the character in the FindText string argument to locate a pair of consecutive paragraph marks.
/// Example #3. The following subroutine replaces all occurrences of the string, str1, in a range by str2:
///
/// Example #4. The following line of code inserts a blank before the first occurrence of a right parenthesis, "(", that follows an
/// occurrence of HRESULT.
///
///
/// To do this for all such occurrences, change the If into a While/Wend loop in the above line of code. This an example of a
/// FIND/REPLACE macro that cannot be run with Find and Replace dialog boxes.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtext HRESULT FindText( BSTR bstr, long Count, long
// Flags, long *pLength );
int FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting at the range's Start cp ( cpFirst).
/// The search is subject to the comparison parameter, Flags. If the string is found, the Start cp is changed to the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged,
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// The string to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n(greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n(less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing the comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of the matched string.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextstart HRESULT FindTextStart( BSTR bstr, long
// Count, long Flags, long *pLength );
int FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting from the range's End cp. The search is
/// subject to the comparison parameter, Flags. If the string is found, the End cp is changed to be the end of the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// String to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n (less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextend HRESULT FindTextEnd( BSTR bstr, long Count,
// long Flags, long *pLength );
int FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
/// Mimics the DELETE and BACKSPACE keys, with and without the CTRL key depressed.
///
/// Type: long
/// Unit to use. Unit can be tomCharacter (the default value) or tomWord.
///
///
/// Type: long
///
/// Number of Unit s to delete. If Count= zero, it deletes the text in the range only. If Count is greater than
/// zero, ITextRange::Delete acts as if the DELETE key was pressed Count times. If Count is less than zero, it
/// acts as if the BACKSPACE key was pressed Count times. The default value is 1. For more information, see the Remarks.
///
///
///
/// Type: long*
///
/// The count of units deleted. It can be null. The pDelta parameter is set equal to the number of Unit s deleted.
/// Deleting the text in a nondegenerate range counts as one Unit.
///
///
///
///
/// If Count = zero, this method deletes the text in the range, that is, it deletes nothing if the range is only an insertion point.
///
///
/// If Count is not zero, and the range is an insertion point (that is, degenerate), | Count| (absolute value of
/// Count) Unit s are deleted in the logical direction given by the sign of Count, where a positive value is the
/// direction toward the end of the story, and a negative value is toward the start of the story.
///
///
/// If Count is not zero, and the range is nondegenerate (contains text), the text in the range is deleted (regardless of the
/// values of Unit and Count), thereby creating an insertion point. Then, | Count| - 1 Â Unit s are
/// deleted in the logical direction given by the sign of Count.
///
///
/// The text in the range can also be deleted by assigning a null string to the range (executing statement r = where r is the range).
/// However, ITextRange::Delete does not require allocating a BSTR.
///
///
/// Deleting the end-of-paragraph mark (CR) results in the special behavior of the Microsoft Word UI. Four cases are of particular interest:
///
///
/// -
///
/// If you delete just the CR but the paragraph includes text, then the CR is deleted, and the following paragraph gets the same
/// paragraph formatting as current one.
///
///
/// -
///
/// If you delete the CR as well as some, but not all, of the characters in the following paragraph, the characters left over from
/// the current paragraph get the paragraph formatting of the following paragraph.
///
///
/// -
/// If you select to the end of a paragraph, but not the whole paragraph, the CR is not deleted.
///
/// -
///
/// If you delete the whole paragraph (from the beginning through the CR), you delete the CR as well (unless it is the final CR in
/// the file).
///
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-delete HRESULT Delete( long Unit, long Count, long
// *pDelta );
int Delete(tomConstants Unit, int Count);
/// Cuts the plain or rich text to a data object or to the Clipboard, depending on the pVar parameter.
///
/// Type: VARIANT*
///
/// The cut text. pVar->ppunkVal is the out parameter for an IDataObject object, provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-cut HRESULT Cut( VARIANT *pVar );
void Cut(out object pVar);
/// Copies the text to a data object.
///
/// Type: VARIANT*
///
/// The copied text. pVar->ppunkVal is the out parameter for an IDataObject provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
///
///
/// The ITextRange::Cut, ITextRange::Copy, and ITextRange::Paste methods let you perform the usual Cut, Copy,
/// and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among
/// clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to
/// reference a text solution's own internal rich text formats.
///
///
/// To copy and replace plain text, you can use the ITextRange::GetText and ITextRange::SetText methods. To copy
/// formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the
/// ITextRange::GetFormattedText and ITextRange::SetFormattedText methods, as shown in the following Microsoft Visual Basic example:
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-copy HRESULT Copy( VARIANT *pVar );
void Copy(out object pVar);
/// Pastes text from a specified data object.
///
/// Type: VARIANT*
/// The IDataObject to paste. However, the contents of the clipboard are used if any of the following are true.
/// pVar is null
/// pVar punkVal is null
/// pVar is not VT_UNKNOWN
/// pVar punkVal does not return an IDataObject when queried for one
///
///
/// Type: long
///
/// The clipboard format to use in the paste operation. Zero is best format, which usually is RTF, but CF_UNICODETEXT and
/// other formats are also possible. The default value is zero. For more information, see Clipboard Formats.
///
///
///
/// Type: HRESULT
///
/// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// E_ACCESSDENIED
/// Destination is write-protected.
///
/// -
/// E_OUTOFMEMORY
/// Destination cannot contain the text to be pasted.
///
///
///
/// For more information, seeITextRange::Copy.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-paste HRESULT Paste( VARIANT *pVar, long Format );
void Paste([In] object pVar, int Format);
/// Determines if a data object can be pasted, using a specified format, into the current range.
///
/// Type: VARIANT*
/// The IDataObject to be pasted. However, the Clipboard contents are checked for pasting if any of the following are true:
///
/// -
/// pVar is null
///
/// -
/// pVar->punkVal is null
///
/// -
/// pVar->vt is not VT_UNKNOWN
///
/// -
/// pVar->punkVal does not return an IDataObject object when queried for one
///
///
///
///
/// Type: long
///
/// Clipboard format that is used. Zero represents the best format, which usually is RTF, but CF_UNICODETEXT and other formats
/// are also possible. The default value is zero.
///
///
///
/// Type: long*
///
/// A tomBool value that is tomTrue only if the data object identified by pVar can be pasted, using the specified
/// format, into the range. This parameter can null.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canpaste HRESULT CanPaste( VARIANT *pVar, long Format,
// long *pValue );
tomConstants CanPaste([In] object pVar, int Format);
/// Determines whether the specified range can be edited.
///
/// Type: long*
///
/// A tomBool value indicating whether the range can be edited. It is tomTrue only if the specified range can be edited. The
/// pointer can be null.
///
///
/// The range cannot be edited if any part of it is protected or if the document is read-only.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canedit HRESULT CanEdit( [retval] long *pValue );
tomConstants CanEdit();
/// Changes the case of letters in this range according to the Type parameter.
///
/// Type: long
/// Type of case change. The default value is tomLower.
///
///
/// Value
/// Meaning
///
/// -
/// tomLowerCase 0
/// Sets all text to lowercase.
///
/// -
/// tomUpperCase 1
/// Sets all text to lowercase.
///
/// -
/// tomTitleCase 2
/// Capitalizes the first letter of each word.
///
/// -
/// tomSentenceCase 4
/// Capitalizes the first letter of each sentence.
///
/// -
/// tomToggleCase 5
/// Toggles the case of each letter.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-changecase HRESULT ChangeCase( [in] long Type );
void ChangeCase(tomConstants Type);
///
/// Retrieves screen coordinates for the start or end character position in the text range, along with the intra-line position.
///
///
/// Type: long
///
/// Flag that indicates the position to retrieve. This parameter can include one value from each of the following tables. The default
/// value is tomStart + TA_BASELINE + TA_LEFT.
///
/// tomAllowOffClient
/// tomClientCoord
/// tomObjectArg
/// tomTransform
/// Use one of the following values to indicate the start or end of the range.
/// tomStart
/// tomEnd
/// Use one of the following values to indicate the vertical position.
///
///
/// TA_TOP
/// Top edge of the bounding rectangle.
///
/// -
/// TA_BASELINE
/// Base line of the text.
///
/// -
/// TA_BOTTOM
/// Bottom edge of the bounding rectangle.
///
///
/// Use one of the following values to indicate the horizontal position.
///
///
/// TA_LEFT
/// Left edge of the bounding rectangle.
///
/// -
/// TA_CENTER
/// Center of the bounding rectangle.
///
/// -
/// TA_RIGHT
/// Right edge of the bounding rectangle.
///
///
///
///
/// Type: long*
/// The x-coordinate.
///
///
/// Type: long*
/// The y-coordinate.
///
///
/// The ITextRange::GetPoint method gives ITextRange the ability to emulate UI-pointer commands; it is also handy for
/// accessibility purposes.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpoint HRESULT GetPoint( long Type, long *px, long *py );
void GetPoint(int Type, out int px, out int py);
///
/// Changes the range based on a specified point at or up through (depending on Extend) the point ( x, y)
/// aligned according to Type.
///
///
/// Type: long
/// Horizontal coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// Vertical coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// The end to move to the specified point. It can be one of the following.
///
///
/// tomStart
/// Move the start of range.
///
/// -
/// tomEnd
/// Move the end of range.
///
///
///
///
/// Type: long
///
/// How to set the endpoints of the range. If Extend is zero (the default), the range is an insertion point at the specified
/// point (or at the nearest point with selectable text). If Extend is 1, the end specified by Type is moved to the
/// point and the other end is left alone.
///
///
///
/// An application can use the specified point in the WindowFromPoint function to get the handle of the window, which usually can be
/// used to find the client-rectangle coordinates (although a notable exception is with Windowless Controls).
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpoint HRESULT SetPoint( [in] long x, [in] long y,
// [in] long Type, [in] long Extend );
void SetPoint(int x, int y, tomConstants Type, int Extend);
/// Scrolls the specified range into view.
///
/// Type: long
/// Flag specifying the end to scroll into view. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomEnd
/// Scrolls the end character position to appear on the bottom line.
///
/// -
/// tomStart
/// Scrolls the start character position to appear on the top line. (Default value).
///
/// -
/// tomNoUpScroll
///
///
/// -
/// tomNoVpScroll
///
///
///
///
///
/// Type: HRESULT
///
/// The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns S_FALSE.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-scrollintoview HRESULT ScrollIntoView( long Value );
[PreserveSig]
HRESULT ScrollIntoView(tomConstants Value);
///
/// Retrieves a pointer to the embedded object at the start of the specified range, that is, at cpFirst. The range must either
/// be an insertion point or it must select only the embedded object.
///
///
/// Type: IUnknown**
/// The pointer to the object.
///
///
/// If the start of this range does not have an embedded object or if the range selects more than a single object, ppObject is
/// set equal to NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getembeddedobject HRESULT GetEmbeddedObject( IUnknown
// **ppObject );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetEmbeddedObject();
}
///
/// The ITextRange2 interface is derived from ITextRange, and its objects are powerful editing and data-binding tools that enable
/// a program to select text in a story and then examine or change that text.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextrange2
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextRange2")]
[ComImport, Guid("C241F5E2-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextRange2 : ITextSelection
{
/// Gets the plain text in this range. The Text property is the default property of the ITextRange interface.
///
/// Type: BSTR*
/// The text.
///
///
///
/// The ITextRange::GetText method returns the plain text in the range. The Text property is the default property for
/// ITextRange; this is, it is automatically invoked for a range, as in the following Microsoft Visual Basic for Applications (VBA) example.
///
///
/// Some of the examples below use this fact. The ITextRange::SetText method substitutes bstr for the range text. For
/// processing a single character, the Char property is more efficient than the Text property and does not require creating a single
/// character range for storing a character. If the range is degenerate, the Text property lets you insert text easily. You can also
/// delete the text in a range, as shown in the following VBA examples.
///
///
/// You can use the Text property to copy plain text from one place to another, simply by setting one range equal to another.
/// (This is quite different from the Duplicate property; for more information, see ITextRange::GetDuplicate). The following
/// Microsoft Visual Basic example statement sets the text in the range1 to that in range2.
///
///
/// The ranges can be in different stories or even in different applications. However, they do imply copying the text first into a
/// BSTR and then from that string to the target location. For large amounts of text, the ITextRange::Copy and
/// ITextRange::Paste methods can be faster, since they can perform the copy directly from source to target and with any format
/// supported by the source and target.
///
///
/// The text returned by the Text property is given in Unicode. The end-of-paragraph mark may be given by 0x2029 (the Unicode
/// Paragraph Separator), or by carriage return/line feed (CR/LF) (0xd, 0xa), or by a carriage return alone, depending on the
/// original file. Microsoft Word uses a carriage return alone, unless it reads another choice in from a file, the clipboard, or an
/// IDataObject. The placeholder for an embedded object is given by the special character, WCH_EMBEDDING, which has the
/// Unicode value 0xFFFC.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-gettext HRESULT GetText( BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
new string GetText();
/// Sets the text in this range.
///
/// Type: BSTR
/// Text that replaces the current text in this range. If null, the current text is deleted.
///
///
///
/// ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with
/// the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed
/// the text in. For UI selection behavior, see TypeText.
///
///
/// If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the
/// ITextRange::SetText method (unless some other range has changed that text in between the calls).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-settext HRESULT SetText( [in] BSTR bstr );
new void SetText([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Gets the character at the start position of the range.
///
/// Type: long*
/// The start character position of the range.
///
///
/// The following Microsoft Visual Basic example sets ch equal to the character at the start of the range.
///
/// Similarly, ITextRange::SetChar overwrites the character at the start of the range with the specified character. The characters
/// retrieved and set by these methods are LONG variables, which hide the way that they are stored in the backing store (as
/// bytes, words, variable-length, and so forth), and they do not require using a BSTR.
///
/// The Char property, which can do most things that a characters collection can, has two big advantages:
///
/// -
/// It can reference any character in the parent story instead of being limited to the parent range.
///
/// -
/// It is significantly faster, since LONG s are involved instead of range objects.
///
///
/// Accordingly, the Text Object Model (TOM) does not support a characters collection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getchar HRESULT GetChar( long *pChar );
new int GetChar();
/// Sets the character at the starting position of the range.
///
/// Type: long
/// New value for character at the starting position.
///
///
///
/// ITextRange::SetChar lets you specify the precise character code to use. However, string literals with similar looking
/// glyphs can be misleading.
///
///
/// The characters set by this method are LONG instead of a BSTR. This hides the way that they are stored in the
/// backing store, (as bytes, words, variable-length, and so forth).
///
///
/// Frequently on systems that do not have automatic word-wrapping, documents have hard carriage returns inserted just for line
/// breaks. The following code shows a simple, but not perfect, way to convert such hard carriage returns back to blanks for the
/// story that is associated with the range r.
///
/// Alternatively, you could use the following inside the IF loop.
///
/// This approach enables you to wrap the text to other widths. However, the algorithm isn't perfect: it assumes that a hard carriage
/// return that is followed by anything other than white space (blank, tab, line feed, carriage return, and so forth) should be
/// replaced by a blank. The algorithm also assumes that the carriage return character is a single character like carriage return or
/// the Unicode end-of-paragraph (EOP) 0x2029 character. And, the combination carriage return and line feed isn't matched and would
/// require writing and executing more code (or use ). Another caution is that there are other cases, such as mixed code and
/// documentation, where the algorithm does not work correctly.
///
///
/// However, ITextRange::SetChar is more efficient than a replace operation that is accomplished by a delete followed by an
/// insertion. Thus, rewriting the code without using ITextRange::SetChar would probably be much slower.
///
///
/// The Char property, which can do most things that a characters collection can, has two big advantages: it can reference any
/// character in the parent story instead of being limited to the parent range, and it's significantly faster, since LONG s
/// rather than range objects are involved. Because of these advantages, the Text Object Model (TOM) does not support a characters collection.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setchar HRESULT SetChar( long Char );
new void SetChar(int Char);
/// Gets a duplicate of this range object.
///
/// Type: ITextRange**
/// The duplicate of the range.
///
///
///
/// To create an insertion point in order to traverse a range, first duplicate the range and then collapse the duplicate at its start
/// character position. Note, a range is characterized by start and end character positions, and the story it belongs to.
///
///
/// Even if the range is actually an ITextSelection, the duplicate returned is an ITextRange. For an example, see the
/// ITextRange::FindText method.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getduplicate HRESULT GetDuplicate( ITextRange **ppRange );
new ITextRange GetDuplicate();
/// Gets an ITextRange object with the specified range's formatted text.
///
/// Type: ITextRange**
/// The ITextRange object with the formatted text.
///
///
///
/// This method, which amounts to an alias for the ITextRange::GetDuplicate method, is included to be Microsoft Visual Basic for
/// Applications (VBA)-friendly. The method returns the formatted text in a range. If the ITextRange does not belong to the same Text
/// Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be
/// used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in a range2, by the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getformattedtext HRESULT GetFormattedText( ITextRange
// **ppRange );
new ITextRange GetFormattedText();
/// Sets the formatted text of this range text to the formatted text of the specified range.
///
/// Type: ITextRange*
/// The formatted text to replace this range's text.
///
///
///
/// If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by the IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to
/// reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in range2 with the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setformattedtext HRESULT SetFormattedText( [in]
// ITextRange *pRange );
new void SetFormattedText([In, Optional] ITextRange? pRange);
/// Gets the start character position of the range.
///
/// Type: long*
/// The start character position.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstart HRESULT GetStart( long *pcpFirst );
new int GetStart();
/// Sets the character position for the start of this range.
///
/// Type: long
/// The new character position for the start of the range.
///
///
///
/// Note that if cpFirst is greater than the range's end position, this method sets the end position equal to cpFirst,
/// making the range an insertion point. If this range is the selection, the start position becomes the active end and is scrolled
/// into view if the display isn't frozen.
///
///
/// ITextRange::SetEnd sets the range's end position, and ITextRange::SetRange sets both range ends simultaneously. The following
/// example shows how to convert a nondegenerate range into a degenerate one (insertion point).
///
/// Similarly, converts the range into an insertion point at the end position.
/// The following example adds 1 to the end position, if it is not at the end of the story.
/// This also makes the end position the active end of the range, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setstart HRESULT SetStart( [in] long cpFirst );
new void SetStart(int cpFirst);
/// Gets the end character position of the range.
///
/// Type: long*
/// The end character position.
///
///
///
/// Although a pointer to a range remains valid when the text is edited, this is not the case for the character position. A character
/// position is volatile; that is, it becomes invalid as soon as text is inserted or deleted before the character position. Be
/// careful about using methods that return character position values, especially if the values are to be stored for any duration.
///
/// This method is similar to the ITextRange::GetStart method which gets the start character position of the range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getend HRESULT GetEnd( long *pcpLim );
new int GetEnd();
/// Sets the end position of the range.
///
/// Type: long
/// The new end position.
///
///
///
/// If the new end position is less than the start position, this method also sets the start position to cp; that is, the
/// range becomes an insertion point.
///
///
/// If this range is actually the selection, the end position becomes the active end and, if the display is not frozen, it is
/// scrolled into view.
///
///
/// ITextRange::SetStart sets the range's start position and ITextRange::SetRange sets both range ends simultaneously. To convert a
/// nondegenerate range, r, into a degenerate one (insertion point) at the start position, use
///
/// Similarly, r.Start = r.End converts r into an insertion point at the end position.
/// To add 1 to the end position, unless it is at the end of the story, use:
/// This also makes end position the active end, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setend HRESULT SetEnd( long cpLim );
new void SetEnd(int cpLim);
/// Gets an ITextFont object with the character attributes of the specified range.
///
/// Type: ITextFont**
/// The pointer to an ITextFont object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextFont for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getfont HRESULT GetFont( ITextFont **ppFont );
new ITextFont GetFont();
/// Sets this range's character attributes to those of the specified ITextFont object.
///
/// Type: ITextFont*
/// A font object with the desired character format.
///
///
/// For occasional format changes, use the ITextRange::SetFont method. However, to make a number of character formatting
/// changes, it is more efficient to use a font duplicate. This is because every time you execute a statement like range.font.bold
/// = tomTrue, a font object is allocated and freed. However, a font duplicate can be allocated once and used many times.
/// Furthermore, you can save the font duplicate, reset it to the default or undefined states with the Reset method, and give it
/// values as needed for your rich-text processing. For sample code that shows how to use font duplicates, see Using a Font Duplicate.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setfont HRESULT SetFont( [in] ITextFont *pFont );
new void SetFont([In, Optional] ITextFont? pFont);
/// Gets an ITextPara object with the paragraph attributes of the specified range.
///
/// Type: ITextPara**
/// The pointer to the ITextPara object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextPara for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpara HRESULT GetPara( ITextPara **ppPara );
new ITextPara GetPara();
/// Sets the paragraph attributes of this range to those of the specified ITextPara object.
///
/// Type: ITextPara*
/// The paragraph object with the desired paragraph format.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpara HRESULT SetPara( [in] ITextPara *pPara );
new void SetPara([In, Optional] ITextPara? pPara);
/// Gets the count of characters in the range's story.
///
/// Type: long*
/// The count of characters in the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorylength HRESULT GetStoryLength( long *pCount );
new int GetStoryLength();
/// Get the type of the range's story.
///
/// Type: long*
/// The type of the range's story. The pValue value can be one of the following values.
///
///
/// Story type
/// Value
/// Story type
/// Value
///
/// -
/// tomUnknownStory
/// 0
/// tomEvenPagesHeaderStory
/// 6
///
/// -
/// tomMainTextStory
/// 1
/// tomPrimaryHeaderStory
/// 7
///
/// -
/// tomFootnotesStory
/// 2
/// tomEvenPagesFooterStory
/// 8
///
/// -
/// tomEndnotesStory
/// 3
/// tomPrimaryFooterStory
/// 9
///
/// -
/// tomCommentsStory
/// 4
/// tomFirstPageHeaderStory
/// 10
///
/// -
/// tomTextFrameStory
/// 5
/// tomFirstPageFooterStory
/// 11
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorytype HRESULT GetStoryType( long *pValue );
new tomConstants GetStoryType();
/// Collapses the specified text range into a degenerate point at either the beginning or end of the range.
///
/// Type: long
/// Flag specifying the end to collapse at. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomStart or tomTrue
/// Range is collapsed to the start of the range. This is the default.
///
/// -
/// tomEnd or tomFalse
/// Range is collapsed to the end of the range.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-collapse HRESULT Collapse( [in] long bStart );
new void Collapse(tomConstants bStart);
/// Expands this range so that any partial units it contains are completely contained.
///
/// Type: long
///
/// Unit to include, if it is partially within the range. The default value is . For a list of the other Unit values, see the
/// discussion under ITextRange.
///
///
///
/// Type: long*
/// The count of characters added to the range. The value can be null.
///
///
/// For example, if an insertion point is at the beginning, the end, or within a word, ITextRange::Expand expands the range to
/// include that word. If the range already includes one word and part of another, ITextRange::Expand expands the range to
/// include both words. ITextRange::Expand expands the range to include the visible portion of the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-expand HRESULT Expand( long Unit, long *pDelta );
new int Expand(int Unit);
///
/// Retrieves the story index of the Unit parameter at the specified range Start character position. The first Unit in
/// a story has an index value of 1. The index of a Unit is the same for all character positions from that immediately
/// preceding the Unit up to the last character in the Unit.
///
///
/// Type: long
/// Unit that is indexed. For a list of possible Unit values, see the discussion under ITextRange.
///
///
/// Type: long*
/// The index value. The value is zero if Unit does not exist.
///
///
///
/// The ITextRange::GetIndex method retrieves the story index of a word, line, sentence, paragraph, and so forth, at the range
/// Start. Unit specifies which kind of entity to index, such as words ( tomWord), lines ( tomLine), sentences (
/// tomSentence), or paragraphs ( tomParagraph). For example, ITextRange::GetIndex sets pIndex equal to
/// the line number of the first line in the range. For a range at the end of the story, ITextRange::GetIndex, returns the
/// number of Unit s in the story. Thus, you can get the number of words, lines, objects, and so forth, in a story.
///
///
/// The index value returned by the ITextRange::GetIndex method is not valid if the text is subsequently edited. Thus, users
/// should be careful about using methods that return index values, especially if the values are to be stored for any duration. This
/// is in contrast to a pointer to a range, which does remain valid when the text is edited.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getindex HRESULT GetIndex( long Unit, long *pIndex );
new int GetIndex(int Unit);
/// Changes this range to the specified unit of the story.
///
/// Type: long
/// Unit used to index the range. For a list of unit values, see ITextRange.
///
///
/// Type: long
///
/// Index for the Unit. This range is relocated to the Unit that has this index number. If positive, the numbering of
/// Unit s begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story
/// and proceeds backward. The start of the story corresponds to an Index of 1 for all units that exist, and the last unit in
/// the story corresponds to an Index of -1.
///
///
///
/// Type: long
///
/// Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start
/// position of the specified Unit. If nonzero, the range is set to the entire Unit.
///
///
///
/// This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, converts a
/// range to an insertion point at the start of the tenth line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setindex HRESULT SetIndex( [in] long Unit, [in] long
// Index, [in] long Extend );
new void SetIndex(int Unit, int Index, int Extend);
/// Adjusts the range endpoints to the specified values.
///
/// Type: long
/// The character position for the anchor end of the range.
///
///
/// Type: long
/// The character position for the active end of the range.
///
///
///
/// This method sets the range's start position to , and the end position to . If the range is a nondegenerate selection,
/// cpAnchor is the active end, and cpAnchor is the anchor end. If the range is a degenerate selection, the selection
/// is displayed at the start of the line, rather than at the end of the previous line.
///
/// This method removes any other subranges this range may have. To preserve the current subranges, use ITextRange2::SetActiveSubrange.
/// If the text range is a selection, you can set the attributes of the selection by using the ITextSelection::SetFlags method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setrange HRESULT SetRange( long cpAnchor, long cpActive );
new void SetRange(int cpAnchor, int cpActive);
/// Determines whether this range is within or at the same text as a specified range.
///
/// Type: ITextRange*
/// Text that is compared to the current range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The method returns pB is tomTrue only if the range is in or at the
/// same text as pRange.
///
///
///
///
/// For range2 to be contained in range1, both ranges must be in the same story, and the limits of range2 must satisfy either of the
/// following statements.
///
///
/// -
///
/// The start and end character positions of range1 are the same as range2. That is, both ranges are degenerate and have identical
/// insertion points.
///
///
/// -
/// Range2 is a nondegenerate range with start and end character positions at or within those of range1.
///
///
/// The following example shows how to walk one range with another.
///
/// When the ITextRange::FindText, ITextRange::MoveWhile, and ITextRange::MoveUntil method families are used, you can use one range
/// to walk another by specifying the appropriate limit count of characters (for an example, see the Remarks in ITextRange::Find).
///
///
/// ITextRange::IsEqual is a special case of ITextRange::InRange that returns pBtomTrue if the pRange has
/// the same start and end character positions and belongs to the same story.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-inrange HRESULT InRange( ITextRange *pRange, long
// *pValue );
new tomConstants InRange([In, Optional] ITextRange? pRange);
/// Determines whether this range's story is the same as a specified range's story.
///
/// Type: ITextRange*
/// The ITextRange object whose story is compared to this range's story.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range's story is the same
/// as that of the pRange; otherwise it receives tomFalse.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-instory HRESULT InStory( ITextRange *pRange, long
// *pValue );
new tomConstants InStory([In, Optional] ITextRange? pRange);
/// Determines whether this range has the same character positions and story as those of a specified range.
///
/// Type: ITextRange*
/// The ITextRange object that is compared to this range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range points at the same
/// text (has the same start and end character positions and story) as pRange; otherwise it returns tomFalse.
///
///
///
/// The ITextRange::IsEqual method returns tomTrue only if the range points at the same text as pRange. See
/// Finding Rich Text for code that compares two different pieces of text to see if they contain the same plain text and the same
/// character formatting.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-isequal HRESULT IsEqual( ITextRange *pRange, long
// *pValue );
new tomConstants IsEqual([In, Optional] ITextRange? pRange);
/// Sets the start and end positions, and story values of the active selection, to those of this range.
///
/// The active end of the new selection is at the end position.
/// The caret for an ambiguous character position is displayed at the beginning of the line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-select HRESULT Select();
new void Select();
/// Moves the range ends to the start of the first overlapping Unit in the range.
///
/// Type: long
/// Unit to use in the move operation. For a list of Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// How to move the ends of the range. It can be one of the following values.
///
///
/// 0 (or tomMove)
/// Collapses a nondegenerate range to the start position by moving the insertion point. This is the default.
///
/// -
/// 1 (or tomExtend)
/// Moves the start position to the beginning of the overlapping Unit. Does not move the end position.
///
///
///
///
/// Type: long*
///
/// Pointer to a variable that receives the number of characters that the start position is moved. It can be null. On return,
/// pDelta is the signed number of characters that the insertion point or start position is moved. This value is always less
/// than or equal to zero, because the motion is always toward the beginning of the story.
///
///
///
///
/// If the range is an insertion point on a boundary between Unit s, ITextRange::StartOf does not change the start position.
///
///
/// The ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend
/// from the active end, whereas ITextRange::StartOf extends from the start position and ITextRange::EndOf extends from
/// the end position.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-startof HRESULT StartOf( long Unit, long Extend, long
// *pDelta );
new tomConstants StartOf(tomConstants Unit, tomConstants Extend);
/// Moves this range's ends to the end of the last overlapping Unit in the range.
///
/// Type: long
/// Unit to use. Default value: tomWord. For a list of the other Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// Indicator of how the shifting of the range ends is to proceed. It can be one of the following.
///
///
/// 0 or tomMove
///
/// Collapses a nondegenerate range to the End of the original range by moving the insertion point. This is the default.
///
///
/// -
/// 1 (or tomExtend)
/// Moves End to the end of the overlapping Unit. Does not move Start.
///
///
///
///
/// Type: long*
///
/// The count of characters that End is moved past. The value of the pointer can be null. On return, the value of pDelta is
/// the number of characters the insertion point or End is moved plus 1 if a collapse occurs to the entry End. If the range
/// includes the final CR (carriage return) (at the end of the story) and Extend = tomMove, then pDelta is set to â1,
/// to indicate that the collapse occurred before the end of the range (because an insertion point cannot exist beyond the
/// final CR).
///
///
///
/// For comparison, the ITextRange::StartOf method moves the range ends to the beginning of the first overlapping Unit in the
/// range. Note, the ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in
/// that the latter extend from the active end, whereas ITextRange::StartOf extends from Start and ITextRange::EndOf
/// extends from End. If the range is an insertion point on a boundary between Unit s, ITextRange::EndOf does not
/// change End. In particular, calling ITextRange::EndOf ( tomCharacter, *, *) does not change End except for an
/// insertion point at the beginning of a story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-endof HRESULT EndOf( long Unit, long Extend, long
// *pDelta );
new tomConstants EndOf(tomConstants Unit, tomConstants Extend);
///
/// Moves the insertion point forward or backward a specified number of units. If the range is nondegenerate, the range is collapsed
/// to an insertion point at either end, depending on Count, and then is moved.
///
///
/// Type: long
/// Unit to use. The default value is tomCharacter. For information on other values, see the discussion in ITextRange.
///
///
/// Type: long
///
/// Number of Unit s to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward
/// the end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero,
/// the range is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of Unit s the insertion point moves past. The pointer can be NULL. For more information, see the
/// Remarks section.
///
///
///
///
/// If the range is degenerate (an insertion point), this method tries to move the insertion point Count  Unit s.
///
///
/// If the range is nondegenerate and Count is greater than zero, this method collapses the range at the end character
/// position, moves the resulting insertion point forward to a Unit boundary (if it is not already at one), and then tries to
/// move Count - 1 Unit s forward. If the range is nondegenerate and Count is less than zero, this method
/// collapses the range at the start character position, moves the resulting insertion point backward to a Unit boundary (if
/// it isn't already at one), and then tries to move | Count| - 1 Unit s backward. Thus, in both cases, collapsing a
/// nondegenerate range to an insertion point, whether moving to the start or end of the Unit following the collapse, counts
/// as a Unit.
///
///
/// The ITextRange::Move method returns pDelta = number of Unit s actually moved. This method never moves the
/// insertion point beyond the story of this range. If CountUnit s would move the insertion point before the beginning
/// of the story, it is moved to the story beginning and pDelta is set accordingly. Similarly, if Count  Unit s
/// would move it beyond the end of the story, it is moved to the story end.
///
///
/// The ITextRange::Move method works similarly to the UI-oriented MoveLeft and MoveRight methods, except that the direction
/// of motion is logical rather than geometrical. That is, with ITextRange::Move the direction is either toward the end or
/// toward the start of the story. Depending on the language, moving toward the end of the story could be moving to the left or to
/// the right. To get a feel for Count, press Ctrl+Right Arrow in a Microsoft Word document for a variety of selections. In
/// left-to-right text, this keystroke behaves the same as , and . Count corresponds to the number of times you press
/// Ctrl+Right Arrow.
///
///
/// For example, if you press Ctrl+Right Arrow for the selections shown in both of the following figures, you end up with an
/// insertion point at character position 8, since this command collapses the selections at their end character positions (7 and 8,
/// respectively) and moves to the next tomWord boundary.
///
///
/// The first selection does not include the blank space at character position 7, so Ctrl+Right Arrow moves past the space to the
/// tomWord boundary at character position 8. The end character position is already at a tomWord boundary for the
/// second selection, so Ctrl+Right Arrow just collapses the selection at that boundary. Similarly, Ctrl+Left Arrow, which for this
/// text acts like , and collapses the first selection at character position 5, which is already at a tomWord boundary, so no
/// more motion occurs. But Ctrl+Left Arrow collapses the second selection at character position 4 and then moves to zero, since
/// that's the next tomWord boundary in the direction of motion.
///
///
/// The return argument, pDelta, is set equal to the number of Unit s that the insertion point is moved including one
/// Unit for collapsing a nondegenerate range and moving it to a Unit boundary. So, if no motion and no collapse occur,
/// as when the range is an insertion point at the end of the story, pDelta is set equal to zero. This approach is useful for
/// controlling program loops that process a whole story.
///
///
/// In both of the cases mentioned above, calling sets pDelta equal to 1 because the ranges were collapsed. Similarly, calling
/// sets pDelta equal to -1 for both cases. Collapsing, with or without moving part of a Unit to a Unit
/// boundary, counts as a Unit moved.
///
///
/// The direction of motion refers to the logical character ordering in the plain-text backing store. This approach avoids the
/// problems of geometrical ordering, such as left versus right and up versus down, in international software. Such geometrical
/// methods are still needed in the edit engine, of course, since keyboards have arrow keys to invoke them. If the range is really an
/// ITextSelection object, then methods like MoveLeft and MoveRight can be used.
///
///
/// If Unit specifies characters ( tomCharacter), the Text Object Model (TOM) uses the Unicode character set. To
/// convert between Unicode and multibyte character sets the MultiByteToWideChar and WideCharToMultiByte functions provide easy ways
/// to convert between Unicode and multibyte character sets on import and export, respectively. For more information, see Open. In
/// this connection, the use of a carriage return/line feed (CR/LF) to separate paragraphs is as problematic as double-byte character
/// set (DBCS). The ITextSelection UI methods back up over a CR/LF as if it were a single character, but the ITextRange::Move
/// methods count CR/LFs as two characters. It's clearly better to use a single character as a paragraph separator, which in TOM is
/// represented by a character return, although the Unicode paragraph separator character, 0x2029, is accepted. In general, TOM
/// engines should support CR/LF, carriage return (CR), line feed (LF), vertical tab, form feed, and 0x2029. Microsoft Rich Edit 2.0
/// also supports CR/CR/LF for backward compatibility.
///
///
/// See also the ITextRange::MoveStart and ITextRange::MoveEnd methods, which move the range Start or End position Count Â
/// Unit s, respectively.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-move HRESULT Move( long Unit, long Count, long *pDelta );
new tomConstants Move(tomConstants Unit, int Count);
/// Moves the start position of the range the specified number of units in the specified direction.
///
/// Type: long
///
/// Unit used in the move. The default value is tomCharacter. For a list of the other Unit values, see the discussion
/// under ITextRange.
///
///
///
/// Type: long
///
/// Number of units to move. The default value is 1. If Count is greater than zero, motion is forwardâtoward the end of the
/// storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the start
/// position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end is moved. The value can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStart is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestart HRESULT MoveStart( long Unit, long Count, long
// *pDelta );
new tomConstants MoveStart(tomConstants Unit, int Count);
/// Moves the end position of the range.
///
/// Type: long
///
/// The units by which to move the end of the range. The default value is tomCharacter. For a list of the other unit values,
/// see ITextRange.
///
///
///
/// Type: long
///
/// The number of units to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward the
/// end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the
/// end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end position of the range is moved past. The value can be null.
///
///
///
/// If the new end position precedes the old start position, the new start position is set equal to the new end position; that is, it
/// becomes a degenerate range or an insertion point.
///
///
/// The motion described by ITextRange::MoveEnd is logical rather than geometric. That is, motion is toward the end or toward
/// the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveend HRESULT MoveEnd( long Unit, long Count, long
// *pDelta );
new tomConstants MoveEnd(tomConstants Unit, int Count);
///
/// Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the
/// number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching
/// character is found.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search starts at the start position and goes backward â toward the beginning of the story.
/// If Count is greater than zero, the search starts at the end position and goes forward â toward the end of the story.
///
///
///
/// Type: long*
/// The actual count of characters end is moved. This parameter can be null.
///
///
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the
/// start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveWhile method is similar to ITextRange::MoveUntil, but MoveWhile searches as long as it finds
/// members of the set specified by Cset, and there is no additional increment to the value pDelta.
///
///
/// The ITextRange::MoveStartWhile and ITextRange::MoveEndWhile methods move the start and end, respectively, just past all
/// contiguous characters that are found in set of characters specified by the Cset parameter.
///
///
/// The VARIANT type is primarily intended to be used with IDispatch scenarios like Microsoft Visual Basic for
/// Applications (VBA), but it can be readily used from C or C++ as well. The following C++ code illustrates how to initialize and
/// use the VARIANT argument for matching a span of digits in the range r.
///
/// Alternatively, an explicit string could be used, as in the following sample.
///
/// The following VBA example code matches the body of the next Standard Generalized Markup Language (SGML) entry in a range, r. SGML
/// entries start with < > and end with </ >.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movewhile HRESULT MoveWhile( VARIANT *Cset, long Count,
// long *pDelta );
new int MoveWhile([In] object Cset, int Count);
///
/// Moves the start position of the range either Count characters, or just past all contiguous characters that are found in
/// the set of characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
/// The actual count of characters that the start position is moved. This parameter can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartwhile HRESULT MoveStartWhile( VARIANT *Cset,
// long Count, long *pDelta );
new int MoveStartWhile([In] object Cset, int Count);
///
/// Moves the end of the range either Count characters or just past all contiguous characters that are found in the set of
/// characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of characters that the end is moved. The value can be null.
///
///
/// If the new end precedes the old start, the new start is set equal to the new end.
///
/// The motion described by ITextRange::MoveEndWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveendwhile HRESULT MoveEndWhile( VARIANT *Cset, long
// Count, long *pDelta );
new int MoveEndWhile([In] object Cset, int Count);
///
/// Searches up to Count characters for the first character in the set of characters specified by Cset. If a character
/// is found, the range is collapsed to that point. The start of the search and the direction are also specified by Count.
///
///
/// Type: VARIANT*
///
/// The character set used in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search is backward starting at the start position. If Count is greater than zero, the
/// search is forward starting at the end.
///
///
///
/// Type: long*
///
/// The number of characters the insertion point is moved, plus 1 for a match if Count is greater than zero, and â1 for a
/// match if Count less than zero. The pointer can be null.
///
///
///
/// If no character is matched, the range is unchanged.
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveStartUntil and ITextRange::MoveEndUntil methods move the start and end, respectively, until it finds the
/// first character that is also in the set specified by the Cset parameter.
///
///
/// The ITextRange::MoveUntil method is similar to ITextRange::MoveWhile, but there are two differences. First,
/// MoveUntil moves an insertion point until it finds the first character that belongs to the character set specified
/// by Cset. Second, in MoveUntil the character matched counts as an additional character in the value returned in
/// pDelta. This lets you know that the character at one end of the range or the other belongs to the Cset even though
/// the insertion point stays at one of the range ends.
///
///
/// For example, suppose the range, r, is an insertion point. To see if the character at r (that is, given by r.GetChar()) is in
/// Cset, call
///
///
/// If the character is in Cset, the return value is 1 and the insertion point does not move. Similarly, to see if the
/// character preceding r is in Cset, call
///
/// If the character is in Cset, the return value is â1.
///
/// The following Microsoft Visual Basic for Applications (VBA) subroutine prints all numbers in the story identified by the range, r.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveuntil HRESULT MoveUntil( VARIANT *Cset, long Count,
// long *pDelta );
new int MoveUntil([In] object Cset, int Count);
///
/// Moves the start position of the range the position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the start position.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters the start of the range is moved, plus 1 for a match if Count is greater than zero, and
/// â1 for a match if Count is less than zero. The value can be null.
///
///
///
/// If no character from Cset is found within Count positions of the start position, the range is left unchanged.
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartuntil HRESULT MoveStartUntil( VARIANT *Cset,
// long Count, long *pDelta );
new int MoveStartUntil([In] object Cset, int Count);
///
/// Moves the range's end to the character position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the range's end.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters that the range end is moved, plus 1 for a match if Count is greater than zero, and â1
/// for a match if Count is less than zero. The value can be null.
///
///
///
///
/// If no character from the set specified by Cset is found within Count positions of the range's end, the range is
/// left unchanged. If the new end precedes the old start, the new start is set equal to the new end.
///
///
/// The motion described by ITextRange::MoveEndUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveenduntil HRESULT MoveEndUntil( VARIANT *Cset, long
// Count, long *pDelta );
new int MoveEndUntil([In] object Cset, int Count);
///
/// Searches up to Count characters for the text given by bstr. The starting position and direction are also specified
/// by Count, and the matching criteria are given by Flags.
///
///
/// Type: BSTR
/// String to find.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Searches to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
///
/// Searches forward for n chars, starting from cpFirst. If the range itself matches bstr, another search is
/// attempted from cpFirst + 1.
///
///
/// -
/// n(less than 0)
///
/// Searches backward for n chars, starting from cpLim. If the range itself matches bstr, another search is
/// attempted from cpLim â 1.
///
///
/// -
/// 0 (degenerate range)
/// Search begins after the range.
///
/// -
/// 0 (nondegenerate range)
/// Search is limited to the range.
///
///
/// Â
///
/// In all cases, if a string is found, the range limits are changed to be those of the matched string and pLength is set
/// equal to the length of the string. If the string is not found, the range remains unchanged and pLength is set equal to zero.
///
///
///
/// Type: long
/// Flags governing comparisons. It can be 0 (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
///
///
/// The ITextRange::FindText method can also match special characters by using a caret (^) followed by a special letter. For a
/// list of special characters, see the Special list available in the Microsoft Word Find and Replace dialog box. For
/// example, matches the next paragraph mark. Note, can be used to represent the Clipboard contents in the string to be replaced.
/// Thus, using in the find string enables you to search for rich text. For more details, see the Word Help files.
///
///
/// As a comparison with the ITextRange::FindText method, the ITextRange::FindTextStart method searches forward or backward
/// from the range's Start cp, and the ITextRange::FindTextEnd method searches forward or backward from the range's End
/// cp. For more details, see the descriptions of these methods.
///
/// The following are several code snippets that show the ITextRange::FindText methods.
///
/// Example #1. The following Microsoft Visual Basic for Applications (VBA) program prints all the /* ... */ comments in a story
/// identified by the range r.
///
///
/// Instead of these comments being printed, they could be inserted into another edit instance and saved to a file, or they could be
/// inserted into separate cells in a table or spreadsheet.
///
/// To print all lines containing one or more occurrences of the word "laser", replace the loop by the following code:
///
/// Example #2. The following program prints a telephone list, given a story that contains an address list. The address list entries
/// are separated by two or more paragraph marks, and each entry has the following form.
///
/// Note the use of the character in the FindText string argument to locate a pair of consecutive paragraph marks.
/// Example #3. The following subroutine replaces all occurrences of the string, str1, in a range by str2:
///
/// Example #4. The following line of code inserts a blank before the first occurrence of a right parenthesis, "(", that follows an
/// occurrence of HRESULT.
///
///
/// To do this for all such occurrences, change the If into a While/Wend loop in the above line of code. This an example of a
/// FIND/REPLACE macro that cannot be run with Find and Replace dialog boxes.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtext HRESULT FindText( BSTR bstr, long Count, long
// Flags, long *pLength );
new int FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting at the range's Start cp ( cpFirst).
/// The search is subject to the comparison parameter, Flags. If the string is found, the Start cp is changed to the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged,
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// The string to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n(greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n(less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing the comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of the matched string.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextstart HRESULT FindTextStart( BSTR bstr, long
// Count, long Flags, long *pLength );
new int FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting from the range's End cp. The search is
/// subject to the comparison parameter, Flags. If the string is found, the End cp is changed to be the end of the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// String to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n (less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextend HRESULT FindTextEnd( BSTR bstr, long Count,
// long Flags, long *pLength );
new int FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
/// Mimics the DELETE and BACKSPACE keys, with and without the CTRL key depressed.
///
/// Type: long
/// Unit to use. Unit can be tomCharacter (the default value) or tomWord.
///
///
/// Type: long
///
/// Number of Unit s to delete. If Count= zero, it deletes the text in the range only. If Count is greater than
/// zero, ITextRange::Delete acts as if the DELETE key was pressed Count times. If Count is less than zero, it
/// acts as if the BACKSPACE key was pressed Count times. The default value is 1. For more information, see the Remarks.
///
///
///
/// Type: long*
///
/// The count of units deleted. It can be null. The pDelta parameter is set equal to the number of Unit s deleted.
/// Deleting the text in a nondegenerate range counts as one Unit.
///
///
///
///
/// If Count = zero, this method deletes the text in the range, that is, it deletes nothing if the range is only an insertion point.
///
///
/// If Count is not zero, and the range is an insertion point (that is, degenerate), | Count| (absolute value of
/// Count) Unit s are deleted in the logical direction given by the sign of Count, where a positive value is the
/// direction toward the end of the story, and a negative value is toward the start of the story.
///
///
/// If Count is not zero, and the range is nondegenerate (contains text), the text in the range is deleted (regardless of the
/// values of Unit and Count), thereby creating an insertion point. Then, | Count| - 1 Â Unit s are
/// deleted in the logical direction given by the sign of Count.
///
///
/// The text in the range can also be deleted by assigning a null string to the range (executing statement r = where r is the range).
/// However, ITextRange::Delete does not require allocating a BSTR.
///
///
/// Deleting the end-of-paragraph mark (CR) results in the special behavior of the Microsoft Word UI. Four cases are of particular interest:
///
///
/// -
///
/// If you delete just the CR but the paragraph includes text, then the CR is deleted, and the following paragraph gets the same
/// paragraph formatting as current one.
///
///
/// -
///
/// If you delete the CR as well as some, but not all, of the characters in the following paragraph, the characters left over from
/// the current paragraph get the paragraph formatting of the following paragraph.
///
///
/// -
/// If you select to the end of a paragraph, but not the whole paragraph, the CR is not deleted.
///
/// -
///
/// If you delete the whole paragraph (from the beginning through the CR), you delete the CR as well (unless it is the final CR in
/// the file).
///
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-delete HRESULT Delete( long Unit, long Count, long
// *pDelta );
new int Delete(tomConstants Unit, int Count);
/// Cuts the plain or rich text to a data object or to the Clipboard, depending on the pVar parameter.
///
/// Type: VARIANT*
///
/// The cut text. pVar->ppunkVal is the out parameter for an IDataObject object, provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-cut HRESULT Cut( VARIANT *pVar );
new void Cut(out object pVar);
/// Copies the text to a data object.
///
/// Type: VARIANT*
///
/// The copied text. pVar->ppunkVal is the out parameter for an IDataObject provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
///
///
/// The ITextRange::Cut, ITextRange::Copy, and ITextRange::Paste methods let you perform the usual Cut, Copy,
/// and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among
/// clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to
/// reference a text solution's own internal rich text formats.
///
///
/// To copy and replace plain text, you can use the ITextRange::GetText and ITextRange::SetText methods. To copy
/// formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the
/// ITextRange::GetFormattedText and ITextRange::SetFormattedText methods, as shown in the following Microsoft Visual Basic example:
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-copy HRESULT Copy( VARIANT *pVar );
new void Copy(out object pVar);
/// Pastes text from a specified data object.
///
/// Type: VARIANT*
/// The IDataObject to paste. However, the contents of the clipboard are used if any of the following are true.
/// pVar is null
/// pVar punkVal is null
/// pVar is not VT_UNKNOWN
/// pVar punkVal does not return an IDataObject when queried for one
///
///
/// Type: long
///
/// The clipboard format to use in the paste operation. Zero is best format, which usually is RTF, but CF_UNICODETEXT and
/// other formats are also possible. The default value is zero. For more information, see Clipboard Formats.
///
///
///
/// Type: HRESULT
///
/// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// E_ACCESSDENIED
/// Destination is write-protected.
///
/// -
/// E_OUTOFMEMORY
/// Destination cannot contain the text to be pasted.
///
///
///
/// For more information, seeITextRange::Copy.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-paste HRESULT Paste( VARIANT *pVar, long Format );
new void Paste([In] object pVar, int Format);
/// Determines if a data object can be pasted, using a specified format, into the current range.
///
/// Type: VARIANT*
/// The IDataObject to be pasted. However, the Clipboard contents are checked for pasting if any of the following are true:
///
/// -
/// pVar is null
///
/// -
/// pVar->punkVal is null
///
/// -
/// pVar->vt is not VT_UNKNOWN
///
/// -
/// pVar->punkVal does not return an IDataObject object when queried for one
///
///
///
///
/// Type: long
///
/// Clipboard format that is used. Zero represents the best format, which usually is RTF, but CF_UNICODETEXT and other formats
/// are also possible. The default value is zero.
///
///
///
/// Type: long*
///
/// A tomBool value that is tomTrue only if the data object identified by pVar can be pasted, using the specified
/// format, into the range. This parameter can null.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canpaste HRESULT CanPaste( VARIANT *pVar, long Format,
// long *pValue );
new tomConstants CanPaste([In] object pVar, int Format);
/// Determines whether the specified range can be edited.
///
/// Type: long*
///
/// A tomBool value indicating whether the range can be edited. It is tomTrue only if the specified range can be edited. The
/// pointer can be null.
///
///
/// The range cannot be edited if any part of it is protected or if the document is read-only.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canedit HRESULT CanEdit( [retval] long *pValue );
new tomConstants CanEdit();
/// Changes the case of letters in this range according to the Type parameter.
///
/// Type: long
/// Type of case change. The default value is tomLower.
///
///
/// Value
/// Meaning
///
/// -
/// tomLowerCase 0
/// Sets all text to lowercase.
///
/// -
/// tomUpperCase 1
/// Sets all text to lowercase.
///
/// -
/// tomTitleCase 2
/// Capitalizes the first letter of each word.
///
/// -
/// tomSentenceCase 4
/// Capitalizes the first letter of each sentence.
///
/// -
/// tomToggleCase 5
/// Toggles the case of each letter.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-changecase HRESULT ChangeCase( [in] long Type );
new void ChangeCase(tomConstants Type);
///
/// Retrieves screen coordinates for the start or end character position in the text range, along with the intra-line position.
///
///
/// Type: long
///
/// Flag that indicates the position to retrieve. This parameter can include one value from each of the following tables. The default
/// value is tomStart + TA_BASELINE + TA_LEFT.
///
/// tomAllowOffClient
/// tomClientCoord
/// tomObjectArg
/// tomTransform
/// Use one of the following values to indicate the start or end of the range.
/// tomStart
/// tomEnd
/// Use one of the following values to indicate the vertical position.
///
///
/// TA_TOP
/// Top edge of the bounding rectangle.
///
/// -
/// TA_BASELINE
/// Base line of the text.
///
/// -
/// TA_BOTTOM
/// Bottom edge of the bounding rectangle.
///
///
/// Use one of the following values to indicate the horizontal position.
///
///
/// TA_LEFT
/// Left edge of the bounding rectangle.
///
/// -
/// TA_CENTER
/// Center of the bounding rectangle.
///
/// -
/// TA_RIGHT
/// Right edge of the bounding rectangle.
///
///
///
///
/// Type: long*
/// The x-coordinate.
///
///
/// Type: long*
/// The y-coordinate.
///
///
/// The ITextRange::GetPoint method gives ITextRange the ability to emulate UI-pointer commands; it is also handy for
/// accessibility purposes.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpoint HRESULT GetPoint( long Type, long *px, long *py );
new void GetPoint(int Type, out int px, out int py);
///
/// Changes the range based on a specified point at or up through (depending on Extend) the point ( x, y)
/// aligned according to Type.
///
///
/// Type: long
/// Horizontal coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// Vertical coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// The end to move to the specified point. It can be one of the following.
///
///
/// tomStart
/// Move the start of range.
///
/// -
/// tomEnd
/// Move the end of range.
///
///
///
///
/// Type: long
///
/// How to set the endpoints of the range. If Extend is zero (the default), the range is an insertion point at the specified
/// point (or at the nearest point with selectable text). If Extend is 1, the end specified by Type is moved to the
/// point and the other end is left alone.
///
///
///
/// An application can use the specified point in the WindowFromPoint function to get the handle of the window, which usually can be
/// used to find the client-rectangle coordinates (although a notable exception is with Windowless Controls).
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpoint HRESULT SetPoint( [in] long x, [in] long y,
// [in] long Type, [in] long Extend );
new void SetPoint(int x, int y, tomConstants Type, int Extend);
/// Scrolls the specified range into view.
///
/// Type: long
/// Flag specifying the end to scroll into view. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomEnd
/// Scrolls the end character position to appear on the bottom line.
///
/// -
/// tomStart
/// Scrolls the start character position to appear on the top line. (Default value).
///
/// -
/// tomNoUpScroll
///
///
/// -
/// tomNoVpScroll
///
///
///
///
///
/// Type: HRESULT
///
/// The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns S_FALSE.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-scrollintoview HRESULT ScrollIntoView( long Value );
[PreserveSig]
new HRESULT ScrollIntoView(tomConstants Value);
///
/// Retrieves a pointer to the embedded object at the start of the specified range, that is, at cpFirst. The range must either
/// be an insertion point or it must select only the embedded object.
///
///
/// Type: IUnknown**
/// The pointer to the object.
///
///
/// If the start of this range does not have an embedded object or if the range selects more than a single object, ppObject is
/// set equal to NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getembeddedobject HRESULT GetEmbeddedObject( IUnknown
// **ppObject );
[return: MarshalAs(UnmanagedType.IUnknown)]
new object GetEmbeddedObject();
/// Gets the count of characters in a range.
///
/// Type: long*
/// The signed count of characters.
///
///
/// The count of characters is the difference between the character position of the active end of the range, and the character
/// position of the anchor end. Some Text Object Model (TOM) implementations might include active ends only for a selection
/// (represented by the ITextSelection interface). The rich edit control's TOM implementation of a text range (represented by the
/// ITextRange interface) also has active ends.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcch HRESULT GetCch( [out, retval] long *pcch );
int GetCch();
///
/// Not implemented.
/// Gets a cells object with the parameters of cells in the currently selected table row or column.
///
///
/// Type: IUnknown**
/// The cells object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcells HRESULT GetCells( [out, retval] IUnknown
// **ppCells );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetCells();
///
/// Not implemented.
/// Gets the column properties for the currently selected column.
///
///
/// Type: IUnknown**
/// The column properties for the currently selected column.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcolumn HRESULT GetColumn( [out, retval] IUnknown
// **ppColumn );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetColumn();
/// Gets the count of subranges, including the active subrange in the current range.
///
/// Type: long*
/// The count of subranges not including the active one.
///
///
///
/// If you select a range with no or one character, the count will be 1. But if you select a word and then move to a different
/// location, and select a second word not touching the first, then the count is 2.
///
/// See ITextRange2::AddSubrange to add subranges programmatically.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcount HRESULT GetCount( [out, retval] long *pCount );
int GetCount();
/// Gets a duplicate of a range object.
///
/// Type: ITextRange2**
/// The duplicate range.
///
///
/// If this range is an ITextSelection2 object, the duplicate returned is an ITextRange2 object. See the ITextRange::FindText method
/// for more information.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getduplicate2 HRESULT GetDuplicate2( [out, retval]
// ITextRange2 **ppRange );
ITextRange2 GetDuplicate2();
/// Gets an ITextFont2 object with the character attributes of the current range.
///
/// Type: ITextFont2**
/// The ITextFont2 object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getfont2 HRESULT GetFont2( [out, retval] ITextFont2
// **ppFont );
ITextFont2 GetFont2();
/// Sets the character formatting attributes of the range.
///
/// Type: ITextFont2*
/// The font object with the desired character formatting attributes.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setfont2 HRESULT SetFont2( [in] ITextFont2 *pFont );
void SetFont2([In, Optional] ITextFont2? pFont);
/// Gets an ITextRange2 object with the current range's formatted text.
///
/// Type: ITextRange2**
/// The formatted text.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getformattedtext2 HRESULT GetFormattedText2( [out,
// retval] ITextRange2 **ppRange );
ITextRange2 GetFormattedText2();
/// Sets the text of this range to the formatted text of the specified range.
///
/// Type: ITextRange2*
/// The range that contains the formatted text that replaces the text of this range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setformattedtext2 HRESULT SetFormattedText2( [in]
// ITextRange2 *pRange );
void SetFormattedText2([In, Optional] ITextRange2? pRange);
/// Gets the gravity of this range.
///
/// Type: long*
/// The gravity value, which can be one of the following:
/// tomGravityUI
/// tomGravityBack
/// tomGravityFore
/// tomGravityIn
/// tomGravityOut
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getgravity HRESULT GetGravity( [out, retval] long
// *pValue );
tomConstants GetGravity();
/// Sets the gravity of this range.
///
/// Type: long
/// The new gravity value, which can be one of the following.
/// tomGravityUI
/// tomGravityBack
/// tomGravityFore
/// tomGravityIn
/// tomGravityOut
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setgravity HRESULT SetGravity( [in] long Value );
void SetGravity(tomConstants Value);
/// Gets an ITextPara2 object with the paragraph attributes of a range.
///
/// Type: ITextPara2**
/// The ITextPara2 object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getpara2 HRESULT GetPara2( [out, retval] ITextPara2
// **ppPara );
ITextPara2 GetPara2();
/// Sets the paragraph format attributes of a range.
///
/// Type: ITextPara2*
/// The desired paragraph format.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setpara2 HRESULT SetPara2( [in] ITextPara2 *pPara );
void SetPara2([In, Optional] ITextPara2? pPara);
/// Gets the row properties in the currently selected row.
///
/// Type: ITextRow**
/// The row properties.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getrow HRESULT GetRow( [out, retval] ITextRow **ppRow );
ITextRow GetRow();
/// Gets the character position of the start of the paragraph that contains the range's start character position.
///
/// Type: long*
/// The start of the paragraph that contains the range's start character position.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getstartpara HRESULT GetStartPara( [out, retval] long
// *pValue );
int GetStartPara();
///
/// Not implemented.
/// Gets the table properties in the currently selected table.
///
///
/// Type: IUnknown**
/// The table properties.
///
///
/// To select the table when the insertion point is inside a table, call ITextRange::Expand(tomTable).
/// Note: this method isn't implemented in RichEdit (see ITextRow for table functionality).
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-gettable HRESULT GetTable( [out, retval] IUnknown
// **ppTable );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetTable();
/// Returns the URL text associated with a range.
///
/// Type: BSTR*
/// The URL text associated with the range.
///
///
/// This method sets the start and end positions of the range to that of the whole hyperlink, including the friendly name, if any.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-geturl HRESULT GetURL( [out, retval] BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
string GetURL();
/// Sets the text in this range to that of the specified URL.
///
/// Type: BSTR
/// The text to use as a URL for the selected friendly name.
///
///
///
/// The URL string is not validated. The text it contains must be enclosed in quotes, optionally preceded by the sentinel character
/// 0xFDDF. For example: "http://www.msn.com" or 0xFDDF"http://www.msn.com". The range must be nondegenerate.
///
/// The following actions are possible:
///
/// -
/// If part of a link's friendly name is selected, the URL part is replaced with bstr.
///
/// -
/// If part of a regular URL is selected, it becomes the link's friendly name, with bstr as the URL.
///
/// -
/// If nonlink text is selected:
///
///
/// The text range be adjusted to different character positions after calling SetURL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-seturl HRESULT SetURL( [in] BSTR bstr );
void SetURL([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Adds a subrange to this range.
///
/// Type: long
/// The active-end character position of the subrange.
///
///
/// Type: long
/// The anchor-end character position of the subrange.
///
///
/// Type: long
///
/// The activate parameter. If this parameter is tomTrue, the new subrange is the active subrange, with cp1 as the
/// active end, and cp2 the anchor end.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-addsubrange HRESULT AddSubrange( [in] long cp1, [in]
// long cp2, [in] long Activate );
void AddSubrange(int cp1, int cp2, tomConstants Activate);
/// Converts the linear-format math in a range to a built-up form, or modifies the current built-up form.
///
/// Type: long
/// A combination of the following flags.
/// tomChemicalFormula
/// tomHaveDelimiter
/// tomMathAlphabetics
/// tomMathApplyTemplate
/// tomMathArabicAlphabetics
/// tomMathAutoCorrect
/// tomMathAutoCorrectExt
/// tomMathAutoCorrectOpPairs
/// tomMathBackspace
/// tomMathBuildDown
/// tomMathBuildDownOutermost
/// tomMathBuildUpArgOrZone
/// tomMathBuildUpRecurse
/// tomMathChangeMask
/// tomMathCollapseSel
/// tomMathDeleteArg
/// tomMathDeleteArg1
/// tomMathDeleteArg2
/// tomMathDeleteCol
/// tomMathDeleteRow
/// tomMathEnter
/// tomMathInsColAfter
/// tomMathInsColBefore
/// tomMathInsRowAfter
/// tomMathInsRowBefore
/// tomMathMakeFracLinear
/// tomMathMakeFracSlashed
/// tomMathMakeFracStacked
/// tomMathMakeLeftSubSup
/// tomMathMakeSubSup
/// tomMathRemoveOutermost
/// tomMathRichEdit
/// tomMathShiftTab
/// tomMathSingleChar
/// tomMathSubscript
/// tomMathSuperscript
/// tomMathTab
/// tomNeedTermOp
/// tomPlain
/// tomShowEmptyArgPlaceholders
/// tomTeX
///
///
///
/// If the ITextRange2::BuildUpMath method is called on a nondegenerate range, the method checks the text for math italic
/// conversions (if tomMathAlphabetics is specified) and math autocorrect conversions (if tomMathAutoCorrect or
/// tomMathAutoCorrectExt is specified). Then, the method attempts to build up the selected text. If successful, the method
/// replaces the previous text in the range with the built-up text. If the method makes any changes to the range, the function
/// returns NOERROR and the range selects the result. If the method does change the range, it returns S_FALSE or a
/// Component Object Model (COM) error code.
///
///
/// If the ITextRange2::BuildUpMath method is called on a degenerate range, the BuildUpMath method treats the range as
/// an insertion point (IP) immediately following the last character input. The method converts that character, possibly along with
/// some preceding characters, to math italic (if tomMathAlphabetics is specified), internal math autocorrect (if
/// tomMathAutoCorrect is specified), negated operators, and some operator pairs (if tomMathAutoCorrectOpPairs is
/// specified). If the IP is inside an argument, the method scans a range of text from the IP back to the start of a math object
/// argument; otherwise, the method scans to the start of the current math zone. The scan is terminated by a hard carriage return or
/// a soft end-of-paragraph mark, because math zones are terminated by these marks. A scan forward from start of the math object
/// argument or math zone bypasses text that has no chance of being built up. If the scan reaches the original entry IP, one of the
/// following outcomes can occur:
///
///
/// -
///
/// If the method made any changes, the function returns NOERROR and the range updated with the changed text.
///
///
/// -
/// If the method made no changes, the function returns S_FALSE and leaves the range unchanged.
///
///
///
/// If the scan finds text that might get built up, the BuildUpMath method attempts to build up the text up to the insertion
/// point. If successful, the method returns NOERROR, and the range is updated with the corresponding built-up text.
///
///
/// If this full build-up attempt fails, the BuildUpMath method does a partial build-up check for the expression immediately
/// preceding the IP. If this succeeds, the method returns NOERROR and the range contains the linear text to be replaced by
/// the built-up text.
///
///
/// If full and partial build-up attempts fail, the function returns as described previously for the cases where no build-up text was
/// found. Other possible return values include E_INVALIDARG (if either interface pointer is NULL) and E_OUTOFMEMORY.
///
///
/// You should set the tomNeedTermOp flag should for formula autobuildup unless autocorrection has occurred that deletes the
/// terminating blank. Autocorrection can occur when correcting text like \alpha when the user types a blank to force autocorrection.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-buildupmath HRESULT BuildUpMath( [in] long Flags );
void BuildUpMath(tomConstants Flags);
/// Deletes a subrange from a range.
///
/// Type: long
/// The start character position of the subrange.
///
///
/// Type: long
/// The end character position of the subrange.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-deletesubrange HRESULT DeleteSubrange( [in] long
// cpFirst, [in] long cpLim );
void DeleteSubrange(int cpFirst, int cpLim);
/// Searches for math inline functions in text as specified by a source range.
///
/// Type: ITextRange2*
/// The formatted text to find in the range's text.
///
///
/// Type: long
/// The number of characters to search through.
///
///
/// Type: long
/// Flags that control the search as defined for ITextRange::FindText.
///
///
/// Type: long*
/// A count of the number of characters bypassed.
///
///
///
/// If the string is found, and the math inline functions, if any, are the same as their counterparts in the source range, the range
/// limits are changed to be those of the matched string and length is set equal to the length of the string.
///
/// If the string isn't found, the range remains unchanged and length is set equal to 0.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-find HRESULT Find( [in] ITextRange2 *pRange, [in] long
// Count, [in] long Flags, [out] long *pDelta );
tomConstants Find([In, Optional] ITextRange2? pRange, int Count, tomConstants Flags);
/// Gets the character at the specified offset from the end of this range.
///
/// Type: long*
/// The character value.
///
///
/// Type: long
/// The offset from the end of the range. An offset of 0 gets the character at the end of the range.
///
///
/// This method differs from ITextRange::GetChar in the following ways:
///
/// -
/// It returns the UTF-32 character for the surrogate pair instead of the pair's lead code.
///
/// -
///
/// It gets the character code, or codes, at the specified offset from the end of the range instead of the character at the start of
/// the range.
///
///
///
/// If the character is the lead code for a surrogate pair, the corresponding UTF-32 character is returned.
///
/// If Offset specifies a character before the start of the story or at the end of the story, this method returns the
/// character code 0.
///
///
///
/// If the Offset value is
/// This character is returned
///
/// -
/// 0
/// The character at the end of the range.
///
/// -
/// Negative and accesses the middle of a surrogate pair
/// The corresponding UTF-32 character.
///
/// -
/// Positive and accesses the middle of a surrogate pair
/// The UTF-32 character following that pair.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getchar2 HRESULT GetChar2( [out] long *pChar, [in] long
// Offset );
void GetChar2(out int pChar, int Offset);
///
/// Not implemented.
/// Gets the drop-cap parameters of the paragraph that contains this range.
///
///
/// Type: long*
/// The count of lines for the drop cap. A value of 0 means no drop cap.
///
///
/// Type: long*
/// The position of the drop cap. The position can be one of the following:
///
/// -
/// tomDropMargin
///
/// -
/// tomDropNone
///
/// -
/// tomDropNormal
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getdropcap HRESULT GetDropCap( [out] long *pcLine,
// [out] long *pPosition );
tomConstants GetDropCap(out int pcLine);
/// Gets the properties of the inline object at the range active end.
///
/// Type: long*
/// The inline object type can be one of the following:
/// tomSimpleText
/// tomRuby
/// tomHorzVert
/// tomWarichu
/// tomAccent
/// tomBox
/// tomBoxedFormula
/// tomBrackets
/// tomBracketsWithSeps
/// tomEquationArray
/// tomFraction
/// tomFunctionApply
/// tomLeftSubSup
/// tomLowerLimit
/// tomMatrix
/// tomNary
/// tomOpChar
/// tomOverbar
/// tomPhantom
/// tomRadical
/// tomSlashedFraction
/// tomStack
/// tomStretchStack
/// tomSubscript
/// tomSubSup
/// tomSuperscript
/// tomUnderbar
/// tomUpperLimit
///
///
/// Type: long*
/// The inline object alignment, which can be one of these meanings depending on the inline object type:
///
///
/// Inline object type
/// Meaning of Align Parameter
///
/// -
/// tomRuby
/// tomRubyBelow tomRubyAlignCenter (default) tomRubyAlign010 tomRubyAlign121 tomRubyAlignLeft tomRubyAlignRight
///
/// -
/// tomBox
///
/// tomBoxAlignCenter tomSpaceMask tomSpaceDefault tomSpaceUnary tomSpaceBinary tomSpaceRelational tomSpaceSkip tomSpaceOrd
/// tomSpaceDifferential tomSizeText tomSizeScript tomSizeScriptScript tomNoBreak tomTransparentForPositioning tomTransparentForSpacing
///
///
/// -
/// tomBoxedFormula
///
/// tomBoxHideTop tomBoxHideBottom tomBoxHideLeft tomBoxHideRight tomBoxStrikeH tomBoxStrikeV tomBoxStrikeTLBR tomBoxStrikeBLTR
///
///
/// -
/// tomBrackets
/// tomAlignDefault tomAlignCenter tomAlignMatchAscentDescent tomMathVariant
///
/// -
/// tomEquationArray
/// tomEqArrayLayoutWidth tomEqArrayAlignMask tomEqArrayAlignCenter tomEqArrayAlignTopRow tomEqArrayAlignBottomRow
///
/// -
/// tomMatrix
/// tomMatrixAlignMask tomMatrixAlignCenter tomMatrixAlignTopRow tomMatrixAlignBottomRow tomShowMatPlaceHldr
///
/// -
/// tomNary
///
/// tomLimitsDefault tomLimitsUnderOver tomLimitsSubSup tomUpperLimitAsSuperScript tomLimitsOpposite tomShowLLimPlaceHldr
/// tomShowULimPlaceHldr tomDontGrowWithContent tomGrowWithContent
///
///
/// -
/// tomPhantom
/// tomPhantomShow tomPhantomZeroWidth tomPhantomZeroAscent tomPhantomZeroDescent tomPhantomTransparent
///
/// -
/// tomRadical
/// tomShowDegPlaceHldr
///
/// -
/// tomSubSup
/// tomSubSupAlign
///
/// -
/// tomStretchStack
/// tomStretchCharBelow tomStretchCharAbove tomStretchBaseBelow tomStretchBaseAbove
///
///
///
///
/// Type: long*
/// The inline object character.
/// The value for each object type is shown in the following table..
///
///
/// Inline object type
/// Meaning of align parameter
///
/// -
/// tomAccent
/// Accent (U+0300âU+36F, U+20D0âU+20EF)
///
/// -
/// tomBoxedFormula
/// U+25AD for rectangle enclosure
///
/// -
/// tomBrackets
/// Opening bracket. Default: U+0028.
///
/// -
/// tomBracketsWithSeps
/// Opening bracket with separators. Default: U+0028
///
/// -
/// tomEquationArray
/// U+2588
///
/// -
/// tomFraction
/// Normal built-up fraction: U+002F; small numeric fraction: U+2298
///
/// -
/// tomFunctionApply
/// U+2061
///
/// -
/// tomLeftSubSup
/// U+005E
///
/// -
/// tomLowerLimit
/// U+252C
///
/// -
/// tomMatrix
///
/// U+25A0: no enclosing brackets U+24A8: enclosing parentheses (\pmatrix) U+24B1: enclosing vertical bars (\vmatrix) U+24A9:
/// enclosing double vertical bars (\Vmatrix)
///
///
/// -
/// tomNary
/// n-ary symbol
///
/// -
/// tomOpChar
/// Internal use for no-build operators
///
/// -
/// tomOverbar
/// U+00AF
///
/// -
/// tomPhantom
///
/// U+27E1: full or custom phantom U+2B04: horizontal phantom U+21F3: vertical phantom U+2B06: ascent smash U+2B07: descent smash
/// U+2B0C: horizontal smash U+2B0D: full smash
///
///
/// -
/// tomRadical
/// U+221A: square or nth root U+221B: cube root U+221C: fourth root
///
/// -
/// tomSlashedFraction
/// U+2044: skewed fraction U+2215: built-up linear fraction
///
/// -
/// tomStack
/// U+00A6
///
/// -
/// tomStretchStack
/// Horizontal stretch character (see Unicode Technical Note 28 Appendix B for a list)
///
/// -
/// tomSubscript
/// U+005E
///
/// -
/// tomSubSup
/// U+005E
///
/// -
/// tomSuperscript
/// U+005F
///
/// -
/// tomUnderbar
/// U+2581
///
/// -
/// tomUpperLimit
/// U+2534
///
///
///
///
/// Type: long*
///
/// The closing tomBrackets character. See Unicode Technical Note 28 Appendix B. Character Keywords and Properties for a list.
///
///
///
/// Type: long*
/// The separator character for tomBracketsWithSep:
/// U+007C: vertical bar with no extra spacing
/// U+2223: vertical bar with extra spacing
///
///
/// Type: long*
/// The inline object count of arguments.
///
///
/// Type: long*
/// The inline object TeX style, which can be one of the following values.
/// Note   The tomStyleDefault behavior depends on the context.
/// Â
/// tomStyleDefault
/// tomStyleScriptScriptCramped
/// tomStyleScriptScript
/// tomStyleScriptCramped
/// tomStyleScript
/// tomStyleTextCramped
/// tomStyleText
/// tomStyleDisplayCramped
/// tomStyleDisplay
///
///
/// Type: long*
/// The inline object count of columns ( tomMatrix only).
///
///
/// Type: long*
/// The inline object 0-based nesting level.
///
///
///
/// Unicode Technical Note 28 describes the alignment and character values in detail when the active end character is an inline
/// object start delimiter.
///
///
/// When that character is not a start delimiter, the character and column parameters are set to 0, the count is set to the 0-based
/// argument index, and the other parameters are set according to the active-end character properties of the innermost inline object argument.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getinlineobject HRESULT GetInlineObject( [out] long
// *pType, [out] long *pAlign, [out] long *pChar, [out] long *pChar1, [out] long *pChar2, [out] long *pCount, [out] long *pTeXStyle,
// [out] long *pcCol, [out] long *pLevel );
int GetInlineObject(out tomConstants pType, out tomConstants pAlign, out int pChar, out int pChar1, out int pChar2, out int pCount, out tomConstants pTeXStyle, out int pcCol);
/// Gets the value of a property.
///
/// Type: long
/// The property ID.
///
///
/// Type: long*
/// The property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getproperty HRESULT GetProperty( [in] long Type, [out]
// long *pValue );
int GetProperty(int Type);
/// Retrieves a rectangle of the specified type for the current range.
///
/// Type: long
/// The type of rectangle to return. This parameter can include one value from each of the following tables.
/// tomAllowOffClient
/// tomClientCoord
/// tomObjectArg
/// tomTransform
/// Use one of these values to indicate the vertical position:
///
///
/// TA_TOP
/// Top edge of the bounding rectangle.
///
/// -
/// TA_BASELINE
/// Base line of the text.
///
/// -
/// TA_BOTTOM
/// Bottom edge of the bounding rectangle.
///
///
/// Â
/// Use one of these values to indicate the horizontal position:
///
///
/// TA_LEFT
/// Left edge of the bounding rectangle.
///
/// -
/// TA_CENTER
/// Center of the bounding rectangle.
///
/// -
/// TA_RIGHT
/// Right edge of the bounding rectangle.
///
///
///
///
/// Type: long*
/// The left rectangle coordinate.
///
///
/// Type: long*
/// The top rectangle coordinate.
///
///
/// Type: long*
/// The right rectangle coordinate.
///
///
/// Type: long*
/// The bottom rectangle coordinate.
///
///
/// Type: long*
/// The hit-test value for the range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getrect HRESULT GetRect( [in] long Type, [out] long
// *pLeft, [out] long *pTop, [out] long *pRight, [out] long *pBottom, [out] long *pHit );
tomConstants GetRect(tomConstants Type, out int pLeft, out int pTop, out int pRight, out int pBottom);
/// Retrieves a subrange in a range.
///
/// Type: long
/// The subrange index.
///
///
/// Type: long*
/// The character position for the start of the subrange.
///
///
/// Type: long*
/// The character position for the end of the subrange.
///
///
/// Subranges are selected as follows.
///
///
/// iSubrange value
/// Subrange
///
/// -
/// Equals zero
/// Gets the current active subrange.
///
/// -
/// Greater than zero
///
/// Gets the subrange at the index specified by iSubrange, in the order in which the subranges were added. This requires extra calculation.
///
///
/// -
/// Less than zero
/// Gets the subrange at the index specified by iSubrange, in increasing character position order.
///
///
/// Â
/// See ITextRange2::GetCount for the count of subranges not including the active subrange.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getsubrange HRESULT GetSubrange( [in] long iSubrange,
// [out] long *pcpFirst, [out] long *pcpLim );
void GetSubrange(int iSubrange, out int pcpFirst, out int pcpLim);
/// Gets the text in this range according to the specified conversion flags.
///
/// Type: long
///
/// The flags controlling how the text is retrieved. The flags can include a combination of the following values. Specifying a
/// Flags value of 0 is the same as calling the ITextRange::GetText method.
///
/// tomAdjustCRLF
/// tomUseCRLF
/// tomIncludeNumbering
/// tomNoHidden
/// tomNoMathZoneBrackets
/// tomTextize
/// tomAllowFinalEOP
/// tomTranslateTableCell
/// tomFoldMathAlpha
/// tomLanguageTag
///
///
/// Type: BSTR*
/// The text in the range.
///
///
/// This method includes the special flag tomLanguageTag to get the BCP-47 language tag for the range. This is an industry
/// standard language tag which may be preferable to the language code identifier (LCID) obtained by calling ITextFont::GetLanguageID.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-gettext2 HRESULT GetText2( [in] long Flags, [out] BSTR
// *pbstr );
void GetText2(tomConstants Flags, [MarshalAs(UnmanagedType.BStr)] out string pbstr);
/// Converts and replaces the hexadecimal number at the end of this range to a Unicode character.
///
/// Some Unicode surrogates for hex values from 0x10000 up to 0x10FFFF are for internal use:
///
///
/// Hex values
/// Available for use
///
/// -
/// 7, 0xFDD0 â 0xFDEF, 0xFFF9 â 0xFFFF
/// Internal use only
///
/// -
/// 0xA â 0xD in the C0 range (0-0x1F)
/// Available for use
///
/// -
/// C1 range (0x80 â 0x9F)
/// Internal use only
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-hextounicode HRESULT HexToUnicode();
void HexToUnicode();
/// Inserts a table in a range.
///
/// Type: long
/// The number of columns in the table.
///
///
/// Type: long
/// The number of rows in the table.
///
///
/// Type: long
/// Specifies how the cells fit the target space.
///
///
/// If the range is nondegenerate, the table replaces the text in the range. The column widths are calculated according to the
/// AutoFit parameter, and the borders are solid black with 0.5 point widths. To change these defaults, use the
/// ITextRange2::GetRow method to obtain an ITextRow interface.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-inserttable HRESULT InsertTable( [in] long cCol, [in]
// long cRow, [in] long AutoFit );
void InsertTable(int cCol, int cRow, int AutoFit);
/// Translates the built-up math, ruby, and other inline objects in this range to linearized form.
///
/// Type: long
/// A combination of the following flags.
/// tomMathAlphabetics
/// tomMathBuildDownOutermost
/// tomMathBuildUpArgOrZone
/// tomMathRemoveOutermost
/// tomPlain
/// tomTeX
///
///
/// If the linearization is successful, the originally selected range is replaced by the linearized version.
///
/// If the tomMathRemoveOutermost or tomMathBuildDownOutermost build down mode is specified, the build down operation
/// can be affected by the tomMathChangeMask values.
///
///
/// The main purpose of these build-down modes is to facilitate transformations of the build-up math object as exposed by math
/// context menus.
///
///
/// For example, to convert a stacked fraction to a linear fraction as in (a+b/c)/(u+x/y)â((a+b/c))â((u+x/y)), parentheses must
/// be inserted; otherwise, you get a transformation that looks incorrect, as in (a+b/c)/(u+x/y)â(a+b/c)â(u+x/y), even though
/// internally the linear fraction still has the original numerator and denominator.
///
///
/// The build-down process automatically inserts the parentheses, because the linear format for this case has parentheses, and the
/// special change is made to replace the stacked-fraction operator U+002F by the linear fraction operator U+2215. Build up doesn't
/// discard the parentheses for U+2215, but it does for U+002F.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-linearize HRESULT Linearize( [in] long Flags );
void Linearize(tomConstants Flags);
/// Makes the specified subrange the active subrange of this range.
///
/// Type: long
/// The anchor end character position of the subrange to make active.
///
///
/// Type: long
/// The active end character position of the subrange to make active.
///
/// The active subrange is the one affected by operations such as Shift+Arrow keys if this range is the selection.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setactivesubrange HRESULT SetActiveSubrange( [in] long
// cpAnchor, [in] long cpActive );
void SetActiveSubrange(int cpAnchor, int cpActive);
///
/// Not implemented.
/// Sets the drop-cap parameters for the paragraph that contains the current range.
///
///
/// Type: long
/// The count of lines for drop cap. Zero means no drop cap.
///
///
/// Type: long
/// The position of drop cap. It can be one of the following.
///
///
///
/// The current range can be degenerate, or you can select up to the complete drop-cap paragraph. If the range contains more than one
/// paragraph, this method returns E_FAIL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setdropcap HRESULT SetDropCap( [in] long cLine, [in]
// long Position );
void SetDropCap(int cLine, int Position);
/// Sets the value of the specified property.
///
/// Type: long
/// The ID of the property to set.
///
///
/// Type: long
/// The new property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setproperty HRESULT SetProperty( [in] long Type, [in]
// long Value );
void SetProperty(tomConstants Type, int Value);
/// Sets the text of this range.
///
/// Type: long
/// Flags controlling how the text is inserted in the range. The flag can be one of the following values:
/// tomUnicodeBiDi
/// tomMathCFCheck
/// tomUnlink
/// tomUnhide
/// tomCheckTextLimit
/// tomLanguageTag
///
///
/// Type: BSTR
/// The new text.
///
///
/// If the bstr parameter is NULL, the text in the range is deleted.
///
/// This method is similar to ITextRange:: SetText, but lets the client specify flags that control various insertion options,
/// including the special flag tomLanguageTag to get the BCP-47 language tag for the range. This is an industry standard
/// language tag that may be preferable to ITextFont::SetLanguageID, which uses a language code identifier (LCID).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-settext2 HRESULT SetText2( [in] long Flags, [in] BSTR
// bstr );
void SetText2(tomConstants Flags, [MarshalAs(UnmanagedType.BStr)] string bstr);
///
/// Converts the Unicode character(s) preceding the start position of this text range to a hexadecimal number, and selects it.
///
///
/// Some Unicode surrogates for hex values from 0x10000 up to 0x10FFFF are for internal use:
///
///
/// Hex values
/// Available for use
///
/// -
/// 0xFDD0 â 0xFDEF, 0xFFF9-0xFFFF
/// Internal use only
///
/// -
/// 0xA â 0xD in the C0 range (0-0x1F)
/// Available for use
///
/// -
/// C1 range (0x80 â 0x9F)
/// Internal use only
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-unicodetohex HRESULT UnicodeToHex();
void UnicodeToHex();
/// Sets or inserts the properties of an inline object for a degenerate range.
///
/// Type: long
/// The object type as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The object alignment as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The object character as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The closing bracket (tomBrackets) character. See Unicode Technical Note 28 for a list of characters.
///
///
/// Type: long
/// The separator character for tomBracketsWithSeps, which can be one of the following values.
///
///
/// Type: long
/// The number of arguments in the inline object.
///
///
/// Type: long
/// The TeX style, as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The number of columns in the inline object. For tomMatrix only.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setinlineobject HRESULT SetInlineObject( [in] long
// Type, [in] long Align, [in] long Char, [in] long Char1, [in] long Char2, [in] long Count, [in] long TeXStyle, [in] long cCol );
void SetInlineObject(tomConstants Type, tomConstants Align, int Char, int Char1, int Char2, int Count, tomConstants TeXStyle, int cCol);
/// Retrieves the math function type associated with the specified math function name.
///
/// Type: BSTR
/// The math function name that is checked to determine the math function type.
///
///
/// Type: long*
/// The math function type of the function name specified by bstr. It can be one of the following values.
/// tomFunctionTypeNone
/// tomFunctionTypeTakesArg
/// tomFunctionTypeTakesLim
/// tomFunctionTypeTakesLim2
/// tomFunctionTypeIsLim
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getmathfunctiontype HRESULT GetMathFunctionType( [in]
// BSTR bstr, [out] long *pValue );
tomConstants GetMathFunctionType([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Inserts an image into this range.
///
/// Type: long
/// The width, in HIMETRIC units (0.01 mm), of the image.
///
///
/// Type: long
/// The height, in HIMETRIC units, of the image.
///
///
/// Type: long
///
/// If Type is TA_BASELINE, this parameter is the distance, in HIMETRIC units, that the top of the image extends above the
/// text baseline. If Type is TA_BASELINE and ascent is zero, the bottom of the image is placed at the text baseline.
///
///
///
/// Type: long
/// The vertical alignment of the image. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// TA_BASELINE
/// Align the image relative to the text baseline.
///
/// -
/// TA_BOTTOM
/// Align the bottom of the image at the bottom of the text line.
///
/// -
/// TA_TOP
/// Align the top of the image at the top of the text line
///
///
///
///
/// Type: BSTR
/// The alternate text for the image.
///
///
/// Type: IStream
/// The stream that contains the image data.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// If the range is nondegenerate, the image replaces the text in the range.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-insertimage HRESULT InsertImage( [in] long width, [in]
// long height, [in] long ascent, [in] long Type, [in] BSTR bstrAltText, [in] IStream *pStream );
void InsertImage(int width, int height, int ascent, Gdi32.TextAlign Type, [MarshalAs(UnmanagedType.BStr)] string? bstrAltText,
[In, Optional] System.Runtime.InteropServices.ComTypes.IStream? pStream);
}
///
/// The ITextRow interface provides methods to insert one or more identical table rows, and to retrieve and change table row
/// properties. To insert nonidentical rows, call ITextRow::Insert for each different row configuration.
///
///
///
/// To select a table, a row, or a cell, use ITextRange::Expand, with the Unit parameter set to tomTable, tomRow, or
/// tomCell, respectively. These units can also be used with the ITextRange::Move methods to navigate and select multiple rows or cells.
///
///
/// Some of the ITextRow properties apply to the whole row, such as the row alignment. In addition, there are a number of
/// properties, such as cell alignment, that apply to a cell with the index set via the ITextRow::SetCellIndex method. This cell is
/// referred to as the active cell.
///
///
/// ITextRow works similarly to ITextPara2, but doesn't modify the document until either the ITextRow::Apply or ITextRow::Insert
/// methods are called. In addition, the row and cell parameters are always active, that is, they cannot have the value tomDefault.
///
///
/// On initialization, the ITextRow object acquires the table row properties, if any, at the active end of the associated
/// ITextRange2. The ITextRow::Reset method can be used to update these properties to the current values for ITextRange2 object.
///
///
/// A rich edit control table consists of a sequence of table rows, which, in turn, consist of sequences of paragraphs. A table row
/// starts with the special two-character delimiter paragraph U+FFF9 U+000D and ends with the two-character delimiter paragraph U+FFFB
/// U+000D. Each cell is terminated by the cell mark U+0007, which is treated as a hard end-of-paragraph mark just as U+000D (CR) is. The
/// table row and cell parameters are treated as special paragraph formatting of the table-row delimiters. The cell parameters are stored
/// in an expanded version of the tabs array. This format allows tables to be nested within other tables and is allowed to go fifteen
/// levels deep.
///
///
/// The architecture is quite flexible in that each table row can have any valid table-row parameters, regardless of the parameters for
/// other rows (except for vertical merge flags). For example, the number of cells and the start indents of table rows can differ, unlike
/// in HTML which has nÃm rectangular format with all rows starting at the same indent.
///
///
/// On the other hand, no formal table description is stored anywhere. Information such as the number of rows must be figured out by
/// navigating through the table. For example, the count of rows in a table can be obtained by calling ITextRange::StartOf (
/// tomTable, tomFalse, NULL) to move to the start of the current table and then calling ITextRange::Move (
/// tomRow, tomForward, &dcRow). The quantity &dcRow + 1 then contains the count of rows in the
/// table, because moving by tomRow increments doesn't move beyond the last table row.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextrow
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextRow")]
[ComImport, Guid("C241F5EF-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextRow
{
/// Gets the horizontal alignment of a row.
///
/// Type: long*
/// The horizontal alignment. It can be one of the following values.
/// tomAlignLeft
/// tomAlignCenter
/// tomAlignRight
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getalignment HRESULT GetAlignment( [out, retval] long
// *pValue );
tomConstants GetAlignment();
/// Sets the horizontal alignment of a row.
///
/// Type: long
/// The new horizontal alignment. It can be one of the following values.
/// tomAlignLeft
/// tomAlignCenter
/// tomAlignRight
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setalignment HRESULT SetAlignment( [in] long Value );
void SetAlignment(tomConstants Value);
/// Gets the count of cells in this row.
///
/// Type: long*
/// The cell count for this row.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellcount HRESULT GetCellCount( [out, retval] long
// *pValue );
int GetCellCount();
/// Sets the count of cells in a row.
///
/// Type: long
/// The row cell count.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellcount HRESULT SetCellCount( [in] long Value );
void SetCellCount(int Value);
/// Gets the count of cells cached for this row.
///
/// Type: long*
/// The cached cell count.
///
///
/// If all cells are identical, properties need to be cached only for the cell with index 0. If the cached count is less than the
/// cell count, the cell parameters for index CellCountCache â 1 are used for cells with larger indices.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellcountcache HRESULT GetCellCountCache( [out, retval]
// long *pValue );
int GetCellCountCache();
/// Sets the count of cells cached for a row.
///
/// Type: long
/// The cell count.
///
///
/// If all cells are identical, properties need to be cached only for the cell with index 0. If the cached count is less than the
/// cell count, the cell parameters for index CellCountCache â 1 are used for cells with larger indices.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellcountcache HRESULT SetCellCountCache( [in] long
// Value );
void SetCellCountCache(int Value);
/// Gets the index of the active cell to get or set parameters for.
///
/// Type: long*
/// The cell index.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellindex HRESULT GetCellIndex( [out, retval] long
// *pValue );
int GetCellIndex();
/// Sets the index of the active cell.
///
/// Type: long
/// The cell index.
///
///
/// You can get or set parameters for an active cell.
///
/// If the cell index is greater than the cell count, and the cell index is less that 63 (the maximum cell count), then the cell
/// count is increased to cell index + 1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellindex HRESULT SetCellIndex( [in] long Value );
void SetCellIndex(int Value);
/// Gets the cell margin of this row.
///
/// Type: long*
/// The cell margin.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellmargin HRESULT GetCellMargin( [out, retval] long
// *pValue );
int GetCellMargin();
/// Sets the cell margin of a row.
///
/// Type: long
/// The cell margin. The cell margin is used for all cells in the row and is typically about 108 twips or 0.075 inches.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellmargin HRESULT SetCellMargin( [in] long Value );
void SetCellMargin(int Value);
/// Gets the height of the row.
///
/// Type: long*
/// The row height. A value of 0 indicates autoheight.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getheight HRESULT GetHeight( [out, retval] long *pValue );
int GetHeight();
/// Sets the height of a row.
///
/// Type: long
/// The row height. A value of 0 indicates autoheight.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setheight HRESULT SetHeight( [in] long Value );
void SetHeight(int Value);
/// Gets the indent of this row.
///
/// Type: long*
/// The indent of the row.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getindent HRESULT GetIndent( [out, retval] long *pValue );
int GetIndent();
/// Sets the indent of a row.
///
/// Type: long
/// The row indent.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setindent HRESULT SetIndent( [in] long Value );
void SetIndent(int Value);
/// Gets whether this row is allowed to be broken across pages.
///
/// Type: long*
/// A tomBool value that indicates whether this row can be broken across pages.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getkeeptogether HRESULT GetKeepTogether( [out, retval]
// long *pValue );
tomConstants GetKeepTogether();
/// Sets whether this row is allowed to be broken across pages.
///
/// Type: long
/// A tomBool value that indicates whether this row can be broken across pages.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setkeeptogether HRESULT SetKeepTogether( [in] long Value );
void SetKeepTogether(tomConstants Value);
/// Gets whether this row should appear on the same page as the row that follows it.
///
/// Type: long*
/// A tomBool value that indicates whether this row should be kept on the same page as the following row.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getkeepwithnext HRESULT GetKeepWithNext( [out, retval]
// long *pValue );
tomConstants GetKeepWithNext();
/// Sets whether a row should appear on the same page as the row that follows it.
///
/// Type: long
/// A tomBool value that indicates whether a row should appear on the same page as the row that follows it.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setkeepwithnext HRESULT SetKeepWithNext( [in] long Value );
void SetKeepWithNext(tomConstants Value);
/// Gets the nest level of a table.
///
/// Type: long*
/// The nest level.
///
///
/// The nest level of the table is identified by the associated ITextRange2 object. If there is only a single table, the nest level
/// is 1. If there is no table, the nest level is 0.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getnestlevel HRESULT GetNestLevel( [out, retval] long
// *pValue );
int GetNestLevel();
/// Gets whether this row has right-to-left orientation.
///
/// Type: long*
/// A tomBool value that indicates whether this row has right-to-left orientation.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getrtl HRESULT GetRTL( [out, retval] long *pValue );
tomConstants GetRTL();
/// Sets whether this row has right-to-left orientation.
///
/// Type: long
/// A tomBool value that can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomTrue
/// Right-to-left orientation.
///
/// -
/// tomFalse
/// Left-to-right orientation.
///
/// -
/// tomToggle
/// Toggles the orientation.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setrtl HRESULT SetRTL( [in] long Value );
void SetRTL(tomConstants Value);
/// Gets the vertical alignment of the active cell.
///
/// Type: long*
/// The vertical alignment.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellalignment HRESULT GetCellAlignment( [out, retval]
// long *pValue );
tomConstants GetCellAlignment();
/// Sets the vertical alignment of the active cell.
///
/// Type: long
/// The vertical alignment.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellalignment HRESULT SetCellAlignment( [in] long Value );
void SetCellAlignment(tomConstants Value);
/// Gets the background color of the active cell.
///
/// Type: long*
/// The background color.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellcolorback HRESULT GetCellColorBack( [out, retval]
// long *pValue );
int GetCellColorBack();
/// Sets the background color of the active cell.
///
/// Type: long
/// The background color.
///
/// See ITextRow::GetCellShading to see how the background color is used together with the foreground color.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellcolorback HRESULT SetCellColorBack( [in] long Value );
void SetCellColorBack(int Value);
/// Gets the foreground color of the active cell.
///
/// Type: long*
/// The foreground color.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellcolorfore HRESULT GetCellColorFore( [out, retval]
// long *pValue );
int GetCellColorFore();
/// Sets the foreground color of the active cell.
///
/// Type: long
/// The foreground color.
///
/// See ITextRow::GetCellShading to see how the foreground color is used together with the background color.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellcolorfore HRESULT SetCellColorFore( [in] long Value );
void SetCellColorFore(int Value);
/// Gets the merge flags of the active cell.
///
/// Type: long*
/// The merge flag of the active cell. The flag can be one of the following:
/// tomHContCell
/// tomHStartCell
/// tomVLowCell
/// tomVTopCell
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellmergeflags HRESULT GetCellMergeFlags( [out, retval]
// long *pValue );
tomConstants GetCellMergeFlags();
/// Sets the merge flags of the active cell.
///
/// Type: long
/// The merge flag. It can be one of these values.
/// tomHContCell
/// tomHStartCell
/// tomVLowCell
/// tomVTopCell
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellmergeflags HRESULT SetCellMergeFlags( [in] long
// Value );
void SetCellMergeFlags(tomConstants Value);
/// Gets the shading of the active cell.
///
/// Type: long*
/// The shading of the active cell. See Remarks.
///
///
/// The shading is given in hundredths of a percent, so full shading is given by the value 10000. The shading percentage determines
/// the mix of the cell foreground and background colors to be used for the cell background. A shading of 0 uses the cell background
/// color alone. A shading of 10000 (100%) uses the foreground color alone. Values in between mix the foreground and background
/// colors, weighting the background with (10000 â CellShading)/1000 and the foreground with CellShading/1000. These ratios are
/// applied to the red, green, and blue channels independently of one another.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellshading HRESULT GetCellShading( [out, retval] long
// *pValue );
int GetCellShading();
/// Sets the shading of the active cell.
///
/// Type: long
/// The shading of the active cell.
///
///
/// The shading is given in hundredths of a percent, so full shading is given by the value 10000. The shading percentage determines
/// the mix of the cell foreground and background colors to be used for the cell background. A shading of 0 uses the cell background
/// color alone. A shading of 10000 (100%) uses the foreground color alone. Values in between mix the foreground and background
/// colors, weighting the background with (10000 â CellShading)/1000 and the foreground with CellShading/1000. These ratios are
/// applied to the red, green, and blue channels independently of one another.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellshading HRESULT SetCellShading( [in] long Value );
void SetCellShading(int Value);
/// Gets the vertical-text setting of the active cell.
///
/// Type: long*
/// The vertical-text setting
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellverticaltext HRESULT GetCellVerticalText( [out,
// retval] long *pValue );
tomConstants GetCellVerticalText();
/// Sets the vertical-text setting of the active cell.
///
/// Type: long
/// The vertical setting.
///
/// This property is not currently implemented.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellverticaltext HRESULT SetCellVerticalText( [in] long
// Value );
void SetCellVerticalText(tomConstants Value);
/// Gets the width of the active cell.
///
/// Type: long*
/// The width of the active cell, in twips.
///
/// The width of the cell, and/or the entire row, must be less than 22 inches (1440 x 22).
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellwidth HRESULT GetCellWidth( [out, retval] long
// *pValue );
int GetCellWidth();
/// Sets the active cell width in twips.
///
/// Type: long
/// The width of the active cell.
///
/// The total width of the entire row must be less than 22 inches, or 1440Ã22.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellwidth HRESULT SetCellWidth( [in] long Value );
void SetCellWidth(int Value);
/// Gets the border colors of the active cell.
///
/// Type: long*
/// The active-cell left border color.
///
///
/// Type: long*
/// The active-cell top border color.
///
///
/// Type: long*
/// The active-cell right border color.
///
///
/// Type: long*
/// The active-cell bottom border color.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellbordercolors HRESULT GetCellBorderColors( [in] long
// *pcrLeft, [in] long *pcrTop, [in] long *pcrRight, [in] long *pcrBottom );
void GetCellBorderColors(out int pcrLeft, out int pcrTop, out int pcrRight, out int pcrBottom);
/// Gets the border widths of the active cell.
///
/// Type: long*
/// The active-cell left border width.
///
///
/// Type: long*
/// The active-cell top border width.
///
///
/// Type: long*
/// The active-cell right border width.
///
///
/// Type: long*
/// The active-cell bottom border width.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getcellborderwidths HRESULT GetCellBorderWidths( [in] long
// *pduLeft, [in] long *pduTop, [in] long *pduRight, [in] long *pduBottom );
void GetCellBorderWidths(out int pduLeft, out int pduTop, out int pduRight, out int pduBottom);
/// Sets the border colors of the active cell.
///
/// Type: long
/// The left border color.
///
///
/// Type: long
/// The top border color.
///
///
/// Type: long
/// The right border color.
///
///
/// Type: long
/// The bottom border color.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellbordercolors HRESULT SetCellBorderColors( [in] long
// crLeft, [in] long crTop, [in] long crRight, [in] long crBottom );
void SetCellBorderColors(int crLeft, int crTop, int crRight, int crBottom);
/// Sets the border widths of the active cell.
///
/// Type: long
/// The left border width.
///
///
/// Type: long
/// The top border width.
///
///
/// Type: long
/// The right border width.
///
///
/// Type: long
/// The bottom border width.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setcellborderwidths HRESULT SetCellBorderWidths( [in] long
// duLeft, [in] long duTop, [in] long duRight, [in] long duBottom );
void SetCellBorderWidths(int duLeft, int duTop, int duRight, int duBottom);
/// Applies the formatting attributes of this text row object to the specified rows in the associated ITextRange2.
///
/// Type: long
/// The number of rows to apply this text row object to.
///
///
/// Type: long
/// A flag that controls how the formatting attributes are applied. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomCellStructureChangeOnly
///
/// Apply formatting attributes only to cell widths or the cell count (enables you to change column widths or insert/delete columns
/// without changing other properties, such as cell borders).
///
///
/// -
/// tomRowApplyDefault
/// Apply formatting attributes to the full application, not just cell widths and count.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-apply HRESULT Apply( [in] long cRow, [in] long Flags );
void Apply(int cRow, tomConstants Flags);
/// Determines whether changes can be made to this row.
///
/// Type: long*
///
/// A tomBool indicating whether the row can be edited. It is tomTrue only if the row can be edited. The pB parameter
/// can be NULL.
///
///
///
/// The row can be changed only if no part of an associated range is protected and the associated document isn't read only.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-canchange HRESULT CanChange( [out, retval] long *pValue );
tomConstants CanChange();
/// Gets the value of the specified property.
///
/// Type: long
/// The ID of the property to retrieve.
///
///
/// Type: long*
/// The value for the property.
///
/// Currently, no extra properties are defined.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-getproperty HRESULT GetProperty( [in] long Type, [out]
// long *pValue );
int GetProperty(int Type);
/// Inserts a row, or rows, at the location identified by the associated ITextRange2 object.
///
/// Type: long
/// The number of rows to insert.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-insert HRESULT Insert( [in] long cRow );
void Insert(int cRow);
/// Compares two table rows to determine if they have the same properties.
///
/// Type: ITextRow*
/// The row to compare to.
///
///
/// Type: long*
/// The comparison result. The value is set to tomTrue if equal, and tomFalse if not. The value can be NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-isequal HRESULT IsEqual( [in] ITextRow *pRow, [out,
// retval] long *pB );
tomConstants IsEqual([In, Optional] ITextRow? pRow);
/// Resets a row.
///
/// Type: long
/// The tomRowUpdate reset value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-reset HRESULT Reset( [in] long Value );
void Reset(tomConstants Value);
/// Sets the value of the specified property.
///
/// Type: long
/// The ID of the property to set.
///
///
/// Type: long
/// The value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrow-setproperty HRESULT SetProperty( [in] long Type, [in] long
// Value );
void SetProperty(int Type, int Value);
}
/// A text selection is a text range with selection highlighting.
///
///
/// The selection is associated with some kind of view, and has some UI-oriented methods that allow one to emulate keyboard input. Thus,
/// an application can use the ITextRange methods on a text selection, as well as the ITextSelection methods.
///
///
/// For keyboard input emulation, ranges used in selections use the concept of the active end, which is typically the end that was
/// last moved. For example, if an ITextRange::Move* method operates on a range that is actually a text selection, the most
/// recently moved end is the active one. The most familiar examples of the active end are those involving Shift+Arrow Key handling,
/// where the active end is the one that moves. Accordingly, the ITextSelection methods include move methods for the active end,
/// such as MoveLeft or MoveRight, and methods to get and set the active end status. These methods manipulate selections in ways similar
/// to the standard cursor-keypad operations. This allows you to implement, for example, a macro recorder facility.
///
///
/// To see how the cursor-keypad methods work, see the following table. A given method corresponds to a cursor-keypad key with the Ctrl
/// and Shift keys. The Unit parameter is selected by pressing or not pressing the Ctrl key, while the Extend parameter is
/// selected by pressing or not pressing the Shift key. Note, MoveUp and MoveDown correspond to more than one keypad key. For more
/// information, see the descriptions of the methods.
///
///
///
/// Method
/// Cursor-keypad key
/// Unit given by CTRL pressed (not pressed)
/// Extend given by SHIFT pressed (not pressed)
///
/// -
/// EndKey
/// End
/// tomStory (tomLine)
/// tomExtend (tomMove)
///
/// -
/// HomeKey
/// Home
/// tomStory (tomLine)
/// tomExtend (tomMove)
///
/// -
/// MoveLeft
/// Left Arrow
/// tomWord (tomCharacter)
/// tomExtend (tomMove)
///
/// -
/// MoveRight
/// Right Arrow
/// tomWord (tomCharacter)
/// tomExtend (tomMove)
///
/// -
/// MoveUp
/// Up Arrow
/// tomParagraph (tomLine)
/// tomExtend (tomMove)
///
/// -
/// MoveDown
/// Down Arrow
/// tomParagraph (tomLine)
/// tomExtend (tomMove)
///
/// -
/// MoveUp
/// Page Up
/// tomWindow (tomScreen)
/// tomExtend (tomMove)
///
/// -
/// MoveDown
/// Page Down
/// tomWindow (tomScreen)
/// tomExtend (tomMove)
///
///
/// Â
///
/// Applications typically do not implement the ITextSelection interface. Instead, Microsoft text solutions such as rich edit
/// controls implement ITextSelection as part of their Text Object Model (TOM) implementation.
///
/// Applications can retrieve an ITextSelection pointer by calling the GetSelection method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextselection
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextSelection")]
[ComImport, Guid("8CC497C1-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)]
public interface ITextSelection : ITextRange
{
/// Gets the plain text in this range. The Text property is the default property of the ITextRange interface.
///
/// Type: BSTR*
/// The text.
///
///
///
/// The ITextRange::GetText method returns the plain text in the range. The Text property is the default property for
/// ITextRange; this is, it is automatically invoked for a range, as in the following Microsoft Visual Basic for Applications (VBA) example.
///
///
/// Some of the examples below use this fact. The ITextRange::SetText method substitutes bstr for the range text. For
/// processing a single character, the Char property is more efficient than the Text property and does not require creating a single
/// character range for storing a character. If the range is degenerate, the Text property lets you insert text easily. You can also
/// delete the text in a range, as shown in the following VBA examples.
///
///
/// You can use the Text property to copy plain text from one place to another, simply by setting one range equal to another.
/// (This is quite different from the Duplicate property; for more information, see ITextRange::GetDuplicate). The following
/// Microsoft Visual Basic example statement sets the text in the range1 to that in range2.
///
///
/// The ranges can be in different stories or even in different applications. However, they do imply copying the text first into a
/// BSTR and then from that string to the target location. For large amounts of text, the ITextRange::Copy and
/// ITextRange::Paste methods can be faster, since they can perform the copy directly from source to target and with any format
/// supported by the source and target.
///
///
/// The text returned by the Text property is given in Unicode. The end-of-paragraph mark may be given by 0x2029 (the Unicode
/// Paragraph Separator), or by carriage return/line feed (CR/LF) (0xd, 0xa), or by a carriage return alone, depending on the
/// original file. Microsoft Word uses a carriage return alone, unless it reads another choice in from a file, the clipboard, or an
/// IDataObject. The placeholder for an embedded object is given by the special character, WCH_EMBEDDING, which has the
/// Unicode value 0xFFFC.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-gettext HRESULT GetText( BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
new string GetText();
/// Sets the text in this range.
///
/// Type: BSTR
/// Text that replaces the current text in this range. If null, the current text is deleted.
///
///
///
/// ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with
/// the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed
/// the text in. For UI selection behavior, see TypeText.
///
///
/// If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the
/// ITextRange::SetText method (unless some other range has changed that text in between the calls).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-settext HRESULT SetText( [in] BSTR bstr );
new void SetText([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Gets the character at the start position of the range.
///
/// Type: long*
/// The start character position of the range.
///
///
/// The following Microsoft Visual Basic example sets ch equal to the character at the start of the range.
///
/// Similarly, ITextRange::SetChar overwrites the character at the start of the range with the specified character. The characters
/// retrieved and set by these methods are LONG variables, which hide the way that they are stored in the backing store (as
/// bytes, words, variable-length, and so forth), and they do not require using a BSTR.
///
/// The Char property, which can do most things that a characters collection can, has two big advantages:
///
/// -
/// It can reference any character in the parent story instead of being limited to the parent range.
///
/// -
/// It is significantly faster, since LONG s are involved instead of range objects.
///
///
/// Accordingly, the Text Object Model (TOM) does not support a characters collection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getchar HRESULT GetChar( long *pChar );
new int GetChar();
/// Sets the character at the starting position of the range.
///
/// Type: long
/// New value for character at the starting position.
///
///
///
/// ITextRange::SetChar lets you specify the precise character code to use. However, string literals with similar looking
/// glyphs can be misleading.
///
///
/// The characters set by this method are LONG instead of a BSTR. This hides the way that they are stored in the
/// backing store, (as bytes, words, variable-length, and so forth).
///
///
/// Frequently on systems that do not have automatic word-wrapping, documents have hard carriage returns inserted just for line
/// breaks. The following code shows a simple, but not perfect, way to convert such hard carriage returns back to blanks for the
/// story that is associated with the range r.
///
/// Alternatively, you could use the following inside the IF loop.
///
/// This approach enables you to wrap the text to other widths. However, the algorithm isn't perfect: it assumes that a hard carriage
/// return that is followed by anything other than white space (blank, tab, line feed, carriage return, and so forth) should be
/// replaced by a blank. The algorithm also assumes that the carriage return character is a single character like carriage return or
/// the Unicode end-of-paragraph (EOP) 0x2029 character. And, the combination carriage return and line feed isn't matched and would
/// require writing and executing more code (or use ). Another caution is that there are other cases, such as mixed code and
/// documentation, where the algorithm does not work correctly.
///
///
/// However, ITextRange::SetChar is more efficient than a replace operation that is accomplished by a delete followed by an
/// insertion. Thus, rewriting the code without using ITextRange::SetChar would probably be much slower.
///
///
/// The Char property, which can do most things that a characters collection can, has two big advantages: it can reference any
/// character in the parent story instead of being limited to the parent range, and it's significantly faster, since LONG s
/// rather than range objects are involved. Because of these advantages, the Text Object Model (TOM) does not support a characters collection.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setchar HRESULT SetChar( long Char );
new void SetChar(int Char);
/// Gets a duplicate of this range object.
///
/// Type: ITextRange**
/// The duplicate of the range.
///
///
///
/// To create an insertion point in order to traverse a range, first duplicate the range and then collapse the duplicate at its start
/// character position. Note, a range is characterized by start and end character positions, and the story it belongs to.
///
///
/// Even if the range is actually an ITextSelection, the duplicate returned is an ITextRange. For an example, see the
/// ITextRange::FindText method.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getduplicate HRESULT GetDuplicate( ITextRange **ppRange );
new ITextRange GetDuplicate();
/// Gets an ITextRange object with the specified range's formatted text.
///
/// Type: ITextRange**
/// The ITextRange object with the formatted text.
///
///
///
/// This method, which amounts to an alias for the ITextRange::GetDuplicate method, is included to be Microsoft Visual Basic for
/// Applications (VBA)-friendly. The method returns the formatted text in a range. If the ITextRange does not belong to the same Text
/// Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be
/// used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in a range2, by the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getformattedtext HRESULT GetFormattedText( ITextRange
// **ppRange );
new ITextRange GetFormattedText();
/// Sets the formatted text of this range text to the formatted text of the specified range.
///
/// Type: ITextRange*
/// The formatted text to replace this range's text.
///
///
///
/// If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by the IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to
/// reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in range2 with the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setformattedtext HRESULT SetFormattedText( [in]
// ITextRange *pRange );
new void SetFormattedText([In, Optional] ITextRange? pRange);
/// Gets the start character position of the range.
///
/// Type: long*
/// The start character position.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstart HRESULT GetStart( long *pcpFirst );
new int GetStart();
/// Sets the character position for the start of this range.
///
/// Type: long
/// The new character position for the start of the range.
///
///
///
/// Note that if cpFirst is greater than the range's end position, this method sets the end position equal to cpFirst,
/// making the range an insertion point. If this range is the selection, the start position becomes the active end and is scrolled
/// into view if the display isn't frozen.
///
///
/// ITextRange::SetEnd sets the range's end position, and ITextRange::SetRange sets both range ends simultaneously. The following
/// example shows how to convert a nondegenerate range into a degenerate one (insertion point).
///
/// Similarly, converts the range into an insertion point at the end position.
/// The following example adds 1 to the end position, if it is not at the end of the story.
/// This also makes the end position the active end of the range, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setstart HRESULT SetStart( [in] long cpFirst );
new void SetStart(int cpFirst);
/// Gets the end character position of the range.
///
/// Type: long*
/// The end character position.
///
///
///
/// Although a pointer to a range remains valid when the text is edited, this is not the case for the character position. A character
/// position is volatile; that is, it becomes invalid as soon as text is inserted or deleted before the character position. Be
/// careful about using methods that return character position values, especially if the values are to be stored for any duration.
///
/// This method is similar to the ITextRange::GetStart method which gets the start character position of the range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getend HRESULT GetEnd( long *pcpLim );
new int GetEnd();
/// Sets the end position of the range.
///
/// Type: long
/// The new end position.
///
///
///
/// If the new end position is less than the start position, this method also sets the start position to cp; that is, the
/// range becomes an insertion point.
///
///
/// If this range is actually the selection, the end position becomes the active end and, if the display is not frozen, it is
/// scrolled into view.
///
///
/// ITextRange::SetStart sets the range's start position and ITextRange::SetRange sets both range ends simultaneously. To convert a
/// nondegenerate range, r, into a degenerate one (insertion point) at the start position, use
///
/// Similarly, r.Start = r.End converts r into an insertion point at the end position.
/// To add 1 to the end position, unless it is at the end of the story, use:
/// This also makes end position the active end, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setend HRESULT SetEnd( long cpLim );
new void SetEnd(int cpLim);
/// Gets an ITextFont object with the character attributes of the specified range.
///
/// Type: ITextFont**
/// The pointer to an ITextFont object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextFont for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getfont HRESULT GetFont( ITextFont **ppFont );
new ITextFont GetFont();
/// Sets this range's character attributes to those of the specified ITextFont object.
///
/// Type: ITextFont*
/// A font object with the desired character format.
///
///
/// For occasional format changes, use the ITextRange::SetFont method. However, to make a number of character formatting
/// changes, it is more efficient to use a font duplicate. This is because every time you execute a statement like range.font.bold
/// = tomTrue, a font object is allocated and freed. However, a font duplicate can be allocated once and used many times.
/// Furthermore, you can save the font duplicate, reset it to the default or undefined states with the Reset method, and give it
/// values as needed for your rich-text processing. For sample code that shows how to use font duplicates, see Using a Font Duplicate.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setfont HRESULT SetFont( [in] ITextFont *pFont );
new void SetFont([In, Optional] ITextFont? pFont);
/// Gets an ITextPara object with the paragraph attributes of the specified range.
///
/// Type: ITextPara**
/// The pointer to the ITextPara object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextPara for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpara HRESULT GetPara( ITextPara **ppPara );
new ITextPara GetPara();
/// Sets the paragraph attributes of this range to those of the specified ITextPara object.
///
/// Type: ITextPara*
/// The paragraph object with the desired paragraph format.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpara HRESULT SetPara( [in] ITextPara *pPara );
new void SetPara([In, Optional] ITextPara? pPara);
/// Gets the count of characters in the range's story.
///
/// Type: long*
/// The count of characters in the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorylength HRESULT GetStoryLength( long *pCount );
new int GetStoryLength();
/// Get the type of the range's story.
///
/// Type: long*
/// The type of the range's story. The pValue value can be one of the following values.
///
///
/// Story type
/// Value
/// Story type
/// Value
///
/// -
/// tomUnknownStory
/// 0
/// tomEvenPagesHeaderStory
/// 6
///
/// -
/// tomMainTextStory
/// 1
/// tomPrimaryHeaderStory
/// 7
///
/// -
/// tomFootnotesStory
/// 2
/// tomEvenPagesFooterStory
/// 8
///
/// -
/// tomEndnotesStory
/// 3
/// tomPrimaryFooterStory
/// 9
///
/// -
/// tomCommentsStory
/// 4
/// tomFirstPageHeaderStory
/// 10
///
/// -
/// tomTextFrameStory
/// 5
/// tomFirstPageFooterStory
/// 11
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorytype HRESULT GetStoryType( long *pValue );
new tomConstants GetStoryType();
/// Collapses the specified text range into a degenerate point at either the beginning or end of the range.
///
/// Type: long
/// Flag specifying the end to collapse at. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomStart or tomTrue
/// Range is collapsed to the start of the range. This is the default.
///
/// -
/// tomEnd or tomFalse
/// Range is collapsed to the end of the range.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-collapse HRESULT Collapse( [in] long bStart );
new void Collapse(tomConstants bStart);
/// Expands this range so that any partial units it contains are completely contained.
///
/// Type: long
///
/// Unit to include, if it is partially within the range. The default value is . For a list of the other Unit values, see the
/// discussion under ITextRange.
///
///
///
/// Type: long*
/// The count of characters added to the range. The value can be null.
///
///
/// For example, if an insertion point is at the beginning, the end, or within a word, ITextRange::Expand expands the range to
/// include that word. If the range already includes one word and part of another, ITextRange::Expand expands the range to
/// include both words. ITextRange::Expand expands the range to include the visible portion of the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-expand HRESULT Expand( long Unit, long *pDelta );
new int Expand(int Unit);
///
/// Retrieves the story index of the Unit parameter at the specified range Start character position. The first Unit in
/// a story has an index value of 1. The index of a Unit is the same for all character positions from that immediately
/// preceding the Unit up to the last character in the Unit.
///
///
/// Type: long
/// Unit that is indexed. For a list of possible Unit values, see the discussion under ITextRange.
///
///
/// Type: long*
/// The index value. The value is zero if Unit does not exist.
///
///
///
/// The ITextRange::GetIndex method retrieves the story index of a word, line, sentence, paragraph, and so forth, at the range
/// Start. Unit specifies which kind of entity to index, such as words ( tomWord), lines ( tomLine), sentences (
/// tomSentence), or paragraphs ( tomParagraph). For example, ITextRange::GetIndex sets pIndex equal to
/// the line number of the first line in the range. For a range at the end of the story, ITextRange::GetIndex, returns the
/// number of Unit s in the story. Thus, you can get the number of words, lines, objects, and so forth, in a story.
///
///
/// The index value returned by the ITextRange::GetIndex method is not valid if the text is subsequently edited. Thus, users
/// should be careful about using methods that return index values, especially if the values are to be stored for any duration. This
/// is in contrast to a pointer to a range, which does remain valid when the text is edited.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getindex HRESULT GetIndex( long Unit, long *pIndex );
new int GetIndex(int Unit);
/// Changes this range to the specified unit of the story.
///
/// Type: long
/// Unit used to index the range. For a list of unit values, see ITextRange.
///
///
/// Type: long
///
/// Index for the Unit. This range is relocated to the Unit that has this index number. If positive, the numbering of
/// Unit s begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story
/// and proceeds backward. The start of the story corresponds to an Index of 1 for all units that exist, and the last unit in
/// the story corresponds to an Index of -1.
///
///
///
/// Type: long
///
/// Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start
/// position of the specified Unit. If nonzero, the range is set to the entire Unit.
///
///
///
/// This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, converts a
/// range to an insertion point at the start of the tenth line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setindex HRESULT SetIndex( [in] long Unit, [in] long
// Index, [in] long Extend );
new void SetIndex(int Unit, int Index, int Extend);
/// Adjusts the range endpoints to the specified values.
///
/// Type: long
/// The character position for the anchor end of the range.
///
///
/// Type: long
/// The character position for the active end of the range.
///
///
///
/// This method sets the range's start position to , and the end position to . If the range is a nondegenerate selection,
/// cpAnchor is the active end, and cpAnchor is the anchor end. If the range is a degenerate selection, the selection
/// is displayed at the start of the line, rather than at the end of the previous line.
///
/// This method removes any other subranges this range may have. To preserve the current subranges, use ITextRange2::SetActiveSubrange.
/// If the text range is a selection, you can set the attributes of the selection by using the ITextSelection::SetFlags method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setrange HRESULT SetRange( long cpAnchor, long cpActive );
new void SetRange(int cpAnchor, int cpActive);
/// Determines whether this range is within or at the same text as a specified range.
///
/// Type: ITextRange*
/// Text that is compared to the current range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The method returns pB is tomTrue only if the range is in or at the
/// same text as pRange.
///
///
///
///
/// For range2 to be contained in range1, both ranges must be in the same story, and the limits of range2 must satisfy either of the
/// following statements.
///
///
/// -
///
/// The start and end character positions of range1 are the same as range2. That is, both ranges are degenerate and have identical
/// insertion points.
///
///
/// -
/// Range2 is a nondegenerate range with start and end character positions at or within those of range1.
///
///
/// The following example shows how to walk one range with another.
///
/// When the ITextRange::FindText, ITextRange::MoveWhile, and ITextRange::MoveUntil method families are used, you can use one range
/// to walk another by specifying the appropriate limit count of characters (for an example, see the Remarks in ITextRange::Find).
///
///
/// ITextRange::IsEqual is a special case of ITextRange::InRange that returns pBtomTrue if the pRange has
/// the same start and end character positions and belongs to the same story.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-inrange HRESULT InRange( ITextRange *pRange, long
// *pValue );
new tomConstants InRange([In, Optional] ITextRange? pRange);
/// Determines whether this range's story is the same as a specified range's story.
///
/// Type: ITextRange*
/// The ITextRange object whose story is compared to this range's story.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range's story is the same
/// as that of the pRange; otherwise it receives tomFalse.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-instory HRESULT InStory( ITextRange *pRange, long
// *pValue );
new tomConstants InStory([In, Optional] ITextRange? pRange);
/// Determines whether this range has the same character positions and story as those of a specified range.
///
/// Type: ITextRange*
/// The ITextRange object that is compared to this range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range points at the same
/// text (has the same start and end character positions and story) as pRange; otherwise it returns tomFalse.
///
///
///
/// The ITextRange::IsEqual method returns tomTrue only if the range points at the same text as pRange. See
/// Finding Rich Text for code that compares two different pieces of text to see if they contain the same plain text and the same
/// character formatting.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-isequal HRESULT IsEqual( ITextRange *pRange, long
// *pValue );
new tomConstants IsEqual([In, Optional] ITextRange? pRange);
/// Sets the start and end positions, and story values of the active selection, to those of this range.
///
/// The active end of the new selection is at the end position.
/// The caret for an ambiguous character position is displayed at the beginning of the line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-select HRESULT Select();
new void Select();
/// Moves the range ends to the start of the first overlapping Unit in the range.
///
/// Type: long
/// Unit to use in the move operation. For a list of Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// How to move the ends of the range. It can be one of the following values.
///
///
/// 0 (or tomMove)
/// Collapses a nondegenerate range to the start position by moving the insertion point. This is the default.
///
/// -
/// 1 (or tomExtend)
/// Moves the start position to the beginning of the overlapping Unit. Does not move the end position.
///
///
///
///
/// Type: long*
///
/// Pointer to a variable that receives the number of characters that the start position is moved. It can be null. On return,
/// pDelta is the signed number of characters that the insertion point or start position is moved. This value is always less
/// than or equal to zero, because the motion is always toward the beginning of the story.
///
///
///
///
/// If the range is an insertion point on a boundary between Unit s, ITextRange::StartOf does not change the start position.
///
///
/// The ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend
/// from the active end, whereas ITextRange::StartOf extends from the start position and ITextRange::EndOf extends from
/// the end position.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-startof HRESULT StartOf( long Unit, long Extend, long
// *pDelta );
new tomConstants StartOf(tomConstants Unit, tomConstants Extend);
/// Moves this range's ends to the end of the last overlapping Unit in the range.
///
/// Type: long
/// Unit to use. Default value: tomWord. For a list of the other Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// Indicator of how the shifting of the range ends is to proceed. It can be one of the following.
///
///
/// 0 or tomMove
///
/// Collapses a nondegenerate range to the End of the original range by moving the insertion point. This is the default.
///
///
/// -
/// 1 (or tomExtend)
/// Moves End to the end of the overlapping Unit. Does not move Start.
///
///
///
///
/// Type: long*
///
/// The count of characters that End is moved past. The value of the pointer can be null. On return, the value of pDelta is
/// the number of characters the insertion point or End is moved plus 1 if a collapse occurs to the entry End. If the range
/// includes the final CR (carriage return) (at the end of the story) and Extend = tomMove, then pDelta is set to â1,
/// to indicate that the collapse occurred before the end of the range (because an insertion point cannot exist beyond the
/// final CR).
///
///
///
/// For comparison, the ITextRange::StartOf method moves the range ends to the beginning of the first overlapping Unit in the
/// range. Note, the ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in
/// that the latter extend from the active end, whereas ITextRange::StartOf extends from Start and ITextRange::EndOf
/// extends from End. If the range is an insertion point on a boundary between Unit s, ITextRange::EndOf does not
/// change End. In particular, calling ITextRange::EndOf ( tomCharacter, *, *) does not change End except for an
/// insertion point at the beginning of a story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-endof HRESULT EndOf( long Unit, long Extend, long
// *pDelta );
new tomConstants EndOf(tomConstants Unit, tomConstants Extend);
///
/// Moves the insertion point forward or backward a specified number of units. If the range is nondegenerate, the range is collapsed
/// to an insertion point at either end, depending on Count, and then is moved.
///
///
/// Type: long
/// Unit to use. The default value is tomCharacter. For information on other values, see the discussion in ITextRange.
///
///
/// Type: long
///
/// Number of Unit s to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward
/// the end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero,
/// the range is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of Unit s the insertion point moves past. The pointer can be NULL. For more information, see the
/// Remarks section.
///
///
///
///
/// If the range is degenerate (an insertion point), this method tries to move the insertion point Count  Unit s.
///
///
/// If the range is nondegenerate and Count is greater than zero, this method collapses the range at the end character
/// position, moves the resulting insertion point forward to a Unit boundary (if it is not already at one), and then tries to
/// move Count - 1 Unit s forward. If the range is nondegenerate and Count is less than zero, this method
/// collapses the range at the start character position, moves the resulting insertion point backward to a Unit boundary (if
/// it isn't already at one), and then tries to move | Count| - 1 Unit s backward. Thus, in both cases, collapsing a
/// nondegenerate range to an insertion point, whether moving to the start or end of the Unit following the collapse, counts
/// as a Unit.
///
///
/// The ITextRange::Move method returns pDelta = number of Unit s actually moved. This method never moves the
/// insertion point beyond the story of this range. If CountUnit s would move the insertion point before the beginning
/// of the story, it is moved to the story beginning and pDelta is set accordingly. Similarly, if Count  Unit s
/// would move it beyond the end of the story, it is moved to the story end.
///
///
/// The ITextRange::Move method works similarly to the UI-oriented MoveLeft and MoveRight methods, except that the direction
/// of motion is logical rather than geometrical. That is, with ITextRange::Move the direction is either toward the end or
/// toward the start of the story. Depending on the language, moving toward the end of the story could be moving to the left or to
/// the right. To get a feel for Count, press Ctrl+Right Arrow in a Microsoft Word document for a variety of selections. In
/// left-to-right text, this keystroke behaves the same as , and . Count corresponds to the number of times you press
/// Ctrl+Right Arrow.
///
///
/// For example, if you press Ctrl+Right Arrow for the selections shown in both of the following figures, you end up with an
/// insertion point at character position 8, since this command collapses the selections at their end character positions (7 and 8,
/// respectively) and moves to the next tomWord boundary.
///
///
/// The first selection does not include the blank space at character position 7, so Ctrl+Right Arrow moves past the space to the
/// tomWord boundary at character position 8. The end character position is already at a tomWord boundary for the
/// second selection, so Ctrl+Right Arrow just collapses the selection at that boundary. Similarly, Ctrl+Left Arrow, which for this
/// text acts like , and collapses the first selection at character position 5, which is already at a tomWord boundary, so no
/// more motion occurs. But Ctrl+Left Arrow collapses the second selection at character position 4 and then moves to zero, since
/// that's the next tomWord boundary in the direction of motion.
///
///
/// The return argument, pDelta, is set equal to the number of Unit s that the insertion point is moved including one
/// Unit for collapsing a nondegenerate range and moving it to a Unit boundary. So, if no motion and no collapse occur,
/// as when the range is an insertion point at the end of the story, pDelta is set equal to zero. This approach is useful for
/// controlling program loops that process a whole story.
///
///
/// In both of the cases mentioned above, calling sets pDelta equal to 1 because the ranges were collapsed. Similarly, calling
/// sets pDelta equal to -1 for both cases. Collapsing, with or without moving part of a Unit to a Unit
/// boundary, counts as a Unit moved.
///
///
/// The direction of motion refers to the logical character ordering in the plain-text backing store. This approach avoids the
/// problems of geometrical ordering, such as left versus right and up versus down, in international software. Such geometrical
/// methods are still needed in the edit engine, of course, since keyboards have arrow keys to invoke them. If the range is really an
/// ITextSelection object, then methods like MoveLeft and MoveRight can be used.
///
///
/// If Unit specifies characters ( tomCharacter), the Text Object Model (TOM) uses the Unicode character set. To
/// convert between Unicode and multibyte character sets the MultiByteToWideChar and WideCharToMultiByte functions provide easy ways
/// to convert between Unicode and multibyte character sets on import and export, respectively. For more information, see Open. In
/// this connection, the use of a carriage return/line feed (CR/LF) to separate paragraphs is as problematic as double-byte character
/// set (DBCS). The ITextSelection UI methods back up over a CR/LF as if it were a single character, but the ITextRange::Move
/// methods count CR/LFs as two characters. It's clearly better to use a single character as a paragraph separator, which in TOM is
/// represented by a character return, although the Unicode paragraph separator character, 0x2029, is accepted. In general, TOM
/// engines should support CR/LF, carriage return (CR), line feed (LF), vertical tab, form feed, and 0x2029. Microsoft Rich Edit 2.0
/// also supports CR/CR/LF for backward compatibility.
///
///
/// See also the ITextRange::MoveStart and ITextRange::MoveEnd methods, which move the range Start or End position Count Â
/// Unit s, respectively.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-move HRESULT Move( long Unit, long Count, long *pDelta );
new tomConstants Move(tomConstants Unit, int Count);
/// Moves the start position of the range the specified number of units in the specified direction.
///
/// Type: long
///
/// Unit used in the move. The default value is tomCharacter. For a list of the other Unit values, see the discussion
/// under ITextRange.
///
///
///
/// Type: long
///
/// Number of units to move. The default value is 1. If Count is greater than zero, motion is forwardâtoward the end of the
/// storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the start
/// position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end is moved. The value can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStart is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestart HRESULT MoveStart( long Unit, long Count, long
// *pDelta );
new tomConstants MoveStart(tomConstants Unit, int Count);
/// Moves the end position of the range.
///
/// Type: long
///
/// The units by which to move the end of the range. The default value is tomCharacter. For a list of the other unit values,
/// see ITextRange.
///
///
///
/// Type: long
///
/// The number of units to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward the
/// end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the
/// end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end position of the range is moved past. The value can be null.
///
///
///
/// If the new end position precedes the old start position, the new start position is set equal to the new end position; that is, it
/// becomes a degenerate range or an insertion point.
///
///
/// The motion described by ITextRange::MoveEnd is logical rather than geometric. That is, motion is toward the end or toward
/// the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveend HRESULT MoveEnd( long Unit, long Count, long
// *pDelta );
new tomConstants MoveEnd(tomConstants Unit, int Count);
///
/// Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the
/// number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching
/// character is found.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search starts at the start position and goes backward â toward the beginning of the story.
/// If Count is greater than zero, the search starts at the end position and goes forward â toward the end of the story.
///
///
///
/// Type: long*
/// The actual count of characters end is moved. This parameter can be null.
///
///
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the
/// start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveWhile method is similar to ITextRange::MoveUntil, but MoveWhile searches as long as it finds
/// members of the set specified by Cset, and there is no additional increment to the value pDelta.
///
///
/// The ITextRange::MoveStartWhile and ITextRange::MoveEndWhile methods move the start and end, respectively, just past all
/// contiguous characters that are found in set of characters specified by the Cset parameter.
///
///
/// The VARIANT type is primarily intended to be used with IDispatch scenarios like Microsoft Visual Basic for
/// Applications (VBA), but it can be readily used from C or C++ as well. The following C++ code illustrates how to initialize and
/// use the VARIANT argument for matching a span of digits in the range r.
///
/// Alternatively, an explicit string could be used, as in the following sample.
///
/// The following VBA example code matches the body of the next Standard Generalized Markup Language (SGML) entry in a range, r. SGML
/// entries start with < > and end with </ >.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movewhile HRESULT MoveWhile( VARIANT *Cset, long Count,
// long *pDelta );
new int MoveWhile([In] object Cset, int Count);
///
/// Moves the start position of the range either Count characters, or just past all contiguous characters that are found in
/// the set of characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
/// The actual count of characters that the start position is moved. This parameter can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartwhile HRESULT MoveStartWhile( VARIANT *Cset,
// long Count, long *pDelta );
new int MoveStartWhile([In] object Cset, int Count);
///
/// Moves the end of the range either Count characters or just past all contiguous characters that are found in the set of
/// characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of characters that the end is moved. The value can be null.
///
///
/// If the new end precedes the old start, the new start is set equal to the new end.
///
/// The motion described by ITextRange::MoveEndWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveendwhile HRESULT MoveEndWhile( VARIANT *Cset, long
// Count, long *pDelta );
new int MoveEndWhile([In] object Cset, int Count);
///
/// Searches up to Count characters for the first character in the set of characters specified by Cset. If a character
/// is found, the range is collapsed to that point. The start of the search and the direction are also specified by Count.
///
///
/// Type: VARIANT*
///
/// The character set used in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search is backward starting at the start position. If Count is greater than zero, the
/// search is forward starting at the end.
///
///
///
/// Type: long*
///
/// The number of characters the insertion point is moved, plus 1 for a match if Count is greater than zero, and â1 for a
/// match if Count less than zero. The pointer can be null.
///
///
///
/// If no character is matched, the range is unchanged.
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveStartUntil and ITextRange::MoveEndUntil methods move the start and end, respectively, until it finds the
/// first character that is also in the set specified by the Cset parameter.
///
///
/// The ITextRange::MoveUntil method is similar to ITextRange::MoveWhile, but there are two differences. First,
/// MoveUntil moves an insertion point until it finds the first character that belongs to the character set specified
/// by Cset. Second, in MoveUntil the character matched counts as an additional character in the value returned in
/// pDelta. This lets you know that the character at one end of the range or the other belongs to the Cset even though
/// the insertion point stays at one of the range ends.
///
///
/// For example, suppose the range, r, is an insertion point. To see if the character at r (that is, given by r.GetChar()) is in
/// Cset, call
///
///
/// If the character is in Cset, the return value is 1 and the insertion point does not move. Similarly, to see if the
/// character preceding r is in Cset, call
///
/// If the character is in Cset, the return value is â1.
///
/// The following Microsoft Visual Basic for Applications (VBA) subroutine prints all numbers in the story identified by the range, r.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveuntil HRESULT MoveUntil( VARIANT *Cset, long Count,
// long *pDelta );
new int MoveUntil([In] object Cset, int Count);
///
/// Moves the start position of the range the position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the start position.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters the start of the range is moved, plus 1 for a match if Count is greater than zero, and
/// â1 for a match if Count is less than zero. The value can be null.
///
///
///
/// If no character from Cset is found within Count positions of the start position, the range is left unchanged.
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartuntil HRESULT MoveStartUntil( VARIANT *Cset,
// long Count, long *pDelta );
new int MoveStartUntil([In] object Cset, int Count);
///
/// Moves the range's end to the character position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the range's end.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters that the range end is moved, plus 1 for a match if Count is greater than zero, and â1
/// for a match if Count is less than zero. The value can be null.
///
///
///
///
/// If no character from the set specified by Cset is found within Count positions of the range's end, the range is
/// left unchanged. If the new end precedes the old start, the new start is set equal to the new end.
///
///
/// The motion described by ITextRange::MoveEndUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveenduntil HRESULT MoveEndUntil( VARIANT *Cset, long
// Count, long *pDelta );
new int MoveEndUntil([In] object Cset, int Count);
///
/// Searches up to Count characters for the text given by bstr. The starting position and direction are also specified
/// by Count, and the matching criteria are given by Flags.
///
///
/// Type: BSTR
/// String to find.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Searches to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
///
/// Searches forward for n chars, starting from cpFirst. If the range itself matches bstr, another search is
/// attempted from cpFirst + 1.
///
///
/// -
/// n(less than 0)
///
/// Searches backward for n chars, starting from cpLim. If the range itself matches bstr, another search is
/// attempted from cpLim â 1.
///
///
/// -
/// 0 (degenerate range)
/// Search begins after the range.
///
/// -
/// 0 (nondegenerate range)
/// Search is limited to the range.
///
///
/// Â
///
/// In all cases, if a string is found, the range limits are changed to be those of the matched string and pLength is set
/// equal to the length of the string. If the string is not found, the range remains unchanged and pLength is set equal to zero.
///
///
///
/// Type: long
/// Flags governing comparisons. It can be 0 (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
///
///
/// The ITextRange::FindText method can also match special characters by using a caret (^) followed by a special letter. For a
/// list of special characters, see the Special list available in the Microsoft Word Find and Replace dialog box. For
/// example, matches the next paragraph mark. Note, can be used to represent the Clipboard contents in the string to be replaced.
/// Thus, using in the find string enables you to search for rich text. For more details, see the Word Help files.
///
///
/// As a comparison with the ITextRange::FindText method, the ITextRange::FindTextStart method searches forward or backward
/// from the range's Start cp, and the ITextRange::FindTextEnd method searches forward or backward from the range's End
/// cp. For more details, see the descriptions of these methods.
///
/// The following are several code snippets that show the ITextRange::FindText methods.
///
/// Example #1. The following Microsoft Visual Basic for Applications (VBA) program prints all the /* ... */ comments in a story
/// identified by the range r.
///
///
/// Instead of these comments being printed, they could be inserted into another edit instance and saved to a file, or they could be
/// inserted into separate cells in a table or spreadsheet.
///
/// To print all lines containing one or more occurrences of the word "laser", replace the loop by the following code:
///
/// Example #2. The following program prints a telephone list, given a story that contains an address list. The address list entries
/// are separated by two or more paragraph marks, and each entry has the following form.
///
/// Note the use of the character in the FindText string argument to locate a pair of consecutive paragraph marks.
/// Example #3. The following subroutine replaces all occurrences of the string, str1, in a range by str2:
///
/// Example #4. The following line of code inserts a blank before the first occurrence of a right parenthesis, "(", that follows an
/// occurrence of HRESULT.
///
///
/// To do this for all such occurrences, change the If into a While/Wend loop in the above line of code. This an example of a
/// FIND/REPLACE macro that cannot be run with Find and Replace dialog boxes.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtext HRESULT FindText( BSTR bstr, long Count, long
// Flags, long *pLength );
new int FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting at the range's Start cp ( cpFirst).
/// The search is subject to the comparison parameter, Flags. If the string is found, the Start cp is changed to the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged,
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// The string to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n(greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n(less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing the comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of the matched string.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextstart HRESULT FindTextStart( BSTR bstr, long
// Count, long Flags, long *pLength );
new int FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting from the range's End cp. The search is
/// subject to the comparison parameter, Flags. If the string is found, the End cp is changed to be the end of the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// String to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n (less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextend HRESULT FindTextEnd( BSTR bstr, long Count,
// long Flags, long *pLength );
new int FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
/// Mimics the DELETE and BACKSPACE keys, with and without the CTRL key depressed.
///
/// Type: long
/// Unit to use. Unit can be tomCharacter (the default value) or tomWord.
///
///
/// Type: long
///
/// Number of Unit s to delete. If Count= zero, it deletes the text in the range only. If Count is greater than
/// zero, ITextRange::Delete acts as if the DELETE key was pressed Count times. If Count is less than zero, it
/// acts as if the BACKSPACE key was pressed Count times. The default value is 1. For more information, see the Remarks.
///
///
///
/// Type: long*
///
/// The count of units deleted. It can be null. The pDelta parameter is set equal to the number of Unit s deleted.
/// Deleting the text in a nondegenerate range counts as one Unit.
///
///
///
///
/// If Count = zero, this method deletes the text in the range, that is, it deletes nothing if the range is only an insertion point.
///
///
/// If Count is not zero, and the range is an insertion point (that is, degenerate), | Count| (absolute value of
/// Count) Unit s are deleted in the logical direction given by the sign of Count, where a positive value is the
/// direction toward the end of the story, and a negative value is toward the start of the story.
///
///
/// If Count is not zero, and the range is nondegenerate (contains text), the text in the range is deleted (regardless of the
/// values of Unit and Count), thereby creating an insertion point. Then, | Count| - 1 Â Unit s are
/// deleted in the logical direction given by the sign of Count.
///
///
/// The text in the range can also be deleted by assigning a null string to the range (executing statement r = where r is the range).
/// However, ITextRange::Delete does not require allocating a BSTR.
///
///
/// Deleting the end-of-paragraph mark (CR) results in the special behavior of the Microsoft Word UI. Four cases are of particular interest:
///
///
/// -
///
/// If you delete just the CR but the paragraph includes text, then the CR is deleted, and the following paragraph gets the same
/// paragraph formatting as current one.
///
///
/// -
///
/// If you delete the CR as well as some, but not all, of the characters in the following paragraph, the characters left over from
/// the current paragraph get the paragraph formatting of the following paragraph.
///
///
/// -
/// If you select to the end of a paragraph, but not the whole paragraph, the CR is not deleted.
///
/// -
///
/// If you delete the whole paragraph (from the beginning through the CR), you delete the CR as well (unless it is the final CR in
/// the file).
///
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-delete HRESULT Delete( long Unit, long Count, long
// *pDelta );
new int Delete(tomConstants Unit, int Count);
/// Cuts the plain or rich text to a data object or to the Clipboard, depending on the pVar parameter.
///
/// Type: VARIANT*
///
/// The cut text. pVar->ppunkVal is the out parameter for an IDataObject object, provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-cut HRESULT Cut( VARIANT *pVar );
new void Cut(out object pVar);
/// Copies the text to a data object.
///
/// Type: VARIANT*
///
/// The copied text. pVar->ppunkVal is the out parameter for an IDataObject provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
///
///
/// The ITextRange::Cut, ITextRange::Copy, and ITextRange::Paste methods let you perform the usual Cut, Copy,
/// and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among
/// clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to
/// reference a text solution's own internal rich text formats.
///
///
/// To copy and replace plain text, you can use the ITextRange::GetText and ITextRange::SetText methods. To copy
/// formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the
/// ITextRange::GetFormattedText and ITextRange::SetFormattedText methods, as shown in the following Microsoft Visual Basic example:
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-copy HRESULT Copy( VARIANT *pVar );
new void Copy(out object pVar);
/// Pastes text from a specified data object.
///
/// Type: VARIANT*
/// The IDataObject to paste. However, the contents of the clipboard are used if any of the following are true.
/// pVar is null
/// pVar punkVal is null
/// pVar is not VT_UNKNOWN
/// pVar punkVal does not return an IDataObject when queried for one
///
///
/// Type: long
///
/// The clipboard format to use in the paste operation. Zero is best format, which usually is RTF, but CF_UNICODETEXT and
/// other formats are also possible. The default value is zero. For more information, see Clipboard Formats.
///
///
///
/// Type: HRESULT
///
/// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// E_ACCESSDENIED
/// Destination is write-protected.
///
/// -
/// E_OUTOFMEMORY
/// Destination cannot contain the text to be pasted.
///
///
///
/// For more information, seeITextRange::Copy.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-paste HRESULT Paste( VARIANT *pVar, long Format );
new void Paste([In] object pVar, int Format);
/// Determines if a data object can be pasted, using a specified format, into the current range.
///
/// Type: VARIANT*
/// The IDataObject to be pasted. However, the Clipboard contents are checked for pasting if any of the following are true:
///
/// -
/// pVar is null
///
/// -
/// pVar->punkVal is null
///
/// -
/// pVar->vt is not VT_UNKNOWN
///
/// -
/// pVar->punkVal does not return an IDataObject object when queried for one
///
///
///
///
/// Type: long
///
/// Clipboard format that is used. Zero represents the best format, which usually is RTF, but CF_UNICODETEXT and other formats
/// are also possible. The default value is zero.
///
///
///
/// Type: long*
///
/// A tomBool value that is tomTrue only if the data object identified by pVar can be pasted, using the specified
/// format, into the range. This parameter can null.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canpaste HRESULT CanPaste( VARIANT *pVar, long Format,
// long *pValue );
new tomConstants CanPaste([In] object pVar, int Format);
/// Determines whether the specified range can be edited.
///
/// Type: long*
///
/// A tomBool value indicating whether the range can be edited. It is tomTrue only if the specified range can be edited. The
/// pointer can be null.
///
///
/// The range cannot be edited if any part of it is protected or if the document is read-only.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canedit HRESULT CanEdit( [retval] long *pValue );
new tomConstants CanEdit();
/// Changes the case of letters in this range according to the Type parameter.
///
/// Type: long
/// Type of case change. The default value is tomLower.
///
///
/// Value
/// Meaning
///
/// -
/// tomLowerCase 0
/// Sets all text to lowercase.
///
/// -
/// tomUpperCase 1
/// Sets all text to lowercase.
///
/// -
/// tomTitleCase 2
/// Capitalizes the first letter of each word.
///
/// -
/// tomSentenceCase 4
/// Capitalizes the first letter of each sentence.
///
/// -
/// tomToggleCase 5
/// Toggles the case of each letter.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-changecase HRESULT ChangeCase( [in] long Type );
new void ChangeCase(tomConstants Type);
///
/// Retrieves screen coordinates for the start or end character position in the text range, along with the intra-line position.
///
///
/// Type: long
///
/// Flag that indicates the position to retrieve. This parameter can include one value from each of the following tables. The default
/// value is tomStart + TA_BASELINE + TA_LEFT.
///
/// tomAllowOffClient
/// tomClientCoord
/// tomObjectArg
/// tomTransform
/// Use one of the following values to indicate the start or end of the range.
/// tomStart
/// tomEnd
/// Use one of the following values to indicate the vertical position.
///
///
/// TA_TOP
/// Top edge of the bounding rectangle.
///
/// -
/// TA_BASELINE
/// Base line of the text.
///
/// -
/// TA_BOTTOM
/// Bottom edge of the bounding rectangle.
///
///
/// Use one of the following values to indicate the horizontal position.
///
///
/// TA_LEFT
/// Left edge of the bounding rectangle.
///
/// -
/// TA_CENTER
/// Center of the bounding rectangle.
///
/// -
/// TA_RIGHT
/// Right edge of the bounding rectangle.
///
///
///
///
/// Type: long*
/// The x-coordinate.
///
///
/// Type: long*
/// The y-coordinate.
///
///
/// The ITextRange::GetPoint method gives ITextRange the ability to emulate UI-pointer commands; it is also handy for
/// accessibility purposes.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpoint HRESULT GetPoint( long Type, long *px, long *py );
new void GetPoint(int Type, out int px, out int py);
///
/// Changes the range based on a specified point at or up through (depending on Extend) the point ( x, y)
/// aligned according to Type.
///
///
/// Type: long
/// Horizontal coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// Vertical coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// The end to move to the specified point. It can be one of the following.
///
///
/// tomStart
/// Move the start of range.
///
/// -
/// tomEnd
/// Move the end of range.
///
///
///
///
/// Type: long
///
/// How to set the endpoints of the range. If Extend is zero (the default), the range is an insertion point at the specified
/// point (or at the nearest point with selectable text). If Extend is 1, the end specified by Type is moved to the
/// point and the other end is left alone.
///
///
///
/// An application can use the specified point in the WindowFromPoint function to get the handle of the window, which usually can be
/// used to find the client-rectangle coordinates (although a notable exception is with Windowless Controls).
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpoint HRESULT SetPoint( [in] long x, [in] long y,
// [in] long Type, [in] long Extend );
new void SetPoint(int x, int y, tomConstants Type, int Extend);
/// Scrolls the specified range into view.
///
/// Type: long
/// Flag specifying the end to scroll into view. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomEnd
/// Scrolls the end character position to appear on the bottom line.
///
/// -
/// tomStart
/// Scrolls the start character position to appear on the top line. (Default value).
///
/// -
/// tomNoUpScroll
///
///
/// -
/// tomNoVpScroll
///
///
///
///
///
/// Type: HRESULT
///
/// The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns S_FALSE.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-scrollintoview HRESULT ScrollIntoView( long Value );
[PreserveSig]
new HRESULT ScrollIntoView(tomConstants Value);
///
/// Retrieves a pointer to the embedded object at the start of the specified range, that is, at cpFirst. The range must either
/// be an insertion point or it must select only the embedded object.
///
///
/// Type: IUnknown**
/// The pointer to the object.
///
///
/// If the start of this range does not have an embedded object or if the range selects more than a single object, ppObject is
/// set equal to NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getembeddedobject HRESULT GetEmbeddedObject( IUnknown
// **ppObject );
[return: MarshalAs(UnmanagedType.IUnknown)]
new object GetEmbeddedObject();
/// Gets the text selection flags.
///
/// Type: long*
/// Any combination of the following selection flags.
///
///
/// Selection Flag
/// Value
/// Meaning
///
/// -
/// tomSelStartActive
/// 1
/// Start end is active.
///
/// -
/// tomSelAtEOL
/// 2
///
/// For degenerate selections, the ambiguous character position corresponding to both the beginning of a line and the end of the
/// preceding line should have the caret displayed at the end of the preceding line.
///
///
/// -
/// tomSelOvertype
/// 4
/// Insert/Overtype mode is set to overtype.
///
/// -
/// tomSelActive
/// 8
/// Selection is active.
///
/// -
/// tomSelReplace
/// 16
/// Typing and pasting replaces selection.
///
///
/// Â
/// Each of the table values is binary. Thus, if any value is not set, the text selection has the opposite property.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-getflags HRESULT GetFlags( long *pFlags );
tomConstants GetFlags();
/// Sets the text selection flags.
///
/// Type: long
/// New flag values. It can be any combination of the following.
///
///
/// Selection flag
/// Value
/// Meaning
///
/// -
/// tomSelStartActive
/// 1
/// Start end is active.
///
/// -
/// tomSelAtEOL
/// 2
///
/// For degenerate selections, the ambiguous character position corresponding to both the beginning of a line and the end of the
/// preceding line should have the caret displayed at the end of the preceding line.
///
///
/// -
/// tomSelOvertype
/// 4
/// Insert/Overtype mode is set to overtype.
///
/// -
/// tomSelActive
/// 8
/// Selection is active.
///
/// -
/// tomSelReplace
/// 16
/// Typing and pasting replaces selection.
///
///
/// Â
/// Each of the table values is binary. Thus, if any value is not set, the text selection has the opposite property.
///
///
///
/// To make sure that the start end is active and that the ambiguous character position is displayed at the end of the line, execute
/// the following code:
///
///
/// The Flags property is useful because an ITextRange object can select itself. With SetFlags, you can change the active end
/// from the default value of End, select the caret position for an ambiguous character position, or change the Insert/Overtype mode.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-setflags HRESULT SetFlags( long Flags );
void SetFlags(tomConstants Flags);
/// Gets the type of text selection.
///
/// Type: long*
/// The selection type. The method returns pType with one of the values in the following table.
///
///
/// Selection type
/// Value
/// Meaning
///
/// -
/// tomNoSelection
/// 0
/// No selection and no insertion point.
///
/// -
/// tomSelectionIP
/// 1
/// Insertion point.
///
/// -
/// tomSelectionNormal
/// 2
/// Single nondegenerate range.
///
/// -
/// tomSelectionFrame
/// 3
/// Frame.
///
/// -
/// tomSelectionColumn
/// 4
/// Table column.
///
/// -
/// tomSelectionRow
/// 5
/// Table rows.
///
/// -
/// tomSelectionBlock
/// 6
/// Block selection.
///
/// -
/// tomSelectionInlineShape
/// 7
/// Picture.
///
/// -
/// tomSelectionShape
/// 8
/// Shape.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-gettype HRESULT GetType( long *pType );
tomConstants GetType();
/// Generalizes the functionality of the Left Arrow key.
///
/// Type: long
/// Unit to use. It can be one of the following.
///
///
/// Value
/// Corresponding key combination
/// Meaning
///
/// -
/// tomCharacter
/// Left Arrow
/// Move one character position to the left. This is the default.
///
/// -
/// tomWord
/// Ctrl+Left Arrow
/// Move one word to the left.
///
///
/// Â
/// Note: If Count is less than zero, movement is to the right.
///
///
/// Type: long
/// Number of Units to move past. The default value is 1. If Count is less than zero, movement is to the right.
///
///
/// Type: long
///
/// Flag that indicates how to change the selection. If Extend is zero (or tomMove), the method collapses the selection
/// to an insertion point at the active end and then moves it. If Extend is 1 (or tomExtend), the method moves the
/// active end and leaves the other end alone. The default value is zero. A nonzero Extend value corresponds to the Shift key
/// being pressed in addition to the key combination described in Unit.
///
///
///
/// Type: long*
///
/// The actual count of units the insertion point or active end is moved left. This parameter can be null. Collapsing the selection,
/// when Extend is 0, counts as one unit.
///
///
///
///
/// The WordBasic move methods like CharRight, CharLeft, WordRight, and WordLeft are hybrids that can do
/// four things that are closely related to the standard arrow-key edit behavior:
///
///
/// -
/// Move the current insertion point if there's no selection.
///
/// -
/// Move the active end of the selection if there is a selection.
///
/// -
/// Turn an insertion point into a selection and vice versa.
///
/// -
/// Return a Boolean stating if movement occurred.
///
///
///
/// The Extend argument of MoveLeft and MoveRight enables you to be consistent with the first three items above, and
/// the pDelta is a generalization of the fourth. For example, given a selection consisting of a single range, you have the
/// following correspondences (for left-to-right characters).
///
///
///
/// ITextSelection
/// WordBasic
/// Function
///
/// -
/// selection.MoveRight tomWord, 1, 1
/// WordRight 1,1
/// Moves active end one word right.
///
/// -
/// selection.MoveLeft tomCharacter, 1, 1
/// CharLeft 1,1
/// Moves active end one character left.
///
///
/// Â
///
/// As in WordBasic, if Count is less than zero, the meanings of left and right are interchanged, that is is equivalent to .
///
///
/// Similar to WordBasic and the Left Arrow key UI behavior, calling on a degenerate selection moves the insertion point the
/// specified number of Unit s. On a degenerate range, calling where is greater than zero causes the range to become
/// nondegenerate with the left end being the active end.
///
///
/// When Extend is tomExtend (or is nonzero), MoveLeft moves only the active end of the selection, leaving the
/// other end where it is. However, if Extend equals zero and the selection starts as a nondegenerate range, where is greater
/// than zero moves the active end - 1 units left, and then moves the other end to the active end. In other words, it makes an
/// insertion point at the active end. Collapsing the range counts as one unit. Thus, converts a nondegenerate selection into a
/// degenerate one at the selection's left end. Here, Count has the default value of 1 and Extend has the default value
/// of zero. This example corresponds to pressing the Left Arrow key. MoveLeft and MoveRight are related to the ITextRange
/// move methods, but differ in that they explicitly use the active end (the end moved by pressing the Shift key).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-moveleft HRESULT MoveLeft( long Unit, long Count,
// long Extend, long *pDelta );
tomConstants MoveLeft(tomConstants Unit, int Count, tomConstants Extend);
/// Generalizes the functionality of the Right Arrow key.
///
/// Type: long
/// Unit to use. It can be one of the following.
///
///
/// Value
/// Corresponding key combination
/// Meaning
///
/// -
/// tomCharacter
/// Right Arrow
/// Move one character position to the right. This is the default.
///
/// -
/// tomWord
/// Ctrl+Right Arrow
/// Move one word to the right.
///
///
/// Â
/// Note, if Count is less than zero, movement is to the left.
///
///
/// Type: long
/// Number of Units to move past. The default value is 1. If Count is less than zero, movement is to the left.
///
///
/// Type: long
///
/// Flag that indicates how to change the selection. If Extend is zero (or tomMove), the method collapses the selection
/// to an insertion point at the active end and then moves it. If Extend is 1 (or tomExtend), the method moves the
/// active end and leaves the other end alone. The default value is zero. A nonzero Extend value corresponds to the Shift key
/// being pressed in addition to the key combination described in Unit.
///
///
///
/// Type: long*
///
/// The actual count of units the insertion point or active end is moved left. This parameter can be null. Collapsing the selection,
/// when Extend is 0, counts as one unit.
///
///
///
///
/// Microsoft WordBasic move methods like CharRight, CharLeft, WordRight, and WordLeft are hybrids that
/// can do four things that are closely related to the standard arrow-key edit behavior:
///
///
/// -
/// Move the current insertion point if there's no selection.
///
/// -
/// Move the active end of the selection if there is a selection.
///
/// -
/// Turn an insertion point into a selection and vice versa.
///
/// -
/// Return a Boolean stating if movement occurred.
///
///
///
/// The Extend argument of MoveLeft and MoveRight enables you to be consistent with the first three items above, and
/// the pDelta is a generalization of the fourth. For example, given a selection, s, consisting of a single range, you have
/// the following correspondences (for left-to-right characters).
///
///
///
/// ITextSelection
/// WordBasic
/// Function
///
/// -
/// s.MoveRight tomWord, 1, 1
/// WordRight 1,1
/// Moves active end one word right.
///
/// -
/// s.MoveLeft tomCharacter, 1, 1
/// CharLeft 1,1
/// Moves active end one character left.
///
///
/// Â
///
/// As in WordBasic, if Count is less than zero, the meanings of left and right are interchanged, that is is equivalent to .
///
///
/// Similar to WordBasic and the Right Arrow key UI behavior, calling on a degenerate selection moves the insertion point the
/// specified number of units. On a degenerate range, calling where is greater than zero causes the range to become nondegenerate
/// with the right end being the active end.
///
///
/// When Extend is tomExtend (or is nonzero), MoveRight moves only the active end of the selection, leaving the
/// other end where it is. However, if Extend equals zero and the selection starts as a nondegenerate range, where is greater
/// than zero moves the active end - 1 units right, and then moves the other end to the active end. In other words, it makes an
/// insertion point at the active end. Collapsing the range counts as one unit. Thus, converts a nondegenerate selection into a
/// degenerate one at the selection's right end. Here, Count has the default value of 1 and Extend has the default
/// value of zero. This example corresponds to pressing the Right Arrow key. MoveLeft and MoveRight are related to the
/// ITextRange move methods, but differ in that they explicitly use the active end (the end moved by pressing the Shift key).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-moveright HRESULT MoveRight( long Unit, long Count,
// long Extend, long *pDelta );
tomConstants MoveRight(tomConstants Unit, int Count, tomConstants Extend);
/// Mimics the functionality of the Up Arrow and Page Up keys.
///
/// Type: long
/// Unit to use in the operation. It can be one of the following.
///
///
/// Value
/// Corresponding key combination
/// Meaning
///
/// -
/// tomLine
/// Up Arrow
/// Moves up one line. This is the default.
///
/// -
/// tomParagraph
/// Ctrl+Up Arrow
/// Moves up one paragraph.
///
/// -
/// tomScreen
/// Page Up
/// Moves up one screen.
///
/// -
/// tomWindow
/// Ctrl+Page Up
/// Moves to first character in window.
///
///
///
///
/// Type: long
/// Number of Units to move past. The default value is 1.
///
///
/// Type: long
///
/// Flag that indicates how to change the selection. If Extend is zero (or tomMove), the method collapses the selection
/// to an insertion point and then moves. If Extend is 1 (or tomExtend), the method moves the active end and leaves the
/// other end alone. The default value is zero. A nonzero Extend value corresponds to the Shift key being pressed in addition
/// to the key combination described in Unit.
///
///
///
/// Type: long*
///
/// The actual count of units the insertion point or active end is moved down. This parameter can be null. Collapsing the selection
/// counts as one unit.
///
///
///
/// The MoveUp and MoveDown methods are similar to the MoveLeft and MoveRight methods, except that they reflect the behavior
/// of the Up Arrow, Down Arrow, Page Up, and Page Down keys on the cursor-keypad.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-moveup HRESULT MoveUp( long Unit, long Count, long
// Extend, long *pDelta );
tomConstants MoveUp(tomConstants Unit, int Count, tomConstants Extend);
/// Mimics the functionality of the Down Arrow and Page Down keys.
///
/// Type: long
/// Unit to use in the operation. It can be one of the following.
///
///
/// Value
/// Corresponding key combination
/// Meaning
///
/// -
/// tomLine
/// Down Arrow
/// Moves down one line. This is the default.
///
/// -
/// tomParagraph
/// Ctrl+Down Arrow
/// Moves down one paragraph.
///
/// -
/// tomScreen
/// Page Down
/// Moves down one screen.
///
/// -
/// tomWindow
/// Ctrl+Page Down
/// Moves to last character in window.
///
///
///
///
/// Type: long
/// Number of Units to move past. The default value is 1.
///
///
/// Type: long
///
/// Flag that indicates how to change the selection. If Extend is zero (or tomMove), the method collapses the selection
/// to an insertion point and then moves. If Extend is 1 (or tomExtend), the method moves the active end and leaves the
/// other end alone. The default value is zero. A nonzero Extend value corresponds to the Shift key being pressed in addition
/// to the key combination described in Unit.
///
///
///
/// Type: long*
///
/// Pointer to a variable that receives the actual count of units the insertion point or active end is moved down. Collapsing the
/// selection counts as one unit. This parameter can be null.
///
///
///
/// The ITextSelection::MoveUp and ITextSelection::MoveDown methods are similar to the ITextSelection::MoveLeft and
/// ITextSelection::MoveRight methods, except that they reflect the behavior of the Up Arrow, Down Arrow, Page Up, and Page Down keys
/// on the cursor-keypad.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-movedown HRESULT MoveDown( long Unit, long Count,
// long Extend, long *pDelta );
tomConstants MoveDown(tomConstants Unit, int Count, tomConstants Extend);
/// Generalizes the functionality of the Home key.
///
/// Type: long
/// Unit to use in the Home key operation. It can take on one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomLine
///
/// Depending on Extend, it moves either the insertion point or the active end to the beginning of the first line in the
/// selection. This is the default.
///
///
/// -
/// tomStory
///
/// Depending on Extend, it moves either the insertion point or the active end to the beginning of the first line in the story.
///
///
/// -
/// tomColumn
///
/// Depending on Extend, it moves either the insertion point or the active end to the beginning of the first column in the
/// selection. This is available only if the TOM engine supports tables.
///
///
/// -
/// tomRow
///
/// Depending on Extend, it moves either the insertion point or the active end to the beginning of the first row in the
/// selection. This is available only if the TOM engine supports tables.
///
///
///
///
///
/// Type: long
///
/// Flag that indicates how to change the selection. If Extend is zero (or tomMove), the method collapses the selection
/// to an insertion point. If Extend is 1 (or tomExtend), the method moves the active end and leaves the other end
/// alone. The default value is zero.
///
///
///
/// Type: long*
///
/// Pointer to a variable that receives the count of characters that the insertion point or the active end is moved. This parameter
/// can be null.
///
///
///
/// The ITextSelection::HomeKey and ITextSelection::EndKey methods are used to mimic the standard Home/End key behavior.
///
/// tomLine mimics the Home or End key behavior without the Ctrl key pressed, while tomStory mimics the behavior
/// with the Ctrl key pressed. Similarly, tomMove mimics the Home or End key behavior without the Shift key
/// pressed, while tomExtend mimics the behavior with the Shift key pressed. So converts the selection into an
/// insertion point at the beginning of the associated story, while HomeKey(tomStory, tomExtend) moves the active end of the
/// selection to the beginning of the story and leaves the other end where it was.
///
///
/// The HomeKey and EndKey methods are logical methods like the Move methods, rather than directional methods. Thus,
/// they depend on the language that is involved. For example, in Arabic text, HomeKey moves to the right end of a line,
/// whereas in English text, it moves to the left. Thus, HomeKey and EndKey methods are different than the
/// ITextSelection::MoveLeft and ITextSelection::MoveRight methods. Also, note that the HomeKey method is quite different from
/// the Start property, which is the cp at the beginning of the selection. HomeKey and EndKey also differ from
/// the StartOf and EndOf methods in that they extend from the active end, whereas StartOf extends from Start and EndOf
/// extends from End.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-homekey HRESULT HomeKey( long Unit, long Extend,
// long *pDelta );
tomConstants HomeKey(tomConstants Unit, tomConstants Extend);
/// Mimics the functionality of the End key.
///
/// Type: long
/// Unit to use. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomLine
///
/// Depending on Extend, it moves either the insertion point or the active end to the end of the last line in the selection.
/// This is the default.
///
///
/// -
/// tomStory
///
/// Depending on Extend, it moves either the insertion point or the active end to the end of the last line in the story.
///
///
/// -
/// tomColumn
///
/// Depending on Extend, it moves either the insertion point or the active end to the end of the last column in the selection.
/// This is available only if the TOM engine supports tables.
///
///
/// -
/// tomRow
///
/// Depending on Extend, it moves either the insertion point or the active end to the end of the last row in the selection.
/// This is available only if the TOM engine supports tables.
///
///
///
///
///
/// Type: long
///
/// Flag that indicates how to change the selection. If Extend is zero (or tomMove), the method collapses the selection
/// to an insertion point. If Extend is 1 (or tomExtend), the method moves the active end and leaves the other end
/// alone. The default value is zero.
///
///
///
/// Type: long*
///
/// Pointer to a variable that receives the count of characters that the insertion point or the active end is moved. This parameter
/// can be null.
///
///
///
///
/// Setting Extend to tomExtend (or nonzero) corresponds to the Shift key being pressed. Setting Unit to
/// tomLine corresponds to the Ctrl key not being pressed. Setting Unit to tomStory to Ctrl being pressed. The
/// pDelta parameters receives the number of characters that the insertion point or active end is moved.
///
/// The ITextSelection::HomeKey and ITextSelection::EndKey methods are used to mimic the standard Home/End key behavior.
///
/// The tomLine value mimics the Home or End key behavior without the Ctrl key pressed, while tomStory mimics
/// the behavior with the Ctrl key pressed. Similarly, tomMove mimics the Home or End key behavior without the
/// Shift key pressed, while tomExtend mimics the behavior with the Shift key pressed. So converts the selection into
/// an insertion point at the end of the associated story, while moves the active end of the selection to the end of the story and
/// leaves the other end where it was.
///
///
/// The HomeKey and EndKey methods are logical methods like the Move* methods, rather than directional methods. Thus,
/// they depend on the language that is involved. For example, in Arabic text, HomeKey moves to the right end of a line,
/// whereas in English text, it moves to the left. Thus, HomeKey and EndKey are different than the MoveLeft and
/// MoveRight methods. Also, note that the EndKey method is quite different from the End property, which is the at the
/// end of the selection. HomeKey and EndKey also differ from the StartOf and EndOf methods in that they extend from
/// the active end, whereas StartOf extends from Start and EndOf extends from End.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-endkey HRESULT EndKey( long Unit, long Extend, long
// *pDelta );
tomConstants EndKey(tomConstants Unit, tomConstants Extend);
///
/// Types the string given by bstr at this selection as if someone typed it. This is similar to the underlying SetText method,
/// but is sensitive to the Insert/Overtype key state and UI settings like AutoCorrect and smart quotes.
///
///
/// Type: BSTR
/// String to type into this selection.
///
///
///
/// This method types the string given by bstr at this selection as if someone typed it. Using TypeText is faster than
/// sending characters through the SendMessage function, but it is slower than using SetText.
///
///
/// TypeText is similar to the underlying SetText method, however, it is sensitive to the Insert/Overtype key state and UI
/// settings like AutoCorrect and smart quotes. For example, it deletes any nondegenerate selection and then inserts or overtypes
/// (depending on the Insert/Overtype key stateâsee the SetFlags method) the string bstr at the insertion point, leaving
/// this selection as an insertion point following the inserted text.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextselection-typetext HRESULT TypeText( BSTR bstr );
void TypeText([MarshalAs(UnmanagedType.BStr)] string bstr);
}
/// Currently, this interface contains no methods other than those inherited from ITextRange2.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextselection2
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextSelection2")]
[ComImport, Guid("C241F5E1-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextSelection2 : ITextRange2
{
/// Gets the plain text in this range. The Text property is the default property of the ITextRange interface.
///
/// Type: BSTR*
/// The text.
///
///
///
/// The ITextRange::GetText method returns the plain text in the range. The Text property is the default property for
/// ITextRange; this is, it is automatically invoked for a range, as in the following Microsoft Visual Basic for Applications (VBA) example.
///
///
/// Some of the examples below use this fact. The ITextRange::SetText method substitutes bstr for the range text. For
/// processing a single character, the Char property is more efficient than the Text property and does not require creating a single
/// character range for storing a character. If the range is degenerate, the Text property lets you insert text easily. You can also
/// delete the text in a range, as shown in the following VBA examples.
///
///
/// You can use the Text property to copy plain text from one place to another, simply by setting one range equal to another.
/// (This is quite different from the Duplicate property; for more information, see ITextRange::GetDuplicate). The following
/// Microsoft Visual Basic example statement sets the text in the range1 to that in range2.
///
///
/// The ranges can be in different stories or even in different applications. However, they do imply copying the text first into a
/// BSTR and then from that string to the target location. For large amounts of text, the ITextRange::Copy and
/// ITextRange::Paste methods can be faster, since they can perform the copy directly from source to target and with any format
/// supported by the source and target.
///
///
/// The text returned by the Text property is given in Unicode. The end-of-paragraph mark may be given by 0x2029 (the Unicode
/// Paragraph Separator), or by carriage return/line feed (CR/LF) (0xd, 0xa), or by a carriage return alone, depending on the
/// original file. Microsoft Word uses a carriage return alone, unless it reads another choice in from a file, the clipboard, or an
/// IDataObject. The placeholder for an embedded object is given by the special character, WCH_EMBEDDING, which has the
/// Unicode value 0xFFFC.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-gettext HRESULT GetText( BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
new string GetText();
/// Sets the text in this range.
///
/// Type: BSTR
/// Text that replaces the current text in this range. If null, the current text is deleted.
///
///
///
/// ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with
/// the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed
/// the text in. For UI selection behavior, see TypeText.
///
///
/// If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the
/// ITextRange::SetText method (unless some other range has changed that text in between the calls).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-settext HRESULT SetText( [in] BSTR bstr );
new void SetText([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Gets the character at the start position of the range.
///
/// Type: long*
/// The start character position of the range.
///
///
/// The following Microsoft Visual Basic example sets ch equal to the character at the start of the range.
///
/// Similarly, ITextRange::SetChar overwrites the character at the start of the range with the specified character. The characters
/// retrieved and set by these methods are LONG variables, which hide the way that they are stored in the backing store (as
/// bytes, words, variable-length, and so forth), and they do not require using a BSTR.
///
/// The Char property, which can do most things that a characters collection can, has two big advantages:
///
/// -
/// It can reference any character in the parent story instead of being limited to the parent range.
///
/// -
/// It is significantly faster, since LONG s are involved instead of range objects.
///
///
/// Accordingly, the Text Object Model (TOM) does not support a characters collection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getchar HRESULT GetChar( long *pChar );
new int GetChar();
/// Sets the character at the starting position of the range.
///
/// Type: long
/// New value for character at the starting position.
///
///
///
/// ITextRange::SetChar lets you specify the precise character code to use. However, string literals with similar looking
/// glyphs can be misleading.
///
///
/// The characters set by this method are LONG instead of a BSTR. This hides the way that they are stored in the
/// backing store, (as bytes, words, variable-length, and so forth).
///
///
/// Frequently on systems that do not have automatic word-wrapping, documents have hard carriage returns inserted just for line
/// breaks. The following code shows a simple, but not perfect, way to convert such hard carriage returns back to blanks for the
/// story that is associated with the range r.
///
/// Alternatively, you could use the following inside the IF loop.
///
/// This approach enables you to wrap the text to other widths. However, the algorithm isn't perfect: it assumes that a hard carriage
/// return that is followed by anything other than white space (blank, tab, line feed, carriage return, and so forth) should be
/// replaced by a blank. The algorithm also assumes that the carriage return character is a single character like carriage return or
/// the Unicode end-of-paragraph (EOP) 0x2029 character. And, the combination carriage return and line feed isn't matched and would
/// require writing and executing more code (or use ). Another caution is that there are other cases, such as mixed code and
/// documentation, where the algorithm does not work correctly.
///
///
/// However, ITextRange::SetChar is more efficient than a replace operation that is accomplished by a delete followed by an
/// insertion. Thus, rewriting the code without using ITextRange::SetChar would probably be much slower.
///
///
/// The Char property, which can do most things that a characters collection can, has two big advantages: it can reference any
/// character in the parent story instead of being limited to the parent range, and it's significantly faster, since LONG s
/// rather than range objects are involved. Because of these advantages, the Text Object Model (TOM) does not support a characters collection.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setchar HRESULT SetChar( long Char );
new void SetChar(int Char);
/// Gets a duplicate of this range object.
///
/// Type: ITextRange**
/// The duplicate of the range.
///
///
///
/// To create an insertion point in order to traverse a range, first duplicate the range and then collapse the duplicate at its start
/// character position. Note, a range is characterized by start and end character positions, and the story it belongs to.
///
///
/// Even if the range is actually an ITextSelection, the duplicate returned is an ITextRange. For an example, see the
/// ITextRange::FindText method.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getduplicate HRESULT GetDuplicate( ITextRange **ppRange );
new ITextRange GetDuplicate();
/// Gets an ITextRange object with the specified range's formatted text.
///
/// Type: ITextRange**
/// The ITextRange object with the formatted text.
///
///
///
/// This method, which amounts to an alias for the ITextRange::GetDuplicate method, is included to be Microsoft Visual Basic for
/// Applications (VBA)-friendly. The method returns the formatted text in a range. If the ITextRange does not belong to the same Text
/// Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be
/// used to reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in a range2, by the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getformattedtext HRESULT GetFormattedText( ITextRange
// **ppRange );
new ITextRange GetFormattedText();
/// Sets the formatted text of this range text to the formatted text of the specified range.
///
/// Type: ITextRange*
/// The formatted text to replace this range's text.
///
///
///
/// If the ITextRange does not belong to the same Text Object Model (TOM) engine, call IUnknown::QueryInterface for an IDataObject interface.
///
///
/// Among the formats typically supported by the IDataObject are CF_TEXT and CF_RTF. In addition, private formats can be used to
/// reference a text solution's own internal rich-text formats. The following Microsoft Visual Basic example uses the
/// FormattedText property to replace the text in range2 with the formatted text in range1.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setformattedtext HRESULT SetFormattedText( [in]
// ITextRange *pRange );
new void SetFormattedText([In, Optional] ITextRange? pRange);
/// Gets the start character position of the range.
///
/// Type: long*
/// The start character position.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstart HRESULT GetStart( long *pcpFirst );
new int GetStart();
/// Sets the character position for the start of this range.
///
/// Type: long
/// The new character position for the start of the range.
///
///
///
/// Note that if cpFirst is greater than the range's end position, this method sets the end position equal to cpFirst,
/// making the range an insertion point. If this range is the selection, the start position becomes the active end and is scrolled
/// into view if the display isn't frozen.
///
///
/// ITextRange::SetEnd sets the range's end position, and ITextRange::SetRange sets both range ends simultaneously. The following
/// example shows how to convert a nondegenerate range into a degenerate one (insertion point).
///
/// Similarly, converts the range into an insertion point at the end position.
/// The following example adds 1 to the end position, if it is not at the end of the story.
/// This also makes the end position the active end of the range, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setstart HRESULT SetStart( [in] long cpFirst );
new void SetStart(int cpFirst);
/// Gets the end character position of the range.
///
/// Type: long*
/// The end character position.
///
///
///
/// Although a pointer to a range remains valid when the text is edited, this is not the case for the character position. A character
/// position is volatile; that is, it becomes invalid as soon as text is inserted or deleted before the character position. Be
/// careful about using methods that return character position values, especially if the values are to be stored for any duration.
///
/// This method is similar to the ITextRange::GetStart method which gets the start character position of the range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getend HRESULT GetEnd( long *pcpLim );
new int GetEnd();
/// Sets the end position of the range.
///
/// Type: long
/// The new end position.
///
///
///
/// If the new end position is less than the start position, this method also sets the start position to cp; that is, the
/// range becomes an insertion point.
///
///
/// If this range is actually the selection, the end position becomes the active end and, if the display is not frozen, it is
/// scrolled into view.
///
///
/// ITextRange::SetStart sets the range's start position and ITextRange::SetRange sets both range ends simultaneously. To convert a
/// nondegenerate range, r, into a degenerate one (insertion point) at the start position, use
///
/// Similarly, r.Start = r.End converts r into an insertion point at the end position.
/// To add 1 to the end position, unless it is at the end of the story, use:
/// This also makes end position the active end, and it can turn a degenerate range into a nondegenerate one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setend HRESULT SetEnd( long cpLim );
new void SetEnd(int cpLim);
/// Gets an ITextFont object with the character attributes of the specified range.
///
/// Type: ITextFont**
/// The pointer to an ITextFont object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextFont for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getfont HRESULT GetFont( ITextFont **ppFont );
new ITextFont GetFont();
/// Sets this range's character attributes to those of the specified ITextFont object.
///
/// Type: ITextFont*
/// A font object with the desired character format.
///
///
/// For occasional format changes, use the ITextRange::SetFont method. However, to make a number of character formatting
/// changes, it is more efficient to use a font duplicate. This is because every time you execute a statement like range.font.bold
/// = tomTrue, a font object is allocated and freed. However, a font duplicate can be allocated once and used many times.
/// Furthermore, you can save the font duplicate, reset it to the default or undefined states with the Reset method, and give it
/// values as needed for your rich-text processing. For sample code that shows how to use font duplicates, see Using a Font Duplicate.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setfont HRESULT SetFont( [in] ITextFont *pFont );
new void SetFont([In, Optional] ITextFont? pFont);
/// Gets an ITextPara object with the paragraph attributes of the specified range.
///
/// Type: ITextPara**
/// The pointer to the ITextPara object.
///
///
/// For plain-text controls, these objects do not vary from range to range, but in rich-text solutions, they do. See the section on
/// ITextPara for further details.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpara HRESULT GetPara( ITextPara **ppPara );
new ITextPara GetPara();
/// Sets the paragraph attributes of this range to those of the specified ITextPara object.
///
/// Type: ITextPara*
/// The paragraph object with the desired paragraph format.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpara HRESULT SetPara( [in] ITextPara *pPara );
new void SetPara([In, Optional] ITextPara? pPara);
/// Gets the count of characters in the range's story.
///
/// Type: long*
/// The count of characters in the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorylength HRESULT GetStoryLength( long *pCount );
new int GetStoryLength();
/// Get the type of the range's story.
///
/// Type: long*
/// The type of the range's story. The pValue value can be one of the following values.
///
///
/// Story type
/// Value
/// Story type
/// Value
///
/// -
/// tomUnknownStory
/// 0
/// tomEvenPagesHeaderStory
/// 6
///
/// -
/// tomMainTextStory
/// 1
/// tomPrimaryHeaderStory
/// 7
///
/// -
/// tomFootnotesStory
/// 2
/// tomEvenPagesFooterStory
/// 8
///
/// -
/// tomEndnotesStory
/// 3
/// tomPrimaryFooterStory
/// 9
///
/// -
/// tomCommentsStory
/// 4
/// tomFirstPageHeaderStory
/// 10
///
/// -
/// tomTextFrameStory
/// 5
/// tomFirstPageFooterStory
/// 11
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getstorytype HRESULT GetStoryType( long *pValue );
new tomConstants GetStoryType();
/// Collapses the specified text range into a degenerate point at either the beginning or end of the range.
///
/// Type: long
/// Flag specifying the end to collapse at. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomStart or tomTrue
/// Range is collapsed to the start of the range. This is the default.
///
/// -
/// tomEnd or tomFalse
/// Range is collapsed to the end of the range.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-collapse HRESULT Collapse( [in] long bStart );
new void Collapse(tomConstants bStart);
/// Expands this range so that any partial units it contains are completely contained.
///
/// Type: long
///
/// Unit to include, if it is partially within the range. The default value is . For a list of the other Unit values, see the
/// discussion under ITextRange.
///
///
///
/// Type: long*
/// The count of characters added to the range. The value can be null.
///
///
/// For example, if an insertion point is at the beginning, the end, or within a word, ITextRange::Expand expands the range to
/// include that word. If the range already includes one word and part of another, ITextRange::Expand expands the range to
/// include both words. ITextRange::Expand expands the range to include the visible portion of the range's story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-expand HRESULT Expand( long Unit, long *pDelta );
new int Expand(int Unit);
///
/// Retrieves the story index of the Unit parameter at the specified range Start character position. The first Unit in
/// a story has an index value of 1. The index of a Unit is the same for all character positions from that immediately
/// preceding the Unit up to the last character in the Unit.
///
///
/// Type: long
/// Unit that is indexed. For a list of possible Unit values, see the discussion under ITextRange.
///
///
/// Type: long*
/// The index value. The value is zero if Unit does not exist.
///
///
///
/// The ITextRange::GetIndex method retrieves the story index of a word, line, sentence, paragraph, and so forth, at the range
/// Start. Unit specifies which kind of entity to index, such as words ( tomWord), lines ( tomLine), sentences (
/// tomSentence), or paragraphs ( tomParagraph). For example, ITextRange::GetIndex sets pIndex equal to
/// the line number of the first line in the range. For a range at the end of the story, ITextRange::GetIndex, returns the
/// number of Unit s in the story. Thus, you can get the number of words, lines, objects, and so forth, in a story.
///
///
/// The index value returned by the ITextRange::GetIndex method is not valid if the text is subsequently edited. Thus, users
/// should be careful about using methods that return index values, especially if the values are to be stored for any duration. This
/// is in contrast to a pointer to a range, which does remain valid when the text is edited.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getindex HRESULT GetIndex( long Unit, long *pIndex );
new int GetIndex(int Unit);
/// Changes this range to the specified unit of the story.
///
/// Type: long
/// Unit used to index the range. For a list of unit values, see ITextRange.
///
///
/// Type: long
///
/// Index for the Unit. This range is relocated to the Unit that has this index number. If positive, the numbering of
/// Unit s begins at the start of the story and proceeds forward. If negative, the numbering begins at the end of the story
/// and proceeds backward. The start of the story corresponds to an Index of 1 for all units that exist, and the last unit in
/// the story corresponds to an Index of -1.
///
///
///
/// Type: long
///
/// Flag that indicates the extent of the range. If zero (the default), the range is collapsed to an insertion point at the start
/// position of the specified Unit. If nonzero, the range is set to the entire Unit.
///
///
///
/// This method allows an application to work with line-oriented text, such as programs, in a convenient way. For example, converts a
/// range to an insertion point at the start of the tenth line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setindex HRESULT SetIndex( [in] long Unit, [in] long
// Index, [in] long Extend );
new void SetIndex(int Unit, int Index, int Extend);
/// Adjusts the range endpoints to the specified values.
///
/// Type: long
/// The character position for the anchor end of the range.
///
///
/// Type: long
/// The character position for the active end of the range.
///
///
///
/// This method sets the range's start position to , and the end position to . If the range is a nondegenerate selection,
/// cpAnchor is the active end, and cpAnchor is the anchor end. If the range is a degenerate selection, the selection
/// is displayed at the start of the line, rather than at the end of the previous line.
///
/// This method removes any other subranges this range may have. To preserve the current subranges, use ITextRange2::SetActiveSubrange.
/// If the text range is a selection, you can set the attributes of the selection by using the ITextSelection::SetFlags method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setrange HRESULT SetRange( long cpAnchor, long cpActive );
new void SetRange(int cpAnchor, int cpActive);
/// Determines whether this range is within or at the same text as a specified range.
///
/// Type: ITextRange*
/// Text that is compared to the current range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The method returns pB is tomTrue only if the range is in or at the
/// same text as pRange.
///
///
///
///
/// For range2 to be contained in range1, both ranges must be in the same story, and the limits of range2 must satisfy either of the
/// following statements.
///
///
/// -
///
/// The start and end character positions of range1 are the same as range2. That is, both ranges are degenerate and have identical
/// insertion points.
///
///
/// -
/// Range2 is a nondegenerate range with start and end character positions at or within those of range1.
///
///
/// The following example shows how to walk one range with another.
///
/// When the ITextRange::FindText, ITextRange::MoveWhile, and ITextRange::MoveUntil method families are used, you can use one range
/// to walk another by specifying the appropriate limit count of characters (for an example, see the Remarks in ITextRange::Find).
///
///
/// ITextRange::IsEqual is a special case of ITextRange::InRange that returns pBtomTrue if the pRange has
/// the same start and end character positions and belongs to the same story.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-inrange HRESULT InRange( ITextRange *pRange, long
// *pValue );
new tomConstants InRange([In, Optional] ITextRange? pRange);
/// Determines whether this range's story is the same as a specified range's story.
///
/// Type: ITextRange*
/// The ITextRange object whose story is compared to this range's story.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range's story is the same
/// as that of the pRange; otherwise it receives tomFalse.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-instory HRESULT InStory( ITextRange *pRange, long
// *pValue );
new tomConstants InStory([In, Optional] ITextRange? pRange);
/// Determines whether this range has the same character positions and story as those of a specified range.
///
/// Type: ITextRange*
/// The ITextRange object that is compared to this range.
///
///
/// Type: long*
///
/// The comparison result. The pointer can be null. The pB parameter receives tomTrue if this range points at the same
/// text (has the same start and end character positions and story) as pRange; otherwise it returns tomFalse.
///
///
///
/// The ITextRange::IsEqual method returns tomTrue only if the range points at the same text as pRange. See
/// Finding Rich Text for code that compares two different pieces of text to see if they contain the same plain text and the same
/// character formatting.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-isequal HRESULT IsEqual( ITextRange *pRange, long
// *pValue );
new tomConstants IsEqual([In, Optional] ITextRange? pRange);
/// Sets the start and end positions, and story values of the active selection, to those of this range.
///
/// The active end of the new selection is at the end position.
/// The caret for an ambiguous character position is displayed at the beginning of the line.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-select HRESULT Select();
new void Select();
/// Moves the range ends to the start of the first overlapping Unit in the range.
///
/// Type: long
/// Unit to use in the move operation. For a list of Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// How to move the ends of the range. It can be one of the following values.
///
///
/// 0 (or tomMove)
/// Collapses a nondegenerate range to the start position by moving the insertion point. This is the default.
///
/// -
/// 1 (or tomExtend)
/// Moves the start position to the beginning of the overlapping Unit. Does not move the end position.
///
///
///
///
/// Type: long*
///
/// Pointer to a variable that receives the number of characters that the start position is moved. It can be null. On return,
/// pDelta is the signed number of characters that the insertion point or start position is moved. This value is always less
/// than or equal to zero, because the motion is always toward the beginning of the story.
///
///
///
///
/// If the range is an insertion point on a boundary between Unit s, ITextRange::StartOf does not change the start position.
///
///
/// The ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in that the latter extend
/// from the active end, whereas ITextRange::StartOf extends from the start position and ITextRange::EndOf extends from
/// the end position.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-startof HRESULT StartOf( long Unit, long Extend, long
// *pDelta );
new tomConstants StartOf(tomConstants Unit, tomConstants Extend);
/// Moves this range's ends to the end of the last overlapping Unit in the range.
///
/// Type: long
/// Unit to use. Default value: tomWord. For a list of the other Unit values, see the discussion under ITextRange.
///
///
/// Type: long
/// Indicator of how the shifting of the range ends is to proceed. It can be one of the following.
///
///
/// 0 or tomMove
///
/// Collapses a nondegenerate range to the End of the original range by moving the insertion point. This is the default.
///
///
/// -
/// 1 (or tomExtend)
/// Moves End to the end of the overlapping Unit. Does not move Start.
///
///
///
///
/// Type: long*
///
/// The count of characters that End is moved past. The value of the pointer can be null. On return, the value of pDelta is
/// the number of characters the insertion point or End is moved plus 1 if a collapse occurs to the entry End. If the range
/// includes the final CR (carriage return) (at the end of the story) and Extend = tomMove, then pDelta is set to â1,
/// to indicate that the collapse occurred before the end of the range (because an insertion point cannot exist beyond the
/// final CR).
///
///
///
/// For comparison, the ITextRange::StartOf method moves the range ends to the beginning of the first overlapping Unit in the
/// range. Note, the ITextRange::StartOf and ITextRange::EndOf methods differ from the HomeKey and EndKey methods in
/// that the latter extend from the active end, whereas ITextRange::StartOf extends from Start and ITextRange::EndOf
/// extends from End. If the range is an insertion point on a boundary between Unit s, ITextRange::EndOf does not
/// change End. In particular, calling ITextRange::EndOf ( tomCharacter, *, *) does not change End except for an
/// insertion point at the beginning of a story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-endof HRESULT EndOf( long Unit, long Extend, long
// *pDelta );
new tomConstants EndOf(tomConstants Unit, tomConstants Extend);
///
/// Moves the insertion point forward or backward a specified number of units. If the range is nondegenerate, the range is collapsed
/// to an insertion point at either end, depending on Count, and then is moved.
///
///
/// Type: long
/// Unit to use. The default value is tomCharacter. For information on other values, see the discussion in ITextRange.
///
///
/// Type: long
///
/// Number of Unit s to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward
/// the end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero,
/// the range is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of Unit s the insertion point moves past. The pointer can be NULL. For more information, see the
/// Remarks section.
///
///
///
///
/// If the range is degenerate (an insertion point), this method tries to move the insertion point Count  Unit s.
///
///
/// If the range is nondegenerate and Count is greater than zero, this method collapses the range at the end character
/// position, moves the resulting insertion point forward to a Unit boundary (if it is not already at one), and then tries to
/// move Count - 1 Unit s forward. If the range is nondegenerate and Count is less than zero, this method
/// collapses the range at the start character position, moves the resulting insertion point backward to a Unit boundary (if
/// it isn't already at one), and then tries to move | Count| - 1 Unit s backward. Thus, in both cases, collapsing a
/// nondegenerate range to an insertion point, whether moving to the start or end of the Unit following the collapse, counts
/// as a Unit.
///
///
/// The ITextRange::Move method returns pDelta = number of Unit s actually moved. This method never moves the
/// insertion point beyond the story of this range. If CountUnit s would move the insertion point before the beginning
/// of the story, it is moved to the story beginning and pDelta is set accordingly. Similarly, if Count  Unit s
/// would move it beyond the end of the story, it is moved to the story end.
///
///
/// The ITextRange::Move method works similarly to the UI-oriented MoveLeft and MoveRight methods, except that the direction
/// of motion is logical rather than geometrical. That is, with ITextRange::Move the direction is either toward the end or
/// toward the start of the story. Depending on the language, moving toward the end of the story could be moving to the left or to
/// the right. To get a feel for Count, press Ctrl+Right Arrow in a Microsoft Word document for a variety of selections. In
/// left-to-right text, this keystroke behaves the same as , and . Count corresponds to the number of times you press
/// Ctrl+Right Arrow.
///
///
/// For example, if you press Ctrl+Right Arrow for the selections shown in both of the following figures, you end up with an
/// insertion point at character position 8, since this command collapses the selections at their end character positions (7 and 8,
/// respectively) and moves to the next tomWord boundary.
///
///
/// The first selection does not include the blank space at character position 7, so Ctrl+Right Arrow moves past the space to the
/// tomWord boundary at character position 8. The end character position is already at a tomWord boundary for the
/// second selection, so Ctrl+Right Arrow just collapses the selection at that boundary. Similarly, Ctrl+Left Arrow, which for this
/// text acts like , and collapses the first selection at character position 5, which is already at a tomWord boundary, so no
/// more motion occurs. But Ctrl+Left Arrow collapses the second selection at character position 4 and then moves to zero, since
/// that's the next tomWord boundary in the direction of motion.
///
///
/// The return argument, pDelta, is set equal to the number of Unit s that the insertion point is moved including one
/// Unit for collapsing a nondegenerate range and moving it to a Unit boundary. So, if no motion and no collapse occur,
/// as when the range is an insertion point at the end of the story, pDelta is set equal to zero. This approach is useful for
/// controlling program loops that process a whole story.
///
///
/// In both of the cases mentioned above, calling sets pDelta equal to 1 because the ranges were collapsed. Similarly, calling
/// sets pDelta equal to -1 for both cases. Collapsing, with or without moving part of a Unit to a Unit
/// boundary, counts as a Unit moved.
///
///
/// The direction of motion refers to the logical character ordering in the plain-text backing store. This approach avoids the
/// problems of geometrical ordering, such as left versus right and up versus down, in international software. Such geometrical
/// methods are still needed in the edit engine, of course, since keyboards have arrow keys to invoke them. If the range is really an
/// ITextSelection object, then methods like MoveLeft and MoveRight can be used.
///
///
/// If Unit specifies characters ( tomCharacter), the Text Object Model (TOM) uses the Unicode character set. To
/// convert between Unicode and multibyte character sets the MultiByteToWideChar and WideCharToMultiByte functions provide easy ways
/// to convert between Unicode and multibyte character sets on import and export, respectively. For more information, see Open. In
/// this connection, the use of a carriage return/line feed (CR/LF) to separate paragraphs is as problematic as double-byte character
/// set (DBCS). The ITextSelection UI methods back up over a CR/LF as if it were a single character, but the ITextRange::Move
/// methods count CR/LFs as two characters. It's clearly better to use a single character as a paragraph separator, which in TOM is
/// represented by a character return, although the Unicode paragraph separator character, 0x2029, is accepted. In general, TOM
/// engines should support CR/LF, carriage return (CR), line feed (LF), vertical tab, form feed, and 0x2029. Microsoft Rich Edit 2.0
/// also supports CR/CR/LF for backward compatibility.
///
///
/// See also the ITextRange::MoveStart and ITextRange::MoveEnd methods, which move the range Start or End position Count Â
/// Unit s, respectively.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-move HRESULT Move( long Unit, long Count, long *pDelta );
new tomConstants Move(tomConstants Unit, int Count);
/// Moves the start position of the range the specified number of units in the specified direction.
///
/// Type: long
///
/// Unit used in the move. The default value is tomCharacter. For a list of the other Unit values, see the discussion
/// under ITextRange.
///
///
///
/// Type: long
///
/// Number of units to move. The default value is 1. If Count is greater than zero, motion is forwardâtoward the end of the
/// storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the start
/// position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end is moved. The value can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStart is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestart HRESULT MoveStart( long Unit, long Count, long
// *pDelta );
new tomConstants MoveStart(tomConstants Unit, int Count);
/// Moves the end position of the range.
///
/// Type: long
///
/// The units by which to move the end of the range. The default value is tomCharacter. For a list of the other unit values,
/// see ITextRange.
///
///
///
/// Type: long
///
/// The number of units to move past. The default value is 1. If Count is greater than zero, motion is forwardâtoward the
/// end of the storyâand if Count is less than zero, motion is backwardâtoward the beginning. If Count is zero, the
/// end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of units that the end position of the range is moved past. The value can be null.
///
///
///
/// If the new end position precedes the old start position, the new start position is set equal to the new end position; that is, it
/// becomes a degenerate range or an insertion point.
///
///
/// The motion described by ITextRange::MoveEnd is logical rather than geometric. That is, motion is toward the end or toward
/// the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveend HRESULT MoveEnd( long Unit, long Count, long
// *pDelta );
new tomConstants MoveEnd(tomConstants Unit, int Count);
///
/// Starts at a specified end of a range and searches while the characters belong to the set specified by Cset and while the
/// number of characters is less than or equal to Count. The range is collapsed to an insertion point when a non-matching
/// character is found.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search starts at the start position and goes backward â toward the beginning of the story.
/// If Count is greater than zero, the search starts at the end position and goes forward â toward the end of the story.
///
///
///
/// Type: long*
/// The actual count of characters end is moved. This parameter can be null.
///
///
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or toward the
/// start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveWhile method is similar to ITextRange::MoveUntil, but MoveWhile searches as long as it finds
/// members of the set specified by Cset, and there is no additional increment to the value pDelta.
///
///
/// The ITextRange::MoveStartWhile and ITextRange::MoveEndWhile methods move the start and end, respectively, just past all
/// contiguous characters that are found in set of characters specified by the Cset parameter.
///
///
/// The VARIANT type is primarily intended to be used with IDispatch scenarios like Microsoft Visual Basic for
/// Applications (VBA), but it can be readily used from C or C++ as well. The following C++ code illustrates how to initialize and
/// use the VARIANT argument for matching a span of digits in the range r.
///
/// Alternatively, an explicit string could be used, as in the following sample.
///
/// The following VBA example code matches the body of the next Standard Generalized Markup Language (SGML) entry in a range, r. SGML
/// entries start with < > and end with </ >.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movewhile HRESULT MoveWhile( VARIANT *Cset, long Count,
// long *pDelta );
new int MoveWhile([In] object Cset, int Count);
///
/// Moves the start position of the range either Count characters, or just past all contiguous characters that are found in
/// the set of characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
/// The actual count of characters that the start position is moved. This parameter can be null.
///
///
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartwhile HRESULT MoveStartWhile( VARIANT *Cset,
// long Count, long *pDelta );
new int MoveStartWhile([In] object Cset, int Count);
///
/// Moves the end of the range either Count characters or just past all contiguous characters that are found in the set of
/// characters specified by Cset, whichever is less.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
/// The actual number of characters that the end is moved. The value can be null.
///
///
/// If the new end precedes the old start, the new start is set equal to the new end.
///
/// The motion described by ITextRange::MoveEndWhile is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveendwhile HRESULT MoveEndWhile( VARIANT *Cset, long
// Count, long *pDelta );
new int MoveEndWhile([In] object Cset, int Count);
///
/// Searches up to Count characters for the first character in the set of characters specified by Cset. If a character
/// is found, the range is collapsed to that point. The start of the search and the direction are also specified by Count.
///
///
/// Type: VARIANT*
///
/// The character set used in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is less than zero, the search is backward starting at the start position. If Count is greater than zero, the
/// search is forward starting at the end.
///
///
///
/// Type: long*
///
/// The number of characters the insertion point is moved, plus 1 for a match if Count is greater than zero, and â1 for a
/// match if Count less than zero. The pointer can be null.
///
///
///
/// If no character is matched, the range is unchanged.
///
/// The motion described by ITextRange::MoveUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see the discussion in ITextRange and the Remarks section of ITextRange::Move.
///
/// The ITextRange::MoveStartUntil and ITextRange::MoveEndUntil methods move the start and end, respectively, until it finds the
/// first character that is also in the set specified by the Cset parameter.
///
///
/// The ITextRange::MoveUntil method is similar to ITextRange::MoveWhile, but there are two differences. First,
/// MoveUntil moves an insertion point until it finds the first character that belongs to the character set specified
/// by Cset. Second, in MoveUntil the character matched counts as an additional character in the value returned in
/// pDelta. This lets you know that the character at one end of the range or the other belongs to the Cset even though
/// the insertion point stays at one of the range ends.
///
///
/// For example, suppose the range, r, is an insertion point. To see if the character at r (that is, given by r.GetChar()) is in
/// Cset, call
///
///
/// If the character is in Cset, the return value is 1 and the insertion point does not move. Similarly, to see if the
/// character preceding r is in Cset, call
///
/// If the character is in Cset, the return value is â1.
///
/// The following Microsoft Visual Basic for Applications (VBA) subroutine prints all numbers in the story identified by the range, r.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveuntil HRESULT MoveUntil( VARIANT *Cset, long Count,
// long *pDelta );
new int MoveUntil([In] object Cset, int Count);
///
/// Moves the start position of the range the position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the start position.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search is forwardâtoward the end of the storyâand if Count is less than zero,
/// search is backwardâtoward the beginning. If Count is zero, the start position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters the start of the range is moved, plus 1 for a match if Count is greater than zero, and
/// â1 for a match if Count is less than zero. The value can be null.
///
///
///
/// If no character from Cset is found within Count positions of the start position, the range is left unchanged.
/// If the new start follows the old end, the new end is set equal to the new start.
///
/// The motion described by ITextRange::MoveStartUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-movestartuntil HRESULT MoveStartUntil( VARIANT *Cset,
// long Count, long *pDelta );
new int MoveStartUntil([In] object Cset, int Count);
///
/// Moves the range's end to the character position of the first character found that is in the set of characters specified by
/// Cset, provided that the character is found within Count characters of the range's end.
///
///
/// Type: VARIANT*
///
/// The character set to use in the match. This could be an explicit string of characters or a character-set index. For more
/// information, see Character Match Sets.
///
///
///
/// Type: long
///
/// Maximum number of characters to move past. The default value is tomForward, which searches to the end of the story. If
/// Count is greater than zero, the search moves forward (toward the end of the story). If Count is less than zero, the
/// search moves backward (toward the beginning of the story). If Count is zero, the end position is unchanged.
///
///
///
/// Type: long*
///
/// The actual number of characters that the range end is moved, plus 1 for a match if Count is greater than zero, and â1
/// for a match if Count is less than zero. The value can be null.
///
///
///
///
/// If no character from the set specified by Cset is found within Count positions of the range's end, the range is
/// left unchanged. If the new end precedes the old start, the new start is set equal to the new end.
///
///
/// The motion described by ITextRange::MoveEndUntil is logical rather than geometric. That is, motion is toward the end or
/// toward the start of a story. Depending on the language, moving to the end of the story could be moving left or moving right.
///
/// For more information, see ITextRange and ITextRange::Move.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-moveenduntil HRESULT MoveEndUntil( VARIANT *Cset, long
// Count, long *pDelta );
new int MoveEndUntil([In] object Cset, int Count);
///
/// Searches up to Count characters for the text given by bstr. The starting position and direction are also specified
/// by Count, and the matching criteria are given by Flags.
///
///
/// Type: BSTR
/// String to find.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Searches to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
///
/// Searches forward for n chars, starting from cpFirst. If the range itself matches bstr, another search is
/// attempted from cpFirst + 1.
///
///
/// -
/// n(less than 0)
///
/// Searches backward for n chars, starting from cpLim. If the range itself matches bstr, another search is
/// attempted from cpLim â 1.
///
///
/// -
/// 0 (degenerate range)
/// Search begins after the range.
///
/// -
/// 0 (nondegenerate range)
/// Search is limited to the range.
///
///
/// Â
///
/// In all cases, if a string is found, the range limits are changed to be those of the matched string and pLength is set
/// equal to the length of the string. If the string is not found, the range remains unchanged and pLength is set equal to zero.
///
///
///
/// Type: long
/// Flags governing comparisons. It can be 0 (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
///
///
/// The ITextRange::FindText method can also match special characters by using a caret (^) followed by a special letter. For a
/// list of special characters, see the Special list available in the Microsoft Word Find and Replace dialog box. For
/// example, matches the next paragraph mark. Note, can be used to represent the Clipboard contents in the string to be replaced.
/// Thus, using in the find string enables you to search for rich text. For more details, see the Word Help files.
///
///
/// As a comparison with the ITextRange::FindText method, the ITextRange::FindTextStart method searches forward or backward
/// from the range's Start cp, and the ITextRange::FindTextEnd method searches forward or backward from the range's End
/// cp. For more details, see the descriptions of these methods.
///
/// The following are several code snippets that show the ITextRange::FindText methods.
///
/// Example #1. The following Microsoft Visual Basic for Applications (VBA) program prints all the /* ... */ comments in a story
/// identified by the range r.
///
///
/// Instead of these comments being printed, they could be inserted into another edit instance and saved to a file, or they could be
/// inserted into separate cells in a table or spreadsheet.
///
/// To print all lines containing one or more occurrences of the word "laser", replace the loop by the following code:
///
/// Example #2. The following program prints a telephone list, given a story that contains an address list. The address list entries
/// are separated by two or more paragraph marks, and each entry has the following form.
///
/// Note the use of the character in the FindText string argument to locate a pair of consecutive paragraph marks.
/// Example #3. The following subroutine replaces all occurrences of the string, str1, in a range by str2:
///
/// Example #4. The following line of code inserts a blank before the first occurrence of a right parenthesis, "(", that follows an
/// occurrence of HRESULT.
///
///
/// To do this for all such occurrences, change the If into a While/Wend loop in the above line of code. This an example of a
/// FIND/REPLACE macro that cannot be run with Find and Replace dialog boxes.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtext HRESULT FindText( BSTR bstr, long Count, long
// Flags, long *pLength );
new int FindText([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting at the range's Start cp ( cpFirst).
/// The search is subject to the comparison parameter, Flags. If the string is found, the Start cp is changed to the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged,
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// The string to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n(greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n(less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing the comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of the matched string.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextstart HRESULT FindTextStart( BSTR bstr, long
// Count, long Flags, long *pLength );
new int FindTextStart([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
///
/// Searches up to Count characters for the string, bstr, starting from the range's End cp. The search is
/// subject to the comparison parameter, Flags. If the string is found, the End cp is changed to be the end of the
/// matched string, and pLength is set equal to the length of the string. If the string is not found, the range is unchanged
/// and pLength is set equal to zero.
///
///
/// Type: BSTR
/// String to search for.
///
///
/// Type: long
/// Maximum number of characters to search. It can be one of the following.
///
///
/// tomForward
/// Search to the end of the story. This is the default value.
///
/// -
/// n (greater than 0)
/// Search forward for n chars, starting from cpLim.
///
/// -
/// n (less than 0)
/// Search backward for n chars, starting from cpLim.
///
///
///
///
/// Type: long
/// Flags governing comparisons. It can be zero (the default) or any combination of the following values.
///
///
/// tomMatchWord
/// 2
/// Matches whole words.
///
/// -
/// tomMatchCase
/// 4
/// Matches case.
///
/// -
/// tomMatchPattern
/// 8
/// Matches regular expressions.
///
///
///
///
/// Type: long*
/// The length of string matched.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-findtextend HRESULT FindTextEnd( BSTR bstr, long Count,
// long Flags, long *pLength );
new int FindTextEnd([MarshalAs(UnmanagedType.BStr)] string bstr, int Count, tomConstants Flags);
/// Mimics the DELETE and BACKSPACE keys, with and without the CTRL key depressed.
///
/// Type: long
/// Unit to use. Unit can be tomCharacter (the default value) or tomWord.
///
///
/// Type: long
///
/// Number of Unit s to delete. If Count= zero, it deletes the text in the range only. If Count is greater than
/// zero, ITextRange::Delete acts as if the DELETE key was pressed Count times. If Count is less than zero, it
/// acts as if the BACKSPACE key was pressed Count times. The default value is 1. For more information, see the Remarks.
///
///
///
/// Type: long*
///
/// The count of units deleted. It can be null. The pDelta parameter is set equal to the number of Unit s deleted.
/// Deleting the text in a nondegenerate range counts as one Unit.
///
///
///
///
/// If Count = zero, this method deletes the text in the range, that is, it deletes nothing if the range is only an insertion point.
///
///
/// If Count is not zero, and the range is an insertion point (that is, degenerate), | Count| (absolute value of
/// Count) Unit s are deleted in the logical direction given by the sign of Count, where a positive value is the
/// direction toward the end of the story, and a negative value is toward the start of the story.
///
///
/// If Count is not zero, and the range is nondegenerate (contains text), the text in the range is deleted (regardless of the
/// values of Unit and Count), thereby creating an insertion point. Then, | Count| - 1 Â Unit s are
/// deleted in the logical direction given by the sign of Count.
///
///
/// The text in the range can also be deleted by assigning a null string to the range (executing statement r = where r is the range).
/// However, ITextRange::Delete does not require allocating a BSTR.
///
///
/// Deleting the end-of-paragraph mark (CR) results in the special behavior of the Microsoft Word UI. Four cases are of particular interest:
///
///
/// -
///
/// If you delete just the CR but the paragraph includes text, then the CR is deleted, and the following paragraph gets the same
/// paragraph formatting as current one.
///
///
/// -
///
/// If you delete the CR as well as some, but not all, of the characters in the following paragraph, the characters left over from
/// the current paragraph get the paragraph formatting of the following paragraph.
///
///
/// -
/// If you select to the end of a paragraph, but not the whole paragraph, the CR is not deleted.
///
/// -
///
/// If you delete the whole paragraph (from the beginning through the CR), you delete the CR as well (unless it is the final CR in
/// the file).
///
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-delete HRESULT Delete( long Unit, long Count, long
// *pDelta );
new int Delete(tomConstants Unit, int Count);
/// Cuts the plain or rich text to a data object or to the Clipboard, depending on the pVar parameter.
///
/// Type: VARIANT*
///
/// The cut text. pVar->ppunkVal is the out parameter for an IDataObject object, provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-cut HRESULT Cut( VARIANT *pVar );
new void Cut(out object pVar);
/// Copies the text to a data object.
///
/// Type: VARIANT*
///
/// The copied text. pVar->ppunkVal is the out parameter for an IDataObject provided that the following conditions exist:
///
///
/// -
/// pVar->vt = (VT_UNKNOWN | VT_BYREF)
///
/// -
/// pVar is not null
///
/// -
/// pVar->ppunkVal is not null
///
///
/// Otherwise, the clipboard is used.
///
///
///
/// The ITextRange::Cut, ITextRange::Copy, and ITextRange::Paste methods let you perform the usual Cut, Copy,
/// and Paste operations on a range object using an IDataObject, thereby not changing the contents of the clipboard. Among
/// clipboard formats typically supported are CF_TEXT and CF_RTF. In addition, private clipboard formats can be used to
/// reference a text solution's own internal rich text formats.
///
///
/// To copy and replace plain text, you can use the ITextRange::GetText and ITextRange::SetText methods. To copy
/// formatted text from range r1 to range r2 without using the clipboard, you can use Copy and Paste and also the
/// ITextRange::GetFormattedText and ITextRange::SetFormattedText methods, as shown in the following Microsoft Visual Basic example:
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-copy HRESULT Copy( VARIANT *pVar );
new void Copy(out object pVar);
/// Pastes text from a specified data object.
///
/// Type: VARIANT*
/// The IDataObject to paste. However, the contents of the clipboard are used if any of the following are true.
/// pVar is null
/// pVar punkVal is null
/// pVar is not VT_UNKNOWN
/// pVar punkVal does not return an IDataObject when queried for one
///
///
/// Type: long
///
/// The clipboard format to use in the paste operation. Zero is best format, which usually is RTF, but CF_UNICODETEXT and
/// other formats are also possible. The default value is zero. For more information, see Clipboard Formats.
///
///
///
/// Type: HRESULT
///
/// If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more
/// information about COM error codes, see Error Handling in COM.
///
///
///
/// Return code
/// Description
///
/// -
/// E_ACCESSDENIED
/// Destination is write-protected.
///
/// -
/// E_OUTOFMEMORY
/// Destination cannot contain the text to be pasted.
///
///
///
/// For more information, seeITextRange::Copy.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-paste HRESULT Paste( VARIANT *pVar, long Format );
new void Paste([In] object pVar, int Format);
/// Determines if a data object can be pasted, using a specified format, into the current range.
///
/// Type: VARIANT*
/// The IDataObject to be pasted. However, the Clipboard contents are checked for pasting if any of the following are true:
///
/// -
/// pVar is null
///
/// -
/// pVar->punkVal is null
///
/// -
/// pVar->vt is not VT_UNKNOWN
///
/// -
/// pVar->punkVal does not return an IDataObject object when queried for one
///
///
///
///
/// Type: long
///
/// Clipboard format that is used. Zero represents the best format, which usually is RTF, but CF_UNICODETEXT and other formats
/// are also possible. The default value is zero.
///
///
///
/// Type: long*
///
/// A tomBool value that is tomTrue only if the data object identified by pVar can be pasted, using the specified
/// format, into the range. This parameter can null.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canpaste HRESULT CanPaste( VARIANT *pVar, long Format,
// long *pValue );
new tomConstants CanPaste([In] object pVar, int Format);
/// Determines whether the specified range can be edited.
///
/// Type: long*
///
/// A tomBool value indicating whether the range can be edited. It is tomTrue only if the specified range can be edited. The
/// pointer can be null.
///
///
/// The range cannot be edited if any part of it is protected or if the document is read-only.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-canedit HRESULT CanEdit( [retval] long *pValue );
new tomConstants CanEdit();
/// Changes the case of letters in this range according to the Type parameter.
///
/// Type: long
/// Type of case change. The default value is tomLower.
///
///
/// Value
/// Meaning
///
/// -
/// tomLowerCase 0
/// Sets all text to lowercase.
///
/// -
/// tomUpperCase 1
/// Sets all text to lowercase.
///
/// -
/// tomTitleCase 2
/// Capitalizes the first letter of each word.
///
/// -
/// tomSentenceCase 4
/// Capitalizes the first letter of each sentence.
///
/// -
/// tomToggleCase 5
/// Toggles the case of each letter.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-changecase HRESULT ChangeCase( [in] long Type );
new void ChangeCase(tomConstants Type);
///
/// Retrieves screen coordinates for the start or end character position in the text range, along with the intra-line position.
///
///
/// Type: long
///
/// Flag that indicates the position to retrieve. This parameter can include one value from each of the following tables. The default
/// value is tomStart + TA_BASELINE + TA_LEFT.
///
/// tomAllowOffClient
/// tomClientCoord
/// tomObjectArg
/// tomTransform
/// Use one of the following values to indicate the start or end of the range.
/// tomStart
/// tomEnd
/// Use one of the following values to indicate the vertical position.
///
///
/// TA_TOP
/// Top edge of the bounding rectangle.
///
/// -
/// TA_BASELINE
/// Base line of the text.
///
/// -
/// TA_BOTTOM
/// Bottom edge of the bounding rectangle.
///
///
/// Use one of the following values to indicate the horizontal position.
///
///
/// TA_LEFT
/// Left edge of the bounding rectangle.
///
/// -
/// TA_CENTER
/// Center of the bounding rectangle.
///
/// -
/// TA_RIGHT
/// Right edge of the bounding rectangle.
///
///
///
///
/// Type: long*
/// The x-coordinate.
///
///
/// Type: long*
/// The y-coordinate.
///
///
/// The ITextRange::GetPoint method gives ITextRange the ability to emulate UI-pointer commands; it is also handy for
/// accessibility purposes.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getpoint HRESULT GetPoint( long Type, long *px, long *py );
new void GetPoint(int Type, out int px, out int py);
///
/// Changes the range based on a specified point at or up through (depending on Extend) the point ( x, y)
/// aligned according to Type.
///
///
/// Type: long
/// Horizontal coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// Vertical coordinate of the specified point, in absolute screen coordinates.
///
///
/// Type: long
/// The end to move to the specified point. It can be one of the following.
///
///
/// tomStart
/// Move the start of range.
///
/// -
/// tomEnd
/// Move the end of range.
///
///
///
///
/// Type: long
///
/// How to set the endpoints of the range. If Extend is zero (the default), the range is an insertion point at the specified
/// point (or at the nearest point with selectable text). If Extend is 1, the end specified by Type is moved to the
/// point and the other end is left alone.
///
///
///
/// An application can use the specified point in the WindowFromPoint function to get the handle of the window, which usually can be
/// used to find the client-rectangle coordinates (although a notable exception is with Windowless Controls).
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-setpoint HRESULT SetPoint( [in] long x, [in] long y,
// [in] long Type, [in] long Extend );
new void SetPoint(int x, int y, tomConstants Type, int Extend);
/// Scrolls the specified range into view.
///
/// Type: long
/// Flag specifying the end to scroll into view. It can be one of the following.
///
///
/// Value
/// Meaning
///
/// -
/// tomEnd
/// Scrolls the end character position to appear on the bottom line.
///
/// -
/// tomStart
/// Scrolls the start character position to appear on the top line. (Default value).
///
/// -
/// tomNoUpScroll
///
///
/// -
/// tomNoVpScroll
///
///
///
///
///
/// Type: HRESULT
///
/// The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns S_FALSE.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-scrollintoview HRESULT ScrollIntoView( long Value );
[PreserveSig]
new HRESULT ScrollIntoView(tomConstants Value);
///
/// Retrieves a pointer to the embedded object at the start of the specified range, that is, at cpFirst. The range must either
/// be an insertion point or it must select only the embedded object.
///
///
/// Type: IUnknown**
/// The pointer to the object.
///
///
/// If the start of this range does not have an embedded object or if the range selects more than a single object, ppObject is
/// set equal to NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange-getembeddedobject HRESULT GetEmbeddedObject( IUnknown
// **ppObject );
[return: MarshalAs(UnmanagedType.IUnknown)]
new object GetEmbeddedObject();
/// Gets the count of characters in a range.
///
/// Type: long*
/// The signed count of characters.
///
///
/// The count of characters is the difference between the character position of the active end of the range, and the character
/// position of the anchor end. Some Text Object Model (TOM) implementations might include active ends only for a selection
/// (represented by the ITextSelection interface). The rich edit control's TOM implementation of a text range (represented by the
/// ITextRange interface) also has active ends.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcch HRESULT GetCch( [out, retval] long *pcch );
new int GetCch();
///
/// Not implemented.
/// Gets a cells object with the parameters of cells in the currently selected table row or column.
///
///
/// Type: IUnknown**
/// The cells object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcells HRESULT GetCells( [out, retval] IUnknown
// **ppCells );
[return: MarshalAs(UnmanagedType.IUnknown)]
new object GetCells();
///
/// Not implemented.
/// Gets the column properties for the currently selected column.
///
///
/// Type: IUnknown**
/// The column properties for the currently selected column.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcolumn HRESULT GetColumn( [out, retval] IUnknown
// **ppColumn );
[return: MarshalAs(UnmanagedType.IUnknown)]
new object GetColumn();
/// Gets the count of subranges, including the active subrange in the current range.
///
/// Type: long*
/// The count of subranges not including the active one.
///
///
///
/// If you select a range with no or one character, the count will be 1. But if you select a word and then move to a different
/// location, and select a second word not touching the first, then the count is 2.
///
/// See ITextRange2::AddSubrange to add subranges programmatically.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getcount HRESULT GetCount( [out, retval] long *pCount );
new int GetCount();
/// Gets a duplicate of a range object.
///
/// Type: ITextRange2**
/// The duplicate range.
///
///
/// If this range is an ITextSelection2 object, the duplicate returned is an ITextRange2 object. See the ITextRange::FindText method
/// for more information.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getduplicate2 HRESULT GetDuplicate2( [out, retval]
// ITextRange2 **ppRange );
new ITextRange2 GetDuplicate2();
/// Gets an ITextFont2 object with the character attributes of the current range.
///
/// Type: ITextFont2**
/// The ITextFont2 object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getfont2 HRESULT GetFont2( [out, retval] ITextFont2
// **ppFont );
new ITextFont2 GetFont2();
/// Sets the character formatting attributes of the range.
///
/// Type: ITextFont2*
/// The font object with the desired character formatting attributes.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setfont2 HRESULT SetFont2( [in] ITextFont2 *pFont );
new void SetFont2([In, Optional] ITextFont2? pFont);
/// Gets an ITextRange2 object with the current range's formatted text.
///
/// Type: ITextRange2**
/// The formatted text.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getformattedtext2 HRESULT GetFormattedText2( [out,
// retval] ITextRange2 **ppRange );
new ITextRange2 GetFormattedText2();
/// Sets the text of this range to the formatted text of the specified range.
///
/// Type: ITextRange2*
/// The range that contains the formatted text that replaces the text of this range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setformattedtext2 HRESULT SetFormattedText2( [in]
// ITextRange2 *pRange );
new void SetFormattedText2([In, Optional] ITextRange2? pRange);
/// Gets the gravity of this range.
///
/// Type: long*
/// The gravity value, which can be one of the following:
/// tomGravityUI
/// tomGravityBack
/// tomGravityFore
/// tomGravityIn
/// tomGravityOut
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getgravity HRESULT GetGravity( [out, retval] long
// *pValue );
new tomConstants GetGravity();
/// Sets the gravity of this range.
///
/// Type: long
/// The new gravity value, which can be one of the following.
/// tomGravityUI
/// tomGravityBack
/// tomGravityFore
/// tomGravityIn
/// tomGravityOut
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setgravity HRESULT SetGravity( [in] long Value );
new void SetGravity(tomConstants Value);
/// Gets an ITextPara2 object with the paragraph attributes of a range.
///
/// Type: ITextPara2**
/// The ITextPara2 object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getpara2 HRESULT GetPara2( [out, retval] ITextPara2
// **ppPara );
new ITextPara2 GetPara2();
/// Sets the paragraph format attributes of a range.
///
/// Type: ITextPara2*
/// The desired paragraph format.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setpara2 HRESULT SetPara2( [in] ITextPara2 *pPara );
new void SetPara2([In, Optional] ITextPara2? pPara);
/// Gets the row properties in the currently selected row.
///
/// Type: ITextRow**
/// The row properties.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getrow HRESULT GetRow( [out, retval] ITextRow **ppRow );
new ITextRow GetRow();
/// Gets the character position of the start of the paragraph that contains the range's start character position.
///
/// Type: long*
/// The start of the paragraph that contains the range's start character position.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getstartpara HRESULT GetStartPara( [out, retval] long
// *pValue );
new int GetStartPara();
///
/// Not implemented.
/// Gets the table properties in the currently selected table.
///
///
/// Type: IUnknown**
/// The table properties.
///
///
/// To select the table when the insertion point is inside a table, call ITextRange::Expand(tomTable).
/// Note: this method isn't implemented in RichEdit (see ITextRow for table functionality).
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-gettable HRESULT GetTable( [out, retval] IUnknown
// **ppTable );
[return: MarshalAs(UnmanagedType.IUnknown)]
new object GetTable();
/// Returns the URL text associated with a range.
///
/// Type: BSTR*
/// The URL text associated with the range.
///
///
/// This method sets the start and end positions of the range to that of the whole hyperlink, including the friendly name, if any.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-geturl HRESULT GetURL( [out, retval] BSTR *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
new string GetURL();
/// Sets the text in this range to that of the specified URL.
///
/// Type: BSTR
/// The text to use as a URL for the selected friendly name.
///
///
///
/// The URL string is not validated. The text it contains must be enclosed in quotes, optionally preceded by the sentinel character
/// 0xFDDF. For example: "http://www.msn.com" or 0xFDDF"http://www.msn.com". The range must be nondegenerate.
///
/// The following actions are possible:
///
/// -
/// If part of a link's friendly name is selected, the URL part is replaced with bstr.
///
/// -
/// If part of a regular URL is selected, it becomes the link's friendly name, with bstr as the URL.
///
/// -
/// If nonlink text is selected:
///
///
/// The text range be adjusted to different character positions after calling SetURL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-seturl HRESULT SetURL( [in] BSTR bstr );
new void SetURL([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Adds a subrange to this range.
///
/// Type: long
/// The active-end character position of the subrange.
///
///
/// Type: long
/// The anchor-end character position of the subrange.
///
///
/// Type: long
///
/// The activate parameter. If this parameter is tomTrue, the new subrange is the active subrange, with cp1 as the
/// active end, and cp2 the anchor end.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-addsubrange HRESULT AddSubrange( [in] long cp1, [in]
// long cp2, [in] long Activate );
new void AddSubrange(int cp1, int cp2, tomConstants Activate);
/// Converts the linear-format math in a range to a built-up form, or modifies the current built-up form.
///
/// Type: long
/// A combination of the following flags.
/// tomChemicalFormula
/// tomHaveDelimiter
/// tomMathAlphabetics
/// tomMathApplyTemplate
/// tomMathArabicAlphabetics
/// tomMathAutoCorrect
/// tomMathAutoCorrectExt
/// tomMathAutoCorrectOpPairs
/// tomMathBackspace
/// tomMathBuildDown
/// tomMathBuildDownOutermost
/// tomMathBuildUpArgOrZone
/// tomMathBuildUpRecurse
/// tomMathChangeMask
/// tomMathCollapseSel
/// tomMathDeleteArg
/// tomMathDeleteArg1
/// tomMathDeleteArg2
/// tomMathDeleteCol
/// tomMathDeleteRow
/// tomMathEnter
/// tomMathInsColAfter
/// tomMathInsColBefore
/// tomMathInsRowAfter
/// tomMathInsRowBefore
/// tomMathMakeFracLinear
/// tomMathMakeFracSlashed
/// tomMathMakeFracStacked
/// tomMathMakeLeftSubSup
/// tomMathMakeSubSup
/// tomMathRemoveOutermost
/// tomMathRichEdit
/// tomMathShiftTab
/// tomMathSingleChar
/// tomMathSubscript
/// tomMathSuperscript
/// tomMathTab
/// tomNeedTermOp
/// tomPlain
/// tomShowEmptyArgPlaceholders
/// tomTeX
///
///
///
/// If the ITextRange2::BuildUpMath method is called on a nondegenerate range, the method checks the text for math italic
/// conversions (if tomMathAlphabetics is specified) and math autocorrect conversions (if tomMathAutoCorrect or
/// tomMathAutoCorrectExt is specified). Then, the method attempts to build up the selected text. If successful, the method
/// replaces the previous text in the range with the built-up text. If the method makes any changes to the range, the function
/// returns NOERROR and the range selects the result. If the method does change the range, it returns S_FALSE or a
/// Component Object Model (COM) error code.
///
///
/// If the ITextRange2::BuildUpMath method is called on a degenerate range, the BuildUpMath method treats the range as
/// an insertion point (IP) immediately following the last character input. The method converts that character, possibly along with
/// some preceding characters, to math italic (if tomMathAlphabetics is specified), internal math autocorrect (if
/// tomMathAutoCorrect is specified), negated operators, and some operator pairs (if tomMathAutoCorrectOpPairs is
/// specified). If the IP is inside an argument, the method scans a range of text from the IP back to the start of a math object
/// argument; otherwise, the method scans to the start of the current math zone. The scan is terminated by a hard carriage return or
/// a soft end-of-paragraph mark, because math zones are terminated by these marks. A scan forward from start of the math object
/// argument or math zone bypasses text that has no chance of being built up. If the scan reaches the original entry IP, one of the
/// following outcomes can occur:
///
///
/// -
///
/// If the method made any changes, the function returns NOERROR and the range updated with the changed text.
///
///
/// -
/// If the method made no changes, the function returns S_FALSE and leaves the range unchanged.
///
///
///
/// If the scan finds text that might get built up, the BuildUpMath method attempts to build up the text up to the insertion
/// point. If successful, the method returns NOERROR, and the range is updated with the corresponding built-up text.
///
///
/// If this full build-up attempt fails, the BuildUpMath method does a partial build-up check for the expression immediately
/// preceding the IP. If this succeeds, the method returns NOERROR and the range contains the linear text to be replaced by
/// the built-up text.
///
///
/// If full and partial build-up attempts fail, the function returns as described previously for the cases where no build-up text was
/// found. Other possible return values include E_INVALIDARG (if either interface pointer is NULL) and E_OUTOFMEMORY.
///
///
/// You should set the tomNeedTermOp flag should for formula autobuildup unless autocorrection has occurred that deletes the
/// terminating blank. Autocorrection can occur when correcting text like \alpha when the user types a blank to force autocorrection.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-buildupmath HRESULT BuildUpMath( [in] long Flags );
new void BuildUpMath(tomConstants Flags);
/// Deletes a subrange from a range.
///
/// Type: long
/// The start character position of the subrange.
///
///
/// Type: long
/// The end character position of the subrange.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-deletesubrange HRESULT DeleteSubrange( [in] long
// cpFirst, [in] long cpLim );
new void DeleteSubrange(int cpFirst, int cpLim);
/// Searches for math inline functions in text as specified by a source range.
///
/// Type: ITextRange2*
/// The formatted text to find in the range's text.
///
///
/// Type: long
/// The number of characters to search through.
///
///
/// Type: long
/// Flags that control the search as defined for ITextRange::FindText.
///
///
/// Type: long*
/// A count of the number of characters bypassed.
///
///
///
/// If the string is found, and the math inline functions, if any, are the same as their counterparts in the source range, the range
/// limits are changed to be those of the matched string and length is set equal to the length of the string.
///
/// If the string isn't found, the range remains unchanged and length is set equal to 0.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-find HRESULT Find( [in] ITextRange2 *pRange, [in] long
// Count, [in] long Flags, [out] long *pDelta );
new tomConstants Find([In, Optional] ITextRange2? pRange, int Count, tomConstants Flags);
/// Gets the character at the specified offset from the end of this range.
///
/// Type: long*
/// The character value.
///
///
/// Type: long
/// The offset from the end of the range. An offset of 0 gets the character at the end of the range.
///
///
/// This method differs from ITextRange::GetChar in the following ways:
///
/// -
/// It returns the UTF-32 character for the surrogate pair instead of the pair's lead code.
///
/// -
///
/// It gets the character code, or codes, at the specified offset from the end of the range instead of the character at the start of
/// the range.
///
///
///
/// If the character is the lead code for a surrogate pair, the corresponding UTF-32 character is returned.
///
/// If Offset specifies a character before the start of the story or at the end of the story, this method returns the
/// character code 0.
///
///
///
/// If the Offset value is
/// This character is returned
///
/// -
/// 0
/// The character at the end of the range.
///
/// -
/// Negative and accesses the middle of a surrogate pair
/// The corresponding UTF-32 character.
///
/// -
/// Positive and accesses the middle of a surrogate pair
/// The UTF-32 character following that pair.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getchar2 HRESULT GetChar2( [out] long *pChar, [in] long
// Offset );
new void GetChar2(out int pChar, int Offset);
///
/// Not implemented.
/// Gets the drop-cap parameters of the paragraph that contains this range.
///
///
/// Type: long*
/// The count of lines for the drop cap. A value of 0 means no drop cap.
///
///
/// Type: long*
/// The position of the drop cap. The position can be one of the following:
///
/// -
/// tomDropMargin
///
/// -
/// tomDropNone
///
/// -
/// tomDropNormal
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getdropcap HRESULT GetDropCap( [out] long *pcLine,
// [out] long *pPosition );
new tomConstants GetDropCap(out int pcLine);
/// Gets the properties of the inline object at the range active end.
///
/// Type: long*
/// The inline object type can be one of the following:
/// tomSimpleText
/// tomRuby
/// tomHorzVert
/// tomWarichu
/// tomAccent
/// tomBox
/// tomBoxedFormula
/// tomBrackets
/// tomBracketsWithSeps
/// tomEquationArray
/// tomFraction
/// tomFunctionApply
/// tomLeftSubSup
/// tomLowerLimit
/// tomMatrix
/// tomNary
/// tomOpChar
/// tomOverbar
/// tomPhantom
/// tomRadical
/// tomSlashedFraction
/// tomStack
/// tomStretchStack
/// tomSubscript
/// tomSubSup
/// tomSuperscript
/// tomUnderbar
/// tomUpperLimit
///
///
/// Type: long*
/// The inline object alignment, which can be one of these meanings depending on the inline object type:
///
///
/// Inline object type
/// Meaning of Align Parameter
///
/// -
/// tomRuby
/// tomRubyBelow tomRubyAlignCenter (default) tomRubyAlign010 tomRubyAlign121 tomRubyAlignLeft tomRubyAlignRight
///
/// -
/// tomBox
///
/// tomBoxAlignCenter tomSpaceMask tomSpaceDefault tomSpaceUnary tomSpaceBinary tomSpaceRelational tomSpaceSkip tomSpaceOrd
/// tomSpaceDifferential tomSizeText tomSizeScript tomSizeScriptScript tomNoBreak tomTransparentForPositioning tomTransparentForSpacing
///
///
/// -
/// tomBoxedFormula
///
/// tomBoxHideTop tomBoxHideBottom tomBoxHideLeft tomBoxHideRight tomBoxStrikeH tomBoxStrikeV tomBoxStrikeTLBR tomBoxStrikeBLTR
///
///
/// -
/// tomBrackets
/// tomAlignDefault tomAlignCenter tomAlignMatchAscentDescent tomMathVariant
///
/// -
/// tomEquationArray
/// tomEqArrayLayoutWidth tomEqArrayAlignMask tomEqArrayAlignCenter tomEqArrayAlignTopRow tomEqArrayAlignBottomRow
///
/// -
/// tomMatrix
/// tomMatrixAlignMask tomMatrixAlignCenter tomMatrixAlignTopRow tomMatrixAlignBottomRow tomShowMatPlaceHldr
///
/// -
/// tomNary
///
/// tomLimitsDefault tomLimitsUnderOver tomLimitsSubSup tomUpperLimitAsSuperScript tomLimitsOpposite tomShowLLimPlaceHldr
/// tomShowULimPlaceHldr tomDontGrowWithContent tomGrowWithContent
///
///
/// -
/// tomPhantom
/// tomPhantomShow tomPhantomZeroWidth tomPhantomZeroAscent tomPhantomZeroDescent tomPhantomTransparent
///
/// -
/// tomRadical
/// tomShowDegPlaceHldr
///
/// -
/// tomSubSup
/// tomSubSupAlign
///
/// -
/// tomStretchStack
/// tomStretchCharBelow tomStretchCharAbove tomStretchBaseBelow tomStretchBaseAbove
///
///
///
///
/// Type: long*
/// The inline object character.
/// The value for each object type is shown in the following table..
///
///
/// Inline object type
/// Meaning of align parameter
///
/// -
/// tomAccent
/// Accent (U+0300âU+36F, U+20D0âU+20EF)
///
/// -
/// tomBoxedFormula
/// U+25AD for rectangle enclosure
///
/// -
/// tomBrackets
/// Opening bracket. Default: U+0028.
///
/// -
/// tomBracketsWithSeps
/// Opening bracket with separators. Default: U+0028
///
/// -
/// tomEquationArray
/// U+2588
///
/// -
/// tomFraction
/// Normal built-up fraction: U+002F; small numeric fraction: U+2298
///
/// -
/// tomFunctionApply
/// U+2061
///
/// -
/// tomLeftSubSup
/// U+005E
///
/// -
/// tomLowerLimit
/// U+252C
///
/// -
/// tomMatrix
///
/// U+25A0: no enclosing brackets U+24A8: enclosing parentheses (\pmatrix) U+24B1: enclosing vertical bars (\vmatrix) U+24A9:
/// enclosing double vertical bars (\Vmatrix)
///
///
/// -
/// tomNary
/// n-ary symbol
///
/// -
/// tomOpChar
/// Internal use for no-build operators
///
/// -
/// tomOverbar
/// U+00AF
///
/// -
/// tomPhantom
///
/// U+27E1: full or custom phantom U+2B04: horizontal phantom U+21F3: vertical phantom U+2B06: ascent smash U+2B07: descent smash
/// U+2B0C: horizontal smash U+2B0D: full smash
///
///
/// -
/// tomRadical
/// U+221A: square or nth root U+221B: cube root U+221C: fourth root
///
/// -
/// tomSlashedFraction
/// U+2044: skewed fraction U+2215: built-up linear fraction
///
/// -
/// tomStack
/// U+00A6
///
/// -
/// tomStretchStack
/// Horizontal stretch character (see Unicode Technical Note 28 Appendix B for a list)
///
/// -
/// tomSubscript
/// U+005E
///
/// -
/// tomSubSup
/// U+005E
///
/// -
/// tomSuperscript
/// U+005F
///
/// -
/// tomUnderbar
/// U+2581
///
/// -
/// tomUpperLimit
/// U+2534
///
///
///
///
/// Type: long*
///
/// The closing tomBrackets character. See Unicode Technical Note 28 Appendix B. Character Keywords and Properties for a list.
///
///
///
/// Type: long*
/// The separator character for tomBracketsWithSep:
/// U+007C: vertical bar with no extra spacing
/// U+2223: vertical bar with extra spacing
///
///
/// Type: long*
/// The inline object count of arguments.
///
///
/// Type: long*
/// The inline object TeX style, which can be one of the following values.
/// Note   The tomStyleDefault behavior depends on the context.
/// Â
/// tomStyleDefault
/// tomStyleScriptScriptCramped
/// tomStyleScriptScript
/// tomStyleScriptCramped
/// tomStyleScript
/// tomStyleTextCramped
/// tomStyleText
/// tomStyleDisplayCramped
/// tomStyleDisplay
///
///
/// Type: long*
/// The inline object count of columns ( tomMatrix only).
///
///
/// Type: long*
/// The inline object 0-based nesting level.
///
///
///
/// Unicode Technical Note 28 describes the alignment and character values in detail when the active end character is an inline
/// object start delimiter.
///
///
/// When that character is not a start delimiter, the character and column parameters are set to 0, the count is set to the 0-based
/// argument index, and the other parameters are set according to the active-end character properties of the innermost inline object argument.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getinlineobject HRESULT GetInlineObject( [out] long
// *pType, [out] long *pAlign, [out] long *pChar, [out] long *pChar1, [out] long *pChar2, [out] long *pCount, [out] long *pTeXStyle,
// [out] long *pcCol, [out] long *pLevel );
new int GetInlineObject(out tomConstants pType, out tomConstants pAlign, out int pChar, out int pChar1, out int pChar2, out int pCount, out tomConstants pTeXStyle, out int pcCol);
/// Gets the value of a property.
///
/// Type: long
/// The property ID.
///
///
/// Type: long*
/// The property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getproperty HRESULT GetProperty( [in] long Type, [out]
// long *pValue );
new int GetProperty(int Type);
/// Retrieves a rectangle of the specified type for the current range.
///
/// Type: long
/// The type of rectangle to return. This parameter can include one value from each of the following tables.
/// tomAllowOffClient
/// tomClientCoord
/// tomObjectArg
/// tomTransform
/// Use one of these values to indicate the vertical position:
///
///
/// TA_TOP
/// Top edge of the bounding rectangle.
///
/// -
/// TA_BASELINE
/// Base line of the text.
///
/// -
/// TA_BOTTOM
/// Bottom edge of the bounding rectangle.
///
///
/// Â
/// Use one of these values to indicate the horizontal position:
///
///
/// TA_LEFT
/// Left edge of the bounding rectangle.
///
/// -
/// TA_CENTER
/// Center of the bounding rectangle.
///
/// -
/// TA_RIGHT
/// Right edge of the bounding rectangle.
///
///
///
///
/// Type: long*
/// The left rectangle coordinate.
///
///
/// Type: long*
/// The top rectangle coordinate.
///
///
/// Type: long*
/// The right rectangle coordinate.
///
///
/// Type: long*
/// The bottom rectangle coordinate.
///
///
/// Type: long*
/// The hit-test value for the range.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getrect HRESULT GetRect( [in] long Type, [out] long
// *pLeft, [out] long *pTop, [out] long *pRight, [out] long *pBottom, [out] long *pHit );
new tomConstants GetRect(tomConstants Type, out int pLeft, out int pTop, out int pRight, out int pBottom);
/// Retrieves a subrange in a range.
///
/// Type: long
/// The subrange index.
///
///
/// Type: long*
/// The character position for the start of the subrange.
///
///
/// Type: long*
/// The character position for the end of the subrange.
///
///
/// Subranges are selected as follows.
///
///
/// iSubrange value
/// Subrange
///
/// -
/// Equals zero
/// Gets the current active subrange.
///
/// -
/// Greater than zero
///
/// Gets the subrange at the index specified by iSubrange, in the order in which the subranges were added. This requires extra calculation.
///
///
/// -
/// Less than zero
/// Gets the subrange at the index specified by iSubrange, in increasing character position order.
///
///
/// Â
/// See ITextRange2::GetCount for the count of subranges not including the active subrange.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getsubrange HRESULT GetSubrange( [in] long iSubrange,
// [out] long *pcpFirst, [out] long *pcpLim );
new void GetSubrange(int iSubrange, out int pcpFirst, out int pcpLim);
/// Gets the text in this range according to the specified conversion flags.
///
/// Type: long
///
/// The flags controlling how the text is retrieved. The flags can include a combination of the following values. Specifying a
/// Flags value of 0 is the same as calling the ITextRange::GetText method.
///
/// tomAdjustCRLF
/// tomUseCRLF
/// tomIncludeNumbering
/// tomNoHidden
/// tomNoMathZoneBrackets
/// tomTextize
/// tomAllowFinalEOP
/// tomTranslateTableCell
/// tomFoldMathAlpha
/// tomLanguageTag
///
///
/// Type: BSTR*
/// The text in the range.
///
///
/// This method includes the special flag tomLanguageTag to get the BCP-47 language tag for the range. This is an industry
/// standard language tag which may be preferable to the language code identifier (LCID) obtained by calling ITextFont::GetLanguageID.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-gettext2 HRESULT GetText2( [in] long Flags, [out] BSTR
// *pbstr );
new void GetText2(tomConstants Flags, [MarshalAs(UnmanagedType.BStr)] out string pbstr);
/// Converts and replaces the hexadecimal number at the end of this range to a Unicode character.
///
/// Some Unicode surrogates for hex values from 0x10000 up to 0x10FFFF are for internal use:
///
///
/// Hex values
/// Available for use
///
/// -
/// 7, 0xFDD0 â 0xFDEF, 0xFFF9 â 0xFFFF
/// Internal use only
///
/// -
/// 0xA â 0xD in the C0 range (0-0x1F)
/// Available for use
///
/// -
/// C1 range (0x80 â 0x9F)
/// Internal use only
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-hextounicode HRESULT HexToUnicode();
new void HexToUnicode();
/// Inserts a table in a range.
///
/// Type: long
/// The number of columns in the table.
///
///
/// Type: long
/// The number of rows in the table.
///
///
/// Type: long
/// Specifies how the cells fit the target space.
///
///
/// If the range is nondegenerate, the table replaces the text in the range. The column widths are calculated according to the
/// AutoFit parameter, and the borders are solid black with 0.5 point widths. To change these defaults, use the
/// ITextRange2::GetRow method to obtain an ITextRow interface.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-inserttable HRESULT InsertTable( [in] long cCol, [in]
// long cRow, [in] long AutoFit );
new void InsertTable(int cCol, int cRow, int AutoFit);
/// Translates the built-up math, ruby, and other inline objects in this range to linearized form.
///
/// Type: long
/// A combination of the following flags.
/// tomMathAlphabetics
/// tomMathBuildDownOutermost
/// tomMathBuildUpArgOrZone
/// tomMathRemoveOutermost
/// tomPlain
/// tomTeX
///
///
/// If the linearization is successful, the originally selected range is replaced by the linearized version.
///
/// If the tomMathRemoveOutermost or tomMathBuildDownOutermost build down mode is specified, the build down operation
/// can be affected by the tomMathChangeMask values.
///
///
/// The main purpose of these build-down modes is to facilitate transformations of the build-up math object as exposed by math
/// context menus.
///
///
/// For example, to convert a stacked fraction to a linear fraction as in (a+b/c)/(u+x/y)â((a+b/c))â((u+x/y)), parentheses must
/// be inserted; otherwise, you get a transformation that looks incorrect, as in (a+b/c)/(u+x/y)â(a+b/c)â(u+x/y), even though
/// internally the linear fraction still has the original numerator and denominator.
///
///
/// The build-down process automatically inserts the parentheses, because the linear format for this case has parentheses, and the
/// special change is made to replace the stacked-fraction operator U+002F by the linear fraction operator U+2215. Build up doesn't
/// discard the parentheses for U+2215, but it does for U+002F.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-linearize HRESULT Linearize( [in] long Flags );
new void Linearize(tomConstants Flags);
/// Makes the specified subrange the active subrange of this range.
///
/// Type: long
/// The anchor end character position of the subrange to make active.
///
///
/// Type: long
/// The active end character position of the subrange to make active.
///
/// The active subrange is the one affected by operations such as Shift+Arrow keys if this range is the selection.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setactivesubrange HRESULT SetActiveSubrange( [in] long
// cpAnchor, [in] long cpActive );
new void SetActiveSubrange(int cpAnchor, int cpActive);
///
/// Not implemented.
/// Sets the drop-cap parameters for the paragraph that contains the current range.
///
///
/// Type: long
/// The count of lines for drop cap. Zero means no drop cap.
///
///
/// Type: long
/// The position of drop cap. It can be one of the following.
///
///
///
/// The current range can be degenerate, or you can select up to the complete drop-cap paragraph. If the range contains more than one
/// paragraph, this method returns E_FAIL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setdropcap HRESULT SetDropCap( [in] long cLine, [in]
// long Position );
new void SetDropCap(int cLine, int Position);
/// Sets the value of the specified property.
///
/// Type: long
/// The ID of the property to set.
///
///
/// Type: long
/// The new property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setproperty HRESULT SetProperty( [in] long Type, [in]
// long Value );
new void SetProperty(tomConstants Type, int Value);
/// Sets the text of this range.
///
/// Type: long
/// Flags controlling how the text is inserted in the range. The flag can be one of the following values:
/// tomUnicodeBiDi
/// tomMathCFCheck
/// tomUnlink
/// tomUnhide
/// tomCheckTextLimit
/// tomLanguageTag
///
///
/// Type: BSTR
/// The new text.
///
///
/// If the bstr parameter is NULL, the text in the range is deleted.
///
/// This method is similar to ITextRange:: SetText, but lets the client specify flags that control various insertion options,
/// including the special flag tomLanguageTag to get the BCP-47 language tag for the range. This is an industry standard
/// language tag that may be preferable to ITextFont::SetLanguageID, which uses a language code identifier (LCID).
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-settext2 HRESULT SetText2( [in] long Flags, [in] BSTR
// bstr );
new void SetText2(tomConstants Flags, [MarshalAs(UnmanagedType.BStr)] string bstr);
///
/// Converts the Unicode character(s) preceding the start position of this text range to a hexadecimal number, and selects it.
///
///
/// Some Unicode surrogates for hex values from 0x10000 up to 0x10FFFF are for internal use:
///
///
/// Hex values
/// Available for use
///
/// -
/// 0xFDD0 â 0xFDEF, 0xFFF9-0xFFFF
/// Internal use only
///
/// -
/// 0xA â 0xD in the C0 range (0-0x1F)
/// Available for use
///
/// -
/// C1 range (0x80 â 0x9F)
/// Internal use only
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-unicodetohex HRESULT UnicodeToHex();
new void UnicodeToHex();
/// Sets or inserts the properties of an inline object for a degenerate range.
///
/// Type: long
/// The object type as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The object alignment as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The object character as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The closing bracket (tomBrackets) character. See Unicode Technical Note 28 for a list of characters.
///
///
/// Type: long
/// The separator character for tomBracketsWithSeps, which can be one of the following values.
///
///
/// Type: long
/// The number of arguments in the inline object.
///
///
/// Type: long
/// The TeX style, as defined in ITextRange2::GetInlineObject.
///
///
/// Type: long
/// The number of columns in the inline object. For tomMatrix only.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-setinlineobject HRESULT SetInlineObject( [in] long
// Type, [in] long Align, [in] long Char, [in] long Char1, [in] long Char2, [in] long Count, [in] long TeXStyle, [in] long cCol );
new void SetInlineObject(tomConstants Type, tomConstants Align, int Char, int Char1, int Char2, int Count, tomConstants TeXStyle, int cCol);
/// Retrieves the math function type associated with the specified math function name.
///
/// Type: BSTR
/// The math function name that is checked to determine the math function type.
///
///
/// Type: long*
/// The math function type of the function name specified by bstr. It can be one of the following values.
/// tomFunctionTypeNone
/// tomFunctionTypeTakesArg
/// tomFunctionTypeTakesLim
/// tomFunctionTypeTakesLim2
/// tomFunctionTypeIsLim
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-getmathfunctiontype HRESULT GetMathFunctionType( [in]
// BSTR bstr, [out] long *pValue );
new tomConstants GetMathFunctionType([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Inserts an image into this range.
///
/// Type: long
/// The width, in HIMETRIC units (0.01 mm), of the image.
///
///
/// Type: long
/// The height, in HIMETRIC units, of the image.
///
///
/// Type: long
///
/// If Type is TA_BASELINE, this parameter is the distance, in HIMETRIC units, that the top of the image extends above the
/// text baseline. If Type is TA_BASELINE and ascent is zero, the bottom of the image is placed at the text baseline.
///
///
///
/// Type: long
/// The vertical alignment of the image. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// TA_BASELINE
/// Align the image relative to the text baseline.
///
/// -
/// TA_BOTTOM
/// Align the bottom of the image at the bottom of the text line.
///
/// -
/// TA_TOP
/// Align the top of the image at the top of the text line
///
///
///
///
/// Type: BSTR
/// The alternate text for the image.
///
///
/// Type: IStream
/// The stream that contains the image data.
///
///
/// Type: HRESULT
/// If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.
///
/// If the range is nondegenerate, the image replaces the text in the range.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextrange2-insertimage HRESULT InsertImage( [in] long width, [in]
// long height, [in] long ascent, [in] long Type, [in] BSTR bstrAltText, [in] IStream *pStream );
new void InsertImage(int width, int height, int ascent, Gdi32.TextAlign Type, [MarshalAs(UnmanagedType.BStr)] string? bstrAltText,
[In, Optional] System.Runtime.InteropServices.ComTypes.IStream? pStream);
}
///
///
/// The ITextStory interface methods are used to access shared data from multiple stories, which is stored in the parent
/// ITextServices instance.
///
///
/// The stories can be "edited" simultaneously by using individual ITextRange2 methods, and displayed independently of one another. In
/// addition, one story at a time can be UI active; that is, it receives keyboard and mouse input.
///
///
/// The ITextStory is a lightweight interface that does not require an ITextRange2 object. This allows the client to manipulate a
/// story, which is a faster, smaller object than a complete editing instance.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextstory
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextStory")]
[ComImport, Guid("C241F5F3-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITextStory
{
/// Sets the active state of a story.
///
/// Type: long*
/// The active state. It can be one of the following values.
///
///
/// Value
/// Meaning
///
/// -
/// tomDisplayActive
/// The story has no UI or display (fast and lightweight).
///
/// -
/// tomDisplayUIActive
/// The story is UI active; that is, gets keyboard and mouse interactions.
///
/// -
/// tomInactive
/// The story has display, but no UI.
///
/// -
/// tomUIActive
/// The story has display and UI activity.
///
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-getactive HRESULT GetActive( [out, retval] long *pValue );
tomConstants GetActive();
/// Sets the active state of a story.
///
/// Type: long
/// The active state. For values, see the ITextStory::GetActive method.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-setactive HRESULT SetActive( [in] long Value );
void SetActive(tomConstants Value);
/// Gets a new display for a story.
///
/// Type: IUnknown**
/// The IUnknown interface for a display.
///
///
/// A story can be displayed by calling ITextStory::SetActive( tomDisplayActive). The ITextStory::GetDisplay method is
/// included, in case it might be advantageous to have more than one display for a set of ITextStory interfaces.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-getdisplay HRESULT GetDisplay( [out, retval] IUnknown
// **ppDisplay );
[return: MarshalAs(UnmanagedType.IUnknown)]
object GetDisplay();
/// Gets the index of a story.
///
/// Type: long*
/// The index.
///
/// The index is used with the ITextDocument2:: GetStory method.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-getindex HRESULT GetIndex( [out, retval] long *pValue );
int GetIndex();
/// Gets this story's type.
///
/// Type: long*
/// This story's type. It can be any of the following values, or a custom client value from 100 to 65535.
/// tomCommentsStory
/// tomEndnotesStory
/// tomEvenPagesFooterStory
/// tomEvenPagesHeaderStory
/// tomFindStory
/// tomFirstPageFooterStory
/// tomFirstPageHeaderStory
/// tomFootnotesStory
/// tomMainTextStory
/// tomPrimaryFooterStory
/// tomPrimaryHeaderStory
/// tomReplaceStory
/// tomScratchStory
/// tomTextFrameStory
/// tomUnknownStory
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-gettype HRESULT GetType( [out, retval] long *pValue );
tomConstants GetType();
/// Sets the story type.
///
/// Type: long
/// The story type. The type values are defined in ITextStory::GetType.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-settype HRESULT SetType( [in] long Value );
void SetType(tomConstants Value);
/// Gets the value of the specified property.
///
/// Type: long
/// The ID of the property. Currently, no extra properties are defined.
///
///
/// Type: long*
/// The property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-getproperty HRESULT GetProperty( [in] long Type, [out]
// long *pValue );
int GetProperty(int Type);
/// Gets a text range object for the story.
///
/// Type: long
/// The active end of the range.
///
///
/// Type: long
/// The anchor end of the range.
///
///
/// Type: ITextRange2**
/// The text range object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-getrange HRESULT GetRange( [in] long cpActive, [in] long
// cpAnchor, [out, retval] ITextRange2 **ppRange );
ITextRange2 GetRange(int cpActive, int cpAnchor);
/// Gets the text in a story according to the specified conversion flags.
///
/// Type: long
/// The conversion flags.
/// A Flags value of 0 retrieves text the same as ITextRange::GetText. Other values include the following.
/// tomAdjustCRLF
/// tomAllowFinalEOP
/// tomFoldMathAlpha
/// tomIncludeNumbering
/// tomNoHidden
/// tomNoMathZoneBrackets
/// tomLanguageTag
/// tomTextize
/// tomTranslateTableCell
/// tomUseCRLF
///
///
/// Type: BSTR*
/// The text in the story.
///
/// This method is similar to using ITextRange2::GetText2 for a whole story, but it doesnât require a range.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-gettext HRESULT GetText( [in] long Flags, [out] BSTR
// *pbstr );
[return: MarshalAs(UnmanagedType.BStr)]
string GetText(tomConstants Flags);
/// Replaces a storyâs text with specified formatted text.
///
/// Type: IUnknown*
/// The formatted text to replace the storyâs text.
///
/// This method calls IUnknown::QueryInterface for an ITextRange2 interface.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-setformattedtext HRESULT SetFormattedText( [in] IUnknown
// *pUnk );
void SetFormattedText([In, Optional, MarshalAs(UnmanagedType.IUnknown)] object? pUnk);
/// Sets the value of the specified property.
///
/// Type: long
/// The Microsoft accountID that identifies the property. Currently, no extra properties are defined.
///
///
/// Type: long
/// The new property value.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-setproperty HRESULT SetProperty( [in] long Type, [in]
// long Value );
void SetProperty(int Type, int Value);
/// Replaces the text in a story with the specified text.
///
/// Type: long
/// Flags controlling how the text is inserted as defined in the following table:
/// tomCheckTextLimit
/// tomMathCFCheck
/// tomUnhide
/// tomUnicodeBiDi
/// tomUnlink
///
///
/// Type: BSTR
/// The new text for this story. If this parameter is NULL, the text in the story is deleted.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstory-settext HRESULT SetText( [in] long Flags, [in] BSTR bstr );
void SetText(tomConstants Flags, [MarshalAs(UnmanagedType.BStr)] string bstr);
}
/// The purpose of the ITextStoryRanges interface is to enumerate the stories in an ITextDocument.
///
/// You get a pointer to an ITextStoryRanges collection by calling the GetStoryRanges method. Each story obtained from this
/// collection is represented by an ITextRange object that covers the whole story. Text Object Model (TOM) engines that only have a
/// single story do not need to implement an ITextStoryRanges interface. Your code should only get a stories collection if
/// GetStoryCount returns a story count greater than one.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextstoryranges
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextStoryRanges")]
[ComImport, Guid("8CC497C5-A1DF-11ce-8098-00AA0047BE5D"), InterfaceType(dualIntType)]
public interface ITextStoryRanges
{
/// Retrieves an IEnumVARIANT enumerator interface for this collection of stories.
///
/// Type: IUnknown**
/// The pointer to the enumerator interface.
///
///
/// This definition together with the implementation of IEnumVARIANT, enables one to support the following Microsoft Visual
/// Basic for Applications (VBA) code.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstoryranges-_newenum HRESULT _NewEnum( IUnknown **ppunkEnum );
IEnumVARIANT NewEnum();
/// Retrieves an ITextRange object for the Index th story in this story collection.
///
/// Type: LONG
///
/// Index of story range that is retrieved. The default value is 1, which indicates the first story in the collection. Count,
/// given by ITextStoryRanges::GetCount, indicates the last story in the collection. If Index is less than zero, the stories
/// are counted from last to first, with -1 being the index of the last story in the collection, and Index = -Â Count
/// indicating the first story in the collection.
///
///
///
/// Type: ITextRange**
/// The ITextRange object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstoryranges-item HRESULT Item( long Index, ITextRange
// **ppRange );
ITextRange Item(int Index);
/// Retrieves the number of stories in the specified stories collection.
///
/// Type: long*
/// The count of stories.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstoryranges-getcount HRESULT GetCount( long *pCount );
int GetCount();
}
///
/// The ITextStoryRanges2 interface enumerates the stories in an ITextDocument.
///
/// You get a pointer to an ITextStoryRanges2 collection by using the ITextDocument::GetStoryRanges method. Each story obtained
/// from this collection is represented by an ITextRange2 object that covers the whole story.
///
///
/// A Text Object Model (TOM) implementation that has only a single story doesn't need to implement the ITextStoryRanges2
/// interface. An implementation of this interface should only retrieve a stories collection if ITextDocument::GetStoryCount returns a
/// story count greater than one.
///
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextstoryranges2
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextStoryRanges2")]
[ComImport, Guid("C241F5E5-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextStoryRanges2 : ITextStoryRanges
{
/// Retrieves an IEnumVARIANT enumerator interface for this collection of stories.
///
/// Type: IUnknown**
/// The pointer to the enumerator interface.
///
///
/// This definition together with the implementation of IEnumVARIANT, enables one to support the following Microsoft Visual
/// Basic for Applications (VBA) code.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstoryranges-_newenum HRESULT _NewEnum( IUnknown **ppunkEnum );
new IEnumVARIANT NewEnum();
/// Retrieves an ITextRange object for the Index th story in this story collection.
///
/// Type: LONG
///
/// Index of story range that is retrieved. The default value is 1, which indicates the first story in the collection. Count,
/// given by ITextStoryRanges::GetCount, indicates the last story in the collection. If Index is less than zero, the stories
/// are counted from last to first, with -1 being the index of the last story in the collection, and Index = -Â Count
/// indicating the first story in the collection.
///
///
///
/// Type: ITextRange**
/// The ITextRange object.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstoryranges-item HRESULT Item( long Index, ITextRange
// **ppRange );
new ITextRange Item(int Index);
/// Retrieves the number of stories in the specified stories collection.
///
/// Type: long*
/// The count of stories.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstoryranges-getcount HRESULT GetCount( long *pCount );
new int GetCount();
/// Gets an ITextRange2 object for a story, by index, in a stories collection.
///
/// Type: long
/// The index of the story range. The default value is 1.
///
///
/// Type: ITextRange2**
/// The range.
///
///
/// The first story has an index of 1, and the last story has an index equal to the count retrieved by the ITextStoryRanges::GetCount
/// method. Negative index values count from the last story to the first; that is, an index of â1 gets the last story in the
/// collection, and an index of â count gets the first story.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstoryranges2-item2 HRESULT Item2( [in] long Index, [out,
// retval] ITextRange2 **ppRange );
ITextRange2 Item2(int Index);
}
///
/// The ITextStrings interface represents a collection of rich-text strings that are useful for manipulating rich text. In
/// particular, you can use the collection to convert linearly formatted math expressions into built-up form and vice versa. You can also
/// use the collection to collect the concatenation of a set of rich-text strings, or to manipulate a string without changing a primary
/// story. The collection is efficiently implemented by concatenating the strings in a scratch story and maintaining an array of the
/// string counts that identify the strings.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nn-tom-itextstrings
[PInvokeData("tom.h", MSDNShortId = "NN:tom.ITextStrings")]
[ComImport, Guid("C241F5E7-7206-11D8-A2C7-00A0D1D6C6B3"), InterfaceType(dualIntType)]
public interface ITextStrings
{
/// Gets an ITextRange2 object for a selected index in a string collection.
///
/// Type: long
/// The index of the string to retrieve. The default value is 1.
///
///
/// Type: ITextRange2**
/// The object to receive the range.
///
/// The first string corresponds to Index = 1 and the last to Count which is given by ITextStrings_GetCount.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-item HRESULT Item( [in] long Index, [out, retval]
// ITextRange2 **ppRange );
ITextRange2 Item(int Index);
/// Gets the number of strings in a string collection.
///
/// Type: long*
/// The count of strings.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-getcount HRESULT GetCount( [out, retval] long *pCount );
int GetCount();
/// Adds a string to the end of the collection.
///
/// Type: BSTR
/// The string. The value can be NULL for a null string.
///
/// Adding an item to the end of a collection is like pushing a parameter onto the stack.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-add HRESULT Add( [in] BSTR bstr );
void Add([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Appends a string to the string at the specified index in the collection.
///
/// Type: ITextRange2*
/// The string to append.
///
///
/// Type: long
/// The string index.
///
///
/// The index is relative to the top of the collection, so if iString is equal to 0 the string is inserted at the top. If
/// iString is equal to â1, it is inserted below the top string, and so on.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-append HRESULT Append( [in] ITextRange2 *pRange, [in]
// long iString );
void Append([In, Optional] ITextRange2? pRange, int iString);
/// Concatenates two strings.
///
/// Type: long
/// The string.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-cat2 HRESULT Cat2( [in] long iString );
void Cat2(int iString);
/// Inserts text between the top two strings in a collection.
///
/// Type: BSTR
/// The text to insert. The value can be NULL.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-cattop2 HRESULT CatTop2( [in] BSTR bstr );
void CatTop2([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Deletes the contents of a given range.
///
/// Type: ITextRange2*
/// The range to delete.
///
/// If the text selected by the range is not completely contained by the string, the method fails.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-deleterange HRESULT DeleteRange( [in] ITextRange2
// *pRange );
void DeleteRange([In, Optional] ITextRange2? pRange);
/// Encodes an object, given a set of argument strings.
///
/// Type: long
/// The object type. See ITextRange2::GetInlineObject for a table of definitions.
///
///
/// Type: long
/// The object alignment. See ITextRange2::GetInlineObject for a table of definitions.
///
///
/// Type: long
/// The object character.
///
///
/// Type: long
/// The object character.
///
///
/// Type: long
/// The object character.
///
///
/// Type: long
/// The count of strings (arguments) to concatenate.
///
///
/// Type: long
/// The TeX style.
///
///
/// Type: long
/// The count of columns ( tomArray only).
///
///
/// Type: ITextRange2*
/// The specifying range that points at the desired formatting.
///
/// See ITextRange2::GetInlineObject for a more detailed discussion of the arguments.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-encodefunction HRESULT EncodeFunction( [in] long Type,
// [in] long Align, [in] long Char, [in] long Char1, [in] long Char2, [in] long Count, [in] long TeXStyle, [in] long cCol, [in]
// ITextRange2 *pRange );
void EncodeFunction(int Type, int Align, int Char, int Char1, int Char2, int Count, int TeXStyle, int cCol,
[In, Optional] ITextRange2? pRange);
/// Gets the count of characters for a selected string index.
///
/// Type: long
/// The string index.
///
///
/// Type: long*
/// The string character count.
///
///
/// The index is relative to the top of the collection, so iString = 0 returns the character count of the top string,
/// iString = â1 returns that for the one below the top string, and so on.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-getcch HRESULT GetCch( [in] long iString, [out] long
// *pcch );
int GetCch(int iString);
/// Inserts a NULL string in the collection at a selected string index.
///
/// Type: long
/// The string index.
///
///
/// The index is relative to the top of the collection, so iString = 0 inserts the NULL string at the top,
/// iString = â1 inserts it below the top string, and so on.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-insertnullstr HRESULT InsertNullStr( [in] long iString );
void InsertNullStr(int iString);
/// Moves the start boundary of a string, by index, for a selected number of characters.
///
/// Type: long
/// The string index.
///
///
/// Type: long
/// The selected number of characters to move the boundary.
///
///
/// The index is relative to the top of the collection, so iString = 0 moves the top string boundary, iString = â1
/// moves the boundary of the string below the top string, and so on.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-moveboundary HRESULT MoveBoundary( [in] long iString,
// [in] long cch );
void MoveBoundary(int iString, int cch);
/// Prefixes a string to the top string in the collection.
///
/// Type: BSTR
/// The string to prefix to the collection.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-prefixtop HRESULT PrefixTop( [in] BSTR bstr );
void PrefixTop([MarshalAs(UnmanagedType.BStr)] string bstr);
/// Removes a string from a string collection, starting at an index.
///
/// Type: long
/// The string index.
///
///
/// Type: long
/// The count of strings to remove.
///
///
/// The index is relative to the top of the collection, so iString = 0 removes the top string ( cString must be 1),
/// iString = â1 removes the one below the top string (and the top string if cString = 2), and so on.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-remove HRESULT Remove( [in] long iString, [in] long
// cString );
void Remove(int iString, int cString);
/// Replaces text with formatted text.
///
/// Type: ITextRange2*
/// The text to be replaced.
///
///
/// Type: ITextRange2*
/// The formatted text.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-setformattedtext HRESULT SetFormattedText( [in]
// ITextRange2 *pRangeD, [in] ITextRange2 *pRangeS );
void SetFormattedText([In, Optional] ITextRange2? pRangeD, [In, Optional] ITextRange2? pRangeS);
///
/// Sets the character position in the source range's story that has desired character formatting attributes. The
/// ITextStrings::EncodeFunction method applies those character formatting attributes to the operators specified by the Char,
/// Char1, and Char2 parameters.
///
///
/// Type: long
/// The index of the string to associate with a character position.
///
///
/// Type: long
/// The character position in source range's story that has the desired character formatting.
///
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-setopcp HRESULT SetOpCp( [in] long iString, [in] long
// cp );
void SetOpCp(int iString, int cp);
/// Suffixes a string to the top string in the collection.
///
/// Type: BSTR
/// The text to suffix to the top string.
///
///
/// Type: ITextRange2*
/// The range with the desired character formatting.
///
/// This method is similar to ITextStrings::Append, but appends a string instead of a range.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-suffixtop HRESULT SuffixTop( [in] BSTR bstr, [in]
// ITextRange2 *pRange );
void SuffixTop([MarshalAs(UnmanagedType.BStr)] string bstr, [In, Optional] ITextRange2? pRange);
/// Swaps the top two strings in the collection.
// https://learn.microsoft.com/en-us/windows/win32/api/tom/nf-tom-itextstrings-swap HRESULT Swap();
void Swap();
}
}