Visual C++ 6 Unleashed

Visual C++ 6 Unleashed

By MICKEY WILLIAMS and David Bennett

Just What Is an Active Document?

Active documents are an evolved form of OLE documents that originally were designed to enable users to view an OLE document inside a Web browser. In particular, Active documents are OLE embedded documents with the addition of four new COM interfaces: IOleDocument, IOleDocumentView, IOleCommandTarget, and IPrint. These new interfaces allow for a significant difference between OLE embedded documents and Active documents: Active documents occupy the entire client area of its container, whereas OLE embedded documents occupy a small, well-defined area. This ability to occupy the entire client area was added so that users browsing the Web with a tool such as Internet Explorer could click a hyperlink on a Web page and link directly to a Microsoft Word document, Microsoft Excel spreadsheet, or another application. To users, it appears as though the application data is just another Web page with perhaps more menu items and toolbars. This provides users with a positive and rich Internet experience.

Active documents first appeared with the release of Microsoft Office 95. Microsoft Office Binder is an Active container, and Microsoft Word and the other Office applications are Active documents. In fact, it is quite interesting to notice the following in the Visual C++ header DOCOBJ.H:

#define IMsoDocument   IOleDocument
#define IMsoView       IOleDocumentView

Clearly, the IOleDocument and IOleDocumentView interfaces began life as Microsoft Office (Mso) interfaces. Also, Active documents originally were referred to as DocObjects. You will notice API calls and interfaces that reference this name—for ex ample, the MFC class CDocObjectServer.

Let's look a little more closely at the four new COM interfaces:

Two MFC classes encapsulate the Active document interfaces: CDocObjectServer and CDocObjectServerItem. CDocObjectServer supports the IOleDocument, IOleDocumentView, IOleCommandTarget, and IPrint interfaces. CDocObjectServer is similar to what COleDocument does and replaces this class when you want to support Active documents. CDocObjectServerItem supports OLE server verbs required for Active documents. It derives from COleServerItem and overrides OnHide, OnOpen, and OnShow to implement Active document support. It replaces COleServerItem when you want to support Active documents.

Share ThisShare This

Informit Network