»
Symbian OS v6.1 Edition for C++ »
API Reference »
Text and Text Attributes »
CParaFormatLayer
Location:
txtfmlyr.h
Link against: etext.lib
CParaFormatLayer
Support
Supported from 5.0
Description
A paragraph format layer. Has a pointer (stored in its base class
CFormatLayer
) to another paragraph format layer which may be NULL.
This pointer is referred to as the based-on link. A paragraph format layer is
owned by an instance of the CGlobalText
class and stores the
object's global paragraph formatting. Implements persistence and allows
attributes to be set and sensed.
Derivation
CBase | Base class for all classes to be instantiated on the heap |
CFormatLayer | Abstract base class for the paragraph and character format layers (CParaFormatLayer and CCharFormatLayer) |
CParaFormatLayer | A paragraph format layer |
|
Defined in CParaFormatLayer
:
CloneL()
, ExternalizeL()
, InternalizeL()
, IsIdentical()
, IsIdenticalL()
, NewL()
, Ptr()
, SenseEffectiveL()
, SenseL()
, SetL()
, Type()
Inherited from CBase
:
operator new()
Inherited from CFormatLayer
:
ChainCount()
,
ExternalizeChainL()
,
InternalizeChainL()
,
IsEmpty()
,
Reset()
,
SenseBase()
,
SetBase()
Construction
static CParaFormatLayer* NewL();
Description
Allocates and constructs an empty
CParaFormatLayer
. Its based-on link is NULL.
Notes
Use SetL()
to set format attributes in the layer.
Use SetBase()
, defined in the base class
CFormatLayer
, to set the layer’s based on link.
Return value
CParaFormatLayer* |
Pointer to the new paragraph format layer. |
|
static CParaFormatLayer* NewL(const CParaFormat* aParaFormat,const TParaFormatMask& aMask);
Description
Allocates and constructs a CParaFormatLayer
. The
attributes which are set in the mask are initialised to the values specified in
the format container aParaFormat
. The attributes which are not set
in the mask are initialised to the default values for class
CParaFormat
. The new layer's based-on link is set to NULL.
Parameters
const CParaFormat* aParaFormat |
Contains the attribute values to assign to the format layer.
|
const TParaFormatMask& aMask |
Mask specifying which attributes should be initialized from
aParaFormat . |
|
Return value
CParaFormatLayer* |
Pointer to the new paragraph format layer. |
|
static CParaFormatLayer* NewL(RReadStream& aStream);
Description
Allocates and constructs a CParaFormatLayer
, restoring
its format attributes from a stream. The layer's based-on link is set to
NULL.
Parameters
RReadStream& aStream |
Stream from which the layer is restored. |
|
Return value
CParaFormatLayer* |
Pointer to the new paragraph format layer. |
|
void SetL(const CParaFormat* aDesiredEffectiveFormat,const TParaFormatMask& aMask);
Description
Sets the layer's format attributes. The attributes which are set in
the mask are set in the layer to the values specified in the format container
aDesiredEffectiveFormat
. The attributes which are not set in the
mask are not changed.
Note
Any tab stops in aDesiredEffectiveFormat
are merged with
the tab stops in the current layer.
Parameters
const CParaFormat* aDesiredEffectiveFormat |
Contains the attribute values to assign to the format layer. |
const TParaFormatMask& aMask |
Mask specifying which attributes should be set from
aDesiredEffectiveFormat . |
|
void SenseEffectiveL(CParaFormat* aParaFormat, CParaFormat::TParaFormatGetMode aMode=CParaFormat::EAllAttributes)const;
Description
Senses the layer’s effective format, searching all based-on
links. The resulting aParaFormat
is fully populated, except that
if aMode
is EFixedAttributes
, then only the fixed
attributes (not tabs, paragraph borders or bullets) are written to it.
Notes
The function also "tidies up" the layer's effective paragraph
formatting, so that any zero height bullets, paragraph borders with a NULL line
style or NULL tab stops are removed.
Parameters
CParaFormat* aParaFormat |
On return, contains the layer's effective formatting. Depending on the
value of aMode , tabs, borders and bullets may be excluded. Must
not be NULL or a panic occurs. |
CParaFormat::TParaFormatGetMode aMode |
Controls which attributes are written to aParaFormat . If
EAllAttributes , all attributes are written; if
EFixedAttributes , tabs, bullets and borders are not written.
|
|
Leave codes
|
The function can only leave if aMode has a value of
EAllAttributes . |
|
void SenseL(CParaFormat* aParaFormat,TParaFormatMask& aMask, CParaFormat::TParaFormatGetMode aMode=CParaFormat::EAllAttributes)const;
Description
Senses the formatting which has been applied to the current layer only.
No based-on links are searched. This function does not get the effective
formatting, but the resulting aParaFormat
is useable even if not
all attributes are flagged for sensing in aMask
because any
attribute values not sensed from the current layer, are set to default
values.
Parameters
CParaFormat* aParaFormat |
On return, contains the formatting which has been applied to the current
layer only. Any attributes not explicitly set in the current layer are
initialised to the default values for a CParaFormat . Attributes
specified in aMask are not sensed from this layer. The values for
these attributes are also initialised to the default settings. Must not be NULL
or a panic occurs. |
TParaFormatMask& aMask |
A bitmask. Any attributes which are set in the mask as passed into the
function are not sensed from the current layer. On return, indicates the
attributes which were sensed from this layer. So, normally, when passed to the
function, all attributes in the mask should be unset. |
CParaFormat:: TParaFormatGetMode aMode |
Controls which attributes are written to aParaFormat . If
EAllAttributes , all attributes are written; if
EFixedAttributes , tabs, bullets and borders are not written.
|
|
Leave codes
|
The function can only leave if aMode has a value of
EAllAttributes . |
|
CParaFormatLayer* CloneL()const;
Description
Constructs and returns a new CParaFormatLayer
with identical
formatting to the current layer. Note that the function does not copy the
original layer's based-on link — the new layer's based-on link is
set to NULL, so that the two layers may not have the same effective
formatting.
Return value
CParaFormatLayer* |
A new paragraph format layer cloned from the current layer. |
|
virtual TUid Type()const;
Description
Returns the paragraph format layer UID. This can be used to distinguish
between an ordinary paragraph format layer and paragraph styles, which have a
different UID.
Return value
TUid |
The UID of a paragraph format layer
(KNormalParagraphStyleUid ). |
|
TBool IsIdenticalL(const CParaFormat* aParaFormat,const TParaFormatMask& aMask)const;
Description
Compares a format attribute container with the current layer. For the two
objects to be identical, the current layer must contain only the attributes
specified in the argument aMask
, and these attributes must have
the same values as those in aParaFormat
. None of the current
layer's based-on links are searched.
Parameters
const CParaFormat* aParaFormat |
Contains the attribute values used in the comparison. |
const TParaFormatMask& aMask |
A bitmask specifying which attributes are relevant to the function.
|
|
Return value
TBool |
ETrue if the formatting of the current layer exactly
matches that contained in aParaFormat . Otherwise
EFalse . |
|
virtual TBool IsIdentical(CFormatLayer* aLayer,TBool aCheckBasedOnLink=ETrue)const;
Description
Compares another paragraph format layer with the current layer. For the
two layers to be equal, they must have the same contents and (if the second
parameter is ETrue
), their based-on links must point to the same
format layer.
Parameters
CFormatLayer* aLayer |
The paragraph format layer to compare to this format layer. |
TBool aCheckBasedOnLink=ETrue |
If ETrue , both layers' based-on links must point to the
same format layer. If EFalse , the based-on links are not used in
the comparison. By default, ETrue . |
|
Return value
TBool |
ETrue if the two layers are identical, otherwise
EFalse . |
|
const TUint8* Ptr(TInt& aSize)const;
Description
Gets a pointer to the start of the buffer containing the layer's format
attribute values.
Parameters
TInt& aSize |
On return, set to the size of the buffer. |
|
Return value
TUint8* |
Pointer to the buffer which contains the layer's format attribute
values. |
|
virtual void ExternalizeL(RWriteStream& aStream)const;
Description
Externalises the paragraph format layer but not its based-on link to a
write stream. The presence of this function means that the standard templated
operator<<()
(defined in s32strm.h) is available to
externalise objects of this class.
Parameters
RWriteStream& aStream |
Stream to which the format layer should be externalised. |
|
virtual void InternalizeL(RReadStream& aStream,const CFormatLayer* aBase=NULL);
Description
Internalises the paragraph format layer but not its based-on link 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. The internalised layer is set to be based on
the layer specified.
Parameters
RReadStream& aStream |
Stream from which the format layer should be internalised. |
const CFormatLayer* aBase=NULL |
The based-on link to assign to the layer. By default NULL. |
|