|
Palette Management for Active Document Objects
The following sections describe issues related to palette management by OLE document objects. In general, the palette management scheme for document objects is the same as the scheme used for controls, except that document objects do not receive ambient properties from their container.
Responsibilities of the Document Object
Palette management for document objects is similar to palette management for controls. The following are the responsibilities of the document object:
- Document objects should implement IViewObject2::GetColorSet if interested in notifying the container about the palette they want to display. This is exactly the same as the corresponding responsibility for controls (as previously discussed).
- Document objects should realize their palette in the background except when handling WM_QUERYNEWPALETTE messages (forwarded from the container). Again, this is exactly the same as the corresponding responsibility for controls.
The only difference between the responsibilities of controls and document objects is that document objects do not handle the DISPID_AMBIENT_PALETTE property.
Single Document Case
In the most common cases, a document object container will activate only one document object at a time. In such a situation, it is acceptable that the activated document object should have complete control over the palette, which includes managing palette issues for any controls or content within that document.
The document object container in this case has nothing to do with palettes and need not be concerned with palette issues. It should leave palette handling up to the document object¡ªin other words, it should forward all Microsoft Windows palette management messages on to the document object.
The following is example code for the window procedure of the document object host.
|