williamr@2
|
1 |
// Copyright (c) 1999-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 |
// The main header file for TAGMA, the low-level text formatting engine for EPOC.
|
williamr@2
|
15 |
// 'Tm' stands for 'TAGMA' and is the standard prefix for TAGMA classes, after
|
williamr@2
|
16 |
// the C, T, or whatever.
|
williamr@2
|
17 |
//
|
williamr@2
|
18 |
//
|
williamr@2
|
19 |
|
williamr@2
|
20 |
|
williamr@2
|
21 |
|
williamr@2
|
22 |
#ifndef __TAGMA_H__
|
williamr@2
|
23 |
#define __TAGMA_H__
|
williamr@2
|
24 |
|
williamr@2
|
25 |
#include <e32base.h>
|
williamr@2
|
26 |
#include <openfont.h>
|
williamr@2
|
27 |
#include <txtfrmat.h>
|
williamr@2
|
28 |
#include <txtstyle.h>
|
williamr@2
|
29 |
#include <linebreak.h>
|
williamr@2
|
30 |
|
williamr@2
|
31 |
// forward declarations
|
williamr@2
|
32 |
class TTmLineInfo;
|
williamr@2
|
33 |
class CTmTextImp;
|
williamr@2
|
34 |
class RWindow;
|
williamr@2
|
35 |
class RWsSession;
|
williamr@2
|
36 |
class RParagraphStyleInfo;
|
williamr@2
|
37 |
class CStyleList;
|
williamr@2
|
38 |
class TTmDocPosSpec;
|
williamr@2
|
39 |
class TTmDocPos;
|
williamr@2
|
40 |
class TCursorSelection;
|
williamr@2
|
41 |
class TTmHighlightExtensions;
|
williamr@2
|
42 |
class TBidirectionalContext;
|
williamr@2
|
43 |
|
williamr@2
|
44 |
/**
|
williamr@2
|
45 |
A bit mask for selecting one or more attributes of a TTmCharFormat object.
|
williamr@2
|
46 |
@internalComponent
|
williamr@2
|
47 |
*/
|
williamr@2
|
48 |
class TTmCharFormatMask
|
williamr@2
|
49 |
|
williamr@2
|
50 |
{
|
williamr@2
|
51 |
public:
|
williamr@2
|
52 |
/** Constants, that are also bit assignments, representing character format attributes */
|
williamr@2
|
53 |
enum TAttrib
|
williamr@2
|
54 |
{
|
williamr@2
|
55 |
EFontName = 0x1,
|
williamr@2
|
56 |
EFontCoverage = 0x2,
|
williamr@2
|
57 |
EBold = 0x4,
|
williamr@2
|
58 |
EItalic = 0x8,
|
williamr@2
|
59 |
ESerif = 0x10,
|
williamr@2
|
60 |
EMonoWidth = 0x20,
|
williamr@2
|
61 |
EHeight = 0x40,
|
williamr@2
|
62 |
EPrintPosition = 0x80,
|
williamr@2
|
63 |
ETextColor = 0x100,
|
williamr@2
|
64 |
EBackgroundColor = 0x200,
|
williamr@2
|
65 |
EBackground = 0x400,
|
williamr@2
|
66 |
EUnderline = 0x800,
|
williamr@2
|
67 |
EStrikethrough = 0x1000,
|
williamr@2
|
68 |
EShadow = 0x2000,
|
williamr@2
|
69 |
EUserDefinedEffects = 0x4000,
|
williamr@2
|
70 |
ELanguage = 0x8000,
|
williamr@2
|
71 |
EPictureAlignment = 0x10000
|
williamr@2
|
72 |
};
|
williamr@2
|
73 |
|
williamr@2
|
74 |
inline TTmCharFormatMask();
|
williamr@2
|
75 |
IMPORT_C TTmCharFormatMask(const TCharFormatMask& aMask);
|
williamr@2
|
76 |
IMPORT_C void GetTCharFormatMask(TCharFormatMask& aMask) const;
|
williamr@2
|
77 |
inline void Clear(TAttrib aAttrib);
|
williamr@2
|
78 |
inline void Set(TAttrib aAttrib);
|
williamr@2
|
79 |
inline TBool IsSet(TAttrib aAttrib);
|
williamr@2
|
80 |
|
williamr@2
|
81 |
TUint iFlags;
|
williamr@2
|
82 |
};
|
williamr@2
|
83 |
|
williamr@2
|
84 |
/**
|
williamr@2
|
85 |
A character format; all dimensions are in twips. A character format object
|
williamr@2
|
86 |
stores all text style attributes that can differ from any one character to the
|
williamr@2
|
87 |
next. Attributes that affect an entire paragraph only are kept in RTmParFormat
|
williamr@2
|
88 |
objects.
|
williamr@2
|
89 |
@internalComponent
|
williamr@2
|
90 |
*/
|
williamr@2
|
91 |
class TTmCharFormat
|
williamr@2
|
92 |
{
|
williamr@2
|
93 |
public:
|
williamr@2
|
94 |
/** Bit assignments for effects */
|
williamr@2
|
95 |
enum
|
williamr@2
|
96 |
{
|
williamr@2
|
97 |
EBackground = 1, ///< Text background is drawn in the background colour
|
williamr@2
|
98 |
ERounded = 2, ///< Text background (if any) has rounded corners
|
williamr@2
|
99 |
EUnderline = 4, ///< Text is underlined
|
williamr@2
|
100 |
EStrikethrough = 8, ///< Text is struck through with a horizontal line.
|
williamr@2
|
101 |
EShadow = 16, ///< Text has a drop shadow.
|
williamr@2
|
102 |
/** Bits 24-31 are reserved for styles defined by the custom drawer. */
|
williamr@2
|
103 |
EUserDefinedMask = 0xFF000000,
|
williamr@2
|
104 |
/** Shift TCharFormat highlight styles left by this to get the
|
williamr@2
|
105 |
TTmCharFormat effects portion. */
|
williamr@2
|
106 |
EUserDefinedShift = 24,
|
williamr@2
|
107 |
/** For custom drawers: draw whatever is wanted for "no matches" in the FEP. */
|
williamr@2
|
108 |
ENoMatchesIndicator = 0x4000000,
|
williamr@2
|
109 |
/** Reset if the effect in bits 24-30 is defined defined by Symbian,
|
williamr@2
|
110 |
set if it is defined externally. */
|
williamr@2
|
111 |
ECustomDrawEffectIsExternallyDefined = 0x80000000
|
williamr@2
|
112 |
};
|
williamr@2
|
113 |
|
williamr@2
|
114 |
/** Picture alignment */
|
williamr@2
|
115 |
enum TPictureAlignment
|
williamr@2
|
116 |
{
|
williamr@2
|
117 |
EPictureAlignBaseline,
|
williamr@2
|
118 |
EPictureAlignTop,
|
williamr@2
|
119 |
EPictureAlignBottom,
|
williamr@2
|
120 |
EPictureAlignCenter
|
williamr@2
|
121 |
};
|
williamr@2
|
122 |
|
williamr@2
|
123 |
IMPORT_C TTmCharFormat();
|
williamr@2
|
124 |
IMPORT_C TTmCharFormat(const TDesC& aFontName,TInt aFontHeight);
|
williamr@2
|
125 |
IMPORT_C void operator=(const TCharFormat& aFormat);
|
williamr@2
|
126 |
inline TTmCharFormat(const TCharFormat& aFormat);
|
williamr@2
|
127 |
IMPORT_C void GetTCharFormat(TCharFormat& aFormat) const;
|
williamr@2
|
128 |
IMPORT_C TBool operator==(const TTmCharFormat& aFormat) const;
|
williamr@2
|
129 |
inline TBool operator!=(const TTmCharFormat& aFormat) const;
|
williamr@2
|
130 |
|
williamr@2
|
131 |
TOpenFontSpec iFontSpec;
|
williamr@2
|
132 |
TLogicalRgb iTextColor;
|
williamr@2
|
133 |
TLogicalRgb iBackgroundColor; // used only when EBackground flag is set in iEffects
|
williamr@2
|
134 |
TUint iEffects; // bit flags as defined above;
|
williamr@2
|
135 |
// note that effects NEVER change character metrics and so can
|
williamr@2
|
136 |
// be ignored when measuring text
|
williamr@2
|
137 |
TUint iLanguage; // language used for proofing
|
williamr@2
|
138 |
TPictureAlignment iPictureAlignment;// vertical alignment of embedded objects
|
williamr@2
|
139 |
TUint iTag; // tag for use by URL parsers, etc.; a way of marking a range of
|
williamr@2
|
140 |
// text without using any typographic attributes
|
williamr@2
|
141 |
};
|
williamr@2
|
142 |
|
williamr@2
|
143 |
/**
|
williamr@2
|
144 |
A tabulation position, measured from the start of the line, which will be
|
williamr@2
|
145 |
the left end for paragraphs with a left-to-right base direction, and vice
|
williamr@2
|
146 |
versa.
|
williamr@2
|
147 |
@internalComponent
|
williamr@2
|
148 |
*/
|
williamr@2
|
149 |
class TTmTab
|
williamr@2
|
150 |
|
williamr@2
|
151 |
{
|
williamr@2
|
152 |
public:
|
williamr@2
|
153 |
/** Tab type */
|
williamr@2
|
154 |
enum TType
|
williamr@2
|
155 |
{
|
williamr@2
|
156 |
EStandardTab, // text is placed after the tab, in the current paragraph direction
|
williamr@2
|
157 |
ECenterTab, // text is centred around the tab
|
williamr@2
|
158 |
EReverseTab // text is placed before the tab, in the current paragraph direction
|
williamr@2
|
159 |
};
|
williamr@2
|
160 |
|
williamr@2
|
161 |
inline TTmTab();
|
williamr@2
|
162 |
inline TTmTab(const TTabStop& aTab);
|
williamr@2
|
163 |
IMPORT_C void operator=(const TTabStop& aTab);
|
williamr@2
|
164 |
IMPORT_C void GetTTabStop(TTabStop& aTab) const;
|
williamr@2
|
165 |
IMPORT_C TBool operator==(const TTmTab& aTab) const;
|
williamr@2
|
166 |
inline TBool operator!=(const TTmTab& aTab) const;
|
williamr@2
|
167 |
|
williamr@2
|
168 |
TInt iPosition;
|
williamr@2
|
169 |
TType iType;
|
williamr@2
|
170 |
};
|
williamr@2
|
171 |
|
williamr@2
|
172 |
/**
|
williamr@2
|
173 |
A bullet or other label inserted automatically at the start of a paragraph.
|
williamr@2
|
174 |
As well as an actual bullet, it can be a number or a letter.
|
williamr@2
|
175 |
@internalComponent
|
williamr@2
|
176 |
*/
|
williamr@2
|
177 |
class TTmBullet
|
williamr@2
|
178 |
|
williamr@2
|
179 |
{
|
williamr@2
|
180 |
public:
|
williamr@2
|
181 |
/** Bullet style */
|
williamr@2
|
182 |
enum TStyle
|
williamr@2
|
183 |
{
|
williamr@2
|
184 |
EBulletStyle,
|
williamr@2
|
185 |
EArabicNumberStyle,
|
williamr@2
|
186 |
ESmallRomanNumberStyle,
|
williamr@2
|
187 |
ECapitalRomanNumberStyle,
|
williamr@2
|
188 |
ESmallLetterStyle,
|
williamr@2
|
189 |
ECapitalLetterStyle
|
williamr@2
|
190 |
};
|
williamr@2
|
191 |
|
williamr@2
|
192 |
/** The alignment within the margin of bullets or other text used in TTmBullet objects */
|
williamr@2
|
193 |
enum TAlignment
|
williamr@2
|
194 |
{
|
williamr@2
|
195 |
/** Bullet forward aligned. */
|
williamr@2
|
196 |
ELeftAlign,
|
williamr@2
|
197 |
/** Bullet centre aligned. */
|
williamr@2
|
198 |
ECenterAlign,
|
williamr@2
|
199 |
/** Bullet reverse aligned. */
|
williamr@2
|
200 |
ERightAlign
|
williamr@2
|
201 |
};
|
williamr@2
|
202 |
|
williamr@2
|
203 |
IMPORT_C TTmBullet();
|
williamr@2
|
204 |
IMPORT_C void operator=(const TBullet& aBullet);
|
williamr@2
|
205 |
inline TTmBullet(const TBullet& aBullet);
|
williamr@2
|
206 |
IMPORT_C void GetTBullet(TBullet& aBullet) const;
|
williamr@2
|
207 |
IMPORT_C TBool operator==(const TTmBullet& aBullet) const;
|
williamr@2
|
208 |
inline TBool operator!=(const TTmBullet& aBullet) const;
|
williamr@2
|
209 |
|
williamr@2
|
210 |
TChar iCharacterCode; // the bullet or other symbol used if iStyle is EBulletStyle
|
williamr@2
|
211 |
TOpenFontSpec iFontSpec;
|
williamr@2
|
212 |
TBool iHangingIndent;
|
williamr@2
|
213 |
TLogicalRgb iColor;
|
williamr@2
|
214 |
TStyle iStyle; // is this a bullet or a number or a letter?
|
williamr@2
|
215 |
TInt iStartNumber; // the number of the first paragraph in a run of paragraphs in this style
|
williamr@2
|
216 |
TAlignment iAlignment; // alignment of the bullet or number within the margin
|
williamr@2
|
217 |
};
|
williamr@2
|
218 |
|
williamr@2
|
219 |
/**
|
williamr@2
|
220 |
A specification of a paragraph border rule: that is, a line or lines drawn
|
williamr@2
|
221 |
above, below, to the left, or to the right of a paragraph.
|
williamr@2
|
222 |
@internalComponent
|
williamr@2
|
223 |
*/
|
williamr@2
|
224 |
class TTmParBorder
|
williamr@2
|
225 |
|
williamr@2
|
226 |
{
|
williamr@2
|
227 |
public:
|
williamr@2
|
228 |
/** Paragraph border style */
|
williamr@2
|
229 |
enum TStyle
|
williamr@2
|
230 |
{
|
williamr@2
|
231 |
ESolidStyle,
|
williamr@2
|
232 |
EDoubleStyle,
|
williamr@2
|
233 |
EDotStyle,
|
williamr@2
|
234 |
EDashStyle,
|
williamr@2
|
235 |
EDotDashStyle,
|
williamr@2
|
236 |
EDotDotDashStyle
|
williamr@2
|
237 |
};
|
williamr@2
|
238 |
|
williamr@2
|
239 |
IMPORT_C TTmParBorder();
|
williamr@2
|
240 |
IMPORT_C void operator=(const TParaBorder& aBorder);
|
williamr@2
|
241 |
inline TTmParBorder(const TParaBorder& aBorder);
|
williamr@2
|
242 |
IMPORT_C void GetTParaBorder(TParaBorder& aBorder) const;
|
williamr@2
|
243 |
IMPORT_C TBool operator==(const TTmParBorder& aBorder) const;
|
williamr@2
|
244 |
inline TBool operator!=(const TTmParBorder& aBorder) const;
|
williamr@2
|
245 |
|
williamr@2
|
246 |
TStyle iStyle;
|
williamr@2
|
247 |
TInt iWeight;
|
williamr@2
|
248 |
TLogicalRgb iColor;
|
williamr@2
|
249 |
TBool iAutoColor;
|
williamr@2
|
250 |
};
|
williamr@2
|
251 |
|
williamr@2
|
252 |
|
williamr@2
|
253 |
/**
|
williamr@2
|
254 |
A bit mask for selecting one or more attributes of an RTmParFormat.
|
williamr@2
|
255 |
@internalComponent
|
williamr@2
|
256 |
*/
|
williamr@2
|
257 |
class TTmParFormatMask
|
williamr@2
|
258 |
|
williamr@2
|
259 |
{
|
williamr@2
|
260 |
public:
|
williamr@2
|
261 |
/** Constants, that are also bit assignments, representing paragraph format attributes */
|
williamr@2
|
262 |
enum TAttrib
|
williamr@2
|
263 |
{
|
williamr@2
|
264 |
EAlignment = 0x1,
|
williamr@2
|
265 |
EDirection = 0x2,
|
williamr@2
|
266 |
EKeepTogether = 0x4,
|
williamr@2
|
267 |
EKeepWithNext = 0x8,
|
williamr@2
|
268 |
EStartNewPage = 0x10,
|
williamr@2
|
269 |
EWidowOrphan = 0x20,
|
williamr@2
|
270 |
ENoWrap = 0x40,
|
williamr@2
|
271 |
EExactLineSpacing = 0x80,
|
williamr@2
|
272 |
EPixelLineSpacing = 0x100,
|
williamr@2
|
273 |
ELeadingMargin = 0x200,
|
williamr@2
|
274 |
ETrailingMargin = 0x400,
|
williamr@2
|
275 |
EFirstLineIndent = 0x800,
|
williamr@2
|
276 |
ELineSpacing = 0x1000,
|
williamr@2
|
277 |
ESpaceAbove = 0x2000,
|
williamr@2
|
278 |
ESpaceBelow = 0x4000,
|
williamr@2
|
279 |
ETabSize = 0x8000,
|
williamr@2
|
280 |
EBorderMargin = 0x10000,
|
williamr@2
|
281 |
ETabList = 0x20000,
|
williamr@2
|
282 |
EBullet = 0x40000,
|
williamr@2
|
283 |
EBorder = 0x80000
|
williamr@2
|
284 |
};
|
williamr@2
|
285 |
|
williamr@2
|
286 |
inline TTmParFormatMask();
|
williamr@2
|
287 |
IMPORT_C TTmParFormatMask(const TParaFormatMask& aMask);
|
williamr@2
|
288 |
IMPORT_C void GetTParaFormatMask(TParaFormatMask& aMask) const;
|
williamr@2
|
289 |
inline void Clear(TAttrib aAttrib);
|
williamr@2
|
290 |
inline void Set(TAttrib aAttrib);
|
williamr@2
|
291 |
inline TBool IsSet(TAttrib aAttrib);
|
williamr@2
|
292 |
|
williamr@2
|
293 |
TUint iFlags;
|
williamr@2
|
294 |
};
|
williamr@2
|
295 |
|
williamr@2
|
296 |
/**
|
williamr@2
|
297 |
Paragraph format; all dimensions are in twips unless otherwise specified.
|
williamr@2
|
298 |
@internalComponent
|
williamr@2
|
299 |
*/
|
williamr@2
|
300 |
class RTmParFormat
|
williamr@2
|
301 |
|
williamr@2
|
302 |
{
|
williamr@2
|
303 |
public:
|
williamr@2
|
304 |
/** Index used to select one of the four borders of a paragraph */
|
williamr@2
|
305 |
enum TBorderIndex
|
williamr@2
|
306 |
{
|
williamr@2
|
307 |
ETopBorder = 0,
|
williamr@2
|
308 |
EBottomBorder = 1,
|
williamr@2
|
309 |
ELeadingBorder = 2,
|
williamr@2
|
310 |
ETrailingBorder = 3,
|
williamr@2
|
311 |
};
|
williamr@2
|
312 |
|
williamr@2
|
313 |
/** Bit assignments for RTmParFormat::iFlags. */
|
williamr@2
|
314 |
enum
|
williamr@2
|
315 |
{
|
williamr@2
|
316 |
/** Base direction of paragraph is right-to-left (as for Arabic) */
|
williamr@2
|
317 |
ERightToLeft = 1,
|
williamr@2
|
318 |
/** Do not allow paragraph to straddle page boundaries. */
|
williamr@2
|
319 |
EKeepTogether = 2,
|
williamr@2
|
320 |
/** Put this paragraph on the same page as the next. */
|
williamr@2
|
321 |
EKeepWithNext = 4,
|
williamr@2
|
322 |
/** Put this paragraph at the start of a new page. */
|
williamr@2
|
323 |
EStartNewPage = 8,
|
williamr@2
|
324 |
/** Suppress widows and orphans. */
|
williamr@2
|
325 |
EWidowOrphan = 16,
|
williamr@2
|
326 |
/** Suppresses line breaking. */
|
williamr@2
|
327 |
ENoWrap = 32,
|
williamr@2
|
328 |
/** Force line spacing distance to be respected even on lines that are
|
williamr@2
|
329 |
* taller than the specified height. */
|
williamr@2
|
330 |
EExactLineSpacing = 64,
|
williamr@2
|
331 |
/** Line spaceing is in pixels, not twips. */
|
williamr@2
|
332 |
EPixelLineSpacing = 128,
|
williamr@2
|
333 |
/** Work out paragraph directionality from the text. */
|
williamr@2
|
334 |
EDirectionalityFromText = 256
|
williamr@2
|
335 |
};
|
williamr@2
|
336 |
|
williamr@2
|
337 |
/** Paragraph alignment */
|
williamr@2
|
338 |
enum TAlignment
|
williamr@2
|
339 |
{
|
williamr@2
|
340 |
EAlignNormalBidirectional,
|
williamr@2
|
341 |
EAlignNormal = EAlignNormalBidirectional, /** @deprecated in 7.0s */
|
williamr@2
|
342 |
EAlignCenter,
|
williamr@2
|
343 |
EAlignReverseBidirectional,
|
williamr@2
|
344 |
EAlignReverse = EAlignReverseBidirectional, /** @deprecated in 7.0s */
|
williamr@2
|
345 |
EAlignJustify,
|
williamr@2
|
346 |
EAlignAbsoluteLeft,
|
williamr@2
|
347 |
EAlignAbsoluteRight
|
williamr@2
|
348 |
};
|
williamr@2
|
349 |
|
williamr@2
|
350 |
IMPORT_C RTmParFormat();
|
williamr@2
|
351 |
IMPORT_C void Close();
|
williamr@2
|
352 |
#ifdef _DEBUG
|
williamr@2
|
353 |
inline ~RTmParFormat();
|
williamr@2
|
354 |
#endif
|
williamr@2
|
355 |
IMPORT_C void CopyL(const RTmParFormat& aFormat);
|
williamr@2
|
356 |
IMPORT_C void CopyL(const CParaFormat& aFormat);
|
williamr@2
|
357 |
IMPORT_C void GetCParaFormatL(CParaFormat& aFormat) const;
|
williamr@2
|
358 |
IMPORT_C TBool operator==(const RTmParFormat& aFormat) const;
|
williamr@2
|
359 |
inline TBool operator!=(const RTmParFormat& aFormat) const;
|
williamr@2
|
360 |
IMPORT_C TInt Tabs() const;
|
williamr@2
|
361 |
inline const TTmTab& Tab(TInt aIndex) const;
|
williamr@2
|
362 |
inline const TTmBullet* Bullet() const;
|
williamr@2
|
363 |
inline const TTmParBorder* Border(TBorderIndex aIndex) const;
|
williamr@2
|
364 |
IMPORT_C TBool HaveBorders() const;
|
williamr@2
|
365 |
inline TBool RightToLeft() const;
|
williamr@2
|
366 |
|
williamr@2
|
367 |
TAlignment iAlignment;
|
williamr@2
|
368 |
TUint iFlags; // bit flags as defined above
|
williamr@2
|
369 |
TInt iLeadingMargin; // left margin, or right if right-to-left
|
williamr@2
|
370 |
TInt iTrailingMargin; // right margin, or left if right-to-left
|
williamr@2
|
371 |
TInt iFirstLineIndent; // added to first line leading margin
|
williamr@2
|
372 |
TInt iLineSpacing; // distance between baselines
|
williamr@2
|
373 |
TInt iSpaceAbove; // space above the paragraph
|
williamr@2
|
374 |
TInt iSpaceBelow; // space below the paragraph
|
williamr@2
|
375 |
TInt iTabSize; // default size of tabs
|
williamr@2
|
376 |
TInt iBorderMargin; // distance between the text and the border if any
|
williamr@2
|
377 |
TLogicalRgb iBackgroundColor; // paragraph background colour
|
williamr@2
|
378 |
|
williamr@2
|
379 |
private:
|
williamr@2
|
380 |
RTmParFormat(const RTmParFormat& aFormat); // deliberately unimplemented
|
williamr@2
|
381 |
void operator=(const RTmParFormat& aFormat);// deliberately unimplemented
|
williamr@2
|
382 |
|
williamr@2
|
383 |
RArray<TTmTab>* iTabList; // custom tabs if any
|
williamr@2
|
384 |
TTmBullet* iBullet; // bullet if any
|
williamr@2
|
385 |
TTmParBorder* iBorder[4]; // borders if any
|
williamr@2
|
386 |
};
|
williamr@2
|
387 |
|
williamr@2
|
388 |
/**
|
williamr@2
|
389 |
The text customization interface. You can customize the colors, word
|
williamr@2
|
390 |
spacing, line breaking, line height calculation, background drawing, and text
|
williamr@2
|
391 |
appearance, of a text object by supplying an implementation of the MTmCustom
|
williamr@2
|
392 |
class, either directly (as in CTmText::CustomizeL, which takes a pointer to
|
williamr@2
|
393 |
MTmCustom) or indirectly, making use of the fact that MTmSource is derived from
|
williamr@2
|
394 |
MTmCustom (as in CTmTextLayout::SetTextL, which takes a reference to
|
williamr@2
|
395 |
MTmSource).
|
williamr@2
|
396 |
@publishedAll
|
williamr@2
|
397 |
@released
|
williamr@2
|
398 |
*/
|
williamr@2
|
399 |
class MTmCustom
|
williamr@2
|
400 |
: public MLineBreaker
|
williamr@2
|
401 |
{
|
williamr@2
|
402 |
public:
|
williamr@2
|
403 |
/**
|
williamr@2
|
404 |
TLineHeightParam structure is used in MTmCustom::SetLineHeight() method to set
|
williamr@2
|
405 |
text line height related parameters such as max character height, max ascent and descent,
|
williamr@2
|
406 |
height and depth of the tallest pictures (top-aligned, bottom-aligned or centered).
|
williamr@2
|
407 |
@see MTmCustom::SetLineHeight()
|
williamr@2
|
408 |
@publishedAll
|
williamr@2
|
409 |
@released
|
williamr@2
|
410 |
*/
|
williamr@2
|
411 |
class TLineHeightParam
|
williamr@2
|
412 |
{
|
williamr@2
|
413 |
public:
|
williamr@2
|
414 |
inline TLineHeightParam();
|
williamr@2
|
415 |
/** Height of the highest character in the line. */
|
williamr@2
|
416 |
TInt iMaxCharHeight;
|
williamr@2
|
417 |
/** Depth of the deepest character in the line. */
|
williamr@2
|
418 |
TInt iMaxCharDepth;
|
williamr@2
|
419 |
/** Height plus depth of the tallest top-aligned picture. */
|
williamr@2
|
420 |
TInt iMaxTopPictureHeight;
|
williamr@2
|
421 |
/** Height plus depth of the tallest bottom-aligned picture. */
|
williamr@2
|
422 |
TInt iMaxBottomPictureHeight;
|
williamr@2
|
423 |
/** Height plus depth of the tallest centred picture. */
|
williamr@2
|
424 |
TInt iMaxCenterPictureHeight;
|
williamr@2
|
425 |
/** Height of the tallest character of any in the fonts in the line. */
|
williamr@2
|
426 |
TInt iFontMaxCharHeight;
|
williamr@2
|
427 |
/** Depth of the deepest character of any in the fonts in the line. */
|
williamr@2
|
428 |
TInt iFontMaxCharDepth;
|
williamr@2
|
429 |
/** Maximum ascent of the fonts in the line. */
|
williamr@2
|
430 |
TInt iFontMaxAscent;
|
williamr@2
|
431 |
/** Maximum descent of the fonts in the line. */
|
williamr@2
|
432 |
TInt iFontMaxDescent;
|
williamr@2
|
433 |
/** Desired precise or minimum line height. */
|
williamr@2
|
434 |
TInt iDesiredLineHeight;
|
williamr@2
|
435 |
/** True if the line height must be precise. */
|
williamr@2
|
436 |
TBool iExactLineHeight;
|
williamr@2
|
437 |
};
|
williamr@2
|
438 |
|
williamr@2
|
439 |
/** The Unicode line breaking classes; see Unicode Technical Report 14.
|
williamr@2
|
440 |
Not a named enumerated type, so that overriding applications can add new
|
williamr@2
|
441 |
line breaking classes freely.
|
williamr@2
|
442 |
The description of each constant gives the name of the line-breaking
|
williamr@2
|
443 |
class, an example and a brief, imprecise description of the default
|
williamr@2
|
444 |
behaviour of characters of that class.
|
williamr@2
|
445 |
*/
|
williamr@2
|
446 |
enum
|
williamr@2
|
447 |
{
|
williamr@2
|
448 |
/** Opening Punctuation (e.g. '['). Breaking after prohibited. */
|
williamr@2
|
449 |
EOpLineBreakClass,
|
williamr@2
|
450 |
/** Closing Punctuation (e.g. ']'). Breaking before prohibited. */
|
williamr@2
|
451 |
EClLineBreakClass,
|
williamr@2
|
452 |
/** Ambiguous Quotes (e.g. '"'). Breaking before and after prohibited. */
|
williamr@2
|
453 |
EQuLineBreakClass,
|
williamr@2
|
454 |
/** Glue (e.g. Non-breaking space). Breaking before and after prohibited
|
williamr@2
|
455 |
unless spaces are present. */
|
williamr@2
|
456 |
EGlLineBreakClass,
|
williamr@2
|
457 |
/** Non-Starter (e.g. small Japanese kana). Breaking before prohibited
|
williamr@2
|
458 |
if no spaces present. */
|
williamr@2
|
459 |
ENsLineBreakClass,
|
williamr@2
|
460 |
/** Exclamation or Interrogation (e.g. '?'). Like closing punctuation
|
williamr@2
|
461 |
except before Postfix or Non-starter. */
|
williamr@2
|
462 |
EExLineBreakClass,
|
williamr@2
|
463 |
/** Symbol (e.g. '/'. Like Alphabetic, but allows breaking before
|
williamr@2
|
464 |
Alphabetic. */
|
williamr@2
|
465 |
ESyLineBreakClass,
|
williamr@2
|
466 |
/** Numeric Infix Separator (e.g. ','). Forbids breaking after any and before
|
williamr@2
|
467 |
Numeric. */
|
williamr@2
|
468 |
EIsLineBreakClass,
|
williamr@2
|
469 |
/** Numeric Prefix (e.g. '$'). Forbids breaking before Numeric. */
|
williamr@2
|
470 |
EPrLineBreakClass,
|
williamr@2
|
471 |
/** Numeric Postfix (e.g. '%'). Forbids breaking after Numeric. */
|
williamr@2
|
472 |
EPoLineBreakClass,
|
williamr@2
|
473 |
/** Numeric (e.g. '1'). */
|
williamr@2
|
474 |
ENuLineBreakClass,
|
williamr@2
|
475 |
/** Alphabetic (e.g. 'a'). */
|
williamr@2
|
476 |
EAlLineBreakClass,
|
williamr@2
|
477 |
/** Ideographic (e.g. Japanese Kanji). Generally break before or after */
|
williamr@2
|
478 |
EIdLineBreakClass,
|
williamr@2
|
479 |
/** Inseparable (e.g. ellipsis). Forbid breaks between Inseparables. */
|
williamr@2
|
480 |
EInLineBreakClass,
|
williamr@2
|
481 |
/** Hyphen (e.g. '-'). Allows a break after except before Numeric. */
|
williamr@2
|
482 |
EHyLineBreakClass,
|
williamr@2
|
483 |
/** Break After. Generally allow a break after. Breaking between Break
|
williamr@2
|
484 |
Afters not separated by spaces is prohibited. */
|
williamr@2
|
485 |
EBaLineBreakClass,
|
williamr@2
|
486 |
/** Break Before. Generally allow a break before. Breaking between Break
|
williamr@2
|
487 |
Befores not separated by spaces is prohibited. */
|
williamr@2
|
488 |
EBbLineBreakClass,
|
williamr@2
|
489 |
/** Break Before and After. Generally allow a break before or after.
|
williamr@2
|
490 |
Breaking between Break Before and Afters is prohibited, even if spaces
|
williamr@2
|
491 |
are present. */
|
williamr@2
|
492 |
EB2LineBreakClass,
|
williamr@2
|
493 |
/** Zero-Width Space. Allow a break. */
|
williamr@2
|
494 |
EZwLineBreakClass,
|
williamr@2
|
495 |
/** Combining Mark. Takes on the class of its base class. */
|
williamr@2
|
496 |
ECmLineBreakClass,
|
williamr@2
|
497 |
/** Mandatory Break. */
|
williamr@2
|
498 |
EBkLineBreakClass,
|
williamr@2
|
499 |
/** Carriage Return. Break after unless part of a CRLF pair. */
|
williamr@2
|
500 |
ECrLineBreakClass,
|
williamr@2
|
501 |
/** Line Feed. Break after. */
|
williamr@2
|
502 |
ELfLineBreakClass,
|
williamr@2
|
503 |
/** Surrogate. Half of a surrogate pair. */
|
williamr@2
|
504 |
ESgLineBreakClass,
|
williamr@2
|
505 |
/** Contingent Break (e.g. embedded pictures). Uses external
|
williamr@2
|
506 |
information */
|
williamr@2
|
507 |
ECbLineBreakClass,
|
williamr@2
|
508 |
|
williamr@2
|
509 |
/** Space. Intervening characters of class Space are indicated by
|
williamr@2
|
510 |
aHaveSpaces in LineBreakPossible. */
|
williamr@2
|
511 |
ESpLineBreakClass,
|
williamr@2
|
512 |
|
williamr@2
|
513 |
/** Complex Context (e.g. Thai). Runs of Complex Context are passed to
|
williamr@2
|
514 |
GetLineBreakInContext. */
|
williamr@2
|
515 |
ESaLineBreakClass,
|
williamr@2
|
516 |
|
williamr@2
|
517 |
/** Ambiguous. Characters of ambiguous East Asian width are treated
|
williamr@2
|
518 |
as Alphabetic, unless they are resolved as being "Wide", in which case
|
williamr@2
|
519 |
they are treated as Ideographic. */
|
williamr@2
|
520 |
EAiLineBreakClass,
|
williamr@2
|
521 |
|
williamr@2
|
522 |
/** The Xx class is used when the class is unknown; e.g.; outside the provided context. */
|
williamr@2
|
523 |
EXxLineBreakClass,
|
williamr@2
|
524 |
|
williamr@2
|
525 |
/** The number of Unicode line break classes. */
|
williamr@2
|
526 |
ELineBreakClasses
|
williamr@2
|
527 |
};
|
williamr@2
|
528 |
|
williamr@2
|
529 |
IMPORT_C virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const;
|
williamr@2
|
530 |
IMPORT_C virtual TInt Stretch(TUint aChar) const;
|
williamr@2
|
531 |
IMPORT_C virtual TUint Map(TUint aChar) const;
|
williamr@2
|
532 |
IMPORT_C virtual void SetLineHeight(const TLineHeightParam& aParam,TInt& aAscent,TInt& aDescent) const;
|
williamr@2
|
533 |
IMPORT_C virtual void DrawBackground(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
|
williamr@2
|
534 |
const TLogicalRgb& aBackground,TRect& aRectDrawn) const;
|
williamr@2
|
535 |
IMPORT_C virtual void DrawLineGraphics(CGraphicsContext& aGc,const TPoint& aTextLayoutTopLeft,const TRect& aRect,
|
williamr@2
|
536 |
const TTmLineInfo& aLineInfo) const;
|
williamr@2
|
537 |
IMPORT_C virtual void DrawText(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aRect,
|
williamr@2
|
538 |
const TTmLineInfo& aLineInfo,const TTmCharFormat& aFormat,
|
williamr@2
|
539 |
const TDesC& aText,const TPoint& aTextOrigin,TInt aExtraPixels) const;
|
williamr@2
|
540 |
IMPORT_C virtual void DrawPicture(CGraphicsContext& aGc,
|
williamr@2
|
541 |
const TPoint& aTextLayoutTopLeft, const TRect& aRect,
|
williamr@2
|
542 |
MGraphicsDeviceMap& aDevice, const CPicture& aPicture) const;
|
williamr@2
|
543 |
IMPORT_C virtual TUint LineBreakClass(TUint aCode,TUint& aRangeStart,TUint& aRangeEnd) const;
|
williamr@2
|
544 |
IMPORT_C virtual TBool LineBreakPossible(TUint aPrevClass,TUint aNextClass,TBool aHaveSpaces) const;
|
williamr@2
|
545 |
IMPORT_C virtual TBool GetLineBreakInContext(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
|
williamr@2
|
546 |
TBool aForwards,TInt& aBreakPos) const;
|
williamr@2
|
547 |
IMPORT_C virtual TBool IsHangingCharacter(TUint aChar) const;
|
williamr@2
|
548 |
|
williamr@2
|
549 |
// non-virtuals
|
williamr@2
|
550 |
IMPORT_C void SetPenColor(CGraphicsContext& aGc,TLogicalRgb aColor) const;
|
williamr@2
|
551 |
IMPORT_C void SetBrushColor(CGraphicsContext& aGc,TLogicalRgb aColor) const;
|
williamr@2
|
552 |
IMPORT_C TRgb SystemColor(TLogicalRgb aColor) const;
|
williamr@2
|
553 |
};
|
williamr@2
|
554 |
|
williamr@2
|
555 |
/**
|
williamr@2
|
556 |
MTmTextDrawExt interface UID.
|
williamr@2
|
557 |
@internalComponent
|
williamr@2
|
558 |
*/
|
williamr@2
|
559 |
const TUid KTmTextDrawExtId = {0x10203665};
|
williamr@2
|
560 |
|
williamr@2
|
561 |
/**
|
williamr@2
|
562 |
Text drawing - an extension interface. It offfers
|
williamr@2
|
563 |
DrawLine(), DrawText() and DrawRect() methods.
|
williamr@2
|
564 |
The idea is to move out from RTm<Name>Interpreter implementations all
|
williamr@2
|
565 |
CGraphicsContext::Draw<Item> calls and replace them with the corresponding
|
williamr@2
|
566 |
MTmTextDrawExt::Draw<Item> calls. The implementations of MTmTextDrawExt interface can customize
|
williamr@2
|
567 |
drawing methods implementations - for example - including opaque drawing support.
|
williamr@2
|
568 |
The MTmTextDrawExt interface UID is KTmTextDrawExtId. The interface implementation can be queried
|
williamr@2
|
569 |
through a MTmSource::GetExtendedInterface() call.
|
williamr@2
|
570 |
@internalComponent
|
williamr@2
|
571 |
*/
|
williamr@2
|
572 |
class MTmTextDrawExt
|
williamr@2
|
573 |
{
|
williamr@2
|
574 |
public:
|
williamr@2
|
575 |
virtual void DrawLine(CGraphicsContext& aGc, const TPoint& aPt1, const TPoint& aPt2) const = 0;
|
williamr@2
|
576 |
virtual void DrawText(CGraphicsContext& aGc, const TDesC& aText, const TPoint& aPt) const = 0;
|
williamr@2
|
577 |
virtual void DrawRect(CGraphicsContext& aGc, const TRect& aRc) const = 0;
|
williamr@2
|
578 |
};
|
williamr@2
|
579 |
|
williamr@2
|
580 |
/**
|
williamr@2
|
581 |
@internalComponent
|
williamr@2
|
582 |
*/
|
williamr@2
|
583 |
const TUid KFormLabelApiExtensionUid = { 0x101FD03C};
|
williamr@2
|
584 |
|
williamr@2
|
585 |
/**
|
williamr@2
|
586 |
MTmSource is an interface class that must be implemented by users of
|
williamr@2
|
587 |
CTmTextLayout to provide text content and attributes. MTmSource is derived from
|
williamr@2
|
588 |
MTmCustom, which contains the functions to customise the layout and display, so
|
williamr@2
|
589 |
that this can be done in CTmText without affecting the content.
|
williamr@2
|
590 |
@internalComponent
|
williamr@2
|
591 |
*/
|
williamr@2
|
592 |
class MTmSource: public MTmCustom
|
williamr@2
|
593 |
|
williamr@2
|
594 |
{
|
williamr@2
|
595 |
public:
|
williamr@2
|
596 |
/** Label type used in LabelModeSelect */
|
williamr@2
|
597 |
enum TLabelType
|
williamr@2
|
598 |
{
|
williamr@2
|
599 |
/** Not a label; used for TLabelTypes not yet assigned. */
|
williamr@2
|
600 |
ENoLabel,
|
williamr@2
|
601 |
|
williamr@2
|
602 |
/** Paragraph label of the type supported by FORM. */
|
williamr@2
|
603 |
EParLabel
|
williamr@2
|
604 |
};
|
williamr@2
|
605 |
|
williamr@2
|
606 |
enum
|
williamr@2
|
607 |
{
|
williamr@2
|
608 |
/**
|
williamr@2
|
609 |
The maximum number of characters supplied to GetLineBreak, after aMaxBreakPos,
|
williamr@2
|
610 |
and after trailing whitespace, to provide context for line breaking decisions.
|
williamr@2
|
611 |
*/
|
williamr@2
|
612 |
ELineBreakContext = 32
|
williamr@2
|
613 |
};
|
williamr@2
|
614 |
|
williamr@2
|
615 |
// pure virtuals
|
williamr@2
|
616 |
|
williamr@2
|
617 |
/** Return the device used to format the text. */
|
williamr@2
|
618 |
virtual MGraphicsDeviceMap& FormatDevice() const = 0;
|
williamr@2
|
619 |
|
williamr@2
|
620 |
/**
|
williamr@2
|
621 |
Return the device used to draw the text and when converting between x-y coordinates and document positions.
|
williamr@2
|
622 |
If the formatting and interpreting devices are different, text is scaled appropriately when it is drawn;
|
williamr@2
|
623 |
this allows text to be formatted for printer fonts and displayed on the screen, giving a wysiwyg print preview.
|
williamr@2
|
624 |
*/
|
williamr@2
|
625 |
virtual MGraphicsDeviceMap& InterpretDevice() const = 0;
|
williamr@2
|
626 |
|
williamr@2
|
627 |
/** Return the length of the document in characters. */
|
williamr@2
|
628 |
virtual TInt DocumentLength() const = 0;
|
williamr@2
|
629 |
|
williamr@2
|
630 |
/**
|
williamr@2
|
631 |
Return at least one character of text, but preferably as many as possible, starting at aPos. Put its character
|
williamr@2
|
632 |
format in aFormat. The text must be a run of characters sharing the same character format.
|
williamr@2
|
633 |
*/
|
williamr@2
|
634 |
virtual void GetText(TInt aPos,TPtrC& aText,TTmCharFormat& aFormat) const = 0;
|
williamr@2
|
635 |
|
williamr@2
|
636 |
/**
|
williamr@2
|
637 |
Return the paragraph format of the paragraph containing aPos. End-of-paragraph characters belong to the preceding
|
williamr@2
|
638 |
paragraph.
|
williamr@2
|
639 |
*/
|
williamr@2
|
640 |
virtual void GetParagraphFormatL(TInt aPos,RTmParFormat& aFormat) const = 0;
|
williamr@2
|
641 |
|
williamr@2
|
642 |
/**
|
williamr@2
|
643 |
Return the document position of the start of the paragraph containing aPos. End-of-paragraph characters belong to
|
williamr@2
|
644 |
the preceding paragraph.
|
williamr@2
|
645 |
*/
|
williamr@2
|
646 |
virtual TInt ParagraphStart(TInt aPos) const = 0;
|
williamr@2
|
647 |
|
williamr@2
|
648 |
// ordinary virtuals
|
williamr@2
|
649 |
IMPORT_C virtual CPicture* PictureL(TInt aPos) const;
|
williamr@2
|
650 |
IMPORT_C virtual TInt GetPictureSizeInTwipsL(TInt aPos,TSize& aSize) const;
|
williamr@2
|
651 |
IMPORT_C virtual TAny* GetExtendedInterface(const TUid& aInterfaceId);
|
williamr@2
|
652 |
IMPORT_C virtual void MTmSource_Reserved_1();
|
williamr@2
|
653 |
IMPORT_C virtual void MTmSource_Reserved_2();
|
williamr@2
|
654 |
IMPORT_C virtual TBool PageBreakInRange(TInt aStartPos,TInt aEndPos) const;
|
williamr@2
|
655 |
|
williamr@2
|
656 |
// non-virtuals
|
williamr@2
|
657 |
IMPORT_C TInt ParagraphEnd(TInt aPos) const;
|
williamr@2
|
658 |
IMPORT_C TBool GetLineBreakL(const TDesC& aText,TInt aDocPos,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards,
|
williamr@2
|
659 |
TInt& aBreakPos,TInt& aHangingChars,TInt& aBreakPosAfterSpaces) const;
|
williamr@2
|
660 |
IMPORT_C static void GetStandardLineBreak(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos,
|
williamr@2
|
661 |
TInt& aBreakPos,TInt& aNextLineStart);
|
williamr@2
|
662 |
};
|
williamr@2
|
663 |
|
williamr@2
|
664 |
/**
|
williamr@2
|
665 |
Class used to provide label functionality within Form
|
williamr@2
|
666 |
as an extended interface (via the GetExtendedInterface mechanism
|
williamr@2
|
667 |
supplied in MTmSource). This class is entirely internal to Form.
|
williamr@2
|
668 |
@internalComponent
|
williamr@2
|
669 |
@see MTmSource::GetExtendedInterface
|
williamr@2
|
670 |
@since Sirocco
|
williamr@2
|
671 |
*/
|
williamr@2
|
672 |
class MFormLabelApi
|
williamr@2
|
673 |
{
|
williamr@2
|
674 |
public:
|
williamr@2
|
675 |
IMPORT_C virtual TBool LabelModeSelect(MTmSource::TLabelType aType, TInt aPos);
|
williamr@2
|
676 |
IMPORT_C virtual void LabelModeCancel();
|
williamr@2
|
677 |
IMPORT_C virtual void LabelMetrics(MTmSource::TLabelType aType, TSize& aLabelSize, TInt& aMarginSize) const;
|
williamr@2
|
678 |
};
|
williamr@2
|
679 |
|
williamr@2
|
680 |
/**
|
williamr@2
|
681 |
@internalTechnology
|
williamr@2
|
682 |
*/
|
williamr@2
|
683 |
class CTmBufSeg: public CBufSeg
|
williamr@2
|
684 |
{
|
williamr@2
|
685 |
public:
|
williamr@2
|
686 |
inline CTmBufSeg(TInt aExpandSize);
|
williamr@2
|
687 |
TInt MemoryUsed() const;
|
williamr@2
|
688 |
};
|
williamr@2
|
689 |
|
williamr@2
|
690 |
/** @internalTechnology */
|
williamr@2
|
691 |
class CTmCode: public CBase
|
williamr@2
|
692 |
{
|
williamr@2
|
693 |
public:
|
williamr@2
|
694 |
inline ~CTmCode();
|
williamr@2
|
695 |
void InsertByteL(TUint8 aByte,TInt aPos);
|
williamr@2
|
696 |
TInt InsertNumberL(TInt aNumber,TInt aPos);
|
williamr@2
|
697 |
TInt InsertRectL(const TRect& aRect,TInt aPos);
|
williamr@2
|
698 |
void AppendByteL(TUint8 aByte);
|
williamr@2
|
699 |
TInt AppendNumberL(TInt aNumber);
|
williamr@2
|
700 |
TInt AppendRectL(const TRect& aRect);
|
williamr@2
|
701 |
void ChangeL(TInt aStart,TInt aEnd,CTmCode& aNewCode);
|
williamr@2
|
702 |
TInt MemoryUsed() const;
|
williamr@2
|
703 |
TInt Size() const;
|
williamr@2
|
704 |
void Delete(TInt aPos,TInt aLength);
|
williamr@2
|
705 |
void Reset();
|
williamr@2
|
706 |
inline TPtr8 Ptr(TInt aPos);
|
williamr@2
|
707 |
void CreateBufferL();
|
williamr@2
|
708 |
inline CBufBase* Buffer();
|
williamr@2
|
709 |
inline const CBufBase* Buffer() const;
|
williamr@2
|
710 |
|
williamr@2
|
711 |
private:
|
williamr@2
|
712 |
enum
|
williamr@2
|
713 |
{
|
williamr@2
|
714 |
EExpandSize = 512
|
williamr@2
|
715 |
};
|
williamr@2
|
716 |
TInt WriteNumber(TInt aNumber,TUint8* aBuffer);
|
williamr@2
|
717 |
|
williamr@2
|
718 |
CTmBufSeg* iBuffer;
|
williamr@2
|
719 |
};
|
williamr@2
|
720 |
|
williamr@2
|
721 |
/**
|
williamr@2
|
722 |
Formatting parameters used when formatting part of a layout object.
|
williamr@2
|
723 |
@internalComponent
|
williamr@2
|
724 |
*/
|
williamr@2
|
725 |
class TTmFormatParamBase
|
williamr@2
|
726 |
|
williamr@2
|
727 |
{
|
williamr@2
|
728 |
public:
|
williamr@2
|
729 |
enum
|
williamr@2
|
730 |
{
|
williamr@2
|
731 |
EWrap = 1, // wrap the text at iWrapWidth
|
williamr@2
|
732 |
EAtLeastMaxHeight = 2, // stop adding text only when iMaxHeight has been reached or exceeded
|
williamr@2
|
733 |
ETruncateWithEllipsis = 4, // truncate any text that sticks out; see iEllipsis below
|
williamr@2
|
734 |
ELegalLineBreaksOnly = 8 // break only at allowed line breaks, even if that
|
williamr@2
|
735 |
// results in the text not fitting the measure
|
williamr@2
|
736 |
};
|
williamr@2
|
737 |
|
williamr@2
|
738 |
IMPORT_C TTmFormatParamBase();
|
williamr@2
|
739 |
inline TBool IsWrapping() const;
|
williamr@2
|
740 |
inline TBool IsTruncatingWithEllipsis() const;
|
williamr@2
|
741 |
inline TBool LegalLineBreaksOnly() const;
|
williamr@2
|
742 |
|
williamr@2
|
743 |
TInt iWrapWidth; // wrapping width of the text including margins and indents, if wrapping is on
|
williamr@2
|
744 |
TInt iMaxHeight; // maximum height of the text
|
williamr@2
|
745 |
TInt iMaxLines; // maximum number of lines to be formatted
|
williamr@2
|
746 |
TInt iFlags; // flags defined above
|
williamr@2
|
747 |
TChar iEllipsis; // if truncating and not 0xFFFF, insert this ellipsis char (defaults to '...').
|
williamr@2
|
748 |
|
williamr@2
|
749 |
};
|
williamr@2
|
750 |
|
williamr@2
|
751 |
/**
|
williamr@2
|
752 |
Formatting parameters used when formatting an entire layout object or
|
williamr@2
|
753 |
creating a section of format code.
|
williamr@2
|
754 |
@internalComponent
|
williamr@2
|
755 |
*/
|
williamr@2
|
756 |
class TTmFormatParam: public TTmFormatParamBase
|
williamr@2
|
757 |
|
williamr@2
|
758 |
{
|
williamr@2
|
759 |
public:
|
williamr@2
|
760 |
IMPORT_C TTmFormatParam();
|
williamr@2
|
761 |
IMPORT_C TTmFormatParam(const TTmFormatParamBase& aBase);
|
williamr@2
|
762 |
|
williamr@2
|
763 |
TInt iStartChar; // first character position to be formatted
|
williamr@2
|
764 |
TInt iEndChar; // last character position to be formatted
|
williamr@2
|
765 |
TInt iLineInPar; // starting line number in the paragraph
|
williamr@2
|
766 |
};
|
williamr@2
|
767 |
|
williamr@2
|
768 |
/**
|
williamr@2
|
769 |
Additional parameters used when reformatting.
|
williamr@2
|
770 |
@internalComponent
|
williamr@2
|
771 |
*/
|
williamr@2
|
772 |
class TTmReformatParam
|
williamr@2
|
773 |
|
williamr@2
|
774 |
{
|
williamr@2
|
775 |
public:
|
williamr@2
|
776 |
IMPORT_C TTmReformatParam();
|
williamr@2
|
777 |
|
williamr@2
|
778 |
TInt iStartChar; // start of changed text
|
williamr@2
|
779 |
TInt iOldLength; // length of text before the change
|
williamr@2
|
780 |
TInt iNewLength; // length of text after the change
|
williamr@2
|
781 |
TInt iMaxExtraLines; // maximum lines in the partial paragraph after the end of the changed text
|
williamr@2
|
782 |
// to format in one go; the remainder can be handled by background formatting
|
williamr@2
|
783 |
TBool iParFormatChanged; // TRUE if the paragraph format of the changed text has changed
|
williamr@2
|
784 |
TBool iParInvalid; // format to the end of the paragraph
|
williamr@2
|
785 |
};
|
williamr@2
|
786 |
|
williamr@2
|
787 |
/**
|
williamr@2
|
788 |
Information returned when reformatting.
|
williamr@2
|
789 |
@internalComponent
|
williamr@2
|
790 |
*/
|
williamr@2
|
791 |
class TTmReformatResult
|
williamr@2
|
792 |
|
williamr@2
|
793 |
{
|
williamr@2
|
794 |
public:
|
williamr@2
|
795 |
IMPORT_C TTmReformatResult();
|
williamr@2
|
796 |
|
williamr@2
|
797 |
TRect iRedrawRect; // rectangle to be redrawn
|
williamr@2
|
798 |
TInt iHeightChange; // change in height of the reformatted text
|
williamr@2
|
799 |
TInt iUnchangedTop; // y coordinate, before formatting, of the top of text needing no change,
|
williamr@2
|
800 |
// including text in any section not yet formatted by this call
|
williamr@2
|
801 |
TInt iUnformattedStart; // start of any unformatted section; KMaxTInt if none
|
williamr@2
|
802 |
};
|
williamr@2
|
803 |
|
williamr@2
|
804 |
/**
|
williamr@2
|
805 |
A structure for returning information about a line. One of these is
|
williamr@2
|
806 |
returned by all hit-detection functions. Typically, after finding the position
|
williamr@2
|
807 |
in the document that corresponds to given x-y coordinates, you will want some
|
williamr@2
|
808 |
more information like the line's bounding rectangle. When you call, for
|
williamr@2
|
809 |
example, CTmTextLayout::FindXyPos you will receive a TTmLineInfo object that
|
williamr@2
|
810 |
will tell you this, and much more.
|
williamr@2
|
811 |
@publishedAll
|
williamr@2
|
812 |
@released
|
williamr@2
|
813 |
*/
|
williamr@2
|
814 |
class TTmLineInfo
|
williamr@2
|
815 |
|
williamr@2
|
816 |
{
|
williamr@2
|
817 |
public:
|
williamr@2
|
818 |
// bit values for iFlags
|
williamr@2
|
819 |
enum
|
williamr@2
|
820 |
{
|
williamr@2
|
821 |
EParStart = 1,
|
williamr@2
|
822 |
EParEnd = 2,
|
williamr@2
|
823 |
EParRightToLeft = 4,
|
williamr@2
|
824 |
ELineEndsInForcedLineBreak = 8,
|
williamr@2
|
825 |
EPictureButtsLowerEdge = 16, /**< @deprecated - no effect, present for compatibility only */
|
williamr@2
|
826 |
EPictureButtsUpperEdge = 32 /**< @deprecated - no effect, present for compatibility only */
|
williamr@2
|
827 |
};
|
williamr@2
|
828 |
|
williamr@2
|
829 |
inline TTmLineInfo();
|
williamr@2
|
830 |
|
williamr@2
|
831 |
/** Outer enclosing rectangle including margins */
|
williamr@2
|
832 |
TRect iOuterRect;
|
williamr@2
|
833 |
|
williamr@2
|
834 |
/** Inner enclosing rectangle: the text only */
|
williamr@2
|
835 |
TRect iInnerRect;
|
williamr@2
|
836 |
|
williamr@2
|
837 |
/** y coordinate of the baseline */
|
williamr@2
|
838 |
TInt iBaseline;
|
williamr@2
|
839 |
|
williamr@2
|
840 |
/** Start document position */
|
williamr@2
|
841 |
TInt iStart;
|
williamr@2
|
842 |
|
williamr@2
|
843 |
/** End document position */
|
williamr@2
|
844 |
TInt iEnd;
|
williamr@2
|
845 |
|
williamr@2
|
846 |
/** Line number */
|
williamr@2
|
847 |
TInt iLineNumber;
|
williamr@2
|
848 |
|
williamr@2
|
849 |
/** Paragraph number */
|
williamr@2
|
850 |
TInt iParNumber;
|
williamr@2
|
851 |
|
williamr@2
|
852 |
/** Line number in the paragraph */
|
williamr@2
|
853 |
TInt iLineInPar;
|
williamr@2
|
854 |
|
williamr@2
|
855 |
/** y coordinate of the top of the paragraph */
|
williamr@2
|
856 |
TInt iParTop;
|
williamr@2
|
857 |
|
williamr@2
|
858 |
/** Start of paragraph, end of paragraph, etc. */
|
williamr@2
|
859 |
TUint iFlags;
|
williamr@2
|
860 |
};
|
williamr@2
|
861 |
|
williamr@2
|
862 |
/**
|
williamr@2
|
863 |
A structure to hold a logical document position that can be converted to a raw
|
williamr@2
|
864 |
document position or an x-y position.
|
williamr@2
|
865 |
|
williamr@2
|
866 |
A document position can specify a leading or trailing edge or a text
|
williamr@2
|
867 |
directionality so that bidirectional hit testing can use both these
|
williamr@2
|
868 |
distinctions.
|
williamr@2
|
869 |
|
williamr@2
|
870 |
The leading edge at position N is the position before character N in logical
|
williamr@2
|
871 |
order, and the trailing edge is the position after character in logical order.
|
williamr@2
|
872 |
|
williamr@2
|
873 |
Specification by directionality works differently. Character N in left-to-right
|
williamr@2
|
874 |
text is preceded by position N (left-to-right) and followed by position N+1
|
williamr@2
|
875 |
(left-to-right). Character N in right-to-left text is preceded (in display
|
williamr@2
|
876 |
order) by position N+1 (right-to-left) and followed by position N
|
williamr@2
|
877 |
(right-to-left).
|
williamr@2
|
878 |
@publishedAll
|
williamr@2
|
879 |
@released
|
williamr@2
|
880 |
*/
|
williamr@2
|
881 |
class TTmDocPosSpec
|
williamr@2
|
882 |
|
williamr@2
|
883 |
{
|
williamr@2
|
884 |
public:
|
williamr@2
|
885 |
/**
|
williamr@2
|
886 |
The cursor type.
|
williamr@2
|
887 |
*/
|
williamr@2
|
888 |
enum TType
|
williamr@2
|
889 |
{
|
williamr@2
|
890 |
/** trailing edge */
|
williamr@2
|
891 |
ETrailing,
|
williamr@2
|
892 |
|
williamr@2
|
893 |
/** leading edge */
|
williamr@2
|
894 |
ELeading,
|
williamr@2
|
895 |
|
williamr@2
|
896 |
/** left-to-right */
|
williamr@2
|
897 |
ELeftToRight,
|
williamr@2
|
898 |
|
williamr@2
|
899 |
/** right-to-left */
|
williamr@2
|
900 |
ERightToLeft
|
williamr@2
|
901 |
};
|
williamr@2
|
902 |
|
williamr@2
|
903 |
inline TTmDocPosSpec();
|
williamr@2
|
904 |
inline TTmDocPosSpec(TInt aPos,TType aType);
|
williamr@2
|
905 |
inline TTmDocPosSpec(const TTmDocPos& aRawDocPos);
|
williamr@2
|
906 |
|
williamr@2
|
907 |
/** the edge position in the document; 0 ... document length */
|
williamr@2
|
908 |
TInt iPos;
|
williamr@2
|
909 |
/** the type as specified above */
|
williamr@2
|
910 |
TType iType;
|
williamr@2
|
911 |
};
|
williamr@2
|
912 |
|
williamr@2
|
913 |
/**
|
williamr@2
|
914 |
A structure for holding a raw document position that can be converted to or
|
williamr@2
|
915 |
from an x-y position and compared ordinally, which cannot be done with the more
|
williamr@2
|
916 |
abstract TTmDocPosSpec class. Leading edges are distinguished from trailing
|
williamr@2
|
917 |
edges so that bidirectional hit testing and cursor positioning can distinguish
|
williamr@2
|
918 |
between 'after character N', and 'before character N + 1', which may be some
|
williamr@2
|
919 |
distance apart if N and N + 1 are in runs of opposite directionality.
|
williamr@2
|
920 |
@publishedAll
|
williamr@2
|
921 |
@released
|
williamr@2
|
922 |
*/
|
williamr@2
|
923 |
class TTmDocPos
|
williamr@2
|
924 |
|
williamr@2
|
925 |
{
|
williamr@2
|
926 |
public:
|
williamr@2
|
927 |
inline TTmDocPos();
|
williamr@2
|
928 |
inline TTmDocPos(TInt aPos,TBool aLeadingEdge);
|
williamr@2
|
929 |
IMPORT_C TBool operator==(const TTmDocPos& aPos) const;
|
williamr@2
|
930 |
inline TBool operator!=(const TTmDocPos& aPos) const;
|
williamr@2
|
931 |
IMPORT_C TBool operator>(const TTmDocPos& aPos) const;
|
williamr@2
|
932 |
IMPORT_C TBool operator>=(const TTmDocPos& aPos) const;
|
williamr@2
|
933 |
inline TBool operator<(const TTmDocPos& aPos) const;
|
williamr@2
|
934 |
inline TBool operator<=(const TTmDocPos& aPos) const;
|
williamr@2
|
935 |
|
williamr@2
|
936 |
/** the edge position in the document; 0 ... document length */
|
williamr@2
|
937 |
TInt iPos;
|
williamr@2
|
938 |
/** true if the position is a leading edge */
|
williamr@2
|
939 |
TBool iLeadingEdge;
|
williamr@2
|
940 |
};
|
williamr@2
|
941 |
|
williamr@2
|
942 |
/**
|
williamr@2
|
943 |
Holds information about a position in a document.
|
williamr@2
|
944 |
@publishedAll
|
williamr@2
|
945 |
@released
|
williamr@2
|
946 |
*/
|
williamr@2
|
947 |
class TTmPosInfo2
|
williamr@2
|
948 |
|
williamr@2
|
949 |
{
|
williamr@2
|
950 |
public:
|
williamr@2
|
951 |
/** Document position. */
|
williamr@2
|
952 |
TTmDocPos iDocPos;
|
williamr@2
|
953 |
/** True if the position is attatched to text flowing right-to-left. */
|
williamr@2
|
954 |
TBool iRightToLeft;
|
williamr@2
|
955 |
/** Intersection of the character edge with the baseline. */
|
williamr@2
|
956 |
TPoint iEdge;
|
williamr@2
|
957 |
};
|
williamr@2
|
958 |
|
williamr@2
|
959 |
/**
|
williamr@2
|
960 |
A structure for returning information about a position in a line.
|
williamr@2
|
961 |
@deprecated 7.0s
|
williamr@2
|
962 |
@internalComponent
|
williamr@2
|
963 |
*/
|
williamr@2
|
964 |
class TTmPosInfo
|
williamr@2
|
965 |
|
williamr@2
|
966 |
{
|
williamr@2
|
967 |
public:
|
williamr@2
|
968 |
TTmPosInfo() {}
|
williamr@2
|
969 |
TTmPosInfo(const TTmPosInfo2& a) : iDocPos(a.iDocPos), iEdge(a.iEdge) {}
|
williamr@2
|
970 |
TTmDocPos iDocPos; // the document position
|
williamr@2
|
971 |
TPoint iEdge; // intersection of the character edge at iDocPos with the baseline
|
williamr@2
|
972 |
};
|
williamr@2
|
973 |
|
williamr@2
|
974 |
/**
|
williamr@2
|
975 |
@internalComponent
|
williamr@2
|
976 |
*/
|
williamr@2
|
977 |
class TTmHighlightExtensions
|
williamr@2
|
978 |
|
williamr@2
|
979 |
{
|
williamr@2
|
980 |
public:
|
williamr@2
|
981 |
inline TTmHighlightExtensions();
|
williamr@2
|
982 |
inline void SetAll(TInt aExtension);
|
williamr@2
|
983 |
inline void SetLeftExtension(TInt aExtension);
|
williamr@2
|
984 |
inline void SetRightExtension(TInt aExtension);
|
williamr@2
|
985 |
inline void SetTopExtension(TInt aExtension);
|
williamr@2
|
986 |
inline void SetBottomExtension(TInt aExtension);
|
williamr@2
|
987 |
inline TInt LeftExtension() const;
|
williamr@2
|
988 |
inline TInt RightExtension() const;
|
williamr@2
|
989 |
inline TInt TopExtension() const;
|
williamr@2
|
990 |
inline TInt BottomExtension() const;
|
williamr@2
|
991 |
inline TBool Extends() const;
|
williamr@2
|
992 |
inline TBool Shrinks() const;
|
williamr@2
|
993 |
inline void ExtendRect(TRect& aRect) const;
|
williamr@2
|
994 |
inline void AdjustRect(TRect& aRect) const;
|
williamr@2
|
995 |
inline TBool IsNull() const;
|
williamr@2
|
996 |
inline void AbsExtendRect(TRect& aRect) const;
|
williamr@2
|
997 |
public:
|
williamr@2
|
998 |
TInt iLeftExtension;
|
williamr@2
|
999 |
TInt iRightExtension;
|
williamr@2
|
1000 |
TInt iTopExtension;
|
williamr@2
|
1001 |
TInt iBottomExtension;
|
williamr@2
|
1002 |
};
|
williamr@2
|
1003 |
|
williamr@2
|
1004 |
/**
|
williamr@2
|
1005 |
Cursor placement. Used as an argument to CTextView::SetCursorPlacement().
|
williamr@2
|
1006 |
@see CTextView::SetCursorPlacement()
|
williamr@2
|
1007 |
@publishedAll
|
williamr@2
|
1008 |
*/
|
williamr@2
|
1009 |
enum TTmCursorPlacement
|
williamr@2
|
1010 |
{
|
williamr@2
|
1011 |
/** The text cursor is a vertical line at the insertion position, with its height
|
williamr@2
|
1012 |
and depth based on the metrics of the previous character in the paragraph
|
williamr@2
|
1013 |
or if none, the next character. */
|
williamr@2
|
1014 |
ECursorVertical,
|
williamr@2
|
1015 |
/** The text cursor is an underline below the character logically after the insertion
|
williamr@2
|
1016 |
position. */
|
williamr@2
|
1017 |
ECursorUnderlineNext,
|
williamr@2
|
1018 |
/** The text cursor is an underline below the character logically before the insertion
|
williamr@2
|
1019 |
position. */
|
williamr@2
|
1020 |
ECursorUnderlinePrev
|
williamr@2
|
1021 |
};
|
williamr@2
|
1022 |
|
williamr@2
|
1023 |
/**
|
williamr@2
|
1024 |
The text layout for a single rectangular piece of text. The object does not own its text or format attributes but
|
williamr@2
|
1025 |
gets them from an interface class called MTmSource.
|
williamr@2
|
1026 |
|
williamr@2
|
1027 |
There are functions for setting the text, drawing it, and converting between x-y coordinates and document positions.
|
williamr@2
|
1028 |
|
williamr@2
|
1029 |
Ranges
|
williamr@2
|
1030 |
|
williamr@2
|
1031 |
All ranges of character positions and pixels include the start but not the end. This means that if a line is described
|
williamr@2
|
1032 |
by a TTmLineInfo object as starting at document position 345 and ending at 389, character positions 345 to 388 are in
|
williamr@2
|
1033 |
the line; 389 is in the next line if any.
|
williamr@2
|
1034 |
|
williamr@2
|
1035 |
Coordinates and units
|
williamr@2
|
1036 |
|
williamr@2
|
1037 |
All coordinates used in TAGMA classes and function arguments are in pixels and are relative to the origin of the object,
|
williamr@2
|
1038 |
which is the top left corner of the ordinary text, not including paragraph labels. Vertical coordinates increase from
|
williamr@2
|
1039 |
top to bottom.
|
williamr@2
|
1040 |
|
williamr@2
|
1041 |
Document format and positions
|
williamr@2
|
1042 |
|
williamr@2
|
1043 |
A TAGMA document, as supplied by the MTmSource interface, has a length as returned by MTmSource::DocumentLength of
|
williamr@2
|
1044 |
zero or more characters. It consists of Unicode text split into paragraphs by standard Unicode paragraph delimiters
|
williamr@2
|
1045 |
(character value 0x2029), so the number of paragraphs in the entire document is one more than the number of
|
williamr@2
|
1046 |
paragraph delimiters. A document position is a value in the range 0 to one more than the document length.
|
williamr@2
|
1047 |
Lines contain all document positions from their start to one less than their end position. These conventions allow
|
williamr@2
|
1048 |
all lines to end in a delimiter; the last line contains an imaginary paragraph end, which need not be supplied by
|
williamr@2
|
1049 |
the MTmSource interface, at a position equal to the document length. A CTmTextLayout object formatted for an
|
williamr@2
|
1050 |
empty document will thus have a start position (returned by StartChar) of 0 and an end position
|
williamr@2
|
1051 |
(returned by EndChar) of 1.
|
williamr@2
|
1052 |
@internalComponent
|
williamr@2
|
1053 |
*/
|
williamr@2
|
1054 |
class CTmTextLayout: public CBase
|
williamr@2
|
1055 |
|
williamr@2
|
1056 |
{
|
williamr@2
|
1057 |
public:
|
williamr@2
|
1058 |
|
williamr@2
|
1059 |
class TTmChunkDescription
|
williamr@2
|
1060 |
/**
|
williamr@2
|
1061 |
Output from FindAdjacentChunks. Describes a chunk of text that is of a
|
williamr@2
|
1062 |
constant format and directionality.
|
williamr@2
|
1063 |
@internalComponent
|
williamr@2
|
1064 |
*/
|
williamr@2
|
1065 |
{
|
williamr@2
|
1066 |
public:
|
williamr@2
|
1067 |
/** Position of the first character in the chunk. A negative number
|
williamr@2
|
1068 |
indicates "no such chunk". */
|
williamr@2
|
1069 |
TInt iStart;
|
williamr@2
|
1070 |
/** One past the position of the last character in the chunk. */
|
williamr@2
|
1071 |
TInt iEnd;
|
williamr@2
|
1072 |
/** ETrue if the chunk is displayed right-to-left. */
|
williamr@2
|
1073 |
TBool iRightToLeft;
|
williamr@2
|
1074 |
};
|
williamr@2
|
1075 |
|
williamr@2
|
1076 |
IMPORT_C CTmTextLayout();
|
williamr@2
|
1077 |
IMPORT_C ~CTmTextLayout();
|
williamr@2
|
1078 |
IMPORT_C void SetTextL(MTmSource& aSource,const TTmFormatParam& aParam);
|
williamr@2
|
1079 |
IMPORT_C void FormatL(const TTmFormatParamBase& aParam,const TTmReformatParam& aReformatParam,
|
williamr@2
|
1080 |
TTmReformatResult& TTmReformatResult);
|
williamr@2
|
1081 |
IMPORT_C TBool AddParL(const TTmFormatParamBase& aParam,TBool aAtStart,TInt& aHeightIncrease,TInt& aParagraphsIncrease);
|
williamr@2
|
1082 |
IMPORT_C TBool DeletePar(const TTmFormatParamBase& aParam,TBool aAtStart,TInt aMaxDeletedHeight,TInt& aHeightDecrease);
|
williamr@2
|
1083 |
IMPORT_C void Clear();
|
williamr@2
|
1084 |
IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
1085 |
const TLogicalRgb* aDocBackground,TBool aDrawParBackground) const;
|
williamr@2
|
1086 |
IMPORT_C void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
1087 |
const TLogicalRgb& aBackground) const;
|
williamr@2
|
1088 |
IMPORT_C void InvertLayout(CGraphicsContext& aGc, const TPoint& aTopLeft,
|
williamr@2
|
1089 |
TInt aStartDocPos, TInt aEndDocPos) const;
|
williamr@2
|
1090 |
IMPORT_C void HighlightSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
|
williamr@2
|
1091 |
TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect) const;
|
williamr@2
|
1092 |
IMPORT_C void DrawSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
|
williamr@2
|
1093 |
TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect) const;
|
williamr@2
|
1094 |
IMPORT_C void HighlightSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
|
williamr@2
|
1095 |
TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect, const TTmHighlightExtensions& aHighlightExtensions,
|
williamr@2
|
1096 |
TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const;
|
williamr@2
|
1097 |
IMPORT_C void InvertLayout(CGraphicsContext& aGc,
|
williamr@2
|
1098 |
const TPoint& aTopLeft, TInt aStartDocPos,TInt aEndDocPos, const TTmHighlightExtensions& aHighlightExtensions,
|
williamr@2
|
1099 |
TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const;
|
williamr@2
|
1100 |
IMPORT_C void DrawSection(CGraphicsContext& aGc, const TPoint& aTopLeft,
|
williamr@2
|
1101 |
TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect, const TTmHighlightExtensions& aHighlightExtensions,
|
williamr@2
|
1102 |
TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const;
|
williamr@2
|
1103 |
IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1104 |
IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1105 |
IMPORT_C TBool FindXyPosWithDisambiguation(const TPoint& aXyPos,
|
williamr@2
|
1106 |
TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight,
|
williamr@2
|
1107 |
TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1108 |
IMPORT_C TInt FindNextPos(TInt aStart) const;
|
williamr@2
|
1109 |
IMPORT_C TInt FindPreviousPos(TInt aStart) const;
|
williamr@2
|
1110 |
IMPORT_C TInt Lines() const;
|
williamr@2
|
1111 |
IMPORT_C TInt Paragraphs() const;
|
williamr@2
|
1112 |
IMPORT_C TBool DocPosToLine(const TTmDocPosSpec& aDocPos,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1113 |
IMPORT_C TBool LineNumberToLine(TInt aLineNumber,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1114 |
IMPORT_C TBool ParNumberToLine(TInt aParNumber,TInt aLineInPar,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1115 |
IMPORT_C TBool YPosToLine(TInt aYPos,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1116 |
IMPORT_C TBool GetDisplayedTextL(TInt aLineNumber,TDes& aText,TInt& aNeeded) const;
|
williamr@2
|
1117 |
IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TSize& aSize) const;
|
williamr@2
|
1118 |
IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize) const;
|
williamr@2
|
1119 |
IMPORT_C TInt WidthOfWidestLine(TInt aTop = 0,TInt aBottom = KMaxTInt) const;
|
williamr@2
|
1120 |
IMPORT_C void HorizontalExtremes(TInt &aLeft, TInt &aRight,
|
williamr@2
|
1121 |
TInt aTopY = 0, TInt aBottomY = KMaxTInt) const;
|
williamr@2
|
1122 |
IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aInfo,TBool aToLeft) const;
|
williamr@2
|
1123 |
IMPORT_C TBool GetNextPosLeftWithDisambiguation(const TTmDocPosSpec& aDocPos,
|
williamr@2
|
1124 |
TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
|
williamr@2
|
1125 |
IMPORT_C TBool GetNextPosRightWithDisambiguation(const TTmDocPosSpec& aDocPos,
|
williamr@2
|
1126 |
TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
|
williamr@2
|
1127 |
IMPORT_C TBool LineExtreme(const TTmDocPosSpec& aPos, TBool aToRight,
|
williamr@2
|
1128 |
TTmDocPos& aExtreme) const;
|
williamr@2
|
1129 |
IMPORT_C TBool FindAdjacentChunks(const TTmDocPosSpec& aPos,
|
williamr@2
|
1130 |
TTmChunkDescription& aLeft, TTmChunkDescription& aRight) const;
|
williamr@2
|
1131 |
IMPORT_C TBool GetCursor(const TTmDocPosSpec& aDocPos,TTmCursorPlacement aPlacement,
|
williamr@2
|
1132 |
TTmLineInfo& aLineInfo,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
|
williamr@2
|
1133 |
IMPORT_C TInt MemoryUsed() const;
|
williamr@2
|
1134 |
inline TInt StartChar() const;
|
williamr@2
|
1135 |
inline TInt EndChar() const;
|
williamr@2
|
1136 |
inline TInt LayoutWidth() const;
|
williamr@2
|
1137 |
inline TInt LayoutHeight() const;
|
williamr@2
|
1138 |
inline MTmSource* Source();
|
williamr@2
|
1139 |
inline const MTmSource* Source() const;
|
williamr@2
|
1140 |
inline const CTmCode& Code() const;
|
williamr@2
|
1141 |
IMPORT_C void MakeVisible(TBool aVisible);
|
williamr@2
|
1142 |
TInt GetDrawingInterpFlags() const;
|
williamr@2
|
1143 |
IMPORT_C void DeleteFormattingFromEndL(
|
williamr@2
|
1144 |
const TTmFormatParamBase& aParam, TInt aMaxDeletedHeight, TInt& aHeightDecrease);
|
williamr@2
|
1145 |
IMPORT_C void ExtendFormattingDownwardsL(TTmFormatParam& aParam);
|
williamr@2
|
1146 |
|
williamr@2
|
1147 |
// deprecated functions
|
williamr@2
|
1148 |
// deprecated 7.0
|
williamr@2
|
1149 |
IMPORT_C TBool GetDisplayedText(TInt aLineNumber,TDes& aText,TInt& aNeeded) const;
|
williamr@2
|
1150 |
// deprecated 7.0s
|
williamr@2
|
1151 |
IMPORT_C TBool FindDocPos(const TTmDocPos& aDocPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1152 |
// deprecated 7.0s
|
williamr@2
|
1153 |
IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1154 |
// deprecated 7.0s
|
williamr@2
|
1155 |
IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPos& aDocPos,TTmPosInfo& aInfo,TBool aToLeft) const;
|
williamr@2
|
1156 |
// deprecated 7.0s
|
williamr@2
|
1157 |
IMPORT_C TBool DocPosToLine(const TTmDocPos& aDocPos,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1158 |
// deprecated 7.0s
|
williamr@2
|
1159 |
IMPORT_C TBool GetCursor(const TTmDocPos& aDocPos,
|
williamr@2
|
1160 |
TTmCursorPlacement aPlacement, TTmLineInfo& aLineInfo,
|
williamr@2
|
1161 |
TPoint& aOrigin, TInt& aWidth, TInt& aAscent, TInt& aDescent) const;
|
williamr@2
|
1162 |
|
williamr@2
|
1163 |
IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
1164 |
const TLogicalRgb* aDocBackground,TBool aDrawParBackground,
|
williamr@2
|
1165 |
const TCursorSelection* aHighlight,
|
williamr@2
|
1166 |
const TTmHighlightExtensions* aHighlightExtensions) const;
|
williamr@2
|
1167 |
IMPORT_C void GetUpdateBoundingRect(TInt aStartDocPos, TInt aEndDocPos, const TPoint& aTopLeft,
|
williamr@2
|
1168 |
TRect& aBoundingRect) const;
|
williamr@2
|
1169 |
|
williamr@2
|
1170 |
IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo, TInt& aSubscript) const;
|
williamr@2
|
1171 |
private:
|
williamr@2
|
1172 |
TBool LastLine(TTmLineInfo& aLine);
|
williamr@2
|
1173 |
#ifdef _DEBUG
|
williamr@2
|
1174 |
void Invariant() const;
|
williamr@2
|
1175 |
#else
|
williamr@2
|
1176 |
void Invariant() const { }
|
williamr@2
|
1177 |
#endif
|
williamr@2
|
1178 |
void AdjustWidth(const TTmFormatParamBase& aParam,TInt aWidthOfNewText);
|
williamr@2
|
1179 |
|
williamr@2
|
1180 |
MTmSource* iSource; // source of text and text attributes; not owned
|
williamr@2
|
1181 |
CTmCode iCode; // the layout bytecode
|
williamr@2
|
1182 |
TInt iWidth; // width in pixels
|
williamr@2
|
1183 |
TInt iHeight; // height in pixels
|
williamr@2
|
1184 |
TInt iStartChar; // start character position in the document
|
williamr@2
|
1185 |
TInt iEndChar; // end character position in the document
|
williamr@2
|
1186 |
TBidirectionalContext* iBdStateAtEnd; //bidirectional state at end of formatted range
|
williamr@2
|
1187 |
TInt iDrawingInterpFlags; // flags destined for the RTmDrawingInterpreter object
|
williamr@2
|
1188 |
// please try to avoid removing or adding any new members to this class. although it
|
williamr@2
|
1189 |
// is internal, it is included by value in CTextLayout which is published. therefore
|
williamr@2
|
1190 |
// a size change in this class would mean a size change in CTextLayout and a BC break.
|
williamr@2
|
1191 |
// if adding or removing members is unavoidable, please remember to update the dummy
|
williamr@2
|
1192 |
// member in CTextLayout accordingly.
|
williamr@2
|
1193 |
};
|
williamr@2
|
1194 |
|
williamr@2
|
1195 |
/**
|
williamr@2
|
1196 |
A mixin class to make it easy for higher-level classes that own a CTmTextLayout
|
williamr@2
|
1197 |
object to have enquiry functions without it being necessary to implement them
|
williamr@2
|
1198 |
all as forwarding functions. The owner class just implements TextLayout and
|
williamr@2
|
1199 |
overrides GetOrigin if necessary.
|
williamr@2
|
1200 |
|
williamr@2
|
1201 |
Non-const CTmTextLayout functions like Clear are not included because allowing
|
williamr@2
|
1202 |
them to be called on owner classes would probably put the owner class into an
|
williamr@2
|
1203 |
inconsistent state.
|
williamr@2
|
1204 |
|
williamr@2
|
1205 |
The word Layout is prefixed, suffixed or infixed to functions with names that
|
williamr@2
|
1206 |
would usually conflict with owner class names. For example, we have DrawLayout,
|
williamr@2
|
1207 |
not Draw, and GetMinimumLayoutSizeL, not GetMinimumSizeL.
|
williamr@2
|
1208 |
@internalComponent
|
williamr@2
|
1209 |
*/
|
williamr@2
|
1210 |
class MTmTextLayoutForwarder
|
williamr@2
|
1211 |
|
williamr@2
|
1212 |
{
|
williamr@2
|
1213 |
public:
|
williamr@2
|
1214 |
IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
1215 |
const TLogicalRgb* aDocBackground,TBool aDrawParBackground) const;
|
williamr@2
|
1216 |
IMPORT_C void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
1217 |
const TLogicalRgb& aBackground) const;
|
williamr@2
|
1218 |
IMPORT_C void InvertLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,TInt aStartDocPos,TInt aEndDocPos);
|
williamr@2
|
1219 |
IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1220 |
IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1221 |
IMPORT_C TBool FindXyPosWithDisambiguation(const TPoint& aXyPos,
|
williamr@2
|
1222 |
TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight,
|
williamr@2
|
1223 |
TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1224 |
IMPORT_C TBool DocPosToLine(const TTmDocPosSpec& aDocPos,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1225 |
IMPORT_C TBool LineNumberToLine(TInt aLineNumber,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1226 |
IMPORT_C TBool ParNumberToLine(TInt aParNumber,TInt aLineInPar,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1227 |
IMPORT_C TBool YPosToLine(TInt aYPos,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1228 |
IMPORT_C TInt WidthOfWidestLine(TInt aTop = 0,TInt aBottom = KMaxTInt) const;
|
williamr@2
|
1229 |
IMPORT_C void HorizontalExtremes(TInt &aLeft, TInt &aRight,
|
williamr@2
|
1230 |
TInt aTopY = 0, TInt aBottomY = KMaxTInt) const;
|
williamr@2
|
1231 |
IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aInfo,TBool aToLeft) const;
|
williamr@2
|
1232 |
IMPORT_C TBool GetNextPosLeftWithDisambiguation(const TTmDocPosSpec& aDocPos,
|
williamr@2
|
1233 |
TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
|
williamr@2
|
1234 |
IMPORT_C TBool GetNextPosRightWithDisambiguation(const TTmDocPosSpec& aDocPos,
|
williamr@2
|
1235 |
TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const;
|
williamr@2
|
1236 |
IMPORT_C TBool GetCursor(const TTmDocPosSpec& aDocPos,TTmCursorPlacement aPlacement,
|
williamr@2
|
1237 |
TTmLineInfo& aLineInfo,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const;
|
williamr@2
|
1238 |
|
williamr@2
|
1239 |
IMPORT_C TInt Lines() const;
|
williamr@2
|
1240 |
IMPORT_C TInt Paragraphs() const;
|
williamr@2
|
1241 |
IMPORT_C TBool GetDisplayedText(TInt aLineNumber,TDes& aText,TInt& aNeeded) const;
|
williamr@2
|
1242 |
IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TSize& aSize) const;
|
williamr@2
|
1243 |
IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize) const;
|
williamr@2
|
1244 |
IMPORT_C TInt StartChar() const;
|
williamr@2
|
1245 |
IMPORT_C TInt EndChar() const;
|
williamr@2
|
1246 |
IMPORT_C TInt LayoutWidth() const;
|
williamr@2
|
1247 |
IMPORT_C TInt LayoutHeight() const;
|
williamr@2
|
1248 |
|
williamr@2
|
1249 |
// deprecated functions
|
williamr@2
|
1250 |
// deprecated 7.0s
|
williamr@2
|
1251 |
IMPORT_C TBool FindDocPos(const TTmDocPos& aDocPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1252 |
// deprecated 7.0s
|
williamr@2
|
1253 |
IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1254 |
// deprecated 7.0s
|
williamr@2
|
1255 |
IMPORT_C TBool DocPosToLine(const TTmDocPos& aDocPos,TTmLineInfo& aLineInfo) const;
|
williamr@2
|
1256 |
// deprecated 7.0s
|
williamr@2
|
1257 |
IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPos& aDocPos,TTmPosInfo& aInfo,TBool aToLeft) const;
|
williamr@2
|
1258 |
// deprecated 7.0s
|
williamr@2
|
1259 |
IMPORT_C TBool GetCursor(const TTmDocPos& aDocPos,
|
williamr@2
|
1260 |
TTmCursorPlacement aPlacement, TTmLineInfo& aLineInfo,
|
williamr@2
|
1261 |
TPoint& aOrigin, TInt& aWidth, TInt& aAscent, TInt& aDescent) const;
|
williamr@2
|
1262 |
private:
|
williamr@2
|
1263 |
/** Returns a reference to the CTmTextLayoutObject this
|
williamr@2
|
1264 |
MTmTextLayoutForwarder forwards inquiries to. */
|
williamr@2
|
1265 |
virtual const CTmTextLayout& TextLayout() const = 0;
|
williamr@2
|
1266 |
|
williamr@2
|
1267 |
/** The origin is subtracted from coordinates passed in and added to those
|
williamr@2
|
1268 |
passed out. */
|
williamr@2
|
1269 |
IMPORT_C virtual void GetOrigin(TPoint& aPoint) const;
|
williamr@2
|
1270 |
|
williamr@2
|
1271 |
void FixUpLineInfo(TTmLineInfo& aInfo,const TPoint* aOrigin = NULL) const;
|
williamr@2
|
1272 |
};
|
williamr@2
|
1273 |
|
williamr@2
|
1274 |
/**
|
williamr@2
|
1275 |
A character format layer. Unmasked attributes are transparent.
|
williamr@2
|
1276 |
@internalComponent
|
williamr@2
|
1277 |
*/
|
williamr@2
|
1278 |
class TTmCharFormatLayer
|
williamr@2
|
1279 |
|
williamr@2
|
1280 |
{
|
williamr@2
|
1281 |
public:
|
williamr@2
|
1282 |
inline TTmCharFormatLayer();
|
williamr@2
|
1283 |
IMPORT_C TTmCharFormatLayer(const CCharFormatLayer& aFormat);
|
williamr@2
|
1284 |
|
williamr@2
|
1285 |
TTmCharFormat iFormat;
|
williamr@2
|
1286 |
TTmCharFormatMask iMask;
|
williamr@2
|
1287 |
};
|
williamr@2
|
1288 |
|
williamr@2
|
1289 |
/**
|
williamr@2
|
1290 |
A paragraph format layer. Unmasked attributes are transparent.
|
williamr@2
|
1291 |
@internalComponent
|
williamr@2
|
1292 |
*/
|
williamr@2
|
1293 |
class RTmParFormatLayer
|
williamr@2
|
1294 |
|
williamr@2
|
1295 |
{
|
williamr@2
|
1296 |
public:
|
williamr@2
|
1297 |
inline void Close();
|
williamr@2
|
1298 |
IMPORT_C void CopyL(const CParaFormatLayer& aFormat);
|
williamr@2
|
1299 |
|
williamr@2
|
1300 |
RTmParFormat iFormat;
|
williamr@2
|
1301 |
TTmParFormatMask iMask;
|
williamr@2
|
1302 |
};
|
williamr@2
|
1303 |
|
williamr@2
|
1304 |
/**
|
williamr@2
|
1305 |
A style.
|
williamr@2
|
1306 |
@internalComponent
|
williamr@2
|
1307 |
*/
|
williamr@2
|
1308 |
class RTmStyle
|
williamr@2
|
1309 |
|
williamr@2
|
1310 |
{
|
williamr@2
|
1311 |
public:
|
williamr@2
|
1312 |
enum
|
williamr@2
|
1313 |
{
|
williamr@2
|
1314 |
EMaxName = KMaxParagraphStyleName
|
williamr@2
|
1315 |
};
|
williamr@2
|
1316 |
|
williamr@2
|
1317 |
inline void Close();
|
williamr@2
|
1318 |
IMPORT_C void CopyL(const RParagraphStyleInfo& aStyle);
|
williamr@2
|
1319 |
IMPORT_C void GetRParagraphStyleInfoL(RParagraphStyleInfo& aStyle,
|
williamr@2
|
1320 |
const CParaFormatLayer& aGlobalParaFormatLayer,const CCharFormatLayer& aGlobalCharFormatLayer,
|
williamr@2
|
1321 |
const CStyleList& aList) const;
|
williamr@2
|
1322 |
|
williamr@2
|
1323 |
TBuf<KMaxName> iName;
|
williamr@2
|
1324 |
TBuf<KMaxName> iNextStyleName;
|
williamr@2
|
1325 |
TTmCharFormatLayer iCharFormat;
|
williamr@2
|
1326 |
RTmParFormatLayer iParFormat;
|
williamr@2
|
1327 |
TInt iOutlineLevel;
|
williamr@2
|
1328 |
};
|
williamr@2
|
1329 |
|
williamr@2
|
1330 |
/**
|
williamr@2
|
1331 |
A self-contained text object. It owns both layout and content. It is
|
williamr@2
|
1332 |
intended for labels and the general display of small-to-medium-sized amounts of
|
williamr@2
|
1333 |
text.
|
williamr@2
|
1334 |
@internalComponent
|
williamr@2
|
1335 |
*/
|
williamr@2
|
1336 |
class CTmText: public CBase, public MTmTextLayoutForwarder
|
williamr@2
|
1337 |
|
williamr@2
|
1338 |
{
|
williamr@2
|
1339 |
public:
|
williamr@2
|
1340 |
IMPORT_C static CTmText* NewL(MGraphicsDeviceMap* aDevice = NULL,const TTmFormatParamBase* aFormatParam = NULL);
|
williamr@2
|
1341 |
IMPORT_C static CTmText* NewL(MGraphicsDeviceMap& aDevice,const TTmFormatParamBase& aFormatParam);
|
williamr@2
|
1342 |
IMPORT_C static CTmText* NewL(MGraphicsDeviceMap& aDevice,TInt aWrapWidth,TInt aFlags);
|
williamr@2
|
1343 |
IMPORT_C ~CTmText();
|
williamr@2
|
1344 |
IMPORT_C void InsertL(TInt aPos,const TDesC& aText,
|
williamr@2
|
1345 |
const TTmCharFormat* aCharFormat = NULL,const RTmParFormat* aParFormat = NULL,
|
williamr@2
|
1346 |
TRect* aRedrawRect = NULL,TInt* aScroll = NULL);
|
williamr@2
|
1347 |
IMPORT_C void GetFormat(TTmFormatParamBase& aFormatParam) const;
|
williamr@2
|
1348 |
IMPORT_C void SetWrapWidthL(TInt aWrapWidth);
|
williamr@2
|
1349 |
IMPORT_C void ChangeFormatL(const TTmFormatParamBase& aFormatParam);
|
williamr@2
|
1350 |
IMPORT_C void Clear();
|
williamr@2
|
1351 |
IMPORT_C void CustomizeL(const MTmCustom* aCustom);
|
williamr@2
|
1352 |
IMPORT_C TInt MemoryUsed() const;
|
williamr@2
|
1353 |
inline void Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
1354 |
const TLogicalRgb* aDocBackground,TBool aDrawParBackground);
|
williamr@2
|
1355 |
|
williamr@2
|
1356 |
private:
|
williamr@2
|
1357 |
CTmText();
|
williamr@2
|
1358 |
IMPORT_C void Spare1();
|
williamr@2
|
1359 |
|
williamr@2
|
1360 |
// implementations of MTmTextLayoutForwarder virtual functions
|
williamr@2
|
1361 |
const CTmTextLayout& TextLayout() const;
|
williamr@2
|
1362 |
|
williamr@2
|
1363 |
CTmTextImp* iImp; // the implementation
|
williamr@2
|
1364 |
};
|
williamr@2
|
1365 |
|
williamr@2
|
1366 |
// inline functions
|
williamr@2
|
1367 |
/** Constructs a TTmCharFormatMask. Turns all the flags on. */
|
williamr@2
|
1368 |
TTmCharFormatMask::TTmCharFormatMask(): iFlags(0xFFFFFFFF)
|
williamr@2
|
1369 |
{
|
williamr@2
|
1370 |
}
|
williamr@2
|
1371 |
|
williamr@2
|
1372 |
/** Clears the selected flag.*/
|
williamr@2
|
1373 |
void TTmCharFormatMask::Clear(TAttrib aAttrib)
|
williamr@2
|
1374 |
{
|
williamr@2
|
1375 |
iFlags &= ~aAttrib;
|
williamr@2
|
1376 |
}
|
williamr@2
|
1377 |
|
williamr@2
|
1378 |
/** Sets the selected flag. */
|
williamr@2
|
1379 |
void TTmCharFormatMask::Set(TAttrib aAttrib)
|
williamr@2
|
1380 |
{
|
williamr@2
|
1381 |
iFlags |= aAttrib;
|
williamr@2
|
1382 |
}
|
williamr@2
|
1383 |
|
williamr@2
|
1384 |
/** Returns true if the selected attribute is set. */
|
williamr@2
|
1385 |
TBool TTmCharFormatMask::IsSet(TAttrib aAttrib)
|
williamr@2
|
1386 |
{
|
williamr@2
|
1387 |
return iFlags & aAttrib;
|
williamr@2
|
1388 |
}
|
williamr@2
|
1389 |
|
williamr@2
|
1390 |
/** Constructs a TTmCharFormat by converting the information in a TCharFormat. */
|
williamr@2
|
1391 |
TTmCharFormat::TTmCharFormat(const TCharFormat& aFormat)
|
williamr@2
|
1392 |
{
|
williamr@2
|
1393 |
*this = aFormat;
|
williamr@2
|
1394 |
}
|
williamr@2
|
1395 |
|
williamr@2
|
1396 |
/** The inequality operator. Return TRUE if this object and aFormat differ in any way. */
|
williamr@2
|
1397 |
TBool TTmCharFormat::operator!=(const TTmCharFormat& aFormat) const
|
williamr@2
|
1398 |
{
|
williamr@2
|
1399 |
return !operator==(aFormat);
|
williamr@2
|
1400 |
}
|
williamr@2
|
1401 |
|
williamr@2
|
1402 |
/** Constructs a TTmTab and set it to a standard tab stop with a position of 0. */
|
williamr@2
|
1403 |
TTmTab::TTmTab():
|
williamr@2
|
1404 |
iPosition(0),
|
williamr@2
|
1405 |
iType(EStandardTab)
|
williamr@2
|
1406 |
{
|
williamr@2
|
1407 |
}
|
williamr@2
|
1408 |
|
williamr@2
|
1409 |
/** Constructs a TTmTab by converting the information in a TTabStop. */
|
williamr@2
|
1410 |
TTmTab::TTmTab(const TTabStop& aTab)
|
williamr@2
|
1411 |
{
|
williamr@2
|
1412 |
*this = aTab;
|
williamr@2
|
1413 |
}
|
williamr@2
|
1414 |
|
williamr@2
|
1415 |
/** The inequality operator. Returns TRUE if this object and aTab differ in any
|
williamr@2
|
1416 |
way. */
|
williamr@2
|
1417 |
TBool TTmTab::operator!=(const TTmTab& aTab) const
|
williamr@2
|
1418 |
{
|
williamr@2
|
1419 |
return !operator==(aTab);
|
williamr@2
|
1420 |
}
|
williamr@2
|
1421 |
|
williamr@2
|
1422 |
/** Constructs a TTmBullet by converting the information in a TBullet. */
|
williamr@2
|
1423 |
TTmBullet::TTmBullet(const TBullet& aBullet)
|
williamr@2
|
1424 |
{
|
williamr@2
|
1425 |
*this = aBullet;
|
williamr@2
|
1426 |
}
|
williamr@2
|
1427 |
|
williamr@2
|
1428 |
/** The inequality operator. Returns true if this object and aBullet differ in
|
williamr@2
|
1429 |
any way. */
|
williamr@2
|
1430 |
TBool TTmBullet::operator!=(const TTmBullet& aBullet) const
|
williamr@2
|
1431 |
{
|
williamr@2
|
1432 |
return !operator==(aBullet);
|
williamr@2
|
1433 |
}
|
williamr@2
|
1434 |
|
williamr@2
|
1435 |
/** Constructs a TTmParBorder by converting the information in a TParaBorder. */
|
williamr@2
|
1436 |
TTmParBorder::TTmParBorder(const TParaBorder& aBorder)
|
williamr@2
|
1437 |
{
|
williamr@2
|
1438 |
*this = aBorder;
|
williamr@2
|
1439 |
}
|
williamr@2
|
1440 |
|
williamr@2
|
1441 |
/** The inequality operator. Returns TRUE if this object and aBorder differ in
|
williamr@2
|
1442 |
any way. */
|
williamr@2
|
1443 |
TBool TTmParBorder::operator!=(const TTmParBorder& aBorder) const
|
williamr@2
|
1444 |
{
|
williamr@2
|
1445 |
return !operator==(aBorder);
|
williamr@2
|
1446 |
}
|
williamr@2
|
1447 |
|
williamr@2
|
1448 |
/** Constructs a TTmParFormatMask with all the flags on. */
|
williamr@2
|
1449 |
TTmParFormatMask::TTmParFormatMask():
|
williamr@2
|
1450 |
iFlags(0xFFFFFFFF)
|
williamr@2
|
1451 |
{
|
williamr@2
|
1452 |
}
|
williamr@2
|
1453 |
|
williamr@2
|
1454 |
/** Clears the selected flag. */
|
williamr@2
|
1455 |
void TTmParFormatMask::Clear(TAttrib aAttrib)
|
williamr@2
|
1456 |
{
|
williamr@2
|
1457 |
iFlags &= ~aAttrib;
|
williamr@2
|
1458 |
}
|
williamr@2
|
1459 |
|
williamr@2
|
1460 |
/** Sets the selected flag. */
|
williamr@2
|
1461 |
void TTmParFormatMask::Set(TAttrib aAttrib)
|
williamr@2
|
1462 |
{
|
williamr@2
|
1463 |
iFlags |= aAttrib;
|
williamr@2
|
1464 |
}
|
williamr@2
|
1465 |
|
williamr@2
|
1466 |
/**
|
williamr@2
|
1467 |
Returns true if the selected flag is Set.
|
williamr@2
|
1468 |
*/
|
williamr@2
|
1469 |
TBool TTmParFormatMask::IsSet(TAttrib aAttrib)
|
williamr@2
|
1470 |
{
|
williamr@2
|
1471 |
return iFlags & aAttrib;
|
williamr@2
|
1472 |
}
|
williamr@2
|
1473 |
|
williamr@2
|
1474 |
#ifdef _DEBUG
|
williamr@2
|
1475 |
RTmParFormat::~RTmParFormat()
|
williamr@2
|
1476 |
{
|
williamr@2
|
1477 |
__ASSERT_DEBUG(!iTabList && !iBullet && !HaveBorders(), User::Invariant());
|
williamr@2
|
1478 |
}
|
williamr@2
|
1479 |
#endif
|
williamr@2
|
1480 |
|
williamr@2
|
1481 |
/** The inequality operator. Returns true if this object and aFormat differ in
|
williamr@2
|
1482 |
any way.
|
williamr@2
|
1483 |
*/
|
williamr@2
|
1484 |
TBool RTmParFormat::operator!=(const RTmParFormat& aFormat) const
|
williamr@2
|
1485 |
{
|
williamr@2
|
1486 |
return !operator==(aFormat);
|
williamr@2
|
1487 |
}
|
williamr@2
|
1488 |
|
williamr@2
|
1489 |
/** Returns a reference to the tab selected by aIndex. */
|
williamr@2
|
1490 |
const TTmTab& RTmParFormat::Tab(TInt aIndex) const
|
williamr@2
|
1491 |
{
|
williamr@2
|
1492 |
return (*iTabList)[aIndex];
|
williamr@2
|
1493 |
}
|
williamr@2
|
1494 |
|
williamr@2
|
1495 |
/** Returns a pointer to the TTmBullet object if any. Returns null if the
|
williamr@2
|
1496 |
RTmParFormat does not contain a TTmBullet. */
|
williamr@2
|
1497 |
const TTmBullet* RTmParFormat::Bullet() const
|
williamr@2
|
1498 |
{
|
williamr@2
|
1499 |
return iBullet;
|
williamr@2
|
1500 |
}
|
williamr@2
|
1501 |
|
williamr@2
|
1502 |
/** Returns a pointer to the border selected by aIndex. Returns null if the
|
williamr@2
|
1503 |
selected border is not present. */
|
williamr@2
|
1504 |
const TTmParBorder* RTmParFormat::Border(TBorderIndex aIndex) const
|
williamr@2
|
1505 |
{
|
williamr@2
|
1506 |
return iBorder[aIndex];
|
williamr@2
|
1507 |
}
|
williamr@2
|
1508 |
|
williamr@2
|
1509 |
/** Returns true if the paragraph's base direction is right-to-left. */
|
williamr@2
|
1510 |
TBool RTmParFormat::RightToLeft() const
|
williamr@2
|
1511 |
{
|
williamr@2
|
1512 |
return iFlags & ERightToLeft;
|
williamr@2
|
1513 |
}
|
williamr@2
|
1514 |
|
williamr@2
|
1515 |
/** Constructs a line height parameter structure, setting all the data members
|
williamr@2
|
1516 |
to zero. */
|
williamr@2
|
1517 |
MTmCustom::TLineHeightParam::TLineHeightParam()
|
williamr@2
|
1518 |
{
|
williamr@2
|
1519 |
Mem::FillZ(this,sizeof(*this));
|
williamr@2
|
1520 |
}
|
williamr@2
|
1521 |
|
williamr@2
|
1522 |
CTmBufSeg::CTmBufSeg(TInt aExpandSize):
|
williamr@2
|
1523 |
CBufSeg(aExpandSize)
|
williamr@2
|
1524 |
{
|
williamr@2
|
1525 |
}
|
williamr@2
|
1526 |
|
williamr@2
|
1527 |
CTmCode::~CTmCode()
|
williamr@2
|
1528 |
{
|
williamr@2
|
1529 |
delete iBuffer;
|
williamr@2
|
1530 |
}
|
williamr@2
|
1531 |
|
williamr@2
|
1532 |
TPtr8 CTmCode::Ptr(TInt aPos)
|
williamr@2
|
1533 |
{
|
williamr@2
|
1534 |
return iBuffer->Ptr(aPos);
|
williamr@2
|
1535 |
}
|
williamr@2
|
1536 |
|
williamr@2
|
1537 |
CBufBase* CTmCode::Buffer()
|
williamr@2
|
1538 |
{
|
williamr@2
|
1539 |
return iBuffer;
|
williamr@2
|
1540 |
}
|
williamr@2
|
1541 |
|
williamr@2
|
1542 |
const CBufBase* CTmCode::Buffer() const
|
williamr@2
|
1543 |
{
|
williamr@2
|
1544 |
return iBuffer;
|
williamr@2
|
1545 |
}
|
williamr@2
|
1546 |
|
williamr@2
|
1547 |
/** Returns true if wrapping is turned on. */
|
williamr@2
|
1548 |
TBool TTmFormatParamBase::IsWrapping() const
|
williamr@2
|
1549 |
{
|
williamr@2
|
1550 |
return iFlags & EWrap;
|
williamr@2
|
1551 |
}
|
williamr@2
|
1552 |
|
williamr@2
|
1553 |
/** Returns true if truncation with ellipsis is turned on. */
|
williamr@2
|
1554 |
TBool TTmFormatParamBase::IsTruncatingWithEllipsis() const
|
williamr@2
|
1555 |
{
|
williamr@2
|
1556 |
return iFlags & ETruncateWithEllipsis;
|
williamr@2
|
1557 |
}
|
williamr@2
|
1558 |
|
williamr@2
|
1559 |
/** Returns true if line breaking must only occur at legal line breaks, even if
|
williamr@2
|
1560 |
the line cannot legally be broken at the desired wrap width. */
|
williamr@2
|
1561 |
TBool TTmFormatParamBase::LegalLineBreaksOnly() const
|
williamr@2
|
1562 |
{
|
williamr@2
|
1563 |
return iFlags & ELegalLineBreaksOnly;
|
williamr@2
|
1564 |
}
|
williamr@2
|
1565 |
|
williamr@2
|
1566 |
/** Constructs a TTmLineInfo object, setting all data members to 0. */
|
williamr@2
|
1567 |
TTmLineInfo::TTmLineInfo()
|
williamr@2
|
1568 |
{
|
williamr@2
|
1569 |
Mem::FillZ(this,sizeof(*this));
|
williamr@2
|
1570 |
}
|
williamr@2
|
1571 |
|
williamr@2
|
1572 |
/** Constructs a TTmDocPos object, setting iPos to 0 and iLeadingEdge to false.
|
williamr@2
|
1573 |
This is the lowest legal value for a TTmDocPos object. A trailing edge comes
|
williamr@2
|
1574 |
before a leading edge because it is the trailing edge of the character before
|
williamr@2
|
1575 |
the position, while the leading edge is that of the character after the
|
williamr@2
|
1576 |
position. ('Leading' means the first to be encountered when traversing the
|
williamr@2
|
1577 |
document in logical order). */
|
williamr@2
|
1578 |
TTmDocPos::TTmDocPos():
|
williamr@2
|
1579 |
iPos(0),
|
williamr@2
|
1580 |
iLeadingEdge(FALSE)
|
williamr@2
|
1581 |
{
|
williamr@2
|
1582 |
}
|
williamr@2
|
1583 |
|
williamr@2
|
1584 |
/** Constructs a TTmDocPos object, setting iPos to aPos and iLeadingEdge to
|
williamr@2
|
1585 |
aLeadingEdge.
|
williamr@2
|
1586 |
*/
|
williamr@2
|
1587 |
TTmDocPos::TTmDocPos(TInt aPos,TBool aLeadingEdge):
|
williamr@2
|
1588 |
iPos(aPos),
|
williamr@2
|
1589 |
iLeadingEdge(aLeadingEdge)
|
williamr@2
|
1590 |
{
|
williamr@2
|
1591 |
}
|
williamr@2
|
1592 |
|
williamr@2
|
1593 |
/** Constructs a TTmDocPosSpec, setting the position to 0 and the type to
|
williamr@2
|
1594 |
trailing. */
|
williamr@2
|
1595 |
TTmDocPosSpec::TTmDocPosSpec():
|
williamr@2
|
1596 |
iPos(0),
|
williamr@2
|
1597 |
iType(ETrailing)
|
williamr@2
|
1598 |
{
|
williamr@2
|
1599 |
}
|
williamr@2
|
1600 |
|
williamr@2
|
1601 |
|
williamr@2
|
1602 |
/**
|
williamr@2
|
1603 |
The not equal operator.
|
williamr@2
|
1604 |
@return True if both sides have different values.
|
williamr@2
|
1605 |
*/
|
williamr@2
|
1606 |
TBool TTmDocPos::operator!=(const TTmDocPos& aPos) const { return !((*this)==aPos); }
|
williamr@2
|
1607 |
|
williamr@2
|
1608 |
/**
|
williamr@2
|
1609 |
Smaller than operator.
|
williamr@2
|
1610 |
@return
|
williamr@2
|
1611 |
True if the right side of the operator is further on in the document than
|
williamr@2
|
1612 |
the left hand side.
|
williamr@2
|
1613 |
*/
|
williamr@2
|
1614 |
TBool TTmDocPos::operator<(const TTmDocPos& aPos) const { return !((*this)>=aPos); }
|
williamr@2
|
1615 |
|
williamr@2
|
1616 |
/**
|
williamr@2
|
1617 |
Smaller than or equal to operator.
|
williamr@2
|
1618 |
@return
|
williamr@2
|
1619 |
True if the right side of the operator is further on in the document than
|
williamr@2
|
1620 |
the left hand side or if both sides are identical.
|
williamr@2
|
1621 |
*/
|
williamr@2
|
1622 |
TBool TTmDocPos::operator<=(const TTmDocPos& aPos) const { return !((*this)>aPos); }
|
williamr@2
|
1623 |
|
williamr@2
|
1624 |
/** Constructs a TTmDocPosSpec, setting the position to aPos and the type to
|
williamr@2
|
1625 |
aType.
|
williamr@2
|
1626 |
*/
|
williamr@2
|
1627 |
TTmDocPosSpec::TTmDocPosSpec(TInt aPos,TType aType):
|
williamr@2
|
1628 |
iPos(aPos),
|
williamr@2
|
1629 |
iType(aType)
|
williamr@2
|
1630 |
{
|
williamr@2
|
1631 |
}
|
williamr@2
|
1632 |
|
williamr@2
|
1633 |
/** Constructs a TTmDocPosSpec from a TTmDocPos. */
|
williamr@2
|
1634 |
TTmDocPosSpec::TTmDocPosSpec(const TTmDocPos& aDocPos):
|
williamr@2
|
1635 |
iPos(aDocPos.iPos),
|
williamr@2
|
1636 |
iType(aDocPos.iLeadingEdge ? ELeading : ETrailing)
|
williamr@2
|
1637 |
{
|
williamr@2
|
1638 |
}
|
williamr@2
|
1639 |
|
williamr@2
|
1640 |
/** Returns the first formatted character. */
|
williamr@2
|
1641 |
TInt CTmTextLayout::StartChar() const
|
williamr@2
|
1642 |
{
|
williamr@2
|
1643 |
return iStartChar;
|
williamr@2
|
1644 |
}
|
williamr@2
|
1645 |
|
williamr@2
|
1646 |
/** Returns the character after the last formatted character. */
|
williamr@2
|
1647 |
TInt CTmTextLayout::EndChar() const
|
williamr@2
|
1648 |
{
|
williamr@2
|
1649 |
return iEndChar;
|
williamr@2
|
1650 |
}
|
williamr@2
|
1651 |
|
williamr@2
|
1652 |
/** Return the width in pixels of the formatted text, not including paragraph
|
williamr@2
|
1653 |
labels if present. */
|
williamr@2
|
1654 |
TInt CTmTextLayout::LayoutWidth() const
|
williamr@2
|
1655 |
{
|
williamr@2
|
1656 |
return iWidth;
|
williamr@2
|
1657 |
}
|
williamr@2
|
1658 |
|
williamr@2
|
1659 |
/** Returns the height in pixels of the formatted text. */
|
williamr@2
|
1660 |
TInt CTmTextLayout::LayoutHeight() const
|
williamr@2
|
1661 |
{
|
williamr@2
|
1662 |
return iHeight;
|
williamr@2
|
1663 |
}
|
williamr@2
|
1664 |
|
williamr@2
|
1665 |
/** Returns a pointer to to the MTmSource object, if any, that provides text
|
williamr@2
|
1666 |
and formatting to this object. Returns null if no source object has been set. */
|
williamr@2
|
1667 |
MTmSource* CTmTextLayout::Source()
|
williamr@2
|
1668 |
{
|
williamr@2
|
1669 |
return iSource;
|
williamr@2
|
1670 |
}
|
williamr@2
|
1671 |
|
williamr@2
|
1672 |
const MTmSource* CTmTextLayout::Source() const
|
williamr@2
|
1673 |
{
|
williamr@2
|
1674 |
return iSource;
|
williamr@2
|
1675 |
}
|
williamr@2
|
1676 |
|
williamr@2
|
1677 |
/**
|
williamr@2
|
1678 |
Returns a reference to the CTmCode object containing the bytecode
|
williamr@2
|
1679 |
representing the text layout.
|
williamr@2
|
1680 |
@internalComponent
|
williamr@2
|
1681 |
*/
|
williamr@2
|
1682 |
const CTmCode& CTmTextLayout::Code() const
|
williamr@2
|
1683 |
{
|
williamr@2
|
1684 |
return iCode;
|
williamr@2
|
1685 |
}
|
williamr@2
|
1686 |
|
williamr@2
|
1687 |
/** Constructs a TTmCharFormatLayer object containing default TTmCharFormat and
|
williamr@2
|
1688 |
TTmCharFormatMask objects. */
|
williamr@2
|
1689 |
TTmCharFormatLayer::TTmCharFormatLayer()
|
williamr@2
|
1690 |
{
|
williamr@2
|
1691 |
}
|
williamr@2
|
1692 |
|
williamr@2
|
1693 |
/** Closes an RTmParFormatLayer object by freeing any objects allocated on the
|
williamr@2
|
1694 |
heap. */
|
williamr@2
|
1695 |
void RTmParFormatLayer::Close()
|
williamr@2
|
1696 |
{
|
williamr@2
|
1697 |
iFormat.Close();
|
williamr@2
|
1698 |
}
|
williamr@2
|
1699 |
|
williamr@2
|
1700 |
/** Closes an RTmStyle object by freeing any objects allocated on the heap.
|
williamr@2
|
1701 |
*/
|
williamr@2
|
1702 |
void RTmStyle::Close()
|
williamr@2
|
1703 |
{
|
williamr@2
|
1704 |
iParFormat.Close();
|
williamr@2
|
1705 |
}
|
williamr@2
|
1706 |
|
williamr@2
|
1707 |
/** Draws the formatted text. This inline function just calls
|
williamr@2
|
1708 |
CTmText::DrawLayout and is identical to it. It is provided for coding
|
williamr@2
|
1709 |
convenience because of the expectation that a drawing function called Draw
|
williamr@2
|
1710 |
exists. */
|
williamr@2
|
1711 |
void CTmText::Draw(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect,
|
williamr@2
|
1712 |
const TLogicalRgb* aDocBackground,TBool aDrawParBackground)
|
williamr@2
|
1713 |
{
|
williamr@2
|
1714 |
DrawLayout(aGc,aTopLeft,aClipRect,aDocBackground,aDrawParBackground);
|
williamr@2
|
1715 |
}
|
williamr@2
|
1716 |
|
williamr@2
|
1717 |
/** Contains the extensions to character rectangle used when highlighting
|
williamr@2
|
1718 |
the text in reverse video
|
williamr@2
|
1719 |
*/
|
williamr@2
|
1720 |
TTmHighlightExtensions::TTmHighlightExtensions()
|
williamr@2
|
1721 |
{
|
williamr@2
|
1722 |
}
|
williamr@2
|
1723 |
|
williamr@2
|
1724 |
void TTmHighlightExtensions::SetAll(TInt aExtension)
|
williamr@2
|
1725 |
{
|
williamr@2
|
1726 |
iLeftExtension=iRightExtension=iTopExtension=iBottomExtension=aExtension;
|
williamr@2
|
1727 |
}
|
williamr@2
|
1728 |
|
williamr@2
|
1729 |
void TTmHighlightExtensions::SetLeftExtension(TInt aExtension)
|
williamr@2
|
1730 |
{
|
williamr@2
|
1731 |
iLeftExtension=aExtension;
|
williamr@2
|
1732 |
}
|
williamr@2
|
1733 |
|
williamr@2
|
1734 |
void TTmHighlightExtensions::SetRightExtension(TInt aExtension)
|
williamr@2
|
1735 |
{
|
williamr@2
|
1736 |
iRightExtension=aExtension;
|
williamr@2
|
1737 |
}
|
williamr@2
|
1738 |
|
williamr@2
|
1739 |
void TTmHighlightExtensions::SetTopExtension(TInt aExtension)
|
williamr@2
|
1740 |
{
|
williamr@2
|
1741 |
iTopExtension=aExtension;
|
williamr@2
|
1742 |
}
|
williamr@2
|
1743 |
|
williamr@2
|
1744 |
void TTmHighlightExtensions::SetBottomExtension(TInt aExtension)
|
williamr@2
|
1745 |
{
|
williamr@2
|
1746 |
iBottomExtension=aExtension;
|
williamr@2
|
1747 |
}
|
williamr@2
|
1748 |
|
williamr@2
|
1749 |
TInt TTmHighlightExtensions::LeftExtension() const
|
williamr@2
|
1750 |
{
|
williamr@2
|
1751 |
return iLeftExtension;
|
williamr@2
|
1752 |
}
|
williamr@2
|
1753 |
|
williamr@2
|
1754 |
TInt TTmHighlightExtensions::RightExtension() const
|
williamr@2
|
1755 |
{
|
williamr@2
|
1756 |
return iRightExtension;
|
williamr@2
|
1757 |
}
|
williamr@2
|
1758 |
|
williamr@2
|
1759 |
TInt TTmHighlightExtensions::TopExtension() const
|
williamr@2
|
1760 |
{
|
williamr@2
|
1761 |
return iTopExtension;
|
williamr@2
|
1762 |
}
|
williamr@2
|
1763 |
|
williamr@2
|
1764 |
TInt TTmHighlightExtensions::BottomExtension() const
|
williamr@2
|
1765 |
{
|
williamr@2
|
1766 |
return iBottomExtension;
|
williamr@2
|
1767 |
}
|
williamr@2
|
1768 |
|
williamr@2
|
1769 |
inline TBool TTmHighlightExtensions::Extends() const
|
williamr@2
|
1770 |
{
|
williamr@2
|
1771 |
return (iTopExtension > 0 || iBottomExtension > 0 || iLeftExtension > 0 || iRightExtension > 0);
|
williamr@2
|
1772 |
}
|
williamr@2
|
1773 |
|
williamr@2
|
1774 |
inline TBool TTmHighlightExtensions::Shrinks() const
|
williamr@2
|
1775 |
{
|
williamr@2
|
1776 |
return (iTopExtension < 0 || iBottomExtension < 0 || iLeftExtension < 0 || iRightExtension < 0);
|
williamr@2
|
1777 |
}
|
williamr@2
|
1778 |
|
williamr@2
|
1779 |
inline void TTmHighlightExtensions::ExtendRect(TRect& aRect) const
|
williamr@2
|
1780 |
{
|
williamr@2
|
1781 |
if (iLeftExtension>0)
|
williamr@2
|
1782 |
aRect.iTl.iX-=iLeftExtension;
|
williamr@2
|
1783 |
if (iRightExtension>0)
|
williamr@2
|
1784 |
aRect.iBr.iX+=iRightExtension;
|
williamr@2
|
1785 |
if (iTopExtension>0)
|
williamr@2
|
1786 |
aRect.iTl.iY-=iTopExtension;
|
williamr@2
|
1787 |
if (iBottomExtension>0)
|
williamr@2
|
1788 |
aRect.iBr.iY+=iBottomExtension;
|
williamr@2
|
1789 |
}
|
williamr@2
|
1790 |
|
williamr@2
|
1791 |
inline void TTmHighlightExtensions::AdjustRect(TRect& aRect) const
|
williamr@2
|
1792 |
{
|
williamr@2
|
1793 |
aRect.iTl.iX-=iLeftExtension;
|
williamr@2
|
1794 |
aRect.iTl.iY-=iTopExtension;
|
williamr@2
|
1795 |
aRect.iBr.iX+=iRightExtension;
|
williamr@2
|
1796 |
aRect.iBr.iY+=iBottomExtension;
|
williamr@2
|
1797 |
}
|
williamr@2
|
1798 |
|
williamr@2
|
1799 |
inline TBool TTmHighlightExtensions::IsNull() const
|
williamr@2
|
1800 |
{
|
williamr@2
|
1801 |
return 0 == iLeftExtension && 0 == iTopExtension && 0 == iRightExtension && 0 == iBottomExtension;
|
williamr@2
|
1802 |
}
|
williamr@2
|
1803 |
|
williamr@2
|
1804 |
inline void TTmHighlightExtensions::AbsExtendRect(TRect& aRect) const
|
williamr@2
|
1805 |
{
|
williamr@2
|
1806 |
if (iLeftExtension>0)
|
williamr@2
|
1807 |
aRect.iTl.iX-=iLeftExtension;
|
williamr@2
|
1808 |
else
|
williamr@2
|
1809 |
aRect.iTl.iX+=iLeftExtension;
|
williamr@2
|
1810 |
|
williamr@2
|
1811 |
if (iRightExtension>0)
|
williamr@2
|
1812 |
aRect.iBr.iX+=iRightExtension;
|
williamr@2
|
1813 |
else
|
williamr@2
|
1814 |
aRect.iBr.iX-=iRightExtension;
|
williamr@2
|
1815 |
|
williamr@2
|
1816 |
if (iTopExtension>0)
|
williamr@2
|
1817 |
aRect.iTl.iY-=iTopExtension;
|
williamr@2
|
1818 |
else
|
williamr@2
|
1819 |
aRect.iTl.iY+=iTopExtension;
|
williamr@2
|
1820 |
|
williamr@2
|
1821 |
if (iBottomExtension>0)
|
williamr@2
|
1822 |
aRect.iBr.iY+=iBottomExtension;
|
williamr@2
|
1823 |
else
|
williamr@2
|
1824 |
aRect.iBr.iY-=iBottomExtension;
|
williamr@2
|
1825 |
}
|
williamr@2
|
1826 |
|
williamr@2
|
1827 |
#endif // __TAGMA_H__
|