Commit 964f057a authored by ElenaSubbotina's avatar ElenaSubbotina

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

parent d9979d12
...@@ -69,7 +69,7 @@ namespace DocFileFormat ...@@ -69,7 +69,7 @@ namespace DocFileFormat
{ {
} }
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ); virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
private: private:
......
...@@ -68,7 +68,7 @@ namespace DocFileFormat ...@@ -68,7 +68,7 @@ namespace DocFileFormat
{ {
} }
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ) virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
{ {
BookmarkFirst *newObject = new BookmarkFirst(); BookmarkFirst *newObject = new BookmarkFirst();
......
...@@ -54,7 +54,7 @@ namespace DocFileFormat ...@@ -54,7 +54,7 @@ namespace DocFileFormat
virtual ~EmptyStructure() {} virtual ~EmptyStructure() {}
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ) virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
{ {
EmptyStructure *newObject = new EmptyStructure(); EmptyStructure *newObject = new EmptyStructure();
......
...@@ -61,4 +61,4 @@ namespace DocFileFormat ...@@ -61,4 +61,4 @@ namespace DocFileFormat
return static_cast<ByteStructure*>( newObject ); return static_cast<ByteStructure*>( newObject );
} }
}; };
} }
\ No newline at end of file
...@@ -529,7 +529,7 @@ namespace DocFileFormat ...@@ -529,7 +529,7 @@ namespace DocFileFormat
void reset( VirtualStreamReader reader ) 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_RgLw97.cbMac = reader.ReadInt32();//32
/*m_FibWord97.fcSpare0 = */reader.ReadInt32(); /*m_FibWord97.fcSpare0 = */reader.ReadInt32();
...@@ -539,8 +539,8 @@ namespace DocFileFormat ...@@ -539,8 +539,8 @@ namespace DocFileFormat
m_RgLw97.ccpText = reader.ReadInt32(); m_RgLw97.ccpText = reader.ReadInt32();
m_RgLw97.ccpFtn = reader.ReadInt32(); m_RgLw97.ccpFtn = reader.ReadInt32();
m_RgLw97.ccpHdr = reader.ReadInt32(); m_RgLw97.ccpHdr = reader.ReadInt32();
/*m_FibWord97.ccpMcr = */reader.ReadInt32(); /*m_FibWord97.ccpMcr = */reader.ReadInt32();
m_RgLw97.ccpAtn = reader.ReadInt32(); m_RgLw97.ccpAtn = reader.ReadInt32();
m_RgLw97.ccpEdn = reader.ReadInt32(); m_RgLw97.ccpEdn = reader.ReadInt32();
m_RgLw97.ccpTxbx = reader.ReadInt32(); m_RgLw97.ccpTxbx = reader.ReadInt32();
...@@ -743,7 +743,7 @@ namespace DocFileFormat ...@@ -743,7 +743,7 @@ namespace DocFileFormat
m_FibWord97.fcSttbFnm = reader.ReadInt32(); m_FibWord97.fcSttbFnm = reader.ReadInt32();
m_FibWord97.lcbSttbFnm = reader.ReadInt32(); //676 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 reader.ReadBytes(8, false); //68
...@@ -1218,7 +1218,7 @@ namespace DocFileFormat ...@@ -1218,7 +1218,7 @@ namespace DocFileFormat
if (m_FibBase.nFib > Fib1995) if (m_FibBase.nFib > Fib1995)
csw = reader.ReadUInt16(); //32 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 //read the RgW97
......
...@@ -79,7 +79,7 @@ namespace DocFileFormat ...@@ -79,7 +79,7 @@ namespace DocFileFormat
public: public:
FontFamilyName(); FontFamilyName();
virtual ~FontFamilyName(); virtual ~FontFamilyName();
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ); virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
private: private:
long searchTerminationZero( VirtualStreamReader *reader ); long searchTerminationZero( VirtualStreamReader *reader );
......
...@@ -61,4 +61,4 @@ namespace DocFileFormat ...@@ -61,4 +61,4 @@ namespace DocFileFormat
return static_cast<ByteStructure*>( newObject ); return static_cast<ByteStructure*>( newObject );
} }
}; };
} }
\ No newline at end of file
...@@ -148,11 +148,7 @@ namespace DocFileFormat ...@@ -148,11 +148,7 @@ namespace DocFileFormat
} }
OutlineListDescriptor::~OutlineListDescriptor() 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 ) OutlineListDescriptor::OutlineListDescriptor( unsigned char * data, int length )
{ {
...@@ -160,10 +156,11 @@ namespace DocFileFormat ...@@ -160,10 +156,11 @@ namespace DocFileFormat
for (int i = 0 ; i < 9; i++) for (int i = 0 ; i < 9; i++)
{ {
lvl[i] = new NumberingLevelDescriptor(data + pos, length - pos); lvl[i].Parse(data + pos, length - pos);
pos += 16; 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; fSpareOlst2 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2; fSpareOlst3 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2; fSpareOlst4 = FormatUtils::BytesToUChar(data, pos, length); pos += 2;
...@@ -189,7 +186,7 @@ namespace DocFileFormat ...@@ -189,7 +186,7 @@ namespace DocFileFormat
delete []data; delete []data;
return static_cast<ByteStructure*>(newObject); return static_cast<ByteStructure*>(newObject);
} }
} }
...@@ -134,7 +134,7 @@ namespace DocFileFormat ...@@ -134,7 +134,7 @@ namespace DocFileFormat
private: private:
NumberingLevelDescriptor *lvl[9]; NumberingLevelDescriptor lvl[9];
unsigned char fRestartHdr; unsigned char fRestartHdr;
unsigned char fSpareOlst2; unsigned char fSpareOlst2;
...@@ -145,11 +145,11 @@ namespace DocFileFormat ...@@ -145,11 +145,11 @@ namespace DocFileFormat
public: public:
static const int STRUCTURE_SIZE = 212; static const int STRUCTURE_SIZE = 212;
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ); virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length );
virtual ~OutlineListDescriptor(); virtual ~OutlineListDescriptor();
// Parses the given StreamReader to retrieve a OLST struct // Parses the given StreamReader to retrieve a OLST struct
OutlineListDescriptor( unsigned char * data, int length ); //cbOLST(count of bytes of OLST) is 212 OutlineListDescriptor( unsigned char * data, int length ); //cbOLST(count of bytes of OLST) is 212
OutlineListDescriptor() {} OutlineListDescriptor() {}
}; };
} }
\ No newline at end of file
...@@ -97,52 +97,65 @@ namespace DocFileFormat ...@@ -97,52 +97,65 @@ namespace DocFileFormat
RELEASEARRAYOBJECTS( bytes ); RELEASEARRAYOBJECTS( bytes );
} }
} }
NumberingLevelDescriptor::NumberingLevelDescriptor()
{
//default set
bEnabled = false;
}
NumberingLevelDescriptor::~NumberingLevelDescriptor() NumberingLevelDescriptor::~NumberingLevelDescriptor()
{ {
} }
NumberingLevelDescriptor::NumberingLevelDescriptor( unsigned char * data, int length ) NumberingLevelDescriptor::NumberingLevelDescriptor( unsigned char * data, int length )
{ {
nfc = FormatUtils::BytesToUChar(data, 0, length); bEnabled = false;
cbTextBefore = FormatUtils::BytesToUChar(data, 1, length);
cbTextAfter = FormatUtils::BytesToUChar(data, 2, length);
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 ); nfc = FormatUtils::BytesToUChar(data, 0, length);
fHang = FormatUtils::BitmaskToBool( flag, 0x08 ); cbTextBefore = FormatUtils::BytesToUChar(data, 1, length);
cbTextAfter = FormatUtils::BytesToUChar(data, 2, length);
fSetBold = FormatUtils::BitmaskToBool( flag, 0x10 ); int flag = FormatUtils::BytesToUChar(data, 3, length);
fSetItalic = FormatUtils::BitmaskToBool( flag, 0x20 );
fSetSmallCaps = FormatUtils::BitmaskToBool( flag, 0x40 );
fSetCaps = FormatUtils::BitmaskToBool( flag, 0x80 );
flag = FormatUtils::BytesToUChar(data, 4, length);; jc = (unsigned char)( flag & 0x03 );
fSetStrike = FormatUtils::BitmaskToBool( flag, 0x01 ); fPrev = FormatUtils::BitmaskToBool( flag, 0x04 );
fSetKul = FormatUtils::BitmaskToBool( flag, 0x02 ); fHang = FormatUtils::BitmaskToBool( flag, 0x08 );
fPrevSpace = FormatUtils::BitmaskToBool( flag, 0x04 ); fSetBold = FormatUtils::BitmaskToBool( flag, 0x10 );
fBold = FormatUtils::BitmaskToBool( flag, 0x08 ); fSetItalic = FormatUtils::BitmaskToBool( flag, 0x20 );
fItalic = FormatUtils::BitmaskToBool( flag, 0x10 ); fSetSmallCaps = FormatUtils::BitmaskToBool( flag, 0x40 );
fSmallCaps = FormatUtils::BitmaskToBool( flag, 0x20 ); fSetCaps = FormatUtils::BitmaskToBool( flag, 0x80 );
fCaps = FormatUtils::BitmaskToBool( flag, 0x40 );
fStrike = FormatUtils::BitmaskToBool( flag, 0x80 );
flag = FormatUtils::BytesToUChar(data, 5, length); flag = FormatUtils::BytesToUChar(data, 4, length);;
kul = FormatUtils::BitmaskToBool( flag, 0x07 );//3 bit fSetStrike = FormatUtils::BitmaskToBool( flag, 0x01 );
ico = FormatUtils::BitmaskToBool( flag, 0xf1 );//5 bit fSetKul = FormatUtils::BitmaskToBool( flag, 0x02 );
ftc = FormatUtils::BytesToInt16 (data, 6, length); fPrevSpace = FormatUtils::BitmaskToBool( flag, 0x04 );
hps = FormatUtils::BytesToUInt16(data, 8, length); 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); flag = FormatUtils::BytesToUChar(data, 5, length);
dxaIndent = FormatUtils::BytesToUInt16(data, 12, length);
dxaSpace = FormatUtils::BytesToUInt16(data, 14, 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 ...@@ -141,8 +141,11 @@ namespace DocFileFormat
unsigned short dxaIndent; unsigned short dxaIndent;
unsigned short dxaSpace; unsigned short dxaSpace;
public: public:
bool bEnabled;
virtual ~NumberingLevelDescriptor(); virtual ~NumberingLevelDescriptor();
// Parses the given StreamReader to retrieve a ANLV struct // 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 ...@@ -86,7 +86,8 @@ namespace DocFileFormat
{ {
for (int i = 0; i < n; ++i) 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 ...@@ -63,7 +63,7 @@ namespace DocFileFormat
virtual ~Spa(); virtual ~Spa();
virtual ByteStructure* ConstructObject(VirtualStreamReader* reader, int length); virtual ByteStructure* ConstructObject(VirtualStreamReader* reader, int length);
inline int GetShapeID() const inline int GetShapeID() const
{ {
return spid; return spid;
......
...@@ -51,7 +51,7 @@ namespace DocFileFormat ...@@ -51,7 +51,7 @@ namespace DocFileFormat
{ {
} }
virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length ) virtual ByteStructure* ConstructObject( VirtualStreamReader* reader, int length )
{ {
WideString* newObject = new WideString(); WideString* newObject = new WideString();
......
...@@ -104,14 +104,14 @@ namespace DocFileFormat ...@@ -104,14 +104,14 @@ namespace DocFileFormat
if (FIB->m_FibBase.nFib) if (FIB->m_FibBase.nFib)
{ {
if (FIB->m_FibBase.nFib < Fib1997) if (FIB->m_FibBase.nFib <= Fib1995)
{ {
bOlderVersion = FIB->m_bOlderVersion = true; bOlderVersion = FIB->m_bOlderVersion = true;
} }
} }
else 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; bOlderVersion = FIB->m_bOlderVersion = true;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
QT -= core QT -= core
QT -= gui QT -= gui
VERSION = 2.0.2.390 VERSION = 2.0.2.391
DEFINES += INTVER=$$VERSION DEFINES += INTVER=$$VERSION
TEMPLATE = app 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