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

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue Jan 15 06:57:55 PST 2013


 src/docrecord.py |   24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

New commits:
commit aaaa9d2cad6f5578fae09cc80e4c8c52e2c5fc57
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 15 15:57:38 2013 +0100

    Sprm::dump: make this more robust

diff --git a/src/docrecord.py b/src/docrecord.py
index 74eecdf..5210db5 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -539,16 +539,24 @@ class Sprm(DOCDirStream):
                 4: docsprm.secMap,
                 5: docsprm.tblMap,
                 }
-        if self.ct:
-            operandstr = ""
-        else:
+        attrs = []
+        close = False
+        attrs.append('value="%s"' % hex(self.sprm))
+        attrs.append('ispmd="%s"' % hex(self.ispmd))
+        attrs.append('fSpec="%s"' % hex(self.fSpec))
+        if self.sgc in sgcmap:
+            attrs.append('sgc="%s"' % sgcmap[self.sgc])
+        attrs.append('spra="%s"' % self.spra)
+        if self.sgc in nameMap and self.sprm in nameMap[self.sgc]:
+            attrs.append('name="%s"' % nameMap[self.sgc][self.sprm])
+        attrs.append('operandSize="%s"' % self.getOperandSize())
+        if not self.ct:
+            close = True
             if self.operand == "todo":
-                operandstr = ' operand=""/'
+                attrs.append('operand=""')
             else:
-                operandstr = ' operand="%s"/' % hex(self.operand)
-        print '<sprm value="%s" name="%s" ispmd="%s" fSpec="%s" sgc="%s" spra="%s" operandSize="%s"%s>' % (
-                hex(self.sprm), nameMap[self.sgc][self.sprm], hex(self.ispmd), hex(self.fSpec), sgcmap[self.sgc], hex(self.spra), self.getOperandSize(), operandstr
-                )
+                attrs.append('operand="%s"' % hex(self.operand))
+        print '<sprm %s%s>' % (" ".join(attrs), {True:"/", False:""}[close])
         if self.ct:
             self.ct.dump()
             print '</sprm>'


More information about the Libreoffice-commits mailing list