CDocObjectServerItem Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at 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::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, OnOpen, 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. Also see Internet First Steps: Active Documents and Active Documents.

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::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