os/textandloc/textrendering/word/SRC/WPAPPUI.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 __WORD_H__
    20 #define __WORD_H__
    21 
    22 #include <txtfrmat.h>
    23 #include <txtrich.h>
    24 #include <txtstyle.h>
    25 #include <prninf.h>
    26 #include <badesca.h>
    27 #include <coecobs.h>
    28 #include <apgdoor.h>
    29 #include <eikappui.h>
    30 #include <techview/eikpprob.h>
    31 #include <techview/eikedwob.h>
    32 #include <techview/eikbutb.h>
    33 #include <techview/eikrted.h>
    34 #include <gulicon.h>
    35 #include "WPTEXTED.H"
    36 #include "WPDOC.H"
    37 #include "WNGMODEL.H"
    38 
    39 class CRichText;
    40 class CCharFormatLayer;
    41 class CParaFormatLayer;
    42 class CStreamStore;
    43 class CPrintSetup;
    44 class CTextPageRegionPrinter;
    45 class CWordDocument;
    46 class CWordToolBarUpdate;
    47 class CWordTextListBox;
    48 class CEikColumnListBox;
    49 class CWordSnakingColumnListBox;
    50 class CEikCommandButtonBase;
    51 class CWordTest;
    52 
    53 /**
    54 @internalComponent
    55 */
    56 const TUid KUidPrinterDevice={0x1000010b};
    57 
    58 const CParagraphStyle::TApplyParaStyleMode KApplyParaStyleMode=CParagraphStyle::ERetainSpecificCharFormat;
    59 const TInt KThinBorderThicknessInTwips=20;
    60 const TInt KThickBorderThicknessInTwips=30;
    61 
    62 const TInt KVersionAppConfigurationData=1;
    63 
    64 const TInt KFileBusyInitialDelayInMicroSeconds=1000000;
    65 
    66 # if defined(__GCC32__)
    67 	const TInt KClippedTextCharacter=0;
    68 # else
    69 	const TChar KClippedTextCharacter=0;
    70 #endif
    71 
    72 class CWordAppUi : public CEikAppUi, public MCoeControlObserver, public MEikEdwinObserver, public MPrintPreviewDialogObserver
    73 /**
    74 @internalComponent
    75 */
    76     {
    77 
    78 	friend class CWordToolBarUpdate;
    79 public:
    80     CWordAppUi();
    81     ~CWordAppUi();
    82     void ConstructL();
    83 //
    84 	void GetUiData(TWordUiData& aData)const;
    85 	void SetUiData();
    86 	inline void SetReadOnly(TBool aReadOnly);
    87 	inline void NotifyNewTextL();
    88 //
    89 private:
    90 	enum TButtons
    91 		{
    92 		EAll,
    93 		EStyleName,
    94 		EFontName,
    95 		EFontHeight,
    96 		EBold,
    97 		EItalic,
    98 		EUnderline,
    99 		EAlignment,
   100 		EBullet,
   101 		EBorder
   102 		};
   103 	enum TToolBarUpdate
   104 		{
   105 		EVisibilityDependant,
   106 		EVisibilityIndependant
   107 		};
   108 	enum TToolBarType
   109 		{
   110 		EToolBar,
   111 		EToolBand
   112 		};
   113 	enum TWordFlags
   114 		{
   115 		EFNameBoxPopped		=0x001,
   116 		EFHeightBoxPopped	=0x002,
   117 		EBordersPopped		=0x004,
   118 		EWysiwygModeOn		=0x008,
   119 		EStyleBoxPopped 	=0x010,
   120 		EAlignBoxPopped		=0x020,
   121 		};
   122 	enum TBorderFlags
   123 		{
   124 		ESingleFull=3,
   125 		ESingleTop,
   126 		ESingleBottom,
   127 		ESingleTopAndBottom,
   128 		EDoubleFull,
   129 		EDoubleTop,
   130 		EDoubleBottom,
   131 		ENullBorder
   132 		};			 
   133 	enum TNpcFlags
   134 		{
   135 		ENpcTabsVisible				=0x001,
   136 		ENpcSpacesVisible			=0x002,
   137 		NpcParagraphsVisible		=0x004,
   138 		NpcForcedLineBreaksVisible	=0x008,
   139 		NpcSoftHyphensVisible		=0x010,
   140 		NpcHardHyphensVisible		=0x020,
   141 		NpcHardSpacesVisible		=0x040
   142 		};
   143 	enum TPicturePrefFlags
   144 		{
   145 		ESketchAsGlass		=0x001,
   146 		EGraphAsGlass		=0x002,
   147 		EConfirmDeleteObject=0x004
   148 		};
   149 
   150 	enum TConfirmationText
   151 		{
   152 		ERevertTitle,
   153 		ERevertText,
   154 		};
   155 private:
   156 	//
   157 	// from CCoeAppUi
   158 	TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
   159 	void SetAndDrawFocus(TBool aFocus);
   160 	virtual TCoeInputCapabilities InputCapabilities() const;
   161 	//
   162 	// from CEikAppUi
   163 	virtual void HandleCommandL(TInt aCommand);
   164 	virtual void HandleModelChangeL();
   165 	virtual TBool ProcessCommandParametersL(TApaCommand aCommand,TFileName& aDocumentName,const TDesC8& aTail);
   166 	virtual void OpenFileL(const TDesC& aFileName);
   167 	virtual void CreateFileL(const TDesC& aFileName);
   168 	// overload to provide template functionality
   169 	virtual void CreateFileL(const TDesC& aFileName, const TDesC& aTemplateFileName);
   170 	//
   171 	// from MCoeControlObserver
   172 	virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
   173 	//
   174 	// from MEikEdwinObserver
   175 	virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
   176 	//
   177 	// from MEikMenuObserver
   178 	virtual void DynInitMenuPaneL(TInt aMenuId,CEikMenuPane* aMenuPane);
   179 	//
   180 	// from MPrintPreviewDialogObserver
   181 	virtual TBool PageSetupChangedL(CPrintSetup* aPrintSetup,TInt& aNumPagesInDoc);
   182 	virtual TBool RunPrintRangeDialogL(CPrintSetup* aPrintSetup,TInt& aNumPagesInDoc);
   183 	void RunPrintDialogL();
   184 	void DoPrintL();
   185 	//
   186 	// in WPAPFILE.CPP
   187 	void CmdFileNewL();
   188 	void CmdFileOpenL();
   189 	void CmdFileSaveL();
   190 	void CmdFileSaveAsL();
   191 	void CmdFileRevertL();
   192 	void CmdFileSaveAsTemplateL();
   193 	void CmdFileDeleteTemplateL();
   194 	void CmdFileTextImportL();
   195 	void CmdFileTextExportL()const;
   196 	void CmdFileHtmlImportL();
   197 	void DoFileOpenL(const TFileName& aFileName);
   198 	void DoFileSaveL(TBool aEchoInfoMessage);
   199 	TFileName CurrentFilePath()const;
   200 	void SetInitialPathL(TFileName& aFileName)const;
   201 	TFileName NormalTemplateFileNameL()const;
   202 	//
   203 	// paginate/print/preview stuff
   204 	void RunPageSetupDialogL();
   205 	//
   206 	// in WPAPPTBR.CPP
   207 	void UpdateToolBarAndBandL(TInt aCommand);
   208 	TBool ToggleToolbarControlL(CEikToolBar& aToolBar);
   209 	void UpdateToolbandButtonsL(TToolBarUpdate aUpdate=EVisibilityDependant);
   210 	void UpdateCharFormatButtonsL();
   211 	void UpdateParaFormatButtonsL();
   212 	void UpdateToolBandFontNameButtonL(TDesC& NewFontName);
   213 	void UpdateToolBandFontNameButtonL(TDes& aNewFontName);
   214 	void UpdateToolBandFontHeightButtonL(const TInt aNewFontHeight);
   215 	void UpdateStyleButtonL();
   216 	void UpdateAlignButtonL(RTmParFormat::TAlignment aNewAlignment);
   217 	TInt AlignmentBitmapId(TInt aId)const;
   218 	void UpdateBorderButtonL(TBool aBordersPresent);
   219 	void UpdateFileNameLabelL();
   220 	void UpdateToolBandButton(TInt aCommand,CEikButtonBase::TState aNewState);
   221 	//
   222 	// in WPAPPUT.CPP
   223 	TBool RunPaginationDialogL();
   224 	void RunPreviewDialogL();
   225 	void RunGoToDialogL();
   226 	void RunViewPreferencesDialogL();
   227 	void RunOutlineDialogL();
   228 	void RunObjectPreferencesDialogL();
   229 	TBool ConfirmationDialogL(TConfirmationText aTitle,TConfirmationText aText)const;
   230 	void ReformatDueToStateChangeL();
   231 	inline CRichText* Text()const;
   232 	inline CWordDocument* Document()const;
   233 	inline CTextPageRegionPrinter& PageRegionPrinter()const;
   234 	inline TBool WysiwygModeIsSet()const;
   235 	inline TBool ToggleWysiwygMode();
   236 	inline TBool SketchAsGlass()const;
   237 	inline void SetSketchAsGlass(TBool aSketchAsGlass);
   238 	inline TBool GraphAsGlass()const;
   239 	inline void SetGraphAsGlass(TBool aGraphAsGlass);
   240 	TKeyResponse ProcessStyleHotKeyL(const TChar& aKey);
   241 	//
   242 	inline void SetPaginationOutOfDate(TBool aPaginationOutOfDate);
   243 	inline TBool PaginationOutOfDate()const;
   244 	void CreateEdwinL();
   245 	void SetEdwinL();
   246 	void ResetEdwinL();
   247 	void ResetPrint();
   248 	void UpdateToolbarsL();
   249 	void SetParaAlignmentL(TInt aCommand);
   250 	void CmdChangeAlignmentL();
   251 	void SetBulletL();
   252 	void RunSelectBulletDialogL();
   253 	void CreateDefaultBulletL();
   254 	void ZoomL(TInt aZoomCmd);
   255 	void AlterParaStylesL(TInt aCommand);
   256 	void InsertCharacterL(TChar aCharacter);
   257 	void CmdWrapToScreenL();
   258 	void UpdatePageLayoutL();
   259 	TInt PageLayoutWidth() const;
   260 	void ResetFlags();
   261 	TFileName BitmapStore() const;
   262 	void AppendAndTrim(TDes& aTargetBuf,const TDesC& aSourceBuf);
   263 	TBool DocHasChanged() const;
   264 	//
   265 	// in WPLBOX.CPP
   266 	CDesCArray* BuildFontNameListLC() const;
   267 	CDesCArray* BuildStyleNameListLC() const;
   268 	CDesCArray* BuildAlignListLC(CArrayPtrFlat<CGulIcon>& aIcons) const;
   269 	TInt FindStyleName(CDesCArray* aStyleList) const;
   270 	TInt FindFontName(CDesCArray* aFontList) const;
   271 	TInt FindAlignmentL() const;
   272 	TInt NearestHeightIndex() const;
   273 	CDesCArray* UpdateHeightListLC();
   274 	void LaunchFontsPopupL();
   275 	void LaunchStylesPopupL();
   276 	void LaunchFontHeightsPopupL();
   277 	void LaunchBordersPopupL();
   278 	void LaunchAlignPopupL();
   279 	void DestroyPopoutLBox();
   280 	void DoCreatePopoutL(CDesCArray* aText,TInt aIndex,CEikCommandButtonBase* aLaunchingButton,TToolBarType aType,
   281 								TBool aLimitWidth);
   282 	void DoCreateBitmapPopoutL(CDesCArray* aText, CArrayPtrFlat<CGulIcon>* aIcons, TInt aIndex,
   283 							   CEikCommandButtonBase* aControl, TToolBarType aType);
   284 	void DoCreateMcBitmapPopoutL(CDesCArray* aText, CArrayPtrFlat<CGulIcon>* aBitmaps, TInt aIndex,
   285 								CEikCommandButtonBase* aLaunchingButton, TInt aColumnWidth, const TRect& aRect);
   286 
   287 private:
   288 //
   289 	CPrintSetup* iPrintSetup;
   290 	CWordModel* iModel;
   291 //
   292 	CWordTextEditor* iRichEd;
   293 	CArrayFixFlat<TInt>* iTwipsList;
   294 	CWordTextListBox* iPopoutListBox;
   295 	CEikColumnListBox* iBitmapPopout;
   296 	CWordSnakingColumnListBox* iMcBitmapPopout;
   297 	RTmParFormat::TAlignment iAlignment;
   298 	TBool iBorderPresent;
   299 	TZoomFactor iAppZoom;
   300 	TBullet* iBullet;
   301 	CWordToolBarUpdate* iToolBarUpdate;
   302 //
   303 	__MUTABLE HBufC8* iConfirmationText;  // Pre-allocated QueryWin title text- for reporting.
   304 	TPrintParameters iPrintParameters;	
   305 	TBool iPaginateDialogCalled;
   306 	TBool iPaginationOutOfDate;
   307 	TUint16 iWordFlags;
   308 	TUint16 iPicturePrefs;
   309  	TUint iBorderFlags;
   310 
   311 	CWordTest* iTest;			// test functions and data (GA)
   312 	};
   313 
   314 
   315 class TWordUiData
   316 /**
   317 @internalComponent
   318 */
   319 	{
   320 public:
   321 	TWordUiData();
   322 	void Reset();
   323 	void InternalizeL(RReadStream& aStream);
   324 	void ExternalizeL(RWriteStream& aStream)const;
   325 public:
   326 	TUint16 iNpcVisibility;  // non-printing characters visibility
   327 	TUint16 iPicturePrefs;  // new objects as icon/glass
   328 	TBool iToolbandVisibility;
   329 	TBool iToolbarVisibility;
   330 	TInt iCursorPos;
   331 	TInt iZoomFactor;
   332 	TBool iWysiwygOn;
   333 	};
   334 
   335 
   336 class CWordToolBarUpdate : public CActive
   337 /**
   338 @internalComponent
   339 */
   340 	{
   341 public:
   342 	enum TUpdateType
   343 		{
   344 		EFullUpdate,
   345 		ECharFormatUpdate
   346 		};
   347 public:
   348 	static CWordToolBarUpdate* NewL(CWordAppUi& aAppUi);
   349 	~CWordToolBarUpdate();
   350 	void RunL();
   351 	void Start(TUpdateType aUpdateType);
   352 private:													
   353 	CWordToolBarUpdate(CWordAppUi& aAppUi);
   354 	void DoCancel();
   355 private:													
   356 	CWordAppUi& iAppUi;
   357 	TInt iCount;
   358 	TUpdateType iUpdateType;
   359 public:
   360 	//
   361 	// Character format
   362 	TInt iFontHeightInTwips;
   363 	TFontStrokeWeight iStrokeWeight;
   364 	TFontPosture iPosture;
   365 	TBool iUnderline;
   366 	//
   367 	// Paragraph format
   368 	CParaFormat::TAlignment iAlignment;
   369 	TBool iBulletPresent;
   370 	TBool iBordersPresent;
   371 	};
   372 
   373 #include "WPAPPUI.INL"
   374 
   375 #endif