Compartilhar via


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

With CRichEditView and CRichEditCntrItem, provides the functionality of the rich edit control within the context of MFC's document view architecture.

Syntax

class CRichEditDoc : public COleServerDoc  

Members

Public Methods

Name Description
CRichEditDoc::CreateClientItem Called to perform cleanup of the document.
CRichEditDoc::GetStreamFormat Indicates whether stream input and output should include formatting information.
CRichEditDoc::GetView Retrieves the asssociated CRichEditView object.

Public Data Members

Name Description
CRichEditDoc::m_bRTF Indicates whether stream I/O should include formatting.

Remarks

A "rich edit control" is a window in which the user can enter and edit text. The text can be assigned character and paragraph formatting, and can include embedded OLE objects. Rich edit controls provide a programming interface for formatting text. However, an application must implement any user interface components necessary to make formatting operations available to the user.

CRichEditView maintains the text and formatting characteristic of text. CRichEditDoc maintains the list of client items which are in the view. CRichEditCntrItem provides container-side access to the OLE client items.

This Windows Common control (and therefore the CRichEditCtrl and related classes) is available only to programs running under Windows 95/98 and Windows NT versions 3.51 and later.

For an example of using a rich edit document in an MFC application, see the WORDPAD sample application.

Inheritance Hierarchy

CObject

CCmdTarget

CDocument

COleDocument

COleLinkingDoc

COleServerDoc

CRichEditDoc

Requirements

Header: afxrich.h

CRichEditDoc::CreateClientItem

Call this function to create a CRichEditCntrItem object and add it to this document.

virtual CRichEditCntrItem* CreateClientItem(REOBJECT* preo = NULL) const = 0;  

Parameters

preo
Pointer to an REOBJECT structure which describes an OLE item. The new CRichEditCntrItem object is constructed around this OLE item. If preo is NULL, the new client item is empty.

Return Value

Pointer to a new CRichEditCntrItem object which has been added to this document.

Remarks

This function does not perform any OLE initialization.

For more information, see the REOBJECT structure in the Windows SDK.

CRichEditDoc::GetStreamFormat

Call this function to determine the text format for streaming the contents of the rich edit.

int GetStreamFormat() const;  

Return Value

One of the following flags:

  • SF_TEXT Indicates that the rich edit control does not maintain formatting information.

  • SF_RTF Indicates that the rich edit control does maintain formatting information.

Remarks

The return value is based on the m_bRTF data member. This function returns SF_RTF if m_bRTF is TRUE; otherwise, SF_TEXT.

CRichEditDoc::GetView

Call this function to access the CRichEditView object associated with this CRichEditDoc object.

virtual CRichEditView* GetView() const;  

Return Value

Pointer to the CRichEditView object associated with the document.

Remarks

The text and formatting information are contained within the CRichEditView object. The CRichEditDoc object maintains the OLE items for serialization. There should be only one CRichEditView for each CRichEditDoc.

CRichEditDoc::m_bRTF

When TRUE, indicates that CRichEditCtrl::StreamIn and CRichEditCtrl::StreamOut should store paragraph and character-formatting characteristics.

BOOL m_bRTF;  

See Also

MFC Sample WORDPAD
COleServerDoc Class
Hierarchy Chart
CRichEditView Class
CRichEditCntrItem Class
COleDocument Class
CRichEditCtrl Class