CParaFormat Class Reference

class CParaFormat : public CBase

A transient container of paragraph format attributes, including tab stops, bullet points and paragraph borders.

Rich and global text objects store paragraph formatting using paragraph format layers (see class CParaFormatLayer). The CParaFormat class is used to store the relevant attribute values when setting or sensing a CParaFormatLayer. It is normally used in combination with a TParaFormatMask, to specify which attributes are relevant to the function concerned.

On construction, all CParaFormat member data is initialised. The attributes which are not explicitly set are assigned default values.

Inherits from

Public Member Functions
~CParaFormat()
TBool BordersPresent()
IMPORT_C voidCopyL(const CParaFormat &, const TParaFormatMask &)
IMPORT_C TBoolIsBorderEqual(TParaBorderSide, const CParaFormat &)
IMPORT_C TBoolIsEqual(const CParaFormat &, const TParaFormatMask &)
IMPORT_C CParaFormat *NewL()
IMPORT_C CParaFormat *NewL(const CParaFormat &)
IMPORT_C CParaFormat *NewLC()
IMPORT_C const TParaBorderParaBorder(TParaBorderSide)
TParaBorder *ParaBorderPtr(TParaBorderSide)
IMPORT_C voidRemoveAllBorders()
IMPORT_C voidRemoveTab(TInt)
IMPORT_C voidReset()
IMPORT_C voidResetNonDestructive()
IMPORT_C voidSetParaBorderL(TParaBorderSide, const TParaBorder &)
IMPORT_C voidStoreTabL(const TTabStop &)
IMPORT_C voidStrip()
TInt TabCount()
IMPORT_C const TTabStopTabStop(TInt)
Private Member Functions
CParaFormat(const CParaFormat &)
voidCreateTabListL()
CParaFormat &operator=(const CParaFormat &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enumanonymous { EMaxParaBorder = 4 }
enumanonymous { }
enumTAlignment {
ELeftAlign, ETopAlign = ELeftAlign, ECenterAlign, ERightAlign, EBottomAlign = ERightAlign, EJustifiedAlign, EUnspecifiedAlign, ECustomAlign, EAbsoluteLeftAlign, EAbsoluteRightAlign
}
enumTLineSpacingControl { ELineSpacingAtLeastInTwips, ELineSpacingExactlyInTwips, ELineSpacingAtLeastInPixels, ELineSpacingExactlyInPixels }
enumTParaBorderSide { EParaBorderTop, EParaBorderBottom, EParaBorderLeft, EParaBorderRight }
enumTParaFormatGetMode { EAllAttributes, EFixedAttributes }
Private Member Enumerations
enumanonymous { ETabStoreGranularity = 2 }
enumanonymous { }
Public Attributes
TInt32 iBorderMarginInTwips
TBullet *iBullet
TUint32 iDefaultTabWidthInTwips
TLogicalRgb iFillColor
TAlignment iHorizontalAlignment
TInt32 iIndentInTwips
TBool iKeepTogether
TBool iKeepWithNext
TInt32 iLanguage
TInt32 iLeftMarginInTwips
TLineSpacingControl iLineSpacingControl
TInt32 iLineSpacingInTwips
TInt32 iRightMarginInTwips
TInt32 iSpaceAfterInTwips
TInt32 iSpaceBeforeInTwips
TBool iStartNewPage
TAlignment iVerticalAlignment
TBool iWidowOrphan
TBool iWrap
Private Attributes
TParaBorderArray *iParaBorderArray
CArrayFixFlat< TTabStop > *iTabList

Constructor & Destructor Documentation

CParaFormat(const CParaFormat &)

CParaFormat(const CParaFormat &aFormat)[private]

Parameters

const CParaFormat & aFormat

~CParaFormat()

IMPORT_C~CParaFormat()

The destructor frees all resources owned by the paragraph format container (tabs, borders and bullets), prior to its destruction.

Note that Strip() also sets the resource pointers to NULL. This is important in case CParaFormat is on the stack and gets deleted twice: once by the cleanup stack and once by exceptions being unwound.

Member Functions Documentation

BordersPresent()

TBool BordersPresent()const [inline]

Tests whether any paragraph borders have been set.

CopyL(const CParaFormat &, const TParaFormatMask &)

IMPORT_C voidCopyL(const CParaFormat &aFormat,
const TParaFormatMask &aMask
)

Parameters

const CParaFormat & aFormat
const TParaFormatMask & aMask

CreateTabListL()

voidCreateTabListL()[private]

IsBorderEqual(TParaBorderSide, const CParaFormat &)

IMPORT_C TBoolIsBorderEqual(TParaBorderSideaSide,
const CParaFormat &aFormat
)const

Tests whether the paragraph border located on the specified side is the same as the border on the corresponding side in this object. For two borders to be equal, they must both either be set or unset, and if set, they must have the same characteristics.

Parameters

TParaBorderSide aSideIndicates which side should be compared.
const CParaFormat & aFormatContains the paragraph border to compare.

IsEqual(const CParaFormat &, const TParaFormatMask &)

IMPORT_C TBoolIsEqual(const CParaFormat &aFormat,
const TParaFormatMask &aMask
)const

Parameters

const CParaFormat & aFormat
const TParaFormatMask & aMask

NewL()

IMPORT_C CParaFormat *NewL()[static]

Allocates and constructs a CParaFormat object. All attributes are initialised with default values.

NewL(const CParaFormat &)

IMPORT_C CParaFormat *NewL(const CParaFormat &aFormat)[static]

Parameters

const CParaFormat & aFormat

NewLC()

IMPORT_C CParaFormat *NewLC()[static]

Allocates and constructs a CParaFormat object. All attributes are initialised with default values. Leaves the object on the cleanup stack.

ParaBorder(TParaBorderSide)

IMPORT_C const TParaBorderParaBorder(TParaBorderSideaSide)const

Parameters

TParaBorderSide aSide

ParaBorderPtr(TParaBorderSide)

TParaBorder *ParaBorderPtr(TParaBorderSideaSide)[inline]

Gets a pointer to the paragraph border on the side specified. If no paragraph border array has been allocated, returns NULL.

Parameters

TParaBorderSide aSideThe side for the paragraph border.

RemoveAllBorders()

IMPORT_C voidRemoveAllBorders()

RemoveTab(TInt)

IMPORT_C voidRemoveTab(TIntaTabTwipsPosition)

Parameters

TInt aTabTwipsPosition

Reset()

IMPORT_C voidReset()

ResetNonDestructive()

IMPORT_C voidResetNonDestructive()

SetParaBorderL(TParaBorderSide, const TParaBorder &)

IMPORT_C voidSetParaBorderL(TParaBorderSideaSide,
const TParaBorder &aBorder
)

Sets one side of the object's paragraph border. If a border on the specified side already exists, it is replaced.

Note: Setting a single side of the object's paragraph border incurs the overhead of allocating storage for the three other sides, which are assigned default values.

Parameters

TParaBorderSide aSideThe side for the paragraph border.
const TParaBorder & aBorderSpecification for the paragraph border.

StoreTabL(const TTabStop &)

IMPORT_C voidStoreTabL(const TTabStop &aTabStop)

Adds a tab stop to the list of tab stops, maintaining the ordering of the list, (ascending order of twips position). Multiple tabs with the same twips position are not allowed, so that if aTabStop shares the same twips position as an existing tab stop, regardless of its alignment, the existing tab stop is replaced by aTabStop.

Parameters

const TTabStop & aTabStopThe tab stop to be stored.

Strip()

IMPORT_C voidStrip()

Deletes all paragraph borders, bullets and tab stops. No other attributes are affected.

TabCount()

TInt TabCount()const [inline]

TabStop(TInt)

IMPORT_C const TTabStopTabStop(TIntaTabIndex)const

Gets the tab stop located at the specified index within the tab list (counting from zero). Tab stops are ordered in ascending order of twips position. If the object has no tab list, then a default tab stop is returned.

Parameters

TInt aTabIndexThe offset of the tab stop in the tab list. Must be less than the total number of tab stops, or a panic occurs. To find the total number of tab stops, use TabCount().

operator=(const CParaFormat &)

CParaFormat &operator=(const CParaFormat &aParaFormat)[private]

Parameters

const CParaFormat & aParaFormat

Member Enumerations Documentation

Enum anonymous

Miscellaneous constants.

Enumerators

EMaxParaBorder = 4

The maximum number of paragraph borders (= 4).

Enum anonymous

Enumerators

ETabStoreGranularity = 2

Enum anonymous

Miscellaneous constants.

Enumerators

Enum anonymous

Enumerators

Enum TAlignment

Paragraph alignment

Enumerators

ELeftAlign

Paragraph aligned to the leading margin (left for left-to-right paragraphs, right for right-to-left paragraphs).

ETopAlign = ELeftAlign

Paragraph top aligned.

ECenterAlign

Paragraph centre aligned.

ERightAlign

Paragraph aligned to the trailing margin (right for left-to-right paragraphs, left for right-to-left paragraphs).

EBottomAlign = ERightAlign

Paragraph bottom aligned.

EJustifiedAlign

Paragraph justified.

EUnspecifiedAlign

Used by the spreadsheet application. Unlike ETopAlign and EBottomAlign, provides no default implementation.

ECustomAlign

User-defined paragraph alignment.

EAbsoluteLeftAlign

Absolute left alignment

EAbsoluteRightAlign

Absolute right alignment

Enum TLineSpacingControl

Line spacing control

Enumerators

ELineSpacingAtLeastInTwips

Twips line spacing must be at least as wide as the iLineSpacingInTwips value.

ELineSpacingExactlyInTwips

Twips line spacing must be exactly the iLineSpacingInTwips value.

ELineSpacingAtLeastInPixels

Pixels line spacing must be at least as wide as the line spacing value in pixels.

ELineSpacingExactlyInPixels

Pixels line spacing must be exactly the same as the line spacing value in pixels.

Enum TParaBorderSide

Paragraph border sides

Enumerators

EParaBorderTop

The border at the top of the paragraph.

EParaBorderBottom

The border at the bottom of the paragraph.

EParaBorderLeft

The border on the left hand side.

EParaBorderRight

The border on the right hand side.

Enum TParaFormatGetMode

Attribute sense mode

Enumerators

EAllAttributes

Indicates that all paragraph format attributes are written to the result when sensing paragraph format attributes.

EFixedAttributes

Indicates that tabs, bullets and borders are not sensed.

Member Data Documentation

TInt32 iBorderMarginInTwips

TInt32 iBorderMarginInTwips

Distance in twips between the paragraph border and the enclosed text. By default KParaDefaultBorderMargin (zero).

TBullet * iBullet

TBullet *iBullet

The bullet point associated with the paragraph. A NULL value indicates no bullet point. By default NULL.

TUint32 iDefaultTabWidthInTwips

TUint32 iDefaultTabWidthInTwips

Specifies the default tab stop width. By default KParaDefaultTabWidth (360 twips).

TLogicalRgb iFillColor

TLogicalRgb iFillColor

The background colour of the paragraph. By default the default system background colour. This colour applies to the area bounded by the paragraph border, if one exists.

TAlignment iHorizontalAlignment

TAlignment iHorizontalAlignment

Horizontal alignment of paragraph. By default KParaDefaultHorizAlign (left).

TInt32 iIndentInTwips

TInt32 iIndentInTwips

An indent for the first line in the paragraph, relative to the leading margin (left for left-to-right paragraphs, right for right-to-left paragraphs). By default KParaDefaultIndent (zero).

TBool iKeepTogether

TBool iKeepTogether

Prevents a page break within paragraph if ETrue. By default KParaDefaultKeepTogether (EFalse).

TBool iKeepWithNext

TBool iKeepWithNext

Prevents a page break between this paragraph and the following paragraph if ETrue. By default, KParaDefaultKeepWithNext (EFalse).

TInt32 iLanguage

TInt32 iLanguage

The language of the paragraph for proofing. By default KParaDefaultLanguage. Used for example when spell checking a document which contains text in more than one language, so that the program recognises the text as being in another language.

TInt32 iLeftMarginInTwips

TInt32 iLeftMarginInTwips

The width in twips of the leading margin (left for left-to-right paragraphs, right for right-to-left paragraphs). By default KParaDefaultLeftMargin (zero).

TLineSpacingControl iLineSpacingControl

TLineSpacingControl iLineSpacingControl

Control for the iLineSpacingInTwips value. By default, KParaDefaultLineSpacingControl (ELineSpacingAtLeastInTwips).

TInt32 iLineSpacingInTwips

TInt32 iLineSpacingInTwips

Inter-line spacing within the paragraph, in twips. By default KParaDefaultLineSpacing (200 twips).

TParaBorderArray * iParaBorderArray

TParaBorderArray *iParaBorderArray[private]

TInt32 iRightMarginInTwips

TInt32 iRightMarginInTwips

The width in twips of the trailing margin (right for left-to-right paragraphs, left for right-to-left paragraphs). By default KParaDefaultRightMargin (zero).

TInt32 iSpaceAfterInTwips

TInt32 iSpaceAfterInTwips

Space below paragraph. By default KParaDefaultSpaceAfter (zero).

TInt32 iSpaceBeforeInTwips

TInt32 iSpaceBeforeInTwips

Space above paragraph. By default KParaDefaultSpaceBefore (zero).

TBool iStartNewPage

TBool iStartNewPage

Inserts a page break immediately before this paragraph if ETrue. By default, KParaDefaultStartNewPage (EFalse).

CArrayFixFlat< TTabStop > * iTabList

CArrayFixFlat< TTabStop > *iTabList[private]

TAlignment iVerticalAlignment

TAlignment iVerticalAlignment

Vertical alignment of paragraph, (intended for use by spreadsheet applications). By default KParaDefaultVertAlign (unspecified).

TBool iWidowOrphan

TBool iWidowOrphan

Prevents the printing of the last line of a paragraph at the top of the page (referred to as a widow), or the first line of a paragraph at the bottom of the page, (referred to as an orphan). By default, KParaDefaultWidowOrphan (EFalse).

TBool iWrap

TBool iWrap

Specifies whether the paragraph should line wrap at the right margin. By default KParaDefaultWrap (ETrue).