The IOleDocumentView interface enables a container to communicate with each view supported by a document object. A document object that supports multiple views of its data represents each view as a separate object. Each document view object implements IOleDocumentView, along with IOleInPlaceObject, IOleInPlaceActiveObject, and optional interfaces such as IPrint and IOleCommandTarget. A document object that supports only a single view does not require that view to be implemented as a separate object. Instead, both document and view can be implemented as a single class.
The IOleDocumentView interface provides all the necessary methods for a container to manipulate, manage, and activate a document view object.
The SetInPlaceSite method enables a container to hand a document object an IOleInPlaceSite pointer to its view site in the container. The method GetInPlaceSite enables a container to retrieve a document object’s IOleInPlaceSite pointer.
The GetDocument method provides a container with access to the IUnknown pointer of the document object containing the view object to which the call is made.
The SetRect and GetRect methods manage the simple rectangle that a view will occupy in the container. SetRectComplex enables a container to specify not only the simple rectangle but also the spaces that should be occupied by the view’s scrollbars and size box.
The Show, UIActivate, and Open methods enable a container to manipulate a document view object’s visual state. Show instructs a document view object to activate or deactivate itself in-place. When a view object is active, UIActivate instructs it to activate or deactivate its user interface elements, such as menus, toolbars, and accelerators. IOleDocumentView::Show provides document objects with the same functionality that the IOleInPlaceObject methods InPlaceActivate and InPlaceDeactivate provide to normal in-place-active objects; IOleDocumentView::UIActivate, the same functionality as UIActivate and UIDeactivate.
The Open method activates a document object in a separate window, as is the case with an embedded OLE Document that does not support in-place activation.
The Close method instructs a document view object to deactivate itself and release its document view site pointer. If the view is active in a separate window, the document view object should also close that window
The SaveViewState method enables a container to save a view’s internal state to a stream. The ApplyViewState method enables a container to reload a previously saved view state.
The Clone method enables a container to create a duplicate of the current view object.
All document objects must implement IOleDocumentView for each and every view they support. If a document object supports multiple views, each view must be implemented as a separate class object. If a document object supports only a single view, the document object and its view can both be implemented as a single class.
A container calls the methods of this interface to activate, deactivate, close, and generally communicate with a document view object.
Methods in VTable Order
IUnknown Methods |
Description |
QueryInterface |
Returns pointers to supported interfaces. |
AddRef |
Increments reference count. |
Release |
Decrements reference count. |
IOleDocumentView Methods |
Description |
Associates a container site with this view. | |
Retrieves the last site passed in SetInPlaceSite. | |
Returns the IUnknown pointer of the document object that owns this view. | |
Sets the coordinates of the view port. | |
Retrieves the coordinates last passed in SetRect | |
Sets the coordinates of the view port, scroll bars, and size box. | |
In-place activates or deactivates a view. | |
In-place activates or deactivates a view’s user-interface elements. | |
Displays view in a separate pop-up window | |
Instructs view to close | |
Saves view state into stream | |
Initializes view with view state previously saved in call to SaveViewState. | |
Creates a duplicate view object. |
See Also
TBD