[Libreoffice-commits] .: doc-dump.py src/docdirstream.py src/docrecord.py src/docstream.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed Nov 7 06:37:56 PST 2012
doc-dump.py | 34 +++
src/docdirstream.py | 32 +++
src/docrecord.py | 110 +++++++++++
src/docstream.py | 502 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 678 insertions(+)
New commits:
commit 52348b33de681263a51bd7bdc9b508d9ae88ee08
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Nov 7 13:26:39 2012 +0100
initial doc (WW8) support
diff --git a/doc-dump.py b/doc-dump.py
new file mode 100755
index 0000000..ac1fba6
--- /dev/null
+++ b/doc-dump.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import sys
+sys.path.append(sys.path[0]+"/src")
+import globals
+import docstream
+
+class DOCDumper:
+ def __init__(self, filepath, params):
+ self.filepath = filepath
+ self.params = params
+
+ def dump(self):
+ file = open(self.filepath, 'rb')
+ strm = docstream.DOCFile(file.read(), self.params)
+ file.close()
+ dirnames = strm.getDirectoryNames()
+ print '<?xml version="1.0"?>\n<streams>'
+ for dirname in dirnames:
+ if len(dirname) == 0 or dirname in ['Root Entry']:
+ continue
+ strm.getDirectoryStreamByName(dirname).dump()
+ print '</streams>'
+
+def main(args):
+ exname, args = args[0], args[1:]
+ params = globals.Params()
+ dumper = DOCDumper(args[0], params)
+ dumper.dump()
+
+if __name__ == '__main__':
+ main(sys.argv)
+
+# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
diff --git a/src/docdirstream.py b/src/docdirstream.py
new file mode 100755
index 0000000..9f1ccd5
--- /dev/null
+++ b/src/docdirstream.py
@@ -0,0 +1,32 @@
+#!/usr/bin/env python
+
+import globals
+
+class DOCDirStream:
+ """Represents one single word file subdirectory, like e.g. 'WordDocument'."""
+
+ def __init__(self, bytes, params = None, name = None, mainStream = None, doc = None):
+ self.bytes = bytes
+ self.size = len(self.bytes)
+ self.pos = 0
+ self.params = params
+ self.name = name
+ self.mainStream = mainStream
+ self.doc = doc
+
+ def printAndSet(self, key, value, hexdump = True, end = True):
+ setattr(self, key, value)
+ if hexdump:
+ value = hex(value)
+ if end:
+ print '<%s value="%s"/>' % (key, value)
+ else:
+ print '<%s value="%s">' % (key, value)
+
+ def getBit(self, byte, bitNumber):
+ return (byte & (1 << bitNumber)) >> bitNumber
+
+ def dump(self):
+ print '<stream name="%s" size="%s"/>' % (globals.encodeName(self.name), self.size)
+
+# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
diff --git a/src/docrecord.py b/src/docrecord.py
new file mode 100755
index 0000000..df79c24
--- /dev/null
+++ b/src/docrecord.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+
+import struct
+from docdirstream import DOCDirStream
+import globals
+
+class FcCompressed(DOCDirStream):
+ """The FcCompressed structure specifies the location of text in the WordDocument Stream."""
+ def __init__(self, bytes, mainStream, offset, size):
+ DOCDirStream.__init__(self, bytes, mainStream=mainStream)
+ self.pos = offset
+ self.size = size
+
+ def dump(self):
+ print '<fcCompressed type="FcCompressed" offset="%d" size="%d bytes">' % (self.pos, self.size)
+ buf = struct.unpack("<I", self.bytes[self.pos:self.pos+4])[0]
+ self.pos += 4
+ self.printAndSet("fc", buf & ((2**32-1) >> 2)) # bits 0..29
+ self.printAndSet("fCompressed", self.getBit(buf, 30))
+ self.printAndSet("r1", self.getBit(buf, 31))
+ print '</fcCompressed>'
+
+ def getTransformedAddress(self):
+ if self.fCompressed:
+ return self.fc/2
+ else:
+ print "TODO FcCompressed: fCompressed = 0 not supported"
+
+class Pcd(DOCDirStream):
+ """The Pcd structure specifies the location of text in the WordDocument Stream and additional properties for this text."""
+ def __init__(self, bytes, mainStream, offset, size):
+ DOCDirStream.__init__(self, bytes, mainStream=mainStream)
+ self.pos = offset
+ self.size = size
+
+ def dump(self):
+ print '<pcd type="Pcd" offset="%d" size="%d bytes">' % (self.pos, self.size)
+ buf = struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0]
+ self.pos += 2
+ self.printAndSet("fNoParaLast", self.getBit(buf, 0))
+ self.printAndSet("fR1", self.getBit(buf, 1))
+ self.printAndSet("fDirty", self.getBit(buf, 2))
+ self.printAndSet("fR2", buf & (2**13-1))
+ self.fc = FcCompressed(self.bytes, self.mainStream, self.pos, 4)
+ self.fc.dump()
+ self.pos += 4
+ print '</pcd>'
+
+class PlcPcd(DOCDirStream):
+ """The PlcPcd structure is a PLC whose data elements are Pcds (8 bytes each)."""
+ def __init__(self, bytes, mainStream, offset, size):
+ DOCDirStream.__init__(self, bytes, mainStream=mainStream)
+ self.pos = offset
+ self.size = size
+
+ def dump(self):
+ print '<plcPcd type="PlcPcd" offset="%d" size="%d bytes">' % (self.pos, self.size)
+ elements = (self.size - 4) / (4 + 8) # 8 is defined by 2.8.35, the rest is defined by 2.2.2
+ pos = self.pos
+ self.ranges = []
+ self.aPcds = []
+ for i in range(elements):
+ start = struct.unpack("<I", self.bytes[pos:pos+4])[0]
+ end = struct.unpack("<I", self.bytes[pos+4:pos+8])[0]
+ print '<aCP index="%d" start="%d" end="%d"/>' % (i, start, end)
+ self.ranges.append((start, end))
+ pos += 4
+ for i in range(elements):
+ offset = self.pos + ( 4 * ( elements + 1 ) ) + ( 8 * i ) # 8 as defined by 2.8.35
+ self.aPcds.append(Pcd(self.bytes, self.mainStream, offset, 8))
+ self.aPcds[-1].dump()
+ for i, item in enumerate(self.ranges):
+ start, end = item
+ offset = self.aPcds[i].fc.getTransformedAddress()
+ print '<aCPTransformed index="%d" value="%s"/>' % (i, globals.encodeName(self.mainStream.bytes[offset:offset+end-start]))
+ print '</plcPcd>'
+
+class Pcdt(DOCDirStream):
+ """The Pcdt structure contains a PlcPcd structure and specifies its size."""
+ def __init__(self, bytes, mainStream, offset, size):
+ DOCDirStream.__init__(self, bytes, mainStream=mainStream)
+ self.pos = offset
+ self.size = size
+
+ def dump(self):
+ print '<pcdt type="Pcdt" offset="%d" size="%d bytes">' % (self.pos, self.size)
+ self.printAndSet("clxt", ord(struct.unpack("<c", self.bytes[self.pos:self.pos+1])[0]))
+ self.pos += 1
+ self.printAndSet("lcb", struct.unpack("<I", self.bytes[self.pos:self.pos+4])[0])
+ self.pos += 4
+ PlcPcd(self.bytes, self.mainStream, self.pos, self.lcb).dump()
+ print '</pcdt>'
+
+class Clx(DOCDirStream):
+ def __init__(self, bytes, mainStream, offset, size):
+ DOCDirStream.__init__(self, bytes, mainStream=mainStream)
+ self.pos = offset
+ self.size = size
+
+ def dump(self):
+ print '<clx type="Clx" offset="%d" size="%d bytes">' % (self.pos, self.size)
+ firstByte = ord(struct.unpack("<c", self.bytes[self.pos:self.pos+1])[0])
+ if firstByte == 0x02:
+ print '<info what="Array of Prc, 0 elements"/>'
+ Pcdt(self.bytes, self.mainStream, self.pos, self.size).dump()
+ else:
+ print '<todo what="Clx::dump() first byte is not 0x02"/>'
+ print '</clx>'
+
+# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
diff --git a/src/docstream.py b/src/docstream.py
new file mode 100755
index 0000000..f14dba5
--- /dev/null
+++ b/src/docstream.py
@@ -0,0 +1,502 @@
+#!/usr/bin/env python
+
+import ole
+import struct
+from docdirstream import DOCDirStream
+import docrecord
+
+class DOCFile:
+ """Represents the whole word file - feed will all bytes."""
+ def __init__ (self, chars, params):
+ self.chars = chars
+ self.size = len(self.chars)
+ self.params = params
+
+ self.header = ole.Header(self.chars, self.params)
+ self.pos = self.header.parse()
+
+ def __getDirectoryObj(self):
+ obj = self.header.getDirectory()
+ obj.parseDirEntries()
+ return obj
+
+ def getDirectoryNames(self):
+ return self.__getDirectoryObj().getDirectoryNames()
+
+ def getDirectoryStreamByName(self, name):
+ obj = self.__getDirectoryObj()
+ bytes = obj.getRawStreamByName(name)
+ if name == "WordDocument":
+ return WordDocumentStream(bytes, self.params, doc=self)
+ if name == "1Table":
+ return TableStream(bytes, self.params, name, doc=self)
+ else:
+ return DOCDirStream(bytes, self.params, name, doc=self)
+
+class TableStream(DOCDirStream):
+ def __init__(self, bytes, params, name, doc):
+ DOCDirStream.__init__(self, bytes, params, name, doc = doc)
+
+ def dump(self):
+ print '<stream name="%s" size="%s"/>' % (self.name, self.size)
+
+class WordDocumentStream(DOCDirStream):
+ def __init__(self, bytes, params, doc):
+ DOCDirStream.__init__(self, bytes, params, "WordDocument", doc = doc)
+
+ def dump(self):
+ print '<stream name="WordDocument" size="%d">' % self.size
+ self.dumpFib()
+ print '</stream>'
+
+ def dumpFib(self):
+ print '<fib>'
+ self.dumpFibBase("base")
+ self.printAndSet("csw", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+ self.dumpFibRgW97("fibRgW")
+ self.printAndSet("cslw", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+ self.dumpFibRgLw97("fibRgLw")
+ self.printAndSet("cbRgFcLcb", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+ self.dumpFibRgFcLcb("fibRgFcLcbBlob")
+ self.printAndSet("cswNew", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+ print '</fib>'
+
+ def dumpFibBase(self, name):
+ print '<%s type="FibBase" size="32 bytes">' % name
+
+ self.printAndSet("wIndent", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+
+ self.printAndSet("nFib", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+
+ self.printAndSet("unused", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+
+ self.printAndSet("lid", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+
+ self.printAndSet("pnNext", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+
+ buf = struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0]
+ self.pos += 2
+ self.printAndSet("fDot", self.getBit(buf, 0))
+ self.printAndSet("fGlsy", self.getBit(buf, 1))
+ self.printAndSet("fComplex", self.getBit(buf, 2))
+ self.printAndSet("fHasPic", self.getBit(buf, 3))
+
+ self.printAndSet("cQuickSaves", ((buf & (2**4-1 << 4)) >> 4), hexdump=False)
+
+ self.printAndSet("fEncrypted", self.getBit(buf, 8))
+ self.printAndSet("fWhichTblStm", self.getBit(buf, 9))
+ self.printAndSet("fReadOnlyRecommended", self.getBit(buf, 10))
+ self.printAndSet("fWriteReservation", self.getBit(buf, 11))
+
+ self.printAndSet("fExtChar", self.getBit(buf, 12))
+ self.printAndSet("fLoadOverride", self.getBit(buf, 13))
+ self.printAndSet("fFarEast", self.getBit(buf, 14))
+ self.printAndSet("fObfuscated", self.getBit(buf, 15))
+
+ self.printAndSet("nFibBack", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+
+ self.printAndSet("lKey", struct.unpack("<I", self.bytes[self.pos:self.pos+4])[0])
+ self.pos += 4
+
+ self.printAndSet("envr", ord(struct.unpack("<c", self.bytes[self.pos:self.pos+1])[0]))
+ self.pos += 1
+
+ buf = ord(struct.unpack("<c", self.bytes[self.pos:self.pos+1])[0])
+ self.pos += 1
+
+ self.printAndSet("fMac", self.getBit(buf, 0))
+ self.printAndSet("fEmptySpecial", self.getBit(buf, 1))
+ self.printAndSet("fLoadOverridePage", self.getBit(buf, 2))
+ self.printAndSet("reserved1", self.getBit(buf, 3))
+ self.printAndSet("reserved2", self.getBit(buf, 4))
+ self.printAndSet("fSpare0", (buf & (2**3-1)))
+
+ self.printAndSet("reserved3", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+ self.printAndSet("reserved4", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+ self.printAndSet("reserved5", struct.unpack("<L", self.bytes[self.pos:self.pos+4])[0])
+ self.pos += 4
+ self.printAndSet("reserved6", struct.unpack("<L", self.bytes[self.pos:self.pos+4])[0])
+ self.pos += 4
+
+ print '</%s>' % name
+
+ def dumpFibRgW97(self, name):
+ print '<%s type="FibRgW97" size="28 bytes">' % name
+
+ for i in range(13):
+ self.printAndSet("reserved%d" % (i + 1), struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+ self.printAndSet("lidFE", struct.unpack("<H", self.bytes[self.pos:self.pos+2])[0])
+ self.pos += 2
+
+ print '</%s>' % name
+
+ def dumpFibRgLw97(self, name):
+ print '<%s type="FibRgLw97" size="88 bytes">' % name
+
+ fields = [
+ "cbMac",
+ "reserved1",
+ "reserved2",
+ "ccpText",
+ "ccpFtn",
+ "ccpHdd",
+ "reserved3",
+ "ccpAtn",
+ "ccpEdn",
+ "ccpTxbx",
+ "ccpHdrTxbx",
+ "reserved4",
+ "reserved5",
+ "reserved6",
+ "reserved7",
+ "reserved8",
+ "reserved9",
+ "reserved10",
+ "reserved11",
+ "reserved12",
+ "reserved13",
+ "reserved14",
+ ]
+ for i in fields:
+ self.printAndSet(i, struct.unpack("<L", self.bytes[self.pos:self.pos+4])[0])
+ self.pos += 4
+
+ print '</%s>' % name
+
+ def dumpFibRgFcLcb(self, name):
+ if self.nFib == 0x00c1:
+ self.dumpFibRgFcLcb97(name)
+ elif self.nFib == 0x0101:
+ self.dumpFibRgFcLcb2002(name)
+ else:
+ print """<todo what="dumpFibRgFcLcb() doesn't know how to handle nFib = %s">""" % hex(self.nFib)
+
+ def __dumpFibRgFcLcb97(self):
+ # should be 186
+ fields = [
+ ["fcStshfOrig"],
+ ["lcbStshfOrig"],
+ ["fcStshf"],
+ ["lcbStshf"],
+ ["fcPlcffndRef"],
+ ["lcbPlcffndRef"],
+ ["fcPlcffndTxt"],
+ ["lcbPlcffndTxt"],
+ ["fcPlcfandRef"],
+ ["lcbPlcfandRef"],
+ ["fcPlcfandTxt"],
+ ["lcbPlcfandTxt"],
+ ["fcPlcfSed"],
+ ["lcbPlcfSed"],
+ ["fcPlcPad"],
+ ["lcbPlcPad"],
+ ["fcPlcfPhe"],
+ ["lcbPlcfPhe"],
+ ["fcSttbfGlsy"],
+ ["lcbSttbfGlsy"],
+ ["fcPlcfGlsy"],
+ ["lcbPlcfGlsy"],
+ ["fcPlcfHdd"],
+ ["lcbPlcfHdd"],
+ ["fcPlcfBteChpx"],
+ ["lcbPlcfBteChpx"],
+ ["fcPlcfBtePapx"],
+ ["lcbPlcfBtePapx"],
+ ["fcPlcfSea"],
+ ["lcbPlcfSea"],
+ ["fcSttbfFfn"],
+ ["lcbSttbfFfn"],
+ ["fcPlcfFldMom"],
+ ["lcbPlcfFldMom"],
+ ["fcPlcfFldHdr"],
+ ["lcbPlcfFldHdr"],
+ ["fcPlcfFldFtn"],
+ ["lcbPlcfFldFtn"],
+ ["fcPlcfFldAtn"],
+ ["lcbPlcfFldAtn"],
+ ["fcPlcfFldMcr"],
+ ["lcbPlcfFldMcr"],
+ ["fcSttbfBkmk"],
+ ["lcbSttbfBkmk"],
+ ["fcPlcfBkf"],
+ ["lcbPlcfBkf"],
+ ["fcPlcfBkl"],
+ ["lcbPlcfBkl"],
+ ["fcCmds"],
+ ["lcbCmds"],
+ ["fcUnused1"],
+ ["lcbUnused1"],
+ ["fcSttbfMcr"],
+ ["lcbSttbfMcr"],
+ ["fcPrDrvr"],
+ ["lcbPrDrvr"],
+ ["fcPrEnvPort"],
+ ["lcbPrEnvPort"],
+ ["fcPrEnvLand"],
+ ["lcbPrEnvLand"],
+ ["fcWss"],
+ ["lcbWss"],
+ ["fcDop"],
+ ["lcbDop"],
+ ["fcSttbfAssoc"],
+ ["lcbSttbfAssoc"],
+ ["fcClx"],
+ ["lcbClx", self.handleLcbClx],
+ ["fcPlcfPgdFtn"],
+ ["lcbPlcfPgdFtn"],
+ ["fcAutosaveSource"],
+ ["lcbAutosaveSource"],
+ ["fcGrpXstAtnOwners"],
+ ["lcbGrpXstAtnOwners"],
+ ["fcSttbfAtnBkmk"],
+ ["lcbSttbfAtnBkmk"],
+ ["fcUnused2"],
+ ["lcbUnused2"],
+ ["fcUnused3"],
+ ["lcbUnused3"],
+ ["fcPlcSpaMom"],
+ ["lcbPlcSpaMom"],
+ ["fcPlcSpaHdr"],
+ ["lcbPlcSpaHdr"],
+ ["fcPlcfAtnBkf"],
+ ["lcbPlcfAtnBkf"],
+ ["fcPlcfAtnBkl"],
+ ["lcbPlcfAtnBkl"],
+ ["fcPms"],
+ ["lcbPms"],
+ ["fcFormFldSttbs"],
+ ["lcbFormFldSttbs"],
+ ["fcPlcfendRef"],
+ ["lcbPlcfendRef"],
+ ["fcPlcfendTxt"],
+ ["lcbPlcfendTxt"],
+ ["fcPlcfFldEdn"],
+ ["lcbPlcfFldEdn"],
+ ["fcUnused4"],
+ ["lcbUnused4"],
+ ["fcDggInfo"],
+ ["lcbDggInfo"],
+ ["fcSttbfRMark"],
+ ["lcbSttbfRMark"],
+ ["fcSttbfCaption"],
+ ["lcbSttbfCaption"],
+ ["fcSttbfAutoCaption"],
+ ["lcbSttbfAutoCaption"],
+ ["fcPlcfWkb"],
+ ["lcbPlcfWkb"],
+ ["fcPlcfSpl"],
+ ["lcbPlcfSpl"],
+ ["fcPlcftxbxTxt"],
+ ["lcbPlcftxbxTxt"],
+ ["fcPlcfFldTxbx"],
+ ["lcbPlcfFldTxbx"],
+ ["fcPlcfHdrtxbxTxt"],
+ ["lcbPlcfHdrtxbxTxt"],
+ ["fcPlcffldHdrTxbx"],
+ ["lcbPlcffldHdrTxbx"],
+ ["fcStwUser"],
+ ["lcbStwUser"],
+ ["fcSttbTtmbd"],
+ ["lcbSttbTtmbd"],
+ ["fcCookieData"],
+ ["lcbCookieData"],
+ ["fcPgdMotherOldOld"],
+ ["lcbPgdMotherOldOld"],
+ ["fcBkdMotherOldOld"],
+ ["lcbBkdMotherOldOld"],
+ ["fcPgdFtnOldOld"],
+ ["lcbPgdFtnOldOld"],
+ ["fcBkdFtnOldOld"],
+ ["lcbBkdFtnOldOld"],
+ ["fcPgdEdnOldOld"],
+ ["lcbPgdEdnOldOld"],
+ ["fcBkdEdnOldOld"],
+ ["lcbBkdEdnOldOld"],
+ ["fcSttbfIntlFld"],
+ ["lcbSttbfIntlFld"],
+ ["fcRouteSlip"],
+ ["lcbRouteSlip"],
+ ["fcSttbSavedBy"],
+ ["lcbSttbSavedBy"],
+ ["fcSttbFnm"],
+ ["lcbSttbFnm"],
+ ["fcPlfLst"],
+ ["lcbPlfLst"],
+ ["fcPlfLfo"],
+ ["lcbPlfLfo"],
+ ["fcPlcfTxbxBkd"],
+ ["lcbPlcfTxbxBkd"],
+ ["fcPlcfTxbxHdrBkd"],
+ ["lcbPlcfTxbxHdrBkd"],
+ ["fcDocUndoWord9"],
+ ["lcbDocUndoWord9"],
+ ["fcRgbUse"],
+ ["lcbRgbUse"],
+ ["fcUsp"],
+ ["lcbUsp"],
+ ["fcUskf"],
+ ["lcbUskf"],
+ ["fcPlcupcRgbUse"],
+ ["lcbPlcupcRgbUse"],
+ ["fcPlcupcUsp"],
+ ["lcbPlcupcUsp"],
+ ["fcSttbGlsyStyle"],
+ ["lcbSttbGlsyStyle"],
+ ["fcPlgosl"],
+ ["lcbPlgosl"],
+ ["fcPlcocx"],
+ ["lcbPlcocx"],
+ ["fcPlcfBteLvc"],
+ ["lcbPlcfBteLvc"],
+ ["dwLowDateTime"],
+ ["dwHighDateTime"],
+ ["fcPlcfLvcPre10"],
+ ["lcbPlcfLvcPre10"],
+ ["fcPlcfAsumy"],
+ ["lcbPlcfAsumy"],
+ ["fcPlcfGram"],
+ ["lcbPlcfGram"],
+ ["fcSttbListNames"],
+ ["lcbSttbListNames"],
+ ["fcSttbfUssr"],
+ ["lcbSttbfUssr"],
+ ]
+ for i in fields:
+ self.printAndSet(i[0], struct.unpack("<L", self.bytes[self.pos:self.pos+4])[0], end = len(i) == 1)
+ self.pos += 4
+ if len(i) > 1:
+ i[1]()
+ print '</%s>' % i[0]
+
+ def handleLcbClx(self):
+ offset = self.fcClx
+ size = self.lcbClx
+ clx = docrecord.Clx(self.doc.getDirectoryStreamByName("1Table").bytes, self, offset, size)
+ clx.dump()
+
+ def dumpFibRgFcLcb97(self, name):
+ print '<%s type="FibRgFcLcb97" size="744 bytes">' % name
+ self.__dumpFibRgFcLcb97()
+ print '</%s>' % name
+
+ def __dumpFibRgFcLcb2000(self):
+ self.__dumpFibRgFcLcb97()
+ fields = [
+ "fcPlcfTch",
+ "lcbPlcfTch",
+ "fcRmdThreading",
+ "lcbRmdThreading",
+ "fcMid",
+ "lcbMid",
+ "fcSttbRgtplc",
+ "lcbSttbRgtplc",
+ "fcMsoEnvelope",
+ "lcbMsoEnvelope",
+ "fcPlcfLad",
+ "lcbPlcfLad",
+ "fcRgDofr",
+ "lcbRgDofr",
+ "fcPlcosl",
+ "lcbPlcosl",
+ "fcPlcfCookieOld",
+ "lcbPlcfCookieOld",
+ "fcPgdMotherOld",
+ "lcbPgdMotherOld",
+ "fcBkdMotherOld",
+ "lcbBkdMotherOld",
+ "fcPgdFtnOld",
+ "lcbPgdFtnOld",
+ "fcBkdFtnOld",
+ "lcbBkdFtnOld",
+ "fcPgdEdnOld",
+ "lcbPgdEdnOld",
+ "fcBkdEdnOld",
+ "lcbBkdEdnOld",
+ ]
+ for i in fields:
+ self.printAndSet(i, struct.unpack("<L", self.bytes[self.pos:self.pos+4])[0])
+ self.pos += 4
+
+ def __dumpFibRgFcLcb2002(self):
+ self.__dumpFibRgFcLcb2000()
+ fields = [
+ "fcUnused1",
+ "lcbUnused1",
+ "fcPlcfPgp",
+ "lcbPlcfPgp",
+ "fcPlcfuim",
+ "lcbPlcfuim",
+ "fcPlfguidUim",
+ "lcbPlfguidUim",
+ "fcAtrdExtra",
+ "lcbAtrdExtra",
+ "fcPlrsid",
+ "lcbPlrsid",
+ "fcSttbfBkmkFactoid",
+ "lcbSttbfBkmkFactoid",
+ "fcPlcfBkfFactoid",
+ "lcbPlcfBkfFactoid",
+ "fcPlcfcookie",
+ "lcbPlcfcookie",
+ "fcPlcfBklFactoid",
+ "lcbPlcfBklFactoid",
+ "fcFactoidData",
+ "lcbFactoidData",
+ "fcDocUndo",
+ "lcbDocUndo",
+ "fcSttbfBkmkFcc",
+ "lcbSttbfBkmkFcc",
+ "fcPlcfBkfFcc",
+ "lcbPlcfBkfFcc",
+ "fcPlcfBklFcc",
+ "lcbPlcfBklFcc",
+ "fcSttbfbkmkBPRepairs",
+ "lcbSttbfbkmkBPRepairs",
+ "fcPlcfbkfBPRepairs",
+ "lcbPlcfbkfBPRepairs",
+ "fcPlcfbklBPRepairs",
+ "lcbPlcfbklBPRepairs",
+ "fcPmsNew",
+ "lcbPmsNew",
+ "fcODSO",
+ "lcbODSO",
+ "fcPlcfpmiOldXP",
+ "lcbPlcfpmiOldXP",
+ "fcPlcfpmiNewXP",
+ "lcbPlcfpmiNewXP",
+ "fcPlcfpmiMixedXP",
+ "lcbPlcfpmiMixedXP",
+ "fcUnused2",
+ "lcbUnused2",
+ "fcPlcffactoid",
+ "lcbPlcffactoid",
+ "fcPlcflvcOldXP",
+ "lcbPlcflvcOldXP",
+ "fcPlcflvcNewXP",
+ "lcbPlcflvcNewXP",
+ "fcPlcflvcMixedXP",
+ "lcbPlcflvcMixedXP",
+ ]
+ for i in fields:
+ self.printAndSet(i, struct.unpack("<L", self.bytes[self.pos:self.pos+4])[0])
+ self.pos += 4
+
+ def dumpFibRgFcLcb2002(self, name):
+ print '<%s type="dumpFibRgFcLcb2002" size="744 bytes">' % name
+ self.__dumpFibRgFcLcb2002()
+ print '</%s>' % name
+
+# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list