Paragraph styles are encapsulated by the RParagraphStyleInfo, CParagraphStyle and CStyleList classes. These three classes should be used as follows:
All styles are based on the global paragraph and character format layers. A CParagraphStyle object should be constructed specifying these normal layers.
To set the paragraph format of a CParagraphStyle object, use the SetL() function that it inherits from its base class CParaFormatLayer.
To set the character format of a CParagraphStyle object, use the CParagraphStyle::CharFormatLayer() function, which returns a non-null pointer to the CCharFormatLayer object, and then call its SetL function.
Paragraph styles inherit attributes from the normal style. Attributes explicitly set in the CParagraphStyle object override the attributes from the normal style.
Append all user defined styles to a CStyleList.
To do this, construct an RParagraphStyleInfo object, specifying the CParagraphStyle to be appended, and optionally, a style for the following paragraph. Any number of RParagraphStyleInfo s can be appended to the style list.
Pass the style list to the constructor of a CRichText object.
In this case, the rich text object owns the style list. If the rich text object is not passed an instance of a CStyleList upon construction, it may still use styles, by calling CRichText::SetStyleListExternallyOwned(). However, in this case, the style list is not owned by the rich text object. It will not be deleted when that rich text object is deleted, and must be stored and restored separately from the rich text object.
Styles may be specified as usually applying to one paragraph only. For example, after a user has just typed in a heading in a word processor, they will expect the style of the following paragraph to be normal text, not another heading. This 'following style' can be set either in the constructor of RParagraphStyleInfo or set using CStyleList::SetStyleToFollow() after it has been appended to the style list.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.