The Text Object Model (TOM) is a
Microsoft Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
API
An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
that provides developers with object-based rich text manipulation interfaces. It is implemented through
COM
Com or COM may refer to:
Computing
* COM (hardware interface), a serial port interface on IBM PC-compatible computers
* COM file, or .com file, short for "command", a file extension for an executable file in MS-DOS
* .com, an Internet top-level d ...
, and can be accessed through
Microsoft Word
Microsoft Word is a word processing software developed by Microsoft. It was first released on October 25, 1983, under the name ''Multi-Tool Word'' for Xenix systems. Subsequent versions were later written for several other platforms includin ...
or additionally through the RichEdit controls that normally ship with Windows.
History
When TOM was developed, it was influenced heavily by WordBasic,
a
macro language
In computer programming, a macro (short for "macro instruction"; ) is a rule or pattern that specifies how a certain input should be mapped to a replacement output. Applying a macro to an input is known as macro expansion. The input and output ...
used within Word before
VBA (
Word 95 and previous releases). TOM has developed alongside the RichEdit technology, and has been present since version 1.0 of the RichEdit components.
The API has been available as an option for
Windows CE
Windows Embedded Compact, formerly Windows Embedded CE, Windows Powered and Windows CE, is an operating system subfamily developed by Microsoft as part of its Windows Embedded family of products.
Unlike Windows Embedded Standard, which is base ...
since the 2.5 release of RichEdit (Western Languages Only), which was at least used by
Pocket Word
Microsoft Word is a word processing software developed by Microsoft. It was first released on October 25, 1983, under the name ''Multi-Tool Word'' for Xenix systems. Subsequent versions were later written for several other platforms includi ...
at that time.
Version 8.0 of RichEdit, which shipped with
Windows 8
Windows 8 is a major release of the Windows NT operating system developed by Microsoft. It was Software release life cycle#Release to manufacturing (RTM), released to manufacturing on August 1, 2012; it was subsequently made available for downl ...
, added support for
OpenType math
OpenType is a format for scalable computer fonts. It was built on its predecessor TrueType, retaining TrueType's basic structure and adding many intricate data structures for prescribing typographic behavior. OpenType is a registered trademark o ...
.
Technical details
To retrieve an implemented instance of
ITextDocument
interface
Interface or interfacing may refer to:
Academic journals
* ''Interface'' (journal), by the Electrochemical Society
* ''Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics''
* '' Inte ...
(the top-level document interface), the
EM_GETOLEINTERFACE
message may be sent via th
SendMessageAPI to obtain a pointer to an
IRichEditOle
object, which also implements the
ITextDocument
interface.
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).
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
*
Rich Text Format
)
As an example, the following RTF code
would be rendered as follows:
This is some bold text.
Character encoding
A standard RTF file can only consist of 7-bit ASCII characters, but can use escape sequences to encode other characters. Th ...
*
Component Object Model (COM)
*
Object Linking and Embedding
Object Linking & Embedding (OLE) is a proprietary technology developed by Microsoft that allows embedding and linking to documents and other objects. For developers, it brought OLE Control Extension (OCX), a way to develop and use custom user i ...
(OLE)
References
External links
Text Object Model OverviewObtaining the TOM Object for a RichEdit ControlHistorical RichEdit/TOM informationTOM Classes for .NET
{{Microsoft APIs
Microsoft application programming interfaces