00001 /* 00002 * ============================================================================ 00003 * Name : CRichBio from CRichBio.h 00004 * Part of : RICHBIO 00005 * 00006 * Description: 00007 * A UI control used by Smart Messaging Viewers. 00008 * Version: 00009 * 00010 * Copyright (C) 2002 Nokia Corporation. 00011 * This material, including documentation and any related 00012 * computer programs, is protected by copyright controlled by 00013 * Nokia Corporation. All rights are reserved. Copying, 00014 * including reproducing, storing, adapting or translating, any 00015 * or all of this material requires the prior written consent of 00016 * Nokia Corporation. This material also contains confidential 00017 * information which may not be disclosed to others without the 00018 * prior written consent of Nokia Corporation. 00019 * 00020 * ============================================================================ 00021 */ 00022 00023 #ifndef _CRICHBIO_H_ 00024 #define _CRICHBIO_H_ 00025 00026 // INCLUDES 00027 00028 #include <coecntrl.h> // CCoeControl 00029 #include <badesca.h> // CDesC16ArrayFlat 00030 #include <txtfrmat.h> // TCharFormat 00031 #include <MsgEditor.hrh> // TMsgCursorLocation 00032 00033 // DATA TYPES 00034 00040 enum TRichBioMode 00041 { 00042 ERichBioModeEditorBase, 00043 ERichBioModeStandard 00044 }; 00045 00046 // FORWARD DECLARATIONS 00047 00048 class CEikRichTextEditor; 00049 class CMsgExpandableControlEditor; 00050 00056 class CRichBio : public CCoeControl 00057 { 00058 public: // construction 00059 00070 IMPORT_C static CRichBio* NewL( const CCoeControl* aParent, 00071 TRichBioMode aMode ); 00072 00081 IMPORT_C CRichBio( TRichBioMode aMode ); 00082 00088 IMPORT_C void ConstructL( const CCoeControl* aParent ); 00089 00090 public: // destruction 00091 00095 ~CRichBio(); 00096 00097 public: // own methods 00098 00106 IMPORT_C void AddItemL(const TDesC& aLabel, const TDesC& aValue); 00107 00112 IMPORT_C TRect CurrentLineRect(); 00113 00120 IMPORT_C CEikRichTextEditor& Editor(); 00121 00126 IMPORT_C TBool IsEditorBaseMode() const; 00127 00131 IMPORT_C void Reset(); 00132 00137 IMPORT_C void SetAndGetSizeL( TSize& aSize ); 00138 00143 IMPORT_C TInt VirtualHeight(); 00144 00151 IMPORT_C TInt VirtualVisibleTop(); 00152 00159 IMPORT_C TBool IsCursorLocation(TMsgCursorLocation aLocation) const; 00160 00161 00162 00163 public: // from CCoeControl 00164 00165 TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); 00166 00167 private: // Helper methods. 00168 00174 void ApplyLabelFormat(TCharFormat& aFormat, TCharFormatMask& aMask); 00175 00181 void ApplyValueFormat(TCharFormat& aFormat, TCharFormatMask& aMask); 00182 00189 void ApplyFormat(TCharFormat& aFormat, TCharFormatMask& aMask, TBool aIsLabel); 00190 00196 void AddItemToRichTextL(const TDesC& aLabel, const TDesC& aValue); 00197 00204 void AppendTextL( const TDesC& aText, 00205 const TCharFormat& aFormat, 00206 const TCharFormatMask& aMask ); 00207 00212 TBool CacheExists(); 00213 00217 void LoadFromCacheL(); 00218 00224 void CacheItemL(const TDesC& aLabel, const TDesC& aValue); 00225 00230 static void Panic( TInt aPanic ); 00231 00232 00233 00234 private: 00235 00239 CRichBio(); 00240 00244 CRichBio(const CRichBio& aSource); 00245 00249 const CRichBio& operator=(const CRichBio& aSource); 00250 00251 private: // from CCoeControl 00252 00253 void Draw(const TRect& aRect) const; 00254 00255 TInt CountComponentControls() const; 00256 00257 CCoeControl* ComponentControl(TInt aIndex) const; 00258 00259 void SizeChanged(); 00260 00261 private: 00262 00264 class CEdwinSizeObserver; 00265 00267 friend class CEdwinSizeObserver; 00268 00270 CEdwinSizeObserver* iEdwinSizeObserver; 00271 00273 CMsgExpandableControlEditor* iEditor; 00274 00276 TInt iVirtualHeight; 00277 00278 // startup cache for data 00279 CDesC16ArrayFlat* iLabelCache; 00280 00281 // startup cache for data 00282 CDesC16ArrayFlat* iValueCache; 00283 00284 // Editor Base mode on or off. 00285 const TRichBioMode iMode; 00286 00288 TBool iIsFirstItem; 00289 00290 private: 00291 friend class T_RichBioTestSuite; 00292 }; 00293 00294 //_CRICHBIO_H_ 00295 #endif 00296 00297 // end of file