| 1 | /*******************************************************************\r |
| 2 | *\r |
| 3 | * File: CSimpleTextParser.h\r |
| 4 | *\r |
| 5 | * Author: Peter van Sebille (peter@yipton.net)\r |
| 6 | *\r |
| 7 | * (c) Copyright 2002, Peter van Sebille\r |
| 8 | * All Rights Reserved\r |
| 9 | *\r |
| 10 | *******************************************************************/\r |
| 11 | \r |
| 12 | #ifndef __CSIMPLE_TEXT_PARSER_H\r |
| 13 | #define __CSIMPLE_TEXT_PARSER_H\r |
| 14 | \r |
| 15 | #include <e32def.h>\r |
| 16 | #include <txtrich.h> // CRichText\r |
| 17 | #include <eikrted.h> // CEikRichTextEditor\r |
| 18 | \r |
| 19 | class CSimpleTextFormatParser : public CBase\r |
| 20 | {\r |
| 21 | public:\r |
| 22 | static CSimpleTextFormatParser* NewLC();\r |
| 23 | void ParseL(const TDesC& aPSTText, CRichText& aRichText);\r |
| 24 | \r |
| 25 | protected:\r |
| 26 | CSimpleTextFormatParser(){}\r |
| 27 | ~CSimpleTextFormatParser();\r |
| 28 | void ConstructL();\r |
| 29 | \r |
| 30 | void ParseTagL(const TDesC& aTag);\r |
| 31 | \r |
| 32 | TRgb ForegroundColor();\r |
| 33 | void SetBold(TBool aEnable=ETrue);\r |
| 34 | void SetItalic(TBool aEnable=ETrue);\r |
| 35 | void SetUnderLine(TBool aEnable=ETrue);\r |
| 36 | void SetFontHeight(TInt aHeight);\r |
| 37 | void SetFontName(const TDesC& aName);\r |
| 38 | void SetHiddenText(TBool aEnable=ETrue);\r |
| 39 | void SetForegroundColor(const TRgb& aColor);\r |
| 40 | \r |
| 41 | void NewParagraph();\r |
| 42 | void SetAlignment(CParaFormat::TAlignment aAlignment);\r |
| 43 | void SetBackgroundColor(const TRgb& aColor);\r |
| 44 | \r |
| 45 | void AppendTextL(const TDesC& aText);\r |
| 46 | TInt TextPos();\r |
| 47 | TInt ParaPos();\r |
| 48 | \r |
| 49 | \r |
| 50 | CRichText* iRichText;\r |
| 51 | TCharFormat iCharFormat;\r |
| 52 | TCharFormatMask iCharMask;\r |
| 53 | CParaFormat* iParaFormat;\r |
| 54 | TParaFormatMask iParaMask;\r |
| 55 | TInt iCurrentPara;\r |
| 56 | TRgb iPrevFgColor;\r |
| 57 | };\r |
| 58 | \r |
| 59 | #endif /* __CSIMPLE_TEXT_PARSER_H */\r |