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

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Jan 11 04:03:08 PST 2013


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

New commits:
commit 614d9656f45bb48580eee2453b13b351b12a0bcd
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Jan 11 13:02:56 2013 +0100

    dump SttbListNames

diff --git a/src/docrecord.py b/src/docrecord.py
index ef87891..fb1c5dc 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -2557,4 +2557,25 @@ class PlfLfo(DOCDirStream):
             self.pos = lfoData.pos
         print '</plfLfo>'
 
+class SttbListNames(DOCDirStream):
+    """The SttbListNames structure is an STTB structure whose strings are the names used by the LISTNUM field."""
+    def __init__(self, mainStream):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes, mainStream=mainStream)
+        self.pos = mainStream.fcSttbListNames
+        self.size = mainStream.lcbSttbListNames
+
+    def dump(self):
+        print '<sttbListNames type="SttbListNames" 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.fcSttbListNames + self.size
+        print '</sttbListNames>'
+
 # vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
diff --git a/src/docstream.py b/src/docstream.py
index 648fe81..6edb4b5 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -386,7 +386,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcPlcfGram"],
             ["lcbPlcfGram", self.handleLcbPlcfGram],
             ["fcSttbListNames"],
-            ["lcbSttbListNames"],
+            ["lcbSttbListNames", self.handleLcbSttbListNames],
             ["fcSttbfUssr"],
             ["lcbSttbfUssr"],
                 ]
@@ -524,6 +524,9 @@ class WordDocumentStream(DOCDirStream):
     def handleLcbPlfLfo(self):
         docrecord.PlfLfo(self).dump()
 
+    def handleLcbSttbListNames(self):
+        docrecord.SttbListNames(self).dump()
+
     def dumpFibRgFcLcb97(self, name):
         print '<%s type="FibRgFcLcb97" size="744 bytes">' % name
         self.__dumpFibRgFcLcb97()


More information about the Libreoffice-commits mailing list