1.1 --- a/epoc32/include/frmtview.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/frmtview.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,674 @@
1.4 -frmtview.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#ifndef __FRMTVIEW_H__
1.21 +#define __FRMTVIEW_H__
1.22 +
1.23 +#include <e32std.h>
1.24 +#include <e32base.h>
1.25 +#include <w32std.h>
1.26 +#include <frmtlay.h>
1.27 +#include <frmframe.h>
1.28 +
1.29 +/**
1.30 +Internal class - not part of interface
1.31 +@internalComponent
1.32 +*/
1.33 +class RScreenDisplay
1.34 +
1.35 + {
1.36 +public:
1.37 + enum TClippingRects
1.38 + {
1.39 + EFClipTextArea = 0x0001,
1.40 + EFClipLineCursor = 0x0002,
1.41 + EFClipExtendedTextArea = 0x0004,
1.42 + EFClipViewRect = 0x0008,
1.43 + EFClipExtendedViewRect = 0x0010,
1.44 + EFClipInvalid = 0x0200,
1.45 + EFClipAllFlags = 0xFFFF
1.46 + };
1.47 +public:
1.48 + RScreenDisplay(TDrawTextLayoutContext* const aDrawTextLayoutContext);
1.49 + void Close();
1.50 + void Destroy();
1.51 + void SetWindowsServer(RWsSession *aSession) { iSession = aSession; }
1.52 + void SetWindowGroup(RWindowGroup *aWin) { iGroupWin = aWin; }
1.53 +
1.54 + void SetWindow(RWindow *aWin);
1.55 + RWindow* Window() const { return iWin; }
1.56 + void SetBitmapContext(CBitmapContext* aGc) { iGc = aGc; }
1.57 + CBitmapContext* BitmapContext() const { return iGc; }
1.58 + RWsSession* WindowServerSession() { return iSession; }
1.59 + void SetGraphicsDeviceL(CBitmapDevice *aGd);
1.60 + CBitmapDevice* BitmapDevice() const {return iGd; }
1.61 + void CreateContextL(CBitmapDevice *aGd);
1.62 + void CreateContextL();
1.63 + void SetInvalidRect(const TRect& aRect);
1.64 + void SetInvalidRect(TInt aHeight);
1.65 + void SetInvalidRectHorizontal(TInt aWidth);
1.66 + void SetRects(TUint aRects);
1.67 + TRect LineCursorMargin() const;
1.68 + TPoint TopLeftTextArea() const;
1.69 + TBool IsLineCursor() const;
1.70 +
1.71 + void AddRects(TUint aRects);
1.72 + void SubRects(TUint aRects);
1.73 + TRect ClippingRect();
1.74 + void ResetClippingRect();
1.75 + void Scroll(TRect aRect,const TPoint& aBy,TBool aScrollBackground);
1.76 + void Flush();
1.77 + void ClearRect(const TRect& aRect);
1.78 + void InvertRect(TRect aRect,const TRgb aInvertColor);
1.79 + void SetTextCursor(TPoint aPos, const TTextCursor &aCursor);
1.80 + void RemoveTextCursor();
1.81 + void BlastBitmap(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aRect);
1.82 + void DrawPictureFrame(TFrameOverlay* aPictureFrame,const TRect& aLineRect);
1.83 + void Invalidate(TRect aRect);
1.84 + void ActivateContext();
1.85 + void ActivateContext(CGraphicsContext *aGc);
1.86 + void DeactivateContext();
1.87 + void DeactivateContext(CGraphicsContext *aGc);
1.88 + void SetLayout(CTextLayout* aLayout);
1.89 + CTextLayout* Layout();
1.90 + TBool UseWindowGc() const;
1.91 +
1.92 +private:
1.93 + void DestroyContexts();
1.94 +private:
1.95 + RWsSession *iSession;
1.96 + RWindowGroup *iGroupWin;
1.97 + RWindow *iWin;
1.98 + CBitmapContext *iGc;
1.99 + CBitmapDevice *iGd;
1.100 + TDrawTextLayoutContext* const iDrawTextLayoutContext;
1.101 + TUint iRects;
1.102 + TRect iInvalidRect;
1.103 + TLogicalRgb iBackground;
1.104 + CTextLayout* iTextLayout;
1.105 + };
1.106 +
1.107 +/** Visibility of line and text cursor.
1.108 +
1.109 +The TVisibility enumeration defined in this class is used in calls to CTextView::SetCursorVisibilityL().
1.110 +The remainder of this class does not form part of the API.
1.111 +@internalComponent
1.112 +*/
1.113 +class TCursor
1.114 + {
1.115 + public:
1.116 + enum TCursors
1.117 + {
1.118 + EFNeitherCursor = 0,
1.119 + EFTextCursor = 1,
1.120 + EFLineCursor = 2,
1.121 + EFBothCursors = EFTextCursor | EFLineCursor
1.122 + };
1.123 +
1.124 + /** Cursor visibility */
1.125 + enum TVisibility
1.126 + {
1.127 + /** Indicates that the cursor should be invisible. */
1.128 + EFCursorInvisible = 0,
1.129 + /** Indicates that the cursor should be visible. */
1.130 + EFCursorVisible,
1.131 + /** Indicates a flashing text cursor. When specified for the line
1.132 + cursor, is equivalent to EFCursorVisible, as the line cursor cannot
1.133 + flash. Note that a non-flashing text cursor should only be used when
1.134 + there is to be no editing, reformatting, scrolling or cursor movement.
1.135 + */
1.136 + EFCursorFlashing
1.137 + };
1.138 +
1.139 + TCursor(TCursorPosition& aCursorPos,RScreenDisplay& aDisplay);
1.140 + void SetLineCursorBitmap(const CFbsBitmap* aLineCursorBitmap);
1.141 + inline TUint LineCursorVisibility();
1.142 + inline TUint TextCursorVisibility();
1.143 + void Draw(TUint aCursors);
1.144 +
1.145 + void SetVisibility(TVisibility aLineCursor,TVisibility aTextCursor);
1.146 + void SetType(TTextCursor::EType aType);
1.147 + void SetPlacement(TTmCursorPlacement aPlacement);
1.148 + void SetAscentAndDescent(TInt aAscent,TInt aDescent);
1.149 + void SetWeight(TInt aWeight);
1.150 + void SetFlash(TBool aEnabled);
1.151 + void SetXorColor(TRgb aColor);
1.152 + void MatchCursorHeightToAdjacentChar();
1.153 + void SetExtensions(TInt aFirstExtension, TInt aSecondExtension);
1.154 + private:
1.155 + enum
1.156 + {
1.157 + ELineCursorToLabelGap = 2,
1.158 + ETextCursorWeight = 3,
1.159 + ETextCursorInvertColor = 0xFFFFFF
1.160 + };
1.161 +
1.162 + void DrawLineCursor(TInt aHeight);
1.163 + void RemoveLineCursor();
1.164 + void DrawTextCursor(TPoint aOrigin,TInt aWidth,TInt aAscent,TInt aDescent);
1.165 + void RemoveTextCursor();
1.166 +
1.167 + RScreenDisplay& iDisplay; // a reference to the object controlling drawing
1.168 + TCursorPosition& iCursorPos; // a reference to the object holding the cursor's document position
1.169 + TBool iVisible; // TRUE if the text cursor is currently visible in the displayed text
1.170 + TBool iFlash; // TRUE if the text cursor should flash
1.171 + TVisibility iLineCursor; // line cursor state
1.172 + TVisibility iTextCursor; // text cursor state
1.173 + const CFbsBitmap* iLineCursorBitmap; // if non-null, points to a non-owned bitmap representing the line cursor
1.174 + TInt iAscent; // if non-negative, ascent used for vertical cursors
1.175 + TInt iDescent; // if non-negative, descent used for vertical cursors
1.176 + TInt iWeight; // width of vertical cursors, height of horizontal ones
1.177 + TTextCursor::EType iType; // filled or hollow rectangle, etc.
1.178 + TRgb iXorColor; // colour XORed with the background when the cursor is drawn
1.179 + TTmCursorPlacement iPlacement; // vertical, underline, etc.
1.180 + TInt iFirstExtension; // customise the cursor, extends vertical cursors upwards, horizontal cursors leftwards
1.181 + TInt iSecondExtension; // customise the cursor, extends vertical cursors downwards, horizontal cursors rightwards
1.182 + TInt iReserved[2];
1.183 + };
1.184 +
1.185 +/**
1.186 +Lays out formatted text for display.
1.187 +
1.188 +The class provides functions to:
1.189 +
1.190 +convert between document positions and x,y coordinates
1.191 +
1.192 +set the dimensions of the rectangle in which text can be viewed (the view
1.193 +rectangle)
1.194 +
1.195 +set margin widths
1.196 +
1.197 +do horizontal and vertical scrolling
1.198 +
1.199 +do text selection
1.200 +
1.201 +set the cursor position and appearance
1.202 +
1.203 +After a change has been made to the text layout, a reformat and redraw should
1.204 +normally take place. CTextView provides functions which are optimised to reformat
1.205 +the minimum amount necessary. For example, when a global formatting parameter
1.206 +is changed (e.g. the wrap width), the whole document's layout needs to be
1.207 +recalculated, so HandleGlobalChangeL() should be called. If the change involves
1.208 +the insertion or deletion of a single character, only a single line may be
1.209 +affected; for this, HandleCharEditL() is appropriate. Most CTextView reformatting
1.210 +functions do scrolling (using block transfer), if necessary, and a redraw.
1.211 +
1.212 +For maximum responsiveness, CTextView uses an active object to carry out
1.213 +reformatting as a background task, so that the application can continue to
1.214 +receive user input. Many CTextView functions force background formatting to
1.215 +complete before they take effect.
1.216 +
1.217 +When scrolling vertically, positive numbers of pixels, lines, paragraphs,
1.218 +pages, etc., mean that the text moves down, and vice versa. When scrolling
1.219 +horizontally, positive numbers of pixels mean that the text moves left and
1.220 +vice versa.
1.221 +
1.222 +A text view can display up to two cursors and up to three margins. The cursors
1.223 +are the text cursor and the line cursor. The purpose of the line cursor is
1.224 +to make it easier to see which line the text cursor (or the selection extension
1.225 +point) is on. The three margins are the label margin (for paragraph labels),
1.226 +the line cursor margin (for the line cursor) and the left text margin (the
1.227 +gap between the edge of the page and the text). All are optional, but if present,
1.228 +they appear in that order, starting at the left edge of the view rectangle.
1.229 +
1.230 +An object of class CTextLayout is used by the text view to calculate changes
1.231 +to the layout. This object must be specified when constructing the text view.
1.232 +It is also used to set layout attributes, including the wrap width, the height
1.233 +of the visible portion of the document (the "band"), whether formatting is
1.234 +set to the band or to the whole document and the text object which is the
1.235 +source of the text and formatting information.
1.236 +
1.237 +The x-y pixel coordinates used by CTextView are called window coordinates.
1.238 +Window coordinates have their origin at the top left corner of the view window
1.239 +(unlike class CTextLayout whose coordinates have their origin at the top left
1.240 +corner of the area within the view rectangle in which text can appear). As
1.241 +in most bitmap graphics systems, x coordinates increase rightwards and y coordinates
1.242 +increase downwards.
1.243 +@publishedAll
1.244 +@released
1.245 +*/
1.246 +class CTextView : public CBase
1.247 +
1.248 + {
1.249 +friend class CTestTextView;
1.250 +public:
1.251 + enum TPriorities
1.252 + {
1.253 + EFBackgroundFormattingPriority = (CActive::EPriorityIdle + CActive::EPriorityLow) / 2
1.254 + };
1.255 +
1.256 + /** deprecated 8.0 */
1.257 + enum
1.258 + {
1.259 + EFFirstCharOnLine = -1000000,
1.260 + EFLastCharOnLine = 1000000
1.261 + };
1.262 +
1.263 + /** Cursor height matching.
1.264 +
1.265 + Passed as an argument to MatchCursorHeightToAdjacentChar(). */
1.266 + enum TBeforeAfter
1.267 + {
1.268 + /** Text cursor height is matched to preceding character. */
1.269 + EFCharacterBefore = ETrue,
1.270 + /** Text cursor height is matched to following character. */
1.271 + EFCharacterAfter = EFalse
1.272 + };
1.273 +
1.274 +
1.275 +
1.276 + /** Whether to reformat and redraw. Argument to SetViewL(). */
1.277 + enum TDiscard
1.278 + {
1.279 + /** Discard all formatting; redraw. */
1.280 + EFViewDiscardAllFormat,
1.281 + /** Do not discard all formatting; redraw. */
1.282 + EFViewDontDiscardFormat,
1.283 + /** Discard all formatting; no redraw. */
1.284 + EFViewDiscardAllNoRedraw,
1.285 + /** Do not discard all formatting; redraw. */
1.286 + EFViewDontDiscardFullRedraw
1.287 + };
1.288 +
1.289 + /**
1.290 + Provides notification to the owner of the text view object of changes to the
1.291 + formatting.
1.292 +
1.293 + Its OnReformatL() function is called after reformatting but before redisplay,
1.294 + so that edit windows etc. can be resized.
1.295 + @publishedAll
1.296 + @released
1.297 + */
1.298 + class MObserver
1.299 +
1.300 + {
1.301 + public:
1.302 +
1.303 + /** Called after reformatting but before redisplay, so that edit
1.304 + windows, etc., can be resized.
1.305 + @param aTextView A pointer to the current text view object. */
1.306 + virtual void OnReformatL(const CTextView* aTextView) = 0;
1.307 + };
1.308 +
1.309 + // argument to SetViewL
1.310 + enum TDoHorizontalScroll
1.311 + {
1.312 + EFNoHorizontalScroll = EFalse,
1.313 + EFCheckForHorizontalScroll = ETrue
1.314 + };
1.315 +
1.316 +
1.317 + /**
1.318 + A standard inquiry interface for the text formatting engine, built on
1.319 + top of a CTextView object.
1.320 +
1.321 + To use it, construct a TTagmaForwarder object, then call InitL(), which
1.322 + finishes background formatting, then call the MTmTextLayoutForwarder
1.323 + functions.
1.324 + @publishedAll
1.325 + @released
1.326 + */
1.327 + class TTagmaForwarder: public MTmTextLayoutForwarder
1.328 +
1.329 + {
1.330 + public:
1.331 + inline TTagmaForwarder();
1.332 + inline void InitL(CTextView* aView);
1.333 +
1.334 + private:
1.335 + // from MTmTextLayoutForwarder
1.336 + inline const CTmTextLayout& TextLayout() const;
1.337 + inline void GetOrigin(TPoint& aPoint) const;
1.338 +
1.339 + CTextView* iView;
1.340 + };
1.341 +
1.342 +private:
1.343 + enum TDrawParameters
1.344 + {
1.345 + EFDrawAllWindow = CLayoutData::EFLargeNumber // must be larger than the pixel height of any window.
1.346 + };
1.347 +
1.348 + // bit values used in iFlags
1.349 + enum
1.350 + {
1.351 + EFSelectionVisible = 1,
1.352 + EFPictureFrameEnabled = 2,
1.353 + EFEverythingVisible = 3,
1.354 + EFFlickerFreeRedraw = 4,
1.355 + EFTextVisible = 8
1.356 + };
1.357 +
1.358 + // horizontal scroll jump in pixels
1.359 + enum THorizontalScrollJump
1.360 + {
1.361 + EFDefaultHorizontalScrollJump = 20
1.362 +#ifdef _DEBUG
1.363 + ,EFUnreasonablyLargeHorizontalScrollJump = 10000
1.364 +#endif
1.365 + };
1.366 +
1.367 + // picture frame blob widths in pixels
1.368 + enum TPictureFrameBlobWidths
1.369 + {
1.370 + EFFrameVisibleBlobWidth = 10,
1.371 + EFFrameActiveBlobWidth = 20
1.372 + };
1.373 +
1.374 + enum THorizontalScroll
1.375 + {
1.376 + EFNoPreviousHorizontalScroll = 0,
1.377 + EFPreviousHorizontalScroll
1.378 + };
1.379 +
1.380 + enum TMemoryStatus
1.381 + {
1.382 + EFMemoryOK,
1.383 + EFOutOfMemory,
1.384 + EFRecovering
1.385 + };
1.386 +
1.387 + enum TExtendedHighlightRedraw
1.388 + {
1.389 + EFTopEdge = 0x0001,
1.390 + EFBottomEdge = 0x0002
1.391 + };
1.392 +
1.393 +
1.394 +public:
1.395 + IMPORT_C static CTextView *NewL(CTextLayout* aLayout,const TRect &aDisplay,CBitmapDevice* aGd,
1.396 + MGraphicsDeviceMap* aDeviceMap,RWindow* aWin,RWindowGroup* aGroupWin,
1.397 + RWsSession* aSession);
1.398 + IMPORT_C ~CTextView();
1.399 + IMPORT_C void SetDisplayContextL(CBitmapDevice* aGd,RWindow* aWin,RWindowGroup* aGroupWin,RWsSession* aSession);
1.400 + IMPORT_C void SetLayout(CTextLayout* aLayout);
1.401 + inline const CTextLayout* Layout() const;
1.402 + IMPORT_C void SetViewRect(const TRect& aDisplay);
1.403 + IMPORT_C void AlterViewRect(const TRect &aViewRect);
1.404 + IMPORT_C void SetMarginWidths(TInt aLabels,TInt aLineCursor);
1.405 + IMPORT_C void SetHorizontalScrollJump(TInt aScrollJump);
1.406 + IMPORT_C void SetLineCursorBitmap(const CFbsBitmap* aLineCursorBitmap);
1.407 + IMPORT_C void SetHighlightExtensions(TInt aLeftExtension, TInt aRightExtension, TInt aTopExtension, TInt aBottomExtension);
1.408 + IMPORT_C void SetExcessHeightRequired(TInt aExcessHeightRequired);
1.409 + IMPORT_C void SetBackgroundColor(TRgb aColor);
1.410 + IMPORT_C void SetTextColorOverride(const TRgb* aOverrideColor = NULL);
1.411 + IMPORT_C void SetCursorVisibilityL(TUint aLineCursor,TUint aTextCursor);
1.412 + IMPORT_C void SetSelectionVisibilityL(TBool aSelectionVisible);
1.413 + IMPORT_C TBool SelectionVisible() const;
1.414 + IMPORT_C void EnablePictureFrameL(TBool aEnabled);
1.415 + IMPORT_C const TRect& ViewRect() const;
1.416 + IMPORT_C const TRect& AlteredViewRect() const;
1.417 + IMPORT_C void MarginWidths(TInt& aLabels,TInt& aLineCursor) const;
1.418 + IMPORT_C TInt HorizontalScrollJump() const;
1.419 + IMPORT_C TInt LeftTextMargin() const;
1.420 + IMPORT_C void SetLatentXPosition(TInt aLatentX);
1.421 + // deprecated 7.0
1.422 + IMPORT_C void SetParagraphFillTextOnly(TBool aFillTextOnly);
1.423 + IMPORT_C void SetCursorWidthTypeL(TTextCursor::EType aType,TInt aWidth = 0);
1.424 + IMPORT_C void SetCursorPlacement(TTmCursorPlacement aPlacement);
1.425 + IMPORT_C void SetCursorWeight(TInt aWeight);
1.426 + IMPORT_C void SetCursorFlash(TBool aEnabled);
1.427 + IMPORT_C void SetCursorXorColor(TRgb aColor);
1.428 + IMPORT_C void SetCursorExtensions(TInt aFirstExtension, TInt aSecondExtension);
1.429 + IMPORT_C TCursorSelection Selection() const;
1.430 + IMPORT_C TBool IsPictureFrameSelected(TRect& aPictureFrameRect,TInt& aDocPos) const;
1.431 + IMPORT_C TBool GetPictureRectangleL(TInt aDocPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL) const;
1.432 + IMPORT_C TBool GetPictureRectangleL(TPoint aXyPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL);
1.433 + IMPORT_C TBool FindXyPosL(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL);
1.434 + IMPORT_C TInt XyPosToDocPosL(TPoint& aPoint);
1.435 + IMPORT_C TBool FindDocPosL(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL);
1.436 + IMPORT_C TBool DocPosToXyPosL(TInt aDocPos,TPoint& aPoint);
1.437 + IMPORT_C TRect ParagraphRectL(TInt aDocPos) const;
1.438 + IMPORT_C void CalculateHorizontalExtremesL(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines);
1.439 + IMPORT_C void MatchCursorHeightL(const TFontSpec& aFontSpec);
1.440 + IMPORT_C void MatchCursorHeightToAdjacentChar(TBeforeAfter aBasedOn = EFCharacterBefore);
1.441 + IMPORT_C TPoint SetSelectionL(const TCursorSelection& aSelection);
1.442 + IMPORT_C void CancelSelectionL();
1.443 + IMPORT_C void ClearSelectionL();
1.444 + IMPORT_C TPoint SetDocPosL(const TTmDocPosSpec& aDocPos,TBool aDragSelectOn = EFalse);
1.445 + IMPORT_C TPoint SetDocPosL(TInt aDocPos,TBool aDragSelectOn = EFalse);
1.446 + IMPORT_C TPoint SetXyPosL(TPoint aPos,TBool aDragSelectOn,TRect*& aPictureRect,TInt& aPictureFrameEdges);
1.447 + IMPORT_C TPoint MoveCursorL(TCursorPosition::TMovementType& aMovement,TBool aDragSelectOn);
1.448 + IMPORT_C TInt ScrollDisplayL(TCursorPosition::TMovementType aMovement,
1.449 + CTextLayout::TAllowDisallow aScrollBlankSpace=CTextLayout::EFDisallowScrollingBlankSpace);
1.450 + IMPORT_C TPoint SetViewLineAtTopL(TInt aLineNo);
1.451 + IMPORT_C void ScrollDisplayPixelsL(TInt& aDeltaY);
1.452 + IMPORT_C TInt ScrollDisplayLinesL(TInt& aDeltaLines,
1.453 + CTextLayout::TAllowDisallow aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace);
1.454 + IMPORT_C TInt ScrollDisplayParagraphsL(TInt& aDeltaParas,
1.455 + CTextLayout::TAllowDisallow aScrollBlankSpace = CTextLayout::EFDisallowScrollingBlankSpace);
1.456 + IMPORT_C TPoint SetViewL(TInt aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier = TViewYPosQualifier(),
1.457 + TDiscard aDiscardFormat = EFViewDontDiscardFormat,
1.458 + TDoHorizontalScroll aDoHorizontalScroll = EFCheckForHorizontalScroll);
1.459 + IMPORT_C void SetLeftTextMargin(TInt aLeftMargin);
1.460 + IMPORT_C void DrawL(TRect aRect);
1.461 + IMPORT_C void DrawL(TRect aRect,CBitmapContext& aGc);
1.462 + inline void SetObserver(MObserver* aObserver);
1.463 + IMPORT_C void SetPendingSelection(const TCursorSelection& aSelection);
1.464 + inline void EnableFlickerFreeRedraw();
1.465 + inline void DisableFlickerFreeRedraw();
1.466 + inline TBool FlickerFreeRedraw() const;
1.467 + inline void GetOrigin(TPoint& aPoint) const;
1.468 + IMPORT_C TCursorSelection GetForwardDeletePositionL();
1.469 + IMPORT_C TCursorSelection GetBackwardDeletePositionL();
1.470 +
1.471 + // reformatting after changes to the content
1.472 + IMPORT_C void FormatTextL();
1.473 + IMPORT_C TInt HandleCharEditL(TUint aType = CTextLayout::EFCharacterInsert,TBool aFormatChanged = EFalse);
1.474 + IMPORT_C TPoint HandleRangeFormatChangeL(TCursorSelection aSelection,TBool aFormatChanged = EFalse);
1.475 + IMPORT_C TPoint HandleInsertDeleteL(TCursorSelection aSelection,TInt aDeletedChars,TBool aFormatChanged = EFalse);
1.476 + IMPORT_C void HandleGlobalChangeL(TViewYPosQualifier aYPosQualifier = TViewYPosQualifier());
1.477 + IMPORT_C void HandleGlobalChangeNoRedrawL(TViewYPosQualifier aYPosQualifier = TViewYPosQualifier());
1.478 + IMPORT_C void HandleAdditionalCharactersAtEndL();
1.479 + IMPORT_C void FinishBackgroundFormattingL();
1.480 +
1.481 + IMPORT_C CBitmapContext* BitmapContext();
1.482 + IMPORT_C const TTmDocPos& VisualEndOfRunL(
1.483 + const TTmDocPos& aStart, const TTmDocPos& aEnd,
1.484 + TCursorPosition::TVisualEnd aDirection);
1.485 + IMPORT_C void GetCursorPos(TTmDocPos& aPos) const;
1.486 +
1.487 + IMPORT_C TPoint SetDocPosL(const TTmDocPos& aDocPos,TBool aDragSelectOn = EFalse);
1.488 +
1.489 + IMPORT_C void SetCursorPositioningHintL(TCursorPosition::TPosHint aHint);
1.490 +
1.491 + IMPORT_C void SetOpaque(TBool aDrawOpaque);
1.492 + IMPORT_C void MakeVisible(TBool aVisible);
1.493 +
1.494 +private:
1.495 + IMPORT_C static TInt IdleL(TAny *aSelf);
1.496 + IMPORT_C CTextView();
1.497 + IMPORT_C void ConstructL(CTextLayout* aLayout,const TRect &aDisplay,CBitmapDevice* aGd,MGraphicsDeviceMap* aDeviceMap,
1.498 + RWindow* aWin,RWindowGroup* aGroupWin,RWsSession* aSession);
1.499 + inline TInt TopViewRect() const;
1.500 + inline TBool IsFormatting() const;
1.501 + TBool NoMemoryCheckL();
1.502 + void StartIdleObject();
1.503 + inline void DrawWithPreviousHighlight();
1.504 + inline void DrawWithCurrentHighlight();
1.505 + TInt CalculateBaseLinePos(TTmDocPos& aDocPos);
1.506 + TInt DrawAfterCursorMoveL(TInt aVerticalScrollBy);
1.507 + TBool NextLineL();
1.508 + void ClearRectAtBottom(TInt aHeight);
1.509 + void DrawTextL(TInt aFromHeight = 0,TInt aToHeight = EFDrawAllWindow);
1.510 + void DisplayNewLinesL(TInt aFrom,TInt aTo);
1.511 + void DrawCursor(TUint aCursors = TCursor::EFBothCursors);
1.512 + TPoint DoMoveCursorL(TBool aDragSelectOn,TCursorPosition::TMovementType& aMovement,TBool aAllowPictureFrame);
1.513 + void ScrollTextL(TInt aScrollY,TInt aFrom,TInt aScrollX,TBool aScrollBackground);
1.514 + void ScrollRect(TRect& aRect,TInt aScrollY,TInt aFrom,TInt aScrollX,TBool aScrollBackground);
1.515 + void ScrollRect(TInt aScrollY,TInt& aFrom,TInt& aTo);
1.516 + TPoint HandleBlockChangeL(TCursorSelection aSelection,TInt aOldCharsChanged,TBool aFormatChanged);
1.517 + void CheckScrollUpL();
1.518 + TInt CheckHorizontalScroll(const TTmDocPos& aDocPos);
1.519 + TInt DoHorizontalScrollDisplayL(TCursorPosition::TMovementType aMovement,
1.520 + CTextLayout::TAllowDisallow aScrollBlankSpace);
1.521 + TInt DoScrollDisplayL(TCursorPosition::TMovementType aMovement,CTextLayout::TAllowDisallow aScrollBlankSpace);
1.522 + void ScrollDisplayL();
1.523 + TPoint ViewTopOfLineL(const TTmDocPos& aDocPos,TInt& aYPos,
1.524 + CTextView::TDiscard aDiscardFormat = EFViewDontDiscardFormat,
1.525 + TDoHorizontalScroll aHorizontalScroll = EFCheckForHorizontalScroll);
1.526 + TPoint ViewL(const TTmDocPos& aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier = TViewYPosQualifier(),
1.527 + CTextView::TDiscard aDiscardFormat = EFViewDontDiscardFormat,
1.528 + TDoHorizontalScroll aHorizontalScroll = EFCheckForHorizontalScroll);
1.529 + TPoint DoHandleGlobalChangeL(TViewYPosQualifier aYPosQualifier,CTextView::TDiscard aDiscard);
1.530 + void UpdateHighlightL();
1.531 + void HighlightUsingExtensions(CTextLayout::TRangeChange aOptimizedRange, CTextLayout::TRangeChange aOriginalRange);
1.532 + void UpdatePictureFrameL();
1.533 + void RedrawPictureFrameRectL(TInt aPos);
1.534 + void DrawPictureFrameL(TRect& aClipRect);
1.535 + void DestroyWindowServerObjects();
1.536 + void NoMemoryL(TInt aErr);
1.537 + void RecoverNoMemoryL();
1.538 + void RecreateWindowServerObjectsL();
1.539 + void DrawTextSupportL(const TRect& aRect,const TCursorSelection* aHighlight);
1.540 + void DoDrawTextSupportL(const TRect& aRect,const TCursorSelection* aHighlight);
1.541 + void DoDrawTextSupportOpaqueL(const TRect& aRect,const TCursorSelection* aHighlight);
1.542 + void DisplayLineRangeL(TInt aFrom,TInt aTo);
1.543 + inline void NotifyReformatL();
1.544 + void CalculateHorizontalExtremes(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines);
1.545 + TBool ExtendedHighlightExists() const;
1.546 + void DoClearSelectionL(const TCursorSelection& aSelection, TBool aIsPictureFrame);
1.547 + void AdjustRectForScrolling(TRect &aRect, TInt aScrollY, TInt aScrollX) const;
1.548 + static void ResetOffScreenBitmapContext(TAny* aTextView);
1.549 + static void ResetExternalDraw(TAny* aTextView);
1.550 +
1.551 +private:
1.552 + CIdle* iWrap;
1.553 + RScreenDisplay iDisplay;
1.554 + CTextLayout* iLayout; // must not be moved
1.555 + TDrawTextLayoutContext iDrawTextLayoutContext; // must not be moved
1.556 + TCursor iCursor;
1.557 + TCursorPosition iCursorPos; // must not be moved
1.558 + TFrameOverlay* iPictureFrame;
1.559 + TMemoryStatus iNoMemory;
1.560 + TUint iFlags; // must not be moved
1.561 + TUint iHorizontalScroll;
1.562 + TInt iGood;
1.563 + TInt iFormattedUpTo;
1.564 + TInt iHorizontalScrollJump;
1.565 + TInt iHeightNotDrawn;
1.566 + MObserver* iObserver; // must not be moved
1.567 + /** Explicit off-screen bitmap to draw to.
1.568 + @internalComponent */
1.569 + CBitmapContext* iOffScreenContext;
1.570 + TRect iReducedDrawingAreaRect;
1.571 + TUint iDummy;// was iRedrawExtendedHighlight;
1.572 + TBool iContextIsNavigation;
1.573 + TBool iDrawOpaque;
1.574 + };
1.575 +
1.576 +inline TUint TCursor::LineCursorVisibility()
1.577 + {
1.578 + return iLineCursor;
1.579 + }
1.580 +
1.581 +inline TUint TCursor::TextCursorVisibility()
1.582 + {
1.583 + return iTextCursor;
1.584 + }
1.585 +
1.586 +/** Returns a pointer to the text layout object used by the text view.
1.587 +@return A pointer to the text layout object used by the text view. */
1.588 +inline const CTextLayout* CTextView::Layout() const
1.589 + {
1.590 + return iLayout;
1.591 + }
1.592 +
1.593 +/** Sets a text view observer. This provides notification to the owner of the
1.594 +text view object of changes to the formatting. Its OnReformatL() function is
1.595 +called after reformatting but before redisplay, so that edit windows etc. can
1.596 +be resized.
1.597 +
1.598 +@param aObserver Pointer to text view observer object. */
1.599 +inline void CTextView::SetObserver(MObserver* aObserver)
1.600 + {
1.601 + iObserver = aObserver;
1.602 + }
1.603 +
1.604 +inline void CTextView::EnableFlickerFreeRedraw()
1.605 + {
1.606 + iFlags |= EFFlickerFreeRedraw;
1.607 + }
1.608 +
1.609 +inline void CTextView::DisableFlickerFreeRedraw()
1.610 + {
1.611 + iFlags &= ~EFFlickerFreeRedraw;
1.612 + }
1.613 +
1.614 +inline TBool CTextView::FlickerFreeRedraw() const
1.615 + {
1.616 + return iFlags & EFFlickerFreeRedraw;
1.617 + }
1.618 +
1.619 +inline void CTextView::NotifyReformatL()
1.620 + {
1.621 + if (iObserver)
1.622 + iObserver->OnReformatL(this);
1.623 + }
1.624 +
1.625 +inline TBool CTextView::IsFormatting() const
1.626 + {
1.627 + return iLayout->IsBackgroundFormatting();
1.628 + }
1.629 +
1.630 +inline TInt CTextView::TopViewRect() const
1.631 + {
1.632 + return iDrawTextLayoutContext.iViewRect.iTl.iY;
1.633 + }
1.634 +
1.635 +inline void CTextView::DrawWithPreviousHighlight()
1.636 + {
1.637 + iCursorPos.SetToPreviousHighlight();
1.638 + }
1.639 +
1.640 +inline void CTextView::DrawWithCurrentHighlight()
1.641 + {
1.642 + iCursorPos.SetToCurrentHighlight();
1.643 + }
1.644 +
1.645 +/** Gets the origin of the cursor.
1.646 +@param aPoint On return, the cursor origin. */
1.647 +inline void CTextView::GetOrigin(TPoint& aPoint) const
1.648 + {
1.649 + iLayout->GetOrigin(aPoint);
1.650 + aPoint += iDrawTextLayoutContext.TopLeftText();
1.651 + }
1.652 +
1.653 +/** This constructor deliberately does not take a pointer or reference to
1.654 +CTextView, to prevent the class from being used unless InitL() is called. */
1.655 +inline CTextView::TTagmaForwarder::TTagmaForwarder():
1.656 + iView(NULL)
1.657 + {
1.658 + }
1.659 +
1.660 +/** Called after construction, to complete background reformatting.
1.661 +@param aView A pointer to the text view object. */
1.662 +inline void CTextView::TTagmaForwarder::InitL(CTextView* aView)
1.663 + {
1.664 + iView = aView;
1.665 + iView->FinishBackgroundFormattingL();
1.666 + }
1.667 +
1.668 +inline const CTmTextLayout& CTextView::TTagmaForwarder::TextLayout() const
1.669 + {
1.670 + return iView->Layout()->TagmaTextLayout();
1.671 + }
1.672 +
1.673 +inline void CTextView::TTagmaForwarder::GetOrigin(TPoint& aPoint) const
1.674 + {
1.675 + iView->GetOrigin(aPoint);
1.676 + }
1.677 +
1.678 +#endif