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