Files and clipboard

The text content model is fully integrated with the stream store. Editable, plain, global and rich text may be stored and restored. Formatting and content use different streams, which makes it relatively easy for a plain text or global text object to restore the (relevant) data from a rich text object.

Pictures in rich text are stored using the picture’s own store and restore protocol, as required by concrete CPicture implementations.

The stream store is typically a file, but by allowing text to be restored into an already-existing document, support for two additional requirements is provided:

  • the clipboard: text may be copied to the clipboard (and then optionally deleted, to support cut), and pasted in from it

  • undo buffers: a memory store may be used to hold inserted or deleted text, to achieve the effect of undo/redo

Storing and restoring

Storing and restoring operations are optimised for efficiency for editable text. For instance, in rich text, StoreL() and RestoreL() may be used to store and restore the text content, its formatting, styles, fields and pictures in a single operation. Certain applications may want to store only certain parts of the text model; to save space, for example. Utilities are provided to store and restore certain components independently of each other.