Edit

Share via


CDocObjectServerItem Class

Implements OLE server verbs specifically for DocObject servers.

Syntax

class CDocObjectServerItem : public COleServerItem

Members

Protected Constructors

Name Description
CDocObjectServerItem::CDocObjectServerItem Constructs a CDocObjectServerItem object.

Public Methods

Name Description
CDocObjectServerItem::GetDocument Retrieves a pointer to the document that contains the item.

Protected Methods

Name Description
CDocObjectServerItem::OnDoVerb Called to execute a verb.
CDocObjectServerItem::OnHide Throws an exception if the framework tries to hide a DocObject item.
CDocObjectServerItem::OnShow Called by the framework to make the DocObject item in-place active. If the item is not a DocObject, calls COleServerItem::OnShow.

Remarks

CDocObjectServerItem defines overridable member functions: OnHide, OnDoVerb, and OnShow.

To use CDocObjectServerItem, assure that the OnGetEmbeddedItem override in your COleServerDoc-derived class returns a new CDocObjectServerItem object. If you need to change any functionality in your item, you can create a new instance of your own CDocObjectServerItem-derived class.

For further information on DocObjects, see CDocObjectServer and COleCmdUI in the MFC Reference.

Inheritance Hierarchy

CObject

CCmdTarget

CDocItem

COleServerItem

CDocObjectServerItem

Requirements

Header: afxdocob.h

CDocObjectServerItem::CDocObjectServerItem

Constructs a CDocObjectServerItem object.

CDocObjectServerItem(COleServerDoc* pServerDoc, BOOL bAutoDelete);

Parameters

pServerDoc
A pointer to the document that will contain the new DocObject item.

bAutoDelete
Indicates whether the object can be deleted when a link to it is released. Set the argument to FALSE if the CDocObjectServerItem object is an integral part of your document's data. Set it to TRUE if the object is a secondary structure used to identify a range in your document's data that can be deleted by the framework.

CDocObjectServerItem::GetDocument

Retrieves a pointer to the document that contains the item.

COleServerDoc* GetDocument() const;

Return Value

A pointer to the document that contains the item; NULL if the item is not part of a document.

Remarks

This allows access to the server document that you passed as an argument to the CDocObjectServerItem constructor.

CDocObjectServerItem::OnDoVerb

Called by the framework to execute the specified verb.

virtual void OnDoVerb(LONG iVerb);

Parameters

iVerb
Specifies the verb to execute. For possible values, see IOleObject::DoVerb in the Windows SDK.

Remarks

The default implementation calls the OnShow member function if the item is a DocObject and the OLEIVERB_INPLACEACTIVATE or OLEIVERB_SHOW is specified. If the item is not a DocObject or a different verb is specified, the default implementation calls COleServerItem::OnDoVerb.

CDocObjectServerItem::OnHide

Called by the framework to hide the item.

virtual void OnHide();

Remarks

The default implementation throws an exception if the item is a DocObject. You cannot hide an active DocObject item because it takes the whole view. You must deactivate the DocObject item to make it disappear. If the item is not a DocObject, the default implementation calls COleServerItem::OnHide.

CDocObjectServerItem::OnShow

Called by the framework to instruct the server application to make the DocObject item in-place active.

virtual void OnShow();

Remarks

If the item is not a DocObject, the default implementation calls COleServerItem::OnShow. Override this function if you want to perform special processing when opening a DocObject item.

See also

COleServerItem Class
Hierarchy Chart
CDocObjectServer Class
COleDocObjectItem Class