00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef NPDAPI_H
00022 #define NPDAPI_H
00023
00024
00025 #include <e32base.h>
00026 #include <charconv.h>
00027 #include <ConeResLoader.h>
00028 #include <f32file.h>
00029
00030
00031 const TInt KNotepadPseudoKeyIdForNewNote(-1);
00032
00033
00034 class CCoeEnv;
00035 class CEikDialog;
00036 class CNotepadModel;
00037 class CNotepadTableModel;
00038 class CPlainText;
00039
00040
00047 class CNotepadApi : public CBase
00048 {
00049 public:
00050
00051
00052
00053
00054
00055 enum
00056 {
00057 ENpdDataEdited = 0,
00058 ENpdDataDeleted,
00059 ENpdDataErased
00060 };
00061
00062 public:
00063
00070 IMPORT_C static CNotepadApi* NewL();
00071
00078 IMPORT_C static CNotepadApi* NewLC();
00079
00084 IMPORT_C virtual ~CNotepadApi();
00085
00086 public:
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:
00340 CNotepadApi();
00341
00342 private:
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:
00397
00402 IMPORT_C virtual void CNotepadApi_Reserved();
00403
00408 IMPORT_C static void CNotepadApi_Reserved_Static();
00409
00410 private:
00411
00412 CCoeEnv* iEnv;
00413 CEikDialog* iDialog;
00414 CNotepadModel* iModel;
00415 RConeResourceLoader iResourceLoader;
00416
00417 };
00418
00419
00420 #endif
00421
00422
00423