Update contrib.
1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
21 #include <bidi.h> // class TBidirectionalState::TRunInfo
22 enum CGraphicsContext::TTextAlign;
29 This enumeration holds the possible panic codes that may be raised
30 by the BidiText API on detecting an unrecoverable error.
36 /** The call to RRunInfoArray::OpenL() has not been made prior to this call to TBidiText::SetText()
37 @see TBidiText::SetText */
38 EBidiPanic_RunArrayNull = 0,
40 /** Maximum number of lines that the text will need to be split into is invalid i.e less than zero or negative.
42 @see TBidiText::MinimumSize */
43 EBidiPanic_InvalidMaxline = 1,
45 /** Maximum number of characters are invalid i.e less than zero or negative.
46 @see TBidiText::NewL */
47 EBidiPanic_InvalidReservedMaxLength = 2,
49 /** Maximum width of the text in pixels is invalid i.e zero or negative.
50 @see TBidiText::MinimumSize */
51 EBidiPanic_InvalidWrappingWidth = 3,
53 /** Number of empty pixels between two lines of text are invalid i.e zero or negative.
54 @see TBidiText::MinimumSize */
55 EBidiPanic_InvalidLineGap = 4,
57 /** Text length for display is invalid i.e zero or negative.
58 @see TBidiText::DisplayText
59 @see TBidiText::LineOfDisplayText */
60 EBidiPanic_InvalidVisualOrderedTextLength = 5,
62 /** Line number to retrieve is invalid i.e zero or negative.
63 @see TBidiText::LineOfDisplayText */
64 EBidiPanic_InvalidLineNumber = 6
68 This class works as a replacement for HBufC in those cases where a small
69 amount of text is being formatted simply. The text must be all of one style
70 and broken into lines of all the same length. The number of lines and the text
71 itself is specified on construction, and the text may then be re-broken,
72 re-truncated and re-drawn with non-leaving functions.
79 /** Overall directionality of the text. */
82 /** Text reading begins on the left. */
84 /** Text reading begins on the right. */
88 /** Class specific panic codes
89 @deprecated This enum has been replaced by TBidiPanic.
96 IMPORT_C static TDirectionality ScriptDirectionality(TLanguage aLanguage);
97 IMPORT_C static TDirectionality TextDirectionality(
98 const TDesC& aText, TBool* aFound = 0);
102 IMPORT_C static TBidiText* NewL(TInt aReservedMaxLength, TInt aMaxLines);
103 IMPORT_C static TBidiText* NewL(const TDesC& aText, TInt aMaxLines);
104 IMPORT_C static TBidiText* NewL(const TDesC& aText, TInt aMaxLines,
105 TDirectionality aDirectionality);
106 IMPORT_C TInt SetText(const TDesC& aText, RRunInfoArray& aRunInfoArray);
107 IMPORT_C TInt SetText(const TDesC& aText, TDirectionality aDirectionality, RRunInfoArray& aRunInfoArray);
108 IMPORT_C void SetTruncationChar(TChar aTruncateWith);
109 IMPORT_C void WrapText(TInt aWrappingWidth, const CFont& aFont,
110 const MLineBreaker* aBreaker, TInt aMaxLines);
111 IMPORT_C void WrapText(TInt aWrappingWidth, const CFont& aFont,
112 const MLineBreaker* aBreaker = NULL);
113 IMPORT_C TSize MinimumSize(TInt aWrappingWidth, const CFont& aFont, TInt aLineGap, TInt aMaxLines = -1,
114 const MLineBreaker* aBreaker = NULL) const;
115 IMPORT_C TPtrC Text() const;
116 IMPORT_C TPtrC DisplayText() const;
117 IMPORT_C TInt WrappingWidth() const;
118 IMPORT_C TDirectionality Directionality() const;
119 IMPORT_C TChar TruncationChar() const;
120 IMPORT_C TInt NumberOfLinesInDisplayText() const;
121 IMPORT_C TPtrC LineOfDisplayText(TInt aLine, TInt& aWidthInPixels) const;
122 IMPORT_C void DrawText(CGraphicsContext& aGc, const TPoint& aLeft) const;
123 IMPORT_C void DrawText(CGraphicsContext& aGc,
124 const TPoint& aLeft, TInt aBaseLineSpacing,
125 CGraphicsContext::TTextAlign aAlignment) const;
126 IMPORT_C void DrawText(CGraphicsContext& aGc,
127 const TPoint& aLeft, TInt aBaseLineSpacing) const;
129 TInt DoWrapText(TInt aWrappingWidth, const CFont& aFont, const MLineBreaker* aBreaker,
130 TInt aMaxLines, TText*& aOutputText, TInt& aNumLines, TInt16* aLineWidthArray) const;
135 This class is used to keep track of the shared run info array.
136 Keep it open for as long as the TBidiText object is used. The same
137 RRunInfoArray object can be used with several different TBidiText objects.
143 friend class TBidiText;
146 IMPORT_C RRunInfoArray();
147 IMPORT_C void OpenL();
148 IMPORT_C void Close();
151 TBidirectionalState::TRunInfo* RunArray() const;