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

Miklos Vajna vmiklos at kemper.freedesktop.org
Fri Nov 9 07:38:11 PST 2012


 src/docrecord.py |    7 ++-
 src/docsprm.py   |   98 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+), 3 deletions(-)

New commits:
commit f6e54cf23853aa2096f90d204749c36dcf1c4cd0
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Nov 9 16:38:04 2012 +0100

    add names for sprm opcodes

diff --git a/src/docrecord.py b/src/docrecord.py
index 44552bb..bc83750 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -1,8 +1,9 @@
 #!/usr/bin/env python
 
 import struct
-from docdirstream import DOCDirStream
 import globals
+from docdirstream import DOCDirStream
+import docsprm
 
 class FcCompressed(DOCDirStream):
     """The FcCompressed structure specifies the location of text in the WordDocument Stream."""
@@ -130,8 +131,8 @@ class Sprm(DOCDirStream):
                 4: 'section',
                 5: 'table'
                 }
-        print '<sprm value="%s" ispmd="%s" fSpec="%s" sgc="%s" spra="%s" operandSize="%s" operand="%s"/>' % (
-                hex(self.sprm), hex(self.ispmd), hex(self.fSpec), sgcmap[self.sgc], hex(self.spra), self.getOperandSize(), hex(self.operand)
+        print '<sprm value="%s" name="%s" ispmd="%s" fSpec="%s" sgc="%s" spra="%s" operandSize="%s" operand="%s"/>' % (
+                hex(self.sprm), docsprm.parMap[self.sprm], hex(self.ispmd), hex(self.fSpec), sgcmap[self.sgc], hex(self.spra), self.getOperandSize(), hex(self.operand)
                 )
 
     def getOperandSize(self):
diff --git a/src/docsprm.py b/src/docsprm.py
new file mode 100755
index 0000000..b60d782
--- /dev/null
+++ b/src/docsprm.py
@@ -0,0 +1,98 @@
+#!/usr/bin/env python
+
+# see 2.6.2 of the spec
+parMap = {
+    0x4600: "sprmPIstd",
+    0xC601: "sprmPIstdPermute",
+    0x2602: "sprmPIncLvl",
+    0x2403: "sprmPJc80",
+    0x2405: "sprmPFKeep",
+    0x2406: "sprmPFKeepFollow",
+    0x2407: "sprmPFPageBreakBefore",
+    0x260A: "sprmPIlvl",
+    0x460B: "sprmPIlfo",
+    0x240C: "sprmPFNoLineNumb",
+    0xC60D: "sprmPChgTabsPapx",
+    0x840E: "sprmPDxaRight80",
+    0x840F: "sprmPDxaLeft80",
+    0x4610: "sprmPNest80",
+    0x8411: "sprmPDxaLeft180",
+    0x6412: "sprmPDyaLine",
+    0xA413: "sprmPDyaBefore",
+    0xA414: "sprmPDyaAfter",
+    0xC615: "sprmPChgTabs",
+    0x2416: "sprmPFInTable",
+    0x2417: "sprmPFTtp",
+    0x8418: "sprmPDxaAbs",
+    0x8419: "sprmPDyaAbs",
+    0x841A: "sprmPDxaWidth",
+    0x261B: "sprmPPc",
+    0x2423: "sprmPWr",
+    0x6424: "sprmPBrcTop80",
+    0x6425: "sprmPBrcLeft80",
+    0x6426: "sprmPBrcBottom80",
+    0x6427: "sprmPBrcRight80",
+    0x6428: "sprmPBrcBetween80",
+    0x6629: "sprmPBrcBar80",
+    0x242A: "sprmPFNoAutoHyph",
+    0x442B: "sprmPWHeightAbs",
+    0x442C: "sprmPDcs",
+    0x442D: "sprmPShd80",
+    0x842E: "sprmPDyaFromText",
+    0x842F: "sprmPDxaFromText",
+    0x2430: "sprmPFLocked",
+    0x2431: "sprmPFWidowControl",
+    0x2433: "sprmPFKinsoku",
+    0x2434: "sprmPFWordWrap",
+    0x2435: "sprmPFOverflowPunct",
+    0x2436: "sprmPFTopLinePunct",
+    0x2437: "sprmPFAutoSpaceDE",
+    0x2438: "sprmPFAutoSpaceDN",
+    0x4439: "sprmPWAlignFont",
+    0x443A: "sprmPFrameTextFlow",
+    0x2640: "sprmPOutLvl",
+    0x2441: "sprmPFBiDi",
+    0x2443: "sprmPFNumRMIns",
+    0xC645: "sprmPNumRM",
+    0x6646: "sprmPHugePapx",
+    0x2447: "sprmPFUsePgsuSettings",
+    0x2448: "sprmPFAdjustRight",
+    0x6649: "sprmPItap",
+    0x664A: "sprmPDtap",
+    0x244B: "sprmPFInnerTableCell",
+    0x244C: "sprmPFInnerTtp",
+    0xC64D: "sprmPShd",
+    0xC64E: "sprmPBrcTop",
+    0xC64F: "sprmPBrcLeft",
+    0xC650: "sprmPBrcBottom",
+    0xC651: "sprmPBrcRight",
+    0xC652: "sprmPBrcBetween",
+    0xC653: "sprmPBrcBar",
+    0x4455: "sprmPDxcRight",
+    0x4456: "sprmPDxcLeft",
+    0x4457: "sprmPDxcLeft1",
+    0x4458: "sprmPDylBefore",
+    0x4459: "sprmPDylAfter",
+    0x245A: "sprmPFOpenTch",
+    0x245B: "sprmPFDyaBeforeAuto",
+    0x245C: "sprmPFDyaAfterAuto",
+    0x845D: "sprmPDxaRight",
+    0x845E: "sprmPDxaLeft",
+    0x465F: "sprmPNest",
+    0x8460: "sprmPDxaLeft1",
+    0x2461: "sprmPJc",
+    0x2462: "sprmPFNoAllowOverlap",
+    0x2664: "sprmPWall",
+    0x6465: "sprmPIpgp",
+    0xC666: "sprmPCnf",
+    0x6467: "sprmPRsid",
+    0xC669: "sprmPIstdListPermute",
+    0x646B: "sprmPTableProps",
+    0xC66C: "sprmPTIstdInfo",
+    0x246D: "sprmPFContextualSpacing",
+    0xC66F: "sprmPPropRMark",
+    0x2470: "sprmPFMirrorIndents",
+    0x2471: "sprmPTtwo",
+        }
+
+# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list