Update contrib.
2 * Copyright (c) 1997-2009 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.
30 #include <techview/eikpprob.h>
31 #include <techview/eikedwob.h>
32 #include <techview/eikbutb.h>
33 #include <techview/eikrted.h>
40 class CCharFormatLayer;
41 class CParaFormatLayer;
44 class CTextPageRegionPrinter;
46 class CWordToolBarUpdate;
47 class CWordTextListBox;
48 class CEikColumnListBox;
49 class CWordSnakingColumnListBox;
50 class CEikCommandButtonBase;
56 const TUid KUidPrinterDevice={0x1000010b};
58 const CParagraphStyle::TApplyParaStyleMode KApplyParaStyleMode=CParagraphStyle::ERetainSpecificCharFormat;
59 const TInt KThinBorderThicknessInTwips=20;
60 const TInt KThickBorderThicknessInTwips=30;
62 const TInt KVersionAppConfigurationData=1;
64 const TInt KFileBusyInitialDelayInMicroSeconds=1000000;
66 # if defined(__GCC32__)
67 const TInt KClippedTextCharacter=0;
69 const TChar KClippedTextCharacter=0;
72 class CWordAppUi : public CEikAppUi, public MCoeControlObserver, public MEikEdwinObserver, public MPrintPreviewDialogObserver
78 friend class CWordToolBarUpdate;
84 void GetUiData(TWordUiData& aData)const;
86 inline void SetReadOnly(TBool aReadOnly);
87 inline void NotifyNewTextL();
105 EVisibilityDependant,
106 EVisibilityIndependant
115 EFNameBoxPopped =0x001,
116 EFHeightBoxPopped =0x002,
117 EBordersPopped =0x004,
118 EWysiwygModeOn =0x008,
119 EStyleBoxPopped =0x010,
120 EAlignBoxPopped =0x020,
135 ENpcTabsVisible =0x001,
136 ENpcSpacesVisible =0x002,
137 NpcParagraphsVisible =0x004,
138 NpcForcedLineBreaksVisible =0x008,
139 NpcSoftHyphensVisible =0x010,
140 NpcHardHyphensVisible =0x020,
141 NpcHardSpacesVisible =0x040
143 enum TPicturePrefFlags
145 ESketchAsGlass =0x001,
146 EGraphAsGlass =0x002,
147 EConfirmDeleteObject=0x004
150 enum TConfirmationText
158 TKeyResponse HandleKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
159 void SetAndDrawFocus(TBool aFocus);
160 virtual TCoeInputCapabilities InputCapabilities() const;
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);
171 // from MCoeControlObserver
172 virtual void HandleControlEventL(CCoeControl* aControl,TCoeEvent aEventType);
174 // from MEikEdwinObserver
175 virtual void HandleEdwinEventL(CEikEdwin* aEdwin,TEdwinEvent aEventType);
177 // from MEikMenuObserver
178 virtual void DynInitMenuPaneL(TInt aMenuId,CEikMenuPane* aMenuPane);
180 // from MPrintPreviewDialogObserver
181 virtual TBool PageSetupChangedL(CPrintSetup* aPrintSetup,TInt& aNumPagesInDoc);
182 virtual TBool RunPrintRangeDialogL(CPrintSetup* aPrintSetup,TInt& aNumPagesInDoc);
183 void RunPrintDialogL();
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;
203 // paginate/print/preview stuff
204 void RunPageSetupDialogL();
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);
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);
242 inline void SetPaginationOutOfDate(TBool aPaginationOutOfDate);
243 inline TBool PaginationOutOfDate()const;
248 void UpdateToolbarsL();
249 void SetParaAlignmentL(TInt aCommand);
250 void CmdChangeAlignmentL();
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;
261 TFileName BitmapStore() const;
262 void AppendAndTrim(TDes& aTargetBuf,const TDesC& aSourceBuf);
263 TBool DocHasChanged() const;
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,
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);
289 CPrintSetup* iPrintSetup;
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;
301 CWordToolBarUpdate* iToolBarUpdate;
303 __MUTABLE HBufC8* iConfirmationText; // Pre-allocated QueryWin title text- for reporting.
304 TPrintParameters iPrintParameters;
305 TBool iPaginateDialogCalled;
306 TBool iPaginationOutOfDate;
308 TUint16 iPicturePrefs;
311 CWordTest* iTest; // test functions and data (GA)
323 void InternalizeL(RReadStream& aStream);
324 void ExternalizeL(RWriteStream& aStream)const;
326 TUint16 iNpcVisibility; // non-printing characters visibility
327 TUint16 iPicturePrefs; // new objects as icon/glass
328 TBool iToolbandVisibility;
329 TBool iToolbarVisibility;
336 class CWordToolBarUpdate : public CActive
348 static CWordToolBarUpdate* NewL(CWordAppUi& aAppUi);
349 ~CWordToolBarUpdate();
351 void Start(TUpdateType aUpdateType);
353 CWordToolBarUpdate(CWordAppUi& aAppUi);
358 TUpdateType iUpdateType;
362 TInt iFontHeightInTwips;
363 TFontStrokeWeight iStrokeWeight;
364 TFontPosture iPosture;
368 CParaFormat::TAlignment iAlignment;
369 TBool iBulletPresent;
370 TBool iBordersPresent;
373 #include "WPAPPUI.INL"