1 frmtview.h |
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // 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 |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __FRMTVIEW_H__ |
|
17 #define __FRMTVIEW_H__ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 #include <w32std.h> |
|
22 #include <frmtlay.h> |
|
23 #include <frmframe.h> |
|
24 |
|
25 /** |
|
26 Internal class - not part of interface |
|
27 @internalComponent |
|
28 */ |
|
29 class RScreenDisplay |
|
30 |
|
31 { |
|
32 public: |
|
33 enum TClippingRects |
|
34 { |
|
35 EFClipTextArea = 0x0001, |
|
36 EFClipLineCursor = 0x0002, |
|
37 EFClipExtendedTextArea = 0x0004, |
|
38 EFClipViewRect = 0x0008, |
|
39 EFClipExtendedViewRect = 0x0010, |
|
40 EFClipInvalid = 0x0200, |
|
41 EFClipAllFlags = 0xFFFF |
|
42 }; |
|
43 public: |
|
44 RScreenDisplay(TDrawTextLayoutContext* const aDrawTextLayoutContext); |
|
45 void Close(); |
|
46 void Destroy(); |
|
47 void SetWindowsServer(RWsSession *aSession) { iSession = aSession; } |
|
48 void SetWindowGroup(RWindowGroup *aWin) { iGroupWin = aWin; } |
|
49 |
|
50 void SetWindow(RWindow *aWin); |
|
51 RWindow* Window() const { return iWin; } |
|
52 void SetBitmapContext(CBitmapContext* aGc) { iGc = aGc; } |
|
53 CBitmapContext* BitmapContext() const { return iGc; } |
|
54 RWsSession* WindowServerSession() { return iSession; } |
|
55 void SetGraphicsDeviceL(CBitmapDevice *aGd); |
|
56 CBitmapDevice* BitmapDevice() const {return iGd; } |
|
57 void CreateContextL(CBitmapDevice *aGd); |
|
58 void CreateContextL(); |
|
59 void SetInvalidRect(const TRect& aRect); |
|
60 void SetInvalidRect(TInt aHeight); |
|
61 void SetInvalidRectHorizontal(TInt aWidth); |
|
62 void SetRects(TUint aRects); |
|
63 TRect LineCursorMargin() const; |
|
64 TPoint TopLeftTextArea() const; |
|
65 TBool IsLineCursor() const; |
|
66 |
|
67 void AddRects(TUint aRects); |
|
68 void SubRects(TUint aRects); |
|
69 TRect ClippingRect(); |
|
70 void ResetClippingRect(); |
|
71 void Scroll(TRect aRect,const TPoint& aBy,TBool aScrollBackground); |
|
72 void Flush(); |
|
73 void ClearRect(const TRect& aRect); |
|
74 void InvertRect(TRect aRect,const TRgb aInvertColor); |
|
75 void SetTextCursor(TPoint aPos, const TTextCursor &aCursor); |
|
76 void RemoveTextCursor(); |
|
77 void BlastBitmap(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aRect); |
|
78 void DrawPictureFrame(TFrameOverlay* aPictureFrame,const TRect& aLineRect); |
|
79 void Invalidate(TRect aRect); |
|
80 void ActivateContext(); |
|
81 void ActivateContext(CGraphicsContext *aGc); |
|
82 void DeactivateContext(); |
|
83 void DeactivateContext(CGraphicsContext *aGc); |
|
84 void SetLayout(CTextLayout* aLayout); |
|
85 CTextLayout* Layout(); |
|
86 TBool UseWindowGc() const; |
|
87 |
|
88 private: |
|
89 void DestroyContexts(); |
|
90 private: |
|
91 RWsSession *iSession; |
|
92 RWindowGroup *iGroupWin; |
|
93 RWindow *iWin; |
|
94 CBitmapContext *iGc; |
|
95 CBitmapDevice *iGd; |
|
96 TDrawTextLayoutContext* const iDrawTextLayoutContext; |
|
97 TUint iRects; |
|
98 TRect iInvalidRect; |
|
99 TLogicalRgb iBackground; |
|
100 CTextLayout* iTextLayout; |
|
101 }; |
|
102 |
|
103 /** Visibility of line and text cursor. |
|
104 |
|
105 The TVisibility enumeration defined in this class is used in calls to CTextView::SetCursorVisibilityL(). |
|
106 The remainder of this class does not form part of the API. |
|
107 @internalComponent |
|
108 */ |
|
109 class TCursor |
|
110 { |
|
111 public: |
|
112 enum TCursors |
|
113 { |
|
114 EFNeitherCursor = 0, |
|
115 EFTextCursor = 1, |
|
116 EFLineCursor = 2, |
|
117 EFBothCursors = EFTextCursor | EFLineCursor |
|
118 }; |
|
119 |
|
120 /** Cursor visibility */ |
|
121 enum TVisibility |
|
122 { |
|
123 /** Indicates that the cursor should be invisible. */ |
|
124 EFCursorInvisible = 0, |
|
125 /** Indicates that the cursor should be visible. */ |
|
126 EFCursorVisible, |
|
127 /** Indicates a flashing text cursor. When specified for the line |
|
128 cursor, is equivalent to EFCursorVisible, as the line cursor cannot |
|
129 flash. Note that a non-flashing text cursor should only be used when |
|
130 there is to be no editing, reformatting, scrolling or cursor movement. |
|
131 */ |
|
132 EFCursorFlashing |
|
133 }; |
|
134 |
|
135 TCursor(TCursorPosition& aCursorPos,RScreenDisplay& aDisplay); |
|
136 void SetLineCursorBitmap(const CFbsBitmap* aLineCursorBitmap); |
|
137 inline TUint LineCursorVisibility(); |
|
138 inline TUint TextCursorVisibility(); |
|
139 void Draw(TUint aCursors); |
|
140 |
|
141 void SetVisibility(TVisibility aLineCursor,TVisibility aTextCursor); |
|
142 void SetType(TTextCursor::EType aType); |
|
143 void SetPlacement(TTmCursorPlacement aPlacement); |
|
144 void SetAscentAndDescent(TInt aAscent,TInt aDescent); |
|
145 void SetWeight(TInt aWeight); |
|
146 void SetFlash(TBool aEnabled); |
|
147 void SetXorColor(TRgb aColor); |
|
148 void MatchCursorHeightToAdjacentChar(); |
|
149 void SetExtensions(TInt aFirstExtension, TInt aSecondExtension); |
|
150 private: |
|
151 enum |
|
152 { |
|
153 ELineCursorToLabelGap = 2, |
|
154 ETextCursorWeight = 3, |
|
155 ETextCursorInvertColor = 0xFFFFFF |
|
156 }; |
|
157 |
|
158 void DrawLineCursor(TInt aHeight); |
|
159 void RemoveLineCursor(); |
|
160 void DrawTextCursor(TPoint aOrigin,TInt aWidth,TInt aAscent,TInt aDescent); |
|
161 void RemoveTextCursor(); |
|
162 |
|
163 RScreenDisplay& iDisplay; // a reference to the object controlling drawing |
|
164 TCursorPosition& iCursorPos; // a reference to the object holding the cursor's document position |
|
165 TBool iVisible; // TRUE if the text cursor is currently visible in the displayed text |
|
166 TBool iFlash; // TRUE if the text cursor should flash |
|
167 TVisibility iLineCursor; // line cursor state |
|
168 TVisibility iTextCursor; // text cursor state |
|
169 const CFbsBitmap* iLineCursorBitmap; // if non-null, points to a non-owned bitmap representing the line cursor |
|
170 TInt iAscent; // if non-negative, ascent used for vertical cursors |
|
171 TInt iDescent; // if non-negative, descent used for vertical cursors |
|
172 TInt iWeight; // width of vertical cursors, height of horizontal ones |
|
173 TTextCursor::EType iType; // filled or hollow rectangle, etc. |
|
174 TRgb iXorColor; // colour XORed with the background when the cursor is drawn |
|
175 TTmCursorPlacement iPlacement; // vertical, underline, etc. |
|
176 TInt iFirstExtension; // customise the cursor, extends vertical cursors upwards, horizontal cursors leftwards |
|
177 TInt iSecondExtension; // customise the cursor, extends vertical cursors downwards, horizontal cursors rightwards |
|
178 TInt iReserved[2]; |
|
179 }; |
|
180 |
|
181 /** |
|
182 Lays out formatted text for display. |
|
183 |
|
184 The class provides functions to: |
|
185 |
|
186 convert between document positions and x,y coordinates |
|
187 |
|
188 set the dimensions of the rectangle in which text can be viewed (the view |
|
189 rectangle) |
|
190 |
|
191 set margin widths |
|
192 |
|
193 do horizontal and vertical scrolling |
|
194 |
|
195 do text selection |
|
196 |
|
197 set the cursor position and appearance |
|
198 |
|
199 After a change has been made to the text layout, a reformat and redraw should |
|
200 normally take place. CTextView provides functions which are optimised to reformat |
|
201 the minimum amount necessary. For example, when a global formatting parameter |
|
202 is changed (e.g. the wrap width), the whole document's layout needs to be |
|
203 recalculated, so HandleGlobalChangeL() should be called. If the change involves |
|
204 the insertion or deletion of a single character, only a single line may be |
|
205 affected; for this, HandleCharEditL() is appropriate. Most CTextView reformatting |
|
206 functions do scrolling (using block transfer), if necessary, and a redraw. |
|
207 |
|
208 For maximum responsiveness, CTextView uses an active object to carry out |
|
209 reformatting as a background task, so that the application can continue to |
|
210 receive user input. Many CTextView functions force background formatting to |
|
211 complete before they take effect. |
|
212 |
|
213 When scrolling vertically, positive numbers of pixels, lines, paragraphs, |
|
214 pages, etc., mean that the text moves down, and vice versa. When scrolling |
|
215 horizontally, positive numbers of pixels mean that the text moves left and |
|
216 vice versa. |
|
217 |
|
218 A text view can display up to two cursors and up to three margins. The cursors |
|
219 are the text cursor and the line cursor. The purpose of the line cursor is |
|
220 to make it easier to see which line the text cursor (or the selection extension |
|
221 point) is on. The three margins are the label margin (for paragraph labels), |
|
222 the line cursor margin (for the line cursor) and the left text margin (the |
|
223 gap between the edge of the page and the text). All are optional, but if present, |
|
224 they appear in that order, starting at the left edge of the view rectangle. |
|
225 |
|
226 An object of class CTextLayout is used by the text view to calculate changes |
|
227 to the layout. This object must be specified when constructing the text view. |
|
228 It is also used to set layout attributes, including the wrap width, the height |
|
229 of the visible portion of the document (the "band"), whether formatting is |
|
230 set to the band or to the whole document and the text object which is the |
|
231 source of the text and formatting information. |
|
232 |
|
233 The x-y pixel coordinates used by CTextView are called window coordinates. |
|
234 Window coordinates have their origin at the top left corner of the view window |
|
235 (unlike class CTextLayout whose coordinates have their origin at the top left |
|
236 corner of the area within the view rectangle in which text can appear). As |
|
237 in most bitmap graphics systems, x coordinates increase rightwards and y coordinates |
|
238 increase downwards. |
|
239 @publishedAll |
|
240 @released |
|
241 */ |
|
242 class CTextView : public CBase |
|
243 |
|
244 { |
|
245 friend class CTestTextView; |
|
246 public: |
|
247 enum TPriorities |
|
248 { |
|
249 EFBackgroundFormattingPriority = (CActive::EPriorityIdle + CActive::EPriorityLow) / 2 |
|
250 }; |
|
251 |
|
252 /** deprecated 8.0 */ |
|
253 enum |
|
254 { |
|
255 EFFirstCharOnLine = -1000000, |
|
256 EFLastCharOnLine = 1000000 |
|
257 }; |
|
258 |
|
259 /** Cursor height matching. |
|
260 |
|
261 Passed as an argument to MatchCursorHeightToAdjacentChar(). */ |
|
262 enum TBeforeAfter |
|
263 { |
|
264 /** Text cursor height is matched to preceding character. */ |
|
265 EFCharacterBefore = ETrue, |
|
266 /** Text cursor height is matched to following character. */ |
|
267 EFCharacterAfter = EFalse |
|
268 }; |
|
269 |
|
270 |
|
271 |
|
272 /** Whether to reformat and redraw. Argument to SetViewL(). */ |
|
273 enum TDiscard |
|
274 { |
|
275 /** Discard all formatting; redraw. */ |
|
276 EFViewDiscardAllFormat, |
|
277 /** Do not discard all formatting; redraw. */ |
|
278 EFViewDontDiscardFormat, |
|
279 /** Discard all formatting; no redraw. */ |
|
280 EFViewDiscardAllNoRedraw, |
|
281 /** Do not discard all formatting; redraw. */ |
|
282 EFViewDontDiscardFullRedraw |
|
283 }; |
|
284 |
|
285 /** |
|
286 Provides notification to the owner of the text view object of changes to the |
|
287 formatting. |
|
288 |
|
289 Its OnReformatL() function is called after reformatting but before redisplay, |
|
290 so that edit windows etc. can be resized. |
|
291 @publishedAll |
|
292 @released |
|
293 */ |
|
294 class MObserver |
|
295 |
|
296 { |
|
297 public: |
|
298 |
|
299 /** Called after reformatting but before redisplay, so that edit |
|
300 windows, etc., can be resized. |
|
301 @param aTextView A pointer to the current text view object. */ |
|
302 virtual void OnReformatL(const CTextView* aTextView) = 0; |
|
303 }; |
|
304 |
|
305 // argument to SetViewL |
|
306 enum TDoHorizontalScroll |
|
307 { |
|
308 EFNoHorizontalScroll = EFalse, |
|
309 EFCheckForHorizontalScroll = ETrue |
|
310 }; |
|
311 |
|
312 |
|
313 /** |
|
314 A standard inquiry interface for the text formatting engine, built on |
|
315 top of a CTextView object. |
|
316 |
|
317 To use it, construct a TTagmaForwarder object, then call InitL(), which |
|
318 finishes background formatting, then call the MTmTextLayoutForwarder |
|
319 functions. |
|
320 @publishedAll |
|
321 @released |
|
322 */ |
|
323 class TTagmaForwarder: public MTmTextLayoutForwarder |
|
324 |
|
325 { |
|
326 public: |
|
327 inline TTagmaForwarder(); |
|
328 inline void InitL(CTextView* aView); |
|
329 |
|
330 private: |
|
331 // from MTmTextLayoutForwarder |
|
332 inline const CTmTextLayout& TextLayout() const; |
|
333 inline void GetOrigin(TPoint& aPoint) const; |
|
334 |
|
335 CTextView* iView; |
|
336 }; |
|
337 |
|
338 private: |
|
339 enum TDrawParameters |
|
340 { |
|
341 EFDrawAllWindow = CLayoutData::EFLargeNumber // must be larger than the pixel height of any window. |
|
342 }; |
|
343 |
|
344 // bit values used in iFlags |
|
345 enum |
|
346 { |
|
347 EFSelectionVisible = 1, |
|
348 EFPictureFrameEnabled = 2, |
|
349 EFEverythingVisible = 3, |
|
350 EFFlickerFreeRedraw = 4, |
|
351 EFTextVisible = 8 |
|
352 }; |
|
353 |
|
354 // horizontal scroll jump in pixels |
|
355 enum THorizontalScrollJump |
|
356 { |
|
357 EFDefaultHorizontalScrollJump = 20 |
|
358 #ifdef _DEBUG |
|
359 ,EFUnreasonablyLargeHorizontalScrollJump = 10000 |
|
360 #endif |
|
361 }; |
|
362 |
|
363 // picture frame blob widths in pixels |
|
364 enum TPictureFrameBlobWidths |
|
365 { |
|
366 EFFrameVisibleBlobWidth = 10, |
|
367 EFFrameActiveBlobWidth = 20 |
|
368 }; |
|
369 |
|
370 enum THorizontalScroll |
|
371 { |
|
372 EFNoPreviousHorizontalScroll = 0, |
|
373 EFPreviousHorizontalScroll |
|
374 }; |
|
375 |
|
376 enum TMemoryStatus |
|
377 { |
|
378 EFMemoryOK, |
|
379 EFOutOfMemory, |
|
380 EFRecovering |
|
381 }; |
|
382 |
|
383 enum TExtendedHighlightRedraw |
|
384 { |
|
385 EFTopEdge = 0x0001, |
|
386 EFBottomEdge = 0x0002 |
|
387 }; |
|
388 |
|
389 |
|
390 public: |
|
391 IMPORT_C static CTextView *NewL(CTextLayout* aLayout,const TRect &aDisplay,CBitmapDevice* aGd, |
|
392 MGraphicsDeviceMap* aDeviceMap,RWindow* aWin,RWindowGroup* aGroupWin, |
|
393 RWsSession* aSession); |
|
394 IMPORT_C ~CTextView(); |
|
395 IMPORT_C void SetDisplayContextL(CBitmapDevice* aGd,RWindow* aWin,RWindowGroup* aGroupWin,RWsSession* aSession); |
|
396 IMPORT_C void SetLayout(CTextLayout* aLayout); |
|
397 inline const CTextLayout* Layout() const; |
|
398 IMPORT_C void SetViewRect(const TRect& aDisplay); |
|
399 IMPORT_C void AlterViewRect(const TRect &aViewRect); |
|
400 IMPORT_C void SetMarginWidths(TInt aLabels,TInt aLineCursor); |
|
401 IMPORT_C void SetHorizontalScrollJump(TInt aScrollJump); |
|
402 IMPORT_C void SetLineCursorBitmap(const CFbsBitmap* aLineCursorBitmap); |
|
403 IMPORT_C void SetHighlightExtensions(TInt aLeftExtension, TInt aRightExtension, TInt aTopExtension, TInt aBottomExtension); |
|
404 IMPORT_C void SetExcessHeightRequired(TInt aExcessHeightRequired); |
|
405 IMPORT_C void SetBackgroundColor(TRgb aColor); |
|
406 IMPORT_C void SetTextColorOverride(const TRgb* aOverrideColor = NULL); |
|
407 IMPORT_C void SetCursorVisibilityL(TUint aLineCursor,TUint aTextCursor); |
|
408 IMPORT_C void SetSelectionVisibilityL(TBool aSelectionVisible); |
|
409 IMPORT_C TBool SelectionVisible() const; |
|
410 IMPORT_C void EnablePictureFrameL(TBool aEnabled); |
|
411 IMPORT_C const TRect& ViewRect() const; |
|
412 IMPORT_C const TRect& AlteredViewRect() const; |
|
413 IMPORT_C void MarginWidths(TInt& aLabels,TInt& aLineCursor) const; |
|
414 IMPORT_C TInt HorizontalScrollJump() const; |
|
415 IMPORT_C TInt LeftTextMargin() const; |
|
416 IMPORT_C void SetLatentXPosition(TInt aLatentX); |
|
417 // deprecated 7.0 |
|
418 IMPORT_C void SetParagraphFillTextOnly(TBool aFillTextOnly); |
|
419 IMPORT_C void SetCursorWidthTypeL(TTextCursor::EType aType,TInt aWidth = 0); |
|
420 IMPORT_C void SetCursorPlacement(TTmCursorPlacement aPlacement); |
|
421 IMPORT_C void SetCursorWeight(TInt aWeight); |
|
422 IMPORT_C void SetCursorFlash(TBool aEnabled); |
|
423 IMPORT_C void SetCursorXorColor(TRgb aColor); |
|
424 IMPORT_C void SetCursorExtensions(TInt aFirstExtension, TInt aSecondExtension); |
|
425 IMPORT_C TCursorSelection Selection() const; |
|
426 IMPORT_C TBool IsPictureFrameSelected(TRect& aPictureFrameRect,TInt& aDocPos) const; |
|
427 IMPORT_C TBool GetPictureRectangleL(TInt aDocPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL) const; |
|
428 IMPORT_C TBool GetPictureRectangleL(TPoint aXyPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL); |
|
429 IMPORT_C TBool FindXyPosL(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL); |
|
430 IMPORT_C TInt XyPosToDocPosL(TPoint& aPoint); |
|
431 IMPORT_C TBool FindDocPosL(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL); |
|
432 IMPORT_C TBool DocPosToXyPosL(TInt aDocPos,TPoint& aPoint); |
|
433 IMPORT_C TRect ParagraphRectL(TInt aDocPos) const; |
|
434 IMPORT_C void CalculateHorizontalExtremesL(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines); |
|
435 IMPORT_C void MatchCursorHeightL(const TFontSpec& aFontSpec); |
|
436 IMPORT_C void MatchCursorHeightToAdjacentChar(TBeforeAfter aBasedOn = EFCharacterBefore); |
|
437 IMPORT_C TPoint SetSelectionL(const TCursorSelection& aSelection); |
|
438 IMPORT_C void CancelSelectionL(); |
|
439 IMPORT_C void ClearSelectionL(); |
|
440 IMPORT_C TPoint SetDocPosL(const TTmDocPosSpec& aDocPos,TBool aDragSelectOn = EFalse); |
|
441 IMPORT_C TPoint SetDocPosL(TInt aDocPos,TBool aDragSelectOn = EFalse); |
|
442 IMPORT_C TPoint SetXyPosL(TPoint aPos,TBool aDragSelectOn,TRect*& aPictureRect,TInt& aPictureFrameEdges); |
|
443 IMPORT_C TPoint MoveCursorL(TCursorPosition::TMovementType& aMovement,TBool aDragSelectOn); |
|
444 IMPORT_C TInt ScrollDisplayL(TCursorPosition::TMovementType aMovement, |
|
445 CTextLayout::TAllowDisallow aScrollBlankSpace=CTextLayout::EFDisallowScrollingBlankSpace); |
|
446 IMPORT_C TPoint SetViewLineAtTopL(TInt aLineNo); |
|
447 IMPORT_C void ScrollDisplayPixelsL(TInt& aDeltaY); |
|
448 IMPORT_C TInt ScrollDisplayLinesL(TInt& aDeltaLines, |
|
449 CTextLayout::TAllowDisallow aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace); |
|
450 IMPORT_C TInt ScrollDisplayParagraphsL(TInt& aDeltaParas, |
|
451 CTextLayout::TAllowDisallow aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace); |
|
452 IMPORT_C TPoint SetViewL(TInt aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier = TViewYPosQualifier(), |
|
453 TDiscard aDiscardFormat = EFViewDontDiscardFormat, |
|
454 TDoHorizontalScroll aDoHorizontalScroll = EFCheckForHorizontalScroll); |
|
455 IMPORT_C void SetLeftTextMargin(TInt aLeftMargin); |
|
456 IMPORT_C void DrawL(TRect aRect); |
|
457 IMPORT_C void DrawL(TRect aRect,CBitmapContext& aGc); |
|
458 inline void SetObserver(MObserver* aObserver); |
|
459 IMPORT_C void SetPendingSelection(const TCursorSelection& aSelection); |
|
460 inline void EnableFlickerFreeRedraw(); |
|
461 inline void DisableFlickerFreeRedraw(); |
|
462 inline TBool FlickerFreeRedraw() const; |
|
463 inline void GetOrigin(TPoint& aPoint) const; |
|
464 IMPORT_C TCursorSelection GetForwardDeletePositionL(); |
|
465 IMPORT_C TCursorSelection GetBackwardDeletePositionL(); |
|
466 |
|
467 // reformatting after changes to the content |
|
468 IMPORT_C void FormatTextL(); |
|
469 IMPORT_C TInt HandleCharEditL(TUint aType = CTextLayout::EFCharacterInsert,TBool aFormatChanged = EFalse); |
|
470 IMPORT_C TPoint HandleRangeFormatChangeL(TCursorSelection aSelection,TBool aFormatChanged = EFalse); |
|
471 IMPORT_C TPoint HandleInsertDeleteL(TCursorSelection aSelection,TInt aDeletedChars,TBool aFormatChanged = EFalse); |
|
472 IMPORT_C void HandleGlobalChangeL(TViewYPosQualifier aYPosQualifier = TViewYPosQualifier()); |
|
473 IMPORT_C void HandleGlobalChangeNoRedrawL(TViewYPosQualifier aYPosQualifier = TViewYPosQualifier()); |
|
474 IMPORT_C void HandleAdditionalCharactersAtEndL(); |
|
475 IMPORT_C void FinishBackgroundFormattingL(); |
|
476 |
|
477 IMPORT_C CBitmapContext* BitmapContext(); |
|
478 IMPORT_C const TTmDocPos& VisualEndOfRunL( |
|
479 const TTmDocPos& aStart, const TTmDocPos& aEnd, |
|
480 TCursorPosition::TVisualEnd aDirection); |
|
481 IMPORT_C void GetCursorPos(TTmDocPos& aPos) const; |
|
482 |
|
483 IMPORT_C TPoint SetDocPosL(const TTmDocPos& aDocPos,TBool aDragSelectOn = EFalse); |
|
484 |
|
485 IMPORT_C void SetCursorPositioningHintL(TCursorPosition::TPosHint aHint); |
|
486 |
|
487 IMPORT_C void SetOpaque(TBool aDrawOpaque); |
|
488 IMPORT_C void MakeVisible(TBool aVisible); |
|
489 |
|
490 private: |
|
491 IMPORT_C static TInt IdleL(TAny *aSelf); |
|
492 IMPORT_C CTextView(); |
|
493 IMPORT_C void ConstructL(CTextLayout* aLayout,const TRect &aDisplay,CBitmapDevice* aGd,MGraphicsDeviceMap* aDeviceMap, |
|
494 RWindow* aWin,RWindowGroup* aGroupWin,RWsSession* aSession); |
|
495 inline TInt TopViewRect() const; |
|
496 inline TBool IsFormatting() const; |
|
497 TBool NoMemoryCheckL(); |
|
498 void StartIdleObject(); |
|
499 inline void DrawWithPreviousHighlight(); |
|
500 inline void DrawWithCurrentHighlight(); |
|
501 TInt CalculateBaseLinePos(TTmDocPos& aDocPos); |
|
502 TInt DrawAfterCursorMoveL(TInt aVerticalScrollBy); |
|
503 TBool NextLineL(); |
|
504 void ClearRectAtBottom(TInt aHeight); |
|
505 void DrawTextL(TInt aFromHeight = 0,TInt aToHeight = EFDrawAllWindow); |
|
506 void DisplayNewLinesL(TInt aFrom,TInt aTo); |
|
507 void DrawCursor(TUint aCursors = TCursor::EFBothCursors); |
|
508 TPoint DoMoveCursorL(TBool aDragSelectOn,TCursorPosition::TMovementType& aMovement,TBool aAllowPictureFrame); |
|
509 void ScrollTextL(TInt aScrollY,TInt aFrom,TInt aScrollX,TBool aScrollBackground); |
|
510 void ScrollRect(TRect& aRect,TInt aScrollY,TInt aFrom,TInt aScrollX,TBool aScrollBackground); |
|
511 void ScrollRect(TInt aScrollY,TInt& aFrom,TInt& aTo); |
|
512 TPoint HandleBlockChangeL(TCursorSelection aSelection,TInt aOldCharsChanged,TBool aFormatChanged); |
|
513 void CheckScrollUpL(); |
|
514 TInt CheckHorizontalScroll(const TTmDocPos& aDocPos); |
|
515 TInt DoHorizontalScrollDisplayL(TCursorPosition::TMovementType aMovement, |
|
516 CTextLayout::TAllowDisallow aScrollBlankSpace); |
|
517 TInt DoScrollDisplayL(TCursorPosition::TMovementType aMovement,CTextLayout::TAllowDisallow aScrollBlankSpace); |
|
518 void ScrollDisplayL(); |
|
519 TPoint ViewTopOfLineL(const TTmDocPos& aDocPos,TInt& aYPos, |
|
520 CTextView::TDiscard aDiscardFormat = EFViewDontDiscardFormat, |
|
521 TDoHorizontalScroll aHorizontalScroll = EFCheckForHorizontalScroll); |
|
522 TPoint ViewL(const TTmDocPos& aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier = TViewYPosQualifier(), |
|
523 CTextView::TDiscard aDiscardFormat = EFViewDontDiscardFormat, |
|
524 TDoHorizontalScroll aHorizontalScroll = EFCheckForHorizontalScroll); |
|
525 TPoint DoHandleGlobalChangeL(TViewYPosQualifier aYPosQualifier,CTextView::TDiscard aDiscard); |
|
526 void UpdateHighlightL(); |
|
527 void HighlightUsingExtensions(CTextLayout::TRangeChange aOptimizedRange, CTextLayout::TRangeChange aOriginalRange); |
|
528 void UpdatePictureFrameL(); |
|
529 void RedrawPictureFrameRectL(TInt aPos); |
|
530 void DrawPictureFrameL(TRect& aClipRect); |
|
531 void DestroyWindowServerObjects(); |
|
532 void NoMemoryL(TInt aErr); |
|
533 void RecoverNoMemoryL(); |
|
534 void RecreateWindowServerObjectsL(); |
|
535 void DrawTextSupportL(const TRect& aRect,const TCursorSelection* aHighlight); |
|
536 void DoDrawTextSupportL(const TRect& aRect,const TCursorSelection* aHighlight); |
|
537 void DoDrawTextSupportOpaqueL(const TRect& aRect,const TCursorSelection* aHighlight); |
|
538 void DisplayLineRangeL(TInt aFrom,TInt aTo); |
|
539 inline void NotifyReformatL(); |
|
540 void CalculateHorizontalExtremes(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines); |
|
541 TBool ExtendedHighlightExists() const; |
|
542 void DoClearSelectionL(const TCursorSelection& aSelection, TBool aIsPictureFrame); |
|
543 void AdjustRectForScrolling(TRect &aRect, TInt aScrollY, TInt aScrollX) const; |
|
544 static void ResetOffScreenBitmapContext(TAny* aTextView); |
|
545 static void ResetExternalDraw(TAny* aTextView); |
|
546 |
|
547 private: |
|
548 CIdle* iWrap; |
|
549 RScreenDisplay iDisplay; |
|
550 CTextLayout* iLayout; // must not be moved |
|
551 TDrawTextLayoutContext iDrawTextLayoutContext; // must not be moved |
|
552 TCursor iCursor; |
|
553 TCursorPosition iCursorPos; // must not be moved |
|
554 TFrameOverlay* iPictureFrame; |
|
555 TMemoryStatus iNoMemory; |
|
556 TUint iFlags; // must not be moved |
|
557 TUint iHorizontalScroll; |
|
558 TInt iGood; |
|
559 TInt iFormattedUpTo; |
|
560 TInt iHorizontalScrollJump; |
|
561 TInt iHeightNotDrawn; |
|
562 MObserver* iObserver; // must not be moved |
|
563 /** Explicit off-screen bitmap to draw to. |
|
564 @internalComponent */ |
|
565 CBitmapContext* iOffScreenContext; |
|
566 TRect iReducedDrawingAreaRect; |
|
567 TUint iDummy;// was iRedrawExtendedHighlight; |
|
568 TBool iContextIsNavigation; |
|
569 TBool iDrawOpaque; |
|
570 }; |
|
571 |
|
572 inline TUint TCursor::LineCursorVisibility() |
|
573 { |
|
574 return iLineCursor; |
|
575 } |
|
576 |
|
577 inline TUint TCursor::TextCursorVisibility() |
|
578 { |
|
579 return iTextCursor; |
|
580 } |
|
581 |
|
582 /** Returns a pointer to the text layout object used by the text view. |
|
583 @return A pointer to the text layout object used by the text view. */ |
|
584 inline const CTextLayout* CTextView::Layout() const |
|
585 { |
|
586 return iLayout; |
|
587 } |
|
588 |
|
589 /** Sets a text view observer. This provides notification to the owner of the |
|
590 text view object of changes to the formatting. Its OnReformatL() function is |
|
591 called after reformatting but before redisplay, so that edit windows etc. can |
|
592 be resized. |
|
593 |
|
594 @param aObserver Pointer to text view observer object. */ |
|
595 inline void CTextView::SetObserver(MObserver* aObserver) |
|
596 { |
|
597 iObserver = aObserver; |
|
598 } |
|
599 |
|
600 inline void CTextView::EnableFlickerFreeRedraw() |
|
601 { |
|
602 iFlags |= EFFlickerFreeRedraw; |
|
603 } |
|
604 |
|
605 inline void CTextView::DisableFlickerFreeRedraw() |
|
606 { |
|
607 iFlags &= ~EFFlickerFreeRedraw; |
|
608 } |
|
609 |
|
610 inline TBool CTextView::FlickerFreeRedraw() const |
|
611 { |
|
612 return iFlags & EFFlickerFreeRedraw; |
|
613 } |
|
614 |
|
615 inline void CTextView::NotifyReformatL() |
|
616 { |
|
617 if (iObserver) |
|
618 iObserver->OnReformatL(this); |
|
619 } |
|
620 |
|
621 inline TBool CTextView::IsFormatting() const |
|
622 { |
|
623 return iLayout->IsBackgroundFormatting(); |
|
624 } |
|
625 |
|
626 inline TInt CTextView::TopViewRect() const |
|
627 { |
|
628 return iDrawTextLayoutContext.iViewRect.iTl.iY; |
|
629 } |
|
630 |
|
631 inline void CTextView::DrawWithPreviousHighlight() |
|
632 { |
|
633 iCursorPos.SetToPreviousHighlight(); |
|
634 } |
|
635 |
|
636 inline void CTextView::DrawWithCurrentHighlight() |
|
637 { |
|
638 iCursorPos.SetToCurrentHighlight(); |
|
639 } |
|
640 |
|
641 /** Gets the origin of the cursor. |
|
642 @param aPoint On return, the cursor origin. */ |
|
643 inline void CTextView::GetOrigin(TPoint& aPoint) const |
|
644 { |
|
645 iLayout->GetOrigin(aPoint); |
|
646 aPoint += iDrawTextLayoutContext.TopLeftText(); |
|
647 } |
|
648 |
|
649 /** This constructor deliberately does not take a pointer or reference to |
|
650 CTextView, to prevent the class from being used unless InitL() is called. */ |
|
651 inline CTextView::TTagmaForwarder::TTagmaForwarder(): |
|
652 iView(NULL) |
|
653 { |
|
654 } |
|
655 |
|
656 /** Called after construction, to complete background reformatting. |
|
657 @param aView A pointer to the text view object. */ |
|
658 inline void CTextView::TTagmaForwarder::InitL(CTextView* aView) |
|
659 { |
|
660 iView = aView; |
|
661 iView->FinishBackgroundFormattingL(); |
|
662 } |
|
663 |
|
664 inline const CTmTextLayout& CTextView::TTagmaForwarder::TextLayout() const |
|
665 { |
|
666 return iView->Layout()->TagmaTextLayout(); |
|
667 } |
|
668 |
|
669 inline void CTextView::TTagmaForwarder::GetOrigin(TPoint& aPoint) const |
|
670 { |
|
671 iView->GetOrigin(aPoint); |
|
672 } |
|
673 |
|
674 #endif |