williamr@4: /* williamr@4: * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@4: * All rights reserved. williamr@4: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@4: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@4: * williamr@4: * Initial Contributors: williamr@4: * Nokia Corporation - initial contribution. williamr@4: * williamr@4: * Contributors: williamr@4: * williamr@4: * Description: williamr@4: * williamr@4: */ williamr@4: williamr@2: williamr@2: #ifndef __TXTMFMTX_H__ williamr@2: #define __TXTMFMTX_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: // Defines interface for getting/setting formatting attributes. williamr@2: williamr@2: williamr@2: williamr@2: class MFormatText williamr@2: /** williamr@2: Specifies the mixin protocol for getting and setting character and paragraph williamr@2: format attributes. williamr@2: williamr@2: It is inherited by classes which support character and paragraph formatting, williamr@2: e.g. CRichText and CGlobalText. Its purpose is to allow developers to apply williamr@2: and retrieve formatting without needing to know which type of editable text williamr@2: is involved. williamr@2: williamr@2: All functions defined in this class use a document position and a length. williamr@2: These values are only relevant to rich text. In general, they must be valid williamr@2: (i.e. the range must not extend beyond the bounds of the document), or a panic williamr@2: occurs. In global text, formatting is applied globally, so that the length williamr@2: and position values are ignored. williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: { williamr@2: public: williamr@2: // williamr@2: // Paragraph format attributes williamr@2: williamr@2: williamr@2: /** Gets the effective paragraph formatting which applies to a range of paragraphs. williamr@2: Also gets a bit mask which indicates which values change over the region, williamr@2: and whose value is therefore indeterminate. williamr@2: williamr@2: @param aFormat On return, contains the effective paragraph formatting for williamr@2: the range of paragraphs. For global text, this is the paragraph formatting williamr@2: of the entire text object. williamr@2: @param aVaries On return, a bitmask indicating which paragraph format attributes williamr@2: vary over the range of characters selected. For global text, this mask contains williamr@2: a value of zero for every attribute because formatting is applied globally. williamr@2: @param aPos The document position of the start of the range. williamr@2: @param aLength The number of characters in the range. williamr@2: @param aMode The default, EAllAttributes means that values for all paragraph williamr@2: format attributes are written to aFormat. EFixedAttributes means that tabs, williamr@2: bullets and borders are not written to aFormat. */ williamr@2: virtual void GetParaFormatL(CParaFormat* aFormat,TParaFormatMask& aVaries,TInt aPos,TInt aLength, williamr@2: CParaFormat::TParaFormatGetMode aMode=CParaFormat::EAllAttributes)const=0; williamr@2: williamr@2: williamr@2: /** Applies paragraph formatting to a range of paragraphs. The attributes which williamr@2: are set in the mask are taken from aFormat and applied. The attributes which williamr@2: are not set in the mask are not applied. williamr@2: williamr@2: @param aFormat Contains the paragraph format attribute values to apply. williamr@2: @param aMask Specifies which paragraph format attributes should be applied. williamr@2: @param aPos The document position of the start of the range. williamr@2: @param aLength The number of characters in the range. */ williamr@2: virtual void ApplyParaFormatL(const CParaFormat* aFormat,const TParaFormatMask& aMask,TInt aPos,TInt aLength)=0; williamr@2: // williamr@2: // Character format attributes williamr@2: williamr@2: williamr@2: /** Gets the effective character formatting which applies to a range of characters. williamr@2: Also gets a bit mask which indicates which values change over the region, williamr@2: and whose value is therefore indeterminate. williamr@2: williamr@2: @param aFormat On return, contains the character format values for the range williamr@2: of characters. For global text, this is the character formatting of the entire williamr@2: text object. williamr@2: @param aVaries On return, indicates which character format attributes vary williamr@2: over the range and whose values are therefore indeterminate. For global text, williamr@2: this mask contains a value of zero for every attribute because formatting williamr@2: is applied globally. williamr@2: @param aPos The document position of the start of the range. williamr@2: @param aLength The number of characters in the range. */ williamr@2: virtual void GetCharFormat(TCharFormat& aFormat,TCharFormatMask& aVaries,TInt aPos,TInt aLength)const=0; williamr@2: williamr@2: williamr@2: /** Applies character formatting to a range of characters. The attributes which williamr@2: are set in the mask are taken from aFormat and applied. The attributes which williamr@2: are not set in the mask are not applied. williamr@2: williamr@2: @param aFormat Contains the character format attribute values to apply. williamr@2: @param aMask Bitmask specifying which character format attributes should be williamr@2: applied. williamr@2: @param aPos Document position from which to apply the new character formatting. williamr@2: williamr@2: @param aLength The number of characters to which the new formatting should williamr@2: be applied. */ williamr@2: virtual void ApplyCharFormatL(const TCharFormat& aFormat,const TCharFormatMask& aMask,TInt aPos,TInt aLength)=0; williamr@2: }; williamr@2: williamr@2: #endif williamr@4: