|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef TAGMA_LAYOUT_AND_SOURCE_H |
|
20 #define TAGMA_LAYOUT_AND_SOURCE_H |
|
21 |
|
22 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
23 #include <tagma.h> |
|
24 #endif |
|
25 |
|
26 class CTmBufSeg; |
|
27 class CTmCode; |
|
28 class TTmTab; |
|
29 class TTmBullet; |
|
30 class TTmParBorder; |
|
31 class TTmReformatParam; |
|
32 class TTmReformatResult; |
|
33 |
|
34 /** |
|
35 WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
36 Paragraph format; all dimensions are in twips unless otherwise specified. |
|
37 @internalComponent |
|
38 */ |
|
39 class RTmParFormat |
|
40 |
|
41 { |
|
42 public: |
|
43 /** Index used to select one of the four borders of a paragraph */ |
|
44 enum TBorderIndex |
|
45 { |
|
46 ETopBorder = 0, |
|
47 EBottomBorder = 1, |
|
48 ELeadingBorder = 2, |
|
49 ETrailingBorder = 3, |
|
50 }; |
|
51 |
|
52 /** Bit assignments for RTmParFormat::iFlags. */ |
|
53 enum |
|
54 { |
|
55 /** Base direction of paragraph is right-to-left (as for Arabic) */ |
|
56 ERightToLeft = 1, |
|
57 /** Do not allow paragraph to straddle page boundaries. */ |
|
58 EKeepTogether = 2, |
|
59 /** Put this paragraph on the same page as the next. */ |
|
60 EKeepWithNext = 4, |
|
61 /** Put this paragraph at the start of a new page. */ |
|
62 EStartNewPage = 8, |
|
63 /** Suppress widows and orphans. */ |
|
64 EWidowOrphan = 16, |
|
65 /** Suppresses line breaking. */ |
|
66 ENoWrap = 32, |
|
67 /** Force line spacing distance to be respected even on lines that are |
|
68 * taller than the specified height. */ |
|
69 EExactLineSpacing = 64, |
|
70 /** Line spaceing is in pixels, not twips. */ |
|
71 EPixelLineSpacing = 128, |
|
72 /** Work out paragraph directionality from the text. */ |
|
73 EDirectionalityFromText = 256 |
|
74 }; |
|
75 |
|
76 /** Paragraph alignment */ |
|
77 enum TAlignment |
|
78 { |
|
79 EAlignNormalBidirectional, |
|
80 EAlignNormal = EAlignNormalBidirectional, /** @deprecated in 7.0s */ |
|
81 EAlignCenter, |
|
82 EAlignReverseBidirectional, |
|
83 EAlignReverse = EAlignReverseBidirectional, /** @deprecated in 7.0s */ |
|
84 EAlignJustify, |
|
85 EAlignAbsoluteLeft, |
|
86 EAlignAbsoluteRight |
|
87 }; |
|
88 |
|
89 IMPORT_C RTmParFormat(); |
|
90 IMPORT_C void Close(); |
|
91 #ifdef _DEBUG |
|
92 inline ~RTmParFormat(); |
|
93 #endif |
|
94 IMPORT_C void CopyL(const RTmParFormat& aFormat); |
|
95 IMPORT_C void CopyL(const CParaFormat& aFormat); |
|
96 IMPORT_C void GetCParaFormatL(CParaFormat& aFormat) const; |
|
97 IMPORT_C TBool operator==(const RTmParFormat& aFormat) const; |
|
98 inline TBool operator!=(const RTmParFormat& aFormat) const; |
|
99 IMPORT_C TInt Tabs() const; |
|
100 inline const TTmTab& Tab(TInt aIndex) const; |
|
101 inline const TTmBullet* Bullet() const; |
|
102 inline const TTmParBorder* Border(TBorderIndex aIndex) const; |
|
103 IMPORT_C TBool HaveBorders() const; |
|
104 inline TBool RightToLeft() const; |
|
105 |
|
106 TAlignment iAlignment; |
|
107 TUint iFlags; // bit flags as defined above |
|
108 TInt iLeadingMargin; // left margin, or right if right-to-left |
|
109 TInt iTrailingMargin; // right margin, or left if right-to-left |
|
110 TInt iFirstLineIndent; // added to first line leading margin |
|
111 TInt iLineSpacing; // distance between baselines |
|
112 TInt iSpaceAbove; // space above the paragraph |
|
113 TInt iSpaceBelow; // space below the paragraph |
|
114 TInt iTabSize; // default size of tabs |
|
115 TInt iBorderMargin; // distance between the text and the border if any |
|
116 TLogicalRgb iBackgroundColor; // paragraph background colour |
|
117 |
|
118 private: |
|
119 RTmParFormat(const RTmParFormat& aFormat); // deliberately unimplemented |
|
120 void operator=(const RTmParFormat& aFormat);// deliberately unimplemented |
|
121 |
|
122 RArray<TTmTab>* iTabList; // custom tabs if any |
|
123 TTmBullet* iBullet; // bullet if any |
|
124 TTmParBorder* iBorder[4]; // borders if any |
|
125 }; |
|
126 |
|
127 /** |
|
128 WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
129 MTmSource is an interface class that must be implemented by users of |
|
130 CTmTextLayout to provide text content and attributes. MTmSource is derived from |
|
131 MTmCustom, which contains the functions to customise the layout and display, so |
|
132 that this can be done in CTmText without affecting the content. |
|
133 @internalComponent |
|
134 */ |
|
135 class MTmSource: public MTmCustom |
|
136 |
|
137 { |
|
138 public: |
|
139 /** Label type used in LabelModeSelect */ |
|
140 enum TLabelType |
|
141 { |
|
142 /** Not a label; used for TLabelTypes not yet assigned. */ |
|
143 ENoLabel, |
|
144 |
|
145 /** Paragraph label of the type supported by FORM. */ |
|
146 EParLabel |
|
147 }; |
|
148 |
|
149 enum |
|
150 { |
|
151 /** |
|
152 The maximum number of characters supplied to GetLineBreak, after aMaxBreakPos, |
|
153 and after trailing whitespace, to provide context for line breaking decisions. |
|
154 */ |
|
155 ELineBreakContext = 32 |
|
156 }; |
|
157 |
|
158 // pure virtuals |
|
159 |
|
160 /** Return the device used to format the text. */ |
|
161 virtual MGraphicsDeviceMap& FormatDevice() const = 0; |
|
162 |
|
163 /** |
|
164 Return the device used to draw the text and when converting between x-y coordinates and document positions. |
|
165 If the formatting and interpreting devices are different, text is scaled appropriately when it is drawn; |
|
166 this allows text to be formatted for printer fonts and displayed on the screen, giving a wysiwyg print preview. |
|
167 */ |
|
168 virtual MGraphicsDeviceMap& InterpretDevice() const = 0; |
|
169 |
|
170 /** Return the length of the document in characters. */ |
|
171 virtual TInt DocumentLength() const = 0; |
|
172 |
|
173 /** |
|
174 Return at least one character of text, but preferably as many as possible, starting at aPos. Put its character |
|
175 format in aFormat. The text must be a run of characters sharing the same character format. |
|
176 */ |
|
177 virtual void GetText(TInt aPos,TPtrC& aText,TTmCharFormat& aFormat) const = 0; |
|
178 |
|
179 /** |
|
180 Return the paragraph format of the paragraph containing aPos. End-of-paragraph characters belong to the preceding |
|
181 paragraph. |
|
182 */ |
|
183 virtual void GetParagraphFormatL(TInt aPos,RTmParFormat& aFormat) const = 0; |
|
184 |
|
185 /** |
|
186 Return the document position of the start of the paragraph containing aPos. End-of-paragraph characters belong to |
|
187 the preceding paragraph. |
|
188 */ |
|
189 virtual TInt ParagraphStart(TInt aPos) const = 0; |
|
190 |
|
191 // ordinary virtuals |
|
192 IMPORT_C virtual CPicture* PictureL(TInt aPos) const; |
|
193 IMPORT_C virtual TInt GetPictureSizeInTwipsL(TInt aPos,TSize& aSize) const; |
|
194 IMPORT_C virtual TAny* GetExtendedInterface(const TUid& aInterfaceId); |
|
195 IMPORT_C virtual void MTmSource_Reserved_1(); |
|
196 IMPORT_C virtual void MTmSource_Reserved_2(); |
|
197 IMPORT_C virtual TBool PageBreakInRange(TInt aStartPos,TInt aEndPos) const; |
|
198 |
|
199 // non-virtuals |
|
200 IMPORT_C TInt ParagraphEnd(TInt aPos) const; |
|
201 IMPORT_C TBool GetLineBreakL(const TDesC& aText,TInt aDocPos,TInt aMinBreakPos,TInt aMaxBreakPos,TBool aForwards, |
|
202 TInt& aBreakPos,TInt& aHangingChars,TInt& aBreakPosAfterSpaces) const; |
|
203 IMPORT_C static void GetStandardLineBreak(const TDesC& aText,TInt aMinBreakPos,TInt aMaxBreakPos, |
|
204 TInt& aBreakPos,TInt& aNextLineStart); |
|
205 }; |
|
206 |
|
207 /** |
|
208 WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
209 @internalTechnology |
|
210 */ |
|
211 class CTmCode: public CBase |
|
212 { |
|
213 public: |
|
214 inline ~CTmCode(); |
|
215 void InsertByteL(TUint8 aByte,TInt aPos); |
|
216 TInt InsertNumberL(TInt aNumber,TInt aPos); |
|
217 TInt InsertRectL(const TRect& aRect,TInt aPos); |
|
218 void AppendByteL(TUint8 aByte); |
|
219 TInt AppendNumberL(TInt aNumber); |
|
220 TInt AppendRectL(const TRect& aRect); |
|
221 void ChangeL(TInt aStart,TInt aEnd,CTmCode& aNewCode); |
|
222 TInt MemoryUsed() const; |
|
223 TInt Size() const; |
|
224 void Delete(TInt aPos,TInt aLength); |
|
225 void Reset(); |
|
226 inline TPtr8 Ptr(TInt aPos); |
|
227 void CreateBufferL(); |
|
228 inline CBufBase* Buffer(); |
|
229 inline const CBufBase* Buffer() const; |
|
230 |
|
231 private: |
|
232 enum |
|
233 { |
|
234 EExpandSize = 512 |
|
235 }; |
|
236 TInt WriteNumber(TInt aNumber,TUint8* aBuffer); |
|
237 |
|
238 CTmBufSeg* iBuffer; |
|
239 }; |
|
240 |
|
241 /** |
|
242 WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
243 Formatting parameters used when formatting part of a layout object. |
|
244 @internalComponent |
|
245 */ |
|
246 class TTmFormatParamBase |
|
247 |
|
248 { |
|
249 public: |
|
250 enum |
|
251 { |
|
252 EWrap = 1, // wrap the text at iWrapWidth |
|
253 EAtLeastMaxHeight = 2, // stop adding text only when iMaxHeight has been reached or exceeded |
|
254 ETruncateWithEllipsis = 4, // truncate any text that sticks out; see iEllipsis below |
|
255 ELegalLineBreaksOnly = 8 // break only at allowed line breaks, even if that |
|
256 // results in the text not fitting the measure |
|
257 }; |
|
258 |
|
259 IMPORT_C TTmFormatParamBase(); |
|
260 inline TBool IsWrapping() const; |
|
261 inline TBool IsTruncatingWithEllipsis() const; |
|
262 inline TBool LegalLineBreaksOnly() const; |
|
263 |
|
264 TInt iWrapWidth; // wrapping width of the text including margins and indents, if wrapping is on |
|
265 TInt iMaxHeight; // maximum height of the text |
|
266 TInt iMaxLines; // maximum number of lines to be formatted |
|
267 TInt iFlags; // flags defined above |
|
268 TChar iEllipsis; // if truncating and not 0xFFFF, insert this ellipsis char (defaults to '...'). |
|
269 |
|
270 }; |
|
271 |
|
272 /** |
|
273 WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
274 Formatting parameters used when formatting an entire layout object or |
|
275 creating a section of format code. |
|
276 @internalComponent |
|
277 */ |
|
278 class TTmFormatParam: public TTmFormatParamBase |
|
279 |
|
280 { |
|
281 public: |
|
282 IMPORT_C TTmFormatParam(); |
|
283 IMPORT_C TTmFormatParam(const TTmFormatParamBase& aBase); |
|
284 |
|
285 TInt iStartChar; // first character position to be formatted |
|
286 TInt iEndChar; // last character position to be formatted |
|
287 TInt iLineInPar; // starting line number in the paragraph |
|
288 }; |
|
289 |
|
290 /** |
|
291 WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
292 The text layout for a single rectangular piece of text. The object does not own its text or format attributes but |
|
293 gets them from an interface class called MTmSource. |
|
294 |
|
295 There are functions for setting the text, drawing it, and converting between x-y coordinates and document positions. |
|
296 |
|
297 Ranges |
|
298 |
|
299 All ranges of character positions and pixels include the start but not the end. This means that if a line is described |
|
300 by a TTmLineInfo object as starting at document position 345 and ending at 389, character positions 345 to 388 are in |
|
301 the line; 389 is in the next line if any. |
|
302 |
|
303 Coordinates and units |
|
304 |
|
305 All coordinates used in TAGMA classes and function arguments are in pixels and are relative to the origin of the object, |
|
306 which is the top left corner of the ordinary text, not including paragraph labels. Vertical coordinates increase from |
|
307 top to bottom. |
|
308 |
|
309 Document format and positions |
|
310 |
|
311 A TAGMA document, as supplied by the MTmSource interface, has a length as returned by MTmSource::DocumentLength of |
|
312 zero or more characters. It consists of Unicode text split into paragraphs by standard Unicode paragraph delimiters |
|
313 (character value 0x2029), so the number of paragraphs in the entire document is one more than the number of |
|
314 paragraph delimiters. A document position is a value in the range 0 to one more than the document length. |
|
315 Lines contain all document positions from their start to one less than their end position. These conventions allow |
|
316 all lines to end in a delimiter; the last line contains an imaginary paragraph end, which need not be supplied by |
|
317 the MTmSource interface, at a position equal to the document length. A CTmTextLayout object formatted for an |
|
318 empty document will thus have a start position (returned by StartChar) of 0 and an end position |
|
319 (returned by EndChar) of 1. |
|
320 @internalComponent |
|
321 WARNING: this Class is for internal use ONLY. Compatibility is not guaranteed in future releases. |
|
322 */ |
|
323 class CTmTextLayout: public CBase |
|
324 |
|
325 { |
|
326 public: |
|
327 |
|
328 class TTmChunkDescription |
|
329 /** |
|
330 Output from FindAdjacentChunks. Describes a chunk of text that is of a |
|
331 constant format and directionality. |
|
332 @internalComponent |
|
333 */ |
|
334 { |
|
335 public: |
|
336 /** Position of the first character in the chunk. A negative number |
|
337 indicates "no such chunk". */ |
|
338 TInt iStart; |
|
339 /** One past the position of the last character in the chunk. */ |
|
340 TInt iEnd; |
|
341 /** ETrue if the chunk is displayed right-to-left. */ |
|
342 TBool iRightToLeft; |
|
343 }; |
|
344 |
|
345 IMPORT_C CTmTextLayout(); |
|
346 IMPORT_C ~CTmTextLayout(); |
|
347 IMPORT_C void SetTextL(MTmSource& aSource,const TTmFormatParam& aParam); |
|
348 IMPORT_C void FormatL(const TTmFormatParamBase& aParam,const TTmReformatParam& aReformatParam, |
|
349 TTmReformatResult& TTmReformatResult); |
|
350 IMPORT_C TBool AddParL(const TTmFormatParamBase& aParam,TBool aAtStart,TInt& aHeightIncrease,TInt& aParagraphsIncrease); |
|
351 IMPORT_C TBool DeletePar(const TTmFormatParamBase& aParam,TBool aAtStart,TInt aMaxDeletedHeight,TInt& aHeightDecrease); |
|
352 IMPORT_C void Clear(); |
|
353 IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect, |
|
354 const TLogicalRgb* aDocBackground,TBool aDrawParBackground) const; |
|
355 IMPORT_C void DrawBackground(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect, |
|
356 const TLogicalRgb& aBackground) const; |
|
357 IMPORT_C void InvertLayout(CGraphicsContext& aGc, const TPoint& aTopLeft, |
|
358 TInt aStartDocPos, TInt aEndDocPos) const; |
|
359 IMPORT_C void HighlightSection(CGraphicsContext& aGc, const TPoint& aTopLeft, |
|
360 TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect) const; |
|
361 IMPORT_C void DrawSection(CGraphicsContext& aGc, const TPoint& aTopLeft, |
|
362 TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect) const; |
|
363 /* this function is some what used by partner already */ |
|
364 IMPORT_C void HighlightSection(CGraphicsContext& aGc, const TPoint& aTopLeft, |
|
365 TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect, const TTmHighlightExtensions& aHighlightExtensions, |
|
366 TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const; |
|
367 /* this function is some what used by partner already */ |
|
368 IMPORT_C void InvertLayout(CGraphicsContext& aGc, |
|
369 const TPoint& aTopLeft, TInt aStartDocPos,TInt aEndDocPos, const TTmHighlightExtensions& aHighlightExtensions, |
|
370 TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const; |
|
371 /* this function is some what used by partner already */ |
|
372 IMPORT_C void DrawSection(CGraphicsContext& aGc, const TPoint& aTopLeft, |
|
373 TInt aStartDocPos, TInt aEndDocPos, const TRect& aClipRect, const TTmHighlightExtensions& aHighlightExtensions, |
|
374 TInt aHighlightStartDocPos, TInt aHighlightEndDocPos) const; |
|
375 IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const; |
|
376 IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo) const; |
|
377 IMPORT_C TBool FindXyPosWithDisambiguation(const TPoint& aXyPos, |
|
378 TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight, |
|
379 TTmLineInfo& aLineInfo) const; |
|
380 IMPORT_C TInt FindNextPos(TInt aStart) const; |
|
381 IMPORT_C TInt FindPreviousPos(TInt aStart) const; |
|
382 IMPORT_C TInt Lines() const; |
|
383 IMPORT_C TInt Paragraphs() const; |
|
384 IMPORT_C TBool DocPosToLine(const TTmDocPosSpec& aDocPos,TTmLineInfo& aLineInfo) const; |
|
385 IMPORT_C TBool LineNumberToLine(TInt aLineNumber,TTmLineInfo& aLineInfo) const; |
|
386 IMPORT_C TBool ParNumberToLine(TInt aParNumber,TInt aLineInPar,TTmLineInfo& aLineInfo) const; |
|
387 IMPORT_C TBool YPosToLine(TInt aYPos,TTmLineInfo& aLineInfo) const; |
|
388 IMPORT_C TBool GetDisplayedTextL(TInt aLineNumber,TDes& aText,TInt& aNeeded) const; |
|
389 IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TSize& aSize) const; |
|
390 IMPORT_C void GetMinimumLayoutSizeL(TInt aWrapWidth,TBool aAllowLegalLineBreaksOnly,TSize& aSize) const; |
|
391 IMPORT_C TInt WidthOfWidestLine(TInt aTop = 0,TInt aBottom = KMaxTInt) const; |
|
392 IMPORT_C void HorizontalExtremes(TInt &aLeft, TInt &aRight, |
|
393 TInt aTopY = 0, TInt aBottomY = KMaxTInt) const; |
|
394 IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aInfo,TBool aToLeft) const; |
|
395 IMPORT_C TBool GetNextPosLeftWithDisambiguation(const TTmDocPosSpec& aDocPos, |
|
396 TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const; |
|
397 IMPORT_C TBool GetNextPosRightWithDisambiguation(const TTmDocPosSpec& aDocPos, |
|
398 TTmPosInfo2& aPosLeft, TTmPosInfo2& aPosRight) const; |
|
399 IMPORT_C TBool LineExtreme(const TTmDocPosSpec& aPos, TBool aToRight, |
|
400 TTmDocPos& aExtreme) const; |
|
401 IMPORT_C TBool FindAdjacentChunks(const TTmDocPosSpec& aPos, |
|
402 TTmChunkDescription& aLeft, TTmChunkDescription& aRight) const; |
|
403 IMPORT_C TBool GetCursor(const TTmDocPosSpec& aDocPos,TTmCursorPlacement aPlacement, |
|
404 TTmLineInfo& aLineInfo,TPoint& aOrigin,TInt& aWidth,TInt& aAscent,TInt& aDescent) const; |
|
405 IMPORT_C TInt MemoryUsed() const; |
|
406 inline TInt StartChar() const; |
|
407 inline TInt EndChar() const; |
|
408 inline TInt LayoutWidth() const; |
|
409 inline TInt LayoutHeight() const; |
|
410 inline MTmSource* Source(); |
|
411 inline const MTmSource* Source() const; |
|
412 inline const CTmCode& Code() const; |
|
413 IMPORT_C void MakeVisible(TBool aVisible); |
|
414 TInt GetDrawingInterpFlags() const; |
|
415 IMPORT_C void DeleteFormattingFromEndL( |
|
416 const TTmFormatParamBase& aParam, TInt aMaxDeletedHeight, TInt& aHeightDecrease); |
|
417 IMPORT_C void ExtendFormattingDownwardsL(TTmFormatParam& aParam); |
|
418 |
|
419 // deprecated functions |
|
420 // deprecated 7.0 |
|
421 IMPORT_C TBool GetDisplayedText(TInt aLineNumber,TDes& aText,TInt& aNeeded) const; |
|
422 // deprecated 7.0s |
|
423 IMPORT_C TBool FindDocPos(const TTmDocPos& aDocPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const; |
|
424 // deprecated 7.0s |
|
425 IMPORT_C TBool FindXyPos(const TPoint& aXyPos,TTmPosInfo& aPosInfo,TTmLineInfo& aLineInfo) const; |
|
426 // deprecated 7.0s |
|
427 IMPORT_C TBool GetNextVisualCursorPos(const TTmDocPos& aDocPos,TTmPosInfo& aInfo,TBool aToLeft) const; |
|
428 // deprecated 7.0s |
|
429 IMPORT_C TBool DocPosToLine(const TTmDocPos& aDocPos,TTmLineInfo& aLineInfo) const; |
|
430 // deprecated 7.0s |
|
431 IMPORT_C TBool GetCursor(const TTmDocPos& aDocPos, |
|
432 TTmCursorPlacement aPlacement, TTmLineInfo& aLineInfo, |
|
433 TPoint& aOrigin, TInt& aWidth, TInt& aAscent, TInt& aDescent) const; |
|
434 |
|
435 IMPORT_C void DrawLayout(CGraphicsContext& aGc,const TPoint& aTopLeft,const TRect& aClipRect, |
|
436 const TLogicalRgb* aDocBackground,TBool aDrawParBackground, |
|
437 const TCursorSelection* aHighlight, |
|
438 const TTmHighlightExtensions* aHighlightExtensions) const; |
|
439 IMPORT_C void GetUpdateBoundingRect(TInt aStartDocPos, TInt aEndDocPos, const TPoint& aTopLeft, |
|
440 TRect& aBoundingRect) const; |
|
441 |
|
442 IMPORT_C TBool FindDocPos(const TTmDocPosSpec& aDocPos,TTmPosInfo2& aPosInfo,TTmLineInfo& aLineInfo, TInt& aSubscript) const; |
|
443 void SetCurrentContextChar(TUint aContextChar); |
|
444 TUint GetCurrentContextChar() const; |
|
445 private: |
|
446 TBool LastLine(TTmLineInfo& aLine); |
|
447 #ifdef _DEBUG |
|
448 void Invariant() const; |
|
449 #else |
|
450 void Invariant() const { } |
|
451 #endif |
|
452 void AdjustWidth(const TTmFormatParamBase& aParam,TInt aWidthOfNewText); |
|
453 |
|
454 MTmSource* iSource; // source of text and text attributes; not owned |
|
455 CTmCode iCode; // the layout bytecode |
|
456 TInt iWidth; // width in pixels |
|
457 TInt iHeight; // height in pixels |
|
458 TInt iStartChar; // start character position in the document |
|
459 TInt iEndChar; // end character position in the document |
|
460 TBidirectionalContext* iBdStateAtEnd; //bidirectional state at end of formatted range |
|
461 TInt iDrawingInterpFlags; // flags destined for the RTmDrawingInterpreter object |
|
462 // please try to avoid removing or adding any new members to this class. although it |
|
463 // is internal, it is included by value in CTextLayout which is published. therefore |
|
464 // a size change in this class would mean a size change in CTextLayout and a BC break. |
|
465 // if adding or removing members is unavoidable, please remember to update the dummy |
|
466 // member in CTextLayout accordingly. |
|
467 TUint iCurrentContextChar; // One character of context that is stored here between formatting on lines. |
|
468 // At the end of the formatting of a line, the context for that line is stored |
|
469 // here and taken by the next line to be formatted. The first chunk of the new line |
|
470 // takes this context from the line, and then all subsequent chunks take their context |
|
471 // from the previous chunk. |
|
472 }; |
|
473 |
|
474 |
|
475 //inline functions |
|
476 |
|
477 #ifdef _DEBUG |
|
478 RTmParFormat::~RTmParFormat() |
|
479 { |
|
480 __ASSERT_DEBUG(!iTabList && !iBullet && !HaveBorders(), User::Invariant()); |
|
481 } |
|
482 #endif |
|
483 |
|
484 /** The inequality operator. Returns true if this object and aFormat differ in |
|
485 any way. |
|
486 */ |
|
487 TBool RTmParFormat::operator!=(const RTmParFormat& aFormat) const |
|
488 { |
|
489 return !operator==(aFormat); |
|
490 } |
|
491 |
|
492 /** Returns a reference to the tab selected by aIndex. */ |
|
493 const TTmTab& RTmParFormat::Tab(TInt aIndex) const |
|
494 { |
|
495 return (*iTabList)[aIndex]; |
|
496 } |
|
497 |
|
498 /** Returns a pointer to the TTmBullet object if any. Returns null if the |
|
499 RTmParFormat does not contain a TTmBullet. */ |
|
500 const TTmBullet* RTmParFormat::Bullet() const |
|
501 { |
|
502 return iBullet; |
|
503 } |
|
504 |
|
505 /** Returns a pointer to the border selected by aIndex. Returns null if the |
|
506 selected border is not present. */ |
|
507 const TTmParBorder* RTmParFormat::Border(TBorderIndex aIndex) const |
|
508 { |
|
509 return iBorder[aIndex]; |
|
510 } |
|
511 |
|
512 /** Returns true if the paragraph's base direction is right-to-left. */ |
|
513 TBool RTmParFormat::RightToLeft() const |
|
514 { |
|
515 return iFlags & ERightToLeft; |
|
516 } |
|
517 |
|
518 /** Returns true if wrapping is turned on. */ |
|
519 TBool TTmFormatParamBase::IsWrapping() const |
|
520 { |
|
521 return iFlags & EWrap; |
|
522 } |
|
523 |
|
524 /** Returns true if truncation with ellipsis is turned on. */ |
|
525 TBool TTmFormatParamBase::IsTruncatingWithEllipsis() const |
|
526 { |
|
527 return iFlags & ETruncateWithEllipsis; |
|
528 } |
|
529 |
|
530 /** Returns true if line breaking must only occur at legal line breaks, even if |
|
531 the line cannot legally be broken at the desired wrap width. */ |
|
532 TBool TTmFormatParamBase::LegalLineBreaksOnly() const |
|
533 { |
|
534 return iFlags & ELegalLineBreaksOnly; |
|
535 } |
|
536 |
|
537 |
|
538 /** Returns the first formatted character. */ |
|
539 TInt CTmTextLayout::StartChar() const |
|
540 { |
|
541 return iStartChar; |
|
542 } |
|
543 |
|
544 /** Returns the character after the last formatted character. */ |
|
545 TInt CTmTextLayout::EndChar() const |
|
546 { |
|
547 return iEndChar; |
|
548 } |
|
549 |
|
550 /** Return the width in pixels of the formatted text, not including paragraph |
|
551 labels if present. */ |
|
552 TInt CTmTextLayout::LayoutWidth() const |
|
553 { |
|
554 return iWidth; |
|
555 } |
|
556 |
|
557 /** Returns the height in pixels of the formatted text. */ |
|
558 TInt CTmTextLayout::LayoutHeight() const |
|
559 { |
|
560 return iHeight; |
|
561 } |
|
562 |
|
563 /** Returns a pointer to to the MTmSource object, if any, that provides text |
|
564 and formatting to this object. Returns null if no source object has been set. */ |
|
565 MTmSource* CTmTextLayout::Source() |
|
566 { |
|
567 return iSource; |
|
568 } |
|
569 |
|
570 const MTmSource* CTmTextLayout::Source() const |
|
571 { |
|
572 return iSource; |
|
573 } |
|
574 |
|
575 /** |
|
576 Returns a reference to the CTmCode object containing the bytecode |
|
577 representing the text layout. |
|
578 @internalComponent |
|
579 */ |
|
580 const CTmCode& CTmTextLayout::Code() const |
|
581 { |
|
582 return iCode; |
|
583 } |
|
584 |
|
585 |
|
586 #endif |