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

Miklos Vajna vmiklos at collabora.co.uk
Sun Apr 6 06:28:29 PDT 2014


 msodumper/docrecord.py |   33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

New commits:
commit b70d0f07e654c4a7dbf46ef5a70a3c94440546e8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sun Apr 6 15:27:14 2014 +0200

    doc: dump SHDOperand and SHD

diff --git a/msodumper/docrecord.py b/msodumper/docrecord.py
index eaac4ff..61512d7 100644
--- a/msodumper/docrecord.py
+++ b/msodumper/docrecord.py
@@ -1109,6 +1109,21 @@ Fts = {
 }
 
 
+class SHD(DOCDirStream):
+    """The Shd structure specifies the colors and pattern that are used for background shading."""
+    def __init__(self, parent):
+        DOCDirStream.__init__(self, parent.bytes)
+        self.parent = parent
+        self.pos = parent.pos
+
+    def dump(self):
+        print '<shd type="SHD" offset="%d">' % self.pos
+        COLORREF(self).dump("cvFore")
+        COLORREF(self).dump("cvBack")
+        self.printAndSet("ipat", self.readuInt16(), dict=Ipat)
+        print '</shd>'
+
+
 class TCGRF(DOCDirStream):
     """A TCGRF structure specifies the text layout and cell merge properties for a single cell in a table."""
     def __init__(self, parent):
@@ -1174,6 +1189,20 @@ class TDefTableOperand(DOCDirStream):
         print '</tDefTableOperand>'
 
 
+class SHDOperand(DOCDirStream):
+    """The SDHOperand structure is an operand that is used by several Sprm
+    structures to specify the background shading to be applied."""
+    def __init__(self, parent):
+        DOCDirStream.__init__(self, parent.bytes)
+        self.pos = parent.pos
+
+    def dump(self):
+        print '<shdOperand>'
+        self.printAndSet("cb", self.readuInt8())
+        SHD(self).dump()
+        print '</shdOperand>'
+
+
 class BrcOperand(DOCDirStream):
     """The BrcOperand structure is the operand to several SPRMs that control borders."""
     def __init__(self, parent):
@@ -1245,6 +1274,10 @@ class Sprm(DOCDirStream):
         else:
             if self.sprm == 0xd608:
                 self.ct = TDefTableOperand(self)
+            elif self.sprm == 0xca71:
+                self.ct = SHDOperand(self)
+            else:
+                print '<todo what="Sprm::__init__() unhandled sprm of size %s: %s"/>' % (self.getOperandSize(), hex(self.sprm))
 
     def dump(self):
         sgcmap = {


More information about the Libreoffice-commits mailing list