epoc32/include/mw/eikgted.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
/*
williamr@2
     2
* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description:
williamr@2
    15
*
williamr@2
    16
*/
williamr@2
    17
williamr@2
    18
williamr@2
    19
#if !defined(__EIKGTED_H__)
williamr@2
    20
#define __EIKGTED_H__
williamr@2
    21
williamr@2
    22
#if !defined(__EIKEDWIN_H__)
williamr@2
    23
#include <eikedwin.h>
williamr@2
    24
#endif
williamr@2
    25
williamr@2
    26
williamr@2
    27
#if !defined(__BADESCA_H__)
williamr@2
    28
#include <badesca.h>
williamr@2
    29
#endif
williamr@2
    30
williamr@2
    31
#if !defined(__EIKON_HRH__)
williamr@2
    32
#include <eikon.hrh>
williamr@2
    33
#endif
williamr@2
    34
williamr@2
    35
class CGlobalText;
williamr@2
    36
class CControlEnv;
williamr@2
    37
class CEikDialogToolBar;
williamr@2
    38
class CPrintSetup;
williamr@2
    39
class CTextPageRegionPrinter;
williamr@2
    40
class CEikDialogToolBar;
williamr@2
    41
williamr@2
    42
/**
williamr@2
    43
 * Global text editor.
williamr@2
    44
 *
williamr@2
    45
 * This is an edit window which supports globally formatted text. Supports
williamr@2
    46
 * a line cursor and provides functions which make it easy to launch various
williamr@2
    47
 * dialogs, for instance search, replace, set font etc. 
williamr@2
    48
 * 
williamr@2
    49
 * @since Symbian 5.0
williamr@2
    50
 */ 
williamr@2
    51
class CEikGlobalTextEditor : public CEikEdwin
williamr@2
    52
	{
williamr@2
    53
williamr@2
    54
public:
williamr@2
    55
williamr@2
    56
    /**
williamr@2
    57
     * Font style
williamr@2
    58
     */
williamr@2
    59
	enum TFontStyleFlags
williamr@2
    60
		{
williamr@2
    61
        /** Normal font */
williamr@2
    62
        EStandard	=0x00,
williamr@2
    63
williamr@2
    64
        /** Bolded font */
williamr@2
    65
		EBold		=0x01,
williamr@2
    66
williamr@2
    67
        /** Italic font */
williamr@2
    68
		EItalic		=0x02,
williamr@2
    69
williamr@2
    70
        /** Underlined font */
williamr@2
    71
		EUnderline	=0x04
williamr@2
    72
		};
williamr@2
    73
williamr@2
    74
public: // construction and destruction
williamr@2
    75
williamr@2
    76
    /** 
williamr@2
    77
     * C++ default constructor.
williamr@2
    78
     */
williamr@2
    79
    IMPORT_C CEikGlobalTextEditor();
williamr@2
    80
	
williamr@2
    81
    /** 
williamr@2
    82
     * C++ default constructor.
williamr@2
    83
     *
williamr@2
    84
     * @param aBorder The editor's border.
williamr@2
    85
     */ 
williamr@2
    86
    IMPORT_C CEikGlobalTextEditor(const TGulBorder& aBorder);
williamr@2
    87
	
williamr@2
    88
    /**
williamr@2
    89
     * Destructor.
williamr@2
    90
     */
williamr@2
    91
    IMPORT_C ~CEikGlobalTextEditor();
williamr@2
    92
	
williamr@2
    93
    /** 
williamr@2
    94
     * By Default symbian 2nd phase constructor is private.
williamr@2
    95
     *
williamr@2
    96
     * Completes construction of the global text editor.
williamr@2
    97
     *
williamr@2
    98
     * The editor's paragraph and character formatting is set to 
williamr@2
    99
     * default values.
williamr@2
   100
     *
williamr@2
   101
     * @param aParent The editor's parent control. Omit if the 
williamr@2
   102
     *        editor has no parent.
williamr@2
   103
     * @param aNumberOfLines The editor's number of lines.
williamr@2
   104
     * @param aTextLimit The maximum length of the editor in characters.
williamr@2
   105
     * @param aEdwinFlags The editor's flags. See @c CEikEdwin::TFlags.
williamr@2
   106
     * @param aFontControlFlags A set of flags that specify which font 
williamr@2
   107
     *        controls should appear, e.g. specifying @c EGulFontControlBold
williamr@2
   108
     *        removes the bold checkbox control. The default shows all. 
williamr@2
   109
     *        For possible values, see @c gulftflg.hrh.
williamr@2
   110
     * @param aFontNameFlags The editor's font name flags. For possible 
williamr@2
   111
     *        values, see @c gulftflg.hrh.
williamr@2
   112
     */ 
williamr@2
   113
    IMPORT_C void ConstructL(const CCoeControl* aParent,
williamr@2
   114
                             TInt aNumberOfLines,
williamr@2
   115
                             TInt aTextLimit,
williamr@2
   116
                             TInt aEdwinFlags,
williamr@2
   117
                             TInt aFontControlFlags,
williamr@2
   118
                             TInt aFontNameFlags);
williamr@2
   119
	
williamr@2
   120
    // This feature is not supported in Avkon; type made more general for 
williamr@2
   121
    // source compatibility
williamr@2
   122
williamr@2
   123
    /**
williamr@2
   124
     * Not implemented.
williamr@2
   125
     *
williamr@2
   126
     * @param aButtonGroup Not used
williamr@2
   127
     */ 
williamr@2
   128
	IMPORT_C void SetButtonGroup(CCoeControl* aButtonGroup);
williamr@2
   129
	
williamr@2
   130
    // This feature is not supported in Avkon
williamr@2
   131
    /**
williamr@2
   132
     * Not implemented.
williamr@2
   133
     *
williamr@2
   134
     * @param aBitmap Not used
williamr@2
   135
     */
williamr@2
   136
	IMPORT_C void SetLineCursorBitmapL(CFbsBitmap* aBitmap);
williamr@2
   137
williamr@2
   138
public: // formatting dialogs
williamr@2
   139
williamr@2
   140
    /**
williamr@2
   141
     * Runs a dialog enabling a user to set the font.
williamr@2
   142
     *
williamr@2
   143
     * Updates the button group to reflect any text formatting applied.
williamr@2
   144
     *
williamr@2
   145
     * @param aFontFlags = EGulNoSymbolFonts Specifies which font types should
williamr@2
   146
     *        appear in the list. For possible values see @c gulftflg.hrh.
williamr@2
   147
     * @param aGraphicsDevice = NULL The graphics device. This is used to get 
williamr@2
   148
     *        the list of available fonts. If NULL the default screen device 
williamr@2
   149
     *        is used.
williamr@2
   150
     * @param aFontControlFlags = EGulFontControlAll A set of flags that specify 
williamr@2
   151
     *        which font controls should appear in the dialog e.g. specifying 
williamr@2
   152
     *        @c EGulFontControlBold removes the bold checkbox control. 
williamr@2
   153
     *        The default shows all. For possible values see @c gulftflg.hrh.
williamr@2
   154
     * @return @c ETrue if user made a change and pressed @c OK. 
williamr@2
   155
     *         @c EFalse if user pressed cancel or made no changes.
williamr@2
   156
     */
williamr@2
   157
    IMPORT_C TBool RunFontDialogL(TInt aFontFlags=EGulNoSymbolFonts,
williamr@2
   158
                                  CGraphicsDevice* aGraphicsDevice=NULL,
williamr@2
   159
                                  TInt aFontControlFlags=EGulFontControlAll);
williamr@2
   160
	
williamr@2
   161
    /**
williamr@2
   162
     * Runs a dialog enabling an user to set tab position.
williamr@2
   163
     *
williamr@2
   164
     * @param aPageWidth Width of the page in twips.
williamr@2
   165
     */
williamr@2
   166
    IMPORT_C void RunTabsDialogL(TInt aPageWidth);
williamr@2
   167
	
williamr@2
   168
    /** 
williamr@2
   169
     * Runs indents dialog.
williamr@2
   170
     *
williamr@2
   171
     * Changes the paragraph format to indent all text.
williamr@2
   172
     *
williamr@2
   173
     * @param aPageWidth Width of page in twips.
williamr@2
   174
     */
williamr@2
   175
    IMPORT_C void RunIndentsDialogL(TInt aPageWidth);
williamr@2
   176
	
williamr@2
   177
    /**
williamr@2
   178
     * Sets the Graphics device to be used.
williamr@2
   179
     *
williamr@2
   180
     * @param aGraphicsDevice Wanted graphics device.
williamr@2
   181
     */
williamr@2
   182
    IMPORT_C void SetGraphicsDevice(CGraphicsDevice* aGraphicsDevice);
williamr@2
   183
	
williamr@2
   184
    /**
williamr@2
   185
     * Runs the find dialog.
williamr@2
   186
     * Enables an user to specify the text for which to search for. 
williamr@2
   187
     */ 
williamr@2
   188
    IMPORT_C void RunFindDialogL();
williamr@2
   189
	
williamr@2
   190
    /**
williamr@2
   191
     * Runs the find dialog again. 
williamr@2
   192
     */ 
williamr@2
   193
    IMPORT_C void RunFindAgainDialogL();
williamr@2
   194
	
williamr@2
   195
    /** 
williamr@2
   196
     * Runs the replace dialog.
williamr@2
   197
     *
williamr@2
   198
     * Enables the user to specify the text to be searched for and the
williamr@2
   199
     * replacement for that text. Can replace single or multiple occurances.
williamr@2
   200
     */ 
williamr@2
   201
    IMPORT_C void RunReplaceDialogL();
williamr@2
   202
	
williamr@2
   203
    /**
williamr@2
   204
     * Sets up the find model, the find list and the replace list ready
williamr@2
   205
     * for find or replace operations.
williamr@2
   206
     * 
williamr@2
   207
     * @param aModel The find model to be used.
williamr@2
   208
     * @param aFindList The find list to be used.
williamr@2
   209
     * @param aReplaceList The replace list to be used.
williamr@2
   210
     */
williamr@2
   211
    IMPORT_C void InitFindL(SEdwinFindModel*& aModel,
williamr@2
   212
                            CDesCArray*& aFindList,
williamr@2
   213
                            CDesCArray*& aReplaceList);
williamr@2
   214
	
williamr@2
   215
    /**
williamr@2
   216
     * Searches for text.
williamr@2
   217
     * 
williamr@2
   218
     * Returns @c ETrue if text is found.
williamr@2
   219
     *
williamr@2
   220
     * Used by @c RunFindDialogL(), @c RunFindAgainDialogL() and 
williamr@2
   221
     * @c RunReplaceDialogL() methods.
williamr@2
   222
     *
williamr@2
   223
     * @return @c ETrue if the text is found @c EFalse otherwise.
williamr@2
   224
     */ 
williamr@2
   225
    IMPORT_C TBool DoFindL();
williamr@2
   226
	
williamr@2
   227
    /**
williamr@2
   228
     * Runs a dialog enabling a user to set one of text alignment, spacing or
williamr@2
   229
     * borders.
williamr@2
   230
     *
williamr@2
   231
     * Depending on the user's choice another dialog is run enabling them to 
williamr@2
   232
     * set their requirements.
williamr@2
   233
     *
williamr@2
   234
     * @param aCommand User selected command. One of @c EEikCmdParaAlign, 
williamr@2
   235
     *        @c EEikCmdParaSpacing or @c EEikCmdParaBorder. 
williamr@2
   236
     */
williamr@2
   237
    IMPORT_C void RunParaDialogsL(TInt aCommand);	
williamr@2
   238
	
williamr@2
   239
    /**
williamr@2
   240
     * Runs a dialog enabling a user to do pagination.
williamr@2
   241
     * 
williamr@2
   242
     * @param aPrintSetup The printer setup.
williamr@2
   243
     * @param aCharsPerPage Page table (array of characters per page).
williamr@2
   244
     * @return @c ETrue if pagination is succesfull @c EFalse otherwise.
williamr@2
   245
     */ 
williamr@2
   246
    IMPORT_C TBool RunPaginateDialogL(CPrintSetup* aPrintSetup,
williamr@2
   247
                                      CArrayFix<TInt>* aCharsPerPage);
williamr@2
   248
williamr@2
   249
public: // other functions
williamr@2
   250
williamr@2
   251
    /**
williamr@2
   252
     * Gets the global text that is being edited.
williamr@2
   253
     * 
williamr@2
   254
     * @return The global text being edited.
williamr@2
   255
     */
williamr@2
   256
    IMPORT_C CGlobalText* GlobalText() const;
williamr@2
   257
	
williamr@2
   258
    /** 
williamr@2
   259
     * Applies the paragraph formatting and updates the screen layout.
williamr@2
   260
     *
williamr@2
   261
     * The attributes which are set in the mask are read from @c aParaMask. 
williamr@2
   262
     * The attributes which are not set in the mask are not changed. 
williamr@2
   263
     * 
williamr@2
   264
     * @param aParaFormat Contains the new paragraph formatting values 
williamr@2
   265
     *        to apply.
williamr@2
   266
     * @param aParaMask Bitmask specifying the paragraph format attributes 
williamr@2
   267
     *        to change.
williamr@2
   268
     */
williamr@2
   269
    IMPORT_C void ApplyParaFormatL(CParaFormat* aParaFormat,
williamr@2
   270
                                   TParaFormatMask& aParaMask);
williamr@2
   271
	
williamr@2
   272
    /**
williamr@2
   273
     * Applies the character formatting and updates the screen layout. 
williamr@2
   274
     * 
williamr@2
   275
     * The attributes which are set in the mask are read from @c aCharFormat.
williamr@2
   276
     * The attributes which are not set in the mask are not changed. 
williamr@2
   277
     *
williamr@2
   278
     * @param aCharFormat Contain the new character formatting values 
williamr@2
   279
     *        to apply.
williamr@2
   280
     * @param aCharMask Bitmask specifying the character format attributes 
williamr@2
   281
     *        to change.
williamr@2
   282
     */
williamr@2
   283
    IMPORT_C void ApplyCharFormatL(TCharFormat& aCharFormat,
williamr@2
   284
                                   TCharFormatMask& aCharMask);
williamr@2
   285
	
williamr@2
   286
    /** 
williamr@2
   287
     * Toggles format in the current selection. 
williamr@2
   288
     * 
williamr@2
   289
     * For a global text editor the format change is applied globally.
williamr@2
   290
     * For a rich text editor where there is no selection the format 
williamr@2
   291
     * change is applied to the word at the current cursor position.
williamr@2
   292
     *
williamr@2
   293
     * @param aFontFlag The format attribute toggle. See the 
williamr@2
   294
     *        @c TFontStyleFlags enum.
williamr@2
   295
     */
williamr@2
   296
    IMPORT_C void BoldItalicUnderlineEventL(TInt aFontFlag);
williamr@2
   297
	
williamr@2
   298
    /**
williamr@2
   299
     * Update the buttons in the button group so that they reflect the 
williamr@2
   300
     * formatting of the global text object.
williamr@2
   301
     */ 
williamr@2
   302
    IMPORT_C void UpdateButtonGroup();
williamr@2
   303
williamr@2
   304
public: // from CCoeControl
williamr@2
   305
williamr@2
   306
    /**
williamr@2
   307
     * From @c CCoeControl.
williamr@2
   308
     *
williamr@2
   309
     * Completes construction of the global text editor from a resource file.
williamr@2
   310
     * 
williamr@2
   311
     * The editor's paragraph and character formatting is set to default 
williamr@2
   312
     * values.
williamr@2
   313
     *
williamr@2
   314
     * See the @c GTXTED resource struct
williamr@2
   315
     *
williamr@2
   316
     * @param aReader A reader positioned for reading from a @c GTXTED 
williamr@2
   317
     *        resource.
williamr@2
   318
     */
williamr@2
   319
    IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
williamr@2
   320
	
williamr@2
   321
    /**
williamr@2
   322
     * From @c CCoeControl.
williamr@2
   323
     *
williamr@2
   324
     * Handles key events.
williamr@2
   325
     *
williamr@2
   326
     * @param aKeyEvent The key code and modifier 
williamr@2
   327
     * @param aType The type of the event: e.g. Key up.
williamr@2
   328
     * @return @c EKeyWasConsumed if the event was handled.
williamr@2
   329
     *         @c EKeyWasNotConsumed if the event was not handled.
williamr@2
   330
     */
williamr@2
   331
    IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
williamr@2
   332
                                         TEventCode aType);
williamr@2
   333
    /**
williamr@2
   334
     * From @c CCoeControl.
williamr@2
   335
     *
williamr@2
   336
     * Sets the editor ready for drawing.
williamr@2
   337
     */ 
williamr@2
   338
    IMPORT_C void ActivateL();
williamr@2
   339
    
williamr@2
   340
    /**
williamr@2
   341
     * From @c CCoeControl.
williamr@2
   342
     *
williamr@2
   343
     * Handles pointer events.
williamr@2
   344
     *
williamr@2
   345
     * @param aPointerEvent Pointer to an event that is to be handled. 
williamr@2
   346
     */
williamr@2
   347
    IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
williamr@2
   348
williamr@2
   349
public: // from CEikEdwin
williamr@2
   350
williamr@2
   351
    /**
williamr@2
   352
     * From @c CEikEdwin.
williamr@2
   353
     *
williamr@2
   354
     * Gets the width of a line cursor in pixels.
williamr@2
   355
     *
williamr@2
   356
     * @return The width of the line cursor in pixels.  
williamr@2
   357
     */ 
williamr@2
   358
    IMPORT_C TInt LineCursorWidth() const;
williamr@2
   359
williamr@2
   360
protected:
williamr@2
   361
williamr@2
   362
    /**
williamr@2
   363
     * Completes the second-phase construction of a @c CEikEdwin object. 
williamr@2
   364
     * This protected function is called by @c ConstructL() and 
williamr@2
   365
     * @c ConstructFromResourceL() after the @c Edwin’s size, flags and 
williamr@2
   366
     * text limit have been set. Derived classes should call either this 
williamr@2
   367
     * function or @c CEikEdwin’s @c ConstructL() or 
williamr@2
   368
     * @c ConstructFromResourceL() functions during their construction 
williamr@2
   369
     * before initialising their own members.
williamr@2
   370
     */ 
williamr@2
   371
    IMPORT_C void BaseConstructL();
williamr@2
   372
williamr@2
   373
protected: //from CCoeControl
williamr@2
   374
williamr@2
   375
    /**
williamr@2
   376
     * From @c CCoeControl.
williamr@2
   377
     *
williamr@2
   378
     * Writes the internal state to the specified stream. Does nothing
williamr@2
   379
     * in release mode. 
williamr@2
   380
     * 
williamr@2
   381
     * @param aWriteStream The stream to write to.
williamr@2
   382
     */
williamr@2
   383
    IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
williamr@2
   384
williamr@2
   385
private: // from CoeControl
williamr@2
   386
williamr@2
   387
    IMPORT_C void Reserved_2();
williamr@2
   388
williamr@2
   389
private:
williamr@2
   390
williamr@2
   391
    /**
williamr@2
   392
    * From CAknControl
williamr@2
   393
    */
williamr@2
   394
    IMPORT_C void* ExtensionInterface( TUid aInterface );
williamr@2
   395
williamr@2
   396
private: // from CEikEdwin
williamr@2
   397
williamr@2
   398
    IMPORT_C void Reserved_3();
williamr@2
   399
williamr@2
   400
private:
williamr@2
   401
williamr@2
   402
    void CheckDocumentNotEmptyL();
williamr@2
   403
	
williamr@2
   404
    void CreateFindModelL();
williamr@2
   405
	
williamr@2
   406
    void GetTextForFindL();
williamr@2
   407
williamr@2
   408
protected:
williamr@2
   409
williamr@2
   410
    /** 
williamr@2
   411
     * Stores the object's global character formatting. 
williamr@2
   412
     */
williamr@2
   413
    CCharFormatLayer* iCharFormatLayer;
williamr@2
   414
	
williamr@2
   415
    /** 
williamr@2
   416
     * Stores the object's global paragraph formatting. 
williamr@2
   417
     */
williamr@2
   418
    CParaFormatLayer* iParaFormatLayer;
williamr@2
   419
williamr@2
   420
private:
williamr@2
   421
williamr@2
   422
    CDesCArray* iFindList; 
williamr@2
   423
	
williamr@2
   424
    CDesCArray* iReplaceList;
williamr@2
   425
	
williamr@2
   426
    SEdwinFindModel* iFindModel;
williamr@2
   427
	
williamr@2
   428
    CEikDialogToolBar* iButGroup;
williamr@2
   429
	
williamr@2
   430
    TInt iLineCursorWidth;
williamr@2
   431
	
williamr@2
   432
    CFbsBitmap* iLineCursor;
williamr@2
   433
	
williamr@2
   434
    TInt iFontControlFlags;
williamr@2
   435
	
williamr@2
   436
    TInt iFontNameFlags;
williamr@2
   437
	
williamr@2
   438
    CGraphicsDevice* iGraphicsDevice;
williamr@2
   439
    
williamr@2
   440
    TInt iSpare[4];
williamr@2
   441
	};
williamr@2
   442
williamr@2
   443
williamr@2
   444
#endif  // __EIKGTED_H__
williamr@2
   445
williamr@2
   446
// enf of file