2 * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #if !defined(__EIKGTED_H__)
22 #if !defined(__EIKEDWIN_H__)
27 #if !defined(__BADESCA_H__)
31 #if !defined(__EIKON_HRH__)
37 class CEikDialogToolBar;
39 class CTextPageRegionPrinter;
40 class CEikDialogToolBar;
45 * This is an edit window which supports globally formatted text. Supports
46 * a line cursor and provides functions which make it easy to launch various
47 * dialogs, for instance search, replace, set font etc.
51 class CEikGlobalTextEditor : public CEikEdwin
70 /** Underlined font */
74 public: // construction and destruction
77 * C++ default constructor.
79 IMPORT_C CEikGlobalTextEditor();
82 * C++ default constructor.
84 * @param aBorder The editor's border.
86 IMPORT_C CEikGlobalTextEditor(const TGulBorder& aBorder);
91 IMPORT_C ~CEikGlobalTextEditor();
94 * By Default symbian 2nd phase constructor is private.
96 * Completes construction of the global text editor.
98 * The editor's paragraph and character formatting is set to
101 * @param aParent The editor's parent control. Omit if the
102 * editor has no parent.
103 * @param aNumberOfLines The editor's number of lines.
104 * @param aTextLimit The maximum length of the editor in characters.
105 * @param aEdwinFlags The editor's flags. See @c CEikEdwin::TFlags.
106 * @param aFontControlFlags A set of flags that specify which font
107 * controls should appear, e.g. specifying @c EGulFontControlBold
108 * removes the bold checkbox control. The default shows all.
109 * For possible values, see @c gulftflg.hrh.
110 * @param aFontNameFlags The editor's font name flags. For possible
111 * values, see @c gulftflg.hrh.
113 IMPORT_C void ConstructL(const CCoeControl* aParent,
117 TInt aFontControlFlags,
118 TInt aFontNameFlags);
120 // This feature is not supported in Avkon; type made more general for
121 // source compatibility
126 * @param aButtonGroup Not used
128 IMPORT_C void SetButtonGroup(CCoeControl* aButtonGroup);
130 // This feature is not supported in Avkon
134 * @param aBitmap Not used
136 IMPORT_C void SetLineCursorBitmapL(CFbsBitmap* aBitmap);
138 public: // formatting dialogs
141 * Runs a dialog enabling a user to set the font.
143 * Updates the button group to reflect any text formatting applied.
145 * @param aFontFlags = EGulNoSymbolFonts Specifies which font types should
146 * appear in the list. For possible values see @c gulftflg.hrh.
147 * @param aGraphicsDevice = NULL The graphics device. This is used to get
148 * the list of available fonts. If NULL the default screen device
150 * @param aFontControlFlags = EGulFontControlAll A set of flags that specify
151 * which font controls should appear in the dialog e.g. specifying
152 * @c EGulFontControlBold removes the bold checkbox control.
153 * The default shows all. For possible values see @c gulftflg.hrh.
154 * @return @c ETrue if user made a change and pressed @c OK.
155 * @c EFalse if user pressed cancel or made no changes.
157 IMPORT_C TBool RunFontDialogL(TInt aFontFlags=EGulNoSymbolFonts,
158 CGraphicsDevice* aGraphicsDevice=NULL,
159 TInt aFontControlFlags=EGulFontControlAll);
162 * Runs a dialog enabling an user to set tab position.
164 * @param aPageWidth Width of the page in twips.
166 IMPORT_C void RunTabsDialogL(TInt aPageWidth);
169 * Runs indents dialog.
171 * Changes the paragraph format to indent all text.
173 * @param aPageWidth Width of page in twips.
175 IMPORT_C void RunIndentsDialogL(TInt aPageWidth);
178 * Sets the Graphics device to be used.
180 * @param aGraphicsDevice Wanted graphics device.
182 IMPORT_C void SetGraphicsDevice(CGraphicsDevice* aGraphicsDevice);
185 * Runs the find dialog.
186 * Enables an user to specify the text for which to search for.
188 IMPORT_C void RunFindDialogL();
191 * Runs the find dialog again.
193 IMPORT_C void RunFindAgainDialogL();
196 * Runs the replace dialog.
198 * Enables the user to specify the text to be searched for and the
199 * replacement for that text. Can replace single or multiple occurances.
201 IMPORT_C void RunReplaceDialogL();
204 * Sets up the find model, the find list and the replace list ready
205 * for find or replace operations.
207 * @param aModel The find model to be used.
208 * @param aFindList The find list to be used.
209 * @param aReplaceList The replace list to be used.
211 IMPORT_C void InitFindL(SEdwinFindModel*& aModel,
212 CDesCArray*& aFindList,
213 CDesCArray*& aReplaceList);
218 * Returns @c ETrue if text is found.
220 * Used by @c RunFindDialogL(), @c RunFindAgainDialogL() and
221 * @c RunReplaceDialogL() methods.
223 * @return @c ETrue if the text is found @c EFalse otherwise.
225 IMPORT_C TBool DoFindL();
228 * Runs a dialog enabling a user to set one of text alignment, spacing or
231 * Depending on the user's choice another dialog is run enabling them to
232 * set their requirements.
234 * @param aCommand User selected command. One of @c EEikCmdParaAlign,
235 * @c EEikCmdParaSpacing or @c EEikCmdParaBorder.
237 IMPORT_C void RunParaDialogsL(TInt aCommand);
240 * Runs a dialog enabling a user to do pagination.
242 * @param aPrintSetup The printer setup.
243 * @param aCharsPerPage Page table (array of characters per page).
244 * @return @c ETrue if pagination is succesfull @c EFalse otherwise.
246 IMPORT_C TBool RunPaginateDialogL(CPrintSetup* aPrintSetup,
247 CArrayFix<TInt>* aCharsPerPage);
249 public: // other functions
252 * Gets the global text that is being edited.
254 * @return The global text being edited.
256 IMPORT_C CGlobalText* GlobalText() const;
259 * Applies the paragraph formatting and updates the screen layout.
261 * The attributes which are set in the mask are read from @c aParaMask.
262 * The attributes which are not set in the mask are not changed.
264 * @param aParaFormat Contains the new paragraph formatting values
266 * @param aParaMask Bitmask specifying the paragraph format attributes
269 IMPORT_C void ApplyParaFormatL(CParaFormat* aParaFormat,
270 TParaFormatMask& aParaMask);
273 * Applies the character formatting and updates the screen layout.
275 * The attributes which are set in the mask are read from @c aCharFormat.
276 * The attributes which are not set in the mask are not changed.
278 * @param aCharFormat Contain the new character formatting values
280 * @param aCharMask Bitmask specifying the character format attributes
283 IMPORT_C void ApplyCharFormatL(TCharFormat& aCharFormat,
284 TCharFormatMask& aCharMask);
287 * Toggles format in the current selection.
289 * For a global text editor the format change is applied globally.
290 * For a rich text editor where there is no selection the format
291 * change is applied to the word at the current cursor position.
293 * @param aFontFlag The format attribute toggle. See the
294 * @c TFontStyleFlags enum.
296 IMPORT_C void BoldItalicUnderlineEventL(TInt aFontFlag);
299 * Update the buttons in the button group so that they reflect the
300 * formatting of the global text object.
302 IMPORT_C void UpdateButtonGroup();
304 public: // from CCoeControl
307 * From @c CCoeControl.
309 * Completes construction of the global text editor from a resource file.
311 * The editor's paragraph and character formatting is set to default
314 * See the @c GTXTED resource struct
316 * @param aReader A reader positioned for reading from a @c GTXTED
319 IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
322 * From @c CCoeControl.
324 * Handles key events.
326 * @param aKeyEvent The key code and modifier
327 * @param aType The type of the event: e.g. Key up.
328 * @return @c EKeyWasConsumed if the event was handled.
329 * @c EKeyWasNotConsumed if the event was not handled.
331 IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
334 * From @c CCoeControl.
336 * Sets the editor ready for drawing.
338 IMPORT_C void ActivateL();
341 * From @c CCoeControl.
343 * Handles pointer events.
345 * @param aPointerEvent Pointer to an event that is to be handled.
347 IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
349 public: // from CEikEdwin
354 * Gets the width of a line cursor in pixels.
356 * @return The width of the line cursor in pixels.
358 IMPORT_C TInt LineCursorWidth() const;
363 * Completes the second-phase construction of a @c CEikEdwin object.
364 * This protected function is called by @c ConstructL() and
365 * @c ConstructFromResourceL() after the @c Edwin’s size, flags and
366 * text limit have been set. Derived classes should call either this
367 * function or @c CEikEdwin’s @c ConstructL() or
368 * @c ConstructFromResourceL() functions during their construction
369 * before initialising their own members.
371 IMPORT_C void BaseConstructL();
373 protected: //from CCoeControl
376 * From @c CCoeControl.
378 * Writes the internal state to the specified stream. Does nothing
381 * @param aWriteStream The stream to write to.
383 IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
385 private: // from CoeControl
387 IMPORT_C void Reserved_2();
394 IMPORT_C void* ExtensionInterface( TUid aInterface );
396 private: // from CEikEdwin
398 IMPORT_C void Reserved_3();
402 void CheckDocumentNotEmptyL();
404 void CreateFindModelL();
406 void GetTextForFindL();
411 * Stores the object's global character formatting.
413 CCharFormatLayer* iCharFormatLayer;
416 * Stores the object's global paragraph formatting.
418 CParaFormatLayer* iParaFormatLayer;
422 CDesCArray* iFindList;
424 CDesCArray* iReplaceList;
426 SEdwinFindModel* iFindModel;
428 CEikDialogToolBar* iButGroup;
430 TInt iLineCursorWidth;
432 CFbsBitmap* iLineCursor;
434 TInt iFontControlFlags;
438 CGraphicsDevice* iGraphicsDevice;
444 #endif // __EIKGTED_H__