textrendering/texthandling/stext/TXTRICH.CPP
branchRCL_3
changeset 55 336bee5c2d35
parent 54 748ec5531811
--- a/textrendering/texthandling/stext/TXTRICH.CPP	Tue Aug 31 17:01:26 2010 +0300
+++ b/textrendering/texthandling/stext/TXTRICH.CPP	Wed Sep 01 12:39:40 2010 +0100
@@ -26,11 +26,6 @@
 #include "ParseLst.h"
 #include "TXTCLIPBOARD.H"
 
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "TXTRICHTraces.h"
-#endif
-
 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
 #include "TXTETEXT_INTERNAL.H"
 #include "TXTRICH_INTERNAL.H"
@@ -42,15 +37,7 @@
 	{
 #ifdef _DEBUG
 // ASSERT: The global format layers are never null.
-	if (iGlobalParaFormatLayer == NULL)
-	    {
-	    OstTrace0( TRACE_DUMP, CRICHTEXT_DBGTESTINVARIANT, "Invariant" );
-	    }
 	__ASSERT_DEBUG(iGlobalParaFormatLayer != NULL, User::Invariant());
-	if (iGlobalCharFormatLayer == NULL)
-	    {
-	    OstTrace0( TRACE_DUMP, DUP1_CRICHTEXT_DBGTESTINVARIANT, "Invariant" );
-	    }
 	__ASSERT_DEBUG(iGlobalCharFormatLayer != NULL, User::Invariant());
 	if (IndexPresent())
 		{
@@ -62,20 +49,10 @@
 			TParaAttribsEntry entry = (*iIndex->iParaIx)[offset];
 			cumulativeParaLength += entry.iLength;
 			}
-		if (cumulativeParaLength != (DocumentLength() + 1))
-		    {
-		    OstTrace0( TRACE_DUMP, DUP2_CRICHTEXT_DBGTESTINVARIANT, "Invariant" );
-		    }
 		__ASSERT_DEBUG(cumulativeParaLength == (DocumentLength() + 1), User::Invariant());
 		}
 		// Change here for defect INC005336.
 		// This defect is present when the assertion below fails.
-        if ((iParserData != NULL) &&
-                (iParserData->HaveRange()) &&
-                (iParserData->EndParse() > DocumentLength()))
-            {
-            OstTrace0( TRACE_DUMP, DUP3_CRICHTEXT_DBGTESTINVARIANT, "Invariant" );
-            }
 		__ASSERT_DEBUG( (iParserData == NULL) || \
 			(!iParserData->HaveRange()) || \
 			(iParserData->EndParse() <= DocumentLength()), User::Invariant());
@@ -103,15 +80,7 @@
 @return The rich text object. */
 	{
 	// Create new rich text containing just a single end-of-document character.
-	if (aGlobalParaLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalParaLayer != NULL, Panic(ENullFormatLayerHandle));
-	if (aGlobalCharLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalCharLayer != NULL, Panic(ENullFormatLayerHandle));
 
 	CRichText* self = new(ELeave) CRichText(aGlobalParaLayer, aGlobalCharLayer);
@@ -153,15 +122,7 @@
 used internally for storing paragraph attributes. Default = EMultiPara.
 @return The new rich text object. */
 	{
-	if (aGlobalParaLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalParaLayer != NULL, Panic(ENullFormatLayerHandle));
-	if (aGlobalCharLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP3_CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalCharLayer != NULL, Panic(ENullFormatLayerHandle));
 
 	CRichText* self = new(ELeave) CRichText(aGlobalParaLayer, aGlobalCharLayer, CONST_CAST(CStyleList*, &aStyleList));
@@ -198,15 +159,7 @@
 which should rarely need to be changed.
 @return The new rich text object. */
 	{
-	if (aGlobalParaLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP4_CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalParaLayer != NULL, Panic(ENullFormatLayerHandle));
-	if (aGlobalCharLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP5_CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalCharLayer != NULL, Panic(ENullFormatLayerHandle));
 
 	CRichText* self = new(ELeave) CRichText(aGlobalParaLayer, aGlobalCharLayer);
@@ -252,20 +205,8 @@
 	{
 	// Restore a new rich text from the specified stream, that uses the specified global layers, and the
 	// specified picture header factory and store, if this rich text supports pictures.
-	if (!aPictureFactory && aStoreResolver)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP6_CRICHTEXT_NEWL, "EInvalidPictureFactorySettings" );
-	    }
 	__ASSERT_ALWAYS(!(!aPictureFactory && aStoreResolver), Panic(EInvalidPictureFactorySettings));
-	if (aGlobalParaLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP7_CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalParaLayer != NULL, Panic(ENullFormatLayerHandle));
-	if (aGlobalCharLayer == NULL)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP8_CRICHTEXT_NEWL, "ENullFormatLayerHandle" );
-	    }
 	__ASSERT_ALWAYS(aGlobalCharLayer != NULL, Panic(ENullFormatLayerHandle));
 
 	CRichText* self = new(ELeave) CRichText(aGlobalParaLayer, aGlobalCharLayer);
@@ -442,20 +383,8 @@
 	__TEST_INVARIANT;
 
 	TInt documentLength = DocumentLength();
-	if (aPos < 0 || aPos > documentLength)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_DOCOPYTOSTOREL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= documentLength,Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_DOCOPYTOSTOREL, "ECopyToClipboardNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0,Panic(ECopyToClipboardNegativeLength));
-	if (aPos + aLength > documentLength)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_DOCOPYTOSTOREL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + aLength <= documentLength,Panic(ECharPosBeyondDocument));
 
 	if (aLength == 0)
@@ -561,10 +490,6 @@
 //
 	{
 	__TEST_INVARIANT;
-	if (aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_DOPASTERTFROMSTOREL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	TUid type = KClipboardUidTypeRichTextWithStyles;
@@ -607,17 +532,12 @@
 		CreateAndGenerateMarkupComponentL();  // create the index if it does not already exist
 	TStreamId id = aDictionary.At(KClipboardUidTypePlainText);
 // ASSERT: We have rich text, so the plain text stream must exist.
-	if (id == KNullStreamId)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_PASTERICHTEXTFROMSTOREL, "EClipboardIntegrity" );
-	    }
 	__ASSERT_ALWAYS(id != KNullStreamId,Panic(EClipboardIntegrity));
 	TInt consumed = CPlainText::DoPasteFromStoreL(aStore, id, aPos);
 	TRAPD(ret, CompletePasteRichTextFromStoreL(aStore, aRichTextStreamId, aPos, aStylePasteMode));
 	if (ret != KErrNone)
 		{
 		CPlainText::Delete(aPos,consumed);
-		OstTrace1( TRACE_FATAL, DUP1_CRICHTEXT_PASTERICHTEXTFROMSTOREL, "Leave code=%d", ret );
 		User::Leave(ret);
 		}
 	return consumed;
@@ -705,34 +625,12 @@
 @param aBuf The descriptor to insert. */
 	{
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_INSERTL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aChar == EPictureCharacter)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_INSERTL, "ENonOverloadedInsertCalledWithPictureCharacter" );
-	    }
 	__ASSERT_ALWAYS(aChar!= EPictureCharacter, Panic(ENonOverloadedInsertCalledWithPictureCharacter));
 
-	if (aChar < 0x10000)
-		{
-		TBuf<1> content;
-		content.Append(aChar);
-		RtInsertL(aPos, content);
-		}
-	else
-		{
-		TText16 high = TChar::GetHighSurrogate(aChar);
-		TText16 low = TChar::GetLowSurrogate(aChar);
-		RDebug::Print(_L("CRichText::InsertL(), %X expand to %X %X."), TUint(aChar), high, low);
-		
-		TBuf<2> content;
-		content.Append(high);
-		content.Append(low);
-		RtInsertL(aPos, content);
-		}
+	TBuf<1> content;
+	content.Append(aChar);
+	RtInsertL(aPos, content);
 
 	__TEST_INVARIANT;
 	}
@@ -757,10 +655,6 @@
 //
 	{
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_RTINSERTL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	int length = aBuf.Length();
@@ -800,10 +694,6 @@
 and information about the picture. */
 	{
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_INSERTL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	CleanupStack::PushL(aHeader.iPicture);
@@ -854,20 +744,8 @@
 	// Delete commences at, and includes, character position aPos.
 	__TEST_INVARIANT;
 
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_DELETEL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_DELETEL, "EDebugDeleteZeroLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0, Panic(EDebugDeleteZeroLength));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_DELETEL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	TBool requireMerge = EFalse;
@@ -905,15 +783,7 @@
 	// Store the length of the text before we commence with deletions.
 	TInt initialDocLen=DocumentLength();
 
-	if (aPos < 0 || aPos > initialDocLen)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_DELETEPARAGRAPH, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= initialDocLen, Panic(ECharPosBeyondDocument));
-	if (aPos + aLength > initialDocLen + 1)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_DELETEPARAGRAPH, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + aLength <= initialDocLen + 1, Panic(ECharPosBeyondDocument));
 
 	if (aLength <= 0)
@@ -963,15 +833,7 @@
 	// Guaranteed not to leave if this pre-condition holds true.
 	__TEST_INVARIANT;
 
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_DELETEFROMPARAGRAPH, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_DELETEFROMPARAGRAPH, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (aLength <= 0)
@@ -1058,10 +920,6 @@
 	// of this paragraph.  If aPos is already on a paragraph boundary then do nothing.
 	//
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_PARAGRAPHNUMBERFORPOS, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -1100,10 +958,6 @@
 
 void CRichText::SetExtendedInsertCharFormatL(const TCharFormatX& aFormat, const TCharFormatXMask& aMask, TInt aPos)
 	{
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_SETEXTENDEDINSERTCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 	CreateAndGenerateMarkupComponentL();
 	CRichTextIndex* index = iIndex.AsPtr();
@@ -1186,20 +1040,8 @@
 	// immediately inserted.
 	//
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_DELSETINSERTCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_DELSETINSERTCHARFORMATL, "EDebugDeleteZeroLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0, Panic(EDebugDeleteZeroLength));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_DELSETINSERTCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	TBool parasMerged = EFalse;
@@ -1256,20 +1098,8 @@
 	// character position aPos to aPos+aLength-1.
 	//
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_APPLYPARAFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_APPLYPARAFORMATL, "EApplyParaFormatNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0,Panic(EApplyParaFormatNegativeLength));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_APPLYPARAFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	CreateAndGenerateMarkupComponentL();
@@ -1303,20 +1133,8 @@
 	__TEST_INVARIANT;
 	
 	TInt document_length = DocumentLength();
-	if (aPos < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_APPLYCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0,Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_APPLYCHARFORMATL, "EApplyCharFormatNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0,Panic(EApplyCharFormatNegativeLength));
-	if (aPos + aLength - 1 > document_length)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_APPLYCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + aLength - 1 <= document_length,Panic(ECharPosBeyondDocument));
 
 	//If some characters are highlighted AND current position + highlighted txt = document length	
@@ -1338,20 +1156,8 @@
 void CRichText::ApplyExtendedCharFormatL(const TCharFormatX& aFormat,const TCharFormatXMask& aMask,TInt aPos,TInt aLength)
 	{
 	TInt document_length = DocumentLength();
-	if (aPos < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_APPLYEXTENDEDCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0,Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_APPLYEXTENDEDCHARFORMATL, "EApplyCharFormatNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0,Panic(EApplyCharFormatNegativeLength));
-	if (aPos + aLength - 1 > document_length)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_APPLYEXTENDEDCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + aLength - 1 <= document_length,Panic(ECharPosBeyondDocument));
 	
 	DoApplyExtendedCharFormatL(aFormat, aMask, aPos, aLength);
@@ -1408,25 +1214,9 @@
 	// character positions aPos to aPos+aLength-1.
 	//
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_APPLYPARAGRAPHSTYLEL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_APPLYPARAGRAPHSTYLEL, "EApplyParaStyleNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0, Panic(EApplyParaStyleNegativeLength));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_APPLYPARAGRAPHSTYLEL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (!StyleListPresent())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP3_CRICHTEXT_APPLYPARAGRAPHSTYLEL, "ERichTextNotSetForUsingStyles" );
-	    }
 	__ASSERT_ALWAYS(StyleListPresent(), Panic(ERichTextNotSetForUsingStyles));
 
 	CreateAndGenerateMarkupComponentL();
@@ -1458,10 +1248,6 @@
 	// Update the rich text index following the change of an applied paragraph style.
 	//
 	__TEST_INVARIANT;
-	if (!StyleListPresent())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_NOTIFYSTYLECHANGEDL, "ERichTextNotSetForUsingStyles" );
-	    }
 	__ASSERT_ALWAYS(StyleListPresent(), Panic(ERichTextNotSetForUsingStyles));
 
 	CreateAndGenerateMarkupComponentL();
@@ -1485,20 +1271,8 @@
 indicates whether this object is a style, or just a paragraph format layer. */
 	{
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_PARAGRAPHSTYLE, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_PARAGRAPHSTYLE, "EParagraphStyleNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0,Panic(EParagraphStyleNegativeLength));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_PARAGRAPHSTYLE, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -1549,20 +1323,8 @@
 
 	__TEST_INVARIANT;
 
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_REMOVESPECIFICPARAFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_REMOVESPECIFICPARAFORMATL, "ERemoveSpecificParaFormatNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0, Panic(ERemoveSpecificParaFormatNegativeLength));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_REMOVESPECIFICPARAFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -1594,20 +1356,8 @@
 	__TEST_INVARIANT;
 	
 	TInt document_length = DocumentLength();
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_REMOVESPECIFICCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_REMOVESPECIFICCHARFORMATL, "ERemoveSpecificParaFormatNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0, Panic(ERemoveSpecificParaFormatNegativeLength));
-	if (aPos + (aLength - 1) > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_REMOVESPECIFICCHARFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + (aLength - 1) <= DocumentLength(), Panic(ECharPosBeyondDocument));
 	
 	// in correspondance to INC097216, character format removing considers the height of end of document
@@ -1656,10 +1406,6 @@
 	{
 	__TEST_INVARIANT;
 	TInt documentLength = DocumentLength();
-	if (aPos < 0 || aPos > documentLength)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_GETTEXTANDEXTENDEDFORMAT, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= documentLength, Panic(ECharPosBeyondDocument));
 	if (!IndexPresent())
 		{
@@ -1683,10 +1429,6 @@
 KErrNone if there is. */
 	{
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_GETPICTURESIZEINTWIPS, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -1716,10 +1458,6 @@
 	__ETEXT_WATCH(PICTURE_HANDLE);
 
 	__TEST_INVARIANT;
-	if (aPos<0 || aPos>DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_PICTUREHANDLEL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -1742,10 +1480,6 @@
 	__ETEXT_WATCH(GET_PARAGRAPH_FORMAT)
 
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_GETPARAGRAPHFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (!IndexPresent())
@@ -1769,10 +1503,6 @@
 	__ETEXT_WATCH(GET_PARAGRAPH_FORMAT)
 
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_GETSPECIFICPARAGRAPHFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	aFormat->Reset();
@@ -1811,20 +1541,8 @@
 	// Application: seeding paragraph formatting dialogs.
 	//
 	__TEST_INVARIANT;
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_GETPARAFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_GETPARAFORMATL, "EGetParaFormatNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0, Panic(EGetParaFormatNegativeLength));
-	if (aPos + aLength > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_GETPARAFORMATL, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + aLength <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -1871,20 +1589,8 @@
 	{
 	__TEST_INVARIANT;
 	int document_length = DocumentLength();
-	if (aPos < 0 || aPos > document_length)
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_GETEXTENDEDCHARFORMAT, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= document_length, Panic(ECharPosBeyondDocument));
-	if (aLength < 0)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_GETEXTENDEDCHARFORMAT, "EGetCharFormatNegativeLength" );
-	    }
 	__ASSERT_ALWAYS(aLength >= 0, Panic(EGetCharFormatNegativeLength));
-	if (aPos + aLength - 1 > document_length)
-	    {
-	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_GETEXTENDEDCHARFORMAT, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos + aLength - 1 <= document_length, Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -1906,10 +1612,6 @@
 
 	__TEST_INVARIANT;
 
-	if (aPos < 0 || aPos > DocumentLength())
-	    {
-	    OstTrace0( TRACE_FATAL, CRICHTEXT_GETSPECIFICCHARFORMATLEFTRIGHT, "ECharPosBeyondDocument" );
-	    }
 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= DocumentLength(), Panic(ECharPosBeyondDocument));
 
 	if (IndexPresent())
@@ -2067,10 +1769,6 @@
 
 	if (IndexPresent())
 		{
-		if (!aSource.IndexPresent())
-		    {
-		    OstTrace0( TRACE_DUMP, DUP1_CRICHTEXT_DOAPPENDTAKINGSOLEPICTUREOWNERSHIPL, "Invariant" );
-		    }
 		__ASSERT_DEBUG(aSource.IndexPresent(), User::Invariant());       // PrepareAppend should have sorted this
 
 		TGlobalLayerInfoAppend info(GlobalParaFormatLayer(), GlobalCharFormatLayer(), aSource.GlobalParaFormatLayer(), aSource.GlobalCharFormatLayer());