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.
When to Implement
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.
When to Use
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
SetInPlaceSite
Associates a container site with this view.
GetInPlaceSite Retrieves the last site passed in SetInPlaceSite.
GetDocument Returns the IUnknown pointer of the document object that owns this view.
SetRect Sets the coordinates of the view port.
GetRect Retrieves the coordinates last passed in SetRect
SetRectComplex
Sets the coordinates of the view port, scroll bars, and size box.
Show In-place activates or deactivates a view.
UIActivate In-place activates or deactivates a viewÆs user-interface elements.
Open Displays view in a separate pop-up window
Close Instructs view to close
SaveViewState Saves view state into stream
ApplyViewState Initializes view with view state previously saved in call to SaveViewState.
Clone Creates a duplicate view object.
See Also
TBD