CStyleList Class Reference
class CStyleList : public CBase
|
A container of paragraph styles.
It is implemented as a fixed length array of pointers to RParagraphStyleInfos. The array's granularity is specified on construction. The list takes ownership of all paragraph styles appended to it. When the list is deleted, all styles it owns are also deleted.
After the style list has been set up, it should normally be passed to a
CRichText
object, either in the rich text object's constructor, or by calling
CRichText::SetStyleListExternallyOwned()
. The rich text object takes ownership of the style list (unless SetStyleListExternallyOwned() is used). Styles can be modified, added to and removed from the style list after ownership of the list has been passed to the rich text object.
If
CRichText::SetStyleListExternallyOwned()
is used, the style list is not owned by the rich text object, and it must be stored and restored separately from the rich text object.
Constructor & Destructor Documentation
CStyleList()
IMPORT_C
|
CStyleList
|
(
|
)
|
[protected]
|
~CStyleList()
Deletes all the entries in the list and the list itself.
Member Functions Documentation
ConstructL(TInt)
IMPORT_C void
|
ConstructL
|
(
|
TInt
|
aGranularity
|
)
|
[protected]
|
Count()
TInt
|
Count
|
(
|
)
|
const [inline]
|
Gets the number of styles in the style list.
ExternalizeL(RWriteStream &)
IndexByName(const TDesC &)
IMPORT_C
TInt
|
IndexByName
|
(
|
const
TDesC
&
|
aName
|
)
|
const
|
Gets the index into the style list of a specified paragraph style, identified by its name.
Parameters
const
TDesC
& aName
|
The name of the style.
|
IndexByPtr(const CParaFormatLayer *)
InternalizeL(RReadStream &, const CParaFormatLayer *, const CCharFormatLayer *)
Internalises the style list from a read stream. The presence of this function means that the standard templated
operator>>()
(defined in s32strm.h) is available to internalise objects of this class. Any existing style list contents are replaced.
Parameters
RReadStream
& aStream
|
Stream store from which the style list is internalised.
|
const
CParaFormatLayer
* aGlobalParaFormatLayer
|
Pointer to the global paragraph format layer on which all styles in the list are based.
|
const
CCharFormatLayer
* aGlobalCharFormatLayer
|
Pointer to the global character format layer on which all styles in the list are based.
|
KillStyleList()
void
|
KillStyleList
|
(
|
)
|
[private]
|
NewL(TInt)
Allocates and constructs an empty
CStyleList
object with an array granularity.
Parameters
TInt
aCapacity =
KMaxStyleListGranularity
|
The number of entries by which the array of styles expands when its buffer is reallocated. By default, KMaxStyleListGranularity (= 4). Must be positive or a panic occurs.
|
NewL(RReadStream &, const CParaFormatLayer *, const CCharFormatLayer *)
Allocates and constructs a
CStyleList
, restoring its contents from the specified stream store. Each style in the list is set to be based on the global format layers specified.
Parameters
RReadStream
& aStream
|
Stream store from which the style list is restored.
|
const
CParaFormatLayer
* aGlobalParaFormatLayer
|
Pointer to the global paragraph format layer on which all styles in the list are based.
|
const
CCharFormatLayer
* aGlobalCharFormatLayer
|
Pointer to the global character format layer on which all styles in the list are based.
|
PtrByName(const TParagraphStyleName &)
Gets the style with the specified name from the style list.
PtrByType(const TUid)
Gets the style with the specified type UID from the style list.
Parameters
const
TUid
aType
|
The UID of the style to retrieve.
|
Remove(CParagraphStyle *)
Removes a style from the style list. If the style is owned by the list, it is deleted. If the style is not owned by the list, but is referenced by a style owned by the list, (i.e. a style in the list is based on it, or references it as its iStyleForNextPara pointer) then the pointer to aStyle is set to NULL.
Parameters
CParagraphStyle
* aStyle
|
Pointer to the style to remove from the style list, or to set to NULL.
|
Reset()
Deletes the contents of the list.
SetStyleToFollow(const RParagraphStyleInfo &)
Sets the style to use for the following paragraph for a style in the style list. Both the style (aStyleSet.iStyle) and the style to set for the following paragraph (aStyleSet.iStyleForNextPara) must exist in the style list.
The function first locates the style (aStyleSet.iStyle) in the list, then sets the style to use for the next paragraph to aStyleSet.iStyleForNextPara.
If aStyleSet.iStyle does not exist in the style list, the function returns with KErrNotFound. If aStyleSet.iStyleForNextPara does not exist in the style list, a panic occurs.
Parameters
const
RParagraphStyleInfo
& aStyleSet
|
Identifies a style in the list, and a style to use for its following paragraph.
|
StoreL(CStreamStore &)
Stores the style list to a stream store.
Parameters
CStreamStore
& aStore
|
Stream store to which the style list is written.
|
operator[](TInt)
Gets a style from the style list, from its index into the array. Two versions are supplied. The compiler chooses the appropriate version based on the use made of the returned reference. If it is used in an expression where the reference can be modified, then the non-const version is chosen.
Parameters
TInt
aIndex
|
The index of the style into the list. The first style is at position zero. Must be within the bounds of the array or a panic occurs.
|
Member Data Documentation
CArrayFixFlat< RParagraphStyleInfo > * iList
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.