textrendering/texthandling/stext/TXTFMLYR.CPP
changeset 44 601ab138ba0b
parent 0 1fb32624e06b
child 55 336bee5c2d35
equal deleted inserted replaced
37:6be019398652 44:601ab138ba0b
    21 #include "TXTFRMAT.H"
    21 #include "TXTFRMAT.H"
    22 #include "TXTFMLYR.H"
    22 #include "TXTFMLYR.H"
    23 #include <txtfmstm.h>
    23 #include <txtfmstm.h>
    24 #include "TXTSTD.H"
    24 #include "TXTSTD.H"
    25 
    25 
       
    26 #include "OstTraceDefinitions.h"
       
    27 #ifdef OST_TRACE_COMPILER_IN_USE
       
    28 #include "TXTFMLYRTraces.h"
       
    29 #endif
       
    30 
    26 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    31 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    27 #include "TXTFMLYR_INTERNAL.H"
    32 #include "TXTFMLYR_INTERNAL.H"
    28 #endif
    33 #endif
    29 
    34 
    30 CFormatLayer::CFormatLayer()
    35 CFormatLayer::CFormatLayer()
   146 
   151 
   147 @param aStream Stream to which the format layer chain should be externalised. 
   152 @param aStream Stream to which the format layer chain should be externalised. 
   148 @param aExcludeCount The number of layers to be excluded. By default, zero. */
   153 @param aExcludeCount The number of layers to be excluded. By default, zero. */
   149 	{
   154 	{
   150 // ASSERT: aExcludeCount is positive.
   155 // ASSERT: aExcludeCount is positive.
       
   156 	if (aExcludeCount<0)
       
   157 	    {
       
   158 	    OstTrace0( TRACE_FATAL, CFORMATLAYER_EXTERNALIZECHAINL, "ECannotStoreFormatLayerChain" );
       
   159 	    }
   151 	__ASSERT_ALWAYS(aExcludeCount>=0,Panic(ECannotStoreFormatLayerChain));
   160 	__ASSERT_ALWAYS(aExcludeCount>=0,Panic(ECannotStoreFormatLayerChain));
   152 // ASSERT: The number of layers to be excluded is less than the total no. of layers.
   161 // ASSERT: The number of layers to be excluded is less than the total no. of layers.
       
   162 	if (aExcludeCount>=ChainCount())
       
   163 	    {
       
   164 	    OstTrace0( TRACE_FATAL, DUP1_CFORMATLAYER_EXTERNALIZECHAINL, "ECannotStoreFormatLayerChain" );
       
   165 	    }
   153 	__ASSERT_ALWAYS(aExcludeCount<ChainCount(),Panic(ECannotStoreFormatLayerChain));
   166 	__ASSERT_ALWAYS(aExcludeCount<ChainCount(),Panic(ECannotStoreFormatLayerChain));
   154 	TInt aCount=ChainCount()-aExcludeCount;
   167 	TInt aCount=ChainCount()-aExcludeCount;
   155 	aStream.WriteInt8L(aCount);  // Store the chain length.
   168 	aStream.WriteInt8L(aCount);  // Store the chain length.
   156 	ExternalizeLayersRecurseL(aStream,--aCount);
   169 	ExternalizeLayersRecurseL(aStream,--aCount);
   157 	}	
   170 	}	
   164 //
   177 //
   165 	{
   178 	{
   166 	if (aDescendantCount)
   179 	if (aDescendantCount)
   167 		{
   180 		{
   168 // ASSERT: The format layer chain is consistent.
   181 // ASSERT: The format layer chain is consistent.
       
   182 		if (iBasedOn==NULL)
       
   183 		    {
       
   184 		    OstTrace0( TRACE_DUMP, CFORMATLAYER_EXTERNALIZELAYERSRECURSEL, "ECorruptFormatLayerChain" );
       
   185 		    }
   169 		__ASSERT_ALWAYS(iBasedOn!=NULL,Panic(ECorruptFormatLayerChain));
   186 		__ASSERT_ALWAYS(iBasedOn!=NULL,Panic(ECorruptFormatLayerChain));
   170 		iBasedOn->ExternalizeLayersRecurseL(aStream,--aDescendantCount);
   187 		iBasedOn->ExternalizeLayersRecurseL(aStream,--aDescendantCount);
   171 		}
   188 		}
   172 	aStream<< *this;
   189 	aStream<< *this;
   173 	}
   190 	}
   358 Must not be NULL or a panic occurs. 
   375 Must not be NULL or a panic occurs. 
   359 @param aMode Controls which attributes are written to aParaFormat. If 
   376 @param aMode Controls which attributes are written to aParaFormat. If 
   360 EAllAttributes, all attributes are written; if EFixedAttributes, tabs, 
   377 EAllAttributes, all attributes are written; if EFixedAttributes, tabs, 
   361 bullets and borders are not written. */
   378 bullets and borders are not written. */
   362 	{
   379 	{
       
   380 	if (aParaFormat==NULL)
       
   381 	    {
       
   382 	    OstTrace0( TRACE_FATAL, CPARAFORMATLAYER_SENSEEFFECTIVEL, "ENullFormatPointer" );
       
   383 	    }
   363 	__ASSERT_ALWAYS(aParaFormat!=NULL,Panic(ENullFormatPointer));
   384 	__ASSERT_ALWAYS(aParaFormat!=NULL,Panic(ENullFormatPointer));
   364 	aParaFormat->Reset();
   385 	aParaFormat->Reset();
   365 	TParaFormatMask mask;
   386 	TParaFormatMask mask;
   366 	FillParaFormatL(aParaFormat,mask,aMode);
   387 	FillParaFormatL(aParaFormat,mask,aMode);
   367 	CleanupEffectiveFormat(aParaFormat,mask);
   388 	CleanupEffectiveFormat(aParaFormat,mask);
   388 to the function, all attributes in the mask should be unset. 
   409 to the function, all attributes in the mask should be unset. 
   389 @param aMode Controls which attributes are written to aParaFormat. If 
   410 @param aMode Controls which attributes are written to aParaFormat. If 
   390 EAllAttributes, all attributes are written; if EFixedAttributes, tabs, bullets 
   411 EAllAttributes, all attributes are written; if EFixedAttributes, tabs, bullets 
   391 and borders are not written. */
   412 and borders are not written. */
   392 	{
   413 	{
       
   414 	if (aParaFormat==NULL)
       
   415 	    {
       
   416 	    OstTrace0( TRACE_FATAL, CPARAFORMATLAYER_SENSEL, "ENullFormatPointer" );
       
   417 	    }
   393 	__ASSERT_ALWAYS(aParaFormat!=NULL,Panic(ENullFormatPointer));
   418 	__ASSERT_ALWAYS(aParaFormat!=NULL,Panic(ENullFormatPointer));
   394 
   419 
   395 	iStore.SenseParaFormatL(*aParaFormat,aMask,aMode);
   420 	iStore.SenseParaFormatL(*aParaFormat,aMask,aMode);
   396 	}
   421 	}
   397 
   422