[Libreoffice-commits] mso-dumper.git: 2 commits - msodumper/docrecord.py

Miklos Vajna vmiklos at collabora.co.uk
Fri Dec 4 08:04:56 PST 2015


 msodumper/docrecord.py |   45 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 42 insertions(+), 3 deletions(-)

New commits:
commit 3d44b9bd4d980508cac74bcb36eb4bf2d2f24b31
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 4 17:04:32 2015 +0100

    docrecord: dump PropertyBag

diff --git a/msodumper/docrecord.py b/msodumper/docrecord.py
index 6468346..bf315e1 100644
--- a/msodumper/docrecord.py
+++ b/msodumper/docrecord.py
@@ -4209,6 +4209,42 @@ class PropertyBagStore(DOCDirStream):
             self.stringTable.append(string)
         print '</stringTable>'
         print '</propBagStore>'
+        self.parent.pos = self.pos
+
+
+class Property(DOCDirStream):
+    """Specified by [MS-OSHARED] 2.3.4.4, specifies the indexes into the string
+    table entries of the stringTable field."""
+    def __init__(self, parent, index):
+        DOCDirStream.__init__(self, parent.bytes)
+        self.parent = parent
+        self.pos = parent.pos
+        self.index = index
+
+    def dump(self):
+        print '<property type="Property" offset="%s" index="%s">' % (self.pos, self.index)
+        self.printAndSet("keyIndex", self.readuInt32(), hexdump=False)
+        self.printAndSet("valueIndex", self.readuInt32(), hexdump=False)
+        print '</property>'
+        self.parent.pos = self.pos
+
+
+class PropertyBag(DOCDirStream):
+    """Specified by [MS-OSHARED] 2.3.4.3, specifies the smart tag data."""
+    def __init__(self, parent):
+        DOCDirStream.__init__(self, parent.bytes)
+        self.parent = parent
+        self.pos = parent.pos
+
+    def dump(self):
+        print '<propBag type="PropertyBag" offset="%s">' % self.pos
+        self.printAndSet("id", self.readuInt16())
+        self.printAndSet("cProp", self.readuInt16())
+        self.printAndSet("cbUnknown", self.readuInt16())
+        for i in range(self.cProp):
+            Property(self, i).dump()
+        print '</propBag>'
+        self.parent.pos = self.pos
 
 
 class SmartTagData(DOCDirStream):
@@ -4223,6 +4259,9 @@ class SmartTagData(DOCDirStream):
         print '<smartTagData type="SmartTagData" offset="%d" size="%d bytes">' % (self.pos, self.size)
         self.propBagStore = PropertyBagStore(self)
         self.propBagStore.dump()
+        # TODO this is an array in fact
+        self.propBag = PropertyBag(self)
+        self.propBag.dump()
         print '</smartTagData>'
 
 
commit f1c33abd03aa5bbc9098ebe9c62248ef5e77ae69
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Dec 4 15:49:59 2015 +0100

    docrecord: fix dumping multiple FACTOIDINFO in SttbfBkmkFactoid

diff --git a/msodumper/docrecord.py b/msodumper/docrecord.py
index ca54445..6468346 100644
--- a/msodumper/docrecord.py
+++ b/msodumper/docrecord.py
@@ -4318,11 +4318,11 @@ class SttbfBkmkFactoid(DOCDirStream):
         self.printAndSet("cData", self.readuInt16())
         self.printAndSet("cbExtra", self.readuInt16())
         assert self.cbExtra == 0
-        self.printAndSet("cchData", self.readuInt16())
-        assert self.cchData == 0x6
         for i in range(self.cData):
+            self.printAndSet("cchData", self.readuInt16())
+            assert self.cchData == 0x6
             FACTOIDINFO(self).dump()
-        assert self.pos == self.mainStream.fcSttbfBkmk + self.size
+        assert self.pos == self.mainStream.fcSttbfBkmkFactoid + self.size
         print '</sttbfBkmkFactoid>'
 
 # vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list