コード例 #1
0
void CMemSpyEngineActiveObjectArray::BuildHeaderCaptionL()
    {
    const TInt KHeaderLength = 100;
    //
    if  ( !iHeader )
        {
        iHeader = HBufC::NewL( KHeaderLength );
        }
    //
    TPtr pHeader( iHeader->Des() );
    //
    _LIT(KCaption, "\tNumber of AO\'s\t\t%d");
    pHeader.Format( KCaption, Count() );
    }
コード例 #2
0
void XlChartPlotSeries::classifySeries (XlChartBinaryReader& in_reader)
{
	//NOTE! modifies m_uCurrentIndex.
	//
    enum {undef = -2, aux, std, trend, xPos, xNeg, yPos, yNeg} type = undef;

    ChAutoPtr<XlHeader> pHeader(ChNEW XlHeader());
    ChSINT4  lPos = in_reader.getStream()->getPos();    

    if ( in_reader.nextSibling(*pHeader) )
    {    
        in_reader.getStream()->seek( pHeader->getLength() + XlRecord::HDR_SIZE, SsrwOO_CUR );
        // Open container and parse subordinates.
		// Find out about series type, 
		// also get main series group index or pick up aux series parent while parsing.
		in_reader.m_pParser->getHeader( *pHeader, in_reader.getSheetVersion() );
        if ( pHeader->getId() == XlChartBegin::ID )
        {
			ChSINT2 unAuxParentInd = -1;
			ChVector<SeriesDescription>* pList = NULL;	// tells about group type 
														// when completed
            while ( in_reader.nextSibling(*pHeader) )  
            {
                switch ( pHeader->getId() )
                {
                case XlChartSerToCrt::ID:		//order 1
                    {   
						ChAutoPtr<XlChartSerToCrt> pSerToCrt( ChNEW XlChartSerToCrt(*pHeader) );
						in_reader.getStream()->seek(XlRecord::HDR_SIZE, SsrwOO_CUR);
						in_reader.m_pParser->visit(*pSerToCrt);

						if (type == undef)
						{

							type = std;

							pList = ( pSerToCrt->getChartGroup() == 1 )? &m_secondaryGroupSeries :
																		 &m_mainGroupSeries;
						}
						break;
                    }
				case XlChartSerParent::ID:		//order 1
                    {   
						ChAutoPtr<XlChartSerParent> pSerParent( ChNEW XlChartSerParent(*pHeader) );
						in_reader.getStream()->seek(XlRecord::HDR_SIZE, SsrwOO_CUR);
						in_reader.m_pParser->visit(*pSerParent);

						if (type == undef)
						{
							type = aux;

							// this record seems to use 1 based indexes so subtract 1 to get 0 based
							unAuxParentInd = pSerParent->getSeriesNumber() - 1;
						}
						break;
                    }
				case XlChartSerAuxErrBar::ID:	//order 2
                    {   
						ChAutoPtr<XlChartSerAuxErrBar> pSerErr( ChNEW XlChartSerAuxErrBar(*pHeader) );
						in_reader.getStream()->seek(XlRecord::HDR_SIZE, SsrwOO_CUR);
						in_reader.m_pParser->visit(*pSerErr);

						if (type == aux)
						{
							switch ( pSerErr->getErrorBarType() )
							{
							case EB_XPLUS:
								{
									type = xPos;
									break;
								}
							case EB_XMINUS:
								{
									type = xNeg;
									break;
								}
							case EB_YPLUS:
								{
									type = yPos;
									break;
								}
							case EB_YMINUS:
								{
									type = yNeg;
									break;
								}
							}
						}
						break;
                    }
                case XlChartSerAuxTrend::ID:	//order 2
                    // no need to parse yet...
					if (type == aux)
					{
						type = trend;
					}
					// no break!
                    // step over the header as we didn't read anything.
                default:
                    in_reader.getStream()->seek( pHeader->getLength() + XlRecord::HDR_SIZE, SsrwOO_CUR );
                    break;
                }
            }
        
			switch (type)
			{
			default:	//
			case undef:	// incorrect file data
			case aux:	//
				{
					break;
				}
			case std:	// primary series
				{
					// standard series are simply appended to their list
					ChAutoPtr<SeriesDescription> pSeries( ChNEW SeriesDescription() );
					pSeries->m_primary.m_lLoc = lPos;
					pSeries->m_primary.m_unIndex = m_uCurrentIndex;
					pList->push_back(*pSeries);
					break;
				}
			case trend:	//
			case xPos:	//
			case xNeg:	// aux series
			case yPos:	//
			case yNeg:	//
				{
					// need to find the parent
					// ASSUMPTION: parent already exists.  If BIFF files define an auxillary
					// series before the parent series, this assumption is invalid and 
					// the result will be missing auxillary information.

					//Look in the main axis group first, then in the secondary axis group
					if (unAuxParentInd >= 0)
					{
						ChUINT2 iGroup;
						for (iGroup = 0; iGroup < 2; iGroup ++)
						{
							ChVector<SeriesDescription>* pList = iGroup == 0? &m_mainGroupSeries : 
																			  &m_secondaryGroupSeries;

							ChUINT2 iListItem;
							for (iListItem = 0; iListItem < pList->size(); iListItem ++)
							{
								if (pList->at(iListItem).m_primary.m_unIndex == unAuxParentInd)
								{
									switch (type)
									{
									case trend:
										{
											SeriesDesc desc;
											desc.m_lLoc = lPos;
											desc.m_unIndex = m_uCurrentIndex;
											pList->at(iListItem).m_trendlines.push_back(desc);
											break;
										}
									case xPos:
										pList->at(iListItem).m_ErrorXPos.m_lLoc = lPos;
										pList->at(iListItem).m_ErrorXPos.m_unIndex = m_uCurrentIndex;
										break;
									case xNeg:
										pList->at(iListItem).m_ErrorXNeg.m_lLoc = lPos;
										pList->at(iListItem).m_ErrorXNeg.m_unIndex = m_uCurrentIndex;
										break;
									case yPos:
										pList->at(iListItem).m_ErrorYPos.m_lLoc = lPos;
										pList->at(iListItem).m_ErrorYPos.m_unIndex = m_uCurrentIndex;
										break;
									case yNeg:
										pList->at(iListItem).m_ErrorYNeg.m_lLoc = lPos;
										pList->at(iListItem).m_ErrorYNeg.m_unIndex = m_uCurrentIndex;
										break;
									}
									iGroup = 2;	// break the group loop as we don't need to look in 
												// secondary series if we succeeded.

									break;		// break this list search
								}
							}
						}
					}
					break;
				}
			}
        }
    }
    m_uCurrentIndex ++;
}