1.1 --- a/epoc32/include/mw/eikgted.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/mw/eikgted.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,446 @@
1.4 -eikgted.h
1.5 +/*
1.6 +* Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#if !defined(__EIKGTED_H__)
1.24 +#define __EIKGTED_H__
1.25 +
1.26 +#if !defined(__EIKEDWIN_H__)
1.27 +#include <eikedwin.h>
1.28 +#endif
1.29 +
1.30 +
1.31 +#if !defined(__BADESCA_H__)
1.32 +#include <badesca.h>
1.33 +#endif
1.34 +
1.35 +#if !defined(__EIKON_HRH__)
1.36 +#include <eikon.hrh>
1.37 +#endif
1.38 +
1.39 +class CGlobalText;
1.40 +class CControlEnv;
1.41 +class CEikDialogToolBar;
1.42 +class CPrintSetup;
1.43 +class CTextPageRegionPrinter;
1.44 +class CEikDialogToolBar;
1.45 +
1.46 +/**
1.47 + * Global text editor.
1.48 + *
1.49 + * This is an edit window which supports globally formatted text. Supports
1.50 + * a line cursor and provides functions which make it easy to launch various
1.51 + * dialogs, for instance search, replace, set font etc.
1.52 + *
1.53 + * @since Symbian 5.0
1.54 + */
1.55 +class CEikGlobalTextEditor : public CEikEdwin
1.56 + {
1.57 +
1.58 +public:
1.59 +
1.60 + /**
1.61 + * Font style
1.62 + */
1.63 + enum TFontStyleFlags
1.64 + {
1.65 + /** Normal font */
1.66 + EStandard =0x00,
1.67 +
1.68 + /** Bolded font */
1.69 + EBold =0x01,
1.70 +
1.71 + /** Italic font */
1.72 + EItalic =0x02,
1.73 +
1.74 + /** Underlined font */
1.75 + EUnderline =0x04
1.76 + };
1.77 +
1.78 +public: // construction and destruction
1.79 +
1.80 + /**
1.81 + * C++ default constructor.
1.82 + */
1.83 + IMPORT_C CEikGlobalTextEditor();
1.84 +
1.85 + /**
1.86 + * C++ default constructor.
1.87 + *
1.88 + * @param aBorder The editor's border.
1.89 + */
1.90 + IMPORT_C CEikGlobalTextEditor(const TGulBorder& aBorder);
1.91 +
1.92 + /**
1.93 + * Destructor.
1.94 + */
1.95 + IMPORT_C ~CEikGlobalTextEditor();
1.96 +
1.97 + /**
1.98 + * By Default symbian 2nd phase constructor is private.
1.99 + *
1.100 + * Completes construction of the global text editor.
1.101 + *
1.102 + * The editor's paragraph and character formatting is set to
1.103 + * default values.
1.104 + *
1.105 + * @param aParent The editor's parent control. Omit if the
1.106 + * editor has no parent.
1.107 + * @param aNumberOfLines The editor's number of lines.
1.108 + * @param aTextLimit The maximum length of the editor in characters.
1.109 + * @param aEdwinFlags The editor's flags. See @c CEikEdwin::TFlags.
1.110 + * @param aFontControlFlags A set of flags that specify which font
1.111 + * controls should appear, e.g. specifying @c EGulFontControlBold
1.112 + * removes the bold checkbox control. The default shows all.
1.113 + * For possible values, see @c gulftflg.hrh.
1.114 + * @param aFontNameFlags The editor's font name flags. For possible
1.115 + * values, see @c gulftflg.hrh.
1.116 + */
1.117 + IMPORT_C void ConstructL(const CCoeControl* aParent,
1.118 + TInt aNumberOfLines,
1.119 + TInt aTextLimit,
1.120 + TInt aEdwinFlags,
1.121 + TInt aFontControlFlags,
1.122 + TInt aFontNameFlags);
1.123 +
1.124 + // This feature is not supported in Avkon; type made more general for
1.125 + // source compatibility
1.126 +
1.127 + /**
1.128 + * Not implemented.
1.129 + *
1.130 + * @param aButtonGroup Not used
1.131 + */
1.132 + IMPORT_C void SetButtonGroup(CCoeControl* aButtonGroup);
1.133 +
1.134 + // This feature is not supported in Avkon
1.135 + /**
1.136 + * Not implemented.
1.137 + *
1.138 + * @param aBitmap Not used
1.139 + */
1.140 + IMPORT_C void SetLineCursorBitmapL(CFbsBitmap* aBitmap);
1.141 +
1.142 +public: // formatting dialogs
1.143 +
1.144 + /**
1.145 + * Runs a dialog enabling a user to set the font.
1.146 + *
1.147 + * Updates the button group to reflect any text formatting applied.
1.148 + *
1.149 + * @param aFontFlags = EGulNoSymbolFonts Specifies which font types should
1.150 + * appear in the list. For possible values see @c gulftflg.hrh.
1.151 + * @param aGraphicsDevice = NULL The graphics device. This is used to get
1.152 + * the list of available fonts. If NULL the default screen device
1.153 + * is used.
1.154 + * @param aFontControlFlags = EGulFontControlAll A set of flags that specify
1.155 + * which font controls should appear in the dialog e.g. specifying
1.156 + * @c EGulFontControlBold removes the bold checkbox control.
1.157 + * The default shows all. For possible values see @c gulftflg.hrh.
1.158 + * @return @c ETrue if user made a change and pressed @c OK.
1.159 + * @c EFalse if user pressed cancel or made no changes.
1.160 + */
1.161 + IMPORT_C TBool RunFontDialogL(TInt aFontFlags=EGulNoSymbolFonts,
1.162 + CGraphicsDevice* aGraphicsDevice=NULL,
1.163 + TInt aFontControlFlags=EGulFontControlAll);
1.164 +
1.165 + /**
1.166 + * Runs a dialog enabling an user to set tab position.
1.167 + *
1.168 + * @param aPageWidth Width of the page in twips.
1.169 + */
1.170 + IMPORT_C void RunTabsDialogL(TInt aPageWidth);
1.171 +
1.172 + /**
1.173 + * Runs indents dialog.
1.174 + *
1.175 + * Changes the paragraph format to indent all text.
1.176 + *
1.177 + * @param aPageWidth Width of page in twips.
1.178 + */
1.179 + IMPORT_C void RunIndentsDialogL(TInt aPageWidth);
1.180 +
1.181 + /**
1.182 + * Sets the Graphics device to be used.
1.183 + *
1.184 + * @param aGraphicsDevice Wanted graphics device.
1.185 + */
1.186 + IMPORT_C void SetGraphicsDevice(CGraphicsDevice* aGraphicsDevice);
1.187 +
1.188 + /**
1.189 + * Runs the find dialog.
1.190 + * Enables an user to specify the text for which to search for.
1.191 + */
1.192 + IMPORT_C void RunFindDialogL();
1.193 +
1.194 + /**
1.195 + * Runs the find dialog again.
1.196 + */
1.197 + IMPORT_C void RunFindAgainDialogL();
1.198 +
1.199 + /**
1.200 + * Runs the replace dialog.
1.201 + *
1.202 + * Enables the user to specify the text to be searched for and the
1.203 + * replacement for that text. Can replace single or multiple occurances.
1.204 + */
1.205 + IMPORT_C void RunReplaceDialogL();
1.206 +
1.207 + /**
1.208 + * Sets up the find model, the find list and the replace list ready
1.209 + * for find or replace operations.
1.210 + *
1.211 + * @param aModel The find model to be used.
1.212 + * @param aFindList The find list to be used.
1.213 + * @param aReplaceList The replace list to be used.
1.214 + */
1.215 + IMPORT_C void InitFindL(SEdwinFindModel*& aModel,
1.216 + CDesCArray*& aFindList,
1.217 + CDesCArray*& aReplaceList);
1.218 +
1.219 + /**
1.220 + * Searches for text.
1.221 + *
1.222 + * Returns @c ETrue if text is found.
1.223 + *
1.224 + * Used by @c RunFindDialogL(), @c RunFindAgainDialogL() and
1.225 + * @c RunReplaceDialogL() methods.
1.226 + *
1.227 + * @return @c ETrue if the text is found @c EFalse otherwise.
1.228 + */
1.229 + IMPORT_C TBool DoFindL();
1.230 +
1.231 + /**
1.232 + * Runs a dialog enabling a user to set one of text alignment, spacing or
1.233 + * borders.
1.234 + *
1.235 + * Depending on the user's choice another dialog is run enabling them to
1.236 + * set their requirements.
1.237 + *
1.238 + * @param aCommand User selected command. One of @c EEikCmdParaAlign,
1.239 + * @c EEikCmdParaSpacing or @c EEikCmdParaBorder.
1.240 + */
1.241 + IMPORT_C void RunParaDialogsL(TInt aCommand);
1.242 +
1.243 + /**
1.244 + * Runs a dialog enabling a user to do pagination.
1.245 + *
1.246 + * @param aPrintSetup The printer setup.
1.247 + * @param aCharsPerPage Page table (array of characters per page).
1.248 + * @return @c ETrue if pagination is succesfull @c EFalse otherwise.
1.249 + */
1.250 + IMPORT_C TBool RunPaginateDialogL(CPrintSetup* aPrintSetup,
1.251 + CArrayFix<TInt>* aCharsPerPage);
1.252 +
1.253 +public: // other functions
1.254 +
1.255 + /**
1.256 + * Gets the global text that is being edited.
1.257 + *
1.258 + * @return The global text being edited.
1.259 + */
1.260 + IMPORT_C CGlobalText* GlobalText() const;
1.261 +
1.262 + /**
1.263 + * Applies the paragraph formatting and updates the screen layout.
1.264 + *
1.265 + * The attributes which are set in the mask are read from @c aParaMask.
1.266 + * The attributes which are not set in the mask are not changed.
1.267 + *
1.268 + * @param aParaFormat Contains the new paragraph formatting values
1.269 + * to apply.
1.270 + * @param aParaMask Bitmask specifying the paragraph format attributes
1.271 + * to change.
1.272 + */
1.273 + IMPORT_C void ApplyParaFormatL(CParaFormat* aParaFormat,
1.274 + TParaFormatMask& aParaMask);
1.275 +
1.276 + /**
1.277 + * Applies the character formatting and updates the screen layout.
1.278 + *
1.279 + * The attributes which are set in the mask are read from @c aCharFormat.
1.280 + * The attributes which are not set in the mask are not changed.
1.281 + *
1.282 + * @param aCharFormat Contain the new character formatting values
1.283 + * to apply.
1.284 + * @param aCharMask Bitmask specifying the character format attributes
1.285 + * to change.
1.286 + */
1.287 + IMPORT_C void ApplyCharFormatL(TCharFormat& aCharFormat,
1.288 + TCharFormatMask& aCharMask);
1.289 +
1.290 + /**
1.291 + * Toggles format in the current selection.
1.292 + *
1.293 + * For a global text editor the format change is applied globally.
1.294 + * For a rich text editor where there is no selection the format
1.295 + * change is applied to the word at the current cursor position.
1.296 + *
1.297 + * @param aFontFlag The format attribute toggle. See the
1.298 + * @c TFontStyleFlags enum.
1.299 + */
1.300 + IMPORT_C void BoldItalicUnderlineEventL(TInt aFontFlag);
1.301 +
1.302 + /**
1.303 + * Update the buttons in the button group so that they reflect the
1.304 + * formatting of the global text object.
1.305 + */
1.306 + IMPORT_C void UpdateButtonGroup();
1.307 +
1.308 +public: // from CCoeControl
1.309 +
1.310 + /**
1.311 + * From @c CCoeControl.
1.312 + *
1.313 + * Completes construction of the global text editor from a resource file.
1.314 + *
1.315 + * The editor's paragraph and character formatting is set to default
1.316 + * values.
1.317 + *
1.318 + * See the @c GTXTED resource struct
1.319 + *
1.320 + * @param aReader A reader positioned for reading from a @c GTXTED
1.321 + * resource.
1.322 + */
1.323 + IMPORT_C void ConstructFromResourceL(TResourceReader& aReader);
1.324 +
1.325 + /**
1.326 + * From @c CCoeControl.
1.327 + *
1.328 + * Handles key events.
1.329 + *
1.330 + * @param aKeyEvent The key code and modifier
1.331 + * @param aType The type of the event: e.g. Key up.
1.332 + * @return @c EKeyWasConsumed if the event was handled.
1.333 + * @c EKeyWasNotConsumed if the event was not handled.
1.334 + */
1.335 + IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
1.336 + TEventCode aType);
1.337 + /**
1.338 + * From @c CCoeControl.
1.339 + *
1.340 + * Sets the editor ready for drawing.
1.341 + */
1.342 + IMPORT_C void ActivateL();
1.343 +
1.344 + /**
1.345 + * From @c CCoeControl.
1.346 + *
1.347 + * Handles pointer events.
1.348 + *
1.349 + * @param aPointerEvent Pointer to an event that is to be handled.
1.350 + */
1.351 + IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent);
1.352 +
1.353 +public: // from CEikEdwin
1.354 +
1.355 + /**
1.356 + * From @c CEikEdwin.
1.357 + *
1.358 + * Gets the width of a line cursor in pixels.
1.359 + *
1.360 + * @return The width of the line cursor in pixels.
1.361 + */
1.362 + IMPORT_C TInt LineCursorWidth() const;
1.363 +
1.364 +protected:
1.365 +
1.366 + /**
1.367 + * Completes the second-phase construction of a @c CEikEdwin object.
1.368 + * This protected function is called by @c ConstructL() and
1.369 + * @c ConstructFromResourceL() after the @c Edwin’s size, flags and
1.370 + * text limit have been set. Derived classes should call either this
1.371 + * function or @c CEikEdwin’s @c ConstructL() or
1.372 + * @c ConstructFromResourceL() functions during their construction
1.373 + * before initialising their own members.
1.374 + */
1.375 + IMPORT_C void BaseConstructL();
1.376 +
1.377 +protected: //from CCoeControl
1.378 +
1.379 + /**
1.380 + * From @c CCoeControl.
1.381 + *
1.382 + * Writes the internal state to the specified stream. Does nothing
1.383 + * in release mode.
1.384 + *
1.385 + * @param aWriteStream The stream to write to.
1.386 + */
1.387 + IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const;
1.388 +
1.389 +private: // from CoeControl
1.390 +
1.391 + IMPORT_C void Reserved_2();
1.392 +
1.393 +private:
1.394 +
1.395 + /**
1.396 + * From CAknControl
1.397 + */
1.398 + IMPORT_C void* ExtensionInterface( TUid aInterface );
1.399 +
1.400 +private: // from CEikEdwin
1.401 +
1.402 + IMPORT_C void Reserved_3();
1.403 +
1.404 +private:
1.405 +
1.406 + void CheckDocumentNotEmptyL();
1.407 +
1.408 + void CreateFindModelL();
1.409 +
1.410 + void GetTextForFindL();
1.411 +
1.412 +protected:
1.413 +
1.414 + /**
1.415 + * Stores the object's global character formatting.
1.416 + */
1.417 + CCharFormatLayer* iCharFormatLayer;
1.418 +
1.419 + /**
1.420 + * Stores the object's global paragraph formatting.
1.421 + */
1.422 + CParaFormatLayer* iParaFormatLayer;
1.423 +
1.424 +private:
1.425 +
1.426 + CDesCArray* iFindList;
1.427 +
1.428 + CDesCArray* iReplaceList;
1.429 +
1.430 + SEdwinFindModel* iFindModel;
1.431 +
1.432 + CEikDialogToolBar* iButGroup;
1.433 +
1.434 + TInt iLineCursorWidth;
1.435 +
1.436 + CFbsBitmap* iLineCursor;
1.437 +
1.438 + TInt iFontControlFlags;
1.439 +
1.440 + TInt iFontNameFlags;
1.441 +
1.442 + CGraphicsDevice* iGraphicsDevice;
1.443 +
1.444 + TInt iSpare[4];
1.445 + };
1.446 +
1.447 +
1.448 +#endif // __EIKGTED_H__
1.449 +
1.450 +// enf of file