epoc32/include/txtlaydc.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// 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
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
//
williamr@2
    15
williamr@2
    16
#ifndef __TXTLAYDC_H__
williamr@2
    17
#define __TXTLAYDC_H__
williamr@2
    18
williamr@2
    19
#include <e32std.h>
williamr@2
    20
williamr@2
    21
class CParaFormat;
williamr@2
    22
class TCharFormat;
williamr@2
    23
class CPicture;
williamr@2
    24
williamr@2
    25
williamr@2
    26
class MLayDoc
williamr@2
    27
/** 
williamr@2
    28
Specifies the interface for providing the information needed by the text 
williamr@2
    29
layout engine to lay out a text object. 
williamr@2
    30
williamr@2
    31
Examples of derived classes are CRichText and CGlobalText.
williamr@2
    32
williamr@2
    33
At the heart of the interface are two interrogation functions; one gives the 
williamr@2
    34
paragraph formatting for a document position, and the other gives a pointer 
williamr@2
    35
descriptor to a series of contiguous characters with identical character 
williamr@2
    36
formatting, and their character formatting. This information is sufficient 
williamr@2
    37
for the layout engine to find the formatting and content of an entire document.
williamr@2
    38
williamr@2
    39
The constructor for the layout engine (CTextLayout) is prototyped as:
williamr@2
    40
static CTextLayout *NewL(MLayDoc *aDoc,TInt aWrapWidth);
williamr@2
    41
By viewing the text object purely in terms of the MLayDoc interface, the layout 
williamr@2
    42
engine is insulated from any editable text implementation issues.
williamr@2
    43
@see static CTextLayout *NewL(MLayDoc *aDoc,TInt aWrapWidth)
williamr@2
    44
@publishedAll
williamr@2
    45
@released
williamr@2
    46
*/
williamr@2
    47
	{
williamr@2
    48
	// Defines interface for extracting content & format information from text source.
williamr@2
    49
	// Designed to be 'mixed-in' with other classes.
williamr@2
    50
	//
williamr@2
    51
public:
williamr@2
    52
	
williamr@2
    53
	/** Used as a parameter to the PictureHandleL() function to control whether 
williamr@2
    54
	picture data should be loaded into memory or not. */
williamr@2
    55
	enum TForcePictureLoad 
williamr@2
    56
		{
williamr@2
    57
		/** Do not load the picture data into memory. */
williamr@2
    58
		EForceLoadFalse,
williamr@2
    59
		/** Load the picture data into memory. */
williamr@2
    60
		EForceLoadTrue
williamr@2
    61
		};
williamr@2
    62
public:
williamr@2
    63
		
williamr@2
    64
	/** Gets the the number of characters in the document.
williamr@2
    65
	
williamr@2
    66
	@return The number of characters contained in the document. */
williamr@2
    67
	virtual TInt LdDocumentLength()const=0;  // Does not include final document terminator
williamr@2
    68
williamr@2
    69
	/** Gets the document position of the start of the paragraph containing a 
williamr@2
    70
	specified position.
williamr@2
    71
	
williamr@2
    72
	@param aCurrentPos A valid document position. On return contains the 
williamr@2
    73
	document position of the first character in the paragraph. 
williamr@2
    74
	@return The number of characters skipped in scanning to the start of the 
williamr@2
    75
	paragraph. */
williamr@2
    76
	virtual TInt LdToParagraphStart(TInt& aCurrentPos)const=0;
williamr@2
    77
		
williamr@2
    78
	/** Gets the effective paragraph formatting which applies to the paragraph 
williamr@2
    79
	which contains a specified document position. On return, aFormat is filled 
williamr@2
    80
	with values for all paragraph format attributes.
williamr@2
    81
	
williamr@2
    82
	@param aFormat On return, filled with the paragraph's effective paragraph 
williamr@2
    83
	formatting. 
williamr@2
    84
	@param aPos Any document position within the paragraph of interest. */
williamr@2
    85
	virtual void GetParagraphFormatL(CParaFormat* aFormat,TInt aPos)const=0;
williamr@2
    86
	
williamr@2
    87
	/** Gets a constant pointer descriptor to a portion of the text object with 
williamr@2
    88
	constant character formatting. The view starts at the document position 
williamr@2
    89
	specified, and ends at: 
williamr@2
    90
	
williamr@2
    91
	the last character which shares the same character formatting (rich text 
williamr@2
    92
	only), or
williamr@2
    93
	
williamr@2
    94
	the end of the document, or
williamr@2
    95
	
williamr@2
    96
	the end of the segment, if segmented storage is being used
williamr@2
    97
	
williamr@2
    98
	whichever occurs first. 
williamr@2
    99
	
williamr@2
   100
	Also fills a character format object with the character formatting of the 
williamr@2
   101
	range of characters.
williamr@2
   102
	
williamr@2
   103
	@param aView On return, a constant pointer to a portion of the text. 
williamr@2
   104
	@param aFormat On return, contains the character formatting of the text. 
williamr@2
   105
	@param aStartPos The start position for the view. Must be a valid document 
williamr@2
   106
	position, or a panic occurs. */
williamr@2
   107
	virtual void GetChars(TPtrC& aView,TCharFormat& aFormat,TInt aStartPos)const=0;	
williamr@2
   108
williamr@2
   109
	/** Gets the size of a picture located at a specified document position.
williamr@2
   110
	
williamr@2
   111
	Note: The global text implementation of this function always returns 
williamr@2
   112
	KErrNotFound because global text does not support pictures.
williamr@2
   113
	
williamr@2
   114
	@param aSize On return, contains the size of the picture located at aPos.
williamr@2
   115
	@param aPos Document position of the picture. 
williamr@2
   116
	@return KErrNotFound if there is no picture at the specified document 
williamr@2
   117
	position, KErrNone if there is. */
williamr@2
   118
	virtual TInt GetPictureSizeInTwips(TSize& aSize, TInt aPos)const=0;
williamr@2
   119
williamr@2
   120
	/** Gets a pointer to the picture located at a specified document position, 
williamr@2
   121
	if one exists. If the picture is not in memory, the function loads it (if 
williamr@2
   122
	the second argument has a value of EForceLoadTrue).
williamr@2
   123
	
williamr@2
   124
	Note: The global text implementation of this function always returns NULL 
williamr@2
   125
	because global text does not support pictures.
williamr@2
   126
	
williamr@2
   127
	@param aPos Document position of the picture character. 
williamr@2
   128
	@param aForceLoad If the picture is not loaded into memory, EForceLoadTrue 
williamr@2
   129
	loads it using the picture factory; EForceLoadFalse does not, and in this 
williamr@2
   130
	case, the function returns NULL. 
williamr@2
   131
	@return A pointer to the picture located at aPos. NULL if aPos does not 
williamr@2
   132
	specify a picture character, or if there is a picture at aPos which is not 
williamr@2
   133
	in memory, and the second argument is EForceLoadFalse. */
williamr@2
   134
	virtual CPicture* PictureHandleL(TInt aPos,TForcePictureLoad aForceLoad=EForceLoadTrue)const=0;
williamr@2
   135
williamr@2
   136
	/** Tests whether a page break occurs within a range of characters. A page 
williamr@2
   137
	table should have been set up first: see CPlainText::SetPageTable().
williamr@2
   138
	
williamr@2
   139
	@param aPos The document position from which to begin searching for a page 
williamr@2
   140
	break.
williamr@2
   141
	@param aLength The number of characters to search for a page break, 
williamr@2
   142
	beginning at aPos. The default is zero. 
williamr@2
   143
	@return ETrue if a page break occurs within the specified range, otherwise 
williamr@2
   144
	EFalse. */
williamr@2
   145
	virtual TBool EnquirePageBreak(TInt aPos,TInt aLength=0)const=0;
williamr@2
   146
	
williamr@2
   147
	/** This function should be implemented by text objects which support 
williamr@2
   148
	paragraph labels. Each paragraph may have at most one label. By default, 
williamr@2
   149
	the functions provided by MLayDoc apply to the main body of text. This 
williamr@2
   150
	function is provided to change this so that the MLayDoc object is an 
williamr@2
   151
	individual paragraph label, (each of which is treated as a separate 
williamr@2
   152
	document). Paragraph labelling has not been implemented by global or rich 
williamr@2
   153
	text.
williamr@2
   154
	
williamr@2
   155
	This function should select the paragraph label associated with the 
williamr@2
   156
	paragraph containing document position aPos (aPos is a document position 
williamr@2
   157
	in the main document).
williamr@2
   158
	
williamr@2
   159
	@param aPos A document position within a paragraph. This paragraph's label 
williamr@2
   160
	should be set as the main MLayDoc document. 
williamr@2
   161
	@return Should return EFalse if the paragraph has no label, in which case 
williamr@2
   162
	the function has no effect, ETrue otherwise. */
williamr@2
   163
	virtual TBool SelectParagraphLabel(TInt aPos)=0;
williamr@2
   164
williamr@2
   165
	/** Cancels a paragraph label selection made by a call to 
williamr@2
   166
	SelectParagraphLabel() so that the main document reverts back to the main 
williamr@2
   167
	body of text. */
williamr@2
   168
	virtual void CancelSelectLabel()=0;
williamr@2
   169
	
williamr@2
   170
	/**
williamr@2
   171
	@internalAll
williamr@2
   172
	@prototype
williamr@2
   173
	*/
williamr@2
   174
	IMPORT_C virtual void MLayDoc_Reserved_1();
williamr@2
   175
	};
williamr@2
   176
williamr@2
   177
#endif