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

Miklos Vajna vmiklos at kemper.freedesktop.org
Sat Dec 1 09:10:34 PST 2012


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

New commits:
commit 346d0818aad449cf541001a25492eb0c493e3350
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Dec 1 18:09:05 2012 +0100

    dump SttbfAssoc

diff --git a/src/docrecord.py b/src/docrecord.py
index 0da17f8..ebbdfdf 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -1500,6 +1500,48 @@ class SttbfFfn(DOCDirStream):
             print '</cchData>'
         print '</sttbfFfn>'
 
+class SttbfAssoc(DOCDirStream):
+    """The SttbfAssoc structure is an STTB that contains strings which are associated with this document."""
+    def __init__(self, mainStream):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes)
+        self.pos = mainStream.fcSttbfAssoc
+        self.size = mainStream.lcbSttbfAssoc
+        self.mainStream = mainStream
+
+    def dump(self):
+        indexMap = {
+                0x00: "Unused. MUST be ignored.",
+                0x01: "The path of the associated document template (2), if it is not the default Normal template.",
+                0x02: "The title of the document.",
+                0x03: "The subject of the document.",
+                0x04: "Key words associated with the document.",
+                0x05: "Unused. This index MUST be ignored.",
+                0x06: "The author of the document.",
+                0x07: "The user who last revised the document.",
+                0x08: "The path of the associated mail merge data source.",
+                0x09: "The path of the associated mail merge header document.",
+                0x0A: "Unused. This index MUST be ignored.",
+                0x0B: "Unused. This index MUST be ignored.",
+                0x0C: "Unused. This index MUST be ignored.",
+                0x0D: "Unused. This index MUST be ignored.",
+                0x0E: "Unused. This index MUST be ignored.",
+                0x0F: "Unused. This index MUST be ignored.",
+                0x10: "Unused. This index MUST be ignored.",
+                0x11: "The write-reservation password of the document.",
+                }
+        print '<sttbfAssoc type="SttbfAssoc" 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" meaning="%s" offset="%d" size="%d bytes">' % (hex(i), indexMap[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.fcSttbfAssoc + self.size
+        print '</sttbfAssoc>'
+
 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 da069b2..b410e9b 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -268,7 +268,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcDop"],
             ["lcbDop", self.handleDop],
             ["fcSttbfAssoc"],
-            ["lcbSttbfAssoc"],
+            ["lcbSttbfAssoc", self.handleLcbSttbfAssoc],
             ["fcClx"],
             ["lcbClx", self.handleLcbClx],
             ["fcPlcfPgdFtn"],
@@ -483,6 +483,9 @@ class WordDocumentStream(DOCDirStream):
     def handleLcbWss(self):
         docrecord.Selsf(self).dump()
 
+    def handleLcbSttbfAssoc(self):
+        docrecord.SttbfAssoc(self).dump()
+
     def dumpFibRgFcLcb97(self, name):
         print '<%s type="FibRgFcLcb97" size="744 bytes">' % name
         self.__dumpFibRgFcLcb97()


More information about the Libreoffice-commits mailing list