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