Partager via


COleServerDoc Class

The base class for OLE server documents.

class AFX_NOVTABLE COleServerDoc : public COleLinkingDoc

Remarks

A server document can contain COleServerItem objects, which represent the server interface to embedded or linked items. When a server application is launched by a container to edit an embedded item, the item is loaded as its own server document; the COleServerDoc object contains just one COleServerItem object, consisting of the entire document. When a server application is launched by a container to edit a linked item, an existing document is loaded from disk; a portion of the document's contents is highlighted to indicate the linked item.

COleServerDoc objects can also contain items of the COleClientItem class. This allows you to create container-server applications. The framework provides functions to properly store the COleClientItem items while servicing the COleServerItem objects.

If your server application does not support links, a server document will always contain only one server item, which represents the entire embedded object as a document. If your server application does support links, it must create a server item each time a selection is copied to the Clipboard.

To use COleServerDoc, derive a class from it and implement the OnGetEmbeddedItem member function, which allows your server to support embedded items. Derive a class from COleServerItem to implement the items in your documents, and return objects of that class from OnGetEmbeddedItem.

To support linked items, COleServerDoc provides the OnGetLinkedItem member function. You can use the default implementation or override it if you have your own way of managing document items.

You need one COleServerDoc-derived class for each type of server document your application supports. For example, if your server application supports worksheets and charts, you need two COleServerDoc-derived classes.

For more information on servers, see the article Servers: Implementing a Server..

Requirements

Header: afxole.h

See Also

Concepts

HIERSVR Sample: Demonstrates a Server Application with OLE Drag and Drop

COleServerDoc Members

COleLinkingDoc Class

Hierarchy Chart

COleDocument Class

COleLinkingDoc Class

COleTemplateServer Class