--- a/textrendering/texthandling/stext/TXTETEXT.CPP Tue Aug 31 17:01:26 2010 +0300
+++ b/textrendering/texthandling/stext/TXTETEXT.CPP Wed Sep 01 12:39:40 2010 +0100
@@ -41,11 +41,6 @@
#include "TXTRTPFL.H"
#include "TXTCLIPBOARD.H"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "TXTETEXTTraces.h"
-#endif
-
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
#include "TXTETEXT_INTERNAL.H"
#endif
@@ -263,15 +258,7 @@
EXPORT_C void CEditableText::StartFepInlineEditL(TBool& aParagraphContainingStartPositionOfInlineTextHasChangedFormat,TInt& aNumberOfCharactersSuccessfullyDeleted,TInt& aNumberOfCharactersSuccessfullyInserted,TInt& aPositionOfInsertionPointInDocument,TInt aNewPositionOfInsertionPointInDocument,const TDesC& aInitialInlineText,TInt aPositionOfInlineTextInDocument,TInt aNumberOfCharactersToHide,MFepInlineTextFormatRetriever& aInlineTextFormatRetriever)
/** @internalAll */
{
- if (aPositionOfInlineTextInDocument<0 || aNumberOfCharactersToHide<0 || aPositionOfInlineTextInDocument+aNumberOfCharactersToHide>DocumentLength())
- {
- OstTrace0( TRACE_DUMP, CEDITABLETEXT_STARTFEPINLINEEDITL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPositionOfInlineTextInDocument>=0 && aNumberOfCharactersToHide>=0 && aPositionOfInlineTextInDocument+aNumberOfCharactersToHide<=DocumentLength(),Panic(ECharPosBeyondDocument));
- if (InlineEditData()!=NULL)
- {
- OstTrace0( TRACE_DUMP, DUP1_CEDITABLETEXT_STARTFEPINLINEEDITL, "EAlreadyFepInlineEditing" );
- }
__ASSERT_ALWAYS(InlineEditData()==NULL,Panic(EAlreadyFepInlineEditing));
aParagraphContainingStartPositionOfInlineTextHasChangedFormat=EFalse;
aNumberOfCharactersSuccessfullyDeleted=0;
@@ -308,20 +295,12 @@
/** @internalAll */
{
CInlineEditData* const inlineEditData=InlineEditData();
- if (inlineEditData==NULL)
- {
- OstTrace0( TRACE_DUMP, CEDITABLETEXT_UPDATEFEPINLINETEXTL, "ENotCurrentlyFepInlineEditing" );
- }
__ASSERT_ALWAYS(inlineEditData!=NULL,Panic(ENotCurrentlyFepInlineEditing));
aParagraphContainingStartPositionOfInlineTextHasChangedFormat=EFalse;
aNumberOfCharactersSuccessfullyDeleted=0;
aNumberOfCharactersSuccessfullyInserted=0;
HBufC*& inlineText=inlineEditData->iInlineText;
HBufC* oldInlineText=inlineText;
- if (oldInlineText!=NULL && inlineEditData->iLengthOfInlineText!=oldInlineText->Length())
- {
- OstTrace0( TRACE_DUMP, DUP1_CEDITABLETEXT_UPDATEFEPINLINETEXTL, "EDebug" );
- }
__ASSERT_DEBUG(oldInlineText==NULL || inlineEditData->iLengthOfInlineText==oldInlineText->Length(),Panic(EDebug));
const TInt lengthOfNewInlineText=aNewInlineText.Length();
if (oldInlineText!=NULL && *oldInlineText==aNewInlineText)
@@ -367,15 +346,7 @@
*/
{
const CInlineEditData* const inlineEditData=InlineEditData();
- if (inlineEditData==NULL)
- {
- OstTrace0( TRACE_FATAL, DUP1_CEDITABLETEXT_COMMITFEPINLINEEDITL, "ENotCurrentlyFepInlineEditing" );
- }
__ASSERT_ALWAYS(inlineEditData!=NULL,Panic(ENotCurrentlyFepInlineEditing));
- if (inlineEditData->iInlineText!=NULL && inlineEditData->iLengthOfInlineText!=inlineEditData->iInlineText->Length())
- {
- OstTrace0( TRACE_DUMP, CEDITABLETEXT_COMMITFEPINLINEEDITL, "EDebug" );
- }
__ASSERT_DEBUG(inlineEditData->iInlineText==NULL || inlineEditData->iLengthOfInlineText==inlineEditData->iInlineText->Length(),Panic(EDebug));
aParagraphContainingStartPositionOfInlineTextHasChangedFormat=EFalse;
const TInt lengthOfInlineText=inlineEditData->iLengthOfInlineText;
@@ -399,10 +370,6 @@
{
const TInt positionOfInlineTextInDocument=inlineEditData->iPositionOfInlineTextInDocument;
const TInt lengthOfInlineText=inlineEditData->iLengthOfInlineText;
- if (inlineEditData->iInlineText!=NULL && lengthOfInlineText!=inlineEditData->iInlineText->Length())
- {
- OstTrace0( TRACE_DUMP, CEDITABLETEXT_CANCELFEPINLINEEDIT, "EDebug" );
- }
__ASSERT_DEBUG(inlineEditData->iInlineText==NULL || lengthOfInlineText==inlineEditData->iInlineText->Length(),Panic(EDebug));
TRAPD(notUsed,
if (lengthOfInlineText>0)
@@ -414,10 +381,6 @@
const HBufC* const hiddenText=inlineEditData->iHiddenText;
if (hiddenText!=NULL)
{
- if (hiddenText->Length()<=0)
- {
- OstTrace0( TRACE_DUMP, DUP1_CEDITABLETEXT_CANCELFEPINLINEEDIT, "EDebug" );
- }
__ASSERT_DEBUG(hiddenText->Length()>0, Panic(EDebug));
InsertL(positionOfInlineTextInDocument,*hiddenText);
aNumberOfCharactersSuccessfullyInserted=hiddenText->Length();
@@ -599,10 +562,6 @@
/** Allocates storage of CBufFlat or CBufSeg, according to the parameter aStorage.
Creates & initializes the field set.*/
{
- if (iByteStore!=NULL)
- {
- OstTrace0( TRACE_DUMP, CPLAINTEXT_DOCONSTRUCTL, "EConstructCalledTwice" );
- }
__ASSERT_DEBUG(iByteStore==NULL,Panic(EConstructCalledTwice));
iByteStore=(aStorage==ESegmentedStorage)
@@ -925,20 +884,8 @@
{
__TEST_INVARIANT;
TInt documentLength = DocumentLength();
- if (aPos < 0 || aPos > documentLength)
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_DOCOPYTOSTOREL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos >= 0 && aPos <= documentLength,Panic(ECharPosBeyondDocument));
- if (aLength < 0)
- {
- OstTrace0( TRACE_FATAL, DUP1_CPLAINTEXT_DOCOPYTOSTOREL, "ECopyToStreamNegativeLength" );
- }
__ASSERT_ALWAYS(aLength >= 0,Panic(ECopyToStreamNegativeLength));
- if (aPos + aLength > documentLength)
- {
- OstTrace0( TRACE_FATAL, DUP2_CPLAINTEXT_DOCOPYTOSTOREL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos + aLength <= documentLength,Panic(ECharPosBeyondDocument));
if (aLength == 0)
@@ -977,20 +924,8 @@
{
__TEST_INVARIANT;
TInt documentLength = DocumentLength();
- if (aPos < 0 || aPos > documentLength)
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_COPYTOSTREAML, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos >= 0 && aPos <= documentLength,Panic(ECharPosBeyondDocument));
- if (aLength < 0)
- {
- OstTrace0( TRACE_FATAL, DUP1_CPLAINTEXT_COPYTOSTREAML, "ECopyToStreamNegativeLength" );
- }
__ASSERT_ALWAYS(aLength >= 0,Panic(ECopyToStreamNegativeLength));
- if (aPos + aLength > documentLength)
- {
- OstTrace0( TRACE_FATAL, DUP2_CPLAINTEXT_COPYTOSTREAML, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos + aLength <= documentLength,Panic(ECharPosBeyondDocument));
aStream.WriteInt32L(aLength);
@@ -1026,10 +961,6 @@
TInt CPlainText::DoPasteFromStoreL(const CStreamStore& aStore,TStreamId aStreamId,TInt aPos)
{
- if (aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_DOPASTEFROMSTOREL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
TInt charsPasted=0;
@@ -1076,7 +1007,6 @@
if (error != KErrNone)
{
DoPtDelete(aPos,chars_read);
- OstTrace1( TRACE_FATAL, DUP1_CPLAINTEXT_PASTEFROMSTREAML, "Leave code=%d", error );
User::Leave(error);
}
@@ -1128,10 +1058,6 @@
/** Inserts the end-of-document character upon document construction.*/
{
// ASSERT: The plain text component is empty.
- if (DocumentLength()!=-1)
- {
- OstTrace0( TRACE_DUMP, DUP1_CPLAINTEXT_INSERTEODL, "ECorruptTextStore" );
- }
__ASSERT_DEBUG(DocumentLength()==-1,Panic(ECorruptTextStore));
TBuf<1> content;
content.Append(EParagraphDelimiter);
@@ -1175,6 +1101,8 @@
{return ((iByteStore->Size()/sizeof(TText))-1);}
+
+
EXPORT_C void CPlainText::InsertL(TInt aInsertPos,const TChar& aChar)
/** Inserts either a single character or a descriptor into the text object
at a specified document position.
@@ -1187,34 +1115,13 @@
@param aBuf The descriptor to insert. */
{
__TEST_INVARIANT;
- if (aInsertPos<0 || aInsertPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_INSERTL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aInsertPos>=0 && aInsertPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
- TInt contentLength = 1;
- if (aChar < 0x10000)
- {
- TBuf<1> content;
- content.Append(aChar);
- DoPtInsertL(aInsertPos,content);
- }
- else
- {
- TText16 high = TChar::GetHighSurrogate(aChar);
- TText16 low = TChar::GetLowSurrogate(aChar);
- RDebug::Print(_L("CPlainText::InsertL(%d), %X expand to %X %X."), aInsertPos, TUint(aChar), high, low);
-
- TBuf<2> content;
- contentLength = 2;
- content.Append(high);
- content.Append(low);
- DoPtInsertL(aInsertPos,content);
- }
+ TBuf<1> content;
+ content.Append(aChar);
+ DoPtInsertL(aInsertPos,content);
if (FieldSetPresent())
- iFieldSet->NotifyInsertion(aInsertPos,contentLength);
-
+ iFieldSet->NotifyInsertion(aInsertPos,content.Length()); // length always 1 - optimise???
SetHasChanged(ETrue);
__TEST_INVARIANT;
@@ -1234,10 +1141,6 @@
Maintain field set.*/
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_PTINSERTL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
DoPtInsertL(aPos,aBuf);
@@ -1323,20 +1226,8 @@
EFalse, so no reformatting occurs.*/
{
TInt documentLength=DocumentLength()+1;
- if (aPos<0 || aPos>documentLength)
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_DOPTDELETE, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=documentLength,Panic(ECharPosBeyondDocument));
- if (aLength<0)
- {
- OstTrace0( TRACE_FATAL, DUP1_CPLAINTEXT_DOPTDELETE, "EDeleteNegativeLength" );
- }
__ASSERT_ALWAYS(aLength>=0,Panic(EDeleteNegativeLength));
- if (aPos+aLength>documentLength)
- {
- OstTrace0( TRACE_FATAL, DUP2_CPLAINTEXT_DOPTDELETE, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos+aLength<=documentLength,Panic(ECharPosBeyondDocument));
iByteStore->Delete(aPos*sizeof(TText),aLength*sizeof(TText));
@@ -1384,10 +1275,6 @@
file.Close();
file_session.Close();
}
- if (error < 0)
- {
- OstTrace1( TRACE_FATAL, DUP1_CPLAINTEXT_IMPORTTEXTFILEL, "Leave code=%x", error );
- }
User::LeaveIfError(error);
return chars_inserted;
}
@@ -1412,10 +1299,6 @@
@param aMaxLineLength The maximum number of characters in each line, (only
relevant if the text organisation is EOrganiseByLine). */
{
- if (aTextOrganisation != EOrganiseByParagraph && aLineWrap <= 0)
- {
- OstTrace0( TRACE_DUMP, CPLAINTEXT_EXPORTASTEXTL, "EExportLineWrapInvalid" );
- }
__ASSERT_DEBUG(aTextOrganisation == EOrganiseByParagraph || aLineWrap > 0,Panic(EExportLineWrapInvalid));
RFs file_session;
TInt error = file_session.Connect();
@@ -1434,10 +1317,6 @@
file.Close();
file_session.Close();
}
- if (error < 0)
- {
- OstTrace1( TRACE_FATAL, DUP2_CPLAINTEXT_EXPORTASTEXTL, "Leave code=%x", error );
- }
User::LeaveIfError(error);
}
@@ -1591,10 +1470,6 @@
*/
{
__TEST_INVARIANT;
- if (aStartPos<0 || aStartPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, DUP1_CPLAINTEXT_READ, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aStartPos>=0 && aStartPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
TPtr8 buf=iByteStore->Ptr(aStartPos*sizeof(TText));
@@ -1621,10 +1496,6 @@
*/
{
__TEST_INVARIANT;
- if (aStartPos<0 || aStartPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_READ, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aStartPos>=0 && aStartPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
TPtr8 buf=iByteStore->Ptr(aStartPos*sizeof(TText));
@@ -1648,15 +1519,7 @@
{
__TEST_INVARIANT;
TInt documentLength=DocumentLength();
- if (aPos<0 || aPos>documentLength)
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_EXTRACT, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=documentLength,Panic(ECharPosBeyondDocument));
- if (aBuf.MaxLength()<documentLength - aPos)
- {
- OstTrace0( TRACE_FATAL, DUP1_CPLAINTEXT_EXTRACT, "EExtractBufferTooSmall" );
- }
__ASSERT_ALWAYS(aBuf.MaxLength()>=documentLength - aPos,Panic(EExtractBufferTooSmall));
DoExtract(aBuf,aPos,documentLength-aPos);
@@ -1678,15 +1541,7 @@
@param aLength The number of characters to copy. */
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, DUP2_CPLAINTEXT_EXTRACT, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
- if (aBuf.MaxLength()<aLength)
- {
- OstTrace0( TRACE_FATAL, DUP3_CPLAINTEXT_EXTRACT, "EExtractBufferTooSmall" );
- }
__ASSERT_ALWAYS(aBuf.MaxLength()>=aLength,Panic(EExtractBufferTooSmall));
DoExtract(aBuf,aPos,aLength);
@@ -1696,10 +1551,6 @@
// inline text, depending on the flag.
EXPORT_C void CPlainText::ExtractSelectively(TDes& aBuf,TInt aPos,TInt aLength,TUint aFlags)
{
- if (aPos < 0 || aPos > DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_EXTRACTSELECTIVELY, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(),Panic(ECharPosBeyondDocument));
DoExtract(aBuf,aPos,aLength,aFlags);
}
@@ -1790,10 +1641,6 @@
//
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength()+1)
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_UPDATEPAGETABLE, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength()+1,Panic(ECharPosBeyondDocument));
if (iPageTable)
@@ -1810,10 +1657,6 @@
@return The page number containing document position aPos. */
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_PAGECONTAININGPOS, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
if (!iPageTable || (iPageTable->Count()<1))
@@ -1867,15 +1710,7 @@
field types, see the UID values defined in flddef.h. */
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_INSERTFIELDL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
- if (!aField)
- {
- OstTrace0( TRACE_FATAL, DUP1_CPLAINTEXT_INSERTFIELDL, "ENoTextField" );
- }
__ASSERT_ALWAYS(aField,Panic(ENoTextField));
if (!FieldSetPresent())
@@ -1902,10 +1737,6 @@
position, or a panic occurs. */
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_UPDATEFIELDL, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
if (!FieldSetPresent())
@@ -1970,10 +1801,6 @@
at aPos. */
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_REMOVEFIELD, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
TBool fieldRemoved=EFalse;
@@ -2060,10 +1887,6 @@
field located at aPos. */
{
__TEST_INVARIANT;
- if (aPos<0 || aPos>DocumentLength())
- {
- OstTrace0( TRACE_FATAL, CPLAINTEXT_CONVERTFIELDTOTEXT, "ECharPosBeyondDocument" );
- }
__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
TBool fieldConverted=EFalse;