Text Object Model

Source: Wikipedia, the free encyclopedia.

The Text Object Model (TOM) is a

API that provides developers with object-based rich text manipulation interfaces. It is implemented through COM, and can be accessed through Microsoft Word or additionally through the RichEdit controls that normally ship with Windows.[1]

History

When TOM was developed, it was influenced heavily by WordBasic,

Pocket Word at that time.[2]

Version 8.0 of RichEdit, which shipped with

Technical details

To retrieve an implemented instance of ITextDocument interface (the top-level document interface), the EM_GETOLEINTERFACE message may be sent via the SendMessage API to obtain a pointer to an IRichEditOle object, which also implements the ITextDocument interface.[1] TOM may operate differently depending on the version of the RichEdit control the interface is retrieved for (RICHEDIT50W windows provide more functionality than the standard RICHEDIT20W or RICHEDIT20A controls, like proper table support).[2]

COM Interfaces

ITextDocument
A top-level interface. Documents may be opened and saved through this interface. Some screen update control is achieved here as well. Undo/redo grouping is implemented here. Arbitrary text ranges (ITextRange) and a text range for currently selected text (ITextSelection) are provided, which are used to modify or review the document.
ITextRange
Provides editing and data-binding tools to select text within a document, that can be examined, modified, or removed. Ranges exist within paragraphs, and the paragraph a range is within is accessible through a property of this object.
ITextSelection
Provides selection information, in addition to functionality provided by the ITextRange.
ITextFont
Dual Interface with ITextPara
A mechanism for inspection and modification of rich edit font attributes, that is considerably more extensive that the standard OLE interface used to describe a font (IFontDisp, StdFont).
ITextPara
Dual Interface with ITextFont
Provides extensive information about the position, formatting outside of fonts (e.g. first line indent), behavior (e.g. widow control), and purpose of a paragraph (it could be a normal paragraph, a list, a table, etc).

See also

References

  1. ^ a b c "Text Object Model". Retrieved 2011-12-04.
  2. ^ a b c "RichEdit versions". Retrieved 2023-11-19.
  3. ^ "DevBlogs".

External links