00001 // EIKRTED.H 00002 // 00003 // Copyright (c) 1997-1999 Symbian Ltd. All rights reserved. 00004 // 00005 00006 #if !defined(__EIKRTED_H__) 00007 #define __EIKRTED_H__ 00008 00009 #if !defined(__EIKGTED_H__) 00010 #include <eikgted.h> 00011 #endif 00012 00013 #if !defined(__APPARC_H__) 00014 #include <apparc.h> 00015 #endif 00016 00017 #if !defined(__TXTMRTSR_H__) 00018 #include <txtmrtsr.h> 00019 #endif 00020 00021 #if !defined(__GDI_H__) 00022 #include <gdi.h> 00023 #endif 00024 00025 class CRichText; 00026 class TResourceReader; 00027 class TPictureHeader; 00028 class CEikRubberBand; 00029 class CBufStore; 00030 class CStreamStore; 00031 class CApaDoor; 00032 class CEikParserManager; 00033 class MEikRichTextEditorParserObserver; 00034 class MParser; 00035 00044 class CEikRichTextEditor : public CEikGlobalTextEditor, 00045 public MApaEmbeddedDocObserver, 00046 public MRichTextStoreResolver, 00047 public MPictureFactory 00048 { 00049 00050 public: 00051 00057 enum TObjectFormat 00058 { 00060 EAlwaysIconic, 00061 00066 EGlassIfPossible 00067 }; 00068 00075 enum // user flag 00076 { 00081 EShowAllPicturesAsIconic =0x00100000, 00082 00089 ENoTextParsers =0x00200000, 00090 }; 00091 00092 public: 00093 00097 IMPORT_C CEikRichTextEditor(); 00098 00104 IMPORT_C CEikRichTextEditor(const TGulBorder& aBorder); 00105 00109 IMPORT_C ~CEikRichTextEditor(); 00110 00138 IMPORT_C void ConstructL(const CCoeControl* aParent, 00139 TInt aNumberOfLines, 00140 TInt aTextLimit, 00141 TInt aEdwinFlags, 00142 TInt aFontControlFlags=EGulFontControlAll, 00143 TInt aFontNameFlags=EGulNoSymbolFonts); 00144 00150 IMPORT_C CRichText* RichText() const; 00151 00166 IMPORT_C void InsertObjectL(TObjectFormat aFormat); 00167 00181 IMPORT_C void InsertObjectL(); // defaults to EGlassIfPossible 00182 00201 IMPORT_C void InsertObjectL(const TDesC& aAppDllName, 00202 TUid aAppDllUid, 00203 TObjectFormat aFormat); 00204 00223 IMPORT_C void InsertObjectL(TUid aPictureType, 00224 CBase* aData); 00225 00235 IMPORT_C void ReEditObjectL(); 00236 00248 IMPORT_C TInt ObjectCursorPos() const; 00249 00261 IMPORT_C TBool CheckForObjectL(); 00262 00277 IMPORT_C void EditPictureFormatL(); 00278 00286 IMPORT_C void PictureFormatChangedL(); 00287 00302 IMPORT_C void GetEmbeddedAppL(CApaDoor*& aDoor, 00303 CApaDocument*& aDoc, 00304 TInt aDocPos); 00305 00317 IMPORT_C void UpdatePictureFormatL(); 00318 00334 IMPORT_C void UpdatePictureFormatL(TInt aStartPos,TInt aLength); 00335 00344 IMPORT_C void SetDefaultIconicDoorSize(const TSize& aSize); 00345 00351 IMPORT_C const TSize& DefaultIconicDoorSize() const; 00352 00362 IMPORT_C void UpdatePictureSizeL(); 00363 00377 IMPORT_C void UpdatePictureSizeL(TInt aStartPos,TInt aLength); 00378 00391 IMPORT_C void SetParserObserver( 00392 MEikRichTextEditorParserObserver* aObserver); 00393 00400 IMPORT_C void SetPhoneNumberGrouping( TBool aEnable ); 00401 00402 public: // from CCoeControl 00403 00421 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); 00422 00433 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); 00434 00447 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); 00448 00460 IMPORT_C void ActivateL(); 00461 00462 private: 00463 00467 IMPORT_C void* ExtensionInterface( TUid aInterface ); 00468 00469 public: // from CEikEdwin 00470 00480 IMPORT_C void CopyDocumentContentL(CGlobalText& aInText,CGlobalText& aOutText); 00481 00482 protected: 00483 00487 enum // internal flags 00488 { 00490 ECropFromLeft =0x00010000, 00491 00493 ECropFromRight =0x00020000, 00494 00496 ECropFromTop =0x00040000, 00497 00499 ECropFromBottom =0x00080000, 00500 00502 EReEditingObject =0x00100000 00503 }; 00504 00505 protected: // from CCoeControl 00506 00514 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; 00515 00516 protected: // from MEditObserver 00517 00526 IMPORT_C void EditObserver(TInt aStartEdit,TInt aEditLength); 00527 00528 private: // from CoeControl 00529 00530 IMPORT_C void Draw(const TRect& aRect) const; 00531 00532 IMPORT_C void Reserved_2(); 00533 00534 private: // from CEikEdwin 00535 00536 IMPORT_C void HandleTextPastedL(TInt aStartPos,TInt& aLength); 00537 IMPORT_C void Reserved_3(); 00538 00539 private: // from MApaEmbeddedDocObserver 00540 00541 IMPORT_C void NotifyExit(TExitMode aMode); 00542 00543 private: // from MRichTextStoreResolver 00544 00545 IMPORT_C const CStreamStore& StreamStoreL(TInt aPos) const; 00546 00547 private: // from MPictureFactory 00548 00549 IMPORT_C void NewPictureL(TPictureHeader& aHdr,const CStreamStore& aDeferredPictureStore) const; 00550 00551 private: 00552 00553 void CommonConstructL(); 00554 00555 static TInt InsertEmbeddedDocL(TAny *aThis); 00556 00557 static TInt DeleteEmbeddedDoc(TAny *aThis); 00558 00559 static TInt UpdateEmbeddedDocL(TAny* aThis); 00560 00561 static TInt TryDeleteEmbeddedDocL(TAny *aThis); 00562 00563 void InsertPictureL(const TPictureHeader& aPictureHeader); 00564 00565 void DoInsertPictureL(TBool& aFormatHasChanged,const TPictureHeader& aPictureHeader); 00566 00567 void DoReEditObjectL(TInt aDocPos); 00568 00569 void RoomForObjectL(); 00570 00571 void InsertObjectL(CApaDocument* aDoc,TObjectFormat aFormat); 00572 00573 void SetTextObserver(CRichText& aText); 00574 00575 inline void DoReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType); 00576 00577 protected: 00578 00582 TSize iDefaultIconicDoorSize; 00583 00584 private: 00585 00586 TPictureHeader iEmbeddedDoc; 00587 00588 CIdle* iEmbeddedDocUpdate; 00589 00590 CBufStore* iBufStore; 00591 00592 CEikParserManager* iParserManager; 00593 00594 private: 00595 00596 friend class CEikParserManager; 00597 00598 public: // new methods 00599 00603 IMPORT_C void RefreshParsersL(); 00604 00605 }; 00606 00607 class MEikRichTextEditorParserObserver 00608 { 00609 public: 00610 virtual void HandleCursorOverParserL(const TDesC& aDoItText)=0; 00611 }; 00612 00613 inline void CEikRichTextEditor::DoReportEdwinEventL(MEikEdwinObserver::TEdwinEvent aEventType) 00614 {ReportEdwinEventL(aEventType);} 00615 00616 // __EIKRTED_H__ 00617 #endif 00618 00619 // End of file