textrendering/texthandling/stext/TXTRTSTR.CPP
branchRCL_3
changeset 54 748ec5531811
parent 0 1fb32624e06b
child 55 336bee5c2d35
equal deleted inserted replaced
36:f902e87c146f 54:748ec5531811
    24 #include "TXTINDEX.H"
    24 #include "TXTINDEX.H"
    25 #include "TXTSTD.H"
    25 #include "TXTSTD.H"
    26 #include "TXTRTPFL.H"
    26 #include "TXTRTPFL.H"
    27 #include "ParseLst.h"
    27 #include "ParseLst.h"
    28 
    28 
       
    29 #include "OstTraceDefinitions.h"
       
    30 #ifdef OST_TRACE_COMPILER_IN_USE
       
    31 #include "TXTRTSTRTraces.h"
       
    32 #endif
       
    33 
    29 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    34 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    30 #include "TXTETEXT_INTERNAL.H"
    35 #include "TXTETEXT_INTERNAL.H"
    31 #include "TXTRICH_INTERNAL.H"
    36 #include "TXTRICH_INTERNAL.H"
    32 #endif
    37 #endif
    33 
    38 
   400 	{
   405 	{
   401 	__ETEXT_WATCH(DETACH_POS_LENGTH);
   406 	__ETEXT_WATCH(DETACH_POS_LENGTH);
   402 
   407 
   403 	__TEST_INVARIANT;
   408 	__TEST_INVARIANT;
   404 	TInt documentLength = DocumentLength();
   409 	TInt documentLength = DocumentLength();
       
   410 	if (aPos < 0 || aPos > documentLength)
       
   411 	    {
       
   412 	    OstTrace0( TRACE_FATAL, DUP1_CRICHTEXT_DETACHFROMSTOREL, "ECharPosBeyondDocument" );
       
   413 	    }
   405 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= documentLength,Panic(ECharPosBeyondDocument));
   414 	__ASSERT_ALWAYS(aPos >= 0 && aPos <= documentLength,Panic(ECharPosBeyondDocument));
       
   415 	if (aLength < 0)
       
   416 	    {
       
   417 	    OstTrace0( TRACE_FATAL, CRICHTEXT_DETACHFROMSTOREL, "ECopyToStreamNegativeLength" );
       
   418 	    }
   406 	__ASSERT_ALWAYS(aLength >= 0,Panic(ECopyToStreamNegativeLength));
   419 	__ASSERT_ALWAYS(aLength >= 0,Panic(ECopyToStreamNegativeLength));
       
   420 	if (aPos + aLength > documentLength)
       
   421 	    {
       
   422 	    OstTrace0( TRACE_FATAL, DUP2_CRICHTEXT_DETACHFROMSTOREL, "ECharPosBeyondDocument" );
       
   423 	    }
   407 	__ASSERT_ALWAYS(aPos + aLength <= documentLength,Panic(ECharPosBeyondDocument));
   424 	__ASSERT_ALWAYS(aPos + aLength <= documentLength,Panic(ECharPosBeyondDocument));
   408 	
   425 	
   409 	if (aLength > 0 && IndexPresent())
   426 	if (aLength > 0 && IndexPresent())
   410 		iIndex->DetachFromStoreL(aDegree,aPos,aLength);
   427 		iIndex->DetachFromStoreL(aDegree,aPos,aLength);
   411 
   428 
   434 @param aPictureFactory The picture factory. 
   451 @param aPictureFactory The picture factory. 
   435 @param aStoreResolver The store resolver. This determines which file store 
   452 @param aStoreResolver The store resolver. This determines which file store 
   436 the picture is stored in. */
   453 the picture is stored in. */
   437 	{
   454 	{
   438 	__TEST_INVARIANT;
   455 	__TEST_INVARIANT;
       
   456 	if (!aPictureFactory && aStoreResolver)
       
   457 	    {
       
   458 	    OstTrace0( TRACE_FATAL, CRICHTEXT_SETPICTUREFACTORY, "EInvalidPictureFactorySettings" );
       
   459 	    }
   439 	__ASSERT_ALWAYS(!(!aPictureFactory && aStoreResolver),Panic(EInvalidPictureFactorySettings));
   460 	__ASSERT_ALWAYS(!(!aPictureFactory && aStoreResolver),Panic(EInvalidPictureFactorySettings));
   440 
   461 
   441 	iPictureFactory=aPictureFactory;
   462 	iPictureFactory=aPictureFactory;
   442 	iStoreResolver=aStoreResolver;
   463 	iStoreResolver=aStoreResolver;
   443 	}
   464 	}
   450 @param aPos The document position. Must be valid. 
   471 @param aPos The document position. Must be valid. 
   451 @return The picture header located at document position aPos, or a default 
   472 @return The picture header located at document position aPos, or a default 
   452 picture header. */
   473 picture header. */
   453 	{
   474 	{
   454 	__TEST_INVARIANT;
   475 	__TEST_INVARIANT;
       
   476 	if (aPos<0 || aPos>DocumentLength())
       
   477 	    {
       
   478 	    OstTrace0( TRACE_FATAL, CRICHTEXT_PICTUREHEADER, "ECharPosBeyondDocument" );
       
   479 	    }
   455 	__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
   480 	__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
   456 
   481 
   457 	return (IndexPresent())
   482 	return (IndexPresent())
   458 		? iIndex->PictureHeader(aPos)
   483 		? iIndex->PictureHeader(aPos)
   459 		: TPictureHeader();
   484 		: TPictureHeader();
   468 @param aPos The document position of the picture character. Must be valid 
   493 @param aPos The document position of the picture character. Must be valid 
   469 or a panic occurs.
   494 or a panic occurs.
   470 @see CRichText::PictureHandleL() */
   495 @see CRichText::PictureHandleL() */
   471 	{
   496 	{
   472 	__TEST_INVARIANT;
   497 	__TEST_INVARIANT;
       
   498 	if (aPos<0 || aPos>DocumentLength())
       
   499 	    {
       
   500 	    OstTrace0( TRACE_FATAL, CRICHTEXT_DROPPICTUREOWNERSHIP, "ECharPosBeyondDocument" );
       
   501 	    }
   473 	__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
   502 	__ASSERT_ALWAYS(aPos>=0 && aPos<=DocumentLength(),Panic(ECharPosBeyondDocument));
   474 
   503 
   475 	TPictureHeader* p = IndexPresent()? iIndex->PictureHeaderPtr(aPos) : 0;
   504 	TPictureHeader* p = IndexPresent()? iIndex->PictureHeaderPtr(aPos) : 0;
   476 	if (!p)
   505 	if (!p)
   477 		return;
   506 		return;