68 for (TInt para=0;para<maxPara;para++) |
73 for (TInt para=0;para<maxPara;para++) |
69 { |
74 { |
70 // ASSERT: The basedOn link is valid. |
75 // ASSERT: The basedOn link is valid. |
71 CFormatLayer* thisLayer=(*iParaIx)[para].iParaAttribs->iParaFormat; |
76 CFormatLayer* thisLayer=(*iParaIx)[para].iParaAttribs->iParaFormat; |
72 CFormatLayer* base=CONST_CAST(CFormatLayer*,thisLayer->SenseBase()); |
77 CFormatLayer* base=CONST_CAST(CFormatLayer*,thisLayer->SenseBase()); |
|
78 if (base==NULL) |
|
79 { |
|
80 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_DBGTESTINVARIANT, "base==NULL" ); |
|
81 } |
73 __ASSERT_DEBUG(base!=NULL,User::Invariant()); |
82 __ASSERT_DEBUG(base!=NULL,User::Invariant()); |
74 if ((*iParaIx)[para].iParaAttribs->iRefCount>0) |
83 if ((*iParaIx)[para].iParaAttribs->iRefCount>0) |
75 numberOfReferencesToSharedList++; |
84 numberOfReferencesToSharedList++; |
76 TInt paragraphLength=(*iParaIx)[para].iLength; |
85 TInt paragraphLength=(*iParaIx)[para].iLength; |
77 TInt sumOfPhraseLengths=0; |
86 TInt sumOfPhraseLengths=0; |
81 if (maxPhrase>1) |
90 if (maxPhrase>1) |
82 { |
91 { |
83 const RPhraseAttribsEntry* phrase=&(*iPhraseIx)[currentPhraseElement]; |
92 const RPhraseAttribsEntry* phrase=&(*iPhraseIx)[currentPhraseElement]; |
84 CCharFormatLayer* charFormatLayer=phrase->CharFormat(); |
93 CCharFormatLayer* charFormatLayer=phrase->CharFormat(); |
85 // ASSERT: The basedOn link is valid. |
94 // ASSERT: The basedOn link is valid. |
|
95 if (charFormatLayer->SenseBase()==NULL) |
|
96 { |
|
97 OstTrace0( TRACE_DUMP, DUP1_CRICHTEXTINDEX_DBGTESTINVARIANT, "charFormatLayer->SenseBase()==NULL" ); |
|
98 } |
86 __ASSERT_DEBUG(charFormatLayer->SenseBase()!=NULL,User::Invariant()); |
99 __ASSERT_DEBUG(charFormatLayer->SenseBase()!=NULL,User::Invariant()); |
|
100 if (TInt(charFormatLayer->SenseBase())<=0x1000) |
|
101 { |
|
102 OstTrace0( TRACE_DUMP, DUP2_CRICHTEXTINDEX_DBGTESTINVARIANT, "TInt(charFormatLayer->SenseBase())<=0x1000" ); |
|
103 } |
87 __ASSERT_DEBUG(TInt(charFormatLayer->SenseBase())>0x1000,User::Invariant()); |
104 __ASSERT_DEBUG(TInt(charFormatLayer->SenseBase())>0x1000,User::Invariant()); |
88 sumOfPhraseLengths+=(*iPhraseIx)[currentPhraseElement].Length(); |
105 sumOfPhraseLengths+=(*iPhraseIx)[currentPhraseElement].Length(); |
89 if ((*iPhraseIx)[currentPhraseElement].Length()==0) |
106 if ((*iPhraseIx)[currentPhraseElement].Length()==0) |
90 zeroLengthPhraseCount++; |
107 zeroLengthPhraseCount++; |
91 currentPhraseElement++; |
108 currentPhraseElement++; |
92 } |
109 } |
93 else |
110 else |
94 { |
111 { |
95 CCharFormatLayer* charFormatLayer=(*iParaIx)[para].iParaAttribs->iCharFormat; |
112 CCharFormatLayer* charFormatLayer=(*iParaIx)[para].iParaAttribs->iCharFormat; |
96 // ASSERT: The basedOn link is valid. |
113 // ASSERT: The basedOn link is valid. |
|
114 if (charFormatLayer->SenseBase()==NULL) |
|
115 { |
|
116 OstTrace0( TRACE_DUMP, DUP3_CRICHTEXTINDEX_DBGTESTINVARIANT, "charFormatLayer->SenseBase()==NULL" ); |
|
117 } |
97 __ASSERT_DEBUG(charFormatLayer->SenseBase()!=NULL,User::Invariant()); |
118 __ASSERT_DEBUG(charFormatLayer->SenseBase()!=NULL,User::Invariant()); |
98 sumOfPhraseLengths+=(*iParaIx)[para].iLength; |
119 sumOfPhraseLengths+=(*iParaIx)[para].iLength; |
99 } |
120 } |
100 } |
121 } |
|
122 if (sumOfPhraseLengths!=paragraphLength) |
|
123 { |
|
124 OstTrace0( TRACE_DUMP, DUP4_CRICHTEXTINDEX_DBGTESTINVARIANT, "sumOfPhraseLengths!=paragraphLength" ); |
|
125 } |
101 __ASSERT_DEBUG(sumOfPhraseLengths==paragraphLength,User::Invariant()); |
126 __ASSERT_DEBUG(sumOfPhraseLengths==paragraphLength,User::Invariant()); |
102 } |
127 } |
103 // ASSERT: We have no unexpected phrases left over |
128 // ASSERT: We have no unexpected phrases left over |
|
129 if (currentPhraseElement!=-1 && |
|
130 currentPhraseElement!=iPhraseIx->Count()) |
|
131 { |
|
132 OstTrace0( TRACE_DUMP, DUP5_CRICHTEXTINDEX_DBGTESTINVARIANT, "We have no unexpected phrases left over" ); |
|
133 } |
104 __ASSERT_DEBUG(currentPhraseElement==-1 || |
134 __ASSERT_DEBUG(currentPhraseElement==-1 || |
105 currentPhraseElement==iPhraseIx->Count(),User::Invariant()); |
135 currentPhraseElement==iPhraseIx->Count(),User::Invariant()); |
106 // ASSERT: There is either zero(0) or one(1) zero length phrase in the whole index |
136 // ASSERT: There is either zero(0) or one(1) zero length phrase in the whole index |
|
137 if (!((zeroLengthPhraseCount==0) || |
|
138 (zeroLengthPhraseCount==1 && iPendingNewPhrasePos!=EInsertCharFormatReset))) |
|
139 { |
|
140 OstTrace0( TRACE_DUMP, DUP6_CRICHTEXTINDEX_DBGTESTINVARIANT, "There is either zero(0) or one(1) zero length phrase in the whole index" ); |
|
141 } |
107 __ASSERT_DEBUG( (zeroLengthPhraseCount==0) || |
142 __ASSERT_DEBUG( (zeroLengthPhraseCount==0) || |
108 (zeroLengthPhraseCount==1 && iPendingNewPhrasePos!=EInsertCharFormatReset), |
143 (zeroLengthPhraseCount==1 && iPendingNewPhrasePos!=EInsertCharFormatReset), |
109 User::Invariant()); |
144 User::Invariant()); |
110 // ASSERT: the number of paraEntries with paraAttribs of refCount>0 == the sum of refCounts in the shared list. |
145 // ASSERT: the number of paraEntries with paraAttribs of refCount>0 == the sum of refCounts in the shared list. |
111 // or is only one less - as is set when SetInsertCharFormat is called on a shared paraAttribs. |
146 // or is only one less - as is set when SetInsertCharFormat is called on a shared paraAttribs. |
115 CParaAttribs* currentSharedPara; |
150 CParaAttribs* currentSharedPara; |
116 TDblQueIter<CParaAttribs> iterator(((CRichTextIndex*)this)->iSharedParaQueHead); |
151 TDblQueIter<CParaAttribs> iterator(((CRichTextIndex*)this)->iSharedParaQueHead); |
117 while ((currentSharedPara=iterator++)!=NULL) |
152 while ((currentSharedPara=iterator++)!=NULL) |
118 totalReferenceCount+=currentSharedPara->iRefCount; |
153 totalReferenceCount+=currentSharedPara->iRefCount; |
119 } |
154 } |
|
155 if ((numberOfReferencesToSharedList!=totalReferenceCount) && |
|
156 (numberOfReferencesToSharedList!=totalReferenceCount-1)) |
|
157 { |
|
158 OstTrace0( TRACE_DUMP, DUP7_CRICHTEXTINDEX_DBGTESTINVARIANT, "Invariant" ); |
|
159 } |
120 __ASSERT_DEBUG((numberOfReferencesToSharedList==totalReferenceCount) || |
160 __ASSERT_DEBUG((numberOfReferencesToSharedList==totalReferenceCount) || |
121 (numberOfReferencesToSharedList==totalReferenceCount-1),User::Invariant()); |
161 (numberOfReferencesToSharedList==totalReferenceCount-1),User::Invariant()); |
122 // ASSERT: iPictureCount corresponds to the number of pictures in the stored in the index. |
162 // ASSERT: iPictureCount corresponds to the number of pictures in the stored in the index. |
123 TInt picCount=0; |
163 TInt picCount=0; |
124 TInt phraseCount=(iPhraseIx) ? iPhraseIx->Count() : 0; |
164 TInt phraseCount=(iPhraseIx) ? iPhraseIx->Count() : 0; |
125 for (TInt item=0;item<phraseCount;item++) |
165 for (TInt item=0;item<phraseCount;item++) |
126 picCount+=((*iPhraseIx)[item].IsPicturePhrase()) |
166 picCount+=((*iPhraseIx)[item].IsPicturePhrase()) |
127 ? 1 |
167 ? 1 |
128 : 0; |
168 : 0; |
|
169 if (iPictureCount!=picCount) |
|
170 { |
|
171 OstTrace0( TRACE_DUMP, DUP8_CRICHTEXTINDEX_DBGTESTINVARIANT, "Invariant" ); |
|
172 } |
129 __ASSERT_DEBUG(iPictureCount==picCount,User::Invariant()); |
173 __ASSERT_DEBUG(iPictureCount==picCount,User::Invariant()); |
130 #endif |
174 #endif |
131 } |
175 } |
132 |
176 |
133 |
177 |
209 // unless internalize failed after getting shared list & before getting all para data. |
257 // unless internalize failed after getting shared list & before getting all para data. |
210 CParaAttribs* currentSharedPara; |
258 CParaAttribs* currentSharedPara; |
211 TDblQueIter<CParaAttribs> iterator(iSharedParaQueHead); |
259 TDblQueIter<CParaAttribs> iterator(iSharedParaQueHead); |
212 while ((currentSharedPara=iterator++)!=NULL) |
260 while ((currentSharedPara=iterator++)!=NULL) |
213 currentSharedPara->Release(currentSharedPara->iRefCount); |
261 currentSharedPara->Release(currentSharedPara->iRefCount); |
|
262 if (!iSharedParaQueHead.IsEmpty()) |
|
263 { |
|
264 OstTrace0( TRACE_FATAL, DUP1_CRICHTEXTINDEX_CRICHTEXTINDEX, "ERichTextIndexIntegrityErr" ); |
|
265 } |
214 __ASSERT_ALWAYS(iSharedParaQueHead.IsEmpty(),Panic(ERichTextIndexIntegrityErr)); |
266 __ASSERT_ALWAYS(iSharedParaQueHead.IsEmpty(),Panic(ERichTextIndexIntegrityErr)); |
215 } |
267 } |
216 |
268 |
217 |
269 |
218 TInt CRichTextIndex::CharPosOfParagraph(TInt& aLength,TInt aParaOffset)const |
270 TInt CRichTextIndex::CharPosOfParagraph(TInt& aLength,TInt aParaOffset)const |
395 } |
447 } |
396 for (TInt paraItem=1;paraItem<paragraphCount;paraItem++) |
448 for (TInt paraItem=1;paraItem<paragraphCount;paraItem++) |
397 {// For each para inserted between the fist and last |
449 {// For each para inserted between the fist and last |
398 TParaAttribsEntry& para=(*iParaIx)[pastePos.iParaElement+paraItem]; |
450 TParaAttribsEntry& para=(*iParaIx)[pastePos.iParaElement+paraItem]; |
399 TInt length=ParaLengthFromBuffer(buf)+1; |
451 TInt length=ParaLengthFromBuffer(buf)+1; |
|
452 if (length==KErrNotFound) |
|
453 { |
|
454 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_INSERTL, "EInsertEmbeddedParaErr" ); |
|
455 } |
400 __ASSERT_DEBUG(length!=KErrNotFound,Panic(EInsertEmbeddedParaErr)); |
456 __ASSERT_DEBUG(length!=KErrNotFound,Panic(EInsertEmbeddedParaErr)); |
401 para.iLength=length; |
457 para.iLength=length; |
402 buf.Set(buf.Right(buf.Length()-length)); |
458 buf.Set(buf.Right(buf.Length()-length)); |
403 } |
459 } |
404 // For final paragrph |
460 // For final paragrph |
450 if (current.iPhrase) |
506 if (current.iPhrase) |
451 { |
507 { |
452 current.iPhrase->AdjustLength(-1); // collapse phrase by right amount |
508 current.iPhrase->AdjustLength(-1); // collapse phrase by right amount |
453 if (insertPendingPos!=EInsertCharFormatReset) |
509 if (insertPendingPos!=EInsertCharFormatReset) |
454 { |
510 { |
|
511 if (current.iPhrase->Length()!=0) |
|
512 { |
|
513 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_SPLITPARAGRAPHATPASTEPOSL, "Invariant" ); |
|
514 } |
455 __ASSERT_DEBUG(current.iPhrase->Length()==0,User::Invariant()); |
515 __ASSERT_DEBUG(current.iPhrase->Length()==0,User::Invariant()); |
456 iPendingNewPhrasePos=insertPendingPos; |
516 iPendingNewPhrasePos=insertPendingPos; |
457 } |
517 } |
458 else if (current.iPhrase->Length()==0) |
518 else if (current.iPhrase->Length()==0) |
459 { |
519 { |
460 RemoveFromPhraseIx(iPos.iPhraseElement,1); |
520 RemoveFromPhraseIx(iPos.iPhraseElement,1); |
461 current.iParaAttribs->iPhraseCount--; |
521 current.iParaAttribs->iPhraseCount--; |
|
522 if (current.iParaAttribs->PhraseCount()<=1) |
|
523 { |
|
524 OstTrace0( TRACE_DUMP, DUP1_CRICHTEXTINDEX_SPLITPARAGRAPHATPASTEPOSL, "Invariant" ); |
|
525 } |
462 __ASSERT_DEBUG(current.iParaAttribs->PhraseCount()>1,User::Invariant()); |
526 __ASSERT_DEBUG(current.iParaAttribs->PhraseCount()>1,User::Invariant()); |
463 } |
527 } |
464 } |
528 } |
|
529 OstTrace1( TRACE_DUMP, DUP2_CRICHTEXTINDEX_SPLITPARAGRAPHATPASTEPOSL, "Leave code=%d", ret ); |
465 User::Leave(ret); |
530 User::Leave(ret); |
466 } |
531 } |
467 if (insertPendingPos != EInsertCharFormatReset) |
532 if (insertPendingPos != EInsertCharFormatReset) |
468 ConsolidateAt(insertPendingPos, insertCharFormatDeleted? |
533 ConsolidateAt(insertPendingPos, insertCharFormatDeleted? |
469 EPositionOnly : EFollowingPhrase); |
534 EPositionOnly : EFollowingPhrase); |
488 { |
553 { |
489 __TEST_INVARIANT; |
554 __TEST_INVARIANT; |
490 |
555 |
491 RebalanceIndex(); |
556 RebalanceIndex(); |
492 // ASSERT: A valid picture header, referencing a valid picture has been inserted. |
557 // ASSERT: A valid picture header, referencing a valid picture has been inserted. |
|
558 if (!aPicHdr.iPicture.IsPtr() || aPicHdr.iPicture.AsPtr()==NULL) |
|
559 { |
|
560 OstTrace0( TRACE_FATAL, DUP1_CRICHTEXTINDEX_INSERTL, "EInsertNullPicHdrData" ); |
|
561 } |
493 __ASSERT_ALWAYS(aPicHdr.iPicture.IsPtr() && aPicHdr.iPicture.AsPtr()!=NULL,Panic(EInsertNullPicHdrData)); |
562 __ASSERT_ALWAYS(aPicHdr.iPicture.IsPtr() && aPicHdr.iPicture.AsPtr()!=NULL,Panic(EInsertNullPicHdrData)); |
494 // ASSERT: The current insert pos hasn't been changed without cancelling SetInsertCharFormat. |
563 // ASSERT: The current insert pos hasn't been changed without cancelling SetInsertCharFormat. |
|
564 if ((iPendingNewPhrasePos!=EInsertCharFormatReset) && (aPos!=iPendingNewPhrasePos)) |
|
565 { |
|
566 OstTrace0( TRACE_FATAL, DUP2_CRICHTEXTINDEX_INSERTL, "ESetInsertCharFormatIntegrityErr" ); |
|
567 } |
495 __ASSERT_ALWAYS((iPendingNewPhrasePos==EInsertCharFormatReset) || (aPos==iPendingNewPhrasePos), |
568 __ASSERT_ALWAYS((iPendingNewPhrasePos==EInsertCharFormatReset) || (aPos==iPendingNewPhrasePos), |
496 Panic(ESetInsertCharFormatIntegrityErr)); |
569 Panic(ESetInsertCharFormatIntegrityErr)); |
497 if (iPendingNewPhrasePos!=EInsertCharFormatReset) |
570 if (iPendingNewPhrasePos!=EInsertCharFormatReset) |
498 CancelInsertCharFormat(); // Cancel this state before inserting picture. Rebalances the index. |
571 CancelInsertCharFormat(); // Cancel this state before inserting picture. Rebalances the index. |
499 ScanToPosition(aPos,EScanToPositionMatchLeft); |
572 ScanToPosition(aPos,EScanToPositionMatchLeft); |
514 CleanupStack::PushL(TCleanupItem(ReleaseOnCleanup,reclaimed)); |
587 CleanupStack::PushL(TCleanupItem(ReleaseOnCleanup,reclaimed)); |
515 current.iParaEntry->iParaAttribs=reclaimed; // Use this reclaimed para attribs (the new CParaAttribs instance) |
588 current.iParaEntry->iParaAttribs=reclaimed; // Use this reclaimed para attribs (the new CParaAttribs instance) |
516 } |
589 } |
517 GetCurrentRecords(current); |
590 GetCurrentRecords(current); |
518 // ASSERT: The reclaim succeeded. We must always end up with a PhraseIx-not constant char format. |
591 // ASSERT: The reclaim succeeded. We must always end up with a PhraseIx-not constant char format. |
|
592 if (current.iPhrase==NULL) |
|
593 { |
|
594 OstTrace0( TRACE_DUMP, DUP3_CRICHTEXTINDEX_INSERTL, "EReclaimShareError" ); |
|
595 } |
519 __ASSERT_DEBUG(current.iPhrase!=NULL,Panic(EReclaimShareError)); |
596 __ASSERT_DEBUG(current.iPhrase!=NULL,Panic(EReclaimShareError)); |
520 TRAPD(ret1, |
597 TRAPD(ret1, |
521 SplitPhraseL(aPos)); // Phrase may not be split if at boundary. |
598 SplitPhraseL(aPos)); // Phrase may not be split if at boundary. |
522 |
599 |
523 if (ret1!=KErrNone) |
600 if (ret1!=KErrNone) |
769 __TEST_INVARIANT; // Do not need to RebalanceIndex(); part of defined behaviour for delete. |
846 __TEST_INVARIANT; // Do not need to RebalanceIndex(); part of defined behaviour for delete. |
770 |
847 |
771 CancelInsertCharFormat(); |
848 CancelInsertCharFormat(); |
772 ScanToPosition(aPos,EScanToPositionAbsolute,&iLastUsed); |
849 ScanToPosition(aPos,EScanToPositionAbsolute,&iLastUsed); |
773 |
850 |
|
851 if (iPos.iParaElementOffset!=0) |
|
852 { |
|
853 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_DELETEPARAGRAPH, "EDeleteParagraphInvalidStartValue" ); |
|
854 } |
774 __ASSERT_DEBUG(iPos.iParaElementOffset==0,Panic(EDeleteParagraphInvalidStartValue)); |
855 __ASSERT_DEBUG(iPos.iParaElementOffset==0,Panic(EDeleteParagraphInvalidStartValue)); |
775 |
856 |
776 TIndexDeleteInfo info; |
857 TIndexDeleteInfo info; |
777 info.iDeleteType=TIndexDeleteInfo::EDeleteParagraph; |
858 info.iDeleteType=TIndexDeleteInfo::EDeleteParagraph; |
778 info.iDeletePos=iPos; |
859 info.iDeletePos=iPos; |
811 TCurrentIndexRecords current; |
892 TCurrentIndexRecords current; |
812 GetCurrentRecords(current); |
893 GetCurrentRecords(current); |
813 TInt startParaLength=current.iParaEntry->iLength; |
894 TInt startParaLength=current.iParaEntry->iLength; |
814 TInt lengthRemainingInPara=startParaLength-iPos.iParaElementOffset; |
895 TInt lengthRemainingInPara=startParaLength-iPos.iParaElementOffset; |
815 |
896 |
|
897 if (aLength>=lengthRemainingInPara) |
|
898 { |
|
899 OstTrace0( TRACE_FATAL, CRICHTEXTINDEX_DELETEFROMPARAGRAPH, "EDeleteFromParagraphInvalidRange" ); |
|
900 } |
816 __ASSERT_ALWAYS(aLength<lengthRemainingInPara,Panic(EDeleteFromParagraphInvalidRange)); |
901 __ASSERT_ALWAYS(aLength<lengthRemainingInPara,Panic(EDeleteFromParagraphInvalidRange)); |
817 } |
902 } |
818 #endif |
903 #endif |
819 |
904 |
820 TIndexDeleteInfo info; |
905 TIndexDeleteInfo info; |
1026 movement etc. Split the current phrase at aPos (if necessary) and insert a zero |
1111 movement etc. Split the current phrase at aPos (if necessary) and insert a zero |
1027 length phrase, ready to accept the pending content of the specified format. |
1112 length phrase, ready to accept the pending content of the specified format. |
1028 */ |
1113 */ |
1029 void CRichTextIndex::SetInsertCharFormatL(const TCharFormatX& aFormat,const TCharFormatXMask& aMask,TInt aPos) |
1114 void CRichTextIndex::SetInsertCharFormatL(const TCharFormatX& aFormat,const TCharFormatXMask& aMask,TInt aPos) |
1030 { |
1115 { |
|
1116 if (InsertCharFormatIsActive() && aPos!=iPendingNewPhrasePos) |
|
1117 { |
|
1118 OstTrace0( TRACE_FATAL, CRICHTEXTINDEX_SETINSERTCHARFORMATL, "ESetInsertCharFormatIntegrityErr" ); |
|
1119 } |
1031 __ASSERT_ALWAYS(!InsertCharFormatIsActive() || aPos==iPendingNewPhrasePos, |
1120 __ASSERT_ALWAYS(!InsertCharFormatIsActive() || aPos==iPendingNewPhrasePos, |
1032 Panic(ESetInsertCharFormatIntegrityErr)); |
1121 Panic(ESetInsertCharFormatIntegrityErr)); |
1033 if (InsertCharFormatIsActive()) |
1122 if (InsertCharFormatIsActive()) |
1034 UpdateInsertCharFormatL(aFormat, aMask); |
1123 UpdateInsertCharFormatL(aFormat, aMask); |
1035 else |
1124 else |
1037 } |
1126 } |
1038 |
1127 |
1039 void CRichTextIndex::NewInsertCharFormatL(const TCharFormatX& aFormat, |
1128 void CRichTextIndex::NewInsertCharFormatL(const TCharFormatX& aFormat, |
1040 const TCharFormatXMask& aMask, TInt aPos) |
1129 const TCharFormatXMask& aMask, TInt aPos) |
1041 { |
1130 { |
|
1131 if (InsertCharFormatIsActive()) |
|
1132 { |
|
1133 OstTrace0( TRACE_FATAL, CRICHTEXTINDEX_NEWINSERTCHARFORMATL, "ESetInsertCharFormatIntegrityErr" ); |
|
1134 } |
1042 __ASSERT_ALWAYS(!InsertCharFormatIsActive(), |
1135 __ASSERT_ALWAYS(!InsertCharFormatIsActive(), |
1043 Panic(ESetInsertCharFormatIntegrityErr)); |
1136 Panic(ESetInsertCharFormatIntegrityErr)); |
1044 ScanToPosition(aPos,EScanToPositionMatchLeft); |
1137 ScanToPosition(aPos,EScanToPositionMatchLeft); |
1045 TCurrentIndexRecords current; |
1138 TCurrentIndexRecords current; |
1046 GetCurrentRecords(current); |
1139 GetCurrentRecords(current); |
1087 CleanupStack::PopAndDestroy(newLayer); |
1181 CleanupStack::PopAndDestroy(newLayer); |
1088 } |
1182 } |
1089 |
1183 |
1090 CCharFormatLayer* CRichTextIndex::GetCurrentInsertCharFormat() |
1184 CCharFormatLayer* CRichTextIndex::GetCurrentInsertCharFormat() |
1091 { |
1185 { |
|
1186 if (!InsertCharFormatIsActive()) |
|
1187 { |
|
1188 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_GETCURRENTINSERTCHARFORMAT, "ESetInsertCharFormatIntegrityErr" ); |
|
1189 } |
1092 __ASSERT_DEBUG(InsertCharFormatIsActive(), |
1190 __ASSERT_DEBUG(InsertCharFormatIsActive(), |
1093 Panic(ESetInsertCharFormatIntegrityErr)); |
1191 Panic(ESetInsertCharFormatIntegrityErr)); |
1094 ScanToPosition(iPendingNewPhrasePos,EScanToPositionMatchLeft); |
1192 ScanToPosition(iPendingNewPhrasePos,EScanToPositionMatchLeft); |
1095 TCurrentIndexRecords current; |
1193 TCurrentIndexRecords current; |
1096 GetCurrentRecords(current); |
1194 GetCurrentRecords(current); |
|
1195 if ((*iPhraseIx)[iPos.iPhraseElement].Length() != 0) |
|
1196 { |
|
1197 OstTrace0( TRACE_DUMP, DUP1_CRICHTEXTINDEX_GETCURRENTINSERTCHARFORMAT, "ESetInsertCharFormatIntegrityErr" ); |
|
1198 } |
1097 __ASSERT_DEBUG((*iPhraseIx)[iPos.iPhraseElement].Length() == 0, |
1199 __ASSERT_DEBUG((*iPhraseIx)[iPos.iPhraseElement].Length() == 0, |
1098 Panic(ESetInsertCharFormatIntegrityErr)); |
1200 Panic(ESetInsertCharFormatIntegrityErr)); |
1099 return (*iPhraseIx)[iPos.iPhraseElement].CharFormat(); |
1201 return (*iPhraseIx)[iPos.iPhraseElement].CharFormat(); |
1100 } |
1202 } |
1101 |
1203 |
1152 @pre The insert character format must be active |
1258 @pre The insert character format must be active |
1153 @return ETrue if a zero-length phrase was deleted. |
1259 @return ETrue if a zero-length phrase was deleted. |
1154 */ |
1260 */ |
1155 TBool CRichTextIndex::DeleteInsertCharFormat() |
1261 TBool CRichTextIndex::DeleteInsertCharFormat() |
1156 { |
1262 { |
|
1263 if (!InsertCharFormatIsActive()) |
|
1264 { |
|
1265 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_DELETEINSERTCHARFORMAT, "Invariant" ); |
|
1266 } |
1157 __ASSERT_DEBUG(InsertCharFormatIsActive(), User::Invariant()); |
1267 __ASSERT_DEBUG(InsertCharFormatIsActive(), User::Invariant()); |
1158 ScanToPosition(iPendingNewPhrasePos,EScanToPositionMatchLeft); |
1268 ScanToPosition(iPendingNewPhrasePos,EScanToPositionMatchLeft); |
1159 TCurrentIndexRecords current; |
1269 TCurrentIndexRecords current; |
1160 GetCurrentRecords(current); |
1270 GetCurrentRecords(current); |
1161 if (current.iPhrase && current.iPhrase->Length() == 0) |
1271 if (current.iPhrase && current.iPhrase->Length() == 0) |
1453 } |
1563 } |
1454 |
1564 |
1455 |
1565 |
1456 void CRichTextIndex::SplitPhraseL(TInt aPhrase,TInt anOffset,RPhraseAttribsEntry& aPhraseAttribs,CParaAttribs& aParaAttribs) |
1566 void CRichTextIndex::SplitPhraseL(TInt aPhrase,TInt anOffset,RPhraseAttribsEntry& aPhraseAttribs,CParaAttribs& aParaAttribs) |
1457 { |
1567 { |
|
1568 if (anOffset<=0 || anOffset>=aPhraseAttribs.Length()) |
|
1569 { |
|
1570 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_SPLITPHRASEL, "Invariant" ); |
|
1571 } |
1458 __ASSERT_DEBUG(anOffset>0 && anOffset<aPhraseAttribs.Length(),User::Invariant()); |
1572 __ASSERT_DEBUG(anOffset>0 && anOffset<aPhraseAttribs.Length(),User::Invariant()); |
1459 // |
1573 // |
1460 CCharFormatLayer* charLayer=CCharFormatLayer::NewCopyBaseL(aPhraseAttribs.CharFormat()); |
1574 CCharFormatLayer* charLayer=CCharFormatLayer::NewCopyBaseL(aPhraseAttribs.CharFormat()); |
1461 CleanupStack::PushL(charLayer); |
1575 CleanupStack::PushL(charLayer); |
1462 iPhraseIx->InsertL(aPhrase+1,RPhraseAttribsEntry(charLayer,aPhraseAttribs.Length()-anOffset)); |
1576 iPhraseIx->InsertL(aPhrase+1,RPhraseAttribsEntry(charLayer,aPhraseAttribs.Length()-anOffset)); |
1485 // |
1599 // |
1486 // aParaEntry is not shared and can be (phrase count 1), aPhrase is the single phrase element |
1600 // aParaEntry is not shared and can be (phrase count 1), aPhrase is the single phrase element |
1487 // |
1601 // |
1488 { |
1602 { |
1489 CParaAttribs* paraAttribs=aParaEntry.iParaAttribs; |
1603 CParaAttribs* paraAttribs=aParaEntry.iParaAttribs; |
|
1604 if (paraAttribs->iPhraseCount!=1) |
|
1605 { |
|
1606 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_SHARE, "Invariant" ); |
|
1607 } |
1490 __ASSERT_DEBUG(paraAttribs->iPhraseCount==1,User::Invariant()); |
1608 __ASSERT_DEBUG(paraAttribs->iPhraseCount==1,User::Invariant()); |
1491 |
1609 |
1492 RPhraseAttribsEntry& phraseAttribs=iPhraseIx->At(aPhrase); |
1610 RPhraseAttribsEntry& phraseAttribs=iPhraseIx->At(aPhrase); |
|
1611 if (phraseAttribs.IsPicturePhrase()) |
|
1612 { |
|
1613 OstTrace0( TRACE_DUMP, DUP1_CRICHTEXTINDEX_SHARE, "Invariant" ); |
|
1614 } |
1493 __ASSERT_DEBUG(!phraseAttribs.IsPicturePhrase(),User::Invariant()); |
1615 __ASSERT_DEBUG(!phraseAttribs.IsPicturePhrase(),User::Invariant()); |
1494 |
1616 |
1495 CParaAttribs* share=GetParaAttribs(paraAttribs,*phraseAttribs.CharFormat()); |
1617 CParaAttribs* share=GetParaAttribs(paraAttribs,*phraseAttribs.CharFormat()); |
1496 if (share!=paraAttribs) |
1618 if (share!=paraAttribs) |
1497 { // re-use an existing share, so release the current attribs |
1619 { // re-use an existing share, so release the current attribs |
1520 if (paraAttribs->IsShared()) |
1642 if (paraAttribs->IsShared()) |
1521 return; |
1643 return; |
1522 |
1644 |
1523 TInt phrase=iPos.iPhraseElement; |
1645 TInt phrase=iPos.iPhraseElement; |
1524 TInt base=iPos.iParaBasePhraseElement; |
1646 TInt base=iPos.iParaBasePhraseElement; |
|
1647 if (phrase<base || phrase>=base+paraAttribs->iPhraseCount) |
|
1648 { |
|
1649 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_APPLYCHARFORMATROLLBACK, "Invariant" ); |
|
1650 } |
1525 __ASSERT_DEBUG(phrase>=base && phrase<base+paraAttribs->iPhraseCount,User::Invariant()); |
1651 __ASSERT_DEBUG(phrase>=base && phrase<base+paraAttribs->iPhraseCount,User::Invariant()); |
1526 if (phrase<base+paraAttribs->iPhraseCount-1) // merge to the right |
1652 if (phrase<base+paraAttribs->iPhraseCount-1) // merge to the right |
1527 MergePhrases(phrase+1,iPhraseIx->At(phrase+1),*paraAttribs); |
1653 MergePhrases(phrase+1,iPhraseIx->At(phrase+1),*paraAttribs); |
1528 if (phrase>base) // merge to the left |
1654 if (phrase>base) // merge to the left |
1529 MergePhrases(phrase,iPhraseIx->At(phrase),*paraAttribs); |
1655 MergePhrases(phrase,iPhraseIx->At(phrase),*paraAttribs); |
1535 void CRichTextIndex::ApplyCharFormatL(const TCharFormatX& aFormat,const TCharFormatXMask& aMask,TInt aPos,TInt aLength,TBool aRemoveSpecific) |
1661 void CRichTextIndex::ApplyCharFormatL(const TCharFormatX& aFormat,const TCharFormatXMask& aMask,TInt aPos,TInt aLength,TBool aRemoveSpecific) |
1536 // Applies the specified character formatting to the characters contained within the range |
1662 // Applies the specified character formatting to the characters contained within the range |
1537 // aPos to aPos+(aLength-1). |
1663 // aPos to aPos+(aLength-1). |
1538 // |
1664 // |
1539 { |
1665 { |
|
1666 if (aLength<0) |
|
1667 { |
|
1668 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_APPLYCHARFORMATL, "Invariant" ); |
|
1669 } |
1540 __ASSERT_DEBUG(aLength>=0,User::Invariant()); |
1670 __ASSERT_DEBUG(aLength>=0,User::Invariant()); |
1541 __TEST_INVARIANT; |
1671 __TEST_INVARIANT; |
1542 |
1672 |
1543 ScanToPosition(aPos,EScanToPositionAbsolute); |
1673 ScanToPosition(aPos,EScanToPositionAbsolute); |
1544 TInt paraOffset=iPos.iParaElementOffset; |
1674 TInt paraOffset=iPos.iParaElementOffset; |
1588 // STEP 2. Walk through all affected phrases in this paragraph |
1718 // STEP 2. Walk through all affected phrases in this paragraph |
1589 // For each one, we may need to split it, and then apply the new format |
1719 // For each one, we may need to split it, and then apply the new format |
1590 |
1720 |
1591 do |
1721 do |
1592 { |
1722 { |
|
1723 if (phrase>=iPos.iParaBasePhraseElement+paraAttribs->iPhraseCount) |
|
1724 { |
|
1725 OstTrace0( TRACE_DUMP, DUP1_CRICHTEXTINDEX_APPLYCHARFORMATL, "Invariant" ); |
|
1726 } |
1593 __ASSERT_DEBUG(phrase<iPos.iParaBasePhraseElement+paraAttribs->iPhraseCount,User::Invariant()); |
1727 __ASSERT_DEBUG(phrase<iPos.iParaBasePhraseElement+paraAttribs->iPhraseCount,User::Invariant()); |
1594 // |
1728 // |
1595 RPhraseAttribsEntry* phraseAttribs=&iPhraseIx->At(phrase); |
1729 RPhraseAttribsEntry* phraseAttribs=&iPhraseIx->At(phrase); |
1596 TInt len=phraseAttribs->Length(); |
1730 TInt len=phraseAttribs->Length(); |
1597 |
1731 |
1625 SplitPhraseL(phrase,charsToFormat,*phraseAttribs,*paraAttribs); |
1759 SplitPhraseL(phrase,charsToFormat,*phraseAttribs,*paraAttribs); |
1626 len=charsToFormat; |
1760 len=charsToFormat; |
1627 phraseAttribs=&iPhraseIx->At(phrase); // SplitPhraseL modifies the index array, we must do this! |
1761 phraseAttribs=&iPhraseIx->At(phrase); // SplitPhraseL modifies the index array, we must do this! |
1628 } |
1762 } |
1629 |
1763 |
|
1764 if (phraseAttribs->Length()!=len) |
|
1765 { |
|
1766 OstTrace0( TRACE_DUMP, DUP2_CRICHTEXTINDEX_APPLYCHARFORMATL, "Invariant" ); |
|
1767 } |
1630 __ASSERT_DEBUG(phraseAttribs->Length()==len,User::Invariant()); |
1768 __ASSERT_DEBUG(phraseAttribs->Length()==len,User::Invariant()); |
1631 |
1769 |
1632 // STEP 2.3 Change the format of the current phrase layer |
1770 // STEP 2.3 Change the format of the current phrase layer |
1633 |
1771 |
1634 TCharFormatX format=aFormat; |
1772 TCharFormatX format=aFormat; |
1670 iPos.iParaElement++; |
1812 iPos.iParaElement++; |
1671 paraOffset=0; |
1813 paraOffset=0; |
1672 iPos.iParaBasePhraseElement=phrase; |
1814 iPos.iParaBasePhraseElement=phrase; |
1673 #ifdef _DEBUG |
1815 #ifdef _DEBUG |
1674 ScanToPosition(aPos,EScanToPositionAbsolute); |
1816 ScanToPosition(aPos,EScanToPositionAbsolute); |
|
1817 if (iPos.iDocPos!=aPos) |
|
1818 { |
|
1819 OstTrace0( TRACE_DUMP, DUP4_CRICHTEXTINDEX_APPLYCHARFORMATL, "Invariant" ); |
|
1820 } |
1675 __ASSERT_DEBUG(iPos.iDocPos==aPos,User::Invariant()); |
1821 __ASSERT_DEBUG(iPos.iDocPos==aPos,User::Invariant()); |
|
1822 if (iPos.iPhraseElement!=phrase) |
|
1823 { |
|
1824 OstTrace0( TRACE_DUMP, DUP5_CRICHTEXTINDEX_APPLYCHARFORMATL, "Invariant" ); |
|
1825 } |
1676 __ASSERT_DEBUG(iPos.iPhraseElement==phrase,User::Invariant()); |
1826 __ASSERT_DEBUG(iPos.iPhraseElement==phrase,User::Invariant()); |
|
1827 if (iPos.iParaElementOffset!=paraOffset) |
|
1828 { |
|
1829 OstTrace0( TRACE_DUMP, DUP6_CRICHTEXTINDEX_APPLYCHARFORMATL, "Invariant" ); |
|
1830 } |
1677 __ASSERT_DEBUG(iPos.iParaElementOffset==paraOffset,User::Invariant()); |
1831 __ASSERT_DEBUG(iPos.iParaElementOffset==paraOffset,User::Invariant()); |
|
1832 if (iPos.iPhraseElementOffset!=phraseOffset) |
|
1833 { |
|
1834 OstTrace0( TRACE_DUMP, DUP7_CRICHTEXTINDEX_APPLYCHARFORMATL, "Invariant" ); |
|
1835 } |
1678 __ASSERT_DEBUG(iPos.iPhraseElementOffset==phraseOffset,User::Invariant()); |
1836 __ASSERT_DEBUG(iPos.iPhraseElementOffset==phraseOffset,User::Invariant()); |
1679 __TEST_INVARIANT; |
1837 __TEST_INVARIANT; |
1680 #endif |
1838 #endif |
1681 } |
1839 } |
1682 |
1840 |
2225 if (handle) |
2383 if (handle) |
2226 return handle; |
2384 return handle; |
2227 else |
2385 else |
2228 {// No match, so piece together new shared paraAttribs and add to shared para list |
2386 {// No match, so piece together new shared paraAttribs and add to shared para list |
2229 sourceParaAttribs->iRefCount=1; |
2387 sourceParaAttribs->iRefCount=1; |
|
2388 if (sourcePhrase->IsPicturePhrase()) |
|
2389 { |
|
2390 OstTrace0( TRACE_FATAL, CRICHTEXTINDEX_GETPARAATTRIBS, "EReleasCharFormatLayerOwnershipCalledOnPicturePhrase" ); |
|
2391 } |
2230 __ASSERT_ALWAYS(!sourcePhrase->IsPicturePhrase(),Panic(EReleasCharFormatLayerOwnershipCalledOnPicturePhrase)); |
2392 __ASSERT_ALWAYS(!sourcePhrase->IsPicturePhrase(),Panic(EReleasCharFormatLayerOwnershipCalledOnPicturePhrase)); |
2231 sourceParaAttribs->iCharFormat=sourcePhrase->ReleaseCharFormatLayerOwnership(); |
2393 sourceParaAttribs->iCharFormat=sourcePhrase->ReleaseCharFormatLayerOwnership(); |
2232 sourcePhrase->Discard(); |
2394 sourcePhrase->Discard(); |
2233 iPhraseIx->Delete(aLogicalPosition.iPhraseElement); // remove the deleted phrase from the phrase index. |
2395 iPhraseIx->Delete(aLogicalPosition.iPhraseElement); // remove the deleted phrase from the phrase index. |
2234 iSharedParaQueHead.AddLast(*sourceParaAttribs); |
2396 iSharedParaQueHead.AddLast(*sourceParaAttribs); |
2458 ScanToPosition(aSplitPos,EScanToPositionAbsolute); |
2624 ScanToPosition(aSplitPos,EScanToPositionAbsolute); |
2459 if (iPos.iPhraseElementOffset==0) |
2625 if (iPos.iPhraseElementOffset==0) |
2460 return; // aSplitPos on a phrase boundary; urgo no split. |
2626 return; // aSplitPos on a phrase boundary; urgo no split. |
2461 TCurrentIndexRecords current; GetCurrentRecords(current); |
2627 TCurrentIndexRecords current; GetCurrentRecords(current); |
2462 // ASSERT: This function set can only be called on CParaAttribs that specific char format. |
2628 // ASSERT: This function set can only be called on CParaAttribs that specific char format. |
|
2629 if (current.iPhrase==NULL) |
|
2630 { |
|
2631 OstTrace0( TRACE_FATAL, DUP1_CRICHTEXTINDEX_SPLITPHRASEL, "ESplitPhraseCalledOnSharedPara" ); |
|
2632 } |
2463 __ASSERT_ALWAYS(current.iPhrase!=NULL,Panic(ESplitPhraseCalledOnSharedPara)); |
2633 __ASSERT_ALWAYS(current.iPhrase!=NULL,Panic(ESplitPhraseCalledOnSharedPara)); |
2464 DoSplitPhraseL(*current.iPhrase,iPos.iPhraseElementOffset,current.iParaAttribs); |
2634 DoSplitPhraseL(*current.iPhrase,iPos.iPhraseElementOffset,current.iParaAttribs); |
2465 } |
2635 } |
2466 |
2636 |
2467 |
2637 |
2487 // Splits the specified phrase, creating a new phrase of the same character format. |
2657 // Splits the specified phrase, creating a new phrase of the same character format. |
2488 // This new phrase is inserted into the phrase index immediately following the current one. |
2658 // This new phrase is inserted into the phrase index immediately following the current one. |
2489 // |
2659 // |
2490 { |
2660 { |
2491 // ASSERT: Cannot split a picture phrase. |
2661 // ASSERT: Cannot split a picture phrase. |
|
2662 if (aCurrentPhrase.IsPicturePhrase()) |
|
2663 { |
|
2664 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_DOSPLITPHRASEL, "ESplitPhraseCalledOnPicturePhrase" ); |
|
2665 } |
2492 __ASSERT_DEBUG(!aCurrentPhrase.IsPicturePhrase(),Panic(ESplitPhraseCalledOnPicturePhrase)); |
2666 __ASSERT_DEBUG(!aCurrentPhrase.IsPicturePhrase(),Panic(ESplitPhraseCalledOnPicturePhrase)); |
2493 CCharFormatLayer* layer=CCharFormatLayer::NewCopyBaseL(aCurrentPhrase.CharFormat()); |
2667 CCharFormatLayer* layer=CCharFormatLayer::NewCopyBaseL(aCurrentPhrase.CharFormat()); |
2494 CleanupStack::PushL(layer); |
2668 CleanupStack::PushL(layer); |
2495 RPhraseAttribsEntry newPhrase(layer,aCurrentPhrase.Length()-aPhraseOffset); |
2669 RPhraseAttribsEntry newPhrase(layer,aCurrentPhrase.Length()-aPhraseOffset); |
2496 iPhraseIx->InsertL(iPos.iPhraseElement+1,newPhrase); |
2670 iPhraseIx->InsertL(iPos.iPhraseElement+1,newPhrase); |
2518 TInt phraseCount=PhraseCount(); |
2692 TInt phraseCount=PhraseCount(); |
2519 if (phraseCount>0) |
2693 if (phraseCount>0) |
2520 return ETrue; |
2694 return ETrue; |
2521 // |
2695 // |
2522 TInt sharedParaCount=SharedParaCount(this); |
2696 TInt sharedParaCount=SharedParaCount(this); |
|
2697 if (sharedParaCount<1 && (sharedParaCount!=0 || phraseCount<=0)) |
|
2698 { |
|
2699 OstTrace0( TRACE_FATAL, CRICHTEXTINDEX_HASMARKUPDATA, "ERichTextIndexIntegrityErr" ); |
|
2700 } |
2523 __ASSERT_ALWAYS(sharedParaCount>=1 || (sharedParaCount==0 && phraseCount>0),Panic(ERichTextIndexIntegrityErr)); |
2701 __ASSERT_ALWAYS(sharedParaCount>=1 || (sharedParaCount==0 && phraseCount>0),Panic(ERichTextIndexIntegrityErr)); |
2524 if (sharedParaCount>1) |
2702 if (sharedParaCount>1) |
2525 return ETrue; |
2703 return ETrue; |
2526 const CParaAttribs* paraAttribs=iSharedParaQueHead.First(); |
2704 const CParaAttribs* paraAttribs=iSharedParaQueHead.First(); |
2527 if (!paraAttribs->iParaFormat->IsEmpty()) |
2705 if (!paraAttribs->iParaFormat->IsEmpty()) |
2590 const CParaAttribs* sParaAttribs=sParaEntry.iParaAttribs; |
2768 const CParaAttribs* sParaAttribs=sParaEntry.iParaAttribs; |
2591 CParaAttribs* tParaAttribs; |
2769 CParaAttribs* tParaAttribs; |
2592 if (sParaAttribs->IsShared()) |
2770 if (sParaAttribs->IsShared()) |
2593 { |
2771 { |
2594 tParaAttribs=map->Item(sParaAttribs); |
2772 tParaAttribs=map->Item(sParaAttribs); |
|
2773 if (tParaAttribs==NULL) |
|
2774 { |
|
2775 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_APPENDPARAINDEXL, "ESharedFormatsMapIntegrityError" ); |
|
2776 } |
2595 __ASSERT_DEBUG(tParaAttribs!=NULL,Panic(ESharedFormatsMapIntegrityError)); |
2777 __ASSERT_DEBUG(tParaAttribs!=NULL,Panic(ESharedFormatsMapIntegrityError)); |
2596 tParaAttribs->iRefCount++; |
2778 tParaAttribs->iRefCount++; |
2597 } |
2779 } |
2598 else |
2780 else |
2599 {// Have to build up the specific para attribs |
2781 {// Have to build up the specific para attribs |
2623 { |
2805 { |
2624 TDblQueIter<CParaAttribs> iterator(MUTABLE_CAST(TDblQue<CParaAttribs>&,aSource->iSharedParaQueHead)); |
2806 TDblQueIter<CParaAttribs> iterator(MUTABLE_CAST(TDblQue<CParaAttribs>&,aSource->iSharedParaQueHead)); |
2625 CParaAttribs* currentSharedPara; |
2807 CParaAttribs* currentSharedPara; |
2626 while ((currentSharedPara=iterator++)!=NULL) |
2808 while ((currentSharedPara=iterator++)!=NULL) |
2627 { |
2809 { |
|
2810 if (!currentSharedPara->IsShared()) |
|
2811 { |
|
2812 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_APPENDSHAREDFORMATSL, "Invariant" ); |
|
2813 } |
2628 __ASSERT_DEBUG(currentSharedPara->IsShared(),User::Invariant()); |
2814 __ASSERT_DEBUG(currentSharedPara->IsShared(),User::Invariant()); |
2629 |
2815 |
2630 CParaFormatLayer* sPl=currentSharedPara->iParaFormat; |
2816 CParaFormatLayer* sPl=currentSharedPara->iParaFormat; |
2631 CCharFormatLayer* sCl=currentSharedPara->iCharFormat; |
2817 CCharFormatLayer* sCl=currentSharedPara->iCharFormat; |
2632 sPl->SetBase(aGlobalLayerInfo.iAggParaFormatLayer); // alter the original so that the following GetParaAttribsL() call will |
2818 sPl->SetBase(aGlobalLayerInfo.iAggParaFormatLayer); // alter the original so that the following GetParaAttribsL() call will |
2687 // transfer pictures now |
2873 // transfer pictures now |
2688 for (TInt kk=pictureMap->Count();--kk>=0;) |
2874 for (TInt kk=pictureMap->Count();--kk>=0;) |
2689 { |
2875 { |
2690 TInt jj=pictureMap->At(kk); |
2876 TInt jj=pictureMap->At(kk); |
2691 TPictureHeader* sHeader=(*aSource->iPhraseIx)[jj].PictureHeaderPtr(); |
2877 TPictureHeader* sHeader=(*aSource->iPhraseIx)[jj].PictureHeaderPtr(); |
|
2878 if (!sHeader) |
|
2879 { |
|
2880 OstTrace0( TRACE_DUMP, CRICHTEXTINDEX_APPENDPHRASEINDEXL, "Invariant" ); |
|
2881 } |
2692 __ASSERT_DEBUG(sHeader,User::Invariant()); |
2882 __ASSERT_DEBUG(sHeader,User::Invariant()); |
2693 if (sHeader->iPicture.IsPtr()) |
2883 if (sHeader->iPicture.IsPtr()) |
2694 { // transfer picture to us |
2884 { // transfer picture to us |
2695 TPictureHeader* tHeader=(*iPhraseIx)[jj+originalPhraseCount].PictureHeaderPtr(); |
2885 TPictureHeader* tHeader=(*iPhraseIx)[jj+originalPhraseCount].PictureHeaderPtr(); |
|
2886 if (!tHeader) |
|
2887 { |
|
2888 OstTrace0( TRACE_DUMP, DUP1_CRICHTEXTINDEX_APPENDPHRASEINDEXL, "Invariant" ); |
|
2889 } |
2696 __ASSERT_DEBUG(tHeader,User::Invariant()); |
2890 __ASSERT_DEBUG(tHeader,User::Invariant()); |
2697 tHeader->iPicture=sHeader->iPicture.AsPtr(); |
2891 tHeader->iPicture=sHeader->iPicture.AsPtr(); |
2698 sHeader->iPicture=NULL; |
2892 sHeader->iPicture=NULL; |
2699 } |
2893 } |
2700 } |
2894 } |
2923 // Adjusts the length of the phrase by the signed value aIncrement. |
3121 // Adjusts the length of the phrase by the signed value aIncrement. |
2924 // |
3122 // |
2925 { |
3123 { |
2926 // ASSERT: The length of a picture phrase may only be altered by deleting it, in which case |
3124 // ASSERT: The length of a picture phrase may only be altered by deleting it, in which case |
2927 // the only adjustment made will be an increment of -1 (EPictureIndicator). |
3125 // the only adjustment made will be an increment of -1 (EPictureIndicator). |
|
3126 if (IsPicturePhrase() && (!IsPicturePhrase() || aIncrement!=EPictureIndicator) |
|
3127 && (!IsPicturePhrase() || aIncrement!=0) ) |
|
3128 { |
|
3129 OstTrace0( TRACE_DUMP, RPHRASEATTRIBSENTRY_ADJUSTLENGTH, "EModifiedPicturePhraseLength" ); |
|
3130 } |
2928 __ASSERT_DEBUG(!IsPicturePhrase() || (IsPicturePhrase() && aIncrement==EPictureIndicator) |
3131 __ASSERT_DEBUG(!IsPicturePhrase() || (IsPicturePhrase() && aIncrement==EPictureIndicator) |
2929 || (IsPicturePhrase() && aIncrement==0) |
3132 || (IsPicturePhrase() && aIncrement==0) |
2930 ,Panic(EModifiedPicturePhraseLength)); |
3133 ,Panic(EModifiedPicturePhraseLength)); |
2931 TInt len=iLength; |
3134 TInt len=iLength; |
2932 iLength=(len==EPictureIndicator) |
3135 iLength=(len==EPictureIndicator) |