1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/textrendering/texthandling/inc/FEPITFR.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,103 @@
1.4 +/*
1.5 +* Copyright (c) 1997-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 "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.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 +* the class for inline-text format retrieval - in its own header file to prevent low-level
1.19 +* components dependent on this class from gaining unnecessary (and undesirable) dependencies
1.20 +* on high-level components
1.21 +*
1.22 +*/
1.23 +
1.24 +
1.25 +#ifndef __FEPITFR_H__
1.26 +#define __FEPITFR_H__
1.27 +
1.28 +#include <e32std.h>
1.29 +
1.30 +class TCharFormat;
1.31 +
1.32 +
1.33 +/** Specifies the mixin protocol for finding out the formatting to apply to inline
1.34 +text.
1.35 +
1.36 +This class should be overridden by front end processors which support inline editing.
1.37 +
1.38 +An instance of a class which implements this protocol should be passed to
1.39 +MCoeFepAwareTextEditor::StartFepInlineEditL().
1.40 +
1.41 +@publishedAll
1.42 +@released */
1.43 +class MFepInlineTextFormatRetriever // to be overridden by inline-editing front-end processors
1.44 + {
1.45 +public:
1.46 + /** Gets the character formatting to apply to the inline text.
1.47 +
1.48 + This function may be used to differentiate the formatting of the inline text
1.49 + from the surrounding text. The first parameter should be set to contain the
1.50 + character formatting values to use.
1.51 +
1.52 + MCoeFepAwareTextEditor provides a member function for finding out the character
1.53 + formatting of the surrounding text - GetFormatForFep(). This can be called
1.54 + inside the implementation of this function to make any necessary adjustments
1.55 + to the format of the inline text to ensure that it is different from the surrounding
1.56 + text.
1.57 +
1.58 + The second and third parameters enable different parts of the inline text
1.59 + to have different formatting.
1.60 +
1.61 + All implementations of this function need to set the aNumberOfCharactersWithSameFormat
1.62 + parameter. If all of the inline text uses the same formatting then aNumberOfCharactersWithSameFormat
1.63 + should be set to the length of the inline text and the aPositionOfCharacter
1.64 + parameter can be ignored.
1.65 +
1.66 + When the inline text does not all use the same formatting, the second parameter
1.67 + should be set to the number of characters starting at aPositionOfCharacter
1.68 + which have the same formatting: see the following example.
1.69 +
1.70 + Example
1.71 +
1.72 + If the inline text is 7 characters long, the first 4 characters are in format
1.73 + A, the next 2 characters are in format B, and the remaining character is in
1.74 + format C.
1.75 +
1.76 + When the FEP framework (which knows that the inline text is 7 characters long)
1.77 + needs to find out the format of the inline text, it calls GetFormatOfFepInlineText()
1.78 + passing zero into aPositionOfCharacter (to signify the start of the inline
1.79 + text).
1.80 +
1.81 + As the first 4 characters are all in format A, the function should set aFormat
1.82 + to A and it should set aNumberOfCharactersWithSameFormat to 4. As the FEP
1.83 + framework has only been told the format of the first 4 characters, it calls
1.84 + GetFormatOfFepInlineText() again passing 4 into aPositionOfCharacter. As the
1.85 + 2 characters starting at position 4 are all in format B, the function should
1.86 + set aFormat to B and it should set aNumberOfCharactersWithSameFormat to 2.
1.87 + The FEP framework still does not know the format of the 7th character so it
1.88 + calls GetFormatOfFepInlineText() a third time passing 6 into aPositionOfCharacter.
1.89 + As the character at position 6 is in format C, the function should set aFormat
1.90 + to C and it should set aNumberOfCharactersWithSameFormat to 1. The FEP framework
1.91 + now knows the format of all of the inline text.
1.92 +
1.93 + @param aFormat On return, contains the formatting to apply to the inline text
1.94 + (or to a portion of it).
1.95 + @param aNumberOfCharactersWithSameFormat On return, contains the number of
1.96 + characters in the inline text (starting at aPositionOfCharacter) which have
1.97 + the same formatting.
1.98 + @param aPositionOfCharacter Start position within the inline text. */
1.99 + virtual void GetFormatOfFepInlineText(TCharFormat& aFormat, TInt& aNumberOfCharactersWithSameFormat, TInt aPositionOfCharacter) const=0;
1.100 +private: // reserved. do not override!
1.101 + IMPORT_C virtual void MFepInlineTextFormatRetriever_Reserved_1();
1.102 + IMPORT_C virtual void MFepInlineTextFormatRetriever_Reserved_2();
1.103 + };
1.104 +
1.105 +#endif // __FEPITFR_H__
1.106 +