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: * An example parser
sl@0: *
sl@0: */
sl@0: 
sl@0: 
sl@0: #ifndef __EXPARSER_H__
sl@0: #define __EXPARSER_H__
sl@0: 
sl@0: #include <mparser.h>
sl@0: #include <medobsrv.h>
sl@0: 
sl@0: 
sl@0: class CTestParser : public CBase, public MParser
sl@0: 	{
sl@0: public:
sl@0: 	static CTestParser* NewL();
sl@0: 
sl@0: 	~CTestParser();
sl@0: 
sl@0: 	// Overloads for MParser interface
sl@0: 	TBool ParseThisText(const CRichText& aTextObj, TBool aAllowBack,
sl@0: 						TInt aStartScan, TInt aScanLength,
sl@0: 						TInt& aStartTag, TInt& aTagLength);
sl@0: 
sl@0: 	const TDesC& CreateDoItText(const CRichText& aTextObj,
sl@0: 								TInt aStartText, TInt aLength);
sl@0: 
sl@0: 	void ActivateThisTextL(const CRichText& aTextObj,
sl@0: 						   TInt aStartText, TInt aLength);
sl@0: 
sl@0: 	TBool ReformatOnRecognise() const {return ETrue;}
sl@0: 
sl@0: 	TBool ReformatOnRollover() const {return ETrue;}
sl@0: 
sl@0: 	void GetRecogniseFormat(TCharFormat& aFormat);
sl@0: 
sl@0: 	void GetRolloverFormat(TCharFormat& aFormat);
sl@0: 
sl@0: 	void Release();
sl@0: 
sl@0: private:
sl@0: 	CTestParser();
sl@0: 
sl@0: private:
sl@0: 	HBufC* iDoItText;
sl@0: 	};
sl@0: 
sl@0: //-----------------------------------------------
sl@0: 
sl@0: class CTestParser2 : public CBase, public MParser
sl@0: 	{
sl@0: public:
sl@0: 	static CTestParser2* NewL();
sl@0: 
sl@0: 	~CTestParser2();
sl@0: 
sl@0: 	// Overloads for MParser interface
sl@0: 	TBool ParseThisText(const CRichText& aTextObj, TBool aAllowBack,
sl@0: 						TInt aStartScan, TInt aScanLength,
sl@0: 						TInt& aStartTag, TInt& aTagLength);
sl@0: 
sl@0: 	const TDesC& CreateDoItText(const CRichText& aTextObj,
sl@0: 								TInt aStartText, TInt aLength);
sl@0: 
sl@0: 	void ActivateThisTextL(const CRichText& aTextObj,
sl@0: 						   TInt aStartText, TInt aLength);
sl@0: 
sl@0: 	TBool ReformatOnRecognise() const {return ETrue;}
sl@0: 
sl@0: 	TBool ReformatOnRollover() const {return ETrue;}
sl@0: 
sl@0: 	void GetRecogniseFormat(TCharFormat& aFormat);
sl@0: 
sl@0: 	void GetRolloverFormat(TCharFormat& aFormat);
sl@0: 
sl@0: 	void Release();
sl@0: 
sl@0: private:
sl@0: 	CTestParser2();
sl@0: 
sl@0: private:
sl@0: 	HBufC* iDoItText;
sl@0: 	};
sl@0: 
sl@0: 
sl@0: class CEditObserver : public CBase, public MEditObserver
sl@0: 	{
sl@0: public:
sl@0: 	CEditObserver();
sl@0: 	~CEditObserver();
sl@0: 	void EditObserver(TInt aStart, TInt aExtent);
sl@0: 
sl@0: public:
sl@0: 	TInt iStart;
sl@0: 	TInt iExtent;
sl@0: 	};
sl@0: 
sl@0: #endif