Commit 964f057a authored by ElenaSubbotina's avatar ElenaSubbotina

DocFormatReader - fix wrong FIB.version - users-02.doc

parent d9979d12
......@@ -529,7 +529,7 @@ namespace DocFileFormat
void reset( VirtualStreamReader reader )
{
if (m_FibBase.nFib > 0 && m_FibBase.nFib < Fib1997)
if (m_FibBase.nFib > 0 && m_FibBase.nFib <= Fib1995)
{
m_RgLw97.cbMac = reader.ReadInt32();//32
/*m_FibWord97.fcSpare0 = */reader.ReadInt32();
......@@ -743,7 +743,7 @@ namespace DocFileFormat
m_FibWord97.fcSttbFnm = reader.ReadInt32();
m_FibWord97.lcbSttbFnm = reader.ReadInt32(); //676
}
if (m_FibBase.nFib >= Fib1997 || m_FibBase.nFib == 0)
if (m_FibBase.nFib > Fib1995 || m_FibBase.nFib == 0)
{
reader.ReadBytes(8, false); //68
......@@ -1218,7 +1218,7 @@ namespace DocFileFormat
if (m_FibBase.nFib > Fib1995)
csw = reader.ReadUInt16(); //32
if (m_FibBase.nFib >= Fib1997 || m_FibBase.nFib == 0)
if (m_FibBase.nFib > Fib1995 || m_FibBase.nFib == 0)
{
//read the RgW97
......
......@@ -148,11 +148,7 @@ namespace DocFileFormat
}
OutlineListDescriptor::~OutlineListDescriptor()
{
for (int i = 0 ; i < 9; i++)
{
if (lvl[i]) delete lvl[i];
lvl[i] = NULL;
}
}
OutlineListDescriptor::OutlineListDescriptor( unsigned char * data, int length )
{
......@@ -160,9 +156,10 @@ namespace DocFileFormat
for (int i = 0 ; i < 9; i++)
{
lvl[i] = new NumberingLevelDescriptor(data + pos, length - pos);
lvl[i].Parse(data + pos, length - pos);
pos += 16;
}
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
......
......@@ -134,7 +134,7 @@ namespace DocFileFormat
private:
NumberingLevelDescriptor *lvl[9];
NumberingLevelDescriptor lvl[9];
unsigned char fRestartHdr;
unsigned char fSpareOlst2;
......
......@@ -97,6 +97,11 @@ namespace DocFileFormat
RELEASEARRAYOBJECTS( bytes );
}
}
NumberingLevelDescriptor::NumberingLevelDescriptor()
{
//default set
bEnabled = false;
}
NumberingLevelDescriptor::~NumberingLevelDescriptor()
{
......@@ -104,6 +109,15 @@ namespace DocFileFormat
NumberingLevelDescriptor::NumberingLevelDescriptor( unsigned char * data, int length )
{
bEnabled = false;
Parse(data, length);
}
void NumberingLevelDescriptor::Parse(unsigned char * data, int length )
{
bEnabled = true;
nfc = FormatUtils::BytesToUChar(data, 0, length);
cbTextBefore = FormatUtils::BytesToUChar(data, 1, length);
cbTextAfter = FormatUtils::BytesToUChar(data, 2, length);
......@@ -144,5 +158,4 @@ namespace DocFileFormat
dxaIndent = FormatUtils::BytesToUInt16(data, 12, length);
dxaSpace = FormatUtils::BytesToUInt16(data, 14, length);
}
}
......@@ -141,8 +141,11 @@ namespace DocFileFormat
unsigned short dxaIndent;
unsigned short dxaSpace;
public:
bool bEnabled;
virtual ~NumberingLevelDescriptor();
// Parses the given StreamReader to retrieve a ANLV struct
NumberingLevelDescriptor();
NumberingLevelDescriptor( unsigned char * data, int length ); //cbANLV is 16 bytes
void Parse( unsigned char * data, int length );
};
}
......@@ -86,7 +86,8 @@ namespace DocFileFormat
{
for (int i = 0; i < n; ++i)
{
Elements.push_back(T().ConstructObject(&reader, structureLength));
T object;
Elements.push_back(object.ConstructObject(&reader, structureLength));
}
}
......
......@@ -104,14 +104,14 @@ namespace DocFileFormat
if (FIB->m_FibBase.nFib)
{
if (FIB->m_FibBase.nFib < Fib1997)
if (FIB->m_FibBase.nFib <= Fib1995)
{
bOlderVersion = FIB->m_bOlderVersion = true;
}
}
else
{
if (FIB->m_FibNew.nFibNew < Fib1997 && FIB->m_FibNew.nFibNew > 0)
if (FIB->m_FibNew.nFibNew <= Fib1995 && FIB->m_FibNew.nFibNew > 0)
{
bOlderVersion = FIB->m_bOlderVersion = true;
}
......
......@@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.0.2.390
VERSION = 2.0.2.391
DEFINES += INTVER=$$VERSION
TEMPLATE = app
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment