williamr@2
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
williamr@2
|
2 |
// All rights reserved.
|
williamr@2
|
3 |
// This component and the accompanying materials are made available
|
williamr@2
|
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
|
williamr@2
|
5 |
// which accompanies this distribution, and is available
|
williamr@2
|
6 |
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
|
williamr@2
|
7 |
//
|
williamr@2
|
8 |
// Initial Contributors:
|
williamr@2
|
9 |
// Nokia Corporation - initial contribution.
|
williamr@2
|
10 |
//
|
williamr@2
|
11 |
// Contributors:
|
williamr@2
|
12 |
//
|
williamr@2
|
13 |
// Description:
|
williamr@2
|
14 |
//
|
williamr@2
|
15 |
|
williamr@2
|
16 |
#ifndef __FRMTLAY_H__
|
williamr@2
|
17 |
#define __FRMTLAY_H__
|
williamr@2
|
18 |
|
williamr@2
|
19 |
#include <e32std.h>
|
williamr@2
|
20 |
#include <e32base.h>
|
williamr@2
|
21 |
#include <gdi.h>
|
williamr@2
|
22 |
#include <txtfrmat.h>
|
williamr@2
|
23 |
#include <txtetext.h>
|
williamr@2
|
24 |
#include <frmlaydt.h>
|
williamr@2
|
25 |
#include <frmparam.h>
|
williamr@2
|
26 |
#include <frmvis.h>
|
williamr@2
|
27 |
#include <tagma.h>
|
williamr@2
|
28 |
|
williamr@2
|
29 |
class CWindowGc;
|
williamr@2
|
30 |
class MLayDoc;
|
williamr@2
|
31 |
class TLayDocTextSource;
|
williamr@2
|
32 |
class TCursorPosition;
|
williamr@2
|
33 |
|
williamr@2
|
34 |
|
williamr@2
|
35 |
/**
|
williamr@2
|
36 |
This interface class defines an interface for clients of Form to provided
|
williamr@2
|
37 |
implementations of customisation interfaces relating to the source text
|
williamr@2
|
38 |
document as requried by the internals of Form and Tagma. Its use by
|
williamr@2
|
39 |
Form clients is optional.
|
williamr@2
|
40 |
Derived objects of this interface are registered with the CTextLayout
|
williamr@2
|
41 |
API and are called from the TLayDocTextSource class at present.
|
williamr@2
|
42 |
@publishedPartner
|
williamr@2
|
43 |
@released
|
williamr@2
|
44 |
@see MTmInlineTextSource
|
williamr@2
|
45 |
*/
|
williamr@2
|
46 |
class MFormCustomInterfaceProvider
|
williamr@2
|
47 |
{
|
williamr@2
|
48 |
public:
|
williamr@2
|
49 |
/**
|
williamr@2
|
50 |
Form uses this method to request an interface implmentation for the
|
williamr@2
|
51 |
specified interface Uid. See class description for interfaces covered
|
williamr@2
|
52 |
by this API.
|
williamr@2
|
53 |
@param aInterfaceId
|
williamr@2
|
54 |
The unique identifier for the interface wanted by Form.
|
williamr@2
|
55 |
@return
|
williamr@2
|
56 |
Ptr to interface instance or 0 if not supported by client
|
williamr@2
|
57 |
*/
|
williamr@2
|
58 |
virtual TAny* GetExtendedInterface(const TUid& aInterfaceId) = 0;
|
williamr@2
|
59 |
};
|
williamr@2
|
60 |
|
williamr@2
|
61 |
|
williamr@2
|
62 |
/** Parameter used to control which part of a line (top, baseline or bottom)
|
williamr@2
|
63 |
should be scrolled to a certain vertical position in a view rectangle. Used
|
williamr@2
|
64 |
as a parameter in functions like CTextView::HandleGlobalChangeL() and
|
williamr@2
|
65 |
CTextLayout::SetViewL(). The selected part of the line is called the hotspot.
|
williamr@2
|
66 |
@publishedAll
|
williamr@2
|
67 |
@released
|
williamr@2
|
68 |
*/
|
williamr@2
|
69 |
class TViewYPosQualifier
|
williamr@2
|
70 |
{
|
williamr@2
|
71 |
friend class CTextLayout;
|
williamr@2
|
72 |
friend class CTextView;
|
williamr@2
|
73 |
public:
|
williamr@2
|
74 |
/** Which part of a line (top, baseline or bottom) should appear at a
|
williamr@2
|
75 |
vertical pixel position. */
|
williamr@2
|
76 |
enum TPartOfLine
|
williamr@2
|
77 |
{
|
williamr@2
|
78 |
/** The top pixel is placed at the specified vertical point. */
|
williamr@2
|
79 |
EFViewTopOfLine = 1,
|
williamr@2
|
80 |
/** The baseline is placed at the specified vertical point. */
|
williamr@2
|
81 |
EFViewBaseLine = 0,
|
williamr@2
|
82 |
/** The bottom pixel is placed at the specified vertical point. */
|
williamr@2
|
83 |
EFViewBottomOfLine = 2
|
williamr@2
|
84 |
};
|
williamr@2
|
85 |
|
williamr@2
|
86 |
/** Whether the top line in the view should be fully visible. */
|
williamr@2
|
87 |
enum TFullyVisible
|
williamr@2
|
88 |
{
|
williamr@2
|
89 |
/** Force a partially visible top line to be fully visible. */
|
williamr@2
|
90 |
EFViewForceLineFullyVisible = ETrue,
|
williamr@2
|
91 |
/** Do not force a partially visible top line to be fully visible. */
|
williamr@2
|
92 |
EFViewDontForceLineFullyVisible = EFalse
|
williamr@2
|
93 |
};
|
williamr@2
|
94 |
public:
|
williamr@2
|
95 |
inline TViewYPosQualifier();
|
williamr@2
|
96 |
IMPORT_C void SetHotSpot(TPartOfLine aHotSpot);
|
williamr@2
|
97 |
IMPORT_C void SetFillScreen(TBool aFillScreen = ETrue);
|
williamr@2
|
98 |
IMPORT_C void SetMakeLineFullyVisible(TFullyVisible aMakeLineFullyVisible = EFViewForceLineFullyVisible);
|
williamr@2
|
99 |
private:
|
williamr@2
|
100 |
TPartOfLine iHotSpot;
|
williamr@2
|
101 |
TBool iFillScreen;
|
williamr@2
|
102 |
TFullyVisible iFullyVisible;
|
williamr@2
|
103 |
};
|
williamr@2
|
104 |
|
williamr@2
|
105 |
/**
|
williamr@2
|
106 |
A structure used to return the results of a reformatting operation.
|
williamr@2
|
107 |
@see CTextLayout::HandleBlockChangeL()
|
williamr@2
|
108 |
@publishedAll
|
williamr@2
|
109 |
@released
|
williamr@2
|
110 |
*/
|
williamr@2
|
111 |
class TViewRectChanges
|
williamr@2
|
112 |
|
williamr@2
|
113 |
{
|
williamr@2
|
114 |
public:
|
williamr@2
|
115 |
inline TViewRectChanges();
|
williamr@2
|
116 |
|
williamr@2
|
117 |
public:
|
williamr@2
|
118 |
/** The vertical coordinate of the top of the first line of reformatted
|
williamr@2
|
119 |
text. */
|
williamr@2
|
120 |
TInt iFormattedFrom;
|
williamr@2
|
121 |
/** The vertical coordinate of the bottom of the last line of reformatted
|
williamr@2
|
122 |
text. */
|
williamr@2
|
123 |
TInt iFormattedTo;
|
williamr@2
|
124 |
/** The number of pixels by which text above the reformatted or edited
|
williamr@2
|
125 |
block has scrolled (positive values mean the text moved down). */
|
williamr@2
|
126 |
TInt iScrollAtTop;
|
williamr@2
|
127 |
/** The number of pixels by which text below the reformatted or edited
|
williamr@2
|
128 |
block has scrolled (positive values mean the text moved down). */
|
williamr@2
|
129 |
TInt iScrollAtBottom;
|
williamr@2
|
130 |
};
|
williamr@2
|
131 |
|
williamr@2
|
132 |
/**
|
williamr@2
|
133 |
The cursor or cursor selection within a document.
|
williamr@2
|
134 |
|
williamr@2
|
135 |
If the cursor and anchor position differ, the selection covers the text from
|
williamr@2
|
136 |
the lower to the higher position, not including the character after the higher
|
williamr@2
|
137 |
position. If the selection is changed (by shift plus arrow keys in many UIs)
|
williamr@2
|
138 |
the cursor position changes and the anchor remains the same.
|
williamr@2
|
139 |
@publishedAll
|
williamr@2
|
140 |
@released
|
williamr@2
|
141 |
*/
|
williamr@2
|
142 |
class TCursorSelection
|
williamr@2
|
143 |
|
williamr@2
|
144 |
{
|
williamr@2
|
145 |
public:
|
williamr@2
|
146 |
inline TCursorSelection();
|
williamr@2
|
147 |
inline TCursorSelection(TInt aCursorPos,TInt aAnchorPos);
|
williamr@2
|
148 |
inline void SetSelection(TInt aCursorPos,TInt aAnchorPos);
|
williamr@2
|
149 |
inline TInt LowerPos() const;
|
williamr@2
|
150 |
inline TInt HigherPos() const;
|
williamr@2
|
151 |
inline TInt Length() const;
|
williamr@2
|
152 |
public:
|
williamr@2
|
153 |
/** The cursor position. */
|
williamr@2
|
154 |
TInt iCursorPos;
|
williamr@2
|
155 |
/** The anchor position. */
|
williamr@2
|
156 |
TInt iAnchorPos;
|
williamr@2
|
157 |
};
|
williamr@2
|
158 |
|
williamr@2
|
159 |
/**
|
williamr@2
|
160 |
Parameters used by functions that draw text.
|
williamr@2
|
161 |
|
williamr@2
|
162 |
An object of this class is passed to CTextLayout::DrawL() and to
|
williamr@2
|
163 |
InvertRangeL(). The draw context includes the view rectangle, the graphics
|
williamr@2
|
164 |
context, the background colour and the margin widths.
|
williamr@2
|
165 |
|
williamr@2
|
166 |
You only need to use this class directly when you are using a CTextLayout
|
williamr@2
|
167 |
object which is not owned by a CTextView object.
|
williamr@2
|
168 |
@publishedAll
|
williamr@2
|
169 |
@released
|
williamr@2
|
170 |
*/
|
williamr@2
|
171 |
class TDrawTextLayoutContext
|
williamr@2
|
172 |
|
williamr@2
|
173 |
{
|
williamr@2
|
174 |
private:
|
williamr@2
|
175 |
enum TDrawMode
|
williamr@2
|
176 |
{
|
williamr@2
|
177 |
EFDrawText=0x001,
|
williamr@2
|
178 |
EFDrawGraphics=0x002,
|
williamr@2
|
179 |
EFUseClippingRect=0x004,
|
williamr@2
|
180 |
EFUseWindowGc=0x008,
|
williamr@2
|
181 |
EFUseGcClear=0x020,
|
williamr@2
|
182 |
EFUseBackgroundColor=0x040,
|
williamr@2
|
183 |
EFUseOverrideTextColor=0x080,
|
williamr@2
|
184 |
EFParagraphFillTextOnly=0x100,
|
williamr@2
|
185 |
EFAllFlags=0xfff
|
williamr@2
|
186 |
};
|
williamr@2
|
187 |
public:
|
williamr@2
|
188 |
IMPORT_C TDrawTextLayoutContext();
|
williamr@2
|
189 |
|
williamr@2
|
190 |
IMPORT_C void SetGc(CGraphicsContext* aGc,CGraphicsContext* aPictureGc=NULL);
|
williamr@2
|
191 |
IMPORT_C void SetBitmapGc(CBitmapContext* aGc,CBitmapContext* aPictureGc=NULL);
|
williamr@2
|
192 |
IMPORT_C void SetWindowGc(CWindowGc* aGc,CWindowGc* aPictureGc=NULL);
|
williamr@2
|
193 |
IMPORT_C void SetDrawToEveryPixel(TBool aDrawToEveryPixel);
|
williamr@2
|
194 |
IMPORT_C void SetTextColorOverride(const TRgb *aOverrideColor);
|
williamr@2
|
195 |
IMPORT_C void SetDrawTextOnly();
|
williamr@2
|
196 |
IMPORT_C void SetDrawGraphicsOnly();
|
williamr@2
|
197 |
IMPORT_C void SetDrawTextAndGraphics();
|
williamr@2
|
198 |
IMPORT_C void SetClipping(TBool aClipping);
|
williamr@2
|
199 |
// deprecated 7.0
|
williamr@2
|
200 |
IMPORT_C void SetParagraphFillTextOnly(TBool aFillTextOnly);
|
williamr@2
|
201 |
|
williamr@2
|
202 |
//Enquiry functions
|
williamr@2
|
203 |
IMPORT_C const TRgb* TextOverrideColor() const;
|
williamr@2
|
204 |
IMPORT_C CGraphicsContext* PrimaryGc() const;
|
williamr@2
|
205 |
IMPORT_C CGraphicsContext* PictureGc() const;
|
williamr@2
|
206 |
IMPORT_C TBool UseClippingRect() const;
|
williamr@2
|
207 |
IMPORT_C TBool UseGcClear() const;
|
williamr@2
|
208 |
IMPORT_C TBool DrawText() const;
|
williamr@2
|
209 |
IMPORT_C TBool DrawGraphics() const;
|
williamr@2
|
210 |
IMPORT_C TBool UseBackgroundColor() const;
|
williamr@2
|
211 |
// deprecated 7.0
|
williamr@2
|
212 |
IMPORT_C TBool ParagraphFillTextOnly() const;
|
williamr@2
|
213 |
|
williamr@2
|
214 |
//Physical dimensions
|
williamr@2
|
215 |
IMPORT_C TRect TextArea() const;
|
williamr@2
|
216 |
IMPORT_C TInt DisplayHeight() const;
|
williamr@2
|
217 |
IMPORT_C TPoint TopLeftTextArea() const;
|
williamr@2
|
218 |
IMPORT_C TRect TotalMargin() const;
|
williamr@2
|
219 |
IMPORT_C TRect LabelMargin() const;
|
williamr@2
|
220 |
IMPORT_C TBool IsLabelMargin() const;
|
williamr@2
|
221 |
IMPORT_C TRect GutterMargin() const;
|
williamr@2
|
222 |
IMPORT_C TBool IsGutterMargin() const;
|
williamr@2
|
223 |
IMPORT_C TPoint TopLeftText() const;
|
williamr@2
|
224 |
IMPORT_C void WindowToText(TPoint& aWinPos) const;
|
williamr@2
|
225 |
IMPORT_C void WindowToText(TRect& aRect) const;
|
williamr@2
|
226 |
IMPORT_C void TextToWindow(TPoint& aTextAreaPos) const;
|
williamr@2
|
227 |
IMPORT_C void TextToWindow(TRect& aRect) const;
|
williamr@2
|
228 |
|
williamr@2
|
229 |
TBool UseWindowGc() const;
|
williamr@2
|
230 |
void SetDrawMode(TUint aDrawMode);
|
williamr@2
|
231 |
TUint DrawMode() const;
|
williamr@2
|
232 |
|
williamr@2
|
233 |
public:
|
williamr@2
|
234 |
/** The view rectangle (specified in window coordinates). This is used to
|
williamr@2
|
235 |
set the area in which text can be drawn. Text can only be drawn within the
|
williamr@2
|
236 |
intersection between the text area and the aDrawRect parameter passed to
|
williamr@2
|
237 |
CTextLayout::DrawL() or InvertRangeL(). */
|
williamr@2
|
238 |
TRect iViewRect;
|
williamr@2
|
239 |
/** The label margin width. By default zero. Must have the same value as
|
williamr@2
|
240 |
the label margin width as set in the text layout object. */
|
williamr@2
|
241 |
TInt iLabelMarginWidth;
|
williamr@2
|
242 |
/** The gutter margin width (also known as the line cursor margin width).
|
williamr@2
|
243 |
By default zero. */
|
williamr@2
|
244 |
TInt iGutterMarginWidth;
|
williamr@2
|
245 |
/** The horizontal offset between window coordinates and text layout
|
williamr@2
|
246 |
coordinates. */
|
williamr@2
|
247 |
TInt iTextStartX;
|
williamr@2
|
248 |
/** The background colour for the view rectangle. The background colour is
|
williamr@2
|
249 |
used to fill the parts of the view rectangle in which text cannot appear,
|
williamr@2
|
250 |
for example, below the last line of the document and in the label, line
|
williamr@2
|
251 |
cursor and left text margins. */
|
williamr@2
|
252 |
TLogicalRgb iBackgroundColor;
|
williamr@2
|
253 |
private:
|
williamr@2
|
254 |
CGraphicsContext* iGc;
|
williamr@2
|
255 |
CGraphicsContext* iPictureGc;
|
williamr@2
|
256 |
TLogicalRgb iOverrideTextColor;
|
williamr@2
|
257 |
TUint iDrawMode;
|
williamr@2
|
258 |
};
|
williamr@2
|
259 |
|
williamr@2
|
260 |
/**
|
williamr@2
|
261 |
An abstract class which specifies the protocol for customising the way text
|
williamr@2
|
262 |
and its background are drawn.
|
williamr@2
|
263 |
|
williamr@2
|
264 |
Common uses for this are to implement custom highlighting or to draw a
|
williamr@2
|
265 |
background bitmap. You must create an object of a class derived from this class
|
williamr@2
|
266 |
and call CTextLayout::SetCustomDraw(), passing a pointer to the object. All of
|
williamr@2
|
267 |
these functions have default implementations. Your class can override any of the
|
williamr@2
|
268 |
virtual functions listed below.
|
williamr@2
|
269 |
@publishedAll
|
williamr@2
|
270 |
@released
|
williamr@2
|
271 |
*/
|
williamr@2
|
272 |
class MFormCustomDraw
|
williamr@2
|
273 |
|
williamr@2
|
274 |
{
|
williamr@2
|
275 |
public:
|
williamr@2
|
276 |
|
williamr@2
|
277 |
class TParam
|
williamr@2
|
278 |
/**
|
williamr@2
|
279 |
Parameters used by several custom draw functions
|
williamr@2
|
280 |
@publishedAll
|
williamr@2
|
281 |
@released
|
williamr@2
|
282 |
*/
|
williamr@2
|
283 |
{
|
williamr@2
|
284 |
public:
|
williamr@2
|
285 |
TParam(CGraphicsContext& aGc,MGraphicsDeviceMap& aMap,const TPoint& aTextLayoutTopLeft,const TRect& aDrawRect):
|
williamr@2
|
286 |
iGc(aGc), iMap(aMap), iTextLayoutTopLeft(aTextLayoutTopLeft), iDrawRect(aDrawRect) { }
|
williamr@2
|
287 |
|
williamr@2
|
288 |
CGraphicsContext& iGc;
|
williamr@2
|
289 |
MGraphicsDeviceMap& iMap;
|
williamr@2
|
290 |
const TPoint& iTextLayoutTopLeft;
|
williamr@2
|
291 |
const TRect& iDrawRect;
|
williamr@2
|
292 |
};
|
williamr@2
|
293 |
|
williamr@2
|
294 |
class TLineInfo
|
williamr@2
|
295 |
/**
|
williamr@2
|
296 |
Contains the line metrics.
|
williamr@2
|
297 |
@publishedAll
|
williamr@2
|
298 |
@released
|
williamr@2
|
299 |
*/
|
williamr@2
|
300 |
{
|
williamr@2
|
301 |
public:
|
williamr@2
|
302 |
TLineInfo(const TRect& aOuterRect,const TRect& aInnerRect,TInt aBaseline):
|
williamr@2
|
303 |
iOuterRect(aOuterRect), iInnerRect(aInnerRect), iBaseline(aBaseline) { }
|
williamr@2
|
304 |
|
williamr@2
|
305 |
const TRect& iOuterRect;
|
williamr@2
|
306 |
const TRect& iInnerRect;
|
williamr@2
|
307 |
TInt iBaseline;
|
williamr@2
|
308 |
};
|
williamr@2
|
309 |
|
williamr@2
|
310 |
IMPORT_C virtual void DrawBackground(const TParam& aParam,const TRgb& aBackground,TRect& aDrawn) const;
|
williamr@2
|
311 |
IMPORT_C virtual void DrawLineGraphics(const TParam& aParam,const TLineInfo& aLineInfo) const;
|
williamr@2
|
312 |
IMPORT_C virtual void DrawText(const TParam& aParam,const TLineInfo& aLineInfo,const TCharFormat& aFormat,
|
williamr@2
|
313 |
const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const;
|
williamr@2
|
314 |
IMPORT_C virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
|
williamr@2
|
315 |
|
williamr@2
|
316 |
IMPORT_C virtual void MFormCustomDraw_Reserved_1();
|
williamr@2
|
317 |
IMPORT_C virtual void MFormCustomDraw_Reserved_2();
|
williamr@2
|
318 |
};
|
williamr@2
|
319 |
|
williamr@2
|
320 |
|
williamr@2
|
321 |
/**
|
williamr@2
|
322 |
An interface class that can be derived from to implement custom line breaking.
|
williamr@2
|
323 |
|
williamr@2
|
324 |
Custom line breaking allows the Text Views line wrapping algorithm to break
|
williamr@2
|
325 |
lines in any way. For instance, it may be used to avoid the jagged white space
|
williamr@2
|
326 |
at the right edge of text windows caused by normal line wrapping on a small
|
williamr@2
|
327 |
screen.
|
williamr@2
|
328 |
|
williamr@2
|
329 |
All of these functions have a default implementation. To change the default
|
williamr@2
|
330 |
behaviour, a pointer to an object that overrides any or all of the functions
|
williamr@2
|
331 |
in the interface needs to be passed to the function CTextLayout::SetCustomWrap().
|
williamr@2
|
332 |
@since 6.2
|
williamr@2
|
333 |
|
williamr@2
|
334 |
@see CTextLayout::SetCustomWrap()
|
williamr@2
|
335 |
@publishedAll
|
williamr@2
|
336 |
@released
|
williamr@2
|
337 |
*/
|
williamr@2
|
338 |
class MFormCustomWrap
|
williamr@2
|
339 |
|
williamr@2
|
340 |
{
|
williamr@2
|
341 |
public:
|
williamr@2
|
342 |
IMPORT_C virtual TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
|
williamr@2
|
343 |
IMPORT_C virtual TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
|
williamr@2
|
344 |
IMPORT_C virtual TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
|
williamr@2
|
345 |
TBool aForwards,TInt& aBreakPos) const;
|
williamr@2
|
346 |
IMPORT_C virtual TBool IsHangingCharacter(TUint aChar) const;
|
williamr@2
|
347 |
private:
|
williamr@2
|
348 |
IMPORT_C virtual void MFormCustomWrap_Reserved_1();
|
williamr@2
|
349 |
IMPORT_C virtual void MFormCustomWrap_Reserved_2();
|
williamr@2
|
350 |
};
|
williamr@2
|
351 |
|
williamr@2
|
352 |
|
williamr@2
|
353 |
/**
|
williamr@2
|
354 |
Mixin class used to customize visible appearance of invisible characters
|
williamr@2
|
355 |
such as a paragraph mark or a tab.
|
williamr@2
|
356 |
|
williamr@2
|
357 |
@see CTextView::SetCustomInvisibleCharacterRemapper()
|
williamr@2
|
358 |
@publishedAll
|
williamr@2
|
359 |
@released
|
williamr@2
|
360 |
*/
|
williamr@2
|
361 |
class MFormCustomInvisibleCharacterRemapper
|
williamr@2
|
362 |
{
|
williamr@2
|
363 |
public:
|
williamr@2
|
364 |
IMPORT_C static TUint DefaultMapping(TUint aChar, const TNonPrintingCharVisibility aNonPrintingCharVisibility, const TLayDocTextSource& aLayDoc);
|
williamr@2
|
365 |
|
williamr@2
|
366 |
/**
|
williamr@2
|
367 |
Allows custom remapping of invisible characters.
|
williamr@2
|
368 |
|
williamr@2
|
369 |
Called by TLayDocTextSource::Map() if it has been created and registered
|
williamr@2
|
370 |
with TLayDocTextSource using CTextLayout::SetInvisibleCharacterRemapper().
|
williamr@2
|
371 |
|
williamr@2
|
372 |
Unless there is a specific reason for doing otherwise it is recommended
|
williamr@2
|
373 |
that where this function has not remapped a given character it should
|
williamr@2
|
374 |
pass it to DefaultMapping() to let it try.
|
williamr@2
|
375 |
|
williamr@2
|
376 |
@param aChar
|
williamr@2
|
377 |
Invisible character to be remapped
|
williamr@2
|
378 |
@param aDesiredVisibilities
|
williamr@2
|
379 |
Current state of flags showing visibility of invisible characters
|
williamr@2
|
380 |
@param aLayDoc
|
williamr@2
|
381 |
Const ref to the calling CLayDocTextSource
|
williamr@2
|
382 |
@return
|
williamr@2
|
383 |
The replacement character if remapping has taken place, else return original character
|
williamr@2
|
384 |
*/
|
williamr@2
|
385 |
virtual TUint Remap(TUint aChar, const TNonPrintingCharVisibility aNonPrintingCharVisibility, const TLayDocTextSource& aLayDoc) = 0;
|
williamr@2
|
386 |
};
|
williamr@2
|
387 |
|
williamr@2
|
388 |
|
williamr@2
|
389 |
/**
|
williamr@2
|
390 |
@internalTechnology
|
williamr@2
|
391 |
Internal to Symbian
|
williamr@2
|
392 |
*/
|
williamr@2
|
393 |
NONSHARABLE_CLASS(TLayDocTextSource) : public MTmSource, public MFormLabelApi, public MTmTextDrawExt
|
williamr@2
|
394 |
{
|
williamr@2
|
395 |
public:
|
williamr@2
|
396 |
|
williamr@2
|
397 |
enum
|
williamr@2
|
398 |
{
|
williamr@2
|
399 |
EDefaultFontHeightIncreaseFactor = 7,
|
williamr@2
|
400 |
EDefaultMinimumLineDescent = 3
|
williamr@2
|
401 |
};
|
williamr@2
|
402 |
|
williamr@2
|
403 |
TLayDocTextSource();
|
williamr@2
|
404 |
|
williamr@2
|
405 |
// overrides for MTmSource pure virtual functions
|
williamr@2
|
406 |
MGraphicsDeviceMap& FormatDevice() const;
|
williamr@2
|
407 |
MGraphicsDeviceMap& InterpretDevice() const;
|
williamr@2
|
408 |
TInt DocumentLength() const;
|
williamr@2
|
409 |
void GetText(TInt aPos,TPtrC& aText,TTmCharFormat& aFormat) const;
|
williamr@2
|
410 |
void GetParagraphFormatL(TInt aPos,RTmParFormat& aFormat) const;
|
williamr@2
|
411 |
TInt ParagraphStart(TInt aPos) const;
|
williamr@2
|
412 |
|
williamr@2
|
413 |
// overrides for other MTmSource virtual functions
|
williamr@2
|
414 |
TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
|
williamr@2
|
415 |
CPicture* PictureL(TInt aPos) const;
|
williamr@2
|
416 |
TInt GetPictureSizeInTwipsL(TInt aPos,TSize& aSize) const;
|
williamr@2
|
417 |
TBool LabelModeSelect(TLabelType aType, TInt aPos);
|
williamr@2
|
418 |
void LabelModeCancel();
|
williamr@2
|
419 |
void LabelMetrics(TLabelType aType, TSize& aLabelSize, TInt& aMarginSize) const;
|
williamr@2
|
420 |
TUint Map(TUint aChar) const;
|
williamr@2
|
421 |
void SetLineHeight(const TLineHeightParam& aParam,TInt& aAscent,TInt& aDescent) const;
|
williamr@2
|
422 |
TBool PageBreakInRange(TInt aStartPos,TInt aEndPos) const;
|
williamr@2
|
423 |
void DrawBackground(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
|
williamr@2
|
424 |
const TLogicalRgb& aBackground,TRect& aRectDrawn) const;
|
williamr@2
|
425 |
void DrawLineGraphics(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
|
williamr@2
|
426 |
const TTmLineInfo& aLineInfo) const;
|
williamr@2
|
427 |
void DrawText(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
|
williamr@2
|
428 |
const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat,
|
williamr@2
|
429 |
const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const;
|
williamr@2
|
430 |
virtual void DrawPicture(CGraphicsContext& aGc,
|
williamr@2
|
431 |
const TPoint& aTextLayoutTopLeft, const TRect& aRect,
|
williamr@2
|
432 |
MGraphicsDeviceMap& aDevice, const CPicture& aPicture) const;
|
williamr@2
|
433 |
|
williamr@2
|
434 |
// overrides for the MTmSource virtual functions which implements the MFormCustomWrap
|
williamr@2
|
435 |
// if iCustomWrap is set.
|
williamr@2
|
436 |
TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
|
williamr@2
|
437 |
TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
|
williamr@2
|
438 |
TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
|
williamr@2
|
439 |
TBool aForwards,TInt& aBreakPos) const;
|
williamr@2
|
440 |
TBool IsHangingCharacter(TUint aChar) const;
|
williamr@2
|
441 |
|
williamr@2
|
442 |
// other functions
|
williamr@2
|
443 |
TBool CanMap() const;
|
williamr@2
|
444 |
|
williamr@2
|
445 |
TAny* GetExtendedInterface(const TUid& aInterfaceId);
|
williamr@2
|
446 |
|
williamr@2
|
447 |
//MTmTextDrawExt implementations
|
williamr@2
|
448 |
virtual void DrawLine(CGraphicsContext& aGc, const TPoint& aPt1, const TPoint& aPt2) const;
|
williamr@2
|
449 |
virtual void DrawText(CGraphicsContext& aGc, const TDesC& aText, const TPoint& aPt) const;
|
williamr@2
|
450 |
virtual void DrawRect(CGraphicsContext& aGc, const TRect& aRc) const;
|
williamr@2
|
451 |
|
williamr@2
|
452 |
//Set/reset opaque flag of aGc graphics context
|
williamr@2
|
453 |
void SetOpaque(CGraphicsContext& aGc) const;
|
williamr@2
|
454 |
void ResetOpaque(CGraphicsContext& aGc) const;
|
williamr@2
|
455 |
|
williamr@2
|
456 |
// flags
|
williamr@2
|
457 |
enum
|
williamr@2
|
458 |
{
|
williamr@2
|
459 |
EWrap = 1,
|
williamr@2
|
460 |
ETruncateWithEllipsis = 2,
|
williamr@2
|
461 |
EUseLabelsDevice = 4
|
williamr@2
|
462 |
};
|
williamr@2
|
463 |
|
williamr@2
|
464 |
MLayDoc* iLayDoc;
|
williamr@2
|
465 |
TUint iFlags; // wrap, truncate, etc.
|
williamr@2
|
466 |
TInt iWidth; // wrapping width
|
williamr@2
|
467 |
TChar iEllipsis; // ellipsis character (or none if 0xFFFF) used if truncating
|
williamr@2
|
468 |
TInt iLabelsWidth;
|
williamr@2
|
469 |
TInt iLabelsGutter;
|
williamr@2
|
470 |
CLayoutData::TFormatMode iFormatMode;
|
williamr@2
|
471 |
MGraphicsDeviceMap* iImageDevice; // device map used for drawing text
|
williamr@2
|
472 |
MGraphicsDeviceMap* iLabelsDevice; // device map used for labels
|
williamr@2
|
473 |
MGraphicsDeviceMap* iFormatDevice; // device map used for formatting
|
williamr@2
|
474 |
TInt iFontHeightIncreaseFactor; // percentage automatically added to font heights
|
williamr@2
|
475 |
TInt iMinimumLineDescent; // minimum line descent in pixels
|
williamr@2
|
476 |
TNonPrintingCharVisibility iNonPrintingCharVisibility;
|
williamr@2
|
477 |
const MFormParam* iFormParam; // if non-null, points to the object that supplies system colours
|
williamr@2
|
478 |
const MFormCustomDraw* iCustomDraw; // if non-null, points to custom drawing routines
|
williamr@2
|
479 |
const MFormCustomWrap* iCustomWrap; // if non-null, points to custom wrapping routines
|
williamr@2
|
480 |
/** Optional object able to provide a concrete customisation object for use
|
williamr@2
|
481 |
internally by Form. */
|
williamr@2
|
482 |
MFormCustomInterfaceProvider* iInterfaceProvider;
|
williamr@2
|
483 |
TBool iDrawOpaque; // Opaque drawing active if the flag is ETrue
|
williamr@2
|
484 |
TInt iExcessHeightRequired; // delta required to position the baseline so there is enough
|
williamr@2
|
485 |
// space for the highset glyph in pixels.
|
williamr@2
|
486 |
MFormCustomInvisibleCharacterRemapper* iInvisibleCharacterRemapper; // Used to customize the remapping of
|
williamr@2
|
487 |
// invisible characters to visible characters
|
williamr@2
|
488 |
};
|
williamr@2
|
489 |
|
williamr@2
|
490 |
/**
|
williamr@2
|
491 |
Text layout.
|
williamr@2
|
492 |
|
williamr@2
|
493 |
CTextLayout is the lowest-level text formatting class in the Text Views API. It
|
williamr@2
|
494 |
obtains text and formatting attributes via the MLayDoc interface class and
|
williamr@2
|
495 |
formats the text to a certain width.
|
williamr@2
|
496 |
|
williamr@2
|
497 |
It has functions for drawing the text and performing hit-detection that is,
|
williamr@2
|
498 |
converting x-y coordinates to document positions, and vice versa. It defines
|
williamr@2
|
499 |
many public functions that are not generally useful, but are called by the
|
williamr@2
|
500 |
higher-level CTextView class, or exist only for the convenience of closely
|
williamr@2
|
501 |
associated classes like the printing and pagination systems. These are
|
williamr@2
|
502 |
identified in the documentation by the text "not generally useful".
|
williamr@2
|
503 |
|
williamr@2
|
504 |
When using the CTextLayout class, you must be aware of what functions have
|
williamr@2
|
505 |
previously been called. For example:
|
williamr@2
|
506 |
|
williamr@2
|
507 |
1) Formatting and scrolling functions must not be called if a CTextView object
|
williamr@2
|
508 |
owns the CTextLayout object, because the CTextView object may be reformatting
|
williamr@2
|
509 |
the CTextLayout object asynchronously by means of an active object, or may hold
|
williamr@2
|
510 |
some state information about the CTextLayout object that would be invalidated
|
williamr@2
|
511 |
by reformatting. These functions are identified in the documentation by the
|
williamr@2
|
512 |
text "Do not use if a CTextView object owns this CTextLayout object.".
|
williamr@2
|
513 |
|
williamr@2
|
514 |
2) Functions that raise out of memory exceptions can leave the object in an
|
williamr@2
|
515 |
inconsistent state; these functions can be identified as usual by their
|
williamr@2
|
516 |
trailing L. When this occurs, it is necessary to discard the formatting
|
williamr@2
|
517 |
information by calling DiscardFormat().
|
williamr@2
|
518 |
|
williamr@2
|
519 |
3) Some functions change formatting parameters like the wrap width or band
|
williamr@2
|
520 |
height, but do not reformat to reflect the change. These functions are
|
williamr@2
|
521 |
identified in the documentation by the text "Reformat needed".
|
williamr@2
|
522 |
@publishedAll
|
williamr@2
|
523 |
@released
|
williamr@2
|
524 |
*/
|
williamr@2
|
525 |
class CTextLayout: public CBase
|
williamr@2
|
526 |
|
williamr@2
|
527 |
{
|
williamr@2
|
528 |
friend class CTestTextLayout;
|
williamr@2
|
529 |
public:
|
williamr@2
|
530 |
|
williamr@2
|
531 |
/**Flags used by CTextLayout::SetViewL(). Whether to reformat and redraw.*/
|
williamr@2
|
532 |
enum TDiscard
|
williamr@2
|
533 |
{
|
williamr@2
|
534 |
/** Discard all formatting; redraw. */
|
williamr@2
|
535 |
EFViewDiscardAllFormat = TRUE,
|
williamr@2
|
536 |
/** Do not discard all formatting; redraw. */
|
williamr@2
|
537 |
EFViewDontDiscardFormat = FALSE
|
williamr@2
|
538 |
};
|
williamr@2
|
539 |
|
williamr@2
|
540 |
/** Indicates whether blank space should scroll.
|
williamr@2
|
541 |
Used by several CTextView and CTextLayout scrolling functions. */
|
williamr@2
|
542 |
enum TAllowDisallow
|
williamr@2
|
543 |
{
|
williamr@2
|
544 |
/** Allow blank space to scroll. */
|
williamr@2
|
545 |
EFAllowScrollingBlankSpace = TRUE,
|
williamr@2
|
546 |
/** Disallow blank space from scrolling. */
|
williamr@2
|
547 |
EFDisallowScrollingBlankSpace = FALSE
|
williamr@2
|
548 |
};
|
williamr@2
|
549 |
|
williamr@2
|
550 |
enum // flags for HandleCharEditL
|
williamr@2
|
551 |
{
|
williamr@2
|
552 |
/** Insert a character, (not a paragraph delimiter). */
|
williamr@2
|
553 |
EFCharacterInsert,
|
williamr@2
|
554 |
/** Insert a paragraph delimiter. */
|
williamr@2
|
555 |
EFParagraphDelimiter,
|
williamr@2
|
556 |
/** Delete single character to the left. */
|
williamr@2
|
557 |
EFLeftDelete,
|
williamr@2
|
558 |
/** Delete single character to the right. */
|
williamr@2
|
559 |
EFRightDelete
|
williamr@2
|
560 |
};
|
williamr@2
|
561 |
|
williamr@2
|
562 |
enum
|
williamr@2
|
563 |
{
|
williamr@2
|
564 |
/** A value greater than any possible display height indicates that the
|
williamr@2
|
565 |
entire visible area, at least, was scrolled, and so there is no point
|
williamr@2
|
566 |
in blitting text; a full redraw is needed.
|
williamr@2
|
567 |
*/
|
williamr@2
|
568 |
EFScrollRedrawWholeScreen = CLayoutData::EFLargeNumber,
|
williamr@2
|
569 |
/** The maximum line width when wrapping is unset. */
|
williamr@2
|
570 |
EFMaximumLineWidth = CLayoutData::EFBodyWidthForNoWrapping,
|
williamr@2
|
571 |
};
|
williamr@2
|
572 |
|
williamr@2
|
573 |
enum
|
williamr@2
|
574 |
{
|
williamr@2
|
575 |
/** Wrapping off; overrides the paragraph format. */
|
williamr@2
|
576 |
EFAllParagraphsNotWrapped = TRUE,
|
williamr@2
|
577 |
/** Wrapping on, unless CParaFormat::iWrap is false. */
|
williamr@2
|
578 |
EFParagraphsWrappedByDefault = FALSE
|
williamr@2
|
579 |
};
|
williamr@2
|
580 |
|
williamr@2
|
581 |
/** Amount to format. Used by CTextLayout::SetAmountToFormat(). */
|
williamr@2
|
582 |
enum TAmountFormatted
|
williamr@2
|
583 |
{
|
williamr@2
|
584 |
/** Format the whole document. */
|
williamr@2
|
585 |
EFFormatAllText = FALSE,
|
williamr@2
|
586 |
/** Format the visible band only. */
|
williamr@2
|
587 |
EFFormatBand = TRUE,
|
williamr@2
|
588 |
};
|
williamr@2
|
589 |
|
williamr@2
|
590 |
enum TScrollFlags
|
williamr@2
|
591 |
{
|
williamr@2
|
592 |
EFScrollOnlyToTopsOfLines = 1
|
williamr@2
|
593 |
};
|
williamr@2
|
594 |
|
williamr@2
|
595 |
/** Formatting information. */
|
williamr@2
|
596 |
enum TCurrentFormat
|
williamr@2
|
597 |
{
|
williamr@2
|
598 |
/** Returned by some CTextLayout enquiry functions to indicate that no
|
williamr@2
|
599 |
formatting has taken place so that the requested value cannot be
|
williamr@2
|
600 |
calculated. */
|
williamr@2
|
601 |
EFNoCurrentFormat = -1,
|
williamr@2
|
602 |
/** Returned by CTextLayout::ParagraphHeight() when the paragraph is not formatted. */
|
williamr@2
|
603 |
EFNotInCurrentFormat = 0
|
williamr@2
|
604 |
};
|
williamr@2
|
605 |
public:
|
williamr@2
|
606 |
class TRangeChange
|
williamr@2
|
607 |
/**
|
williamr@2
|
608 |
Specifies the range of characters involved when setting or clearing a
|
williamr@2
|
609 |
text selection.
|
williamr@2
|
610 |
|
williamr@2
|
611 |
This class is used in the CTextLayout::Highlight() function. The following
|
williamr@2
|
612 |
code demonstrates how it should be used to clear an existing highlight and
|
williamr@2
|
613 |
set a new one:
|
williamr@2
|
614 |
|
williamr@2
|
615 |
@code
|
williamr@2
|
616 |
CTextLayout::TRangeChange oldHighlight(anchorPos, old_cursorPos,
|
williamr@2
|
617 |
CTextLayout::TRangeChange::EClear); // existing highlight
|
williamr@2
|
618 |
CTextLayout::TRangeChange newHighlight(anchorPos, new_cursorPos,
|
williamr@2
|
619 |
CTextLayout::TRangeChange::ESet); // new one
|
williamr@2
|
620 |
newHighlight.OptimizeWith(oldHighlight); // doesn't matter which range is
|
williamr@2
|
621 |
the parameter and which is the calling object
|
williamr@2
|
622 |
layout.Highlight(oldHighlight,drawRect,context); // doesn't matter in which
|
williamr@2
|
623 |
order this and following line occur
|
williamr@2
|
624 |
layout.Highlight(newHighlight,drawRect,context);
|
williamr@2
|
625 |
@endcode
|
williamr@2
|
626 |
|
williamr@2
|
627 |
@see CTextLayout::Highlight()
|
williamr@2
|
628 |
@publishedAll
|
williamr@2
|
629 |
@released
|
williamr@2
|
630 |
*/
|
williamr@2
|
631 |
{
|
williamr@2
|
632 |
public:
|
williamr@2
|
633 |
/** Enumerates the possible change types. */
|
williamr@2
|
634 |
enum TChangeType
|
williamr@2
|
635 |
{
|
williamr@2
|
636 |
/** The object is being used to set a range. */
|
williamr@2
|
637 |
ESet,
|
williamr@2
|
638 |
/** The object is being used to clear a range. */
|
williamr@2
|
639 |
EClear
|
williamr@2
|
640 |
};
|
williamr@2
|
641 |
IMPORT_C TRangeChange(TInt aStart, TInt aEnd, TChangeType aChange);
|
williamr@2
|
642 |
IMPORT_C TRangeChange();
|
williamr@2
|
643 |
IMPORT_C void Set(TInt aStart, TInt aEnd, TChangeType aChange);
|
williamr@2
|
644 |
IMPORT_C TChangeType Get(TInt& aStart, TInt& aEnd) const;
|
williamr@2
|
645 |
IMPORT_C void OptimizeWith(TRangeChange& aBuddy);
|
williamr@2
|
646 |
IMPORT_C TBool NonNull() const;
|
williamr@2
|
647 |
IMPORT_C TBool Clip(TInt aMin, TInt aMax);
|
williamr@2
|
648 |
|
williamr@2
|
649 |
TBool IsJoinedTo(const TRangeChange aRange);
|
williamr@2
|
650 |
void Join(const TRangeChange aRange);
|
williamr@2
|
651 |
|
williamr@2
|
652 |
private:
|
williamr@2
|
653 |
TInt iA;
|
williamr@2
|
654 |
TInt iB;
|
williamr@2
|
655 |
};
|
williamr@2
|
656 |
|
williamr@2
|
657 |
public:
|
williamr@2
|
658 |
|
williamr@2
|
659 |
class TTagmaForwarder: public MTmTextLayoutForwarder
|
williamr@2
|
660 |
/**
|
williamr@2
|
661 |
A standard inquiry interface for the text formatting engine, built on
|
williamr@2
|
662 |
top of a CTextView object.
|
williamr@2
|
663 |
|
williamr@2
|
664 |
To use it, construct a TTagmaForwarder object, then call InitL(), which
|
williamr@2
|
665 |
finishes background formatting, then call the MTmTextLayoutForwarder
|
williamr@2
|
666 |
functions.
|
williamr@2
|
667 |
@internalComponent
|
williamr@2
|
668 |
*/
|
williamr@2
|
669 |
{
|
williamr@2
|
670 |
public:
|
williamr@2
|
671 |
inline TTagmaForwarder(const CTextLayout& aLayout);
|
williamr@2
|
672 |
|
williamr@2
|
673 |
private:
|
williamr@2
|
674 |
// from MTmTextLayoutForwarder
|
williamr@2
|
675 |
inline const CTmTextLayout& TextLayout() const;
|
williamr@2
|
676 |
inline void GetOrigin(TPoint& aPoint) const;
|
williamr@2
|
677 |
|
williamr@2
|
678 |
const CTextLayout& iLayout;
|
williamr@2
|
679 |
};
|
williamr@2
|
680 |
|
williamr@2
|
681 |
/**
|
williamr@2
|
682 |
Accesses text supplied by MTmSource.
|
williamr@2
|
683 |
@internalComponent
|
williamr@2
|
684 |
*/
|
williamr@2
|
685 |
class TUtf32SourceCache
|
williamr@2
|
686 |
{
|
williamr@2
|
687 |
public:
|
williamr@2
|
688 |
TUtf32SourceCache(const MTmSource& aSource);
|
williamr@2
|
689 |
TUtf32SourceCache(const CTextLayout& aLayout);
|
williamr@2
|
690 |
TText GetUtf16(TInt aIndex);
|
williamr@2
|
691 |
TChar GetUtf32(TInt aIndex);
|
williamr@2
|
692 |
private:
|
williamr@2
|
693 |
const MTmSource* iSource;
|
williamr@2
|
694 |
TPtrC16 iCurrentView;
|
williamr@2
|
695 |
TInt iCurrentViewIndex;
|
williamr@2
|
696 |
};
|
williamr@2
|
697 |
friend class TUtf32SourceCache;
|
williamr@2
|
698 |
|
williamr@2
|
699 |
IMPORT_C static CTextLayout *NewL(MLayDoc *aDoc,TInt aWrapWidth);
|
williamr@2
|
700 |
IMPORT_C ~CTextLayout();
|
williamr@2
|
701 |
IMPORT_C void DiscardFormat();
|
williamr@2
|
702 |
IMPORT_C void SetLayDoc(MLayDoc *aDoc);
|
williamr@2
|
703 |
IMPORT_C void SetWrapWidth(TInt aWrapWidth);
|
williamr@2
|
704 |
IMPORT_C void SetBandHeight(TInt aHeight);
|
williamr@2
|
705 |
IMPORT_C TInt BandHeight() const;
|
williamr@2
|
706 |
IMPORT_C void SetImageDeviceMap(MGraphicsDeviceMap *aGd);
|
williamr@2
|
707 |
IMPORT_C void SetLabelsDeviceMap(MGraphicsDeviceMap *aDeviceMap);
|
williamr@2
|
708 |
IMPORT_C void SetAmountToFormat(TAmountFormatted aAmountOfFormat = EFFormatBand);
|
williamr@2
|
709 |
IMPORT_C TBool IsFormattingBand() const;
|
williamr@2
|
710 |
IMPORT_C void SetFormatMode(CLayoutData::TFormatMode aFormatMode,TInt aWrapWidth,MGraphicsDeviceMap* aFormatDevice);
|
williamr@2
|
711 |
IMPORT_C void ForceNoWrapping(TBool aNoWrapping = EFAllParagraphsNotWrapped);
|
williamr@2
|
712 |
IMPORT_C TBool IsWrapping() const;
|
williamr@2
|
713 |
IMPORT_C void SetTruncating(TBool aOn);
|
williamr@2
|
714 |
IMPORT_C TBool Truncating() const;
|
williamr@2
|
715 |
IMPORT_C void SetTruncatingEllipsis(TChar aEllipsis);
|
williamr@2
|
716 |
IMPORT_C TChar TruncatingEllipsis() const;
|
williamr@2
|
717 |
IMPORT_C void SetLabelsMarginWidth(TInt aWidth);
|
williamr@2
|
718 |
IMPORT_C void SetNonPrintingCharsVisibility(TNonPrintingCharVisibility aVisibility);
|
williamr@2
|
719 |
IMPORT_C TNonPrintingCharVisibility NonPrintingCharsVisibility() const;
|
williamr@2
|
720 |
IMPORT_C TBool IsBackgroundFormatting() const;
|
williamr@2
|
721 |
IMPORT_C void NotifyTerminateBackgroundFormatting();
|
williamr@2
|
722 |
// deprecated 7.0
|
williamr@2
|
723 |
IMPORT_C void SetExcludePartialLines(TBool aExcludePartialLines = TRUE);
|
williamr@2
|
724 |
// deprecated 7.0
|
williamr@2
|
725 |
IMPORT_C TBool ExcludingPartialLines() const;
|
williamr@2
|
726 |
IMPORT_C void SetFontHeightIncreaseFactor(TInt aPercentage);
|
williamr@2
|
727 |
IMPORT_C TInt FontHeightIncreaseFactor() const;
|
williamr@2
|
728 |
IMPORT_C void SetMinimumLineDescent(TInt aPixels);
|
williamr@2
|
729 |
IMPORT_C TInt MinimumLineDescent() const;
|
williamr@2
|
730 |
IMPORT_C TInt DocumentLength() const;
|
williamr@2
|
731 |
IMPORT_C TInt ToParagraphStart(TInt& aDocPos) const;
|
williamr@2
|
732 |
IMPORT_C TInt PixelsAboveBand() const;
|
williamr@2
|
733 |
IMPORT_C TInt YBottomLastFormattedLine() const;
|
williamr@2
|
734 |
IMPORT_C TInt FormattedHeightInPixels() const;
|
williamr@2
|
735 |
IMPORT_C TInt PosRangeInBand(TInt& aDocPos) const;
|
williamr@2
|
736 |
IMPORT_C TBool PosInBand(const TTmDocPos& aDocPos,TTmLineInfo* aLineInfo = NULL) const;
|
williamr@2
|
737 |
IMPORT_C TBool PosInBand(TTmDocPos aDocPos,TPoint& aXyPos) const;
|
williamr@2
|
738 |
IMPORT_C TBool PosInBand(TInt aDocPos,TPoint& aXyPos) const;
|
williamr@2
|
739 |
IMPORT_C TBool PosIsFormatted(TInt aDocPos) const;
|
williamr@2
|
740 |
IMPORT_C TInt FirstCharOnLine(TInt aLineNo) const;
|
williamr@2
|
741 |
IMPORT_C TInt FormattedLength() const;
|
williamr@2
|
742 |
IMPORT_C TInt FirstFormattedPos() const;
|
williamr@2
|
743 |
IMPORT_C TInt NumFormattedLines() const;
|
williamr@2
|
744 |
IMPORT_C TInt FirstLineInBand() const;
|
williamr@2
|
745 |
IMPORT_C TInt GetLineRect(TInt aYPos,TRect& aLine) const;
|
williamr@2
|
746 |
IMPORT_C TInt ParagraphHeight(TInt aDocPos) const;
|
williamr@2
|
747 |
IMPORT_C TRect ParagraphRectL(TInt aDocPos) const;
|
williamr@2
|
748 |
IMPORT_C TBool CalculateHorizontalExtremesL(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines,
|
williamr@2
|
749 |
TBool aIgnoreWrapCharacters = FALSE) const;
|
williamr@2
|
750 |
IMPORT_C void GetCharacterHeightAndAscentL(TInt aDocPos,TInt& aHeight,TInt& aAscent) const;
|
williamr@2
|
751 |
IMPORT_C void GetFontHeightAndAscentL(const TFontSpec& aFontSpec,TInt& aHeight,TInt& aAscent) const;
|
williamr@2
|
752 |
IMPORT_C TInt XyPosToDocPosL(TPoint &aPos, TUint aFlags = 0) const;
|
williamr@2
|
753 |
IMPORT_C TBool DocPosToXyPosL(TInt aDocPos, TPoint& aPos, TUint aFlags = 0) const;
|
williamr@2
|
754 |
IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL) const;
|
williamr@2
|
755 |
IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo* aLineInfo = NULL) const;
|
williamr@2
|
756 |
IMPORT_C TRect GetLineRectL(TInt aDocPos1,TInt aDocPos2) const;
|
williamr@2
|
757 |
IMPORT_C TBool PictureRectangleL(TInt aDocPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL) const;
|
williamr@2
|
758 |
IMPORT_C TBool PictureRectangleL(const TPoint& aXyPos,TRect& aPictureRect,TBool* aCanScaleOrCrop = NULL) const;
|
williamr@2
|
759 |
IMPORT_C TInt FirstDocPosFullyInBand() const;
|
williamr@2
|
760 |
IMPORT_C void GetMinimumSizeL(TInt aWrapWidth,TSize& aSize);
|
williamr@2
|
761 |
IMPORT_C void GetMinimumSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize);
|
williamr@2
|
762 |
IMPORT_C TInt MajorVersion() const;
|
williamr@2
|
763 |
IMPORT_C TInt SetViewL(const TTmDocPos& aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier,
|
williamr@2
|
764 |
TDiscard aDiscardFormat = EFViewDontDiscardFormat);
|
williamr@2
|
765 |
IMPORT_C TInt SetViewL(TInt aDocPos,TInt& aYPos,TViewYPosQualifier aYPosQualifier,
|
williamr@2
|
766 |
TDiscard aDiscardFormat = EFViewDontDiscardFormat);
|
williamr@2
|
767 |
IMPORT_C void FormatBandL();
|
williamr@2
|
768 |
IMPORT_C void FormatCharRangeL(TInt aStartDocPos,TInt aEndDocPos);
|
williamr@2
|
769 |
void FormatCharRangeL(TInt aStartDocPos,TInt aEndDocPos,TInt aPixelOffset);
|
williamr@2
|
770 |
IMPORT_C TBool FormatNextLineL(TInt& aBotPixel);
|
williamr@2
|
771 |
IMPORT_C TBool FormatLineL(CParaFormat* aParaFormat,TInt& aDocPos,TInt& aHeight,TBool& aPageBreak);
|
williamr@2
|
772 |
IMPORT_C TInt ScrollParagraphsL(TInt& aNumParas,TAllowDisallow aScrollBlankSpace);
|
williamr@2
|
773 |
IMPORT_C TInt ScrollLinesL(TInt& aNumLines,TAllowDisallow aScrollBlankSpace = EFDisallowScrollingBlankSpace);
|
williamr@2
|
774 |
IMPORT_C TInt ChangeBandTopL(TInt& aPixels,TAllowDisallow aScrollBlankSpace = EFDisallowScrollingBlankSpace);
|
williamr@2
|
775 |
IMPORT_C void PageUpL(TInt& aYCursorPos,TInt& aPixelsScrolled);
|
williamr@2
|
776 |
IMPORT_C void PageDownL(TInt& aYCursorPos,TInt& aPixelsScrolled);
|
williamr@2
|
777 |
IMPORT_C TBool HandleCharEditL(TUint aType,TInt& aCursorPos,TInt& aGood,TInt& aFormattedUpTo,
|
williamr@2
|
778 |
TInt& aFormattedFrom,TInt& aScroll,TBool aFormatChanged);
|
williamr@2
|
779 |
IMPORT_C void HandleBlockChangeL(TCursorSelection aSelection,TInt aOldCharsChanged,TViewRectChanges& aViewChanges,
|
williamr@2
|
780 |
TBool aFormatChanged);
|
williamr@2
|
781 |
IMPORT_C void HandleAdditionalCharactersAtEndL(TInt& aFirstPixel,TInt& aLastPixel);
|
williamr@2
|
782 |
// deprecated 6.1
|
williamr@2
|
783 |
IMPORT_C void ReformatVerticalSpaceL();
|
williamr@2
|
784 |
IMPORT_C void AdjustVerticalAlignment(CParaFormat::TAlignment aVerticalAlignment);
|
williamr@2
|
785 |
IMPORT_C static void DrawBorders(const MGraphicsDeviceMap* aGd,CGraphicsContext& aGc,const TRect& aRect,
|
williamr@2
|
786 |
const TParaBorderArray& aBorder,const TRgb* aBackground = NULL,
|
williamr@2
|
787 |
TRegion* aClipRegion = NULL,const TRect* aDrawRect = NULL);
|
williamr@2
|
788 |
IMPORT_C void DrawL(const TRect& aDrawRect,const TDrawTextLayoutContext* aDrawTextLayoutContext,
|
williamr@2
|
789 |
const TCursorSelection* aHighlight = NULL);
|
williamr@2
|
790 |
IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,
|
williamr@2
|
791 |
TTmPosInfo2& aPosInfo, TBool aToLeft) const;
|
williamr@2
|
792 |
// deprecated 7.0
|
williamr@2
|
793 |
IMPORT_C void InvertRangeL(const TCursorSelection& aHighlight,const TRect& aDrawRect,
|
williamr@2
|
794 |
const TDrawTextLayoutContext* aDrawTextLayoutContext);
|
williamr@2
|
795 |
IMPORT_C void Highlight(const TRangeChange& aHighlight,const TRect& aDrawRect,
|
williamr@2
|
796 |
const TDrawTextLayoutContext* aDrawTextLayoutContext);
|
williamr@2
|
797 |
IMPORT_C void SetCustomDraw(const MFormCustomDraw* aCustomDraw);
|
williamr@2
|
798 |
IMPORT_C const MFormCustomDraw* CustomDraw() const;
|
williamr@2
|
799 |
IMPORT_C void SetCustomWrap(const MFormCustomWrap* aCustomWrap);
|
williamr@2
|
800 |
IMPORT_C const MFormCustomWrap* CustomWrap() const;
|
williamr@2
|
801 |
IMPORT_C void ExtendFormattingToCoverYL(TInt aYPos);
|
williamr@2
|
802 |
IMPORT_C void ExtendFormattingToCoverPosL(TInt aDocPos);
|
williamr@2
|
803 |
|
williamr@2
|
804 |
IMPORT_C TInt GetLineNumber(TInt aDocPos);
|
williamr@2
|
805 |
IMPORT_C void SetHighlightExtensions(TInt aLeftExtension, TInt aRightExtension, TInt aTopExtension, TInt aBottomExtension);
|
williamr@2
|
806 |
void SetExcessHeightRequired(TInt aExcessHeightRequired);
|
williamr@2
|
807 |
IMPORT_C void SetInterfaceProvider( MFormCustomInterfaceProvider* aProvider );
|
williamr@2
|
808 |
inline const CTmTextLayout& TagmaTextLayout() const;
|
williamr@2
|
809 |
inline void GetOrigin(TPoint& aPoint) const;
|
williamr@2
|
810 |
|
williamr@2
|
811 |
|
williamr@2
|
812 |
inline void RestrictScrollToTopsOfLines(TBool aRestrict);
|
williamr@2
|
813 |
|
williamr@2
|
814 |
|
williamr@2
|
815 |
// Non-exported public functions
|
williamr@2
|
816 |
void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
817 |
const TLogicalRgb& aBackground) const;
|
williamr@2
|
818 |
TBool CalculateHorizontalExtremes(TInt& aLeftX,TInt& aRightX,TBool aOnlyVisibleLines) const;
|
williamr@2
|
819 |
TBool GetCursor(const TTmDocPos& aDocPos,TTmCursorPlacement aPlacement,
|
williamr@2
|
820 |
TRect& aLineRect,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
|
williamr@2
|
821 |
void GetParagraphRect(const TTmDocPos& aDocPos,TRect& aRect) const;
|
williamr@2
|
822 |
TInt ScrollDocPosIntoViewL(const TTmDocPos& aDocPos);
|
williamr@2
|
823 |
TInt PictureRectangleAndPosL(const TPoint& aXyPos, TRect& aPictureRect,
|
williamr@2
|
824 |
TBool* aCanScaleOrCrop = 0) const;
|
williamr@2
|
825 |
void HighlightUsingExtensions(const CTextLayout::TRangeChange& aChangeHighlight,const TRangeChange& aFullHighlight,
|
williamr@2
|
826 |
const TRect& aDrawRect, const TDrawTextLayoutContext* aDrawTextLayoutContext);
|
williamr@2
|
827 |
inline const TTmHighlightExtensions& HighlightExtensions() const;
|
williamr@2
|
828 |
void GetHighlightRemnants(const TRect& aRect, const TDrawTextLayoutContext& aDrawTextLayoutContext, TRect* aRemainderRects) const;
|
williamr@2
|
829 |
TInt WrapWidth() const;
|
williamr@2
|
830 |
|
williamr@2
|
831 |
void SetOpaqueLC();
|
williamr@2
|
832 |
|
williamr@2
|
833 |
IMPORT_C void SetCustomInvisibleCharacterRemapper(MFormCustomInvisibleCharacterRemapper* aInvisibleCharacterRemapper);
|
williamr@2
|
834 |
IMPORT_C MFormCustomInvisibleCharacterRemapper* GetCustomInvisibleCharacterRemapper();
|
williamr@2
|
835 |
void SetTextViewCursorPos(TCursorPosition* aPos); // Put in for INC092568
|
williamr@2
|
836 |
|
williamr@2
|
837 |
void SetWindow(RWindow* aWnd);
|
williamr@2
|
838 |
void SetReadyToRedraw();
|
williamr@2
|
839 |
void BeginRedraw(const TRect& aRect);
|
williamr@2
|
840 |
void EndRedraw();
|
williamr@2
|
841 |
void SetExternalDraw(const TRect& aRect);
|
williamr@2
|
842 |
void ResetExternalDraw();
|
williamr@2
|
843 |
TBool BeginRedrawCalled() const;
|
williamr@2
|
844 |
IMPORT_C void MakeVisible(TBool aVisible);
|
williamr@2
|
845 |
|
williamr@2
|
846 |
#ifdef _DEBUG
|
williamr@2
|
847 |
TBool __DbgIsFormattingUpToDate() const;
|
williamr@2
|
848 |
#endif
|
williamr@2
|
849 |
|
williamr@2
|
850 |
enum TPanicNumber
|
williamr@2
|
851 |
{
|
williamr@2
|
852 |
EUnimplemented,
|
williamr@2
|
853 |
ENoMemory,
|
williamr@2
|
854 |
EDrawingBorderError,
|
williamr@2
|
855 |
EFormatDeviceNotSet,
|
williamr@2
|
856 |
EImageDeviceNotSet,
|
williamr@2
|
857 |
EPixelNotInFormattedLine,
|
williamr@2
|
858 |
EInvalidDocPos,
|
williamr@2
|
859 |
ENoCharRangeToFormat,
|
williamr@2
|
860 |
ECharacterNotFormatted,
|
williamr@2
|
861 |
EPrintPreviewModeError,
|
williamr@2
|
862 |
EBadCharacterEditType,
|
williamr@2
|
863 |
EInvalidLineNumber,
|
williamr@2
|
864 |
EPosNotFormatted,
|
williamr@2
|
865 |
EMustFormatAllText,
|
williamr@2
|
866 |
EPageScrollError,
|
williamr@2
|
867 |
EInvalidRedraw
|
williamr@2
|
868 |
};
|
williamr@2
|
869 |
static void Panic(TPanicNumber aNumber);
|
williamr@2
|
870 |
|
williamr@2
|
871 |
private:
|
williamr@2
|
872 |
IMPORT_C CTextLayout();
|
williamr@2
|
873 |
IMPORT_C void ConstructL(MLayDoc *aDoc,TInt aWrapWidth);
|
williamr@2
|
874 |
void InitFormatParam(TTmFormatParamBase& aParam);
|
williamr@2
|
875 |
TInt ScrollL(TInt aDy,TAllowDisallow aScrollBlankSpace);
|
williamr@2
|
876 |
void FormatBandL(TInt aStartDocPos,TInt aEndDocPos);
|
williamr@2
|
877 |
void PruneFormatL(TBool aFromStart);
|
williamr@2
|
878 |
TInt VisibleHeightInPixels() const;
|
williamr@2
|
879 |
TInt BandHeightInPixels() const;
|
williamr@2
|
880 |
TInt SuggestCursorPos(TInt aCurrentCursorPos) const;
|
williamr@2
|
881 |
TInt SetBandTop();
|
williamr@2
|
882 |
TBool AddFormattingAtEndL(TTmFormatParamBase& aFormatParam, TInt& aHeightIncrease, TInt& aParagraphsIncrease);
|
williamr@2
|
883 |
|
williamr@2
|
884 |
static void ResetOpaque(void* aThis);
|
williamr@2
|
885 |
|
williamr@2
|
886 |
|
williamr@2
|
887 |
CTmTextLayout iText; // the TAGMA object that contains the text layout
|
williamr@2
|
888 |
TInt iExcessHeightRequired; // The delta required to position the baseline so there is enough
|
williamr@2
|
889 |
// space for the highset glyph in pixels
|
williamr@2
|
890 |
RWindow *iWnd; // the window to be used to draw
|
williamr@2
|
891 |
TBool iBeginRedrawCount;
|
williamr@2
|
892 |
TRect iRedrawRect;
|
williamr@2
|
893 |
TCursorPosition* iTextViewCursorPos; // From and owned by owning CTextView if it exists,
|
williamr@2
|
894 |
// Null otherwise. Put in for INC092568
|
williamr@2
|
895 |
TBool iIsWndInExternalRedraw; // If ETrue, then iWnd->EndRedraw() will not be called
|
williamr@2
|
896 |
// from within CTextLayout::EndRedraw() as the window redraw
|
williamr@2
|
897 |
// has been initiated externally and will be ended externally as well
|
williamr@2
|
898 |
TBool iReadyToRedraw; // If EFalse, disables CTextLayout::BeginRedraw() and
|
williamr@2
|
899 |
// CTextLayout::EndRedraw()
|
williamr@2
|
900 |
TInt iDummy[5]; // This dummy variable has been inserted to replace the original size of
|
williamr@2
|
901 |
// a variable that had to be moved to avaid a BC break because it had
|
williamr@2
|
902 |
// increased in size. Feel free to reuse this space - just reduce the size
|
williamr@2
|
903 |
// of this variable by the size of any variable you insert in front of it.
|
williamr@2
|
904 |
// Currently it occupies 5 words.
|
williamr@2
|
905 |
TInt iBandTop; // effectively, scroll position: subtract this from CTmTextLayout y position
|
williamr@2
|
906 |
// to give CTextLayout y position
|
williamr@2
|
907 |
TInt iVisibleHeight;// in pixels if iFormatMode is EFScreenMode or EFWysiwygMode, otherwise twips
|
williamr@2
|
908 |
TInt iBandHeight; // in pixels if iFormatMode is EFScreenMode or EFWysiwygMode, otherwise twips
|
williamr@2
|
909 |
|
williamr@2
|
910 |
TInt iScrollFlags; // from CTextLayout::TScrollFlags
|
williamr@2
|
911 |
TInt iUnformattedStart; // document position of the start of any unformatted text;
|
williamr@2
|
912 |
// if < KMaxTInt, background formatting can be used
|
williamr@2
|
913 |
// (by calling FormatNextLine) to format the remainder
|
williamr@2
|
914 |
TBool iParInvalid; // if true and background formatting is happening, the remainder of the paragraph
|
williamr@2
|
915 |
// containing iUnformattedStart is invalid and must be reformatted;
|
williamr@2
|
916 |
// otherwise, formatting stops when line ends match
|
williamr@2
|
917 |
TTmHighlightExtensions iHighlightExtensions;
|
williamr@2
|
918 |
TLayDocTextSource iSource; // the source of the text
|
williamr@2
|
919 |
// before adding any new member variables to the end of this class, please
|
williamr@2
|
920 |
// consider whether you can insert them before the iDummy member variable
|
williamr@2
|
921 |
// further up, which currently represents wasted space.
|
williamr@2
|
922 |
};
|
williamr@2
|
923 |
|
williamr@2
|
924 |
/**
|
williamr@2
|
925 |
Cursor position.
|
williamr@2
|
926 |
|
williamr@2
|
927 |
The TMovementType enum defined in this class is used to indicate the direction
|
williamr@2
|
928 |
of a scroll or cursor movement. The remainder of this class does not form part
|
williamr@2
|
929 |
of the API.
|
williamr@2
|
930 |
@publishedAll
|
williamr@2
|
931 |
@released
|
williamr@2
|
932 |
*/
|
williamr@2
|
933 |
class TCursorPosition
|
williamr@2
|
934 |
|
williamr@2
|
935 |
{
|
williamr@2
|
936 |
public:
|
williamr@2
|
937 |
|
williamr@2
|
938 |
|
williamr@2
|
939 |
/** Direction of cursor movement. */
|
williamr@2
|
940 |
enum TMovementType
|
williamr@2
|
941 |
{
|
williamr@2
|
942 |
/** No cursor movement */
|
williamr@2
|
943 |
EFNoMovement,
|
williamr@2
|
944 |
/** Single character cursor movement to the left */
|
williamr@2
|
945 |
EFLeft,
|
williamr@2
|
946 |
/** Single character cursor movement to the right */
|
williamr@2
|
947 |
EFRight,
|
williamr@2
|
948 |
/** Line up cursor movement */
|
williamr@2
|
949 |
EFLineUp,
|
williamr@2
|
950 |
/** Line down cursor movement */
|
williamr@2
|
951 |
EFLineDown,
|
williamr@2
|
952 |
/** Page up cursor movement */
|
williamr@2
|
953 |
EFPageUp,
|
williamr@2
|
954 |
/** Page down cursor movement */
|
williamr@2
|
955 |
EFPageDown,
|
williamr@2
|
956 |
/** Cursor movement to line start */
|
williamr@2
|
957 |
EFLineBeg,
|
williamr@2
|
958 |
/** Cursor movement to line end */
|
williamr@2
|
959 |
EFLineEnd
|
williamr@2
|
960 |
};
|
williamr@2
|
961 |
|
williamr@2
|
962 |
/** Selection of the left end or right end of a run of text. */
|
williamr@2
|
963 |
enum TVisualEnd
|
williamr@2
|
964 |
{
|
williamr@2
|
965 |
/** Leftmost end. */
|
williamr@2
|
966 |
EVisualLeft,
|
williamr@2
|
967 |
/** Rightmost end. */
|
williamr@2
|
968 |
EVisualRight
|
williamr@2
|
969 |
};
|
williamr@2
|
970 |
|
williamr@2
|
971 |
enum TPosHint
|
williamr@2
|
972 |
{
|
williamr@2
|
973 |
EPosHintUndefined = 0,
|
williamr@2
|
974 |
/** Left to right typing expected. */
|
williamr@2
|
975 |
EInsertStrongL2R = 1,
|
williamr@2
|
976 |
/** Right to left typing expected. */
|
williamr@2
|
977 |
EInsertStrongR2L = 2,
|
williamr@2
|
978 |
|
williamr@2
|
979 |
// Maybe several more.
|
williamr@2
|
980 |
//...
|
williamr@2
|
981 |
EPosHintLast
|
williamr@2
|
982 |
};
|
williamr@2
|
983 |
|
williamr@2
|
984 |
inline TCursorPosition();
|
williamr@2
|
985 |
inline void SetLayout(CTextLayout *aLayout);
|
williamr@2
|
986 |
inline void UpdateLatentX(TInt aX);
|
williamr@2
|
987 |
inline void SetToPreviousHighlight();
|
williamr@2
|
988 |
inline void SetToCurrentHighlight();
|
williamr@2
|
989 |
inline void CancelHighlight();
|
williamr@2
|
990 |
inline void SetDocPos(const TTmDocPos& aDocPos);
|
williamr@2
|
991 |
void UpdateLatentPosition();
|
williamr@2
|
992 |
TInt SetSelectionL(const TCursorSelection& aSelection);
|
williamr@2
|
993 |
void SetPendingSelection(const TCursorSelection& aSelection);
|
williamr@2
|
994 |
void GetOldSelection(TCursorSelection& aSelection) const;
|
williamr@2
|
995 |
void GetSelection(TCursorSelection& aSelection) const;
|
williamr@2
|
996 |
TInt SetDocPosL(TBool aDragSelectOn,const TTmDocPos& aDocPos);
|
williamr@2
|
997 |
TInt SetXyPosL(TBool aDragSelectOn,TPoint aPos,TBool aAllowPictureFrame);
|
williamr@2
|
998 |
TInt MoveL(TBool aDragSelectOn,TMovementType& aMovement,TBool aAllowPictureFrame);
|
williamr@2
|
999 |
const TTmDocPos& VisualEndOfRunL(
|
williamr@2
|
1000 |
const TTmDocPos& aStart, const TTmDocPos& aEnd,
|
williamr@2
|
1001 |
TVisualEnd aDirection);
|
williamr@2
|
1002 |
void TextMoveVertically();
|
williamr@2
|
1003 |
inline void DontDrawOldPictureFrame();
|
williamr@2
|
1004 |
|
williamr@2
|
1005 |
// inquiry functions
|
williamr@2
|
1006 |
inline TBool IsSelection() const;
|
williamr@2
|
1007 |
inline TBool IsSelectionToDraw() const;
|
williamr@2
|
1008 |
TBool IsPictureFrame() const;
|
williamr@2
|
1009 |
TBool IsNewPictureFrame() const;
|
williamr@2
|
1010 |
inline const TTmDocPos& TmDocPos() const;
|
williamr@2
|
1011 |
inline TInt DocPos() const;
|
williamr@2
|
1012 |
inline TBool DrawHighlight() const;
|
williamr@2
|
1013 |
inline TBool DrawOldPictureFrame() const;
|
williamr@2
|
1014 |
inline TBool DrawNewPictureFrame() const;
|
williamr@2
|
1015 |
TBool GetCursor(TTmCursorPlacement aPlacement,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
|
williamr@2
|
1016 |
TPosHint PositioningHint() const { return iPositioningHint; }
|
williamr@2
|
1017 |
void SetPositioningHint (TPosHint aHint)
|
williamr@2
|
1018 |
{iPositioningHint = aHint;}
|
williamr@2
|
1019 |
|
williamr@2
|
1020 |
TTmPosInfo2& ChoosePosition(TTmPosInfo2& aPreferred,
|
williamr@2
|
1021 |
TTmPosInfo2& aBackup);
|
williamr@2
|
1022 |
|
williamr@2
|
1023 |
private:
|
williamr@2
|
1024 |
enum
|
williamr@2
|
1025 |
{
|
williamr@2
|
1026 |
EFAbove = -1,
|
williamr@2
|
1027 |
EFInside = 0,
|
williamr@2
|
1028 |
EFBelow = 1
|
williamr@2
|
1029 |
};
|
williamr@2
|
1030 |
|
williamr@2
|
1031 |
// bit values for iFlags
|
williamr@2
|
1032 |
enum
|
williamr@2
|
1033 |
{
|
williamr@2
|
1034 |
EDrawHighlight = 1,
|
williamr@2
|
1035 |
EDrawOldPictureFrame = 2,
|
williamr@2
|
1036 |
EDrawNewPictureFrame = 4,
|
williamr@2
|
1037 |
EReturnPreviousHighlight = 8,
|
williamr@2
|
1038 |
ESelected = 16
|
williamr@2
|
1039 |
};
|
williamr@2
|
1040 |
|
williamr@2
|
1041 |
TInt ViewTopOfLineL(const TTmDocPos& aDocPos,TInt& aYPos);
|
williamr@2
|
1042 |
void CheckSelection(TBool aSelect);
|
williamr@2
|
1043 |
void CheckNullSelection();
|
williamr@2
|
1044 |
inline void UpdateLatentY(TInt aY);
|
williamr@2
|
1045 |
TInt CheckCursorOnScreenL(TInt& aY);
|
williamr@2
|
1046 |
TBool LeftRightL(TTmPosInfo2& aPos, TTmLineInfo& aLine, TMovementType& aMove);
|
williamr@2
|
1047 |
void StartEnd(TTmPosInfo2& aPos, TTmLineInfo& aLine, TMovementType& aMove);
|
williamr@2
|
1048 |
void UpDownL(TTmPosInfo2& aPos, TTmLineInfo& aLine, TMovementType& aMove);
|
williamr@2
|
1049 |
TInt PageScrollL(TMovementType& aMove);
|
williamr@2
|
1050 |
TInt DoSetDocPosL(const TTmDocPos& aDocPos);
|
williamr@2
|
1051 |
TInt DoSetVisibleDocPosL(const TTmDocPos& aDocPos);
|
williamr@2
|
1052 |
void DoSetXyPos(TPoint& aXy);
|
williamr@2
|
1053 |
void SetPictureFrame(const TTmDocPos& aDocPos,TInt aAnchor,const TRect& aPictureRect);
|
williamr@2
|
1054 |
inline TBool CalculateCursorPos(TPoint& aCurPos);
|
williamr@2
|
1055 |
|
williamr@2
|
1056 |
TTmDocPos iDocPos;
|
williamr@2
|
1057 |
TInt iAnchor;
|
williamr@2
|
1058 |
TInt iOldDocPos;
|
williamr@2
|
1059 |
TInt iOldAnchor;
|
williamr@2
|
1060 |
TUint iFlags;
|
williamr@2
|
1061 |
TInt iLatentX;
|
williamr@2
|
1062 |
TInt iLatentY;
|
williamr@2
|
1063 |
CTextLayout* iLayout;
|
williamr@2
|
1064 |
TPosHint iPositioningHint;
|
williamr@2
|
1065 |
};
|
williamr@2
|
1066 |
|
williamr@2
|
1067 |
// inline functions
|
williamr@2
|
1068 |
inline const CTmTextLayout& CTextLayout::TagmaTextLayout() const
|
williamr@2
|
1069 |
{
|
williamr@2
|
1070 |
return iText;
|
williamr@2
|
1071 |
}
|
williamr@2
|
1072 |
|
williamr@2
|
1073 |
inline void CTextLayout::GetOrigin(TPoint& aPoint) const
|
williamr@2
|
1074 |
{
|
williamr@2
|
1075 |
aPoint.iX = 0;
|
williamr@2
|
1076 |
aPoint.iY = -iBandTop;
|
williamr@2
|
1077 |
}
|
williamr@2
|
1078 |
|
williamr@2
|
1079 |
inline CTextLayout::TTagmaForwarder::TTagmaForwarder(const CTextLayout& aLayout):
|
williamr@2
|
1080 |
iLayout(aLayout)
|
williamr@2
|
1081 |
{
|
williamr@2
|
1082 |
}
|
williamr@2
|
1083 |
|
williamr@2
|
1084 |
inline const CTmTextLayout& CTextLayout::TTagmaForwarder::TextLayout() const
|
williamr@2
|
1085 |
{
|
williamr@2
|
1086 |
return iLayout.TagmaTextLayout();
|
williamr@2
|
1087 |
}
|
williamr@2
|
1088 |
|
williamr@2
|
1089 |
inline void CTextLayout::TTagmaForwarder::GetOrigin(TPoint& aPoint) const
|
williamr@2
|
1090 |
{
|
williamr@2
|
1091 |
iLayout.GetOrigin(aPoint);
|
williamr@2
|
1092 |
}
|
williamr@2
|
1093 |
|
williamr@2
|
1094 |
inline const TTmHighlightExtensions& CTextLayout::HighlightExtensions() const
|
williamr@2
|
1095 |
{
|
williamr@2
|
1096 |
return iHighlightExtensions;
|
williamr@2
|
1097 |
}
|
williamr@2
|
1098 |
|
williamr@2
|
1099 |
/**
|
williamr@2
|
1100 |
Dangerous function. Makes scroll operations set the top of the screen flush to
|
williamr@2
|
1101 |
the top of a line. In general this might scroll the cursor off the screen.
|
williamr@2
|
1102 |
*/
|
williamr@2
|
1103 |
void CTextLayout::RestrictScrollToTopsOfLines(TBool a)
|
williamr@2
|
1104 |
{
|
williamr@2
|
1105 |
if (a)
|
williamr@2
|
1106 |
iScrollFlags |= EFScrollOnlyToTopsOfLines;
|
williamr@2
|
1107 |
else
|
williamr@2
|
1108 |
iScrollFlags &= ~EFScrollOnlyToTopsOfLines;
|
williamr@2
|
1109 |
}
|
williamr@2
|
1110 |
|
williamr@2
|
1111 |
/**Constructs a fully initialized TViewYPosQualifier object. The hotspot is
|
williamr@2
|
1112 |
initialized to be the baseline of the line, the screen is not filled, and the
|
williamr@2
|
1113 |
top line is not forced to be fully visible. */
|
williamr@2
|
1114 |
inline TViewYPosQualifier::TViewYPosQualifier():
|
williamr@2
|
1115 |
iHotSpot(EFViewBaseLine),
|
williamr@2
|
1116 |
iFillScreen(EFalse),
|
williamr@2
|
1117 |
iFullyVisible(EFViewDontForceLineFullyVisible)
|
williamr@2
|
1118 |
{
|
williamr@2
|
1119 |
}
|
williamr@2
|
1120 |
|
williamr@2
|
1121 |
|
williamr@2
|
1122 |
/**Constructs a TViewRectChanges object, initializing its iScrollAtTop and
|
williamr@2
|
1123 |
iScrollAtBottom members to zero. */
|
williamr@2
|
1124 |
inline TViewRectChanges::TViewRectChanges():
|
williamr@2
|
1125 |
iScrollAtTop(0),
|
williamr@2
|
1126 |
iScrollAtBottom(0)
|
williamr@2
|
1127 |
{
|
williamr@2
|
1128 |
}
|
williamr@2
|
1129 |
|
williamr@2
|
1130 |
/**Constructs the TCursorSelection object initialising the cursor and anchor
|
williamr@2
|
1131 |
positions to zero. */
|
williamr@2
|
1132 |
inline TCursorSelection::TCursorSelection():
|
williamr@2
|
1133 |
iCursorPos(0),
|
williamr@2
|
1134 |
iAnchorPos(0)
|
williamr@2
|
1135 |
{
|
williamr@2
|
1136 |
}
|
williamr@2
|
1137 |
|
williamr@2
|
1138 |
/** Constructs the TCursorSelection object with a cursor and anchor position.
|
williamr@2
|
1139 |
@param aCursorPos The cursor position.
|
williamr@2
|
1140 |
@param aAnchorPos The anchor position. */
|
williamr@2
|
1141 |
inline TCursorSelection::TCursorSelection(TInt aCursorPos,TInt aAnchorPos):
|
williamr@2
|
1142 |
iCursorPos(aCursorPos),
|
williamr@2
|
1143 |
iAnchorPos(aAnchorPos)
|
williamr@2
|
1144 |
{
|
williamr@2
|
1145 |
}
|
williamr@2
|
1146 |
|
williamr@2
|
1147 |
/** Sets the cursor and anchor positions for the selection.
|
williamr@2
|
1148 |
@param aCursorPos The new cursor position.
|
williamr@2
|
1149 |
@param aAnchorPos The new anchor position. */
|
williamr@2
|
1150 |
inline void TCursorSelection::SetSelection(TInt aCursorPos,TInt aAnchorPos)
|
williamr@2
|
1151 |
{
|
williamr@2
|
1152 |
iCursorPos = aCursorPos;
|
williamr@2
|
1153 |
iAnchorPos = aAnchorPos;
|
williamr@2
|
1154 |
}
|
williamr@2
|
1155 |
|
williamr@2
|
1156 |
/** Gets the lesser of the cursor and anchor positions.
|
williamr@2
|
1157 |
@return The lesser of the cursor and anchor positions. */
|
williamr@2
|
1158 |
inline TInt TCursorSelection::LowerPos() const
|
williamr@2
|
1159 |
{
|
williamr@2
|
1160 |
return Min(iCursorPos,iAnchorPos);
|
williamr@2
|
1161 |
}
|
williamr@2
|
1162 |
|
williamr@2
|
1163 |
/** Gets the greater of the cursor and anchor positions.
|
williamr@2
|
1164 |
@return The greater of the cursor and anchor positions. */
|
williamr@2
|
1165 |
inline TInt TCursorSelection::HigherPos() const
|
williamr@2
|
1166 |
{
|
williamr@2
|
1167 |
return Max(iCursorPos,iAnchorPos);
|
williamr@2
|
1168 |
}
|
williamr@2
|
1169 |
|
williamr@2
|
1170 |
/** Returns the number of characters in the selected range.
|
williamr@2
|
1171 |
@return The length of the selection. */
|
williamr@2
|
1172 |
inline TInt TCursorSelection::Length() const
|
williamr@2
|
1173 |
{
|
williamr@2
|
1174 |
return Abs(iCursorPos - iAnchorPos);
|
williamr@2
|
1175 |
}
|
williamr@2
|
1176 |
|
williamr@2
|
1177 |
/** Constructs the TCursorPosition object, initializing its members
|
williamr@2
|
1178 |
iAnchor, iOldDocPos, iOldAnchor, iFlags, iLatentX, iLatentY to
|
williamr@2
|
1179 |
zero, iLayout to NULL, and iPositioningHint to undefined.
|
williamr@2
|
1180 |
*/
|
williamr@2
|
1181 |
inline TCursorPosition::TCursorPosition():
|
williamr@2
|
1182 |
iAnchor(0),
|
williamr@2
|
1183 |
iOldDocPos(0),
|
williamr@2
|
1184 |
iOldAnchor(0),
|
williamr@2
|
1185 |
iFlags(0),
|
williamr@2
|
1186 |
iLatentX(0),
|
williamr@2
|
1187 |
iLatentY(0),
|
williamr@2
|
1188 |
iLayout(NULL),
|
williamr@2
|
1189 |
iPositioningHint(EPosHintUndefined)
|
williamr@2
|
1190 |
{
|
williamr@2
|
1191 |
}
|
williamr@2
|
1192 |
|
williamr@2
|
1193 |
/** Sets the text layout which TCursorPosition is related.
|
williamr@2
|
1194 |
@param aLayout The text layout.
|
williamr@2
|
1195 |
*/
|
williamr@2
|
1196 |
inline void TCursorPosition::SetLayout(CTextLayout *aLayout)
|
williamr@2
|
1197 |
{
|
williamr@2
|
1198 |
iLayout = aLayout;
|
williamr@2
|
1199 |
}
|
williamr@2
|
1200 |
|
williamr@2
|
1201 |
/** Tests whether there is currently a selected region.
|
williamr@2
|
1202 |
@return True if there is a selected region. False if not. */
|
williamr@2
|
1203 |
inline TBool TCursorPosition::IsSelection() const
|
williamr@2
|
1204 |
{
|
williamr@2
|
1205 |
return iFlags & ESelected;
|
williamr@2
|
1206 |
}
|
williamr@2
|
1207 |
|
williamr@2
|
1208 |
/** Tests whether there is currently a highlighted region being drawn.
|
williamr@2
|
1209 |
@return True if there is a selected region. False if not. */
|
williamr@2
|
1210 |
inline TBool TCursorPosition::IsSelectionToDraw() const
|
williamr@2
|
1211 |
{
|
williamr@2
|
1212 |
return iFlags & (EDrawHighlight | EDrawOldPictureFrame | EDrawNewPictureFrame);
|
williamr@2
|
1213 |
}
|
williamr@2
|
1214 |
|
williamr@2
|
1215 |
/** Sets the flag which directs <code>GetSelection()</code> and
|
williamr@2
|
1216 |
<code>IsPictureFrame()</code> to operate on the previous highlight
|
williamr@2
|
1217 |
instead of the current highlight.
|
williamr@2
|
1218 |
*/
|
williamr@2
|
1219 |
inline void TCursorPosition::SetToPreviousHighlight()
|
williamr@2
|
1220 |
{
|
williamr@2
|
1221 |
iFlags |= EReturnPreviousHighlight;
|
williamr@2
|
1222 |
}
|
williamr@2
|
1223 |
|
williamr@2
|
1224 |
/** Clears the special flag set in <code>SetToPreviousHighlight()</code>
|
williamr@2
|
1225 |
so that <code>GetSelection()</code> and <code>IsPictureFrame()</code>
|
williamr@2
|
1226 |
will operate on the current highlight.
|
williamr@2
|
1227 |
*/
|
williamr@2
|
1228 |
inline void TCursorPosition::SetToCurrentHighlight()
|
williamr@2
|
1229 |
{
|
williamr@2
|
1230 |
iFlags &= ~EReturnPreviousHighlight;
|
williamr@2
|
1231 |
}
|
williamr@2
|
1232 |
|
williamr@2
|
1233 |
/** Removes the selection, and redraws the affected part of the screen.
|
williamr@2
|
1234 |
*/
|
williamr@2
|
1235 |
inline void TCursorPosition::CancelHighlight()
|
williamr@2
|
1236 |
{
|
williamr@2
|
1237 |
iFlags &= ~(ESelected | EDrawHighlight | EDrawOldPictureFrame | EDrawNewPictureFrame);
|
williamr@2
|
1238 |
}
|
williamr@2
|
1239 |
|
williamr@2
|
1240 |
/** Sets the latent horizontal text cursor position. This is the horizontal
|
williamr@2
|
1241 |
coordinate to which the text cursor will be moved.
|
williamr@2
|
1242 |
@param aX The horizontal coordinate to which the text cursor should be moved
|
williamr@2
|
1243 |
*/
|
williamr@2
|
1244 |
inline void TCursorPosition::UpdateLatentX(TInt aX)
|
williamr@2
|
1245 |
{
|
williamr@2
|
1246 |
iLatentX = aX;
|
williamr@2
|
1247 |
}
|
williamr@2
|
1248 |
|
williamr@2
|
1249 |
/** Sets the latent vertical text cursor position. This is the vertical
|
williamr@2
|
1250 |
coordinate to which the text cursor will be moved.
|
williamr@2
|
1251 |
@param aY The vertical coordinate to which the text cursor should be moved
|
williamr@2
|
1252 |
*/
|
williamr@2
|
1253 |
inline void TCursorPosition::UpdateLatentY(TInt aY)
|
williamr@2
|
1254 |
{
|
williamr@2
|
1255 |
iLatentY = aY;
|
williamr@2
|
1256 |
}
|
williamr@2
|
1257 |
|
williamr@2
|
1258 |
/** Caculate x-y position of the cursor
|
williamr@2
|
1259 |
If ETrue is returned, places the position of the intersection of
|
williamr@2
|
1260 |
the character edge with the baseline in aPos
|
williamr@2
|
1261 |
@param aPos On return, stores the position of the intersection of
|
williamr@2
|
1262 |
the character edge with the baseline
|
williamr@2
|
1263 |
@return ETrue if the document is in the formatted text, otherwise EFalse.
|
williamr@2
|
1264 |
*/
|
williamr@2
|
1265 |
inline TBool TCursorPosition::CalculateCursorPos(TPoint& aPos)
|
williamr@2
|
1266 |
{
|
williamr@2
|
1267 |
TTmPosInfo2 pos_info;
|
williamr@2
|
1268 |
TBool result = iLayout->FindDocPos(iDocPos,pos_info);
|
williamr@2
|
1269 |
aPos = pos_info.iEdge;
|
williamr@2
|
1270 |
return result;
|
williamr@2
|
1271 |
}
|
williamr@2
|
1272 |
|
williamr@2
|
1273 |
/** Gets the document position, the structure for holding a raw document
|
williamr@2
|
1274 |
position that can be converted to or from an x-y position and compared
|
williamr@2
|
1275 |
ordinally, which cannot be done with the more abstract TTmDocPosSpec class.
|
williamr@2
|
1276 |
@return the document position
|
williamr@2
|
1277 |
*/
|
williamr@2
|
1278 |
inline const TTmDocPos& TCursorPosition::TmDocPos() const
|
williamr@2
|
1279 |
{
|
williamr@2
|
1280 |
return iDocPos;
|
williamr@2
|
1281 |
}
|
williamr@2
|
1282 |
/** Gets the edge position in the document.
|
williamr@2
|
1283 |
@return the edge position in the document.
|
williamr@2
|
1284 |
*/
|
williamr@2
|
1285 |
inline TInt TCursorPosition::DocPos() const
|
williamr@2
|
1286 |
{
|
williamr@2
|
1287 |
return iDocPos.iPos;
|
williamr@2
|
1288 |
}
|
williamr@2
|
1289 |
|
williamr@2
|
1290 |
/** Sets the document position, the structure for holding a raw document
|
williamr@2
|
1291 |
position that can be converted to or from an x-y position and compared
|
williamr@2
|
1292 |
ordinally, which cannot be done with the more abstract TTmDocPosSpec class.
|
williamr@2
|
1293 |
@param aDocPos the document position
|
williamr@2
|
1294 |
*/
|
williamr@2
|
1295 |
inline void TCursorPosition::SetDocPos(const TTmDocPos& aDocPos)
|
williamr@2
|
1296 |
{
|
williamr@2
|
1297 |
iDocPos = aDocPos;
|
williamr@2
|
1298 |
}
|
williamr@2
|
1299 |
|
williamr@2
|
1300 |
/** Tests whether the highlighted region needs to be drawn.
|
williamr@2
|
1301 |
The function will be called by CTextView::UpdateHighlightL()
|
williamr@2
|
1302 |
to correct the highlight after a cursor movement
|
williamr@2
|
1303 |
@return True if the highlighted region needs to be drawn. False if not. */
|
williamr@2
|
1304 |
inline TBool TCursorPosition::DrawHighlight() const
|
williamr@2
|
1305 |
{
|
williamr@2
|
1306 |
return iFlags & EDrawHighlight;
|
williamr@2
|
1307 |
}
|
williamr@2
|
1308 |
|
williamr@2
|
1309 |
/** Tests whether there is a previous picture frame that needs to be drawn.
|
williamr@2
|
1310 |
The function will be called by CTextView::UpdateHighlightL()
|
williamr@2
|
1311 |
to correct the highlight after a cursor movement
|
williamr@2
|
1312 |
@return True if there is a previous picture frame that needs to be drawn. False if not. */
|
williamr@2
|
1313 |
inline TBool TCursorPosition::DrawOldPictureFrame() const
|
williamr@2
|
1314 |
{
|
williamr@2
|
1315 |
return iFlags & EDrawOldPictureFrame;
|
williamr@2
|
1316 |
}
|
williamr@2
|
1317 |
|
williamr@2
|
1318 |
/** Tests whether there is a new picture frame that needs to be drawn.
|
williamr@2
|
1319 |
The function will be called by CTextView::UpdateHighlightL()
|
williamr@2
|
1320 |
to correct the highlight after a cursor movement
|
williamr@2
|
1321 |
@return True if there is a new picture frame that needs to be drawn. False if not. */
|
williamr@2
|
1322 |
inline TBool TCursorPosition::DrawNewPictureFrame() const
|
williamr@2
|
1323 |
{
|
williamr@2
|
1324 |
return iFlags & EDrawNewPictureFrame;
|
williamr@2
|
1325 |
}
|
williamr@2
|
1326 |
|
williamr@2
|
1327 |
/** Sets to not draw the previous picture frame
|
williamr@2
|
1328 |
*/
|
williamr@2
|
1329 |
inline void TCursorPosition::DontDrawOldPictureFrame()
|
williamr@2
|
1330 |
{
|
williamr@2
|
1331 |
iFlags &= ~EDrawOldPictureFrame;
|
williamr@2
|
1332 |
}
|
williamr@2
|
1333 |
|
williamr@2
|
1334 |
#endif
|