00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 #ifndef __TXTEXAMP_H
00017 #define __TXTEXAMP_H
00018 
00019 #include <coemain.h>
00020 #include <coecntrl.h>
00021 #include <s32file.h>
00022 #include <txtglobl.h>
00023 #include <frmtview.h>
00024 #include <txtfmlyr.h>
00025 
00026 
00027 
00028 
00029 
00030 class MGraphicsExampleObserver
00031         
00032         
00033         
00034         {
00035 public:
00036         
00037         virtual void NotifyGraphicExampleFinished()=0;
00038         
00039         virtual void NotifyStatus(const TDesC& aMessage)=0;
00040         };
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 #pragma warning(disable : 4100)
00072                 
00073 
00074 class CGraphicExampleControl : public CCoeControl
00075         {
00076 public:
00077         
00078         void ConstructL(const TRect& aRect, MGraphicsExampleObserver* aObserver, const CCoeControl& aParent);
00079                 
00080         ~CGraphicExampleControl();
00081         
00082         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
00083                 
00084 protected:
00085         
00086         virtual void UpdateModelL() =0; 
00087         virtual void Draw(const TRect& ) const {}; 
00088         
00089         TInt Phase() const { return iPhase; }; 
00090         void SetMaxPhases(TInt aMaxPhases) { iMaxPhases=aMaxPhases; };
00091                         
00092         CFont* iMessageFont; 
00093 private:
00094         
00095         void HandlePointerEventL(const TPointerEvent& aPointerEvent);
00096                 
00097         void Quit(); 
00098         void NextPhaseL(); 
00099         
00100         TInt iPhase; 
00101         TInt iMaxPhases; 
00102 protected:
00103         MGraphicsExampleObserver* iFormObserver;
00104         TBool iUpdateModelDoesRedraw; 
00105         };
00106 
00107 
00108 
00109 class CGlobalText;
00110 class CRichText;
00111 class CParaFormatLayer;
00112 class CCharFormatLayer;
00113 class CTextLayout;
00114 class CTextView;
00115 class CStyleList;
00116 class CParagraphStyle;
00117 
00118 
00119 class CGlobalControl : public CGraphicExampleControl
00120         {
00121         
00122 public:
00123         CGlobalControl() { SetMaxPhases(16); };
00124         void UpdateModelL();
00125         void Draw(const TRect& aRect) const;
00126         ~CGlobalControl();
00127 private:
00128         CGlobalText* iGlobalText; 
00129         CParaFormatLayer* iParaFormatLayer;
00130         CCharFormatLayer* iCharFormatLayer;
00131         TStreamId iStreamId; 
00132         
00133         CTextLayout* iLayout; 
00134         CTextView* iTextView; 
00135         TRect iViewRect; 
00136         TCharFormat iCharFormat;
00137         TCharFormatMask iCharFormatMask;
00138         };
00139 
00140 class CRichControl : public CGraphicExampleControl
00141         {
00142         
00143 public:
00144         CRichControl() { SetMaxPhases(14);}; 
00145         ~CRichControl(); 
00146         void UpdateModelL();
00147         void Draw(const TRect& aRect) const;
00148 private:
00149         CRichText* iRichText; 
00150         CParaFormatLayer* iParaFormatLayer;
00151         CCharFormatLayer* iCharFormatLayer;
00152         TStreamId iStreamId; 
00153         
00154         CTextLayout* iLayout; 
00155         CTextView* iTextView; 
00156         TRect iViewRect; 
00157         TCharFormat iCharFormat;
00158         TCharFormatMask iCharFormatMask;
00159         };
00160 
00161 class CStyleControl : public CGraphicExampleControl
00162         {
00163         
00164 public:
00165         CStyleControl() { SetMaxPhases(9);}; 
00166         ~CStyleControl(); 
00167         void UpdateModelL();
00168         void Draw(const TRect& aRect) const;
00169 private:
00170         void CreateNormalL(); 
00171         void CreateStylesL(); 
00172 private:
00173         CRichText* iRichText; 
00174         CParaFormatLayer* iNormalParaFormatLayer;
00175         CCharFormatLayer* iNormalCharFormatLayer;
00176         TStreamId iStreamId; 
00177         
00178         CTextLayout* iLayout; 
00179         CTextView* iTextView; 
00180         TRect iViewRect; 
00181         CStyleList* iStyleList; 
00182         CParagraphStyle* iStyleOne;
00183         CParagraphStyle* iStyleTwo;
00184         TCharFormat iCharFormat;
00185         TCharFormatMask iCharFormatMask;
00186         };
00187 
00188 class CViewControl : public CGraphicExampleControl
00189         {
00190         
00191 public:
00192         CViewControl() { SetMaxPhases(14);}; 
00193         ~CViewControl(); 
00194         void UpdateModelL();
00195         void Draw(const TRect& aRect) const;
00196 private:
00197         CRichText* iRichText; 
00198         CParaFormatLayer* iParaFormatLayer;
00199         CCharFormatLayer* iCharFormatLayer;
00200         
00201         CTextLayout* iLayout; 
00202         CTextView* iTextView; 
00203         TRect iViewRect; 
00204         CFbsBitmap* iBitmap; 
00205         TCharFormat iCharFormat;
00206         TCharFormatMask iCharFormatMask;
00207         };
00208 
00209 #endif
00210