167 RParagraphStyleInfo info=iList->At(nn); |
162 RParagraphStyleInfo info=iList->At(nn); |
168 if (info.iStyleForNextPara) |
163 if (info.iStyleForNextPara) |
169 { |
164 { |
170 TInt index=IndexByPtr(info.iStyleForNextPara); |
165 TInt index=IndexByPtr(info.iStyleForNextPara); |
171 // ASSERT: The style-to-follow is present in the list. |
166 // ASSERT: The style-to-follow is present in the list. |
172 if (!((info.iStyleForNextPara==NULL) || |
|
173 ((info.iStyleForNextPara) && (index!=KErrNotFound && index>=0 && index<styleCount)))) |
|
174 { |
|
175 OstTrace0( TRACE_DUMP, CSTYLELIST_DBGTESTINVARIANT, "Invariant" ); |
|
176 } |
|
177 __ASSERT_DEBUG( |
167 __ASSERT_DEBUG( |
178 (info.iStyleForNextPara==NULL) || |
168 (info.iStyleForNextPara==NULL) || |
179 ((info.iStyleForNextPara) && (index!=KErrNotFound && index>=0 && index<styleCount)),User::Invariant()); |
169 ((info.iStyleForNextPara) && (index!=KErrNotFound && index>=0 && index<styleCount)),User::Invariant()); |
180 } |
170 } |
181 } |
171 } |
256 @param aIndex The index of the style into the list. The first style is at |
246 @param aIndex The index of the style into the list. The first style is at |
257 position zero. Must be within the bounds of the array, or a panic occurs. |
247 position zero. Must be within the bounds of the array, or a panic occurs. |
258 @return A const reference to the style at position aIndex in the array. |
248 @return A const reference to the style at position aIndex in the array. |
259 @return A non-const reference to the style at position aIndex in the array. */ |
249 @return A non-const reference to the style at position aIndex in the array. */ |
260 { |
250 { |
261 if (!iList) |
|
262 { |
|
263 OstTrace0( TRACE_FATAL, CSTYLELIST_AT, "EStyleIntegrityError" ); |
|
264 } |
|
265 __ASSERT_ALWAYS(iList,Panic(EStyleIntegrityError)); |
251 __ASSERT_ALWAYS(iList,Panic(EStyleIntegrityError)); |
266 if (aIndex<0 || aIndex>=iList->Count()) |
|
267 { |
|
268 OstTrace0( TRACE_DUMP, DUP3_CSTYLELIST_AT, "EStyleIndexOutOfRange" ); |
|
269 } |
|
270 __ASSERT_DEBUG(aIndex>=0 && aIndex<iList->Count(),Panic(EStyleIndexOutOfRange)); |
252 __ASSERT_DEBUG(aIndex>=0 && aIndex<iList->Count(),Panic(EStyleIndexOutOfRange)); |
271 |
253 |
272 return (*iList)[aIndex]; |
254 return (*iList)[aIndex]; |
273 } |
255 } |
274 |
256 |
275 |
257 |
276 EXPORT_C RParagraphStyleInfo& CStyleList::At(TInt aIndex) |
258 EXPORT_C RParagraphStyleInfo& CStyleList::At(TInt aIndex) |
277 { |
259 { |
278 if (!iList) |
|
279 { |
|
280 OstTrace0( TRACE_FATAL, DUP2_CSTYLELIST_AT, "EStyleIntegrityError" ); |
|
281 } |
|
282 __ASSERT_ALWAYS(iList,Panic(EStyleIntegrityError)); |
260 __ASSERT_ALWAYS(iList,Panic(EStyleIntegrityError)); |
283 if (aIndex<0 || aIndex>=iList->Count()) |
|
284 { |
|
285 OstTrace0( TRACE_DUMP, DUP1_CSTYLELIST_AT, "EStyleIndexOutOfRange" ); |
|
286 } |
|
287 __ASSERT_DEBUG(aIndex>=0 && aIndex<iList->Count(),Panic(EStyleIndexOutOfRange)); |
261 __ASSERT_DEBUG(aIndex>=0 && aIndex<iList->Count(),Panic(EStyleIndexOutOfRange)); |
288 |
262 |
289 return (*iList)[aIndex]; |
263 return (*iList)[aIndex]; |
290 } |
264 } |
291 |
265 |
357 RParagraphStyleInfo set=iList->At(nn); |
331 RParagraphStyleInfo set=iList->At(nn); |
358 CParagraphStyle* style=set.iStyle; |
332 CParagraphStyle* style=set.iStyle; |
359 TInt offset=(set.iStyleForNextPara!=NULL) |
333 TInt offset=(set.iStyleForNextPara!=NULL) |
360 ? IndexByPtr(style) |
334 ? IndexByPtr(style) |
361 : -1; |
335 : -1; |
362 if (!(offset==-1 || (offset>=0 && offset<Count()))) |
|
363 { |
|
364 OstTrace0( TRACE_DUMP, CSTYLELIST_EXTERNALIZEL, "EStyleIntegrityError" ); |
|
365 } |
|
366 __ASSERT_DEBUG(offset==-1 || (offset>=0 && offset<Count()),Panic(EStyleIntegrityError)); |
336 __ASSERT_DEBUG(offset==-1 || (offset>=0 && offset<Count()),Panic(EStyleIntegrityError)); |
367 aStream.WriteInt8L(offset); |
337 aStream.WriteInt8L(offset); |
368 } |
338 } |
369 } |
339 } |
370 |
340 |
454 if (cur_style.iStyle->iBasedOn == aStyle) |
424 if (cur_style.iStyle->iBasedOn == aStyle) |
455 cur_style.iStyle->iBasedOn = NULL; |
425 cur_style.iStyle->iBasedOn = NULL; |
456 if (cur_style.iStyle == aStyle) |
426 if (cur_style.iStyle == aStyle) |
457 { |
427 { |
458 // Assert that the style must occur only once in the style list. |
428 // Assert that the style must occur only once in the style list. |
459 if (index != -1) |
|
460 { |
|
461 OstTrace0( TRACE_DUMP, CSTYLELIST_REMOVE, "EStyleIntegrityError" ); |
|
462 } |
|
463 __ASSERT_DEBUG(index == -1,Panic(EStyleIntegrityError)); |
429 __ASSERT_DEBUG(index == -1,Panic(EStyleIntegrityError)); |
464 index = i; |
430 index = i; |
465 } |
431 } |
466 } |
432 } |
467 |
433 |
491 @param aStyleSet Identifies a style in the list, and a style to use for its |
457 @param aStyleSet Identifies a style in the list, and a style to use for its |
492 following paragraph. |
458 following paragraph. |
493 @return KErrNone if successful, or KErrNotFound if the first style contained |
459 @return KErrNone if successful, or KErrNotFound if the first style contained |
494 in the argument (aStyleSet.iStyle) is not in the style list. */ |
460 in the argument (aStyleSet.iStyle) is not in the style list. */ |
495 { |
461 { |
496 if (IndexByPtr(aStyleSet.iStyleForNextPara) == KErrNotFound) |
|
497 { |
|
498 OstTrace0( TRACE_FATAL, CSTYLELIST_SETSTYLETOFOLLOW, "EStyleIntegrityError" ); |
|
499 } |
|
500 __ASSERT_ALWAYS( IndexByPtr(aStyleSet.iStyleForNextPara) != KErrNotFound, Panic(EStyleIntegrityError) ); |
462 __ASSERT_ALWAYS( IndexByPtr(aStyleSet.iStyleForNextPara) != KErrNotFound, Panic(EStyleIntegrityError) ); |
501 __TEST_INVARIANT; |
463 __TEST_INVARIANT; |
502 |
464 |
503 TInt index = IndexByPtr(aStyleSet.iStyle); |
465 TInt index = IndexByPtr(aStyleSet.iStyle); |
504 if (index == KErrNotFound) |
466 if (index == KErrNotFound) |