CDocItem 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 CDocItem Class.

The base class for document items, which are components of a document's data.

class CDocItem : public CCmdTarget  

Public Methods

NameDescription
CDocItem::GetDocumentReturns the document that contains the item.
CDocItem::IsBlankDetermines whether the item contains any information.

CDocItem objects are used to represent OLE items in both client and server documents.

For more information, see the article Containers: Implementing a Container.

CObject

CCmdTarget

CDocItem

Header: afxole.h

Call this function to get the document that contains the item.

CDocument* 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 function is overridden in the derived classes COleClientItem and COleServerItem, returning a pointer to either a COleDocument, a COleLinkingDoc, or a COleServerDoc object.

Called by the framework when default serialization occurs.

virtual BOOL IsBlank() const;  

Return Value

Nonzero if the item contains no information; otherwise 0.

Remarks

By default, CDocItem objects are not blank. COleClientItem objects are sometimes blank because they derive directly from CDocItem. However, COleServerItem objects are always blank. By default, OLE applications containing COleClientItem objects that have no x or y extent are serialized. This is done by returning TRUE from an override of IsBlank when the item has no x or y extent.

Override this function if you want to implement other actions during serialization.

CCmdTarget Class
Hierarchy Chart
COleDocument Class
COleServerItem Class
COleClientItem Class

Show: