Commit 964f057a authored by ElenaSubbotina's avatar ElenaSubbotina

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

parent d9979d12
......@@ -69,7 +69,7 @@ namespace DocFileFormat
{
}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
private:
......
......@@ -68,7 +68,7 @@ namespace DocFileFormat
{
}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
{
BookmarkFirst *newObject = new BookmarkFirst();
......
......@@ -54,7 +54,7 @@ namespace DocFileFormat
virtual ~EmptyStructure() {}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
{
EmptyStructure *newObject = new EmptyStructure();
......
......@@ -61,4 +61,4 @@ namespace DocFileFormat
return static_cast<ByteStructure*>( newObject );
}
};
}
\ No newline at end of file
}
......@@ -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();
......@@ -539,8 +539,8 @@ namespace DocFileFormat
m_RgLw97.ccpText = reader.ReadInt32();
m_RgLw97.ccpFtn = reader.ReadInt32();
m_RgLw97.ccpHdr = reader.ReadInt32();
/*m_FibWord97.ccpMcr = */reader.ReadInt32();
/*m_FibWord97.ccpMcr = */reader.ReadInt32();
m_RgLw97.ccpAtn = reader.ReadInt32();
m_RgLw97.ccpEdn = reader.ReadInt32();
m_RgLw97.ccpTxbx = 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
......
......@@ -79,7 +79,7 @@ namespace DocFileFormat
public:
FontFamilyName();
virtual ~FontFamilyName();
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
private:
long searchTerminationZero( VirtualStreamReader *reader );
......
......@@ -61,4 +61,4 @@ namespace DocFileFormat
return static_cast<ByteStructure*>( newObject );
}
};
}
\ No newline at end of file
}
......@@ -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,10 +156,11 @@ 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;
fRestartHdr = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
......@@ -189,7 +186,7 @@ namespace DocFileFormat
delete []data;
return static_cast<ByteStructure*>(newObject);
return static_cast<ByteStructure*>(newObject);
}
}
......@@ -134,7 +134,7 @@ namespace DocFileFormat
private:
NumberingLevelDescriptor *lvl[9];
NumberingLevelDescriptor lvl[9];
unsigned char fRestartHdr;
unsigned char fSpareOlst2;
......@@ -145,11 +145,11 @@ namespace DocFileFormat
public:
static const int STRUCTURE_SIZE = 212;
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
virtual ~OutlineListDescriptor();
// Parses the given StreamReader to retrieve a OLST struct
OutlineListDescriptor( unsigned char * data, int length ); //cbOLST(count of bytes of OLST) is 212
OutlineListDescriptor() {}
};
}
\ No newline at end of file
}
......@@ -97,52 +97,65 @@ namespace DocFileFormat
RELEASEARRAYOBJECTS( bytes );
}
}
NumberingLevelDescriptor::NumberingLevelDescriptor()
{
//default set
bEnabled = false;
}
NumberingLevelDescriptor::~NumberingLevelDescriptor()
{
}
NumberingLevelDescriptor::NumberingLevelDescriptor( unsigned char * data, int length )
NumberingLevelDescriptor::NumberingLevelDescriptor( unsigned char * data, int length )
{
nfc = FormatUtils::BytesToUChar(data, 0, length);
cbTextBefore = FormatUtils::BytesToUChar(data, 1, length);
cbTextAfter = FormatUtils::BytesToUChar(data, 2, length);
bEnabled = false;
int flag = FormatUtils::BytesToUChar(data, 3, length);
Parse(data, length);
}
jc = (unsigned char)( flag & 0x03 );
void NumberingLevelDescriptor::Parse(unsigned char * data, int length )
{
bEnabled = true;
fPrev = FormatUtils::BitmaskToBool( flag, 0x04 );
fHang = FormatUtils::BitmaskToBool( flag, 0x08 );
nfc = FormatUtils::BytesToUChar(data, 0, length);
cbTextBefore = FormatUtils::BytesToUChar(data, 1, length);
cbTextAfter = FormatUtils::BytesToUChar(data, 2, length);
fSetBold = FormatUtils::BitmaskToBool( flag, 0x10 );
fSetItalic = FormatUtils::BitmaskToBool( flag, 0x20 );
fSetSmallCaps = FormatUtils::BitmaskToBool( flag, 0x40 );
fSetCaps = FormatUtils::BitmaskToBool( flag, 0x80 );
int flag = FormatUtils::BytesToUChar(data, 3, length);
flag = FormatUtils::BytesToUChar(data, 4, length);;
jc = (unsigned char)( flag & 0x03 );
fSetStrike = FormatUtils::BitmaskToBool( flag, 0x01 );
fSetKul = FormatUtils::BitmaskToBool( flag, 0x02 );
fPrev = FormatUtils::BitmaskToBool( flag, 0x04 );
fHang = FormatUtils::BitmaskToBool( flag, 0x08 );
fPrevSpace = FormatUtils::BitmaskToBool( flag, 0x04 );
fBold = FormatUtils::BitmaskToBool( flag, 0x08 );
fItalic = FormatUtils::BitmaskToBool( flag, 0x10 );
fSmallCaps = FormatUtils::BitmaskToBool( flag, 0x20 );
fCaps = FormatUtils::BitmaskToBool( flag, 0x40 );
fStrike = FormatUtils::BitmaskToBool( flag, 0x80 );
fSetBold = FormatUtils::BitmaskToBool( flag, 0x10 );
fSetItalic = FormatUtils::BitmaskToBool( flag, 0x20 );
fSetSmallCaps = FormatUtils::BitmaskToBool( flag, 0x40 );
fSetCaps = FormatUtils::BitmaskToBool( flag, 0x80 );
flag = FormatUtils::BytesToUChar(data, 5, length);
flag = FormatUtils::BytesToUChar(data, 4, length);;
kul = FormatUtils::BitmaskToBool( flag, 0x07 );//3 bit
ico = FormatUtils::BitmaskToBool( flag, 0xf1 );//5 bit
fSetStrike = FormatUtils::BitmaskToBool( flag, 0x01 );
fSetKul = FormatUtils::BitmaskToBool( flag, 0x02 );
ftc = FormatUtils::BytesToInt16 (data, 6, length);
hps = FormatUtils::BytesToUInt16(data, 8, length);
fPrevSpace = FormatUtils::BitmaskToBool( flag, 0x04 );
fBold = FormatUtils::BitmaskToBool( flag, 0x08 );
fItalic = FormatUtils::BitmaskToBool( flag, 0x10 );
fSmallCaps = FormatUtils::BitmaskToBool( flag, 0x20 );
fCaps = FormatUtils::BitmaskToBool( flag, 0x40 );
fStrike = FormatUtils::BitmaskToBool( flag, 0x80 );
iStartAt = FormatUtils::BytesToUInt16(data, 10, length);
dxaIndent = FormatUtils::BytesToUInt16(data, 12, length);
dxaSpace = FormatUtils::BytesToUInt16(data, 14, length);
}
flag = FormatUtils::BytesToUChar(data, 5, length);
kul = FormatUtils::BitmaskToBool( flag, 0x07 );//3 bit
ico = FormatUtils::BitmaskToBool( flag, 0xf1 );//5 bit
ftc = FormatUtils::BytesToInt16 (data, 6, length);
hps = FormatUtils::BytesToUInt16(data, 8, length);
iStartAt = FormatUtils::BytesToUInt16(data, 10, length);
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( unsigned char * data, int length ); //cbANLV is 16 bytes
};
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));
}
}
......
......@@ -63,7 +63,7 @@ namespace DocFileFormat
virtual ~Spa();
virtual ByteStructure* ConstructObject(VirtualStreamReader* reader, int length);
virtual ByteStructure* ConstructObject(VirtualStreamReader* reader, int length);
inline int GetShapeID() const
{
return spid;
......
......@@ -51,7 +51,7 @@ namespace DocFileFormat
{
}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
{
WideString* newObject = new WideString();
......
......@@ -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