williamr@2: /* williamr@2: * Copyright (c) 1997-1999 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@4: * under the terms of "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@4: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: #if !defined(__EIKGTED_H__) williamr@2: #define __EIKGTED_H__ williamr@2: williamr@2: #if !defined(__EIKEDWIN_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: williamr@2: #if !defined(__BADESCA_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__EIKON_HRH__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: class CGlobalText; williamr@2: class CControlEnv; williamr@2: class CEikDialogToolBar; williamr@2: class CPrintSetup; williamr@2: class CTextPageRegionPrinter; williamr@2: class CEikDialogToolBar; williamr@2: williamr@2: /** williamr@2: * Global text editor. williamr@2: * williamr@2: * This is an edit window which supports globally formatted text. Supports williamr@2: * a line cursor and provides functions which make it easy to launch various williamr@2: * dialogs, for instance search, replace, set font etc. williamr@2: * williamr@2: * @since Symbian 5.0 williamr@2: */ williamr@2: class CEikGlobalTextEditor : public CEikEdwin williamr@2: { williamr@2: williamr@2: public: williamr@2: williamr@2: /** williamr@2: * Font style williamr@2: */ williamr@2: enum TFontStyleFlags williamr@2: { williamr@2: /** Normal font */ williamr@2: EStandard =0x00, williamr@2: williamr@2: /** Bolded font */ williamr@2: EBold =0x01, williamr@2: williamr@2: /** Italic font */ williamr@2: EItalic =0x02, williamr@2: williamr@2: /** Underlined font */ williamr@2: EUnderline =0x04 williamr@2: }; williamr@2: williamr@2: public: // construction and destruction williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: */ williamr@2: IMPORT_C CEikGlobalTextEditor(); williamr@2: williamr@2: /** williamr@2: * C++ default constructor. williamr@2: * williamr@2: * @param aBorder The editor's border. williamr@2: */ williamr@2: IMPORT_C CEikGlobalTextEditor(const TGulBorder& aBorder); williamr@2: williamr@2: /** williamr@2: * Destructor. williamr@2: */ williamr@2: IMPORT_C ~CEikGlobalTextEditor(); williamr@2: williamr@2: /** williamr@2: * By Default symbian 2nd phase constructor is private. williamr@2: * williamr@2: * Completes construction of the global text editor. williamr@2: * williamr@2: * The editor's paragraph and character formatting is set to williamr@2: * default values. williamr@2: * williamr@2: * @param aParent The editor's parent control. Omit if the williamr@2: * editor has no parent. williamr@2: * @param aNumberOfLines The editor's number of lines. williamr@2: * @param aTextLimit The maximum length of the editor in characters. williamr@2: * @param aEdwinFlags The editor's flags. See @c CEikEdwin::TFlags. williamr@2: * @param aFontControlFlags A set of flags that specify which font williamr@2: * controls should appear, e.g. specifying @c EGulFontControlBold williamr@2: * removes the bold checkbox control. The default shows all. williamr@2: * For possible values, see @c gulftflg.hrh. williamr@2: * @param aFontNameFlags The editor's font name flags. For possible williamr@2: * values, see @c gulftflg.hrh. williamr@2: */ williamr@2: IMPORT_C void ConstructL(const CCoeControl* aParent, williamr@2: TInt aNumberOfLines, williamr@2: TInt aTextLimit, williamr@2: TInt aEdwinFlags, williamr@2: TInt aFontControlFlags, williamr@2: TInt aFontNameFlags); williamr@2: williamr@2: // This feature is not supported in Avkon; type made more general for williamr@2: // source compatibility williamr@2: williamr@2: /** williamr@2: * Not implemented. williamr@2: * williamr@2: * @param aButtonGroup Not used williamr@2: */ williamr@2: IMPORT_C void SetButtonGroup(CCoeControl* aButtonGroup); williamr@2: williamr@2: // This feature is not supported in Avkon williamr@2: /** williamr@2: * Not implemented. williamr@2: * williamr@2: * @param aBitmap Not used williamr@2: */ williamr@2: IMPORT_C void SetLineCursorBitmapL(CFbsBitmap* aBitmap); williamr@2: williamr@2: public: // formatting dialogs williamr@2: williamr@2: /** williamr@2: * Runs a dialog enabling a user to set the font. williamr@2: * williamr@2: * Updates the button group to reflect any text formatting applied. williamr@2: * williamr@2: * @param aFontFlags = EGulNoSymbolFonts Specifies which font types should williamr@2: * appear in the list. For possible values see @c gulftflg.hrh. williamr@2: * @param aGraphicsDevice = NULL The graphics device. This is used to get williamr@2: * the list of available fonts. If NULL the default screen device williamr@2: * is used. williamr@2: * @param aFontControlFlags = EGulFontControlAll A set of flags that specify williamr@2: * which font controls should appear in the dialog e.g. specifying williamr@2: * @c EGulFontControlBold removes the bold checkbox control. williamr@2: * The default shows all. For possible values see @c gulftflg.hrh. williamr@2: * @return @c ETrue if user made a change and pressed @c OK. williamr@2: * @c EFalse if user pressed cancel or made no changes. williamr@2: */ williamr@2: IMPORT_C TBool RunFontDialogL(TInt aFontFlags=EGulNoSymbolFonts, williamr@2: CGraphicsDevice* aGraphicsDevice=NULL, williamr@2: TInt aFontControlFlags=EGulFontControlAll); williamr@2: williamr@2: /** williamr@2: * Runs a dialog enabling an user to set tab position. williamr@2: * williamr@2: * @param aPageWidth Width of the page in twips. williamr@2: */ williamr@2: IMPORT_C void RunTabsDialogL(TInt aPageWidth); williamr@2: williamr@2: /** williamr@2: * Runs indents dialog. williamr@2: * williamr@2: * Changes the paragraph format to indent all text. williamr@2: * williamr@2: * @param aPageWidth Width of page in twips. williamr@2: */ williamr@2: IMPORT_C void RunIndentsDialogL(TInt aPageWidth); williamr@2: williamr@2: /** williamr@2: * Sets the Graphics device to be used. williamr@2: * williamr@2: * @param aGraphicsDevice Wanted graphics device. williamr@2: */ williamr@2: IMPORT_C void SetGraphicsDevice(CGraphicsDevice* aGraphicsDevice); williamr@2: williamr@2: /** williamr@2: * Runs the find dialog. williamr@2: * Enables an user to specify the text for which to search for. williamr@2: */ williamr@2: IMPORT_C void RunFindDialogL(); williamr@2: williamr@2: /** williamr@2: * Runs the find dialog again. williamr@2: */ williamr@2: IMPORT_C void RunFindAgainDialogL(); williamr@2: williamr@2: /** williamr@2: * Runs the replace dialog. williamr@2: * williamr@2: * Enables the user to specify the text to be searched for and the williamr@2: * replacement for that text. Can replace single or multiple occurances. williamr@2: */ williamr@2: IMPORT_C void RunReplaceDialogL(); williamr@2: williamr@2: /** williamr@2: * Sets up the find model, the find list and the replace list ready williamr@2: * for find or replace operations. williamr@2: * williamr@2: * @param aModel The find model to be used. williamr@2: * @param aFindList The find list to be used. williamr@2: * @param aReplaceList The replace list to be used. williamr@2: */ williamr@2: IMPORT_C void InitFindL(SEdwinFindModel*& aModel, williamr@2: CDesCArray*& aFindList, williamr@2: CDesCArray*& aReplaceList); williamr@2: williamr@2: /** williamr@2: * Searches for text. williamr@2: * williamr@2: * Returns @c ETrue if text is found. williamr@2: * williamr@2: * Used by @c RunFindDialogL(), @c RunFindAgainDialogL() and williamr@2: * @c RunReplaceDialogL() methods. williamr@2: * williamr@2: * @return @c ETrue if the text is found @c EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool DoFindL(); williamr@2: williamr@2: /** williamr@2: * Runs a dialog enabling a user to set one of text alignment, spacing or williamr@2: * borders. williamr@2: * williamr@2: * Depending on the user's choice another dialog is run enabling them to williamr@2: * set their requirements. williamr@2: * williamr@2: * @param aCommand User selected command. One of @c EEikCmdParaAlign, williamr@2: * @c EEikCmdParaSpacing or @c EEikCmdParaBorder. williamr@2: */ williamr@2: IMPORT_C void RunParaDialogsL(TInt aCommand); williamr@2: williamr@2: /** williamr@2: * Runs a dialog enabling a user to do pagination. williamr@2: * williamr@2: * @param aPrintSetup The printer setup. williamr@2: * @param aCharsPerPage Page table (array of characters per page). williamr@2: * @return @c ETrue if pagination is succesfull @c EFalse otherwise. williamr@2: */ williamr@2: IMPORT_C TBool RunPaginateDialogL(CPrintSetup* aPrintSetup, williamr@2: CArrayFix* aCharsPerPage); williamr@2: williamr@2: public: // other functions williamr@2: williamr@2: /** williamr@2: * Gets the global text that is being edited. williamr@2: * williamr@2: * @return The global text being edited. williamr@2: */ williamr@2: IMPORT_C CGlobalText* GlobalText() const; williamr@2: williamr@2: /** williamr@2: * Applies the paragraph formatting and updates the screen layout. williamr@2: * williamr@2: * The attributes which are set in the mask are read from @c aParaMask. williamr@2: * The attributes which are not set in the mask are not changed. williamr@2: * williamr@2: * @param aParaFormat Contains the new paragraph formatting values williamr@2: * to apply. williamr@2: * @param aParaMask Bitmask specifying the paragraph format attributes williamr@2: * to change. williamr@2: */ williamr@2: IMPORT_C void ApplyParaFormatL(CParaFormat* aParaFormat, williamr@2: TParaFormatMask& aParaMask); williamr@2: williamr@2: /** williamr@2: * Applies the character formatting and updates the screen layout. williamr@2: * williamr@2: * The attributes which are set in the mask are read from @c aCharFormat. williamr@2: * The attributes which are not set in the mask are not changed. williamr@2: * williamr@2: * @param aCharFormat Contain the new character formatting values williamr@2: * to apply. williamr@2: * @param aCharMask Bitmask specifying the character format attributes williamr@2: * to change. williamr@2: */ williamr@2: IMPORT_C void ApplyCharFormatL(TCharFormat& aCharFormat, williamr@2: TCharFormatMask& aCharMask); williamr@2: williamr@2: /** williamr@2: * Toggles format in the current selection. williamr@2: * williamr@2: * For a global text editor the format change is applied globally. williamr@2: * For a rich text editor where there is no selection the format williamr@2: * change is applied to the word at the current cursor position. williamr@2: * williamr@2: * @param aFontFlag The format attribute toggle. See the williamr@2: * @c TFontStyleFlags enum. williamr@2: */ williamr@2: IMPORT_C void BoldItalicUnderlineEventL(TInt aFontFlag); williamr@2: williamr@2: /** williamr@2: * Update the buttons in the button group so that they reflect the williamr@2: * formatting of the global text object. williamr@2: */ williamr@2: IMPORT_C void UpdateButtonGroup(); williamr@2: williamr@2: public: // from CCoeControl williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Completes construction of the global text editor from a resource file. williamr@2: * williamr@2: * The editor's paragraph and character formatting is set to default williamr@2: * values. williamr@2: * williamr@2: * See the @c GTXTED resource struct williamr@2: * williamr@2: * @param aReader A reader positioned for reading from a @c GTXTED williamr@2: * resource. williamr@2: */ williamr@2: IMPORT_C void ConstructFromResourceL(TResourceReader& aReader); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Handles key events. williamr@2: * williamr@2: * @param aKeyEvent The key code and modifier williamr@2: * @param aType The type of the event: e.g. Key up. williamr@2: * @return @c EKeyWasConsumed if the event was handled. williamr@2: * @c EKeyWasNotConsumed if the event was not handled. williamr@2: */ williamr@2: IMPORT_C TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, williamr@2: TEventCode aType); williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Sets the editor ready for drawing. williamr@2: */ williamr@2: IMPORT_C void ActivateL(); williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Handles pointer events. williamr@2: * williamr@2: * @param aPointerEvent Pointer to an event that is to be handled. williamr@2: */ williamr@2: IMPORT_C void HandlePointerEventL(const TPointerEvent& aPointerEvent); williamr@2: williamr@2: public: // from CEikEdwin williamr@2: williamr@2: /** williamr@2: * From @c CEikEdwin. williamr@2: * williamr@2: * Gets the width of a line cursor in pixels. williamr@2: * williamr@2: * @return The width of the line cursor in pixels. williamr@2: */ williamr@2: IMPORT_C TInt LineCursorWidth() const; williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Completes the second-phase construction of a @c CEikEdwin object. williamr@2: * This protected function is called by @c ConstructL() and williamr@2: * @c ConstructFromResourceL() after the @c Edwin’s size, flags and williamr@2: * text limit have been set. Derived classes should call either this williamr@2: * function or @c CEikEdwin’s @c ConstructL() or williamr@2: * @c ConstructFromResourceL() functions during their construction williamr@2: * before initialising their own members. williamr@2: */ williamr@2: IMPORT_C void BaseConstructL(); williamr@2: williamr@2: protected: //from CCoeControl williamr@2: williamr@2: /** williamr@2: * From @c CCoeControl. williamr@2: * williamr@2: * Writes the internal state to the specified stream. Does nothing williamr@2: * in release mode. williamr@2: * williamr@2: * @param aWriteStream The stream to write to. williamr@2: */ williamr@2: IMPORT_C void WriteInternalStateL(RWriteStream& aWriteStream) const; williamr@2: williamr@2: private: // from CoeControl williamr@2: williamr@2: IMPORT_C void Reserved_2(); williamr@2: williamr@2: private: williamr@2: williamr@2: /** williamr@2: * From CAknControl williamr@2: */ williamr@2: IMPORT_C void* ExtensionInterface( TUid aInterface ); williamr@2: williamr@2: private: // from CEikEdwin williamr@2: williamr@2: IMPORT_C void Reserved_3(); williamr@2: williamr@2: private: williamr@2: williamr@2: void CheckDocumentNotEmptyL(); williamr@2: williamr@2: void CreateFindModelL(); williamr@2: williamr@2: void GetTextForFindL(); williamr@2: williamr@2: protected: williamr@2: williamr@2: /** williamr@2: * Stores the object's global character formatting. williamr@2: */ williamr@2: CCharFormatLayer* iCharFormatLayer; williamr@2: williamr@2: /** williamr@2: * Stores the object's global paragraph formatting. williamr@2: */ williamr@2: CParaFormatLayer* iParaFormatLayer; williamr@2: williamr@2: private: williamr@2: williamr@2: CDesCArray* iFindList; williamr@2: williamr@2: CDesCArray* iReplaceList; williamr@2: williamr@2: SEdwinFindModel* iFindModel; williamr@2: williamr@2: CEikDialogToolBar* iButGroup; williamr@2: williamr@2: TInt iLineCursorWidth; williamr@2: williamr@2: CFbsBitmap* iLineCursor; williamr@2: williamr@2: TInt iFontControlFlags; williamr@2: williamr@2: TInt iFontNameFlags; williamr@2: williamr@2: CGraphicsDevice* iGraphicsDevice; williamr@2: williamr@2: TInt iSpare[4]; williamr@2: }; williamr@2: williamr@2: williamr@2: #endif // __EIKGTED_H__ williamr@2: williamr@2: // enf of file