Visual C++ Programming Document View Architecture
Document-Centric Computing  Applications on most of the OS require the user to know which applications must be used to create documents of a specific type. Earlier it was not feasible to create a document with data from different applications like a word document with an excel graph and PowerPoint presentation. But now the user instead of concentrating on the type of application , has to worry only about the work to be done. The OS maintains a database of information where all applications installed on the system are listed. The various types of files that each application can deal with are also listed which makes it easier for the OS to locate the application that should be started when the user needs to work on a particular type of a document.
Document-View Architecture MFC’s Document-View architecture provides the skeleton framework for developing applications , like editors, file viewers and database query front ends, that manage disk-based data. The  document  and the  view  together form the basis of the application framework. The  document  stores the data and manages printing the data and coordinates updating multiple views of the data.  The  view  displays the data and manages user interaction with it, including selection and editing.
Document-View Architecture(contd..) As the name suggests the Doc-View architecture adds two new objects to the MFC programs- document  and  view. A document class derived from CDocument. A view class derived from CView. A frame class derived from CFrameWnd. A application class derived from CWinApp.
Document The document is a data object. All user interaction (like in a word processor) is with the document. The document is a non-visual object, it cannot receive messages but can respond to the messages. The document is responsible for the application’s data. It is a data source and is widely used in word processors , spreadsheets and server to networks providing information to programs. Irrespective of the source, data management is encapsulated within the document object.
View The view provides a visual display of the data to the user in a window or on a printed page. It handles the interaction between the document and the user. All user interaction with the data in the document is through the interface presented by the view. It can receive messages. For eg-word processing.  It can be a simple window, an SDI, an MDI or a class derived from CFormView having the capabilities of a dialog box.
Frame The frame class contains the view and other user-interface elements like tool bars and menus. The frame and the view are visual components.
Application It is a non-visual component like the document. It is responsible for starting the application and interacting with the windows.
Document-View Architecture CView View Windows File  Edit  View  Help  CFrameView CDocument CWinApp
Document and View
Features of Doc-View Architecture Data is handled  and displayed separately . Multiple views of the same document can be obtained, such as both a spreadsheet and a chart view. The document/view model lets a separate view object represent each view of the data, while code common to all views (such as a calculation engine) can reside in the document.  The document also takes on the task of updating all views whenever the data changes. The MFC document/view architecture makes it easy to support multiple views, multiple document types, splitter windows, and other valuable user-interface features.
Types There are two basic types of Document-View applications- Single Document Interface. SDI applications support a single type of document  and a single view. Only one document can be opened at any point of time. It focuses on a particular task. The frame window is also the main frame window for the application. Multiple Document Interface Supports multiple documents.

Vc++ 3

  • 1.
    Visual C++ ProgrammingDocument View Architecture
  • 2.
    Document-Centric Computing Applications on most of the OS require the user to know which applications must be used to create documents of a specific type. Earlier it was not feasible to create a document with data from different applications like a word document with an excel graph and PowerPoint presentation. But now the user instead of concentrating on the type of application , has to worry only about the work to be done. The OS maintains a database of information where all applications installed on the system are listed. The various types of files that each application can deal with are also listed which makes it easier for the OS to locate the application that should be started when the user needs to work on a particular type of a document.
  • 3.
    Document-View Architecture MFC’sDocument-View architecture provides the skeleton framework for developing applications , like editors, file viewers and database query front ends, that manage disk-based data. The document and the view together form the basis of the application framework. The document stores the data and manages printing the data and coordinates updating multiple views of the data. The view displays the data and manages user interaction with it, including selection and editing.
  • 4.
    Document-View Architecture(contd..) Asthe name suggests the Doc-View architecture adds two new objects to the MFC programs- document and view. A document class derived from CDocument. A view class derived from CView. A frame class derived from CFrameWnd. A application class derived from CWinApp.
  • 5.
    Document The documentis a data object. All user interaction (like in a word processor) is with the document. The document is a non-visual object, it cannot receive messages but can respond to the messages. The document is responsible for the application’s data. It is a data source and is widely used in word processors , spreadsheets and server to networks providing information to programs. Irrespective of the source, data management is encapsulated within the document object.
  • 6.
    View The viewprovides a visual display of the data to the user in a window or on a printed page. It handles the interaction between the document and the user. All user interaction with the data in the document is through the interface presented by the view. It can receive messages. For eg-word processing. It can be a simple window, an SDI, an MDI or a class derived from CFormView having the capabilities of a dialog box.
  • 7.
    Frame The frameclass contains the view and other user-interface elements like tool bars and menus. The frame and the view are visual components.
  • 8.
    Application It isa non-visual component like the document. It is responsible for starting the application and interacting with the windows.
  • 9.
    Document-View Architecture CViewView Windows File Edit View Help CFrameView CDocument CWinApp
  • 10.
  • 11.
    Features of Doc-ViewArchitecture Data is handled and displayed separately . Multiple views of the same document can be obtained, such as both a spreadsheet and a chart view. The document/view model lets a separate view object represent each view of the data, while code common to all views (such as a calculation engine) can reside in the document. The document also takes on the task of updating all views whenever the data changes. The MFC document/view architecture makes it easy to support multiple views, multiple document types, splitter windows, and other valuable user-interface features.
  • 12.
    Types There aretwo basic types of Document-View applications- Single Document Interface. SDI applications support a single type of document and a single view. Only one document can be opened at any point of time. It focuses on a particular task. The frame window is also the main frame window for the application. Multiple Document Interface Supports multiple documents.