OLE compound document technology rests on a foundation consisting of COM, structured storage, and uniform data transfer. A compound document object is essentially a COM object that can be embedded in, or linked to, an existing document. As a COM object, a compound document object exposes the IUnknown interface, through which clients obtain pointers to its other interfaces that provide special features unique to compound document objects.
These interfaces include:
When a compound document is created, one application is a container and the other is a server. The server document can either be linked or embedded into the container application. When a document is linked, it is stored in a separate file from the container. However, embedded documents are stored in the same file as the container.
Figure 5.8 Using compound documents
Use of compound files is encouraged because the OLE storage system provides efficient and flexible access to object data. The storage system allows objects, or portions of objects, to be read from disk to memory without loading the entire file. This is significant when loading an OLE document that contains either a large number of objects or a single large object such as a video clip, because it is more efficient to load only the data that currently is needed. That is, applications do not have to wait for unwanted data to be loaded before the requested data is made available to the user .
OLE compound documents enable users working within a single application to manipulate data written in various formats and derived from multiple sources. For example, a user might insert a graph created in a second application and a sound object created in a third application into a word processing document. Activating the graph causes the second application to load its user interface, or at least the part containing tools needed to edit the object. Activating the sound object causes the third application to play it. In both cases, a user is able to manipulate data from external sources from within the context of a single document.
* To Use Compound Documents
In this exercise, you will insert a bitmap image into a Microsoft Word document and edit it using Microsoft Paint.
Notice that the menu and toolbars from the Microsoft Paint application are now available in Microsoft Word.