00001 /* 00002 * ============================================================================== 00003 * Name : NpdApi.h 00004 * Part of : Notepad / NpdLib.dll 00005 * Interface : ?Interface_category, ?Interface_name 00006 * Description : Declaration of Notepad Library APIs. 00007 * Version : ?Version 00008 * 00009 * Copyright © 2002 Nokia Corporation. 00010 * This material, including documentation and any related 00011 * computer programs, is protected by copyright controlled by 00012 * Nokia Corporation. All rights are reserved. Copying, 00013 * including reproducing, storing, adapting or translating, any 00014 * or all of this material requires the prior written consent of 00015 * Nokia Corporation. This material also contains confidential 00016 * information which may not be disclosed to others without the 00017 * prior written consent of Nokia Corporation. 00018 * ============================================================================== 00019 */ 00020 00021 #ifndef NPDAPI_H 00022 #define NPDAPI_H 00023 00024 // INCLUDES 00025 #include <e32base.h> 00026 #include <charconv.h> 00027 #include <ConeResLoader.h> 00028 #include <f32file.h> 00029 00030 // CONSTANTS 00031 const TInt KNotepadPseudoKeyIdForNewNote(-1); 00032 00033 // FORWARD DECLARATIONS 00034 class CCoeEnv; 00035 class CEikDialog; 00036 class CNotepadModel; 00037 class CNotepadTableModel; 00038 class CPlainText; 00039 00040 // CLASS DECLARATION 00047 class CNotepadApi : public CBase 00048 { 00049 public: 00050 00051 /* Enum for the status of the memos. 00052 * ENpdDataEdited : Data is edited in the Editor dialog of the opened memo. 00053 * ENpdDataDeleted : Data is deleted in the Editor dialog of the opened memo. 00054 * ENpdDataErased : Data is erased in the Editor dialog of the opened memo.*/ 00055 enum 00056 { 00057 ENpdDataEdited = 0, 00058 ENpdDataDeleted, 00059 ENpdDataErased 00060 }; 00061 00062 public: // Constuctors and destructor 00063 00070 IMPORT_C static CNotepadApi* NewL(); 00071 00078 IMPORT_C static CNotepadApi* NewLC(); 00079 00084 IMPORT_C virtual ~CNotepadApi(); 00085 00086 public: // API functions 00087 00098 IMPORT_C static HBufC* FetchMemoL( 00099 const TDesC* aTitle = NULL); 00100 00111 IMPORT_C static HBufC* FetchTemplateL( 00112 const TDesC* aTitle = NULL); 00113 00119 IMPORT_C static TInt ExecTemplatesL(); 00120 00132 IMPORT_C static TInt ExecFileViewerL( 00133 const TDesC& aFileName, 00134 const TDesC* aTitle = NULL, 00135 const TBool aDoWait = ETrue, 00136 TBool aGuessEncoding = EFalse, 00137 TUint aEncoding = KCharacterSetIdentifierIso88591); 00138 00150 IMPORT_C static TInt ExecFileViewerL( 00151 RFile& aFile, 00152 const TDesC* aTitle = NULL, 00153 const TBool aDoWait = ETrue, 00154 TBool aGuessEncoding = EFalse, 00155 TUint aEncoding = KCharacterSetIdentifierIso88591); 00156 00162 IMPORT_C static void AddContentL(const TDesC& aText); 00163 00170 IMPORT_C static TBool ExistsMemoL(const TInt aKey); 00171 00180 IMPORT_C static TInt NumberOfTemplates(); 00181 00187 IMPORT_C static void SaveFileAsMemoL(const TDesC& aFileName); 00188 00194 IMPORT_C static void SaveFileAsMemoL(RFile& aFile); 00195 00202 IMPORT_C static void SaveFileAsMemoL(const TDesC& aFileName, const TUint aEncoding); 00203 00210 IMPORT_C static void SaveFileAsMemoL(RFile& aFile, const TUint aEncoding); 00211 00217 IMPORT_C CEikDialog* Dialog(); 00218 00223 IMPORT_C CNotepadModel* Model(); 00224 00230 IMPORT_C void CreateListDialogL(TInt aResId); 00231 00242 IMPORT_C void CreateViewerDialogL( 00243 const TDesC& aFileName, 00244 const TDesC* aTitle, 00245 const TBool aDoWait, 00246 TBool aGuessEncoding = EFalse, 00247 TUint aEncoding = KCharacterSetIdentifierIso88591); 00248 00259 IMPORT_C void CreateViewerDialogL( 00260 RFile& aFile, 00261 const TDesC* aTitle, 00262 const TBool aDoWait, 00263 TBool aGuessEncoding = EFalse, 00264 TUint aEncoding = KCharacterSetIdentifierIso88591); 00265 00271 IMPORT_C void CreateViewerDialogL(const TBool aDoWait); 00272 00278 IMPORT_C void CreateModelL(TInt aResId); 00279 00288 IMPORT_C TBool ProbeMemoL(const TInt aKey); 00289 00298 IMPORT_C static TInt ExecReadOnlyTextViewerL( 00299 const TDesC& aText, 00300 const TDesC& aTitle = KNullDesC, 00301 const TDesC& aDeleteConfirmationText = KNullDesC 00302 ); 00303 00313 IMPORT_C static HBufC* ExecTextViewerL( 00314 TInt& aReturnStatus, 00315 const TDesC& aText, 00316 const TDesC& aTitle = KNullDesC, 00317 const TDesC& aDeleteConfirmationText = KNullDesC 00318 ); 00319 00329 IMPORT_C static HBufC* ExecTextEditorL( 00330 TInt& aReturnStatus, 00331 const TDesC& aText = KNullDesC, 00332 const TDesC& aTitle = KNullDesC, 00333 const TDesC& aDeleteConfirmationText = KNullDesC 00334 ); 00335 00336 private: // Constructor 00340 CNotepadApi(); 00341 00342 private: // New functions 00343 00354 IMPORT_C void CreateTextViewerDialogL( 00355 HBufC **aContentPointer, 00356 TInt& aReturnStatus, 00357 TBool aReadOnly, 00358 const TDesC& aText, 00359 const TDesC& aTitle = KNullDesC, 00360 const TDesC& aDeleteConfirmationText = KNullDesC 00361 ); 00362 00372 IMPORT_C void CreateTextEditorDialogL( 00373 HBufC **aContentPointer, 00374 TInt& aReturnStatus, 00375 const TDesC& aText = KNullDesC, 00376 const TDesC& aTitle = KNullDesC, 00377 const TDesC& aDeleteConfirmationText = KNullDesC 00378 ); 00379 00390 HBufC* DoPopupListL( 00391 const TDesC* aTitle, 00392 TInt aModelResId, 00393 TInt aPromptResId, 00394 TInt aEmptyTextResId = 0 ); 00395 00396 private: // Reserved 00397 00402 IMPORT_C virtual void CNotepadApi_Reserved(); 00403 00408 IMPORT_C static void CNotepadApi_Reserved_Static(); 00409 00410 private: // Data 00411 00412 CCoeEnv* iEnv; // not own 00413 CEikDialog* iDialog; // not own 00414 CNotepadModel* iModel; // own 00415 RConeResourceLoader iResourceLoader; 00416 00417 }; 00418 00419 // NPDAPI_H 00420 #endif 00421 00422 // End of File 00423