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