textrendering/word/SRC/WPSTYLE.H
changeset 0 1fb32624e06b
equal deleted inserted replaced
-1:000000000000 0:1fb32624e06b
       
     1 /*
       
     2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     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".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __WPSTYLE_H__
       
    20 #define __WPSTYLE_H__
       
    21 
       
    22 #include <frmtlay.h>
       
    23 #include <badesca.h>
       
    24 #include <techview/eikdialg.h>
       
    25 #include <eikmobs.h>
       
    26 #include <techview/eikedwin.h>
       
    27 #include <techview/eikchred.h>
       
    28 
       
    29 
       
    30 // forward references
       
    31 class CRichText;
       
    32 class CStyleList;
       
    33 class CWordAppUi;
       
    34 class CParagraphStyle;
       
    35 class CEikColumnListBox;
       
    36 class MUnifiedEditor;
       
    37 
       
    38 /**
       
    39 @internalComponent
       
    40 */
       
    41 typedef CArrayFixFlat<TChar> CStyleShortCutList;
       
    42 
       
    43 class TWordStyleGalleryData
       
    44 /**
       
    45 @internalComponent
       
    46 */
       
    47 	{
       
    48 public:
       
    49 //	TWordStyleGalleryData();
       
    50 	TWordStyleGalleryData(CRichText& aText,
       
    51 						CStyleList& aStyleList,
       
    52 						CStyleShortCutList& aHotKeyList,
       
    53 						TChar& aNormalStyleHotKey,
       
    54 						CPrintSetup& aPrintSetup,
       
    55 						TBool& aApplyStyle,
       
    56 						const TCursorSelection& aSelection,
       
    57 						MUnifiedEditor& aEditor);
       
    58 public:
       
    59 	CRichText& iText;
       
    60 	CStyleList& iStyleList;
       
    61 	CStyleShortCutList& iHotKeyList;
       
    62 	TChar& iNormalStyleHotKey;
       
    63 	CPrintSetup& iPrintSetup;
       
    64 	TBool& iApplyStyle;
       
    65 	const TCursorSelection& iSelection;
       
    66 	MUnifiedEditor& iEditor;
       
    67 	};
       
    68 
       
    69 class CWordStyleGallery : public CEikDialog
       
    70 /**
       
    71 @internalComponent
       
    72 */
       
    73 	{
       
    74 private:
       
    75 	CWordStyleGallery(TWordStyleGalleryData& aInfo);
       
    76 	void ConstructL();
       
    77 public:
       
    78 	~CWordStyleGallery();
       
    79 	static CWordStyleGallery* NewLC(TWordStyleGalleryData& aInfo);
       
    80 	static CWordStyleGallery* NewL(TWordStyleGalleryData& aInfo);	
       
    81 	
       
    82 private: // framework
       
    83 	void PreLayoutDynInitL();
       
    84 	void PostLayoutDynInitL();
       
    85 	void HandleControlStateChangeL(TInt aControlId);
       
    86 	TBool OkToExitL(TInt aButtonId);
       
    87 private:
       
    88 	void SetDeleteButton();
       
    89 	void SetTextForCancelButtonL();
       
    90 	void StyleL(TInt aCommand);
       
    91 	void MergeArraysL();
       
    92 	CEikColumnListBox* ListBox() const;
       
    93 	void DoCalcColumnWidthsL();
       
    94 	void AppendL(TInt aIndex);
       
    95 	void StyleDescriptionL(TInt aIndex);
       
    96 	void FillBufferL(const CParaFormatLayer& aParaFormatLayer);
       
    97 	void DrawEdwinL();
       
    98 	void AppendDescriptionL(TTextFormatAttribute aAttribute,const CParaFormat& aFormat,const TParaFormatMask& aMask);
       
    99 	void AppendDescriptionL(TTextFormatAttribute aAttribute,const TParaFormatMask& aMask);
       
   100 	void DoAppendDescriptionL(const TDesC& aText);
       
   101 private:
       
   102 	//
       
   103 	TWordStyleGalleryData& iData;
       
   104 	//
       
   105 	CDesCArray* iStyleNameList;
       
   106 	CDesCArray* iStyleNameKeyList;
       
   107 	TParagraphStyleName iNormalName;
       
   108 	TBuf<20> iHotKey;
       
   109 	//
       
   110 	CDesCArray* iStyleDescriptor;
       
   111 	HBufC* iCurrentDescription;
       
   112 	};
       
   113 
       
   114 
       
   115 class MWordHotkeyValidator
       
   116 /**
       
   117 @internalComponent
       
   118 */
       
   119 	{
       
   120 public: // class specific
       
   121 	virtual TBool ValidateHotkey(TKeyEvent& aKeyEvent)=0;
       
   122 	};
       
   123 
       
   124 
       
   125 class CWordStyleHotKeyEditor : public CEikCharEditor
       
   126 /**
       
   127 @internalComponent
       
   128 */
       
   129 	{
       
   130 public: // class specific
       
   131 	CWordStyleHotKeyEditor(MWordHotkeyValidator* aValidator);
       
   132 public: // virtual overridden
       
   133 	virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
       
   134 private:
       
   135 	MWordHotkeyValidator* iValidator;
       
   136 	};
       
   137 
       
   138 
       
   139 class CWordStyleFormatDialog : public CEikDialog, public MEikMenuObserver, public MWordHotkeyValidator
       
   140 /**
       
   141 @internalComponent
       
   142 */
       
   143 	{
       
   144 public:
       
   145 	CWordStyleFormatDialog(const TParagraphStyleName& aNormalName,const TChar iNormalStyleHotkey,
       
   146 		const CStyleList& aStyleList,const TInt aButton,CRichText& aText,CPrintSetup* aPrintSetup,
       
   147 		CArrayFix<TChar>& aHotKeyList,TChar& aChar,CParagraphStyle* aParagraphStyle=NULL,TBool aNormalStyle=0);
       
   148 	~CWordStyleFormatDialog();
       
   149 private:
       
   150 	enum TStyleFormatDialog {
       
   151 		ETabsDialog=EEikCmdParaTabs,
       
   152 		EAlignmentDialog=EEikCmdParaAlign,
       
   153 		EIndentsDialog=EEikCmdParaIndent,
       
   154 		ELineSpacingDialog=EEikCmdParaSpacing,
       
   155 		EBordersDialog=EEikCmdParaBorder
       
   156 		};
       
   157 private: // framework
       
   158 	void PreLayoutDynInitL();
       
   159 	void HandleControlStateChangeL(TInt aControlId);
       
   160 	void HandleInteractionRefused(TInt aControlId);
       
   161 	void ProcessCommandL(TInt aCommand);
       
   162 	TBool OkToExitL(TInt aButtonId);
       
   163 	SEikControlInfo CreateCustomControlL(TInt aControlType);
       
   164 	//
       
   165 	void RunDialogL(TStyleFormatDialog aFunction);
       
   166 	CParaFormatLayer* GetParaLayerAndFormattingL(CParaFormat& aFormat,TParaFormatMask& aMask);
       
   167 	void DoGetParaFormatL(CParaFormat& aFormat,TParaFormatMask& aMask,const CParaFormatLayer& aLayer);
       
   168 	void RunFontDialogL();
       
   169 	void SetBulletL();
       
   170 	void RunSelectBulletDialogL();
       
   171 	void CreateDefaultBulletL();
       
   172 	void SetEmphasis(CCoeControl* aMenuControl,TBool aEmphasis);
       
   173 	TBool HotkeyConflict(TChar aHotkey);
       
   174 	//
       
   175 	// from MWordHotkeyValidator
       
   176 	TBool ValidateHotkey(TKeyEvent& aKeyEvent);
       
   177 private:
       
   178 	const CStyleList& iStyleList;
       
   179 	TBullet* iBullet;
       
   180 	CRichText* iText;
       
   181 	TInt iButton;
       
   182 	CParagraphStyle* iParagraphStyle;	
       
   183 	CParagraphStyle* iNewParagraphStyle;	
       
   184 	CParaFormatLayer* iParaFormatLayer;
       
   185 	CCharFormatLayer* iCharFormatLayer;
       
   186 	TBool iNormalStyle;
       
   187 	TDes* iName;
       
   188 	CPrintSetup* iPrintSetup;
       
   189 	CArrayFix<TChar>* iHotKeyList;
       
   190 	const TChar iNormalStyleHotkey;
       
   191 	const TParagraphStyleName& iNormalName;
       
   192 	TChar& iChar;
       
   193 	TInt iOutline;
       
   194 	};
       
   195  
       
   196 class CWordDeleteStyleDialog : public CEikDialog  
       
   197 /**
       
   198 @internalComponent
       
   199 */
       
   200 	{
       
   201 public:
       
   202 	CWordDeleteStyleDialog(TDesC* aName);
       
   203 private: // framework
       
   204 	void PreLayoutDynInitL();
       
   205 	TBool OkToExitL(TInt aButton);
       
   206 private:
       
   207 	TDesC* iName;
       
   208 	};
       
   209 
       
   210 
       
   211 #endif