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.

class CDocObjectServerItem : public COleServerItem  

Protected Constructors

NameDescription
CDocObjectServerItem::CDocObjectServerItemConstructs a CDocObjectServerItem object.

Public Methods

NameDescription
CDocObjectServerItem::GetDocumentRetrieves a pointer to the document that contains the item.

Protected Methods

NameDescription
CDocObjectServerItem::OnHideThrows an exception if the framework tries to hide a DocObject item.
CDocObjectServerItem::OnShowCalled by the framework to make the DocObject item in-place active. If the item is not a DocObject, calls COleServerItem::OnShow.

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.

CObject

CCmdTarget

CDocItem

COleServerItem

CDocObjectServerItem

Header: afxdocob.h

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.

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.

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.

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.

COleServerItem Class
Hierarchy Chart
CDocObjectServer Class
COleDocObjectItem Class

Show: