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

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue Jan 15 05:07:31 PST 2013


 src/docrecord.py |   23 +++++++++++++++++++++++
 src/docstream.py |   14 ++++++++++++--
 2 files changed, 35 insertions(+), 2 deletions(-)

New commits:
commit 1939456abbceb45214659363e529036f835be87d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 15 13:58:49 2013 +0100

    dump SttbSavedBy

diff --git a/src/docrecord.py b/src/docrecord.py
index 389e609..74eecdf 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -2580,4 +2580,25 @@ class SttbListNames(DOCDirStream):
         assert self.pos == self.mainStream.fcSttbListNames + self.size
         print '</sttbListNames>'
 
+class SttbSavedBy(DOCDirStream):
+    """The SttbSavedBy structure is an STTB structure that specifies the save history of this document."""
+    def __init__(self, mainStream):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes, mainStream=mainStream)
+        self.pos = mainStream.fcSttbSavedBy
+        self.size = mainStream.lcbSttbSavedBy
+
+    def dump(self):
+        print '<sttbSavedBy type="SttbSavedBy" offset="%d" size="%d">' % (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.fcSttbSavedBy + self.size
+        print '</sttbSavedBy>'
+
 # vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
diff --git a/src/docstream.py b/src/docstream.py
index 8ee68c5..7633ccc 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -353,7 +353,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcRouteSlip"],
             ["lcbRouteSlip"],
             ["fcSttbSavedBy"],
-            ["lcbSttbSavedBy"],
+            ["lcbSttbSavedBy", self.handleLcbSttbSavedBy],
             ["fcSttbFnm"],
             ["lcbSttbFnm"],
             ["fcPlfLst"],
@@ -525,6 +525,9 @@ class WordDocumentStream(DOCDirStream):
     def handleLcbPlcfGram(self):
         docrecord.PlcfGram(self).dump()
 
+    def handleLcbSttbSavedBy(self):
+        docrecord.SttbSavedBy(self).dump()
+
     def handleLcbPlfLst(self):
         docrecord.PlfLst(self).dump()
 
commit 6a095ad00fea30934ab7742a3e6d56cbcc891b25
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 15 13:46:12 2013 +0100

    Dop: handle nFibNew == 0xd9

diff --git a/src/docrecord.py b/src/docrecord.py
index fb1c5dc..389e609 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -1609,6 +1609,8 @@ class Dop(DOCDirStream):
         print '<dop type="Dop" offset="%s" size="%d bytes">' % (self.pos, self.size)
         if self.fib.nFibNew == 0:
             Dop97(self).dump()
+        elif self.fib.nFibNew == 0x00d9:
+            Dop2000(self).dump()
         elif self.fib.nFibNew == 0x0112:
             Dop2007(self).dump()
         else:
diff --git a/src/docstream.py b/src/docstream.py
index 6edb4b5..8ee68c5 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -88,6 +88,8 @@ class WordDocumentStream(DOCDirStream):
         self.printAndSet("nFibNew", self.readuInt16())
         if self.nFibNew == 0x0112:
             self.dumpFibRgCswNewData2007("fibRgCswNewData2007")
+        elif self.nFibNew == 0x00D9:
+            self.dumpFibRgCswNewData2000("fibRgCswNewData2000")
         else:
             print """<todo what="dumpFibRgCswNew() doesn't know how to handle nFibNew = %s"/>""" % hex(self.nFibNew)
         print '</%s>' % name
@@ -95,6 +97,11 @@ class WordDocumentStream(DOCDirStream):
     def __dumpFibRgCswNewData2000(self):
         self.printAndSet("cQuickSavesNew", self.readuInt16())
 
+    def dumpFibRgCswNewData2000(self, name):
+        print '<%s type="FibRgCswNewData2000" size="%d bytes">' % (name, 8)
+        self.__dumpFibRgCswNewData2000()
+        print '</%s>' % name
+
     def dumpFibRgCswNewData2007(self, name):
         print '<%s type="FibRgCswNewData2007" size="%d bytes">' % (name, 8)
         self.__dumpFibRgCswNewData2000()
@@ -406,7 +413,7 @@ class WordDocumentStream(DOCDirStream):
             value = self.readInt32()
             hasHandler = len(i) > 1
             # the spec says these must be ignored
-            needsIgnoring = ["lcbStshfOrig"]
+            needsIgnoring = ["lcbStshfOrig", "lcbPlcfBteLvc"]
             if self.ccpHdd == 0:
                 needsIgnoring.append("lcbPlcfHdd")
             # a member needs handling if it defines the size of a struct and it's non-zero


More information about the Libreoffice-commits mailing list