[ooo-build-commit] 3 commits - scratch/mso-dumper

Thorsten Behrens thorsten at kemper.freedesktop.org
Thu Sep 24 06:33:35 PDT 2009


 scratch/mso-dumper/src/globals.py   |    9 ++-
 scratch/mso-dumper/src/pptrecord.py |  104 +++++++++++++++++++++++++++++++++++-
 scratch/mso-dumper/src/pptstream.py |   10 +--
 3 files changed, 114 insertions(+), 9 deletions(-)

New commits:
commit 59dbe71b818341eb40acbe9df92f493400e26287
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Thu Sep 24 13:41:58 2009 +0200

    Added handler for InteractiveAtom
    
    * scratch/mso-dumper/src/pptrecord.py:
    * scratch/mso-dumper/src/pptstream.py:

diff --git a/scratch/mso-dumper/src/pptrecord.py b/scratch/mso-dumper/src/pptrecord.py
index 24c0706..78b7bfb 100644
--- a/scratch/mso-dumper/src/pptrecord.py
+++ b/scratch/mso-dumper/src/pptrecord.py
@@ -313,6 +313,27 @@ class ObjectRefAtom(BaseRecordHandler):
 
 
 # -------------------------------------------------------------------
+# special record handler: object ref atom
+
+class InteractiveInfoAtom(BaseRecordHandler):
+    """Interaction info atom."""
+
+    actionDesc=["noAction","macroAction","runProgramAction","jumpAction","hyperlinkAction",
+                "oleAction","mediaAction","customShowAction"]
+    def parseBytes (self):
+        self.appendLine("sound object id: %Xh"%self.readUnsignedInt(4))
+        self.appendLine("external hyperlink id: %Xh"%self.readUnsignedInt(4))
+        self.appendLine("action: %s"%self.actionDesc[self.readUnsignedInt(1)])
+        self.appendLine("ole verb id: %d"%self.readUnsignedInt(1))
+        flags = self.readUnsignedInt(1)
+        self.appendLine("animated button: %s"%((flags & 0x01)!=0))
+        self.appendLine("stop sound: %s"%((flags & 0x02)!=0))
+        self.appendLine("custom show return: %s"%((flags & 0x04)!=0))
+        self.appendLine("interaction visited: %s"%((flags & 0x08)!=0))
+        self.appendLine("hyperlink type: %d"%self.readUnsignedInt(1))
+
+
+# -------------------------------------------------------------------
 # special record handler: document atom
 
 class DocAtom(BaseRecordHandler):
@@ -387,6 +408,7 @@ class AnimationInfo(BaseRecordHandler):
         self.appendLine("synchronous: %d"%((flags & 0x00000020)!=0))
         self.appendLine("hide: %d"%((flags & 0x00000040)!=0))
         self.appendLine("animateBackground: %d"%((flags & 0x00000080)!=0))
+        self.appendLine("associated shape: %d"%((flags & 0x00004000)!=0))
 
         self.appendLine("sound reference ID: %Xh"%self.readUnsignedInt(4))
         self.appendLine("delay time: %d"%self.readUnsignedInt(4))
diff --git a/scratch/mso-dumper/src/pptstream.py b/scratch/mso-dumper/src/pptstream.py
index 61e3317..3734b4a 100644
--- a/scratch/mso-dumper/src/pptstream.py
+++ b/scratch/mso-dumper/src/pptstream.py
@@ -337,7 +337,7 @@ recData = {
  4080:  ["DFF_PST_SlideListWithText"],
  4081:  ["DFF_PST_AnimationInfoAtom", pptrecord.AnimationInfo],
  4082:  ["DFF_PST_InteractiveInfo"],
- 4083:  ["DFF_PST_InteractiveInfoAtom"],
+ 4083:  ["DFF_PST_InteractiveInfoAtom", pptrecord.InteractiveInfoAtom],
  4084:  ["DFF_PST_SlideList"],
  4085:  ["DFF_PST_UserEditAtom"],
  4086:  ["DFF_PST_CurrentUserAtom"],
commit 0e1fa3a779b47a06ac6e1bd1ee0d26ae8cdc2de7
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Wed Sep 23 15:59:47 2009 +0200

    Added handling of ExObjRefAtom
    
    * scratch/mso-dumper/src/pptrecord.py:
    * scratch/mso-dumper/src/pptstream.py:

diff --git a/scratch/mso-dumper/src/pptrecord.py b/scratch/mso-dumper/src/pptrecord.py
index f8c8764..24c0706 100644
--- a/scratch/mso-dumper/src/pptrecord.py
+++ b/scratch/mso-dumper/src/pptrecord.py
@@ -303,6 +303,16 @@ class MediaAtom(BaseRecordHandler):
 
 
 # -------------------------------------------------------------------
+# special record handler: object ref atom
+
+class ObjectRefAtom(BaseRecordHandler):
+    """Object reference atom."""
+
+    def parseBytes (self):
+        self.appendLine("external object id: %Xh"%self.readUnsignedInt(4))
+
+
+# -------------------------------------------------------------------
 # special record handler: document atom
 
 class DocAtom(BaseRecordHandler):
diff --git a/scratch/mso-dumper/src/pptstream.py b/scratch/mso-dumper/src/pptstream.py
index 9429756..61e3317 100644
--- a/scratch/mso-dumper/src/pptstream.py
+++ b/scratch/mso-dumper/src/pptstream.py
@@ -270,7 +270,7 @@ recData = {
  2031:  ["DFF_PST_Int4ArrayAtom"],
  2032:  ["DFF_PST_ColorSchemeAtom", pptrecord.ColorScheme],
  3008:  ["DFF_PST_OEShape"],
- 3009:  ["DFF_PST_ExObjRefAtom"],
+ 3009:  ["DFF_PST_ExObjRefAtom", pptrecord.ObjectRefAtom],
  3011:  ["DFF_PST_OEPlaceholderAtom"],
  3020:  ["DFF_PST_GrColor"],
  3025:  ["DFF_PST_GrectAtom"],
commit 6b321e5522f51549657c24603968ee7efc8a0754
Author: Thorsten Behrens <tbehrens at novell.com>
Date:   Wed Sep 23 15:39:09 2009 +0200

    Proper string termination, media/sound grokking added
    
    * scratch/mso-dumper/src/globals.py:
    * scratch/mso-dumper/src/pptrecord.py:
    * scratch/mso-dumper/src/pptstream.py:

diff --git a/scratch/mso-dumper/src/globals.py b/scratch/mso-dumper/src/globals.py
index e39bb11..df0c161 100644
--- a/scratch/mso-dumper/src/globals.py
+++ b/scratch/mso-dumper/src/globals.py
@@ -239,9 +239,14 @@ def getUTF8FromUTF16 (bytes):
     text = ''
     for i in xrange(0, loopCount):
         code = ''
-        if bytes[i*2+1] != '\x00':
+        lsbZero = bytes[i*2] == '\x00'
+        msbZero = bytes[i*2+1] == '\x00'
+        if msbZero and lsbZero:
+            return text
+        
+        if not msbZero:
             code += bytes[i*2+1]
-        if bytes[i*2] != '\x00':
+        if not lsbZero:
             code += bytes[i*2]
         try:    
             text += unicode(code, 'utf-8')
diff --git a/scratch/mso-dumper/src/pptrecord.py b/scratch/mso-dumper/src/pptrecord.py
index f341f06..f8c8764 100644
--- a/scratch/mso-dumper/src/pptrecord.py
+++ b/scratch/mso-dumper/src/pptrecord.py
@@ -139,12 +139,13 @@ class FontEntity(BaseRecordHandler):
     """Font entity."""
 
     def parseBytes (self):
-        faceName       = globals.getUTF8FromUTF16(globals.getTextBytes(self.readBytes(64)))
+        faceName       = globals.getUTF8FromUTF16(
+            globals.getTextBytes(self.readBytes(64)))
         charSet        = self.readUnsignedInt(1)
         flags          = self.readUnsignedInt(1)
         fontType       = self.readUnsignedInt(1)
         pitchAndFamily = self.readUnsignedInt(1)
-        self.appendLine("Font: name=%s charset=%d flags=0x%x type=%d family=%d"%(faceName, charSet, flags, fontType, pitchAndFamily))
+        self.appendLine("Font: name=\"%s\" charset=%d flags=0x%x type=%d family=%d"%(faceName, charSet, flags, fontType, pitchAndFamily))
 
 # -------------------------------------------------------------------
 # special record handler: properties
@@ -277,6 +278,31 @@ class TextHeader(BaseRecordHandler):
 
 
 # -------------------------------------------------------------------
+# special record handler: embedded wav atom
+
+class EmbeddedWav(BaseRecordHandler):
+    """Wav atom."""
+
+    def parseBytes (self):
+        self.appendLine("sound id: %Xh"%self.readUnsignedInt(4))
+        self.appendLine("sound len: %d bytes"%self.readUnsignedInt(4))
+
+
+# -------------------------------------------------------------------
+# special record handler: media atom
+
+class MediaAtom(BaseRecordHandler):
+    """Media atom."""
+
+    def parseBytes (self):
+        self.appendLine("id: %Xh"%self.readUnsignedInt(4))
+        flags = self.readUnsignedInt(2)
+        self.appendLine("loop: %s"%((flags & 0x0001)!=0))
+        self.appendLine("rewind: %s"%((flags & 0x0002)!=0))
+        self.appendLine("is narration: %s"%((flags & 0x0004)!=0))
+
+
+# -------------------------------------------------------------------
 # special record handler: document atom
 
 class DocAtom(BaseRecordHandler):
@@ -514,6 +540,48 @@ class AnimValue(BaseRecordHandler):
         self.valueHandlers[valueType](self)
 
 
+class AnimReference(BaseRecordHandler):
+    """Animation reference object."""
+
+    def handleDefault (self,type,mode):
+        self.appendLine("unknown ref kind: %Xh (mode %Xh)"%(type,mode))
+
+    def handleShapeAsWhole (self,type,mode):
+        self.appendLine("whole shape animation: shape ID %d"%self.readUnsignedInt(4))
+
+    def handleShapeOnePara (self,type,mode):
+        self.appendLine("one paragraph of shape: shape ID %d"%self.readUnsignedInt(4))
+        self.appendLine("begin character: %d"%self.readSignedInt(4))
+        self.appendLine("end character: %d"%self.readSignedInt(4))
+
+    def handleShapeOnlyBackground (self,type,mode):
+        self.appendLine("only background of shape: shape ID %d"%self.readUnsignedInt(4))
+
+    def handleShapeOnlyText (self,type,mode):
+        self.appendLine("only text content of shape: shape ID %d"%self.readUnsignedInt(4))
+
+    shapeRefModeHandler=[handleShapeAsWhole,handleDefault,handleShapeOnePara,
+                         handleDefault,handleDefault,handleDefault,
+                         handleShapeOnlyBackground,handleDefault,handleShapeOnlyText]
+    def handleShape (self,type,mode):
+        self.shapeRefModeHandler[mode](self,type,mode)
+
+    def handleSound (self,type,mode):
+        self.appendLine("sound object: ID %d"%self.readUnsignedInt(4))
+
+    def handleAudio (self,type,mode):
+        self.appendLine("audio shape: shape ID %d"%self.readUnsignedInt(4))
+
+    def handleVideo (self,type,mode):
+        self.appendLine("video shape: shape ID %d"%self.readUnsignedInt(4))
+
+    refTypeHandler=[handleDefault,handleShape,handleSound,handleAudio,handleVideo]
+    def parseBytes (self):
+        refMode = self.readUnsignedInt(4)
+        refType = self.readUnsignedInt(4)
+        self.refTypeHandler[refType](self,refType,refMode)
+
+
 # -------------------------------------------------------------------
 # special record handlers: text style properties
 
diff --git a/scratch/mso-dumper/src/pptstream.py b/scratch/mso-dumper/src/pptstream.py
index a495413..9429756 100644
--- a/scratch/mso-dumper/src/pptstream.py
+++ b/scratch/mso-dumper/src/pptstream.py
@@ -345,7 +345,7 @@ recData = {
  4088:  ["DFF_PST_GenericDateMCAtom"],
  4089:  ["DFF_PST_HeaderMCAtom"],
  4090:  ["DFF_PST_FooterMCAtom"],
- 4100:  ["DFF_PST_ExMediaAtom"],
+ 4100:  ["DFF_PST_ExMediaAtom", pptrecord.MediaAtom],
  4101:  ["DFF_PST_ExVideo"],
  4102:  ["DFF_PST_ExAviMovie"],
  4103:  ["DFF_PST_ExMCIMovie"],
@@ -355,7 +355,7 @@ recData = {
  4112:  ["DFF_PST_ExWAVAudioLink"],
  4113:  ["DFF_PST_ExOleObjStg"],
  4114:  ["DFF_PST_ExCDAudioAtom"],
- 4115:  ["DFF_PST_ExWAVAudioEmbeddedAtom"],
+ 4115:  ["DFF_PST_ExWAVAudioEmbeddedAtom", pptrecord.EmbeddedWav],
  4116:  ["DFF_PST_AnimationInfo"],
  4117:  ["DFF_PST_RTFDateTimeMCAtom"],
  5000:  ["DFF_PST_ProgTags"],
@@ -408,7 +408,7 @@ recData = {
 0xF015: ["DFF_msofbtClientRule"],
 0xF017: ["DFF_msofbtCalloutRule"],
 
-0x2AFB: ["DFF_msofbtAnimReference"],
+0x2AFB: ["DFF_msofbtAnimReference", pptrecord.AnimReference],
 0xF125: ["DFF_msofbtAnimEvent"],
 0xF127: ["DFF_msofbtAnimNode", pptrecord.AnimNode],
 0xF128: ["DFF_msofbtAnimTrigger", pptrecord.AnimTrigger],


More information about the ooo-build-commit mailing list