[ooo-build-commit] .: scratch/mso-dumper

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Mar 22 19:52:55 PDT 2010


 scratch/mso-dumper/src/msodraw.py   |   33 +++++++++++++++++++++++++++++++++
 scratch/mso-dumper/src/xlsrecord.py |    7 +++++++
 scratch/mso-dumper/src/xlsstream.py |    2 +-
 3 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit a79bd5d4a99cb16e976467e05cc1b4f70afe915d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Mar 22 22:52:33 2010 -0400

    [mso-dumper] Pick up Excel's MSODRAWINGSELECTION records.
    
    * scratch/mso-dumper/src/msodraw.py:
    * scratch/mso-dumper/src/xlsrecord.py:
    * scratch/mso-dumper/src/xlsstream.py:

diff --git a/scratch/mso-dumper/src/msodraw.py b/scratch/mso-dumper/src/msodraw.py
index 239d43f..92090ad 100644
--- a/scratch/mso-dumper/src/msodraw.py
+++ b/scratch/mso-dumper/src/msodraw.py
@@ -26,6 +26,7 @@
 ########################################################################
 
 import globals
+import sys
 
 def indent (level):
     return '  '*level
@@ -47,6 +48,7 @@ class RecordHeader:
         FSP                     = 0xF00A
         FOPT                    = 0xF00B
         FConnectorRule          = 0xF012
+        FDGSL                   = 0xF119
         SplitMenuColorContainer = 0xF11E
 
     containerTypeNames = {
@@ -61,6 +63,7 @@ class RecordHeader:
         Type.FSP:                     'OfficeArtFSP',
         Type.FSPGR:                   'OfficeArtFSPGR',
         Type.FConnectorRule:          'OfficeArtFConnectorRule',
+        Type.FDGSL:                   'OfficeArtFDGSL',
         Type.SplitMenuColorContainer: 'OfficeArtSplitMenuColorContainer'
     }
 
@@ -183,6 +186,33 @@ class FDGGBlock:
             idcl.appendLines(recHdl, rh)
 
 
+class FDGSL:
+    selectionMode = {
+        0x00000000: 'default state',
+        0x00000001: 'ready to rotate',
+        0x00000002: 'ready to change the curvature of line shapes',
+        0x00000007: 'ready to crop the picture'
+    }
+
+    def __init__ (self, strm):
+        self.cpsp = strm.readUnsignedInt(4)  # the spec says undefined.
+        self.dgslk = strm.readUnsignedInt(4) # selection mode
+        self.shapeFocus = strm.readUnsignedInt(4) # shape ID in focus
+        self.shapesSelected = []
+        shapeCount = (strm.getSize() - 20)/4
+        for i in xrange(0, shapeCount):
+            spid = strm.readUnsignedInt(4)
+            self.shapesSelected.append(spid)
+
+    def appendLines (self, recHdl, rh):
+        recHdl.appendLine("FDGSL content:")
+        recHdl.appendLine("  selection mode: %s"%
+            globals.getValueOrUnknown(FDGSL.selectionMode, self.dgslk))
+        recHdl.appendLine("  ID of shape in focus: %d"%self.shapeFocus)
+        for shape in self.shapesSelected:
+            recHdl.appendLine("  ID of shape selected: %d"%shape)
+
+
 class FOPT:
     """property table for a shape instance"""
 
@@ -518,6 +548,9 @@ class MSODrawHandler(globals.ByteStream):
             elif rh.recType == RecordHeader.Type.FConnectorRule:
                 fcon = FConnectorRule(self)
                 fcon.appendLines(self.parent, rh)
+            elif rh.recType == RecordHeader.Type.FDGSL:
+                fdgsl = FDGSL(self)
+                fdgsl.appendLines(self.parent, rh)
             elif rh.recType == RecordHeader.Type.SplitMenuColorContainer:
                 smcc = SplitMenuColorContainer(self)
                 smcc.appendLines(self.parent, rh)
diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index 80be3d1..e01b836 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -2760,3 +2760,10 @@ class MSODrawingGroup(BaseRecordHandler):
     def parseBytes (self):
         msoHdl = msodraw.MSODrawHandler(self.bytes, self)
         msoHdl.parseBytes()
+
+
+class MSODrawingSelection(BaseRecordHandler):
+
+    def parseBytes (self):
+        msoHdl = msodraw.MSODrawHandler(self.bytes, self)
+        msoHdl.parseBytes()
diff --git a/scratch/mso-dumper/src/xlsstream.py b/scratch/mso-dumper/src/xlsstream.py
index 9e099f6..759fcb3 100644
--- a/scratch/mso-dumper/src/xlsstream.py
+++ b/scratch/mso-dumper/src/xlsstream.py
@@ -162,7 +162,7 @@ recData = {
     0x00EA: ["TABIDCONF", "Sheet Tab ID of Conflict History"],
     0x00EB: ["MSODRAWINGGROUP", "Microsoft Office Drawing Group", xlsrecord.MSODrawingGroup],
     0x00EC: ["MSODRAWING", "Microsoft Office Drawing", xlsrecord.MSODrawing],
-    0x00ED: ["MSODRAWINGSELECTION", "Microsoft Office Drawing Selection"],
+    0x00ED: ["MSODRAWINGSELECTION", "Microsoft Office Drawing Selection", xlsrecord.MSODrawingSelection],
     0x00EF: ["PHONETIC", "Asian Phonetic Settings", xlsrecord.PhoneticInfo],
     0x00F0: ["SXRULE", "PivotTable Rule Data"],
     0x00F1: ["SXEX", "PivotTable View Extended Information"],


More information about the ooo-build-commit mailing list