sl@0: /* sl@0: * Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include <mparser.h> sl@0: sl@0: sl@0: // Given the text object, scan the specified range of the text buffer sl@0: // (from aStartScan to one before aEndScan) and show the first match, if sl@0: // any, that you would like tagged by setting the range (from aStartTag sl@0: // to one before aEndTag). Return ETrue if you find anything, EFalse sl@0: // otherwise. This function must be defined. If aAllowBack is ETrue then sl@0: // the parser is allowed to recognise tags that start before but sl@0: // continue into the range specified, otherwise it is not allowed to do sl@0: // so (and, if it does, will assert in debug mode). sl@0: // virtual TBool ParseThisText(const CRichText& aTextObj, sl@0: // TBool aAllowBack, sl@0: // TInt aStartScan, sl@0: // TInt aScanLength, sl@0: // TInt& aStartTag, sl@0: // TInt& aTagLength) = 0; sl@0: sl@0: sl@0: // The text cursor is over the text string in aTextObj (aLength sl@0: // characters starting at aStartText). Return a const ptr to the string sl@0: // that should be displayed for a "Do It!" button. (This can be sl@0: // constant, such as a _LIT, or change according to the tagged text.) sl@0: // The parser retains ownership of this string and, if necessary, should sl@0: // delete it when this function is next called or when the parser is sl@0: // deleted. This function will normally be invoked directly by UIKON and sl@0: // must be defined. sl@0: // virtual const TDesC& CreateDoItText(const CRichText& aTextObj, sl@0: // TInt aStartText, sl@0: // TInt aLength) = 0; sl@0: sl@0: sl@0: // The text cursor is over the text string in aTextObj (aLength sl@0: // characters starting at aStartText) and the "Do It!" button has been sl@0: // pushed (or some other activation method has been triggered). Do sl@0: // whatever should happen (such as launching a browser with the sl@0: // indicated URL). If the parser requires a copy of the text to pass on, sl@0: // it is up to it to take one before doing anything (such as handing it sl@0: // to a separate thread) and to dispose of it later. This function will sl@0: // normally be invoked directly by UIKON and must be defined. sl@0: // virtual void ActivateThisTextL(const CRichText& aTextObj, sl@0: // TInt aStartText, sl@0: // TInt aLength) = 0; sl@0: sl@0: sl@0: // Whether this parser makes any formatting changes to text that is sl@0: // recognised and tagged as soon as it has been recognised. If it does sl@0: // then this function should be overridden with one that returns ETrue sl@0: // and the GetRecogniseFormat() function should be overridden sl@0: // appropriately - otherwise do nothing. sl@0: EXPORT_C TBool MParser::ReformatOnRecognise() const sl@0: { sl@0: return EFalse; sl@0: } sl@0: sl@0: sl@0: // Whether this parser makes any formatting changes to text that is sl@0: // recognised and tagged when the text cursor moves onto it. If it does sl@0: // then this function should be overridden with one that returns ETrue sl@0: // and the GetRolloverFormat() function should be overridden sl@0: // appropriately otherwise do nothing. sl@0: EXPORT_C TBool MParser::ReformatOnRollover() const sl@0: { sl@0: return EFalse; sl@0: } sl@0: sl@0: sl@0: // Given an existing format, modify it to reflect the highlighting sl@0: // changes that apply immediately some text is recognised and tagged by sl@0: // this parser. If this parser does not make any highlighting changes at sl@0: // recognise time then this function should not be overridden. sl@0: EXPORT_C void MParser::GetRecogniseFormat(TCharFormat& /*aFormat*/) sl@0: { sl@0: } sl@0: sl@0: sl@0: // Given an existing format, modify it to reflect the highlighting sl@0: // changes that apply when the text cursor moves onto text that has been sl@0: // recognised and tagged by this parser. This should include all changes sl@0: // that you wish to make to the base format as this will *not* be sl@0: // applied cumulatively to the recognise highlighting. If this parser sl@0: // does not make any highlighting changes at rollover time then this sl@0: // function should not be overridden and any recognise highlighting will sl@0: // remain. sl@0: EXPORT_C void MParser::GetRolloverFormat(TCharFormat& aFormat) sl@0: { sl@0: GetRecogniseFormat(aFormat); sl@0: } sl@0: sl@0: sl@0: EXPORT_C TBool MParser::ConfirmCursorOverTag(const CRichText& /*aTextObj*/, sl@0: TInt /*aTagStart*/, TInt /*aTagLen*/, TInt /*aCurPos*/) sl@0: /** sl@0: This confirmation routine is called by the parsing framework when sl@0: it's logic determines the cursor is over a tag. It gives the parser sl@0: a chance to override the default cursor-tag rollover matching. This sl@0: is not necessary if the default behaviour is acceptable. sl@0: It is called from the CRichText::CursorOverTag() sl@0: when the framework tests for format redraw when over a tag and sl@0: CRichText::OverrideFormatForParsersIfApplicable() when Tagma sl@0: is formatting text. sl@0: @publishedPartner sl@0: @released sl@0: @param aTextObj sl@0: A reference to the text document tag is within. sl@0: @param aTagStart sl@0: The document position of the first tag character. sl@0: @param aTagLen sl@0: The number of characters in the tag. sl@0: @param aCurPos sl@0: The cursor position used in calculation of calling routines. sl@0: @return TBool sl@0: ETrue if parser agrees cursor over a tag, EFalse otherwise. sl@0: */ sl@0: { sl@0: return ETrue; sl@0: } sl@0: sl@0: sl@0: EXPORT_C void MParser::MParser_Reserved_2() {}