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

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Dec 3 02:31:53 PST 2012


 src/docrecord.py |   22 ++++++++++++++++++++++
 src/docstream.py |    5 ++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit 8578f5e40cc8ac46e7aca4acb71f0628e2d9f41a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Dec 3 11:31:47 2012 +0100

    dump SttbfRMark

diff --git a/src/docrecord.py b/src/docrecord.py
index ebbdfdf..5e2b87a 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -1542,6 +1542,28 @@ class SttbfAssoc(DOCDirStream):
         assert self.pos == self.mainStream.fcSttbfAssoc + self.size
         print '</sttbfAssoc>'
 
+class SttbfRMark(DOCDirStream):
+    """The SttbfRMark structure is an STTB structure where the strings specify the names of the authors of the revision marks, comments, and e-mail messages in the document."""
+    def __init__(self, mainStream):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes)
+        self.pos = mainStream.fcSttbfRMark
+        self.size = mainStream.lcbSttbfRMark
+        self.mainStream = mainStream
+
+    def dump(self):
+        print '<sttbfRMark type="SttbfRMark" offset="%d" size="%d bytes">' % (self.pos, self.size)
+        self.printAndSet("fExtend", self.readuInt16())
+        self.printAndSet("cData", self.readuInt16())
+        self.printAndSet("cbExtra", self.readuInt16())
+        for i in range(self.cData):
+            cchData = self.readuInt16()
+            print '<cchData index="%s" offset="%d" size="%d bytes">' % (i, self.pos, cchData)
+            print '<string value="%s"/>' % globals.encodeName(self.bytes[self.pos:self.pos+2*cchData].decode('utf-16'), lowOnly = True)
+            self.pos += 2*cchData
+            print '</cchData>'
+        assert self.pos == self.mainStream.fcSttbfRMark + self.size
+        print '</sttbfRMark>'
+
 class ATNBE(DOCDirStream):
     """The ATNBE structure contains information about an annotation bookmark in the document."""
     size = 10 # in bytes, see 2.9.4
diff --git a/src/docstream.py b/src/docstream.py
index b410e9b..0a99009 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -306,7 +306,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcDggInfo"],
             ["lcbDggInfo"],
             ["fcSttbfRMark"],
-            ["lcbSttbfRMark"],
+            ["lcbSttbfRMark", self.handleLcbSttbfRMark],
             ["fcSttbfCaption"],
             ["lcbSttbfCaption"],
             ["fcSttbfAutoCaption"],
@@ -486,6 +486,9 @@ class WordDocumentStream(DOCDirStream):
     def handleLcbSttbfAssoc(self):
         docrecord.SttbfAssoc(self).dump()
 
+    def handleLcbSttbfRMark(self):
+        docrecord.SttbfRMark(self).dump()
+
     def dumpFibRgFcLcb97(self, name):
         print '<%s type="FibRgFcLcb97" size="744 bytes">' % name
         self.__dumpFibRgFcLcb97()


More information about the Libreoffice-commits mailing list