Objective Chart : PART I User’s Guide : Chapter 12 Objective Chart and MFC : Communication Document (ComDoc) System
Communication Document (ComDoc) System
The Communication Document (ComDoc) system and the Objective Chart graphing system are independent of each other. Charting applications do not need to use ComDocs (or any other document). And ComDocs can be used to create and link documents of any type.
The ComDoc system adds a new dimension to MDI applications. A ComDoc can invoke child documents and keep those documents updated whenever changes occur to the parent document. The child can also update the parent document.
For example, a menu command handler for an Objective Grid application can create a second document based on Objective Chart to plot a subset of its data. Any subsequent changes to the Grid data are immediately reflected in the Chart. In addition, data items in the Chart can be dragged to new values that are used to update the Grid.
The ComDoc system modifies the MFC document architecture to makes it possible to perform the following actions:
Call up a document of a certain type without invoking the standard document type dialog.
Initialize the new document with data.
Maintain a two-way stream of communication between the original or parent document and the newly created child document.
See Chapter 20, “Communication Document System,” for a more involved discussion of this subject.
Communication Document Classes
Two classes, SECComDoc and SECDocManager, implement the general ComDoc system. A third class, CGraphDoc, is derived from SECComDoc to provide functions for communicating data related to charts.
The ComDoc system is described in more detail in Chapter 20, “Communication Document System.”
SECComDoc
SECComDoc extends the standard MFC CDocument class to support communication between linked documents. It maintains as list of linked documents and a pointer to its parent document, if it is a child document.
SECComDoc also includes several functions that enable documents to pass messages to one another. SECComDoc defines the format of these messages, but the meaning and functions that the messages transmit are left open.
CGraphDoc
CGraphDoc is a special derivation of the SECComDoc class that handles document linking. It contains the SRGraph data member, m_Graph, which stores the chart data. This document type is a partner to the SRGraphView view class. It also handles SRGraph serialization.
CGraphDoc also defines several message codes to pass information related to chart data values, annotations, and scope.
SECDocManager
This derivation of the standard CDocManager class has special functions to facilitate the document linking process. Your applications should use this SECDocManager class instead of the CDocManager if you want to enable document linking.