textrendering/textformatting/inc/InlineText.h
changeset 0 1fb32624e06b
child 5 e96e8a131979
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef INLINETEXT_H_
       
    20 #define INLINETEXT_H_
       
    21 
       
    22 #include <tagma.h>
       
    23 #include <InlineText_Internal.h>
       
    24 
       
    25 
       
    26 /**
       
    27 Class used to provide custom formatting functionality within Form
       
    28 as an extended interface (via the GetExtendedInterface mechanism
       
    29 supplied in MTmSource). Basically allows inline text insertion,
       
    30 that is, insertion of non-backing store text into the CTmTextLayout 
       
    31 formatting data used when drawing to the graphics device.
       
    32 
       
    33 Implementors of derived classes need to ensure that, in addition
       
    34 to anything else it does, their overload of GetExtendedInterface
       
    35 reacts to being prompted with the UID KInlineTextApiExtensionUid
       
    36 by returning their class cast as an MTmInlineTextSource. It should
       
    37 also invoke GetExtendedInterface on its other parent for any
       
    38 unrecognised UIDs.
       
    39 
       
    40 @publishedPartner
       
    41 @released
       
    42 @see MTmSource::GetExtendedInterface
       
    43 @see MFormCustomInterfaceProvider
       
    44 */
       
    45 class MTmInlineTextSource
       
    46 	{
       
    47 public:
       
    48 	/**
       
    49 	Reports the next position into which inline text should be inserted
       
    50 	@param aFrom
       
    51 		The document position and character edge to start from.
       
    52 	@param aMaxLength
       
    53 		The maximum length within which to report inline text.
       
    54 		It means that inline text at position X should be reported if
       
    55 		aFrom <= X && X < aFrom + aMaxLength.
       
    56 		Also report trailing inline text at position aFrom + aMaxLength
       
    57 		because it is really attached to the preceding character.
       
    58 		Always report only the first inline text position >= aFrom.
       
    59 	@param aNext
       
    60 		On exit the position of the next bit of inline text to be inserted.
       
    61 		N.B. The position of trailing text following position N and the 
       
    62 		position of leading text preceding position N+1 are both 
       
    63 		considered to be N+1 - and the trailing text comes first so if
       
    64 		aFrom specifies a leading edge do not report trailing edge
       
    65 		inline text unless its position is greater than aFrom.
       
    66 		A panic EBadReturnValue will result otherwise.
       
    67 	@return
       
    68 		KErrNone if a position is found within the specified range,
       
    69 		KErrNotFound otherwise.
       
    70 	@post
       
    71 		if KErrNone returned then aFrom <= aNext
       
    72 		&& GetInlineText(aNext).Length() != 0
       
    73 		&& (GetInlineText(X).Length() == 0 for all
       
    74 		TTmDocPos X such that aFrom < X && X < aNext)
       
    75 		else if KErrNotFound returned
       
    76 		GetInlineText(X).Length() == 0 for all
       
    77 		TTmDocPos X such that aFrom <= X && X < aFrom + aMaxLength
       
    78 	*/
       
    79 	virtual TInt GetNextInlineTextPosition(const TTmDocPos& aFrom, TInt aMaxLength, TTmDocPos& aNext) = 0;
       
    80 
       
    81 	/**
       
    82 	Gets a view of the text to be inserted at aAt.
       
    83 	@param aAt
       
    84 		Document position, including character edge, being queried.
       
    85 	@return
       
    86 		Any inline text that should be attached to the specified character edge at aAt.
       
    87 	*/
       
    88 	virtual TPtrC GetInlineText(const TTmDocPos& aAt) = 0;
       
    89 	};
       
    90 
       
    91 #endif	// INLINETEXT_H_
       
    92