epoc32/include/txtlaydc.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
     1.1 --- a/epoc32/include/txtlaydc.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/txtlaydc.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,177 @@
     1.4 -txtlaydc.h
     1.5 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +// All rights reserved.
     1.7 +// This component and the accompanying materials are made available
     1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.9 +// which accompanies this distribution, and is available
    1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +//
    1.12 +// Initial Contributors:
    1.13 +// Nokia Corporation - initial contribution.
    1.14 +//
    1.15 +// Contributors:
    1.16 +//
    1.17 +// Description:
    1.18 +//
    1.19 +
    1.20 +#ifndef __TXTLAYDC_H__
    1.21 +#define __TXTLAYDC_H__
    1.22 +
    1.23 +#include <e32std.h>
    1.24 +
    1.25 +class CParaFormat;
    1.26 +class TCharFormat;
    1.27 +class CPicture;
    1.28 +
    1.29 +
    1.30 +class MLayDoc
    1.31 +/** 
    1.32 +Specifies the interface for providing the information needed by the text 
    1.33 +layout engine to lay out a text object. 
    1.34 +
    1.35 +Examples of derived classes are CRichText and CGlobalText.
    1.36 +
    1.37 +At the heart of the interface are two interrogation functions; one gives the 
    1.38 +paragraph formatting for a document position, and the other gives a pointer 
    1.39 +descriptor to a series of contiguous characters with identical character 
    1.40 +formatting, and their character formatting. This information is sufficient 
    1.41 +for the layout engine to find the formatting and content of an entire document.
    1.42 +
    1.43 +The constructor for the layout engine (CTextLayout) is prototyped as:
    1.44 +static CTextLayout *NewL(MLayDoc *aDoc,TInt aWrapWidth);
    1.45 +By viewing the text object purely in terms of the MLayDoc interface, the layout 
    1.46 +engine is insulated from any editable text implementation issues.
    1.47 +@see static CTextLayout *NewL(MLayDoc *aDoc,TInt aWrapWidth)
    1.48 +@publishedAll
    1.49 +@released
    1.50 +*/
    1.51 +	{
    1.52 +	// Defines interface for extracting content & format information from text source.
    1.53 +	// Designed to be 'mixed-in' with other classes.
    1.54 +	//
    1.55 +public:
    1.56 +	
    1.57 +	/** Used as a parameter to the PictureHandleL() function to control whether 
    1.58 +	picture data should be loaded into memory or not. */
    1.59 +	enum TForcePictureLoad 
    1.60 +		{
    1.61 +		/** Do not load the picture data into memory. */
    1.62 +		EForceLoadFalse,
    1.63 +		/** Load the picture data into memory. */
    1.64 +		EForceLoadTrue
    1.65 +		};
    1.66 +public:
    1.67 +		
    1.68 +	/** Gets the the number of characters in the document.
    1.69 +	
    1.70 +	@return The number of characters contained in the document. */
    1.71 +	virtual TInt LdDocumentLength()const=0;  // Does not include final document terminator
    1.72 +
    1.73 +	/** Gets the document position of the start of the paragraph containing a 
    1.74 +	specified position.
    1.75 +	
    1.76 +	@param aCurrentPos A valid document position. On return contains the 
    1.77 +	document position of the first character in the paragraph. 
    1.78 +	@return The number of characters skipped in scanning to the start of the 
    1.79 +	paragraph. */
    1.80 +	virtual TInt LdToParagraphStart(TInt& aCurrentPos)const=0;
    1.81 +		
    1.82 +	/** Gets the effective paragraph formatting which applies to the paragraph 
    1.83 +	which contains a specified document position. On return, aFormat is filled 
    1.84 +	with values for all paragraph format attributes.
    1.85 +	
    1.86 +	@param aFormat On return, filled with the paragraph's effective paragraph 
    1.87 +	formatting. 
    1.88 +	@param aPos Any document position within the paragraph of interest. */
    1.89 +	virtual void GetParagraphFormatL(CParaFormat* aFormat,TInt aPos)const=0;
    1.90 +	
    1.91 +	/** Gets a constant pointer descriptor to a portion of the text object with 
    1.92 +	constant character formatting. The view starts at the document position 
    1.93 +	specified, and ends at: 
    1.94 +	
    1.95 +	the last character which shares the same character formatting (rich text 
    1.96 +	only), or
    1.97 +	
    1.98 +	the end of the document, or
    1.99 +	
   1.100 +	the end of the segment, if segmented storage is being used
   1.101 +	
   1.102 +	whichever occurs first. 
   1.103 +	
   1.104 +	Also fills a character format object with the character formatting of the 
   1.105 +	range of characters.
   1.106 +	
   1.107 +	@param aView On return, a constant pointer to a portion of the text. 
   1.108 +	@param aFormat On return, contains the character formatting of the text. 
   1.109 +	@param aStartPos The start position for the view. Must be a valid document 
   1.110 +	position, or a panic occurs. */
   1.111 +	virtual void GetChars(TPtrC& aView,TCharFormat& aFormat,TInt aStartPos)const=0;	
   1.112 +
   1.113 +	/** Gets the size of a picture located at a specified document position.
   1.114 +	
   1.115 +	Note: The global text implementation of this function always returns 
   1.116 +	KErrNotFound because global text does not support pictures.
   1.117 +	
   1.118 +	@param aSize On return, contains the size of the picture located at aPos.
   1.119 +	@param aPos Document position of the picture. 
   1.120 +	@return KErrNotFound if there is no picture at the specified document 
   1.121 +	position, KErrNone if there is. */
   1.122 +	virtual TInt GetPictureSizeInTwips(TSize& aSize, TInt aPos)const=0;
   1.123 +
   1.124 +	/** Gets a pointer to the picture located at a specified document position, 
   1.125 +	if one exists. If the picture is not in memory, the function loads it (if 
   1.126 +	the second argument has a value of EForceLoadTrue).
   1.127 +	
   1.128 +	Note: The global text implementation of this function always returns NULL 
   1.129 +	because global text does not support pictures.
   1.130 +	
   1.131 +	@param aPos Document position of the picture character. 
   1.132 +	@param aForceLoad If the picture is not loaded into memory, EForceLoadTrue 
   1.133 +	loads it using the picture factory; EForceLoadFalse does not, and in this 
   1.134 +	case, the function returns NULL. 
   1.135 +	@return A pointer to the picture located at aPos. NULL if aPos does not 
   1.136 +	specify a picture character, or if there is a picture at aPos which is not 
   1.137 +	in memory, and the second argument is EForceLoadFalse. */
   1.138 +	virtual CPicture* PictureHandleL(TInt aPos,TForcePictureLoad aForceLoad=EForceLoadTrue)const=0;
   1.139 +
   1.140 +	/** Tests whether a page break occurs within a range of characters. A page 
   1.141 +	table should have been set up first: see CPlainText::SetPageTable().
   1.142 +	
   1.143 +	@param aPos The document position from which to begin searching for a page 
   1.144 +	break.
   1.145 +	@param aLength The number of characters to search for a page break, 
   1.146 +	beginning at aPos. The default is zero. 
   1.147 +	@return ETrue if a page break occurs within the specified range, otherwise 
   1.148 +	EFalse. */
   1.149 +	virtual TBool EnquirePageBreak(TInt aPos,TInt aLength=0)const=0;
   1.150 +	
   1.151 +	/** This function should be implemented by text objects which support 
   1.152 +	paragraph labels. Each paragraph may have at most one label. By default, 
   1.153 +	the functions provided by MLayDoc apply to the main body of text. This 
   1.154 +	function is provided to change this so that the MLayDoc object is an 
   1.155 +	individual paragraph label, (each of which is treated as a separate 
   1.156 +	document). Paragraph labelling has not been implemented by global or rich 
   1.157 +	text.
   1.158 +	
   1.159 +	This function should select the paragraph label associated with the 
   1.160 +	paragraph containing document position aPos (aPos is a document position 
   1.161 +	in the main document).
   1.162 +	
   1.163 +	@param aPos A document position within a paragraph. This paragraph's label 
   1.164 +	should be set as the main MLayDoc document. 
   1.165 +	@return Should return EFalse if the paragraph has no label, in which case 
   1.166 +	the function has no effect, ETrue otherwise. */
   1.167 +	virtual TBool SelectParagraphLabel(TInt aPos)=0;
   1.168 +
   1.169 +	/** Cancels a paragraph label selection made by a call to 
   1.170 +	SelectParagraphLabel() so that the main document reverts back to the main 
   1.171 +	body of text. */
   1.172 +	virtual void CancelSelectLabel()=0;
   1.173 +	
   1.174 +	/**
   1.175 +	@internalAll
   1.176 +	@prototype
   1.177 +	*/
   1.178 +	IMPORT_C virtual void MLayDoc_Reserved_1();
   1.179 +	};
   1.180 +
   1.181 +#endif