[Libreoffice-commits] .: 2 commits - src/docrecord.py src/docstream.py

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue Nov 20 08:02:23 PST 2012


 src/docrecord.py |   34 ++++++++++++++++++++++++++++++++++
 src/docstream.py |    8 +++++++-
 2 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit 2436df923e2329ee633d6f084d369ff8a89735b4
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Nov 20 17:02:15 2012 +0100

    start dumping ATRDPre10

diff --git a/src/docrecord.py b/src/docrecord.py
index e79a5c9..a3c6fe6 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -318,6 +318,16 @@ class PnFkpChpx(DOCDirStream):
         chpxFkp.dump()
         print '</%s>' % self.name
 
+class ATRDPre10(DOCDirStream):
+    """The ATRDPre10 structure contains information about a comment in the document."""
+    def __init__(self, aPlcfandRef, offset):
+        DOCDirStream.__init__(self, aPlcfandRef.bytes)
+        self.pos = offset
+
+    def dump(self):
+        print '<aATRDPre10 type="ATRDPre10" offset="%d" size="30 bytes">' % self.pos
+        print '</aATRDPre10>'
+
 class PnFkpPapx(DOCDirStream):
     """The PnFkpPapx structure specifies the offset of a PapxFkp in the WordDocument Stream."""
     def __init__(self, bytes, mainStream, offset, size, name):
@@ -398,6 +408,9 @@ class PlcfandRef(DOCDirStream, PLC):
             print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, start, start + 1)
             pos += 4
 
+            # aATRDPre10
+            aATRDPre10 = ATRDPre10(self, self.getOffset(self.pos, i))
+            aATRDPre10.dump()
             print '</aCP>'
         print '</plcfandRef>'
 
commit af141a7dbfd2e312ff208b65b219e9ac86f081db
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Nov 20 16:43:02 2012 +0100

    dump PlcfandRef

diff --git a/src/docrecord.py b/src/docrecord.py
index 6c51a48..e79a5c9 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -380,6 +380,27 @@ class PlcfandTxt(DOCDirStream, PLC):
             print '</aCP>'
         print '</plcfandTxt>'
 
+class PlcfandRef(DOCDirStream, PLC):
+    """The PlcfandRef structure is a PLC whose data elements are ATRDPre10 structures."""
+    def __init__(self, mainStream, offset, size):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes, mainStream=mainStream)
+        PLC.__init__(self, size, 30)
+        self.pos = offset
+        self.size = size
+
+    def dump(self):
+        print '<plcfandRef type="PlcfandRef" offset="%d" size="%d bytes">' % (self.pos, self.size)
+        offset = self.mainStream.fcMin
+        pos = self.pos
+        for i in range(self.getElements()):
+            start = offset + self.getuInt32(pos = pos)
+            print '<aCP index="%d" commentEndOffset="%d">' % (i, start)
+            print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, start, start + 1)
+            pos += 4
+
+            print '</aCP>'
+        print '</plcfandRef>'
+
 class PlcBtePapx(DOCDirStream, PLC):
     """The PlcBtePapx structure is a PLC that specifies paragraph, table row, or table cell properties."""
     def __init__(self, bytes, mainStream, offset, size):
diff --git a/src/docstream.py b/src/docstream.py
index b98a0fc..928bb29 100755
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -197,7 +197,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcPlcffndTxt"],
             ["lcbPlcffndTxt"],
             ["fcPlcfandRef"],
-            ["lcbPlcfandRef"],
+            ["lcbPlcfandRef", self.handleLcbPlcfandRef],
             ["fcPlcfandTxt"],
             ["lcbPlcfandTxt", self.handleLcbPlcfandTxt],
             ["fcPlcfSed"],
@@ -418,6 +418,12 @@ class WordDocumentStream(DOCDirStream):
         plcfandTxt = docrecord.PlcfandTxt(self, offset, size)
         plcfandTxt.dump()
 
+    def handleLcbPlcfandRef(self):
+        offset = self.fcPlcfandRef
+        size = self.lcbPlcfandRef
+        plcfandRef = docrecord.PlcfandRef(self, offset, size)
+        plcfandRef.dump()
+
     def dumpFibRgFcLcb97(self, name):
         print '<%s type="FibRgFcLcb97" size="744 bytes">' % name
         self.__dumpFibRgFcLcb97()


More information about the Libreoffice-commits mailing list