Files
core/ASCOfficeDocFile/DocDocxConverter/ListData.cpp

54 lines
1.5 KiB
C++

#include "stdafx.h"
#include "ListData.h"
namespace DocFileFormat
{
ListData::~ListData()
{
for_each( this->rglvl->begin(), this->rglvl->end(), DeleteDynamicObject() );
RELEASEOBJECT( this->rglvl );
RELEASEARRAYOBJECTS( this->_rawBytes );
}
/*========================================================================================================*/
/// Parses the StreamReader to retrieve a ListData
ListData::ListData( VirtualStreamReader* reader, int length ):
rglvl(NULL), _rawBytes(NULL)
{
long startPos = reader->GetPosition();
this->lsid = reader->ReadInt32();
this->tplc = reader->ReadInt32();
for ( int i = 0; i < 9; i++ )
{
this->rgistd.push_back( reader->ReadInt16() );
}
//parse flagbyte
int flag = (int)reader->ReadByte();
this->fSimpleList = FormatUtils::BitmaskToBool( flag, 0x01 );
if ( this->fSimpleList )
{
this->rglvl = new vector<ListLevel*>( 1 );
}
else
{
this->rglvl = new vector<ListLevel*>( 9 );
}
this->fRestartHdn = FormatUtils::BitmaskToBool( flag, 0x02 );
this->fAutoNum = FormatUtils::BitmaskToBool( flag, 0x04 );
this->fPreRTF = FormatUtils::BitmaskToBool( flag, 0x08 );
this->fHybrid = FormatUtils::BitmaskToBool( flag, 0x10 );
this->grfhic = reader->ReadByte();
reader->Seek( startPos, STREAM_SEEK_SET );
_rawBytes = reader->ReadBytes( LSTF_LENGTH, true );
}
}