CFormatLayer Class Reference

#include <txtfmlyr.h>

class CFormatLayer : public CBase

Inherits from

  • CFormatLayer

    Detailed Description

    Abstract base class for the paragraph and character format layers.

    A format layer is a set of character or paragraph format attributes which may own a pointer to another format layer. This pointer is called a based-on link. The effective formatting of a text object may be built up from a chain of format layers - the final layer in the chain has a NULL based-on link. In case of conflict, attribute values set in upper layers (layers furthest from the layer with the NULL based-on link) override those set in lower layers. In rich text, additional formatting may be applied on top of these format layers.

    The system of based-on links is implemented by the CFormatLayer class. It also implements persistence for chains of format layers.

    When setting or sensing the attributes of a CParaFormatLayer or CCharFormatLayer, a format mask and container are specified as parameters. The container has data members for every format attribute, which may be set independently. When setting the layer, the mask indicates the attributes which will be taken from the container. Any attributes not specified in the mask will be taken from the system-provided default values.

    When sensing a layer, on return, the mask indicates which attributes have been explicitly set in the layer, (i.e. not taken from the default values). In addition, a layer's effective format may be sensed. In this case, no mask is used because the format container will, on return, contain a value for every attribute.

    Member Attribute Documentation

    __DECLARE_TEST

    __DECLARE_TEST[protected]

    iBasedOn

    const CFormatLayer *iBasedOn[protected]

    iStore

    RFormatStream iStore[protected]

    Constructor & Destructor Documentation

    CFormatLayer ( )

    CFormatLayer()[protected]

    ~CFormatLayer ( )

    ~CFormatLayer()[protected]

    Member Function Documentation

    ChainCount ( )

    IMPORT_C TIntChainCount()const

    Gets the number of format layers in the chain, inclusive of itself. Assumes that the format layer chain has been correctly set up to terminate with a NULL based-on link.

    Returns: The number of format layers in the chain, counting from the current layer.

    CloneLayerL ( CFormatLayer * )

    voidCloneLayerL(CFormatLayer *aClone)const [protected]

    ExternalizeChainL ( RWriteStream &, TInt )

    IMPORT_C voidExternalizeChainL(RWriteStream &aStream,
    TIntaExcludeCount = 0
    )const

    Stores a chain of format layers. By default an entire chain is stored unless an exclude count is provided. In this case, the length of the chain stored is the ChainCount() minus the exclude count. The excluded layers are the ones starting with the layer with the NULL based-on link.

    Note

    The exclude count must be zero or greater but must be less than the total number of layers in the chain, otherwise a panic occurs.

    ParameterDescription
    aStreamStream to which the format layer chain should be externalised.
    aExcludeCountThe number of layers to be excluded. By default, zero.

    ExternalizeL ( RWriteStream & )

    voidExternalizeL(RWriteStream &aStream)const [pure virtual]

    Implementations of this function externalise the format layer but not its based-on link to a write stream. The presence of this function means that the standard templatedoperator<<() (defined in s32strm.h) is available to externalise objects of the derived class.

    ParameterDescription
    aStreamStream to which the format layer should be externalised.

    ExternalizeLayersRecurseL ( RWriteStream &, TInt )

    voidExternalizeLayersRecurseL(RWriteStream &aStream,
    TIntaDescendantCount
    )const [protected]

    Stores a format layer chain with *aLength* number of layers in a stack-like fashion. This necessitates navigating to the end of the chain and storing the layers as we unwind back to the top of the chain.

    InternalizeChainL ( RReadStream &, const CFormatLayer * )

    IMPORT_C voidInternalizeChainL(RReadStream &aStream,
    const CFormatLayer *aBase = NULL
    )

    Restores a chain of format layers from a read stream. The layer at the end of the chain (the one furthest from this layer) is set to be based on the specified layer aBase, which may be NULL. This layer is set to be at the head of the restored chain (i.e. no other layers are based on it).

    ParameterDescription
    aStreamStream from which the format layer chain should be internalised.
    aBaseThe format layer at the end of the chain (furthest from this layer). May be NULL.

    InternalizeL ( RReadStream &, const CFormatLayer * )

    voidInternalizeL(RReadStream &aStream,
    const CFormatLayer *aBase = NULL
    )[pure virtual]

    Implementations of this function internalise the 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 the derived class. The internalised layer is set to be based on the layer specified.

    ParameterDescription
    aStreamStream from which the format layer should be internalised.
    aBaseThe based-on link to assign to the layer. By default, NULL.

    IsEmpty ( )

    IMPORT_C TBoolIsEmpty()const

    Tests whether any formatting is stored in the format layer.

    Returns: ETrue if no formatting is stored in the format layer, otherwise returns EFalse.

    IsIdentical ( CFormatLayer *, TBool )

    TBool IsIdentical(CFormatLayer *aLayer,
    TBoolaCheckBasedOnLink = ETrue
    )const [pure virtual]

    Implementations of this function compare another format layer with the current object. 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.

    ParameterDescription
    aLayerThe layer to compare to this format layer.
    aCheckBasedOnLinkIf 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.

    Returns: ETrue if the two layers are identical, otherwise EFalse.

    IsIdentical ( const TUint8 *, TInt )

    TBool IsIdentical(const TUint8 *aPtr,
    TIntaSize
    )const [protected]

    Implementations of this function compare another format layer with the current object. 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.

    Returns: ETrue if the two layers are identical, otherwise EFalse.

    Ptr ( TInt & )

    const TUint8 *Ptr(TInt &aSize)const [protected]

    Return a pointer to the stored bytecode.

    Reset ( )

    IMPORT_C voidReset()

    Deletes the contents of the format layer. The based-on link is not affected.

    RestoreNewL ( RReadStream & )

    CFormatLayer *RestoreNewL(RReadStream &aStream)[protected, pure virtual]

    SenseBase ( )

    IMPORT_C const CFormatLayer *SenseBase()const

    Gets the format layer which this layer's based-on link points to. If NULL, this layer is the final layer in the chain.

    Returns: The format layer on which this layer is based.

    SetBase ( const CFormatLayer * )

    IMPORT_C voidSetBase(const CFormatLayer *aBaseFormatLayer)

    Sets the format layer which this layer's based-on link points to.

    ParameterDescription
    aBaseFormatLayerThe format layer which this layer's based-on link points to. Specify NULL if this is the final layer in the chain (the layer on which all other layers are based).

    Swap ( CFormatLayer & )

    voidSwap(CFormatLayer &aLayer)

    Swaps the contents of this with aLayer.

    ParameterDescription
    aLayerThe layer to swap contents with.