Notes on Implementing Other RTF Features

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

 

The table-driven approach to dispatching RTF controls used by the sample converter does not implement any syntax checking. For most controls, this is not a problem; a control simply modifies the appropriate property. However, some controls, such as those for tabs and borders, are dependent on other control words either before or after the current control word.

There are standard techniques for handling these features.

Tabs and Other Control Sequences Terminating in a Fixed Control

The best way to implement these types of control sequences is to have a global structure that represents the current state of the tab descriptor (or other entity). As the modifiers come in, they modify the various fields of the global structure. When the fixed control at the end of the sequence is dispatched, it adds the entire descriptor and reinitializes the global variable.

Borders and Other Control Sequences Beginning with a Fixed Control

The best way to implement these types of control sequences is to have a global pointer that is initialized when the fixed control is dispatched. The controls that modify the fixed control then modify fields pointed to by the control.