|
1 /* |
|
2 * Copyright (c) 1997-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 __TXTSTD_H__ |
|
20 #define __TXTSTD_H__ |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <txtfrmat.h> |
|
24 |
|
25 class TCharFormatX |
|
26 /** |
|
27 The extended character format used internally. |
|
28 As well as the public TCharFormat attributes it stores |
|
29 any attributes that are useful only inside ETEXT. |
|
30 @internalComponent |
|
31 */ |
|
32 { |
|
33 public: |
|
34 TCharFormatX(): iParserTag(0) { } |
|
35 TCharFormatX(const TCharFormat& aCharFormat): iCharFormat(aCharFormat), iParserTag(0) { } |
|
36 |
|
37 TCharFormat iCharFormat; |
|
38 TUint iParserTag; |
|
39 }; |
|
40 |
|
41 /** |
|
42 Attributes not used in the format masks, but used to store system colour indices, etc. |
|
43 This method maintains data compatibility. For example, a paragraph fill colour, including its |
|
44 fourth byte that is used as the system colour index, is selected by a single mask but corresponding |
|
45 to EAttFillColor, but is stored using two attribute flags: one for the three bytes of the RGB colour, |
|
46 and one extra optional one for the system colour index. |
|
47 @internalComponent |
|
48 */ |
|
49 enum TTextFormatNonMaskableAttribute |
|
50 { |
|
51 EAttFillSystemColor = ETextFormatAttributeCount, |
|
52 EAttBulletSystemColor, |
|
53 EAttTopBorderSystemColor, |
|
54 EAttBottomBorderSystemColor, |
|
55 EAttLeftBorderSystemColor, |
|
56 EAttRightBorderSystemColor, |
|
57 EAttTextSystemColor, |
|
58 EAttFontHighlightSystemColor, |
|
59 EAttParaLanguageX, |
|
60 EAttCharLanguageX, |
|
61 EAttBulletX, |
|
62 EAttBitmapType, |
|
63 |
|
64 EExternalizedAttributeCount |
|
65 }; |
|
66 |
|
67 |
|
68 /** |
|
69 Attributes used to mask internal character attributes. |
|
70 @internalComponent |
|
71 */ |
|
72 enum TCharFormatXAttribute |
|
73 { |
|
74 EAttParserTag = EExternalizedAttributeCount, |
|
75 |
|
76 EAttributeCount |
|
77 }; |
|
78 |
|
79 class TCharFormatXMask: public TCharFormatMask |
|
80 /** |
|
81 A mask that can deal with TCharFormatXAttributes as well as TTextFormatAttributes |
|
82 @internalComponent |
|
83 */ |
|
84 { |
|
85 public: |
|
86 TCharFormatXMask(): TCharFormatMask() { } |
|
87 TCharFormatXMask(TCharFormatMask aMask): TCharFormatMask(aMask) { } |
|
88 |
|
89 /* |
|
90 An offset to make extended attribute flags contiguous with ordinary character attributes |
|
91 so that we don't run out of bits if more non-maskable attributes are invented. |
|
92 */ |
|
93 enum |
|
94 { |
|
95 EAttribOffset = EExternalizedAttributeCount - ETextFormatAttributeCount |
|
96 }; |
|
97 |
|
98 void SetAttrib(TTextFormatAttribute aAttribute) |
|
99 { TCharFormatMask::SetAttrib(aAttribute); } |
|
100 void ClearAttrib(TTextFormatAttribute aAttribute) |
|
101 { TCharFormatMask::ClearAttrib(aAttribute); } |
|
102 TBool AttribIsSet(TTextFormatAttribute aAttribute) const |
|
103 { return TCharFormatMask::AttribIsSet(aAttribute); } |
|
104 |
|
105 void SetAttrib(TCharFormatXAttribute aAttribute) |
|
106 { TCharFormatMask::SetAttrib((TTextFormatAttribute)(aAttribute - EAttribOffset)); } |
|
107 void ClearAttrib(TCharFormatXAttribute aAttribute) |
|
108 { TCharFormatMask::ClearAttrib((TTextFormatAttribute)(aAttribute - EAttribOffset)); } |
|
109 TBool AttribIsSet(TCharFormatXAttribute aAttribute) const |
|
110 { return TCharFormatMask::AttribIsSet((TTextFormatAttribute)(aAttribute - EAttribOffset)); } |
|
111 void ClearExtendedAttribs() { ClearAttrib(EAttParserTag); } |
|
112 }; |
|
113 |
|
114 |
|
115 /** |
|
116 @internalComponent |
|
117 */ |
|
118 enum TETextPanic |
|
119 { |
|
120 // General |
|
121 EDebug, |
|
122 EDebugDeleteZeroLength, |
|
123 |
|
124 // Format attributes |
|
125 ETabNotFound, |
|
126 |
|
127 // Format layer storage |
|
128 EAttributeLengthLookupNegative, |
|
129 EStoreTabError, |
|
130 ECannotStoreFormatLayerChain, |
|
131 ECorruptFormatLayerChain, |
|
132 ECorruptFormatLayer, |
|
133 ENullFormatPointer, |
|
134 |
|
135 // Picture Restoration |
|
136 ENullStore, |
|
137 EInvalidPictureFactorySettings, |
|
138 ENullStoreResolver, |
|
139 |
|
140 // Plain text |
|
141 ECharPosBeyondDocument, |
|
142 EConstructCalledTwice, |
|
143 ECopyToStreamNegativeLength, |
|
144 EPasteNegativeLength, |
|
145 EDeleteNegativeLength, |
|
146 ECorruptTextStore, |
|
147 EExtractBufferTooSmall, |
|
148 ENoTextField, |
|
149 EExportLineWrapInvalid, |
|
150 |
|
151 // Global text |
|
152 ENullFormatLayerHandle, |
|
153 EApplyParaFormatNegativeLength, |
|
154 EApplyCharFormatNegativeLength, |
|
155 EGetParaFormatNegativeLength, |
|
156 EGetCharFormatNegativeLength, |
|
157 |
|
158 // Rich text |
|
159 ENullRichTextInsert, |
|
160 EMarkupAlreadyPresent, |
|
161 |
|
162 // Rich text index |
|
163 ERichTextIndexIntegrityErr, |
|
164 EPhraseIxPresentWithNoParaIx, |
|
165 ERichTextIndexReset, |
|
166 ESetInsertCharFormatIntegrityErr, |
|
167 EInsertEmbeddedParaErr, |
|
168 EInsertNullPicHdrData, |
|
169 EDeleteFromParagraphInvalidRange, |
|
170 EDeleteParagraphInvalidStartValue, |
|
171 EDeleteParagraphInvalidEndValue, |
|
172 EReclaimShareError, |
|
173 EParaAttribsNotInSharedList, |
|
174 ERichTextNotSetForUsingStyles, |
|
175 EPictureHeaderIndexOutOfRange, |
|
176 ELostPictureHeader, |
|
177 ESplitPhraseCalledOnSharedPara, |
|
178 ESplitPhraseCalledOnPicturePhrase, |
|
179 EGetPictureSizeCalledOnNonPicturePhrase, |
|
180 EModifiedPicturePhraseLength, |
|
181 EReleasCharFormatLayerOwnershipCalledOnPicturePhrase, |
|
182 ERichTextStorePictureIntegrityError, |
|
183 ERtIndexInternalizeCalledOnNonEmptySource, |
|
184 ERtExternalizeParaIx, |
|
185 ESharedParaCountStreamOverflow, |
|
186 EEndOfSharedParaListEncountered, |
|
187 EPasteParaIxError, |
|
188 EPastePhraseIxErr, |
|
189 ESharedFormatsMapIntegrityError, |
|
190 ESharedFormatsMapOverFlow, |
|
191 EParagraphStyleNegativeLength, |
|
192 EApplyParaStyleNegativeLength, |
|
193 ERemoveSpecificParaFormatNegativeLength, |
|
194 ECopyToClipboardNegativeLength, |
|
195 EClipboardIntegrity, |
|
196 ENonOverloadedInsertCalledWithPictureCharacter, |
|
197 EAppendLFoundInMemoryPicture, |
|
198 |
|
199 // style clipboarding |
|
200 EStyleClipboardIntegrityError, |
|
201 |
|
202 // Paragraph styles |
|
203 EStyleIntegrityError, |
|
204 EStyleIndexOutOfRange, |
|
205 |
|
206 // Front end processor inline editing |
|
207 ENotCurrentlyFepInlineEditing, |
|
208 EAlreadyFepInlineEditing, |
|
209 |
|
210 // Parser system |
|
211 EParserListNotInitialized, |
|
212 EParserListAlreadyExists, |
|
213 EParserListNotActive, |
|
214 EParserCallbackAlreadySet, |
|
215 EParserTagNotFound, |
|
216 EParserListTextIndexNotInitialized, |
|
217 }; |
|
218 |
|
219 /** |
|
220 @internalComponent |
|
221 */ |
|
222 GLREF_C void Panic(TETextPanic aPanic); |
|
223 GLREF_C void ReleaseOnCleanup(TAny* aParaAttribs); |
|
224 GLREF_C void ResetOnCleanup(TAny* aParaFormat); |
|
225 |
|
226 inline void ResetOnCleanupL( CParaFormat* aParaFormat) |
|
227 { |
|
228 CleanupStack::PushL(TCleanupItem(ResetOnCleanup,aParaFormat)); |
|
229 } |
|
230 |
|
231 #if defined(__DLL__) |
|
232 #define DLLEXPORT_C EXPORT_C |
|
233 #else |
|
234 #define DLLEXPORT_C |
|
235 #endif |
|
236 |
|
237 #endif |