1099 |
1099 |
1100 @return The number of characters in the text object. */ |
1100 @return The number of characters in the text object. */ |
1101 {return ((iByteStore->Size()/sizeof(TText))-1);} |
1101 {return ((iByteStore->Size()/sizeof(TText))-1);} |
1102 |
1102 |
1103 |
1103 |
1104 |
|
1105 |
|
1106 EXPORT_C void CPlainText::InsertL(TInt aInsertPos,const TChar& aChar) |
1104 EXPORT_C void CPlainText::InsertL(TInt aInsertPos,const TChar& aChar) |
1107 /** Inserts either a single character or a descriptor into the text object |
1105 /** Inserts either a single character or a descriptor into the text object |
1108 at a specified document position. |
1106 at a specified document position. |
1109 |
1107 |
1110 Updates the page table. |
1108 Updates the page table. |
1115 @param aBuf The descriptor to insert. */ |
1113 @param aBuf The descriptor to insert. */ |
1116 { |
1114 { |
1117 __TEST_INVARIANT; |
1115 __TEST_INVARIANT; |
1118 __ASSERT_ALWAYS(aInsertPos>=0 && aInsertPos<=DocumentLength(),Panic(ECharPosBeyondDocument)); |
1116 __ASSERT_ALWAYS(aInsertPos>=0 && aInsertPos<=DocumentLength(),Panic(ECharPosBeyondDocument)); |
1119 |
1117 |
1120 TBuf<1> content; |
1118 TInt contentLength = 1; |
1121 content.Append(aChar); |
1119 if (aChar < 0x10000) |
1122 DoPtInsertL(aInsertPos,content); |
1120 { |
|
1121 TBuf<1> content; |
|
1122 content.Append(aChar); |
|
1123 DoPtInsertL(aInsertPos,content); |
|
1124 } |
|
1125 else |
|
1126 { |
|
1127 TText16 high = TChar::GetHighSurrogate(aChar); |
|
1128 TText16 low = TChar::GetLowSurrogate(aChar); |
|
1129 RDebug::Print(_L("CPlainText::InsertL(%d), %X expand to %X %X."), aInsertPos, aChar, high, low); |
|
1130 |
|
1131 TBuf<2> content; |
|
1132 contentLength = 2; |
|
1133 content.Append(high); |
|
1134 content.Append(low); |
|
1135 DoPtInsertL(aInsertPos,content); |
|
1136 } |
1123 if (FieldSetPresent()) |
1137 if (FieldSetPresent()) |
1124 iFieldSet->NotifyInsertion(aInsertPos,content.Length()); // length always 1 - optimise??? |
1138 iFieldSet->NotifyInsertion(aInsertPos,contentLength); |
|
1139 |
1125 SetHasChanged(ETrue); |
1140 SetHasChanged(ETrue); |
1126 |
1141 |
1127 __TEST_INVARIANT; |
1142 __TEST_INVARIANT; |
1128 } |
1143 } |
1129 |
1144 |